Compare commits

...

118 commits
2.5 ... master

Author SHA1 Message Date
Richard Goedeken
47f8e92e9a
Merge pull request #91 from orbea/strict-aliasing
build: remove -fno-strict-aliasing
2024-11-03 17:44:22 -08:00
orbea
1b7c25cdaa build: remove -fno-strict-aliasing
It compiles with -Werror=strict-aliasing so this is not required.
2024-11-03 12:34:08 -08:00
orbea
5532574896 Remove executable permissions from the Makefile
mode change 100755 => 100644 projects/unix/Makefile
2024-11-03 12:32:20 -08:00
Richard Goedeken
2798e65d6f update version and release info for v2.6.0 release 2024-07-14 17:36:33 -07:00
Richard Goedeken
d972dc5ea1 update minimum macos SDK in makefile 2024-07-14 12:01:02 -07:00
Richard Goedeken
9d13986f76
Merge pull request #90 from Jj0YzL5nvJ/up2024
CI/CD: Update to generic scripts, independent schedule, etc
2024-05-26 19:56:29 -07:00
Jj0YzL5nvJ
1d690fd8a6 CI/CD: Update to generic scripts, independent schedule, etc 2024-05-24 11:17:26 -06:00
Richard Goedeken
f01be76948
Merge pull request #89 from Clownacy/patch-1
Fix check for M64P_BIG_ENDIAN
2024-01-12 20:21:12 -08:00
Clownacy
47f8cee6ce
Fix check for M64P_BIG_ENDIAN
Every check for M64P_BIG_ENDIAN in the emulator core only checks for its definition, not for its value being non-zero.
2024-01-10 17:33:07 +00:00
Richard Goedeken
f22dc14377
Merge pull request #88 from Jj0YzL5nvJ/up2023
CI/CD: Add BLAKE2 hashfile
2023-06-11 12:18:52 -07:00
Jj0YzL5nvJ
6b53db06de CI/CD: Add BLAKE2 hashfile 2023-05-22 00:24:57 -06:00
Richard Goedeken
bbfba920fc
Merge pull request #87 from Jj0YzL5nvJ/ci-schedule
CI/CD: Integrate scheduled builds and other...
2023-03-02 21:59:57 -08:00
Jj0YzL5nvJ
4ff2fe6a19 CI/CD: Integrate scheduled builds and other necessary updates 2023-02-14 23:49:33 -06:00
Richard Goedeken
ca917cec14
Merge pull request #86 from Jj0YzL5nvJ/up2022
CI/CD: Update MSVC
2022-09-30 16:59:21 -07:00
Jj0YzL5nvJ
fdebc89484 CI/CD: Update MSVC 2022-09-27 23:36:03 -06:00
Richard Goedeken
aa0ea78030
Merge pull request #85 from Jj0YzL5nvJ/ci-update
CI/CD: Update
2022-07-13 19:30:22 -07:00
Jj0YzL5nvJ
3cdee61a98 CI/CD: Update 2022-07-10 18:52:10 -06:00
bsmiles32
27580a8c33
Merge pull request #84 from derselbst/cbfd-overload
Added overload distortion effect, used by a few tracks in CBFD
2022-04-24 22:03:47 +02:00
derselbst
21b669e8a3 Add a comment regarding mp3 and cbfd ucode differences 2022-04-24 17:22:50 +02:00
Tom M
9452b4a181 Apply suggestions from code review
Co-authored-by: bsmiles32 <bobby.smiles32@gmail.com>
2022-04-24 17:13:43 +02:00
Richard Goedeken
2ae723c33b
Merge pull request #82 from Jj0YzL5nvJ/ci-github
CI/CD: Implement GitHub Actions and public nightly builds
2022-04-11 20:55:33 -07:00
Josh Ware
37682c2a12 Added overload distortion effect, used by a few tracks in CBFD 2022-02-14 19:46:05 +01:00
bsmiles32
4bac3aeb98
Merge pull request #83 from fzurita/out_of_bounds_access
Fix out of bounds memory access encountered in CBFD
2022-01-16 18:29:31 +01:00
fzurita
53e6c6a143 Fix out of bounds memory access encountered in CBFD 2022-01-16 12:26:06 -05:00
Jj0YzL5nvJ
51345ed0e5 CI/CD: Implement GitHub Actions and public nightly builds 2021-12-05 09:00:32 -07:00
Pierce Andjelkovic
88093cb434 RISC-V Support 2021-09-15 00:02:11 +02:00
Richard Goedeken
88766c6e2d bump up minimum version number so that we can still build this on modern macos 2021-02-10 21:14:23 -08:00
orbea
e653930d75 build: Allow out of tree builds.
Also fixes a case of SRCDIR being used before its set.
2020-12-15 10:17:15 +01:00
Gilles Siberlin
bb56985770
Merge pull request #79 from loganmc10/ub
Fix undefined behavior
2020-10-21 15:49:47 +02:00
Logan McNaughton
2f42716781 Fix undefined behavior 2020-10-19 10:46:51 -07:00
Richard Goedeken
b4155b7004 Revert "Allow non-default compilers without resorting to symbolic links"
This reverts commit 0ff1d46edf, as it conflicts with GNU make which always defines default values for certain variables
2020-09-16 22:31:15 -07:00
Richard Goedeken
72a1deca7d
Merge pull request #77 from Jj0YzL5nvJ/alter_cc_cxx
Allow non-default compilers without resorting to symbolic links
2020-08-31 21:19:30 -07:00
Jj0YzL5nvJ
0ff1d46edf Allow non-default compilers without resorting to symbolic links 2020-08-30 03:46:09 -06:00
Richard Goedeken
4e61df6a25
Merge pull request #76 from Jj0YzL5nvJ/alter
Allow to set custom platform toolset from commands
2020-08-19 23:36:36 -07:00
Jj0YzL5nvJ
d12cd46872 Allow to set custom platform toolset from commands 2020-08-13 11:58:07 -06:00
Jj0YzL5nvJ
2df8038d5f AppVeyor with artifact packaging 2020-03-02 09:38:16 +01:00
Jj0YzL5nvJ
7d9293ad91 Changes to have more generic project files 2020-02-26 12:39:06 +01:00
Gillou68310
f295d34727 Fix HVQM Implementation 2020-02-21 09:14:06 +01:00
Gillou68310
25b83af2f4 Rework task dispatching implementation 2020-02-20 15:49:07 +01:00
Gillou68310
fa00bf82fd Implement HVQM ucode 2020-02-03 20:50:27 +01:00
Gillou68310
c05c5e0fab Preliminary implementation for Yakouchuu II ucode 2020-02-02 12:11:05 +01:00
Gillou68310
7ea802e76e Migrate to VS2017 2019-11-13 17:15:02 +01:00
Richard Goedeken
f01fed082a add function attributes so GCC can find bugs in calls to string formatting functions with variadic arguments 2019-03-03 09:30:19 -08:00
Richard Goedeken
16c31f09c0
Merge pull request #68 from djames1/master
Added ppc64le support
2019-02-21 21:43:52 -08:00
Daniel James
42ffe474b2 Added ppc64le support 2019-02-20 11:29:49 -05:00
Richard Goedeken
7b1a2094a0 update version and release info for v2.5.9 BETA release 2019-02-10 10:13:29 -08:00
Richard Goedeken
e7b0182fb1 fix Travis CI test builds for MXE 32 and 64 bits 2019-01-29 22:13:25 -08:00
Richard Goedeken
e2adb502c6
Merge pull request #67 from bugfood/fix-nosaveoptions
Remove use of ConfigSaveSection
2019-01-23 21:58:30 -08:00
Corey Hickey
5e0c36f188 Remove use of ConfigSaveSection
Known front-ends have been modified to save configuration after plugin
initialization but before running the game. Now it is no longer
necessary for individual plugins to save their config.

Removing calls to ConfigSaveSection from within plugins makes the
mupen64plus-ui-console '--nosaveoptions' parameter work.
2019-01-22 21:05:11 -08:00
Richard Goedeken
1233981129
Merge pull request #66 from bkeys/makefile_aarch64
Makefile aarch64
2018-09-21 20:23:15 -07:00
Brigham Henry Keys
ba228af849 Removed redundant CPU detection 2018-09-21 02:40:39 -05:00
Brigham Henry Keys
f6ef6b076c Added support for aarch64 2018-09-19 12:09:10 -05:00
Brigham Henry Keys
6e9600cc5b Added support for aarch64 2018-09-19 12:05:32 -05:00
Richard Goedeken
bb52e1ad68
Merge pull request #65 from loganmc10/patch-4
Indi and Naboo now have an HLE implementation
2018-05-26 08:30:47 -07:00
Logan
febfc28730
Indi and Naboo now have an HLE implementation 2018-05-26 07:49:23 -06:00
Richard Goedeken
8a5fb80d28
Merge pull request #64 from loganmc10/patch-3
Remove WDC and Stunt Racer from LLE list
2018-02-12 08:14:55 -08:00
Logan
b7da074c41
Remove WDC and Stunt Racer from LLE list 2018-02-12 06:08:43 -07:00
Richard Goedeken
2e4171499c update FSF address in license 2018-02-04 12:58:57 -08:00
bsmiles32
7418dd6a5f
Merge pull request #63 from bentley/master
Update homepage links
2018-01-01 17:47:01 +01:00
Anthony J. Bentley
7178086ff3 Update homepage. 2017-12-28 16:27:32 -07:00
Anthony J. Bentley
9229360df6 Update link to bug tracker. 2017-12-28 16:06:05 -07:00
Richard Goedeken
d9c297ce25
Merge pull request #62 from Gillou68310/mi_intr
Don't set MI_INTR_SP if task is not finished yet
2017-12-15 18:14:25 -08:00
Gillou68310
9d8e4e370e Don't set MI_INTR_SP if task is not finished yet 2017-12-14 16:37:46 +01:00
Gillou68310
4e116a85a1 Don't disable HLE GFX if no fallback available 2017-12-14 16:37:32 +01:00
Gillou68310
b636701967 Use integers instead of float 2017-12-14 09:12:08 +01:00
bsmiles32
b7e1df3f6c
Merge pull request #61 from Gillou68310/re2
Implement RE2 fill video double buffer ucode
2017-12-14 01:56:01 +01:00
Gillou68310
57a20e4c0b Implement RE2 fill video double buffer ucode 2017-12-13 21:28:36 +01:00
Richard Goedeken
8860a7e63d
Merge pull request #60 from StenApp/patch-1
Update jpeg.c
2017-12-04 21:46:15 -08:00
Sten
3042d32ea5
Update jpeg.c
Truncation warning
2017-12-02 22:31:25 +01:00
Richard Goedeken
a3690d9280
Merge pull request #59 from loganmc10/patch-2
If DEBUG not set, set NDEBUG
2017-11-30 19:37:02 -08:00
Logan
06c8ec7c2c
If DEBUG not set, set NDEBUG 2017-11-30 10:59:57 -07:00
Richard Goedeken
421e97ce45 update Makefile method for finding OSX_SDK_PATH 2017-11-14 16:21:30 -08:00
Dorian Fevrier
0806227ce9
Merge pull request #58 from charlemagnelasse/travis-mxe
Build MXE targets as additional tests in travis build matrix
2017-11-06 12:19:35 +01:00
Charlemagne Lasse
9faf92fadf Build MXE targets as additional tests in travis build matrix 2017-11-05 15:35:14 +01:00
bsmiles32
053e99826f
Merge pull request #54 from bsmiles32/lle_fallback
Implement RSP fallback.
2017-11-01 19:12:13 +01:00
Bobby Smiles
db5bce48bd Remove Gauntlet legend settings override. 2017-10-27 23:18:20 +02:00
Bobby Smiles
1b47eea6fa Set TASK_DONE, BROKE, HALT bits before calling ProcessDlistList function 2017-10-13 19:56:41 +02:00
Dorian Fevrier
47de8d2c66 Merge pull request #56 from mupen64plus/revert-55-sdl2
Revert "Update to VS2015"
2017-10-13 09:54:16 +02:00
Dorian Fevrier
935522a54e Revert "Update to VS2015" 2017-10-13 09:53:48 +02:00
Dorian Fevrier
cdd404b7e2 Merge pull request #55 from loganmc10/sdl2
Update to VS2015
2017-10-13 09:53:31 +02:00
Logan McNaughton
15e20ce808 Add AppVeyor script 2017-10-11 10:33:42 -06:00
Logan McNaughton
cbfce2a22c Visual Studio 2015 2017-10-10 14:57:44 -06:00
Bobby Smiles
b94f7bbdf7 Stub 2 new audio ucodes found in 64DD conversions carts. 2017-10-04 18:48:06 +02:00
Bobby Smiles
58f14e391c Fix: task type 7 should not be "discarded" after calling ShowCFB.
This matches the cxd4 plugin behavior and fixes Pokemon Puzzle league.
2017-10-04 18:47:42 +02:00
Bobby Smiles
b53a5d8422 Implement RSP fallback.
This allows to specify an arbitrary RSP plugin to use when an unknown
ucode is encountered. It is particularly usefull when combined with an
LLE RSP plugin.

Sending audio lists or display lists to audio (resp. gfx) plugins can
also be specified through config parameters. A blacklist of known
problematic gfx ucodes is integrated (same as rsp-cxd4) to avoid sending
them to the gfx plugin.
2017-10-04 18:47:42 +02:00
bsmiles32
cb34bbd39c Merge pull request #53 from Gillou68310/re2
Implement RE2 video frame decoding ucode
2017-10-04 18:27:54 +02:00
Gillou68310
0c6c0784f2 Implement RE2 video frame decoding ucode 2017-09-19 11:58:13 +02:00
bsmiles32
0cc2f05460 Merge pull request #51 from bsmiles32/task_done
Let each ucode specify how sp status should be modified.
2017-09-15 00:46:20 +02:00
Bobby Smiles
5437128c67 Let each ucode specify how sp status should be modified.
Most ucodes are executed until task is done (in one go).
However, some ucodes (yet to be implemented such as wdc zsort) may need
to yield thus not setting task done flag.
This should be stricly equivalent to previous code, just with more
flexibility should we add yielding support.
2017-08-09 08:09:09 +02:00
bsmiles32
5252ff28a5 Merge pull request #52 from derselbst/macros
specify audio ucode flags explicitly
2017-08-09 00:42:46 -05:00
derselbst
8576bcdd79 specify audio ucode flags explicitly 2017-08-01 11:14:53 +02:00
Tom M
8ddd361992 specify audio ucode flags explicitly
for increased readability
2017-07-31 17:04:14 +02:00
Bobby Smiles
842d62d41e Revert "Allow using compiler other than gcc"
This reverts commit f5838d8c48.
2017-06-24 13:34:45 -06:00
bsmiles32
9e8644b09b Merge pull request #47 from fzurita/master
Prevent yet one more illegal access to alist_buffer
2017-06-22 20:32:00 -06:00
bsmiles32
54767eff73 Merge pull request #48 from loganmc10/patch-1
Allow using compiler other than gcc
2017-06-22 20:21:15 -06:00
Logan McNaughton
f5838d8c48 Allow using compiler other than gcc 2017-06-20 21:15:38 -06:00
Francisco Zurita
ef6a5a2f6e Prevent yet one more illegal access to alist_buffer 2017-06-05 23:08:15 -04:00
bsmiles32
4023936c63 Merge pull request #46 from bsmiles32/re2
Add support for Re2 bilinear resizing
2017-06-02 07:29:59 -06:00
Bobby Smiles
4f77c93a2f Re2: Add support for other regions 2017-06-02 15:11:27 +02:00
Bobby Smiles
2f9a16cb3c Fix unused variable warning. 2017-06-02 15:11:13 +02:00
Gillou68310
a339dc66b6 Resident evil 2 resize bilinear ucode 2017-06-02 14:55:43 +02:00
bsmiles32
e42940878c Merge pull request #45 from fzurita/fix_more_crashes
Prevent more illegal accesses of alist_buffer
2017-05-23 16:35:22 -06:00
Francisco Zurita
e29dce8f6b Prevent more illegal accesses of alist_buffer 2017-04-28 09:00:09 -04:00
Richard Goedeken
fb15d2040a Merge pull request #44 from fzurita/fix_crash
Prevent CLEARBUFF for naudio and nead from deriving a count too big for alist_buffer
2017-04-05 23:06:14 -07:00
Francisco Zurita
f5818d4fc5 Prevent CLEARBUFF for naudio and nead from deriving a count too big for
alist_buffer.

alist_buffer max size is 0x1000, so using 0xFFF as mask
2017-03-23 08:50:24 -04:00
Richard Goedeken
1f8a4cb7ba Merge pull request #43 from fzurita/master
Backport fixes from Project64
2017-03-16 22:54:22 -07:00
Francisco Zurita
0898913beb Backport fixes from Project64
Specifically
848502e088
5b546a0fcb
2017-03-05 00:14:43 -05:00
Richard Goedeken
f3acff42b8 Merge pull request #42 from charlemagnelasse/travis-container
Use faster container based Travis CI
2017-02-01 22:21:15 -08:00
Charlemagne Lasse
c557db8d9c Use faster container based Travis CI 2016-12-16 22:24:02 +01:00
Richard Goedeken
13770ff899 Merge pull request #41 from charlemagnelasse/master
Use Ubuntu Trusty as base system for Travis CI
2016-09-01 18:04:07 -07:00
Charlemagne Lasse
fa38ab2d8a Use Ubuntu Trusty as base system for Travis CI 2016-09-01 20:23:59 +02:00
Richard Goedeken
3d09ae67d7 change VS2013 project files to build with the XP-compatible vc120 toolset, so the resulting binaries will run on pre-vista machines 2016-07-13 20:04:06 -07:00
Richard Goedeken
526a7bc8e5 Merge pull request #40 from loganmc10/master
Backports from project64
2016-07-12 19:20:54 -07:00
Logan McNaughton
1381ee5f62 Backports from project64, see:
b187ad9b81
210832c618
c06ad3a276
2016-06-14 10:24:51 -06:00
Richard Goedeken
95f3bab72b Merge pull request #38 from Gillou68310/x64
Added x64 configuration to VisualStudio2013 project file
2015-09-12 21:52:27 -07:00
Gillou68310
d7e051b4c9 Added x64 configuration to VisualStudio2013 project file 2015-08-28 16:19:18 +02:00
Richard Goedeken
5d66105bda Merge pull request #37 from bentley/openbsd
Remove unnecessary OpenBSD warning.
2015-06-08 06:31:34 -07:00
Anthony J. Bentley
1e977b16d6 Remove unnecessary OpenBSD warning. 2015-06-08 01:48:45 -06:00
34 changed files with 1999 additions and 230 deletions

152
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,152 @@
name: HLE RSP
on:
push:
paths-ignore:
- '.{gitattributes,gitignore,travis.yml}'
- '*.md,appveyor.yml,README'
pull_request:
paths-ignore:
- '.{gitattributes,gitignore,travis.yml}'
- '*.md,appveyor.yml,README'
workflow_dispatch:
jobs:
Linux:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
- cc: GCC
arch: x86
- cc: Clang
arch: x64
- cc: Clang
arch: x86
name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Get build dependencies and arrange the environment
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
./../mupen64plus-core/.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Build and related stuff, backup binaries
run: |
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
./../mupen64plus-core/.github/workflows/scripts/ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg
- name: Upload artifact
if: matrix.cc == 'GCC'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*.tar.gz
MSYS2:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
cross: x86_64
env: MINGW64
- cc: GCC
arch: x86
cross: i686
env: MINGW32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: windows-2022
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.env }}
update: true
install: >-
git
libtool
make
mingw-w64-${{ matrix.cross }}-gcc
mingw-w64-${{ matrix.cross }}-toolchain
mingw-w64-${{ matrix.cross }}-ntldd
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
./../mupen64plus-core/.github/workflows/scripts/ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Backup dependencies, etc...
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_backup_mingw_deps.sh ${{ matrix.env }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
MSVC:
strategy:
fail-fast: false
matrix:
include:
- toolset: v143
arch: x64
vs: 2022
- toolset: v141_xp
arch: x86
vs: 2019
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }}
runs-on: windows-${{ matrix.vs }}
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core
set TOOLSET=${{ matrix.toolset }}
.\..\mupen64plus-core\.github\workflows\scripts\ci_msvc_build.cmd ${{ matrix.arch }}
- name: Backup dependencies, etc...
run: |
.\..\mupen64plus-core\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
Nightly-build:
runs-on: ubuntu-latest
if: github.ref_name == 'master'
needs: [Linux, MSYS2, MSVC]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: binaries
- name: Get some tools
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
sudo apt-get update
sudo apt-get -y install hashdeep
- name: Creating new artifacts and update nightly-build
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_nightly_artifacts.sh
- name: Nightly-build
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: false
tag: nightly-build
artifacts: pkg/*

148
.github/workflows/schedule.yml vendored Normal file
View file

@ -0,0 +1,148 @@
name: HLE RSP - Scheduled
on:
schedule:
- cron: '30 14 21 * *'
jobs:
Linux:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
- cc: GCC
arch: x86
- cc: Clang
arch: x64
- cc: Clang
arch: x86
name: Linux / ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: ubuntu-22.04
if: github.repository == 'mupen64plus/mupen64plus-rsp-hle'
steps:
- uses: actions/checkout@v4
- name: Get build dependencies and arrange the environment
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
./../mupen64plus-core/.github/workflows/scripts/ci_install_ubuntu_deps.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Build and related stuff, backup binaries
run: |
export C_CLANG_SUFFIX="-15" C_GCC_SUFFIX="-12"
./../mupen64plus-core/.github/workflows/scripts/ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }} makepkg
- name: Upload artifact
if: matrix.cc == 'GCC'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*.tar.gz
MSYS2:
strategy:
fail-fast: false
matrix:
include:
- cc: GCC
arch: x64
cross: x86_64
env: MINGW64
- cc: GCC
arch: x86
cross: i686
env: MINGW32
name: Windows / MSYS2 ${{ matrix.cc }} / ${{ matrix.arch }}
runs-on: windows-2022
if: github.repository == 'mupen64plus/mupen64plus-rsp-hle'
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.env }}
update: true
install: >-
git
libtool
make
mingw-w64-${{ matrix.cross }}-gcc
mingw-w64-${{ matrix.cross }}-toolchain
mingw-w64-${{ matrix.cross }}-ntldd
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
./../mupen64plus-core/.github/workflows/scripts/ci_build.sh ${{ matrix.arch }} ${{ matrix.cc }}
- name: Backup dependencies, etc...
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_backup_mingw_deps.sh ${{ matrix.env }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
MSVC:
strategy:
fail-fast: false
matrix:
include:
- toolset: v143
arch: x64
vs: 2022
- toolset: v141_xp
arch: x86
vs: 2019
name: Windows / MSVC with ${{ matrix.toolset }} / ${{ matrix.arch }}
runs-on: windows-${{ matrix.vs }}
if: github.repository == 'mupen64plus/mupen64plus-rsp-hle'
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Build and related stuff, backup binaries
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core
set TOOLSET=${{ matrix.toolset }}
.\..\mupen64plus-core\.github\workflows\scripts\ci_msvc_build.cmd ${{ matrix.arch }}
- name: Backup dependencies, etc...
run: |
.\..\mupen64plus-core\.github\workflows\scripts\ci_backup_msvc_deps.cmd ${{ matrix.arch }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NAME }}
path: pkg/*
Nightly-build:
runs-on: ubuntu-latest
if: github.ref_name == 'master'
needs: [Linux, MSYS2, MSVC]
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: binaries
- name: Get some tools
run: |
git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ../mupen64plus-core
sudo apt-get update
sudo apt-get -y install hashdeep
- name: Creating new artifacts and update nightly-build
run: |
./../mupen64plus-core/.github/workflows/scripts/ci_nightly_artifacts.sh
- name: Nightly-build
uses: ncipollo/release-action@v1
with:
prerelease: true
allowUpdates: true
removeArtifacts: true
replacesArtifacts: false
tag: nightly-build
artifacts: pkg/*

View file

@ -1,13 +1,46 @@
sudo: required
dist: xenial
language: cpp
compiler:
- gcc
- clang
addons:
apt:
packages:
- git
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y git
- git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
env:
- DUMP=0
- DUMP=1
script:
- make -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean && LDFLAGS="-Wl,--no-add-needed -Wl,--no-undefined" OPTFLAGS="-O2" make CC="${CC}" CXX="${CXX}" -j$(nproc) -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 all
# extra mxe build entries
matrix:
include:
- env:
- MXE_CPU=i686
- PATH="/usr/lib/mxe/usr/bin/:$PATH"
before_install:
- curl -sSL "https://mirror.mxe.cc/repos/apt/client-conf/mxeapt.gpg" | sudo -E apt-key add -
- echo "deb https://mirror.mxe.cc/repos/apt xenial main" | sudo tee -a /etc/apt/sources.list
- sudo apt-get update -qq
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-gcc
- git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
script:
- make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean &&
make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 -j$(nproc) all
- env:
- MXE_CPU=x86_64
- PATH="/usr/lib/mxe/usr/bin/:$PATH"
before_install:
- curl -sSL "https://mirror.mxe.cc/repos/apt/client-conf/mxeapt.gpg" | sudo -E apt-key add -
- echo "deb https://mirror.mxe.cc/repos/apt xenial main" | sudo tee -a /etc/apt/sources.list
- sudo apt-get update -qq
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-gcc
- git clone --depth=1 --branch=master git://github.com/mupen64plus/mupen64plus-core.git deps/mupen64plus-core
script:
- make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 clean &&
make UNAME=MINGW CROSS_COMPILE="${MXE_CPU}-w64-mingw32.shared-" CC="${MXE_CPU}-w64-mingw32.shared-gcc" CXX="${MXE_CPU}-w64-mingw32.shared-g++" HOST_CPU="${MXE_CPU}" -C projects/unix APIDIR="$(pwd)/deps/mupen64plus-core/src/api/" V=1 -j$(nproc) all

View file

@ -30,7 +30,7 @@ Mupen64Plus is based on GPL-licensed source code from Mupen64 v0.5, originally w
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

65
RELEASE
View file

@ -1,6 +1,71 @@
RSP High-Level Emulation plugin for Mupen64Plus
-----------------------------------------------
--------------------------------------------
# Mupen64Plus-rsp-hle v2.6.0 - July 14, 2024
## Merged PRs
* [90](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/90): CI/CD: Update to generic scripts, independent schedule, etc
* [89](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/89): Fix check for M64P_BIG_ENDIAN
* [88](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/88): CI/CD: Add BLAKE2 hashfile
* [87](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/87): CI/CD: Integrate scheduled builds and other...
* [86](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/86): CI/CD: Update MSVC
* [85](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/85): CI/CD: Update
* [84](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/84): Added overload distortion effect, used by a few tracks in CBFD
* [83](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/83): Fix out of bounds memory access encountered in CBFD
* [82](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/82): CI/CD: Implement GitHub Actions and public nightly builds
* [81](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/81): Add RISC-V Support
* [80](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/80): build: Allow out of tree builds.
* [79](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/79): Fix undefined behavior
* [77](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/77): Allow non-default compilers without resorting to symbolic links
* [76](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/76): Allow to set custom platform toolset from commands
* [75](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/75): AppVeyor with artifact packaging
* [74](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/74): Fix HQVM implementation
* [73](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/73): Rework task dispatching implementation
* [72](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/72): Changes to have more generic project files
* [70](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/70): Implement HVQM ucode
* [69](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/69): Integrate Hvqm preliminary work (not fully functional yet)
* [68](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/68): Added ppc64le support
## Top Contributors (2 or more commits)
1. Jj0YzL5nvJ
2. richard42
3. Gillou68310
4. derselbst
------------------------------------------------
# Mupen64Plus-rsp-hle v2.5.9 - February 10, 2019
## Merged PRs
* [67](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/67): Remove use of ConfigSaveSection
* [66](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/66): Makefile aarch64
* [65](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/65): Indi and Naboo now have an HLE implementation
* [64](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/64): Remove WDC and Stunt Racer from LLE list
* [63](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/63): Update homepage links
* [62](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/62): Don't set MI_INTR_SP if task is not finished yet
* [61](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/61): Implement RE2 fill video double buffer ucode
* [60](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/60): Update jpeg.c
* [59](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/59): If DEBUG not set, set NDEBUG
* [58](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/58): Build MXE targets as additional tests in travis build matrix
* [54](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/54): Implement RSP fallback.
* [53](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/53): Implement RE2 video frame decoding ucode
* [52](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/52): specify audio ucode flags explicitly
* [51](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/51): Let each ucode specify how sp status should be modified.
* [47](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/47): Prevent yet one more illegal access to alist_buffer
* [46](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/46): Add support for Re2 bilinear resizing
* [45](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/45): Prevent more illegal accesses of alist_buffer
* [44](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/44): Prevent CLEARBUFF for naudio and nead from deriving a count too big for alist_buffer
* [43](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/43): Backport fixes from Project64
* [42](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/42): Use faster container based Travis CI
* [41](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/41): Use Ubuntu Trusty as base system for Travis CI
* [40](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/40): Backports from project64
* [38](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/38): Added x64 configuration to VisualStudio2013 project file
* [37](https://github.com/mupen64plus/mupen64plus-rsp-hle/pull/37): Remove unnecessary OpenBSD warning.
Mupen64Plus-rsp-hle v2.5 - April 26, 2015
-------------------------------------------------
- Game-specific fixes: Bottom of the 9th, IndianaJones, BattleForNaboo, Conkers Bad Fur Day

40
appveyor.yml Normal file
View file

@ -0,0 +1,40 @@
version: 1.0.{build}
image: Visual Studio 2022
skip_tags: true
skip_commits:
files:
- '**/*.md'
- .github/
- data/*
- .gitattributes
- .gitignore
- .travis.yml
- README
configuration:
- Release
platform:
- Win32
- x64
before_build:
- git tag --delete nightly-build
- git clone --depth 1 https://github.com/mupen64plus/mupen64plus-core.git ..\mupen64plus-core
build_script:
- msbuild projects\msvc\mupen64plus-rsp-hle.vcxproj /p:Configuration=%configuration%;Platform=%platform%
after_build:
- ps: $env:rev1 = git describe --tags
- set rev2=%platform%
- if "%rev2%"=="Win32" set rev2=x86
- set filepkg=mupen64plus-rsp-hle_v%rev1%_%rev2%
- cd projects\msvc\%platform%\%configuration%
- 7z a -t7z ..\..\..\..\build\%filepkg%.7z *.dll
artifacts:
- path: build\$(filepkg).7z
name: $(filepkg)

View file

@ -1,31 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{2EC7CEE3-C7A7-4F2E-B2C8-4DF6AFEC3E9A}</ProjectGuid>
<RootNamespace>mupen64plusrsphle</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and '$(VisualStudioVersion)' != '14.0'">
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
<TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(PlatformToolset)'=='' or '$(PlatformToolset)'=='v100'" Label="Configuration">
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v120</PlatformToolset>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v120</PlatformToolset>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -33,43 +63,42 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -77,18 +106,33 @@
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\mupen64plus-core\src\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;inline=__inline;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@ -99,11 +143,14 @@
<ClCompile Include="..\..\src\audio.c" />
<ClCompile Include="..\..\src\cicx105.c" />
<ClCompile Include="..\..\src\hle.c" />
<ClCompile Include="..\..\src\hvqm.c" />
<ClCompile Include="..\..\src\jpeg.c" />
<ClCompile Include="..\..\src\memory.c" />
<ClCompile Include="..\..\src\mp3.c" />
<ClCompile Include="..\..\src\musyx.c" />
<ClCompile Include="..\..\src\osal_dynamiclib_win32.c" />
<ClCompile Include="..\..\src\plugin.c" />
<ClCompile Include="..\..\src\re2.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\alist.h" />
@ -114,6 +161,7 @@
<ClInclude Include="..\..\src\hle_external.h" />
<ClInclude Include="..\..\src\hle_internal.h" />
<ClInclude Include="..\..\src\memory.h" />
<ClInclude Include="..\..\src\osal_dynamiclib.h" />
<ClInclude Include="..\..\src\ucodes.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

75
projects/unix/Makefile Executable file → Normal file
View file

@ -1,6 +1,6 @@
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# * mupen64plus-rsp-hle - Makefile *
# * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
# * Mupen64Plus homepage: https://mupen64plus.org/ *
# * Copyright (C) 2008-2009 Richard Goedeken *
# * Copyright (C) 2007-2008 DarkJeztr Tillin9 *
# * *
@ -53,7 +53,6 @@ ifeq ("$(UNAME)","OpenBSD")
OS = FREEBSD
SO_EXTENSION = so
SHARED = -shared
$(warning OS type "$(UNAME)" not officially supported.')
endif
ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
OS = LINUX
@ -67,7 +66,7 @@ ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
PIC = 0
endif
ifeq ("$(OS)","NONE")
$(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
$(error OS type "$(UNAME)" not supported. Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues')
endif
# detect system architecture
@ -103,6 +102,13 @@ ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
PIC ?= 1
$(warning Architecture "$(HOST_CPU)" not officially supported.')
endif
ifneq ("$(filter ppc64le powerpc64le,$(HOST_CPU))","")
CPU := PPC
ARCH_DETECTED := 64BITS
BIG_ENDIAN := 0
PIC ?= 1
$(warning Architecture "$(HOST_CPU)" not officially supported.')
endif
ifneq ("$(filter arm%,$(HOST_CPU))","")
ifeq ("$(filter arm%b,$(HOST_CPU))","")
CPU := ARM
@ -117,14 +123,31 @@ ifneq ("$(filter mips,$(HOST_CPU))","")
PIC ?= 1
$(warning Architecture "$(HOST_CPU)" not officially supported.')
endif
ifeq ("$(CPU)","NONE")
$(error CPU type "$(HOST_CPU)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
ifneq ("$(filter aarch64,$(HOST_CPU))","")
CPU := AARCH
ARCH_DETECTED := 64BITS
PIC ?= 1
NEW_DYNAREC := 1
NO_ASM := 1
endif
ifneq ("$(filter riscv64,$(HOST_CPU))","")
CPU := RISCV64
ARCH_DETECTED := 64BITS
PIC ?= 1
NO_ASM := 1
$(warning Architecture "$(HOST_CPU)" not officially supported.)
endif
ifeq ("$(CPU)","NONE")
$(error CPU type "$(HOST_CPU)" not supported. Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues')
endif
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# base CFLAGS, LDLIBS, and LDFLAGS
OPTFLAGS ?= -O3 -flto
WARNFLAGS ?= -Wall
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fvisibility=hidden -I$(SRCDIR)
LDFLAGS += $(SHARED)
# Since we are building a shared library, we must compile with -fPIC on some architectures
@ -144,25 +167,36 @@ ifeq ($(ARCH_DETECTED), 64BITS_32)
ifeq ($(OS), FREEBSD)
$(error Do not use the BITS=32 option with FreeBSD, use -m32 and -m elf_i386)
endif
CFLAGS += -m32
LDFLAGS += -Wl,-m,elf_i386
ifneq ($(OS), OSX)
ifeq ($(OS), MINGW)
LDFLAGS += -Wl,-m,i386pe
else
CFLAGS += -m32
LDFLAGS += -Wl,-m,elf_i386
endif
endif
endif
ifeq ($(ARCH_DETECTED), 64BITS)
ifeq ($(OS), MINGW)
LDFLAGS += -Wl,-m,i386pep
endif
endif
# set special flags per-system
ifeq ($(OS), LINUX)
# only export api symbols
LDFLAGS += -Wl,-version-script,$(SRCDIR)/rsp_api_export.ver
LDLIBS += -ldl
endif
ifeq ($(OS), OSX)
#xcode-select has been around since XCode 3.0, i.e. OS X 10.5
OSX_SDK_ROOT = $(shell xcode-select -print-path)/Platforms/MacOSX.platform/Developer/SDKs
OSX_SDK_PATH = $(OSX_SDK_ROOT)/$(shell ls $(OSX_SDK_ROOT) | tail -1)
OSX_SDK_PATH = $(shell xcrun --sdk macosx --show-sdk-path)
ifeq ($(CPU), X86)
ifeq ($(ARCH_DETECTED), 64BITS)
CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot $(OSX_SDK_PATH)
CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH)
else
CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot $(OSX_SDK_PATH)
CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH)
LDFLAGS += -read_only_relocs suppress
endif
endif
@ -211,6 +245,7 @@ ifeq ($(DEBUG),1)
CFLAGS += -g
INSTALL_STRIP_FLAG ?=
else
CFLAGS += -DNDEBUG
ifneq ($(OS),OSX)
INSTALL_STRIP_FLAG ?= -s
endif
@ -232,10 +267,6 @@ ifeq ($(DUMP), 1)
CFLAGS += -DENABLE_TASK_DUMP
endif
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# list of source files to compile
SOURCE = \
$(SRCDIR)/alist.c \
@ -245,12 +276,22 @@ SOURCE = \
$(SRCDIR)/audio.c \
$(SRCDIR)/cicx105.c \
$(SRCDIR)/hle.c \
$(SRCDIR)/hvqm.c \
$(SRCDIR)/jpeg.c \
$(SRCDIR)/memory.c \
$(SRCDIR)/mp3.c \
$(SRCDIR)/musyx.c \
$(SRCDIR)/re2.c \
$(SRCDIR)/plugin.c
ifeq ($(OS), MINGW)
SOURCE += \
$(SRCDIR)/osal_dynamiclib_win32.c
else
SOURCE += \
$(SRCDIR)/osal_dynamiclib_unix.c
endif
# generate a list of object files build, make a temporary directory for them
OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
OBJDIRS = $(dir $(OBJECTS))

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - alist.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -50,17 +50,17 @@ static void swap(int16_t **a, int16_t **b)
static int16_t* sample(struct hle_t* hle, unsigned pos)
{
return (int16_t*)hle->alist_buffer + (pos ^ S);
return (int16_t*)hle->alist_buffer + ((pos ^ S) & 0xfff);
}
static uint8_t* alist_u8(struct hle_t* hle, uint16_t dmem)
{
return u8(hle->alist_buffer, dmem);
return (uint8_t*)(hle->alist_buffer + ((dmem ^ S8) & 0xfff));
}
static int16_t* alist_s16(struct hle_t* hle, uint16_t dmem)
{
return (int16_t*)u16(hle->alist_buffer, dmem);
return (int16_t*)(hle->alist_buffer + ((dmem ^ S16) & 0xfff));
}
@ -237,7 +237,7 @@ void alist_interleave(struct hle_t* hle, uint16_t dmemo, uint16_t left, uint16_t
uint16_t r1 = *(srcR++);
uint16_t r2 = *(srcR++);
#if M64P_BIG_ENDIAN
#ifdef M64P_BIG_ENDIAN
*(dst++) = l1;
*(dst++) = r1;
*(dst++) = l2;
@ -282,6 +282,7 @@ void alist_envmix_exp(
int x, y;
short save_buffer[40];
memcpy((uint8_t *)save_buffer, (hle->dram + address), sizeof(save_buffer));
if (init) {
ramps[0].value = (vol[0] << 16);
ramps[1].value = (vol[1] << 16);
@ -292,7 +293,6 @@ void alist_envmix_exp(
exp_seq[0] = (vol[0] * rate[0]);
exp_seq[1] = (vol[1] * rate[1]);
} else {
memcpy((uint8_t *)save_buffer, (hle->dram + address), 80);
wet = *(int16_t *)(save_buffer + 0); /* 0-1 */
dry = *(int16_t *)(save_buffer + 2); /* 2-3 */
ramps[0].target = *(int32_t *)(save_buffer + 4); /* 4-5 */
@ -354,7 +354,7 @@ void alist_envmix_exp(
*(int32_t *)(save_buffer + 14) = exp_seq[1]; /* 14-15 */
*(int32_t *)(save_buffer + 16) = (int32_t)ramps[0].value; /* 12-13 */
*(int32_t *)(save_buffer + 18) = (int32_t)ramps[1].value; /* 14-15 */
memcpy(hle->dram + address, (uint8_t *)save_buffer, 80);
memcpy(hle->dram + address, (uint8_t *)save_buffer, sizeof(save_buffer));
}
void alist_envmix_ge(
@ -382,6 +382,7 @@ void alist_envmix_ge(
struct ramp_t ramps[2];
short save_buffer[40];
memcpy((uint8_t *)save_buffer, (hle->dram + address), 80);
if (init) {
ramps[0].value = (vol[0] << 16);
ramps[1].value = (vol[1] << 16);
@ -390,7 +391,6 @@ void alist_envmix_ge(
ramps[0].step = rate[0] / 8;
ramps[1].step = rate[1] / 8;
} else {
memcpy((uint8_t *)save_buffer, (hle->dram + address), 80);
wet = *(int16_t *)(save_buffer + 0); /* 0-1 */
dry = *(int16_t *)(save_buffer + 2); /* 2-3 */
ramps[0].target = *(int32_t *)(save_buffer + 4); /* 4-5 */
@ -458,6 +458,7 @@ void alist_envmix_lin(
int16_t* const wl = (int16_t*)(hle->alist_buffer + dmem_wl);
int16_t* const wr = (int16_t*)(hle->alist_buffer + dmem_wr);
memcpy((uint8_t *)save_buffer, hle->dram + address, 80);
if (init) {
ramps[0].step = rate[0] / 8;
ramps[0].value = (vol[0] << 16);
@ -467,7 +468,6 @@ void alist_envmix_lin(
ramps[1].target = (target[1] << 16);
}
else {
memcpy((uint8_t *)save_buffer, hle->dram + address, 80);
wet = *(int16_t *)(save_buffer + 0); /* 0-1 */
dry = *(int16_t *)(save_buffer + 2); /* 2-3 */
ramps[0].target = *(int16_t *)(save_buffer + 4) << 16; /* 4-5 */
@ -666,11 +666,11 @@ void alist_resample(
while (count != 0) {
const int16_t* lut = RESAMPLE_LUT + ((pitch_accu & 0xfc00) >> 8);
*sample(hle, opos++) = clamp_s16(
((*sample(hle, ipos ) * lut[0]) >> 15) +
((*sample(hle, ipos + 1) * lut[1]) >> 15) +
((*sample(hle, ipos + 2) * lut[2]) >> 15) +
((*sample(hle, ipos + 3) * lut[3]) >> 15));
*sample(hle, opos++) = clamp_s16( (
(*sample(hle, ipos ) * lut[0]) +
(*sample(hle, ipos + 1) * lut[1]) +
(*sample(hle, ipos + 2) * lut[2]) +
(*sample(hle, ipos + 3) * lut[3]) ) >> 15);
pitch_accu += pitch;
ipos += (pitch_accu >> 16);
@ -961,7 +961,7 @@ void alist_polef(
count -= 16;
} while (count != 0);
dram_store_u16(hle, (uint16_t*)(dst - 4), address, 4);
dram_store_u32(hle, (uint32_t*)(dst - 4), address, 2);
}
void alist_iirf(
@ -1017,8 +1017,22 @@ void alist_iirf(
count -= 0x10;
} while (count > 0);
dram_store_u16(hle, (uint16_t*)&frame[6], address + 4, 4);
dram_store_u16(hle, (uint16_t*)&ibuf[(index-2)&3], address+8, 2);
dram_store_u16(hle, (uint16_t*)&ibuf[(index-1)&3], address+10, 2);
dram_store_u16(hle, (uint16_t*)&frame[6], address + 4, 2);
dram_store_u16(hle, (uint16_t*)&ibuf[(index-2)&3], address+8, 1);
dram_store_u16(hle, (uint16_t*)&ibuf[(index-1)&3], address+10, 1);
}
/* Perform a clamped gain, then attenuate it back by an amount */
void alist_overload(struct hle_t* hle, uint16_t dmem, int16_t count, int16_t gain, uint16_t attenuation)
{
int16_t accu;
int16_t * sample = (int16_t*)(hle->alist_buffer + dmem);
while (count != 0)
{
accu = clamp_s16(*sample * gain);
*sample = (accu * attenuation) >> 16;
sample++;
count --;
}
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - alist.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
@ -150,6 +150,13 @@ void alist_iirf(
int16_t* table,
uint32_t address);
void alist_overload(
struct hle_t* hle,
uint16_t dmem,
int16_t count,
int16_t gain,
uint16_t attenuation);
/*
* Audio flags
*/

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - alist_audio.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -57,7 +57,7 @@ static void SPNOOP(struct hle_t* UNUSED(hle), uint32_t UNUSED(w1), uint32_t UNUS
static void CLEARBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
uint16_t dmem = w1 + DMEM_BASE;
uint16_t count = w2;
uint16_t count = w2 & 0xfff;
if (count == 0)
return;
@ -111,7 +111,7 @@ static void RESAMPLE(struct hle_t* hle, uint32_t w1, uint32_t w2)
alist_resample(
hle,
flags & 0x1,
flags & A_INIT,
flags & 0x2,
hle->alist_audio.out,
hle->alist_audio.in,
@ -152,8 +152,8 @@ static void ADPCM(struct hle_t* hle, uint32_t w1, uint32_t w2)
alist_adpcm(
hle,
flags & 0x1,
flags & 0x2,
flags & A_INIT,
flags & A_LOOP,
false, /* unsupported in this ucode */
hle->alist_audio.out,
hle->alist_audio.in,
@ -278,6 +278,7 @@ void alist_process_audio(struct hle_t* hle)
clear_segments(hle);
alist_process(hle, ABI, 0x10);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_audio_ge(struct hle_t* hle)
@ -291,6 +292,7 @@ void alist_process_audio_ge(struct hle_t* hle)
clear_segments(hle);
alist_process(hle, ABI, 0x10);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_audio_bc(struct hle_t* hle)
@ -304,4 +306,5 @@ void alist_process_audio_bc(struct hle_t* hle)
clear_segments(hle);
alist_process(hle, ABI, 0x10);
rsp_break(hle, SP_STATUS_TASKDONE);
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - alist_naudio.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -108,18 +108,18 @@ static void SETVOL(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
uint8_t flags = (w1 >> 16);
if (flags & 0x4) {
if (flags & 0x2) {
if (flags & A_VOL) {
if (flags & A_LEFT) {
hle->alist_naudio.vol[0] = w1;
hle->alist_naudio.dry = (w2 >> 16);
hle->alist_naudio.wet = w2;
}
else {
else { /* A_RIGHT */
hle->alist_naudio.target[1] = w1;
hle->alist_naudio.rate[1] = w2;
}
}
else {
else { /* A_RATE */
hle->alist_naudio.target[0] = w1;
hle->alist_naudio.rate[0] = w2;
}
@ -134,7 +134,7 @@ static void ENVMIXER(struct hle_t* hle, uint32_t w1, uint32_t w2)
alist_envmix_lin(
hle,
flags & 0x1,
flags & A_INIT,
NAUDIO_DRY_LEFT,
NAUDIO_DRY_RIGHT,
NAUDIO_WET_LEFT,
@ -152,7 +152,7 @@ static void ENVMIXER(struct hle_t* hle, uint32_t w1, uint32_t w2)
static void CLEARBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
uint16_t dmem = w1 + NAUDIO_MAIN;
uint16_t count = w2;
uint16_t count = w2 & 0xfff;
alist_clear(hle, dmem, count);
}
@ -216,8 +216,8 @@ static void ADPCM(struct hle_t* hle, uint32_t w1, uint32_t w2)
alist_adpcm(
hle,
flags & 0x1,
flags & 0x2,
flags & A_INIT,
flags & A_LOOP,
false, /* unsuported by this ucode */
dmemo,
dmemi,
@ -237,7 +237,7 @@ static void RESAMPLE(struct hle_t* hle, uint32_t w1, uint32_t w2)
alist_resample(
hle,
flags & 0x1,
flags & A_INIT,
false, /* TODO: check which ABI supports it */
dmemo,
dmemi,
@ -263,6 +263,16 @@ static void MP3(struct hle_t* hle, uint32_t w1, uint32_t w2)
mp3_task(hle, index, address);
}
static void OVERLOAD(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
/* Overload distortion effect for Conker's Bad Fur Day */
uint16_t dmem = (w1 & 0xfff) + NAUDIO_MAIN;
int16_t gain = (int16_t)(uint16_t)w2;
uint16_t attenuation = w2 >> 16;
alist_overload(hle, dmem, NAUDIO_COUNT, gain, attenuation);
}
/* global functions */
void alist_process_naudio(struct hle_t* hle)
{
@ -274,6 +284,7 @@ void alist_process_naudio(struct hle_t* hle)
};
alist_process(hle, ABI, 0x10);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_naudio_bk(struct hle_t* hle)
@ -287,6 +298,7 @@ void alist_process_naudio_bk(struct hle_t* hle)
};
alist_process(hle, ABI, 0x10);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_naudio_dk(struct hle_t* hle)
@ -300,29 +312,43 @@ void alist_process_naudio_dk(struct hle_t* hle)
};
alist_process(hle, ABI, 0x10);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_naudio_mp3(struct hle_t* hle)
{
static const acmd_callback_t ABI[0x10] = {
UNKNOWN, ADPCM, CLEARBUFF, ENVMIXER,
OVERLOAD, ADPCM, CLEARBUFF, ENVMIXER,
LOADBUFF, RESAMPLE, SAVEBUFF, MP3,
MP3ADDY, SETVOL, DMEMMOVE, LOADADPCM,
MIXER, INTERLEAVE, NAUDIO_14, SETLOOP
};
alist_process(hle, ABI, 0x10);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_naudio_cbfd(struct hle_t* hle)
{
/* TODO: see what differs from alist_process_naudio_mp3 */
/* What differs from alist_process_naudio_mp3?
*
* JoshW: It appears that despite being a newer game, CBFD appears to have a slightly older ucode version
* compared to JFG, B.T. et al.
* For naudio_mp3, the functions DMEM parameters have an additional protective AND on them
* (basically dmem & 0xffff).
* But there are minor differences are in the RESAMPLE and ENVMIXER functions.
* I don't think it is making any noticeable difference, as it could be just a simplification of the logic.
*
* bsmiles32: The only difference I could remember between mp3 and cbfd variants is in the MP3ADDY command.
* And the MP3 overlay is also different.
*/
static const acmd_callback_t ABI[0x10] = {
UNKNOWN, ADPCM, CLEARBUFF, ENVMIXER,
OVERLOAD, ADPCM, CLEARBUFF, ENVMIXER,
LOADBUFF, RESAMPLE, SAVEBUFF, MP3,
MP3ADDY, SETVOL, DMEMMOVE, LOADADPCM,
MIXER, INTERLEAVE, NAUDIO_14, SETLOOP
};
alist_process(hle, ABI, 0x10);
rsp_break(hle, SP_STATUS_TASKDONE);
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - alist_nead.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -92,7 +92,7 @@ static void ADPCM(struct hle_t* hle, uint32_t w1, uint32_t w2)
static void CLEARBUFF(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
uint16_t dmem = w1;
uint16_t count = w2;
uint16_t count = w2 & 0xfff;
if (count == 0)
return;
@ -300,7 +300,7 @@ static void ADDMIXER(struct hle_t* hle, uint32_t w1, uint32_t w2)
static void HILOGAIN(struct hle_t* hle, uint32_t w1, uint32_t w2)
{
int8_t gain = (w1 >> 16); /* Q4.4 signed */
uint16_t count = w1;
uint16_t count = w1 & 0xfff;
uint16_t dmem = (w2 >> 16);
alist_multQ44(hle, dmem, count, gain);
@ -372,6 +372,7 @@ void alist_process_nead_mk(struct hle_t* hle)
};
alist_process(hle, ABI, 0x20);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_sf(struct hle_t* hle)
@ -388,6 +389,7 @@ void alist_process_nead_sf(struct hle_t* hle)
};
alist_process(hle, ABI, 0x20);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_sfj(struct hle_t* hle)
@ -404,6 +406,7 @@ void alist_process_nead_sfj(struct hle_t* hle)
};
alist_process(hle, ABI, 0x20);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_fz(struct hle_t* hle)
@ -420,6 +423,7 @@ void alist_process_nead_fz(struct hle_t* hle)
};
alist_process(hle, ABI, 0x20);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_wrjb(struct hle_t* hle)
@ -436,6 +440,7 @@ void alist_process_nead_wrjb(struct hle_t* hle)
};
alist_process(hle, ABI, 0x20);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_ys(struct hle_t* hle)
@ -450,6 +455,7 @@ void alist_process_nead_ys(struct hle_t* hle)
};
alist_process(hle, ABI, 0x18);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_1080(struct hle_t* hle)
@ -464,6 +470,7 @@ void alist_process_nead_1080(struct hle_t* hle)
};
alist_process(hle, ABI, 0x18);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_oot(struct hle_t* hle)
@ -478,6 +485,7 @@ void alist_process_nead_oot(struct hle_t* hle)
};
alist_process(hle, ABI, 0x18);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_mm(struct hle_t* hle)
@ -492,6 +500,7 @@ void alist_process_nead_mm(struct hle_t* hle)
};
alist_process(hle, ABI, 0x18);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_mmb(struct hle_t* hle)
@ -506,6 +515,7 @@ void alist_process_nead_mmb(struct hle_t* hle)
};
alist_process(hle, ABI, 0x18);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_ac(struct hle_t* hle)
@ -520,4 +530,27 @@ void alist_process_nead_ac(struct hle_t* hle)
};
alist_process(hle, ABI, 0x18);
rsp_break(hle, SP_STATUS_TASKDONE);
}
void alist_process_nead_mats(struct hle_t* hle)
{
/* FIXME: implement proper ucode
* Forward the task if possible,
* otherwise better to have no sound than garbage sound
*/
if (HleForwardTask(hle->user_defined) != 0) {
rsp_break(hle, SP_STATUS_TASKDONE);
}
}
void alist_process_nead_efz(struct hle_t* hle)
{
/* FIXME: implement proper ucode
* Forward the task if possible,
* otherwise use FZero ucode which should be very similar
*/
if (HleForwardTask(hle->user_defined) != 0) {
alist_process_nead_fz(hle);
}
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - arithmetics.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - audio.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - audio.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - cicx105.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2012 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -50,5 +50,7 @@ void cicx105_ucode(struct hle_t* hle)
src += 0x8;
}
rsp_break(hle, 0);
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - common.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *

315
src/hle.c
View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - hle.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2012 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -35,40 +35,28 @@
#define min(a,b) (((a) < (b)) ? (a) : (b))
/* some rsp status flags */
#define SP_STATUS_HALT 0x1
#define SP_STATUS_BROKE 0x2
#define SP_STATUS_INTR_ON_BREAK 0x40
#define SP_STATUS_TASKDONE 0x200
/* some rdp status flags */
#define DP_STATUS_FREEZE 0x2
/* some mips interface interrupt flags */
#define MI_INTR_SP 0x1
/* helper functions prototypes */
static unsigned int sum_bytes(const unsigned char *bytes, unsigned int size);
static bool is_task(struct hle_t* hle);
static void rsp_break(struct hle_t* hle, unsigned int setbits);
static void forward_gfx_task(struct hle_t* hle);
static bool try_fast_audio_dispatching(struct hle_t* hle);
static bool try_fast_task_dispatching(struct hle_t* hle);
static void normal_task_dispatching(struct hle_t* hle);
static void non_task_dispatching(struct hle_t* hle);
static void send_dlist_to_gfx_plugin(struct hle_t* hle);
static ucode_func_t try_audio_task_detection(struct hle_t* hle);
static ucode_func_t try_normal_task_detection(struct hle_t* hle);
static ucode_func_t non_task_detection(struct hle_t* hle);
static ucode_func_t task_detection(struct hle_t* hle);
#ifdef ENABLE_TASK_DUMP
static void dump_binary(struct hle_t* hle, const char *const filename,
const unsigned char *const bytes, unsigned int size);
static void dump_task(struct hle_t* hle, const char *const filename);
static void dump_unknown_task(struct hle_t* hle, unsigned int sum);
static void dump_unknown_non_task(struct hle_t* hle, unsigned int sum);
static void dump_unknown_task(struct hle_t* hle, unsigned int uc_start);
static void dump_unknown_non_task(struct hle_t* hle, unsigned int uc_start);
#endif
/* local variables */
static const bool FORWARD_AUDIO = false, FORWARD_GFX = true;
/* Global functions */
void hle_init(struct hle_t* hle,
unsigned char* dram,
@ -120,14 +108,38 @@ void hle_init(struct hle_t* hle,
void hle_execute(struct hle_t* hle)
{
if (is_task(hle)) {
if (!try_fast_task_dispatching(hle))
normal_task_dispatching(hle);
rsp_break(hle, SP_STATUS_TASKDONE);
} else {
non_task_dispatching(hle);
rsp_break(hle, 0);
uint32_t uc_start = *dmem_u32(hle, TASK_UCODE);
uint32_t uc_dstart = *dmem_u32(hle, TASK_UCODE_DATA);
uint32_t uc_dsize = *dmem_u32(hle, TASK_UCODE_DATA_SIZE);
bool match = false;
struct cached_ucodes_t * cached_ucodes = &hle->cached_ucodes;
struct ucode_info_t *info = NULL;
if (cached_ucodes->count > 0)
info = &cached_ucodes->infos[cached_ucodes->count-1];
for (int i = 0; i < cached_ucodes->count; i++)
{
if (info->uc_start == uc_start && info->uc_dstart == uc_dstart && info->uc_dsize == uc_dsize)
{
match = true;
break;
}
info--;
}
if (!match)
{
info = &cached_ucodes->infos[cached_ucodes->count];
info->uc_start = uc_start;
info->uc_dstart = uc_dstart;
info->uc_dsize = uc_dsize;
info->uc_pfunc = task_detection(hle);
cached_ucodes->count++;
assert(cached_ucodes->count <= CACHED_UCODES_MAX_SIZE);
assert(info->uc_pfunc != NULL);
}
info->uc_pfunc(hle);
}
/* local functions */
@ -157,7 +169,7 @@ static bool is_task(struct hle_t* hle)
return (*dmem_u32(hle, TASK_UCODE_BOOT_SIZE) <= 0x1000);
}
static void rsp_break(struct hle_t* hle, unsigned int setbits)
void rsp_break(struct hle_t* hle, unsigned int setbits)
{
*hle->sp_status |= setbits | SP_STATUS_BROKE | SP_STATUS_HALT;
@ -167,12 +179,66 @@ static void rsp_break(struct hle_t* hle, unsigned int setbits)
}
}
static void forward_gfx_task(struct hle_t* hle)
static void send_alist_to_audio_plugin(struct hle_t* hle)
{
HleProcessDlistList(hle->user_defined);
HleProcessAlistList(hle->user_defined);
rsp_break(hle, SP_STATUS_TASKDONE);
}
static bool try_fast_audio_dispatching(struct hle_t* hle)
static void send_dlist_to_gfx_plugin(struct hle_t* hle)
{
/* Since GFX_INFO version 2, these bits are set before calling the ProcessDlistList function.
* And the GFX plugin is responsible to unset them if needed.
* For GFX_INFO version < 2, the GFX plugin didn't have access to sp_status so
* it doesn't matter if we set these bits before calling ProcessDlistList function.
*/
*hle->sp_status |= SP_STATUS_TASKDONE | SP_STATUS_BROKE | SP_STATUS_HALT;
HleProcessDlistList(hle->user_defined);
if ((*hle->sp_status & SP_STATUS_INTR_ON_BREAK) && (*hle->sp_status & (SP_STATUS_TASKDONE | SP_STATUS_BROKE | SP_STATUS_HALT))) {
*hle->mi_intr |= MI_INTR_SP;
HleCheckInterrupts(hle->user_defined);
}
}
static void task_done(struct hle_t* hle)
{
rsp_break(hle, SP_STATUS_TASKDONE);
}
static void unknown_ucode(struct hle_t* hle)
{
/* Forward task to RSP Fallback.
* If task is not forwarded, use the regular "unknown ucode" path */
if (HleForwardTask(hle->user_defined) != 0) {
uint32_t uc_start = *dmem_u32(hle, TASK_UCODE);
HleWarnMessage(hle->user_defined, "unknown RSP code: uc_start: %x PC:%x", uc_start, *hle->sp_pc);
#ifdef ENABLE_TASK_DUMP
dump_unknown_non_task(hle, uc_start);
#endif
}
}
static void unknown_task(struct hle_t* hle)
{
/* Forward task to RSP Fallback.
* If task is not forwarded, use the regular "unknown task" path */
if (HleForwardTask(hle->user_defined) != 0) {
/* Send task_done signal for unknown ucodes to allow further processings */
rsp_break(hle, SP_STATUS_TASKDONE);
uint32_t uc_start = *dmem_u32(hle, TASK_UCODE);
HleWarnMessage(hle->user_defined, "unknown OSTask: uc_start: %x PC:%x", uc_start, *hle->sp_pc);
#ifdef ENABLE_TASK_DUMP
dump_unknown_task(hle, uc_start);
#endif
}
}
static ucode_func_t try_audio_task_detection(struct hle_t* hle)
{
/* identify audio ucode by using the content of ucode_data */
uint32_t ucode_data = *dmem_u32(hle, TASK_UCODE_DATA);
@ -184,11 +250,11 @@ static bool try_fast_audio_dispatching(struct hle_t* hle)
switch(v)
{
case 0x1e24138c: /* audio ABI (most common) */
alist_process_audio(hle); return true;
return &alist_process_audio;
case 0x1dc8138c: /* GoldenEye */
alist_process_audio_ge(hle); return true;
return &alist_process_audio_ge;
case 0x1e3c1390: /* BlastCorp, DiddyKongRacing */
alist_process_audio_bc(hle); return true;
return &alist_process_audio_bc;
default:
HleWarnMessage(hle->user_defined, "ABI1 identification regression: v=%08x", v);
}
@ -197,30 +263,33 @@ static bool try_fast_audio_dispatching(struct hle_t* hle)
switch(v)
{
case 0x11181350: /* MarioKart, WaveRace (E) */
alist_process_nead_mk(hle); return true;
return &alist_process_nead_mk;
case 0x111812e0: /* StarFox (J) */
alist_process_nead_sfj(hle); return true;
return &alist_process_nead_sfj;
case 0x110412ac: /* WaveRace (J RevB) */
alist_process_nead_wrjb(hle); return true;
return &alist_process_nead_wrjb;
case 0x110412cc: /* StarFox/LylatWars (except J) */
alist_process_nead_sf(hle); return true;
return &alist_process_nead_sf;
case 0x1cd01250: /* FZeroX */
alist_process_nead_fz(hle); return true;
return &alist_process_nead_fz;
case 0x1f08122c: /* YoshisStory */
alist_process_nead_ys(hle); return true;
return &alist_process_nead_ys;
case 0x1f38122c: /* 1080° Snowboarding */
alist_process_nead_1080(hle); return true;
return &alist_process_nead_1080;
case 0x1f681230: /* Zelda OoT / Zelda MM (J, J RevA) */
alist_process_nead_oot(hle); return true;
return &alist_process_nead_oot;
case 0x1f801250: /* Zelda MM (except J, J RevA, E Beta), PokemonStadium 2 */
alist_process_nead_mm(hle); return true;
return &alist_process_nead_mm;
case 0x109411f8: /* Zelda MM (E Beta) */
alist_process_nead_mmb(hle); return true;
return &alist_process_nead_mmb;
case 0x1eac11b8: /* AnimalCrossing */
alist_process_nead_ac(hle); return true;
return &alist_process_nead_ac;
case 0x00010010: /* MusyX v2 (IndianaJones, BattleForNaboo) */
musyx_v2_task(hle); return true;
return &musyx_v2_task;
case 0x1f701238: /* Mario Artist Talent Studio */
return &alist_process_nead_mats;
case 0x1f4c1230: /* FZeroX Expansion */
return &alist_process_nead_efz;
default:
HleWarnMessage(hle->user_defined, "ABI2 identification regression: v=%08x", v);
}
@ -233,156 +302,172 @@ static bool try_fast_audio_dispatching(struct hle_t* hle)
RogueSquadron, ResidentEvil2, PolarisSnoCross,
TheWorldIsNotEnough, RugratsInParis, NBAShowTime,
HydroThunder, Tarzan, GauntletLegend, Rush2049 */
musyx_v1_task(hle); return true;
return &musyx_v1_task;
case 0x0000127c: /* naudio (many games) */
alist_process_naudio(hle); return true;
return &alist_process_naudio;
case 0x00001280: /* BanjoKazooie */
alist_process_naudio_bk(hle); return true;
return &alist_process_naudio_bk;
case 0x1c58126c: /* DonkeyKong */
alist_process_naudio_dk(hle); return true;
return &alist_process_naudio_dk;
case 0x1ae8143c: /* BanjoTooie, JetForceGemini, MickeySpeedWayUSA, PerfectDark */
alist_process_naudio_mp3(hle); return true;
return &alist_process_naudio_mp3;
case 0x1ab0140c: /* ConkerBadFurDay */
alist_process_naudio_cbfd(hle); return true;
return &alist_process_naudio_cbfd;
default:
HleWarnMessage(hle->user_defined, "ABI3 identification regression: v=%08x", v);
}
}
return false;
return NULL;
}
static bool try_fast_task_dispatching(struct hle_t* hle)
static ucode_func_t try_normal_task_detection(struct hle_t* hle)
{
/* identify task ucode by its type */
switch (*dmem_u32(hle, TASK_TYPE)) {
case 1:
if (FORWARD_GFX) {
forward_gfx_task(hle);
return true;
}
break;
case 2:
if (FORWARD_AUDIO) {
HleProcessAlistList(hle->user_defined);
return true;
} else if (try_fast_audio_dispatching(hle))
return true;
break;
case 7:
HleShowCFB(hle->user_defined);
return true;
}
return false;
}
static void normal_task_dispatching(struct hle_t* hle)
{
const unsigned int sum =
unsigned int sum =
sum_bytes((void*)dram_u32(hle, *dmem_u32(hle, TASK_UCODE)), min(*dmem_u32(hle, TASK_UCODE_SIZE), 0xf80) >> 1);
switch (sum) {
/* StoreVe12: found in Zelda Ocarina of Time [misleading task->type == 4] */
case 0x278:
/* Nothing to emulate */
return;
return &task_done;
/* GFX: Twintris [misleading task->type == 0] */
case 0x212ee:
if (FORWARD_GFX) {
forward_gfx_task(hle);
return;
if (hle->hle_gfx) {
return &send_dlist_to_gfx_plugin;
}
break;
return NULL;
/* JPEG: found in Pokemon Stadium J */
case 0x2c85a:
jpeg_decode_PS0(hle);
return;
return &jpeg_decode_PS0;
/* JPEG: found in Zelda Ocarina of Time, Pokemon Stadium 1, Pokemon Stadium 2 */
case 0x2caa6:
jpeg_decode_PS(hle);
return;
return &jpeg_decode_PS;
/* JPEG: found in Ogre Battle, Bottom of the 9th */
case 0x130de:
case 0x278b0:
jpeg_decode_OB(hle);
return;
return &jpeg_decode_OB;
}
HleWarnMessage(hle->user_defined, "unknown OSTask: sum: %x PC:%x", sum, *hle->sp_pc);
#ifdef ENABLE_TASK_DUMP
dump_unknown_task(hle, sum);
#endif
/* Resident Evil 2 */
sum = sum_bytes((void*)dram_u32(hle, *dmem_u32(hle, TASK_UCODE)), 256);
switch (sum) {
case 0x450f:
return &resize_bilinear_task;
case 0x3b44:
return &decode_video_frame_task;
case 0x3d84:
return &fill_video_double_buffer_task;
}
/* HVQM */
sum = sum_bytes((void*)dram_u32(hle, *dmem_u32(hle, TASK_UCODE)), 1488);
switch (sum) {
case 0x19495:
return &hvqm2_decode_sp1_task;
case 0x19728:
return &hvqm2_decode_sp2_task;
}
return NULL;
}
static void non_task_dispatching(struct hle_t* hle)
static ucode_func_t non_task_detection(struct hle_t* hle)
{
const unsigned int sum = sum_bytes(hle->imem, 44);
if (sum == 0x9e2)
{
/* CIC x105 ucode (used during boot of CIC x105 games) */
cicx105_ucode(hle);
return;
return &cicx105_ucode;
}
HleWarnMessage(hle->user_defined, "unknown RSP code: sum: %x PC:%x", sum, *hle->sp_pc);
#ifdef ENABLE_TASK_DUMP
dump_unknown_non_task(hle, sum);
#endif
return &unknown_ucode;
}
static ucode_func_t task_detection(struct hle_t* hle)
{
if (is_task(hle)) {
ucode_func_t uc_pfunc;
uint32_t type = *dmem_u32(hle, TASK_TYPE);
if (type == 2) {
if (hle->hle_aud) {
return &send_alist_to_audio_plugin;
}
uc_pfunc = try_audio_task_detection(hle);
if (uc_pfunc)
return uc_pfunc;
}
uc_pfunc = try_normal_task_detection(hle);
if (uc_pfunc)
return uc_pfunc;
if (type == 1) {
if (hle->hle_gfx) {
return &send_dlist_to_gfx_plugin;
}
}
return &unknown_task;
}
else {
return non_task_detection(hle);
}
}
#ifdef ENABLE_TASK_DUMP
static void dump_unknown_task(struct hle_t* hle, unsigned int sum)
static void dump_unknown_task(struct hle_t* hle, unsigned int uc_start)
{
char filename[256];
uint32_t ucode = *dmem_u32(hle, TASK_UCODE);
uint32_t ucode_data = *dmem_u32(hle, TASK_UCODE_DATA);
uint32_t data_ptr = *dmem_u32(hle, TASK_DATA_PTR);
sprintf(&filename[0], "task_%x.log", sum);
sprintf(&filename[0], "task_%x.log", uc_start);
dump_task(hle, filename);
/* dump ucode_boot */
sprintf(&filename[0], "ucode_boot_%x.bin", sum);
sprintf(&filename[0], "ucode_boot_%x.bin", uc_start);
dump_binary(hle, filename, (void*)dram_u32(hle, *dmem_u32(hle, TASK_UCODE_BOOT)), *dmem_u32(hle, TASK_UCODE_BOOT_SIZE));
/* dump ucode */
if (ucode != 0) {
sprintf(&filename[0], "ucode_%x.bin", sum);
sprintf(&filename[0], "ucode_%x.bin", uc_start);
dump_binary(hle, filename, (void*)dram_u32(hle, ucode), 0xf80);
}
/* dump ucode_data */
if (ucode_data != 0) {
sprintf(&filename[0], "ucode_data_%x.bin", sum);
sprintf(&filename[0], "ucode_data_%x.bin", uc_start);
dump_binary(hle, filename, (void*)dram_u32(hle, ucode_data), *dmem_u32(hle, TASK_UCODE_DATA_SIZE));
}
/* dump data */
if (data_ptr != 0) {
sprintf(&filename[0], "data_%x.bin", sum);
sprintf(&filename[0], "data_%x.bin", uc_start);
dump_binary(hle, filename, (void*)dram_u32(hle, data_ptr), *dmem_u32(hle, TASK_DATA_SIZE));
}
}
static void dump_unknown_non_task(struct hle_t* hle, unsigned int sum)
static void dump_unknown_non_task(struct hle_t* hle, unsigned int uc_start)
{
char filename[256];
/* dump IMEM & DMEM for further analysis */
sprintf(&filename[0], "imem_%x.bin", sum);
sprintf(&filename[0], "imem_%x.bin", uc_start);
dump_binary(hle, filename, hle->imem, 0x1000);
sprintf(&filename[0], "dmem_%x.bin", sum);
sprintf(&filename[0], "dmem_%x.bin", uc_start);
dump_binary(hle, filename, hle->dmem, 0x1000);
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - hle.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - hle_external.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
@ -22,17 +22,25 @@
#ifndef HLE_EXTERNAL_H
#define HLE_EXTERNAL_H
#if defined(__GNUC__)
#define ATTR_FMT(fmtpos, attrpos) __attribute__ ((format (printf, fmtpos, attrpos)))
#else
#define ATTR_FMT(fmtpos, attrpos)
#endif
/* users of the hle core are expected to define these functions */
void HleVerboseMessage(void* user_defined, const char *message, ...);
void HleErrorMessage(void* user_defined, const char *message, ...);
void HleWarnMessage(void* user_defined, const char *message, ...);
void HleVerboseMessage(void* user_defined, const char *message, ...) ATTR_FMT(2, 3);
void HleInfoMessage(void* user_defined, const char *message, ...) ATTR_FMT(2, 3);
void HleErrorMessage(void* user_defined, const char *message, ...) ATTR_FMT(2, 3);
void HleWarnMessage(void* user_defined, const char *message, ...) ATTR_FMT(2, 3);
void HleCheckInterrupts(void* user_defined);
void HleProcessDlistList(void* user_defined);
void HleProcessAlistList(void* user_defined);
void HleProcessRdpList(void* user_defined);
void HleShowCFB(void* user_defined);
int HleForwardTask(void* user_defined);
#endif

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - hle_internal.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
@ -57,6 +57,8 @@ struct hle_t
/* for user convenience, this will be passed to "external" functions */
void* user_defined;
int hle_gfx;
int hle_aud;
/* alist.c */
uint8_t alist_buffer[0x1000];
@ -72,7 +74,20 @@ struct hle_t
/* mp3.c */
uint8_t mp3_buffer[0x1000];
struct cached_ucodes_t cached_ucodes;
};
/* some mips interface interrupt flags */
#define MI_INTR_SP 0x1
/* some rsp status flags */
#define SP_STATUS_HALT 0x1
#define SP_STATUS_BROKE 0x2
#define SP_STATUS_INTR_ON_BREAK 0x40
#define SP_STATUS_TASKDONE 0x200
void rsp_break(struct hle_t* hle, unsigned int setbits);
#endif

354
src/hvqm.c Normal file
View file

@ -0,0 +1,354 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - hvqm.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2020 Gilles Siberlin *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <assert.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "hle_external.h"
#include "hle_internal.h"
#include "memory.h"
/* Nest size */
#define HVQM2_NESTSIZE_L 70 /* Number of elements on long side */
#define HVQM2_NESTSIZE_S 38 /* Number of elements on short side */
#define HVQM2_NESTSIZE (HVQM2_NESTSIZE_L * HVQM2_NESTSIZE_S)
struct HVQM2Block {
uint8_t nbase;
uint8_t dc;
uint8_t dc_l;
uint8_t dc_r;
uint8_t dc_u;
uint8_t dc_d;
};
struct HVQM2Basis {
uint8_t sx;
uint8_t sy;
int16_t scale;
uint16_t offset;
uint16_t lineskip;
};
struct HVQM2Arg {
uint32_t info;
uint32_t buf;
uint16_t buf_width;
uint8_t chroma_step_h;
uint8_t chroma_step_v;
uint16_t hmcus;
uint16_t vmcus;
uint8_t alpha;
uint32_t nest;
};
struct RGBA {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
};
static struct HVQM2Arg arg;
static const int16_t constant[5][16] = {
{0x0006,0x0008,0x0008,0x0006,0x0008,0x000A,0x000A,0x0008,0x0008,0x000A,0x000A,0x0008,0x0006,0x0008,0x0008,0x0006},
{0x0002,0x0000,0xFFFF,0xFFFF,0x0002,0x0000,0xFFFF,0xFFFF,0x0002,0x0000,0xFFFF,0xFFFF,0x0002,0x0000,0xFFFF,0xFFFF},
{0xFFFF,0xFFFF,0x0000,0x0002,0xFFFF,0xFFFF,0x0000,0x0002,0xFFFF,0xFFFF,0x0000,0x0002,0xFFFF,0xFFFF,0x0000,0x0002},
{0x0002,0x0002,0x0002,0x0002,0x0000,0x0000,0x0000,0x0000,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF},
{0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x0000,0x0000,0x0000,0x0000,0x0002,0x0002,0x0002,0x0002}
};
static int process_info(struct hle_t* hle, uint8_t* base, int16_t* out)
{
struct HVQM2Block block;
uint8_t nbase = *base;
dram_load_u8(hle, (uint8_t*)&block, arg.info, sizeof(struct HVQM2Block));
arg.info += 8;
*base = block.nbase & 0x7;
if ((block.nbase & nbase) != 0)
return 0;
if (block.nbase == 0)
{
//LABEL8
for (int i = 0; i < 16; i++)
{
out[i] = constant[0][i] * block.dc;
out[i] += constant[1][i] * block.dc_l;
out[i] += constant[2][i] * block.dc_r;
out[i] += constant[3][i] * block.dc_u;
out[i] += constant[4][i] * block.dc_d;
out[i] += 4;
out[i] >>= 3;
}
}
else if ((block.nbase & 0xf) == 0)
{
//LABEL7
for (int i = 0; i < 16; i++)
{
out[i] = *dram_u8(hle, arg.info);
arg.info++;
}
}
else if (*base == 0)
{
//LABEL6
for (int i = 0; i < 16; i++)
{
out[i] = *(int8_t*)dram_u8(hle, arg.info) + block.dc;
arg.info++;
}
}
else
{
//LABEL5
struct HVQM2Basis basis;
for (int i = 0; i < 16; i++)
out[i] = block.dc;
for (; *base != 0; (*base)--)
{
basis.sx = *dram_u8(hle, arg.info);
arg.info++;
basis.sy = *dram_u8(hle, arg.info);
arg.info++;
basis.scale = *dram_u16(hle, arg.info);
arg.info += 2;
basis.offset = *dram_u16(hle, arg.info);
arg.info += 2;
basis.lineskip = *dram_u16(hle, arg.info);
arg.info += 2;
int16_t vec[16];
uint32_t addr = arg.nest + basis.offset;
int shift = (basis.sx != 0) ? 1 : 0;
//LABEL9
//LABEL10
for (int i = 0; i < 16; i += 4)
{
vec[i] = *dram_u8(hle, addr);
vec[i + 1] = *dram_u8(hle, addr + (1 << shift));
vec[i + 2] = *dram_u8(hle, addr + (2 << shift));
vec[i + 3] = *dram_u8(hle, addr + (3 << shift));
addr += basis.lineskip;
}
//LABEL11
int16_t sum = 0x8;
for (int i = 0; i < 16; i++)
sum += vec[i];
sum >>= 4;
int16_t max = 0;
for (int i = 0; i < 16; i++)
{
vec[i] -= sum;
max = (abs(vec[i]) > max) ? abs(vec[i]) : max;
}
double dmax = 0.0;
if (max > 0)
dmax = (double)(basis.scale << 2) / (double)max;
for (int i = 0; i < 16; i++)
out[i] += (vec[i] < 0) ? (int16_t)((double)vec[i] * dmax - 0.5) : (int16_t)((double)vec[i] * dmax + 0.5);
block.nbase &= 8;
}
assert(block.nbase == 0);
//if(block.nbase != 0)
// LABEL6
}
return 1;
}
#define SATURATE8(x) ((unsigned int) x <= 255 ? x : (x < 0 ? 0: 255))
static struct RGBA YCbCr_to_RGBA(int16_t Y, int16_t Cb, int16_t Cr, uint8_t alpha)
{
struct RGBA color;
//Format S10.6
int r = (int)(((double)Y + 0.5) + (1.765625 * (double)(Cr - 128)));
int g = (int)(((double)Y + 0.5) - (0.34375 * (double)(Cr - 128)) - (0.71875 * (double)(Cb - 128)));
int b = (int)(((double)Y + 0.5) + (1.40625 * (double)(Cb - 128)));
color.r = SATURATE8(r);
color.g = SATURATE8(g);
color.b = SATURATE8(b);
color.a = alpha;
return color;
}
void store_rgba5551(struct hle_t* hle, struct RGBA color, uint32_t * addr)
{
uint16_t pixel = ((color.b >> 3) << 11) | ((color.g >> 3) << 6) | ((color.r >> 3) << 1) | (color.a & 1);
dram_store_u16(hle, &pixel, *addr, 1);
*addr += 2;
}
void store_rgba8888(struct hle_t* hle, struct RGBA color, uint32_t * addr)
{
uint32_t pixel = (color.b << 24) | (color.g << 16) | (color.r << 8) | color.a;
dram_store_u32(hle, &pixel, *addr, 1);
*addr += 4;
}
typedef void(*store_pixel_t)(struct hle_t* hle, struct RGBA color, uint32_t * addr);
static void hvqm2_decode(struct hle_t* hle, int is32)
{
//uint32_t uc_data_ptr = *dmem_u32(hle, TASK_UCODE_DATA);
uint32_t data_ptr = *dmem_u32(hle, TASK_DATA_PTR);
assert((*dmem_u32(hle, TASK_FLAGS) & 0x1) == 0);
/* Fill HVQM2Arg struct */
arg.info = *dram_u32(hle, data_ptr);
data_ptr += 4;
arg.buf = *dram_u32(hle, data_ptr);
data_ptr += 4;
arg.buf_width = *dram_u16(hle, data_ptr);
data_ptr += 2;
arg.chroma_step_h = *dram_u8(hle, data_ptr);
data_ptr++;
arg.chroma_step_v = *dram_u8(hle, data_ptr);
data_ptr++;
arg.hmcus = *dram_u16(hle, data_ptr);
data_ptr += 2;
arg.vmcus = *dram_u16(hle, data_ptr);
data_ptr += 2;
arg.alpha = *dram_u8(hle, data_ptr);
arg.nest = data_ptr + 1;
assert(arg.chroma_step_h == 2);
assert((arg.chroma_step_v == 1) || (arg.chroma_step_v == 2));
assert((*hle->sp_status & 0x80) == 0); //SP_STATUS_YIELD
int length, skip;
store_pixel_t store_pixel;
if (is32)
{
length = 0x20;
skip = arg.buf_width << 2;
arg.buf_width <<= 4;
store_pixel = &store_rgba8888;
}
else
{
length = 0x10;
skip = arg.buf_width << 1;
arg.buf_width <<= 3;
store_pixel = &store_rgba5551;
}
if (arg.chroma_step_v == 2)
arg.buf_width += arg.buf_width;
for (int i = arg.vmcus; i != 0; i--)
{
uint32_t out;
int j;
for (j = arg.hmcus, out = arg.buf; j != 0; j--, out += length)
{
uint8_t base = 0x80;
int16_t Cb[16], Cr[16], Y1[32], Y2[32];
int16_t* pCb = Cb;
int16_t* pCr = Cr;
int16_t* pY1 = Y1;
int16_t* pY2 = Y2;
if (arg.chroma_step_v == 2)
{
if (process_info(hle, &base, pY1) == 0)
continue;
if (process_info(hle, &base, pY2) == 0)
continue;
pY1 = &Y1[16];
pY2 = &Y2[16];
}
if (process_info(hle, &base, pY1) == 0)
continue;
if (process_info(hle, &base, pY2) == 0)
continue;
if (process_info(hle, &base, Cr) == 0)
continue;
if (process_info(hle, &base, Cb) == 0)
continue;
pY1 = Y1;
pY2 = Y2;
uint32_t out_buf = out;
for (int k = 0; k < 4; k++)
{
for (int m = 0; m < arg.chroma_step_v; m++)
{
uint32_t addr = out_buf;
for (int l = 0; l < 4; l++)
{
struct RGBA color = YCbCr_to_RGBA(pY1[l], pCb[l >> 1], pCr[l >> 1], arg.alpha);
store_pixel(hle, color, &addr);
}
for (int l = 0; l < 4; l++)
{
struct RGBA color = YCbCr_to_RGBA(pY2[l], pCb[(l + 4) >> 1], pCr[(l + 4) >> 1], arg.alpha);
store_pixel(hle, color, &addr);
}
out_buf += skip;
pY1 += 4;
pY2 += 4;
}
pCr += 4;
pCb += 4;
}
}
arg.buf += arg.buf_width;
}
rsp_break(hle, SP_STATUS_TASKDONE);
}
void hvqm2_decode_sp1_task(struct hle_t* hle)
{
hvqm2_decode(hle, 0);
}
void hvqm2_decode_sp2_task(struct hle_t* hle)
{
hvqm2_decode(hle, 1);
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - jpeg.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2012 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -141,6 +141,7 @@ static const float IDCT_K[10] = {
void jpeg_decode_PS0(struct hle_t* hle)
{
jpeg_decode_std(hle, "PS0", RescaleYSubBlock, RescaleUVSubBlock, EmitYUVTileLine);
rsp_break(hle, SP_STATUS_TASKDONE);
}
/***************************************************************************
@ -150,6 +151,7 @@ void jpeg_decode_PS0(struct hle_t* hle)
void jpeg_decode_PS(struct hle_t* hle)
{
jpeg_decode_std(hle, "PS", NULL, NULL, EmitRGBATileLine);
rsp_break(hle, SP_STATUS_TASKDONE);
}
/***************************************************************************
@ -190,6 +192,7 @@ void jpeg_decode_OB(struct hle_t* hle)
address += (2 * 6 * SUBBLOCK_SIZE);
}
rsp_break(hle, SP_STATUS_TASKDONE);
}
@ -472,7 +475,7 @@ static void ReorderSubBlock(int16_t *dst, const int16_t *src, const unsigned int
unsigned int i;
/* source and destination sublocks cannot overlap */
assert(abs(dst - src) > SUBBLOCK_SIZE);
assert(labs(dst - src) > SUBBLOCK_SIZE);
for (i = 0; i < SUBBLOCK_SIZE; ++i)
dst[i] = src[table[i]];

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - memory.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - memory.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - mp3.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - musyx.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2013 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
@ -256,6 +256,8 @@ void musyx_v1_task(struct hle_t* hle)
dram_store_u16(hle, (uint16_t *)musyx.cc0, state_ptr + STATE_CC0, SUBFRAME_SIZE);
dram_store_u16(hle, (uint16_t *)musyx.subframe_740_last4, state_ptr + STATE_740_LAST4_V1,
4);
rsp_break(hle, SP_STATUS_TASKDONE);
}
/**************************************************************************
@ -333,6 +335,8 @@ void musyx_v2_task(struct hle_t* hle)
sfd_ptr += SFD2_VOICES + MAX_VOICES * VOICE_SIZE;
}
rsp_break(hle, SP_STATUS_TASKDONE);
}

34
src/osal_dynamiclib.h Normal file
View file

@ -0,0 +1,34 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_dynamiclib.h *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#if !defined(OSAL_DYNAMICLIB_H)
#define OSAL_DYNAMICLIB_H
#include "m64p_types.h"
m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath);
void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName);
m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle);
#endif /* #define OSAL_DYNAMICLIB_H */

View file

@ -0,0 +1,71 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_dynamiclib_unix.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "m64p_types.h"
#include "hle_external.h"
#include "osal_dynamiclib.h"
m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath)
{
if (pLibHandle == NULL || pccLibraryPath == NULL)
return M64ERR_INPUT_ASSERT;
*pLibHandle = dlopen(pccLibraryPath, RTLD_NOW);
if (*pLibHandle == NULL)
{
/* only print an error message if there is a directory separator (/) in the pathname */
/* this prevents us from throwing an error for the use case where Mupen64Plus is not installed */
if (strchr(pccLibraryPath, '/') != NULL)
HleErrorMessage(NULL, "dlopen('%s') failed: %s", pccLibraryPath, dlerror());
return M64ERR_INPUT_NOT_FOUND;
}
return M64ERR_SUCCESS;
}
void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName)
{
if (pccProcedureName == NULL)
return NULL;
return dlsym(LibHandle, pccProcedureName);
}
m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle)
{
int rval = dlclose(LibHandle);
if (rval != 0)
{
HleErrorMessage(NULL, "dlclose() failed: %s", dlerror());
return M64ERR_INTERNAL;
}
return M64ERR_SUCCESS;
}

View file

@ -0,0 +1,75 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_dynamiclib_win32.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "m64p_types.h"
#include "hle_external.h"
#include "osal_dynamiclib.h"
m64p_error osal_dynlib_open(m64p_dynlib_handle *pLibHandle, const char *pccLibraryPath)
{
if (pLibHandle == NULL || pccLibraryPath == NULL)
return M64ERR_INPUT_ASSERT;
*pLibHandle = LoadLibrary(pccLibraryPath);
if (*pLibHandle == NULL)
{
char *pchErrMsg;
DWORD dwErr = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL);
HleErrorMessage(NULL, "LoadLibrary('%s') error: %s", pccLibraryPath, pchErrMsg);
LocalFree(pchErrMsg);
return M64ERR_INPUT_NOT_FOUND;
}
return M64ERR_SUCCESS;
}
void * osal_dynlib_getproc(m64p_dynlib_handle LibHandle, const char *pccProcedureName)
{
if (pccProcedureName == NULL)
return NULL;
return GetProcAddress(LibHandle, pccProcedureName);
}
m64p_error osal_dynlib_close(m64p_dynlib_handle LibHandle)
{
int rval = FreeLibrary(LibHandle);
if (rval == 0)
{
char *pchErrMsg;
DWORD dwErr = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &pchErrMsg, 0, NULL);
HleErrorMessage(NULL, "FreeLibrary() error: %s", pchErrMsg);
LocalFree(pchErrMsg);
return M64ERR_INTERNAL;
}
return M64ERR_SUCCESS;
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - plugin.c *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -23,19 +23,42 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "common.h"
#include "hle.h"
#include "hle_internal.h"
#include "hle_external.h"
#define M64P_PLUGIN_PROTOTYPES 1
#include "m64p_common.h"
#include "m64p_config.h"
#include "m64p_frontend.h"
#include "m64p_plugin.h"
#include "m64p_types.h"
#define RSP_HLE_VERSION 0x020500
#include "osal_dynamiclib.h"
#define CONFIG_API_VERSION 0x020100
#define CONFIG_PARAM_VERSION 1.00
#define RSP_API_VERSION 0x20000
#define RSP_HLE_VERSION 0x020600
#define RSP_PLUGIN_API_VERSION 0x020000
#define RSP_HLE_CONFIG_SECTION "Rsp-HLE"
#define RSP_HLE_CONFIG_VERSION "Version"
#define RSP_HLE_CONFIG_FALLBACK "RspFallback"
#define RSP_HLE_CONFIG_HLE_GFX "DisplayListToGraphicsPlugin"
#define RSP_HLE_CONFIG_HLE_AUD "AudioListToAudioPlugin"
#define VERSION_PRINTF_SPLIT(x) (((x) >> 16) & 0xffff), (((x) >> 8) & 0xff), ((x) & 0xff)
/* Handy macro to avoid code bloat when loading symbols */
#define GET_FUNC(type, field, name) \
((field = (type)osal_dynlib_getproc(handle, name)) != NULL)
/* local variables */
static struct hle_t g_hle;
static void (*l_CheckInterrupts)(void) = NULL;
@ -45,9 +68,125 @@ static void (*l_ProcessRdpList)(void) = NULL;
static void (*l_ShowCFB)(void) = NULL;
static void (*l_DebugCallback)(void *, int, const char *) = NULL;
static void *l_DebugCallContext = NULL;
static m64p_dynlib_handle l_CoreHandle = NULL;
static int l_PluginInit = 0;
static m64p_handle l_ConfigRspHle;
static m64p_dynlib_handle l_RspFallback;
static ptr_InitiateRSP l_InitiateRSP = NULL;
static ptr_DoRspCycles l_DoRspCycles = NULL;
static ptr_RomClosed l_RomClosed = NULL;
static ptr_PluginShutdown l_PluginShutdown = NULL;
/* definitions of pointers to Core functions */
static ptr_ConfigOpenSection ConfigOpenSection = NULL;
static ptr_ConfigDeleteSection ConfigDeleteSection = NULL;
static ptr_ConfigSetParameter ConfigSetParameter = NULL;
static ptr_ConfigGetParameter ConfigGetParameter = NULL;
static ptr_ConfigSetDefaultInt ConfigSetDefaultInt = NULL;
static ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat = NULL;
static ptr_ConfigSetDefaultBool ConfigSetDefaultBool = NULL;
static ptr_ConfigSetDefaultString ConfigSetDefaultString = NULL;
static ptr_ConfigGetParamInt ConfigGetParamInt = NULL;
static ptr_ConfigGetParamFloat ConfigGetParamFloat = NULL;
static ptr_ConfigGetParamBool ConfigGetParamBool = NULL;
static ptr_ConfigGetParamString ConfigGetParamString = NULL;
static ptr_CoreDoCommand CoreDoCommand = NULL;
/* local function */
static void teardown_rsp_fallback()
{
if (l_RspFallback != NULL) {
(*l_PluginShutdown)();
osal_dynlib_close(l_RspFallback);
}
l_RspFallback = NULL;
l_DoRspCycles = NULL;
l_InitiateRSP = NULL;
l_RomClosed = NULL;
l_PluginShutdown = NULL;
}
static void setup_rsp_fallback(const char* rsp_fallback_path)
{
m64p_dynlib_handle handle = NULL;
/* reset rsp fallback */
teardown_rsp_fallback();
if (rsp_fallback_path == NULL || strlen(rsp_fallback_path) == 0) {
HleInfoMessage(NULL, "RSP Fallback disabled !");
return;
}
/* load plugin */
if (osal_dynlib_open(&handle, rsp_fallback_path) != M64ERR_SUCCESS) {
HleErrorMessage(NULL, "Can't load library: %s", rsp_fallback_path);
return;
}
/* call the GetVersion function for the plugin and check compatibility */
ptr_PluginGetVersion PluginGetVersion = (ptr_PluginGetVersion) osal_dynlib_getproc(handle, "PluginGetVersion");
if (PluginGetVersion == NULL)
{
HleErrorMessage(NULL, "library '%s' is not a Mupen64Plus library.", rsp_fallback_path);
goto close_handle;
}
m64p_plugin_type plugin_type = (m64p_plugin_type)0;
int plugin_version = 0;
const char *plugin_name = NULL;
int api_version = 0;
(*PluginGetVersion)(&plugin_type, &plugin_version, &api_version, &plugin_name, NULL);
if (plugin_type != M64PLUGIN_RSP) {
HleErrorMessage(NULL, "plugin %s is not an RSP plugin (%u)", plugin_name, plugin_type);
goto close_handle;
}
if ((api_version & 0xffff0000) != (RSP_API_VERSION & 0xffff0000)) {
HleErrorMessage(NULL, "plugin %s. Version mismatch: %u.%u. Expected >= %u.0",
plugin_name,
(uint16_t)(api_version >> 16),
(uint16_t)(api_version),
(uint16_t)(RSP_API_VERSION >> 16));
goto close_handle;
}
/* load functions */
ptr_PluginStartup PluginStartup;
if (!GET_FUNC(ptr_PluginStartup, PluginStartup, "PluginStartup") ||
!GET_FUNC(ptr_PluginShutdown, l_PluginShutdown, "PluginShutdown") ||
!GET_FUNC(ptr_DoRspCycles, l_DoRspCycles, "DoRspCycles") ||
!GET_FUNC(ptr_InitiateRSP, l_InitiateRSP, "InitiateRSP") ||
!GET_FUNC(ptr_RomClosed, l_RomClosed, "RomClosed"))
{
HleErrorMessage(NULL, "broken RSP plugin; function(s) not found.");
l_PluginShutdown = NULL;
l_DoRspCycles = NULL;
l_InitiateRSP = NULL;
l_RomClosed = NULL;
goto close_handle;
}
/* call the plugin's initialization function and make sure it starts okay */
if ((*PluginStartup)(l_CoreHandle, l_DebugCallContext, l_DebugCallback) != M64ERR_SUCCESS) {
HleErrorMessage(NULL, "Error: %s plugin library '%s' failed to start.", plugin_name, rsp_fallback_path);
goto close_handle;
}
/* OK we're done ! */
l_RspFallback = handle;
HleInfoMessage(NULL, "RSP Fallback '%s' loaded successfully !", rsp_fallback_path);
return;
close_handle:
osal_dynlib_close(handle);
}
static void DebugMessage(int level, const char *message, va_list args)
{
char msgbuf[1024];
@ -69,6 +208,14 @@ void HleVerboseMessage(void* UNUSED(user_defined), const char *message, ...)
va_end(args);
}
void HleInfoMessage(void* UNUSED(user_defined), const char *message, ...)
{
va_list args;
va_start(args, message);
DebugMessage(M64MSG_INFO, message, args);
va_end(args);
}
void HleErrorMessage(void* UNUSED(user_defined), const char *message, ...)
{
va_list args;
@ -126,10 +273,24 @@ void HleShowCFB(void* UNUSED(user_defined))
}
int HleForwardTask(void* user_defined)
{
if (l_DoRspCycles == NULL)
return -1;
(*l_DoRspCycles)(-1);
return 0;
}
/* DLL-exported functions */
EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle UNUSED(CoreLibHandle), void *Context,
EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Context,
void (*DebugCallback)(void *, int, const char *))
{
ptr_CoreGetAPIVersions CoreAPIVersionFunc;
int ConfigAPIVersion, DebugAPIVersion, VidextAPIVersion;
float fConfigParamsVersion = 0.0f;
if (l_PluginInit)
return M64ERR_ALREADY_INIT;
@ -137,7 +298,87 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle UNUSED(CoreLibHandle), v
l_DebugCallback = DebugCallback;
l_DebugCallContext = Context;
/* this plugin doesn't use any Core library functions (ex for Configuration), so no need to keep the CoreLibHandle */
/* attach and call the CoreGetAPIVersions function, check Config API version for compatibility */
CoreAPIVersionFunc = (ptr_CoreGetAPIVersions) osal_dynlib_getproc(CoreLibHandle, "CoreGetAPIVersions");
if (CoreAPIVersionFunc == NULL)
{
HleErrorMessage(NULL, "Core emulator broken; no CoreAPIVersionFunc() function found.");
return M64ERR_INCOMPATIBLE;
}
(*CoreAPIVersionFunc)(&ConfigAPIVersion, &DebugAPIVersion, &VidextAPIVersion, NULL);
if ((ConfigAPIVersion & 0xffff0000) != (CONFIG_API_VERSION & 0xffff0000))
{
HleErrorMessage(NULL, "Emulator core Config API (v%i.%i.%i) incompatible with plugin (v%i.%i.%i)",
VERSION_PRINTF_SPLIT(ConfigAPIVersion), VERSION_PRINTF_SPLIT(CONFIG_API_VERSION));
return M64ERR_INCOMPATIBLE;
}
/* Get the core config function pointers from the library handle */
ConfigOpenSection = (ptr_ConfigOpenSection) osal_dynlib_getproc(CoreLibHandle, "ConfigOpenSection");
ConfigDeleteSection = (ptr_ConfigDeleteSection) osal_dynlib_getproc(CoreLibHandle, "ConfigDeleteSection");
ConfigSetParameter = (ptr_ConfigSetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigSetParameter");
ConfigGetParameter = (ptr_ConfigGetParameter) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParameter");
ConfigSetDefaultInt = (ptr_ConfigSetDefaultInt) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultInt");
ConfigSetDefaultFloat = (ptr_ConfigSetDefaultFloat) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultFloat");
ConfigSetDefaultBool = (ptr_ConfigSetDefaultBool) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultBool");
ConfigSetDefaultString = (ptr_ConfigSetDefaultString) osal_dynlib_getproc(CoreLibHandle, "ConfigSetDefaultString");
ConfigGetParamInt = (ptr_ConfigGetParamInt) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamInt");
ConfigGetParamFloat = (ptr_ConfigGetParamFloat) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamFloat");
ConfigGetParamBool = (ptr_ConfigGetParamBool) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamBool");
ConfigGetParamString = (ptr_ConfigGetParamString) osal_dynlib_getproc(CoreLibHandle, "ConfigGetParamString");
if (!ConfigOpenSection || !ConfigDeleteSection || !ConfigSetParameter || !ConfigGetParameter ||
!ConfigSetDefaultInt || !ConfigSetDefaultFloat || !ConfigSetDefaultBool || !ConfigSetDefaultString ||
!ConfigGetParamInt || !ConfigGetParamFloat || !ConfigGetParamBool || !ConfigGetParamString)
return M64ERR_INCOMPATIBLE;
/* Get core DoCommand function */
CoreDoCommand = (ptr_CoreDoCommand) osal_dynlib_getproc(CoreLibHandle, "CoreDoCommand");
if (!CoreDoCommand) {
return M64ERR_INCOMPATIBLE;
}
/* get a configuration section handle */
if (ConfigOpenSection(RSP_HLE_CONFIG_SECTION, &l_ConfigRspHle) != M64ERR_SUCCESS)
{
HleErrorMessage(NULL, "Couldn't open config section '" RSP_HLE_CONFIG_SECTION "'");
return M64ERR_INPUT_NOT_FOUND;
}
/* check the section version number */
if (ConfigGetParameter(l_ConfigRspHle, RSP_HLE_CONFIG_VERSION, M64TYPE_FLOAT, &fConfigParamsVersion, sizeof(float)) != M64ERR_SUCCESS)
{
HleWarnMessage(NULL, "No version number in '" RSP_HLE_CONFIG_SECTION "' config section. Setting defaults.");
ConfigDeleteSection(RSP_HLE_CONFIG_SECTION);
ConfigOpenSection(RSP_HLE_CONFIG_SECTION, &l_ConfigRspHle);
}
else if (((int) fConfigParamsVersion) != ((int) CONFIG_PARAM_VERSION))
{
HleWarnMessage(NULL, "Incompatible version %.2f in '" RSP_HLE_CONFIG_SECTION "' config section: current is %.2f. Setting defaults.", fConfigParamsVersion, (float) CONFIG_PARAM_VERSION);
ConfigDeleteSection(RSP_HLE_CONFIG_SECTION);
ConfigOpenSection(RSP_HLE_CONFIG_SECTION, &l_ConfigRspHle);
}
else if ((CONFIG_PARAM_VERSION - fConfigParamsVersion) >= 0.0001f)
{
/* handle upgrades */
float fVersion = CONFIG_PARAM_VERSION;
ConfigSetParameter(l_ConfigRspHle, "Version", M64TYPE_FLOAT, &fVersion);
HleInfoMessage(NULL, "Updating parameter set version in '" RSP_HLE_CONFIG_SECTION "' config section to %.2f", fVersion);
}
/* set the default values for this plugin */
ConfigSetDefaultFloat(l_ConfigRspHle, RSP_HLE_CONFIG_VERSION, CONFIG_PARAM_VERSION,
"Mupen64Plus RSP HLE Plugin config parameter version number");
ConfigSetDefaultString(l_ConfigRspHle, RSP_HLE_CONFIG_FALLBACK, "",
"Path to a RSP plugin which will be used when encountering an unknown ucode."
"You can disable this by letting an empty string.");
ConfigSetDefaultBool(l_ConfigRspHle, RSP_HLE_CONFIG_HLE_GFX, 1,
"Send display lists to the graphics plugin");
ConfigSetDefaultBool(l_ConfigRspHle, RSP_HLE_CONFIG_HLE_AUD, 0,
"Send audio lists to the audio plugin");
l_CoreHandle = CoreLibHandle;
l_PluginInit = 1;
return M64ERR_SUCCESS;
@ -151,6 +392,9 @@ EXPORT m64p_error CALL PluginShutdown(void)
/* reset some local variable */
l_DebugCallback = NULL;
l_DebugCallContext = NULL;
l_CoreHandle = NULL;
teardown_rsp_fallback();
l_PluginInit = 0;
return M64ERR_SUCCESS;
@ -183,7 +427,7 @@ EXPORT unsigned int CALL DoRspCycles(unsigned int Cycles)
return Cycles;
}
EXPORT void CALL InitiateRSP(RSP_INFO Rsp_Info, unsigned int* UNUSED(CycleCount))
EXPORT void CALL InitiateRSP(RSP_INFO Rsp_Info, unsigned int* CycleCount)
{
hle_init(&g_hle,
Rsp_Info.RDRAM,
@ -214,9 +458,24 @@ EXPORT void CALL InitiateRSP(RSP_INFO Rsp_Info, unsigned int* UNUSED(CycleCount)
l_ProcessAlistList = Rsp_Info.ProcessAlistList;
l_ProcessRdpList = Rsp_Info.ProcessRdpList;
l_ShowCFB = Rsp_Info.ShowCFB;
setup_rsp_fallback(ConfigGetParamString(l_ConfigRspHle, RSP_HLE_CONFIG_FALLBACK));
g_hle.hle_gfx = ConfigGetParamBool(l_ConfigRspHle, RSP_HLE_CONFIG_HLE_GFX);
g_hle.hle_aud = ConfigGetParamBool(l_ConfigRspHle, RSP_HLE_CONFIG_HLE_AUD);
/* notify fallback plugin */
if (l_InitiateRSP) {
l_InitiateRSP(Rsp_Info, CycleCount);
}
}
EXPORT void CALL RomClosed(void)
{
/* do nothing */
g_hle.cached_ucodes.count = 0;
/* notify fallback plugin */
if (l_RomClosed) {
l_RomClosed();
}
}

224
src/re2.c Normal file
View file

@ -0,0 +1,224 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - re2.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2016 Gilles Siberlin *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include "hle_external.h"
#include "hle_internal.h"
#include "memory.h"
#define SATURATE8(x) ((unsigned int) x <= 255 ? x : (x < 0 ? 0: 255))
/**************************************************************************
* Resident evil 2 ucodes
**************************************************************************/
void resize_bilinear_task(struct hle_t* hle)
{
int data_ptr = *dmem_u32(hle, TASK_UCODE_DATA);
int src_addr = *dram_u32(hle, data_ptr);
int dst_addr = *dram_u32(hle, data_ptr + 4);
int dst_width = *dram_u32(hle, data_ptr + 8);
int dst_height = *dram_u32(hle, data_ptr + 12);
int x_ratio = *dram_u32(hle, data_ptr + 16);
int y_ratio = *dram_u32(hle, data_ptr + 20);
#if 0 /* unused, but keep it for documentation purpose */
int dst_stride = *dram_u32(hle, data_ptr + 24);
#endif
int src_offset = *dram_u32(hle, data_ptr + 36);
int a, b, c ,d, index, y_index, xr, yr, blue, green, red, addr, i, j;
long long x, y, x_diff, y_diff, one_min_x_diff, one_min_y_diff;
unsigned short pixel;
src_addr += (src_offset >> 16) * (320 * 3);
x = y = 0;
for(i = 0; i < dst_height; i++)
{
yr = (int)(y >> 16);
y_diff = y - (yr << 16);
one_min_y_diff = 65536 - y_diff;
y_index = yr * 320;
x = 0;
for(j = 0; j < dst_width; j++)
{
xr = (int)(x >> 16);
x_diff = x - (xr << 16);
one_min_x_diff = 65536 - x_diff;
index = y_index + xr;
addr = src_addr + (index * 3);
dram_load_u8(hle, (uint8_t*)&a, addr, 3);
dram_load_u8(hle, (uint8_t*)&b, (addr + 3), 3);
dram_load_u8(hle, (uint8_t*)&c, (addr + (320 * 3)), 3);
dram_load_u8(hle, (uint8_t*)&d, (addr + (320 * 3) + 3), 3);
blue = (int)(((a&0xff)*one_min_x_diff*one_min_y_diff + (b&0xff)*x_diff*one_min_y_diff +
(c&0xff)*y_diff*one_min_x_diff + (d&0xff)*x_diff*y_diff) >> 32);
green = (int)((((a>>8)&0xff)*one_min_x_diff*one_min_y_diff + ((b>>8)&0xff)*x_diff*one_min_y_diff +
((c>>8)&0xff)*y_diff*one_min_x_diff + ((d>>8)&0xff)*x_diff*y_diff) >> 32);
red = (int)((((a>>16)&0xff)*one_min_x_diff*one_min_y_diff + ((b>>16)&0xff)*x_diff*one_min_y_diff +
((c>>16)&0xff)*y_diff*one_min_x_diff + ((d>>16)&0xff)*x_diff*y_diff) >> 32);
blue = (blue >> 3) & 0x001f;
green = (green >> 3) & 0x001f;
red = (red >> 3) & 0x001f;
pixel = (red << 11) | (green << 6) | (blue << 1) | 1;
dram_store_u16(hle, &pixel, dst_addr, 1);
dst_addr += 2;
x += x_ratio;
}
y += y_ratio;
}
rsp_break(hle, SP_STATUS_TASKDONE);
}
static uint32_t YCbCr_to_RGBA(uint8_t Y, uint8_t Cb, uint8_t Cr)
{
int r, g, b;
r = (int)(((double)Y * 0.582199097) + (0.701004028 * (double)(Cr - 128)));
g = (int)(((double)Y * 0.582199097) - (0.357070923 * (double)(Cr - 128)) - (0.172073364 * (double)(Cb - 128)));
b = (int)(((double)Y * 0.582199097) + (0.886001587 * (double)(Cb - 128)));
r = SATURATE8(r);
g = SATURATE8(g);
b = SATURATE8(b);
return (r << 24) | (g << 16) | (b << 8) | 0;
}
void decode_video_frame_task(struct hle_t* hle)
{
int data_ptr = *dmem_u32(hle, TASK_UCODE_DATA);
int pLuminance = *dram_u32(hle, data_ptr);
int pCb = *dram_u32(hle, data_ptr + 4);
int pCr = *dram_u32(hle, data_ptr + 8);
int pDestination = *dram_u32(hle, data_ptr + 12);
int nMovieWidth = *dram_u32(hle, data_ptr + 16);
int nMovieHeight = *dram_u32(hle, data_ptr + 20);
#if 0 /* unused, but keep it for documentation purpose */
int nRowsPerDMEM = *dram_u32(hle, data_ptr + 24);
int nDMEMPerFrame = *dram_u32(hle, data_ptr + 28);
int nLengthSkipCount = *dram_u32(hle, data_ptr + 32);
#endif
int nScreenDMAIncrement = *dram_u32(hle, data_ptr + 36);
int i, j;
uint8_t Y, Cb, Cr;
uint32_t pixel;
int pY_1st_row, pY_2nd_row, pDest_1st_row, pDest_2nd_row;
for (i = 0; i < nMovieHeight; i += 2)
{
pY_1st_row = pLuminance;
pY_2nd_row = pLuminance + nMovieWidth;
pDest_1st_row = pDestination;
pDest_2nd_row = pDestination + (nScreenDMAIncrement >> 1);
for (j = 0; j < nMovieWidth; j += 2)
{
dram_load_u8(hle, (uint8_t*)&Cb, pCb++, 1);
dram_load_u8(hle, (uint8_t*)&Cr, pCr++, 1);
/*1st row*/
dram_load_u8(hle, (uint8_t*)&Y, pY_1st_row++, 1);
pixel = YCbCr_to_RGBA(Y, Cb, Cr);
dram_store_u32(hle, &pixel, pDest_1st_row, 1);
pDest_1st_row += 4;
dram_load_u8(hle, (uint8_t*)&Y, pY_1st_row++, 1);
pixel = YCbCr_to_RGBA(Y, Cb, Cr);
dram_store_u32(hle, &pixel, pDest_1st_row, 1);
pDest_1st_row += 4;
/*2nd row*/
dram_load_u8(hle, (uint8_t*)&Y, pY_2nd_row++, 1);
pixel = YCbCr_to_RGBA(Y, Cb, Cr);
dram_store_u32(hle, &pixel, pDest_2nd_row, 1);
pDest_2nd_row += 4;
dram_load_u8(hle, (uint8_t*)&Y, pY_2nd_row++, 1);
pixel = YCbCr_to_RGBA(Y, Cb, Cr);
dram_store_u32(hle, &pixel, pDest_2nd_row, 1);
pDest_2nd_row += 4;
}
pLuminance += (nMovieWidth << 1);
pDestination += nScreenDMAIncrement;
}
rsp_break(hle, SP_STATUS_TASKDONE);
}
void fill_video_double_buffer_task(struct hle_t* hle)
{
int data_ptr = *dmem_u32(hle, TASK_UCODE_DATA);
int pSrc = *dram_u32(hle, data_ptr);
int pDest = *dram_u32(hle, data_ptr + 0x4);
int width = *dram_u32(hle, data_ptr + 0x8) >> 1;
int height = *dram_u32(hle, data_ptr + 0x10) << 1;
int stride = *dram_u32(hle, data_ptr + 0x1c) >> 1;
assert((*dram_u32(hle, data_ptr + 0x28) >> 16) == 0x8000);
#if 0 /* unused, but keep it for documentation purpose */
int arg3 = *dram_u32(hle, data_ptr + 0xc);
int arg5 = *dram_u32(hle, data_ptr + 0x14);
int arg6 = *dram_u32(hle, data_ptr + 0x18);
#endif
int i, j;
int r, g, b;
uint32_t pixel, pixel1, pixel2;
for(i = 0; i < height; i++)
{
for(j = 0; j < width; j=j+4)
{
pixel1 = *dram_u32(hle, pSrc+j);
pixel2 = *dram_u32(hle, pDest+j);
r = (((pixel1 >> 24) & 0xff) + ((pixel2 >> 24) & 0xff)) >> 1;
g = (((pixel1 >> 16) & 0xff) + ((pixel2 >> 16) & 0xff)) >> 1;
b = (((pixel1 >> 8) & 0xff) + ((pixel2 >> 8) & 0xff)) >> 1;
pixel = (r << 24) | (g << 16) | (b << 8) | 0;
dram_store_u32(hle, &pixel, pDest+j, 1);
}
pSrc += stride;
pDest += stride;
}
rsp_break(hle, SP_STATUS_TASKDONE);
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - ucodes.h *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
@ -24,8 +24,23 @@
#include <stdint.h>
#define CACHED_UCODES_MAX_SIZE 16
struct hle_t;
typedef void(*ucode_func_t)(struct hle_t* hle);
struct ucode_info_t {
uint32_t uc_start;
uint32_t uc_dstart;
uint16_t uc_dsize;
ucode_func_t uc_pfunc;
};
struct cached_ucodes_t {
struct ucode_info_t infos[CACHED_UCODES_MAX_SIZE];
int count;
};
/* cic_x105 ucode */
void cicx105_ucode(struct hle_t* hle);
@ -126,7 +141,8 @@ void alist_process_nead_oot (struct hle_t* hle);
void alist_process_nead_mm (struct hle_t* hle);
void alist_process_nead_mmb (struct hle_t* hle);
void alist_process_nead_ac (struct hle_t* hle);
void alist_process_nead_mats(struct hle_t* hle);
void alist_process_nead_efz (struct hle_t* hle);
/* mp3 ucode */
void mp3_task(struct hle_t* hle, unsigned int index, uint32_t address);
@ -142,5 +158,14 @@ void jpeg_decode_PS0(struct hle_t* hle);
void jpeg_decode_PS(struct hle_t* hle);
void jpeg_decode_OB(struct hle_t* hle);
/* Resident evil 2 ucode */
void resize_bilinear_task(struct hle_t* hle);
void decode_video_frame_task(struct hle_t* hle);
void fill_video_double_buffer_task(struct hle_t* hle);
/* hvqm2 ucode */
void hvqm2_decode_sp1_task(struct hle_t* hle);
void hvqm2_decode_sp2_task(struct hle_t* hle);
#endif