Compare commits

..

No commits in common. "master" and "2.5" have entirely different histories.
master ... 2.5

34 changed files with 228 additions and 1997 deletions

View file

@ -1,152 +0,0 @@
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/*

View file

@ -1,148 +0,0 @@
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,46 +1,13 @@
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.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
675 Mass Ave, Cambridge, MA 02139, 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,71 +1,6 @@
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

View file

@ -1,40 +0,0 @@
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,61 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.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>
</PropertyGroup>
<PropertyGroup Condition="'$(WindowsTargetPlatformVersion)'=='' and '$(VisualStudioVersion)' != '14.0'">
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
<WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>
<TargetPlatformVersion>$(WindowsTargetPlatformVersion)</TargetPlatformVersion>
<Keyword>Win32Proj</Keyword>
</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>
<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>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<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>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -63,42 +33,43 @@
<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>
</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>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -106,33 +77,18 @@
<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>
<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>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@ -143,14 +99,11 @@
<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" />
@ -161,7 +114,6 @@
<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" />

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

@ -1,6 +1,6 @@
#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# * mupen64plus-rsp-hle - Makefile *
# * Mupen64Plus homepage: https://mupen64plus.org/ *
# * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
# * Copyright (C) 2008-2009 Richard Goedeken *
# * Copyright (C) 2007-2008 DarkJeztr Tillin9 *
# * *
@ -53,6 +53,7 @@ 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
@ -66,7 +67,7 @@ ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
PIC = 0
endif
ifeq ("$(OS)","NONE")
$(error OS type "$(UNAME)" not supported. Please file bug report at 'https://github.com/mupen64plus/mupen64plus-core/issues')
$(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
endif
# detect system architecture
@ -102,13 +103,6 @@ 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
@ -123,31 +117,14 @@ ifneq ("$(filter mips,$(HOST_CPU))","")
PIC ?= 1
$(warning Architecture "$(HOST_CPU)" not officially supported.')
endif
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')
$(error CPU type "$(HOST_CPU)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
endif
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# base CFLAGS, LDLIBS, and LDFLAGS
OPTFLAGS ?= -O3 -flto
WARNFLAGS ?= -Wall
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fvisibility=hidden -I$(SRCDIR)
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src
LDFLAGS += $(SHARED)
# Since we are building a shared library, we must compile with -fPIC on some architectures
@ -167,36 +144,25 @@ 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
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
CFLAGS += -m32
LDFLAGS += -Wl,-m,elf_i386
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)
OSX_SDK_PATH = $(shell xcrun --sdk macosx --show-sdk-path)
#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)
ifeq ($(CPU), X86)
ifeq ($(ARCH_DETECTED), 64BITS)
CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH)
CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot $(OSX_SDK_PATH)
else
CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.9 -isysroot $(OSX_SDK_PATH)
CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot $(OSX_SDK_PATH)
LDFLAGS += -read_only_relocs suppress
endif
endif
@ -245,7 +211,6 @@ ifeq ($(DEBUG),1)
CFLAGS += -g
INSTALL_STRIP_FLAG ?=
else
CFLAGS += -DNDEBUG
ifneq ($(OS),OSX)
INSTALL_STRIP_FLAG ?= -s
endif
@ -267,6 +232,10 @@ ifeq ($(DUMP), 1)
CFLAGS += -DENABLE_TASK_DUMP
endif
SRCDIR = ../../src
OBJDIR = _obj$(POSTFIX)
# list of source files to compile
SOURCE = \
$(SRCDIR)/alist.c \
@ -276,22 +245,12 @@ 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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) & 0xfff);
return (int16_t*)hle->alist_buffer + (pos ^ S);
}
static uint8_t* alist_u8(struct hle_t* hle, uint16_t dmem)
{
return (uint8_t*)(hle->alist_buffer + ((dmem ^ S8) & 0xfff));
return u8(hle->alist_buffer, dmem);
}
static int16_t* alist_s16(struct hle_t* hle, uint16_t dmem)
{
return (int16_t*)(hle->alist_buffer + ((dmem ^ S16) & 0xfff));
return (int16_t*)u16(hle->alist_buffer, dmem);
}
@ -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++);
#ifdef M64P_BIG_ENDIAN
#if M64P_BIG_ENDIAN
*(dst++) = l1;
*(dst++) = r1;
*(dst++) = l2;
@ -282,7 +282,6 @@ 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);
@ -293,6 +292,7 @@ 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, sizeof(save_buffer));
memcpy(hle->dram + address, (uint8_t *)save_buffer, 80);
}
void alist_envmix_ge(
@ -382,7 +382,6 @@ 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);
@ -391,6 +390,7 @@ 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,7 +458,6 @@ 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);
@ -468,6 +467,7 @@ 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]) +
(*sample(hle, ipos + 1) * lut[1]) +
(*sample(hle, ipos + 2) * lut[2]) +
(*sample(hle, ipos + 3) * lut[3]) ) >> 15);
*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));
pitch_accu += pitch;
ipos += (pitch_accu >> 16);
@ -961,7 +961,7 @@ void alist_polef(
count -= 16;
} while (count != 0);
dram_store_u32(hle, (uint32_t*)(dst - 4), address, 2);
dram_store_u16(hle, (uint16_t*)(dst - 4), address, 4);
}
void alist_iirf(
@ -1017,22 +1017,8 @@ void alist_iirf(
count -= 0x10;
} while (count > 0);
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);
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);
}
/* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
@ -150,13 +150,6 @@ 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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 & 0xfff;
uint16_t count = w2;
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 & A_INIT,
flags & 0x1,
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 & A_INIT,
flags & A_LOOP,
flags & 0x1,
flags & 0x2,
false, /* unsupported in this ucode */
hle->alist_audio.out,
hle->alist_audio.in,
@ -278,7 +278,6 @@ 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)
@ -292,7 +291,6 @@ 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)
@ -306,5 +304,4 @@ 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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 & A_VOL) {
if (flags & A_LEFT) {
if (flags & 0x4) {
if (flags & 0x2) {
hle->alist_naudio.vol[0] = w1;
hle->alist_naudio.dry = (w2 >> 16);
hle->alist_naudio.wet = w2;
}
else { /* A_RIGHT */
else {
hle->alist_naudio.target[1] = w1;
hle->alist_naudio.rate[1] = w2;
}
}
else { /* A_RATE */
else {
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 & A_INIT,
flags & 0x1,
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 & 0xfff;
uint16_t count = w2;
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 & A_INIT,
flags & A_LOOP,
flags & 0x1,
flags & 0x2,
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 & A_INIT,
flags & 0x1,
false, /* TODO: check which ABI supports it */
dmemo,
dmemi,
@ -263,16 +263,6 @@ 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)
{
@ -284,7 +274,6 @@ 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)
@ -298,7 +287,6 @@ 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)
@ -312,43 +300,29 @@ 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] = {
OVERLOAD, ADPCM, CLEARBUFF, ENVMIXER,
UNKNOWN, 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)
{
/* 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.
*/
/* TODO: see what differs from alist_process_naudio_mp3 */
static const acmd_callback_t ABI[0x10] = {
OVERLOAD, ADPCM, CLEARBUFF, ENVMIXER,
UNKNOWN, 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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 & 0xfff;
uint16_t count = w2;
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 & 0xfff;
uint16_t count = w1;
uint16_t dmem = (w2 >> 16);
alist_multQ44(hle, dmem, count, gain);
@ -372,7 +372,6 @@ 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)
@ -389,7 +388,6 @@ 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)
@ -406,7 +404,6 @@ 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)
@ -423,7 +420,6 @@ 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)
@ -440,7 +436,6 @@ 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)
@ -455,7 +450,6 @@ 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)
@ -470,7 +464,6 @@ 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)
@ -485,7 +478,6 @@ 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)
@ -500,7 +492,6 @@ 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)
@ -515,7 +506,6 @@ 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)
@ -530,27 +520,4 @@ 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2012 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -50,7 +50,5 @@ 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *

313
src/hle.c
View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - hle.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2012 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -35,28 +35,40 @@
#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 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);
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);
#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 uc_start);
static void dump_unknown_non_task(struct hle_t* hle, unsigned int uc_start);
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);
#endif
/* local variables */
static const bool FORWARD_AUDIO = false, FORWARD_GFX = true;
/* Global functions */
void hle_init(struct hle_t* hle,
unsigned char* dram,
@ -108,38 +120,14 @@ void hle_init(struct hle_t* hle,
void hle_execute(struct hle_t* hle)
{
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 (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);
}
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 */
@ -169,7 +157,7 @@ static bool is_task(struct hle_t* hle)
return (*dmem_u32(hle, TASK_UCODE_BOOT_SIZE) <= 0x1000);
}
void rsp_break(struct hle_t* hle, unsigned int setbits)
static void rsp_break(struct hle_t* hle, unsigned int setbits)
{
*hle->sp_status |= setbits | SP_STATUS_BROKE | SP_STATUS_HALT;
@ -179,66 +167,12 @@ void rsp_break(struct hle_t* hle, unsigned int setbits)
}
}
static void send_alist_to_audio_plugin(struct hle_t* hle)
static void forward_gfx_task(struct hle_t* hle)
{
HleProcessAlistList(hle->user_defined);
rsp_break(hle, SP_STATUS_TASKDONE);
}
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)
static bool try_fast_audio_dispatching(struct hle_t* hle)
{
/* identify audio ucode by using the content of ucode_data */
uint32_t ucode_data = *dmem_u32(hle, TASK_UCODE_DATA);
@ -250,11 +184,11 @@ static ucode_func_t try_audio_task_detection(struct hle_t* hle)
switch(v)
{
case 0x1e24138c: /* audio ABI (most common) */
return &alist_process_audio;
alist_process_audio(hle); return true;
case 0x1dc8138c: /* GoldenEye */
return &alist_process_audio_ge;
alist_process_audio_ge(hle); return true;
case 0x1e3c1390: /* BlastCorp, DiddyKongRacing */
return &alist_process_audio_bc;
alist_process_audio_bc(hle); return true;
default:
HleWarnMessage(hle->user_defined, "ABI1 identification regression: v=%08x", v);
}
@ -263,33 +197,30 @@ static ucode_func_t try_audio_task_detection(struct hle_t* hle)
switch(v)
{
case 0x11181350: /* MarioKart, WaveRace (E) */
return &alist_process_nead_mk;
alist_process_nead_mk(hle); return true;
case 0x111812e0: /* StarFox (J) */
return &alist_process_nead_sfj;
alist_process_nead_sfj(hle); return true;
case 0x110412ac: /* WaveRace (J RevB) */
return &alist_process_nead_wrjb;
alist_process_nead_wrjb(hle); return true;
case 0x110412cc: /* StarFox/LylatWars (except J) */
return &alist_process_nead_sf;
alist_process_nead_sf(hle); return true;
case 0x1cd01250: /* FZeroX */
return &alist_process_nead_fz;
alist_process_nead_fz(hle); return true;
case 0x1f08122c: /* YoshisStory */
return &alist_process_nead_ys;
alist_process_nead_ys(hle); return true;
case 0x1f38122c: /* 1080° Snowboarding */
return &alist_process_nead_1080;
alist_process_nead_1080(hle); return true;
case 0x1f681230: /* Zelda OoT / Zelda MM (J, J RevA) */
return &alist_process_nead_oot;
alist_process_nead_oot(hle); return true;
case 0x1f801250: /* Zelda MM (except J, J RevA, E Beta), PokemonStadium 2 */
return &alist_process_nead_mm;
alist_process_nead_mm(hle); return true;
case 0x109411f8: /* Zelda MM (E Beta) */
return &alist_process_nead_mmb;
alist_process_nead_mmb(hle); return true;
case 0x1eac11b8: /* AnimalCrossing */
return &alist_process_nead_ac;
alist_process_nead_ac(hle); return true;
case 0x00010010: /* MusyX v2 (IndianaJones, BattleForNaboo) */
return &musyx_v2_task;
case 0x1f701238: /* Mario Artist Talent Studio */
return &alist_process_nead_mats;
case 0x1f4c1230: /* FZeroX Expansion */
return &alist_process_nead_efz;
musyx_v2_task(hle); return true;
default:
HleWarnMessage(hle->user_defined, "ABI2 identification regression: v=%08x", v);
}
@ -302,172 +233,156 @@ static ucode_func_t try_audio_task_detection(struct hle_t* hle)
RogueSquadron, ResidentEvil2, PolarisSnoCross,
TheWorldIsNotEnough, RugratsInParis, NBAShowTime,
HydroThunder, Tarzan, GauntletLegend, Rush2049 */
return &musyx_v1_task;
musyx_v1_task(hle); return true;
case 0x0000127c: /* naudio (many games) */
return &alist_process_naudio;
alist_process_naudio(hle); return true;
case 0x00001280: /* BanjoKazooie */
return &alist_process_naudio_bk;
alist_process_naudio_bk(hle); return true;
case 0x1c58126c: /* DonkeyKong */
return &alist_process_naudio_dk;
alist_process_naudio_dk(hle); return true;
case 0x1ae8143c: /* BanjoTooie, JetForceGemini, MickeySpeedWayUSA, PerfectDark */
return &alist_process_naudio_mp3;
alist_process_naudio_mp3(hle); return true;
case 0x1ab0140c: /* ConkerBadFurDay */
return &alist_process_naudio_cbfd;
alist_process_naudio_cbfd(hle); return true;
default:
HleWarnMessage(hle->user_defined, "ABI3 identification regression: v=%08x", v);
}
}
return NULL;
return false;
}
static ucode_func_t try_normal_task_detection(struct hle_t* hle)
static bool try_fast_task_dispatching(struct hle_t* hle)
{
unsigned int sum =
/* 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 =
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 &task_done;
return;
/* GFX: Twintris [misleading task->type == 0] */
case 0x212ee:
if (hle->hle_gfx) {
return &send_dlist_to_gfx_plugin;
if (FORWARD_GFX) {
forward_gfx_task(hle);
return;
}
return NULL;
break;
/* JPEG: found in Pokemon Stadium J */
case 0x2c85a:
return &jpeg_decode_PS0;
jpeg_decode_PS0(hle);
return;
/* JPEG: found in Zelda Ocarina of Time, Pokemon Stadium 1, Pokemon Stadium 2 */
case 0x2caa6:
return &jpeg_decode_PS;
jpeg_decode_PS(hle);
return;
/* JPEG: found in Ogre Battle, Bottom of the 9th */
case 0x130de:
case 0x278b0:
return &jpeg_decode_OB;
jpeg_decode_OB(hle);
return;
}
/* 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;
HleWarnMessage(hle->user_defined, "unknown OSTask: sum: %x PC:%x", sum, *hle->sp_pc);
#ifdef ENABLE_TASK_DUMP
dump_unknown_task(hle, sum);
#endif
}
static ucode_func_t non_task_detection(struct hle_t* hle)
static void non_task_dispatching(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) */
return &cicx105_ucode;
cicx105_ucode(hle);
return;
}
return &unknown_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
}
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 uc_start)
static void dump_unknown_task(struct hle_t* hle, unsigned int sum)
{
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", uc_start);
sprintf(&filename[0], "task_%x.log", sum);
dump_task(hle, filename);
/* dump ucode_boot */
sprintf(&filename[0], "ucode_boot_%x.bin", uc_start);
sprintf(&filename[0], "ucode_boot_%x.bin", sum);
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", uc_start);
sprintf(&filename[0], "ucode_%x.bin", sum);
dump_binary(hle, filename, (void*)dram_u32(hle, ucode), 0xf80);
}
/* dump ucode_data */
if (ucode_data != 0) {
sprintf(&filename[0], "ucode_data_%x.bin", uc_start);
sprintf(&filename[0], "ucode_data_%x.bin", sum);
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", uc_start);
sprintf(&filename[0], "data_%x.bin", sum);
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 uc_start)
static void dump_unknown_non_task(struct hle_t* hle, unsigned int sum)
{
char filename[256];
/* dump IMEM & DMEM for further analysis */
sprintf(&filename[0], "imem_%x.bin", uc_start);
sprintf(&filename[0], "imem_%x.bin", sum);
dump_binary(hle, filename, hle->imem, 0x1000);
sprintf(&filename[0], "dmem_%x.bin", uc_start);
sprintf(&filename[0], "dmem_%x.bin", sum);
dump_binary(hle, filename, hle->dmem, 0x1000);
}

View file

@ -1,6 +1,6 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-rsp-hle - hle.h *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
@ -22,25 +22,17 @@
#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, ...) 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 HleVerboseMessage(void* user_defined, const char *message, ...);
void HleErrorMessage(void* user_defined, const char *message, ...);
void HleWarnMessage(void* user_defined, const char *message, ...);
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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
@ -57,8 +57,6 @@ 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];
@ -74,20 +72,7 @@ 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

View file

@ -1,354 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2012 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -141,7 +141,6 @@ 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);
}
/***************************************************************************
@ -151,7 +150,6 @@ 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);
}
/***************************************************************************
@ -192,7 +190,6 @@ void jpeg_decode_OB(struct hle_t* hle)
address += (2 * 6 * SUBBLOCK_SIZE);
}
rsp_break(hle, SP_STATUS_TASKDONE);
}
@ -475,7 +472,7 @@ static void ReorderSubBlock(int16_t *dst, const int16_t *src, const unsigned int
unsigned int i;
/* source and destination sublocks cannot overlap */
assert(labs(dst - src) > SUBBLOCK_SIZE);
assert(abs(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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2013 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
@ -256,8 +256,6 @@ 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);
}
/**************************************************************************
@ -335,8 +333,6 @@ void musyx_v2_task(struct hle_t* hle)
sfd_ptr += SFD2_VOICES + MAX_VOICES * VOICE_SIZE;
}
rsp_break(hle, SP_STATUS_TASKDONE);
}

View file

@ -1,34 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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

@ -1,71 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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

@ -1,75 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2014 Bobby Smiles *
* Copyright (C) 2009 Richard Goedeken *
* Copyright (C) 2002 Hacktarux *
@ -23,42 +23,19 @@
#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"
#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_HLE_VERSION 0x020500
#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;
@ -68,125 +45,9 @@ 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];
@ -208,14 +69,6 @@ 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;
@ -273,24 +126,10 @@ 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 CoreLibHandle, void *Context,
EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle UNUSED(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;
@ -298,87 +137,7 @@ EXPORT m64p_error CALL PluginStartup(m64p_dynlib_handle CoreLibHandle, void *Con
l_DebugCallback = DebugCallback;
l_DebugCallContext = Context;
/* 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;
/* this plugin doesn't use any Core library functions (ex for Configuration), so no need to keep the CoreLibHandle */
l_PluginInit = 1;
return M64ERR_SUCCESS;
@ -392,9 +151,6 @@ 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;
@ -427,7 +183,7 @@ EXPORT unsigned int CALL DoRspCycles(unsigned int Cycles)
return Cycles;
}
EXPORT void CALL InitiateRSP(RSP_INFO Rsp_Info, unsigned int* CycleCount)
EXPORT void CALL InitiateRSP(RSP_INFO Rsp_Info, unsigned int* UNUSED(CycleCount))
{
hle_init(&g_hle,
Rsp_Info.RDRAM,
@ -458,24 +214,9 @@ EXPORT void CALL InitiateRSP(RSP_INFO Rsp_Info, unsigned int* 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)
{
g_hle.cached_ucodes.count = 0;
/* notify fallback plugin */
if (l_RomClosed) {
l_RomClosed();
}
/* do nothing */
}

224
src/re2.c
View file

@ -1,224 +0,0 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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: https://mupen64plus.org/ *
* Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
* Copyright (C) 2014 Bobby Smiles *
* *
* This program is free software; you can redistribute it and/or modify *
@ -24,23 +24,8 @@
#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);
@ -141,8 +126,7 @@ 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);
@ -158,14 +142,5 @@ 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