Compare commits

..

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

350 changed files with 106074 additions and 130876 deletions

View File

@ -1,19 +0,0 @@
---
name: New Issue, Bug report, Question
about: New Issue, Bug report, Question
title: ''
labels: ''
assignees: ''
---
## State your operating system:
Windows/Mac/Linux. in case of linux, whether you use CLI, gtk2, or gtk3 version.
## DesMuME version
e.g. 0.9.13 or git master
## Isse
type here what's bothering you, in a detailed manner.

View File

@ -7,11 +7,11 @@ on:
jobs: jobs:
build: build:
name: Build DeSmuME (Linux) name: Build DeSmuME (Linux)
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v2
- name: install dependencies - name: install dependencies
run: sudo apt update && sudo apt install meson libsdl2-dev libpcap-dev libgtk-3-dev run: sudo apt update && sudo apt install meson libsdl2-dev libpcap-dev libgtk-3-dev
@ -24,73 +24,13 @@ jobs:
- name: ninja - name: ninja
run: ninja -C desmume/src/frontend/posix/build run: ninja -C desmume/src/frontend/posix/build
build_gtk2:
name: Build DeSmuME (Linux/GTK+2)
runs-on: ubuntu-24.04
steps:
- name: checkout
uses: actions/checkout@v4
- name: install dependencies
run: sudo apt update && sudo apt install autoconf libglu1-mesa-dev libsdl2-dev libpcap-dev libgtk2.0-dev
- name: buildit
run: |
cd desmume/src/frontend/posix/
autoreconf -i
./configure --prefix=/usr --enable-gdb-stub --enable-wifi
make -j8
make DESTDIR=/tmp/DeSmuME install
- name: Pack artifact
run: |
cd /tmp
tar cJf DeSmuME.tar.xz DeSmuME/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: desmume-linux-gtk2-cli-x86_64
path: /tmp/DeSmuME.tar.xz
build_mingw:
name: Build DeSmuME (mingw/i686)
runs-on: ubuntu-24.04
steps:
- name: checkout
uses: actions/checkout@v4
- name: install dependencies
run: sudo apt update && sudo apt install mingw-w64 mingw-w64-i686-dev
- name: buildit
run: |
cd desmume/src/frontend/windows/
echo "OPT=-fstrength-reduce -fthread-jumps -fcse-follow-jumps -fcse-skip-blocks -frerun-cse-after-loop -fexpensive-optimizations -fforce-addr -fomit-frame-pointer -ffast-math -march=pentium4 -mtune=pentium4 -mmmx -msse2" > config.mak
make -j8
mkdir /tmp/DeSmuME
cp desmume.exe /tmp/DeSmuME
- name: Pack artifact
run: |
cd /tmp
tar cJf DeSmuME.tar.xz DeSmuME/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: desmume-mingw-win32
path: /tmp/DeSmuME.tar.xz
build_macos: build_macos:
name: Build DeSmuME (macOS) name: Build DeSmuME (macOS)
runs-on: macos-14 runs-on: macOS-11
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v2
- name: xcodebuild - name: xcodebuild
run: | run: |
@ -103,7 +43,7 @@ jobs:
7z a DeSmuME.app.zip DeSmuME.app 7z a DeSmuME.app.zip DeSmuME.app
- name: Upload artifict - name: Upload artifict
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: macos name: macos
path: desmume/src/frontend/cocoa/desmume.xcarchive/Products/Applications/DeSmuME.app.zip path: desmume/src/frontend/cocoa/desmume.xcarchive/Products/Applications/DeSmuME.app.zip

View File

@ -6,11 +6,11 @@ on:
jobs: jobs:
build_linux: build_linux:
runs-on: ubuntu-24.04 runs-on: ubuntu-20.04
name: Build Linux name: Build Linux
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v2
- name: Install dependencies - name: Install dependencies
run: sudo apt update && sudo apt install meson libsdl2-dev libpcap-dev run: sudo apt update && sudo apt install meson libsdl2-dev libpcap-dev
@ -23,21 +23,21 @@ jobs:
- name: Build - ninja - name: Build - ninja
run: ninja -C desmume/src/frontend/interface/build run: ninja -C desmume/src/frontend/interface/build
- name: Upload artifact - name: Upload artificat
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: linux name: linux
path: desmume/src/frontend/interface/build/libdesmume.so path: desmume/src/frontend/interface/build/libdesmume.so
build_macos: build_macos:
runs-on: macos-14 runs-on: macos-10.15
name: Build MacOS name: Build MacOS
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v2
- name: Install MacOS build deps - name: Install MacOS build deps
run: brew install coreutils sdl2 meson run: brew install coreutils gcc sdl2 meson glib
- name: Build - Meson - name: Build - Meson
run: | run: |
@ -53,14 +53,14 @@ jobs:
CC: clang CC: clang
CXX: clang++ CXX: clang++
- name: Upload artifact - name: Upload artificat
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: macos name: macos
path: desmume/src/frontend/interface/build/libdesmume.dylib path: desmume/src/frontend/interface/build/libdesmume.dylib
build_windows: build_windows:
runs-on: windows-2022 runs-on: windows-2019
name: Build Windows name: Build Windows
strategy: strategy:
fail-fast: false fail-fast: false
@ -68,20 +68,18 @@ jobs:
arch: [ 'x64', 'x86' ] arch: [ 'x64', 'x86' ]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v2
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2 uses: microsoft/setup-msbuild@v1.0.2
with:
msbuild-architecture: ${{ matrix.arch }}
- name: Build - name: Build
run: | run: |
cd desmume\src\frontend\interface\windows cd desmume\src\frontend\interface\windows
MSBuild.exe DeSmuME_Interface.vcxproj /p:configuration="Release Fastbuild" /p:Platform=${{ matrix.arch }} MSBuild.exe DeSmuME_Interface.vcxproj /p:configuration="Release Fastbuild" /p:Platform=${{ matrix.arch }}
- name: Upload artifact - name: Upload artificat
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: win-${{ matrix.arch }} name: win-${{ matrix.arch }}
path: desmume/src/frontend/interface/windows/__bins/*.dll path: desmume/src/frontend/interface/windows/__bins/*.dll

View File

@ -6,15 +6,16 @@ on:
jobs: jobs:
build-sln: build-sln:
runs-on: windows-2022 runs-on: windows-2019
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- name: Setup MSBuild.exe - name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2 uses: microsoft/setup-msbuild@v1.1
with: with:
msbuild-architecture: x64 msbuild-architecture: x64
vs-version: 16.1
- name: Build solution - name: Build solution
run: | run: |
@ -23,7 +24,7 @@ jobs:
cmd /c desmume\src\frontend\windows\ci_postbuild.bat cmd /c desmume\src\frontend\windows\ci_postbuild.bat
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: desmume-win-x64 name: desmume-win-x64
path: desmume/src/frontend/windows/__bins/*.exe path: desmume/src/frontend/windows/__bins/*.exe

View File

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive

View File

@ -18,6 +18,11 @@ autoreconf -i (or alternatively: ./autogen.sh)
make -jN (where N is the number of CPU cores to use). make -jN (where N is the number of CPU cores to use).
DeSmuME provides another interface based on libglade, to use
, you'll need glade:
* http://glade.gnome.org/
To build, first cd to src/frontend/posix and run To build, first cd to src/frontend/posix and run
`meson build --buildtype=release` `meson build --buildtype=release`
@ -27,6 +32,11 @@ It will generate three programs:
1) "desmume" in the "build/gtk" directory; 1) "desmume" in the "build/gtk" directory;
2) "desmume-cli" in the "build/cli" directory. 2) "desmume-cli" in the "build/cli" directory.
If glade is installed on your system, you'll get a third
binary:
3) "desmume-glade" in the "build/gtk-glade" directory.
You can even type "ninja -C build install" to install those programs on You can even type "ninja -C build install" to install those programs on
your system (in /usr/local/ by default); then uninstalling is your system (in /usr/local/ by default); then uninstalling is
done by typing "ninja -C build uninstall". done by typing "ninja -C build uninstall".

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +0,0 @@
Tips:
* Set hotkeys for "Mic Prev Sample" and "Mic Next Sample" in the "Main" section of hotkey configuration (suggest [ and ])
* This will rotate through all the provided desmume_N.wav. You can add your own in the series, just pick the next number.
* Keep the microphone hotkey held down for as long as you want the noise to play! Just tapping it will make a very short sound indeed.
desmume_0.wav was formerly "PERFECT BLOW FOR DS EMULATORS.wav"
desmume_1.wav was formerly "noise_loud.wav"
desmume_4.wav came to us as "pcm0822m.wav"; these are alleged to work well for Giant Bowser fights in Bowser's Inside Story.

Binary file not shown.

View File

@ -374,7 +374,7 @@ namespace Database
size_t regions_num = ARRAY_SIZE(regions); size_t regions_num = ARRAY_SIZE(regions);
const char* found = strchr(regions_index,code); const char* found = strchr(regions_index,code);
if(found && found-regions_index < strlen(regions_index)) return regions[found-regions_index]; if(found) return regions[found-regions_index];
else return unknownAsString ? "???" : NULL; else return unknownAsString ? "???" : NULL;
} }

210
desmume/src/FIFO.cpp Normal file → Executable file
View File

@ -1,7 +1,7 @@
/* /*
Copyright 2006 yopyop Copyright 2006 yopyop
Copyright 2007 shash Copyright 2007 shash
Copyright 2007-2024 DeSmuME team Copyright 2007-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -44,6 +44,7 @@
#elif defined(ENABLE_ALTIVEC) #elif defined(ENABLE_ALTIVEC)
#define USEVECTORSIZE_128 #define USEVECTORSIZE_128
#define VECTORSIZE 16 #define VECTORSIZE 16
#include "./utils/colorspacehandler/colorspacehandler_AltiVec.h"
#endif #endif
#if defined(USEVECTORSIZE_512) || defined(USEVECTORSIZE_256) || defined(USEVECTORSIZE_128) #if defined(USEVECTORSIZE_512) || defined(USEVECTORSIZE_256) || defined(USEVECTORSIZE_128)
@ -339,96 +340,12 @@ void DISP_FIFOinit()
memset(&disp_fifo, 0, sizeof(DISP_FIFO)); memset(&disp_fifo, 0, sizeof(DISP_FIFO));
} }
template <typename T, size_t ADDROFFSET> void DISP_FIFOsend_u32(u32 val)
void DISP_FIFOsend(const T val)
{ {
//INFO("DISP_FIFO send value 0x%08X (head 0x%06X, tail 0x%06X)\n", val, disp_fifo.head, disp_fifo.tail); //INFO("DISP_FIFO send value 0x%08X (head 0x%06X, tail 0x%06X)\n", val, disp_fifo.head, disp_fifo.tail);
disp_fifo.buf[disp_fifo.tail] = val;
const size_t numBytes = sizeof(T); disp_fifo.tail++;
const size_t baseWriteAddress = disp_fifo.tail * sizeof(u32);
const size_t finalWriteAddress = baseWriteAddress + ADDROFFSET;
switch (numBytes)
{
case 1:
{
#ifndef MSB_FIRST
HostWriteByte((u8 *)disp_fifo.buf, (u32)finalWriteAddress, val);
#else
switch (ADDROFFSET)
{
case 0:
HostWriteByte((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 2, val);
break;
case 1:
HostWriteByte((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 3, val);
break;
case 2:
HostWriteByte((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 0, val);
break;
case 3:
HostWriteByte((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 1, val);
break;
default:
break;
}
#endif
#ifndef MSB_FIRST
if (ADDROFFSET == 3)
#else
if (ADDROFFSET == 1)
#endif
{
disp_fifo.tail++;
}
break;
}
case 2:
{
#ifndef MSB_FIRST
HostWriteWord((u8 *)disp_fifo.buf, (u32)finalWriteAddress, val);
#else
switch (ADDROFFSET)
{
case 0:
HostWriteWord((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 2, val);
break;
case 2:
HostWriteWord((u8 *)disp_fifo.buf, (u32)baseWriteAddress + 0, val);
break;
default:
break;
}
#endif
#ifndef MSB_FIRST
if (ADDROFFSET == 2)
#else
if (ADDROFFSET == 0)
#endif
{
disp_fifo.tail++;
}
break;
}
case 4:
HostWriteTwoWords((u8 *)disp_fifo.buf, (u32)finalWriteAddress, val);
disp_fifo.tail++;
break;
default:
break;
}
if (disp_fifo.tail >= 0x6000) if (disp_fifo.tail >= 0x6000)
{ {
disp_fifo.tail = 0; disp_fifo.tail = 0;
@ -463,7 +380,19 @@ void DISP_FIFOrecv_Line16(u16 *__restrict dst)
#ifdef USEMANUALVECTORIZATION #ifdef USEMANUALVECTORIZATION
if ( (disp_fifo.head + (GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16)) / sizeof(u32) <= 0x6000) && (disp_fifo.head == (disp_fifo.head & ~(VECTORSIZE - 1))) ) if ( (disp_fifo.head + (GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16)) / sizeof(u32) <= 0x6000) && (disp_fifo.head == (disp_fifo.head & ~(VECTORSIZE - 1))) )
{ {
#ifdef ENABLE_ALTIVEC
// Big-endian systems read the pixels in their correct bit order, but swap 16-bit chunks
// within 32-bit lanes, and so we can't use a standard buffer copy function here.
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16); i+=sizeof(v128u16))
{
v128u16 fifoColor = vec_ld(i, disp_fifo.buf + disp_fifo.head);
fifoColor = vec_perm( (v128u8)fifoColor, (v128u8)fifoColor, ((v128u8){2,3, 0,1, 6,7, 4,5, 10,11, 8,9, 14,15, 12,13}) );
vec_st(fifoColor, i, dst);
}
#else
buffer_copy_fast<GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16)>(dst, disp_fifo.buf + disp_fifo.head); buffer_copy_fast<GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16)>(dst, disp_fifo.buf + disp_fifo.head);
#endif // ENABLE_ALTIVEC
_DISP_FIFOrecv_LineAdvance(); _DISP_FIFOrecv_LineAdvance();
} }
else else
@ -472,11 +401,82 @@ void DISP_FIFOrecv_Line16(u16 *__restrict dst)
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16) / sizeof(u32); i++) for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16) / sizeof(u32); i++)
{ {
const u32 src = DISP_FIFOrecv_u32(); const u32 src = DISP_FIFOrecv_u32();
#ifdef MSB_FIRST
((u32 *)dst)[i] = (src >> 16) | (src << 16);
#else
((u32 *)dst)[i] = src; ((u32 *)dst)[i] = src;
#endif
} }
} }
} }
#ifdef USEMANUALVECTORIZATION
template <NDSColorFormat OUTPUTFORMAT>
void _DISP_FIFOrecv_LineOpaque16_vec(u32 *__restrict dst)
{
#ifdef ENABLE_ALTIVEC
// Big-endian systems read the pixels in their correct bit order, but swap 16-bit chunks
// within 32-bit lanes, and so we can't use a standard buffer copy function here.
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16); i+=sizeof(v128u16))
{
v128u16 fifoColor = vec_ld(i, disp_fifo.buf + disp_fifo.head);
fifoColor = vec_perm( (v128u8)fifoColor, (v128u8)fifoColor, ((v128u8){2,3, 0,1, 6,7, 4,5, 10,11, 8,9, 14,15, 12,13}) );
fifoColor = vec_or(fifoColor, ((v128u16){0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000}));
vec_st(fifoColor, i, dst);
}
#else
buffer_copy_or_constant_s16_fast<GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16), false>(dst, disp_fifo.buf + disp_fifo.head, 0x8000);
#endif // ENABLE_ALTIVEC
_DISP_FIFOrecv_LineAdvance();
}
template <NDSColorFormat OUTPUTFORMAT>
void _DISP_FIFOrecv_LineOpaque32_vec(u32 *__restrict dst)
{
#ifdef ENABLE_ALTIVEC
for (size_t i = 0, d = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16); i+=16, d+=32)
{
v128u16 fifoColor = vec_ld(0, disp_fifo.buf + disp_fifo.head);
disp_fifo.head += (sizeof(v128u16)/sizeof(u32));
if (disp_fifo.head >= 0x6000)
{
disp_fifo.head -= 0x6000;
}
v128u32 dstLo = ((v128u32){0,0,0,0});
v128u32 dstHi = ((v128u32){0,0,0,0});
fifoColor = vec_perm( (v128u8)fifoColor, (v128u8)fifoColor, ((v128u8){10,11, 8,9, 14,15, 12,13, 2,3, 0,1, 6,7, 4,5}) );
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{
ColorspaceConvert555To6665Opaque_AltiVec<false, BESwapDst>(fifoColor, dstLo, dstHi);
}
else if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev)
{
ColorspaceConvert555To8888Opaque_AltiVec<false, BESwapDst>(fifoColor, dstLo, dstHi);
}
vec_st(dstLo, d + 0, dst);
vec_st(dstHi, d + 16, dst);
}
#else
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{
ColorspaceConvertBuffer555To6665Opaque<false, false, BESwapDst>((u16 *)(disp_fifo.buf + disp_fifo.head), dst, GPU_FRAMEBUFFER_NATIVE_WIDTH);
}
else if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev)
{
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>((u16 *)(disp_fifo.buf + disp_fifo.head), dst, GPU_FRAMEBUFFER_NATIVE_WIDTH);
}
_DISP_FIFOrecv_LineAdvance();
#endif // ENABLE_ALTIVEC
}
#endif // USEMANUALVECTORIZATION
template <NDSColorFormat OUTPUTFORMAT> template <NDSColorFormat OUTPUTFORMAT>
void DISP_FIFOrecv_LineOpaque(u32 *__restrict dst) void DISP_FIFOrecv_LineOpaque(u32 *__restrict dst)
{ {
@ -485,28 +485,26 @@ void DISP_FIFOrecv_LineOpaque(u32 *__restrict dst)
{ {
if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev)
{ {
buffer_copy_or_constant_s16_fast<GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16), false>(dst, disp_fifo.buf + disp_fifo.head, 0x8000); _DISP_FIFOrecv_LineOpaque16_vec<OUTPUTFORMAT>(dst);
} }
else if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) else
{ {
ColorspaceConvertBuffer555xTo6665Opaque<false, false, BESwapDst>((u16 *)(disp_fifo.buf + disp_fifo.head), dst, GPU_FRAMEBUFFER_NATIVE_WIDTH); _DISP_FIFOrecv_LineOpaque32_vec<OUTPUTFORMAT>(dst);
} }
else if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev)
{
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>((u16 *)(disp_fifo.buf + disp_fifo.head), dst, GPU_FRAMEBUFFER_NATIVE_WIDTH);
}
_DISP_FIFOrecv_LineAdvance();
} }
else else
#endif // USEMANUALVECTORIZATION #endif
{ {
if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev)
{ {
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16) / sizeof(u32); i++) for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16) / sizeof(u32); i++)
{ {
const u32 src = DISP_FIFOrecv_u32(); const u32 src = DISP_FIFOrecv_u32();
#ifdef MSB_FIRST
dst[i] = (src >> 16) | (src << 16) | 0x80008000;
#else
dst[i] = src | 0x80008000; dst[i] = src | 0x80008000;
#endif
} }
} }
else else
@ -517,13 +515,13 @@ void DISP_FIFOrecv_LineOpaque(u32 *__restrict dst)
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
dst[i+0] = ColorspaceConvert555To6665Opaque<false>(src >> 0); dst[i+0] = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>((src >> 0) & 0x7FFF) );
dst[i+1] = ColorspaceConvert555To6665Opaque<false>(src >> 16); dst[i+1] = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>((src >> 16) & 0x7FFF) );
} }
else if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) else if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev)
{ {
dst[i+0] = ColorspaceConvert555To8888Opaque<false>(src >> 0); dst[i+0] = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>((src >> 0) & 0x7FFF) );
dst[i+1] = ColorspaceConvert555To8888Opaque<false>(src >> 16); dst[i+1] = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>((src >> 16) & 0x7FFF) );
} }
} }
} }
@ -536,14 +534,6 @@ void DISP_FIFOreset()
disp_fifo.tail = 0; disp_fifo.tail = 0;
} }
template void DISP_FIFOsend< u8, 0>(const u8 val);
template void DISP_FIFOsend< u8, 1>(const u8 val);
template void DISP_FIFOsend< u8, 2>(const u8 val);
template void DISP_FIFOsend< u8, 3>(const u8 val);
template void DISP_FIFOsend<u16, 0>(const u16 val);
template void DISP_FIFOsend<u16, 2>(const u16 val);
template void DISP_FIFOsend<u32, 0>(const u32 val);
template void DISP_FIFOrecv_LineOpaque<NDSColorFormat_BGR555_Rev>(u32 *__restrict dst); template void DISP_FIFOrecv_LineOpaque<NDSColorFormat_BGR555_Rev>(u32 *__restrict dst);
template void DISP_FIFOrecv_LineOpaque<NDSColorFormat_BGR666_Rev>(u32 *__restrict dst); template void DISP_FIFOrecv_LineOpaque<NDSColorFormat_BGR666_Rev>(u32 *__restrict dst);
template void DISP_FIFOrecv_LineOpaque<NDSColorFormat_BGR888_Rev>(u32 *__restrict dst); template void DISP_FIFOrecv_LineOpaque<NDSColorFormat_BGR888_Rev>(u32 *__restrict dst);

View File

@ -1,7 +1,7 @@
/* /*
Copyright 2006 yopyop Copyright 2006 yopyop
Copyright 2007 shash Copyright 2007 shash
Copyright 2007-2022 DeSmuME team Copyright 2007-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -87,7 +87,7 @@ typedef struct
extern DISP_FIFO disp_fifo; extern DISP_FIFO disp_fifo;
void DISP_FIFOinit(); void DISP_FIFOinit();
template<typename T, size_t ADDROFFSET> void DISP_FIFOsend(const T val); void DISP_FIFOsend_u32(u32 val);
u32 DISP_FIFOrecv_u32(); u32 DISP_FIFOrecv_u32();
void DISP_FIFOrecv_Line16(u16 *__restrict dst); void DISP_FIFOrecv_Line16(u16 *__restrict dst);

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
Copyright (C) 2006 yopyop Copyright (C) 2006 yopyop
Copyright (C) 2006-2007 Theo Berkau Copyright (C) 2006-2007 Theo Berkau
Copyright (C) 2007 shash Copyright (C) 2007 shash
Copyright (C) 2009-2025 DeSmuME team Copyright (C) 2009-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -102,7 +102,7 @@ enum DisplayCaptureSize
DisplayCaptureSize_128x128 = 0, DisplayCaptureSize_128x128 = 0,
DisplayCaptureSize_256x64 = 1, DisplayCaptureSize_256x64 = 1,
DisplayCaptureSize_256x128 = 2, DisplayCaptureSize_256x128 = 2,
DisplayCaptureSize_256x192 = 3 DisplayCaptureSize_256x192 = 3,
}; };
typedef union typedef union
@ -117,7 +117,7 @@ typedef union
u8 OBJ_Tile_mapping:1; // 4: A+B; 0=2D (32KB), 1=1D (32..256KB) u8 OBJ_Tile_mapping:1; // 4: A+B; 0=2D (32KB), 1=1D (32..256KB)
u8 OBJ_BMP_2D_dim:1; // 5: A+B; 0=128x512, 1=256x256 pixels u8 OBJ_BMP_2D_dim:1; // 5: A+B; 0=128x512, 1=256x256 pixels
u8 OBJ_BMP_mapping:1; // 6: A+B; 0=2D (128KB), 1=1D (128..256KB) u8 OBJ_BMP_mapping:1; // 6: A+B; 0=2D (128KB), 1=1D (128..256KB)
u8 ForceBlank:1; // 7: A+B; 0=Disable, 1=Enable (causes the line to render all white) u8 ForceBlank:1; // 7: A+B;
u8 BG0_Enable:1; // 8: A+B; 0=Disable, 1=Enable u8 BG0_Enable:1; // 8: A+B; 0=Disable, 1=Enable
u8 BG1_Enable:1; // 9: A+B; 0=Disable, 1=Enable u8 BG1_Enable:1; // 9: A+B; 0=Disable, 1=Enable
@ -143,7 +143,7 @@ typedef union
u8 ExBGxPalette_Enable:1; // 30: A+B; 0=Disable, 1=Enable BG extended Palette u8 ExBGxPalette_Enable:1; // 30: A+B; 0=Disable, 1=Enable BG extended Palette
u8 ExOBJPalette_Enable:1; // 31: A+B; 0=Disable, 1=Enable OBJ extended Palette u8 ExOBJPalette_Enable:1; // 31: A+B; 0=Disable, 1=Enable OBJ extended Palette
#else #else
u8 ForceBlank:1; // 7: A+B; 0=Disable, 1=Enable (causes the line to render all white) u8 ForceBlank:1; // 7: A+B;
u8 OBJ_BMP_mapping:1; // 6: A+B; 0=2D (128KB), 1=1D (128..256KB) u8 OBJ_BMP_mapping:1; // 6: A+B; 0=2D (128KB), 1=1D (128..256KB)
u8 OBJ_BMP_2D_dim:1; // 5: A+B; 0=128x512, 1=256x256 pixels u8 OBJ_BMP_2D_dim:1; // 5: A+B; 0=128x512, 1=256x256 pixels
u8 OBJ_Tile_mapping:1; // 4: A+B; 0=2D (32KB), 1=1D (32..256KB) u8 OBJ_Tile_mapping:1; // 4: A+B; 0=2D (32KB), 1=1D (32..256KB)
@ -581,7 +581,7 @@ typedef union
u8 PolygonShading:1; // 1: Polygon shading mode, interacts with POLYGON_ATTR (0x40004A4); 0=Toon Shading, 1=Highlight Shading u8 PolygonShading:1; // 1: Polygon shading mode, interacts with POLYGON_ATTR (0x40004A4); 0=Toon Shading, 1=Highlight Shading
u8 EnableAlphaTest:1; // 2: Perform alpha test, interacts with ALPHA_TEST_REF (0x4000340); 0=Disable, 1=Enable u8 EnableAlphaTest:1; // 2: Perform alpha test, interacts with ALPHA_TEST_REF (0x4000340); 0=Disable, 1=Enable
u8 EnableAlphaBlending:1; // 3: Perform alpha blending, interacts with POLYGON_ATTR (0x40004A4); 0=Disable, 1=Enable u8 EnableAlphaBlending:1; // 3: Perform alpha blending, interacts with POLYGON_ATTR (0x40004A4); 0=Disable, 1=Enable
u8 EnableAntialiasing:1; // 4: Render polygon edges with antialiasing; 0=Disable, 1=Enable u8 EnableAntiAliasing:1; // 4: Render polygon edges with antialiasing; 0=Disable, 1=Enable
u8 EnableEdgeMarking:1; // 5: Perform polygon edge marking, interacts with EDGE_COLOR (0x4000330); 0=Disable, 1=Enable u8 EnableEdgeMarking:1; // 5: Perform polygon edge marking, interacts with EDGE_COLOR (0x4000330); 0=Disable, 1=Enable
u8 FogOnlyAlpha:1; // 6: Apply fog to the alpha channel only, interacts with FOG_COLOR (0x4000358) / FOG_TABLE (0x4000360); 0=Color+Alpha, 1=Alpha u8 FogOnlyAlpha:1; // 6: Apply fog to the alpha channel only, interacts with FOG_COLOR (0x4000358) / FOG_TABLE (0x4000360); 0=Color+Alpha, 1=Alpha
u8 EnableFog:1; // 7: Perform fog rendering, interacts with FOG_COLOR (0x4000358) / FOG_OFFSET (0x400035C) / FOG_TABLE (0x4000360); u8 EnableFog:1; // 7: Perform fog rendering, interacts with FOG_COLOR (0x4000358) / FOG_OFFSET (0x400035C) / FOG_TABLE (0x4000360);
@ -600,7 +600,7 @@ typedef union
// 0=Disable, 1=Enable // 0=Disable, 1=Enable
u8 FogOnlyAlpha:1; // 6: Apply fog to the alpha channel only, interacts with FOG_COLOR (0x4000358) / FOG_TABLE (0x4000360); 0=Color+Alpha, 1=Alpha u8 FogOnlyAlpha:1; // 6: Apply fog to the alpha channel only, interacts with FOG_COLOR (0x4000358) / FOG_TABLE (0x4000360); 0=Color+Alpha, 1=Alpha
u8 EnableEdgeMarking:1; // 5: Perform polygon edge marking, interacts with EDGE_COLOR (0x4000330); 0=Disable, 1=Enable u8 EnableEdgeMarking:1; // 5: Perform polygon edge marking, interacts with EDGE_COLOR (0x4000330); 0=Disable, 1=Enable
u8 EnableAntialiasing:1; // 4: Render polygon edges with antialiasing; 0=Disable, 1=Enable u8 EnableAntiAliasing:1; // 4: Render polygon edges with antialiasing; 0=Disable, 1=Enable
u8 EnableAlphaBlending:1; // 3: Perform alpha blending, interacts with POLYGON_ATTR (0x40004A4); 0=Disable, 1=Enable u8 EnableAlphaBlending:1; // 3: Perform alpha blending, interacts with POLYGON_ATTR (0x40004A4); 0=Disable, 1=Enable
u8 EnableAlphaTest:1; // 2: Perform alpha test, interacts with ALPHA_TEST_REF (0x4000340); 0=Disable, 1=Enable u8 EnableAlphaTest:1; // 2: Perform alpha test, interacts with ALPHA_TEST_REF (0x4000340); 0=Disable, 1=Enable
u8 PolygonShading:1; // 1: Polygon shading mode, interacts with POLYGON_ATTR (0x40004A4); 0=Toon Shading, 1=Highlight Shading u8 PolygonShading:1; // 1: Polygon shading mode, interacts with POLYGON_ATTR (0x40004A4); 0=Toon Shading, 1=Highlight Shading
@ -929,6 +929,45 @@ typedef union
u16 val; u16 val;
} TILEENTRY; } TILEENTRY;
/*
this structure is for color representation,
it holds 5 meaningful bits per color channel (red,green,blue)
and 1 meaningful bit for alpha representation
this bit can be unused or used for special FX
*/
struct _COLOR { // abgr x555
#ifdef MSB_FIRST
unsigned alpha:1; // sometimes it is unused (pad)
unsigned blue:5;
unsigned green:5;
unsigned red:5;
#else
unsigned red:5;
unsigned green:5;
unsigned blue:5;
unsigned alpha:1; // sometimes it is unused (pad)
#endif
};
struct _COLORx { // abgr x555
unsigned bgr:15;
unsigned alpha:1; // sometimes it is unused (pad)
};
typedef union
{
struct _COLOR bits;
struct _COLORx bitx;
u16 val;
} COLOR;
#define COLOR_16_32(w,i) \
/* doesnt matter who's 16bit who's 32bit */ \
i.bits.red = w.bits.red; \
i.bits.green = w.bits.green; \
i.bits.blue = w.bits.blue; \
i.bits.alpha = w.bits.alpha;
typedef union typedef union
{ {
u16 attr[4]; u16 attr[4];
@ -1291,7 +1330,7 @@ typedef struct
GPUDisplayMode displayOutputMode; GPUDisplayMode displayOutputMode;
u16 backdropColor16; u16 backdropColor16;
u16 workingBackdropColor16; u16 workingBackdropColor16;
Color4u8 workingBackdropColor32; FragmentColor workingBackdropColor32;
ColorEffect colorEffect; ColorEffect colorEffect;
u8 blendEVA; u8 blendEVA;
u8 blendEVB; u8 blendEVB;
@ -1302,12 +1341,12 @@ typedef struct
bool masterBrightnessIsMaxOrMin; bool masterBrightnessIsMaxOrMin;
TBlendTable *blendTable555; TBlendTable *blendTable555;
Color5551 *brightnessUpTable555; u16 *brightnessUpTable555;
Color4u8 *brightnessUpTable666; FragmentColor *brightnessUpTable666;
Color4u8 *brightnessUpTable888; FragmentColor *brightnessUpTable888;
Color5551 *brightnessDownTable555; u16 *brightnessDownTable555;
Color4u8 *brightnessDownTable666; FragmentColor *brightnessDownTable666;
Color4u8 *brightnessDownTable888; FragmentColor *brightnessDownTable888;
u8 WIN0_enable[6]; u8 WIN0_enable[6];
u8 WIN1_enable[6]; u8 WIN1_enable[6];
@ -1347,8 +1386,8 @@ typedef struct
size_t xNative; size_t xNative;
size_t xCustom; size_t xCustom;
void **lineColor; void **lineColor;
Color5551 *lineColor16; u16 *lineColor16;
Color4u8 *lineColor32; FragmentColor *lineColor32;
u8 *lineLayerID; u8 *lineLayerID;
} GPUEngineTargetState; } GPUEngineTargetState;
@ -1425,7 +1464,7 @@ protected:
itemsForPriority_t _itemsForPriority[NB_PRIORITIES]; itemsForPriority_t _itemsForPriority[NB_PRIORITIES];
struct MosaicColor { struct MosaicColor {
CACHE_ALIGN u16 bg[4][GPU_FRAMEBUFFER_NATIVE_WIDTH + 64]; // Pad this buffer a little bit to avoid buffer overruns with vectorized gather instructions. CACHE_ALIGN u16 bg[4][GPU_FRAMEBUFFER_NATIVE_WIDTH + sizeof(u32)]; // Pad this buffer a little bit to avoid buffer overruns with vectorized gather instructions.
struct Obj { struct Obj {
u16 color; u16 color;
u8 alpha; u8 alpha;
@ -1464,7 +1503,7 @@ protected:
volatile s32 _asyncClearLineCustom; volatile s32 _asyncClearLineCustom;
volatile s32 _asyncClearInterrupt; volatile s32 _asyncClearInterrupt;
u16 _asyncClearBackdropColor16; // Do not modify this variable directly. u16 _asyncClearBackdropColor16; // Do not modify this variable directly.
Color4u8 _asyncClearBackdropColor32; // Do not modify this variable directly. FragmentColor _asyncClearBackdropColor32; // Do not modify this variable directly.
bool _asyncClearUseInternalCustomBuffer; // Do not modify this variable directly. bool _asyncClearUseInternalCustomBuffer; // Do not modify this variable directly.
void _ResortBGLayers(); void _ResortBGLayers();
@ -1484,11 +1523,11 @@ protected:
template<bool MOSAIC> void _PrecompositeNativeToCustomLineBG(GPUEngineCompositorInfo &compInfo); template<bool MOSAIC> void _PrecompositeNativeToCustomLineBG(GPUEngineCompositorInfo &compInfo);
template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> void _CompositeNativeLineOBJ(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const Color4u8 *__restrict srcColorNative32); template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> void _CompositeNativeLineOBJ(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const FragmentColor *__restrict srcColorNative32);
template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST> void _CompositeLineDeferred(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorCustom16, const u8 *__restrict srcIndexCustom); template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST> void _CompositeLineDeferred(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorCustom16, const u8 *__restrict srcIndexCustom);
template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST> void _CompositeVRAMLineDeferred(GPUEngineCompositorInfo &compInfo, const void *__restrict vramColorPtr); template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST> void _CompositeVRAMLineDeferred(GPUEngineCompositorInfo &compInfo, const void *__restrict vramColorPtr);
template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> void _CompositeNativeLineOBJ_LoopOp(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const Color4u8 *__restrict srcColorNative32); template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> void _CompositeNativeLineOBJ_LoopOp(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const FragmentColor *__restrict srcColorNative32);
template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST> size_t _CompositeLineDeferred_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const u16 *__restrict srcColorCustom16, const u8 *__restrict srcIndexCustom); template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST> size_t _CompositeLineDeferred_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const u16 *__restrict srcColorCustom16, const u8 *__restrict srcIndexCustom);
template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST> size_t _CompositeVRAMLineDeferred_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const void *__restrict vramColorPtr); template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST> size_t _CompositeVRAMLineDeferred_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const void *__restrict vramColorPtr);
@ -1504,8 +1543,6 @@ protected:
void _RenderLine_SetupSprites(GPUEngineCompositorInfo &compInfo); void _RenderLine_SetupSprites(GPUEngineCompositorInfo &compInfo);
template<NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> void _RenderLine_Layers(GPUEngineCompositorInfo &compInfo); template<NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> void _RenderLine_Layers(GPUEngineCompositorInfo &compInfo);
void _RenderLineBlank(const size_t l);
void _HandleDisplayModeOff(const size_t l); void _HandleDisplayModeOff(const size_t l);
void _HandleDisplayModeNormal(const size_t l); void _HandleDisplayModeNormal(const size_t l);
@ -1572,7 +1609,6 @@ public:
const GPU_IOREG& GetIORegisterMap() const; const GPU_IOREG& GetIORegisterMap() const;
bool IsForceBlankSet() const;
bool IsMasterBrightMaxOrMin() const; bool IsMasterBrightMaxOrMin() const;
bool GetEnableState(); bool GetEnableState();
@ -1584,9 +1620,9 @@ public:
void ApplySettings(); void ApplySettings();
void RenderLineClearAsync(); void RenderLineClearAsync();
void RenderLineClearAsyncStart(bool willClearInternalCustomBuffer, size_t startLineIndex, u16 clearColor16, Color4u8 clearColor32); void RenderLineClearAsyncStart(bool willClearInternalCustomBuffer, s32 startLineIndex, u16 clearColor16, FragmentColor clearColor32);
void RenderLineClearAsyncFinish(); void RenderLineClearAsyncFinish();
void RenderLineClearAsyncWaitForCustomLine(const size_t l); void RenderLineClearAsyncWaitForCustomLine(const s32 l);
void TransitionRenderStatesToDisplayInfo(NDSDisplayInfo &mutableInfo); void TransitionRenderStatesToDisplayInfo(NDSDisplayInfo &mutableInfo);
@ -1615,12 +1651,12 @@ private:
protected: protected:
CACHE_ALIGN u16 _fifoLine16[GPU_FRAMEBUFFER_NATIVE_WIDTH]; CACHE_ALIGN u16 _fifoLine16[GPU_FRAMEBUFFER_NATIVE_WIDTH];
CACHE_ALIGN Color4u8 _fifoLine32[GPU_FRAMEBUFFER_NATIVE_WIDTH]; CACHE_ALIGN FragmentColor _fifoLine32[GPU_FRAMEBUFFER_NATIVE_WIDTH];
CACHE_ALIGN u16 _VRAMNativeBlockCaptureCopy[GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_VRAM_BLOCK_LINES * 4]; CACHE_ALIGN u16 _VRAMNativeBlockCaptureCopy[GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_VRAM_BLOCK_LINES * 4];
u16 *_VRAMNativeBlockCaptureCopyPtr[4]; u16 *_VRAMNativeBlockCaptureCopyPtr[4];
Color4u8 *_3DFramebufferMain; FragmentColor *_3DFramebufferMain;
u16 *_3DFramebuffer16; u16 *_3DFramebuffer16;
u16 *_VRAMNativeBlockPtr[4]; u16 *_VRAMNativeBlockPtr[4];
@ -1632,8 +1668,8 @@ protected:
u16 *_captureWorkingDisplay16; u16 *_captureWorkingDisplay16;
u16 *_captureWorkingA16; u16 *_captureWorkingA16;
u16 *_captureWorkingB16; u16 *_captureWorkingB16;
Color4u8 *_captureWorkingA32; FragmentColor *_captureWorkingA32;
Color4u8 *_captureWorkingB32; FragmentColor *_captureWorkingB32;
DISPCAPCNT_parsed _dispCapCnt; DISPCAPCNT_parsed _dispCapCnt;
bool _displayCaptureEnable; bool _displayCaptureEnable;
@ -1656,10 +1692,10 @@ protected:
void _RenderLine_DispCapture_Copy(const GPUEngineLineInfo &lineInfo, const void *src, void *dst, const size_t captureLengthExt); // Do not use restrict pointers, since src and dst can be the same void _RenderLine_DispCapture_Copy(const GPUEngineLineInfo &lineInfo, const void *src, void *dst, const size_t captureLengthExt); // Do not use restrict pointers, since src and dst can be the same
u16 _RenderLine_DispCapture_BlendFunc(const u16 srcA, const u16 srcB, const u8 blendEVA, const u8 blendEVB); u16 _RenderLine_DispCapture_BlendFunc(const u16 srcA, const u16 srcB, const u8 blendEVA, const u8 blendEVB);
template<NDSColorFormat COLORFORMAT> Color4u8 _RenderLine_DispCapture_BlendFunc(const Color4u8 srcA, const Color4u8 srcB, const u8 blendEVA, const u8 blendEVB); template<NDSColorFormat COLORFORMAT> FragmentColor _RenderLine_DispCapture_BlendFunc(const FragmentColor srcA, const FragmentColor srcB, const u8 blendEVA, const u8 blendEVB);
template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> template<GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST>
size_t _RenderLine_Layer3D_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const Color4u8 *__restrict srcLinePtr); size_t _RenderLine_Layer3D_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const FragmentColor *__restrict srcLinePtr);
template<NDSColorFormat OUTPUTFORMAT> template<NDSColorFormat OUTPUTFORMAT>
void _RenderLine_DispCapture_Blend_Buffer(const void *srcA, const void *srcB, void *dst, const u8 blendEVA, const u8 blendEVB, const size_t pixCount); // Do not use restrict pointers, since srcB and dst can be the same void _RenderLine_DispCapture_Blend_Buffer(const void *srcA, const void *srcB, void *dst, const u8 blendEVA, const u8 blendEVB, const size_t pixCount); // Do not use restrict pointers, since srcB and dst can be the same
@ -1680,7 +1716,7 @@ public:
void ParseReg_DISPCAPCNT(); void ParseReg_DISPCAPCNT();
bool IsLineCaptureNative(const size_t blockID, const size_t blockLine); bool IsLineCaptureNative(const size_t blockID, const size_t blockLine);
void* GetCustomVRAMBlockPtr(const size_t blockID); void* GetCustomVRAMBlockPtr(const size_t blockID);
Color4u8* Get3DFramebufferMain() const; FragmentColor* Get3DFramebufferMain() const;
u16* Get3DFramebuffer16() const; u16* Get3DFramebuffer16() const;
virtual void AllocateWorkingBuffers(NDSColorFormat requestedColorFormat, size_t w, size_t h); virtual void AllocateWorkingBuffers(NDSColorFormat requestedColorFormat, size_t w, size_t h);
@ -1783,8 +1819,8 @@ public:
bool IsCustomSizeRequested() const; bool IsCustomSizeRequested() const;
void* GetRenderedBuffer() const; void* GetRenderedBuffer() const;
size_t GetRenderedWidth() const; size_t GetRenderedWidth() const;
size_t GetRenderedHeight() const; size_t GetRenderedHeight() const;
bool IsEnabled() const; bool IsEnabled() const;
void SetIsEnabled(bool stateIsEnabled); void SetIsEnabled(bool stateIsEnabled);
@ -1804,8 +1840,6 @@ public:
class GPUEventHandler class GPUEventHandler
{ {
public: public:
virtual ~GPUEventHandler() {};
virtual void DidFrameBegin(const size_t line, const bool isFrameSkipRequested, const size_t pageCount, u8 &selectedBufferIndexInOut) = 0; virtual void DidFrameBegin(const size_t line, const bool isFrameSkipRequested, const size_t pageCount, u8 &selectedBufferIndexInOut) = 0;
virtual void DidFrameEnd(bool isFrameSkipped, const NDSDisplayInfo &latestDisplayInfo) = 0; virtual void DidFrameEnd(bool isFrameSkipped, const NDSDisplayInfo &latestDisplayInfo) = 0;
virtual void DidRender3DBegin() = 0; virtual void DidRender3DBegin() = 0;
@ -1822,8 +1856,6 @@ public:
class GPUEventHandlerDefault : public GPUEventHandler class GPUEventHandlerDefault : public GPUEventHandler
{ {
public: public:
virtual ~GPUEventHandlerDefault() {};
virtual void DidFrameBegin(const size_t line, const bool isFrameSkipRequested, const size_t pageCount, u8 &selectedBufferIndexInOut); virtual void DidFrameBegin(const size_t line, const bool isFrameSkipRequested, const size_t pageCount, u8 &selectedBufferIndexInOut);
virtual void DidFrameEnd(bool isFrameSkipped, const NDSDisplayInfo &latestDisplayInfo) {}; virtual void DidFrameEnd(bool isFrameSkipped, const NDSDisplayInfo &latestDisplayInfo) {};
virtual void DidRender3DBegin() {}; virtual void DidRender3DBegin() {};

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2021-2025 DeSmuME team Copyright (C) 2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -31,160 +31,177 @@ static CACHE_ALIGN u32 _gpuDstPitchCount[GPU_FRAMEBUFFER_NATIVE_WIDTH]; // Key:
static CACHE_ALIGN u32 _gpuDstPitchIndex[GPU_FRAMEBUFFER_NATIVE_WIDTH]; // Key: Source pixel index in x-dimension / Value: First destination pixel that maps to the source pixel static CACHE_ALIGN u32 _gpuDstPitchIndex[GPU_FRAMEBUFFER_NATIVE_WIDTH]; // Key: Source pixel index in x-dimension / Value: First destination pixel that maps to the source pixel
u8 PixelOperation::BlendTable555[17][17][32][32]; u8 PixelOperation::BlendTable555[17][17][32][32];
Color5551 PixelOperation::BrightnessUpTable555[17][0x8000]; u16 PixelOperation::BrightnessUpTable555[17][0x8000];
Color4u8 PixelOperation::BrightnessUpTable666[17][0x8000]; FragmentColor PixelOperation::BrightnessUpTable666[17][0x8000];
Color4u8 PixelOperation::BrightnessUpTable888[17][0x8000]; FragmentColor PixelOperation::BrightnessUpTable888[17][0x8000];
Color5551 PixelOperation::BrightnessDownTable555[17][0x8000]; u16 PixelOperation::BrightnessDownTable555[17][0x8000];
Color4u8 PixelOperation::BrightnessDownTable666[17][0x8000]; FragmentColor PixelOperation::BrightnessDownTable666[17][0x8000];
Color4u8 PixelOperation::BrightnessDownTable888[17][0x8000]; FragmentColor PixelOperation::BrightnessDownTable888[17][0x8000];
static CACHE_ALIGN ColorOperation colorop; static CACHE_ALIGN ColorOperation colorop;
static CACHE_ALIGN PixelOperation pixelop; static CACHE_ALIGN PixelOperation pixelop;
FORCEINLINE Color5551 ColorOperation::blend(const Color5551 colA, const Color5551 colB, const u16 blendEVA, const u16 blendEVB) const FORCEINLINE u16 ColorOperation::blend(const u16 colA, const u16 colB, const u16 blendEVA, const u16 blendEVB) const
{ {
const u16 r = ( (colA.r * blendEVA) + (colB.r * blendEVB) ) / 16; u16 ra = colA & 0x001F;
const u16 g = ( (colA.g * blendEVA) + (colB.g * blendEVB) ) / 16; u16 ga = (colA >> 5) & 0x001F;
const u16 b = ( (colA.b * blendEVA) + (colB.b * blendEVB) ) / 16; u16 ba = (colA >> 10) & 0x001F;
u16 rb = colB & 0x001F;
u16 gb = (colB >> 5) & 0x001F;
u16 bb = (colB >> 10) & 0x001F;
Color5551 outColor; ra = ( (ra * blendEVA) + (rb * blendEVB) ) / 16;
outColor.r = (r > 31) ? 31 : r; ga = ( (ga * blendEVA) + (gb * blendEVB) ) / 16;
outColor.g = (g > 31) ? 31 : g; ba = ( (ba * blendEVA) + (bb * blendEVB) ) / 16;
outColor.b = (b > 31) ? 31 : b;
outColor.a = 0;
return outColor; ra = (ra > 31) ? 31 : ra;
ga = (ga > 31) ? 31 : ga;
ba = (ba > 31) ? 31 : ba;
return ra | (ga << 5) | (ba << 10);
} }
FORCEINLINE Color5551 ColorOperation::blend(const Color5551 colA, const Color5551 colB, const TBlendTable *blendTable) const FORCEINLINE u16 ColorOperation::blend(const u16 colA, const u16 colB, const TBlendTable *blendTable) const
{ {
Color5551 outColor; const u8 r = (*blendTable)[ colA & 0x1F][ colB & 0x1F];
outColor.r = (*blendTable)[colA.r][colB.r]; const u8 g = (*blendTable)[(colA >> 5) & 0x1F][(colB >> 5) & 0x1F];
outColor.g = (*blendTable)[colA.g][colB.g]; const u8 b = (*blendTable)[(colA >> 10) & 0x1F][(colB >> 10) & 0x1F];
outColor.b = (*blendTable)[colA.b][colB.b];
outColor.a = 0;
return outColor; return r | (g << 5) | (b << 10);
} }
template <NDSColorFormat COLORFORMAT> template <NDSColorFormat COLORFORMAT>
FORCEINLINE Color4u8 ColorOperation::blend(const Color4u8 colA, const Color4u8 colB, const u16 blendEVA, const u16 blendEVB) const FORCEINLINE FragmentColor ColorOperation::blend(const FragmentColor colA, const FragmentColor colB, const u16 blendEVA, const u16 blendEVB) const
{ {
Color4u8 outColor; FragmentColor outColor;
const u16 r = ( ((u16)colA.r * blendEVA) + ((u16)colB.r * blendEVB) ) / 16;
const u16 g = ( ((u16)colA.g * blendEVA) + ((u16)colB.g * blendEVB) ) / 16; u16 r16 = ( (colA.r * blendEVA) + (colB.r * blendEVB) ) / 16;
const u16 b = ( ((u16)colA.b * blendEVA) + ((u16)colB.b * blendEVB) ) / 16; u16 g16 = ( (colA.g * blendEVA) + (colB.g * blendEVB) ) / 16;
u16 b16 = ( (colA.b * blendEVA) + (colB.b * blendEVB) ) / 16;
if (COLORFORMAT == NDSColorFormat_BGR666_Rev) if (COLORFORMAT == NDSColorFormat_BGR666_Rev)
{ {
outColor.r = (u8)( (r > 63) ? 63 : r ); outColor.r = (r16 > 63) ? 63 : r16;
outColor.g = (u8)( (g > 63) ? 63 : g ); outColor.g = (g16 > 63) ? 63 : g16;
outColor.b = (u8)( (b > 63) ? 63 : b ); outColor.b = (b16 > 63) ? 63 : b16;
} }
else if (COLORFORMAT == NDSColorFormat_BGR888_Rev) else if (COLORFORMAT == NDSColorFormat_BGR888_Rev)
{ {
outColor.r = (u8)( (r > 255) ? 255 : r ); outColor.r = (r16 > 255) ? 255 : r16;
outColor.g = (u8)( (g > 255) ? 255 : g ); outColor.g = (g16 > 255) ? 255 : g16;
outColor.b = (u8)( (b > 255) ? 255 : b ); outColor.b = (b16 > 255) ? 255 : b16;
} }
outColor.a = 0; outColor.a = 0;
return outColor; return outColor;
} }
FORCEINLINE Color5551 ColorOperation::blend3D(const Color4u8 colA, const Color5551 colB) const FORCEINLINE u16 ColorOperation::blend3D(const FragmentColor colA, const u16 colB) const
{ {
const u16 alpha = colA.a + 1; const u16 alpha = colA.a + 1;
const u16 minusAlpha = 32 - alpha; COLOR c2;
COLOR cfinal;
Color5551 outColor; c2.val = colB;
outColor.r = (u8)( (((u16)colA.r * alpha) + ((colB.r << 1) * minusAlpha)) >> 6 );
outColor.g = (u8)( (((u16)colA.g * alpha) + ((colB.g << 1) * minusAlpha)) >> 6 );
outColor.b = (u8)( (((u16)colA.b * alpha) + ((colB.b << 1) * minusAlpha)) >> 6 );
outColor.a = 0;
return outColor; cfinal.bits.red = ((colA.r * alpha) + ((c2.bits.red << 1) * (32 - alpha))) >> 6;
cfinal.bits.green = ((colA.g * alpha) + ((c2.bits.green << 1) * (32 - alpha))) >> 6;
cfinal.bits.blue = ((colA.b * alpha) + ((c2.bits.blue << 1) * (32 - alpha))) >> 6;
cfinal.bits.alpha = 0;
return cfinal.val;
} }
template <NDSColorFormat COLORFORMAT> template <NDSColorFormat COLORFORMAT>
FORCEINLINE Color4u8 ColorOperation::blend3D(const Color4u8 colA, const Color4u8 colB) const FORCEINLINE FragmentColor ColorOperation::blend3D(const FragmentColor colA, const FragmentColor colB) const
{ {
Color4u8 outColor; FragmentColor blendedColor;
const u16 alpha = colA.a + 1; const u16 alpha = colA.a + 1;
if (COLORFORMAT == NDSColorFormat_BGR666_Rev) if (COLORFORMAT == NDSColorFormat_BGR666_Rev)
{ {
const u16 minusAlpha = 32 - alpha; blendedColor.r = ((colA.r * alpha) + (colB.r * (32 - alpha))) >> 5;
outColor.r = (u8)( (((u16)colA.r * alpha) + ((u16)colB.r * minusAlpha)) >> 5 ); blendedColor.g = ((colA.g * alpha) + (colB.g * (32 - alpha))) >> 5;
outColor.g = (u8)( (((u16)colA.g * alpha) + ((u16)colB.g * minusAlpha)) >> 5 ); blendedColor.b = ((colA.b * alpha) + (colB.b * (32 - alpha))) >> 5;
outColor.b = (u8)( (((u16)colA.b * alpha) + ((u16)colB.b * minusAlpha)) >> 5 );
} }
else if (COLORFORMAT == NDSColorFormat_BGR888_Rev) else if (COLORFORMAT == NDSColorFormat_BGR888_Rev)
{ {
const u16 minusAlpha = 256 - alpha; blendedColor.r = ((colA.r * alpha) + (colB.r * (256 - alpha))) >> 8;
outColor.r = (u8)( (((u16)colA.r * alpha) + ((u16)colB.r * minusAlpha)) >> 8 ); blendedColor.g = ((colA.g * alpha) + (colB.g * (256 - alpha))) >> 8;
outColor.g = (u8)( (((u16)colA.g * alpha) + ((u16)colB.g * minusAlpha)) >> 8 ); blendedColor.b = ((colA.b * alpha) + (colB.b * (256 - alpha))) >> 8;
outColor.b = (u8)( (((u16)colA.b * alpha) + ((u16)colB.b * minusAlpha)) >> 8 );
} }
outColor.a = 0; blendedColor.a = 0;
return outColor; return blendedColor;
} }
FORCEINLINE Color5551 ColorOperation::increase(const Color5551 col, const u16 blendEVY) const FORCEINLINE u16 ColorOperation::increase(const u16 col, const u16 blendEVY) const
{ {
Color5551 outColor; u16 r = col & 0x001F;
outColor.r = (col.r + ((31 - col.r) * blendEVY / 16)); u16 g = (col >> 5) & 0x001F;
outColor.g = (col.g + ((31 - col.g) * blendEVY / 16)); u16 b = (col >> 10) & 0x001F;
outColor.b = (col.b + ((31 - col.b) * blendEVY / 16));
outColor.a = 0;
return outColor; r = (r + ((31 - r) * blendEVY / 16));
g = (g + ((31 - g) * blendEVY / 16));
b = (b + ((31 - b) * blendEVY / 16));
return r | (g << 5) | (b << 10);
} }
template <NDSColorFormat COLORFORMAT> template <NDSColorFormat COLORFORMAT>
FORCEINLINE Color4u8 ColorOperation::increase(const Color4u8 col, const u16 blendEVY) const FORCEINLINE FragmentColor ColorOperation::increase(const FragmentColor col, const u16 blendEVY) const
{ {
Color4u8 outColor; FragmentColor newColor;
newColor.color = 0;
u32 r = col.r;
u32 g = col.g;
u32 b = col.b;
if (COLORFORMAT == NDSColorFormat_BGR666_Rev) if (COLORFORMAT == NDSColorFormat_BGR666_Rev)
{ {
outColor.r = (u8)( (u16)col.r + ((63 - (u16)col.r) * blendEVY / 16) ); newColor.r = (r + ((63 - r) * blendEVY / 16));
outColor.g = (u8)( (u16)col.g + ((63 - (u16)col.g) * blendEVY / 16) ); newColor.g = (g + ((63 - g) * blendEVY / 16));
outColor.b = (u8)( (u16)col.b + ((63 - (u16)col.b) * blendEVY / 16) ); newColor.b = (b + ((63 - b) * blendEVY / 16));
} }
else if (COLORFORMAT == NDSColorFormat_BGR888_Rev) else if (COLORFORMAT == NDSColorFormat_BGR888_Rev)
{ {
outColor.r = (u8)( (u16)col.r + ((255 - (u16)col.r) * blendEVY / 16) ); newColor.r = (r + ((255 - r) * blendEVY / 16));
outColor.g = (u8)( (u16)col.g + ((255 - (u16)col.g) * blendEVY / 16) ); newColor.g = (g + ((255 - g) * blendEVY / 16));
outColor.b = (u8)( (u16)col.b + ((255 - (u16)col.b) * blendEVY / 16) ); newColor.b = (b + ((255 - b) * blendEVY / 16));
} }
outColor.a = 0; return newColor;
return outColor;
} }
FORCEINLINE Color5551 ColorOperation::decrease(const Color5551 col, const u16 blendEVY) const FORCEINLINE u16 ColorOperation::decrease(const u16 col, const u16 blendEVY) const
{ {
Color5551 outColor; u16 r = col & 0x001F;
outColor.r = (col.r - (col.r * blendEVY / 16)); u16 g = (col >> 5) & 0x001F;
outColor.g = (col.g - (col.g * blendEVY / 16)); u16 b = (col >> 10) & 0x001F;
outColor.b = (col.b - (col.b * blendEVY / 16));
outColor.a = 0;
return outColor; r = (r - (r * blendEVY / 16));
g = (g - (g * blendEVY / 16));
b = (b - (b * blendEVY / 16));
return r | (g << 5) | (b << 10);
} }
template <NDSColorFormat COLORFORMAT> template <NDSColorFormat COLORFORMAT>
FORCEINLINE Color4u8 ColorOperation::decrease(const Color4u8 col, const u16 blendEVY) const FORCEINLINE FragmentColor ColorOperation::decrease(const FragmentColor col, const u16 blendEVY) const
{ {
Color4u8 outColor; FragmentColor newColor;
outColor.r = (u8)( (u16)col.r - ((u16)col.r * blendEVY / 16) ); newColor.color = 0;
outColor.g = (u8)( (u16)col.g - ((u16)col.g * blendEVY / 16) );
outColor.b = (u8)( (u16)col.b - ((u16)col.b * blendEVY / 16) );
outColor.a = 0;
return outColor; u32 r = col.r;
u32 g = col.g;
u32 b = col.b;
newColor.r = (r - (r * blendEVY / 16));
newColor.g = (g - (g * blendEVY / 16));
newColor.b = (b - (b * blendEVY / 16));
return newColor;
} }
void PixelOperation::InitLUTs() void PixelOperation::InitLUTs()
@ -217,25 +234,25 @@ void PixelOperation::InitLUTs()
{ {
for (u16 j = 0x0000; j < 0x8000; j++) for (u16 j = 0x0000; j < 0x8000; j++)
{ {
Color5551 cur; COLOR cur;
cur.value = j; cur.val = j;
cur.r = ( cur.r + ((31 - cur.r) * i / 16) ); cur.bits.red = (cur.bits.red + ((31 - cur.bits.red) * i / 16));
cur.g = ( cur.g + ((31 - cur.g) * i / 16) ); cur.bits.green = (cur.bits.green + ((31 - cur.bits.green) * i / 16));
cur.b = ( cur.b + ((31 - cur.b) * i / 16) ); cur.bits.blue = (cur.bits.blue + ((31 - cur.bits.blue) * i / 16));
cur.a = 0; cur.bits.alpha = 0;
PixelOperation::BrightnessUpTable555[i][j] = cur; PixelOperation::BrightnessUpTable555[i][j] = cur.val;
PixelOperation::BrightnessUpTable666[i][j].value = COLOR555TO666(cur.value); PixelOperation::BrightnessUpTable666[i][j].color = LOCAL_TO_LE_32( COLOR555TO666(cur.val) );
PixelOperation::BrightnessUpTable888[i][j].value = COLOR555TO888(cur.value); PixelOperation::BrightnessUpTable888[i][j].color = LOCAL_TO_LE_32( COLOR555TO888(cur.val) );
cur.value = j; cur.val = j;
cur.r = ( cur.r - (cur.r * i / 16) ); cur.bits.red = (cur.bits.red - (cur.bits.red * i / 16));
cur.g = ( cur.g - (cur.g * i / 16) ); cur.bits.green = (cur.bits.green - (cur.bits.green * i / 16));
cur.b = ( cur.b - (cur.b * i / 16) ); cur.bits.blue = (cur.bits.blue - (cur.bits.blue * i / 16));
cur.a = 0; cur.bits.alpha = 0;
PixelOperation::BrightnessDownTable555[i][j] = cur; PixelOperation::BrightnessDownTable555[i][j] = cur.val;
PixelOperation::BrightnessDownTable666[i][j].value = COLOR555TO666(cur.value); PixelOperation::BrightnessDownTable666[i][j].color = LOCAL_TO_LE_32( COLOR555TO666(cur.val) );
PixelOperation::BrightnessDownTable888[i][j].value = COLOR555TO888(cur.value); PixelOperation::BrightnessDownTable888[i][j].color = LOCAL_TO_LE_32( COLOR555TO888(cur.val) );
} }
} }
@ -259,25 +276,24 @@ void PixelOperation::InitLUTs()
} }
template <NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> template <NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER>
FORCEINLINE void PixelOperation::_copy16(GPUEngineCompositorInfo &compInfo, const Color5551 srcColor16) const FORCEINLINE void PixelOperation::_copy16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16) const
{ {
Color5551 &dstColor16 = *compInfo.target.lineColor16; u16 &dstColor16 = *compInfo.target.lineColor16;
Color4u8 &dstColor32 = *compInfo.target.lineColor32; FragmentColor &dstColor32 = *compInfo.target.lineColor32;
u8 &dstLayerID = *compInfo.target.lineLayerID; u8 &dstLayerID = *compInfo.target.lineLayerID;
switch (OUTPUTFORMAT) switch (OUTPUTFORMAT)
{ {
case NDSColorFormat_BGR555_Rev: case NDSColorFormat_BGR555_Rev:
dstColor16 = srcColor16; dstColor16 = srcColor16 | 0x8000;
dstColor16.a = 1;
break; break;
case NDSColorFormat_BGR666_Rev: case NDSColorFormat_BGR666_Rev:
dstColor32.value = ColorspaceConvert555To6665Opaque<false>(srcColor16.value); dstColor32.color = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>(srcColor16) );
break; break;
case NDSColorFormat_BGR888_Rev: case NDSColorFormat_BGR888_Rev:
dstColor32.value = ColorspaceConvert555To8888Opaque<false>(srcColor16.value); dstColor32.color = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>(srcColor16) );
break; break;
} }
@ -288,17 +304,17 @@ FORCEINLINE void PixelOperation::_copy16(GPUEngineCompositorInfo &compInfo, cons
} }
template <NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> template <NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER>
FORCEINLINE void PixelOperation::_copy32(GPUEngineCompositorInfo &compInfo, const Color4u8 srcColor32) const FORCEINLINE void PixelOperation::_copy32(GPUEngineCompositorInfo &compInfo, const FragmentColor srcColor32) const
{ {
Color5551 &dstColor16 = *compInfo.target.lineColor16; u16 &dstColor16 = *compInfo.target.lineColor16;
Color4u8 &dstColor32 = *compInfo.target.lineColor32; FragmentColor &dstColor32 = *compInfo.target.lineColor32;
u8 &dstLayerID = *compInfo.target.lineLayerID; u8 &dstLayerID = *compInfo.target.lineLayerID;
switch (OUTPUTFORMAT) switch (OUTPUTFORMAT)
{ {
case NDSColorFormat_BGR555_Rev: case NDSColorFormat_BGR555_Rev:
dstColor16.value = ColorspaceConvert6665To5551<false>(srcColor32); dstColor16 = ColorspaceConvert6665To5551<false>(srcColor32);
dstColor16.a = 1; dstColor16 = dstColor16 | 0x8000;
break; break;
case NDSColorFormat_BGR666_Rev: case NDSColorFormat_BGR666_Rev:
@ -322,26 +338,25 @@ FORCEINLINE void PixelOperation::_copy32(GPUEngineCompositorInfo &compInfo, cons
} }
template <NDSColorFormat OUTPUTFORMAT> template <NDSColorFormat OUTPUTFORMAT>
FORCEINLINE void PixelOperation::_brightnessUp16(GPUEngineCompositorInfo &compInfo, const Color5551 srcColor16) const FORCEINLINE void PixelOperation::_brightnessUp16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16) const
{ {
Color5551 &dstColor16 = *compInfo.target.lineColor16; u16 &dstColor16 = *compInfo.target.lineColor16;
Color4u8 &dstColor32 = *compInfo.target.lineColor32; FragmentColor &dstColor32 = *compInfo.target.lineColor32;
u8 &dstLayerID = *compInfo.target.lineLayerID; u8 &dstLayerID = *compInfo.target.lineLayerID;
switch (OUTPUTFORMAT) switch (OUTPUTFORMAT)
{ {
case NDSColorFormat_BGR555_Rev: case NDSColorFormat_BGR555_Rev:
dstColor16 = compInfo.renderState.brightnessUpTable555[srcColor16.value & 0x7FFF]; dstColor16 = compInfo.renderState.brightnessUpTable555[srcColor16 & 0x7FFF] | 0x8000;
dstColor16.a = 1;
break; break;
case NDSColorFormat_BGR666_Rev: case NDSColorFormat_BGR666_Rev:
dstColor32 = compInfo.renderState.brightnessUpTable666[srcColor16.value & 0x7FFF]; dstColor32 = compInfo.renderState.brightnessUpTable666[srcColor16 & 0x7FFF];
dstColor32.a = 0x1F; dstColor32.a = 0x1F;
break; break;
case NDSColorFormat_BGR888_Rev: case NDSColorFormat_BGR888_Rev:
dstColor32 = compInfo.renderState.brightnessUpTable888[srcColor16.value & 0x7FFF]; dstColor32 = compInfo.renderState.brightnessUpTable888[srcColor16 & 0x7FFF];
dstColor32.a = 0xFF; dstColor32.a = 0xFF;
break; break;
} }
@ -350,17 +365,17 @@ FORCEINLINE void PixelOperation::_brightnessUp16(GPUEngineCompositorInfo &compIn
} }
template <NDSColorFormat OUTPUTFORMAT> template <NDSColorFormat OUTPUTFORMAT>
FORCEINLINE void PixelOperation::_brightnessUp32(GPUEngineCompositorInfo &compInfo, const Color4u8 srcColor32) const FORCEINLINE void PixelOperation::_brightnessUp32(GPUEngineCompositorInfo &compInfo, const FragmentColor srcColor32) const
{ {
Color5551 &dstColor16 = *compInfo.target.lineColor16; u16 &dstColor16 = *compInfo.target.lineColor16;
Color4u8 &dstColor32 = *compInfo.target.lineColor32; FragmentColor &dstColor32 = *compInfo.target.lineColor32;
u8 &dstLayerID = *compInfo.target.lineLayerID; u8 &dstLayerID = *compInfo.target.lineLayerID;
if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev)
{ {
const u16 srcColor16 = ColorspaceConvert6665To5551<false>(srcColor32); const u16 srcColor16 = ColorspaceConvert6665To5551<false>(srcColor32);
dstColor16 = compInfo.renderState.brightnessUpTable555[srcColor16 & 0x7FFF]; dstColor16 = compInfo.renderState.brightnessUpTable555[srcColor16 & 0x7FFF];
dstColor16.a = 1; dstColor16 = dstColor16 | 0x8000;
} }
else else
{ {
@ -372,26 +387,25 @@ FORCEINLINE void PixelOperation::_brightnessUp32(GPUEngineCompositorInfo &compIn
} }
template <NDSColorFormat OUTPUTFORMAT> template <NDSColorFormat OUTPUTFORMAT>
FORCEINLINE void PixelOperation::_brightnessDown16(GPUEngineCompositorInfo &compInfo, const Color5551 srcColor16) const FORCEINLINE void PixelOperation::_brightnessDown16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16) const
{ {
Color5551 &dstColor16 = *compInfo.target.lineColor16; u16 &dstColor16 = *compInfo.target.lineColor16;
Color4u8 &dstColor32 = *compInfo.target.lineColor32; FragmentColor &dstColor32 = *compInfo.target.lineColor32;
u8 &dstLayerID = *compInfo.target.lineLayerID; u8 &dstLayerID = *compInfo.target.lineLayerID;
switch (OUTPUTFORMAT) switch (OUTPUTFORMAT)
{ {
case NDSColorFormat_BGR555_Rev: case NDSColorFormat_BGR555_Rev:
dstColor16 = compInfo.renderState.brightnessDownTable555[srcColor16.value & 0x7FFF]; dstColor16 = compInfo.renderState.brightnessDownTable555[srcColor16 & 0x7FFF] | 0x8000;
dstColor16.a = 1;
break; break;
case NDSColorFormat_BGR666_Rev: case NDSColorFormat_BGR666_Rev:
dstColor32 = compInfo.renderState.brightnessDownTable666[srcColor16.value & 0x7FFF]; dstColor32 = compInfo.renderState.brightnessDownTable666[srcColor16 & 0x7FFF];
dstColor32.a = 0x1F; dstColor32.a = 0x1F;
break; break;
case NDSColorFormat_BGR888_Rev: case NDSColorFormat_BGR888_Rev:
dstColor32 = compInfo.renderState.brightnessDownTable888[srcColor16.value & 0x7FFF]; dstColor32 = compInfo.renderState.brightnessDownTable888[srcColor16 & 0x7FFF];
dstColor32.a = 0xFF; dstColor32.a = 0xFF;
break; break;
} }
@ -400,17 +414,17 @@ FORCEINLINE void PixelOperation::_brightnessDown16(GPUEngineCompositorInfo &comp
} }
template <NDSColorFormat OUTPUTFORMAT> template <NDSColorFormat OUTPUTFORMAT>
FORCEINLINE void PixelOperation::_brightnessDown32(GPUEngineCompositorInfo &compInfo, const Color4u8 srcColor32) const FORCEINLINE void PixelOperation::_brightnessDown32(GPUEngineCompositorInfo &compInfo, const FragmentColor srcColor32) const
{ {
Color5551 &dstColor16 = *compInfo.target.lineColor16; u16 &dstColor16 = *compInfo.target.lineColor16;
Color4u8 &dstColor32 = *compInfo.target.lineColor32; FragmentColor &dstColor32 = *compInfo.target.lineColor32;
u8 &dstLayerID = *compInfo.target.lineLayerID; u8 &dstLayerID = *compInfo.target.lineLayerID;
if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev)
{ {
const u16 srcColor16 = ColorspaceConvert6665To5551<false>(srcColor32); const u16 srcColor16 = ColorspaceConvert6665To5551<false>(srcColor32);
dstColor16 = compInfo.renderState.brightnessDownTable555[srcColor16 & 0x7FFF]; dstColor16 = compInfo.renderState.brightnessDownTable555[srcColor16 & 0x7FFF];
dstColor16.a = 1; dstColor16 = dstColor16 | 0x8000;
} }
else else
{ {
@ -490,7 +504,7 @@ FORCEINLINE void PixelOperation::__selectedEffect(const GPUEngineCompositorInfo
} }
template <NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> template <NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE>
FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compInfo, const Color5551 srcColor16, const bool enableColorEffect, const u8 spriteAlpha, const OBJMode spriteMode) const FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16, const bool enableColorEffect, const u8 spriteAlpha, const OBJMode spriteMode) const
{ {
u8 &dstLayerID = *compInfo.target.lineLayerID; u8 &dstLayerID = *compInfo.target.lineLayerID;
TBlendTable *selectedBlendTable = compInfo.renderState.blendTable555; TBlendTable *selectedBlendTable = compInfo.renderState.blendTable555;
@ -505,7 +519,7 @@ FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compI
if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev)
{ {
Color5551 &dstColor16 = *compInfo.target.lineColor16; u16 &dstColor16 = *compInfo.target.lineColor16;
switch (selectedEffect) switch (selectedEffect)
{ {
@ -514,11 +528,11 @@ FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compI
break; break;
case ColorEffect_IncreaseBrightness: case ColorEffect_IncreaseBrightness:
dstColor16 = compInfo.renderState.brightnessUpTable555[srcColor16.value & 0x7FFF]; dstColor16 = compInfo.renderState.brightnessUpTable555[srcColor16 & 0x7FFF];
break; break;
case ColorEffect_DecreaseBrightness: case ColorEffect_DecreaseBrightness:
dstColor16 = compInfo.renderState.brightnessDownTable555[srcColor16.value & 0x7FFF]; dstColor16 = compInfo.renderState.brightnessDownTable555[srcColor16 & 0x7FFF];
break; break;
case ColorEffect_Blend: case ColorEffect_Blend:
@ -537,32 +551,32 @@ FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compI
} }
} }
dstColor16.a = 1; dstColor16 |= 0x8000;
} }
else else
{ {
Color4u8 &dstColor32 = *compInfo.target.lineColor32; FragmentColor &dstColor32 = *compInfo.target.lineColor32;
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
switch (selectedEffect) switch (selectedEffect)
{ {
case ColorEffect_Disable: case ColorEffect_Disable:
dstColor32.value = ColorspaceConvert555To6665Opaque<false>(srcColor16.value); dstColor32.color = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>(srcColor16) );
break; break;
case ColorEffect_IncreaseBrightness: case ColorEffect_IncreaseBrightness:
dstColor32 = compInfo.renderState.brightnessUpTable666[srcColor16.value & 0x7FFF]; dstColor32 = compInfo.renderState.brightnessUpTable666[srcColor16 & 0x7FFF];
break; break;
case ColorEffect_DecreaseBrightness: case ColorEffect_DecreaseBrightness:
dstColor32 = compInfo.renderState.brightnessDownTable666[srcColor16.value & 0x7FFF]; dstColor32 = compInfo.renderState.brightnessDownTable666[srcColor16 & 0x7FFF];
break; break;
case ColorEffect_Blend: case ColorEffect_Blend:
{ {
Color4u8 srcColor32; FragmentColor srcColor32;
srcColor32.value = ColorspaceConvert555To6665Opaque<false>(srcColor16.value); srcColor32.color = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>(srcColor16) );
dstColor32 = (LAYERTYPE == GPULayerType_3D) ? colorop.blend3D<OUTPUTFORMAT>(srcColor32, dstColor32) : colorop.blend<OUTPUTFORMAT>(srcColor32, dstColor32, blendEVA, blendEVB); dstColor32 = (LAYERTYPE == GPULayerType_3D) ? colorop.blend3D<OUTPUTFORMAT>(srcColor32, dstColor32) : colorop.blend<OUTPUTFORMAT>(srcColor32, dstColor32, blendEVA, blendEVB);
break; break;
} }
@ -573,21 +587,21 @@ FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compI
switch (selectedEffect) switch (selectedEffect)
{ {
case ColorEffect_Disable: case ColorEffect_Disable:
dstColor32.value = ColorspaceConvert555To8888Opaque<false>(srcColor16.value); dstColor32.color = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>(srcColor16) );
break; break;
case ColorEffect_IncreaseBrightness: case ColorEffect_IncreaseBrightness:
dstColor32 = compInfo.renderState.brightnessUpTable888[srcColor16.value & 0x7FFF]; dstColor32 = compInfo.renderState.brightnessUpTable888[srcColor16 & 0x7FFF];
break; break;
case ColorEffect_DecreaseBrightness: case ColorEffect_DecreaseBrightness:
dstColor32 = compInfo.renderState.brightnessDownTable888[srcColor16.value & 0x7FFF]; dstColor32 = compInfo.renderState.brightnessDownTable888[srcColor16 & 0x7FFF];
break; break;
case ColorEffect_Blend: case ColorEffect_Blend:
{ {
Color4u8 srcColor32; FragmentColor srcColor32;
srcColor32.value = ColorspaceConvert555To8888Opaque<false>(srcColor16.value); srcColor32.color = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>(srcColor16) );
dstColor32 = (LAYERTYPE == GPULayerType_3D) ? colorop.blend3D<OUTPUTFORMAT>(srcColor32, dstColor32) : colorop.blend<OUTPUTFORMAT>(srcColor32, dstColor32, blendEVA, blendEVB); dstColor32 = (LAYERTYPE == GPULayerType_3D) ? colorop.blend3D<OUTPUTFORMAT>(srcColor32, dstColor32) : colorop.blend<OUTPUTFORMAT>(srcColor32, dstColor32, blendEVA, blendEVB);
break; break;
} }
@ -599,7 +613,7 @@ FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compI
} }
template <NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> template <NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE>
FORCEINLINE void PixelOperation::_unknownEffect32(GPUEngineCompositorInfo &compInfo, const Color4u8 srcColor32, const bool enableColorEffect, const u8 spriteAlpha, const OBJMode spriteMode) const FORCEINLINE void PixelOperation::_unknownEffect32(GPUEngineCompositorInfo &compInfo, const FragmentColor srcColor32, const bool enableColorEffect, const u8 spriteAlpha, const OBJMode spriteMode) const
{ {
u8 &dstLayerID = *compInfo.target.lineLayerID; u8 &dstLayerID = *compInfo.target.lineLayerID;
TBlendTable *selectedBlendTable = compInfo.renderState.blendTable555; TBlendTable *selectedBlendTable = compInfo.renderState.blendTable555;
@ -614,10 +628,8 @@ FORCEINLINE void PixelOperation::_unknownEffect32(GPUEngineCompositorInfo &compI
if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev)
{ {
Color5551 srcColor16; const u16 srcColor16 = ColorspaceConvert6665To5551<false>(srcColor32);
srcColor16.value = ColorspaceConvert6665To5551<false>(srcColor32); u16 &dstColor16 = *compInfo.target.lineColor16;
Color5551 &dstColor16 = *compInfo.target.lineColor16;
switch (selectedEffect) switch (selectedEffect)
{ {
@ -626,11 +638,11 @@ FORCEINLINE void PixelOperation::_unknownEffect32(GPUEngineCompositorInfo &compI
break; break;
case ColorEffect_IncreaseBrightness: case ColorEffect_IncreaseBrightness:
dstColor16 = compInfo.renderState.brightnessUpTable555[srcColor16.value & 0x7FFF]; dstColor16 = compInfo.renderState.brightnessUpTable555[srcColor16 & 0x7FFF];
break; break;
case ColorEffect_DecreaseBrightness: case ColorEffect_DecreaseBrightness:
dstColor16 = compInfo.renderState.brightnessDownTable555[srcColor16.value & 0x7FFF]; dstColor16 = compInfo.renderState.brightnessDownTable555[srcColor16 & 0x7FFF];
break; break;
case ColorEffect_Blend: case ColorEffect_Blend:
@ -647,11 +659,11 @@ FORCEINLINE void PixelOperation::_unknownEffect32(GPUEngineCompositorInfo &compI
} }
} }
dstColor16.a = 1; dstColor16 |= 0x8000;
} }
else else
{ {
Color4u8 &dstColor32 = *compInfo.target.lineColor32; FragmentColor &dstColor32 = *compInfo.target.lineColor32;
switch (selectedEffect) switch (selectedEffect)
{ {
@ -679,35 +691,32 @@ FORCEINLINE void PixelOperation::_unknownEffect32(GPUEngineCompositorInfo &compI
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE>
FORCEINLINE void PixelOperation::Composite16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16, const bool enableColorEffect, const u8 spriteAlpha, const u8 spriteMode) const FORCEINLINE void PixelOperation::Composite16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16, const bool enableColorEffect, const u8 spriteAlpha, const u8 spriteMode) const
{ {
Color5551 srcColor5551;
srcColor5551.value = srcColor16;
switch (COMPOSITORMODE) switch (COMPOSITORMODE)
{ {
case GPUCompositorMode_Debug: case GPUCompositorMode_Debug:
this->_copy16<OUTPUTFORMAT, true>(compInfo, srcColor5551); this->_copy16<OUTPUTFORMAT, true>(compInfo, srcColor16);
break; break;
case GPUCompositorMode_Copy: case GPUCompositorMode_Copy:
this->_copy16<OUTPUTFORMAT, false>(compInfo, srcColor5551); this->_copy16<OUTPUTFORMAT, false>(compInfo, srcColor16);
break; break;
case GPUCompositorMode_BrightUp: case GPUCompositorMode_BrightUp:
this->_brightnessUp16<OUTPUTFORMAT>(compInfo, srcColor5551); this->_brightnessUp16<OUTPUTFORMAT>(compInfo, srcColor16);
break; break;
case GPUCompositorMode_BrightDown: case GPUCompositorMode_BrightDown:
this->_brightnessDown16<OUTPUTFORMAT>(compInfo, srcColor5551); this->_brightnessDown16<OUTPUTFORMAT>(compInfo, srcColor16);
break; break;
default: default:
this->_unknownEffect16<OUTPUTFORMAT, LAYERTYPE>(compInfo, srcColor5551, enableColorEffect, spriteAlpha, (OBJMode)spriteMode); this->_unknownEffect16<OUTPUTFORMAT, LAYERTYPE>(compInfo, srcColor16, enableColorEffect, spriteAlpha, (OBJMode)spriteMode);
break; break;
} }
} }
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE>
FORCEINLINE void PixelOperation::Composite32(GPUEngineCompositorInfo &compInfo, Color4u8 srcColor32, const bool enableColorEffect, const u8 spriteAlpha, const u8 spriteMode) const FORCEINLINE void PixelOperation::Composite32(GPUEngineCompositorInfo &compInfo, FragmentColor srcColor32, const bool enableColorEffect, const u8 spriteAlpha, const u8 spriteMode) const
{ {
switch (COMPOSITORMODE) switch (COMPOSITORMODE)
{ {
@ -749,80 +758,8 @@ static FORCEINLINE void CopyLinesForVerticalCount(void *__restrict dstLineHead,
#include "GPU_Operations_AVX2.cpp" #include "GPU_Operations_AVX2.cpp"
#elif defined(ENABLE_SSE2) #elif defined(ENABLE_SSE2)
#include "GPU_Operations_SSE2.cpp" #include "GPU_Operations_SSE2.cpp"
#elif defined(ENABLE_NEON_A64)
#include "GPU_Operations_NEON.cpp"
#elif defined(ENABLE_ALTIVEC)
#include "GPU_Operations_AltiVec.cpp"
#else #else
template <bool NEEDENDIANSWAP, size_t ELEMENTSIZE>
static FORCEINLINE void __CopyLineSingleUnlimited(void *__restrict dst, const void *__restrict src, size_t pixCount)
{
#if defined(MSB_FIRST)
if (NEEDENDIANSWAP && (ELEMENTSIZE > 1))
{
if (ELEMENTSIZE == 2)
{
const u16 *__restrict srcPtr16 = (const u16 *__restrict)src;
u16 *__restrict dstPtr16 = (u16 *__restrict)dst;
for (size_t i = 0; i < pixCount; i++)
{
dstPtr16[i] = LE_TO_LOCAL_16(srcPtr16[i]);
}
}
else if (ELEMENTSIZE == 4)
{
const u32 *__restrict srcPtr32 = (const u32 *__restrict)src;
u32 *__restrict dstPtr32 = (u32 *__restrict)dst;
for (size_t i = 0; i < pixCount; i++)
{
dstPtr32[i] = LE_TO_LOCAL_32(srcPtr32[i]);
}
}
}
else
#endif
{
memcpy(dst, src, pixCount * ELEMENTSIZE);
}
}
template <bool NEEDENDIANSWAP, size_t ELEMENTSIZE>
static FORCEINLINE void __CopyLineSingle(void *__restrict dst, const void *__restrict src)
{
#if defined(MSB_FIRST)
if (NEEDENDIANSWAP && (ELEMENTSIZE > 1))
{
if (ELEMENTSIZE == 2)
{
const u16 *__restrict srcPtr16 = (const u16 *__restrict)src;
u16 *__restrict dstPtr16 = (u16 *__restrict)dst;
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH; i++)
{
dstPtr16[i] = LE_TO_LOCAL_16(srcPtr16[i]);
}
}
else if (ELEMENTSIZE == 4)
{
const u32 *__restrict srcPtr32 = (const u32 *__restrict)src;
u32 *__restrict dstPtr32 = (u32 *__restrict)dst;
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH; i++)
{
dstPtr32[i] = LE_TO_LOCAL_32(srcPtr32[i]);
}
}
}
else
#endif
{
memcpy(dst, src, GPU_FRAMEBUFFER_NATIVE_WIDTH * ELEMENTSIZE);
}
}
template <s32 INTEGERSCALEHINT, bool SCALEVERTICAL, bool NEEDENDIANSWAP, size_t ELEMENTSIZE> template <s32 INTEGERSCALEHINT, bool SCALEVERTICAL, bool NEEDENDIANSWAP, size_t ELEMENTSIZE>
static FORCEINLINE void CopyLineExpand(void *__restrict dst, const void *__restrict src, size_t dstWidth, size_t dstLineCount) static FORCEINLINE void CopyLineExpand(void *__restrict dst, const void *__restrict src, size_t dstWidth, size_t dstLineCount)
{ {
@ -843,11 +780,49 @@ static FORCEINLINE void CopyLineExpand(void *__restrict dst, const void *__restr
if (INTEGERSCALEHINT == 0) if (INTEGERSCALEHINT == 0)
{ {
__CopyLineSingleUnlimited<NEEDENDIANSWAP, ELEMENTSIZE>(dst, src, dstWidth); #if defined(MSB_FIRST)
if (NEEDENDIANSWAP && (ELEMENTSIZE != 1))
{
for (size_t i = 0; i < dstWidth; i++)
{
if (ELEMENTSIZE == 2)
{
((u16 *)dst)[i] = LE_TO_LOCAL_16( ((u16 *)src)[i] );
}
else if (ELEMENTSIZE == 4)
{
((u32 *)dst)[i] = LE_TO_LOCAL_32( ((u32 *)src)[i] );
}
}
}
else
#endif
{
memcpy(dst, src, dstWidth * ELEMENTSIZE);
}
} }
else if (INTEGERSCALEHINT == 1) else if (INTEGERSCALEHINT == 1)
{ {
__CopyLineSingle<NEEDENDIANSWAP, ELEMENTSIZE>(dst, src); #if defined(MSB_FIRST)
if (NEEDENDIANSWAP && (ELEMENTSIZE != 1))
{
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH; i++)
{
if (ELEMENTSIZE == 2)
{
((u16 *)dst)[i] = LE_TO_LOCAL_16( ((u16 *)src)[i] );
}
else if (ELEMENTSIZE == 4)
{
((u32 *)dst)[i] = LE_TO_LOCAL_32( ((u32 *)src)[i] );
}
}
}
else
#endif
{
memcpy(dst, src, GPU_FRAMEBUFFER_NATIVE_WIDTH * ELEMENTSIZE);
}
} }
else if (INTEGERSCALEHINT > 1) else if (INTEGERSCALEHINT > 1)
{ {
@ -925,11 +900,49 @@ static FORCEINLINE void CopyLineReduce(void *__restrict dst, const void *__restr
if (INTEGERSCALEHINT == 0) if (INTEGERSCALEHINT == 0)
{ {
__CopyLineSingleUnlimited<NEEDENDIANSWAP, ELEMENTSIZE>(dst, src, srcWidth); #if defined(MSB_FIRST)
if (NEEDENDIANSWAP && (ELEMENTSIZE != 1))
{
for (size_t i = 0; i < srcWidth; i++)
{
if (ELEMENTSIZE == 2)
{
((u16 *)dst)[i] = LE_TO_LOCAL_16( ((u16 *)src)[i] );
}
else if (ELEMENTSIZE == 4)
{
((u32 *)dst)[i] = LE_TO_LOCAL_32( ((u32 *)src)[i] );
}
}
}
else
#endif
{
memcpy(dst, src, srcWidth * ELEMENTSIZE);
}
} }
else if (INTEGERSCALEHINT == 1) else if (INTEGERSCALEHINT == 1)
{ {
__CopyLineSingle<NEEDENDIANSWAP, ELEMENTSIZE>(dst, src); #if defined(MSB_FIRST)
if (NEEDENDIANSWAP && (ELEMENTSIZE != 1))
{
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH; i++)
{
if (ELEMENTSIZE == 2)
{
((u16 *)dst)[i] = LE_TO_LOCAL_16( ((u16 *)src)[i] );
}
else if (ELEMENTSIZE == 4)
{
((u32 *)dst)[i] = LE_TO_LOCAL_32( ((u32 *)src)[i] );
}
}
}
else
#endif
{
memcpy(dst, src, GPU_FRAMEBUFFER_NATIVE_WIDTH * ELEMENTSIZE);
}
} }
else if (INTEGERSCALEHINT > 1) else if (INTEGERSCALEHINT > 1)
{ {
@ -943,11 +956,11 @@ static FORCEINLINE void CopyLineReduce(void *__restrict dst, const void *__restr
} }
else if (ELEMENTSIZE == 2) else if (ELEMENTSIZE == 2)
{ {
((u16 *)dst)[x] = (NEEDENDIANSWAP) ? LE_TO_LOCAL_16( ((u16 *)src)[x * scale] ) : ((u16 *)src)[x * scale]; ((u16 *)dst)[x] = ((u16 *)src)[x * scale];
} }
else if (ELEMENTSIZE == 4) else if (ELEMENTSIZE == 4)
{ {
((u32 *)dst)[x] = (NEEDENDIANSWAP) ? LE_TO_LOCAL_32( ((u32 *)src)[x * scale] ) : ((u32 *)src)[x * scale]; ((u32 *)dst)[x] = ((u32 *)src)[x * scale];
} }
} }
} }
@ -989,9 +1002,9 @@ void GPUEngineBase::_MosaicLine(GPUEngineCompositorInfo &compInfo)
else else
{ {
outColor16 = mosaicColorBG[compInfo.renderState.mosaicWidthBG->trunc[x]]; outColor16 = mosaicColorBG[compInfo.renderState.mosaicWidthBG->trunc[x]];
isOpaque = (outColor16 != 0xFFFF);
} }
isOpaque = (outColor16 != 0xFFFF);
if (isOpaque) if (isOpaque)
{ {
this->_deferredColorNative[x] = outColor16; this->_deferredColorNative[x] = outColor16;
@ -1000,7 +1013,7 @@ void GPUEngineBase::_MosaicLine(GPUEngineCompositorInfo &compInfo)
} }
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST>
void GPUEngineBase::_CompositeNativeLineOBJ_LoopOp(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const Color4u8 *__restrict srcColorNative32) void GPUEngineBase::_CompositeNativeLineOBJ_LoopOp(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const FragmentColor *__restrict srcColorNative32)
{ {
// Do nothing. This is a placeholder for a manually vectorized version of this method. // Do nothing. This is a placeholder for a manually vectorized version of this method.
} }
@ -1073,7 +1086,7 @@ void GPUEngineBase::_PerformWindowTestingNative(GPUEngineCompositorInfo &compInf
} }
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST>
size_t GPUEngineA::_RenderLine_Layer3D_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const Color4u8 *__restrict srcLinePtr) size_t GPUEngineA::_RenderLine_Layer3D_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const FragmentColor *__restrict srcLinePtr)
{ {
// Do nothing. This is a placeholder for a manually vectorized version of this method. // Do nothing. This is a placeholder for a manually vectorized version of this method.
return 0; return 0;
@ -1302,5 +1315,5 @@ void CopyLineReduceHinted(const GPUEngineLineInfo &lineInfo, const void *__restr
} }
// These functions are used in gfx3d.cpp // These functions are used in gfx3d.cpp
template void CopyLineExpandHinted<0x3FFF, true, false, false, 4>(const GPUEngineLineInfo &lineInfo, const void *__restrict srcBuffer, void *__restrict dstBuffer); template void CopyLineExpandHinted<0x3FFF, true, false, true, 4>(const GPUEngineLineInfo &lineInfo, const void *__restrict srcBuffer, void *__restrict dstBuffer);
template void CopyLineReduceHinted<0x3FFF, false, false, 4>(const GPUEngineLineInfo &lineInfo, const void *__restrict srcBuffer, void *__restrict dstBuffer); template void CopyLineReduceHinted<0x3FFF, false, true, 4>(const GPUEngineLineInfo &lineInfo, const void *__restrict srcBuffer, void *__restrict dstBuffer);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2021-2025 DeSmuME team Copyright (C) 2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -45,18 +45,18 @@ class ColorOperation
public: public:
ColorOperation() {}; ColorOperation() {};
FORCEINLINE Color5551 blend(const Color5551 colA, const Color5551 colB, const u16 blendEVA, const u16 blendEVB) const; FORCEINLINE u16 blend(const u16 colA, const u16 colB, const u16 blendEVA, const u16 blendEVB) const;
FORCEINLINE Color5551 blend(const Color5551 colA, const Color5551 colB, const TBlendTable *blendTable) const; FORCEINLINE u16 blend(const u16 colA, const u16 colB, const TBlendTable *blendTable) const;
template<NDSColorFormat COLORFORMAT> FORCEINLINE Color4u8 blend(const Color4u8 colA, const Color4u8 colB, const u16 blendEVA, const u16 blendEVB) const; template<NDSColorFormat COLORFORMAT> FORCEINLINE FragmentColor blend(const FragmentColor colA, const FragmentColor colB, const u16 blendEVA, const u16 blendEVB) const;
FORCEINLINE Color5551 blend3D(const Color4u8 colA, const Color5551 colB) const; FORCEINLINE u16 blend3D(const FragmentColor colA, const u16 colB) const;
template<NDSColorFormat COLORFORMAT> FORCEINLINE Color4u8 blend3D(const Color4u8 colA, const Color4u8 colB) const; template<NDSColorFormat COLORFORMAT> FORCEINLINE FragmentColor blend3D(const FragmentColor colA, const FragmentColor colB) const;
FORCEINLINE Color5551 increase(const Color5551 col, const u16 blendEVY) const; FORCEINLINE u16 increase(const u16 col, const u16 blendEVY) const;
template<NDSColorFormat COLORFORMAT> FORCEINLINE Color4u8 increase(const Color4u8 col, const u16 blendEVY) const; template<NDSColorFormat COLORFORMAT> FORCEINLINE FragmentColor increase(const FragmentColor col, const u16 blendEVY) const;
FORCEINLINE Color5551 decrease(const Color5551 col, const u16 blendEVY) const; FORCEINLINE u16 decrease(const u16 col, const u16 blendEVY) const;
template<NDSColorFormat COLORFORMAT> FORCEINLINE Color4u8 decrease(const Color4u8 col, const u16 blendEVY) const; template<NDSColorFormat COLORFORMAT> FORCEINLINE FragmentColor decrease(const FragmentColor col, const u16 blendEVY) const;
}; };
class PixelOperation class PixelOperation
@ -65,32 +65,32 @@ private:
template<GPULayerType LAYERTYPE> FORCEINLINE void __selectedEffect(const GPUEngineCompositorInfo &compInfo, const u8 &dstLayerID, const bool enableColorEffect, const u8 spriteAlpha, const OBJMode spriteMode, ColorEffect &selectedEffect, TBlendTable **selectedBlendTable, u8 &blendEVA, u8 &blendEVB) const; template<GPULayerType LAYERTYPE> FORCEINLINE void __selectedEffect(const GPUEngineCompositorInfo &compInfo, const u8 &dstLayerID, const bool enableColorEffect, const u8 spriteAlpha, const OBJMode spriteMode, ColorEffect &selectedEffect, TBlendTable **selectedBlendTable, u8 &blendEVA, u8 &blendEVB) const;
protected: protected:
template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copy16(GPUEngineCompositorInfo &compInfo, const Color5551 srcColor16) const; template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copy16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16) const;
template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copy32(GPUEngineCompositorInfo &compInfo, const Color4u8 srcColor32) const; template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copy32(GPUEngineCompositorInfo &compInfo, const FragmentColor srcColor32) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUp16(GPUEngineCompositorInfo &compInfo, const Color5551 srcColor16) const; template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUp16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUp32(GPUEngineCompositorInfo &compInfo, const Color4u8 srcColor32) const; template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUp32(GPUEngineCompositorInfo &compInfo, const FragmentColor srcColor32) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDown16(GPUEngineCompositorInfo &compInfo, const Color5551 srcColor16) const; template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDown16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDown32(GPUEngineCompositorInfo &compInfo, const Color4u8 srcColor32) const; template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDown32(GPUEngineCompositorInfo &compInfo, const FragmentColor srcColor32) const;
template<NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> FORCEINLINE void _unknownEffect16(GPUEngineCompositorInfo &compInfo, const Color5551 srcColor16, const bool enableColorEffect, const u8 spriteAlpha, const OBJMode spriteMode) const; template<NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> FORCEINLINE void _unknownEffect16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16, const bool enableColorEffect, const u8 spriteAlpha, const OBJMode spriteMode) const;
template<NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> FORCEINLINE void _unknownEffect32(GPUEngineCompositorInfo &compInfo, const Color4u8 srcColor32, const bool enableColorEffect, const u8 spriteAlpha, const OBJMode spriteMode) const; template<NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> FORCEINLINE void _unknownEffect32(GPUEngineCompositorInfo &compInfo, const FragmentColor srcColor32, const bool enableColorEffect, const u8 spriteAlpha, const OBJMode spriteMode) const;
public: public:
static CACHE_ALIGN u8 BlendTable555[17][17][32][32]; static CACHE_ALIGN u8 BlendTable555[17][17][32][32];
static CACHE_ALIGN Color5551 BrightnessUpTable555[17][0x8000]; static CACHE_ALIGN u16 BrightnessUpTable555[17][0x8000];
static CACHE_ALIGN Color4u8 BrightnessUpTable666[17][0x8000]; static CACHE_ALIGN FragmentColor BrightnessUpTable666[17][0x8000];
static CACHE_ALIGN Color4u8 BrightnessUpTable888[17][0x8000]; static CACHE_ALIGN FragmentColor BrightnessUpTable888[17][0x8000];
static CACHE_ALIGN Color5551 BrightnessDownTable555[17][0x8000]; static CACHE_ALIGN u16 BrightnessDownTable555[17][0x8000];
static CACHE_ALIGN Color4u8 BrightnessDownTable666[17][0x8000]; static CACHE_ALIGN FragmentColor BrightnessDownTable666[17][0x8000];
static CACHE_ALIGN Color4u8 BrightnessDownTable888[17][0x8000]; static CACHE_ALIGN FragmentColor BrightnessDownTable888[17][0x8000];
static void InitLUTs(); static void InitLUTs();
PixelOperation() {}; PixelOperation() {};
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> FORCEINLINE void Composite16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16, const bool enableColorEffect, const u8 spriteAlpha, const u8 spriteMode) const; template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> FORCEINLINE void Composite16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16, const bool enableColorEffect, const u8 spriteAlpha, const u8 spriteMode) const;
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> FORCEINLINE void Composite32(GPUEngineCompositorInfo &compInfo, Color4u8 srcColor32, const bool enableColorEffect, const u8 spriteAlpha, const u8 spriteMode) const; template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE> FORCEINLINE void Composite32(GPUEngineCompositorInfo &compInfo, FragmentColor srcColor32, const bool enableColorEffect, const u8 spriteAlpha, const u8 spriteMode) const;
}; };
#endif // GPU_OPERATIONS_H #endif // GPU_OPERATIONS_H

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2021-2025 DeSmuME team Copyright (C) 2021-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -950,17 +950,15 @@ FORCEINLINE v256u16 ColorOperation_AVX2::blend3D(const v256u32 &colA_Lo, const v
{ {
// If the color format of B is 555, then the colA_Hi parameter is required. // If the color format of B is 555, then the colA_Hi parameter is required.
// The color format of A is assumed to be RGB666. // The color format of A is assumed to be RGB666.
static const u8 X = 0x80; v256u32 ra_lo = _mm256_and_si256( colA_Lo, _mm256_set1_epi32(0x000000FF) );
v256u32 ga_lo = _mm256_and_si256( _mm256_srli_epi32(colA_Lo, 8), _mm256_set1_epi32(0x000000FF) );
v256u32 ba_lo = _mm256_and_si256( _mm256_srli_epi32(colA_Lo, 16), _mm256_set1_epi32(0x000000FF) );
v256u32 aa_lo = _mm256_srli_epi32(colA_Lo, 24);
const v256u32 ra_lo = _mm256_shuffle_epi8( colA_Lo, _mm256_set_epi8( X, X, X,12, X, X, X, 8, X, X, X, 4, X, X, X, 0, X, X, X,12, X, X, X, 8, X, X, X, 4, X, X, X, 0) ); v256u32 ra_hi = _mm256_and_si256( colA_Hi, _mm256_set1_epi32(0x000000FF) );
const v256u32 ga_lo = _mm256_shuffle_epi8( colA_Lo, _mm256_set_epi8( X, X, X,13, X, X, X, 9, X, X, X, 5, X, X, X, 1, X, X, X,13, X, X, X, 9, X, X, X, 5, X, X, X, 1) ); v256u32 ga_hi = _mm256_and_si256( _mm256_srli_epi32(colA_Hi, 8), _mm256_set1_epi32(0x000000FF) );
const v256u32 ba_lo = _mm256_shuffle_epi8( colA_Lo, _mm256_set_epi8( X, X, X,14, X, X, X,10, X, X, X, 6, X, X, X, 2, X, X, X,14, X, X, X,10, X, X, X, 6, X, X, X, 2) ); v256u32 ba_hi = _mm256_and_si256( _mm256_srli_epi32(colA_Hi, 16), _mm256_set1_epi32(0x000000FF) );
const v256u32 aa_lo = _mm256_shuffle_epi8( colA_Lo, _mm256_set_epi8( X, X, X,15, X, X, X,11, X, X, X, 7, X, X, X, 3, X, X, X,15, X, X, X,11, X, X, X, 7, X, X, X, 3) ); v256u32 aa_hi = _mm256_srli_epi32(colA_Hi, 24);
const v256u32 ra_hi = _mm256_shuffle_epi8( colA_Hi, _mm256_set_epi8( X, X, X,12, X, X, X, 8, X, X, X, 4, X, X, X, 0, X, X, X,12, X, X, X, 8, X, X, X, 4, X, X, X, 0) );
const v256u32 ga_hi = _mm256_shuffle_epi8( colA_Hi, _mm256_set_epi8( X, X, X,13, X, X, X, 9, X, X, X, 5, X, X, X, 1, X, X, X,13, X, X, X, 9, X, X, X, 5, X, X, X, 1) );
const v256u32 ba_hi = _mm256_shuffle_epi8( colA_Hi, _mm256_set_epi8( X, X, X,14, X, X, X,10, X, X, X, 6, X, X, X, 2, X, X, X,14, X, X, X,10, X, X, X, 6, X, X, X, 2) );
const v256u32 aa_hi = _mm256_shuffle_epi8( colA_Hi, _mm256_set_epi8( X, X, X,15, X, X, X,11, X, X, X, 7, X, X, X, 3, X, X, X,15, X, X, X,11, X, X, X, 7, X, X, X, 3) );
v256u16 ra = _mm256_packus_epi32(ra_lo, ra_hi); v256u16 ra = _mm256_packus_epi32(ra_lo, ra_hi);
v256u16 ga = _mm256_packus_epi32(ga_lo, ga_hi); v256u16 ga = _mm256_packus_epi32(ga_lo, ga_hi);
@ -993,11 +991,9 @@ FORCEINLINE v256u16 ColorOperation_AVX2::blend3D(const v256u32 &colA_Lo, const v
template <NDSColorFormat COLORFORMAT> template <NDSColorFormat COLORFORMAT>
FORCEINLINE v256u32 ColorOperation_AVX2::blend3D(const v256u32 &colA, const v256u32 &colB) const FORCEINLINE v256u32 ColorOperation_AVX2::blend3D(const v256u32 &colA, const v256u32 &colB) const
{ {
static const u8 X = 0x80;
// If the color format of B is 666 or 888, then the colA_Hi parameter is ignored. // If the color format of B is 666 or 888, then the colA_Hi parameter is ignored.
// The color format of A is assumed to match the color format of B. // The color format of A is assumed to match the color format of B.
v256u8 alpha; v256u32 alpha;
v256u16 alphaLo; v256u16 alphaLo;
v256u16 alphaHi; v256u16 alphaHi;
@ -1019,7 +1015,8 @@ FORCEINLINE v256u32 ColorOperation_AVX2::blend3D(const v256u32 &colA, const v256
v256u16 tempColorLo = _mm256_unpacklo_epi8(tempColor[0], tempColor[1]); v256u16 tempColorLo = _mm256_unpacklo_epi8(tempColor[0], tempColor[1]);
v256u16 tempColorHi = _mm256_unpackhi_epi8(tempColor[0], tempColor[1]); v256u16 tempColorHi = _mm256_unpackhi_epi8(tempColor[0], tempColor[1]);
alpha = _mm256_shuffle_epi8( colA, _mm256_set_epi8( X,15,15,15, X,11,11,11, X, 7, 7, 7, X, 3, 3, 3, X,15,15,15, X,11,11,11, X, 7, 7, 7, X, 3, 3, 3) ); alpha = _mm256_and_si256( _mm256_srli_epi32(colA, 24), _mm256_set1_epi32(0x0000001F) );
alpha = _mm256_or_si256( alpha, _mm256_or_si256(_mm256_slli_epi32(alpha, 8), _mm256_slli_epi32(alpha, 16)) );
alpha = _mm256_adds_epu8(alpha, _mm256_set1_epi8(1)); alpha = _mm256_adds_epu8(alpha, _mm256_set1_epi8(1));
v256u32 invAlpha = _mm256_subs_epu8(_mm256_set1_epi8(32), alpha); v256u32 invAlpha = _mm256_subs_epu8(_mm256_set1_epi8(32), alpha);
@ -1042,7 +1039,8 @@ FORCEINLINE v256u32 ColorOperation_AVX2::blend3D(const v256u32 &colA, const v256
v256u16 rgbBLo = _mm256_unpacklo_epi8(tempColor[1], _mm256_setzero_si256()); v256u16 rgbBLo = _mm256_unpacklo_epi8(tempColor[1], _mm256_setzero_si256());
v256u16 rgbBHi = _mm256_unpackhi_epi8(tempColor[1], _mm256_setzero_si256()); v256u16 rgbBHi = _mm256_unpackhi_epi8(tempColor[1], _mm256_setzero_si256());
alpha = _mm256_shuffle_epi8( colA, _mm256_set_epi8( X,15,15,15, X,11,11,11, X, 7, 7, 7, X, 3, 3, 3, X,15,15,15, X,11,11,11, X, 7, 7, 7, X, 3, 3, 3) ); alpha = _mm256_and_si256( _mm256_srli_epi32(colA, 24), _mm256_set1_epi32(0x000000FF) );
alpha = _mm256_or_si256( alpha, _mm256_or_si256(_mm256_slli_epi32(alpha, 8), _mm256_slli_epi32(alpha, 16)) );
alpha = _mm256_permute4x64_epi64(alpha, 0xD8); alpha = _mm256_permute4x64_epi64(alpha, 0xD8);
alphaLo = _mm256_unpacklo_epi8(alpha, _mm256_setzero_si256()); alphaLo = _mm256_unpacklo_epi8(alpha, _mm256_setzero_si256());
@ -1130,13 +1128,13 @@ FORCEINLINE void PixelOperation_AVX2::_copy16(GPUEngineCompositorInfo &compInfo,
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo6665Opaque_AVX2<false>(src0, src32[0], src32[1]); ColorspaceConvert555To6665Opaque_AVX2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo6665Opaque_AVX2<false>(src1, src32[2], src32[3]); ColorspaceConvert555To6665Opaque_AVX2<false>(src1, src32[2], src32[3]);
} }
else else
{ {
ColorspaceConvert555xTo8888Opaque_AVX2<false>(src0, src32[0], src32[1]); ColorspaceConvert555To8888Opaque_AVX2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo8888Opaque_AVX2<false>(src1, src32[2], src32[3]); ColorspaceConvert555To8888Opaque_AVX2<false>(src1, src32[2], src32[3]);
} }
_mm256_store_si256( (v256u32 *)compInfo.target.lineColor32 + 0, src32[0] ); _mm256_store_si256( (v256u32 *)compInfo.target.lineColor32 + 0, src32[0] );
@ -1207,13 +1205,13 @@ FORCEINLINE void PixelOperation_AVX2::_copyMask16(GPUEngineCompositorInfo &compI
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo6665Opaque_AVX2<false>(src0, src32[0], src32[1]); ColorspaceConvert555To6665Opaque_AVX2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo6665Opaque_AVX2<false>(src1, src32[2], src32[3]); ColorspaceConvert555To6665Opaque_AVX2<false>(src1, src32[2], src32[3]);
} }
else else
{ {
ColorspaceConvert555xTo8888Opaque_AVX2<false>(src0, src32[0], src32[1]); ColorspaceConvert555To8888Opaque_AVX2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo8888Opaque_AVX2<false>(src1, src32[2], src32[3]); ColorspaceConvert555To8888Opaque_AVX2<false>(src1, src32[2], src32[3]);
} }
passMask16[0] = _mm256_permute4x64_epi64(passMask16[0], 0xD8); passMask16[0] = _mm256_permute4x64_epi64(passMask16[0], 0xD8);
@ -1306,13 +1304,13 @@ FORCEINLINE void PixelOperation_AVX2::_brightnessUp16(GPUEngineCompositorInfo &c
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo666x_AVX2<false>(src0, dst[0], dst[1]); ColorspaceConvert555XTo666X_AVX2<false>(src0, dst[0], dst[1]);
ColorspaceConvert555xTo666x_AVX2<false>(src1, dst[2], dst[3]); ColorspaceConvert555XTo666X_AVX2<false>(src1, dst[2], dst[3]);
} }
else else
{ {
ColorspaceConvert555xTo888x_AVX2<false>(src0, dst[0], dst[1]); ColorspaceConvert555XTo888X_AVX2<false>(src0, dst[0], dst[1]);
ColorspaceConvert555xTo888x_AVX2<false>(src1, dst[2], dst[3]); ColorspaceConvert555XTo888X_AVX2<false>(src1, dst[2], dst[3]);
} }
const v256u32 alphaBits = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? _mm256_set1_epi32(0x1F000000) : _mm256_set1_epi32(0xFF000000); const v256u32 alphaBits = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? _mm256_set1_epi32(0x1F000000) : _mm256_set1_epi32(0xFF000000);
@ -1379,13 +1377,13 @@ FORCEINLINE void PixelOperation_AVX2::_brightnessUpMask16(GPUEngineCompositorInf
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo666x_AVX2<false>(src0, src32[0], src32[1]); ColorspaceConvert555XTo666X_AVX2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo666x_AVX2<false>(src1, src32[2], src32[3]); ColorspaceConvert555XTo666X_AVX2<false>(src1, src32[2], src32[3]);
} }
else else
{ {
ColorspaceConvert555xTo888x_AVX2<false>(src0, src32[0], src32[1]); ColorspaceConvert555XTo888X_AVX2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo888x_AVX2<false>(src1, src32[2], src32[3]); ColorspaceConvert555XTo888X_AVX2<false>(src1, src32[2], src32[3]);
} }
passMask16[0] = _mm256_permute4x64_epi64(passMask16[0], 0xD8); passMask16[0] = _mm256_permute4x64_epi64(passMask16[0], 0xD8);
@ -1473,13 +1471,13 @@ FORCEINLINE void PixelOperation_AVX2::_brightnessDown16(GPUEngineCompositorInfo
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo666x_AVX2<false>(src0, dst[0], dst[1]); ColorspaceConvert555XTo666X_AVX2<false>(src0, dst[0], dst[1]);
ColorspaceConvert555xTo666x_AVX2<false>(src1, dst[2], dst[3]); ColorspaceConvert555XTo666X_AVX2<false>(src1, dst[2], dst[3]);
} }
else else
{ {
ColorspaceConvert555xTo888x_AVX2<false>(src0, dst[0], dst[1]); ColorspaceConvert555XTo888X_AVX2<false>(src0, dst[0], dst[1]);
ColorspaceConvert555xTo888x_AVX2<false>(src1, dst[2], dst[3]); ColorspaceConvert555XTo888X_AVX2<false>(src1, dst[2], dst[3]);
} }
const v256u32 alphaBits = _mm256_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000); const v256u32 alphaBits = _mm256_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000);
@ -1546,13 +1544,13 @@ FORCEINLINE void PixelOperation_AVX2::_brightnessDownMask16(GPUEngineCompositorI
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo666x_AVX2<false>(src0, src32[0], src32[1]); ColorspaceConvert555XTo666X_AVX2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo666x_AVX2<false>(src1, src32[2], src32[3]); ColorspaceConvert555XTo666X_AVX2<false>(src1, src32[2], src32[3]);
} }
else else
{ {
ColorspaceConvert555xTo888x_AVX2<false>(src0, src32[0], src32[1]); ColorspaceConvert555XTo888X_AVX2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo888x_AVX2<false>(src1, src32[2], src32[3]); ColorspaceConvert555XTo888X_AVX2<false>(src1, src32[2], src32[3]);
} }
passMask16[0] = _mm256_permute4x64_epi64(passMask16[0], 0xD8); passMask16[0] = _mm256_permute4x64_epi64(passMask16[0], 0xD8);
@ -1676,13 +1674,13 @@ FORCEINLINE void PixelOperation_AVX2::_unknownEffectMask16(GPUEngineCompositorIn
} }
else if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) else if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo666x_AVX2<false>(src0, tmpSrc[0], tmpSrc[1]); ColorspaceConvert555XTo666X_AVX2<false>(src0, tmpSrc[0], tmpSrc[1]);
ColorspaceConvert555xTo666x_AVX2<false>(src1, tmpSrc[2], tmpSrc[3]); ColorspaceConvert555XTo666X_AVX2<false>(src1, tmpSrc[2], tmpSrc[3]);
} }
else else
{ {
ColorspaceConvert555xTo888x_AVX2<false>(src0, tmpSrc[0], tmpSrc[1]); ColorspaceConvert555XTo888X_AVX2<false>(src0, tmpSrc[0], tmpSrc[1]);
ColorspaceConvert555xTo888x_AVX2<false>(src1, tmpSrc[2], tmpSrc[3]); ColorspaceConvert555XTo888X_AVX2<false>(src1, tmpSrc[2], tmpSrc[3]);
} }
switch (compInfo.renderState.colorEffect) switch (compInfo.renderState.colorEffect)
@ -2181,7 +2179,7 @@ FORCEINLINE void PixelOperation_AVX2::_unknownEffectMask32(GPUEngineCompositorIn
_mm256_load_si256((v256u32 *)compInfo.target.lineColor32 + 0), _mm256_load_si256((v256u32 *)compInfo.target.lineColor32 + 0),
_mm256_load_si256((v256u32 *)compInfo.target.lineColor32 + 1), _mm256_load_si256((v256u32 *)compInfo.target.lineColor32 + 1),
_mm256_load_si256((v256u32 *)compInfo.target.lineColor32 + 2), _mm256_load_si256((v256u32 *)compInfo.target.lineColor32 + 2),
_mm256_load_si256((v256u32 *)compInfo.target.lineColor32 + 3) _mm256_load_si256((v256u32 *)compInfo.target.lineColor32 + 3),
}; };
v256u32 blendSrc32[4]; v256u32 blendSrc32[4];
@ -2462,25 +2460,25 @@ void GPUEngineBase::_MosaicLine(GPUEngineCompositorInfo &compInfo)
_mm256_blendv_epi8(_mm256_and_si256(dstColor16[1], _mm256_set1_epi16(0x7FFF)), _mm256_set1_epi16(0xFFFF), idxMask16[1]) _mm256_blendv_epi8(_mm256_and_si256(dstColor16[1], _mm256_set1_epi16(0x7FFF)), _mm256_set1_epi16(0xFFFF), idxMask16[1])
}; };
const v256u16 mosaicSetColorMask8 = _mm256_permute4x64_epi64( _mm256_cmpeq_epi16(_mm256_load_si256((v256u8 *)(compInfo.renderState.mosaicWidthBG->begin + x)), _mm256_setzero_si256()), 0xD8 ); const v256u16 mosaicSetColorMask8 = _mm256_permute4x64_epi64( _mm256_cmpeq_epi16(_mm256_loadu_si256((v256u8 *)(compInfo.renderState.mosaicWidthBG->begin + x)), _mm256_setzero_si256()), 0xD8 );
const v256u16 mosaicSetColorMask16[2] = { const v256u16 mosaicSetColorMask16[2] = {
_mm256_unpacklo_epi8(mosaicSetColorMask8, mosaicSetColorMask8), _mm256_unpacklo_epi8(mosaicSetColorMask8, mosaicSetColorMask8),
_mm256_unpackhi_epi8(mosaicSetColorMask8, mosaicSetColorMask8) _mm256_unpackhi_epi8(mosaicSetColorMask8, mosaicSetColorMask8)
}; };
__m256i mosaicColorOut[2]; __m256i mosaicColorOut[2];
mosaicColorOut[0] = _mm256_blendv_epi8(mosaicColor16[0], _mm256_load_si256((v256u16 *)(mosaicColorBG + x) + 0), mosaicSetColorMask16[0]); mosaicColorOut[0] = _mm256_blendv_epi8(mosaicColor16[0], _mm256_loadu_si256((v256u16 *)(mosaicColorBG + x) + 0), mosaicSetColorMask16[0]);
mosaicColorOut[1] = _mm256_blendv_epi8(mosaicColor16[1], _mm256_load_si256((v256u16 *)(mosaicColorBG + x) + 1), mosaicSetColorMask16[1]); mosaicColorOut[1] = _mm256_blendv_epi8(mosaicColor16[1], _mm256_loadu_si256((v256u16 *)(mosaicColorBG + x) + 1), mosaicSetColorMask16[1]);
_mm256_store_si256((v256u16 *)(mosaicColorBG + x) + 0, mosaicColorOut[0]); _mm256_storeu_si256((v256u16 *)(mosaicColorBG + x) + 0, mosaicColorOut[0]);
_mm256_store_si256((v256u16 *)(mosaicColorBG + x) + 1, mosaicColorOut[1]); _mm256_storeu_si256((v256u16 *)(mosaicColorBG + x) + 1, mosaicColorOut[1]);
} }
const v256u32 outColor32idx[4] = { const v256u32 outColor32idx[4] = {
_mm256_load_si256((v256u32 *)(compInfo.renderState.mosaicWidthBG->trunc32 + x) + 0), _mm256_loadu_si256((v256u32 *)(compInfo.renderState.mosaicWidthBG->trunc32 + x) + 0),
_mm256_load_si256((v256u32 *)(compInfo.renderState.mosaicWidthBG->trunc32 + x) + 1), _mm256_loadu_si256((v256u32 *)(compInfo.renderState.mosaicWidthBG->trunc32 + x) + 1),
_mm256_load_si256((v256u32 *)(compInfo.renderState.mosaicWidthBG->trunc32 + x) + 2), _mm256_loadu_si256((v256u32 *)(compInfo.renderState.mosaicWidthBG->trunc32 + x) + 2),
_mm256_load_si256((v256u32 *)(compInfo.renderState.mosaicWidthBG->trunc32 + x) + 3) _mm256_loadu_si256((v256u32 *)(compInfo.renderState.mosaicWidthBG->trunc32 + x) + 3)
}; };
const v256u16 outColor32[4] = { const v256u16 outColor32[4] = {
@ -2507,7 +2505,7 @@ void GPUEngineBase::_MosaicLine(GPUEngineCompositorInfo &compInfo)
} }
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST>
void GPUEngineBase::_CompositeNativeLineOBJ_LoopOp(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const Color4u8 *__restrict srcColorNative32) void GPUEngineBase::_CompositeNativeLineOBJ_LoopOp(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const FragmentColor *__restrict srcColorNative32)
{ {
static const size_t step = sizeof(v256u8); static const size_t step = sizeof(v256u8);
@ -2751,10 +2749,10 @@ size_t GPUEngineBase::_CompositeVRAMLineDeferred_LoopOp(GPUEngineCompositorInfo
case NDSColorFormat_BGR888_Rev: case NDSColorFormat_BGR888_Rev:
{ {
const v256u32 src32[4] = { const v256u32 src32[4] = {
_mm256_load_si256((v256u32 *)((Color4u8 *)vramColorPtr + i) + 0), _mm256_load_si256((v256u32 *)((FragmentColor *)vramColorPtr + i) + 0),
_mm256_load_si256((v256u32 *)((Color4u8 *)vramColorPtr + i) + 1), _mm256_load_si256((v256u32 *)((FragmentColor *)vramColorPtr + i) + 1),
_mm256_load_si256((v256u32 *)((Color4u8 *)vramColorPtr + i) + 2), _mm256_load_si256((v256u32 *)((FragmentColor *)vramColorPtr + i) + 2),
_mm256_load_si256((v256u32 *)((Color4u8 *)vramColorPtr + i) + 3) _mm256_load_si256((v256u32 *)((FragmentColor *)vramColorPtr + i) + 3)
}; };
if (LAYERTYPE != GPULayerType_OBJ) if (LAYERTYPE != GPULayerType_OBJ)
@ -2908,7 +2906,7 @@ void GPUEngineBase::_PerformWindowTestingNative(GPUEngineCompositorInfo &compInf
} }
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST>
size_t GPUEngineA::_RenderLine_Layer3D_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const Color4u8 *__restrict srcLinePtr) size_t GPUEngineA::_RenderLine_Layer3D_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const FragmentColor *__restrict srcLinePtr)
{ {
static const size_t step = sizeof(v256u32); static const size_t step = sizeof(v256u32);

File diff suppressed because it is too large Load Diff

View File

@ -1,122 +0,0 @@
/*
Copyright (C) 2025 DeSmuME team
This file 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 file 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 the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GPU_OPERATIONS_ALTIVEC_H
#define GPU_OPERATIONS_ALTIVEC_H
#include "GPU_Operations.h"
#ifndef ENABLE_ALTIVEC
#warning This header requires PowerPC AltiVec support.
#else
class ColorOperation_AltiVec
{
public:
ColorOperation_AltiVec() {};
FORCEINLINE v128u16 blend(const v128u16 &colA, const v128u16 &colB, const v128u16 &blendEVA, const v128u16 &blendEVB) const;
template<NDSColorFormat COLORFORMAT, bool USECONSTANTBLENDVALUESHINT> FORCEINLINE v128u32 blend(const v128u32 &colA, const v128u32 &colB, const v128u16 &blendEVA, const v128u16 &blendEVB) const;
FORCEINLINE v128u16 blend3D(const v128u32 &colA_Lo, const v128u32 &colA_Hi, const v128u16 &colB) const;
template<NDSColorFormat COLORFORMAT> FORCEINLINE v128u32 blend3D(const v128u32 &colA, const v128u32 &colB) const;
FORCEINLINE v128u16 increase(const v128u16 &col, const v128u16 &blendEVY) const;
template<NDSColorFormat COLORFORMAT> FORCEINLINE v128u32 increase(const v128u32 &col, const v128u16 &blendEVY) const;
FORCEINLINE v128u16 decrease(const v128u16 &col, const v128u16 &blendEVY) const;
template<NDSColorFormat COLORFORMAT> FORCEINLINE v128u32 decrease(const v128u32 &col, const v128u16 &blendEVY) const;
};
class PixelOperation_AltiVec
{
protected:
template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copy16(GPUEngineCompositorInfo &compInfo, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copy32(GPUEngineCompositorInfo &compInfo, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copyMask16(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copyMask32(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUp16(GPUEngineCompositorInfo &compInfo, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUp32(GPUEngineCompositorInfo &compInfo, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUpMask16(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUpMask32(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDown16(GPUEngineCompositorInfo &compInfo, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDown32(GPUEngineCompositorInfo &compInfo, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDownMask16(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDownMask32(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE>
FORCEINLINE void _unknownEffectMask16(GPUEngineCompositorInfo &compInfo,
const v128u8 &passMask8,
const v128u16 &evy16,
const v128u8 &srcLayerID,
const v128u16 &src1, const v128u16 &src0,
const v128u8 &srcEffectEnableMask,
const v128u8 &dstBlendEnableMaskLUT,
const v128u8 &enableColorEffectMask,
const v128u8 &spriteAlpha,
const v128u8 &spriteMode) const;
template<NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE>
FORCEINLINE void _unknownEffectMask32(GPUEngineCompositorInfo &compInfo,
const v128u8 &passMask8,
const v128u16 &evy16,
const v128u8 &srcLayerID,
const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0,
const v128u8 &srcEffectEnableMask,
const v128u8 &dstBlendEnableMaskLUT,
const v128u8 &enableColorEffectMask,
const v128u8 &spriteAlpha,
const v128u8 &spriteMode) const;
public:
PixelOperation_AltiVec() {};
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST>
FORCEINLINE void Composite16(GPUEngineCompositorInfo &compInfo,
const bool didAllPixelsPass,
const v128u8 &passMask8,
const v128u16 &evy16,
const v128u8 &srcLayerID,
const v128u16 &src1, const v128u16 &src0,
const v128u8 &srcEffectEnableMask,
const v128u8 &dstBlendEnableMaskLUT,
const u8 *__restrict enableColorEffectPtr,
const u8 *__restrict sprAlphaPtr,
const u8 *__restrict sprModePtr) const;
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST>
FORCEINLINE void Composite32(GPUEngineCompositorInfo &compInfo,
const bool didAllPixelsPass,
const v128u8 &passMask8,
const v128u16 &evy16,
const v128u8 &srcLayerID,
const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0,
const v128u8 &srcEffectEnableMask,
const v128u8 &dstBlendEnableMaskLUT,
const u8 *__restrict enableColorEffectPtr,
const u8 *__restrict sprAlphaPtr,
const u8 *__restrict sprModePtr) const;
};
#endif // ENABLE_ALTIVEC
#endif // GPU_OPERATIONS_ALTIVEC_H

File diff suppressed because it is too large Load Diff

View File

@ -1,122 +0,0 @@
/*
Copyright (C) 2025 DeSmuME team
This file 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 file 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 the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GPU_OPERATIONS_NEON_H
#define GPU_OPERATIONS_NEON_H
#include "GPU_Operations.h"
#ifndef ENABLE_NEON_A64
#warning This header requires ARM64 NEON support.
#else
class ColorOperation_NEON
{
public:
ColorOperation_NEON() {};
FORCEINLINE v128u16 blend(const v128u16 &colA, const v128u16 &colB, const v128u16 &blendEVA, const v128u16 &blendEVB) const;
template<NDSColorFormat COLORFORMAT, bool USECONSTANTBLENDVALUESHINT> FORCEINLINE v128u32 blend(const v128u32 &colA, const v128u32 &colB, const v128u16 &blendEVA, const v128u16 &blendEVB) const;
FORCEINLINE v128u16 blend3D(const v128u32 &colA_Lo, const v128u32 &colA_Hi, const v128u16 &colB) const;
template<NDSColorFormat COLORFORMAT> FORCEINLINE v128u32 blend3D(const v128u32 &colA, const v128u32 &colB) const;
FORCEINLINE v128u16 increase(const v128u16 &col, const v128u16 &blendEVY) const;
template<NDSColorFormat COLORFORMAT> FORCEINLINE v128u32 increase(const v128u32 &col, const v128u16 &blendEVY) const;
FORCEINLINE v128u16 decrease(const v128u16 &col, const v128u16 &blendEVY) const;
template<NDSColorFormat COLORFORMAT> FORCEINLINE v128u32 decrease(const v128u32 &col, const v128u16 &blendEVY) const;
};
class PixelOperation_NEON
{
protected:
template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copy16(GPUEngineCompositorInfo &compInfo, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copy32(GPUEngineCompositorInfo &compInfo, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copyMask16(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER> FORCEINLINE void _copyMask32(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUp16(GPUEngineCompositorInfo &compInfo, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUp32(GPUEngineCompositorInfo &compInfo, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUpMask16(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessUpMask32(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDown16(GPUEngineCompositorInfo &compInfo, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDown32(GPUEngineCompositorInfo &compInfo, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDownMask16(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u16 &src1, const v128u16 &src0) const;
template<NDSColorFormat OUTPUTFORMAT> FORCEINLINE void _brightnessDownMask32(GPUEngineCompositorInfo &compInfo, const v128u8 &passMask8, const v128u16 &evy16, const v128u8 &srcLayerID, const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0) const;
template<NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE>
FORCEINLINE void _unknownEffectMask16(GPUEngineCompositorInfo &compInfo,
const v128u8 &passMask8,
const v128u16 &evy16,
const v128u8 &srcLayerID,
const v128u16 &src1, const v128u16 &src0,
const v128u8 &srcEffectEnableMask,
const v128u8 &dstBlendEnableMaskLUT,
const v128u8 &enableColorEffectMask,
const v128u8 &spriteAlpha,
const v128u8 &spriteMode) const;
template<NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE>
FORCEINLINE void _unknownEffectMask32(GPUEngineCompositorInfo &compInfo,
const v128u8 &passMask8,
const v128u16 &evy16,
const v128u8 &srcLayerID,
const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0,
const v128u8 &srcEffectEnableMask,
const v128u8 &dstBlendEnableMaskLUT,
const v128u8 &enableColorEffectMask,
const v128u8 &spriteAlpha,
const v128u8 &spriteMode) const;
public:
PixelOperation_NEON() {};
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST>
FORCEINLINE void Composite16(GPUEngineCompositorInfo &compInfo,
const bool didAllPixelsPass,
const v128u8 &passMask8,
const v128u16 &evy16,
const v128u8 &srcLayerID,
const v128u16 &src1, const v128u16 &src0,
const v128u8 &srcEffectEnableMask,
const v128u8 &dstBlendEnableMaskLUT,
const u8 *__restrict enableColorEffectPtr,
const u8 *__restrict sprAlphaPtr,
const u8 *__restrict sprModePtr) const;
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, GPULayerType LAYERTYPE, bool WILLPERFORMWINDOWTEST>
FORCEINLINE void Composite32(GPUEngineCompositorInfo &compInfo,
const bool didAllPixelsPass,
const v128u8 &passMask8,
const v128u16 &evy16,
const v128u8 &srcLayerID,
const v128u32 &src3, const v128u32 &src2, const v128u32 &src1, const v128u32 &src0,
const v128u8 &srcEffectEnableMask,
const v128u8 &dstBlendEnableMaskLUT,
const u8 *__restrict enableColorEffectPtr,
const u8 *__restrict sprAlphaPtr,
const u8 *__restrict sprModePtr) const;
};
#endif // ENABLE_NEON_A64
#endif // GPU_OPERATIONS_NEON_H

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2021-2025 DeSmuME team Copyright (C) 2021-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -279,378 +279,6 @@ static FORCEINLINE void CopyLineExpand(void *__restrict dst, const void *__restr
} }
} }
#ifdef ENABLE_SSSE3 #ifdef ENABLE_SSSE3
else if (INTEGERSCALEHINT == 5)
{
__m128i srcPixOut[5];
for (size_t srcX = 0, dstX = 0; srcX < GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE); srcX++, dstX+=INTEGERSCALEHINT)
{
const __m128i srcVec = _mm_load_si128((__m128i *)src + srcX);
if (ELEMENTSIZE == 1)
{
srcPixOut[0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3));
srcPixOut[1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6));
srcPixOut[2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9));
srcPixOut[3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 9, 9,10,10,10,10,10,11,11,11,11,11,12,12,12,12));
srcPixOut[4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,13,13,13,13,13,14,14,14,14,14,15,15,15,15,15));
}
else if (ELEMENTSIZE == 2)
{
srcPixOut[0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3));
srcPixOut[1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 3, 2, 3, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 6, 7));
srcPixOut[2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 7, 6, 7, 6, 7, 6, 7, 8, 9, 8, 9, 8, 9, 8, 9));
srcPixOut[3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 9,10,11,10,11,10,11,10,11,10,11,12,13,12,13));
srcPixOut[4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,13,12,13,12,13,14,15,14,15,14,15,14,15,14,15));
}
else if (ELEMENTSIZE == 4)
{
srcPixOut[0] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[1] = _mm_shuffle_epi32(srcVec, 0x54);
srcPixOut[2] = _mm_shuffle_epi32(srcVec, 0xA5);
srcPixOut[3] = _mm_shuffle_epi32(srcVec, 0xEA);
srcPixOut[4] = _mm_shuffle_epi32(srcVec, 0xFF);
}
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + lx, srcPixOut[lx]);
}
if (SCALEVERTICAL)
{
for (size_t ly = 1; ly < (size_t)INTEGERSCALEHINT; ly++)
{
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + ((GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE) * INTEGERSCALEHINT) * ly) + lx, srcPixOut[lx]);
}
}
}
}
}
else if (INTEGERSCALEHINT == 6)
{
__m128i srcPixOut[6];
for (size_t srcX = 0, dstX = 0; srcX < GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE); srcX++, dstX+=INTEGERSCALEHINT)
{
const __m128i srcVec = _mm_load_si128((__m128i *)src + srcX);
if (ELEMENTSIZE == 1)
{
srcPixOut[0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2));
srcPixOut[1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5));
srcPixOut[2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7));
srcPixOut[3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10));
srcPixOut[4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(10,10,11,11,11,11,11,11,12,12,12,12,12,12,13,13));
srcPixOut[5] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(13,13,13,13,14,14,14,14,14,14,15,15,15,15,15,15));
}
else if (ELEMENTSIZE == 2)
{
srcPixOut[0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3));
srcPixOut[1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 3, 2, 3, 2, 3, 2, 3, 4, 5, 4, 5, 4, 5, 4, 5));
srcPixOut[2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 5, 4, 5, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7));
srcPixOut[3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9,10,11,10,11));
srcPixOut[4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(10,11,10,11,10,11,10,11,12,13,12,13,12,13,12,13));
srcPixOut[5] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,13,12,13,14,15,14,15,14,15,14,15,14,15,14,15));
}
else if (ELEMENTSIZE == 4)
{
srcPixOut[0] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[1] = _mm_shuffle_epi32(srcVec, 0x50);
srcPixOut[2] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[3] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[4] = _mm_shuffle_epi32(srcVec, 0xFA);
srcPixOut[5] = _mm_shuffle_epi32(srcVec, 0xFF);
}
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + lx, srcPixOut[lx]);
}
if (SCALEVERTICAL)
{
for (size_t ly = 1; ly < (size_t)INTEGERSCALEHINT; ly++)
{
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + ((GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE) * INTEGERSCALEHINT) * ly) + lx, srcPixOut[lx]);
}
}
}
}
}
else if (INTEGERSCALEHINT == 7)
{
__m128i srcPixOut[7];
for (size_t srcX = 0, dstX = 0; srcX < GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE); srcX++, dstX+=INTEGERSCALEHINT)
{
const __m128i srcVec = _mm_load_si128((__m128i *)src + srcX);
if (ELEMENTSIZE == 1)
{
srcPixOut[0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2));
srcPixOut[1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4));
srcPixOut[2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6));
srcPixOut[3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9));
srcPixOut[4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,11,11,11));
srcPixOut[5] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(11,11,11,11,12,12,12,12,12,12,12,13,13,13,13,13));
srcPixOut[6] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(13,13,14,14,14,14,14,14,14,15,15,15,15,15,15,15));
}
else if (ELEMENTSIZE == 2)
{
srcPixOut[0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 2, 3));
srcPixOut[1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 4, 5, 4, 5));
srcPixOut[2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 6, 7, 6, 7, 6, 7));
srcPixOut[3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 7, 6, 7, 6, 7, 6, 7, 8, 9, 8, 9, 8, 9, 8, 9));
srcPixOut[4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 9, 8, 9, 8, 9,10,11,10,11,10,11,10,11,10,11));
srcPixOut[5] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(10,11,10,11,12,13,12,13,12,13,12,13,12,13,12,13));
srcPixOut[6] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,13,14,15,14,15,14,15,14,15,14,15,14,15,14,15));
}
else if (ELEMENTSIZE == 4)
{
srcPixOut[0] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[1] = _mm_shuffle_epi32(srcVec, 0x40);
srcPixOut[2] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[3] = _mm_shuffle_epi32(srcVec, 0xA5);
srcPixOut[4] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[5] = _mm_shuffle_epi32(srcVec, 0xFE);
srcPixOut[6] = _mm_shuffle_epi32(srcVec, 0xFF);
}
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + lx, srcPixOut[lx]);
}
if (SCALEVERTICAL)
{
for (size_t ly = 1; ly < (size_t)INTEGERSCALEHINT; ly++)
{
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + ((GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE) * INTEGERSCALEHINT) * ly) + lx, srcPixOut[lx]);
}
}
}
}
}
else if (INTEGERSCALEHINT == 8)
{
__m128i srcPixOut[8];
for (size_t srcX = 0, dstX = 0; srcX < GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE); srcX++, dstX+=INTEGERSCALEHINT)
{
const __m128i srcVec = _mm_load_si128((__m128i *)src + srcX);
if (ELEMENTSIZE == 1)
{
srcPixOut[0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1));
srcPixOut[1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3));
srcPixOut[2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5));
srcPixOut[3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7));
srcPixOut[4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9));
srcPixOut[5] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11));
srcPixOut[6] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13));
srcPixOut[7] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15));
}
else if (ELEMENTSIZE == 2)
{
srcPixOut[0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1));
srcPixOut[1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3));
srcPixOut[2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5));
srcPixOut[3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7));
srcPixOut[4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9));
srcPixOut[5] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11));
srcPixOut[6] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13));
srcPixOut[7] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15));
}
else if (ELEMENTSIZE == 4)
{
srcPixOut[0] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[1] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[2] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[3] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[4] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[5] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[6] = _mm_shuffle_epi32(srcVec, 0xFF);
srcPixOut[7] = _mm_shuffle_epi32(srcVec, 0xFF);
}
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + lx, srcPixOut[lx]);
}
if (SCALEVERTICAL)
{
for (size_t ly = 1; ly < (size_t)INTEGERSCALEHINT; ly++)
{
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + ((GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE) * INTEGERSCALEHINT) * ly) + lx, srcPixOut[lx]);
}
}
}
}
}
else if (INTEGERSCALEHINT == 12)
{
__m128i srcPixOut[12];
for (size_t srcX = 0, dstX = 0; srcX < GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE); srcX++, dstX+=INTEGERSCALEHINT)
{
const __m128i srcVec = _mm_load_si128((__m128i *)src + srcX);
if (ELEMENTSIZE == 1)
{
srcPixOut[ 0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1));
srcPixOut[ 1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2));
srcPixOut[ 2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3));
srcPixOut[ 3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5));
srcPixOut[ 4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6));
srcPixOut[ 5] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7));
srcPixOut[ 6] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9));
srcPixOut[ 7] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 9, 9, 9, 9, 9, 9, 9, 9,10,10,10,10,10,10,10,10));
srcPixOut[ 8] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(10,10,10,10,11,11,11,11,11,11,11,11,11,11,11,11));
srcPixOut[ 9] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,13));
srcPixOut[10] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14));
srcPixOut[11] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(14,14,14,14,15,15,15,15,15,15,15,15,15,15,15,15));
}
else if (ELEMENTSIZE == 2)
{
srcPixOut[ 0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1));
srcPixOut[ 1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 0, 1, 2, 3, 2, 3, 2, 3, 2, 3));
srcPixOut[ 2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3));
srcPixOut[ 3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5));
srcPixOut[ 4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 5, 4, 5, 4, 5, 4, 5, 6, 7, 6, 7, 6, 7, 6, 7));
srcPixOut[ 5] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7));
srcPixOut[ 6] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9));
srcPixOut[ 7] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 9, 8, 9, 8, 9, 8, 9,10,11,10,11,10,11,10,11));
srcPixOut[ 8] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11));
srcPixOut[ 9] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13));
srcPixOut[10] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,13,12,13,12,13,12,13,14,15,14,15,14,15,14,15));
srcPixOut[11] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15));
}
else if (ELEMENTSIZE == 4)
{
srcPixOut[ 0] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[ 1] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[ 2] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[ 3] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[ 4] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[ 5] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[ 6] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[ 7] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[ 8] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[ 9] = _mm_shuffle_epi32(srcVec, 0xFF);
srcPixOut[10] = _mm_shuffle_epi32(srcVec, 0xFF);
srcPixOut[11] = _mm_shuffle_epi32(srcVec, 0xFF);
}
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + lx, srcPixOut[lx]);
}
if (SCALEVERTICAL)
{
for (size_t ly = 1; ly < (size_t)INTEGERSCALEHINT; ly++)
{
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + ((GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE) * INTEGERSCALEHINT) * ly) + lx, srcPixOut[lx]);
}
}
}
}
}
else if (INTEGERSCALEHINT == 16)
{
__m128i srcPixOut[16];
for (size_t srcX = 0, dstX = 0; srcX < GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE); srcX++, dstX+=INTEGERSCALEHINT)
{
const __m128i srcVec = _mm_load_si128((__m128i *)src + srcX);
if (ELEMENTSIZE == 1)
{
srcPixOut[ 0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
srcPixOut[ 1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1));
srcPixOut[ 2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2));
srcPixOut[ 3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3));
srcPixOut[ 4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4));
srcPixOut[ 5] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5));
srcPixOut[ 6] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6));
srcPixOut[ 7] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7));
srcPixOut[ 8] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8));
srcPixOut[ 9] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9));
srcPixOut[10] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10));
srcPixOut[11] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11));
srcPixOut[12] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12));
srcPixOut[13] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13));
srcPixOut[14] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14));
srcPixOut[15] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15));
}
else if (ELEMENTSIZE == 2)
{
srcPixOut[ 0] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1));
srcPixOut[ 1] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1));
srcPixOut[ 2] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3));
srcPixOut[ 3] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3));
srcPixOut[ 4] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5));
srcPixOut[ 5] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5));
srcPixOut[ 6] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7));
srcPixOut[ 7] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 7));
srcPixOut[ 8] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9));
srcPixOut[ 9] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8( 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9, 8, 9));
srcPixOut[10] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11));
srcPixOut[11] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(10,11,10,11,10,11,10,11,10,11,10,11,10,11,10,11));
srcPixOut[12] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13));
srcPixOut[13] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(12,13,12,13,12,13,12,13,12,13,12,13,12,13,12,13));
srcPixOut[14] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15));
srcPixOut[15] = _mm_shuffle_epi8(srcVec, _mm_setr_epi8(14,15,14,15,14,15,14,15,14,15,14,15,14,15,14,15));
}
else if (ELEMENTSIZE == 4)
{
srcPixOut[ 0] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[ 1] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[ 2] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[ 3] = _mm_shuffle_epi32(srcVec, 0x00);
srcPixOut[ 4] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[ 5] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[ 6] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[ 7] = _mm_shuffle_epi32(srcVec, 0x55);
srcPixOut[ 8] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[ 9] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[10] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[11] = _mm_shuffle_epi32(srcVec, 0xAA);
srcPixOut[12] = _mm_shuffle_epi32(srcVec, 0xFF);
srcPixOut[13] = _mm_shuffle_epi32(srcVec, 0xFF);
srcPixOut[14] = _mm_shuffle_epi32(srcVec, 0xFF);
srcPixOut[15] = _mm_shuffle_epi32(srcVec, 0xFF);
}
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + lx, srcPixOut[lx]);
}
if (SCALEVERTICAL)
{
for (size_t ly = 1; ly < (size_t)INTEGERSCALEHINT; ly++)
{
for (size_t lx = 0; lx < (size_t)INTEGERSCALEHINT; lx++)
{
_mm_store_si128((__m128i *)dst + dstX + ((GPU_FRAMEBUFFER_NATIVE_WIDTH / (sizeof(__m128i) / ELEMENTSIZE) * INTEGERSCALEHINT) * ly) + lx, srcPixOut[lx]);
}
}
}
}
}
else if (INTEGERSCALEHINT > 1) else if (INTEGERSCALEHINT > 1)
{ {
const size_t scale = dstWidth / GPU_FRAMEBUFFER_NATIVE_WIDTH; const size_t scale = dstWidth / GPU_FRAMEBUFFER_NATIVE_WIDTH;
@ -1109,36 +737,6 @@ FORCEINLINE v128u16 ColorOperation_SSE2::blend3D(const v128u32 &colA_Lo, const v
{ {
// If the color format of B is 555, then the colA_Hi parameter is required. // If the color format of B is 555, then the colA_Hi parameter is required.
// The color format of A is assumed to be RGB666. // The color format of A is assumed to be RGB666.
#ifdef ENABLE_SSSE3
static const u8 X = 0x80;
const v128u32 ra_lo = _mm_shuffle_epi8( colA_Lo, _mm_set_epi8( X, X, X,12, X, X, X, 8, X, X, X, 4, X, X, X, 0) );
const v128u32 ga_lo = _mm_shuffle_epi8( colA_Lo, _mm_set_epi8( X, X, X,13, X, X, X, 9, X, X, X, 5, X, X, X, 1) );
const v128u32 ba_lo = _mm_shuffle_epi8( colA_Lo, _mm_set_epi8( X, X, X,14, X, X, X,10, X, X, X, 6, X, X, X, 2) );
const v128u32 aa_lo = _mm_shuffle_epi8( colA_Lo, _mm_set_epi8( X, X, X,15, X, X, X,11, X, X, X, 7, X, X, X, 3) );
const v128u32 ra_hi = _mm_shuffle_epi8( colA_Hi, _mm_set_epi8( X, X, X,12, X, X, X, 8, X, X, X, 4, X, X, X, 0) );
const v128u32 ga_hi = _mm_shuffle_epi8( colA_Hi, _mm_set_epi8( X, X, X,13, X, X, X, 9, X, X, X, 5, X, X, X, 1) );
const v128u32 ba_hi = _mm_shuffle_epi8( colA_Hi, _mm_set_epi8( X, X, X,14, X, X, X,10, X, X, X, 6, X, X, X, 2) );
const v128u32 aa_hi = _mm_shuffle_epi8( colA_Hi, _mm_set_epi8( X, X, X,15, X, X, X,11, X, X, X, 7, X, X, X, 3) );
v128u16 ra = _mm_packs_epi32(ra_lo, ra_hi);
v128u16 ga = _mm_packs_epi32(ga_lo, ga_hi);
v128u16 ba = _mm_packs_epi32(ba_lo, ba_hi);
v128u16 aa = _mm_packs_epi32(aa_lo, aa_hi);
ra = _mm_or_si128( ra, _mm_and_si128(_mm_slli_epi16(colB, 9), _mm_set1_epi16(0x3E00)) );
ga = _mm_or_si128( ga, _mm_and_si128(_mm_slli_epi16(colB, 4), _mm_set1_epi16(0x3E00)) );
ba = _mm_or_si128( ba, _mm_and_si128(_mm_srli_epi16(colB, 1), _mm_set1_epi16(0x3E00)) );
aa = _mm_adds_epu8(aa, _mm_set1_epi16(1));
aa = _mm_or_si128( aa, _mm_slli_epi16(_mm_subs_epu16(_mm_set1_epi8(32), aa), 8) );
ra = _mm_maddubs_epi16(ra, aa);
ga = _mm_maddubs_epi16(ga, aa);
ba = _mm_maddubs_epi16(ba, aa);
#else
v128u32 ra_lo = _mm_and_si128( colA_Lo, _mm_set1_epi32(0x000000FF) ); v128u32 ra_lo = _mm_and_si128( colA_Lo, _mm_set1_epi32(0x000000FF) );
v128u32 ga_lo = _mm_and_si128( _mm_srli_epi32(colA_Lo, 8), _mm_set1_epi32(0x000000FF) ); v128u32 ga_lo = _mm_and_si128( _mm_srli_epi32(colA_Lo, 8), _mm_set1_epi32(0x000000FF) );
v128u32 ba_lo = _mm_and_si128( _mm_srli_epi32(colA_Lo, 16), _mm_set1_epi32(0x000000FF) ); v128u32 ba_lo = _mm_and_si128( _mm_srli_epi32(colA_Lo, 16), _mm_set1_epi32(0x000000FF) );
@ -1154,6 +752,18 @@ FORCEINLINE v128u16 ColorOperation_SSE2::blend3D(const v128u32 &colA_Lo, const v
v128u16 ba = _mm_packs_epi32(ba_lo, ba_hi); v128u16 ba = _mm_packs_epi32(ba_lo, ba_hi);
v128u16 aa = _mm_packs_epi32(aa_lo, aa_hi); v128u16 aa = _mm_packs_epi32(aa_lo, aa_hi);
#ifdef ENABLE_SSSE3
ra = _mm_or_si128( ra, _mm_and_si128(_mm_slli_epi16(colB, 9), _mm_set1_epi16(0x3E00)) );
ga = _mm_or_si128( ga, _mm_and_si128(_mm_slli_epi16(colB, 4), _mm_set1_epi16(0x3E00)) );
ba = _mm_or_si128( ba, _mm_and_si128(_mm_srli_epi16(colB, 1), _mm_set1_epi16(0x3E00)) );
aa = _mm_adds_epu8(aa, _mm_set1_epi16(1));
aa = _mm_or_si128( aa, _mm_slli_epi16(_mm_subs_epu16(_mm_set1_epi8(32), aa), 8) );
ra = _mm_maddubs_epi16(ra, aa);
ga = _mm_maddubs_epi16(ga, aa);
ba = _mm_maddubs_epi16(ba, aa);
#else
aa = _mm_adds_epu16(aa, _mm_set1_epi16(1)); aa = _mm_adds_epu16(aa, _mm_set1_epi16(1));
v128u16 rb = _mm_and_si128( _mm_slli_epi16(colB, 1), _mm_set1_epi16(0x003E) ); v128u16 rb = _mm_and_si128( _mm_slli_epi16(colB, 1), _mm_set1_epi16(0x003E) );
v128u16 gb = _mm_and_si128( _mm_srli_epi16(colB, 4), _mm_set1_epi16(0x003E) ); v128u16 gb = _mm_and_si128( _mm_srli_epi16(colB, 4), _mm_set1_epi16(0x003E) );
@ -1175,9 +785,6 @@ FORCEINLINE v128u16 ColorOperation_SSE2::blend3D(const v128u32 &colA_Lo, const v
template <NDSColorFormat COLORFORMAT> template <NDSColorFormat COLORFORMAT>
FORCEINLINE v128u32 ColorOperation_SSE2::blend3D(const v128u32 &colA, const v128u32 &colB) const FORCEINLINE v128u32 ColorOperation_SSE2::blend3D(const v128u32 &colA, const v128u32 &colB) const
{ {
#ifdef ENABLE_SSSE3
static const u8 X = 0x80;
#endif
// If the color format of B is 666 or 888, then the colA_Hi parameter is ignored. // If the color format of B is 666 or 888, then the colA_Hi parameter is ignored.
// The color format of A is assumed to match the color format of B. // The color format of A is assumed to match the color format of B.
v128u16 rgbALo; v128u16 rgbALo;
@ -1197,12 +804,13 @@ FORCEINLINE v128u32 ColorOperation_SSE2::blend3D(const v128u32 &colA, const v128
rgbALo = _mm_unpacklo_epi8(colA, colB); rgbALo = _mm_unpacklo_epi8(colA, colB);
rgbAHi = _mm_unpackhi_epi8(colA, colB); rgbAHi = _mm_unpackhi_epi8(colA, colB);
v128u8 alpha = _mm_shuffle_epi8( colA, _mm_set_epi8( X,15,15,15, X,11,11,11, X, 7, 7, 7, X, 3, 3, 3) ); v128u32 alpha = _mm_and_si128( _mm_srli_epi32(colA, 24), _mm_set1_epi32(0x0000001F) );
alpha = _mm_or_si128( alpha, _mm_or_si128(_mm_slli_epi32(alpha, 8), _mm_slli_epi32(alpha, 16)) );
alpha = _mm_adds_epu8(alpha, _mm_set1_epi8(1)); alpha = _mm_adds_epu8(alpha, _mm_set1_epi8(1));
const v128u8 invAlpha = _mm_subs_epu8(_mm_set1_epi8(32), alpha); v128u32 invAlpha = _mm_subs_epu8(_mm_set1_epi8(32), alpha);
const v128u16 alphaLo = _mm_unpacklo_epi8(alpha, invAlpha); v128u16 alphaLo = _mm_unpacklo_epi8(alpha, invAlpha);
const v128u16 alphaHi = _mm_unpackhi_epi8(alpha, invAlpha); v128u16 alphaHi = _mm_unpackhi_epi8(alpha, invAlpha);
rgbALo = _mm_maddubs_epi16(rgbALo, alphaLo); rgbALo = _mm_maddubs_epi16(rgbALo, alphaLo);
rgbAHi = _mm_maddubs_epi16(rgbAHi, alphaHi); rgbAHi = _mm_maddubs_epi16(rgbAHi, alphaHi);
@ -1215,12 +823,9 @@ FORCEINLINE v128u32 ColorOperation_SSE2::blend3D(const v128u32 &colA, const v128
v128u16 rgbBLo = _mm_unpacklo_epi8(colB, _mm_setzero_si128()); v128u16 rgbBLo = _mm_unpacklo_epi8(colB, _mm_setzero_si128());
v128u16 rgbBHi = _mm_unpackhi_epi8(colB, _mm_setzero_si128()); v128u16 rgbBHi = _mm_unpackhi_epi8(colB, _mm_setzero_si128());
#ifdef ENABLE_SSSE3 v128u32 alpha = _mm_and_si128( _mm_srli_epi32(colA, 24), _mm_set1_epi32(0x000000FF) );
v128u8 alpha = _mm_shuffle_epi8( colA, _mm_set_epi8( X,15,15,15, X,11,11,11, X, 7, 7, 7, X, 3, 3, 3) );
#else
v128u8 alpha = _mm_and_si128( _mm_srli_epi32(colA, 24), _mm_set1_epi32(0x000000FF) );
alpha = _mm_or_si128( alpha, _mm_or_si128(_mm_slli_epi32(alpha, 8), _mm_slli_epi32(alpha, 16)) ); alpha = _mm_or_si128( alpha, _mm_or_si128(_mm_slli_epi32(alpha, 8), _mm_slli_epi32(alpha, 16)) );
#endif
v128u16 alphaLo = _mm_unpacklo_epi8(alpha, _mm_setzero_si128()); v128u16 alphaLo = _mm_unpacklo_epi8(alpha, _mm_setzero_si128());
v128u16 alphaHi = _mm_unpackhi_epi8(alpha, _mm_setzero_si128()); v128u16 alphaHi = _mm_unpackhi_epi8(alpha, _mm_setzero_si128());
alphaLo = _mm_add_epi16(alphaLo, _mm_set1_epi16(1)); alphaLo = _mm_add_epi16(alphaLo, _mm_set1_epi16(1));
@ -1317,13 +922,13 @@ FORCEINLINE void PixelOperation_SSE2::_copy16(GPUEngineCompositorInfo &compInfo,
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo6665Opaque_SSE2<false>(src0, src32[0], src32[1]); ColorspaceConvert555To6665Opaque_SSE2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo6665Opaque_SSE2<false>(src1, src32[2], src32[3]); ColorspaceConvert555To6665Opaque_SSE2<false>(src1, src32[2], src32[3]);
} }
else else
{ {
ColorspaceConvert555xTo8888Opaque_SSE2<false>(src0, src32[0], src32[1]); ColorspaceConvert555To8888Opaque_SSE2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo8888Opaque_SSE2<false>(src1, src32[2], src32[3]); ColorspaceConvert555To8888Opaque_SSE2<false>(src1, src32[2], src32[3]);
} }
_mm_store_si128( (v128u32 *)compInfo.target.lineColor32 + 0, src32[0] ); _mm_store_si128( (v128u32 *)compInfo.target.lineColor32 + 0, src32[0] );
@ -1394,20 +999,20 @@ FORCEINLINE void PixelOperation_SSE2::_copyMask16(GPUEngineCompositorInfo &compI
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo6665Opaque_SSE2<false>(src0, src32[0], src32[1]); ColorspaceConvert555To6665Opaque_SSE2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo6665Opaque_SSE2<false>(src1, src32[2], src32[3]); ColorspaceConvert555To6665Opaque_SSE2<false>(src1, src32[2], src32[3]);
} }
else else
{ {
ColorspaceConvert555xTo8888Opaque_SSE2<false>(src0, src32[0], src32[1]); ColorspaceConvert555To8888Opaque_SSE2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo8888Opaque_SSE2<false>(src1, src32[2], src32[3]); ColorspaceConvert555To8888Opaque_SSE2<false>(src1, src32[2], src32[3]);
} }
const v128u32 dst32[4] = { const v128u32 dst32[4] = {
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3) _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3),
}; };
const v128u32 passMask32[4] = { const v128u32 passMask32[4] = {
@ -1467,7 +1072,7 @@ FORCEINLINE void PixelOperation_SSE2::_copyMask32(GPUEngineCompositorInfo &compI
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3) _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3),
}; };
const v128u32 alphaBits = _mm_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000); const v128u32 alphaBits = _mm_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000);
@ -1499,13 +1104,13 @@ FORCEINLINE void PixelOperation_SSE2::_brightnessUp16(GPUEngineCompositorInfo &c
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo666x_SSE2<false>(src0, dst[0], dst[1]); ColorspaceConvert555XTo666X_SSE2<false>(src0, dst[0], dst[1]);
ColorspaceConvert555xTo666x_SSE2<false>(src1, dst[2], dst[3]); ColorspaceConvert555XTo666X_SSE2<false>(src1, dst[2], dst[3]);
} }
else else
{ {
ColorspaceConvert555xTo888x_SSE2<false>(src0, dst[0], dst[1]); ColorspaceConvert555XTo888X_SSE2<false>(src0, dst[0], dst[1]);
ColorspaceConvert555xTo888x_SSE2<false>(src1, dst[2], dst[3]); ColorspaceConvert555XTo888X_SSE2<false>(src1, dst[2], dst[3]);
} }
const v128u32 alphaBits = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? _mm_set1_epi32(0x1F000000) : _mm_set1_epi32(0xFF000000); const v128u32 alphaBits = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? _mm_set1_epi32(0x1F000000) : _mm_set1_epi32(0xFF000000);
@ -1577,20 +1182,20 @@ FORCEINLINE void PixelOperation_SSE2::_brightnessUpMask16(GPUEngineCompositorInf
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo666x_SSE2<false>(src0, src32[0], src32[1]); ColorspaceConvert555XTo666X_SSE2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo666x_SSE2<false>(src1, src32[2], src32[3]); ColorspaceConvert555XTo666X_SSE2<false>(src1, src32[2], src32[3]);
} }
else else
{ {
ColorspaceConvert555xTo888x_SSE2<false>(src0, src32[0], src32[1]); ColorspaceConvert555XTo888X_SSE2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo888x_SSE2<false>(src1, src32[2], src32[3]); ColorspaceConvert555XTo888X_SSE2<false>(src1, src32[2], src32[3]);
} }
const v128u32 dst32[4] = { const v128u32 dst32[4] = {
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3) _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3),
}; };
const v128u32 alphaBits = _mm_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000); const v128u32 alphaBits = _mm_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000);
@ -1641,7 +1246,7 @@ FORCEINLINE void PixelOperation_SSE2::_brightnessUpMask32(GPUEngineCompositorInf
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3) _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3),
}; };
const v128u32 alphaBits = _mm_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000); const v128u32 alphaBits = _mm_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000);
@ -1670,13 +1275,13 @@ FORCEINLINE void PixelOperation_SSE2::_brightnessDown16(GPUEngineCompositorInfo
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo666x_SSE2<false>(src0, dst[0], dst[1]); ColorspaceConvert555XTo666X_SSE2<false>(src0, dst[0], dst[1]);
ColorspaceConvert555xTo666x_SSE2<false>(src1, dst[2], dst[3]); ColorspaceConvert555XTo666X_SSE2<false>(src1, dst[2], dst[3]);
} }
else else
{ {
ColorspaceConvert555xTo888x_SSE2<false>(src0, dst[0], dst[1]); ColorspaceConvert555XTo888X_SSE2<false>(src0, dst[0], dst[1]);
ColorspaceConvert555xTo888x_SSE2<false>(src1, dst[2], dst[3]); ColorspaceConvert555XTo888X_SSE2<false>(src1, dst[2], dst[3]);
} }
const v128u32 alphaBits = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? _mm_set1_epi32(0x1F000000) : _mm_set1_epi32(0xFF000000); const v128u32 alphaBits = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? _mm_set1_epi32(0x1F000000) : _mm_set1_epi32(0xFF000000);
@ -1748,20 +1353,20 @@ FORCEINLINE void PixelOperation_SSE2::_brightnessDownMask16(GPUEngineCompositorI
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo666x_SSE2<false>(src0, src32[0], src32[1]); ColorspaceConvert555XTo666X_SSE2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo666x_SSE2<false>(src1, src32[2], src32[3]); ColorspaceConvert555XTo666X_SSE2<false>(src1, src32[2], src32[3]);
} }
else else
{ {
ColorspaceConvert555xTo888x_SSE2<false>(src0, src32[0], src32[1]); ColorspaceConvert555XTo888X_SSE2<false>(src0, src32[0], src32[1]);
ColorspaceConvert555xTo888x_SSE2<false>(src1, src32[2], src32[3]); ColorspaceConvert555XTo888X_SSE2<false>(src1, src32[2], src32[3]);
} }
const v128u32 dst32[4] = { const v128u32 dst32[4] = {
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3) _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3),
}; };
const v128u32 alphaBits = _mm_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000); const v128u32 alphaBits = _mm_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000);
@ -1812,7 +1417,7 @@ FORCEINLINE void PixelOperation_SSE2::_brightnessDownMask32(GPUEngineCompositorI
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3) _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3),
}; };
const v128u32 alphaBits = _mm_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000); const v128u32 alphaBits = _mm_set1_epi32((OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F000000 : 0xFF000000);
@ -1889,13 +1494,13 @@ FORCEINLINE void PixelOperation_SSE2::_unknownEffectMask16(GPUEngineCompositorIn
} }
else if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) else if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
{ {
ColorspaceConvert555xTo666x_SSE2<false>(src0, tmpSrc[0], tmpSrc[1]); ColorspaceConvert555XTo666X_SSE2<false>(src0, tmpSrc[0], tmpSrc[1]);
ColorspaceConvert555xTo666x_SSE2<false>(src1, tmpSrc[2], tmpSrc[3]); ColorspaceConvert555XTo666X_SSE2<false>(src1, tmpSrc[2], tmpSrc[3]);
} }
else else
{ {
ColorspaceConvert555xTo888x_SSE2<false>(src0, tmpSrc[0], tmpSrc[1]); ColorspaceConvert555XTo888X_SSE2<false>(src0, tmpSrc[0], tmpSrc[1]);
ColorspaceConvert555xTo888x_SSE2<false>(src1, tmpSrc[2], tmpSrc[3]); ColorspaceConvert555XTo888X_SSE2<false>(src1, tmpSrc[2], tmpSrc[3]);
} }
switch (compInfo.renderState.colorEffect) switch (compInfo.renderState.colorEffect)
@ -2051,7 +1656,7 @@ FORCEINLINE void PixelOperation_SSE2::_unknownEffectMask16(GPUEngineCompositorIn
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3) _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3),
}; };
if (blendMaskValue != 0x00000000) if (blendMaskValue != 0x00000000)
@ -2360,7 +1965,7 @@ FORCEINLINE void PixelOperation_SSE2::_unknownEffectMask32(GPUEngineCompositorIn
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2), _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 2),
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3) _mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 3),
}; };
if (blendMaskValue != 0x00000000) if (blendMaskValue != 0x00000000)
@ -2641,14 +2246,14 @@ void GPUEngineBase::_MosaicLine(GPUEngineCompositorInfo &compInfo)
_mm_blendv_epi8(_mm_and_si128(dstColor16[1], _mm_set1_epi16(0x7FFF)), _mm_set1_epi16(0xFFFF), idxMask16[1]) _mm_blendv_epi8(_mm_and_si128(dstColor16[1], _mm_set1_epi16(0x7FFF)), _mm_set1_epi16(0xFFFF), idxMask16[1])
}; };
const v128u16 mosaicSetColorMask8 = _mm_cmpeq_epi16( _mm_load_si128((v128u8 *)(compInfo.renderState.mosaicWidthBG->begin + x)), _mm_setzero_si128() ); const v128u16 mosaicSetColorMask8 = _mm_cmpeq_epi16( _mm_loadu_si128((v128u8 *)(compInfo.renderState.mosaicWidthBG->begin + x)), _mm_setzero_si128() );
const v128u16 mosaicSetColorMask16[2] = { const v128u16 mosaicSetColorMask16[2] = {
_mm_unpacklo_epi8(mosaicSetColorMask8, mosaicSetColorMask8), _mm_unpacklo_epi8(mosaicSetColorMask8, mosaicSetColorMask8),
_mm_unpackhi_epi8(mosaicSetColorMask8, mosaicSetColorMask8) _mm_unpackhi_epi8(mosaicSetColorMask8, mosaicSetColorMask8)
}; };
_mm_store_si128( (v128u16 *)(mosaicColorBG + x) + 0, _mm_blendv_epi8(mosaicColor16[0], _mm_load_si128((v128u16 *)(mosaicColorBG + x) + 0), mosaicSetColorMask16[0]) ); _mm_storeu_si128( (v128u16 *)(mosaicColorBG + x) + 0, _mm_blendv_epi8(mosaicColor16[0], _mm_loadu_si128((v128u16 *)(mosaicColorBG + x) + 0), mosaicSetColorMask16[0]) );
_mm_store_si128( (v128u16 *)(mosaicColorBG + x) + 1, _mm_blendv_epi8(mosaicColor16[1], _mm_load_si128((v128u16 *)(mosaicColorBG + x) + 1), mosaicSetColorMask16[1]) ); _mm_storeu_si128( (v128u16 *)(mosaicColorBG + x) + 1, _mm_blendv_epi8(mosaicColor16[1], _mm_loadu_si128((v128u16 *)(mosaicColorBG + x) + 1), mosaicSetColorMask16[1]) );
} }
const v128u16 outColor16[2] = { const v128u16 outColor16[2] = {
@ -2682,7 +2287,7 @@ void GPUEngineBase::_MosaicLine(GPUEngineCompositorInfo &compInfo)
} }
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST>
void GPUEngineBase::_CompositeNativeLineOBJ_LoopOp(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const Color4u8 *__restrict srcColorNative32) void GPUEngineBase::_CompositeNativeLineOBJ_LoopOp(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const FragmentColor *__restrict srcColorNative32)
{ {
static const size_t step = sizeof(v128u8); static const size_t step = sizeof(v128u8);
@ -2925,10 +2530,10 @@ size_t GPUEngineBase::_CompositeVRAMLineDeferred_LoopOp(GPUEngineCompositorInfo
case NDSColorFormat_BGR888_Rev: case NDSColorFormat_BGR888_Rev:
{ {
const v128u32 src32[4] = { const v128u32 src32[4] = {
_mm_load_si128((v128u32 *)((Color4u8 *)vramColorPtr + i) + 0), _mm_load_si128((v128u32 *)((FragmentColor *)vramColorPtr + i) + 0),
_mm_load_si128((v128u32 *)((Color4u8 *)vramColorPtr + i) + 1), _mm_load_si128((v128u32 *)((FragmentColor *)vramColorPtr + i) + 1),
_mm_load_si128((v128u32 *)((Color4u8 *)vramColorPtr + i) + 2), _mm_load_si128((v128u32 *)((FragmentColor *)vramColorPtr + i) + 2),
_mm_load_si128((v128u32 *)((Color4u8 *)vramColorPtr + i) + 3) _mm_load_si128((v128u32 *)((FragmentColor *)vramColorPtr + i) + 3)
}; };
if (LAYERTYPE != GPULayerType_OBJ) if (LAYERTYPE != GPULayerType_OBJ)
@ -3083,7 +2688,7 @@ void GPUEngineBase::_PerformWindowTestingNative(GPUEngineCompositorInfo &compInf
} }
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST> template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST>
size_t GPUEngineA::_RenderLine_Layer3D_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const Color4u8 *__restrict srcLinePtr) size_t GPUEngineA::_RenderLine_Layer3D_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const FragmentColor *__restrict srcLinePtr)
{ {
static const size_t step = sizeof(v128u8); static const size_t step = sizeof(v128u8);

View File

@ -1,7 +1,7 @@
/* /*
Copyright (C) 2006 yopyop Copyright (C) 2006 yopyop
Copyright (C) 2007 shash Copyright (C) 2007 shash
Copyright (C) 2007-2025 DeSmuME team Copyright (C) 2007-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -1068,6 +1068,7 @@ static void execsqrt() {
} }
static void execdiv() { static void execdiv() {
s64 num,den; s64 num,den;
s64 res,mod; s64 res,mod;
u8 mode = MMU_new.div.mode; u8 mode = MMU_new.div.mode;
@ -1095,29 +1096,15 @@ static void execdiv() {
break; break;
} }
if(den == 0) if(den==0)
{ {
res = ((num < 0) ? 1 : -1); res = ((num < 0) ? 1 : -1);
mod = num; mod = num;
// when the result is 32bits, the upper 32bits of the sign-extended result are inverted
if (mode == 0)
res ^= 0xFFFFFFFF00000000LL;
// the DIV0 flag in DIVCNT is set only if the full 64bit DIV_DENOM value is zero, even in 32bit mode // the DIV0 flag in DIVCNT is set only if the full 64bit DIV_DENOM value is zero, even in 32bit mode
if ((u64)T1ReadQuad(MMU.ARM9_REG, 0x298) == 0) if ((u64)T1ReadQuad(MMU.ARM9_REG, 0x298) == 0)
MMU_new.div.div0 = 1; MMU_new.div.div0 = 1;
} }
else if((mode != 0) && (num == 0x8000000000000000LL) && (den == -1))
{
res = 0x8000000000000000LL;
mod = 0;
}
else if((mode == 0) && (num == (s64) (s32) 0x80000000) && (den == -1))
{
res = 0x80000000;
mod = 0;
}
else else
{ {
res = num / den; res = num / den;
@ -1293,7 +1280,7 @@ void GC_Command::fromCryptoBuffer(u32 buf[2])
} }
template<int PROCNUM> template<int PROCNUM>
void DESMUME_FASTCALL MMU_writeToGCControl(u32 val) void FASTCALL MMU_writeToGCControl(u32 val)
{ {
int dbsize = (val>>24)&7; int dbsize = (val>>24)&7;
@ -1374,7 +1361,7 @@ void DESMUME_FASTCALL MMU_writeToGCControl(u32 val)
} }
/*template<int PROCNUM> /*template<int PROCNUM>
u32 DESMUME_FASTCALL MMU_readFromGCControl() u32 FASTCALL MMU_readFromGCControl()
{ {
return T1ReadLong(MMU.MMU_MEM[0][0x40], 0x1A4); return T1ReadLong(MMU.MMU_MEM[0][0x40], 0x1A4);
}*/ }*/
@ -1452,16 +1439,16 @@ static void CalculateTouchPressure(int pressurePercent, u16 &z1, u16& z2)
} }
void DESMUME_FASTCALL MMU_writeToSPIData(u16 val) void FASTCALL MMU_writeToSPIData(u16 val)
{ {
enum PM_Bits //from libnds enum PM_Bits //from libnds
{ {
PM_SOUND_AMP = BIT(0), /*!< \brief Power the sound hardware (needed to hear stuff in GBA mode too) */ PM_SOUND_AMP = BIT(0) , /*!< \brief Power the sound hardware (needed to hear stuff in GBA mode too) */
PM_SOUND_MUTE = BIT(1), /*!< \brief Mute the main speakers, headphone output will still work. */ PM_SOUND_MUTE = BIT(1), /*!< \brief Mute the main speakers, headphone output will still work. */
PM_BACKLIGHT_BOTTOM = BIT(2), /*!< \brief Enable the top backlight if set */ PM_BACKLIGHT_BOTTOM = BIT(2), /*!< \brief Enable the top backlight if set */
PM_BACKLIGHT_TOP = BIT(3), /*!< \brief Enable the bottom backlight if set */ PM_BACKLIGHT_TOP = BIT(3) , /*!< \brief Enable the bottom backlight if set */
PM_SYSTEM_PWR = BIT(6) /*!< \brief Turn the power *off* if set */ PM_SYSTEM_PWR = BIT(6) , /*!< \brief Turn the power *off* if set */
}; };
if (val !=0) if (val !=0)
@ -1829,46 +1816,44 @@ static void writereg_POWCNT1(const int size, const u32 adr, const u32 val)
bool isGeomEnabled = !!nds.power1.gfx3d_geometry; bool isGeomEnabled = !!nds.power1.gfx3d_geometry;
if(wasGeomEnabled && !isGeomEnabled) if(wasGeomEnabled && !isGeomEnabled)
{ {
GFX3D_HandleGeometryPowerOff(); //kill the geometry data when the power goes off
//but save these tables, first. they shouldnt be cleared.
//so, so bad. we need to model this with hardware-like operations instead of c++ code
GFX3D_State prior = gfx3d.state;
reconstruct(&gfx3d.state);
memcpy(gfx3d.state.u16ToonTable, prior.u16ToonTable, sizeof(prior.u16ToonTable));
//dont think we should save this one: it's sent with 3d commands, not random bonus immediate register writes like the toon table
//memcpy(gfx3d.state.shininessTable, prior.shininessTable, sizeof(prior.shininessTable));
} }
} }
static INLINE void MMU_IPCSync(u8 proc, u32 val) static INLINE void MMU_IPCSync(u8 proc, u32 val)
{ {
//INFO("IPC%s sync 0x%04X (0x%02X|%02X)\n", proc?"7":"9", val, val >> 8, val & 0xFF);
u32 sync_l = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0x180) & 0xFFFF; u32 sync_l = T1ReadLong(MMU.MMU_MEM[proc][0x40], 0x180) & 0xFFFF;
u32 sync_r = T1ReadLong(MMU.MMU_MEM[proc^1][0x40], 0x180) & 0xFFFF; u32 sync_r = T1ReadLong(MMU.MMU_MEM[proc^1][0x40], 0x180) & 0xFFFF;
u32 iter = (val & 0x0F00) >> 8;
sync_l = ( sync_l & 0x000F ) | ( val & 0x6F00 ); sync_l = ( sync_l & 0x000F ) | ( val & 0x0F00 );
sync_r = ( sync_r & 0x6F00 ) | ( iter ); sync_r = ( sync_r & 0x6F00 ) | ( (val >> 8) & 0x000F );
// For some reason, the arm9 doesn't handshake when ensata is detected. sync_l |= val & 0x6000;
// So we complete the protocol here, which is to mirror the values 8..0 back to
// The arm7 as they are written by the arm7
if (nds.ensataEmulation) {
if (proc) { if(nds.ensataEmulation && proc==1 && nds.ensataIpcSyncCounter<9) {
// However this hack would break soft reset because it also syncs through ipcsync. u32 iteration = (val&0x0F00)>>8;
// So we have to add some additional checks to ensure that it's handshake instead of reset.
if ((iter & 8) || (nds.ensataIpcSyncCounter)) { if(iteration==8-nds.ensataIpcSyncCounter)
// sync_r = (sync_r & 0xF0FF) | (iter << 8); // This is not necessary. nds.ensataIpcSyncCounter++;
sync_l = (sync_l & 0xFFF0) | iter; else printf("ERROR: ENSATA IPC SYNC HACK FAILED; BAD THINGS MAY HAPPEN\n");
nds.ensataIpcSyncCounter = iter;
} //for some reason, the arm9 doesn't handshake when ensata is detected.
} //so we complete the protocol here, which is to mirror the values 8..0 back to
else { //the arm7 as they are written by the arm7
// After ensata handshake, arm9 will write 0x100 as a signal if Ensata is detected. sync_r &= 0xF0FF;
// This will prevent reset from working, so we have to ignore this. sync_r |= (iteration<<8);
if (nds.ensataHandshake == ENSATA_HANDSHAKE_complete) { sync_l &= 0xFFF0;
nds.ensataHandshake = ENSATA_HANDSHAKE_none; sync_l |= iteration;
return;
}
}
} }
// printf("IPCSync(%d, %04x): %04x %04x %d\n", proc, val, sync_l, sync_r, nds.ensataIpcSyncCounter);
T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x180, sync_l); T1WriteLong(MMU.MMU_MEM[proc][0x40], 0x180, sync_l);
T1WriteLong(MMU.MMU_MEM[proc^1][0x40], 0x180, sync_r); T1WriteLong(MMU.MMU_MEM[proc^1][0x40], 0x180, sync_r);
@ -1962,8 +1947,8 @@ u32 TGXSTAT::read32()
// stack position always equal zero. possible timings is wrong // stack position always equal zero. possible timings is wrong
// using in "The Wild West" // using in "The Wild West"
u32 proj_level = (u32)GFX3D_GetMatrixStackIndex(MATRIXMODE_PROJECTION); int proj_level = mtxStackIndex[MATRIXMODE_PROJECTION] & 1;
u32 mv_level = (u32)GFX3D_GetMatrixStackIndex(MATRIXMODE_POSITION); int mv_level = mtxStackIndex[MATRIXMODE_POSITION] & 31;
ret |= ((proj_level << 13) | (mv_level << 8)); ret |= ((proj_level << 13) | (mv_level << 8));
ret |= sb<<14; //stack busy ret |= sb<<14; //stack busy
@ -1974,7 +1959,7 @@ u32 TGXSTAT::read32()
if(gxFIFO.size==0) ret |= BIT(26); //fifo empty if(gxFIFO.size==0) ret |= BIT(26); //fifo empty
//determine busy flag. //determine busy flag.
//if we're waiting for a flush, we're busy //if we're waiting for a flush, we're busy
if(GFX3D_IsSwapBuffersPending()) ret |= BIT(27); if(isSwapBuffers) ret |= BIT(27);
//if fifo is nonempty, we're busy //if fifo is nonempty, we're busy
if(gxFIFO.size!=0) ret |= BIT(27); if(gxFIFO.size!=0) ret |= BIT(27);
@ -1983,7 +1968,7 @@ u32 TGXSTAT::read32()
ret |= ((gxfifo_irq & 0x3) << 30); //user's irq flags ret |= ((gxfifo_irq & 0x3) << 30); //user's irq flags
//printf("vc=%03d Returning gxstat read: %08X (isSwapBuffers=%d)\n", nds.VCount, ret, (GFX3D_IsSwapBuffersPending()) ? 1 : 0); //printf("vc=%03d Returning gxstat read: %08X (isSwapBuffers=%d)\n",nds.VCount,ret,isSwapBuffers);
//ret = (2 << 8); //ret = (2 << 8);
//INFO("gxSTAT 0x%08X (proj %i, pos %i)\n", ret, _hack_getMatrixStackLevel(1), _hack_getMatrixStackLevel(2)); //INFO("gxSTAT 0x%08X (proj %i, pos %i)\n", ret, _hack_getMatrixStackLevel(1), _hack_getMatrixStackLevel(2));
@ -1998,7 +1983,7 @@ void TGXSTAT::write32(const u32 val)
// Writing "1" to Bit15 does reset the Error Flag (Bit15), // Writing "1" to Bit15 does reset the Error Flag (Bit15),
// and additionally resets the Projection Stack Pointer (Bit13) // and additionally resets the Projection Stack Pointer (Bit13)
// (and probably (?) also the Texture Stack Pointer)?? // (and probably (?) also the Texture Stack Pointer)??
GFX3D_ResetMatrixStackPointer(); mtxStackIndex[MATRIXMODE_PROJECTION] = 0;
se = 0; //clear stack error flag se = 0; //clear stack error flag
} }
//printf("gxstat write: %08X while gxfifo.size=%d\n",val,gxFIFO.size); //printf("gxstat write: %08X while gxfifo.size=%d\n",val,gxFIFO.size);
@ -2477,17 +2462,7 @@ bool validateIORegsWrite(u32 addr, u8 size, u32 val)
{ {
if (PROCNUM == ARMCPU_ARM9) if (PROCNUM == ARMCPU_ARM9)
{ {
u32 addrMasked = addr & 0x0FFFFFFC; switch (addr & 0x0FFFFFFC)
if(nds.ensataEmulation)
{
if(addrMasked == eng_3D_CLIPMTX_RESULT) return true;
if(addrMasked == 0x04FFF000) return true;
if(addrMasked == 0x04FFF010) return true;
if(addrMasked == 0x04FFF200) return true;
}
switch (addrMasked)
{ {
// Display Engine A // Display Engine A
case REG_DISPA_DISPCNT: case REG_DISPA_DISPCNT:
@ -3235,104 +3210,11 @@ bool validateIORegsRead(u32 addr, u8 size)
#define VALIDATE_IO_REGS_READ(PROC, SIZE) ; #define VALIDATE_IO_REGS_READ(PROC, SIZE) ;
#endif #endif
template <typename T, size_t LENGTH>
bool MMU_WriteFromExternal(const int targetProc, const u32 targetAddress, T newValue)
{
u32 oldValue32;
switch (LENGTH)
{
case 1:
if (sizeof(T) > LENGTH)
newValue &= 0x000000FF;
break;
case 2:
if (sizeof(T) > LENGTH)
newValue &= 0x0000FFFF;
break;
case 3:
oldValue32 = _MMU_read32(targetProc, MMU_AT_DEBUG, targetAddress);
if (sizeof(T) > LENGTH)
newValue = (oldValue32 & 0xFF000000) | (newValue & 0x00FFFFFF);
break;
case 4:
oldValue32 = _MMU_read32(targetProc, MMU_AT_DEBUG, targetAddress);
if (sizeof(T) > LENGTH)
newValue &= 0xFFFFFFFF;
break;
default:
break;
}
bool needsJitReset = ( (targetAddress >= 0x02000000) && (targetAddress < 0x02400000) );
if (needsJitReset)
{
bool willValueChange = false;
switch (LENGTH)
{
case 1:
willValueChange = (_MMU_read08(targetProc, MMU_AT_DEBUG, targetAddress) != (u8)newValue);
break;
case 2:
willValueChange = (_MMU_read16(targetProc, MMU_AT_DEBUG, targetAddress) != (u16)newValue);
break;
case 3:
case 4:
willValueChange = (oldValue32 != (u32)newValue);
break;
default:
break;
}
if (!willValueChange)
{
needsJitReset = false;
return needsJitReset;
}
}
switch (LENGTH)
{
case 1:
_MMU_write08(targetProc, MMU_AT_DEBUG, targetAddress, (u8)newValue);
break;
case 2:
_MMU_write16(targetProc, MMU_AT_DEBUG, targetAddress, (u16)newValue);
break;
case 3:
case 4:
_MMU_write32(targetProc, MMU_AT_DEBUG, targetAddress, (u32)newValue);
break;
default:
break;
}
return needsJitReset;
}
template bool MMU_WriteFromExternal< u8, 1>(const int targetProc, const u32 targetAddress, u8 newValue);
template bool MMU_WriteFromExternal<u16, 2>(const int targetProc, const u32 targetAddress, u16 newValue);
template bool MMU_WriteFromExternal<u32, 1>(const int targetProc, const u32 targetAddress, u32 newValue);
template bool MMU_WriteFromExternal<u32, 2>(const int targetProc, const u32 targetAddress, u32 newValue);
template bool MMU_WriteFromExternal<u32, 3>(const int targetProc, const u32 targetAddress, u32 newValue);
template bool MMU_WriteFromExternal<u32, 4>(const int targetProc, const u32 targetAddress, u32 newValue);
//================================================================================================== ARM9 * //================================================================================================== ARM9 *
//========================================================================================================= //=========================================================================================================
//========================================================================================================= //=========================================================================================================
//================================================= MMU write 08 //================================================= MMU write 08
void DESMUME_FASTCALL _MMU_ARM9_write08(u32 adr, u8 val) void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
{ {
adr &= 0x0FFFFFFF; adr &= 0x0FFFFFFF;
const u32 adrBank = (adr >> 24); const u32 adrBank = (adr >> 24);
@ -3376,28 +3258,6 @@ void DESMUME_FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
return; return;
} }
switch (adr >> 4)
{
case 0x400033: // Edge Mark Color Table
MMU.ARM9_REG[adr & 0xFFF] = val;
gfx3d_UpdateEdgeMarkColorTable<u8>((u8)(adr & 0x0000000F), val);
return;
case 0x400036:
case 0x400037: // Fog Table
MMU.ARM9_REG[adr & 0xFFF] = val & 0x7F;
gfx3d_UpdateFogTable<u8>((u8)(adr & 0x0000001F), val & 0x7F); // Drop the highest bit of each 8-bit value to limit the range to [0...127]
return;
case 0x400038:
case 0x400039:
case 0x40003A:
case 0x40003B: // Toon Table
MMU.ARM9_REG[adr & 0xFFF] = val;
gfx3d_UpdateToonTable<u8>((u8)(adr & 0x0000003F), val);
return;
}
GPUEngineA *mainEngine = GPU->GetEngineMain(); GPUEngineA *mainEngine = GPU->GetEngineMain();
GPUEngineB *subEngine = GPU->GetEngineSub(); GPUEngineB *subEngine = GPU->GetEngineSub();
@ -3565,19 +3425,7 @@ void DESMUME_FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
return; return;
case REG_DISPA_DISPMMEMFIFO: case REG_DISPA_DISPMMEMFIFO:
DISP_FIFOsend<u8, 0>(val); DISP_FIFOsend_u32(val);
return;
case REG_DISPA_DISPMMEMFIFO+1:
DISP_FIFOsend<u8, 1>(val);
return;
case REG_DISPA_DISPMMEMFIFO+2:
DISP_FIFOsend<u8, 2>(val);
return;
case REG_DISPA_DISPMMEMFIFO+3:
DISP_FIFOsend<u8, 3>(val);
return; return;
case REG_DISPB_BG0HOFS: case REG_DISPB_BG0HOFS:
@ -3742,6 +3590,18 @@ void DESMUME_FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
case REG_DIVCNT+3: printf("ERROR 8bit DIVCNT+3 WRITE\n"); return; case REG_DIVCNT+3: printf("ERROR 8bit DIVCNT+3 WRITE\n"); return;
#endif #endif
//fog table: only write bottom 7 bits
case eng_3D_FOG_TABLE+0x00: case eng_3D_FOG_TABLE+0x01: case eng_3D_FOG_TABLE+0x02: case eng_3D_FOG_TABLE+0x03:
case eng_3D_FOG_TABLE+0x04: case eng_3D_FOG_TABLE+0x05: case eng_3D_FOG_TABLE+0x06: case eng_3D_FOG_TABLE+0x07:
case eng_3D_FOG_TABLE+0x08: case eng_3D_FOG_TABLE+0x09: case eng_3D_FOG_TABLE+0x0A: case eng_3D_FOG_TABLE+0x0B:
case eng_3D_FOG_TABLE+0x0C: case eng_3D_FOG_TABLE+0x0D: case eng_3D_FOG_TABLE+0x0E: case eng_3D_FOG_TABLE+0x0F:
case eng_3D_FOG_TABLE+0x10: case eng_3D_FOG_TABLE+0x11: case eng_3D_FOG_TABLE+0x12: case eng_3D_FOG_TABLE+0x13:
case eng_3D_FOG_TABLE+0x14: case eng_3D_FOG_TABLE+0x15: case eng_3D_FOG_TABLE+0x16: case eng_3D_FOG_TABLE+0x17:
case eng_3D_FOG_TABLE+0x18: case eng_3D_FOG_TABLE+0x19: case eng_3D_FOG_TABLE+0x1A: case eng_3D_FOG_TABLE+0x1B:
case eng_3D_FOG_TABLE+0x1C: case eng_3D_FOG_TABLE+0x1D: case eng_3D_FOG_TABLE+0x1E: case eng_3D_FOG_TABLE+0x1F:
val &= 0x7F;
break;
//ensata putchar port //ensata putchar port
case 0x04FFF000: case 0x04FFF000:
if(nds.ensataEmulation) if(nds.ensataEmulation)
@ -3754,21 +3614,7 @@ void DESMUME_FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
case eng_3D_GXSTAT: case eng_3D_GXSTAT:
MMU_new.gxstat.write(8,adr,val); MMU_new.gxstat.write(8,adr,val);
break; break;
case REG_IPCSYNC:
{
u16 ipcsync = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x180);
ipcsync &= 0xFF00;
ipcsync |= (val & 0xFF);
MMU_IPCSync(ARMCPU_ARM9, ipcsync);
}
case REG_IPCSYNC+1:
{
u16 ipcsync = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x180);
ipcsync &= 0x00FF;
ipcsync |= ((val & 0xFF) << 8);
MMU_IPCSync(ARMCPU_ARM9, ipcsync);
}
case REG_AUXSPICNT: case REG_AUXSPICNT:
case REG_AUXSPICNT+1: case REG_AUXSPICNT+1:
write_auxspicnt(ARMCPU_ARM9, 8, adr & 1, val); write_auxspicnt(ARMCPU_ARM9, 8, adr & 1, val);
@ -3790,45 +3636,10 @@ void DESMUME_FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
case REG_IF+2: REG_IF_WriteByte<ARMCPU_ARM9>(2,val); break; case REG_IF+2: REG_IF_WriteByte<ARMCPU_ARM9>(2,val); break;
case REG_IF+3: REG_IF_WriteByte<ARMCPU_ARM9>(3,val); break; case REG_IF+3: REG_IF_WriteByte<ARMCPU_ARM9>(3,val); break;
case eng_3D_CLEAR_COLOR: case eng_3D_CLEAR_COLOR+0: case eng_3D_CLEAR_COLOR+1:
T1WriteByte(MMU.ARM9_REG, 0x0350, val); case eng_3D_CLEAR_COLOR+2: case eng_3D_CLEAR_COLOR+3:
gfx3d_glClearColor<u8>(0, val); T1WriteByte((u8*)&gfx3d.state.clearColor,adr-eng_3D_CLEAR_COLOR,val);
return; break;
case eng_3D_CLEAR_COLOR+1:
T1WriteByte(MMU.ARM9_REG, 0x0351, val);
gfx3d_glClearColor<u8>(1, val);
return;
case eng_3D_CLEAR_COLOR+2:
T1WriteByte(MMU.ARM9_REG, 0x0352, val);
gfx3d_glClearColor<u8>(2, val);
return;
case eng_3D_CLEAR_COLOR+3:
T1WriteByte(MMU.ARM9_REG, 0x0353, val);
gfx3d_glClearColor<u8>(3, val);
return;
case eng_3D_CLEAR_DEPTH:
HostWriteByte(MMU.ARM9_REG, 0x0354, val);
gfx3d_glClearDepth<u8, 0>(val);
return;
case eng_3D_CLEAR_DEPTH+1:
HostWriteByte(MMU.ARM9_REG, 0x0355, val);
gfx3d_glClearDepth<u8, 1>(val);
return;
case eng_3D_CLRIMAGE_OFFSET:
HostWriteByte(MMU.ARM9_REG, 0x0356, val);
gfx3d_glClearImageOffset<u8, 0>(val);
return;
case eng_3D_CLRIMAGE_OFFSET+1:
HostWriteByte(MMU.ARM9_REG, 0x0357, val);
gfx3d_glClearImageOffset<u8, 1>(val);
return;
case REG_VRAMCNTA: case REG_VRAMCNTA:
case REG_VRAMCNTB: case REG_VRAMCNTB:
@ -3842,11 +3653,6 @@ void DESMUME_FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
case REG_VRAMCNTI: case REG_VRAMCNTI:
MMU_VRAMmapControl(adr-REG_VRAMCNTA, val); MMU_VRAMmapControl(adr-REG_VRAMCNTA, val);
break; break;
// ensata sound register
case 0x04FFF200:
break;
#ifdef LOG_CARD #ifdef LOG_CARD
case 0x040001A0 : /* TODO (clear): ??? */ case 0x040001A0 : /* TODO (clear): ??? */
@ -3888,7 +3694,7 @@ void DESMUME_FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
} }
//================================================= MMU ARM9 write 16 //================================================= MMU ARM9 write 16
void DESMUME_FASTCALL _MMU_ARM9_write16(u32 adr, u16 val) void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
{ {
adr &= 0x0FFFFFFE; adr &= 0x0FFFFFFE;
const u32 adrBank = (adr >> 24); const u32 adrBank = (adr >> 24);
@ -3930,23 +3736,13 @@ void DESMUME_FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
switch (adr >> 4) switch (adr >> 4)
{ {
case 0x400033: // Edge Mark Color Table //toon table
((u16 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> (sizeof(u16) >> 1)] = val; case 0x0400038:
gfx3d_UpdateEdgeMarkColorTable<u16>((u8)(adr & 0x0000000F), val); case 0x0400039:
return; case 0x040003A:
case 0x040003B:
case 0x400036: ((u16 *)(MMU.ARM9_REG))[(adr & 0xFFF)>>1] = val;
case 0x400037: // Fog Table gfx3d_UpdateToonTable((adr & 0x3F) >> 1, val);
((u16 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> (sizeof(u16) >> 1)] = val & 0x7F7F;
gfx3d_UpdateFogTable<u16>((u8)(adr & 0x0000001F), val & 0x7F7F); // Drop the highest bit of each 8-bit value to limit the range to [0...127]
return;
case 0x400038:
case 0x400039:
case 0x40003A:
case 0x40003B: // Toon Table
((u16 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> (sizeof(u16) >> 1)] = val;
gfx3d_UpdateToonTable<u16>((u8)(adr & 0x0000003F), val);
return; return;
} }
@ -4196,11 +3992,7 @@ void DESMUME_FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
return; return;
case REG_DISPA_DISPMMEMFIFO: case REG_DISPA_DISPMMEMFIFO:
DISP_FIFOsend<u16, 0>(val); DISP_FIFOsend_u32(val);
return;
case REG_DISPA_DISPMMEMFIFO+2:
DISP_FIFOsend<u16, 2>(val);
return; return;
case REG_DISPA_MASTERBRIGHT: case REG_DISPA_MASTERBRIGHT:
@ -4441,6 +4233,14 @@ void DESMUME_FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
MMU_new.gxstat.write(16,adr,val); MMU_new.gxstat.write(16,adr,val);
break; break;
//fog table: only write bottom 7 bits
case eng_3D_FOG_TABLE+0x00: case eng_3D_FOG_TABLE+0x02: case eng_3D_FOG_TABLE+0x04: case eng_3D_FOG_TABLE+0x06:
case eng_3D_FOG_TABLE+0x08: case eng_3D_FOG_TABLE+0x0A: case eng_3D_FOG_TABLE+0x0C: case eng_3D_FOG_TABLE+0x0E:
case eng_3D_FOG_TABLE+0x10: case eng_3D_FOG_TABLE+0x12: case eng_3D_FOG_TABLE+0x14: case eng_3D_FOG_TABLE+0x16:
case eng_3D_FOG_TABLE+0x18: case eng_3D_FOG_TABLE+0x1A: case eng_3D_FOG_TABLE+0x1C: case eng_3D_FOG_TABLE+0x1E:
val &= 0x7F7F;
break;
// Alpha test reference value - Parameters:1 // Alpha test reference value - Parameters:1
case eng_3D_ALPHA_TEST_REF: case eng_3D_ALPHA_TEST_REF:
HostWriteWord(MMU.ARM9_REG, 0x0340, val); HostWriteWord(MMU.ARM9_REG, 0x0340, val);
@ -4448,24 +4248,14 @@ void DESMUME_FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
return; return;
case eng_3D_CLEAR_COLOR: case eng_3D_CLEAR_COLOR:
T1WriteWord(MMU.ARM9_REG, 0x0350, val);
gfx3d_glClearColor<u16>(0, val);
return;
case eng_3D_CLEAR_COLOR+2: case eng_3D_CLEAR_COLOR+2:
T1WriteWord(MMU.ARM9_REG, 0x0352, val); T1WriteWord((u8*)&gfx3d.state.clearColor,adr-eng_3D_CLEAR_COLOR,val);
gfx3d_glClearColor<u16>(2, val); break;
return;
// Clear background depth setup - Parameters:2 // Clear background depth setup - Parameters:2
case eng_3D_CLEAR_DEPTH: case eng_3D_CLEAR_DEPTH:
HostWriteWord(MMU.ARM9_REG, 0x0354, val); HostWriteWord(MMU.ARM9_REG, 0x0354, val);
gfx3d_glClearDepth<u16, 0>(val); gfx3d_glClearDepth(val);
return;
case eng_3D_CLRIMAGE_OFFSET:
HostWriteWord(MMU.ARM9_REG, 0x0356, val);
gfx3d_glClearImageOffset<u16, 0>(val);
return; return;
// Fog Color - Parameters:4b // Fog Color - Parameters:4b
@ -4604,7 +4394,7 @@ void DESMUME_FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
} }
//================================================= MMU ARM9 write 32 //================================================= MMU ARM9 write 32
void DESMUME_FASTCALL _MMU_ARM9_write32(u32 adr, u32 val) void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
{ {
adr &= 0x0FFFFFFC; adr &= 0x0FFFFFFC;
const u32 adrBank = (adr >> 24); const u32 adrBank = (adr >> 24);
@ -4658,23 +4448,16 @@ void DESMUME_FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
// lookups by the compiler // lookups by the compiler
switch (adr >> 4) switch (adr >> 4)
{ {
case 0x400033: // Edge Mark Color Table case 0x400033: //edge color table
((u32 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> (sizeof(u32) >> 1)] = val; ((u32 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> 2] = val;
gfx3d_UpdateEdgeMarkColorTable<u32>((u8)(adr & 0x0000000F), val);
return;
case 0x400036:
case 0x400037: // Fog Table
((u32 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> (sizeof(u32) >> 1)] = val & 0x7F7F7F7F;
gfx3d_UpdateFogTable<u32>((u8)(adr & 0x0000001F), val & 0x7F7F7F7F); // Drop the highest bit of each 8-bit value to limit the range to [0...127]
return; return;
case 0x400038: case 0x400038:
case 0x400039: case 0x400039:
case 0x40003A: case 0x40003A:
case 0x40003B: // Toon Table case 0x40003B: //toon table
((u32 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> (sizeof(u32) >> 1)] = val; ((u32 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> 2] = val;
gfx3d_UpdateToonTable<u32>((u8)(adr & 0x0000003F), val); gfx3d_UpdateToonTable((adr & 0x3F) >> 1, val);
return; return;
case 0x400040: case 0x400040:
@ -4852,7 +4635,7 @@ void DESMUME_FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
return; return;
case REG_DISPA_DISPMMEMFIFO: case REG_DISPA_DISPMMEMFIFO:
DISP_FIFOsend<u32, 0>(val); DISP_FIFOsend_u32(val);
return; return;
case REG_DISPA_MASTERBRIGHT: case REG_DISPA_MASTERBRIGHT:
@ -4978,6 +4761,12 @@ void DESMUME_FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
case REG_POWCNT1: writereg_POWCNT1(32,adr,val); break; case REG_POWCNT1: writereg_POWCNT1(32,adr,val); break;
//fog table: only write bottom 7 bits
case eng_3D_FOG_TABLE+0x00: case eng_3D_FOG_TABLE+0x04: case eng_3D_FOG_TABLE+0x08: case eng_3D_FOG_TABLE+0x0C:
case eng_3D_FOG_TABLE+0x10: case eng_3D_FOG_TABLE+0x14: case eng_3D_FOG_TABLE+0x18: case eng_3D_FOG_TABLE+0x1C:
val &= 0x7F7F7F7F;
break;
//ensata handshaking port? //ensata handshaking port?
case 0x04FFF010: case 0x04FFF010:
if(nds.ensataEmulation && nds.ensataHandshake == ENSATA_HANDSHAKE_ack && val == 0x13579bdf) if(nds.ensataEmulation && nds.ensataHandshake == ENSATA_HANDSHAKE_ack && val == 0x13579bdf)
@ -4992,7 +4781,7 @@ void DESMUME_FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
//todo - these are usually write only regs (these and 1000 more) //todo - these are usually write only regs (these and 1000 more)
//shouldnt we block them from getting written? ugh //shouldnt we block them from getting written? ugh
case eng_3D_CLIPMTX_RESULT: case eng_3D_CLIPMTX_RESULT:
if(nds.ensataEmulation /* && nds.ensataHandshake == ENSATA_HANDSHAKE_none */&& val==0x2468ace0) if(nds.ensataEmulation && nds.ensataHandshake == ENSATA_HANDSHAKE_none && val==0x2468ace0)
{ {
printf("ENSATA HANDSHAKE BEGIN\n"); printf("ENSATA HANDSHAKE BEGIN\n");
nds.ensataHandshake = ENSATA_HANDSHAKE_query; nds.ensataHandshake = ENSATA_HANDSHAKE_query;
@ -5010,15 +4799,13 @@ void DESMUME_FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
return; return;
case eng_3D_CLEAR_COLOR: case eng_3D_CLEAR_COLOR:
T1WriteLong(MMU.ARM9_REG, 0x0350, val); T1WriteLong((u8*)&gfx3d.state.clearColor,0,val);
gfx3d_glClearColor<u32>(0, val); break;
return;
// Clear background depth setup - Parameters:2 // Clear background depth setup - Parameters:2
case eng_3D_CLEAR_DEPTH: case eng_3D_CLEAR_DEPTH:
HostWriteLong(MMU.ARM9_REG, 0x0354, val); HostWriteLong(MMU.ARM9_REG, 0x0354, val);
gfx3d_glClearDepth<u16, 0>((u16)(val & 0x0000FFFF)); gfx3d_glClearDepth(val);
gfx3d_glClearImageOffset<u16, 0>((u16)(val >> 16));
return; return;
// Fog Color - Parameters:4b // Fog Color - Parameters:4b
@ -5147,7 +4934,7 @@ void DESMUME_FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
} }
//================================================= MMU ARM9 read 08 //================================================= MMU ARM9 read 08
u8 DESMUME_FASTCALL _MMU_ARM9_read08(u32 adr) u8 FASTCALL _MMU_ARM9_read08(u32 adr)
{ {
adr &= 0x0FFFFFFF; adr &= 0x0FFFFFFF;
@ -5270,7 +5057,7 @@ u8 DESMUME_FASTCALL _MMU_ARM9_read08(u32 adr)
} }
//================================================= MMU ARM9 read 16 //================================================= MMU ARM9 read 16
u16 DESMUME_FASTCALL _MMU_ARM9_read16(u32 adr) u16 FASTCALL _MMU_ARM9_read16(u32 adr)
{ {
adr &= 0x0FFFFFFE; adr &= 0x0FFFFFFE;
@ -5380,7 +5167,7 @@ u16 DESMUME_FASTCALL _MMU_ARM9_read16(u32 adr)
} }
//================================================= MMU ARM9 read 32 //================================================= MMU ARM9 read 32
u32 DESMUME_FASTCALL _MMU_ARM9_read32(u32 adr) u32 FASTCALL _MMU_ARM9_read32(u32 adr)
{ {
adr &= 0x0FFFFFFC; adr &= 0x0FFFFFFC;
@ -5511,10 +5298,6 @@ u32 DESMUME_FASTCALL _MMU_ARM9_read32(u32 adr)
case REG_KEYINPUT: case REG_KEYINPUT:
LagFrameFlag=0; LagFrameFlag=0;
break; break;
// Ensata sound register
case 0x04FFF200:
return 1;
} }
return T1ReadLong_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr & MMU.MMU_MASK[ARMCPU_ARM9][adr>>20]); return T1ReadLong_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr & MMU.MMU_MASK[ARMCPU_ARM9][adr>>20]);
} }
@ -5530,7 +5313,7 @@ u32 DESMUME_FASTCALL _MMU_ARM9_read32(u32 adr)
//========================================================================================================= //=========================================================================================================
//========================================================================================================= //=========================================================================================================
//================================================= MMU ARM7 write 08 //================================================= MMU ARM7 write 08
void DESMUME_FASTCALL _MMU_ARM7_write08(u32 adr, u8 val) void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val)
{ {
adr &= 0x0FFFFFFF; adr &= 0x0FFFFFFF;
@ -5610,21 +5393,6 @@ void DESMUME_FASTCALL _MMU_ARM7_write08(u32 adr, u8 val)
printf("Unsupported 8bit write to timer registers"); printf("Unsupported 8bit write to timer registers");
return; return;
case REG_IPCSYNC:
{
u16 ipcsync = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x180);
ipcsync &= 0xFF00;
ipcsync |= (val & 0xFF);
MMU_IPCSync(ARMCPU_ARM7, ipcsync);
}
case REG_IPCSYNC+1:
{
u16 ipcsync = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x180);
ipcsync &= 0x00FF;
ipcsync |= ((val & 0xFF) << 8);
MMU_IPCSync(ARMCPU_ARM7, ipcsync);
}
case REG_AUXSPIDATA: case REG_AUXSPIDATA:
{ {
//if(val!=0) MMU.AUX_SPI_CMD = val & 0xFF; //zero 20-aug-2013 - this seems pointless //if(val!=0) MMU.AUX_SPI_CMD = val & 0xFF; //zero 20-aug-2013 - this seems pointless
@ -5658,7 +5426,7 @@ void DESMUME_FASTCALL _MMU_ARM7_write08(u32 adr, u8 val)
} }
//================================================= MMU ARM7 write 16 //================================================= MMU ARM7 write 16
void DESMUME_FASTCALL _MMU_ARM7_write16(u32 adr, u16 val) void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
{ {
adr &= 0x0FFFFFFE; adr &= 0x0FFFFFFE;
@ -5843,7 +5611,7 @@ void DESMUME_FASTCALL _MMU_ARM7_write16(u32 adr, u16 val)
T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][adr>>20], adr&MMU.MMU_MASK[ARMCPU_ARM7][adr>>20], val); T1WriteWord(MMU.MMU_MEM[ARMCPU_ARM7][adr>>20], adr&MMU.MMU_MASK[ARMCPU_ARM7][adr>>20], val);
} }
//================================================= MMU ARM7 write 32 //================================================= MMU ARM7 write 32
void DESMUME_FASTCALL _MMU_ARM7_write32(u32 adr, u32 val) void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val)
{ {
adr &= 0x0FFFFFFC; adr &= 0x0FFFFFFC;
@ -5946,7 +5714,7 @@ void DESMUME_FASTCALL _MMU_ARM7_write32(u32 adr, u32 val)
} }
//================================================= MMU ARM7 read 08 //================================================= MMU ARM7 read 08
u8 DESMUME_FASTCALL _MMU_ARM7_read08(u32 adr) u8 FASTCALL _MMU_ARM7_read08(u32 adr)
{ {
adr &= 0x0FFFFFFF; adr &= 0x0FFFFFFF;
@ -6028,7 +5796,7 @@ u8 DESMUME_FASTCALL _MMU_ARM7_read08(u32 adr)
return MMU.MMU_MEM[ARMCPU_ARM7][adr>>20][adr&MMU.MMU_MASK[ARMCPU_ARM7][adr>>20]]; return MMU.MMU_MEM[ARMCPU_ARM7][adr>>20][adr&MMU.MMU_MASK[ARMCPU_ARM7][adr>>20]];
} }
//================================================= MMU ARM7 read 16 //================================================= MMU ARM7 read 16
u16 DESMUME_FASTCALL _MMU_ARM7_read16(u32 adr) u16 FASTCALL _MMU_ARM7_read16(u32 adr)
{ {
adr &= 0x0FFFFFFE; adr &= 0x0FFFFFFE;
@ -6114,7 +5882,7 @@ u16 DESMUME_FASTCALL _MMU_ARM7_read16(u32 adr)
return T1ReadWord_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM7][adr >> 20], adr & MMU.MMU_MASK[ARMCPU_ARM7][adr >> 20]); return T1ReadWord_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM7][adr >> 20], adr & MMU.MMU_MASK[ARMCPU_ARM7][adr >> 20]);
} }
//================================================= MMU ARM7 read 32 //================================================= MMU ARM7 read 32
u32 DESMUME_FASTCALL _MMU_ARM7_read32(u32 adr) u32 FASTCALL _MMU_ARM7_read32(u32 adr)
{ {
adr &= 0x0FFFFFFC; adr &= 0x0FFFFFFC;
@ -6198,7 +5966,7 @@ u32 DESMUME_FASTCALL _MMU_ARM7_read32(u32 adr)
//========================================================================================================= //=========================================================================================================
u32 DESMUME_FASTCALL MMU_read32(u32 proc, u32 adr) u32 FASTCALL MMU_read32(u32 proc, u32 adr)
{ {
ASSERT_UNALIGNED((adr&3)==0); ASSERT_UNALIGNED((adr&3)==0);
@ -6208,7 +5976,7 @@ u32 DESMUME_FASTCALL MMU_read32(u32 proc, u32 adr)
return _MMU_ARM7_read32(adr); return _MMU_ARM7_read32(adr);
} }
u16 DESMUME_FASTCALL MMU_read16(u32 proc, u32 adr) u16 FASTCALL MMU_read16(u32 proc, u32 adr)
{ {
ASSERT_UNALIGNED((adr&1)==0); ASSERT_UNALIGNED((adr&1)==0);
@ -6218,7 +5986,7 @@ u16 DESMUME_FASTCALL MMU_read16(u32 proc, u32 adr)
return _MMU_ARM7_read16(adr); return _MMU_ARM7_read16(adr);
} }
u8 DESMUME_FASTCALL MMU_read8(u32 proc, u32 adr) u8 FASTCALL MMU_read8(u32 proc, u32 adr)
{ {
if(proc==0) if(proc==0)
return _MMU_ARM9_read08(adr); return _MMU_ARM9_read08(adr);
@ -6226,7 +5994,7 @@ u8 DESMUME_FASTCALL MMU_read8(u32 proc, u32 adr)
return _MMU_ARM7_read08(adr); return _MMU_ARM7_read08(adr);
} }
void DESMUME_FASTCALL MMU_write32(u32 proc, u32 adr, u32 val) void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val)
{ {
ASSERT_UNALIGNED((adr&3)==0); ASSERT_UNALIGNED((adr&3)==0);
@ -6236,7 +6004,7 @@ void DESMUME_FASTCALL MMU_write32(u32 proc, u32 adr, u32 val)
_MMU_ARM7_write32(adr,val); _MMU_ARM7_write32(adr,val);
} }
void DESMUME_FASTCALL MMU_write16(u32 proc, u32 adr, u16 val) void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val)
{ {
ASSERT_UNALIGNED((adr&1)==0); ASSERT_UNALIGNED((adr&1)==0);
@ -6246,7 +6014,7 @@ void DESMUME_FASTCALL MMU_write16(u32 proc, u32 adr, u16 val)
_MMU_ARM7_write16(adr,val); _MMU_ARM7_write16(adr,val);
} }
void DESMUME_FASTCALL MMU_write8(u32 proc, u32 adr, u8 val) void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val)
{ {
if(proc==0) if(proc==0)
_MMU_ARM9_write08(adr, val); _MMU_ARM9_write08(adr, val);
@ -6254,7 +6022,7 @@ void DESMUME_FASTCALL MMU_write8(u32 proc, u32 adr, u8 val)
_MMU_ARM7_write08(adr,val); _MMU_ARM7_write08(adr,val);
} }
void DESMUME_FASTCALL MMU_DumpMemBlock(u8 proc, u32 address, u32 size, u8 *buffer) void FASTCALL MMU_DumpMemBlock(u8 proc, u32 address, u32 size, u8 *buffer)
{ {
u32 i; u32 i;
u32 curaddr; u32 curaddr;
@ -6273,67 +6041,67 @@ template u32 MMU_struct::gen_IF<ARMCPU_ARM7>();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//function pointer handlers for gdb stub stuff //function pointer handlers for gdb stub stuff
static u16 DESMUME_FASTCALL arm9_prefetch16( void *data, u32 adr) { static u16 FASTCALL arm9_prefetch16( void *data, u32 adr) {
return _MMU_read16<ARMCPU_ARM9,MMU_AT_CODE>(adr); return _MMU_read16<ARMCPU_ARM9,MMU_AT_CODE>(adr);
} }
static u32 DESMUME_FASTCALL arm9_prefetch32( void *data, u32 adr) { static u32 FASTCALL arm9_prefetch32( void *data, u32 adr) {
return _MMU_read32<ARMCPU_ARM9,MMU_AT_CODE>(adr); return _MMU_read32<ARMCPU_ARM9,MMU_AT_CODE>(adr);
} }
static u8 DESMUME_FASTCALL arm9_read8( void *data, u32 adr) { static u8 FASTCALL arm9_read8( void *data, u32 adr) {
return _MMU_read08<ARMCPU_ARM9>(adr); return _MMU_read08<ARMCPU_ARM9>(adr);
} }
static u16 DESMUME_FASTCALL arm9_read16( void *data, u32 adr) { static u16 FASTCALL arm9_read16( void *data, u32 adr) {
return _MMU_read16<ARMCPU_ARM9>(adr); return _MMU_read16<ARMCPU_ARM9>(adr);
} }
static u32 DESMUME_FASTCALL arm9_read32( void *data, u32 adr) { static u32 FASTCALL arm9_read32( void *data, u32 adr) {
return _MMU_read32<ARMCPU_ARM9>(adr); return _MMU_read32<ARMCPU_ARM9>(adr);
} }
static void DESMUME_FASTCALL arm9_write8(void *data, u32 adr, u8 val) { static void FASTCALL arm9_write8(void *data, u32 adr, u8 val) {
_MMU_write08<ARMCPU_ARM9>(adr, val); _MMU_write08<ARMCPU_ARM9>(adr, val);
} }
static void DESMUME_FASTCALL arm9_write16(void *data, u32 adr, u16 val) { static void FASTCALL arm9_write16(void *data, u32 adr, u16 val) {
_MMU_write16<ARMCPU_ARM9>(adr, val); _MMU_write16<ARMCPU_ARM9>(adr, val);
} }
static void DESMUME_FASTCALL arm9_write32(void *data, u32 adr, u32 val) { static void FASTCALL arm9_write32(void *data, u32 adr, u32 val) {
_MMU_write32<ARMCPU_ARM9>(adr, val); _MMU_write32<ARMCPU_ARM9>(adr, val);
} }
static u16 DESMUME_FASTCALL arm7_prefetch16( void *data, u32 adr) { static u16 FASTCALL arm7_prefetch16( void *data, u32 adr) {
return _MMU_read16<ARMCPU_ARM7,MMU_AT_CODE>(adr); return _MMU_read16<ARMCPU_ARM7,MMU_AT_CODE>(adr);
} }
static u32 DESMUME_FASTCALL arm7_prefetch32( void *data, u32 adr) { static u32 FASTCALL arm7_prefetch32( void *data, u32 adr) {
return _MMU_read32<ARMCPU_ARM7,MMU_AT_CODE>(adr); return _MMU_read32<ARMCPU_ARM7,MMU_AT_CODE>(adr);
} }
static u8 DESMUME_FASTCALL arm7_read8( void *data, u32 adr) { static u8 FASTCALL arm7_read8( void *data, u32 adr) {
return _MMU_read08<ARMCPU_ARM7>(adr); return _MMU_read08<ARMCPU_ARM7>(adr);
} }
static u16 DESMUME_FASTCALL arm7_read16( void *data, u32 adr) { static u16 FASTCALL arm7_read16( void *data, u32 adr) {
return _MMU_read16<ARMCPU_ARM7>(adr); return _MMU_read16<ARMCPU_ARM7>(adr);
} }
static u32 DESMUME_FASTCALL arm7_read32( void *data, u32 adr) { static u32 FASTCALL arm7_read32( void *data, u32 adr) {
return _MMU_read32<ARMCPU_ARM7>(adr); return _MMU_read32<ARMCPU_ARM7>(adr);
} }
static void DESMUME_FASTCALL arm7_write8(void *data, u32 adr, u8 val) { static void FASTCALL arm7_write8(void *data, u32 adr, u8 val) {
_MMU_write08<ARMCPU_ARM7>(adr, val); _MMU_write08<ARMCPU_ARM7>(adr, val);
} }
static void DESMUME_FASTCALL arm7_write16(void *data, u32 adr, u16 val) { static void FASTCALL arm7_write16(void *data, u32 adr, u16 val) {
_MMU_write16<ARMCPU_ARM7>(adr, val); _MMU_write16<ARMCPU_ARM7>(adr, val);
} }
static void DESMUME_FASTCALL arm7_write32(void *data, u32 adr, u32 val) { static void FASTCALL arm7_write32(void *data, u32 adr, u32 val) {
_MMU_write32<ARMCPU_ARM7>(adr, val); _MMU_write32<ARMCPU_ARM7>(adr, val);
} }

View File

@ -1,7 +1,7 @@
/* /*
Copyright (C) 2006 yopyop Copyright (C) 2006 yopyop
Copyright (C) 2007 shash Copyright (C) 2007 shash
Copyright (C) 2007-2025 DeSmuME team Copyright (C) 2007-2017 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -88,8 +88,6 @@ enum EDMADestinationUpdate
class TRegister_32 class TRegister_32
{ {
public: public:
virtual ~TRegister_32() {}
virtual u32 read32() = 0; virtual u32 read32() = 0;
virtual void write32(const u32 val) = 0; virtual void write32(const u32 val) = 0;
void write(const int size, const u32 adr, const u32 val) { void write(const int size, const u32 adr, const u32 val) {
@ -126,9 +124,6 @@ struct TGXSTAT : public TRegister_32
fifo_empty = true; fifo_empty = true;
fifo_low = false; fifo_low = false;
} }
virtual ~TGXSTAT() {}
u8 tb; //test busy u8 tb; //test busy
u8 tr; //test result u8 tr; //test result
u8 se; //stack error u8 se; //stack error
@ -251,10 +246,7 @@ public:
AddressRegister(u32* _ptr) AddressRegister(u32* _ptr)
: ptr(_ptr) : ptr(_ptr)
{} {}
virtual u32 read32() {
virtual ~AddressRegister() {}
virtual u32 read32() {
return *ptr; return *ptr;
} }
virtual void write32(const u32 val) { virtual void write32(const u32 val) {
@ -267,9 +259,7 @@ public:
//we pass in a pointer to the controller here so we can alert it if anything changes //we pass in a pointer to the controller here so we can alert it if anything changes
DmaController* controller; DmaController* controller;
ControlRegister() {} ControlRegister() {}
virtual ~ControlRegister() {} virtual u32 read32() {
virtual u32 read32() {
return controller->read32(); return controller->read32();
} }
virtual void write32(const u32 val) { virtual void write32(const u32 val) {
@ -524,24 +514,24 @@ extern MMU_struct_new MMU_new;
struct armcpu_memory_iface struct armcpu_memory_iface
{ {
/** the 32 bit instruction prefetch */ /** the 32 bit instruction prefetch */
u32 DESMUME_FASTCALL (*prefetch32)( void *data, u32 adr); u32 FASTCALL (*prefetch32)( void *data, u32 adr);
/** the 16 bit instruction prefetch */ /** the 16 bit instruction prefetch */
u16 DESMUME_FASTCALL (*prefetch16)( void *data, u32 adr); u16 FASTCALL (*prefetch16)( void *data, u32 adr);
/** read 8 bit data value */ /** read 8 bit data value */
u8 DESMUME_FASTCALL (*read8)( void *data, u32 adr); u8 FASTCALL (*read8)( void *data, u32 adr);
/** read 16 bit data value */ /** read 16 bit data value */
u16 DESMUME_FASTCALL (*read16)( void *data, u32 adr); u16 FASTCALL (*read16)( void *data, u32 adr);
/** read 32 bit data value */ /** read 32 bit data value */
u32 DESMUME_FASTCALL (*read32)( void *data, u32 adr); u32 FASTCALL (*read32)( void *data, u32 adr);
/** write 8 bit data value */ /** write 8 bit data value */
void DESMUME_FASTCALL (*write8)( void *data, u32 adr, u8 val); void FASTCALL (*write8)( void *data, u32 adr, u8 val);
/** write 16 bit data value */ /** write 16 bit data value */
void DESMUME_FASTCALL (*write16)( void *data, u32 adr, u16 val); void FASTCALL (*write16)( void *data, u32 adr, u16 val);
/** write 32 bit data value */ /** write 32 bit data value */
void DESMUME_FASTCALL (*write32)( void *data, u32 adr, u32 val); void FASTCALL (*write32)( void *data, u32 adr, u32 val);
void *data; void *data;
}; };
@ -555,14 +545,14 @@ void MMU_Reset( void);
void print_memory_profiling( void); void print_memory_profiling( void);
// Memory reading/writing (old) // Memory reading/writing (old)
u8 DESMUME_FASTCALL MMU_read8(u32 proc, u32 adr); u8 FASTCALL MMU_read8(u32 proc, u32 adr);
u16 DESMUME_FASTCALL MMU_read16(u32 proc, u32 adr); u16 FASTCALL MMU_read16(u32 proc, u32 adr);
u32 DESMUME_FASTCALL MMU_read32(u32 proc, u32 adr); u32 FASTCALL MMU_read32(u32 proc, u32 adr);
void DESMUME_FASTCALL MMU_write8(u32 proc, u32 adr, u8 val); void FASTCALL MMU_write8(u32 proc, u32 adr, u8 val);
void DESMUME_FASTCALL MMU_write16(u32 proc, u32 adr, u16 val); void FASTCALL MMU_write16(u32 proc, u32 adr, u16 val);
void DESMUME_FASTCALL MMU_write32(u32 proc, u32 adr, u32 val); void FASTCALL MMU_write32(u32 proc, u32 adr, u32 val);
//template<int PROCNUM> void DESMUME_FASTCALL MMU_doDMA(u32 num); //template<int PROCNUM> void FASTCALL MMU_doDMA(u32 num);
//The base ARM memory interfaces //The base ARM memory interfaces
extern const armcpu_memory_iface arm9_base_memory_iface; extern const armcpu_memory_iface arm9_base_memory_iface;
@ -636,10 +626,6 @@ FORCEINLINE void* MMU_gpu_map(const u32 vram_addr)
return MMU.ARM9_LCD + (vram_page << 14) + ofs; return MMU.ARM9_LCD + (vram_page << 14) + ofs;
} }
// Call MMU_WriteFromExternal() when modifying memory outside of the normal execution process, such
// as when using cheats or when the client wants to write to memory directly. This function returns
// true if memory is modified in such a way that requires the JIT execution be reset.
template<typename T, size_t LENGTH> bool MMU_WriteFromExternal(const int targetProc, const u32 targetAddress, T newValue);
template<int PROCNUM, MMU_ACCESS_TYPE AT> u8 _MMU_read08(u32 addr); template<int PROCNUM, MMU_ACCESS_TYPE AT> u8 _MMU_read08(u32 addr);
template<int PROCNUM, MMU_ACCESS_TYPE AT> u16 _MMU_read16(u32 addr); template<int PROCNUM, MMU_ACCESS_TYPE AT> u16 _MMU_read16(u32 addr);
@ -655,19 +641,19 @@ template<int PROCNUM> FORCEINLINE void _MMU_write08(u32 addr, u8 val) { _MMU_wri
template<int PROCNUM> FORCEINLINE void _MMU_write16(u32 addr, u16 val) { _MMU_write16<PROCNUM, MMU_AT_DATA>(addr,val); } template<int PROCNUM> FORCEINLINE void _MMU_write16(u32 addr, u16 val) { _MMU_write16<PROCNUM, MMU_AT_DATA>(addr,val); }
template<int PROCNUM> FORCEINLINE void _MMU_write32(u32 addr, u32 val) { _MMU_write32<PROCNUM, MMU_AT_DATA>(addr,val); } template<int PROCNUM> FORCEINLINE void _MMU_write32(u32 addr, u32 val) { _MMU_write32<PROCNUM, MMU_AT_DATA>(addr,val); }
void DESMUME_FASTCALL _MMU_ARM9_write08(u32 adr, u8 val); void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val);
void DESMUME_FASTCALL _MMU_ARM9_write16(u32 adr, u16 val); void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val);
void DESMUME_FASTCALL _MMU_ARM9_write32(u32 adr, u32 val); void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val);
u8 DESMUME_FASTCALL _MMU_ARM9_read08(u32 adr); u8 FASTCALL _MMU_ARM9_read08(u32 adr);
u16 DESMUME_FASTCALL _MMU_ARM9_read16(u32 adr); u16 FASTCALL _MMU_ARM9_read16(u32 adr);
u32 DESMUME_FASTCALL _MMU_ARM9_read32(u32 adr); u32 FASTCALL _MMU_ARM9_read32(u32 adr);
void DESMUME_FASTCALL _MMU_ARM7_write08(u32 adr, u8 val); void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val);
void DESMUME_FASTCALL _MMU_ARM7_write16(u32 adr, u16 val); void FASTCALL _MMU_ARM7_write16(u32 adr, u16 val);
void DESMUME_FASTCALL _MMU_ARM7_write32(u32 adr, u32 val); void FASTCALL _MMU_ARM7_write32(u32 adr, u32 val);
u8 DESMUME_FASTCALL _MMU_ARM7_read08(u32 adr); u8 FASTCALL _MMU_ARM7_read08(u32 adr);
u16 DESMUME_FASTCALL _MMU_ARM7_read16(u32 adr); u16 FASTCALL _MMU_ARM7_read16(u32 adr);
u32 DESMUME_FASTCALL _MMU_ARM7_read32(u32 adr); u32 FASTCALL _MMU_ARM7_read32(u32 adr);
extern u32 partie; extern u32 partie;
@ -1057,12 +1043,12 @@ FORCEINLINE void _MMU_write32(const int PROCNUM, const MMU_ACCESS_TYPE AT, const
//#ifdef MMU_ENABLE_ACL //#ifdef MMU_ENABLE_ACL
// void DESMUME_FASTCALL MMU_write8_acl(u32 proc, u32 adr, u8 val); // void FASTCALL MMU_write8_acl(u32 proc, u32 adr, u8 val);
// void DESMUME_FASTCALL MMU_write16_acl(u32 proc, u32 adr, u16 val); // void FASTCALL MMU_write16_acl(u32 proc, u32 adr, u16 val);
// void DESMUME_FASTCALL MMU_write32_acl(u32 proc, u32 adr, u32 val); // void FASTCALL MMU_write32_acl(u32 proc, u32 adr, u32 val);
// u8 DESMUME_FASTCALL MMU_read8_acl(u32 proc, u32 adr, u32 access); // u8 FASTCALL MMU_read8_acl(u32 proc, u32 adr, u32 access);
// u16 DESMUME_FASTCALL MMU_read16_acl(u32 proc, u32 adr, u32 access); // u16 FASTCALL MMU_read16_acl(u32 proc, u32 adr, u32 access);
// u32 DESMUME_FASTCALL MMU_read32_acl(u32 proc, u32 adr, u32 access); // u32 FASTCALL MMU_read32_acl(u32 proc, u32 adr, u32 access);
//#else //#else
// #define MMU_write8_acl(proc, adr, val) _MMU_write08<proc>(adr, val) // #define MMU_write8_acl(proc, adr, val) _MMU_write08<proc>(adr, val)
// #define MMU_write16_acl(proc, adr, val) _MMU_write16<proc>(adr, val) // #define MMU_write16_acl(proc, adr, val) _MMU_write16<proc>(adr, val)
@ -1107,6 +1093,6 @@ FORCEINLINE void _MMU_write16(u32 addr, u16 val) { _MMU_write16(PROCNUM, AT, add
template<int PROCNUM, MMU_ACCESS_TYPE AT> template<int PROCNUM, MMU_ACCESS_TYPE AT>
FORCEINLINE void _MMU_write32(u32 addr, u32 val) { _MMU_write32(PROCNUM, AT, addr, val); } FORCEINLINE void _MMU_write32(u32 addr, u32 val) { _MMU_write32(PROCNUM, AT, addr, val); }
void DESMUME_FASTCALL MMU_DumpMemBlock(u8 proc, u32 address, u32 size, u8 *buffer); void FASTCALL MMU_DumpMemBlock(u8 proc, u32 address, u32 size, u8 *buffer);
#endif #endif

258
desmume/src/Makefile.am Normal file
View File

@ -0,0 +1,258 @@
include desmume.mk
AM_CPPFLAGS += $(SDL_CFLAGS) $(GTHREAD_CFLAGS) $(X_CFLAGS) $(ALSA_CFLAGS) $(LIBAGG_CFLAGS) $(LIBSOUNDTOUCH_CFLAGS)
EXTRA_DIST = instruction_tabdef.inc thumb_tabdef.inc cocoa
if HAVE_GDB_STUB
SUBDIRS = . gdbstub $(UI_DIR)
else
SUBDIRS = . $(UI_DIR)
endif
#DIST_SUBDIRS = . gdbstub cli gtk gtk-glade
noinst_LIBRARIES = libdesmume.a
libdesmume_a_SOURCES = \
armcpu.cpp armcpu.h \
arm_instructions.cpp \
agg2d.h agg2d.inl \
bios.cpp bios.h bits.h cp15.cpp cp15.h \
commandline.h commandline.cpp \
common.cpp common.h \
debug.cpp debug.h \
Database.cpp Database.h Disassembler.cpp Disassembler.h \
emufile.h emufile.cpp encrypt.h encrypt.cpp FIFO.cpp FIFO.h \
firmware.cpp firmware.h GPU.cpp GPU.h \
GPU_osd.h \
instructions.h \
mem.h mc.cpp mc.h \
path.cpp path.h \
readwrite.cpp readwrite.h \
wifi.cpp wifi.h \
mic.h \
MMU.cpp MMU.h MMU_timing.h NDSSystem.cpp NDSSystem.h registers.h \
OGLRender.h OGLRender_3_2.h \
ROMReader.cpp ROMReader.h \
render3D.cpp render3D.h \
rtc.cpp rtc.h \
saves.cpp saves.h \
slot1.cpp slot1.h \
slot2.cpp slot2.h \
SPU.cpp SPU.h \
matrix.cpp matrix.h \
gfx3d.cpp gfx3d.h \
thumb_instructions.cpp types.h \
movie.cpp movie.h \
PACKED.h PACKED_END.h \
utils/advanscene.cpp utils/advanscene.h \
utils/datetime.cpp utils/datetime.h \
utils/ConvertUTF.c utils/ConvertUTF.h utils/guid.cpp utils/guid.h \
utils/emufat.cpp utils/emufat.h utils/emufat_types.h \
utils/fsnitro.cpp utils/fsnitro.h \
utils/md5.cpp utils/md5.h utils/valuearray.h utils/xstring.cpp utils/xstring.h \
utils/decrypt/crc.cpp utils/decrypt/crc.h utils/decrypt/decrypt.cpp \
utils/decrypt/decrypt.h utils/decrypt/header.cpp utils/decrypt/header.h \
utils/task.cpp utils/task.h \
utils/vfat.h utils/vfat.cpp \
utils/colorspacehandler/colorspacehandler.cpp \
utils/dlditool.cpp \
utils/libfat/bit_ops.h \
utils/libfat/cache.cpp \
utils/libfat/cache.h \
utils/libfat/common.h \
utils/libfat/directory.cpp \
utils/libfat/directory.h \
utils/libfat/disc.cpp \
utils/libfat/disc.h \
utils/libfat/disc_io.h \
utils/libfat/fat.h \
utils/libfat/fatdir.cpp \
utils/libfat/fatdir.h \
utils/libfat/fatfile.cpp \
utils/libfat/fatfile.h \
utils/libfat/filetime.cpp \
utils/libfat/filetime.h \
utils/libfat/file_allocation_table.cpp \
utils/libfat/file_allocation_table.h \
utils/libfat/libfat.cpp \
utils/libfat/libfat_pc.h \
utils/libfat/libfat_public_api.cpp \
utils/libfat/libfat_public_api.h \
utils/libfat/lock.cpp \
utils/libfat/lock.h \
utils/libfat/mem_allocate.h \
utils/libfat/partition.cpp \
utils/libfat/partition.h \
utils/tinyxml/tinystr.cpp \
utils/tinyxml/tinystr.h \
utils/tinyxml/tinyxml.cpp \
utils/tinyxml/tinyxml.h \
utils/tinyxml/tinyxmlerror.cpp \
utils/tinyxml/tinyxmlparser.cpp \
utils/glcorearb.h \
addons/slot2_auto.cpp \
addons/slot2_mpcf.cpp \
addons/slot2_paddle.cpp \
addons/slot2_gbagame.cpp \
addons/slot2_none.cpp \
addons/slot2_rumblepak.cpp \
addons/slot2_guitarGrip.cpp \
addons/slot2_expMemory.cpp \
addons/slot2_piano.cpp \
addons/slot2_passme.cpp \
addons/slot1_none.cpp \
addons/slot1_r4.cpp \
addons/slot1_retail_nand.cpp \
addons/slot1_retail_auto.cpp \
addons/slot1_retail_mcrom.cpp \
addons/slot1_retail_mcrom_debug.cpp \
addons/slot1comp_mc.cpp \
addons/slot1comp_mc.h \
addons/slot1comp_rom.h \
addons/slot1comp_rom.cpp \
addons/slot1comp_protocol.h \
addons/slot1comp_protocol.cpp \
cheatSystem.cpp cheatSystem.h \
texcache.cpp texcache.h rasterize.cpp rasterize.h \
metaspu/metaspu.cpp metaspu/metaspu.h \
filter/2xsai.cpp \
filter/bilinear.cpp \
filter/deposterize.cpp \
filter/epx.cpp \
filter/filter.h \
filter/hq2x.cpp \
filter/hq2x.h \
filter/hq3x.cpp \
filter/hq3x.dat \
filter/hq4x.cpp \
filter/hq4x.dat \
filter/interp.h \
filter/lq2x.cpp filter/lq2x.h \
filter/scanline.cpp \
filter/videofilter.cpp filter/videofilter.h \
filter/xbrz.cpp filter/xbrz.h \
version.cpp version.h \
desmume_config.cpp desmume_config.h \
libretro-common/compat/compat_getopt.c \
libretro-common/file/file_path.c \
libretro-common/compat/compat_strl.c \
libretro-common/features/features_cpu.c \
libretro-common/file/retro_dirent.c \
libretro-common/file/retro_stat.c \
libretro-common/rthreads/async_job.c \
libretro-common/rthreads/rsemaphore.c \
libretro-common/rthreads/rthreads.c
if SUPPORT_SSE2
libdesmume_a_SOURCES += \
utils/colorspacehandler/colorspacehandler_SSE2.cpp
endif
if SUPPORT_AVX2
libdesmume_a_SOURCES += \
utils/colorspacehandler/colorspacehandler_AVX2.cpp
endif
if SUPPORT_ALTIVEC
libdesmume_a_SOURCES += \
utils/colorspacehandler/colorspacehandler_AltiVec.cpp
endif
if HAVE_JIT
libdesmume_a_SOURCES += \
arm_jit.cpp arm_jit.h instruction_attributes.h \
utils/AsmJit/AsmJit.h \
utils/AsmJit/Config.h \
utils/AsmJit/core.h \
utils/AsmJit/x86.h \
utils/AsmJit/core/apibegin.h \
utils/AsmJit/core/apiend.h \
utils/AsmJit/core/assembler.cpp \
utils/AsmJit/core/assembler.h \
utils/AsmJit/core/assert.cpp \
utils/AsmJit/core/assert.h \
utils/AsmJit/core/buffer.cpp \
utils/AsmJit/core/buffer.h \
utils/AsmJit/core/build.h \
utils/AsmJit/core/compiler.cpp \
utils/AsmJit/core/compiler.h \
utils/AsmJit/core/compilercontext.cpp \
utils/AsmJit/core/compilercontext.h \
utils/AsmJit/core/compilerfunc.cpp \
utils/AsmJit/core/compilerfunc.h \
utils/AsmJit/core/compileritem.cpp \
utils/AsmJit/core/compileritem.h \
utils/AsmJit/core/context.cpp \
utils/AsmJit/core/context.h \
utils/AsmJit/core/cpuinfo.cpp \
utils/AsmJit/core/cpuinfo.h \
utils/AsmJit/core/defs.cpp \
utils/AsmJit/core/defs.h \
utils/AsmJit/core/func.cpp \
utils/AsmJit/core/func.h \
utils/AsmJit/core/intutil.h \
utils/AsmJit/core/lock.h \
utils/AsmJit/core/logger.cpp \
utils/AsmJit/core/logger.h \
utils/AsmJit/core/memorymanager.cpp \
utils/AsmJit/core/memorymanager.h \
utils/AsmJit/core/memorymarker.cpp \
utils/AsmJit/core/memorymarker.h \
utils/AsmJit/core/operand.cpp \
utils/AsmJit/core/operand.h \
utils/AsmJit/core/podvector.h \
utils/AsmJit/core/stringbuilder.cpp \
utils/AsmJit/core/stringbuilder.h \
utils/AsmJit/core/stringutil.cpp \
utils/AsmJit/core/stringutil.h \
utils/AsmJit/core/virtualmemory.cpp \
utils/AsmJit/core/virtualmemory.h \
utils/AsmJit/core/zonememory.cpp \
utils/AsmJit/core/zonememory.h \
utils/AsmJit/x86/x86assembler.cpp \
utils/AsmJit/x86/x86assembler.h \
utils/AsmJit/x86/x86compiler.cpp \
utils/AsmJit/x86/x86compiler.h \
utils/AsmJit/x86/x86compilercontext.cpp \
utils/AsmJit/x86/x86compilercontext.h \
utils/AsmJit/x86/x86compilerfunc.cpp \
utils/AsmJit/x86/x86compilerfunc.h \
utils/AsmJit/x86/x86compileritem.cpp \
utils/AsmJit/x86/x86compileritem.h \
utils/AsmJit/x86/x86cpuinfo.cpp \
utils/AsmJit/x86/x86cpuinfo.h \
utils/AsmJit/x86/x86defs.cpp \
utils/AsmJit/x86/x86defs.h \
utils/AsmJit/x86/x86func.cpp \
utils/AsmJit/x86/x86func.h \
utils/AsmJit/x86/x86operand.cpp \
utils/AsmJit/x86/x86operand.h \
utils/AsmJit/x86/x86util.cpp \
utils/AsmJit/x86/x86util.h
endif
if HAVE_GL
libdesmume_a_SOURCES += OGLRender.cpp OGLRender_3_2.cpp
endif
if HAVE_OPENAL
libdesmume_a_SOURCES += mic_openal.cpp
else
if HAVE_ALSA
libdesmume_a_SOURCES += mic_alsa.cpp
else
libdesmume_a_SOURCES += mic.cpp
endif
endif
if HAVE_LIBSOUNDTOUCH
libdesmume_a_SOURCES += metaspu/SndOut.cpp metaspu/SndOut.h metaspu/Timestretcher.cpp
endif
if HAVE_LIBAGG
libdesmume_a_SOURCES += aggdraw.cpp aggdraw.h GPU_osd.cpp
else
libdesmume_a_SOURCES += GPU_osd_stub.cpp
endif
if HAVE_LUA
AM_CPPFLAGS += $(LUA_CFLAGS)
libdesmume_a_SOURCES += lua-engine.cpp
endif

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2006 yopyop Copyright (C) 2006 yopyop
Copyright (C) 2008-2025 DeSmuME team Copyright (C) 2008-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -104,6 +104,9 @@ CFIRMWARE *extFirmwareObj = NULL;
std::vector<u32> memReadBreakPoints; std::vector<u32> memReadBreakPoints;
std::vector<u32> memWriteBreakPoints; std::vector<u32> memWriteBreakPoints;
using std::min;
using std::max;
bool singleStep; bool singleStep;
bool nds_debug_continuing[2]; bool nds_debug_continuing[2];
int lagframecounter; int lagframecounter;
@ -314,36 +317,6 @@ RomBanner::RomBanner(bool defaultInit)
memset(end0xFF,0,sizeof(end0xFF)); memset(end0xFF,0,sizeof(end0xFF));
} }
GameInfo::GameInfo()
{
fROM = NULL;
reader = NULL;
romdataForReader = NULL;
romsize = 0;
cardSize = 0;
mask = 0;
crc = 0;
crcForCheatsDb = 0;
chipID = 0x00000FC2;
romType = ROM_NDS;
headerOffset = 0;
memset(&ROMserial[0], 0, sizeof(ROMserial));
memset(&ROMname[0], 0, sizeof(ROMname));
_isDSiEnhanced = false;
memset(&header, 0, sizeof(header));
memset(secureArea, 0, sizeof(secureArea));
memset(&banner, 0, sizeof(banner));
}
GameInfo::~GameInfo()
{
closeROM();
}
bool GameInfo::hasRomBanner() bool GameInfo::hasRomBanner()
{ {
if(header.IconOff + sizeof(RomBanner) > romsize) if(header.IconOff + sizeof(RomBanner) > romsize)
@ -662,8 +635,7 @@ bool GameInfo::isDSiEnhanced()
bool GameInfo::isHomebrew() bool GameInfo::isHomebrew()
{ {
return ((header.ARM9src < 0x4000) && (T1ReadLong(header.logo, 0) != 0x51AEFF24) && (T1ReadLong(header.logo, 4) != 0x699AA221)) || return ((header.ARM9src < 0x4000) && (T1ReadLong(header.logo, 0) != 0x51AEFF24) && (T1ReadLong(header.logo, 4) != 0x699AA221));
(!memcmp(header.gameCode, "####", 4)); // <- ndstool default signature
} }
static int rom_init_path(const char *filename, const char *physicalName, const char *logicalFilename) static int rom_init_path(const char *filename, const char *physicalName, const char *logicalFilename)
@ -748,9 +720,9 @@ int NDS_LoadROM(const char *filename, const char *physicalName, const char *logi
int read = gameInfo.reader->Read(gameInfo.fROM,fROMBuffer,4096); int read = gameInfo.reader->Read(gameInfo.fROM,fROMBuffer,4096);
if(read == 0) break; if(read == 0) break;
if(first && read >= 512) if(first && read >= 512)
gameInfo.crcForCheatsDb = (u32)~crc32(0, fROMBuffer, 512); gameInfo.crcForCheatsDb = ~crc32(0, fROMBuffer, 512);
first = false; first = false;
gameInfo.crc = (u32)crc32(gameInfo.crc, fROMBuffer, read); gameInfo.crc = crc32(gameInfo.crc, fROMBuffer, read);
} }
gameInfo.chipID = 0xC2; // The Manufacturer ID is defined by JEDEC (C2h = Macronix) gameInfo.chipID = 0xC2; // The Manufacturer ID is defined by JEDEC (C2h = Macronix)
@ -806,7 +778,7 @@ int NDS_LoadROM(const char *filename, const char *physicalName, const char *logi
else else
{ {
printf("%s", save_types[sv + 1].descr); printf("%s", save_types[sv + 1].descr);
if (CommonSettings.autodetectBackupMethod == BackupDeviceAutodetectMethod_Advanscene) if (CommonSettings.autodetectBackupMethod == 1)
backup_setManualBackupType(sv + 1); backup_setManualBackupType(sv + 1);
} }
printf("\n\t* ROM crc:\t\t%08X\n", advsc.getCRC32()); printf("\n\t* ROM crc:\t\t%08X\n", advsc.getCRC32());
@ -967,8 +939,6 @@ static const u64 kNever = 0xFFFFFFFFFFFFFFFFULL;
struct TSequenceItem struct TSequenceItem
{ {
virtual ~TSequenceItem() {}
u64 timestamp; u64 timestamp;
u32 param; u32 param;
bool enabled; bool enabled;
@ -1001,8 +971,6 @@ struct TSequenceItem
struct TSequenceItem_GXFIFO : public TSequenceItem struct TSequenceItem_GXFIFO : public TSequenceItem
{ {
virtual ~TSequenceItem_GXFIFO() {}
FORCEINLINE bool isTriggered() FORCEINLINE bool isTriggered()
{ {
return enabled && nds_timer >= MMU.gfx3dCycles; return enabled && nds_timer >= MMU.gfx3dCycles;
@ -1026,8 +994,6 @@ struct TSequenceItem_GXFIFO : public TSequenceItem
template<int procnum, int num> struct TSequenceItem_Timer : public TSequenceItem template<int procnum, int num> struct TSequenceItem_Timer : public TSequenceItem
{ {
virtual ~TSequenceItem_Timer() {}
FORCEINLINE bool isTriggered() FORCEINLINE bool isTriggered()
{ {
return enabled && nds_timer >= nds.timerCycle[procnum][num]; return enabled && nds_timer >= nds.timerCycle[procnum][num];
@ -1096,8 +1062,6 @@ template<int procnum, int num> struct TSequenceItem_Timer : public TSequenceItem
template<int procnum, int chan> struct TSequenceItem_DMA : public TSequenceItem template<int procnum, int chan> struct TSequenceItem_DMA : public TSequenceItem
{ {
DmaController* controller; DmaController* controller;
virtual ~TSequenceItem_DMA() {}
FORCEINLINE bool isTriggered() FORCEINLINE bool isTriggered()
{ {
@ -1157,8 +1121,6 @@ template<int procnum, int chan> struct TSequenceItem_DMA : public TSequenceItem
struct TSequenceItem_ReadSlot1 : public TSequenceItem struct TSequenceItem_ReadSlot1 : public TSequenceItem
{ {
virtual ~TSequenceItem_ReadSlot1() {}
FORCEINLINE bool isTriggered() FORCEINLINE bool isTriggered()
{ {
return enabled && nds_timer >= timestamp; return enabled && nds_timer >= timestamp;
@ -1185,8 +1147,6 @@ struct TSequenceItem_ReadSlot1 : public TSequenceItem
struct TSequenceItem_divider : public TSequenceItem struct TSequenceItem_divider : public TSequenceItem
{ {
virtual ~TSequenceItem_divider() {}
FORCEINLINE bool isTriggered() FORCEINLINE bool isTriggered()
{ {
return MMU.divRunning && nds_timer >= MMU.divCycles; return MMU.divRunning && nds_timer >= MMU.divCycles;
@ -1219,8 +1179,6 @@ struct TSequenceItem_divider : public TSequenceItem
struct TSequenceItem_sqrtunit : public TSequenceItem struct TSequenceItem_sqrtunit : public TSequenceItem
{ {
virtual ~TSequenceItem_sqrtunit() {}
FORCEINLINE bool isTriggered() FORCEINLINE bool isTriggered()
{ {
return MMU.sqrtRunning && nds_timer >= MMU.sqrtCycles; return MMU.sqrtRunning && nds_timer >= MMU.sqrtCycles;
@ -1495,11 +1453,8 @@ static void execHardware_hstart_vblankStart()
//for ARM7, cheats process when a vblank IRQ fires. necessary for AR compatibility and to stop cheats from breaking game boot-ups. //for ARM7, cheats process when a vblank IRQ fires. necessary for AR compatibility and to stop cheats from breaking game boot-ups.
//note that how we process raw cheats is up to us. so we'll do it the same way we used to, elsewhere //note that how we process raw cheats is up to us. so we'll do it the same way we used to, elsewhere
if ( (i == 1) && (cheats != NULL) ) if (i==1 && cheats)
{
cheats->process(CHEAT_TYPE_AR); cheats->process(CHEAT_TYPE_AR);
CHEATS::ResetJitIfNeeded();
}
} }
} }
@ -1698,7 +1653,7 @@ FORCEINLINE u64 _fast_min(u64 a, u64 b)
//you might find that this is faster on a 64bit system; someone should try it //you might find that this is faster on a 64bit system; someone should try it
//http://aggregate.org/MAGIC/#Integer%20Selection //http://aggregate.org/MAGIC/#Integer%20Selection
//u64 ret = (((((s64)(a-b)) >> (64-1)) & (a^b)) ^ b); //u64 ret = (((((s64)(a-b)) >> (64-1)) & (a^b)) ^ b);
//assert(ret==std::min(a,b)); //assert(ret==min(a,b));
//return ret; //return ret;
//but this ends up being the fastest on 32bits //but this ends up being the fastest on 32bits
@ -1940,7 +1895,7 @@ static FORCEINLINE s32 minarmtime(s32 arm9, s32 arm7)
{ {
if(doarm9) if(doarm9)
if(doarm7) if(doarm7)
return std::min(arm9,arm7); return min(arm9,arm7);
else else
return arm9; return arm9;
else else
@ -2004,7 +1959,7 @@ static /*donotinline*/ std::pair<s32,s32> armInnerLoop(
else else
{ {
s32 temp = arm9; s32 temp = arm9;
arm9 = std::min(s32next, arm9 + kIrqWait); arm9 = min(s32next, arm9 + kIrqWait);
nds.idleCycles[0] += arm9-temp; nds.idleCycles[0] += arm9-temp;
if (gxFIFO.size < 255) nds.freezeBus &= ~1; if (gxFIFO.size < 255) nds.freezeBus &= ~1;
} }
@ -2045,7 +2000,7 @@ static /*donotinline*/ std::pair<s32,s32> armInnerLoop(
else else
{ {
s32 temp = arm7; s32 temp = arm7;
arm7 = std::min(s32next, arm7 + kIrqWait); arm7 = min(s32next, arm7 + kIrqWait);
nds.idleCycles[1] += arm7-temp; nds.idleCycles[1] += arm7-temp;
if(arm7 == s32next) if(arm7 == s32next)
{ {
@ -2165,7 +2120,7 @@ void NDS_exec(s32 nb)
//find next work unit: //find next work unit:
u64 next = sequencer.findNext(); u64 next = sequencer.findNext();
next = std::min(next,nds_timer+kMaxWork); //lets set an upper limit for now next = min(next,nds_timer+kMaxWork); //lets set an upper limit for now
//printf("%d\n",(next-nds_timer)); //printf("%d\n",(next-nds_timer));
@ -2241,11 +2196,7 @@ void NDS_exec(s32 nb)
} }
currFrameCounter++; currFrameCounter++;
DEBUG_Notify.NextFrame(); DEBUG_Notify.NextFrame();
if (cheats != NULL) if(cheats) cheats->process(CHEAT_TYPE_INTERNAL);
{
cheats->process(CHEAT_TYPE_INTERNAL);
CHEATS::ResetJitIfNeeded();
}
GDBSTUB_MUTEX_UNLOCK(); GDBSTUB_MUTEX_UNLOCK();
} }
@ -2656,12 +2607,12 @@ bool NDS_FakeBoot()
//perhaps we could automatically boot homebrew to an R4-like device. //perhaps we could automatically boot homebrew to an R4-like device.
_MMU_write32<ARMCPU_ARM9>(0x02FFFE70, 0x5f617267); _MMU_write32<ARMCPU_ARM9>(0x02FFFE70, 0x5f617267);
_MMU_write32<ARMCPU_ARM9>(0x02FFFE74, kCommandline); //(commandline starts here) _MMU_write32<ARMCPU_ARM9>(0x02FFFE74, kCommandline); //(commandline starts here)
_MMU_write32<ARMCPU_ARM9>(0x02FFFE78, (u32)(rompath.size()+1)); _MMU_write32<ARMCPU_ARM9>(0x02FFFE78, rompath.size()+1);
//0x027FFF7C (argc) //0x027FFF7C (argc)
//0x027FFF80 (argv) //0x027FFF80 (argv)
for (size_t i = 0; i < rompath.size(); i++) for(size_t i=0;i<rompath.size();i++)
_MMU_write08<ARMCPU_ARM9>((u32)(kCommandline+i), rompath[i]); _MMU_write08<ARMCPU_ARM9>(kCommandline+i, rompath[i]);
_MMU_write08<ARMCPU_ARM9>((u32)(kCommandline+rompath.size()), 0); _MMU_write08<ARMCPU_ARM9>(kCommandline+rompath.size(), 0);
//-------------------------------- //--------------------------------
//Call the card post_fakeboot hook to perform additional initialization //Call the card post_fakeboot hook to perform additional initialization
@ -2894,14 +2845,14 @@ u16 NDS_getADCTouchPosX(int scrX_lsl4)
{ {
scrX_lsl4 >>= 4; scrX_lsl4 >>= 4;
int rv = ((scrX_lsl4 - TSCal.scr.x1 + 1) * TSCal.adc.width) / TSCal.scr.width + TSCal.adc.x1; int rv = ((scrX_lsl4 - TSCal.scr.x1 + 1) * TSCal.adc.width) / TSCal.scr.width + TSCal.adc.x1;
rv = std::min(0xFFF, std::max(0, rv)); rv = min(0xFFF, max(0, rv));
return (u16)(rv); return (u16)(rv);
} }
u16 NDS_getADCTouchPosY(int scrY_lsl4) u16 NDS_getADCTouchPosY(int scrY_lsl4)
{ {
scrY_lsl4 >>= 4; scrY_lsl4 >>= 4;
int rv = ((scrY_lsl4 - TSCal.scr.y1 + 1) * TSCal.adc.height) / TSCal.scr.height + TSCal.adc.y1; int rv = ((scrY_lsl4 - TSCal.scr.y1 + 1) * TSCal.adc.height) / TSCal.scr.height + TSCal.adc.y1;
rv = std::min(0xFFF, std::max(0, rv)); rv = min(0xFFF, max(0, rv));
return (u16)(rv); return (u16)(rv);
} }
@ -3339,129 +3290,6 @@ void NDS_GetCPULoadAverage(u32 &outLoadAvgARM9, u32 &outLoadAvgARM7)
template void NDS_exec<FALSE>(s32 nb); template void NDS_exec<FALSE>(s32 nb);
template void NDS_exec<TRUE>(s32 nb); template void NDS_exec<TRUE>(s32 nb);
TCommonSettings::TCommonSettings()
{
GFX3D_HighResolutionInterpolateColor = true;
GFX3D_EdgeMark = true;
GFX3D_Fog = true;
GFX3D_Texture = true;
GFX3D_LineHack = true;
GFX3D_Renderer_MultisampleSize = 0;
GFX3D_Renderer_TextureScalingFactor = 1;
GFX3D_Renderer_TextureDeposterize = false;
GFX3D_Renderer_TextureSmoothing = false;
GFX3D_TXTHack = false;
OpenGL_Emulation_ShadowPolygon = true;
OpenGL_Emulation_SpecialZeroAlphaBlending = true;
OpenGL_Emulation_NDSDepthCalculation = true;
OpenGL_Emulation_DepthLEqualPolygonFacing = false;
loadToMemory = false;
UseExtBIOS = false;
strncpy(ARM9BIOS, "biosnds9.bin", MAX_PATH);
strncpy(ARM7BIOS, "biosnds7.bin", MAX_PATH);
SWIFromBIOS = false;
PatchSWI3 = false;
RetailCardProtection8000 = true;
UseExtFirmware = false;
UseExtFirmwareSettings = false;
strncpy(ExtFirmwarePath, "firmware.bin", MAX_PATH);
memset(ExtFirmwareUserSettingsPath, 0, sizeof(ExtFirmwareUserSettingsPath));
BootFromFirmware = false;
ConsoleType = NDS_CONSOLE_TYPE_FAT;
DebugConsole = false;
EnsataEmulation = false;
cheatsDisable = false;
num_cores = NDS_GetCPUCoreCount();
rigorous_timing = false;
gamehacks.en = true;
gamehacks.clear();
StylusPressure = 50;
dispLayers[0][0] = true;
dispLayers[0][1] = true;
dispLayers[0][2] = true;
dispLayers[0][3] = true;
dispLayers[0][4] = true;
dispLayers[1][0] = true;
dispLayers[1][1] = true;
dispLayers[1][2] = true;
dispLayers[1][3] = true;
dispLayers[1][4] = true;
advanced_timing = true;
#ifdef HAVE_JIT
//zero 06-sep-2012 - shouldnt be defaulting this to true for now, since the jit is buggy.
//id rather have people discover a bonus speedhack than discover new bugs in a new version
use_jit = false;
#else
use_jit = false;
#endif
jit_max_block_size = 12;
WifiBridgeDeviceID = 0;
micMode = MicMode_InternalNoise;
spuInterpolationMode = SPUInterpolation_Cosine;
autodetectBackupMethod = BackupDeviceAutodetectMethod_Desmume;
manualBackupType = MC_TYPE_AUTODETECT;
backupSave = false;
SPU_sync_mode = ESynchMode_Synchronous;
SPU_sync_method = ESynchMethod_N;
spu_muteChannels[ 0] = false;
spu_muteChannels[ 1] = false;
spu_muteChannels[ 2] = false;
spu_muteChannels[ 3] = false;
spu_muteChannels[ 4] = false;
spu_muteChannels[ 5] = false;
spu_muteChannels[ 6] = false;
spu_muteChannels[ 7] = false;
spu_muteChannels[ 8] = false;
spu_muteChannels[ 9] = false;
spu_muteChannels[10] = false;
spu_muteChannels[11] = false;
spu_muteChannels[12] = false;
spu_muteChannels[13] = false;
spu_muteChannels[14] = false;
spu_muteChannels[15] = false;
spu_captureMuted = false;
spu_advanced = true;
showGpu.main = true;
showGpu.sub = true;
hud.ShowInputDisplay = false;
hud.ShowGraphicalInputDisplay = false;
hud.FpsDisplay = false;
hud.FrameCounterDisplay = false;
hud.ShowLagFrameCounter = false;
hud.ShowMicrophone = false;
hud.ShowRTC = false;
run_advanscene_import = "";
NDS_SetupDefaultFirmware();
}
bool TCommonSettings::single_core()
{
return (num_cores == 1);
}
void TCommonSettings::GameHacks::apply() void TCommonSettings::GameHacks::apply()
{ {
clear(); clear();

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2006 yopyop Copyright (C) 2006 yopyop
Copyright (C) 2008-2025 DeSmuME team Copyright (C) 2008-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -112,7 +112,7 @@ enum NDSErrorTag
NDSErrorTag_None = 0, NDSErrorTag_None = 0,
NDSErrorTag_ARM9 = 1, NDSErrorTag_ARM9 = 1,
NDSErrorTag_ARM7 = 2, NDSErrorTag_ARM7 = 2,
NDSErrorTag_BothCPUs = 3 NDSErrorTag_BothCPUs = 3,
}; };
struct NDSError struct NDSError
@ -346,11 +346,26 @@ struct GameInfo
NDS_header header; NDS_header header;
//a copy of the pristine secure area from the rom //a copy of the pristine secure area from the rom
u8 secureArea[0x4000]; u8 secureArea[0x4000];
RomBanner banner; RomBanner banner;
const RomBanner& getRomBanner(); const RomBanner& getRomBanner();
GameInfo(); GameInfo() : fROM(NULL),
~GameInfo(); romdataForReader(NULL),
crc(0),
chipID(0x00000FC2),
romsize(0),
cardSize(0),
mask(0),
romType(ROM_NDS),
headerOffset(0),
_isDSiEnhanced(false)
{
memset(&header, 0, sizeof(header));
memset(&ROMserial[0], 0, sizeof(ROMserial));
memset(&ROMname[0], 0, sizeof(ROMname));
}
~GameInfo() { closeROM(); }
bool IsCode(const char* code) const; bool IsCode(const char* code) const;
@ -362,6 +377,7 @@ struct GameInfo
bool isDSiEnhanced(); bool isDSiEnhanced();
bool isHomebrew(); bool isHomebrew();
bool hasRomBanner(); bool hasRomBanner();
}; };
typedef struct TSCalInfo typedef struct TSCalInfo
@ -479,16 +495,71 @@ template<bool FORCE> void NDS_exec(s32 nb = 560190<<1);
extern int lagframecounter; extern int lagframecounter;
enum MicMode
{
MicMode_InternalNoise = 0,
MicMode_Sample = 1,
MicMode_Random = 2,
MicMode_Physical = 3
};
extern struct TCommonSettings extern struct TCommonSettings
{ {
TCommonSettings()
: GFX3D_HighResolutionInterpolateColor(true)
, GFX3D_EdgeMark(true)
, GFX3D_Fog(true)
, GFX3D_Texture(true)
, GFX3D_LineHack(true)
, GFX3D_Renderer_MultisampleSize(0)
, GFX3D_Renderer_TextureScalingFactor(1) // Possible values: 1, 2, 4
, GFX3D_Renderer_TextureDeposterize(false)
, GFX3D_Renderer_TextureSmoothing(false)
, GFX3D_TXTHack(false)
, OpenGL_Emulation_ShadowPolygon(true)
, OpenGL_Emulation_SpecialZeroAlphaBlending(true)
, OpenGL_Emulation_NDSDepthCalculation(true)
, OpenGL_Emulation_DepthLEqualPolygonFacing(false)
, jit_max_block_size(12)
, loadToMemory(false)
, UseExtBIOS(false)
, SWIFromBIOS(false)
, PatchSWI3(false)
, UseExtFirmware(false)
, UseExtFirmwareSettings(false)
, RetailCardProtection8000(true)
, BootFromFirmware(false)
, DebugConsole(false)
, EnsataEmulation(false)
, cheatsDisable(false)
, rigorous_timing(false)
, advanced_timing(true)
, micMode(InternalNoise)
, spuInterpolationMode(2)
, manualBackupType(0)
, autodetectBackupMethod(0)
, spu_captureMuted(false)
, spu_advanced(true)
, StylusPressure(50)
, ConsoleType(NDS_CONSOLE_TYPE_FAT)
, backupSave(false)
, SPU_sync_mode(1)
, SPU_sync_method(0)
, WifiBridgeDeviceID(0)
{
strcpy(ARM9BIOS, "biosnds9.bin");
strcpy(ARM7BIOS, "biosnds7.bin");
strcpy(ExtFirmwarePath, "firmware.bin");
for(int i=0;i<16;i++)
spu_muteChannels[i] = false;
for(int g=0;g<2;g++)
for(int x=0;x<5;x++)
dispLayers[g][x]=true;
#ifdef HAVE_JIT
//zero 06-sep-2012 - shouldnt be defaulting this to true for now, since the jit is buggy.
//id rather have people discover a bonus speedhack than discover new bugs in a new version
use_jit = false;
#else
use_jit = false;
#endif
num_cores = NDS_GetCPUCoreCount();
NDS_SetupDefaultFirmware();
}
bool GFX3D_HighResolutionInterpolateColor; bool GFX3D_HighResolutionInterpolateColor;
bool GFX3D_EdgeMark; bool GFX3D_EdgeMark;
bool GFX3D_Fog; bool GFX3D_Fog;
@ -528,14 +599,18 @@ extern struct TCommonSettings
bool cheatsDisable; bool cheatsDisable;
int num_cores; int num_cores;
bool single_core() { return num_cores==1; }
bool rigorous_timing; bool rigorous_timing;
struct GameHacks struct GameHacks {
{ GameHacks()
: en(true)
{
clear();
}
bool en; bool en;
struct struct {
{
bool overclock; bool overclock;
bool stylusjitter; bool stylusjitter;
} flags; } flags;
@ -555,7 +630,15 @@ extern struct TCommonSettings
int WifiBridgeDeviceID; int WifiBridgeDeviceID;
MicMode micMode; enum MicMode
{
InternalNoise = 0,
Sample = 1,
Random = 2,
Physical = 3
} micMode;
int spuInterpolationMode; int spuInterpolationMode;
//this is a temporary hack until we straighten out the flushing logic and/or gxfifo //this is a temporary hack until we straighten out the flushing logic and/or gxfifo
@ -573,27 +656,29 @@ extern struct TCommonSettings
bool spu_captureMuted; bool spu_captureMuted;
bool spu_advanced; bool spu_advanced;
union struct _ShowGpu {
{ _ShowGpu() : main(true), sub(true) {}
struct { bool main, sub; }; union {
bool screens[2]; struct { bool main,sub; };
bool screens[2];
};
} showGpu; } showGpu;
struct _Hud struct _Hud {
{ _Hud()
bool ShowInputDisplay; : ShowInputDisplay(false)
bool ShowGraphicalInputDisplay; , ShowGraphicalInputDisplay(false)
bool FpsDisplay; , FpsDisplay(false)
bool FrameCounterDisplay; , FrameCounterDisplay(false)
bool ShowLagFrameCounter; , ShowLagFrameCounter(false)
bool ShowMicrophone; , ShowMicrophone(false)
bool ShowRTC; , ShowRTC(false)
{}
bool ShowInputDisplay, ShowGraphicalInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone, ShowRTC;
} hud; } hud;
std::string run_advanscene_import; std::string run_advanscene_import;
TCommonSettings();
bool single_core();
} CommonSettings; } CommonSettings;
void NDS_RunAdvansceneAutoImport(); void NDS_RunAdvansceneAutoImport();

3364
desmume/src/OGLRender.cpp Normal file → Executable file

File diff suppressed because it is too large Load Diff

2043
desmume/src/OGLRender.h Normal file → Executable file

File diff suppressed because it is too large Load Diff

3001
desmume/src/OGLRender_3_2.cpp Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* /*
Copyright (C) 2006 yopyop Copyright (C) 2006 yopyop
Copyright (C) 2006-2007 shash Copyright (C) 2006-2007 shash
Copyright (C) 2008-2024 DeSmuME team Copyright (C) 2008-2019 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -20,106 +20,61 @@
#ifndef OGLRENDER_3_2_H #ifndef OGLRENDER_3_2_H
#define OGLRENDER_3_2_H #define OGLRENDER_3_2_H
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glcorearb.h>
#define OGLEXT(procPtr, func) procPtr func = NULL;
#define INITOGLEXT(procPtr, func) func = (procPtr)wglGetProcAddress(#func);
#define EXTERNOGLEXT(procPtr, func) extern procPtr func;
#elif defined(__APPLE__)
#include <OpenGL/gl3.h>
#include <OpenGL/gl3ext.h>
// Ignore dynamic linking on Apple OS
#define OGLEXT(procPtr, func)
#define INITOGLEXT(procPtr, func)
#define EXTERNOGLEXT(procPtr, func)
#else
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glx.h>
#include "utils/glcorearb.h"
#define OGLEXT(procPtr, func) procPtr func = NULL;
#define INITOGLEXT(procPtr, func) func = (procPtr)glXGetProcAddress((const GLubyte *) #func);
#define EXTERNOGLEXT(procPtr, func) extern procPtr func;
#endif
// Check minimum OpenGL header version
#if !defined(GL_VERSION_3_2)
#error OpenGL requires v3.2 headers or later.
#endif
#include "OGLRender.h" #include "OGLRender.h"
#define MAX_CLIPPED_POLY_COUNT_FOR_UBO 16384 #define MAX_CLIPPED_POLY_COUNT_FOR_UBO 16384
extern const char *GeometryVtxShader_150;
extern const char *GeometryFragShader_150;
extern const char *GeometryZeroDstAlphaPixelMaskVtxShader_150;
extern const char *GeometryZeroDstAlphaPixelMaskFragShader_150;
extern const char *MSGeometryZeroDstAlphaPixelMaskFragShader_150;
extern const char *ClearImageVtxShader_150;
extern const char *ClearImageFragShader_150;
extern const char *EdgeMarkVtxShader_150;
extern const char *EdgeMarkFragShader_150;
extern const char *FogVtxShader_150;
extern const char *FogFragShader_150;
extern const char *FramebufferOutputVtxShader_150;
extern const char *FramebufferOutput6665FragShader_150;
// A port that wants to use the OpenGL 3.2 renderer must assign the two following functions
// to OGLLoadEntryPoints_3_2_Func and OGLCreateRenderer_3_2_Func, respectively.
//
// In addition, the port must add the following GPU3DInterface objects to core3DList:
// - gpu3Dgl: Automatically selects the most fully featured version of standard OpenGL that
// is available on the host system, prefering OpenGL 3.2 Core Profile.
// - gpu3Dgl_3_2: Selects the OpenGL 3.2 Core Profile renderer, and returns an error if it
// is not available on the host system.
//
// Finally, the port must call GPU->Set3DRendererByID() and pass in the index where
// gpu3Dgl_3_2 exists in core3DList so that the emulator can create the appropriate
// OpenGLRenderer object.
//
// Example code:
// OGLLoadEntryPoints_3_2_Func = &OGLLoadEntryPoints_3_2;
// OGLCreateRenderer_3_2_Func = &OGLCreateRenderer_3_2;
// GPU3DInterface *core3DList[] = { &gpu3DNull, &gpu3DRasterize, &gpu3Dgl_3_2, NULL };
// GPU->Set3DRendererByID(2);
void OGLLoadEntryPoints_3_2(); void OGLLoadEntryPoints_3_2();
void OGLCreateRenderer_3_2(OpenGLRenderer **rendererPtr); void OGLCreateRenderer_3_2(OpenGLRenderer **rendererPtr);
class OpenGLGeometryResource : public Render3DResourceGeometry
{
protected:
GLuint _vboID[3];
GLuint _eboID[3];
GLuint _vaoID[3];
GLuint _uboPolyStatesID[3];
GLuint _tboPolyStatesID[3];
GLuint _texPolyStatesID[3];
GLsync _syncGeometryRender[3];
u16 *_indexBuffer[3];
OGLPolyStates *_polyStatesBuffer[3];
public:
OpenGLGeometryResource(const OpenGLVariantID variantID);
~OpenGLGeometryResource();
size_t BindWrite(const size_t rawVtxCount, const size_t clippedPolyCount);
size_t BindUsage();
size_t UnbindUsage();
size_t RebindUsage();
u16* GetIndexBuffer(const size_t index);
OGLPolyStates* GetPolyStatesBuffer(const size_t index);
bool IsPolyStatesBufferUBO();
bool IsPolyStatesBufferTBO();
};
class OpenGLRenderStatesResource : public Render3DResource
{
protected:
GLsync _sync[3];
GLuint _uboRenderStatesID[3];
OGLRenderStates *_buffer[3];
public:
OpenGLRenderStatesResource();
~OpenGLRenderStatesResource();
size_t BindWrite();
size_t BindUsage();
size_t UnbindUsage();
OGLRenderStates* GetRenderStatesBuffer(const size_t index);
};
class OpenGLRenderer_3_2 : public OpenGLRenderer_2_1 class OpenGLRenderer_3_2 : public OpenGLRenderer_2_1
{ {
protected: protected:
bool _isShaderFixedLocationSupported; bool _is64kUBOSupported;
bool _isDualSourceBlendingSupported;
bool _isSampleShadingSupported;
bool _isConservativeDepthSupported; bool _isConservativeDepthSupported;
bool _isConservativeDepthAMDSupported; bool _isConservativeDepthAMDSupported;
OpenGLGeometryResource *_gResource; GLsync _syncBufferSetup;
OpenGLRenderStatesResource *_rsResource; CACHE_ALIGN OGLPolyStates _pendingPolyStates[POLYLIST_SIZE];
virtual Render3DError InitExtensions();
virtual Render3DError CreateVBOs();
virtual Render3DError CreatePBOs();
virtual Render3DError CreateFBOs(); virtual Render3DError CreateFBOs();
virtual void DestroyFBOs(); virtual void DestroyFBOs();
virtual Render3DError CreateMultisampledFBO(GLsizei numSamples); virtual Render3DError CreateMultisampledFBO(GLsizei numSamples);
@ -129,48 +84,40 @@ protected:
virtual void DestroyVAOs(); virtual void DestroyVAOs();
virtual Render3DError CreateGeometryPrograms(); virtual Render3DError CreateGeometryPrograms();
virtual Render3DError CreateClearImageProgram(const char *vsCString, const char *fsCString); virtual void DestroyGeometryPrograms();
virtual void DestroyClearImageProgram();
virtual Render3DError CreateGeometryZeroDstAlphaProgram(const char *vtxShaderCString, const char *fragShaderCString); virtual Render3DError CreateGeometryZeroDstAlphaProgram(const char *vtxShaderCString, const char *fragShaderCString);
virtual Render3DError CreateMSGeometryZeroDstAlphaProgram(const char *vtxShaderCString, const char *fragShaderCString); virtual Render3DError CreateMSGeometryZeroDstAlphaProgram(const char *vtxShaderCString, const char *fragShaderCString);
virtual void DestroyMSGeometryZeroDstAlphaProgram(); virtual void DestroyMSGeometryZeroDstAlphaProgram();
virtual Render3DError CreateEdgeMarkProgram(const bool isMultisample, const char *vtxShaderCString, const char *fragShaderCString); virtual Render3DError CreateEdgeMarkProgram(const char *vtxShaderCString, const char *fragShaderCString);
virtual Render3DError CreateFogProgram(const OGLFogProgramKey fogProgramKey, const bool isMultisample, const char *vtxShaderCString, const char *fragShaderCString); virtual Render3DError CreateFogProgram(const OGLFogProgramKey fogProgramKey, const char *vtxShaderCString, const char *fragShaderCString);
virtual Render3DError CreateFramebufferOutput6665Program(const char *vtxShaderCString, const char *fragShaderCString); virtual Render3DError CreateFramebufferOutput6665Program(const size_t outColorIndex, const char *vtxShaderCString, const char *fragShaderCString);
virtual Render3DError CreateFramebufferOutput8888Program(const char *vtxShaderCString, const char *fragShaderCString); virtual Render3DError CreateFramebufferOutput8888Program(const size_t outColorIndex, const char *vtxShaderCString, const char *fragShaderCString);
virtual void GetExtensionSet(std::set<std::string> *oglExtensionSet); virtual void GetExtensionSet(std::set<std::string> *oglExtensionSet);
virtual Render3DError InitFinalRenderStates(const std::set<std::string> *oglExtensionSet);
virtual void _SetupGeometryShaders(const OGLGeometryFlags flags); virtual void _SetupGeometryShaders(const OGLGeometryFlags flags);
virtual void _RenderGeometryVertexAttribEnable(); virtual Render3DError EnableVertexAttributes();
virtual void _RenderGeometryVertexAttribDisable(); virtual Render3DError DisableVertexAttributes();
virtual Render3DError ZeroDstAlphaPass(const POLY *rawPolyList, const CPoly *clippedPolyList, const size_t clippedPolyCount, const size_t clippedPolyOpaqueCount, bool enableAlphaBlending, size_t indexOffset, POLYGON_ATTR lastPolyAttr); virtual Render3DError ZeroDstAlphaPass(const CPoly *clippedPolyList, const size_t clippedPolyCount, bool enableAlphaBlending, size_t indexOffset, POLYGON_ATTR lastPolyAttr);
virtual void _RenderGeometryLoopBegin();
virtual void _RenderGeometryLoopEnd();
virtual void _ResolveWorkingBackFacing(); virtual void _ResolveWorkingBackFacing();
virtual void _ResolveGeometry(); virtual void _ResolveGeometry();
virtual void _ResolveFinalFramebuffer(); virtual Render3DError ReadBackPixels();
virtual void _FramebufferProcessVertexAttribEnable(); virtual Render3DError BeginRender(const GFX3D &engine);
virtual void _FramebufferProcessVertexAttribDisable();
virtual Render3DError _FramebufferConvertColorFormat();
virtual Render3DError BeginRender(const GFX3D_State &renderState, const GFX3D_GeometryList &renderGList);
virtual Render3DError PostprocessFramebuffer(); virtual Render3DError PostprocessFramebuffer();
virtual Render3DError ClearUsingImage(const u16 *__restrict colorBuffer, const u32 *__restrict depthBuffer, const u8 *__restrict fogBuffer, const u8 opaquePolyID); virtual Render3DError ClearUsingImage(const u16 *__restrict colorBuffer, const u32 *__restrict depthBuffer, const u8 *__restrict fogBuffer, const u8 opaquePolyID);
virtual Render3DError ClearUsingValues(const Color4u8 &clearColor6665, const FragmentAttributes &clearAttributes); virtual Render3DError ClearUsingValues(const FragmentColor &clearColor6665, const FragmentAttributes &clearAttributes);
virtual void SetPolygonIndex(const size_t index); virtual void SetPolygonIndex(const size_t index);
virtual Render3DError SetupPolygon(const POLY &thePoly, bool treatAsTranslucent, bool willChangeStencilBuffer, bool isBackFacing); virtual Render3DError SetupPolygon(const POLY &thePoly, bool treatAsTranslucent, bool willChangeStencilBuffer);
virtual Render3DError SetupTexture(const POLY &thePoly, size_t polyRenderIndex); virtual Render3DError SetupTexture(const POLY &thePoly, size_t polyRenderIndex);
virtual Render3DError SetFramebufferSize(size_t w, size_t h);
public: public:
OpenGLRenderer_3_2(); OpenGLRenderer_3_2();
~OpenGLRenderer_3_2(); ~OpenGLRenderer_3_2();
virtual Render3DError InitExtensions();
virtual Render3DError RenderFinish();
virtual Render3DError RenderPowerOff(); virtual Render3DError RenderPowerOff();
virtual Render3DError SetFramebufferSize(size_t w, size_t h);
}; };
#endif #endif

View File

@ -1,963 +0,0 @@
/*
Copyright (C) 2024 DeSmuME team
This file 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 file 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 the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "OGLRender_ES3.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <string>
#include <sstream>
#include "utils/bits.h"
#include "common.h"
#include "debug.h"
#include "NDSSystem.h"
static const GLenum GeometryDrawBuffersEnumES[8][4] = {
{ OGL_COLOROUT_ATTACHMENT_ID, GL_NONE, GL_NONE, GL_NONE },
{ OGL_COLOROUT_ATTACHMENT_ID, GL_NONE, GL_NONE, OGL_FOGATTRIBUTES_ATTACHMENT_ID },
{ OGL_COLOROUT_ATTACHMENT_ID, GL_NONE, OGL_POLYID_ATTACHMENT_ID, GL_NONE },
{ OGL_COLOROUT_ATTACHMENT_ID, GL_NONE, OGL_POLYID_ATTACHMENT_ID, OGL_FOGATTRIBUTES_ATTACHMENT_ID },
{ OGL_COLOROUT_ATTACHMENT_ID, OGL_WORKING_ATTACHMENT_ID, GL_NONE, GL_NONE },
{ OGL_COLOROUT_ATTACHMENT_ID, OGL_WORKING_ATTACHMENT_ID, GL_NONE, OGL_FOGATTRIBUTES_ATTACHMENT_ID },
{ OGL_COLOROUT_ATTACHMENT_ID, OGL_WORKING_ATTACHMENT_ID, OGL_POLYID_ATTACHMENT_ID, GL_NONE },
{ OGL_COLOROUT_ATTACHMENT_ID, OGL_WORKING_ATTACHMENT_ID, OGL_POLYID_ATTACHMENT_ID, OGL_FOGATTRIBUTES_ATTACHMENT_ID }
};
static const GLint GeometryAttachmentWorkingBufferES[8] = { 1,1,1,1,1,1,1,1 };
static const GLint GeometryAttachmentPolyIDES[8] = { 2,2,2,2,2,2,2,2 };
static const GLint GeometryAttachmentFogAttributesES[8] = { 3,3,3,3,3,3,3,3 };
// Vertex shader for geometry, GLSL ES 3.00
static const char *GeometryVtxShader_ES300 = {"\
IN_VTX_POSITION vec4 inPosition;\n\
IN_VTX_TEXCOORD0 vec2 inTexCoord0;\n\
IN_VTX_COLOR vec3 inColor; \n\
\n\
#if IS_USING_UBO_POLY_STATES\n\
layout (std140) uniform PolyStates\n\
{\n\
ivec4 value[4096];\n\
} polyState;\n\
#elif IS_USING_TBO_POLY_STATES\n\
uniform highp isamplerBuffer PolyStates;\n\
#else\n\
uniform highp isampler2D PolyStates;\n\
#endif\n\
uniform mediump int polyIndex;\n\
uniform bool polyDrawShadow;\n\
\n\
out vec2 vtxTexCoord;\n\
out vec4 vtxColor;\n\
flat out lowp int polyID;\n\
flat out lowp int polyMode;\n\
flat out lowp int polyIsWireframe;\n\
flat out lowp int polyEnableFog;\n\
flat out lowp int polySetNewDepthForTranslucent;\n\
flat out lowp int polyEnableTexture;\n\
flat out lowp int texSingleBitAlpha;\n\
flat out lowp int polyIsBackFacing;\n\
flat out lowp int isPolyDrawable;\n\
\n\
void main()\n\
{\n\
#if IS_USING_UBO_POLY_STATES\n\
ivec4 polyStateVec = polyState.value[polyIndex >> 2];\n\
int polyStateBits = polyStateVec[polyIndex & 0x03];\n\
#elif IS_USING_TBO_POLY_STATES\n\
int polyStateBits = texelFetch(PolyStates, polyIndex).r;\n\
#else\n\
int polyStateBits = texelFetch(PolyStates, ivec2(polyIndex & 0x00FF, (polyIndex >> 8) & 0x007F), 0).r;\n\
#endif\n\
int texSizeShiftS = (polyStateBits >> 18) & 0x07;\n\
int texSizeShiftT = (polyStateBits >> 21) & 0x07;\n\
\n\
float polyAlpha = float((polyStateBits >> 8) & 0x1F) / 31.0;\n\
vec2 polyTexScale = vec2(1.0 / float(8 << texSizeShiftS), 1.0 / float(8 << texSizeShiftT));\n\
\n\
polyID = (polyStateBits >> 0) & 0x3F;\n\
polyMode = (polyStateBits >> 6) & 0x03;\n\
polyIsWireframe = (polyStateBits >> 13) & 0x01;\n\
polyEnableFog = (polyStateBits >> 14) & 0x01;\n\
polySetNewDepthForTranslucent = (polyStateBits >> 15) & 0x01;\n\
polyEnableTexture = (polyStateBits >> 16) & 0x01;\n\
texSingleBitAlpha = (polyStateBits >> 17) & 0x01;\n\
polyIsBackFacing = (polyStateBits >> 24) & 0x01;\n\
\n\
isPolyDrawable = int((polyMode != 3) || polyDrawShadow);\n\
\n\
mat2 texScaleMtx = mat2( vec2(polyTexScale.x, 0.0), \n\
vec2( 0.0, polyTexScale.y)); \n\
\n\
vtxTexCoord = (texScaleMtx * inTexCoord0) / 16.0;\n\
vtxColor = vec4(inColor / 63.0, polyAlpha);\n\
gl_Position = vec4(inPosition.x, -inPosition.y, inPosition.z, inPosition.w) / 4096.0;\n\
}\n\
"};
// Fragment shader for geometry, GLSL ES 3.00
static const char *GeometryFragShader_ES300 = {"\
in vec2 vtxTexCoord;\n\
in vec4 vtxColor;\n\
flat in lowp int polyID;\n\
flat in lowp int polyMode;\n\
flat in lowp int polyIsWireframe;\n\
flat in lowp int polyEnableFog;\n\
flat in lowp int polySetNewDepthForTranslucent;\n\
flat in lowp int polyEnableTexture;\n\
flat in lowp int texSingleBitAlpha;\n\
flat in lowp int polyIsBackFacing;\n\
flat in lowp int isPolyDrawable;\n\
\n\
layout (std140) uniform RenderStates\n\
{\n\
bool enableAntialiasing;\n\
bool enableFogAlphaOnly;\n\
int clearPolyID;\n\
float clearDepth;\n\
float alphaTestRef;\n\
float fogOffset;\n\
float fogStep;\n\
float pad_0;\n\
vec4 fogColor;\n\
vec4 edgeColor[8];\n\
vec4 toonColor[32];\n\
} state;\n\
\n\
uniform sampler2D texRenderObject;\n\
uniform bool texDrawOpaque;\n\
uniform bool drawModeDepthEqualsTest;\n\
uniform bool polyDrawShadow;\n\
uniform float polyDepthOffset;\n\
\n\
OUT_COLOR vec4 outFragColor;\n\
\n\
#if DRAW_MODE_OPAQUE\n\
OUT_WORKING_BUFFER vec4 outDstBackFacing;\n\
#elif USE_DEPTH_LEQUAL_POLYGON_FACING\n\
uniform sampler2D inDstBackFacing;\n\
#endif\n\
\n\
#if ENABLE_EDGE_MARK\n\
OUT_POLY_ID vec4 outPolyID;\n\
#endif\n\
#if ENABLE_FOG\n\
OUT_FOG_ATTRIBUTES vec4 outFogAttributes;\n\
#endif\n\
\n\
void main()\n\
{\n\
#if USE_DEPTH_LEQUAL_POLYGON_FACING && !DRAW_MODE_OPAQUE\n\
bool isOpaqueDstBackFacing = bool( texelFetch(inDstBackFacing, ivec2(gl_FragCoord.xy), 0).r );\n\
if ( drawModeDepthEqualsTest && (bool(polyIsBackFacing) || !isOpaqueDstBackFacing) )\n\
{\n\
discard;\n\
}\n\
#endif\n\
\n\
vec4 mainTexColor = (ENABLE_TEXTURE_SAMPLING && bool(polyEnableTexture)) ? texture(texRenderObject, vtxTexCoord) : vec4(1.0, 1.0, 1.0, 1.0);\n\
\n\
if (!bool(texSingleBitAlpha))\n\
{\n\
if (texDrawOpaque)\n\
{\n\
if ( (polyMode != 1) && (mainTexColor.a <= 0.999) )\n\
{\n\
discard;\n\
}\n\
}\n\
else\n\
{\n\
if ( ((polyMode != 1) && (mainTexColor.a * vtxColor.a > 0.999)) || ((polyMode == 1) && (vtxColor.a > 0.999)) )\n\
{\n\
discard;\n\
}\n\
}\n\
}\n\
#if USE_TEXTURE_SMOOTHING\n\
else\n\
{\n\
if (mainTexColor.a < 0.500)\n\
{\n\
mainTexColor.a = 0.0;\n\
}\n\
else\n\
{\n\
mainTexColor.rgb = mainTexColor.rgb / mainTexColor.a;\n\
mainTexColor.a = 1.0;\n\
}\n\
}\n\
#endif\n\
\n\
outFragColor = mainTexColor * vtxColor;\n\
\n\
if (polyMode == 1)\n\
{\n\
outFragColor.rgb = (ENABLE_TEXTURE_SAMPLING && bool(polyEnableTexture)) ? mix(vtxColor.rgb, mainTexColor.rgb, mainTexColor.a) : vtxColor.rgb;\n\
outFragColor.a = vtxColor.a;\n\
}\n\
else if (polyMode == 2)\n\
{\n\
vec3 newToonColor = state.toonColor[int((vtxColor.r * 31.0) + 0.5)].rgb;\n\
#if TOON_SHADING_MODE\n\
outFragColor.rgb = min((mainTexColor.rgb * vtxColor.r) + newToonColor.rgb, 1.0);\n\
#else\n\
outFragColor.rgb = mainTexColor.rgb * newToonColor.rgb;\n\
#endif\n\
}\n\
else if ((polyMode == 3) && polyDrawShadow)\n\
{\n\
outFragColor = vtxColor;\n\
}\n\
\n\
if ( (isPolyDrawable != 0) && ((outFragColor.a < 0.001) || (ENABLE_ALPHA_TEST && outFragColor.a < state.alphaTestRef)) )\n\
{\n\
discard;\n\
}\n\
#if ENABLE_EDGE_MARK\n\
outPolyID = (isPolyDrawable != 0) ? vec4( float(polyID)/63.0, float(polyIsWireframe == 1), 0.0, float(outFragColor.a > 0.999) ) : vec4(0.0, 0.0, 0.0, 0.0);\n\
#endif\n\
#if ENABLE_FOG\n\
outFogAttributes = (isPolyDrawable != 0) ? vec4( float(polyEnableFog), 0.0, 0.0, float((outFragColor.a > 0.999) ? 1.0 : 0.5) ) : vec4(0.0, 0.0, 0.0, 0.0);\n\
#endif\n\
#if DRAW_MODE_OPAQUE\n\
outDstBackFacing = vec4(float(polyIsBackFacing), 0.0, 0.0, 1.0);\n\
#endif\n\
\n\
#if USE_NDS_DEPTH_CALCULATION || ENABLE_FOG\n\
// It is tempting to perform the NDS depth calculation in the vertex shader rather than in the fragment shader.\n\
// Resist this temptation! It is much more reliable to do the depth calculation in the fragment shader due to\n\
// subtle interpolation differences between various GPUs and/or drivers. If the depth calculation is not done\n\
// here, then it is very possible for the user to experience Z-fighting in certain rendering situations.\n\
\n\
#if ENABLE_W_DEPTH\n\
gl_FragDepth = clamp( ((1.0/gl_FragCoord.w) * (4096.0/16777215.0)) + polyDepthOffset, 0.0, 1.0 );\n\
#else\n\
// hack: when using z-depth, drop some LSBs so that the overworld map in Dragon Quest IV shows up correctly\n\
gl_FragDepth = clamp( (floor(gl_FragCoord.z * 4194303.0) * (4.0/16777215.0)) + polyDepthOffset, 0.0, 1.0 );\n\
#endif\n\
#endif\n\
}\n\
"};
void OGLLoadEntryPoints_ES_3_0()
{
OGLLoadEntryPoints_3_2();
}
void OGLCreateRenderer_ES_3_0(OpenGLRenderer **rendererPtr)
{
if (IsOpenGLDriverVersionSupported(3, 0, 0))
{
*rendererPtr = new OpenGLESRenderer_3_0;
(*rendererPtr)->SetVersion(3, 0, 0);
}
}
OpenGLESRenderer_3_0::OpenGLESRenderer_3_0()
{
_variantID = OpenGLVariantID_ES3_3_0;
_geometryDrawBuffersEnum = GeometryDrawBuffersEnumES;
_geometryAttachmentWorkingBuffer = GeometryAttachmentWorkingBufferES;
_geometryAttachmentPolyID = GeometryAttachmentPolyIDES;
_geometryAttachmentFogAttributes = GeometryAttachmentFogAttributesES;
ref->textureSrcTypeCIColor = GL_UNSIGNED_BYTE;
ref->textureSrcTypeCIFog = GL_UNSIGNED_BYTE;
ref->textureSrcTypeEdgeColor = GL_UNSIGNED_BYTE;
ref->textureSrcTypeToonTable = GL_UNSIGNED_BYTE;
}
Render3DError OpenGLESRenderer_3_0::InitExtensions()
{
OGLRenderRef &OGLRef = *this->ref;
Render3DError error = OGLERROR_NOERR;
// Get OpenGL extensions
std::set<std::string> oglExtensionSet;
this->GetExtensionSet(&oglExtensionSet);
// OpenGL ES 3.0 should fully support FBOs, so we don't need the default framebuffer.
// However, OpenGL ES has traditionally required some kind of surface buffer attached
// to the context before using it. We don't want it, nor would we ever use it here.
// Therefore, check if our context supports being surfaceless before doing anything else,
// as this works as a kind of compatibility check.
if (!this->IsExtensionPresent(&oglExtensionSet, "GL_OES_surfaceless_context"))
{
INFO("OpenGL ES: Client contexts are not expected to have any surfaces attached\n");
INFO(" to the default framebuffer. The fact that the context does not\n");
INFO(" work surfaceless may indicate an error in the context creation,\n");
INFO(" or that your platform's context creation is too old.\n");
error = OGLERROR_FEATURE_UNSUPPORTED;
return error;
}
// Mirrored Repeat Mode Support
OGLRef.stateTexMirroredRepeat = GL_MIRRORED_REPEAT;
// Blending Support
this->_isBlendFuncSeparateSupported = true;
this->_isBlendEquationSeparateSupported = true;
// Fixed locations in shaders are supported in ES 3.0 by default.
this->_isShaderFixedLocationSupported = true;
GLfloat maxAnisotropyOGL = 1.0f;
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropyOGL);
this->_deviceInfo.maxAnisotropy = (float)maxAnisotropyOGL;
// OpenGL ES 3.0 should be able to handle the GL_RGBA format in glReadPixels without any performance penalty.
OGLRef.readPixelsBestFormat = GL_RGBA;
OGLRef.readPixelsBestDataType = GL_UNSIGNED_BYTE;
this->_deviceInfo.isEdgeMarkSupported = true;
this->_deviceInfo.isFogSupported = true;
// Need to generate this texture first because FBO creation needs it.
// This texture is only required by shaders, and so if shader creation
// fails, then we can immediately delete this texture if an error occurs.
glGenTextures(1, &OGLRef.texFinalColorID);
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_FinalColor);
glBindTexture(GL_TEXTURE_2D, OGLRef.texFinalColorID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, (GLsizei)this->_framebufferWidth, (GLsizei)this->_framebufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glActiveTexture(GL_TEXTURE0);
// OpenGL ES 3.0 should have all the necessary features to be able to flip and convert the framebuffer.
this->_willConvertFramebufferOnGPU = true;
this->_enableTextureSmoothing = CommonSettings.GFX3D_Renderer_TextureSmoothing;
this->_emulateShadowPolygon = CommonSettings.OpenGL_Emulation_ShadowPolygon;
this->_emulateSpecialZeroAlphaBlending = CommonSettings.OpenGL_Emulation_SpecialZeroAlphaBlending;
this->_emulateNDSDepthCalculation = CommonSettings.OpenGL_Emulation_NDSDepthCalculation;
this->_emulateDepthLEqualPolygonFacing = CommonSettings.OpenGL_Emulation_DepthLEqualPolygonFacing;
// Load and create shaders. Return on any error, since ES 3.0 makes shaders mandatory.
this->isShaderSupported = true;
this->_rsResource = new OpenGLRenderStatesResource();
if (IsOpenGLDriverVersionSupported(3, 2, 0))
{
this->_gResource = new OpenGLGeometryResource(OpenGLVariantID_ES3_3_2);
}
else if (IsOpenGLDriverVersionSupported(3, 1, 0))
{
this->_gResource = new OpenGLGeometryResource(OpenGLVariantID_ES3_3_1);
}
else
{
this->_gResource = new OpenGLGeometryResource(OpenGLVariantID_ES3_3_0);
}
error = this->CreateGeometryPrograms();
if (error != OGLERROR_NOERR)
{
glUseProgram(0);
this->DestroyGeometryPrograms();
this->isShaderSupported = false;
return error;
}
error = this->CreateClearImageProgram(ClearImageVtxShader_150, ClearImageFragShader_150);
if (error != OGLERROR_NOERR)
{
glUseProgram(0);
this->DestroyGeometryPrograms();
this->isShaderSupported = false;
return error;
}
error = this->CreateGeometryZeroDstAlphaProgram(GeometryZeroDstAlphaPixelMaskVtxShader_150, GeometryZeroDstAlphaPixelMaskFragShader_150);
if (error != OGLERROR_NOERR)
{
glUseProgram(0);
this->DestroyGeometryPrograms();
this->DestroyClearImageProgram();
this->isShaderSupported = false;
return error;
}
INFO("OpenGL ES: Successfully created geometry shaders.\n");
error = this->InitPostprocessingPrograms(EdgeMarkVtxShader_150,
EdgeMarkFragShader_150,
FramebufferOutputVtxShader_150,
FramebufferOutput6665FragShader_150,
NULL);
if (error != OGLERROR_NOERR)
{
glUseProgram(0);
this->DestroyGeometryPrograms();
this->DestroyClearImageProgram();
this->DestroyGeometryZeroDstAlphaProgram();
this->isShaderSupported = false;
return error;
}
this->isVBOSupported = true;
this->CreateVBOs();
// PBOs are only used when reading back the rendered framebuffer for the emulated
// BG0 layer. For desktop-class GPUs, doing an asynchronous glReadPixels() call
// is always advantageous since such devices are expected to have their GPUs
// connected to a data bus.
//
// However, many ARM-based mobile devices use integrated GPUs of varying degrees
// of memory latency and implementation quality. This means that the performance
// of an asynchronous glReadPixels() call is NOT guaranteed on such devices.
//
// In fact, many ARM-based devices suffer devastating performance drops when trying
// to do asynchronous framebuffer reads. Therefore, since most OpenGL ES users will
// be running an ARM-based iGPU, we will disable PBOs for OpenGL ES and stick with
// a traditional synchronous glReadPixels() call instead.
this->isPBOSupported = false;
this->isVAOSupported = true;
this->CreateVAOs();
// Load and create FBOs. Return on any error, since OpenGL ES 3.0 includes FBOs as core functionality.
this->isFBOSupported = true;
error = this->CreateFBOs();
if (error != OGLERROR_NOERR)
{
this->isFBOSupported = false;
return error;
}
this->_isFBOBlitSupported = true;
this->isMultisampledFBOSupported = true;
this->_selectedMultisampleSize = CommonSettings.GFX3D_Renderer_MultisampleSize;
GLint maxSamplesOGL = 0;
glGetIntegerv(GL_MAX_SAMPLES, &maxSamplesOGL);
this->_deviceInfo.maxSamples = (u8)maxSamplesOGL;
if (this->_deviceInfo.maxSamples >= 2)
{
// Try and initialize the multisampled FBOs with the GFX3D_Renderer_MultisampleSize.
// However, if the client has this set to 0, then set sampleSize to 2 in order to
// force the generation and the attachments of the buffers at a meaningful sample
// size. If GFX3D_Renderer_MultisampleSize is 0, then we can deallocate the buffer
// memory afterwards.
GLsizei sampleSize = this->GetLimitedMultisampleSize();
if (sampleSize == 0)
{
sampleSize = 2;
}
error = this->CreateMultisampledFBO(sampleSize);
if (error != OGLERROR_NOERR)
{
this->isMultisampledFBOSupported = false;
}
// If GFX3D_Renderer_MultisampleSize is 0, then we can deallocate the buffers now
// in order to save some memory.
if (this->_selectedMultisampleSize == 0)
{
this->ResizeMultisampledFBOs(0);
}
}
else
{
this->isMultisampledFBOSupported = false;
INFO("OpenGL ES: Driver does not support at least 2x multisampled FBOs.\n");
}
this->_isDepthLEqualPolygonFacingSupported = true;
this->_enableMultisampledRendering = ((this->_selectedMultisampleSize >= 2) && this->isMultisampledFBOSupported);
return OGLERROR_NOERR;
}
Render3DError OpenGLESRenderer_3_0::CreateGeometryPrograms()
{
Render3DError error = OGLERROR_NOERR;
OGLRenderRef &OGLRef = *this->ref;
// Create shader resources.
glGenTextures(1, &OGLRef.texFogDensityTableID);
glActiveTexture(GL_TEXTURE0 + OGLTextureUnitID_LookupTable);
glBindTexture(GL_TEXTURE_2D, OGLRef.texFogDensityTableID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 32, 1, 0, GL_RED, GL_UNSIGNED_BYTE, NULL);
glActiveTexture(GL_TEXTURE0);
OGLGeometryFlags programFlags;
programFlags.value = 0;
std::stringstream shaderHeader;
shaderHeader << "#version 300 es\n";
shaderHeader << "precision highp float;\n";
shaderHeader << "precision highp int;\n";
shaderHeader << "\n";
std::stringstream vsHeader;
vsHeader << "#define IN_VTX_POSITION layout (location = " << OGLVertexAttributeID_Position << ") in\n";
vsHeader << "#define IN_VTX_TEXCOORD0 layout (location = " << OGLVertexAttributeID_TexCoord0 << ") in\n";
vsHeader << "#define IN_VTX_COLOR layout (location = " << OGLVertexAttributeID_Color << ") in\n";
vsHeader << "\n";
vsHeader << "#define IS_USING_UBO_POLY_STATES " << ((this->_gResource->IsPolyStatesBufferUBO()) ? 1 : 0) << "\n";
vsHeader << "#define IS_USING_TBO_POLY_STATES " << ((this->_gResource->IsPolyStatesBufferTBO()) ? 1 : 0) << "\n";
vsHeader << "#define DEPTH_EQUALS_TEST_TOLERANCE " << DEPTH_EQUALS_TEST_TOLERANCE << ".0\n";
vsHeader << "\n";
std::string vtxShaderCode = shaderHeader.str() + vsHeader.str() + std::string(GeometryVtxShader_ES300);
for (size_t flagsValue = 0; flagsValue < 128; flagsValue++, programFlags.value++)
{
std::stringstream shaderFlags;
shaderFlags << "#define OUT_COLOR layout (location = 0) out\n";
shaderFlags << "#define OUT_WORKING_BUFFER layout (location = " << (OGL_WORKING_ATTACHMENT_ID - GL_COLOR_ATTACHMENT0) << ") out\n";
shaderFlags << "#define OUT_POLY_ID layout (location = " << (OGL_POLYID_ATTACHMENT_ID - GL_COLOR_ATTACHMENT0) << ") out\n";
shaderFlags << "#define OUT_FOG_ATTRIBUTES layout (location = " << (OGL_FOGATTRIBUTES_ATTACHMENT_ID - GL_COLOR_ATTACHMENT0) << ") out\n";
shaderFlags << "\n";
shaderFlags << "#define USE_TEXTURE_SMOOTHING " << ((this->_enableTextureSmoothing) ? 1 : 0) << "\n";
shaderFlags << "#define USE_NDS_DEPTH_CALCULATION " << ((this->_emulateNDSDepthCalculation) ? 1 : 0) << "\n";
shaderFlags << "#define USE_DEPTH_LEQUAL_POLYGON_FACING " << ((this->_emulateDepthLEqualPolygonFacing) ? 1 : 0) << "\n";
shaderFlags << "\n";
shaderFlags << "#define ENABLE_W_DEPTH " << ((programFlags.EnableWDepth) ? 1 : 0) << "\n";
shaderFlags << "#define ENABLE_ALPHA_TEST " << ((programFlags.EnableAlphaTest) ? "true\n" : "false\n");
shaderFlags << "#define ENABLE_TEXTURE_SAMPLING " << ((programFlags.EnableTextureSampling) ? "true\n" : "false\n");
shaderFlags << "#define TOON_SHADING_MODE " << ((programFlags.ToonShadingMode) ? 1 : 0) << "\n";
shaderFlags << "#define ENABLE_FOG " << ((programFlags.EnableFog) ? 1 : 0) << "\n";
shaderFlags << "#define ENABLE_EDGE_MARK " << ((programFlags.EnableEdgeMark) ? 1 : 0) << "\n";
shaderFlags << "#define DRAW_MODE_OPAQUE " << ((programFlags.OpaqueDrawMode) ? 1 : 0) << "\n";
shaderFlags << "\n";
std::string fragShaderCode = shaderHeader.str() + shaderFlags.str() + std::string(GeometryFragShader_ES300);
error = this->ShaderProgramCreate(OGLRef.vertexGeometryShaderID,
OGLRef.fragmentGeometryShaderID[flagsValue],
OGLRef.programGeometryID[flagsValue],
vtxShaderCode.c_str(),
fragShaderCode.c_str());
if (error != OGLERROR_NOERR)
{
INFO("OpenGL ES: Failed to create the GEOMETRY shader program.\n");
glUseProgram(0);
this->DestroyGeometryPrograms();
return error;
}
glLinkProgram(OGLRef.programGeometryID[flagsValue]);
if (!this->ValidateShaderProgramLink(OGLRef.programGeometryID[flagsValue]))
{
INFO("OpenGL ES: Failed to link the GEOMETRY shader program.\n");
glUseProgram(0);
this->DestroyGeometryPrograms();
return OGLERROR_SHADER_CREATE_ERROR;
}
glValidateProgram(OGLRef.programGeometryID[flagsValue]);
glUseProgram(OGLRef.programGeometryID[flagsValue]);
// Set up render states UBO
const GLuint uniformBlockRenderStates = glGetUniformBlockIndex(OGLRef.programGeometryID[flagsValue], "RenderStates");
glUniformBlockBinding(OGLRef.programGeometryID[flagsValue], uniformBlockRenderStates, OGLBindingPointID_RenderStates);
GLint uboSize = 0;
glGetActiveUniformBlockiv(OGLRef.programGeometryID[flagsValue], uniformBlockRenderStates, GL_UNIFORM_BLOCK_DATA_SIZE, &uboSize);
assert(uboSize == sizeof(OGLRenderStates));
const GLint uniformTexRenderObject = glGetUniformLocation(OGLRef.programGeometryID[flagsValue], "texRenderObject");
glUniform1i(uniformTexRenderObject, 0);
if (this->_gResource->IsPolyStatesBufferUBO())
{
const GLuint uniformBlockPolyStates = glGetUniformBlockIndex(OGLRef.programGeometryID[flagsValue], "PolyStates");
glUniformBlockBinding(OGLRef.programGeometryID[flagsValue], uniformBlockPolyStates, OGLBindingPointID_PolyStates);
}
else
{
const GLint uniformTexBufferPolyStates = glGetUniformLocation(OGLRef.programGeometryID[flagsValue], "PolyStates");
glUniform1i(uniformTexBufferPolyStates, OGLTextureUnitID_PolyStates);
}
if (this->_emulateDepthLEqualPolygonFacing && !programFlags.OpaqueDrawMode)
{
const GLint uniformTexBackfacing = glGetUniformLocation(OGLRef.programGeometryID[flagsValue], "inDstBackFacing");
glUniform1i(uniformTexBackfacing, OGLTextureUnitID_FinalColor);
}
OGLRef.uniformTexDrawOpaque[flagsValue] = glGetUniformLocation(OGLRef.programGeometryID[flagsValue], "texDrawOpaque");
OGLRef.uniformDrawModeDepthEqualsTest[flagsValue] = glGetUniformLocation(OGLRef.programGeometryID[flagsValue], "drawModeDepthEqualsTest");
OGLRef.uniformPolyDrawShadow[flagsValue] = glGetUniformLocation(OGLRef.programGeometryID[flagsValue], "polyDrawShadow");
OGLRef.uniformPolyStateIndex[flagsValue] = glGetUniformLocation(OGLRef.programGeometryID[flagsValue], "polyIndex");
OGLRef.uniformPolyDepthOffset[flagsValue] = glGetUniformLocation(OGLRef.programGeometryID[flagsValue], "polyDepthOffset");
}
return error;
}
Render3DError OpenGLESRenderer_3_0::CreateClearImageProgram(const char *vsCString, const char *fsCString)
{
Render3DError error = OGLERROR_NOERR;
OGLRenderRef &OGLRef = *this->ref;
std::stringstream shaderHeader;
shaderHeader << "#version 300 es\n";
shaderHeader << "precision highp float;\n";
shaderHeader << "precision highp int;\n";
shaderHeader << "\n";
std::stringstream vsHeader;
if (this->_isShaderFixedLocationSupported)
{
vsHeader << "#define IN_VTX_POSITION layout (location = " << OGLVertexAttributeID_Position << ") in\n";
vsHeader << "#define IN_VTX_TEXCOORD0 layout (location = " << OGLVertexAttributeID_TexCoord0 << ") in\n";
}
else
{
vsHeader << "#define IN_VTX_POSITION in\n";
vsHeader << "#define IN_VTX_TEXCOORD0 in\n";
}
vsHeader << "\n";
std::string vtxShaderCode = shaderHeader.str() + vsHeader.str() + std::string(vsCString);
std::stringstream fsHeader;
if (this->_isShaderFixedLocationSupported)
{
fsHeader << "#define OUT_COLOR layout (location = 0) out\n";
fsHeader << "#define OUT_FOGATTR layout (location = 1) out\n";
}
else
{
fsHeader << "#define OUT_COLOR out\n";
fsHeader << "#define OUT_FOGATTR out\n";
}
fsHeader << "\n";
std::string fragShaderCodeFogColor = shaderHeader.str() + fsHeader.str() + std::string(fsCString);
error = this->ShaderProgramCreate(OGLRef.vsClearImageID,
OGLRef.fsClearImageID,
OGLRef.pgClearImageID,
vtxShaderCode.c_str(),
fragShaderCodeFogColor.c_str());
if (error != OGLERROR_NOERR)
{
INFO("OpenGL ES: Failed to create the CLEAR_IMAGE shader program.\n");
glUseProgram(0);
this->DestroyClearImageProgram();
return error;
}
glLinkProgram(OGLRef.pgClearImageID);
if (!this->ValidateShaderProgramLink(OGLRef.pgClearImageID))
{
INFO("OpenGL ES: Failed to link the CLEAR_IMAGE shader color/fog program.\n");
glUseProgram(0);
this->DestroyClearImageProgram();
return OGLERROR_SHADER_CREATE_ERROR;
}
glValidateProgram(OGLRef.pgClearImageID);
glUseProgram(OGLRef.pgClearImageID);
const GLint uniformTexCIColor = glGetUniformLocation(OGLRef.pgClearImageID, "texCIColor");
const GLint uniformTexCIFogAttr = glGetUniformLocation(OGLRef.pgClearImageID, "texCIFogAttr");
const GLint uniformTexCIDepthCF = glGetUniformLocation(OGLRef.pgClearImageID, "texCIDepth");
glUniform1i(uniformTexCIColor, OGLTextureUnitID_CIColor);
glUniform1i(uniformTexCIFogAttr, OGLTextureUnitID_CIFogAttr);
glUniform1i(uniformTexCIDepthCF, OGLTextureUnitID_CIDepth);
return error;
}
Render3DError OpenGLESRenderer_3_0::CreateGeometryZeroDstAlphaProgram(const char *vtxShaderCString, const char *fragShaderCString)
{
Render3DError error = OGLERROR_NOERR;
OGLRenderRef &OGLRef = *this->ref;
if ( (vtxShaderCString == NULL) || (fragShaderCString == NULL) )
{
return error;
}
std::stringstream shaderHeader;
shaderHeader << "#version 300 es\n";
shaderHeader << "precision highp float;\n";
shaderHeader << "precision highp int;\n";
shaderHeader << "\n";
std::stringstream vsHeader;
vsHeader << "#define IN_VTX_POSITION layout (location = " << OGLVertexAttributeID_Position << ") in\n";
vsHeader << "#define IN_VTX_TEXCOORD0 layout (location = " << OGLVertexAttributeID_TexCoord0 << ") in\n";
vsHeader << "#define IN_VTX_COLOR layout (location = " << OGLVertexAttributeID_Color << ") in\n";
std::string vtxShaderCode = shaderHeader.str() + vsHeader.str() + std::string(vtxShaderCString);
std::string fragShaderCode = shaderHeader.str() + std::string(fragShaderCString);
error = this->ShaderProgramCreate(OGLRef.vtxShaderGeometryZeroDstAlphaID,
OGLRef.fragShaderGeometryZeroDstAlphaID,
OGLRef.programGeometryZeroDstAlphaID,
vtxShaderCode.c_str(),
fragShaderCode.c_str());
if (error != OGLERROR_NOERR)
{
INFO("OpenGL ES: Failed to create the GEOMETRY ZERO DST ALPHA shader program.\n");
glUseProgram(0);
this->DestroyGeometryZeroDstAlphaProgram();
return error;
}
glLinkProgram(OGLRef.programGeometryZeroDstAlphaID);
if (!this->ValidateShaderProgramLink(OGLRef.programGeometryZeroDstAlphaID))
{
INFO("OpenGL ES: Failed to link the GEOMETRY ZERO DST ALPHA shader program.\n");
glUseProgram(0);
this->DestroyGeometryZeroDstAlphaProgram();
return OGLERROR_SHADER_CREATE_ERROR;
}
glValidateProgram(OGLRef.programGeometryZeroDstAlphaID);
glUseProgram(OGLRef.programGeometryZeroDstAlphaID);
const GLint uniformTexGColor = glGetUniformLocation(OGLRef.programGeometryZeroDstAlphaID, "texInFragColor");
glUniform1i(uniformTexGColor, OGLTextureUnitID_GColor);
return OGLERROR_NOERR;
}
Render3DError OpenGLESRenderer_3_0::CreateEdgeMarkProgram(const bool isMultisample, const char *vtxShaderCString, const char *fragShaderCString)
{
Render3DError error = OGLERROR_NOERR;
OGLRenderRef &OGLRef = *this->ref;
if ( (vtxShaderCString == NULL) || (fragShaderCString == NULL) )
{
return error;
}
std::stringstream shaderHeader;
shaderHeader << "#version 300 es\n";
shaderHeader << "precision highp float;\n";
shaderHeader << "precision highp int;\n";
shaderHeader << "\n";
shaderHeader << "#define FRAMEBUFFER_SIZE_X " << this->_framebufferWidth << ".0 \n";
shaderHeader << "#define FRAMEBUFFER_SIZE_Y " << this->_framebufferHeight << ".0 \n";
shaderHeader << "\n";
std::stringstream vsHeader;
vsHeader << "#define IN_VTX_POSITION layout (location = " << OGLVertexAttributeID_Position << ") in\n";
vsHeader << "#define IN_VTX_TEXCOORD0 layout (location = " << OGLVertexAttributeID_TexCoord0 << ") in\n";
vsHeader << "#define IN_VTX_COLOR layout (location = " << OGLVertexAttributeID_Color << ") in\n";
std::stringstream fsHeader;
fsHeader << "#define OUT_COLOR layout (location = 0) out\n";
std::string vtxShaderCode = shaderHeader.str() + vsHeader.str() + std::string(vtxShaderCString);
std::string fragShaderCode = shaderHeader.str() + fsHeader.str() + std::string(fragShaderCString);
error = this->ShaderProgramCreate(OGLRef.vertexEdgeMarkShaderID,
OGLRef.fragmentEdgeMarkShaderID,
OGLRef.programEdgeMarkID,
vtxShaderCode.c_str(),
fragShaderCode.c_str());
if (error != OGLERROR_NOERR)
{
INFO("OpenGL ES: Failed to create the EDGE MARK shader program.\n");
glUseProgram(0);
this->DestroyEdgeMarkProgram();
return error;
}
glLinkProgram(OGLRef.programEdgeMarkID);
if (!this->ValidateShaderProgramLink(OGLRef.programEdgeMarkID))
{
INFO("OpenGL ES: Failed to link the EDGE MARK shader program.\n");
glUseProgram(0);
this->DestroyEdgeMarkProgram();
return OGLERROR_SHADER_CREATE_ERROR;
}
glValidateProgram(OGLRef.programEdgeMarkID);
glUseProgram(OGLRef.programEdgeMarkID);
const GLuint uniformBlockRenderStates = glGetUniformBlockIndex(OGLRef.programEdgeMarkID, "RenderStates");
glUniformBlockBinding(OGLRef.programEdgeMarkID, uniformBlockRenderStates, OGLBindingPointID_RenderStates);
const GLint uniformTexGDepth = glGetUniformLocation(OGLRef.programEdgeMarkID, "texInFragDepth");
const GLint uniformTexGPolyID = glGetUniformLocation(OGLRef.programEdgeMarkID, "texInPolyID");
glUniform1i(uniformTexGDepth, OGLTextureUnitID_DepthStencil);
glUniform1i(uniformTexGPolyID, OGLTextureUnitID_GPolyID);
return OGLERROR_NOERR;
}
Render3DError OpenGLESRenderer_3_0::CreateFogProgram(const OGLFogProgramKey fogProgramKey, const bool isMultisample, const char *vtxShaderCString, const char *fragShaderCString)
{
Render3DError error = OGLERROR_NOERR;
OGLRenderRef &OGLRef = *this->ref;
if (vtxShaderCString == NULL)
{
INFO("OpenGL ES: The FOG vertex shader is unavailable.\n");
error = OGLERROR_VERTEX_SHADER_PROGRAM_LOAD_ERROR;
return error;
}
else if (fragShaderCString == NULL)
{
INFO("OpenGL ES: The FOG fragment shader is unavailable.\n");
error = OGLERROR_FRAGMENT_SHADER_PROGRAM_LOAD_ERROR;
return error;
}
const s32 fogOffset = fogProgramKey.offset;
const GLfloat fogOffsetf = (GLfloat)fogOffset / 32767.0f;
const s32 fogStep = 0x0400 >> fogProgramKey.shift;
std::stringstream shaderHeader;
shaderHeader << "#version 300 es\n";
shaderHeader << "precision highp float;\n";
shaderHeader << "precision highp int;\n";
shaderHeader << "\n";
std::stringstream vsHeader;
vsHeader << "#define IN_VTX_POSITION layout (location = " << OGLVertexAttributeID_Position << ") in\n";
vsHeader << "#define IN_VTX_TEXCOORD0 layout (location = " << OGLVertexAttributeID_TexCoord0 << ") in\n";
vsHeader << "#define IN_VTX_COLOR layout (location = " << OGLVertexAttributeID_Color << ") in\n";
std::stringstream fsHeader;
fsHeader << "#define FOG_OFFSET " << fogOffset << "\n";
fsHeader << "#define FOG_OFFSETF " << fogOffsetf << (((fogOffsetf == 0.0f) || (fogOffsetf == 1.0f)) ? ".0" : "") << "\n";
fsHeader << "#define FOG_STEP " << fogStep << "\n";
fsHeader << "\n";
fsHeader << "#define OUT_COLOR layout (location = 0) out\n";
std::string vtxShaderCode = shaderHeader.str() + vsHeader.str() + std::string(vtxShaderCString);
std::string fragShaderCode = shaderHeader.str() + fsHeader.str() + std::string(fragShaderCString);
OGLFogShaderID shaderID;
shaderID.program = 0;
shaderID.fragShader = 0;
error = this->ShaderProgramCreate(OGLRef.vertexFogShaderID,
shaderID.fragShader,
shaderID.program,
vtxShaderCode.c_str(),
fragShaderCode.c_str());
this->_fogProgramMap[fogProgramKey.key] = shaderID;
if (error != OGLERROR_NOERR)
{
INFO("OpenGL ES: Failed to create the FOG shader program.\n");
glUseProgram(0);
this->DestroyFogProgram(fogProgramKey);
return error;
}
glLinkProgram(shaderID.program);
if (!this->ValidateShaderProgramLink(shaderID.program))
{
INFO("OpenGL ES: Failed to link the FOG shader program.\n");
glUseProgram(0);
this->DestroyFogProgram(fogProgramKey);
return OGLERROR_SHADER_CREATE_ERROR;
}
glValidateProgram(shaderID.program);
glUseProgram(shaderID.program);
const GLuint uniformBlockRenderStates = glGetUniformBlockIndex(shaderID.program, "RenderStates");
glUniformBlockBinding(shaderID.program, uniformBlockRenderStates, OGLBindingPointID_RenderStates);
const GLint uniformTexGDepth = glGetUniformLocation(shaderID.program, "texInFragDepth");
const GLint uniformTexGFog = glGetUniformLocation(shaderID.program, "texInFogAttributes");
const GLint uniformTexFogDensityTable = glGetUniformLocation(shaderID.program, "texFogDensityTable");
glUniform1i(uniformTexGDepth, OGLTextureUnitID_DepthStencil);
glUniform1i(uniformTexGFog, OGLTextureUnitID_FogAttr);
glUniform1i(uniformTexFogDensityTable, OGLTextureUnitID_LookupTable);
return OGLERROR_NOERR;
}
Render3DError OpenGLESRenderer_3_0::CreateFramebufferOutput6665Program(const char *vtxShaderCString, const char *fragShaderCString)
{
Render3DError error = OGLERROR_NOERR;
OGLRenderRef &OGLRef = *this->ref;
if ( (vtxShaderCString == NULL) || (fragShaderCString == NULL) )
{
return error;
}
std::stringstream shaderHeader;
shaderHeader << "#version 300 es\n";
shaderHeader << "precision highp float;\n";
shaderHeader << "precision highp int;\n";
shaderHeader << "\n";
shaderHeader << "#define FRAMEBUFFER_SIZE_X " << this->_framebufferWidth << ".0 \n";
shaderHeader << "#define FRAMEBUFFER_SIZE_Y " << this->_framebufferHeight << ".0 \n";
shaderHeader << "\n";
std::stringstream vsHeader;
vsHeader << "#define IN_VTX_POSITION layout (location = " << OGLVertexAttributeID_Position << ") in\n";
vsHeader << "#define IN_VTX_TEXCOORD0 layout (location = " << OGLVertexAttributeID_TexCoord0 << ") in\n";
vsHeader << "#define IN_VTX_COLOR layout (location = " << OGLVertexAttributeID_Color << ") in\n";
std::stringstream fsHeader;
fsHeader << "#define OUT_COLOR layout (location = " << (OGL_WORKING_ATTACHMENT_ID - GL_COLOR_ATTACHMENT0) << ") out\n";
std::string vtxShaderCode = shaderHeader.str() + vsHeader.str() + std::string(vtxShaderCString);
std::string fragShaderCode = shaderHeader.str() + fsHeader.str() + std::string(fragShaderCString);
error = this->ShaderProgramCreate(OGLRef.vertexFramebufferOutput6665ShaderID,
OGLRef.fragmentFramebufferRGBA6665OutputShaderID,
OGLRef.programFramebufferRGBA6665OutputID,
vtxShaderCode.c_str(),
fragShaderCode.c_str());
if (error != OGLERROR_NOERR)
{
INFO("OpenGL ES: Failed to create the FRAMEBUFFER OUTPUT RGBA6665 shader program.\n");
glUseProgram(0);
this->DestroyFramebufferOutput6665Programs();
return error;
}
glLinkProgram(OGLRef.programFramebufferRGBA6665OutputID);
if (!this->ValidateShaderProgramLink(OGLRef.programFramebufferRGBA6665OutputID))
{
INFO("OpenGL ES: Failed to link the FRAMEBUFFER OUTPUT RGBA6665 shader program.\n");
glUseProgram(0);
this->DestroyFramebufferOutput6665Programs();
return OGLERROR_SHADER_CREATE_ERROR;
}
glValidateProgram(OGLRef.programFramebufferRGBA6665OutputID);
glUseProgram(OGLRef.programFramebufferRGBA6665OutputID);
const GLint uniformTexGColor = glGetUniformLocation(OGLRef.programFramebufferRGBA6665OutputID, "texInFragColor");
glUniform1i(uniformTexGColor, OGLTextureUnitID_GColor);
return OGLERROR_NOERR;
}

View File

@ -1,59 +0,0 @@
/*
Copyright (C) 2024 DeSmuME team
This file 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 file 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 the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OGLRENDER_ES3_H
#define OGLRENDER_ES3_H
#include "OGLRender_3_2.h"
// A port that wants to use the OpenGL ES renderer must assign the two following functions
// to OGLLoadEntryPoints_ES_3_0_Func and OGLCreateRenderer_ES_3_0_Func, respectively.
//
// In addition, the port must add the following GPU3DInterface objects to core3DList:
// - gpu3Dgl_ES_3_0: Selects the OpenGL ES 3.0 renderer, and returns an error if it is
// not available on the host system.
//
// Finally, the port must call GPU->Set3DRendererByID() and pass in the index where
// gpu3Dgl_ES_3_0 exists in core3DList so that the emulator can create the appropriate
// OpenGLRenderer object.
//
// Example code:
// OGLLoadEntryPoints_ES_3_0_Func = &OGLLoadEntryPoints_ES_3_0;
// OGLCreateRenderer_ES_3_0_Func = &OGLCreateRenderer_ES_3_0;
// GPU3DInterface *core3DList[] = { &gpu3DNull, &gpu3DRasterize, &gpu3Dgl_ES_3_0, NULL };
// GPU->Set3DRendererByID(2);
void OGLLoadEntryPoints_ES_3_0();
void OGLCreateRenderer_ES_3_0(OpenGLRenderer **rendererPtr);
class OpenGLESRenderer_3_0 : public OpenGLRenderer_3_2
{
protected:
virtual Render3DError CreateGeometryPrograms();
virtual Render3DError CreateClearImageProgram(const char *vsCString, const char *fsCString);
virtual Render3DError CreateGeometryZeroDstAlphaProgram(const char *vtxShaderCString, const char *fragShaderCString);
virtual Render3DError CreateEdgeMarkProgram(const bool isMultisample, const char *vtxShaderCString, const char *fragShaderCString);
virtual Render3DError CreateFogProgram(const OGLFogProgramKey fogProgramKey, const bool isMultisample, const char *vtxShaderCString, const char *fragShaderCString);
virtual Render3DError CreateFramebufferOutput6665Program(const char *vtxShaderCString, const char *fragShaderCString);
public:
OpenGLESRenderer_3_0();
virtual Render3DError InitExtensions();
};
#endif // OGLRENDER_ES3_H

View File

@ -79,7 +79,7 @@ struct STDROMReaderData
void* STDROMReaderInit(const char* filename) void* STDROMReaderInit(const char* filename)
{ {
#if !defined(_MSC_VER) && !defined(__MINGW32__) #ifndef _MSC_VER
struct stat sb; struct stat sb;
if (stat(filename, &sb) == -1) if (stat(filename, &sb) == -1)
return 0; return 0;
@ -348,7 +348,7 @@ int MemROMReaderWrite(void * file, void * buffer, u32 size)
if(remain<todo) if(remain<todo)
todo = remain; todo = remain;
if (todo == 1) ((u8*)mem.buf)[mem.pos] = *(u8*)buffer; if(todo==1) *(u8*)buffer = ((u8*)mem.buf)[mem.pos];
else memcpy((u8*)mem.buf + mem.pos,buffer, todo); else memcpy((u8*)mem.buf + mem.pos,buffer, todo);
mem.pos += todo; mem.pos += todo;
return todo; return todo;

View File

@ -1,7 +1,7 @@
/* /*
Copyright (C) 2006 yopyop Copyright (C) 2006 yopyop
Copyright (C) 2006 Theo Berkau Copyright (C) 2006 Theo Berkau
Copyright (C) 2008-2025 DeSmuME team Copyright (C) 2008-2021 DeSmuME team
Ideas borrowed from Stephane Dallongeville's SCSP core Ideas borrowed from Stephane Dallongeville's SCSP core
@ -49,14 +49,7 @@ static inline u8 read08(u32 addr) { return _MMU_read08<ARMCPU_ARM7,MMU_AT_DEBUG>
static inline s8 read_s8(u32 addr) { return (s8)_MMU_read08<ARMCPU_ARM7,MMU_AT_DEBUG>(addr); } static inline s8 read_s8(u32 addr) { return (s8)_MMU_read08<ARMCPU_ARM7,MMU_AT_DEBUG>(addr); }
#define K_ADPCM_LOOPING_RECOVERY_INDEX 99999 #define K_ADPCM_LOOPING_RECOVERY_INDEX 99999
#define COSINE_INTERPOLATION_RESOLUTION 8192
#define CATMULLROM_INTERPOLATION_RESOLUTION_BITS 11
#define CATMULLROM_INTERPOLATION_RESOLUTION (1<<CATMULLROM_INTERPOLATION_RESOLUTION_BITS)
#define COSINE_INTERPOLATION_RESOLUTION_BITS 13
#define COSINE_INTERPOLATION_RESOLUTION (1<<COSINE_INTERPOLATION_RESOLUTION_BITS)
#define SPUCHAN_PCM16B_AT(x) ((u32)(x) % SPUINTERPOLATION_TAPS)
//#ifdef FASTBUILD //#ifdef FASTBUILD
#undef FORCEINLINE #undef FORCEINLINE
@ -103,10 +96,20 @@ static const u16 adpcmtbl[89] =
0x41B2, 0x4844, 0x4F7E, 0x5771, 0x602F, 0x69CE, 0x7462, 0x7FFF 0x41B2, 0x4844, 0x4F7E, 0x5771, 0x602F, 0x69CE, 0x7462, 0x7FFF
}; };
static const s16 wavedutytbl[8][8] = {
{ -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, 0x7FFF },
{ -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, 0x7FFF, 0x7FFF },
{ -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF },
{ -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF },
{ -0x7FFF, -0x7FFF, -0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF },
{ -0x7FFF, -0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF },
{ -0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF },
{ -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF }
};
static s32 precalcdifftbl[89][16]; static s32 precalcdifftbl[89][16];
static u8 precalcindextbl[89][8]; static u8 precalcindextbl[89][8];
static u16 catmullrom_lut[CATMULLROM_INTERPOLATION_RESOLUTION][4]; static double cos_lut[COSINE_INTERPOLATION_RESOLUTION];
static u16 cos_lut[COSINE_INTERPOLATION_RESOLUTION];
static const double ARM7_CLOCK = 33513982; static const double ARM7_CLOCK = 33513982;
@ -126,14 +129,6 @@ static FORCEINLINE T MinMax(T val, T min, T max)
return val; return val;
} }
// T must be unsigned type
template<typename T>
static FORCEINLINE T AddAndReturnCarry(T *a, T b) {
T c = (*a >= (-b));
*a += b;
return c;
}
//--------------external spu interface--------------- //--------------external spu interface---------------
int SPU_ChangeSoundCore(int coreid, int newBufferSizeBytes) int SPU_ChangeSoundCore(int coreid, int newBufferSizeBytes)
@ -176,7 +171,7 @@ int SPU_ChangeSoundCore(int coreid, int newBufferSizeBytes)
return -1; return -1;
// Since it failed, instead of it being fatal, disable the user spu // Since it failed, instead of it being fatal, disable the user spu
if (_currentSNDCore->Init((int)(_currentBufferSize * 2)) == -1) if (_currentSNDCore->Init(_currentBufferSize * 2) == -1)
{ {
_currentSNDCore = 0; _currentSNDCore = 0;
return -1; return -1;
@ -196,7 +191,7 @@ SoundInterface_struct *SPU_SoundCore()
void SPU_ReInit(bool fakeBoot) void SPU_ReInit(bool fakeBoot)
{ {
SPU_Init(_currentSNDCoreId, (int)_currentBufferSize); SPU_Init(_currentSNDCoreId, _currentBufferSize);
// Firmware set BIAS to 0x200 // Firmware set BIAS to 0x200
if (fakeBoot) if (fakeBoot)
@ -205,23 +200,9 @@ void SPU_ReInit(bool fakeBoot)
int SPU_Init(int coreid, int newBufferSizeBytes) int SPU_Init(int coreid, int newBufferSizeBytes)
{ {
// Build the interpolation LUTs // Build the cosine interpolation LUT
for (size_t i = 0; i < CATMULLROM_INTERPOLATION_RESOLUTION; i++) {
// This is the Catmull-Rom spline, refactored into a FIR filter
// If we wanted to, we could stick entirely to integer maths
// here, but I doubt it's worth the hassle.
double x = i / (double)CATMULLROM_INTERPOLATION_RESOLUTION;
double a = x*(x*(-x + 2) - 1);
double b = x*x*(3*x - 5) + 2;
double c = x*(x*(-3*x + 4) + 1);
double d = x*x*(x - 1);
catmullrom_lut[i][0] = (u16)floor((1u<<15) * -0.5*a);
catmullrom_lut[i][1] = (u16)floor((1u<<15) * 0.5*b);
catmullrom_lut[i][2] = (u16)floor((1u<<15) * 0.5*c);
catmullrom_lut[i][3] = (u16)floor((1u<<15) * -0.5*d);
}
for (size_t i = 0; i < COSINE_INTERPOLATION_RESOLUTION; i++) for (size_t i = 0; i < COSINE_INTERPOLATION_RESOLUTION; i++)
cos_lut[i] = (u16)floor((1u<<16) * ((1.0 - cos(((double)i/(double)COSINE_INTERPOLATION_RESOLUTION) * M_PI)) * 0.5)); cos_lut[i] = (1.0 - cos(((double)i/(double)COSINE_INTERPOLATION_RESOLUTION) * M_PI)) * 0.5;
SPU_core = new SPU_struct((int)ceil(samples_per_hline)); SPU_core = new SPU_struct((int)ceil(samples_per_hline));
SPU_Reset(); SPU_Reset();
@ -285,7 +266,7 @@ void SPU_SetSynchMode(int mode, int method)
if (_currentSynchMode == ESynchMode_DualSynchAsynch) if (_currentSynchMode == ESynchMode_DualSynchAsynch)
{ {
SPU_user = new SPU_struct((int)_currentBufferSize); SPU_user = new SPU_struct(_currentBufferSize);
SPU_CloneUser(); SPU_CloneUser();
} }
} }
@ -385,11 +366,7 @@ void SPU_struct::ShutUp()
static FORCEINLINE void adjust_channel_timer(channel_struct *chan) static FORCEINLINE void adjust_channel_timer(channel_struct *chan)
{ {
// ARM7_CLOCK / (DESMUME_SAMPLE_RATE*2) / (2^16 - Timer) chan->sampinc = (((double)ARM7_CLOCK) / (DESMUME_SAMPLE_RATE * 2)) / (double)(0x10000 - chan->timer);
// = ARM7_CLOCK / (DESMUME_SAMPLE_RATE*2 * (2^16 - Timer))
// ... and then round up for good measure
u64 sampinc = ((u32)ARM7_CLOCK*(1ull << 32) - 1) / (DESMUME_SAMPLE_RATE * 2ull * (0x10000 - chan->timer)) + 1;
chan->sampincInt = (u32)(sampinc >> 32), chan->sampincFrac = (u32)sampinc;
} }
void SPU_struct::KeyProbe(int chan_num) void SPU_struct::KeyProbe(int chan_num)
@ -422,12 +399,6 @@ void SPU_struct::KeyOn(int channel)
thischan.totlength = thischan.length + thischan.loopstart; thischan.totlength = thischan.length + thischan.loopstart;
adjust_channel_timer(&thischan); adjust_channel_timer(&thischan);
thischan.pcm16bOffs = 0;
for(int i=0;i<SPUINTERPOLATION_TAPS;i++)
{
thischan.pcm16b[i] = 0;
}
//printf("keyon %d totlength:%d\n",channel,thischan.totlength); //printf("keyon %d totlength:%d\n",channel,thischan.totlength);
@ -440,33 +411,39 @@ void SPU_struct::KeyOn(int channel)
case 0: // 8-bit case 0: // 8-bit
// thischan.loopstart = thischan.loopstart << 2; // thischan.loopstart = thischan.loopstart << 2;
// thischan.length = (thischan.length << 2) + thischan.loopstart; // thischan.length = (thischan.length << 2) + thischan.loopstart;
thischan.sampcntFrac = 0, thischan.sampcntInt = -3; thischan.sampcnt = -3;
break; break;
case 1: // 16-bit case 1: // 16-bit
// thischan.loopstart = thischan.loopstart << 1; // thischan.loopstart = thischan.loopstart << 1;
// thischan.length = (thischan.length << 1) + thischan.loopstart; // thischan.length = (thischan.length << 1) + thischan.loopstart;
thischan.sampcntFrac = 0, thischan.sampcntInt = -3; thischan.sampcnt = -3;
break; break;
case 2: // ADPCM case 2: // ADPCM
thischan.pcm16b[0] = (s16)read16(thischan.addr); {
thischan.index = read08(thischan.addr + 2) & 0x7F; thischan.pcm16b = (s16)read16(thischan.addr);
thischan.sampcntFrac = 0, thischan.sampcntInt = -3; thischan.pcm16b_last = thischan.pcm16b;
thischan.loop_index = K_ADPCM_LOOPING_RECOVERY_INDEX; thischan.index = read08(thischan.addr + 2) & 0x7F;;
// thischan.loopstart = thischan.loopstart << 3; thischan.lastsampcnt = 7;
// thischan.length = (thischan.length << 3) + thischan.loopstart; thischan.sampcnt = -3;
break; thischan.loop_index = K_ADPCM_LOOPING_RECOVERY_INDEX;
// thischan.loopstart = thischan.loopstart << 3;
// thischan.length = (thischan.length << 3) + thischan.loopstart;
break;
}
case 3: // PSG case 3: // PSG
thischan.sampcntFrac = 0, thischan.sampcntInt = -1; {
thischan.x = 0x7FFF; thischan.sampcnt = -1;
break; thischan.x = 0x7FFF;
break;
}
default: break; default: break;
} }
thischan.totlength_shifted = thischan.totlength << format_shift[thischan.format]; thischan.double_totlength_shifted = (double)(thischan.totlength << format_shift[thischan.format]);
if(thischan.format != 3) if(thischan.format != 3)
{ {
if(thischan.totlength_shifted == 0) if(thischan.double_totlength_shifted == 0)
{ {
printf("INFO: Stopping channel %d due to zero length\n",channel); printf("INFO: Stopping channel %d due to zero length\n",channel);
thischan.status = CHANSTAT_STOPPED; thischan.status = CHANSTAT_STOPPED;
@ -516,7 +493,7 @@ u8 SPU_struct::ReadByte(u32 addr)
//SOUNDBIAS //SOUNDBIAS
case 0x504: return regs.soundbias >> 0; case 0x504: return regs.soundbias >> 0;
case 0x505: return regs.soundbias >> 8; case 0x505: return regs.soundbias >> 8;
//SNDCAP0CNT/SNDCAP1CNT //SNDCAP0CNT/SNDCAP1CNT
case 0x508: case 0x508:
case 0x509: case 0x509:
@ -765,7 +742,7 @@ void SPU_struct::ProbeCapture(int which)
u32 len = cap.len; u32 len = cap.len;
if(len==0) len=1; if(len==0) len=1;
cap.runtime.maxdad = cap.dad + len*4; cap.runtime.maxdad = cap.dad + len*4;
cap.runtime.sampcntFrac = cap.runtime.sampcntInt = 0; cap.runtime.sampcnt = 0;
cap.runtime.fifo.reset(); cap.runtime.fifo.reset();
} }
@ -1041,109 +1018,161 @@ void SPU_struct::WriteLong(u32 addr, u32 val)
} //switch on address } //switch on address
} }
////////////////////////////////////////////////////////////////////////////// template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE s32 Interpolate(s32 a, s32 b, double ratio)
template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE s32 Interpolate(const s16 *pcm16b, u8 pcm16bOffs, u32 subPos)
{ {
double sampleA = (double)a;
double sampleB = (double)b;
ratio = ratio - sputrunc(ratio);
switch (INTERPOLATE_MODE) switch (INTERPOLATE_MODE)
{ {
case SPUInterpolation_CatmullRom:
{
// Catmull-Rom spline
// Delay: 2 samples, Maximum gain: 1.25
s32 a = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 3)];
s32 b = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 2)];
s32 c = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 1)];
s32 d = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 0)];
const u16 *w = catmullrom_lut[subPos >> (32 - CATMULLROM_INTERPOLATION_RESOLUTION_BITS)];
return (-a*(s32)w[0] + b*(s32)w[1] + c*(s32)w[2] - d*(s32)w[3]) >> 15;
}
case SPUInterpolation_Cosine: case SPUInterpolation_Cosine:
{
// Cosine Interpolation Formula: // Cosine Interpolation Formula:
// ratio2 = (1 - cos(ratio * M_PI)) / 2 // ratio2 = (1 - cos(ratio * M_PI)) / 2
// sampleI = sampleA * (1 - ratio2) + sampleB * ratio2 // sampleI = sampleA * (1 - ratio2) + sampleB * ratio2
// Delay: 1 sample, Maximum gain: 1.0 return s32floor((cos_lut[(unsigned int)(ratio * (double)COSINE_INTERPOLATION_RESOLUTION)] * (sampleB - sampleA)) + sampleA);
s32 a = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 1)]; break;
s32 b = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 0)];
s32 subPos16 = (s32)cos_lut[subPos >> (32 - COSINE_INTERPOLATION_RESOLUTION_BITS)];
return a + ((b - a)*subPos16 >> 16);
}
case SPUInterpolation_Linear: case SPUInterpolation_Linear:
{
// Linear Interpolation Formula: // Linear Interpolation Formula:
// sampleI = sampleA * (1 - ratio) + sampleB * ratio // sampleI = sampleA * (1 - ratio) + sampleB * ratio
// Delay: 1 sample, Maximum gain: 1.0 return s32floor((ratio * (sampleB - sampleA)) + sampleA);
s32 a = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 1)]; break;
s32 b = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 0)];
s32 subPos16 = subPos >> (32 - 16);
return a + ((b - a)*subPos16 >> 16);
}
default: default:
// Delay: 0 samples, Maximum gain: 1.0 break;
return pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs)];
}
}
static FORCEINLINE s32 Fetch8BitData(channel_struct *chan, s32 pos)
{
if(pos < 0) return 0;
return read_s8(chan->addr + pos*1) << 8;
}
static FORCEINLINE s32 Fetch16BitData(channel_struct *chan, s32 pos)
{
if(pos < 0) return 0;
return read16(chan->addr + pos*2);
}
static FORCEINLINE s32 FetchADPCMData(channel_struct *chan, s32 pos)
{
if(pos < 8) return 0;
s16 last = chan->pcm16b[SPUCHAN_PCM16B_AT(chan->pcm16bOffs)];
if(pos == (chan->loopstart<<3)) {
//if(chan->loop_index != K_ADPCM_LOOPING_RECOVERY_INDEX) printf("over-snagging\n");
chan->loop_pcm16b = last;
chan->loop_index = chan->index;
} }
const u32 shift = (pos&1) * 4; return a;
const u32 data4bit = ((u32)read08(chan->addr + (pos>>1))) >> shift;
const s32 diff = precalcdifftbl [chan->index][data4bit & 0xF];
chan->index = precalcindextbl[chan->index][data4bit & 0x7];
return MinMax(last + diff, -0x8000, 0x7FFF);
} }
static FORCEINLINE s32 FetchPSGData(channel_struct *chan, s32 pos) //////////////////////////////////////////////////////////////////////////////
{
if(pos < 0 || chan->num < 8) return 0;
// Chan 8..13: Square wave, Chan 14..15: Noise template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE void Fetch8BitData(channel_struct *chan, s32 *data)
if(chan->num < 14) {
if (chan->sampcnt < 0)
{ {
// Doing this avoids using a LUT *data = 0;
return ((pos%8u) > chan->waveduty) ? (-0x7FFF) : (+0x7FFF); return;
}
u32 loc = sputrunc(chan->sampcnt);
if(INTERPOLATE_MODE != SPUInterpolation_None)
{
s32 a = (s32)(read_s8(chan->addr + loc) << 8), b = a;
if(loc < (chan->totlength << 2) - 1)
b = (s32)(read_s8(chan->addr + loc + 1) << 8);
else if(chan->repeat == 1)
b = (s32)(read_s8(chan->addr + chan->loopstart*4) << 8);
*data = Interpolate<INTERPOLATE_MODE>(a, b, chan->sampcnt);
}
else
*data = (s32)read_s8(chan->addr + loc)<< 8;
}
template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE void Fetch16BitData(const channel_struct * const chan, s32 *data)
{
if (chan->sampcnt < 0)
{
*data = 0;
return;
}
u32 loc = sputrunc(chan->sampcnt);
if(INTERPOLATE_MODE != SPUInterpolation_None)
{
s32 a = (s32)read16(loc*2 + chan->addr), b = a;
if(loc < (chan->totlength << 1) - 1)
b = (s32)read16(chan->addr + loc*2 + 2);
else if(chan->repeat == 1)
b = (s32)read16(chan->addr + chan->loopstart*2);
*data = Interpolate<INTERPOLATE_MODE>(a, b, chan->sampcnt);
}
else
*data = read16(chan->addr + loc*2);
}
template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE void FetchADPCMData(channel_struct * const chan, s32 * const data)
{
if (chan->sampcnt < 8)
{
*data = 0;
return;
}
// No sense decoding, just return the last sample
if (chan->lastsampcnt != sputrunc(chan->sampcnt)){
const u32 endExclusive = sputrunc(chan->sampcnt+1);
for (u32 i = chan->lastsampcnt+1; i < endExclusive; i++)
{
const u32 shift = (i&1)<<2;
const u32 data4bit = ((u32)read08(chan->addr + (i>>1))) >> shift;
const s32 diff = precalcdifftbl[chan->index][data4bit & 0xF];
chan->index = precalcindextbl[chan->index][data4bit & 0x7];
chan->pcm16b_last = chan->pcm16b;
chan->pcm16b = MinMax(chan->pcm16b+diff, -0x8000, 0x7FFF);
if(i == (chan->loopstart<<3)) {
if(chan->loop_index != K_ADPCM_LOOPING_RECOVERY_INDEX) printf("over-snagging\n");
chan->loop_pcm16b = chan->pcm16b;
chan->loop_index = chan->index;
}
}
chan->lastsampcnt = sputrunc(chan->sampcnt);
}
if(INTERPOLATE_MODE != SPUInterpolation_None)
*data = Interpolate<INTERPOLATE_MODE>((s32)chan->pcm16b_last,(s32)chan->pcm16b,chan->sampcnt);
else
*data = (s32)chan->pcm16b;
}
static FORCEINLINE void FetchPSGData(channel_struct *chan, s32 *data)
{
if (chan->sampcnt < 0)
{
*data = 0;
return;
}
if(chan->num < 8)
{
*data = 0;
}
else if(chan->num < 14)
{
*data = (s32)wavedutytbl[chan->waveduty][(sputrunc(chan->sampcnt)) & 0x7];
} }
else else
{ {
if(chan->x & 0x1) if(chan->lastsampcnt == sputrunc(chan->sampcnt))
{ {
chan->x = (chan->x >> 1) ^ 0x6000; *data = (s32)chan->psgnoise_last;
return -0x7FFF; return;
} }
else
u32 max = sputrunc(chan->sampcnt);
for(u32 i = chan->lastsampcnt; i < max; i++)
{ {
chan->x >>= 1; if(chan->x & 0x1)
return +0x7FFF; {
chan->x = (chan->x >> 1) ^ 0x6000;
chan->psgnoise_last = -0x7FFF;
}
else
{
chan->x >>= 1;
chan->psgnoise_last = 0x7FFF;
}
} }
chan->lastsampcnt = sputrunc(chan->sampcnt);
*data = (s32)chan->psgnoise_last;
} }
} }
@ -1172,41 +1201,66 @@ static FORCEINLINE void MixLR(SPU_struct* SPU, channel_struct *chan, s32 data)
template<int FORMAT> static FORCEINLINE void TestForLoop(SPU_struct *SPU, channel_struct *chan) template<int FORMAT> static FORCEINLINE void TestForLoop(SPU_struct *SPU, channel_struct *chan)
{ {
// Do nothing if we haven't reached the end const int shift = (FORMAT == 0 ? 2 : 1);
if(chan->sampcntInt < chan->totlength_shifted) return;
// Kill the channel if we don't repeat chan->sampcnt += chan->sampinc;
if(chan->repeat != 1)
if (chan->sampcnt > chan->double_totlength_shifted)
{ {
SPU->KeyOff(chan->num); // Do we loop? Or are we done?
return; if (chan->repeat == 1)
}
// ADPCM needs special handling
if(FORMAT == 2)
{
// Minimum length (the sum of PNT+LEN) is 4 words (16 bytes),
// smaller values (0..3 words) are causing hang-ups
// (busy bit remains set infinite, but no sound output occurs).
// fix: 7th Dragon (JP) - http://sourceforge.net/p/desmume/bugs/1357/
if (chan->totlength < 4) return;
// Stash loop sample and index
if(chan->loop_index == K_ADPCM_LOOPING_RECOVERY_INDEX)
{ {
chan->pcm16b[SPUCHAN_PCM16B_AT(chan->pcm16bOffs)] = (s16)read16(chan->addr); while (chan->sampcnt > chan->double_totlength_shifted)
chan->index = read08(chan->addr+2) & 0x7F; chan->sampcnt -= chan->double_totlength_shifted - (double)(chan->loopstart << shift);
//chan->sampcnt = (double)(chan->loopstart << shift);
} }
else else
{ {
chan->pcm16b[SPUCHAN_PCM16B_AT(chan->pcm16bOffs)] = chan->loop_pcm16b; SPU->KeyOff(chan->num);
chan->index = chan->loop_index; SPU->bufpos = SPU->buflength;
} }
} }
}
// Wrap sampcnt static FORCEINLINE void TestForLoop2(SPU_struct *SPU, channel_struct *chan)
u32 step = chan->totlength_shifted - (chan->loopstart << format_shift[FORMAT]); {
while (chan->sampcntInt >= chan->totlength_shifted) chan->sampcntInt -= step; // Minimum length (the sum of PNT+LEN) is 4 words (16 bytes),
// smaller values (0..3 words) are causing hang-ups
// (busy bit remains set infinite, but no sound output occurs).
// fix: 7th Dragon (JP) - http://sourceforge.net/p/desmume/bugs/1357/
if (chan->totlength < 4) return;
chan->sampcnt += chan->sampinc;
if (chan->sampcnt > chan->double_totlength_shifted)
{
// Do we loop? Or are we done?
if (chan->repeat == 1)
{
double step = (chan->double_totlength_shifted - (double)(chan->loopstart << 3));
while (chan->sampcnt > chan->double_totlength_shifted) chan->sampcnt -= step;
if(chan->loop_index == K_ADPCM_LOOPING_RECOVERY_INDEX)
{
chan->pcm16b = (s16)read16(chan->addr);
chan->index = read08(chan->addr+2) & 0x7F;
chan->lastsampcnt = 7;
}
else
{
chan->pcm16b = chan->loop_pcm16b;
chan->index = chan->loop_index;
chan->lastsampcnt = (chan->loopstart << 3);
}
}
else
{
chan->status = CHANSTAT_STOPPED;
SPU->KeyOff(chan->num);
SPU->bufpos = SPU->buflength;
}
}
} }
template<int CHANNELS> FORCEINLINE static void SPU_Mix(SPU_struct* SPU, channel_struct *chan, s32 data) template<int CHANNELS> FORCEINLINE static void SPU_Mix(SPU_struct* SPU, channel_struct *chan, s32 data)
@ -1227,36 +1281,26 @@ template<int FORMAT, SPUInterpolationMode INTERPOLATE_MODE, int CHANNELS>
{ {
for (; SPU->bufpos < SPU->buflength; SPU->bufpos++) for (; SPU->bufpos < SPU->buflength; SPU->bufpos++)
{ {
// Advance sampcnt one sample at a time. This is
// needed to keep pcm16b[] filled for interpolation.
u32 nSamplesToSkip = chan->sampincInt + AddAndReturnCarry(&chan->sampcntFrac, chan->sampincFrac);
while(nSamplesToSkip--)
{
s16 data = 0;
s32 pos = chan->sampcntInt;
if(chan->status != CHANSTAT_STOPPED)
{
switch(FORMAT)
{
case 0: data = Fetch8BitData (chan, pos); break;
case 1: data = Fetch16BitData(chan, pos); break;
case 2: data = FetchADPCMData(chan, pos); break;
case 3: data = FetchPSGData (chan, pos); break;
default: break;
}
}
chan->pcm16bOffs++;
chan->pcm16b[SPUCHAN_PCM16B_AT(chan->pcm16bOffs)] = data;
chan->sampcntInt++;
if (FORMAT != 3) TestForLoop<FORMAT>(SPU, chan);
}
if(CHANNELS != -1) if(CHANNELS != -1)
{ {
s32 data = Interpolate<INTERPOLATE_MODE>(chan->pcm16b, chan->pcm16bOffs, chan->sampcntFrac); s32 data;
switch(FORMAT)
{
case 0: Fetch8BitData<INTERPOLATE_MODE>(chan, &data); break;
case 1: Fetch16BitData<INTERPOLATE_MODE>(chan, &data); break;
case 2: FetchADPCMData<INTERPOLATE_MODE>(chan, &data); break;
case 3: FetchPSGData(chan, &data); break;
default: break;
}
SPU_Mix<CHANNELS>(SPU, chan, data); SPU_Mix<CHANNELS>(SPU, chan, data);
} }
switch(FORMAT) {
case 0: case 1: TestForLoop<FORMAT>(SPU, chan); break;
case 2: TestForLoop2(SPU, chan); break;
case 3: chan->sampcnt += chan->sampinc; break;
default: break;
}
} }
} }
@ -1276,14 +1320,12 @@ template<int FORMAT, SPUInterpolationMode INTERPOLATE_MODE>
template<SPUInterpolationMode INTERPOLATE_MODE> template<SPUInterpolationMode INTERPOLATE_MODE>
FORCEINLINE static void __SPU_ChanUpdate(const bool actuallyMix, SPU_struct* const SPU, channel_struct* const chan) FORCEINLINE static void __SPU_ChanUpdate(const bool actuallyMix, SPU_struct* const SPU, channel_struct* const chan)
{ {
// NOTE: PSG doesn't use interpolation, or it would try to
// interpolate between the raw sample points (very bad)
switch(chan->format) switch(chan->format)
{ {
case 0: ___SPU_ChanUpdate<0,INTERPOLATE_MODE>(actuallyMix, SPU, chan); break; case 0: ___SPU_ChanUpdate<0,INTERPOLATE_MODE>(actuallyMix, SPU, chan); break;
case 1: ___SPU_ChanUpdate<1,INTERPOLATE_MODE>(actuallyMix, SPU, chan); break; case 1: ___SPU_ChanUpdate<1,INTERPOLATE_MODE>(actuallyMix, SPU, chan); break;
case 2: ___SPU_ChanUpdate<2,INTERPOLATE_MODE>(actuallyMix, SPU, chan); break; case 2: ___SPU_ChanUpdate<2,INTERPOLATE_MODE>(actuallyMix, SPU, chan); break;
case 3: ___SPU_ChanUpdate<3,SPUInterpolation_None>(actuallyMix, SPU, chan); break; case 3: ___SPU_ChanUpdate<3,INTERPOLATE_MODE>(actuallyMix, SPU, chan); break;
default: assert(false); default: assert(false);
} }
} }
@ -1292,10 +1334,9 @@ FORCEINLINE static void _SPU_ChanUpdate(const bool actuallyMix, SPU_struct* cons
{ {
switch(CommonSettings.spuInterpolationMode) switch(CommonSettings.spuInterpolationMode)
{ {
case SPUInterpolation_None: __SPU_ChanUpdate<SPUInterpolation_None>(actuallyMix, SPU, chan); break; case SPUInterpolation_None: __SPU_ChanUpdate<SPUInterpolation_None>(actuallyMix, SPU, chan); break;
case SPUInterpolation_Linear: __SPU_ChanUpdate<SPUInterpolation_Linear>(actuallyMix, SPU, chan); break; case SPUInterpolation_Linear: __SPU_ChanUpdate<SPUInterpolation_Linear>(actuallyMix, SPU, chan); break;
case SPUInterpolation_Cosine: __SPU_ChanUpdate<SPUInterpolation_Cosine>(actuallyMix, SPU, chan); break; case SPUInterpolation_Cosine: __SPU_ChanUpdate<SPUInterpolation_Cosine>(actuallyMix, SPU, chan); break;
case SPUInterpolation_CatmullRom: __SPU_ChanUpdate<SPUInterpolation_CatmullRom>(actuallyMix, SPU, chan); break;
default: assert(false); default: assert(false);
} }
} }
@ -1446,13 +1487,13 @@ static void SPU_MixAudio_Advanced(bool actuallyMix, SPU_struct *SPU, int length)
for (int capchan = 0; capchan < 2; capchan++) for (int capchan = 0; capchan < 2; capchan++)
{ {
SPU_struct::REGS::CAP& cap = SPU->regs.cap[capchan];
channel_struct& srcChan = SPU->channels[1 + 2 * capchan];
if (SPU->regs.cap[capchan].runtime.running) if (SPU->regs.cap[capchan].runtime.running)
{ {
u32 nSamplesToProcess = srcChan.sampincInt + AddAndReturnCarry(&cap.runtime.sampcntFrac, srcChan.sampincFrac); SPU_struct::REGS::CAP& cap = SPU->regs.cap[capchan];
cap.runtime.sampcntInt += nSamplesToProcess; u32 last = sputrunc(cap.runtime.sampcnt);
while(nSamplesToProcess--) cap.runtime.sampcnt += SPU->channels[1+2*capchan].sampinc;
u32 curr = sputrunc(cap.runtime.sampcnt);
for (u32 j = last; j < curr; j++)
{ {
//so, this is a little strange. why go through a fifo? //so, this is a little strange. why go through a fifo?
//it seems that some games will set up a reverb effect by capturing //it seems that some games will set up a reverb effect by capturing
@ -1503,7 +1544,7 @@ static void SPU_MixAudio_Advanced(bool actuallyMix, SPU_struct *SPU, int length)
if (cap.runtime.curdad >= cap.runtime.maxdad) if (cap.runtime.curdad >= cap.runtime.maxdad)
{ {
cap.runtime.curdad = cap.dad; cap.runtime.curdad = cap.dad;
cap.runtime.sampcntInt -= cap.len*multiplier; cap.runtime.sampcnt -= cap.len*multiplier;
} }
} //sampinc loop } //sampinc loop
} //if capchan running } //if capchan running
@ -1563,14 +1604,14 @@ static void SPU_MixAudio(bool actuallyMix, SPU_struct *SPU, int length)
for (int capchan = 0; capchan < 2; capchan++) for (int capchan = 0; capchan < 2; capchan++)
{ {
SPU_struct::REGS::CAP& cap = SPU->regs.cap[capchan]; SPU_struct::REGS::CAP& cap = SPU->regs.cap[capchan];
channel_struct& srcChan = SPU->channels[1 + 2 * capchan];
if (cap.runtime.running) if (cap.runtime.running)
{ {
for (int samp = 0; samp < length; samp++) for (int samp = 0; samp < length; samp++)
{ {
u32 nSamplesToProcess = srcChan.sampincInt + AddAndReturnCarry(&cap.runtime.sampcntFrac, srcChan.sampincFrac); u32 last = sputrunc(cap.runtime.sampcnt);
cap.runtime.sampcntInt += nSamplesToProcess; cap.runtime.sampcnt += SPU->channels[1+2*capchan].sampinc;
while (nSamplesToProcess--) u32 curr = sputrunc(cap.runtime.sampcnt);
for (u32 j = last; j < curr; j++)
{ {
if (cap.bits8) if (cap.bits8)
{ {
@ -1586,7 +1627,7 @@ static void SPU_MixAudio(bool actuallyMix, SPU_struct *SPU, int length)
if (cap.runtime.curdad >= cap.runtime.maxdad) if (cap.runtime.curdad >= cap.runtime.maxdad)
{ {
cap.runtime.curdad = cap.dad; cap.runtime.curdad = cap.dad;
cap.runtime.sampcntInt -= cap.len*(cap.bits8?4:2); cap.runtime.sampcnt -= cap.len*(cap.bits8?4:2);
} }
} }
} }
@ -1692,7 +1733,7 @@ void SPU_Emulate_user(bool mix)
postProcessBufferSize = freeSampleCount * 2 * sizeof(s16); postProcessBufferSize = freeSampleCount * 2 * sizeof(s16);
postProcessBuffer = (s16 *)realloc(postProcessBuffer, postProcessBufferSize); postProcessBuffer = (s16 *)realloc(postProcessBuffer, postProcessBufferSize);
} }
if (soundProcessor->PostProcessSamples != NULL) if (soundProcessor->PostProcessSamples != NULL)
{ {
processedSampleCount = soundProcessor->PostProcessSamples(postProcessBuffer, freeSampleCount, _currentSynchMode, _currentSynchronizer); processedSampleCount = soundProcessor->PostProcessSamples(postProcessBuffer, freeSampleCount, _currentSynchMode, _currentSynchronizer);
@ -1702,15 +1743,15 @@ void SPU_Emulate_user(bool mix)
processedSampleCount = SPU_DefaultPostProcessSamples(postProcessBuffer, freeSampleCount, _currentSynchMode, _currentSynchronizer); processedSampleCount = SPU_DefaultPostProcessSamples(postProcessBuffer, freeSampleCount, _currentSynchMode, _currentSynchronizer);
} }
soundProcessor->UpdateAudio(postProcessBuffer, (u32)processedSampleCount); soundProcessor->UpdateAudio(postProcessBuffer, processedSampleCount);
WAV_WavSoundUpdate(postProcessBuffer, (int)processedSampleCount, WAVMODE_USER); WAV_WavSoundUpdate(postProcessBuffer, processedSampleCount, WAVMODE_USER);
} }
void SPU_DefaultFetchSamples(s16 *sampleBuffer, size_t sampleCount, ESynchMode synchMode, ISynchronizingAudioBuffer *theSynchronizer) void SPU_DefaultFetchSamples(s16 *sampleBuffer, size_t sampleCount, ESynchMode synchMode, ISynchronizingAudioBuffer *theSynchronizer)
{ {
if (synchMode == ESynchMode_Synchronous) if (synchMode == ESynchMode_Synchronous)
{ {
theSynchronizer->enqueue_samples(sampleBuffer, (int)sampleCount); theSynchronizer->enqueue_samples(sampleBuffer, sampleCount);
} }
} }
@ -1723,14 +1764,14 @@ size_t SPU_DefaultPostProcessSamples(s16 *postProcessBuffer, size_t requestedSam
case ESynchMode_DualSynchAsynch: case ESynchMode_DualSynchAsynch:
if(SPU_user != NULL) if(SPU_user != NULL)
{ {
SPU_MixAudio(true, SPU_user, (int)requestedSampleCount); SPU_MixAudio(true, SPU_user, requestedSampleCount);
memcpy(postProcessBuffer, SPU_user->outbuf, requestedSampleCount * 2 * sizeof(s16)); memcpy(postProcessBuffer, SPU_user->outbuf, requestedSampleCount * 2 * sizeof(s16));
processedSampleCount = requestedSampleCount; processedSampleCount = requestedSampleCount;
} }
break; break;
case ESynchMode_Synchronous: case ESynchMode_Synchronous:
processedSampleCount = theSynchronizer->output_samples(postProcessBuffer, (int)requestedSampleCount); processedSampleCount = theSynchronizer->output_samples(postProcessBuffer, requestedSampleCount);
break; break;
default: default:
@ -1864,7 +1905,7 @@ void WavWriter::update(void* soundData, int numSamples)
{ {
if(!spufp) return; if(!spufp) return;
//TODO - big endian for the s16 samples?? //TODO - big endian for the s16 samples??
fwrite(soundData, (size_t)(numSamples*2), 2, spufp); size_t elems_written = fwrite(soundData, numSamples*2, 2, spufp);
} }
bool WavWriter::isRecording() const bool WavWriter::isRecording() const
@ -1872,6 +1913,7 @@ bool WavWriter::isRecording() const
return spufp != NULL; return spufp != NULL;
} }
static WavWriter wavWriter; static WavWriter wavWriter;
void WAV_End() void WAV_End()
@ -1915,7 +1957,7 @@ void WAV_WavSoundUpdate(void* soundData, int numSamples, WAVMode mode)
void spu_savestate(EMUFILE &os) void spu_savestate(EMUFILE &os)
{ {
//version //version
os.write_32LE(7); os.write_32LE(6);
SPU_struct *spu = SPU_core; SPU_struct *spu = SPU_core;
@ -1931,18 +1973,18 @@ void spu_savestate(EMUFILE &os)
os.write_u8(chan.repeat); os.write_u8(chan.repeat);
os.write_u8(chan.format); os.write_u8(chan.format);
os.write_u8(chan.status); os.write_u8(chan.status);
os.write_u8(chan.pcm16bOffs);
os.write_32LE(chan.addr); os.write_32LE(chan.addr);
os.write_16LE(chan.timer); os.write_16LE(chan.timer);
os.write_16LE(chan.loopstart); os.write_16LE(chan.loopstart);
os.write_32LE(chan.length); os.write_32LE(chan.length);
os.write_32LE(chan.sampcntFrac); os.write_doubleLE(chan.sampcnt);
os.write_32LE(chan.sampcntInt); os.write_doubleLE(chan.sampinc);
os.write_32LE(chan.sampincFrac); os.write_32LE(chan.lastsampcnt);
os.write_32LE(chan.sampincInt); os.write_16LE(chan.pcm16b);
for (int i = 0; i < SPUINTERPOLATION_TAPS; i++) os.write_16LE(chan.pcm16b[i]); os.write_16LE(chan.pcm16b_last);
os.write_32LE(chan.index); os.write_32LE(chan.index);
os.write_16LE(chan.x); os.write_16LE(chan.x);
os.write_16LE(chan.psgnoise_last);
os.write_u8(chan.keyon); os.write_u8(chan.keyon);
} }
@ -1968,8 +2010,7 @@ void spu_savestate(EMUFILE &os)
os.write_u8(spu->regs.cap[i].runtime.running); os.write_u8(spu->regs.cap[i].runtime.running);
os.write_32LE(spu->regs.cap[i].runtime.curdad); os.write_32LE(spu->regs.cap[i].runtime.curdad);
os.write_32LE(spu->regs.cap[i].runtime.maxdad); os.write_32LE(spu->regs.cap[i].runtime.maxdad);
os.write_32LE(spu->regs.cap[i].runtime.sampcntFrac); os.write_doubleLE(spu->regs.cap[i].runtime.sampcnt);
os.write_32LE(spu->regs.cap[i].runtime.sampcntInt);
} }
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
@ -2003,53 +2044,29 @@ bool spu_loadstate(EMUFILE &is, int size)
is.read_u8(chan.repeat); is.read_u8(chan.repeat);
is.read_u8(chan.format); is.read_u8(chan.format);
is.read_u8(chan.status); is.read_u8(chan.status);
if (version >= 7) is.read_u8(chan.pcm16bOffs); else chan.pcm16bOffs = 0;
is.read_32LE(chan.addr); is.read_32LE(chan.addr);
is.read_16LE(chan.timer); is.read_16LE(chan.timer);
is.read_16LE(chan.loopstart); is.read_16LE(chan.loopstart);
is.read_32LE(chan.length); is.read_32LE(chan.length);
chan.totlength = chan.length + chan.loopstart; chan.totlength = chan.length + chan.loopstart;
chan.totlength_shifted = chan.totlength << format_shift[chan.format]; chan.double_totlength_shifted = (double)(chan.totlength << format_shift[chan.format]);
if(version >= 7) { //printf("%f\n",chan.double_totlength_shifted);
is.read_32LE(chan.sampcntFrac); if (version >= 2)
is.read_32LE(chan.sampcntInt);
is.read_32LE(chan.sampincFrac);
is.read_32LE(chan.sampincInt);
}
else if (version >= 2)
{ {
double temp; is.read_doubleLE(chan.sampcnt);
s64 temp2; is.read_doubleLE(chan.sampinc);
is.read_doubleLE(temp); temp2 = (s64)(temp * (1ll << 32));
chan.sampcntFrac = (u32)temp2;
chan.sampcntInt = (s32)(temp2 >> 32);
is.read_doubleLE(temp); temp2 = (u64)(temp * (1ull << 32)); // Intentionally unsigned
chan.sampincFrac = (u32)temp2;
chan.sampincInt = (u32)(temp2 >> 32);
} }
else else
{ {
// FIXME is.read_32LE(*(u32 *)&chan.sampcnt);
// What even is supposed to be happening here? is.read_32LE(*(u32 *)&chan.sampinc);
// sampcnt and sampinc were double type before
// I even made any changes, so this is broken.
chan.sampcntFrac = 0;
is.read_32LE(chan.sampcntInt);
chan.sampincFrac = 0;
is.read_32LE(chan.sampincInt);
}
if (version >= 7) {
for (int i = 0; i < SPUINTERPOLATION_TAPS; i++) is.read_16LE(chan.pcm16b[i]);
}
else
{
is.fseek(4, SEEK_CUR); // chan.lastsampcnt (LE32)
is.read_16LE(chan.pcm16b[0]); // chan.pcm16b
is.fseek(2, SEEK_CUR); // chan.pcm16b_last
} }
is.read_32LE(chan.lastsampcnt);
is.read_16LE(chan.pcm16b);
is.read_16LE(chan.pcm16b_last);
is.read_32LE(chan.index); is.read_32LE(chan.index);
is.read_16LE(chan.x); is.read_16LE(chan.x);
if (version < 7) is.fseek(2, SEEK_CUR); // chan.psgnoise_last (LE16) is.read_16LE(chan.psgnoise_last);
if (version >= 4) if (version >= 4)
is.read_u8(chan.keyon); is.read_u8(chan.keyon);
@ -2088,18 +2105,7 @@ bool spu_loadstate(EMUFILE &is, int size)
is.read_u8(spu->regs.cap[i].runtime.running); is.read_u8(spu->regs.cap[i].runtime.running);
is.read_32LE(spu->regs.cap[i].runtime.curdad); is.read_32LE(spu->regs.cap[i].runtime.curdad);
is.read_32LE(spu->regs.cap[i].runtime.maxdad); is.read_32LE(spu->regs.cap[i].runtime.maxdad);
if (version >= 7) { is.read_doubleLE(spu->regs.cap[i].runtime.sampcnt);
is.read_32LE(spu->regs.cap[i].runtime.sampcntFrac);
is.read_32LE(spu->regs.cap[i].runtime.sampcntInt);
}
else
{
double temp;
u64 temp2;
is.read_doubleLE(temp); temp2 = (u64)(temp * (1ull << 32));
spu->regs.cap[i].runtime.sampcntFrac = (u32)temp2;
spu->regs.cap[i].runtime.sampcntInt = (u32)(temp2 >> 32);
}
} }
} }

View File

@ -36,9 +36,10 @@ class EMUFILE;
#define CHANSTAT_STOPPED 0 #define CHANSTAT_STOPPED 0
#define CHANSTAT_PLAY 1 #define CHANSTAT_PLAY 1
#define SPUINTERPOLATION_TAPS 4 // Must be at least 4 for Catmull-Rom interpolation
//who made these static? theyre used in multiple places. //who made these static? theyre used in multiple places.
FORCEINLINE u32 sputrunc(float f) { return u32floor(f); }
FORCEINLINE u32 sputrunc(double d) { return u32floor(d); }
FORCEINLINE s32 spumuldiv7(s32 val, u8 multiplier) { FORCEINLINE s32 spumuldiv7(s32 val, u8 multiplier) {
assert(multiplier <= 127); assert(multiplier <= 127);
return (multiplier == 127) ? val : ((val * multiplier) >> 7); return (multiplier == 127) ? val : ((val * multiplier) >> 7);
@ -48,8 +49,7 @@ enum SPUInterpolationMode
{ {
SPUInterpolation_None = 0, SPUInterpolation_None = 0,
SPUInterpolation_Linear = 1, SPUInterpolation_Linear = 1,
SPUInterpolation_Cosine = 2, SPUInterpolation_Cosine = 2
SPUInterpolation_CatmullRom = 3
}; };
struct SoundInterface_struct struct SoundInterface_struct
@ -84,21 +84,22 @@ struct channel_struct
format(0), format(0),
keyon(0), keyon(0),
status(0), status(0),
pcm16bOffs(0),
addr(0), addr(0),
timer(0), timer(0),
loopstart(0), loopstart(0),
length(0), length(0),
totlength(0), totlength(0),
totlength_shifted(0), double_totlength_shifted(0.0),
sampcntFrac(0), sampcnt(0.0),
sampcntInt(0), sampinc(0.0),
sampincFrac(0), lastsampcnt(0),
sampincInt(0), pcm16b(0),
pcm16b_last(0),
loop_pcm16b(0), loop_pcm16b(0),
index(0), index(0),
loop_index(0), loop_index(0),
x(0) x(0),
psgnoise_last(0)
{} {}
u32 num; u32 num;
u8 vol; u8 vol;
@ -110,24 +111,22 @@ struct channel_struct
u8 format; u8 format;
u8 keyon; u8 keyon;
u8 status; u8 status;
u8 pcm16bOffs;
u32 addr; u32 addr;
u16 timer; u16 timer;
u16 loopstart; u16 loopstart;
u32 length; u32 length;
u32 totlength; u32 totlength;
s32 totlength_shifted; double double_totlength_shifted;
u32 sampcntFrac; double sampcnt;
s32 sampcntInt; double sampinc;
u32 sampincFrac;
u32 sampincInt;
s16 pcm16b[SPUINTERPOLATION_TAPS];
// ADPCM specific // ADPCM specific
u32 lastsampcnt;
s16 pcm16b, pcm16b_last;
s16 loop_pcm16b; s16 loop_pcm16b;
s32 index; s32 index;
int loop_index; int loop_index;
// PSG noise
u16 x; u16 x;
s16 psgnoise_last;
}; };
class SPUFifo class SPUFifo
@ -197,8 +196,7 @@ public:
u8 running; u8 running;
u32 curdad; u32 curdad;
u32 maxdad; u32 maxdad;
u32 sampcntFrac; double sampcnt;
u32 sampcntInt;
SPUFifo fifo; SPUFifo fifo;
} runtime; } runtime;
} cap[2]; } cap[2];

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2015 DeSmuME team Copyright (C) 2013-2105 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2025 DeSmuME team Copyright (C) 2013-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -193,7 +193,7 @@ private:
if (fpROM) if (fpROM)
{ {
u32 data = 0; u32 data = 0;
u32 readed = (u32)fread(&data, 1, 4, fpROM); u32 readed = fread(&data, 1, 4, fpROM);
if (readed) if (readed)
{ {
rom.incAddress(); rom.incAddress();

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2025 DeSmuME team Copyright (C) 2013-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -59,8 +59,6 @@ enum eSlot1Operation
class ISlot1Comp_Protocol_Client class ISlot1Comp_Protocol_Client
{ {
public: public:
virtual ~ISlot1Comp_Protocol_Client() {}
virtual void slot1client_startOperation(eSlot1Operation theOperation) {} virtual void slot1client_startOperation(eSlot1Operation theOperation) {}
virtual u32 slot1client_read_GCDATAIN(eSlot1Operation theOperation) = 0; virtual u32 slot1client_read_GCDATAIN(eSlot1Operation theOperation) = 0;
virtual void slot1client_write_GCDATAIN(eSlot1Operation theOperation, u32 val) {} virtual void slot1client_write_GCDATAIN(eSlot1Operation theOperation, u32 val) {}

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2009 CrazyMax Copyright (C) 2009 CrazyMax
Copyright (C) 2009-2025 DeSmuME team Copyright (C) 2009-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -65,7 +65,7 @@ private:
fROM->fseek(pos, SEEK_SET); fROM->fseek(pos, SEEK_SET);
u32 data = 0xFFFFFFFF; u32 data = 0xFFFFFFFF;
u32 readed = (u32)fROM->fread(&data, size); u32 readed = fROM->fread(&data, size);
return data; return data;
} }
@ -77,7 +77,7 @@ private:
fSRAM->fseek(pos, SEEK_SET); fSRAM->fseek(pos, SEEK_SET);
u32 data = 0xFFFFFFFF; u32 data = 0xFFFFFFFF;
u32 readed = (u32)fSRAM->fread(&data, size); u32 readed = fSRAM->fread(&data, size);
return data; return data;
} }
@ -107,7 +107,7 @@ private:
for(;;) for(;;)
{ {
u32 romType = 0; u32 romType = 0;
u32 readed = (u32)fROM->fread(&romType, 4); u32 readed = fROM->fread(&romType, 4);
int pos = fROM->ftell(); int pos = fROM->ftell();
int currPct = pos*100/(size-1); int currPct = pos*100/(size-1);

View File

@ -1,87 +0,0 @@
//HCV-1000 emulation code adapted from GBE+: https://github.com/shonumi/gbe-plus
/*
Modifications Copyright (C) 2023 DeSmuME team
This file 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 file 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 the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include "../slot2.h"
u8 hcv1000_cnt;
char hcv1000_data[16];
class Slot2_HCV1000 : public ISlot2Interface
{
public:
virtual Slot2Info const* info()
{
static Slot2InfoSimple info("Sega Card Reader", "Sega Card Reader(HCV-1000) add-on", 0x09);
return &info;
}
virtual bool init()
{
hcv1000_cnt = 0;
memset(hcv1000_data, 0x5F, 16);
return TRUE;
}
virtual void writeByte(u8 PROCNUM, u32 addr, u8 val)
{
if (addr == 0xA000000) { hcv1000_cnt = (val & 0x83); }
}
virtual u8 readByte(u8 PROCNUM, u32 addr)
{
u8 slot_byte = 0xFF;
//Reading these cart addresses is for detection
if (addr < 0x8020000)
{
u8 data = 0xF0 | ((addr & 0x1F) >> 1);
slot_byte = (addr & 0x1) ? 0xFD : data;
}
//HCV_CNT
else if (addr == 0xA000000) { slot_byte = hcv1000_cnt; }
//HCV_DATA
else if ((addr >= 0xA000010) && (addr <= 0xA00001F))
{
slot_byte = (u8)hcv1000_data[addr & 0xF];
}
return slot_byte;
}
virtual u16 readWord(u8 PROCNUM, u32 addr) { return 0xFDFD; };
virtual u32 readLong(u8 PROCNUM, u32 addr) { return 0xFDFDFDFD; };
};
ISlot2Interface* construct_Slot2_HCV1000() { return new Slot2_HCV1000(); }
void HCV1000_setReady()
{
hcv1000_cnt &= ~0x80;
}
void HCV1000_setBarcode(std::string barcode)
{
barcode.resize(16, '_');
memcpy(hcv1000_data, barcode.c_str(), barcode.length());
}

File diff suppressed because it is too large Load Diff

View File

@ -60,7 +60,6 @@
using namespace AsmJit; using namespace AsmJit;
#if (LOG_JIT_LEVEL > 0) #if (LOG_JIT_LEVEL > 0)
#include "../modules/Disassembler.h"
#define LOG_JIT 1 #define LOG_JIT 1
#define JIT_COMMENT(...) c.comment(__VA_ARGS__) #define JIT_COMMENT(...) c.comment(__VA_ARGS__)
#define printJIT(buf, val) { \ #define printJIT(buf, val) { \
@ -1530,7 +1529,7 @@ static int OP_MSR_SPSR_IMM_VAL(const u32 i) { OP_MSR_(SPSR, IMM_VAL, 0); }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LDR // LDR
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
typedef u32 (DESMUME_FASTCALL* OpLDR)(u32, u32*); typedef u32 (FASTCALL* OpLDR)(u32, u32*);
// 98% of all memory accesses land in the same region as the first execution of // 98% of all memory accesses land in the same region as the first execution of
// that instruction, so keep multiple copies with different fastpaths. // that instruction, so keep multiple copies with different fastpaths.
@ -1561,7 +1560,7 @@ static u32 classify_adr(u32 adr, bool store)
} }
template<int PROCNUM, int memtype> template<int PROCNUM, int memtype>
static u32 DESMUME_FASTCALL OP_LDR(u32 adr, u32 *dstreg) static u32 FASTCALL OP_LDR(u32 adr, u32 *dstreg)
{ {
u32 data = READ32(cpu->mem_if->data, adr); u32 data = READ32(cpu->mem_if->data, adr);
if(adr&3) if(adr&3)
@ -1571,28 +1570,28 @@ static u32 DESMUME_FASTCALL OP_LDR(u32 adr, u32 *dstreg)
} }
template<int PROCNUM, int memtype> template<int PROCNUM, int memtype>
static u32 DESMUME_FASTCALL OP_LDRH(u32 adr, u32 *dstreg) static u32 FASTCALL OP_LDRH(u32 adr, u32 *dstreg)
{ {
*dstreg = READ16(cpu->mem_if->data, adr); *dstreg = READ16(cpu->mem_if->data, adr);
return MMU_aluMemAccessCycles<PROCNUM,16,MMU_AD_READ>(3,adr); return MMU_aluMemAccessCycles<PROCNUM,16,MMU_AD_READ>(3,adr);
} }
template<int PROCNUM, int memtype> template<int PROCNUM, int memtype>
static u32 DESMUME_FASTCALL OP_LDRSH(u32 adr, u32 *dstreg) static u32 FASTCALL OP_LDRSH(u32 adr, u32 *dstreg)
{ {
*dstreg = (s16)READ16(cpu->mem_if->data, adr); *dstreg = (s16)READ16(cpu->mem_if->data, adr);
return MMU_aluMemAccessCycles<PROCNUM,16,MMU_AD_READ>(3,adr); return MMU_aluMemAccessCycles<PROCNUM,16,MMU_AD_READ>(3,adr);
} }
template<int PROCNUM, int memtype> template<int PROCNUM, int memtype>
static u32 DESMUME_FASTCALL OP_LDRB(u32 adr, u32 *dstreg) static u32 FASTCALL OP_LDRB(u32 adr, u32 *dstreg)
{ {
*dstreg = READ8(cpu->mem_if->data, adr); *dstreg = READ8(cpu->mem_if->data, adr);
return MMU_aluMemAccessCycles<PROCNUM,8,MMU_AD_READ>(3,adr); return MMU_aluMemAccessCycles<PROCNUM,8,MMU_AD_READ>(3,adr);
} }
template<int PROCNUM, int memtype> template<int PROCNUM, int memtype>
static u32 DESMUME_FASTCALL OP_LDRSB(u32 adr, u32 *dstreg) static u32 FASTCALL OP_LDRSB(u32 adr, u32 *dstreg)
{ {
*dstreg = (s8)READ8(cpu->mem_if->data, adr); *dstreg = (s8)READ8(cpu->mem_if->data, adr);
return MMU_aluMemAccessCycles<PROCNUM,8,MMU_AD_READ>(3,adr); return MMU_aluMemAccessCycles<PROCNUM,8,MMU_AD_READ>(3,adr);
@ -1774,27 +1773,27 @@ static int OP_LDRSB_POS_INDE_M_REG_OFF(const u32 i) { OP_LDR_(LDRSB, REG_OFF, su
// STR // STR
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<int PROCNUM, int memtype> template<int PROCNUM, int memtype>
static u32 DESMUME_FASTCALL OP_STR(u32 adr, u32 data) static u32 FASTCALL OP_STR(u32 adr, u32 data)
{ {
WRITE32(cpu->mem_if->data, adr, data); WRITE32(cpu->mem_if->data, adr, data);
return MMU_aluMemAccessCycles<PROCNUM,32,MMU_AD_WRITE>(2,adr); return MMU_aluMemAccessCycles<PROCNUM,32,MMU_AD_WRITE>(2,adr);
} }
template<int PROCNUM, int memtype> template<int PROCNUM, int memtype>
static u32 DESMUME_FASTCALL OP_STRH(u32 adr, u32 data) static u32 FASTCALL OP_STRH(u32 adr, u32 data)
{ {
WRITE16(cpu->mem_if->data, adr, data); WRITE16(cpu->mem_if->data, adr, data);
return MMU_aluMemAccessCycles<PROCNUM,16,MMU_AD_WRITE>(2,adr); return MMU_aluMemAccessCycles<PROCNUM,16,MMU_AD_WRITE>(2,adr);
} }
template<int PROCNUM, int memtype> template<int PROCNUM, int memtype>
static u32 DESMUME_FASTCALL OP_STRB(u32 adr, u32 data) static u32 FASTCALL OP_STRB(u32 adr, u32 data)
{ {
WRITE8(cpu->mem_if->data, adr, data); WRITE8(cpu->mem_if->data, adr, data);
return MMU_aluMemAccessCycles<PROCNUM,8,MMU_AD_WRITE>(2,adr); return MMU_aluMemAccessCycles<PROCNUM,8,MMU_AD_WRITE>(2,adr);
} }
typedef u32 (DESMUME_FASTCALL* OpSTR)(u32, u32); typedef u32 (FASTCALL* OpSTR)(u32, u32);
#define T(op) op<0,0>, op<0,1>, op<0,2>, op<1,0>, op<1,1>, NULL #define T(op) op<0,0>, op<0,1>, op<0,2>, op<1,0>, op<1,1>, NULL
static const OpSTR STR_tab[2][3] = { T(OP_STR) }; static const OpSTR STR_tab[2][3] = { T(OP_STR) };
static const OpSTR STRH_tab[2][3] = { T(OP_STRH) }; static const OpSTR STRH_tab[2][3] = { T(OP_STRH) };
@ -1913,9 +1912,9 @@ static int OP_STRB_M_ROR_IMM_OFF_POSTIND(const u32 i) { OP_STR_(STRB, ROR_IMM, s
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// LDRD / STRD // LDRD / STRD
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
typedef u32 DESMUME_FASTCALL (*LDRD_STRD_REG)(u32); typedef u32 FASTCALL (*LDRD_STRD_REG)(u32);
template<int PROCNUM, u8 Rnum> template<int PROCNUM, u8 Rnum>
static u32 DESMUME_FASTCALL OP_LDRD_REG(u32 adr) static u32 FASTCALL OP_LDRD_REG(u32 adr)
{ {
cpu->R[Rnum] = READ32(cpu->mem_if->data, adr); cpu->R[Rnum] = READ32(cpu->mem_if->data, adr);
@ -1929,7 +1928,7 @@ static u32 DESMUME_FASTCALL OP_LDRD_REG(u32 adr)
return MMU_memAccessCycles<PROCNUM,32,MMU_AD_READ>(adr); return MMU_memAccessCycles<PROCNUM,32,MMU_AD_READ>(adr);
} }
template<int PROCNUM, u8 Rnum> template<int PROCNUM, u8 Rnum>
static u32 DESMUME_FASTCALL OP_STRD_REG(u32 adr) static u32 FASTCALL OP_STRD_REG(u32 adr)
{ {
WRITE32(cpu->mem_if->data, adr, cpu->R[Rnum]); WRITE32(cpu->mem_if->data, adr, cpu->R[Rnum]);
@ -2044,7 +2043,7 @@ static int OP_LDRD_STRD_OFFSET_PRE_INDEX(const u32 i)
// SWP/SWPB // SWP/SWPB
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<int PROCNUM> template<int PROCNUM>
static u32 DESMUME_FASTCALL op_swp(u32 adr, u32 *Rd, u32 Rs) static u32 FASTCALL op_swp(u32 adr, u32 *Rd, u32 Rs)
{ {
u32 tmp = ROR(READ32(cpu->mem_if->data, adr), (adr & 3)<<3); u32 tmp = ROR(READ32(cpu->mem_if->data, adr), (adr & 3)<<3);
WRITE32(cpu->mem_if->data, adr, Rs); WRITE32(cpu->mem_if->data, adr, Rs);
@ -2052,7 +2051,7 @@ static u32 DESMUME_FASTCALL op_swp(u32 adr, u32 *Rd, u32 Rs)
return (MMU_memAccessCycles<PROCNUM,32,MMU_AD_READ>(adr) + MMU_memAccessCycles<PROCNUM,32,MMU_AD_WRITE>(adr)); return (MMU_memAccessCycles<PROCNUM,32,MMU_AD_READ>(adr) + MMU_memAccessCycles<PROCNUM,32,MMU_AD_WRITE>(adr));
} }
template<int PROCNUM> template<int PROCNUM>
static u32 DESMUME_FASTCALL op_swpb(u32 adr, u32 *Rd, u32 Rs) static u32 FASTCALL op_swpb(u32 adr, u32 *Rd, u32 Rs)
{ {
u32 tmp = READ8(cpu->mem_if->data, adr); u32 tmp = READ8(cpu->mem_if->data, adr);
WRITE8(cpu->mem_if->data, adr, Rs); WRITE8(cpu->mem_if->data, adr, Rs);
@ -2060,7 +2059,7 @@ static u32 DESMUME_FASTCALL op_swpb(u32 adr, u32 *Rd, u32 Rs)
return (MMU_memAccessCycles<PROCNUM,8,MMU_AD_READ>(adr) + MMU_memAccessCycles<PROCNUM,8,MMU_AD_WRITE>(adr)); return (MMU_memAccessCycles<PROCNUM,8,MMU_AD_READ>(adr) + MMU_memAccessCycles<PROCNUM,8,MMU_AD_WRITE>(adr));
} }
typedef u32 DESMUME_FASTCALL (*OP_SWP_SWPB)(u32, u32*, u32); typedef u32 FASTCALL (*OP_SWP_SWPB)(u32, u32*, u32);
static const OP_SWP_SWPB op_swp_tab[2][2] = {{ op_swp<0>, op_swp<1> }, { op_swpb<0>, op_swpb<1> }}; static const OP_SWP_SWPB op_swp_tab[2][2] = {{ op_swp<0>, op_swp<1> }, { op_swpb<0>, op_swpb<1> }};
static int op_swp_(const u32 i, int b) static int op_swp_(const u32 i, int b)
@ -2119,7 +2118,7 @@ static u64 get_reg_list(u32 reg_mask, int dir)
#endif #endif
template <int PROCNUM, bool store, int dir> template <int PROCNUM, bool store, int dir>
static LDM_INLINE DESMUME_FASTCALL u32 OP_LDM_STM_generic(u32 adr, u64 regs, int n) static LDM_INLINE FASTCALL u32 OP_LDM_STM_generic(u32 adr, u64 regs, int n)
{ {
u32 cycles = 0; u32 cycles = 0;
adr &= ~3; adr &= ~3;
@ -2140,7 +2139,7 @@ static LDM_INLINE DESMUME_FASTCALL u32 OP_LDM_STM_generic(u32 adr, u64 regs, int
#endif #endif
template <int PROCNUM, bool store, int dir> template <int PROCNUM, bool store, int dir>
static LDM_INLINE DESMUME_FASTCALL u32 OP_LDM_STM_other(u32 adr, u64 regs, int n) static LDM_INLINE FASTCALL u32 OP_LDM_STM_other(u32 adr, u64 regs, int n)
{ {
u32 cycles = 0; u32 cycles = 0;
adr &= ~3; adr &= ~3;
@ -2162,7 +2161,7 @@ static LDM_INLINE DESMUME_FASTCALL u32 OP_LDM_STM_other(u32 adr, u64 regs, int n
} }
template <int PROCNUM, bool store, int dir, bool null_compiled> template <int PROCNUM, bool store, int dir, bool null_compiled>
static FORCEINLINE DESMUME_FASTCALL u32 OP_LDM_STM_main(u32 adr, u64 regs, int n, u8 *ptr, u32 cycles) static FORCEINLINE FASTCALL u32 OP_LDM_STM_main(u32 adr, u64 regs, int n, u8 *ptr, u32 cycles)
{ {
#ifdef ENABLE_ADVANCED_TIMING #ifdef ENABLE_ADVANCED_TIMING
cycles = 0; cycles = 0;
@ -2201,7 +2200,7 @@ static FORCEINLINE DESMUME_FASTCALL u32 OP_LDM_STM_main(u32 adr, u64 regs, int n
} }
template <int PROCNUM, bool store, int dir> template <int PROCNUM, bool store, int dir>
static u32 DESMUME_FASTCALL OP_LDM_STM(u32 adr, u64 regs, int n) static u32 FASTCALL OP_LDM_STM(u32 adr, u64 regs, int n)
{ {
// TODO use classify_adr? // TODO use classify_adr?
u32 cycles; u32 cycles;
@ -2242,7 +2241,7 @@ static u32 DESMUME_FASTCALL OP_LDM_STM(u32 adr, u64 regs, int n)
return OP_LDM_STM_main<PROCNUM, store, dir, store>(adr, regs, n, ptr, cycles); return OP_LDM_STM_main<PROCNUM, store, dir, store>(adr, regs, n, ptr, cycles);
} }
typedef u32 DESMUME_FASTCALL (*LDMOpFunc)(u32,u64,int); typedef u32 FASTCALL (*LDMOpFunc)(u32,u64,int);
static const LDMOpFunc op_ldm_stm_tab[2][2][2] = {{ static const LDMOpFunc op_ldm_stm_tab[2][2][2] = {{
{ OP_LDM_STM<0,0,-1>, OP_LDM_STM<0,0,+1> }, { OP_LDM_STM<0,0,-1>, OP_LDM_STM<0,0,+1> },
{ OP_LDM_STM<0,1,-1>, OP_LDM_STM<0,1,+1> }, { OP_LDM_STM<0,1,-1>, OP_LDM_STM<0,1,+1> },
@ -3849,7 +3848,7 @@ static const ArmOpCompiler thumb_instruction_compilers[1024] = {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<int PROCNUM, int thumb> template<int PROCNUM, int thumb>
static u32 DESMUME_FASTCALL OP_DECODE() static u32 FASTCALL OP_DECODE()
{ {
u32 cycles; u32 cycles;
u32 adr = cpu->instruct_adr; u32 adr = cpu->instruct_adr;

View File

@ -24,7 +24,7 @@
#include <stdint.h> #include <stdint.h>
#endif #endif
typedef u32 (DESMUME_FASTCALL* ArmOpCompiled)(); typedef u32 (FASTCALL* ArmOpCompiled)();
void arm_jit_reset(bool enable, bool suppress_msg = false); void arm_jit_reset(bool enable, bool suppress_msg = false);
void arm_jit_close(); void arm_jit_close();

View File

@ -460,23 +460,23 @@ FORCEINLINE static u32 armcpu_prefetch()
} }
#if 0 /* not used */ #if 0 /* not used */
static BOOL DESMUME_FASTCALL test_EQ(Status_Reg CPSR) { return ( CPSR.bits.Z); } static BOOL FASTCALL test_EQ(Status_Reg CPSR) { return ( CPSR.bits.Z); }
static BOOL DESMUME_FASTCALL test_NE(Status_Reg CPSR) { return (!CPSR.bits.Z); } static BOOL FASTCALL test_NE(Status_Reg CPSR) { return (!CPSR.bits.Z); }
static BOOL DESMUME_FASTCALL test_CS(Status_Reg CPSR) { return ( CPSR.bits.C); } static BOOL FASTCALL test_CS(Status_Reg CPSR) { return ( CPSR.bits.C); }
static BOOL DESMUME_FASTCALL test_CC(Status_Reg CPSR) { return (!CPSR.bits.C); } static BOOL FASTCALL test_CC(Status_Reg CPSR) { return (!CPSR.bits.C); }
static BOOL DESMUME_FASTCALL test_MI(Status_Reg CPSR) { return ( CPSR.bits.N); } static BOOL FASTCALL test_MI(Status_Reg CPSR) { return ( CPSR.bits.N); }
static BOOL DESMUME_FASTCALL test_PL(Status_Reg CPSR) { return (!CPSR.bits.N); } static BOOL FASTCALL test_PL(Status_Reg CPSR) { return (!CPSR.bits.N); }
static BOOL DESMUME_FASTCALL test_VS(Status_Reg CPSR) { return ( CPSR.bits.V); } static BOOL FASTCALL test_VS(Status_Reg CPSR) { return ( CPSR.bits.V); }
static BOOL DESMUME_FASTCALL test_VC(Status_Reg CPSR) { return (!CPSR.bits.V); } static BOOL FASTCALL test_VC(Status_Reg CPSR) { return (!CPSR.bits.V); }
static BOOL DESMUME_FASTCALL test_HI(Status_Reg CPSR) { return (CPSR.bits.C) && (!CPSR.bits.Z); } static BOOL FASTCALL test_HI(Status_Reg CPSR) { return (CPSR.bits.C) && (!CPSR.bits.Z); }
static BOOL DESMUME_FASTCALL test_LS(Status_Reg CPSR) { return (CPSR.bits.Z) || (!CPSR.bits.C); } static BOOL FASTCALL test_LS(Status_Reg CPSR) { return (CPSR.bits.Z) || (!CPSR.bits.C); }
static BOOL DESMUME_FASTCALL test_GE(Status_Reg CPSR) { return (CPSR.bits.N==CPSR.bits.V); } static BOOL FASTCALL test_GE(Status_Reg CPSR) { return (CPSR.bits.N==CPSR.bits.V); }
static BOOL DESMUME_FASTCALL test_LT(Status_Reg CPSR) { return (CPSR.bits.N!=CPSR.bits.V); } static BOOL FASTCALL test_LT(Status_Reg CPSR) { return (CPSR.bits.N!=CPSR.bits.V); }
static BOOL DESMUME_FASTCALL test_GT(Status_Reg CPSR) { return (!CPSR.bits.Z) && (CPSR.bits.N==CPSR.bits.V); } static BOOL FASTCALL test_GT(Status_Reg CPSR) { return (!CPSR.bits.Z) && (CPSR.bits.N==CPSR.bits.V); }
static BOOL DESMUME_FASTCALL test_LE(Status_Reg CPSR) { return ( CPSR.bits.Z) || (CPSR.bits.N!=CPSR.bits.V); } static BOOL FASTCALL test_LE(Status_Reg CPSR) { return ( CPSR.bits.Z) || (CPSR.bits.N!=CPSR.bits.V); }
static BOOL DESMUME_FASTCALL test_AL(Status_Reg CPSR) { return 1; } static BOOL FASTCALL test_AL(Status_Reg CPSR) { return 1; }
static BOOL (DESMUME_FASTCALL* test_conditions[])(Status_Reg CPSR)= { static BOOL (FASTCALL* test_conditions[])(Status_Reg CPSR)= {
test_EQ , test_NE , test_EQ , test_NE ,
test_CS , test_CC , test_CS , test_CC ,
test_MI , test_PL , test_MI , test_PL ,

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2024 DeSmuME team Copyright (C) 2009-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -24,51 +24,31 @@
#define CHEAT_VERSION_MAJOR 2 #define CHEAT_VERSION_MAJOR 2
#define CHEAT_VERSION_MINOR 0 #define CHEAT_VERSION_MINOR 0
#define MAX_CHEAT_LIST 100
#define MAX_XX_CODE 1024 #define MAX_XX_CODE 1024
#define CHEAT_FILE_MIN_FGETS_BUFFER 32768 #define CHEAT_FILE_MIN_FGETS_BUFFER 32768
#define CHEAT_DB_GAME_TITLE_SIZE 256
#define CHEAT_TYPE_EMPTY 0xFF #define CHEAT_TYPE_EMPTY 0xFF
#define CHEAT_TYPE_INTERNAL 0 #define CHEAT_TYPE_INTERNAL 0
#define CHEAT_TYPE_AR 1 #define CHEAT_TYPE_AR 1
#define CHEAT_TYPE_CODEBREAKER 2 #define CHEAT_TYPE_CODEBREAKER 2
enum CheatSystemError
{
CheatSystemError_NoError = 0,
CheatSystemError_FileOpenFailed = 1,
CheatSystemError_FileFormatInvalid = 2,
CheatSystemError_GameNotFound = 3,
CheatSystemError_LoadEntryError = 4,
CheatSystemError_FileSaveFailed = 5,
CheatSystemError_FileDoesNotExist = 6
};
struct CHEATS_LIST struct CHEATS_LIST
{ {
CHEATS_LIST() CHEATS_LIST()
{ {
memset(this,0,sizeof(*this)); memset(this,0,sizeof(*this));
type = CHEAT_TYPE_EMPTY; type = 0xFF;
} }
u8 type; u8 type;
u8 enabled; BOOL enabled;
// TODO // TODO
u8 freezeType; // 0 - normal freeze u8 freezeType; // 0 - normal freeze
// 1 - can decrease // 1 - can decrease
// 2 - can increase // 2 - can increase
u32 code[MAX_XX_CODE][2]; u32 code[MAX_XX_CODE][2];
char description[1024];
union
{
char description[1024];
struct
{
char descriptionMajor[512];
char descriptionMinor[512];
};
};
u32 num; u32 num;
u8 size; u8 size;
}; };
@ -76,85 +56,56 @@ struct CHEATS_LIST
class CHEATS class CHEATS
{ {
private: private:
std::vector<CHEATS_LIST> _list; std::vector<CHEATS_LIST> list;
u8 _filename[MAX_PATH]; u8 filename[MAX_PATH];
size_t _currentGet; u32 currentGet;
void clear();
void ARparser(CHEATS_LIST& cheat);
char *clearCode(char *s); char *clearCode(char *s);
public: public:
CHEATS() CHEATS()
: _currentGet(0) : currentGet(0)
{ {
memset(_filename, 0, sizeof(_filename)); memset(filename, 0, sizeof(filename));
} }
~CHEATS() {} ~CHEATS() {}
void clear(); void init(char *path);
void init(const char *thePath); BOOL add(u8 size, u32 address, u32 val, char *description, BOOL enabled);
const char* getFilePath() const; BOOL update(u8 size, u32 address, u32 val, char *description, BOOL enabled, u32 pos);
void setFilePath(const char *thePath); BOOL move(u32 srcPos, u32 dstPos);
BOOL add_AR(char *code, char *description, BOOL enabled);
size_t addItem(const CHEATS_LIST &srcCheat); BOOL update_AR(char *code, char *description, BOOL enabled, u32 pos);
bool add(u8 size, u32 address, u32 val, char *description, bool enabled); BOOL add_AR_Direct(CHEATS_LIST cheat);
bool add(u8 size, u32 address, u32 val, char *description, u8 enabled); BOOL add_CB(char *code, char *description, BOOL enabled);
BOOL update_CB(char *code, char *description, BOOL enabled, u32 pos);
bool updateItemAtIndex(const CHEATS_LIST &srcCheat, const size_t pos); BOOL remove(u32 pos);
bool update(u8 size, u32 address, u32 val, char *description, bool enabled, const size_t pos);
bool update(u8 size, u32 address, u32 val, char *description, u8 enabled, const size_t pos);
bool move(size_t srcPos, size_t dstPos);
size_t add_AR_Direct(const CHEATS_LIST &srcCheat);
bool add_AR(char *code, char *description, bool enabled);
bool add_AR(char *code, char *description, u8 enabled);
bool update_AR(char *code, char *description, bool enabled, const size_t pos);
bool update_AR(char *code, char *description, u8 enabled, const size_t pos);
bool add_CB(char *code, char *description, bool enabled);
bool add_CB(char *code, char *description, u8 enabled);
bool update_CB(char *code, char *description, bool enabled, const size_t pos);
bool update_CB(char *code, char *description, u8 enabled, const size_t pos);
bool remove(const size_t pos);
void toggle(bool enabled, const size_t pos);
void toggle(u8 enablbed, const size_t pos);
void getListReset(); void getListReset();
bool getList(CHEATS_LIST *cheat); BOOL getList(CHEATS_LIST *cheat);
CHEATS_LIST* getListPtr(); CHEATS_LIST* getListPtr();
bool copyItemFromIndex(const size_t pos, CHEATS_LIST &outCheatItem); BOOL get(CHEATS_LIST *cheat, u32 pos);
CHEATS_LIST* getItemPtrAtIndex(const size_t pos) const; CHEATS_LIST* getItemByIndex(const u32 pos);
size_t getListSize() const; u32 getSize();
size_t getActiveCount() const; size_t getActiveCount();
void setDescription(const char *description, const size_t pos); void setDescription(const char *description, u32 pos);
bool save(); BOOL save();
bool load(); BOOL load();
bool process(int targetType) const; void process(int targetType);
void getXXcodeString(CHEATS_LIST theList, char *res_buf);
static void JitNeedsReset(); static BOOL XXCodeFromString(CHEATS_LIST *cheatItem, const std::string codeString);
static bool ResetJitIfNeeded(); static BOOL XXCodeFromString(CHEATS_LIST *cheatItem, const char *codeString);
template<size_t LENGTH> static bool DirectWrite(const int targetProc, const u32 targetAddress, u32 newValue);
static bool DirectWrite(const size_t newValueLength, const int targetProc, const u32 targetAddress, u32 newValue);
static bool ARparser(const CHEATS_LIST &cheat);
static void StringFromXXCode(const CHEATS_LIST &srcCheatItem, char *outCStringBuffer);
static bool XXCodeFromString(const std::string codeString, CHEATS_LIST &outCheatItem);
static bool XXCodeFromString(const char *codeString, CHEATS_LIST &outCheatItem);
}; };
class CHEATSEARCH class CHEATSEARCH
{ {
private: private:
u8 *_statMem; u8 *statMem;
u8 *_mem; u8 *mem;
u32 _amount; u32 amount;
u32 _lastRecord; u32 lastRecord;
u32 _type; u32 _type;
u32 _size; u32 _size;
@ -162,168 +113,90 @@ private:
public: public:
CHEATSEARCH() CHEATSEARCH()
: _statMem(0), _mem(0), _amount(0), _lastRecord(0), _type(0), _size(0), _sign(0) : statMem(0), mem(0), amount(0), lastRecord(0), _type(0), _size(0), _sign(0)
{} {}
~CHEATSEARCH() { this->close(); } ~CHEATSEARCH() { close(); }
bool start(u8 type, u8 size, u8 sign); BOOL start(u8 type, u8 size, u8 sign);
void close(); BOOL close();
u32 search(u32 val); u32 search(u32 val);
u32 search(u8 comp); u32 search(u8 comp);
u32 getAmount(); u32 getAmount();
bool getList(u32 *address, u32 *curVal); BOOL getList(u32 *address, u32 *curVal);
void getListReset(); void getListReset();
}; };
#define CHEATDB_OFFSET_FILE_DESCRIPTION 0x00000010 enum CHEATS_DB_TYPE
#define CHEATDB_FILEOFFSET_FIRST_FAT_ENTRY 0x00000100
enum CheatDBFileFormat
{ {
CheatDBFileFormat_Undefined = 0, CHEATS_DB_R4 = 0
CheatDBFileFormat_R4 = 1,
CheatDBFileFormat_Unknown = 65535
}; };
// This struct maps to the FAT entries in the R4 cheat database file.
#pragma pack(push) #pragma pack(push)
#pragma pack(1) #pragma pack(1)
typedef struct FAT_R4 typedef struct FAT_R4
{ {
u8 serial[4]; u8 serial[4];
u32 CRC; u32 CRC;
u64 addr; u64 addr;
} FAT_R4; } FAT_R4;
#pragma pack(pop) #pragma pack(pop)
// Wrapper for a single entry in a memory block that contains data read from a cheat database file.
// This struct also maintains the hierarchical relationships between entries.
struct CheatDBEntry
{
u8 *base; // Pointer to the entry's base location in memory.
char *name; // Pointer to the entry's name string.
char *note; // Pointer to the entry's note string.
u32 *codeLength; // Pointer to the entry's 32-bit code length in bytes. This value is NULL if the entry is a directory.
u32 *codeData; // Pointer to the entry's code data, provided in pairs of 32-bit values. This value is NULL if the entry is a directory.
CheatDBEntry *parent;
std::vector<CheatDBEntry> child;
};
typedef struct CheatDBEntry CheatDBEntry;
class CheatDBGame
{
protected:
u32 _baseOffset; // This offset is relative to the file head.
u32 _firstEntryOffset; // This offset is relative to the file head.
u32 _encryptOffset; // This offset is relative to the memory address of this->_entryDataRawPtr.
u32 _rawDataSize;
u32 _workingDataSize;
u32 _crc;
u32 _entryCount;
std::string _title;
char _serial[4 + 1];
u8 *_entryDataRawPtr;
u8 *_entryData;
CheatDBEntry _entryRoot;
u32 _cheatItemCount;
void _UpdateDirectoryParents(CheatDBEntry &directory);
bool _CreateCheatItemFromCheatEntry(const CheatDBEntry &inEntry, const bool isHierarchical, CHEATS_LIST &outCheatItem);
size_t _DirectoryAddCheatsFlat(const CheatDBEntry &directory, const bool isHierarchical, size_t cheatIndex, CHEATS_LIST *outCheatsList);
public:
CheatDBGame();
CheatDBGame(const u32 encryptOffset, const FAT_R4 &fat, const u32 rawDataSize);
CheatDBGame(FILE *fp, const bool isEncrypted, const u32 encryptOffset, const FAT_R4 &fat, const u32 rawDataSize, u8 (&workingBuffer)[1024]);
~CheatDBGame();
void SetInitialProperties(const u32 rawDataSize, const u32 encryptOffset, const FAT_R4 &fat);
void LoadPropertiesFromFile(FILE *fp, const bool isEncrypted, u8 (&workingBuffer)[1024]);
u32 GetBaseOffset() const;
u32 GetFirstEntryOffset() const;
u32 GetEncryptOffset() const;
u32 GetRawDataSize() const;
u32 GetWorkingDataSize() const;
u32 GetCRC() const;
u32 GetEntryCount() const;
u32 GetCheatItemCount() const;
const char* GetTitle() const;
const char* GetSerial() const;
const CheatDBEntry& GetEntryRoot() const;
const u8* GetEntryRawData() const;
bool IsEntryDataLoaded() const;
u8* LoadEntryData(FILE *fp, const bool isEncrypted);
size_t ParseEntriesToCheatsListFlat(CHEATS_LIST *outCheatsList);
};
typedef std::vector<CheatDBGame> CheatDBGameList;
class CheatDBFile
{
protected:
std::string _path;
std::string _description;
std::string _formatString;
CheatDBFileFormat _format;
bool _isEncrypted;
size_t _size;
FILE *_fp;
CheatDBGame _ReadGame(const u32 encryptOffset, const FAT_R4 &fat, const u32 gameDataSize, u8 (&workingBuffer)[1024]);
public:
CheatDBFile();
~CheatDBFile();
static void R4Decrypt(u8 *buf, const size_t len, u64 n);
static bool ReadToBuffer(FILE *fp, const size_t fileOffset, const bool isEncrypted, const size_t encryptOffset, const size_t requestedSize, u8 *outBuffer);
FILE* GetFilePtr() const;
bool IsEncrypted() const;
const char* GetDescription() const;
CheatDBFileFormat GetFormat() const;
const char* GetFormatString() const;
CheatSystemError OpenFile(const char *filePath);
void CloseFile();
u32 LoadGameList(const char *gameCode, const u32 gameDatabaseCRC, CheatDBGameList &outList);
};
class CHEATSEXPORT class CHEATSEXPORT
{ {
private: private:
CheatDBFile _dbFile; CHEATS_DB_TYPE type;
CheatDBGameList _tempGameList; bool encrypted;
CheatDBGame *_selectedDbGame; FILE *fp;
CHEATS_LIST *_cheats; u32 fsize;
CheatSystemError _lastError; u32 dataSize;
u32 encOffset;
FAT_R4 fat;
bool search();
bool getCodes();
void R4decrypt(u8 *buf, u32 len, u32 n);
u32 numCheats;
CHEATS_LIST *cheats;
u8 error; // 0 - no errors
// 1 - open failed/file not found
// 2 - file format is wrong (no valid header ID)
// 3 - cheat not found in database
// 4 - export error from database
public: public:
CHEATSEXPORT(); CHEATSEXPORT() :
~CHEATSEXPORT(); fp(NULL),
fsize(0),
bool load(const char *path); dataSize(0),
void close(); encOffset(0),
type(CHEATS_DB_R4),
CHEATS_LIST *getCheats() const; encrypted(false),
size_t getCheatsNum() const; numCheats(0),
const char* getGameTitle() const; cheats(0),
const char* getDescription() const; CRC(0),
CheatSystemError getErrorCode() const; error(0)
}; {
memset(date, 0, sizeof(date));
gametitle = (u8 *)malloc(CHEAT_DB_GAME_TITLE_SIZE);
memset(gametitle, 0, CHEAT_DB_GAME_TITLE_SIZE);
}
~CHEATSEXPORT()
{
free(gametitle);
gametitle = NULL;
}
CheatDBGame* GetCheatDBGameEntryFromList(const CheatDBGameList &gameList, const char *gameCode, const u32 gameDatabaseCRC); u8 *gametitle;
void CheatItemGenerateDescriptionHierarchical(const char *itemName, const char *itemNote, CHEATS_LIST &outCheatItem); u8 date[17];
void CheatItemGenerateDescriptionFlat(const char *folderName, const char *folderNote, const char *itemName, const char *itemNote, CHEATS_LIST &outCheatItem); u32 CRC;
bool load(char *path);
void close();
CHEATS_LIST *getCheats();
u32 getCheatsNum();
u8 getErrorCode() { return error; }
};
extern CHEATS *cheats; extern CHEATS *cheats;
extern CHEATSEARCH *cheatSearch; extern CHEATSEARCH *cheatSearch;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2025 DeSmuME team Copyright (C) 2009-2017 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -36,6 +36,62 @@
int _scanline_filter_a = 0, _scanline_filter_b = 2, _scanline_filter_c = 2, _scanline_filter_d = 4; int _scanline_filter_a = 0, _scanline_filter_b = 2, _scanline_filter_c = 2, _scanline_filter_d = 4;
int _commandline_linux_nojoy = 0; int _commandline_linux_nojoy = 0;
CommandLine::CommandLine()
: is_cflash_configured(false)
, _load_to_memory(-1)
, _play_movie_file(0)
, _record_movie_file(0)
, _cflash_image(0)
, _cflash_path(0)
, _gbaslot_rom(0)
, _bios_arm9(NULL)
, _bios_arm7(NULL)
, _bios_swi(0)
, _fw_path(NULL)
, _fw_boot(0)
, _spu_sync_mode(-1)
, _spu_sync_method(-1)
, _spu_advanced(0)
, _num_cores(-1)
, _rigorous_timing(0)
, _advanced_timing(-1)
, _gamehacks(-1)
, _texture_deposterize(-1)
, _texture_smooth(-1)
, _slot1(NULL)
, _slot1_fat_dir(NULL)
, _slot1_fat_dir_type(false)
, _slot1_no8000prot(0)
#ifdef HAVE_JIT
, _cpu_mode(-1)
, _jit_size(-1)
#endif
, _console_type(NULL)
, _advanscene_import(NULL)
, load_slot(-1)
, arm9_gdb_port(0)
, arm7_gdb_port(0)
, start_paused(FALSE)
, autodetect_method(-1)
, render3d(COMMANDLINE_RENDER3D_DEFAULT)
, texture_upscale(-1)
, gpu_resolution_multiplier(-1)
, language(1) //english by default
, disable_sound(0)
, disable_limiter(0)
, windowed_fullscreen(0)
, frameskip(0)
, horizontal(0)
, scale(1.0)
, _rtc_day(-1)
, _rtc_hour(-1)
{
}
CommandLine::~CommandLine()
{
}
static char mytoupper(char c) { return ::toupper(c); } static char mytoupper(char c) { return ::toupper(c); }
static std::string strtoupper(const std::string& str) static std::string strtoupper(const std::string& str)
@ -180,71 +236,6 @@ ENDL
#define OPT_ADVANSCENE 900 #define OPT_ADVANSCENE 900
CommandLine::CommandLine()
{
// private
_play_movie_file = NULL;
_record_movie_file = NULL;
_cflash_image = NULL;
_cflash_path = NULL;
_gbaslot_rom = NULL;
_bios_arm9 = NULL;
_bios_arm7 = NULL;
_fw_path = NULL;
_fw_boot = 0;
_load_to_memory = -1;
_bios_swi = 0;
_spu_advanced = 0;
_num_cores = -1;
_rigorous_timing = 0;
_advanced_timing = -1;
_gamehacks = -1;
_texture_deposterize = -1;
_texture_smooth = -1;
#ifdef HAVE_JIT
_cpu_mode = -1;
_jit_size = -1;
#endif
_slot1 = NULL;
_slot1_fat_dir = NULL;
_console_type = NULL;
_advanscene_import = NULL;
_rtc_day = -1;
_rtc_hour = -1;
// public
load_slot = -1;
autodetect_method = -1;
render3d = COMMANDLINE_RENDER3D_DEFAULT;
texture_upscale = -1;
gpu_resolution_multiplier = -1;
language = 1; //english by default
scale = 1.0;
nds_file = "";
play_movie_file = "";
record_movie_file = "";
arm9_gdb_port = 0;
arm7_gdb_port = 0;
start_paused = 0;
cflash_image = "";
cflash_path = "";
gbaslot_rom = "";
slot1 = "";
console_type = "";
slot1_fat_dir = "";
_slot1_fat_dir_type = false;
_slot1_no8000prot = 0;
disable_sound = 0;
disable_limiter = 0;
windowed_fullscreen = 0;
frameskip = 0;
horizontal = 0;
is_cflash_configured = false;
_spu_sync_mode = -1;
_spu_sync_method = -1;
}
bool CommandLine::parse(int argc,char **argv) bool CommandLine::parse(int argc,char **argv)
{ {
//closest thing to a portable main() we have, I guess. //closest thing to a portable main() we have, I guess.
@ -406,7 +397,7 @@ bool CommandLine::parse(int argc,char **argv)
if(opt_help) if(opt_help)
{ {
printf("%s",help_string); printf(help_string);
exit(1); exit(1);
} }
@ -580,7 +571,7 @@ bool CommandLine::validate()
void CommandLine::errorHelp(const char* binName) void CommandLine::errorHelp(const char* binName)
{ {
printerror("%s",help_string); printerror(help_string);
} }
void CommandLine::process_movieCommands() void CommandLine::process_movieCommands()
@ -621,23 +612,23 @@ void CommandLine::process_addonCommands()
slot1_Change(NDS_SLOT1_R4); slot1_Change(NDS_SLOT1_R4);
else if(slot1 == "RETAILNAND") else if(slot1 == "RETAILNAND")
slot1_Change(NDS_SLOT1_RETAIL_NAND); slot1_Change(NDS_SLOT1_RETAIL_NAND);
else if(slot1 == "RETAILMCROM") else if(slot1 == "RETAILMCROM")
slot1_Change(NDS_SLOT1_RETAIL_MCROM); slot1_Change(NDS_SLOT1_RETAIL_MCROM);
else if(slot1 == "RETAILDEBUG") else if(slot1 == "RETAILDEBUG")
slot1_Change(NDS_SLOT1_RETAIL_DEBUG); slot1_Change(NDS_SLOT1_RETAIL_DEBUG);
if (_rtc_day != -1 || _rtc_hour != -1) { if (_rtc_day != -1 || _rtc_hour != -1) {
DateTime now = DateTime::get_Now(); DateTime now = DateTime::get_Now();
int cur_day = now.get_DayOfWeek(); int cur_day = now.get_DayOfWeek();
int cur_hour = now.get_Hour(); int cur_hour = now.get_Hour();
int cur_total = cur_day * 24 + cur_hour; int cur_total = cur_day * 24 + cur_hour;
int day = (_rtc_day != -1 ? _rtc_day : cur_day); int day = (_rtc_day != -1 ? _rtc_day : cur_day);
int hour = (_rtc_hour != -1 ? _rtc_hour : cur_hour); int hour = (_rtc_hour != -1 ? _rtc_hour : cur_hour);
int total = day * 24 + hour; int total = day * 24 + hour;
int diff = total - cur_total; int diff = total - cur_total;
if (diff < 0) if (diff < 0)
diff += 24 * 7; diff += 24 * 7;
rtcHourOverride = diff; rtcHourOverride = diff;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2025 DeSmuME team Copyright (C) 2009-2017 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -41,36 +41,6 @@ extern int _commandline_linux_nojoy;
class CommandLine class CommandLine
{ {
private:
char *_play_movie_file;
char *_record_movie_file;
char *_cflash_image;
char *_cflash_path;
char *_gbaslot_rom;
char *_bios_arm9;
char *_bios_arm7;
char *_fw_path;
int _fw_boot;
int _load_to_memory;
int _bios_swi;
int _spu_advanced;
int _num_cores;
int _rigorous_timing;
int _advanced_timing;
int _gamehacks;
int _texture_deposterize;
int _texture_smooth;
#ifdef HAVE_JIT
int _cpu_mode;
int _jit_size;
#endif
char *_slot1;
char *_slot1_fat_dir;
char *_console_type;
char *_advanscene_import;
int _rtc_day;
int _rtc_hour;
public: public:
//actual options: these may move to another struct //actual options: these may move to another struct
int load_slot; int load_slot;
@ -83,8 +53,7 @@ public:
std::string nds_file; std::string nds_file;
std::string play_movie_file; std::string play_movie_file;
std::string record_movie_file; std::string record_movie_file;
int arm9_gdb_port; int arm9_gdb_port, arm7_gdb_port;
int arm7_gdb_port;
int start_paused; int start_paused;
std::string cflash_image; std::string cflash_image;
std::string cflash_path; std::string cflash_path;
@ -99,11 +68,6 @@ public:
int windowed_fullscreen; int windowed_fullscreen;
int frameskip; int frameskip;
int horizontal; int horizontal;
bool is_cflash_configured;
int _spu_sync_mode;
int _spu_sync_method;
CommandLine();
bool parse(int argc,char **argv); bool parse(int argc,char **argv);
@ -114,9 +78,44 @@ public:
void process_movieCommands(); void process_movieCommands();
//etc. //etc.
void process_addonCommands(); void process_addonCommands();
bool is_cflash_configured;
//print a little help message for cases when erroneous commandlines are entered //print a little help message for cases when erroneous commandlines are entered
void errorHelp(const char* binName); void errorHelp(const char* binName);
CommandLine();
~CommandLine();
int _spu_sync_mode;
int _spu_sync_method;
private:
char* _play_movie_file;
char* _record_movie_file;
char* _cflash_image;
char* _cflash_path;
char* _gbaslot_rom;
char* _bios_arm9, *_bios_arm7;
char* _fw_path;
int _fw_boot;
int _load_to_memory;
int _bios_swi;
int _spu_advanced;
int _num_cores;
int _rigorous_timing;
int _advanced_timing;
int _gamehacks;
int _texture_deposterize;
int _texture_smooth;
#ifdef HAVE_JIT
int _cpu_mode;
int _jit_size;
#endif
char* _slot1;
char *_slot1_fat_dir;
char* _console_type;
char* _advanscene_import;
int _rtc_day;
int _rtc_hour;
}; };
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2008-2023 DeSmuME team Copyright (C) 2008-2017 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -105,12 +105,22 @@ void* malloc_aligned64(size_t length)
void* malloc_alignedCacheLine(size_t length) void* malloc_alignedCacheLine(size_t length)
{ {
return malloc_aligned(length, CACHE_ALIGN_SIZE); #if defined(HOST_32)
return malloc_aligned32(length);
#elif defined(HOST_64)
return malloc_aligned64(length);
#else
return malloc_aligned16(length);
#endif
} }
void* malloc_alignedPage(size_t length) void* malloc_alignedPage(size_t length)
{ {
return malloc_aligned(length, PAGE_ALIGN_SIZE); // WARNING!
//
// This may fail for SPARC users, which have a page size
// of 8KB instead of the more typical 4KB.
return malloc_aligned(length, 4096);
} }
void free_aligned(void *ptr) void free_aligned(void *ptr)

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2006 yopyop Copyright (C) 2006 yopyop
Copyright (C) 2006-2025 DeSmuME team Copyright (C) 2006-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -175,7 +175,7 @@ void armcp15_setSingleRegionAccess(armcp15_t *armcp15, u8 num, u32 mask, u32 set
armcp15->regionExecuteSet_SYS[num] = set ; armcp15->regionExecuteSet_SYS[num] = set ;
break ; break ;
} }
} } ;
/* precalculate region masks/sets from cp15 register */ /* precalculate region masks/sets from cp15 register */
void armcp15_maskPrecalc(armcp15_t *armcp15) void armcp15_maskPrecalc(armcp15_t *armcp15)
@ -366,13 +366,6 @@ BOOL armcp15_moveCP2ARM(armcp15_t *armcp15, u32 * R, u8 CRn, u8 CRm, u8 opcode1,
} }
} }
return FALSE; return FALSE;
case 13:
if(opcode1 == 0 && opcode2 == 1)
{
*R = armcp15->processID;
return TRUE;
}
return FALSE;
default: default:
LOG("Unsupported CP15 operation : MRC\n"); LOG("Unsupported CP15 operation : MRC\n");
return FALSE; return FALSE;
@ -495,13 +488,6 @@ BOOL armcp15_moveARM2CP(armcp15_t *armcp15, u32 val, u8 CRn, u8 CRm, u8 opcode1,
} }
} }
return FALSE; return FALSE;
case 13:
if(opcode1 == 0 && opcode2 == 1)
{
armcp15->processID = val;
return TRUE;
}
return FALSE;
default: default:
return FALSE; return FALSE;
} }

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2006 Guillaume Duhamel Copyright (C) 2006 Guillaume Duhamel
Copyright (C) 2006-2025 DeSmuME team Copyright (C) 2006-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -388,10 +388,7 @@ void IdeasLog(armcpu_t* cpu)
if(!c) break; if(!c) break;
printf("%c",c); printf("%c",c);
} }
//don't emit a newline. that is a pain in the butt. //don't emit a newline. that is a pain in the butt.
fflush(stdout);
} }
void NocashMessage(armcpu_t* cpu, int offset) void NocashMessage(armcpu_t* cpu, int offset)
@ -416,31 +413,30 @@ void NocashMessage(armcpu_t* cpu, int offset)
//this is very inefficiently coded! //this is very inefficiently coded!
char tmp[100]; char tmp[100];
todo = mass_replace(todo, "%sp%", "%r13%"); todo = mass_replace(todo,"%sp%","%r13%");
todo = mass_replace(todo, "%lr%", "%r14%"); todo = mass_replace(todo,"%lr%","%r14%");
todo = mass_replace(todo, "%pc%", "%r15%"); todo = mass_replace(todo,"%pc%","%r15%");
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[ 0]); todo = mass_replace(todo, "%r0%", tmp); sprintf(tmp,"%08X",cpu->R[0]); todo = mass_replace(todo,"%r0%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[ 1]); todo = mass_replace(todo, "%r1%", tmp); sprintf(tmp,"%08X",cpu->R[1]); todo = mass_replace(todo,"%r1%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[ 2]); todo = mass_replace(todo, "%r2%", tmp); sprintf(tmp,"%08X",cpu->R[2]); todo = mass_replace(todo,"%r2%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[ 3]); todo = mass_replace(todo, "%r3%", tmp); sprintf(tmp,"%08X",cpu->R[3]); todo = mass_replace(todo,"%r3%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[ 4]); todo = mass_replace(todo, "%r4%", tmp); sprintf(tmp,"%08X",cpu->R[4]); todo = mass_replace(todo,"%r4%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[ 5]); todo = mass_replace(todo, "%r5%", tmp); sprintf(tmp,"%08X",cpu->R[5]); todo = mass_replace(todo,"%r5%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[ 6]); todo = mass_replace(todo, "%r6%", tmp); sprintf(tmp,"%08X",cpu->R[6]); todo = mass_replace(todo,"%r6%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[ 7]); todo = mass_replace(todo, "%r7%", tmp); sprintf(tmp,"%08X",cpu->R[7]); todo = mass_replace(todo,"%r7%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[ 8]); todo = mass_replace(todo, "%r8%", tmp); sprintf(tmp,"%08X",cpu->R[8]); todo = mass_replace(todo,"%r8%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[ 9]); todo = mass_replace(todo, "%r9%", tmp); sprintf(tmp,"%08X",cpu->R[9]); todo = mass_replace(todo,"%r9%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[10]); todo = mass_replace(todo, "%r10%", tmp); sprintf(tmp,"%08X",cpu->R[10]); todo = mass_replace(todo,"%r10%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[11]); todo = mass_replace(todo, "%r11%", tmp); sprintf(tmp,"%08X",cpu->R[11]); todo = mass_replace(todo,"%r11%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[12]); todo = mass_replace(todo, "%r12%", tmp); sprintf(tmp,"%08X",cpu->R[12]); todo = mass_replace(todo,"%r12%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[13]); todo = mass_replace(todo, "%r13%", tmp); sprintf(tmp,"%08X",cpu->R[13]); todo = mass_replace(todo,"%r13%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[14]); todo = mass_replace(todo, "%r14%", tmp); sprintf(tmp,"%08X",cpu->R[14]); todo = mass_replace(todo,"%r14%",tmp);
snprintf(tmp, sizeof(tmp), "%08X", cpu->R[15]); todo = mass_replace(todo, "%r15%", tmp); sprintf(tmp,"%08X",cpu->R[15]); todo = mass_replace(todo,"%r15%",tmp);
snprintf(tmp, sizeof(tmp), "%d", nds.VCount); todo = mass_replace(todo, "%scanline%", tmp); sprintf(tmp,"%d",nds.VCount); todo = mass_replace(todo,"%scanline%",tmp);
snprintf(tmp, sizeof(tmp), "%d", currFrameCounter); todo = mass_replace(todo, "%frame%", tmp); sprintf(tmp,"%d",currFrameCounter); todo = mass_replace(todo,"%frame%",tmp);
snprintf(tmp, sizeof(tmp), "%lld", nds_timer); todo = mass_replace(todo, "%totalclks%", tmp); sprintf(tmp,"%lld",nds_timer); todo = mass_replace(todo,"%totalclks%",tmp);
printf("%s",todo.c_str()); printf("%s",todo.c_str());
fflush(stdout);
} }
//------- //-------

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2006 Guillaume Duhamel Copyright (C) 2006 Guillaume Duhamel
Copyright (C) 2006-2025 DeSmuME team Copyright (C) 2006-2015 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -149,7 +149,7 @@ enum EDEBUG_EVENT
DEBUG_EVENT_WRITE=2, //write on arm9 or arm7 bus DEBUG_EVENT_WRITE=2, //write on arm9 or arm7 bus
DEBUG_EVENT_EXECUTE=3, //prefetch on arm9 or arm7, triggered after the read event DEBUG_EVENT_EXECUTE=3, //prefetch on arm9 or arm7, triggered after the read event
DEBUG_EVENT_ACL_EXCEPTION=4, //acl exception on arm9 DEBUG_EVENT_ACL_EXCEPTION=4, //acl exception on arm9
DEBUG_EVENT_CACHE_MISS=5 //cache miss on arm9 DEBUG_EVENT_CACHE_MISS=5, //cache miss on arm9
}; };
enum EDEBUG_NOTIFY enum EDEBUG_NOTIFY

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2025 DeSmuME team Copyright (C) 2009-2018 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -26,8 +26,6 @@
class VIEW3D_Driver class VIEW3D_Driver
{ {
public: public:
virtual ~VIEW3D_Driver() {}
virtual void Launch() {} virtual void Launch() {}
virtual void NewFrame() {} virtual void NewFrame() {}
virtual bool IsRunning() { return false; } virtual bool IsRunning() { return false; }
@ -37,7 +35,7 @@ public:
class BaseDriver { class BaseDriver {
public: public:
BaseDriver(); BaseDriver();
virtual ~BaseDriver(); ~BaseDriver();
virtual void AVI_SoundUpdate(void* soundData, int soundLen) {} virtual void AVI_SoundUpdate(void* soundData, int soundLen) {}
virtual bool AVI_IsRecording() { return FALSE; } virtual bool AVI_IsRecording() { return FALSE; }

View File

@ -65,7 +65,7 @@ public:
bool fail(bool unset=false) { bool ret = this->_failbit; if(unset) unfail(); return ret; } bool fail(bool unset=false) { bool ret = this->_failbit; if(unset) unfail(); return ret; }
void unfail() { this->_failbit = false; } void unfail() { this->_failbit = false; }
virtual bool eof() { return size()==ftell(); } bool eof() { return size()==ftell(); }
size_t fread(const void *ptr, size_t bytes){ size_t fread(const void *ptr, size_t bytes){
return _fread(ptr,bytes); return _fread(ptr,bytes);
@ -327,8 +327,6 @@ public:
virtual void truncate(s32 length); virtual void truncate(s32 length);
virtual bool eof() { return !!::feof(this->_fp); }
virtual int fprintf(const char *format, ...) { virtual int fprintf(const char *format, ...) {
va_list argptr; va_list argptr;
va_start(argptr, format); va_start(argptr, format);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2016-2024 DeSmuME team Copyright (C) 2016-2017 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -21,125 +21,83 @@
#define DEPOSTERIZE_THRESHOLD 23 // Possible values are [0-255], where lower a value prevents blending and a higher value allows for more blending #define DEPOSTERIZE_THRESHOLD 23 // Possible values are [0-255], where lower a value prevents blending and a higher value allows for more blending
namespace static u32 Deposterize_InterpLTE(const u32 pixA, const u32 pixB)
{ {
template <u32 DEN> const u32 aB = (pixB & 0xFF000000) >> 24;
struct UnpackedPixel if (aB == 0)
{ {
u32 r; return pixA;
u32 g; }
u32 b;
u32 a; const u32 rA = (pixA & 0x000000FF);
const u32 gA = (pixA & 0x0000FF00) >> 8;
const u32 bA = (pixA & 0x00FF0000) >> 16;
const u32 aA = (pixA & 0xFF000000) >> 24;
const u32 rB = (pixB & 0x000000FF);
const u32 gB = (pixB & 0x0000FF00) >> 8;
const u32 bB = (pixB & 0x00FF0000) >> 16;
const u32 rC = ( (rB - rA <= DEPOSTERIZE_THRESHOLD) || (rA - rB <= DEPOSTERIZE_THRESHOLD) ) ? ((rA+rB)>>1) : rA;
const u32 gC = ( (gB - gA <= DEPOSTERIZE_THRESHOLD) || (gA - gB <= DEPOSTERIZE_THRESHOLD) ) ? ((gA+gB)>>1) : gA;
const u32 bC = ( (bB - bA <= DEPOSTERIZE_THRESHOLD) || (bA - bB <= DEPOSTERIZE_THRESHOLD) ) ? ((bA+bB)>>1) : bA;
const u32 aC = ( (aB - aA <= DEPOSTERIZE_THRESHOLD) || (aA - aB <= DEPOSTERIZE_THRESHOLD) ) ? ((aA+aB)>>1) : aA;
u32 pack() const return (rC | (gC << 8) | (bC << 16) | (aC << 24));
{ }
return ( ((r/DEN) << 0) |
((g/DEN) << 8) | static u32 Deposterize_Blend(const u32 pixA, const u32 pixB, const u32 weightA, const u32 weightB)
((b/DEN) << 16) | {
((a/DEN) << 24) ); const u32 aB = (pixB & 0xFF000000) >> 24;
} if (aB == 0)
{
return pixA;
}
const u32 rbA = pixA & 0x00FF00FF;
const u32 gA = pixA & 0x0000FF00;
const u32 aA = (pixA & 0xFF000000) >> 24;
const u32 rbB = pixB & 0x00FF00FF;
const u32 gB = pixB & 0x0000FF00;
// Note: The sum of weightA and weightB must equal 16.
const u32 rbC = ( ((rbA * weightA) + (rbB * weightB)) / 16 ) & 0x00FF00FF;
const u32 gC = ( (( gA * weightA) + ( gB * weightB)) / 16 ) & 0x0000FF00;
const u32 aC = ( (( aA * weightA) + ( aB * weightB)) / 16 ) << 24;
return (rbC | gC | aC);
}
static u32 Deposterize_BlendPixel(const u32 color[9])
{
const u32 blend[9] = {
color[0],
Deposterize_InterpLTE(color[0], color[1]),
Deposterize_InterpLTE(color[0], color[2]),
Deposterize_InterpLTE(color[0], color[3]),
Deposterize_InterpLTE(color[0], color[4]),
Deposterize_InterpLTE(color[0], color[5]),
Deposterize_InterpLTE(color[0], color[6]),
Deposterize_InterpLTE(color[0], color[7]),
Deposterize_InterpLTE(color[0], color[8])
}; };
static FORCEINLINE UnpackedPixel<2> Deposterize_InterpLTE(const UnpackedPixel<1> &pixA, const UnpackedPixel<1> &pixB) return Deposterize_Blend(Deposterize_Blend(Deposterize_Blend(Deposterize_Blend(blend[0], blend[5], 2, 14),
{ Deposterize_Blend(blend[0], blend[1], 2, 14),
UnpackedPixel<2> pixOut = { 8, 8),
pixA.r, Deposterize_Blend(Deposterize_Blend(blend[0], blend[7], 2, 14),
pixA.g, Deposterize_Blend(blend[0], blend[3], 2, 14),
pixA.b, 8, 8),
pixA.a 8, 8),
}; Deposterize_Blend(Deposterize_Blend(Deposterize_Blend(blend[0], blend[6], 7, 9),
Deposterize_Blend(blend[0], blend[2], 7, 9),
if (pixB.a == 0) 8, 8),
{ Deposterize_Blend(Deposterize_Blend(blend[0], blend[8], 7, 9),
pixOut.r = pixOut.r << 1; Deposterize_Blend(blend[0], blend[4], 7, 9),
pixOut.g = pixOut.g << 1; 8, 8),
pixOut.b = pixOut.b << 1; 8, 8),
pixOut.a = pixOut.a << 1; 12, 4);
return pixOut;
}
const s32 rDiff = pixA.r - pixB.r;
const s32 gDiff = pixA.g - pixB.g;
const s32 bDiff = pixA.b - pixB.b;
const s32 aDiff = pixA.a - pixB.a;
pixOut.r = ( (-DEPOSTERIZE_THRESHOLD <= rDiff) && (rDiff <= DEPOSTERIZE_THRESHOLD) ) ? (pixOut.r + pixB.r) : (pixOut.r << 1);
pixOut.g = ( (-DEPOSTERIZE_THRESHOLD <= gDiff) && (gDiff <= DEPOSTERIZE_THRESHOLD) ) ? (pixOut.g + pixB.g) : (pixOut.g << 1);
pixOut.b = ( (-DEPOSTERIZE_THRESHOLD <= bDiff) && (bDiff <= DEPOSTERIZE_THRESHOLD) ) ? (pixOut.b + pixB.b) : (pixOut.b << 1);
pixOut.a = ( (-DEPOSTERIZE_THRESHOLD <= aDiff) && (aDiff <= DEPOSTERIZE_THRESHOLD) ) ? (pixOut.a + pixB.a) : (pixOut.a << 1);
return pixOut;
}
static FORCEINLINE UnpackedPixel<2> Deposterize_InterpLTE(const UnpackedPixel<1> &pixA, const u32 color32B)
{
const UnpackedPixel<1> pixB = {
(color32B >> 0) & 0x000000FF,
(color32B >> 8) & 0x000000FF,
(color32B >> 16) & 0x000000FF,
(color32B >> 24) & 0x000000FF
};
return Deposterize_InterpLTE(pixA, pixB);
}
template <u32 WEIGHTA, u32 WEIGHTB, u32 DEN>
static FORCEINLINE UnpackedPixel<DEN*(WEIGHTA+WEIGHTB)> Deposterize_Blend(const UnpackedPixel<DEN> &pixA, const UnpackedPixel<DEN> &pixB)
{
UnpackedPixel<DEN*(WEIGHTA+WEIGHTB)> ret;
ret.r = (pixA.r * WEIGHTA) + (pixB.r * WEIGHTB);
ret.g = (pixA.g * WEIGHTA) + (pixB.g * WEIGHTB);
ret.b = (pixA.b * WEIGHTA) + (pixB.b * WEIGHTB);
ret.a = (pixA.a * WEIGHTA) + (pixB.a * WEIGHTB);
return ret;
}
static u32 Deposterize_BlendPixel(const u32 color32[9])
{
const UnpackedPixel<1> center = {
(color32[0] >> 0) & 0x000000FF,
(color32[0] >> 8) & 0x000000FF,
(color32[0] >> 16) & 0x000000FF,
(color32[0] >> 24) & 0x000000FF
};
const UnpackedPixel<2> center2 = {
center.r << 1,
center.g << 1,
center.b << 1,
center.a << 1
};
#define DF_INTERP(i) Deposterize_InterpLTE(center, color32[i])
UnpackedPixel<512> pixOut = Deposterize_Blend<3, 1>(
Deposterize_Blend<1, 1>(
Deposterize_Blend<1, 1>(
Deposterize_Blend<2, 14>(center2, DF_INTERP(5)),
Deposterize_Blend<2, 14>(center2, DF_INTERP(1))
),
Deposterize_Blend<1, 1>(
Deposterize_Blend<2, 14>(center2, DF_INTERP(7)),
Deposterize_Blend<2, 14>(center2, DF_INTERP(3))
)
),
Deposterize_Blend<1, 1>(
Deposterize_Blend<1, 1>(
Deposterize_Blend<7, 9>(center2, DF_INTERP(6)),
Deposterize_Blend<7, 9>(center2, DF_INTERP(2))
),
Deposterize_Blend<1, 1>(
Deposterize_Blend<7, 9>(center2, DF_INTERP(8)),
Deposterize_Blend<7, 9>(center2, DF_INTERP(4))
)
)
);
#undef DF_INTERP
return pixOut.pack();
}
} }
void RenderDeposterize(SSurface Src, SSurface Dst) void RenderDeposterize(SSurface Src, SSurface Dst)
@ -169,15 +127,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
continue; continue;
} }
color[0] = src[i]; color[0] = src[i];
color[1] = (x < w-1) ? src[i+1] : src[i]; color[1] = (x < w-1) ? src[i+1] : src[i];
color[2] = (x < w-1) ? src[i+w+1] : src[i]; color[2] = (x < w-1) ? src[i+w+1] : src[i];
color[3] = src[i]; color[3] = src[i];
color[4] = (x > 0) ? src[i+w-1] : src[i]; color[4] = (x > 0) ? src[i+w-1] : src[i];
color[5] = (x > 0) ? src[i-1] : src[i]; color[5] = (x > 0) ? src[i-1] : src[i];
color[6] = src[i]; color[6] = src[i];
color[7] = src[i]; color[7] = src[i];
color[8] = src[i]; color[8] = src[i];
workingDst[i] = Deposterize_BlendPixel(color); workingDst[i] = Deposterize_BlendPixel(color);
} }
@ -192,15 +150,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
continue; continue;
} }
color[0] = src[i]; color[0] = src[i];
color[1] = (x < w-1) ? src[i+1] : src[i]; color[1] = (x < w-1) ? src[i+1] : src[i];
color[2] = (x < w-1) ? src[i+w+1] : src[i]; color[2] = (x < w-1) ? src[i+w+1] : src[i];
color[3] = src[i+w]; color[3] = src[i+w];
color[4] = (x > 0) ? src[i+w-1] : src[i]; color[4] = (x > 0) ? src[i+w-1] : src[i];
color[5] = (x > 0) ? src[i-1] : src[i]; color[5] = (x > 0) ? src[i-1] : src[i];
color[6] = (x > 0) ? src[i-w-1] : src[i]; color[6] = (x > 0) ? src[i-w-1] : src[i];
color[7] = src[i-w]; color[7] = src[i-w];
color[8] = (x < w-1) ? src[i-w+1] : src[i]; color[8] = (x < w-1) ? src[i-w+1] : src[i];
workingDst[i] = Deposterize_BlendPixel(color); workingDst[i] = Deposterize_BlendPixel(color);
} }
@ -214,15 +172,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
continue; continue;
} }
color[0] = src[i]; color[0] = src[i];
color[1] = (x < w-1) ? src[i+1] : src[i]; color[1] = (x < w-1) ? src[i+1] : src[i];
color[2] = src[i]; color[2] = src[i];
color[3] = src[i]; color[3] = src[i];
color[4] = src[i]; color[4] = src[i];
color[5] = (x > 0) ? src[i-1] : src[i]; color[5] = (x > 0) ? src[i-1] : src[i];
color[6] = (x > 0) ? src[i-w-1] : src[i]; color[6] = (x > 0) ? src[i-w-1] : src[i];
color[7] = src[i]; color[7] = src[i];
color[8] = (x < w-1) ? src[i-w+1] : src[i]; color[8] = (x < w-1) ? src[i-w+1] : src[i];
workingDst[i] = Deposterize_BlendPixel(color); workingDst[i] = Deposterize_BlendPixel(color);
} }
@ -237,15 +195,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
continue; continue;
} }
color[0] = workingDst[i]; color[0] = workingDst[i];
color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i]; color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i];
color[2] = (x < w-1) ? workingDst[i+w+1] : workingDst[i]; color[2] = (x < w-1) ? workingDst[i+w+1] : workingDst[i];
color[3] = workingDst[i]; color[3] = workingDst[i];
color[4] = (x > 0) ? workingDst[i+w-1] : workingDst[i]; color[4] = (x > 0) ? workingDst[i+w-1] : workingDst[i];
color[5] = (x > 0) ? workingDst[i-1] : workingDst[i]; color[5] = (x > 0) ? workingDst[i-1] : workingDst[i];
color[6] = workingDst[i]; color[6] = workingDst[i];
color[7] = workingDst[i]; color[7] = workingDst[i];
color[8] = workingDst[i]; color[8] = workingDst[i];
finalDst[i] = Deposterize_BlendPixel(color); finalDst[i] = Deposterize_BlendPixel(color);
} }
@ -260,15 +218,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
continue; continue;
} }
color[0] = workingDst[i]; color[0] = workingDst[i];
color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i]; color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i];
color[2] = (x < w-1) ? workingDst[i+w+1] : workingDst[i]; color[2] = (x < w-1) ? workingDst[i+w+1] : workingDst[i];
color[3] = workingDst[i+w]; color[3] = workingDst[i+w];
color[4] = (x > 0) ? workingDst[i+w-1] : workingDst[i]; color[4] = (x > 0) ? workingDst[i+w-1] : workingDst[i];
color[5] = (x > 0) ? workingDst[i-1] : workingDst[i]; color[5] = (x > 0) ? workingDst[i-1] : workingDst[i];
color[6] = (x > 0) ? workingDst[i-w-1] : workingDst[i]; color[6] = (x > 0) ? workingDst[i-w-1] : workingDst[i];
color[7] = workingDst[i-w]; color[7] = workingDst[i-w];
color[8] = (x < w-1) ? workingDst[i-w+1] : workingDst[i]; color[8] = (x < w-1) ? workingDst[i-w+1] : workingDst[i];
finalDst[i] = Deposterize_BlendPixel(color); finalDst[i] = Deposterize_BlendPixel(color);
} }
@ -282,15 +240,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
continue; continue;
} }
color[0] = workingDst[i]; color[0] = workingDst[i];
color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i]; color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i];
color[2] = workingDst[i]; color[2] = workingDst[i];
color[3] = workingDst[i]; color[3] = workingDst[i];
color[4] = workingDst[i]; color[4] = workingDst[i];
color[5] = (x > 0) ? workingDst[i-1] : workingDst[i]; color[5] = (x > 0) ? workingDst[i-1] : workingDst[i];
color[6] = (x > 0) ? workingDst[i-w-1] : workingDst[i]; color[6] = (x > 0) ? workingDst[i-w-1] : workingDst[i];
color[7] = workingDst[i]; color[7] = workingDst[i];
color[8] = (x < w-1) ? workingDst[i-w+1] : workingDst[i]; color[8] = (x < w-1) ? workingDst[i-w+1] : workingDst[i];
finalDst[i] = Deposterize_BlendPixel(color); finalDst[i] = Deposterize_BlendPixel(color);
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2025 DeSmuME team Copyright (C) 2009-2016 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -20,18 +20,15 @@
#define FILTER_MAX_WORKING_SURFACE_COUNT 8 #define FILTER_MAX_WORKING_SURFACE_COUNT 8
struct SSurface typedef struct {
{
unsigned char *Surface; unsigned char *Surface;
int Pitch; unsigned int Pitch;
int Width; unsigned int Width, Height;
int Height;
unsigned char *workingSurface[FILTER_MAX_WORKING_SURFACE_COUNT]; unsigned char *workingSurface[FILTER_MAX_WORKING_SURFACE_COUNT];
void *userData; void *userData;
}; } SSurface;
typedef struct SSurface SSurface;
void RenderDeposterize(SSurface Src, SSurface Dst); void RenderDeposterize(SSurface Src, SSurface Dst);

View File

@ -149,9 +149,9 @@
// } // }
//} //}
static void hq2x_32_def(u32 *__restrict dst0, u32 *__restrict dst1, const u32 *src0, const u32 *src1, const u32 *src2, size_t count) static void hq2x_32_def(u32 *__restrict dst0, u32 *__restrict dst1, const u32 *src0, const u32 *src1, const u32 *src2, unsigned count)
{ {
for (size_t i = 0; i < count; ++i) for (unsigned i = 0; i < count; ++i)
{ {
u8 mask = 0; u8 mask = 0;
u32 c[9]; u32 c[9];
@ -407,9 +407,9 @@ static void hq2x_32_def(u32 *__restrict dst0, u32 *__restrict dst1, const u32 *s
// } // }
//} //}
static void hq2xS_32_def(u32 *__restrict dst0, u32 *__restrict dst1, const u32 *src0, const u32 *src1, const u32 *src2, size_t count) static void hq2xS_32_def(u32 *__restrict dst0, u32 *__restrict dst1, const u32 *src0, const u32 *src1, const u32 *src2, unsigned count)
{ {
for (size_t i = 0; i < count; ++i) for (unsigned i = 0; i < count; ++i)
{ {
u8 mask = 0; u8 mask = 0;
u32 c[9]; u32 c[9];
@ -460,7 +460,7 @@ static void hq2xS_32_def(u32 *__restrict dst0, u32 *__restrict dst1, const u32 *
brightArray[j] = bright; brightArray[j] = bright;
} }
u32 diffBright = ((u32)(maxBright - minBright) * 7) >> 4; int diffBright = ((maxBright - minBright) * 7) >> 4;
if(diffBright > 7) if(diffBright > 7)
{ {
const int centerBright = brightArray[4]; const int centerBright = brightArray[4];

View File

@ -39,9 +39,9 @@
* This effect is a rewritten implementation of the hq3x effect made by Maxim Stepin * This effect is a rewritten implementation of the hq3x effect made by Maxim Stepin
*/ */
void hq3x_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict dst2, const u32 *src0, const u32 *src1, const u32 *src2, size_t count) void hq3x_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict dst2, const u32 *src0, const u32 *src1, const u32 *src2, int count)
{ {
for (size_t i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
u8 mask = 0; u8 mask = 0;
u32 c[9]; u32 c[9];
@ -125,9 +125,9 @@ void hq3x_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict dst
} }
} }
void hq3xS_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict dst2, const u32 *src0, const u32 *src1, const u32 *src2, size_t count) void hq3xS_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict dst2, const u32 *src0, const u32 *src1, const u32 *src2, int count)
{ {
for (size_t i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
u8 mask = 0; u8 mask = 0;
u32 c[9]; u32 c[9];
@ -178,7 +178,7 @@ void hq3xS_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict ds
brightArray[j] = bright; brightArray[j] = bright;
} }
u32 diffBright = ((u32)(maxBright - minBright) * 7) >> 4; unsigned int diffBright = ((maxBright - minBright) * 7) >> 4;
if(diffBright > 7) if(diffBright > 7)
{ {
const int centerBright = brightArray[4]; const int centerBright = brightArray[4];

View File

@ -41,9 +41,9 @@
void hq4x_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict dst2, u32 *__restrict dst3, void hq4x_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict dst2, u32 *__restrict dst3,
const u32 *src0, const u32 *src1, const u32 *src2, const u32 *src0, const u32 *src1, const u32 *src2,
size_t count, unsigned flag) unsigned count, unsigned flag)
{ {
for (size_t i = 0; i < count; ++i) for (unsigned i = 0; i < count; ++i)
{ {
u8 mask = 0; u8 mask = 0;
u32 c[9]; u32 c[9];
@ -130,9 +130,9 @@ void hq4x_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict dst
void hq4xS_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict dst2, u32 *__restrict dst3, void hq4xS_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict dst2, u32 *__restrict dst3,
const u32 *src0, const u32 *src1, const u32 *src2, const u32 *src0, const u32 *src1, const u32 *src2,
size_t count, unsigned flag) unsigned count, unsigned flag)
{ {
for (size_t i = 0; i < count; ++i) for (unsigned i = 0; i < count; ++i)
{ {
u8 mask = 0; u8 mask = 0;
u32 c[9]; u32 c[9];
@ -183,7 +183,7 @@ void hq4xS_32_def(u32 *__restrict dst0, u32 *__restrict dst1, u32 *__restrict ds
brightArray[j] = bright; brightArray[j] = bright;
} }
u32 diffBright = ((u32)(maxBright - minBright) * 7) >> 4; unsigned int diffBright = ((maxBright - minBright) * 7) >> 4;
if(diffBright > 7) if(diffBright > 7)
{ {
const int centerBright = brightArray[4]; const int centerBright = brightArray[4];

View File

@ -270,11 +270,13 @@
// } // }
//} //}
static void lq2x_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1, const u32* src2, size_t count) static void lq2x_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1, const u32* src2, unsigned count)
{ {
for (size_t i = 0; i < count; ++i) unsigned i;
{
u8 mask = 0; for(i=0;i<count;++i) {
unsigned char mask;
u32 c[9]; u32 c[9];
c[1] = src0[0]; c[1] = src0[0];
@ -301,6 +303,8 @@ static void lq2x_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1,
c[8] = c[7]; c[8] = c[7];
} }
mask = 0;
if (c[0] != c[4]) if (c[0] != c[4])
mask |= 1 << 0; mask |= 1 << 0;
if (c[1] != c[4]) if (c[1] != c[4])
@ -376,12 +380,14 @@ static void lq2x_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1,
} }
} }
static void lq2xS_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1, const u32* src2, size_t count) static void lq2xS_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1, const u32* src2, unsigned count)
{ {
for (size_t i = 0; i < count; ++i) unsigned i;
{
u8 mask = 0; for(i=0;i<count;++i) {
u32 c[9]; unsigned char mask = 0;
u32 c[9];
c[1] = src0[0]; c[1] = src0[0];
c[4] = src1[0]; c[4] = src1[0];
@ -423,7 +429,7 @@ static void lq2xS_32_def(u32* dst0, u32* dst1, const u32* src0, const u32* src1,
brightArray[j] = bright; brightArray[j] = bright;
} }
u32 diffBright = (u32)(maxBright - minBright) >> 4; int diffBright = (maxBright - minBright) >> 4;
if(diffBright > 1) if(diffBright > 1)
{ {
const int centerBright = brightArray[4]; const int centerBright = brightArray[4];

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011-2012 Roger Manuel Copyright (C) 2011-2012 Roger Manuel
Copyright (C) 2013-2025 DeSmuME team Copyright (C) 2013-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -144,10 +144,10 @@ VideoFilter::~VideoFilter()
void VideoFilter::__InstanceInit(size_t srcWidth, size_t srcHeight, VideoFilterTypeID typeID, size_t threadCount) void VideoFilter::__InstanceInit(size_t srcWidth, size_t srcHeight, VideoFilterTypeID typeID, size_t threadCount)
{ {
SSurface newSurface; SSurface newSurface;
newSurface.Surface = NULL; newSurface.Surface = NULL;
newSurface.Pitch = (int)(srcWidth * 2); newSurface.Pitch = srcWidth*2;
newSurface.Width = (int)srcWidth; newSurface.Width = srcWidth;
newSurface.Height = (int)srcHeight; newSurface.Height = srcHeight;
newSurface.userData = NULL; newSurface.userData = NULL;
for (size_t i = 0; i < FILTER_MAX_WORKING_SURFACE_COUNT; i++) for (size_t i = 0; i < FILTER_MAX_WORKING_SURFACE_COUNT; i++)
@ -228,9 +228,9 @@ bool VideoFilter::__AllocateDstBuffer(const size_t dstWidth, const size_t dstHei
} }
// Set up SSurface structure. // Set up SSurface structure.
this->__vfDstSurface.Width = (int)dstWidth; this->__vfDstSurface.Width = dstWidth;
this->__vfDstSurface.Height = (int)dstHeight; this->__vfDstSurface.Height = dstHeight;
this->__vfDstSurface.Pitch = (int)(dstWidth * 2); this->__vfDstSurface.Pitch = dstWidth * 2;
if (_useInternalDstBuffer) if (_useInternalDstBuffer)
{ {
@ -241,8 +241,8 @@ bool VideoFilter::__AllocateDstBuffer(const size_t dstWidth, const size_t dstHei
// Update the surfaces on threads. // Update the surfaces on threads.
const size_t threadCount = this->__vfThread.size(); const size_t threadCount = this->__vfThread.size();
const int linesPerThread = (threadCount > 1) ? (int)(dstHeight/threadCount) : (int)dstHeight; const unsigned int linesPerThread = (threadCount > 1) ? dstHeight/threadCount : dstHeight;
int remainingLines = (int)dstHeight; unsigned int remainingLines = dstHeight;
for (size_t i = 0; i < threadCount; i++) for (size_t i = 0; i < threadCount; i++)
{ {
@ -306,14 +306,14 @@ bool VideoFilter::SetSourceSize(const size_t width, const size_t height)
} }
memset(newPixBuffer, 0, width * (height + 8) * sizeof(uint32_t)); memset(newPixBuffer, 0, width * (height + 8) * sizeof(uint32_t));
if ( (this->__vfSrcSurface.Surface == NULL) || ((size_t)this->__vfSrcSurface.Width != width) || ((size_t)this->__vfSrcSurface.Height != height) ) if (this->__vfSrcSurface.Surface == NULL || this->__vfSrcSurface.Width != width || this->__vfSrcSurface.Height != height)
{ {
sizeChanged = true; sizeChanged = true;
} }
this->__vfSrcSurface.Width = (int)width; this->__vfSrcSurface.Width = width;
this->__vfSrcSurface.Height = (int)height; this->__vfSrcSurface.Height = height;
this->__vfSrcSurface.Pitch = (int)(width * 2); this->__vfSrcSurface.Pitch = width * 2;
// Set the working source buffer pointer so that the working memory block is padded // Set the working source buffer pointer so that the working memory block is padded
// with 4 pixel rows worth of memory on both sides. // with 4 pixel rows worth of memory on both sides.
this->__vfSrcSurface.Surface = (unsigned char *)(newPixBuffer + (width * 4)); this->__vfSrcSurface.Surface = (unsigned char *)(newPixBuffer + (width * 4));
@ -323,8 +323,8 @@ bool VideoFilter::SetSourceSize(const size_t width, const size_t height)
// Update the surfaces on threads. // Update the surfaces on threads.
size_t threadCount = this->__vfThread.size(); size_t threadCount = this->__vfThread.size();
const int linesPerThread = (threadCount > 1) ? this->__vfSrcSurface.Height/(int)threadCount : this->__vfSrcSurface.Height; const unsigned int linesPerThread = (threadCount > 1) ? this->__vfSrcSurface.Height/threadCount : this->__vfSrcSurface.Height;
int remainingLines = this->__vfSrcSurface.Height; unsigned int remainingLines = this->__vfSrcSurface.Height;
for (size_t i = 0; i < threadCount; i++) for (size_t i = 0; i < threadCount; i++)
{ {
@ -351,7 +351,7 @@ bool VideoFilter::SetSourceSize(const size_t width, const size_t height)
if (sizeChanged) if (sizeChanged)
{ {
const VideoFilterAttributes vfAttr = this->GetAttributes(); const VideoFilterAttributes vfAttr = this->GetAttributes();
const size_t dstWidth = width * vfAttr.scaleMultiply / vfAttr.scaleDivide; const size_t dstWidth = width * vfAttr.scaleMultiply / vfAttr.scaleDivide;
const size_t dstHeight = height * vfAttr.scaleMultiply / vfAttr.scaleDivide; const size_t dstHeight = height * vfAttr.scaleMultiply / vfAttr.scaleDivide;
this->_pixelScale = (float)vfAttr.scaleMultiply / (float)vfAttr.scaleDivide; this->_pixelScale = (float)vfAttr.scaleMultiply / (float)vfAttr.scaleDivide;
@ -625,16 +625,16 @@ void VideoFilter::RunFilterCustomByAttributes(const uint32_t *__restrict srcBuff
SSurface srcSurface; SSurface srcSurface;
memset(&srcSurface, 0, sizeof(srcSurface)); memset(&srcSurface, 0, sizeof(srcSurface));
srcSurface.Surface = (unsigned char *)srcBuffer; srcSurface.Surface = (unsigned char *)srcBuffer;
srcSurface.Pitch = (int)(srcWidth * 2); srcSurface.Pitch = srcWidth*2;
srcSurface.Width = (int)srcWidth; srcSurface.Width = srcWidth;
srcSurface.Height = (int)srcHeight; srcSurface.Height = srcHeight;
SSurface dstSurface; SSurface dstSurface;
memset(&dstSurface, 0, sizeof(dstSurface)); memset(&dstSurface, 0, sizeof(dstSurface));
dstSurface.Surface = (unsigned char *)dstBuffer; dstSurface.Surface = (unsigned char *)dstBuffer;
dstSurface.Pitch = (int)(dstWidth * 2); dstSurface.Pitch = dstWidth*2;
dstSurface.Width = (int)dstWidth; dstSurface.Width = dstWidth;
dstSurface.Height = (int)dstHeight; dstSurface.Height = dstHeight;
if (filterFunction == NULL) if (filterFunction == NULL)
{ {

View File

@ -16,16 +16,12 @@
// * do so, delete this exception statement from your version. * // * do so, delete this exception statement from your version. *
// **************************************************************************** // ****************************************************************************
// 2025-07-15 (rogerman): Add support for big-endian byte order.
// 2024-08-01 (rogerman): Small performance optimization to
// ColorDistanceARGB::dist(). (Special thanks to m42a
// for this.)
// 2016-03-04 (rogerman): Update to XBRZ 1.4. // 2016-03-04 (rogerman): Update to XBRZ 1.4.
// //
// 2014-11-18 (rogerman): Update to XBRZ 1.1. // 2014-11-18 (rogerman): Update to XBRZ 1.1.
// //
// 2014-02-06 (rogerman): Modified for use in DeSmuME by removing C++11 code. // 2014-02-06 (rogerman): Modified for use in DeSmuME by removing C++11 code.
// Also add render functions compatible with filter.h. // Also add render functions compatible with filter.h.
#include "xbrz.h" #include "xbrz.h"
#include "filter.h" #include "filter.h"
@ -42,17 +38,10 @@
#define FORCE_INLINE inline #define FORCE_INLINE inline
#endif #endif
#if defined(MSB_FIRST) #define COLOR_MASK_A 0xFF000000
#define COLOR_MASK_A 0x000000FF #define COLOR_MASK_R 0x00FF0000
#define COLOR_MASK_R 0x0000FF00 #define COLOR_MASK_G 0x0000FF00
#define COLOR_MASK_G 0x00FF0000 #define COLOR_MASK_B 0x000000FF
#define COLOR_MASK_B 0xFF000000
#else
#define COLOR_MASK_A 0xFF000000
#define COLOR_MASK_R 0x00FF0000
#define COLOR_MASK_G 0x0000FF00
#define COLOR_MASK_B 0x000000FF
#endif
namespace namespace
{ {
@ -67,24 +56,6 @@ inline unsigned char getBlue (uint32_t pix) { return getByte<0>(pix); }
inline uint32_t makePixel( unsigned char r, unsigned char g, unsigned char b) { return (r << 16) | (g << 8) | b; } inline uint32_t makePixel( unsigned char r, unsigned char g, unsigned char b) { return (r << 16) | (g << 8) | b; }
inline uint32_t makePixel(unsigned char a, unsigned char r, unsigned char g, unsigned char b) { return (a << 24) | (r << 16) | (g << 8) | b; } inline uint32_t makePixel(unsigned char a, unsigned char r, unsigned char g, unsigned char b) { return (a << 24) | (r << 16) | (g << 8) | b; }
#if defined(MSB_FIRST)
inline unsigned char getAlpha_DesmumeTexture(uint32_t pix) { return getByte<0>(pix); }
inline unsigned char getRed_DesmumeTexture (uint32_t pix) { return getByte<1>(pix); }
inline unsigned char getGreen_DesmumeTexture(uint32_t pix) { return getByte<2>(pix); }
inline unsigned char getBlue_DesmumeTexture (uint32_t pix) { return getByte<3>(pix); }
inline uint32_t makePixel_DesmumeTexture( unsigned char r, unsigned char g, unsigned char b) { return (b << 24) | (g << 16) | (r << 8) ; }
inline uint32_t makePixel_DesmumeTexture(unsigned char a, unsigned char r, unsigned char g, unsigned char b) { return (b << 24) | (g << 16) | (r << 8) | a; }
#else
inline unsigned char getAlpha_DesmumeTexture(uint32_t pix) { return getAlpha(pix); }
inline unsigned char getRed_DesmumeTexture (uint32_t pix) { return getRed (pix); }
inline unsigned char getGreen_DesmumeTexture(uint32_t pix) { return getGreen(pix); }
inline unsigned char getBlue_DesmumeTexture (uint32_t pix) { return getBlue (pix); }
inline uint32_t makePixel_DesmumeTexture( unsigned char r, unsigned char g, unsigned char b) { return makePixel( r,g,b); }
inline uint32_t makePixel_DesmumeTexture(unsigned char a, unsigned char r, unsigned char g, unsigned char b) { return makePixel(a,r,g,b); }
#endif
template <unsigned int M, unsigned int N> FORCE_INLINE template <unsigned int M, unsigned int N> FORCE_INLINE
unsigned char gradientRGB_calcColor(unsigned char colFront, unsigned char colBack) unsigned char gradientRGB_calcColor(unsigned char colFront, unsigned char colBack)
{ {
@ -136,17 +107,13 @@ uint32_t gradientARGB(uint32_t pixFront, uint32_t pixBack) //find intermediate c
template <unsigned int M, unsigned int N> inline template <unsigned int M, unsigned int N> inline
uint32_t gradientARGB_1bitAlpha(uint32_t pixFront, uint32_t pixBack) //special blending mode for NDS textures -- assumes that the alpha component value is either 0x00 or 0xFF uint32_t gradientARGB_1bitAlpha(uint32_t pixFront, uint32_t pixBack) //special blending mode for NDS textures -- assumes that the alpha component value is either 0x00 or 0xFF
{ {
const unsigned int weightFront = getAlpha_DesmumeTexture(pixFront) * M; const unsigned int weightFront = getAlpha(pixFront) * M;
const unsigned int weightBack = getAlpha_DesmumeTexture(pixBack) * (N - M); const unsigned int weightBack = getAlpha(pixBack) * (N - M);
const unsigned int weightSum = weightFront + weightBack; const unsigned int weightSum = weightFront + weightBack;
if (weightSum == 0) if (weightSum == 0)
{ {
#if defined(MSB_FIRST)
return (pixFront & 0xFFFFFF00);
#else
return (pixFront & 0x00FFFFFF); return (pixFront & 0x00FFFFFF);
#endif
} }
else if (weightFront == 0) else if (weightFront == 0)
{ {
@ -158,10 +125,10 @@ uint32_t gradientARGB_1bitAlpha(uint32_t pixFront, uint32_t pixBack) //special b
} }
// At this point, we know that both pixels must be opaque, so treat them as such. // At this point, we know that both pixels must be opaque, so treat them as such.
return makePixel_DesmumeTexture(0xFF, return makePixel(0xFF,
gradientRGB_calcColor<M, N>(getRed_DesmumeTexture (pixFront), getRed_DesmumeTexture (pixBack)), gradientRGB_calcColor<M, N>(getRed (pixFront), getRed (pixBack)),
gradientRGB_calcColor<M, N>(getGreen_DesmumeTexture(pixFront), getGreen_DesmumeTexture(pixBack)), gradientRGB_calcColor<M, N>(getGreen(pixFront), getGreen(pixBack)),
gradientRGB_calcColor<M, N>(getBlue_DesmumeTexture (pixFront), getBlue_DesmumeTexture (pixBack))); gradientRGB_calcColor<M, N>(getBlue (pixFront), getBlue (pixBack)));
} }
//inline //inline
@ -1185,65 +1152,28 @@ struct ColorDistanceARGB
{ {
static double dist(uint32_t pix1, uint32_t pix2, double luminanceWeight) static double dist(uint32_t pix1, uint32_t pix2, double luminanceWeight)
{ {
const int a1 = getAlpha(pix1); const double a1 = getAlpha(pix1) / 255.0 ;
const int a2 = getAlpha(pix2); const double a2 = getAlpha(pix2) / 255.0 ;
/*
// Requirements for a color distance handling alpha channel: with a1, a2 in [0, 1] Requirements for a color distance handling alpha channel: with a1, a2 in [0, 1]
// 1. if a1 = a2, distance should be: a1 * distYCbCr() 1. if a1 = a2, distance should be: a1 * distYCbCr()
// 2. if a1 = 0, distance should be: a2 * distYCbCr(black, white) = a2 * 255 2. if a1 = 0, distance should be: a2 * distYCbCr(black, white) = a2 * 255
// 3. if a1 = 1, ??? maybe: 255 * (1 - a2) + a2 * distYCbCr() 3. if a1 = 1, ??? maybe: 255 * (1 - a2) + a2 * distYCbCr()
*/
if (a1 == 0)
return a2;
if (a2 == 0)
return a1;
//return std::min(a1, a2) * DistYCbCrBuffer::dist(pix1, pix2) + 255 * abs(a1 - a2); //return std::min(a1, a2) * DistYCbCrBuffer::dist(pix1, pix2) + 255 * abs(a1 - a2);
//=> following code is 15% faster: //=> following code is 15% faster:
const double d = DistYCbCrBuffer::dist(pix1, pix2); const double d = DistYCbCrBuffer::dist(pix1, pix2);
if (a1 == 255 && a2 == 255)
return d;
if (a1 == a2)
return a1 * d / 255.0;
if (a1 < a2) if (a1 < a2)
return a1 * d / 255.0 + (a2 - a1); return a1 * d + 255 * (a2 - a1);
else else
return a2 * d / 255.0 + (a1 - a2); return a2 * d + 255 * (a1 - a2);
//alternative? return std::sqrt(a1 * a2 * square(DistYCbCrBuffer::dist(pix1, pix2)) + square(255 * (a1 - a2))); //alternative? return std::sqrt(a1 * a2 * square(DistYCbCrBuffer::dist(pix1, pix2)) + square(255 * (a1 - a2)));
} }
}; };
struct ColorDistanceARGB_DesmumeTexture
{
static double dist(uint32_t pix1, uint32_t pix2, double luminanceWeight)
{
const int a1 = getAlpha_DesmumeTexture(pix1);
const int a2 = getAlpha_DesmumeTexture(pix2);
if (a1 == 0)
return a2;
if (a2 == 0)
return a1;
#if defined(MSB_FIRST)
const uint32_t pix1Swapped = ((pix1 & 0x000000FF) << 24) | ((pix1 & 0x0000FF00) << 8) | ((pix1 >> 8) & 0x0000FF00) | ((pix1 >> 24) & 0x000000FF);
const uint32_t pix2Swapped = ((pix2 & 0x000000FF) << 24) | ((pix2 & 0x0000FF00) << 8) | ((pix2 >> 8) & 0x0000FF00) | ((pix2 >> 24) & 0x000000FF);
const double d = DistYCbCrBuffer::dist(pix1Swapped, pix2Swapped);
#else
const double d = DistYCbCrBuffer::dist(pix1, pix2);
#endif
if (a1 == 255 && a2 == 255)
return d;
if (a1 == a2)
return a1 * d / 255.0;
if (a1 < a2)
return a1 * d / 255.0 + (a2 - a1);
else
return a2 * d / 255.0 + (a1 - a2);
}
};
struct ColorGradientRGB struct ColorGradientRGB
{ {
@ -1282,15 +1212,15 @@ void xbrz::scale(const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight
switch (SCALEFACTOR) switch (SCALEFACTOR)
{ {
case 2: case 2:
return scaleImage<Scaler2x<ColorGradientARGB_1bitAlpha>, ColorDistanceARGB_DesmumeTexture>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); return scaleImage<Scaler2x<ColorGradientARGB_1bitAlpha>, ColorDistanceARGB>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast);
case 3: case 3:
return scaleImage<Scaler3x<ColorGradientARGB_1bitAlpha>, ColorDistanceARGB_DesmumeTexture>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); return scaleImage<Scaler3x<ColorGradientARGB_1bitAlpha>, ColorDistanceARGB>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast);
case 4: case 4:
return scaleImage<Scaler4x<ColorGradientARGB_1bitAlpha>, ColorDistanceARGB_DesmumeTexture>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); return scaleImage<Scaler4x<ColorGradientARGB_1bitAlpha>, ColorDistanceARGB>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast);
case 5: case 5:
return scaleImage<Scaler5x<ColorGradientARGB_1bitAlpha>, ColorDistanceARGB_DesmumeTexture>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); return scaleImage<Scaler5x<ColorGradientARGB_1bitAlpha>, ColorDistanceARGB>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast);
case 6: case 6:
return scaleImage<Scaler6x<ColorGradientARGB_1bitAlpha>, ColorDistanceARGB_DesmumeTexture>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); return scaleImage<Scaler6x<ColorGradientARGB_1bitAlpha>, ColorDistanceARGB>(src, trg, srcWidth, srcHeight, cfg, yFirst, yLast);
} }
break; break;

View File

@ -13,15 +13,12 @@
// * do so, delete this exception statement from your version. * // * do so, delete this exception statement from your version. *
// **************************************************************************** // ****************************************************************************
// 2024-08-01 (rogerman): Small performance optimization to
// ColorDistanceARGB::dist(). (Special thanks to m42a
// for this.)
// 2016-03-04 (rogerman): Update to XBRZ 1.4. // 2016-03-04 (rogerman): Update to XBRZ 1.4.
// //
// 2014-11-18 (rogerman): Update to XBRZ 1.1. // 2014-11-18 (rogerman): Update to XBRZ 1.1.
// //
// 2014-02-06 (rogerman): Modified for use in DeSmuME by removing C++11 code. // 2014-02-06 (rogerman): Modified for use in DeSmuME by removing C++11 code.
// Also integrate xbrz's config.h file into this one. // Also integrate xbrz's config.h file into this one.
#ifndef XBRZ_HEADER_3847894708239054 #ifndef XBRZ_HEADER_3847894708239054
#define XBRZ_HEADER_3847894708239054 #define XBRZ_HEADER_3847894708239054

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2025 DeSmuME Team Copyright (C) 2009-2022 DeSmuME Team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -34,16 +34,6 @@
static _KEY1 enc(&MMU.ARM7_BIOS[0x0030]); static _KEY1 enc(&MMU.ARM7_BIOS[0x0030]);
const char *defaultNickname = DESMUME_NAME; const char *defaultNickname = DESMUME_NAME;
const char *defaultMessage = DESMUME_NAME " makes you happy!"; const char *defaultMessage = DESMUME_NAME " makes you happy!";
const char *defaultMacAddressStr = "0009BF123456";
CFIRMWARE::CFIRMWARE()
{
memset(&_header, 0, sizeof(_header));
_fwFilePath = "";
_isLoaded = false;
_userDataAddr = 0x0003FE00;
}
u16 CFIRMWARE::_getBootCodeCRC16(const u8 *arm9Data, const u32 arm9Size, const u8 *arm7Data, const u32 arm7Size) u16 CFIRMWARE::_getBootCodeCRC16(const u8 *arm9Data, const u32 arm9Size, const u8 *arm7Data, const u32 arm7Size)
{ {
@ -271,7 +261,7 @@ bool CFIRMWARE::load(const char *firmwareFilePath)
this->_header = newFirmwareData->header; this->_header = newFirmwareData->header;
if (MMU.fw.size != fileSize) // reallocate if (MMU.fw.size != fileSize) // reallocate
mc_alloc(&MMU.fw, (u32)fileSize); mc_alloc(&MMU.fw, fileSize);
this->_userDataAddr = LE_TO_LOCAL_16(newFirmwareData->header.userSettingsOffset) * 8; this->_userDataAddr = LE_TO_LOCAL_16(newFirmwareData->header.userSettingsOffset) * 8;
@ -685,47 +675,6 @@ int copy_firmware_user_data( u8 *dest_buffer, const u8 *fw_data)
return copy_good; return copy_good;
} }
void NDS_GetFirmwareMACAddressAsStr(const FirmwareConfig& config, char outMacStr[13])
{
for (u8 i = 0; i < 6; i++) {
for (u8 j = 0; j < 2; j++) {
u8 u4Bits = j == 0 ? config.MACAddress[i] / 16 : config.MACAddress[i] % 16;
outMacStr[i * 2 + j] = u4Bits >= 10 ? 'A' + (u4Bits - 10) : '0' + u4Bits;
}
}
outMacStr[12] = '\0';
}
void NDS_SetFirmwareMACAddressFromStr(FirmwareConfig& config, const char* macStr)
{
for (size_t i = 0; i < sizeof(config.MACAddress); i++)
config.MACAddress[i] = 0;
// Each letter in macStr represents a 4-bits value (u4) of the mac address.
size_t macStrLen = strlen(macStr);
if (macStrLen > 12)
macStrLen = 12;
const size_t missingLetterCount = 12 - macStrLen;
for (size_t i = 0; i < macStrLen; i++) {
char letter = macStr[i];
u8 macU4Val = 0;
if (letter >= '0' && letter <= '9')
macU4Val = letter - '0';
else if (letter >= 'A' && letter <= 'F')
macU4Val = letter - 'A' + 10;
else if (letter >= 'a' && letter <= 'f')
macU4Val = letter - 'a' + 10;
// Invalid letters are treated as 0.
const size_t u4Idx = i + missingLetterCount; // u4Idx is between 0-12
const size_t u8Idx = u4Idx / 2;
const bool isHighBits = u4Idx % 2 == 0;
config.MACAddress[u8Idx] += isHighBits ? macU4Val << 4 : macU4Val;
}
}
void NDS_GetDefaultFirmwareConfig(FirmwareConfig &outConfig) void NDS_GetDefaultFirmwareConfig(FirmwareConfig &outConfig)
{ {
memset(&outConfig, 0, sizeof(FirmwareConfig)); memset(&outConfig, 0, sizeof(FirmwareConfig));

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2009-2025 DeSmuME Team Copyright (C) 2009-2022 DeSmuME Team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -35,7 +35,6 @@
extern const char *defaultNickname; extern const char *defaultNickname;
extern const char *defaultMessage; extern const char *defaultMessage;
extern const char* defaultMacAddressStr;
struct FirmwareConfig struct FirmwareConfig
{ {
@ -428,12 +427,12 @@ private:
bool _isLoaded; bool _isLoaded;
u32 _userDataAddr; u32 _userDataAddr;
u16 _getBootCodeCRC16(const u8 *arm9Data, const u32 arm9Size, const u8 *arm7Data, const u32 arm7Size); u16 _getBootCodeCRC16(const u8 *arm9Data, const u32 arm9Size, const u8 *arm7Data, const u32 arm7Size);
u32 _decrypt(const u8 *in, u8* &out); u32 _decrypt(const u8 *in, u8* &out);
u32 _decompress(const u8 *in, u8* &out); u32 _decompress(const u8 *in, u8* &out);
public: public:
CFIRMWARE(); CFIRMWARE(): _userDataAddr(0x3FE00), _isLoaded(false) {};
bool load(const char *firmwareFilePath); bool load(const char *firmwareFilePath);
bool unpack(); bool unpack();
@ -448,8 +447,6 @@ public:
int copy_firmware_user_data( u8 *dest_buffer, const u8 *fw_data); int copy_firmware_user_data( u8 *dest_buffer, const u8 *fw_data);
void NDS_GetFirmwareMACAddressAsStr(const FirmwareConfig& config, char outMacStr[13]);
void NDS_SetFirmwareMACAddressFromStr(FirmwareConfig& config, const char* MacStr);
void NDS_GetDefaultFirmwareConfig(FirmwareConfig &outConfig); void NDS_GetDefaultFirmwareConfig(FirmwareConfig &outConfig);
void NDS_GetCurrentWFCUserID(u8 *outMAC, u8 *outUserID); void NDS_GetCurrentWFCUserID(u8 *outMAC, u8 *outUserID);
void NDS_ApplyFirmwareSettings(NDSFirmwareData *outFirmware, void NDS_ApplyFirmwareSettings(NDSFirmwareData *outFirmware,

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018-2023 DeSmuME team Copyright (C) 2018 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -134,7 +134,7 @@ void ClientAVCaptureFileStream::InitBaseProperties(const AVFileTypeID fileTypeID
this->_expectedMaxFrameSize = videoFrameSize + audioFrameSize; this->_expectedMaxFrameSize = videoFrameSize + audioFrameSize;
_semQueue = ssem_new((int)pendingFrameCount); _semQueue = ssem_new(pendingFrameCount);
} }
AVFileTypeVideoCodecID ClientAVCaptureFileStream::GetVideoCodecID() AVFileTypeVideoCodecID ClientAVCaptureFileStream::GetVideoCodecID()
@ -484,7 +484,7 @@ void ClientAVCaptureObject::ConvertVideoSlice555Xto888(const VideoConvertParam &
const u16 *__restrict src = (const u16 *__restrict)param.src; const u16 *__restrict src = (const u16 *__restrict)param.src;
u8 *__restrict dst = param.dst; u8 *__restrict dst = param.dst;
ColorspaceConvertBuffer555xTo888<false, false>(src, dst, param.frameWidth * lineCount); ColorspaceConvertBuffer555XTo888<false, false>(src, dst, param.frameWidth * lineCount);
} }
//converts 32bpp to 24bpp and flips //converts 32bpp to 24bpp and flips
@ -494,7 +494,7 @@ void ClientAVCaptureObject::ConvertVideoSlice888Xto888(const VideoConvertParam &
const u32 *__restrict src = (const u32 *__restrict)param.src; const u32 *__restrict src = (const u32 *__restrict)param.src;
u8 *__restrict dst = param.dst; u8 *__restrict dst = param.dst;
ColorspaceConvertBuffer888xTo888<false, false>(src, dst, param.frameWidth * lineCount); ColorspaceConvertBuffer888XTo888<false, false>(src, dst, param.frameWidth * lineCount);
} }
void ClientAVCaptureObject::CaptureVideoFrame(const void *srcVideoFrame, const size_t inFrameWidth, const size_t inFrameHeight, const NDSColorFormat colorFormat) void ClientAVCaptureObject::CaptureVideoFrame(const void *srcVideoFrame, const size_t inFrameWidth, const size_t inFrameHeight, const NDSColorFormat colorFormat)

View File

@ -88,7 +88,7 @@ enum AVFileTypeID
AVFileTypeID_m4a_ALAC = (AVFileTypeContainerID_m4a | AVFileTypeVideoCodecID_None | AVFileTypeAudioCodecID_ALAC), // dec = 8453936 AVFileTypeID_m4a_ALAC = (AVFileTypeContainerID_m4a | AVFileTypeVideoCodecID_None | AVFileTypeAudioCodecID_ALAC), // dec = 8453936
AVFileTypeID_aiff_PCMs16BE = (AVFileTypeContainerID_aiff | AVFileTypeVideoCodecID_None | AVFileTypeAudioCodecID_PCMs16BE), // dec = 8519456 AVFileTypeID_aiff_PCMs16BE = (AVFileTypeContainerID_aiff | AVFileTypeVideoCodecID_None | AVFileTypeAudioCodecID_PCMs16BE), // dec = 8519456
AVFileTypeID_flac_FLAC = (AVFileTypeContainerID_flac | AVFileTypeVideoCodecID_None | AVFileTypeAudioCodecID_FLAC), // dec = 8585024 AVFileTypeID_flac_FLAC = (AVFileTypeContainerID_flac | AVFileTypeVideoCodecID_None | AVFileTypeAudioCodecID_FLAC), // dec = 8585024
AVFileTypeID_wav_PCMs16LE = (AVFileTypeContainerID_wav | AVFileTypeVideoCodecID_None | AVFileTypeAudioCodecID_PCMs16LE) // dec = 8650512 AVFileTypeID_wav_PCMs16LE = (AVFileTypeContainerID_wav | AVFileTypeVideoCodecID_None | AVFileTypeAudioCodecID_PCMs16LE), // dec = 8650512
}; };
enum enum

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2017-2025 DeSmuME team Copyright (C) 2017-2018 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -101,16 +101,16 @@ void ClientDisplayPresenter::__InstanceInit(const ClientDisplayPresenterProperti
_showRTC = false; _showRTC = false;
_showInputs = false; _showInputs = false;
_hudColorExecutionSpeed = 0xFFFFFFFF; _hudColorExecutionSpeed = LE_TO_LOCAL_32(0xFFFFFFFF);
_hudColorVideoFPS = 0xFFFFFFFF; _hudColorVideoFPS = LE_TO_LOCAL_32(0xFFFFFFFF);
_hudColorRender3DFPS = 0xFFFFFFFF; _hudColorRender3DFPS = LE_TO_LOCAL_32(0xFFFFFFFF);
_hudColorFrameIndex = 0xFFFFFFFF; _hudColorFrameIndex = LE_TO_LOCAL_32(0xFFFFFFFF);
_hudColorLagFrameCount = 0xFFFFFFFF; _hudColorLagFrameCount = LE_TO_LOCAL_32(0xFFFFFFFF);
_hudColorCPULoadAverage = 0xFFFFFFFF; _hudColorCPULoadAverage = LE_TO_LOCAL_32(0xFFFFFFFF);
_hudColorRTC = 0xFFFFFFFF; _hudColorRTC = LE_TO_LOCAL_32(0xFFFFFFFF);
_hudColorInputAppliedAndPending = 0xFFFFFFFF; _hudColorInputAppliedAndPending = LE_TO_LOCAL_32(0xFFFFFFFF);
_hudColorInputAppliedOnly = 0xFF3030FF; _hudColorInputAppliedOnly = LE_TO_LOCAL_32(0xFF3030FF);
_hudColorInputPendingOnly = 0xFF00C000; _hudColorInputPendingOnly = LE_TO_LOCAL_32(0xFF00C000);
_clientFrameInfo.videoFPS = 0; _clientFrameInfo.videoFPS = 0;
_ndsFrameInfo.clear(); _ndsFrameInfo.clear();
@ -256,18 +256,15 @@ double ClientDisplayPresenter::GetScaleFactor() const
void ClientDisplayPresenter::SetScaleFactor(const double scaleFactor) void ClientDisplayPresenter::SetScaleFactor(const double scaleFactor)
{ {
const bool willChangeScaleFactor = (this->_scaleFactor != scaleFactor); const bool willChangeScaleFactor = (this->_scaleFactor != scaleFactor);
if (!willChangeScaleFactor)
{
return;
}
this->_scaleFactor = scaleFactor; this->_scaleFactor = scaleFactor;
this->_glyphTileSize = (double)HUD_TEXTBOX_BASEGLYPHSIZE * scaleFactor;
this->_glyphSize = (double)this->_glyphTileSize * 0.75;
this->LoadHUDFont(); if (willChangeScaleFactor)
this->_UpdateViewScale(); {
this->_glyphTileSize = (double)HUD_TEXTBOX_BASEGLYPHSIZE * scaleFactor;
this->_glyphSize = (double)this->_glyphTileSize * 0.75;
this->LoadHUDFont();
}
} }
void ClientDisplayPresenter::_UpdateClientSize() void ClientDisplayPresenter::_UpdateClientSize()
@ -295,10 +292,6 @@ void ClientDisplayPresenter::_UpdateViewScale()
} }
this->_hudObjectScale *= this->_scaleFactor; this->_hudObjectScale *= this->_scaleFactor;
pthread_mutex_lock(&this->_mutexHUDString);
this->_hudNeedsUpdate = true;
pthread_mutex_unlock(&this->_mutexHUDString);
} }
// NDS screen layout // NDS screen layout
@ -2013,10 +2006,10 @@ void ClientDisplay3DPresenter::SetHUDColorVertices(uint32_t *vtxColorBufferPtr)
continue; continue;
} }
vtxColorBufferPtr[j+0] = LE_TO_LOCAL_32(currentColor); // Top Left vtxColorBufferPtr[j+0] = currentColor; // Top Left
vtxColorBufferPtr[j+1] = LE_TO_LOCAL_32(currentColor); // Top Right vtxColorBufferPtr[j+1] = currentColor; // Top Right
vtxColorBufferPtr[j+2] = LE_TO_LOCAL_32(currentColor); // Bottom Right vtxColorBufferPtr[j+2] = currentColor; // Bottom Right
vtxColorBufferPtr[j+3] = LE_TO_LOCAL_32(currentColor); // Bottom Left vtxColorBufferPtr[j+3] = currentColor; // Bottom Left
} }
// Fill in the vertices for the inputs. // Fill in the vertices for the inputs.
@ -2048,20 +2041,20 @@ void ClientDisplay3DPresenter::SetHUDColorVertices(uint32_t *vtxColorBufferPtr)
for (size_t k = 0; k < HUD_INPUT_ELEMENT_LENGTH; i++, j+=4, k++) for (size_t k = 0; k < HUD_INPUT_ELEMENT_LENGTH; i++, j+=4, k++)
{ {
vtxColorBufferPtr[j+0] = LE_TO_LOCAL_32(inputColors[k]); // Top Left vtxColorBufferPtr[j+0] = inputColors[k]; // Top Left
vtxColorBufferPtr[j+1] = LE_TO_LOCAL_32(inputColors[k]); // Top Right vtxColorBufferPtr[j+1] = inputColors[k]; // Top Right
vtxColorBufferPtr[j+2] = LE_TO_LOCAL_32(inputColors[k]); // Bottom Right vtxColorBufferPtr[j+2] = inputColors[k]; // Bottom Right
vtxColorBufferPtr[j+3] = LE_TO_LOCAL_32(inputColors[k]); // Bottom Left vtxColorBufferPtr[j+3] = inputColors[k]; // Bottom Left
} }
touchColor = ((this->_ndsFrameInfo.inputStatesPending.Touch != 0) && (this->_ndsFrameInfo.inputStatesApplied.Touch != 0)) ? 0x00000000 : LE_TO_LOCAL_32((touchColor & 0x00FFFFFF) | 0x60000000); touchColor = ((this->_ndsFrameInfo.inputStatesPending.Touch != 0) && (this->_ndsFrameInfo.inputStatesApplied.Touch != 0)) ? 0x00000000 : (touchColor & LE_TO_LOCAL_32(0x00FFFFFF)) | LE_TO_LOCAL_32(0x60000000);
for (size_t k = 0; k < HUD_INPUT_TOUCH_LINE_ELEMENTS; i++, j+=4, k++) for (size_t k = 0; k < HUD_INPUT_TOUCH_LINE_ELEMENTS; i++, j+=4, k++)
{ {
vtxColorBufferPtr[j+0] = touchColor; // Top Left vtxColorBufferPtr[j+0] = touchColor; // Top Left
vtxColorBufferPtr[j+1] = touchColor; // Top Right vtxColorBufferPtr[j+1] = touchColor; // Top Right
vtxColorBufferPtr[j+2] = touchColor; // Bottom Right vtxColorBufferPtr[j+2] = touchColor; // Bottom Right
vtxColorBufferPtr[j+3] = touchColor; // Bottom Left vtxColorBufferPtr[j+3] = touchColor; // Bottom Left
} }
} }

View File

@ -245,7 +245,7 @@ protected:
public: public:
ClientExecutionControl(); ClientExecutionControl();
virtual ~ClientExecutionControl(); ~ClientExecutionControl();
ClientAVCaptureObject* GetClientAVCaptureObject(); ClientAVCaptureObject* GetClientAVCaptureObject();
ClientAVCaptureObject* GetClientAVCaptureObjectApplied(); ClientAVCaptureObject* GetClientAVCaptureObjectApplied();

View File

@ -331,7 +331,6 @@ typedef std::vector<ClientInputDeviceProperties> ClientInputDevicePropertiesList
class ClientInputDevicePropertiesEncoder class ClientInputDevicePropertiesEncoder
{ {
public: public:
virtual ~ClientInputDevicePropertiesEncoder() {}
virtual ClientInputDeviceProperties EncodeKeyboardInput(const int32_t keyCode, bool keyPressed); virtual ClientInputDeviceProperties EncodeKeyboardInput(const int32_t keyCode, bool keyPressed);
virtual ClientInputDeviceProperties EncodeMouseInput(const int32_t buttonNumber, float touchLocX, float touchLocY, bool buttonPressed); virtual ClientInputDeviceProperties EncodeMouseInput(const int32_t buttonNumber, float touchLocX, float touchLocY, bool buttonPressed);
}; };
@ -390,7 +389,7 @@ protected:
public: public:
ClientInputHandler(); ClientInputHandler();
virtual ~ClientInputHandler(); ~ClientInputHandler();
ClientExecutionControl* GetClientExecutionController(); ClientExecutionControl* GetClientExecutionController();
void SetClientExecutionController(ClientExecutionControl *execControl); void SetClientExecutionController(ClientExecutionControl *execControl);

View File

@ -1543,27 +1543,6 @@
AB681025187D4AEF0049F2C2 /* Icon_PaddleKnob_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = AB681018187D4AEF0049F2C2 /* Icon_PaddleKnob_256x256.png */; }; AB681025187D4AEF0049F2C2 /* Icon_PaddleKnob_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = AB681018187D4AEF0049F2C2 /* Icon_PaddleKnob_256x256.png */; };
AB681027187D4AEF0049F2C2 /* Icon_Piano_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = AB681019187D4AEF0049F2C2 /* Icon_Piano_256x256.png */; }; AB681027187D4AEF0049F2C2 /* Icon_Piano_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = AB681019187D4AEF0049F2C2 /* Icon_Piano_256x256.png */; };
AB68A0DD16B139BC00DE0546 /* OGLRender_3_2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB68A0DA16B139BC00DE0546 /* OGLRender_3_2.cpp */; }; AB68A0DD16B139BC00DE0546 /* OGLRender_3_2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB68A0DA16B139BC00DE0546 /* OGLRender_3_2.cpp */; };
AB6E17F52A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */; };
AB6E17F62A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */; };
AB6E17F72A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */; };
AB6E17F82A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */; };
AB6E17F92A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */; };
AB6E17FA2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */; };
AB6E17FB2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */; };
AB6E17FC2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */; };
AB6E17FD2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */; };
AB6E17FE2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */; };
AB6E18012A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB6E18022A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB6E18032A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB6E18042A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB6E18052A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB6E18062A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB6E18072A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB6E18082A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB6E18092A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB6E180A2A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB6E180B2A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */; };
AB74EC8A1738499C0026C41E /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB74EC891738499C0026C41E /* Carbon.framework */; }; AB74EC8A1738499C0026C41E /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB74EC891738499C0026C41E /* Carbon.framework */; };
AB78B5C11E384F2100297FED /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3BF4401E262943003E2B24 /* Metal.framework */; settings = {ATTRIBUTES = (Required, ); }; }; AB78B5C11E384F2100297FED /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3BF4401E262943003E2B24 /* Metal.framework */; settings = {ATTRIBUTES = (Required, ); }; };
AB78B5C21E384F2200297FED /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3BF4401E262943003E2B24 /* Metal.framework */; settings = {ATTRIBUTES = (Required, ); }; }; AB78B5C21E384F2200297FED /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB3BF4401E262943003E2B24 /* Metal.framework */; settings = {ATTRIBUTES = (Required, ); }; };
@ -2446,17 +2425,6 @@
AB8493C01B4E614D00CD1C73 /* Icon_VolumeOneThird_16x16@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AB8493AD1B4E614D00CD1C73 /* Icon_VolumeOneThird_16x16@2x.png */; }; AB8493C01B4E614D00CD1C73 /* Icon_VolumeOneThird_16x16@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AB8493AD1B4E614D00CD1C73 /* Icon_VolumeOneThird_16x16@2x.png */; };
AB8493C11B4E614D00CD1C73 /* Icon_VolumeTwoThird_16x16@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AB8493AE1B4E614D00CD1C73 /* Icon_VolumeTwoThird_16x16@2x.png */; }; AB8493C11B4E614D00CD1C73 /* Icon_VolumeTwoThird_16x16@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AB8493AE1B4E614D00CD1C73 /* Icon_VolumeTwoThird_16x16@2x.png */; };
AB8493C31B4E614D00CD1C73 /* Icon_VolumeTwoThird_16x16@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AB8493AE1B4E614D00CD1C73 /* Icon_VolumeTwoThird_16x16@2x.png */; }; AB8493C31B4E614D00CD1C73 /* Icon_VolumeTwoThird_16x16@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = AB8493AE1B4E614D00CD1C73 /* Icon_VolumeTwoThird_16x16@2x.png */; };
AB8800542AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB8800552AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB8800562AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB8800572AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB8800582AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB8800592AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB88005A2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB88005B2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB88005C2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB88005D2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB88005E2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */; };
AB8967D916D2ED0700F826F1 /* DisplayWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */; }; AB8967D916D2ED0700F826F1 /* DisplayWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */; };
AB8967DD16D2ED2700F826F1 /* DisplayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */; }; AB8967DD16D2ED2700F826F1 /* DisplayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */; };
AB8B7AAC17CE8C440051CEBF /* slot1comp_protocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8B7AAB17CE8C440051CEBF /* slot1comp_protocol.cpp */; }; AB8B7AAC17CE8C440051CEBF /* slot1comp_protocol.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB8B7AAB17CE8C440051CEBF /* slot1comp_protocol.cpp */; };
@ -4044,9 +4012,6 @@
AB681018187D4AEF0049F2C2 /* Icon_PaddleKnob_256x256.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_PaddleKnob_256x256.png; path = images/Icon_PaddleKnob_256x256.png; sourceTree = "<group>"; }; AB681018187D4AEF0049F2C2 /* Icon_PaddleKnob_256x256.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_PaddleKnob_256x256.png; path = images/Icon_PaddleKnob_256x256.png; sourceTree = "<group>"; };
AB681019187D4AEF0049F2C2 /* Icon_Piano_256x256.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_Piano_256x256.png; path = images/Icon_Piano_256x256.png; sourceTree = "<group>"; }; AB681019187D4AEF0049F2C2 /* Icon_Piano_256x256.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_Piano_256x256.png; path = images/Icon_Piano_256x256.png; sourceTree = "<group>"; };
AB68A0DA16B139BC00DE0546 /* OGLRender_3_2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OGLRender_3_2.cpp; sourceTree = "<group>"; }; AB68A0DA16B139BC00DE0546 /* OGLRender_3_2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OGLRender_3_2.cpp; sourceTree = "<group>"; };
AB6E17F32A675BF1003A564D /* CheatDatabaseWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CheatDatabaseWindowController.h; sourceTree = "<group>"; };
AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CheatDatabaseWindowController.mm; sourceTree = "<group>"; };
AB6E18002A6B218D003A564D /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = translations/English.lproj/CheatDatabaseViewer.xib; sourceTree = "<group>"; };
AB6FBEF5139B6258007BB045 /* slot1_retail_nand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = slot1_retail_nand.cpp; sourceTree = "<group>"; }; AB6FBEF5139B6258007BB045 /* slot1_retail_nand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = slot1_retail_nand.cpp; sourceTree = "<group>"; };
AB74EC891738499C0026C41E /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; AB74EC891738499C0026C41E /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
AB75226D14C7BB51009B97B3 /* AppIcon_FirmwareConfig.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_FirmwareConfig.icns; sourceTree = "<group>"; }; AB75226D14C7BB51009B97B3 /* AppIcon_FirmwareConfig.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_FirmwareConfig.icns; sourceTree = "<group>"; };
@ -4057,7 +4022,6 @@
AB796CA215CDCB6B00C59155 /* instruction_attributes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = instruction_attributes.h; sourceTree = "<group>"; }; AB796CA215CDCB6B00C59155 /* instruction_attributes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = instruction_attributes.h; sourceTree = "<group>"; };
AB796CA315CDCB6B00C59155 /* instructions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = instructions.h; sourceTree = "<group>"; }; AB796CA315CDCB6B00C59155 /* instructions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = instructions.h; sourceTree = "<group>"; };
AB796D7015CDCBA200C59155 /* DeSmuME (Debug).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (Debug).app"; sourceTree = BUILT_PRODUCTS_DIR; }; AB796D7015CDCBA200C59155 /* DeSmuME (Debug).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (Debug).app"; sourceTree = BUILT_PRODUCTS_DIR; };
AB7DA2432833EEBA001E9A9E /* DeSmuME_arm64.profdata */ = {isa = PBXFileReference; lastKnownFileType = file; path = DeSmuME_arm64.profdata; sourceTree = "<group>"; };
AB7EC7F2189B2B92009D198A /* Icon_AutoholdClear_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_AutoholdClear_420x420.png; path = images/Icon_AutoholdClear_420x420.png; sourceTree = "<group>"; }; AB7EC7F2189B2B92009D198A /* Icon_AutoholdClear_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_AutoholdClear_420x420.png; path = images/Icon_AutoholdClear_420x420.png; sourceTree = "<group>"; };
AB7EC7F3189B2B92009D198A /* Icon_AutoholdSet_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_AutoholdSet_420x420.png; path = images/Icon_AutoholdSet_420x420.png; sourceTree = "<group>"; }; AB7EC7F3189B2B92009D198A /* Icon_AutoholdSet_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_AutoholdSet_420x420.png; path = images/Icon_AutoholdSet_420x420.png; sourceTree = "<group>"; };
AB80E04C142BC4A800A52038 /* cocoa_util.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_util.mm; sourceTree = "<group>"; }; AB80E04C142BC4A800A52038 /* cocoa_util.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_util.mm; sourceTree = "<group>"; };
@ -4073,7 +4037,6 @@
AB8493AC1B4E614D00CD1C73 /* Icon_VolumeMute_16x16@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon_VolumeMute_16x16@2x.png"; path = "images/Icon_VolumeMute_16x16@2x.png"; sourceTree = "<group>"; }; AB8493AC1B4E614D00CD1C73 /* Icon_VolumeMute_16x16@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon_VolumeMute_16x16@2x.png"; path = "images/Icon_VolumeMute_16x16@2x.png"; sourceTree = "<group>"; };
AB8493AD1B4E614D00CD1C73 /* Icon_VolumeOneThird_16x16@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon_VolumeOneThird_16x16@2x.png"; path = "images/Icon_VolumeOneThird_16x16@2x.png"; sourceTree = "<group>"; }; AB8493AD1B4E614D00CD1C73 /* Icon_VolumeOneThird_16x16@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon_VolumeOneThird_16x16@2x.png"; path = "images/Icon_VolumeOneThird_16x16@2x.png"; sourceTree = "<group>"; };
AB8493AE1B4E614D00CD1C73 /* Icon_VolumeTwoThird_16x16@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon_VolumeTwoThird_16x16@2x.png"; path = "images/Icon_VolumeTwoThird_16x16@2x.png"; sourceTree = "<group>"; }; AB8493AE1B4E614D00CD1C73 /* Icon_VolumeTwoThird_16x16@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Icon_VolumeTwoThird_16x16@2x.png"; path = "images/Icon_VolumeTwoThird_16x16@2x.png"; sourceTree = "<group>"; };
AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = slot2_hcv1000.cpp; sourceTree = "<group>"; };
AB8967D716D2ED0700F826F1 /* DisplayWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayWindowController.h; sourceTree = "<group>"; }; AB8967D716D2ED0700F826F1 /* DisplayWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayWindowController.h; sourceTree = "<group>"; };
AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayWindowController.mm; sourceTree = "<group>"; }; AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayWindowController.mm; sourceTree = "<group>"; };
AB8967DC16D2ED2700F826F1 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = translations/English.lproj/DisplayWindow.xib; sourceTree = "<group>"; }; AB8967DC16D2ED2700F826F1 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = translations/English.lproj/DisplayWindow.xib; sourceTree = "<group>"; };
@ -4144,7 +4107,6 @@
AB9971CE134EDA0800531BA7 /* cocoa_globals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_globals.h; sourceTree = "<group>"; }; AB9971CE134EDA0800531BA7 /* cocoa_globals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_globals.h; sourceTree = "<group>"; };
ABA48DF527F95C2E00D961FB /* colorspacehandler_NEON.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = colorspacehandler_NEON.h; sourceTree = "<group>"; }; ABA48DF527F95C2E00D961FB /* colorspacehandler_NEON.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = colorspacehandler_NEON.h; sourceTree = "<group>"; };
ABA48DF627F95C2E00D961FB /* colorspacehandler_NEON.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler_NEON.cpp; sourceTree = "<group>"; }; ABA48DF627F95C2E00D961FB /* colorspacehandler_NEON.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler_NEON.cpp; sourceTree = "<group>"; };
ABA5AB11282E63E20005F25D /* DeSmuME_x86_64.profdata */ = {isa = PBXFileReference; lastKnownFileType = file; path = DeSmuME_x86_64.profdata; sourceTree = "<group>"; };
ABA6574914511EC90077E5E9 /* cocoa_cheat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_cheat.h; sourceTree = "<group>"; }; ABA6574914511EC90077E5E9 /* cocoa_cheat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_cheat.h; sourceTree = "<group>"; };
ABA6574A14511EC90077E5E9 /* cocoa_cheat.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_cheat.mm; sourceTree = "<group>"; }; ABA6574A14511EC90077E5E9 /* cocoa_cheat.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_cheat.mm; sourceTree = "<group>"; };
ABA67CA52808B8D000B5208D /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; ABA67CA52808B8D000B5208D /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
@ -4250,7 +4212,6 @@
ABC570D4134431DA00E7B0B1 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; ABC570D4134431DA00E7B0B1 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
ABC719E1138CB25E002827A9 /* DefaultKeyMappings.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = DefaultKeyMappings.plist; sourceTree = "<group>"; }; ABC719E1138CB25E002827A9 /* DefaultKeyMappings.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = DefaultKeyMappings.plist; sourceTree = "<group>"; };
ABC8599028273FEE00A03EA9 /* DeSmuME (x86_64).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (x86_64).app"; sourceTree = BUILT_PRODUCTS_DIR; }; ABC8599028273FEE00A03EA9 /* DeSmuME (x86_64).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (x86_64).app"; sourceTree = BUILT_PRODUCTS_DIR; };
ABCC191C2831F3E100B795C4 /* DeSmuME_x86_64h.profdata */ = {isa = PBXFileReference; lastKnownFileType = file; path = DeSmuME_x86_64h.profdata; sourceTree = "<group>"; };
ABCC19332287879000DFA471 /* colorspacehandler_AVX512.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler_AVX512.cpp; sourceTree = "<group>"; }; ABCC19332287879000DFA471 /* colorspacehandler_AVX512.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler_AVX512.cpp; sourceTree = "<group>"; };
ABCC19342287879000DFA471 /* colorspacehandler_AVX512.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = colorspacehandler_AVX512.h; sourceTree = "<group>"; }; ABCC19342287879000DFA471 /* colorspacehandler_AVX512.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = colorspacehandler_AVX512.h; sourceTree = "<group>"; };
ABCFA9F2178BDE920030C8BA /* encrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = encrypt.h; sourceTree = "<group>"; }; ABCFA9F2178BDE920030C8BA /* encrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = encrypt.h; sourceTree = "<group>"; };
@ -4416,15 +4377,10 @@
ABD2CE4426E05CB000FB15F7 /* DeSmuME (x86_64h).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (x86_64h).app"; sourceTree = BUILT_PRODUCTS_DIR; }; ABD2CE4426E05CB000FB15F7 /* DeSmuME (x86_64h).app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DeSmuME (x86_64h).app"; sourceTree = BUILT_PRODUCTS_DIR; };
ABD42045172319D1006A9B46 /* FileMigrationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMigrationDelegate.h; sourceTree = "<group>"; }; ABD42045172319D1006A9B46 /* FileMigrationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileMigrationDelegate.h; sourceTree = "<group>"; };
ABD42046172319D1006A9B46 /* FileMigrationDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileMigrationDelegate.mm; sourceTree = "<group>"; }; ABD42046172319D1006A9B46 /* FileMigrationDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileMigrationDelegate.mm; sourceTree = "<group>"; };
ABD86C832D83E20500505422 /* GPU_Operations_NEON.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPU_Operations_NEON.h; sourceTree = "<group>"; };
ABD86C842D83E20500505422 /* GPU_Operations_NEON.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPU_Operations_NEON.cpp; sourceTree = "<group>"; };
ABDD89EF2C30BE97003482B7 /* OGLRender_ES3.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OGLRender_ES3.h; sourceTree = "<group>"; };
ABDD89F02C30BE97003482B7 /* OGLRender_ES3.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = OGLRender_ES3.cpp; sourceTree = "<group>"; };
ABDDF7C41898F024007583C1 /* Icon_DisplayToggle_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_DisplayToggle_420x420.png; path = images/Icon_DisplayToggle_420x420.png; sourceTree = "<group>"; }; ABDDF7C41898F024007583C1 /* Icon_DisplayToggle_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_DisplayToggle_420x420.png; path = images/Icon_DisplayToggle_420x420.png; sourceTree = "<group>"; };
ABDDF7C71898F032007583C1 /* Icon_FrameAdvance_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_FrameAdvance_420x420.png; path = images/Icon_FrameAdvance_420x420.png; sourceTree = "<group>"; }; ABDDF7C71898F032007583C1 /* Icon_FrameAdvance_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_FrameAdvance_420x420.png; path = images/Icon_FrameAdvance_420x420.png; sourceTree = "<group>"; };
ABDDF7C81898F032007583C1 /* Icon_FrameJump_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_FrameJump_420x420.png; path = images/Icon_FrameJump_420x420.png; sourceTree = "<group>"; }; ABDDF7C81898F032007583C1 /* Icon_FrameJump_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_FrameJump_420x420.png; path = images/Icon_FrameJump_420x420.png; sourceTree = "<group>"; };
ABDE648E2E21068500C03E0B /* GPU_Operations_AltiVec.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPU_Operations_AltiVec.h; sourceTree = "<group>"; }; ABE187E928274F0100B68164 /* DeSmuME_i386.profdata */ = {isa = PBXFileReference; lastKnownFileType = file; path = DeSmuME_i386.profdata; sourceTree = "<group>"; };
ABDE648F2E21068500C03E0B /* GPU_Operations_AltiVec.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPU_Operations_AltiVec.cpp; sourceTree = "<group>"; };
ABE5DFE3143FB1DA00835AD8 /* cocoa_videofilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_videofilter.h; sourceTree = "<group>"; }; ABE5DFE3143FB1DA00835AD8 /* cocoa_videofilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_videofilter.h; sourceTree = "<group>"; };
ABE5DFE4143FB1DA00835AD8 /* cocoa_videofilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_videofilter.mm; sourceTree = "<group>"; }; ABE5DFE4143FB1DA00835AD8 /* cocoa_videofilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_videofilter.mm; sourceTree = "<group>"; };
ABE670251415DE6C00E8E4C9 /* tinystr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinystr.cpp; sourceTree = "<group>"; }; ABE670251415DE6C00E8E4C9 /* tinystr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinystr.cpp; sourceTree = "<group>"; };
@ -4437,7 +4393,6 @@
ABE6840E189E33D5007FD69C /* OGLDisplayOutput.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OGLDisplayOutput.h; sourceTree = "<group>"; }; ABE6840E189E33D5007FD69C /* OGLDisplayOutput.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OGLDisplayOutput.h; sourceTree = "<group>"; };
ABE7F53C13EE1C7900FD3A71 /* cocoa_firmware.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_firmware.h; sourceTree = "<group>"; }; ABE7F53C13EE1C7900FD3A71 /* cocoa_firmware.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_firmware.h; sourceTree = "<group>"; };
ABE7F53D13EE1C7900FD3A71 /* cocoa_firmware.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_firmware.mm; sourceTree = "<group>"; }; ABE7F53D13EE1C7900FD3A71 /* cocoa_firmware.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_firmware.mm; sourceTree = "<group>"; };
ABECD444282DF23100AA6C0C /* DeSmuME_i386.profdata */ = {isa = PBXFileReference; lastKnownFileType = file; path = DeSmuME_i386.profdata; sourceTree = "<group>"; };
ABEFCF5D141AB82A000CC0CD /* AppIcon_ROMSave.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_ROMSave.icns; sourceTree = "<group>"; }; ABEFCF5D141AB82A000CC0CD /* AppIcon_ROMSave.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_ROMSave.icns; sourceTree = "<group>"; };
ABEFCF5E141AB82A000CC0CD /* AppIcon_DeSmuME.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_DeSmuME.icns; sourceTree = "<group>"; }; ABEFCF5E141AB82A000CC0CD /* AppIcon_DeSmuME.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_DeSmuME.icns; sourceTree = "<group>"; };
ABEFCF5F141AB82A000CC0CD /* AppIcon_NintendoDS_ROM.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_NintendoDS_ROM.icns; sourceTree = "<group>"; }; ABEFCF5F141AB82A000CC0CD /* AppIcon_NintendoDS_ROM.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_NintendoDS_ROM.icns; sourceTree = "<group>"; };
@ -4977,7 +4932,6 @@
ABC2ECD613B1C87000FAAA2A /* Images */, ABC2ECD613B1C87000FAAA2A /* Images */,
AB00E87C14205EBC00DE561F /* MainMenu.xib */, AB00E87C14205EBC00DE561F /* MainMenu.xib */,
AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */, AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */,
AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */,
AB350D3A147A1D93007165AC /* HID_usage_strings.plist */, AB350D3A147A1D93007165AC /* HID_usage_strings.plist */,
8D1107310486CEB800E47090 /* Info.plist */, 8D1107310486CEB800E47090 /* Info.plist */,
AB02791814415E4C0075E58C /* Info (Debug).plist */, AB02791814415E4C0075E58C /* Info (Debug).plist */,
@ -5270,7 +5224,6 @@
children = ( children = (
AB3ACB6614C2361100D7D192 /* appDelegate.h */, AB3ACB6614C2361100D7D192 /* appDelegate.h */,
AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */, AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */,
AB6E17F32A675BF1003A564D /* CheatDatabaseWindowController.h */,
AB3BF4361E25D6B4003E2B24 /* DisplayViewCALayer.h */, AB3BF4361E25D6B4003E2B24 /* DisplayViewCALayer.h */,
AB8967D716D2ED0700F826F1 /* DisplayWindowController.h */, AB8967D716D2ED0700F826F1 /* DisplayWindowController.h */,
AB3A655C16CC5416001F5D4A /* EmuControllerDelegate.h */, AB3A655C16CC5416001F5D4A /* EmuControllerDelegate.h */,
@ -5290,7 +5243,6 @@
AB3FBD7E2176DE95005722D0 /* WifiSettingsPanel.h */, AB3FBD7E2176DE95005722D0 /* WifiSettingsPanel.h */,
AB54718A1E27610500508C5C /* MacMetalDisplayViewShaders.metal */, AB54718A1E27610500508C5C /* MacMetalDisplayViewShaders.metal */,
AB3ACB6714C2361100D7D192 /* appDelegate.mm */, AB3ACB6714C2361100D7D192 /* appDelegate.mm */,
AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */,
AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */, AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */,
AB3BF4371E25D9AE003E2B24 /* DisplayViewCALayer.mm */, AB3BF4371E25D9AE003E2B24 /* DisplayViewCALayer.mm */,
AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */, AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */,
@ -5394,10 +5346,7 @@
AB407F381A620D6E00313213 /* OptimizationProfiles */ = { AB407F381A620D6E00313213 /* OptimizationProfiles */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
ABECD444282DF23100AA6C0C /* DeSmuME_i386.profdata */, ABE187E928274F0100B68164 /* DeSmuME_i386.profdata */,
ABA5AB11282E63E20005F25D /* DeSmuME_x86_64.profdata */,
ABCC191C2831F3E100B795C4 /* DeSmuME_x86_64h.profdata */,
AB7DA2432833EEBA001E9A9E /* DeSmuME_arm64.profdata */,
); );
path = OptimizationProfiles; path = OptimizationProfiles;
sourceTree = "<group>"; sourceTree = "<group>";
@ -5689,8 +5638,6 @@
AB1D4BB126E6F8D700A9AE42 /* GPU_Operations.cpp */, AB1D4BB126E6F8D700A9AE42 /* GPU_Operations.cpp */,
AB1D4BB426E6F8D700A9AE42 /* GPU_Operations_SSE2.cpp */, AB1D4BB426E6F8D700A9AE42 /* GPU_Operations_SSE2.cpp */,
AB1D4BAF26E6F8D700A9AE42 /* GPU_Operations_AVX2.cpp */, AB1D4BAF26E6F8D700A9AE42 /* GPU_Operations_AVX2.cpp */,
ABD86C842D83E20500505422 /* GPU_Operations_NEON.cpp */,
ABDE648F2E21068500C03E0B /* GPU_Operations_AltiVec.cpp */,
ABD1FEB81345AC8400AF11D1 /* lua-engine.cpp */, ABD1FEB81345AC8400AF11D1 /* lua-engine.cpp */,
ABD1FEB91345AC8400AF11D1 /* matrix.cpp */, ABD1FEB91345AC8400AF11D1 /* matrix.cpp */,
ABD1FEBA1345AC8400AF11D1 /* mc.cpp */, ABD1FEBA1345AC8400AF11D1 /* mc.cpp */,
@ -5700,7 +5647,6 @@
ABD1FEC01345AC8400AF11D1 /* NDSSystem.cpp */, ABD1FEC01345AC8400AF11D1 /* NDSSystem.cpp */,
ABD1FEC11345AC8400AF11D1 /* OGLRender.cpp */, ABD1FEC11345AC8400AF11D1 /* OGLRender.cpp */,
AB68A0DA16B139BC00DE0546 /* OGLRender_3_2.cpp */, AB68A0DA16B139BC00DE0546 /* OGLRender_3_2.cpp */,
ABDD89F02C30BE97003482B7 /* OGLRender_ES3.cpp */,
ABD1FEC21345AC8400AF11D1 /* path.cpp */, ABD1FEC21345AC8400AF11D1 /* path.cpp */,
ABD1FEC31345AC8400AF11D1 /* rasterize.cpp */, ABD1FEC31345AC8400AF11D1 /* rasterize.cpp */,
ABD1FEC41345AC8400AF11D1 /* readwrite.cpp */, ABD1FEC41345AC8400AF11D1 /* readwrite.cpp */,
@ -5735,8 +5681,6 @@
AB1D4BB326E6F8D700A9AE42 /* GPU_Operations.h */, AB1D4BB326E6F8D700A9AE42 /* GPU_Operations.h */,
AB1D4BB226E6F8D700A9AE42 /* GPU_Operations_SSE2.h */, AB1D4BB226E6F8D700A9AE42 /* GPU_Operations_SSE2.h */,
AB1D4BB026E6F8D700A9AE42 /* GPU_Operations_AVX2.h */, AB1D4BB026E6F8D700A9AE42 /* GPU_Operations_AVX2.h */,
ABD86C832D83E20500505422 /* GPU_Operations_NEON.h */,
ABDE648E2E21068500C03E0B /* GPU_Operations_AltiVec.h */,
AB796CA215CDCB6B00C59155 /* instruction_attributes.h */, AB796CA215CDCB6B00C59155 /* instruction_attributes.h */,
AB796CA315CDCB6B00C59155 /* instructions.h */, AB796CA315CDCB6B00C59155 /* instructions.h */,
ABD1FE841345AC8400AF11D1 /* lua-engine.h */, ABD1FE841345AC8400AF11D1 /* lua-engine.h */,
@ -5750,7 +5694,6 @@
ABD1FE8C1345AC8400AF11D1 /* NDSSystem.h */, ABD1FE8C1345AC8400AF11D1 /* NDSSystem.h */,
ABD1FE8D1345AC8400AF11D1 /* OGLRender.h */, ABD1FE8D1345AC8400AF11D1 /* OGLRender.h */,
ABBB421516B4A5F30012E5AB /* OGLRender_3_2.h */, ABBB421516B4A5F30012E5AB /* OGLRender_3_2.h */,
ABDD89EF2C30BE97003482B7 /* OGLRender_ES3.h */,
ABD1FE8F1345AC8400AF11D1 /* PACKED.h */, ABD1FE8F1345AC8400AF11D1 /* PACKED.h */,
ABD1FE8E1345AC8400AF11D1 /* PACKED_END.h */, ABD1FE8E1345AC8400AF11D1 /* PACKED_END.h */,
ABD1FE901345AC8400AF11D1 /* path.h */, ABD1FE901345AC8400AF11D1 /* path.h */,
@ -5789,7 +5732,6 @@
ABD1FF031345AC9B00AF11D1 /* slot2_expMemory.cpp */, ABD1FF031345AC9B00AF11D1 /* slot2_expMemory.cpp */,
ABD1FF041345AC9B00AF11D1 /* slot2_gbagame.cpp */, ABD1FF041345AC9B00AF11D1 /* slot2_gbagame.cpp */,
ABD1FF051345AC9B00AF11D1 /* slot2_guitarGrip.cpp */, ABD1FF051345AC9B00AF11D1 /* slot2_guitarGrip.cpp */,
AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */,
ABD1FF061345AC9B00AF11D1 /* slot2_mpcf.cpp */, ABD1FF061345AC9B00AF11D1 /* slot2_mpcf.cpp */,
ABD1FF071345AC9C00AF11D1 /* slot2_none.cpp */, ABD1FF071345AC9C00AF11D1 /* slot2_none.cpp */,
ABD1FF081345AC9C00AF11D1 /* slot2_paddle.cpp */, ABD1FF081345AC9C00AF11D1 /* slot2_paddle.cpp */,
@ -6503,7 +6445,6 @@
8C43E79727E3CD0100A35F65 /* Icon_Input_420x420.png in Resources */, 8C43E79727E3CD0100A35F65 /* Icon_Input_420x420.png in Resources */,
8C43E79827E3CD0100A35F65 /* Icon_AutoholdSet_420x420.png in Resources */, 8C43E79827E3CD0100A35F65 /* Icon_AutoholdSet_420x420.png in Resources */,
8C43E79927E3CD0100A35F65 /* Icon_MicrophoneBlack_256x256.png in Resources */, 8C43E79927E3CD0100A35F65 /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E18032A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
8C43E79A27E3CD0100A35F65 /* Icon_OpenROM_420x420.png in Resources */, 8C43E79A27E3CD0100A35F65 /* Icon_OpenROM_420x420.png in Resources */,
8C43E79B27E3CD0100A35F65 /* Icon_Reset_420x420.png in Resources */, 8C43E79B27E3CD0100A35F65 /* Icon_Reset_420x420.png in Resources */,
8C43E79C27E3CD0100A35F65 /* Icon_RotateCCW_420x420.png in Resources */, 8C43E79C27E3CD0100A35F65 /* Icon_RotateCCW_420x420.png in Resources */,
@ -6623,7 +6564,6 @@
8C43E8F527E3CD4C00A35F65 /* Icon_Input_420x420.png in Resources */, 8C43E8F527E3CD4C00A35F65 /* Icon_Input_420x420.png in Resources */,
8C43E8F627E3CD4C00A35F65 /* Icon_AutoholdSet_420x420.png in Resources */, 8C43E8F627E3CD4C00A35F65 /* Icon_AutoholdSet_420x420.png in Resources */,
8C43E8F727E3CD4C00A35F65 /* Icon_MicrophoneBlack_256x256.png in Resources */, 8C43E8F727E3CD4C00A35F65 /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E18042A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
8C43E8F827E3CD4C00A35F65 /* Icon_OpenROM_420x420.png in Resources */, 8C43E8F827E3CD4C00A35F65 /* Icon_OpenROM_420x420.png in Resources */,
8C43E8F927E3CD4C00A35F65 /* Icon_Reset_420x420.png in Resources */, 8C43E8F927E3CD4C00A35F65 /* Icon_Reset_420x420.png in Resources */,
8C43E8FA27E3CD4C00A35F65 /* Icon_RotateCCW_420x420.png in Resources */, 8C43E8FA27E3CD4C00A35F65 /* Icon_RotateCCW_420x420.png in Resources */,
@ -6743,7 +6683,6 @@
8CCD840827E40B730024BDD5 /* Icon_Input_420x420.png in Resources */, 8CCD840827E40B730024BDD5 /* Icon_Input_420x420.png in Resources */,
8CCD840927E40B730024BDD5 /* Icon_AutoholdSet_420x420.png in Resources */, 8CCD840927E40B730024BDD5 /* Icon_AutoholdSet_420x420.png in Resources */,
8CCD840A27E40B730024BDD5 /* Icon_MicrophoneBlack_256x256.png in Resources */, 8CCD840A27E40B730024BDD5 /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E180B2A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
8CCD840B27E40B730024BDD5 /* Icon_OpenROM_420x420.png in Resources */, 8CCD840B27E40B730024BDD5 /* Icon_OpenROM_420x420.png in Resources */,
8CCD840C27E40B730024BDD5 /* Icon_Reset_420x420.png in Resources */, 8CCD840C27E40B730024BDD5 /* Icon_Reset_420x420.png in Resources */,
8CCD840D27E40B730024BDD5 /* Icon_RotateCCW_420x420.png in Resources */, 8CCD840D27E40B730024BDD5 /* Icon_RotateCCW_420x420.png in Resources */,
@ -6863,7 +6802,6 @@
AB36C78827F2C8AE00C763C8 /* Icon_Input_420x420.png in Resources */, AB36C78827F2C8AE00C763C8 /* Icon_Input_420x420.png in Resources */,
AB36C78927F2C8AE00C763C8 /* Icon_AutoholdSet_420x420.png in Resources */, AB36C78927F2C8AE00C763C8 /* Icon_AutoholdSet_420x420.png in Resources */,
AB36C78A27F2C8AE00C763C8 /* Icon_MicrophoneBlack_256x256.png in Resources */, AB36C78A27F2C8AE00C763C8 /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E18082A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
AB36C78B27F2C8AE00C763C8 /* Icon_OpenROM_420x420.png in Resources */, AB36C78B27F2C8AE00C763C8 /* Icon_OpenROM_420x420.png in Resources */,
AB36C78C27F2C8AE00C763C8 /* Icon_Reset_420x420.png in Resources */, AB36C78C27F2C8AE00C763C8 /* Icon_Reset_420x420.png in Resources */,
AB36C78D27F2C8AE00C763C8 /* Icon_RotateCCW_420x420.png in Resources */, AB36C78D27F2C8AE00C763C8 /* Icon_RotateCCW_420x420.png in Resources */,
@ -6983,7 +6921,6 @@
AB497A0E27F2E97A00E8A244 /* Icon_Input_420x420.png in Resources */, AB497A0E27F2E97A00E8A244 /* Icon_Input_420x420.png in Resources */,
AB497A0F27F2E97A00E8A244 /* Icon_AutoholdSet_420x420.png in Resources */, AB497A0F27F2E97A00E8A244 /* Icon_AutoholdSet_420x420.png in Resources */,
AB497A1027F2E97A00E8A244 /* Icon_MicrophoneBlack_256x256.png in Resources */, AB497A1027F2E97A00E8A244 /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E18072A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
AB497A1127F2E97A00E8A244 /* Icon_OpenROM_420x420.png in Resources */, AB497A1127F2E97A00E8A244 /* Icon_OpenROM_420x420.png in Resources */,
AB497A1227F2E97A00E8A244 /* Icon_Reset_420x420.png in Resources */, AB497A1227F2E97A00E8A244 /* Icon_Reset_420x420.png in Resources */,
AB497A1327F2E97A00E8A244 /* Icon_RotateCCW_420x420.png in Resources */, AB497A1327F2E97A00E8A244 /* Icon_RotateCCW_420x420.png in Resources */,
@ -7103,7 +7040,6 @@
AB790193215B84F20082AE82 /* Icon_Input_420x420.png in Resources */, AB790193215B84F20082AE82 /* Icon_Input_420x420.png in Resources */,
AB790194215B84F20082AE82 /* Icon_AutoholdSet_420x420.png in Resources */, AB790194215B84F20082AE82 /* Icon_AutoholdSet_420x420.png in Resources */,
AB790195215B84F20082AE82 /* Icon_MicrophoneBlack_256x256.png in Resources */, AB790195215B84F20082AE82 /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E18062A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
AB790196215B84F20082AE82 /* Icon_OpenROM_420x420.png in Resources */, AB790196215B84F20082AE82 /* Icon_OpenROM_420x420.png in Resources */,
AB790197215B84F20082AE82 /* Icon_Reset_420x420.png in Resources */, AB790197215B84F20082AE82 /* Icon_Reset_420x420.png in Resources */,
AB790198215B84F20082AE82 /* Icon_RotateCCW_420x420.png in Resources */, AB790198215B84F20082AE82 /* Icon_RotateCCW_420x420.png in Resources */,
@ -7223,7 +7159,6 @@
AB796CE015CDCBA200C59155 /* Icon_Input_420x420.png in Resources */, AB796CE015CDCBA200C59155 /* Icon_Input_420x420.png in Resources */,
AB7EC7F6189B2B92009D198A /* Icon_AutoholdSet_420x420.png in Resources */, AB7EC7F6189B2B92009D198A /* Icon_AutoholdSet_420x420.png in Resources */,
ABB0FBCC1A9EED350060C55A /* Icon_MicrophoneBlack_256x256.png in Resources */, ABB0FBCC1A9EED350060C55A /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E18012A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
AB796CE215CDCBA200C59155 /* Icon_OpenROM_420x420.png in Resources */, AB796CE215CDCBA200C59155 /* Icon_OpenROM_420x420.png in Resources */,
AB796CE315CDCBA200C59155 /* Icon_Reset_420x420.png in Resources */, AB796CE315CDCBA200C59155 /* Icon_Reset_420x420.png in Resources */,
AB796CE415CDCBA200C59155 /* Icon_RotateCCW_420x420.png in Resources */, AB796CE415CDCBA200C59155 /* Icon_RotateCCW_420x420.png in Resources */,
@ -7343,7 +7278,6 @@
AB790036215B84E50082AE82 /* Icon_Input_420x420.png in Resources */, AB790036215B84E50082AE82 /* Icon_Input_420x420.png in Resources */,
AB790037215B84E50082AE82 /* Icon_AutoholdSet_420x420.png in Resources */, AB790037215B84E50082AE82 /* Icon_AutoholdSet_420x420.png in Resources */,
AB790038215B84E50082AE82 /* Icon_MicrophoneBlack_256x256.png in Resources */, AB790038215B84E50082AE82 /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E18052A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
AB790039215B84E50082AE82 /* Icon_OpenROM_420x420.png in Resources */, AB790039215B84E50082AE82 /* Icon_OpenROM_420x420.png in Resources */,
AB79003A215B84E50082AE82 /* Icon_Reset_420x420.png in Resources */, AB79003A215B84E50082AE82 /* Icon_Reset_420x420.png in Resources */,
AB79003B215B84E50082AE82 /* Icon_RotateCCW_420x420.png in Resources */, AB79003B215B84E50082AE82 /* Icon_RotateCCW_420x420.png in Resources */,
@ -7463,7 +7397,6 @@
AB8F3C5F1A53AC2600A80BF6 /* Icon_Input_420x420.png in Resources */, AB8F3C5F1A53AC2600A80BF6 /* Icon_Input_420x420.png in Resources */,
AB8F3C601A53AC2600A80BF6 /* Icon_AutoholdSet_420x420.png in Resources */, AB8F3C601A53AC2600A80BF6 /* Icon_AutoholdSet_420x420.png in Resources */,
ABB0FBCE1A9EED350060C55A /* Icon_MicrophoneBlack_256x256.png in Resources */, ABB0FBCE1A9EED350060C55A /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E18022A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
AB8F3C621A53AC2600A80BF6 /* Icon_OpenROM_420x420.png in Resources */, AB8F3C621A53AC2600A80BF6 /* Icon_OpenROM_420x420.png in Resources */,
AB8F3C631A53AC2600A80BF6 /* Icon_Reset_420x420.png in Resources */, AB8F3C631A53AC2600A80BF6 /* Icon_Reset_420x420.png in Resources */,
AB8F3C641A53AC2600A80BF6 /* Icon_RotateCCW_420x420.png in Resources */, AB8F3C641A53AC2600A80BF6 /* Icon_RotateCCW_420x420.png in Resources */,
@ -7593,7 +7526,6 @@
ABC8588628273FEE00A03EA9 /* Icon_Input_420x420.png in Resources */, ABC8588628273FEE00A03EA9 /* Icon_Input_420x420.png in Resources */,
ABC8588728273FEE00A03EA9 /* Icon_AutoholdSet_420x420.png in Resources */, ABC8588728273FEE00A03EA9 /* Icon_AutoholdSet_420x420.png in Resources */,
ABC8588828273FEE00A03EA9 /* Icon_MicrophoneBlack_256x256.png in Resources */, ABC8588828273FEE00A03EA9 /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E18092A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
ABC8588928273FEE00A03EA9 /* Icon_OpenROM_420x420.png in Resources */, ABC8588928273FEE00A03EA9 /* Icon_OpenROM_420x420.png in Resources */,
ABC8588A28273FEE00A03EA9 /* Icon_Reset_420x420.png in Resources */, ABC8588A28273FEE00A03EA9 /* Icon_Reset_420x420.png in Resources */,
ABC8588B28273FEE00A03EA9 /* Icon_RotateCCW_420x420.png in Resources */, ABC8588B28273FEE00A03EA9 /* Icon_RotateCCW_420x420.png in Resources */,
@ -7713,7 +7645,6 @@
ABD2CD3C26E05CB000FB15F7 /* Icon_Input_420x420.png in Resources */, ABD2CD3C26E05CB000FB15F7 /* Icon_Input_420x420.png in Resources */,
ABD2CD3D26E05CB000FB15F7 /* Icon_AutoholdSet_420x420.png in Resources */, ABD2CD3D26E05CB000FB15F7 /* Icon_AutoholdSet_420x420.png in Resources */,
ABD2CD3E26E05CB000FB15F7 /* Icon_MicrophoneBlack_256x256.png in Resources */, ABD2CD3E26E05CB000FB15F7 /* Icon_MicrophoneBlack_256x256.png in Resources */,
AB6E180A2A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
ABD2CD3F26E05CB000FB15F7 /* Icon_OpenROM_420x420.png in Resources */, ABD2CD3F26E05CB000FB15F7 /* Icon_OpenROM_420x420.png in Resources */,
ABD2CD4026E05CB000FB15F7 /* Icon_Reset_420x420.png in Resources */, ABD2CD4026E05CB000FB15F7 /* Icon_Reset_420x420.png in Resources */,
ABD2CD4126E05CB000FB15F7 /* Icon_RotateCCW_420x420.png in Resources */, ABD2CD4126E05CB000FB15F7 /* Icon_RotateCCW_420x420.png in Resources */,
@ -7741,7 +7672,6 @@
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
8C43E7AC27E3CD0100A35F65 /* ShellScript */ = { 8C43E7AC27E3CD0100A35F65 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7756,7 +7686,6 @@
}; };
8C43E90A27E3CD4C00A35F65 /* ShellScript */ = { 8C43E90A27E3CD4C00A35F65 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7771,7 +7700,6 @@
}; };
8C74E9BE27F39EDE00BF29F4 /* ShellScript */ = { 8C74E9BE27F39EDE00BF29F4 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7786,7 +7714,6 @@
}; };
8C74E9BF27F39F2C00BF29F4 /* ShellScript */ = { 8C74E9BF27F39F2C00BF29F4 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7801,7 +7728,6 @@
}; };
8C74E9C027F39F5300BF29F4 /* ShellScript */ = { 8C74E9C027F39F5300BF29F4 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7816,7 +7742,6 @@
}; };
AB2DF23215E0834E00B4D0BC /* ShellScript */ = { AB2DF23215E0834E00B4D0BC /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7831,7 +7756,6 @@
}; };
AB2DF23515E0839D00B4D0BC /* ShellScript */ = { AB2DF23515E0839D00B4D0BC /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7846,7 +7770,6 @@
}; };
AB497A2327F2E97A00E8A244 /* ShellScript */ = { AB497A2327F2E97A00E8A244 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7861,7 +7784,6 @@
}; };
AB79004B215B84E50082AE82 /* ShellScript */ = { AB79004B215B84E50082AE82 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7876,7 +7798,6 @@
}; };
AB7901A8215B84F20082AE82 /* ShellScript */ = { AB7901A8215B84F20082AE82 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7891,7 +7812,6 @@
}; };
AB8F3C721A53AC2600A80BF6 /* ShellScript */ = { AB8F3C721A53AC2600A80BF6 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7906,7 +7826,6 @@
}; };
ABC8589C28273FEE00A03EA9 /* ShellScript */ = { ABC8589C28273FEE00A03EA9 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
); );
@ -7995,7 +7914,6 @@
8C43E7F027E3CD0100A35F65 /* ClientExecutionControl.cpp in Sources */, 8C43E7F027E3CD0100A35F65 /* ClientExecutionControl.cpp in Sources */,
8C43E7F127E3CD0100A35F65 /* rsemaphore.c in Sources */, 8C43E7F127E3CD0100A35F65 /* rsemaphore.c in Sources */,
8C43E7F227E3CD0100A35F65 /* movie.cpp in Sources */, 8C43E7F227E3CD0100A35F65 /* movie.cpp in Sources */,
AB6E17F72A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
8C43E7F327E3CD0100A35F65 /* slot1comp_rom.cpp in Sources */, 8C43E7F327E3CD0100A35F65 /* slot1comp_rom.cpp in Sources */,
8C43E7F427E3CD0100A35F65 /* NDSSystem.cpp in Sources */, 8C43E7F427E3CD0100A35F65 /* NDSSystem.cpp in Sources */,
8C43E7F527E3CD0100A35F65 /* MacBaseCaptureTool.mm in Sources */, 8C43E7F527E3CD0100A35F65 /* MacBaseCaptureTool.mm in Sources */,
@ -8101,7 +8019,6 @@
8C43E86627E3CD0100A35F65 /* ftfstype.c in Sources */, 8C43E86627E3CD0100A35F65 /* ftfstype.c in Sources */,
8C43E86B27E3CD0100A35F65 /* macosx_10_5_compat.cpp in Sources */, 8C43E86B27E3CD0100A35F65 /* macosx_10_5_compat.cpp in Sources */,
8C43E86C27E3CD0100A35F65 /* retro_dirent.c in Sources */, 8C43E86C27E3CD0100A35F65 /* retro_dirent.c in Sources */,
AB8800562AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
8C43E87427E3CD0100A35F65 /* slot2_passme.cpp in Sources */, 8C43E87427E3CD0100A35F65 /* slot2_passme.cpp in Sources */,
8C43E87727E3CD0100A35F65 /* psnames.c in Sources */, 8C43E87727E3CD0100A35F65 /* psnames.c in Sources */,
8C43E87827E3CD0100A35F65 /* ftotval.c in Sources */, 8C43E87827E3CD0100A35F65 /* ftotval.c in Sources */,
@ -8166,7 +8083,6 @@
8C43E92F27E3CD4C00A35F65 /* common.cpp in Sources */, 8C43E92F27E3CD4C00A35F65 /* common.cpp in Sources */,
8C43E93027E3CD4C00A35F65 /* cp15.cpp in Sources */, 8C43E93027E3CD4C00A35F65 /* cp15.cpp in Sources */,
8C43E93127E3CD4C00A35F65 /* psaux.c in Sources */, 8C43E93127E3CD4C00A35F65 /* psaux.c in Sources */,
AB8800572AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
8C43E93227E3CD4C00A35F65 /* cpu_detect_x86_gcc.cpp in Sources */, 8C43E93227E3CD4C00A35F65 /* cpu_detect_x86_gcc.cpp in Sources */,
8C43E93327E3CD4C00A35F65 /* crc.cpp in Sources */, 8C43E93327E3CD4C00A35F65 /* crc.cpp in Sources */,
8C43E93427E3CD4C00A35F65 /* MacOGLDisplayView.mm in Sources */, 8C43E93427E3CD4C00A35F65 /* MacOGLDisplayView.mm in Sources */,
@ -8240,7 +8156,6 @@
8C43E97827E3CD4C00A35F65 /* slot2_rumblepak.cpp in Sources */, 8C43E97827E3CD4C00A35F65 /* slot2_rumblepak.cpp in Sources */,
8C43E97927E3CD4C00A35F65 /* sndOSX.cpp in Sources */, 8C43E97927E3CD4C00A35F65 /* sndOSX.cpp in Sources */,
8C43E97A27E3CD4C00A35F65 /* SndOut.cpp in Sources */, 8C43E97A27E3CD4C00A35F65 /* SndOut.cpp in Sources */,
AB6E17F82A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
8C43E97B27E3CD4C00A35F65 /* psnames.c in Sources */, 8C43E97B27E3CD4C00A35F65 /* psnames.c in Sources */,
8C43E97C27E3CD4C00A35F65 /* Slot2WindowDelegate.mm in Sources */, 8C43E97C27E3CD4C00A35F65 /* Slot2WindowDelegate.mm in Sources */,
8C43E97D27E3CD4C00A35F65 /* truetype.c in Sources */, 8C43E97D27E3CD4C00A35F65 /* truetype.c in Sources */,
@ -8398,7 +8313,6 @@
8CCD846127E40B730024BDD5 /* ClientExecutionControl.cpp in Sources */, 8CCD846127E40B730024BDD5 /* ClientExecutionControl.cpp in Sources */,
8CCD846227E40B730024BDD5 /* slot1.cpp in Sources */, 8CCD846227E40B730024BDD5 /* slot1.cpp in Sources */,
8CCD846327E40B730024BDD5 /* slot1_none.cpp in Sources */, 8CCD846327E40B730024BDD5 /* slot1_none.cpp in Sources */,
AB6E17FE2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
8CCD846427E40B730024BDD5 /* slot1_r4.cpp in Sources */, 8CCD846427E40B730024BDD5 /* slot1_r4.cpp in Sources */,
8CCD846527E40B730024BDD5 /* cff.c in Sources */, 8CCD846527E40B730024BDD5 /* cff.c in Sources */,
8CCD846627E40B730024BDD5 /* MacBaseCaptureTool.mm in Sources */, 8CCD846627E40B730024BDD5 /* MacBaseCaptureTool.mm in Sources */,
@ -8504,7 +8418,6 @@
8CCD84DF27E40B730024BDD5 /* type1cid.c in Sources */, 8CCD84DF27E40B730024BDD5 /* type1cid.c in Sources */,
8CCD84E427E40B730024BDD5 /* cocoa_slot2.mm in Sources */, 8CCD84E427E40B730024BDD5 /* cocoa_slot2.mm in Sources */,
8CCD84E627E40B730024BDD5 /* ftbase.c in Sources */, 8CCD84E627E40B730024BDD5 /* ftbase.c in Sources */,
AB88005D2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
8CCD84EA27E40B730024BDD5 /* fsnitro.cpp in Sources */, 8CCD84EA27E40B730024BDD5 /* fsnitro.cpp in Sources */,
8CCD84EB27E40B730024BDD5 /* macosx_10_5_compat.cpp in Sources */, 8CCD84EB27E40B730024BDD5 /* macosx_10_5_compat.cpp in Sources */,
8CCD84EC27E40B730024BDD5 /* OGLRender_3_2.cpp in Sources */, 8CCD84EC27E40B730024BDD5 /* OGLRender_3_2.cpp in Sources */,
@ -8549,7 +8462,6 @@
AB36C7AF27F2C8AE00C763C8 /* decrypt.cpp in Sources */, AB36C7AF27F2C8AE00C763C8 /* decrypt.cpp in Sources */,
AB36C7B027F2C8AE00C763C8 /* directory.cpp in Sources */, AB36C7B027F2C8AE00C763C8 /* directory.cpp in Sources */,
AB36C7B127F2C8AE00C763C8 /* Disassembler.cpp in Sources */, AB36C7B127F2C8AE00C763C8 /* Disassembler.cpp in Sources */,
AB88005A2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
AB36C7B227F2C8AE00C763C8 /* disc.cpp in Sources */, AB36C7B227F2C8AE00C763C8 /* disc.cpp in Sources */,
AB36C7B327F2C8AE00C763C8 /* dlditool.cpp in Sources */, AB36C7B327F2C8AE00C763C8 /* dlditool.cpp in Sources */,
AB36C7B427F2C8AE00C763C8 /* driver.cpp in Sources */, AB36C7B427F2C8AE00C763C8 /* driver.cpp in Sources */,
@ -8735,7 +8647,6 @@
AB36C86B27F2C8AE00C763C8 /* macosx_10_5_compat.cpp in Sources */, AB36C86B27F2C8AE00C763C8 /* macosx_10_5_compat.cpp in Sources */,
AB36C86C27F2C8AE00C763C8 /* OGLRender_3_2.cpp in Sources */, AB36C86C27F2C8AE00C763C8 /* OGLRender_3_2.cpp in Sources */,
AB36C86D27F2C8AE00C763C8 /* ftfntfmt.c in Sources */, AB36C86D27F2C8AE00C763C8 /* ftfntfmt.c in Sources */,
AB6E17FB2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
AB36C86E27F2C8AE00C763C8 /* EmuControllerDelegate.mm in Sources */, AB36C86E27F2C8AE00C763C8 /* EmuControllerDelegate.mm in Sources */,
AB36C86F27F2C8AE00C763C8 /* ClientAVCaptureObject.cpp in Sources */, AB36C86F27F2C8AE00C763C8 /* ClientAVCaptureObject.cpp in Sources */,
AB36C87027F2C8AE00C763C8 /* cocoa_GPU.mm in Sources */, AB36C87027F2C8AE00C763C8 /* cocoa_GPU.mm in Sources */,
@ -8793,7 +8704,6 @@
AB79006E215B84E50082AE82 /* emufile.cpp in Sources */, AB79006E215B84E50082AE82 /* emufile.cpp in Sources */,
AB79006F215B84E50082AE82 /* fatdir.cpp in Sources */, AB79006F215B84E50082AE82 /* fatdir.cpp in Sources */,
AB790070215B84E50082AE82 /* ftbase.c in Sources */, AB790070215B84E50082AE82 /* ftbase.c in Sources */,
AB6E17F92A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
AB790071215B84E50082AE82 /* fatfile.cpp in Sources */, AB790071215B84E50082AE82 /* fatfile.cpp in Sources */,
AB790072215B84E50082AE82 /* FIFO.cpp in Sources */, AB790072215B84E50082AE82 /* FIFO.cpp in Sources */,
AB790073215B84E50082AE82 /* sfnt.c in Sources */, AB790073215B84E50082AE82 /* sfnt.c in Sources */,
@ -8925,7 +8835,6 @@
AB7900EF215B84E50082AE82 /* coreaudiosound.cpp in Sources */, AB7900EF215B84E50082AE82 /* coreaudiosound.cpp in Sources */,
AB7900F0215B84E50082AE82 /* ringbuffer.cpp in Sources */, AB7900F0215B84E50082AE82 /* ringbuffer.cpp in Sources */,
AB7900F1215B84E50082AE82 /* arm_jit.cpp in Sources */, AB7900F1215B84E50082AE82 /* arm_jit.cpp in Sources */,
AB8800582AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
AB7900F2215B84E50082AE82 /* smooth.c in Sources */, AB7900F2215B84E50082AE82 /* smooth.c in Sources */,
AB7900F3215B84E50082AE82 /* troubleshootingWindowDelegate.mm in Sources */, AB7900F3215B84E50082AE82 /* troubleshootingWindowDelegate.mm in Sources */,
AB7900F4215B84E50082AE82 /* macOS_driver.cpp in Sources */, AB7900F4215B84E50082AE82 /* macOS_driver.cpp in Sources */,
@ -9042,7 +8951,6 @@
AB7901DD215B84F20082AE82 /* driver.cpp in Sources */, AB7901DD215B84F20082AE82 /* driver.cpp in Sources */,
AB7901DE215B84F20082AE82 /* emufat.cpp in Sources */, AB7901DE215B84F20082AE82 /* emufat.cpp in Sources */,
AB7901DF215B84F20082AE82 /* type1cid.c in Sources */, AB7901DF215B84F20082AE82 /* type1cid.c in Sources */,
AB8800592AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
AB7901E0215B84F20082AE82 /* emufile.cpp in Sources */, AB7901E0215B84F20082AE82 /* emufile.cpp in Sources */,
AB7901E1215B84F20082AE82 /* fatdir.cpp in Sources */, AB7901E1215B84F20082AE82 /* fatdir.cpp in Sources */,
AB7901E2215B84F20082AE82 /* fatfile.cpp in Sources */, AB7901E2215B84F20082AE82 /* fatfile.cpp in Sources */,
@ -9096,7 +9004,6 @@
AB790211215B84F20082AE82 /* type1.c in Sources */, AB790211215B84F20082AE82 /* type1.c in Sources */,
AB790212215B84F20082AE82 /* slot2_paddle.cpp in Sources */, AB790212215B84F20082AE82 /* slot2_paddle.cpp in Sources */,
AB790213215B84F20082AE82 /* slot2_piano.cpp in Sources */, AB790213215B84F20082AE82 /* slot2_piano.cpp in Sources */,
AB6E17FA2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
AB790214215B84F20082AE82 /* slot2_rumblepak.cpp in Sources */, AB790214215B84F20082AE82 /* slot2_rumblepak.cpp in Sources */,
AB790215215B84F20082AE82 /* sndOSX.cpp in Sources */, AB790215215B84F20082AE82 /* sndOSX.cpp in Sources */,
AB790216215B84F20082AE82 /* SndOut.cpp in Sources */, AB790216215B84F20082AE82 /* SndOut.cpp in Sources */,
@ -9254,7 +9161,6 @@
AB796D0415CDCBA200C59155 /* emufile.cpp in Sources */, AB796D0415CDCBA200C59155 /* emufile.cpp in Sources */,
AB796D0515CDCBA200C59155 /* fatdir.cpp in Sources */, AB796D0515CDCBA200C59155 /* fatdir.cpp in Sources */,
ABFEA8011BB4EC1000B08C25 /* ftbase.c in Sources */, ABFEA8011BB4EC1000B08C25 /* ftbase.c in Sources */,
AB6E17F52A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
AB796D0615CDCBA200C59155 /* fatfile.cpp in Sources */, AB796D0615CDCBA200C59155 /* fatfile.cpp in Sources */,
AB796D0715CDCBA200C59155 /* FIFO.cpp in Sources */, AB796D0715CDCBA200C59155 /* FIFO.cpp in Sources */,
ABFEA8A31BB4EC1100B08C25 /* sfnt.c in Sources */, ABFEA8A31BB4EC1100B08C25 /* sfnt.c in Sources */,
@ -9386,7 +9292,6 @@
AB796D6215CDCBA200C59155 /* coreaudiosound.cpp in Sources */, AB796D6215CDCBA200C59155 /* coreaudiosound.cpp in Sources */,
AB796D6315CDCBA200C59155 /* ringbuffer.cpp in Sources */, AB796D6315CDCBA200C59155 /* ringbuffer.cpp in Sources */,
AB796D6415CDCBA200C59155 /* arm_jit.cpp in Sources */, AB796D6415CDCBA200C59155 /* arm_jit.cpp in Sources */,
AB8800542AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
ABFEA8CA1BB4EC1100B08C25 /* smooth.c in Sources */, ABFEA8CA1BB4EC1100B08C25 /* smooth.c in Sources */,
ABF2B9FB16904133000FF7C0 /* troubleshootingWindowDelegate.mm in Sources */, ABF2B9FB16904133000FF7C0 /* troubleshootingWindowDelegate.mm in Sources */,
AB28625920AE3E9F00EAED43 /* macOS_driver.cpp in Sources */, AB28625920AE3E9F00EAED43 /* macOS_driver.cpp in Sources */,
@ -9503,7 +9408,6 @@
AB8F3C871A53AC2600A80BF6 /* driver.cpp in Sources */, AB8F3C871A53AC2600A80BF6 /* driver.cpp in Sources */,
AB8F3C881A53AC2600A80BF6 /* emufat.cpp in Sources */, AB8F3C881A53AC2600A80BF6 /* emufat.cpp in Sources */,
ABA7316A1BB51FDC00B26147 /* type1cid.c in Sources */, ABA7316A1BB51FDC00B26147 /* type1cid.c in Sources */,
AB8800552AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
AB8F3C891A53AC2600A80BF6 /* emufile.cpp in Sources */, AB8F3C891A53AC2600A80BF6 /* emufile.cpp in Sources */,
AB8F3C8A1A53AC2600A80BF6 /* fatdir.cpp in Sources */, AB8F3C8A1A53AC2600A80BF6 /* fatdir.cpp in Sources */,
AB8F3C8B1A53AC2600A80BF6 /* fatfile.cpp in Sources */, AB8F3C8B1A53AC2600A80BF6 /* fatfile.cpp in Sources */,
@ -9557,7 +9461,6 @@
ABA731701BB51FDC00B26147 /* type1.c in Sources */, ABA731701BB51FDC00B26147 /* type1.c in Sources */,
AB8F3CBA1A53AC2600A80BF6 /* slot2_paddle.cpp in Sources */, AB8F3CBA1A53AC2600A80BF6 /* slot2_paddle.cpp in Sources */,
AB8F3CBB1A53AC2600A80BF6 /* slot2_piano.cpp in Sources */, AB8F3CBB1A53AC2600A80BF6 /* slot2_piano.cpp in Sources */,
AB6E17F62A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
AB8F3CBC1A53AC2600A80BF6 /* slot2_rumblepak.cpp in Sources */, AB8F3CBC1A53AC2600A80BF6 /* slot2_rumblepak.cpp in Sources */,
AB8F3CBD1A53AC2600A80BF6 /* sndOSX.cpp in Sources */, AB8F3CBD1A53AC2600A80BF6 /* sndOSX.cpp in Sources */,
AB8F3CBE1A53AC2600A80BF6 /* SndOut.cpp in Sources */, AB8F3CBE1A53AC2600A80BF6 /* SndOut.cpp in Sources */,
@ -9808,7 +9711,6 @@
AB2ABA461C9F9CFA00173B15 /* rthreads.c in Sources */, AB2ABA461C9F9CFA00173B15 /* rthreads.c in Sources */,
ABB3C6CB1501C04F00E0C22E /* rasterize.cpp in Sources */, ABB3C6CB1501C04F00E0C22E /* rasterize.cpp in Sources */,
ABB3C6CC1501C04F00E0C22E /* readwrite.cpp in Sources */, ABB3C6CC1501C04F00E0C22E /* readwrite.cpp in Sources */,
AB88005E2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
AB49B553281687B90069F1D7 /* truetype.c in Sources */, AB49B553281687B90069F1D7 /* truetype.c in Sources */,
ABB3C6CD1501C04F00E0C22E /* render3D.cpp in Sources */, ABB3C6CD1501C04F00E0C22E /* render3D.cpp in Sources */,
ABB3C6CE1501C04F00E0C22E /* ROMReader.cpp in Sources */, ABB3C6CE1501C04F00E0C22E /* ROMReader.cpp in Sources */,
@ -9888,7 +9790,6 @@
ABC858BF28273FEE00A03EA9 /* filetime.cpp in Sources */, ABC858BF28273FEE00A03EA9 /* filetime.cpp in Sources */,
ABC858C028273FEE00A03EA9 /* FIRFilter.cpp in Sources */, ABC858C028273FEE00A03EA9 /* FIRFilter.cpp in Sources */,
ABC858C128273FEE00A03EA9 /* firmware.cpp in Sources */, ABC858C128273FEE00A03EA9 /* firmware.cpp in Sources */,
AB6E17FC2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
ABC858C228273FEE00A03EA9 /* async_job.c in Sources */, ABC858C228273FEE00A03EA9 /* async_job.c in Sources */,
ABC858C328273FEE00A03EA9 /* gfx3d.cpp in Sources */, ABC858C328273FEE00A03EA9 /* gfx3d.cpp in Sources */,
ABC858C428273FEE00A03EA9 /* DisplayViewCALayer.mm in Sources */, ABC858C428273FEE00A03EA9 /* DisplayViewCALayer.mm in Sources */,
@ -10020,7 +9921,6 @@
ABC8594228273FEE00A03EA9 /* buffer.cpp in Sources */, ABC8594228273FEE00A03EA9 /* buffer.cpp in Sources */,
ABC8594328273FEE00A03EA9 /* ftotval.c in Sources */, ABC8594328273FEE00A03EA9 /* ftotval.c in Sources */,
ABC8594428273FEE00A03EA9 /* compiler.cpp in Sources */, ABC8594428273FEE00A03EA9 /* compiler.cpp in Sources */,
AB88005B2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
ABC8594528273FEE00A03EA9 /* compilercontext.cpp in Sources */, ABC8594528273FEE00A03EA9 /* compilercontext.cpp in Sources */,
ABC8594628273FEE00A03EA9 /* rthreads.c in Sources */, ABC8594628273FEE00A03EA9 /* rthreads.c in Sources */,
ABC8594728273FEE00A03EA9 /* macOS_driver.cpp in Sources */, ABC8594728273FEE00A03EA9 /* macOS_driver.cpp in Sources */,
@ -10118,7 +10018,6 @@
ABD2CD7326E05CB000FB15F7 /* filetime.cpp in Sources */, ABD2CD7326E05CB000FB15F7 /* filetime.cpp in Sources */,
ABD2CD7426E05CB000FB15F7 /* FIRFilter.cpp in Sources */, ABD2CD7426E05CB000FB15F7 /* FIRFilter.cpp in Sources */,
ABD2CD7526E05CB000FB15F7 /* firmware.cpp in Sources */, ABD2CD7526E05CB000FB15F7 /* firmware.cpp in Sources */,
AB6E17FD2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
ABD2CD7626E05CB000FB15F7 /* async_job.c in Sources */, ABD2CD7626E05CB000FB15F7 /* async_job.c in Sources */,
ABD2CD7726E05CB000FB15F7 /* gfx3d.cpp in Sources */, ABD2CD7726E05CB000FB15F7 /* gfx3d.cpp in Sources */,
ABD2CD7826E05CB000FB15F7 /* DisplayViewCALayer.mm in Sources */, ABD2CD7826E05CB000FB15F7 /* DisplayViewCALayer.mm in Sources */,
@ -10250,7 +10149,6 @@
ABD2CDF626E05CB000FB15F7 /* buffer.cpp in Sources */, ABD2CDF626E05CB000FB15F7 /* buffer.cpp in Sources */,
ABD2CDF726E05CB000FB15F7 /* ftotval.c in Sources */, ABD2CDF726E05CB000FB15F7 /* ftotval.c in Sources */,
ABD2CDF826E05CB000FB15F7 /* compiler.cpp in Sources */, ABD2CDF826E05CB000FB15F7 /* compiler.cpp in Sources */,
AB88005C2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
ABD2CDF926E05CB000FB15F7 /* compilercontext.cpp in Sources */, ABD2CDF926E05CB000FB15F7 /* compilercontext.cpp in Sources */,
ABD2CDFA26E05CB000FB15F7 /* rthreads.c in Sources */, ABD2CDFA26E05CB000FB15F7 /* rthreads.c in Sources */,
ABD2CDFB26E05CB000FB15F7 /* macOS_driver.cpp in Sources */, ABD2CDFB26E05CB000FB15F7 /* macOS_driver.cpp in Sources */,
@ -10335,14 +10233,6 @@
name = HID_usage_strings.plist; name = HID_usage_strings.plist;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */ = {
isa = PBXVariantGroup;
children = (
AB6E18002A6B218D003A564D /* English */,
);
name = CheatDatabaseViewer.xib;
sourceTree = "<group>";
};
AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */ = { AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */ = {
isa = PBXVariantGroup; isa = PBXVariantGroup;
children = ( children = (
@ -10443,6 +10333,7 @@
buildSettings = { buildSettings = {
ARCHS = arm64; ARCHS = arm64;
CLANG_OPTIMIZATION_PROFILE_FILE = "$(SRCROOT)/OptimizationProfiles/DeSmuME_arm64.profdata"; CLANG_OPTIMIZATION_PROFILE_FILE = "$(SRCROOT)/OptimizationProfiles/DeSmuME_arm64.profdata";
CLANG_USE_OPTIMIZATION_PROFILE = YES;
GCC_FAST_OBJC_DISPATCH = YES; GCC_FAST_OBJC_DISPATCH = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast; GCC_OPTIMIZATION_LEVEL = fast;
@ -10775,6 +10666,7 @@
ARCHS = x86_64; ARCHS = x86_64;
CLANG_CXX_LIBRARY = "libstdc++"; CLANG_CXX_LIBRARY = "libstdc++";
CLANG_OPTIMIZATION_PROFILE_FILE = "$(SRCROOT)/OptimizationProfiles/DeSmuME_x86_64.profdata"; CLANG_OPTIMIZATION_PROFILE_FILE = "$(SRCROOT)/OptimizationProfiles/DeSmuME_x86_64.profdata";
CLANG_USE_OPTIMIZATION_PROFILE = YES;
GCC_FAST_OBJC_DISPATCH = YES; GCC_FAST_OBJC_DISPATCH = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast; GCC_OPTIMIZATION_LEVEL = fast;
@ -10823,6 +10715,7 @@
buildSettings = { buildSettings = {
ARCHS = x86_64h; ARCHS = x86_64h;
CLANG_OPTIMIZATION_PROFILE_FILE = "$(SRCROOT)/OptimizationProfiles/DeSmuME_x86_64h.profdata"; CLANG_OPTIMIZATION_PROFILE_FILE = "$(SRCROOT)/OptimizationProfiles/DeSmuME_x86_64h.profdata";
CLANG_USE_OPTIMIZATION_PROFILE = YES;
GCC_FAST_OBJC_DISPATCH = YES; GCC_FAST_OBJC_DISPATCH = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_OPTIMIZATION_LEVEL = fast; GCC_OPTIMIZATION_LEVEL = fast;

View File

@ -2,6 +2,6 @@
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef <FileRef
location = "self:"> location = "self:DeSmuME (Latest).xcodeproj">
</FileRef> </FileRef>
</Workspace> </Workspace>

View File

@ -27,6 +27,8 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
BuildableIdentifier = "primary" BuildableIdentifier = "primary"
@ -36,8 +38,8 @@
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
<Testables> <AdditionalOptions>
</Testables> </AdditionalOptions>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Debug"
@ -48,7 +50,6 @@
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
debugServiceExtension = "internal" debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES"> allowLocationSimulation = "YES">
<BuildableProductRunnable <BuildableProductRunnable
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">
@ -60,6 +61,8 @@
ReferencedContainer = "container:DeSmuME (Latest).xcodeproj"> ReferencedContainer = "container:DeSmuME (Latest).xcodeproj">
</BuildableReference> </BuildableReference>
</BuildableProductRunnable> </BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Release" buildConfiguration = "Release"

View File

@ -48,7 +48,6 @@
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
debugServiceExtension = "internal" debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES"> allowLocationSimulation = "YES">
<BuildableProductRunnable <BuildableProductRunnable
runnableDebuggingMode = "0"> runnableDebuggingMode = "0">

View File

@ -266,11 +266,6 @@
AB142028186E2CD80015D52F /* Image_MemoryExpansionPak.png in Resources */ = {isa = PBXBuildFile; fileRef = AB142025186E2CD80015D52F /* Image_MemoryExpansionPak.png */; }; AB142028186E2CD80015D52F /* Image_MemoryExpansionPak.png in Resources */ = {isa = PBXBuildFile; fileRef = AB142025186E2CD80015D52F /* Image_MemoryExpansionPak.png */; };
AB142029186E2CD80015D52F /* Image_MemoryExpansionPak.png in Resources */ = {isa = PBXBuildFile; fileRef = AB142025186E2CD80015D52F /* Image_MemoryExpansionPak.png */; }; AB142029186E2CD80015D52F /* Image_MemoryExpansionPak.png in Resources */ = {isa = PBXBuildFile; fileRef = AB142025186E2CD80015D52F /* Image_MemoryExpansionPak.png */; };
AB14202A186E2CD80015D52F /* Image_MemoryExpansionPak.png in Resources */ = {isa = PBXBuildFile; fileRef = AB142025186E2CD80015D52F /* Image_MemoryExpansionPak.png */; }; AB14202A186E2CD80015D52F /* Image_MemoryExpansionPak.png in Resources */ = {isa = PBXBuildFile; fileRef = AB142025186E2CD80015D52F /* Image_MemoryExpansionPak.png */; };
AB1B20AC2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB1B20AB2AD5ED59007CA7EB /* slot2_hcv1000.cpp */; };
AB1B20AD2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB1B20AB2AD5ED59007CA7EB /* slot2_hcv1000.cpp */; };
AB1B20AE2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB1B20AB2AD5ED59007CA7EB /* slot2_hcv1000.cpp */; };
AB1B20AF2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB1B20AB2AD5ED59007CA7EB /* slot2_hcv1000.cpp */; };
AB1B20B02AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB1B20AB2AD5ED59007CA7EB /* slot2_hcv1000.cpp */; };
AB1CC8001AA509C2008B0A16 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB1CC7FF1AA509C2008B0A16 /* CoreAudio.framework */; }; AB1CC8001AA509C2008B0A16 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB1CC7FF1AA509C2008B0A16 /* CoreAudio.framework */; };
AB1CC80A1AA509DF008B0A16 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB1CC7FF1AA509C2008B0A16 /* CoreAudio.framework */; }; AB1CC80A1AA509DF008B0A16 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB1CC7FF1AA509C2008B0A16 /* CoreAudio.framework */; };
AB1CC80B1AA509E0008B0A16 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB1CC7FF1AA509C2008B0A16 /* CoreAudio.framework */; }; AB1CC80B1AA509E0008B0A16 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB1CC7FF1AA509C2008B0A16 /* CoreAudio.framework */; };
@ -1563,11 +1558,6 @@
ABD59849187D4A6C00069403 /* Icon_PaddleKnob_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = ABD59846187D4A6C00069403 /* Icon_PaddleKnob_256x256.png */; }; ABD59849187D4A6C00069403 /* Icon_PaddleKnob_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = ABD59846187D4A6C00069403 /* Icon_PaddleKnob_256x256.png */; };
ABD5984A187D4A6C00069403 /* Icon_PaddleKnob_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = ABD59846187D4A6C00069403 /* Icon_PaddleKnob_256x256.png */; }; ABD5984A187D4A6C00069403 /* Icon_PaddleKnob_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = ABD59846187D4A6C00069403 /* Icon_PaddleKnob_256x256.png */; };
ABD5984B187D4A6C00069403 /* Icon_PaddleKnob_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = ABD59846187D4A6C00069403 /* Icon_PaddleKnob_256x256.png */; }; ABD5984B187D4A6C00069403 /* Icon_PaddleKnob_256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = ABD59846187D4A6C00069403 /* Icon_PaddleKnob_256x256.png */; };
ABEBCE372A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABEBCE362A703E260028CE8A /* CheatDatabaseWindowController.mm */; };
ABEBCE382A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABEBCE362A703E260028CE8A /* CheatDatabaseWindowController.mm */; };
ABEBCE392A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABEBCE362A703E260028CE8A /* CheatDatabaseWindowController.mm */; };
ABEBCE3A2A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABEBCE362A703E260028CE8A /* CheatDatabaseWindowController.mm */; };
ABEBCE3B2A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABEBCE362A703E260028CE8A /* CheatDatabaseWindowController.mm */; };
ABECB50918A460710052D52A /* xbrz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABECB50818A460710052D52A /* xbrz.cpp */; }; ABECB50918A460710052D52A /* xbrz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABECB50818A460710052D52A /* xbrz.cpp */; };
ABECB50A18A460710052D52A /* xbrz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABECB50818A460710052D52A /* xbrz.cpp */; }; ABECB50A18A460710052D52A /* xbrz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABECB50818A460710052D52A /* xbrz.cpp */; };
ABECB50B18A460710052D52A /* xbrz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABECB50818A460710052D52A /* xbrz.cpp */; }; ABECB50B18A460710052D52A /* xbrz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABECB50818A460710052D52A /* xbrz.cpp */; };
@ -1582,11 +1572,6 @@
ABEF84831873578F00E99ADC /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8C6E56186CD07E00E3EC64 /* ForceFeedback.framework */; }; ABEF84831873578F00E99ADC /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8C6E56186CD07E00E3EC64 /* ForceFeedback.framework */; };
ABEF84841873579400E99ADC /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8C6E56186CD07E00E3EC64 /* ForceFeedback.framework */; }; ABEF84841873579400E99ADC /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8C6E56186CD07E00E3EC64 /* ForceFeedback.framework */; };
ABEF84851873579700E99ADC /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8C6E56186CD07E00E3EC64 /* ForceFeedback.framework */; }; ABEF84851873579700E99ADC /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8C6E56186CD07E00E3EC64 /* ForceFeedback.framework */; };
ABEFFDDE2A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = ABEFFDDC2A78CB67009C3A2D /* CheatDatabaseViewer.xib */; };
ABEFFDDF2A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = ABEFFDDC2A78CB67009C3A2D /* CheatDatabaseViewer.xib */; };
ABEFFDE02A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = ABEFFDDC2A78CB67009C3A2D /* CheatDatabaseViewer.xib */; };
ABEFFDE12A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = ABEFFDDC2A78CB67009C3A2D /* CheatDatabaseViewer.xib */; };
ABEFFDE22A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = ABEFFDDC2A78CB67009C3A2D /* CheatDatabaseViewer.xib */; };
ABF50ABA169F5FDA0018C08D /* assembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABF50A7B169F5FDA0018C08D /* assembler.cpp */; }; ABF50ABA169F5FDA0018C08D /* assembler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABF50A7B169F5FDA0018C08D /* assembler.cpp */; };
ABF50ABB169F5FDA0018C08D /* assert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABF50A7D169F5FDA0018C08D /* assert.cpp */; }; ABF50ABB169F5FDA0018C08D /* assert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABF50A7D169F5FDA0018C08D /* assert.cpp */; };
ABF50ABC169F5FDA0018C08D /* buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABF50A7F169F5FDA0018C08D /* buffer.cpp */; }; ABF50ABC169F5FDA0018C08D /* buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABF50A7F169F5FDA0018C08D /* buffer.cpp */; };
@ -1918,11 +1903,8 @@
AB0F29A314BE7213009ABC6F /* Icon_RotateCW_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_RotateCW_420x420.png; path = images/Icon_RotateCW_420x420.png; sourceTree = "<group>"; }; AB0F29A314BE7213009ABC6F /* Icon_RotateCW_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_RotateCW_420x420.png; path = images/Icon_RotateCW_420x420.png; sourceTree = "<group>"; };
AB0F29A414BE7213009ABC6F /* Icon_ShowHUD_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_ShowHUD_420x420.png; path = images/Icon_ShowHUD_420x420.png; sourceTree = "<group>"; }; AB0F29A414BE7213009ABC6F /* Icon_ShowHUD_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_ShowHUD_420x420.png; path = images/Icon_ShowHUD_420x420.png; sourceTree = "<group>"; };
AB0F29A514BE7213009ABC6F /* Icon_Speaker_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_Speaker_420x420.png; path = images/Icon_Speaker_420x420.png; sourceTree = "<group>"; }; AB0F29A514BE7213009ABC6F /* Icon_Speaker_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_Speaker_420x420.png; path = images/Icon_Speaker_420x420.png; sourceTree = "<group>"; };
AB11AE8E2E210BB400E8A516 /* GPU_Operations_AltiVec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GPU_Operations_AltiVec.cpp; sourceTree = "<group>"; };
AB11AE8F2E210BB400E8A516 /* GPU_Operations_AltiVec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPU_Operations_AltiVec.h; sourceTree = "<group>"; };
AB126D06182ECB9500EBCF22 /* slot2_passme.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = slot2_passme.cpp; sourceTree = "<group>"; }; AB126D06182ECB9500EBCF22 /* slot2_passme.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = slot2_passme.cpp; sourceTree = "<group>"; };
AB142025186E2CD80015D52F /* Image_MemoryExpansionPak.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Image_MemoryExpansionPak.png; path = images/Image_MemoryExpansionPak.png; sourceTree = "<group>"; }; AB142025186E2CD80015D52F /* Image_MemoryExpansionPak.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Image_MemoryExpansionPak.png; path = images/Image_MemoryExpansionPak.png; sourceTree = "<group>"; };
AB1B20AB2AD5ED59007CA7EB /* slot2_hcv1000.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = slot2_hcv1000.cpp; sourceTree = "<group>"; };
AB1CC7FF1AA509C2008B0A16 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; AB1CC7FF1AA509C2008B0A16 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
AB1CC8161AA50C8D008B0A16 /* Icon_MicrophoneBlack_256x256.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_MicrophoneBlack_256x256.png; path = images/Icon_MicrophoneBlack_256x256.png; sourceTree = "<group>"; }; AB1CC8161AA50C8D008B0A16 /* Icon_MicrophoneBlack_256x256.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_MicrophoneBlack_256x256.png; path = images/Icon_MicrophoneBlack_256x256.png; sourceTree = "<group>"; };
AB1CC8171AA50C8D008B0A16 /* Icon_MicrophoneBlueGlow_256x256.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_MicrophoneBlueGlow_256x256.png; path = images/Icon_MicrophoneBlueGlow_256x256.png; sourceTree = "<group>"; }; AB1CC8171AA50C8D008B0A16 /* Icon_MicrophoneBlueGlow_256x256.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_MicrophoneBlueGlow_256x256.png; path = images/Icon_MicrophoneBlueGlow_256x256.png; sourceTree = "<group>"; };
@ -2013,14 +1995,6 @@
AB3ACC3A14C24D5400D7D192 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = COPYING; path = ../../../COPYING; sourceTree = SOURCE_ROOT; }; AB3ACC3A14C24D5400D7D192 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = COPYING; path = ../../../COPYING; sourceTree = SOURCE_ROOT; };
AB3ACC3B14C24D5400D7D192 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README; path = ../../../README; sourceTree = SOURCE_ROOT; }; AB3ACC3B14C24D5400D7D192 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README; path = ../../../README; sourceTree = SOURCE_ROOT; };
AB3ACC3D14C24D5400D7D192 /* README.MAC */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.MAC; path = ../../../README.MAC; sourceTree = SOURCE_ROOT; }; AB3ACC3D14C24D5400D7D192 /* README.MAC */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.MAC; path = ../../../README.MAC; sourceTree = SOURCE_ROOT; };
AB3B8DC62D8A35A000C9CBFD /* GPU_Operations_NEON.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GPU_Operations_NEON.cpp; sourceTree = "<group>"; };
AB3B8DC72D8A35A000C9CBFD /* GPU_Operations_NEON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GPU_Operations_NEON.h; sourceTree = "<group>"; };
AB3B8DC82D8A35A000C9CBFD /* OGLRender_ES3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OGLRender_ES3.cpp; sourceTree = "<group>"; };
AB3B8DC92D8A35A000C9CBFD /* OGLRender_ES3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OGLRender_ES3.h; sourceTree = "<group>"; };
AB3B8DCA2D8A35D900C9CBFD /* OGLDisplayOutput_3_2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OGLDisplayOutput_3_2.cpp; sourceTree = "<group>"; };
AB3B8DCB2D8A35D900C9CBFD /* OGLDisplayOutput_3_2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OGLDisplayOutput_3_2.h; sourceTree = "<group>"; };
AB3B8DCC2D8A35FE00C9CBFD /* colorspacehandler_NEON.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler_NEON.cpp; sourceTree = "<group>"; };
AB3B8DCD2D8A35FE00C9CBFD /* colorspacehandler_NEON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = colorspacehandler_NEON.h; sourceTree = "<group>"; };
AB3E34C7134AF4500056477A /* cocoa_output.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_output.h; sourceTree = "<group>"; }; AB3E34C7134AF4500056477A /* cocoa_output.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_output.h; sourceTree = "<group>"; };
AB3E34C8134AF4500056477A /* cocoa_output.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_output.mm; sourceTree = "<group>"; }; AB3E34C8134AF4500056477A /* cocoa_output.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_output.mm; sourceTree = "<group>"; };
AB3E690E1E231E9900D4CC75 /* MacOGLDisplayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacOGLDisplayView.h; sourceTree = "<group>"; }; AB3E690E1E231E9900D4CC75 /* MacOGLDisplayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacOGLDisplayView.h; sourceTree = "<group>"; };
@ -2352,8 +2326,6 @@
ABE6702A1415DE6C00E8E4C9 /* tinyxmlparser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinyxmlparser.cpp; sourceTree = "<group>"; }; ABE6702A1415DE6C00E8E4C9 /* tinyxmlparser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinyxmlparser.cpp; sourceTree = "<group>"; };
ABE7F53C13EE1C7900FD3A71 /* cocoa_firmware.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_firmware.h; sourceTree = "<group>"; }; ABE7F53C13EE1C7900FD3A71 /* cocoa_firmware.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cocoa_firmware.h; sourceTree = "<group>"; };
ABE7F53D13EE1C7900FD3A71 /* cocoa_firmware.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_firmware.mm; sourceTree = "<group>"; }; ABE7F53D13EE1C7900FD3A71 /* cocoa_firmware.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = cocoa_firmware.mm; sourceTree = "<group>"; };
ABEBCE352A703E260028CE8A /* CheatDatabaseWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheatDatabaseWindowController.h; sourceTree = "<group>"; };
ABEBCE362A703E260028CE8A /* CheatDatabaseWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CheatDatabaseWindowController.mm; sourceTree = "<group>"; };
ABECB50718A460710052D52A /* xbrz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xbrz.h; sourceTree = "<group>"; }; ABECB50718A460710052D52A /* xbrz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xbrz.h; sourceTree = "<group>"; };
ABECB50818A460710052D52A /* xbrz.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xbrz.cpp; sourceTree = "<group>"; }; ABECB50818A460710052D52A /* xbrz.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xbrz.cpp; sourceTree = "<group>"; };
ABECB51218A460910052D52A /* OGLDisplayOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OGLDisplayOutput.h; sourceTree = "<group>"; }; ABECB51218A460910052D52A /* OGLDisplayOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OGLDisplayOutput.h; sourceTree = "<group>"; };
@ -2362,7 +2334,6 @@
ABEFCF5E141AB82A000CC0CD /* AppIcon_DeSmuME.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_DeSmuME.icns; sourceTree = "<group>"; }; ABEFCF5E141AB82A000CC0CD /* AppIcon_DeSmuME.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_DeSmuME.icns; sourceTree = "<group>"; };
ABEFCF5F141AB82A000CC0CD /* AppIcon_NintendoDS_ROM.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_NintendoDS_ROM.icns; sourceTree = "<group>"; }; ABEFCF5F141AB82A000CC0CD /* AppIcon_NintendoDS_ROM.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_NintendoDS_ROM.icns; sourceTree = "<group>"; };
ABEFCF60141AB82A000CC0CD /* AppIcon_SaveState.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_SaveState.icns; sourceTree = "<group>"; }; ABEFCF60141AB82A000CC0CD /* AppIcon_SaveState.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = AppIcon_SaveState.icns; sourceTree = "<group>"; };
ABEFFDDD2A78CB67009C3A2D /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = translations/English.lproj/CheatDatabaseViewer.xib; sourceTree = "<group>"; };
ABF50A74169F5FDA0018C08D /* AsmJit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsmJit.h; sourceTree = "<group>"; }; ABF50A74169F5FDA0018C08D /* AsmJit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsmJit.h; sourceTree = "<group>"; };
ABF50A75169F5FDA0018C08D /* Config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Config.h; sourceTree = "<group>"; }; ABF50A75169F5FDA0018C08D /* Config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Config.h; sourceTree = "<group>"; };
ABF50A76169F5FDA0018C08D /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = core.h; sourceTree = "<group>"; }; ABF50A76169F5FDA0018C08D /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = core.h; sourceTree = "<group>"; };
@ -2573,7 +2544,6 @@
ABC04DC91F67A2AC00EA6ED7 /* macosx_10_5_compat.cpp */, ABC04DC91F67A2AC00EA6ED7 /* macosx_10_5_compat.cpp */,
ABD9A46413DB99B300777194 /* mic_ext.cpp */, ABD9A46413DB99B300777194 /* mic_ext.cpp */,
ABECB51318A460910052D52A /* OGLDisplayOutput.cpp */, ABECB51318A460910052D52A /* OGLDisplayOutput.cpp */,
AB3B8DCA2D8A35D900C9CBFD /* OGLDisplayOutput_3_2.cpp */,
ABD0A5351501AA5A0074A094 /* ringbuffer.cpp */, ABD0A5351501AA5A0074A094 /* ringbuffer.cpp */,
ABD104141346652500AF11D1 /* sndOSX.cpp */, ABD104141346652500AF11D1 /* sndOSX.cpp */,
AB2145211714DFF4006DDB0F /* audiosamplegenerator.h */, AB2145211714DFF4006DDB0F /* audiosamplegenerator.h */,
@ -2597,7 +2567,6 @@
ABD1267420AE812900EFE1B2 /* macOS_driver.h */, ABD1267420AE812900EFE1B2 /* macOS_driver.h */,
ABD9A46313DB99B300777194 /* mic_ext.h */, ABD9A46313DB99B300777194 /* mic_ext.h */,
ABECB51218A460910052D52A /* OGLDisplayOutput.h */, ABECB51218A460910052D52A /* OGLDisplayOutput.h */,
AB3B8DCB2D8A35D900C9CBFD /* OGLDisplayOutput_3_2.h */,
ABD0A5371501AA5A0074A094 /* ringbuffer.h */, ABD0A5371501AA5A0074A094 /* ringbuffer.h */,
ABD104011346652500AF11D1 /* sndOSX.h */, ABD104011346652500AF11D1 /* sndOSX.h */,
AB2F56EE1704C86900E28885 /* utilities.h */, AB2F56EE1704C86900E28885 /* utilities.h */,
@ -2688,7 +2657,6 @@
AB05E8201BBFD41200065D18 /* source-sans-pro */, AB05E8201BBFD41200065D18 /* source-sans-pro */,
ABC2ECD613B1C87000FAAA2A /* Images */, ABC2ECD613B1C87000FAAA2A /* Images */,
AB00E87C14205EBC00DE561F /* MainMenu.xib */, AB00E87C14205EBC00DE561F /* MainMenu.xib */,
ABEFFDDC2A78CB67009C3A2D /* CheatDatabaseViewer.xib */,
AB700DB816CDDBC400FBD336 /* DisplayWindow.xib */, AB700DB816CDDBC400FBD336 /* DisplayWindow.xib */,
AB350D3A147A1D93007165AC /* HID_usage_strings.plist */, AB350D3A147A1D93007165AC /* HID_usage_strings.plist */,
8D1107310486CEB800E47090 /* Info.plist */, 8D1107310486CEB800E47090 /* Info.plist */,
@ -3217,13 +3185,11 @@
AB37E3721D6188BC004A2C0D /* colorspacehandler_SSE2.cpp */, AB37E3721D6188BC004A2C0D /* colorspacehandler_SSE2.cpp */,
AB6FE67226E6F815002B2106 /* colorspacehandler_AVX2.cpp */, AB6FE67226E6F815002B2106 /* colorspacehandler_AVX2.cpp */,
AB6FE67426E6F815002B2106 /* colorspacehandler_AVX512.cpp */, AB6FE67426E6F815002B2106 /* colorspacehandler_AVX512.cpp */,
AB3B8DCC2D8A35FE00C9CBFD /* colorspacehandler_NEON.cpp */,
AB37E36E1D6188BC004A2C0D /* colorspacehandler_AltiVec.cpp */, AB37E36E1D6188BC004A2C0D /* colorspacehandler_AltiVec.cpp */,
AB37E36D1D6188BC004A2C0D /* colorspacehandler.h */, AB37E36D1D6188BC004A2C0D /* colorspacehandler.h */,
AB37E3731D6188BC004A2C0D /* colorspacehandler_SSE2.h */, AB37E3731D6188BC004A2C0D /* colorspacehandler_SSE2.h */,
AB6FE67326E6F815002B2106 /* colorspacehandler_AVX2.h */, AB6FE67326E6F815002B2106 /* colorspacehandler_AVX2.h */,
AB6FE67526E6F815002B2106 /* colorspacehandler_AVX512.h */, AB6FE67526E6F815002B2106 /* colorspacehandler_AVX512.h */,
AB3B8DCD2D8A35FE00C9CBFD /* colorspacehandler_NEON.h */,
AB37E36F1D6188BC004A2C0D /* colorspacehandler_AltiVec.h */, AB37E36F1D6188BC004A2C0D /* colorspacehandler_AltiVec.h */,
); );
path = colorspacehandler; path = colorspacehandler;
@ -3233,7 +3199,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
AB3ACB6614C2361100D7D192 /* appDelegate.h */, AB3ACB6614C2361100D7D192 /* appDelegate.h */,
ABEBCE352A703E260028CE8A /* CheatDatabaseWindowController.h */,
AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */, AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */,
AB3E69811E25FBBF00D4CC75 /* DisplayViewCALayer.h */, AB3E69811E25FBBF00D4CC75 /* DisplayViewCALayer.h */,
AB700DDC16CDE4C300FBD336 /* DisplayWindowController.h */, AB700DDC16CDE4C300FBD336 /* DisplayWindowController.h */,
@ -3252,7 +3217,6 @@
ABA0356E169127BB00817C69 /* troubleshootingWindowDelegate.h */, ABA0356E169127BB00817C69 /* troubleshootingWindowDelegate.h */,
AB4B5A1F217E47E400381363 /* WifiSettingsPanel.h */, AB4B5A1F217E47E400381363 /* WifiSettingsPanel.h */,
AB3ACB6714C2361100D7D192 /* appDelegate.mm */, AB3ACB6714C2361100D7D192 /* appDelegate.mm */,
ABEBCE362A703E260028CE8A /* CheatDatabaseWindowController.mm */,
AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */, AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */,
AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */, AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */,
AB700DDD16CDE4C300FBD336 /* DisplayWindowController.mm */, AB700DDD16CDE4C300FBD336 /* DisplayWindowController.mm */,
@ -3437,8 +3401,6 @@
AB6FE66E26E6F7C2002B2106 /* GPU_Operations.cpp */, AB6FE66E26E6F7C2002B2106 /* GPU_Operations.cpp */,
AB6FE66C26E6F7C2002B2106 /* GPU_Operations_SSE2.cpp */, AB6FE66C26E6F7C2002B2106 /* GPU_Operations_SSE2.cpp */,
AB6FE66A26E6F7C2002B2106 /* GPU_Operations_AVX2.cpp */, AB6FE66A26E6F7C2002B2106 /* GPU_Operations_AVX2.cpp */,
AB3B8DC62D8A35A000C9CBFD /* GPU_Operations_NEON.cpp */,
AB11AE8E2E210BB400E8A516 /* GPU_Operations_AltiVec.cpp */,
ABD1FEB81345AC8400AF11D1 /* lua-engine.cpp */, ABD1FEB81345AC8400AF11D1 /* lua-engine.cpp */,
ABD1FEB91345AC8400AF11D1 /* matrix.cpp */, ABD1FEB91345AC8400AF11D1 /* matrix.cpp */,
ABD1FEBA1345AC8400AF11D1 /* mc.cpp */, ABD1FEBA1345AC8400AF11D1 /* mc.cpp */,
@ -3448,7 +3410,6 @@
ABD1FEC01345AC8400AF11D1 /* NDSSystem.cpp */, ABD1FEC01345AC8400AF11D1 /* NDSSystem.cpp */,
ABD1FEC11345AC8400AF11D1 /* OGLRender.cpp */, ABD1FEC11345AC8400AF11D1 /* OGLRender.cpp */,
AB6FE67026E6F7C2002B2106 /* OGLRender_3_2.cpp */, AB6FE67026E6F7C2002B2106 /* OGLRender_3_2.cpp */,
AB3B8DC82D8A35A000C9CBFD /* OGLRender_ES3.cpp */,
ABD1FEC21345AC8400AF11D1 /* path.cpp */, ABD1FEC21345AC8400AF11D1 /* path.cpp */,
ABD1FEC31345AC8400AF11D1 /* rasterize.cpp */, ABD1FEC31345AC8400AF11D1 /* rasterize.cpp */,
ABD1FEC41345AC8400AF11D1 /* readwrite.cpp */, ABD1FEC41345AC8400AF11D1 /* readwrite.cpp */,
@ -3483,8 +3444,6 @@
AB6FE66F26E6F7C2002B2106 /* GPU_Operations.h */, AB6FE66F26E6F7C2002B2106 /* GPU_Operations.h */,
AB6FE66D26E6F7C2002B2106 /* GPU_Operations_SSE2.h */, AB6FE66D26E6F7C2002B2106 /* GPU_Operations_SSE2.h */,
AB6FE66B26E6F7C2002B2106 /* GPU_Operations_AVX2.h */, AB6FE66B26E6F7C2002B2106 /* GPU_Operations_AVX2.h */,
AB3B8DC72D8A35A000C9CBFD /* GPU_Operations_NEON.h */,
AB11AE8F2E210BB400E8A516 /* GPU_Operations_AltiVec.h */,
ABBCE29D15ACB26100A2C965 /* instruction_attributes.h */, ABBCE29D15ACB26100A2C965 /* instruction_attributes.h */,
ABBCE29E15ACB26100A2C965 /* instructions.h */, ABBCE29E15ACB26100A2C965 /* instructions.h */,
ABD1FE841345AC8400AF11D1 /* lua-engine.h */, ABD1FE841345AC8400AF11D1 /* lua-engine.h */,
@ -3498,7 +3457,6 @@
ABD1FE8C1345AC8400AF11D1 /* NDSSystem.h */, ABD1FE8C1345AC8400AF11D1 /* NDSSystem.h */,
ABD1FE8D1345AC8400AF11D1 /* OGLRender.h */, ABD1FE8D1345AC8400AF11D1 /* OGLRender.h */,
AB6FE67126E6F7C2002B2106 /* OGLRender_3_2.h */, AB6FE67126E6F7C2002B2106 /* OGLRender_3_2.h */,
AB3B8DC92D8A35A000C9CBFD /* OGLRender_ES3.h */,
ABD1FE8F1345AC8400AF11D1 /* PACKED.h */, ABD1FE8F1345AC8400AF11D1 /* PACKED.h */,
ABD1FE8E1345AC8400AF11D1 /* PACKED_END.h */, ABD1FE8E1345AC8400AF11D1 /* PACKED_END.h */,
ABD1FE901345AC8400AF11D1 /* path.h */, ABD1FE901345AC8400AF11D1 /* path.h */,
@ -3537,7 +3495,6 @@
ABD1FF031345AC9B00AF11D1 /* slot2_expMemory.cpp */, ABD1FF031345AC9B00AF11D1 /* slot2_expMemory.cpp */,
ABD1FF041345AC9B00AF11D1 /* slot2_gbagame.cpp */, ABD1FF041345AC9B00AF11D1 /* slot2_gbagame.cpp */,
ABD1FF051345AC9B00AF11D1 /* slot2_guitarGrip.cpp */, ABD1FF051345AC9B00AF11D1 /* slot2_guitarGrip.cpp */,
AB1B20AB2AD5ED59007CA7EB /* slot2_hcv1000.cpp */,
ABD1FF061345AC9B00AF11D1 /* slot2_mpcf.cpp */, ABD1FF061345AC9B00AF11D1 /* slot2_mpcf.cpp */,
ABD1FF071345AC9C00AF11D1 /* slot2_none.cpp */, ABD1FF071345AC9C00AF11D1 /* slot2_none.cpp */,
ABD1FF081345AC9C00AF11D1 /* slot2_paddle.cpp */, ABD1FF081345AC9C00AF11D1 /* slot2_paddle.cpp */,
@ -3831,6 +3788,7 @@
buildPhases = ( buildPhases = (
AB2F3B7B15CF9C6000858373 /* ShellScript */, AB2F3B7B15CF9C6000858373 /* ShellScript */,
AB2F3B7C15CF9C6000858373 /* Resources */, AB2F3B7C15CF9C6000858373 /* Resources */,
ABE76A8015E0904E00F458AE /* ShellScript */,
AB2F3BC415CF9C6000858373 /* Sources */, AB2F3BC415CF9C6000858373 /* Sources */,
AB2F3C3A15CF9C6000858373 /* Frameworks */, AB2F3C3A15CF9C6000858373 /* Frameworks */,
); );
@ -3912,7 +3870,7 @@
attributes = { attributes = {
ORGANIZATIONNAME = "DeSmuME Team"; ORGANIZATIONNAME = "DeSmuME Team";
}; };
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DeSmuME (Xcode 3)" */; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DeSmuME (XCode 3)" */;
compatibilityVersion = "Xcode 3.1"; compatibilityVersion = "Xcode 3.1";
developmentRegion = English; developmentRegion = English;
hasScannedForEncodings = 1; hasScannedForEncodings = 1;
@ -4056,7 +4014,6 @@
ABA1659B2808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */, ABA1659B2808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */,
ABA1659C2808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */, ABA1659C2808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */,
AB6D78942809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */, AB6D78942809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */,
ABEFFDDF2A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -4176,7 +4133,6 @@
ABA165A92808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */, ABA165A92808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */,
ABA165AA2808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */, ABA165AA2808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */,
AB6D78952809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */, AB6D78952809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */,
ABEFFDE02A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -4296,7 +4252,6 @@
ABA165D32808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */, ABA165D32808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */,
ABA165D42808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */, ABA165D42808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */,
AB6D78982809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */, AB6D78982809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */,
ABEFFDDE2A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -4416,7 +4371,6 @@
ABA165C52808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */, ABA165C52808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */,
ABA165C62808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */, ABA165C62808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */,
AB6D78972809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */, AB6D78972809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */,
ABEFFDE22A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -4536,7 +4490,6 @@
ABA165B72808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */, ABA165B72808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */,
ABA165B82808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */, ABA165B82808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */,
AB6D78962809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */, AB6D78962809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */,
ABEFFDE12A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -4674,6 +4627,20 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "cd \"${SRCROOT}\"\nsh \"git-scmrev.sh\""; shellScript = "cd \"${SRCROOT}\"\nsh \"git-scmrev.sh\"";
}; };
ABE76A8015E0904E00F458AE /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"$(SRCROOT)/../svnrev.h",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd \"${SRCROOT}\"\nsh \"git-scmrev.sh\"";
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
@ -4868,8 +4835,6 @@
ABD1267720AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */, ABD1267720AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
ABD1267820AE812900EFE1B2 /* macOS_driver.cpp in Sources */, ABD1267820AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
AB4B5A22217E47E400381363 /* WifiSettingsPanel.mm in Sources */, AB4B5A22217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
ABEBCE382A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */,
AB1B20AD2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -5064,8 +5029,6 @@
ABD1267920AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */, ABD1267920AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
ABD1267A20AE812900EFE1B2 /* macOS_driver.cpp in Sources */, ABD1267A20AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
AB4B5A23217E47E400381363 /* WifiSettingsPanel.mm in Sources */, AB4B5A23217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
ABEBCE392A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */,
AB1B20AE2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -5290,8 +5253,6 @@
ABD1267520AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */, ABD1267520AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
ABD1267620AE812900EFE1B2 /* macOS_driver.cpp in Sources */, ABD1267620AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
AB4B5A21217E47E400381363 /* WifiSettingsPanel.mm in Sources */, AB4B5A21217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
ABEBCE372A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */,
AB1B20AC2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -5516,8 +5477,6 @@
ABD1267D20AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */, ABD1267D20AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
ABD1267E20AE812900EFE1B2 /* macOS_driver.cpp in Sources */, ABD1267E20AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
AB4B5A25217E47E400381363 /* WifiSettingsPanel.mm in Sources */, AB4B5A25217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
ABEBCE3B2A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */,
AB1B20B02AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -5712,8 +5671,6 @@
ABD1267B20AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */, ABD1267B20AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
ABD1267C20AE812900EFE1B2 /* macOS_driver.cpp in Sources */, ABD1267C20AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
AB4B5A24217E47E400381363 /* WifiSettingsPanel.mm in Sources */, AB4B5A24217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
ABEBCE3A2A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */,
AB1B20AF2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -5760,14 +5717,6 @@
name = Localizable.strings; name = Localizable.strings;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
ABEFFDDC2A78CB67009C3A2D /* CheatDatabaseViewer.xib */ = {
isa = PBXVariantGroup;
children = (
ABEFFDDD2A78CB67009C3A2D /* English */,
);
name = CheatDatabaseViewer.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */ /* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
@ -6058,7 +6007,7 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DeSmuME (Xcode 3)" */ = { C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DeSmuME (XCode 3)" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */, C01FCF4F08A954540054247B /* Debug */,

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2024 DeSmuME team Copyright (C) 2012-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -22,7 +22,7 @@
#define HOST_DARWIN #define HOST_DARWIN
#define DESMUME_COCOA #define DESMUME_COCOA
#define ENABLE_OPENGL_STANDARD #define HAVE_OPENGL
#define HAVE_LIBZ #define HAVE_LIBZ
//#define HAVE_LUA //#define HAVE_LUA
//#define HAVE_AV_CONFIG_H //#define HAVE_AV_CONFIG_H

View File

@ -54,7 +54,7 @@
<string>Set Speed</string> <string>Set Speed</string>
<string>Enable/Disable Speed Limiter</string> <string>Enable/Disable Speed Limiter</string>
<string>Enable/Disable Auto Frame Skip</string> <string>Enable/Disable Auto Frame Skip</string>
<string>Enable/Disable Cheat System</string> <string>Enable/Disable Cheats</string>
<string>Enable/Disable GPU State</string> <string>Enable/Disable GPU State</string>
</array> </array>
<key>DefaultInputProfiles</key> <key>DefaultInputProfiles</key>
@ -805,7 +805,7 @@
<array/> <array/>
<key>Enable/Disable Auto Frame Skip</key> <key>Enable/Disable Auto Frame Skip</key>
<array/> <array/>
<key>Enable/Disable Cheat System</key> <key>Enable/Disable Cheats</key>
<array/> <array/>
<key>Enable/Disable GPU State</key> <key>Enable/Disable GPU State</key>
<array/> <array/>

View File

@ -4,8 +4,6 @@
<dict> <dict>
<key>Advanscene_AutoDetectRomSaveType</key> <key>Advanscene_AutoDetectRomSaveType</key>
<true/> <true/>
<key>CheatDatabase_RecentFilePath</key>
<array/>
<key>CoreControl_EnableAutoFrameSkip</key> <key>CoreControl_EnableAutoFrameSkip</key>
<true/> <true/>
<key>CoreControl_FramesToSkipSetting</key> <key>CoreControl_FramesToSkipSetting</key>
@ -831,7 +829,7 @@
<array/> <array/>
<key>Enable/Disable Auto Frame Skip</key> <key>Enable/Disable Auto Frame Skip</key>
<array/> <array/>
<key>Enable/Disable Cheat System</key> <key>Enable/Disable Cheats</key>
<array/> <array/>
<key>Enable/Disable GPU State</key> <key>Enable/Disable GPU State</key>
<array/> <array/>

View File

@ -53,11 +53,6 @@
<string>Cocoa</string> <string>Cocoa</string>
<string>OpenEmu</string> <string>OpenEmu</string>
</array> </array>
<key>0.9.14</key>
<array>
<string>Cocoa</string>
<string>OpenEmu</string>
</array>
</dict> </dict>
<key>DefaultPaths</key> <key>DefaultPaths</key>
<dict> <dict>
@ -209,27 +204,6 @@
<string>${OPENEMU}</string> <string>${OPENEMU}</string>
</dict> </dict>
</dict> </dict>
<key>0.9.14</key>
<dict>
<key>Cocoa</key>
<dict>
<key>ROM Save</key>
<string>${APPSUPPORT}</string>
<key>Cheat</key>
<string>${APPSUPPORT}</string>
<key>Firmware Configuration</key>
<string>${APPSUPPORT}</string>
<key>Save State</key>
<string>${APPSUPPORT}</string>
</dict>
<key>OpenEmu</key>
<dict>
<key>ROM Save</key>
<string>${OPENEMU}</string>
<key>Save State</key>
<string>${OPENEMU}</string>
</dict>
</dict>
</dict> </dict>
<key>DirectoryNames</key> <key>DirectoryNames</key>
<dict> <dict>
@ -441,32 +415,6 @@
<string>SoundSamples</string> <string>SoundSamples</string>
</dict> </dict>
</dict> </dict>
<key>0.9.14</key>
<dict>
<key>Cocoa</key>
<dict>
<key>ROM Save</key>
<string>Battery</string>
<key>Cheat</key>
<string>Cheats</string>
<key>Firmware Configuration</key>
<string>Battery</string>
<key>Lua Script</key>
<string>Lua</string>
<key>Video</key>
<string>AviFiles</string>
<key>R4 Format</key>
<string>R4format</string>
<key>ROM</key>
<string>Roms</string>
<key>Save State</key>
<string>States</string>
<key>Screenshot</key>
<string>Screenshots</string>
<key>Sound Sample</key>
<string>SoundSamples</string>
</dict>
</dict>
</dict> </dict>
<key>FileExtensionByTypes</key> <key>FileExtensionByTypes</key>
<dict> <dict>
@ -614,24 +562,6 @@
<string>nds</string> <string>nds</string>
</dict> </dict>
</dict> </dict>
<key>0.9.14</key>
<dict>
<key>Cocoa</key>
<dict>
<key>ROM Save</key>
<string>dsv</string>
<key>Cheat</key>
<string>dct</string>
<key>Firmware Configuration</key>
<string>dfc</string>
<key>Lua Script</key>
<string>lua</string>
<key>Save State</key>
<string>dst</string>
<key>ROM</key>
<string>nds</string>
</dict>
</dict>
</dict> </dict>
<key>FileTypeByExtensions</key> <key>FileTypeByExtensions</key>
<dict> <dict>
@ -779,24 +709,6 @@
<string>ROM</string> <string>ROM</string>
</dict> </dict>
</dict> </dict>
<key>0.9.14</key>
<dict>
<key>Cocoa</key>
<dict>
<key>dsv</key>
<string>ROM Save</string>
<key>dct</key>
<string>Cheat</string>
<key>dfc</key>
<string>Firmware Configuration</string>
<key>lua</key>
<string>Lua Script</string>
<key>dst</key>
<string>Save State</string>
<key>nds</key>
<string>ROM</string>
</dict>
</dict>
</dict> </dict>
</dict> </dict>
</plist> </plist>

View File

@ -4,8 +4,6 @@
<dict> <dict>
<key>NSRequiresAquaSystemAppearance</key> <key>NSRequiresAquaSystemAppearance</key>
<false/> <false/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>NSMicrophoneUsageDescription</key> <key>NSMicrophoneUsageDescription</key>
<string>DeSmuME requires your host microphone to emulate the NDS microphone.</string> <string>DeSmuME requires your host microphone to emulate the NDS microphone.</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
@ -246,11 +244,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>v0.9.14 (Debug)</string> <string>v0.9.13 (Debug)</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>DSmM</string> <string>DSmM</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.9.14</string> <string>0.9.13</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.games</string> <string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>

View File

@ -4,8 +4,6 @@
<dict> <dict>
<key>NSRequiresAquaSystemAppearance</key> <key>NSRequiresAquaSystemAppearance</key>
<false/> <false/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>NSMicrophoneUsageDescription</key> <key>NSMicrophoneUsageDescription</key>
<string>DeSmuME requires your host microphone to emulate the NDS microphone.</string> <string>DeSmuME requires your host microphone to emulate the NDS microphone.</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
@ -246,11 +244,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>v0.9.14</string> <string>v0.9.13</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>DSmM</string> <string>DSmM</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.9.14</string> <string>0.9.13</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.games</string> <string>public.app-category.games</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2014-2025 DeSmuME team Copyright (C) 2014-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -18,18 +18,16 @@
#ifndef _OGLDISPLAYOUTPUT_H_ #ifndef _OGLDISPLAYOUTPUT_H_
#define _OGLDISPLAYOUTPUT_H_ #define _OGLDISPLAYOUTPUT_H_
#ifndef _OGLDISPLAYOUTPUT_3_2_H_
#if defined(__APPLE__) #if defined(__APPLE__)
#ifdef _OGLDISPLAYOUTPUT_3_2_H_ #include <OpenGL/gl.h>
#include <OpenGL/gl3.h> #include <OpenGL/glext.h>
#include <OpenGL/gl3ext.h>
#else
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#endif
#include <OpenGL/OpenGL.h> #include <OpenGL/OpenGL.h>
#endif #endif
#endif // _OGLDISPLAYOUTPUT_3_2_H_
#include <set> #include <set>
#include <string> #include <string>
#include <pthread.h> #include <pthread.h>
@ -37,7 +35,7 @@
#include "ClientDisplayView.h" #include "ClientDisplayView.h"
#define OPENGL_FETCH_BUFFER_COUNT 3 #define OPENGL_FETCH_BUFFER_COUNT 2
class OGLVideoOutput; class OGLVideoOutput;
@ -49,7 +47,7 @@ enum ShaderSupportTier
ShaderSupport_MidTier = 3, ShaderSupport_MidTier = 3,
ShaderSupport_HighTier = 4, ShaderSupport_HighTier = 4,
ShaderSupport_TopTier = 5, ShaderSupport_TopTier = 5,
ShaderSupport_FutureTier = 6 ShaderSupport_FutureTier = 6,
}; };
struct OGLProcessedFrameInfo struct OGLProcessedFrameInfo
@ -391,6 +389,9 @@ public:
void CopyFromSrcClone(uint32_t *dstBufferPtr, const NDSDisplayID displayID, const u8 bufferIndex); void CopyFromSrcClone(uint32_t *dstBufferPtr, const NDSDisplayID displayID, const u8 bufferIndex);
void FetchNativeDisplayToSrcClone(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock); void FetchNativeDisplayToSrcClone(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock);
void FetchCustomDisplayToSrcClone(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock); void FetchCustomDisplayToSrcClone(const NDSDisplayInfo *displayInfoList, const NDSDisplayID displayID, const u8 bufferIndex, bool needsLock);
void FetchTextureWriteLock(const NDSDisplayID displayID);
void FetchTextureReadLock(const NDSDisplayID displayID);
void FetchTextureUnlock(const NDSDisplayID displayID);
// OpenGL-specific functions that must be called in response to their // OpenGL-specific functions that must be called in response to their
// corresponding GPUClientFetchObject methods. // corresponding GPUClientFetchObject methods.

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2015-2024 DeSmuME team Copyright (C) 2015 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -18,6 +18,12 @@
#ifndef _OGLDISPLAYOUTPUT_3_2_H_ #ifndef _OGLDISPLAYOUTPUT_3_2_H_
#define _OGLDISPLAYOUTPUT_3_2_H_ #define _OGLDISPLAYOUTPUT_3_2_H_
#if defined(__APPLE__)
#include <OpenGL/gl3.h>
#include <OpenGL/gl3ext.h>
#include <OpenGL/OpenGL.h>
#endif
#include "OGLDisplayOutput.h" #include "OGLDisplayOutput.h"
class OGLContextInfo_3_2 : public OGLContextInfo class OGLContextInfo_3_2 : public OGLContextInfo

View File

@ -157,7 +157,7 @@ SineWaveGenerator::SineWaveGenerator()
_frequency = 250.0; _frequency = 250.0;
_sampleRate = MIC_SAMPLE_RATE; _sampleRate = MIC_SAMPLE_RATE;
_cyclePosition = 0.0; _cyclePosition = 0.0;
} };
SineWaveGenerator::SineWaveGenerator(const double freq, const double sampleRate) SineWaveGenerator::SineWaveGenerator(const double freq, const double sampleRate)
{ {

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2025 DeSmuME team Copyright (C) 2013-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -238,9 +238,6 @@ public:
@property (assign) BOOL layerSubOBJ; @property (assign) BOOL layerSubOBJ;
@property (assign) NSInteger render3DRenderingEngine; @property (assign) NSInteger render3DRenderingEngine;
@property (readonly) NSInteger render3DRenderingEngineApplied;
@property (readonly) NSInteger render3DRenderingEngineAppliedHostRendererID;
@property (readonly) NSString *render3DRenderingEngineAppliedHostRendererName;
@property (assign) BOOL render3DHighPrecisionColorInterpolation; @property (assign) BOOL render3DHighPrecisionColorInterpolation;
@property (assign) BOOL render3DEdgeMarking; @property (assign) BOOL render3DEdgeMarking;
@property (assign) BOOL render3DFog; @property (assign) BOOL render3DFog;
@ -264,6 +261,7 @@ public:
#endif #endif
- (BOOL) gpuStateByBit:(const UInt32)stateBit; - (BOOL) gpuStateByBit:(const UInt32)stateBit;
- (NSString *) render3DRenderingEngineString;
- (void) clearWithColor:(const uint16_t)colorBGRA5551; - (void) clearWithColor:(const uint16_t)colorBGRA5551;
- (void) respondToPauseState:(BOOL)isPaused; - (void) respondToPauseState:(BOOL)isPaused;
@ -274,14 +272,18 @@ extern "C"
{ {
#endif #endif
bool cgl_initOpenGL_StandardAuto(); bool OSXOpenGLRendererInit();
bool cgl_initOpenGL_LegacyAuto(); bool OSXOpenGLRendererBegin();
bool cgl_initOpenGL_3_2_CoreProfile(); void OSXOpenGLRendererEnd();
bool OSXOpenGLRendererFramebufferDidResize(const bool isFBOSupported, size_t w, size_t h);
void cgl_deinitOpenGL(); bool CreateOpenGLRenderer();
bool cgl_beginOpenGL(); void DestroyOpenGLRenderer();
void cgl_endOpenGL(); void RequestOpenGLRenderer_3_2(bool request_3_2);
bool cgl_framebufferDidResizeCallback(const bool isFBOSupported, size_t w, size_t h); void SetOpenGLRendererFunctions(bool (*initFunction)(),
bool (*beginOGLFunction)(),
void (*endOGLFunction)(),
bool (*resizeOGLFunction)(const bool isFBOSupported, size_t w, size_t h));
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2013-2025 DeSmuME team Copyright (C) 2013-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -16,10 +16,6 @@
*/ */
#import "cocoa_GPU.h" #import "cocoa_GPU.h"
#include <sys/types.h>
#include <sys/sysctl.h>
#import "cocoa_output.h" #import "cocoa_output.h"
#import "cocoa_globals.h" #import "cocoa_globals.h"
#include "utilities.h" #include "utilities.h"
@ -55,9 +51,6 @@ GPU3DInterface *core3DList[GPU_3D_RENDERER_COUNT+1] = {
NULL NULL
}; };
int __hostRendererID = -1;
char __hostRendererString[256] = {0};
@implementation CocoaDSGPU @implementation CocoaDSGPU
@dynamic gpuStateFlags; @dynamic gpuStateFlags;
@ -81,9 +74,6 @@ char __hostRendererString[256] = {0};
@dynamic layerSubOBJ; @dynamic layerSubOBJ;
@dynamic render3DRenderingEngine; @dynamic render3DRenderingEngine;
@dynamic render3DRenderingEngineApplied;
@dynamic render3DRenderingEngineAppliedHostRendererID;
@dynamic render3DRenderingEngineAppliedHostRendererName;
@dynamic render3DHighPrecisionColorInterpolation; @dynamic render3DHighPrecisionColorInterpolation;
@dynamic render3DEdgeMarking; @dynamic render3DEdgeMarking;
@dynamic render3DFog; @dynamic render3DFog;
@ -128,17 +118,11 @@ char __hostRendererString[256] = {0};
isCPUCoreCountAuto = NO; isCPUCoreCountAuto = NO;
_needRestoreRender3DLock = NO; _needRestoreRender3DLock = NO;
oglrender_init = &cgl_initOpenGL_StandardAuto; SetOpenGLRendererFunctions(&OSXOpenGLRendererInit,
oglrender_deinit = &cgl_deinitOpenGL; &OSXOpenGLRendererBegin,
oglrender_beginOpenGL = &cgl_beginOpenGL; &OSXOpenGLRendererEnd,
oglrender_endOpenGL = &cgl_endOpenGL; &OSXOpenGLRendererFramebufferDidResize);
oglrender_framebufferDidResizeCallback = &cgl_framebufferDidResizeCallback;
#ifdef OGLRENDER_3_2_H
OGLLoadEntryPoints_3_2_Func = &OGLLoadEntryPoints_3_2;
OGLCreateRenderer_3_2_Func = &OGLCreateRenderer_3_2;
#endif
#ifdef PORT_VERSION_OS_X_APP #ifdef PORT_VERSION_OS_X_APP
gpuEvent = new GPUEventHandlerAsync; gpuEvent = new GPUEventHandlerAsync;
@ -185,10 +169,10 @@ char __hostRendererString[256] = {0};
openglDeviceMaxMultisamples = 0; openglDeviceMaxMultisamples = 0;
render3DMultisampleSizeString = @"Off"; render3DMultisampleSizeString = @"Off";
bool isTempContextCreated = cgl_initOpenGL_StandardAuto(); bool isTempContextCreated = OSXOpenGLRendererInit();
if (isTempContextCreated) if (isTempContextCreated)
{ {
cgl_beginOpenGL(); OSXOpenGLRendererBegin();
GLint maxSamplesOGL = 0; GLint maxSamplesOGL = 0;
@ -200,8 +184,8 @@ char __hostRendererString[256] = {0};
openglDeviceMaxMultisamples = maxSamplesOGL; openglDeviceMaxMultisamples = maxSamplesOGL;
cgl_endOpenGL(); OSXOpenGLRendererEnd();
cgl_deinitOpenGL(); DestroyOpenGLRenderer();
} }
return self; return self;
@ -209,7 +193,7 @@ char __hostRendererString[256] = {0};
- (void)dealloc - (void)dealloc
{ {
GPU->SetEventHandler(NULL); // Unassigned our event handler before we delete it. DestroyOpenGLRenderer();
delete fetchObject; delete fetchObject;
delete gpuEvent; delete gpuEvent;
@ -387,13 +371,17 @@ char __hostRendererString[256] = {0};
puts("DeSmuME: Invalid 3D renderer chosen; falling back to SoftRasterizer."); puts("DeSmuME: Invalid 3D renderer chosen; falling back to SoftRasterizer.");
rendererID = CORE3DLIST_SWRASTERIZE; rendererID = CORE3DLIST_SWRASTERIZE;
} }
else if (rendererID == CORE3DLIST_OPENGL)
#if defined(__ppc__) || defined(__ppc64__)
if ( (rendererID != CORE3DLIST_NULL) && (rendererID != CORE3DLIST_SWRASTERIZE) )
{ {
oglrender_init = &cgl_initOpenGL_StandardAuto; puts("DeSmuME: PowerPC Macs only support SoftRasterizer; falling back to SoftRasterizer.");
rendererID = CORE3DLIST_SWRASTERIZE;
} }
#endif
gpuEvent->ApplyRender3DSettingsLock(); gpuEvent->ApplyRender3DSettingsLock();
GPU->Set3DRendererByID((int)rendererID); GPU->Set3DRendererByID(rendererID);
gpuEvent->ApplyRender3DSettingsUnlock(); gpuEvent->ApplyRender3DSettingsUnlock();
} }
@ -406,88 +394,6 @@ char __hostRendererString[256] = {0};
return rendererID; return rendererID;
} }
- (NSInteger) render3DRenderingEngineApplied
{
gpuEvent->ApplyRender3DSettingsLock();
if ( (gpu3D == NULL) || (CurrentRenderer == NULL) )
{
gpuEvent->ApplyRender3DSettingsUnlock();
return 0;
}
const NSInteger rendererID = (NSInteger)CurrentRenderer->GetRenderID();
gpuEvent->ApplyRender3DSettingsUnlock();
return rendererID;
}
- (NSInteger) render3DRenderingEngineAppliedHostRendererID
{
NSInteger hostID = 0;
gpuEvent->ApplyRender3DSettingsLock();
if ( (gpu3D == NULL) || (CurrentRenderer == NULL) )
{
gpuEvent->ApplyRender3DSettingsUnlock();
return hostID;
}
switch (CurrentRenderer->GetRenderID())
{
case RENDERID_OPENGL_AUTO:
case RENDERID_OPENGL_LEGACY:
case RENDERID_OPENGL_3_2:
hostID = (NSInteger)__hostRendererID;
break;
case RENDERID_NULL:
case RENDERID_SOFTRASTERIZER:
default:
break;
}
gpuEvent->ApplyRender3DSettingsUnlock();
return hostID;
}
- (NSString *) render3DRenderingEngineAppliedHostRendererName
{
NSString *theString = @"Uninitialized";
gpuEvent->ApplyRender3DSettingsLock();
if ( (gpu3D == NULL) || (CurrentRenderer == NULL) )
{
gpuEvent->ApplyRender3DSettingsUnlock();
return theString;
}
std::string theName;
switch (CurrentRenderer->GetRenderID())
{
case RENDERID_OPENGL_AUTO:
case RENDERID_OPENGL_LEGACY:
case RENDERID_OPENGL_3_2:
theName = std::string((const char *)__hostRendererString);
break;
case RENDERID_NULL:
case RENDERID_SOFTRASTERIZER:
default:
theName = CurrentRenderer->GetName();
break;
}
theString = [NSString stringWithCString:theName.c_str() encoding:NSUTF8StringEncoding];
gpuEvent->ApplyRender3DSettingsUnlock();
return theString;
}
- (void) setRender3DHighPrecisionColorInterpolation:(BOOL)state - (void) setRender3DHighPrecisionColorInterpolation:(BOOL)state
{ {
gpuEvent->ApplyRender3DSettingsLock(); gpuEvent->ApplyRender3DSettingsLock();
@ -578,7 +484,7 @@ char __hostRendererString[256] = {0};
gpuEvent->ApplyRender3DSettingsLock(); gpuEvent->ApplyRender3DSettingsLock();
CommonSettings.num_cores = (int)numberCores; CommonSettings.num_cores = numberCores;
if (renderingEngineID == RENDERID_SOFTRASTERIZER) if (renderingEngineID == RENDERID_SOFTRASTERIZER)
{ {
@ -1112,6 +1018,26 @@ char __hostRendererString[256] = {0};
return ([self gpuStateFlags] & (1 << stateBit)) ? YES : NO; return ([self gpuStateFlags] & (1 << stateBit)) ? YES : NO;
} }
- (NSString *) render3DRenderingEngineString
{
NSString *theString = @"Uninitialized";
gpuEvent->ApplyRender3DSettingsLock();
if (gpu3D == NULL)
{
gpuEvent->ApplyRender3DSettingsUnlock();
return theString;
}
const char *theName = gpu3D->name;
theString = [NSString stringWithCString:theName encoding:NSUTF8StringEncoding];
gpuEvent->ApplyRender3DSettingsUnlock();
return theString;
}
- (void) clearWithColor:(const uint16_t)colorBGRA5551 - (void) clearWithColor:(const uint16_t)colorBGRA5551
{ {
gpuEvent->FramebufferLock(); gpuEvent->FramebufferLock();
@ -1893,494 +1819,22 @@ bool GPUEventHandlerAsync::GetRender3DNeedsFinish()
#pragma mark - #pragma mark -
#if !defined(MAC_OS_X_VERSION_10_7)
#define kCGLPFAOpenGLProfile (CGLPixelFormatAttribute)99
#define kCGLOGLPVersion_Legacy 0x1000
#define kCGLOGLPVersion_3_2_Core 0x3200
#define kCGLOGLPVersion_GL3_Core 0x3200
#define kCGLRPVideoMemoryMegabytes (CGLRendererProperty)131
#define kCGLRPTextureMemoryMegabytes (CGLRendererProperty)132
#endif
#if !defined(MAC_OS_X_VERSION_10_9)
#define kCGLOGLPVersion_GL4_Core 0x4100
#endif
#if !defined(MAC_OS_X_VERSION_10_13)
#define kCGLRPRemovable (CGLRendererProperty)142
#endif
CGLContextObj OSXOpenGLRendererContext = NULL; CGLContextObj OSXOpenGLRendererContext = NULL;
CGLContextObj OSXOpenGLRendererContextPrev = NULL; CGLContextObj OSXOpenGLRendererContextPrev = NULL;
SILENCE_DEPRECATION_MACOS_10_7( CGLPBufferObj OSXOpenGLRendererPBuffer = NULL ) SILENCE_DEPRECATION_MACOS_10_7( CGLPBufferObj OSXOpenGLRendererPBuffer = NULL );
// Struct to hold renderer info bool OSXOpenGLRendererInit()
struct HostRendererInfo
{ {
int32_t rendererID; // Renderer ID, used to associate a renderer with a display device or virtual screen bool isContextCreated = (OSXOpenGLRendererContext != NULL);
int32_t accelerated; // Hardware acceleration flag, 0 = Software only, 1 = Has hardware acceleration
int32_t displayID; // Display ID, used to associate a display device with a renderer
int32_t online; // Online flag, 0 = No display device associated, 1 = Display device associated
int32_t removable; // Removable flag, used to indicate if the renderer is removable (like an eGPU), 0 = Fixed, 1 = Removable
int32_t virtualScreen; // Virtual screen index, used to associate a virtual screen with a renderer
int32_t videoMemoryMB; // The total amount of VRAM available to this renderer
int32_t textureMemoryMB; // The amount of VRAM available to this renderer for texture usage
char vendor[256]; // C-string copy of the host renderer's vendor
char name[256]; // C-string copy of the host renderer's name
const void *vendorStr; // Pointer to host renderer's vendor string (parsing this is implementation dependent)
const void *nameStr; // Pointer to host renderer's name string (parsing this is implementation dependent)
};
typedef struct HostRendererInfo HostRendererInfo;
static bool __cgl_initOpenGL(const int requestedProfile)
{
bool result = false;
CACHE_ALIGN char ctxString[16] = {0};
if (requestedProfile == kCGLOGLPVersion_GL4_Core)
{
strncpy(ctxString, "CGL 4.1", sizeof(ctxString));
}
else if (requestedProfile == kCGLOGLPVersion_3_2_Core)
{
strncpy(ctxString, "CGL 3.2", sizeof(ctxString));
}
else
{
strncpy(ctxString, "CGL Legacy", sizeof(ctxString));
}
if (OSXOpenGLRendererContext != NULL)
{
result = true;
return result;
}
const bool isHighSierraSupported = IsOSXVersionSupported(10, 13, 0);
const bool isMavericksSupported = (isHighSierraSupported || IsOSXVersionSupported(10, 9, 0));
const bool isMountainLionSupported = (isMavericksSupported || IsOSXVersionSupported(10, 8, 0));
const bool isLionSupported = (isMountainLionSupported || IsOSXVersionSupported(10, 7, 0));
const bool isLeopardSupported = (isLionSupported || IsOSXVersionSupported(10, 5, 0));
CGLPixelFormatAttribute attrs[] = {
kCGLPFAColorSize, (CGLPixelFormatAttribute)24,
kCGLPFAAlphaSize, (CGLPixelFormatAttribute)8,
kCGLPFADepthSize, (CGLPixelFormatAttribute)24,
kCGLPFAStencilSize, (CGLPixelFormatAttribute)8,
kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute)0,
kCGLPFAAllowOfflineRenderers,
kCGLPFAAccelerated,
kCGLPFANoRecovery,
(CGLPixelFormatAttribute)0
};
if (requestedProfile == kCGLOGLPVersion_GL4_Core)
{
if (isMavericksSupported)
{
attrs[5] = (CGLPixelFormatAttribute)0; // We'll be using FBOs instead of the default framebuffer.
attrs[7] = (CGLPixelFormatAttribute)0; // We'll be using FBOs instead of the default framebuffer.
attrs[9] = (CGLPixelFormatAttribute)requestedProfile;
}
else
{
fprintf(stderr, "%s: Your version of OS X is too old to support 4.1 Core Profile.\n", ctxString);
return result;
}
}
else if (requestedProfile == kCGLOGLPVersion_3_2_Core)
{
// As of 2021/09/03, testing has shown that macOS v10.7's OpenGL 3.2 shader
// compiler isn't very reliable, and so we're going to require macOS v10.8
// instead, which at least has a working shader compiler for OpenGL 3.2.
if (isMountainLionSupported)
{
attrs[5] = (CGLPixelFormatAttribute)0; // We'll be using FBOs instead of the default framebuffer.
attrs[7] = (CGLPixelFormatAttribute)0; // We'll be using FBOs instead of the default framebuffer.
attrs[9] = (CGLPixelFormatAttribute)requestedProfile;
}
else
{
fprintf(stderr, "%s: Your version of OS X is too old to support 3.2 Core Profile.\n", ctxString);
return result;
}
}
else if (isLionSupported)
{
attrs[9] = (CGLPixelFormatAttribute)kCGLOGLPVersion_Legacy;
}
else
{
attrs[8] = (CGLPixelFormatAttribute)kCGLPFAAccelerated;
attrs[9] = (CGLPixelFormatAttribute)kCGLPFANoRecovery;
attrs[11] = (CGLPixelFormatAttribute)0;
attrs[12] = (CGLPixelFormatAttribute)0;
}
CGLError error = kCGLNoError;
CGLPixelFormatObj cglPixFormat = NULL;
CGLContextObj newContext = NULL;
GLint virtualScreenCount = 0;
CGLChoosePixelFormat(attrs, &cglPixFormat, &virtualScreenCount);
if (cglPixFormat == NULL)
{
if (requestedProfile == kCGLOGLPVersion_GL4_Core)
{
// OpenGL 4.1 Core Profile requires hardware acceleration. Bail if we can't find a renderer that supports both.
fprintf(stderr, "%s: This system has no HW-accelerated renderers that support 4.1 Core Profile.\n", ctxString);
return result;
}
else if (requestedProfile == kCGLOGLPVersion_3_2_Core)
{
// OpenGL 3.2 Core Profile requires hardware acceleration. Bail if we can't find a renderer that supports both.
fprintf(stderr, "%s: This system has no HW-accelerated renderers that support 3.2 Core Profile.\n", ctxString);
return result;
}
// For Legacy OpenGL, we'll allow fallback to the Apple Software Renderer.
// However, doing this will result in a substantial performance loss.
if (attrs[8] == kCGLPFAAccelerated)
{
attrs[8] = (CGLPixelFormatAttribute)0;
attrs[9] = (CGLPixelFormatAttribute)0;
attrs[10] = (CGLPixelFormatAttribute)0;
}
else
{
attrs[10] = (CGLPixelFormatAttribute)0;
attrs[11] = (CGLPixelFormatAttribute)0;
attrs[12] = (CGLPixelFormatAttribute)0;
}
error = CGLChoosePixelFormat(attrs, &cglPixFormat, &virtualScreenCount);
if (error != kCGLNoError)
{
// We shouldn't fail at this point, but we're including this to account for all code paths.
fprintf(stderr, "%s: Failed to create the pixel format structure: %i\n", ctxString, (int)error);
return result;
}
else
{
printf("WARNING: No HW-accelerated renderers were found -- falling back to Apple Software Renderer.\n This will result in a substantial performance loss.");
}
}
// Create the OpenGL context using our pixel format, and then save the default assigned virtual screen.
error = CGLCreateContext(cglPixFormat, NULL, &newContext);
CGLReleasePixelFormat(cglPixFormat);
cglPixFormat = NULL;
if (error != kCGLNoError)
{
fprintf(stderr, "%s: Failed to create an OpenGL context: %i\n", ctxString, (int)error);
return result;
}
OSXOpenGLRendererContext = newContext;
GLint defaultVirtualScreen = 0;
CGLGetVirtualScreen(newContext, &defaultVirtualScreen);
// Retrieve the properties of every renderer available on the system.
CGLRendererInfoObj cglRendererInfo = NULL;
GLint rendererCount = 0;
CGLQueryRendererInfo(0xFFFFFFFF, &cglRendererInfo, &rendererCount);
HostRendererInfo *rendererInfo = (HostRendererInfo *)malloc(sizeof(HostRendererInfo) * rendererCount);
memset(rendererInfo, 0, sizeof(HostRendererInfo) * rendererCount);
if (isLeopardSupported)
{
for (GLint i = 0; i < rendererCount; i++)
{
HostRendererInfo &info = rendererInfo[i];
CGLDescribeRenderer(cglRendererInfo, i, kCGLRPOnline, &(info.online));
CGLDescribeRenderer(cglRendererInfo, i, kCGLRPDisplayMask, &(info.displayID));
info.displayID = (GLint)CGOpenGLDisplayMaskToDisplayID(info.displayID);
CGLDescribeRenderer(cglRendererInfo, i, kCGLRPAccelerated, &(info.accelerated));
CGLDescribeRenderer(cglRendererInfo, i, kCGLRPRendererID, &(info.rendererID));
if (isLionSupported)
{
CGLDescribeRenderer(cglRendererInfo, i, kCGLRPVideoMemoryMegabytes, &(info.videoMemoryMB));
CGLDescribeRenderer(cglRendererInfo, i, kCGLRPTextureMemoryMegabytes, &(info.textureMemoryMB));
}
else
{
CGLDescribeRenderer(cglRendererInfo, i, kCGLRPVideoMemory, &(info.videoMemoryMB));
info.videoMemoryMB = (GLint)(((uint32_t)info.videoMemoryMB + 1) >> 20);
CGLDescribeRenderer(cglRendererInfo, i, kCGLRPTextureMemory, &(info.textureMemoryMB));
info.textureMemoryMB = (GLint)(((uint32_t)info.textureMemoryMB + 1) >> 20);
}
if (isHighSierraSupported)
{
CGLDescribeRenderer(cglRendererInfo, i, kCGLRPRemovable, &(info.removable));
}
}
}
else
{
CGLDestroyRendererInfo(cglRendererInfo);
free(rendererInfo);
fprintf(stderr, "%s: Failed to retrieve renderer info - requires Mac OS X v10.5 or later.\n", ctxString);
return result;
}
CGLDestroyRendererInfo(cglRendererInfo);
cglRendererInfo = NULL;
// Retrieve the vendor and renderer info from OpenGL.
cgl_beginOpenGL();
for (GLint i = 0; i < virtualScreenCount; i++)
{
CGLSetVirtualScreen(newContext, i);
GLint r;
CGLGetParameter(newContext, kCGLCPCurrentRendererID, &r);
for (int j = 0; j < rendererCount; j++)
{
HostRendererInfo &info = rendererInfo[j];
if (r == info.rendererID)
{
info.virtualScreen = i;
info.vendorStr = (const char *)glGetString(GL_VENDOR);
if (info.vendorStr != NULL)
{
strncpy(info.vendor, (const char *)info.vendorStr, sizeof(info.vendor));
}
else if (info.accelerated == 0)
{
strncpy(info.vendor, "Apple Inc.", sizeof(info.vendor));
}
else
{
strncpy(info.vendor, "UNKNOWN", sizeof(info.vendor));
}
info.nameStr = (const char *)glGetString(GL_RENDERER);
if (info.nameStr != NULL)
{
strncpy(info.name, (const char *)info.nameStr, sizeof(info.name));
}
else if (info.accelerated == 0)
{
strncpy(info.name, "Apple Software Renderer", sizeof(info.name));
}
else
{
strncpy(info.name, "UNKNOWN", sizeof(info.name));
}
}
}
}
cgl_endOpenGL();
// Get the default virtual screen.
strncpy(__hostRendererString, "UNKNOWN", sizeof(__hostRendererString));
__hostRendererID = -1;
HostRendererInfo defaultRendererInfo = rendererInfo[0];
for (int i = 0; i < rendererCount; i++)
{
if (defaultVirtualScreen == rendererInfo[i].virtualScreen)
{
defaultRendererInfo = rendererInfo[i];
__hostRendererID = defaultRendererInfo.rendererID;
strncpy(__hostRendererString, (const char *)defaultRendererInfo.name, sizeof(__hostRendererString));
if ( (defaultRendererInfo.online == 1) && (defaultRendererInfo.vendorStr != NULL) && (defaultRendererInfo.nameStr != NULL) )
{
break;
}
}
}
printf("Default OpenGL Renderer: [0x%08X] %s\n", __hostRendererID, __hostRendererString);
/*
bool isDefaultRunningIntegratedGPU = false;
if ( (defaultRendererInfo.online == 1) && (defaultRendererInfo.vendorStr != NULL) && (defaultRendererInfo.nameStr != NULL) )
{
const HostRendererInfo &d = defaultRendererInfo;
isDefaultRunningIntegratedGPU = (strstr(d.name, "GMA 950") != NULL) ||
(strstr(d.name, "GMA X3100") != NULL) ||
(strstr(d.name, "GeForce 9400M") != NULL) ||
(strstr(d.name, "GeForce 320M") != NULL) ||
(strstr(d.name, "HD Graphics") != NULL) ||
(strstr(d.name, "Iris 5100") != NULL) ||
(strstr(d.name, "Iris Plus") != NULL) ||
(strstr(d.name, "Iris Pro") != NULL) ||
(strstr(d.name, "Iris Graphics") != NULL) ||
(strstr(d.name, "UHD Graphics") != NULL);
}
*/
#if defined(DEBUG) && (DEBUG == 1)
// Report information on every renderer.
if (!isLionSupported)
{
printf("WARNING: You are running a macOS version earlier than v10.7.\n Video Memory and Texture Memory reporting is capped\n at 2048 MB on older macOS.\n");
}
printf("CGL Renderer Count: %i\n", rendererCount);
printf(" Virtual Screen Count: %i\n\n", virtualScreenCount);
for (int i = 0; i < rendererCount; i++)
{
const HostRendererInfo &info = rendererInfo[i];
printf("Renderer Index: %i\n", i);
printf("Virtual Screen: %i\n", info.virtualScreen);
printf("Vendor: %s\n", info.vendor);
printf("Renderer: %s\n", info.name);
printf("Renderer ID: 0x%08X\n", info.rendererID);
printf("Accelerated: %s\n", (info.accelerated == 1) ? "YES" : "NO");
printf("Online: %s\n", (info.online == 1) ? "YES" : "NO");
if (isHighSierraSupported)
{
printf("Removable: %s\n", (info.removable == 1) ? "YES" : "NO");
}
else
{
printf("Removable: UNSUPPORTED, Requires High Sierra\n");
}
printf("Display ID: 0x%08X\n", info.displayID);
printf("Video Memory: %i MB\n", info.videoMemoryMB);
printf("Texture Memory: %i MB\n\n", info.textureMemoryMB);
}
#endif
// Search for a better virtual screen that will suit our offscreen rendering better.
//
// At the moment, we are not supporting removable renderers such as eGPUs. Attempting
// to support removable renderers would require a lot more code to handle dynamically
// changing display<-->renderer associations. - rogerman 2025/03/25
bool wasBetterVirtualScreenFound = false;
char *modelCString = NULL;
size_t modelStringLen = 0;
sysctlbyname("hw.model", NULL, &modelStringLen, NULL, 0);
if (modelStringLen > 0)
{
modelCString = (char *)malloc(modelStringLen * sizeof(char));
sysctlbyname("hw.model", modelCString, &modelStringLen, NULL, 0);
}
for (int i = 0; i < rendererCount; i++)
{
const HostRendererInfo &info = rendererInfo[i];
if ( (defaultRendererInfo.vendorStr == NULL) || (defaultRendererInfo.nameStr == NULL) || (info.vendorStr == NULL) || (info.nameStr == NULL) )
{
continue;
}
wasBetterVirtualScreenFound = (info.accelerated == 1) &&
( ( (modelCString != NULL) && (strstr((const char *)modelCString, "MacBookPro") != NULL) &&
( ( (strstr(defaultRendererInfo.name, "GeForce 9400M") != NULL) &&
(strstr(info.name, "GeForce 9600M GT") != NULL) ) ||
( (strstr(defaultRendererInfo.name, "HD Graphics") != NULL) &&
((strstr(info.name, "GeForce GT 330M") != NULL) ||
(strstr(info.name, "Radeon HD 6490M") != NULL) ||
(strstr(info.name, "Radeon HD 6750M") != NULL) ||
(strstr(info.name, "Radeon HD 6770M") != NULL) ||
(strstr(info.name, "GeForce GT 650M") != NULL) ||
(strstr(info.name, "Radeon Pro 450") != NULL) ||
(strstr(info.name, "Radeon Pro 455") != NULL) ||
(strstr(info.name, "Radeon Pro 555") != NULL) ||
(strstr(info.name, "Radeon Pro 560") != NULL)) ) ||
( (strstr(defaultRendererInfo.name, "Iris Pro") != NULL) &&
((strstr(info.name, "GeForce GT 750M") != NULL) ||
(strstr(info.name, "Radeon R9 M370X") != NULL)) ) ||
( (strstr(defaultRendererInfo.name, "UHD Graphics") != NULL) &&
((strstr(info.name, "Radeon Pro 555X") != NULL) ||
(strstr(info.name, "Radeon Pro 560X") != NULL) ||
(strstr(info.name, "Radeon Pro Vega 16") != NULL) ||
(strstr(info.name, "Radeon Pro Vega 20") != NULL) ||
(strstr(info.name, "Radeon Pro 5300M") != NULL) ||
(strstr(info.name, "Radeon Pro 5500M") != NULL) ||
(strstr(info.name, "Radeon Pro 5600M") != NULL)) ) ) ) ||
( (modelCString != NULL) && (strstr((const char *)modelCString, "MacPro6,1") != NULL) && (info.online == 0) &&
((strstr(info.name, "FirePro D300") != NULL) ||
(strstr(info.name, "FirePro D500") != NULL) ||
(strstr(info.name, "FirePro D700") != NULL)) ) );
if (wasBetterVirtualScreenFound)
{
CGLSetVirtualScreen(newContext, info.virtualScreen);
__hostRendererID = info.rendererID;
strncpy(__hostRendererString, (const char *)info.name, sizeof(__hostRendererString));
printf("Found Better OpenGL Renderer: [0x%08X] %s\n", __hostRendererID, __hostRendererString);
break;
}
}
// If we couldn't find a better virtual screen for our rendering, then just revert to the default one.
if (!wasBetterVirtualScreenFound)
{
CGLSetVirtualScreen(newContext, defaultVirtualScreen);
}
// We're done! Report success and return.
printf("%s: OpenGL context creation successful.\n\n", ctxString);
free(rendererInfo);
free(modelCString);
result = true;
return result;
}
bool cgl_initOpenGL_StandardAuto()
{
bool isContextCreated = __cgl_initOpenGL(kCGLOGLPVersion_GL4_Core);
if (!isContextCreated) if (!isContextCreated)
{ {
isContextCreated = __cgl_initOpenGL(kCGLOGLPVersion_3_2_Core); isContextCreated = CreateOpenGLRenderer();
}
if (!isContextCreated)
{
isContextCreated = __cgl_initOpenGL(kCGLOGLPVersion_Legacy);
} }
return isContextCreated; return isContextCreated;
} }
bool cgl_initOpenGL_LegacyAuto() bool OSXOpenGLRendererBegin()
{
return __cgl_initOpenGL(kCGLOGLPVersion_Legacy);
}
bool cgl_initOpenGL_3_2_CoreProfile()
{
return __cgl_initOpenGL(kCGLOGLPVersion_3_2_Core);
}
void cgl_deinitOpenGL()
{
if (OSXOpenGLRendererContext == NULL)
{
return;
}
CGLSetCurrentContext(NULL);
SILENCE_DEPRECATION_MACOS_10_7( CGLReleasePBuffer(OSXOpenGLRendererPBuffer) );
OSXOpenGLRendererPBuffer = NULL;
CGLReleaseContext(OSXOpenGLRendererContext);
OSXOpenGLRendererContext = NULL;
OSXOpenGLRendererContextPrev = NULL;
}
bool cgl_beginOpenGL()
{ {
OSXOpenGLRendererContextPrev = CGLGetCurrentContext(); OSXOpenGLRendererContextPrev = CGLGetCurrentContext();
CGLSetCurrentContext(OSXOpenGLRendererContext); CGLSetCurrentContext(OSXOpenGLRendererContext);
@ -2388,7 +1842,7 @@ bool cgl_beginOpenGL()
return true; return true;
} }
void cgl_endOpenGL() void OSXOpenGLRendererEnd()
{ {
#ifndef PORT_VERSION_OS_X_APP #ifndef PORT_VERSION_OS_X_APP
// The OpenEmu plug-in needs the context reset after 3D rendering since OpenEmu's context // The OpenEmu plug-in needs the context reset after 3D rendering since OpenEmu's context
@ -2399,7 +1853,7 @@ void cgl_endOpenGL()
#endif #endif
} }
bool cgl_framebufferDidResizeCallback(const bool isFBOSupported, size_t w, size_t h) bool OSXOpenGLRendererFramebufferDidResize(const bool isFBOSupported, size_t w, size_t h)
{ {
bool result = false; bool result = false;
@ -2417,7 +1871,7 @@ bool cgl_framebufferDidResizeCallback(const bool isFBOSupported, size_t w, size_
// Create a PBuffer if FBOs are not supported. // Create a PBuffer if FBOs are not supported.
SILENCE_DEPRECATION_MACOS_10_7( CGLPBufferObj newPBuffer = NULL ); SILENCE_DEPRECATION_MACOS_10_7( CGLPBufferObj newPBuffer = NULL );
SILENCE_DEPRECATION_MACOS_10_7( CGLError error = CGLCreatePBuffer((GLsizei)w, (GLsizei)h, GL_TEXTURE_2D, GL_RGBA, 0, &newPBuffer) ); SILENCE_DEPRECATION_MACOS_10_7( CGLError error = CGLCreatePBuffer(w, h, GL_TEXTURE_2D, GL_RGBA, 0, &newPBuffer) );
if ( (newPBuffer == NULL) || (error != kCGLNoError) ) if ( (newPBuffer == NULL) || (error != kCGLNoError) )
{ {
@ -2438,3 +1892,100 @@ bool cgl_framebufferDidResizeCallback(const bool isFBOSupported, size_t w, size_
result = true; result = true;
return result; return result;
} }
bool CreateOpenGLRenderer()
{
bool result = false;
bool useContext_3_2 = false;
CGLPixelFormatObj cglPixFormat = NULL;
CGLContextObj newContext = NULL;
GLint virtualScreenCount = 0;
CGLPixelFormatAttribute attrs[] = {
kCGLPFAColorSize, (CGLPixelFormatAttribute)24,
kCGLPFAAlphaSize, (CGLPixelFormatAttribute)8,
kCGLPFADepthSize, (CGLPixelFormatAttribute)24,
kCGLPFAStencilSize, (CGLPixelFormatAttribute)8,
kCGLPFAAccelerated,
(CGLPixelFormatAttribute)0, (CGLPixelFormatAttribute)0,
(CGLPixelFormatAttribute)0
};
// If we can support a 3.2 Core Profile context, then request that in our
// pixel format attributes.
#ifdef MAC_OS_X_VERSION_10_7
// As of 2021/09/03, testing has shown that macOS v10.7's OpenGL 3.2 shader
// compiler isn't very reliable, and so we're going to require macOS v10.8
// instead, which at least has a working shader compiler for OpenGL 3.2.
useContext_3_2 = IsOSXVersionSupported(10, 8, 0);
if (useContext_3_2)
{
attrs[9] = kCGLPFAOpenGLProfile;
attrs[10] = (CGLPixelFormatAttribute)kCGLOGLPVersion_3_2_Core;
}
#endif
CGLChoosePixelFormat(attrs, &cglPixFormat, &virtualScreenCount);
if (cglPixFormat == NULL)
{
// Remove the HW rendering requirement and try again. Note that this will
// result in SW rendering, which will cause a substantial speed hit.
attrs[8] = (CGLPixelFormatAttribute)0;
CGLChoosePixelFormat(attrs, &cglPixFormat, &virtualScreenCount);
if (cglPixFormat == NULL)
{
return result;
}
}
CGLCreateContext(cglPixFormat, NULL, &newContext);
CGLReleasePixelFormat(cglPixFormat);
RequestOpenGLRenderer_3_2(useContext_3_2);
OSXOpenGLRendererContext = newContext;
result = true;
return result;
}
void DestroyOpenGLRenderer()
{
if (OSXOpenGLRendererContext == NULL)
{
return;
}
OSXOpenGLRendererEnd();
SILENCE_DEPRECATION_MACOS_10_7( CGLReleasePBuffer(OSXOpenGLRendererPBuffer) );
OSXOpenGLRendererPBuffer = NULL;
CGLReleaseContext(OSXOpenGLRendererContext);
OSXOpenGLRendererContext = NULL;
OSXOpenGLRendererContextPrev = NULL;
}
void RequestOpenGLRenderer_3_2(bool request_3_2)
{
#ifdef OGLRENDER_3_2_H
if (request_3_2)
{
OGLLoadEntryPoints_3_2_Func = &OGLLoadEntryPoints_3_2;
OGLCreateRenderer_3_2_Func = &OGLCreateRenderer_3_2;
return;
}
#endif
OGLLoadEntryPoints_3_2_Func = NULL;
OGLCreateRenderer_3_2_Func = NULL;
}
void SetOpenGLRendererFunctions(bool (*initFunction)(),
bool (*beginOGLFunction)(),
void (*endOGLFunction)(),
bool (*resizeOGLFunction)(const bool isFBOSupported, size_t w, size_t h))
{
oglrender_init = initFunction;
oglrender_beginOpenGL = beginOGLFunction;
oglrender_endOpenGL = endOGLFunction;
oglrender_framebufferDidResizeCallback = resizeOGLFunction;
}

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2011-2023 DeSmuME team Copyright (C) 2011-2015 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -16,305 +16,37 @@
along with the this software. If not, see <http://www.gnu.org/licenses/>. along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <string>
#include <vector>
#include "../../cheatSystem.h"
#undef BOOL
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#undef BOOL
class CHEATS; class CHEATS;
class CHEATS_LIST; class CHEATS_LIST;
class CHEATSEARCH; class CHEATSEARCH;
class ClientCheatManager;
enum CheatType
{
CheatType_Internal = 0,
CheatType_ActionReplay = 1,
CheatType_CodeBreaker = 2
};
enum CheatFreezeType /********************************************************************************************
{ CocoaDSCheatItem - OBJECTIVE-C CLASS
CheatFreezeType_Normal = 0,
CheatFreezeType_CanDecrease = 1,
CheatFreezeType_CanIncrease = 2
};
enum CheatSearchStyle This is an Objective-C wrapper class for DeSmuME's cheat item struct.
{
CheatSearchStyle_ExactValue = 0, The cheat item data is not freed upon release of this object. This is by design.
CheatSearchStyle_Comparative = 1
};
enum CheatSearchCompareStyle
{
CheatSearchCompareStyle_GreaterThan = 0,
CheatSearchCompareStyle_LesserThan = 1,
CheatSearchCompareStyle_Equals = 2,
CheatSearchCompareStyle_NotEquals = 3
};
union DesmumeCheatSearchItem
{
uint64_t data;
struct
{
uint32_t address;
uint32_t value;
};
};
typedef union DesmumeCheatSearchItem DesmumeCheatSearchItem;
typedef std::vector<DesmumeCheatSearchItem> DesmumeCheatSearchResultsList;
struct InternalCheatParam
{
uint32_t address;
uint32_t value;
uint8_t valueLength;
};
typedef struct InternalCheatParam InternalCheatParam;
class ClientCheatItem
{
protected:
ClientCheatManager *_cheatManager;
bool _isEnabled;
bool _willAddFromDB;
CheatType _cheatType;
std::string _nameString;
std::string _commentString;
// Internal cheat type parameters
CheatFreezeType _freezeType;
char _addressString[10+1];
uint32_t _address;
uint32_t _value;
uint8_t _valueLength;
// Action Replay parameters
uint32_t _codeCount;
std::string _rawCodeString;
std::string _cleanCodeString;
void _ConvertInternalToActionReplay();
void _ConvertActionReplayToInternal();
public:
ClientCheatItem();
~ClientCheatItem();
void Init(const CHEATS_LIST &inCheatItem);
void Init(const ClientCheatItem &inCheatItem);
void SetCheatManager(ClientCheatManager *cheatManager);
ClientCheatManager* GetCheatManager() const;
void SetEnabled(bool theState);
bool IsEnabled() const;
void SetWillAddFromDB(bool theState);
bool WillAddFromDB() const;
CheatType GetType() const;
void SetType(CheatType requestedType);
bool IsSupportedType() const;
const char* GetName() const;
void SetName(const char *nameString);
const char* GetComments() const;
void SetComments(const char *commentString);
CheatFreezeType GetFreezeType() const;
void SetFreezeType(CheatFreezeType theFreezeType);
uint32_t GetAddress() const;
void SetAddress(uint32_t theAddress);
const char* GetAddressString() const;
const char* GetAddressSixDigitString() const;
void SetAddressSixDigitString(const char *sixDigitString);
uint32_t GetValue() const;
void SetValue(uint32_t theValue);
uint8_t GetValueLength() const;
void SetValueLength(uint8_t byteLength);
void SetRawCodeString(const char *rawString, const bool willSaveValidatedRawString);
const char* GetRawCodeString() const;
const char* GetCleanCodeString() const;
const std::string& GetCleanCodeCppString() const;
uint32_t GetCodeCount() const;
void ClientToDesmumeCheatItem(CHEATS_LIST *outCheatItem) const;
};
class ClientCheatList
{
private:
ClientCheatItem* __AddItem(const ClientCheatItem *srcItem, const bool willCopy, const bool allowDuplicates);
protected:
std::vector<ClientCheatItem *> *_list;
public:
ClientCheatList();
~ClientCheatList();
CheatSystemError LoadFromFile(const char *filePath);
CheatSystemError SaveToFile(const char *filePath);
bool IsItemDuplicate(const ClientCheatItem *srcItem);
ClientCheatItem* AddNew();
ClientCheatItem* AddNewItemCopy(const ClientCheatItem *srcItem);
ClientCheatItem* AddNewItemCopyNoDuplicate(const ClientCheatItem *srcItem);
ClientCheatItem* AddExistingItemNoDuplicate(const ClientCheatItem *srcItem);
bool Remove(ClientCheatItem *targetItem);
bool RemoveAtIndex(size_t index);
void RemoveAll();
bool Update(const ClientCheatItem &srcItem, ClientCheatItem *targetItem);
bool UpdateAtIndex(const ClientCheatItem &srcItem, size_t index);
size_t GetTotalCheatCount() const;
size_t GetActiveCheatCount() const;
std::vector<ClientCheatItem *>* GetCheatList() const;
size_t GetIndexOfItem(const ClientCheatItem *cheatItem) const;
ClientCheatItem* GetItemAtIndex(size_t index) const;
void ReplaceFromEngine(const CHEATS *engineCheatList);
void CopyListToEngine(const bool willApplyOnlyEnabledItems, CHEATS *engineCheatList);
};
class ClientCheatSearcher
{
protected:
CHEATSEARCH *_desmumeSearcher;
uint8_t _searchValueLength;
size_t _resultsCount;
bool _didSearchStart;
DesmumeCheatSearchResultsList _resultsList;
public:
ClientCheatSearcher();
~ClientCheatSearcher();
bool DidStart() const;
void Reset();
size_t SearchExactValue(uint32_t value, uint8_t valueLength, bool performSignedSearch);
size_t SearchComparative(CheatSearchCompareStyle compareStyle, uint8_t valueLength, bool performSignedSearch);
const DesmumeCheatSearchResultsList& RefreshResults();
const DesmumeCheatSearchResultsList& GetResults();
size_t GetResultCount() const;
};
class ClientCheatDatabase
{
protected:
ClientCheatList *_list;
std::string _title;
std::string _description;
std::string _lastFilePath;
public:
ClientCheatDatabase();
~ClientCheatDatabase();
ClientCheatList* GetList() const;
ClientCheatList* LoadFromFile(const char *dbFilePath);
const char* GetTitle() const;
const char* GetDescription() const;
};
class ClientCheatManager
{
protected:
ClientCheatList *_currentSessionList;
ClientCheatDatabase *_currentDatabase;
ClientCheatSearcher *_currentSearcher;
ClientCheatItem *_selectedItem;
size_t _selectedItemIndex;
uint32_t _untitledCount;
std::string _currentSessionLastFilePath;
std::vector<InternalCheatParam> _pendingInternalCheatWriteList;
bool _masterNeedsUpdate;
public:
ClientCheatManager();
virtual ~ClientCheatManager();
static CHEATS* GetMaster();
static void SetMaster(const CHEATS *masterCheats);
ClientCheatList* GetSessionList() const;
const char* GetSessionListLastFilePath() const;
virtual CheatSystemError SessionListLoadFromFile(const char *filePath);
virtual CheatSystemError SessionListSaveToFile(const char *filePath);
ClientCheatItem* SetSelectedItemByIndex(size_t index);
ClientCheatItem* NewItem();
ClientCheatItem* AddExistingItemNoDuplicate(const ClientCheatItem *theItem);
void RemoveItem(ClientCheatItem *theItem);
void RemoveItemAtIndex(size_t index);
void RemoveSelectedItem();
void ModifyItem(const ClientCheatItem *srcItem, ClientCheatItem *targetItem);
void ModifyItemAtIndex(const ClientCheatItem *srcItem, size_t index);
size_t GetTotalCheatCount() const;
size_t GetActiveCheatCount() const;
void LoadFromMaster();
void ApplyToMaster();
void MasterNeedsUpdate();
ClientCheatList* GetDatabaseList() const;
ClientCheatList* DatabaseListLoadFromFile(const char *dbFilePath);
const char* GetDatabaseTitle() const;
const char* GetDatabaseDescription() const;
bool SearchDidStart() const;
void SearchReset();
size_t SearchExactValue(uint32_t value, uint8_t valueLength, bool performSignedSearch);
size_t SearchComparative(CheatSearchCompareStyle compareStyle, uint8_t valueLength, bool performSignedSearch);
const DesmumeCheatSearchResultsList& SearchResultsRefresh();
const DesmumeCheatSearchResultsList& GetSearchResults();
size_t GetSearchResultCount() const;
void DirectWriteInternalCheatAtIndex(size_t index);
void DirectWriteInternalCheatItem(const ClientCheatItem *cheatItem);
void DirectWriteInternalCheat(uint32_t targetAddress, uint32_t newValue32, size_t newValueLength);
void ApplyPendingInternalCheatWrites();
};
Thread Safety:
Assume that all methods are not thread-safe. This was done for performance
reasons. The caller of this class' methods is expected to handle thread safety.
********************************************************************************************/
@interface CocoaDSCheatItem : NSObject @interface CocoaDSCheatItem : NSObject
{ {
ClientCheatItem *_internalData; CHEATS_LIST *data;
BOOL _didAllocateInternalData; CHEATS_LIST *internalData;
BOOL _disableWorkingCopyUpdate;
BOOL willAdd; BOOL willAdd;
pthread_mutex_t mutexData;
CocoaDSCheatItem *workingCopy; CocoaDSCheatItem *workingCopy;
CocoaDSCheatItem *parent; CocoaDSCheatItem *parent;
BOOL _isMemAddressAlreadyUpdating;
} }
@property (readonly, nonatomic, getter=clientData) ClientCheatItem *_internalData; @property (assign) CHEATS_LIST *data;
@property (assign) BOOL willAdd; @property (assign) BOOL willAdd;
@property (assign, nonatomic) BOOL enabled; @property (assign, nonatomic) BOOL enabled;
@property (assign, nonatomic) NSInteger cheatType; @property (assign, nonatomic) NSInteger cheatType;
@ -332,17 +64,17 @@ public:
@property (readonly) CocoaDSCheatItem *workingCopy; @property (readonly) CocoaDSCheatItem *workingCopy;
@property (assign) CocoaDSCheatItem *parent; @property (assign) CocoaDSCheatItem *parent;
- (id) initWithCocoaCheatItem:(CocoaDSCheatItem *)cdsCheatItem; - (id) initWithCheatData:(CHEATS_LIST *)cheatData;
- (id) initWithCheatItem:(ClientCheatItem *)cheatItem; - (BOOL) retainData;
- (id) initWithCheatData:(const CHEATS_LIST *)cheatData;
- (char *) descriptionCString; - (char *) descriptionCString;
- (void) update; - (void) update;
- (CocoaDSCheatItem *) createWorkingCopy; - (CocoaDSCheatItem *) createWorkingCopy;
- (void) destroyWorkingCopy; - (void) destroyWorkingCopy;
- (void) mergeFromWorkingCopy;
- (void) mergeToParent; - (void) mergeToParent;
- (void) setDataWithDictionary:(NSDictionary *)dataDict;
- (NSDictionary *) dataDictionary;
+ (void) setIconDirectory:(NSImage *)iconImage;
+ (NSImage *) iconDirectory;
+ (void) setIconInternalCheat:(NSImage *)iconImage; + (void) setIconInternalCheat:(NSImage *)iconImage;
+ (NSImage *) iconInternalCheat; + (NSImage *) iconInternalCheat;
+ (void) setIconActionReplay:(NSImage *)iconImage; + (void) setIconActionReplay:(NSImage *)iconImage;
@ -352,116 +84,92 @@ public:
@end @end
@interface CocoaDSCheatDBEntry : NSObject /********************************************************************************************
{ CocoaDSCheatManager - OBJECTIVE-C CLASS
CheatDBEntry *_dbEntry;
CocoaDSCheatDBEntry *parent;
NSMutableArray *child;
NSInteger willAdd;
NSString *codeString;
BOOL needSetMixedState;
}
@property (readonly, nonatomic) NSString *name; This is an Objective-C wrapper class for DeSmuME's cheat list class.
@property (readonly, nonatomic) NSString *comment;
@property (readonly, nonatomic) NSImage *icon;
@property (readonly, nonatomic) NSInteger entryCount;
@property (readonly, nonatomic) NSString *codeString;
@property (readonly, nonatomic) BOOL isDirectory;
@property (readonly, nonatomic) BOOL isCheatItem;
@property (assign) NSInteger willAdd;
@property (assign) BOOL needSetMixedState;
@property (assign) CocoaDSCheatDBEntry *parent;
@property (readonly, nonatomic) NSMutableArray *child;
- (id) initWithDBEntry:(const CheatDBEntry *)dbEntry;
- (ClientCheatItem *) newClientItem;
@end
@interface CocoaDSCheatDBGame : NSObject
{
CheatDBGame *_dbGame;
CocoaDSCheatDBEntry *entryRoot;
NSUInteger index;
}
@property (assign) NSUInteger index;
@property (readonly, nonatomic) NSString *title;
@property (readonly, nonatomic) NSString *serial;
@property (readonly, nonatomic) NSUInteger crc;
@property (readonly, nonatomic) NSString *crcString;
@property (readonly, nonatomic) NSInteger dataSize;
@property (readonly, nonatomic) NSString *dataSizeString;
@property (readonly, nonatomic) BOOL isDataLoaded;
@property (readonly, nonatomic) NSInteger cheatItemCount;
@property (readonly, nonatomic) CocoaDSCheatDBEntry *entryRoot;
- (id) initWithGameEntry:(const CheatDBGame *)gameEntry;
- (CocoaDSCheatDBEntry *) loadEntryDataFromFilePtr:(FILE *)fp isEncrypted:(BOOL)isEncrypted;
@end
@interface CocoaDSCheatDatabase : NSObject
{
CheatDBFile *_dbFile;
CheatDBGameList *_dbGameList;
NSMutableArray *gameList;
NSURL *lastFileURL;
}
@property (readonly) NSURL *lastFileURL;
@property (readonly, nonatomic) NSString *description;
@property (readonly, nonatomic) NSString *formatString;
@property (readonly, nonatomic) BOOL isEncrypted;
@property (readonly) NSMutableArray *gameList;
- (id) initWithFileURL:(NSURL *)fileURL error:(CheatSystemError *)errorCode;
- (CocoaDSCheatDBGame *) getGameEntryUsingCode:(const char *)gameCode crc:(NSUInteger)crc;
- (CocoaDSCheatDBEntry *) loadGameEntry:(CocoaDSCheatDBGame *)dbGame;
@end
Thread Safety:
All methods are thread-safe.
********************************************************************************************/
@interface CocoaDSCheatManager : NSObject @interface CocoaDSCheatManager : NSObject
{ {
ClientCheatManager *_internalCheatManager; CHEATS *listData;
NSMutableArray *sessionList; NSMutableArray *list;
NSMutableArray *searchResultsList;
pthread_rwlock_t *rwlockCoreExecute; pthread_rwlock_t *rwlockCoreExecute;
BOOL isUsingDummyRWlock;
NSUInteger untitledCount;
NSString *dbTitle;
NSString *dbDate;
} }
@property (readonly, nonatomic, getter=internalManager) ClientCheatManager *_internalCheatManager; @property (readonly) CHEATS *listData;
@property (readonly) NSMutableArray *sessionList; @property (readonly) NSMutableArray *list;
@property (readonly, nonatomic) NSString *currentGameCode; @property (assign) pthread_rwlock_t *rwlockCoreExecute;
@property (readonly, nonatomic) NSUInteger currentGameCRC; @property (assign) NSUInteger untitledCount;
@property (readonly, nonatomic) NSUInteger itemTotalCount; @property (copy) NSString *dbTitle;
@property (readonly, nonatomic) NSUInteger itemActiveCount; @property (copy) NSString *dbDate;
@property (readonly) NSMutableArray *searchResultsList;
@property (readonly, nonatomic) BOOL searchDidStart;
@property (readonly, nonatomic) NSUInteger searchCount;
@property (assign, nonatomic) pthread_rwlock_t *rwlockCoreExecute;
- (id) initWithFileURL:(NSURL *)fileURL; - (id) initWithFileURL:(NSURL *)fileURL;
- (id) initWithListData:(CHEATS *)cheatList;
- (id) initWithFileURL:(NSURL *)fileURL listData:(CHEATS *)cheatList;
- (CocoaDSCheatItem *) newItem; - (BOOL) add:(CocoaDSCheatItem *)cheatItem;
- (CocoaDSCheatItem *) addExistingItem:(ClientCheatItem *)cheatItem; - (void) remove:(CocoaDSCheatItem *)cheatItem;
- (CocoaDSCheatItem *) addExistingCocoaItem:(CocoaDSCheatItem *)cocoaCheatItem; - (BOOL) update:(CocoaDSCheatItem *)cheatItem;
- (void) remove:(CocoaDSCheatItem *)cocoaCheatItem;
- (void) removeAtIndex:(NSUInteger)itemIndex;
- (BOOL) update:(CocoaDSCheatItem *)cocoaCheatItem;
- (BOOL) save; - (BOOL) save;
- (void) directWriteInternalCheat:(CocoaDSCheatItem *)cocoaCheatItem; - (NSUInteger) activeCount;
- (void) loadFromMaster; - (NSMutableArray *) cheatListFromDatabase:(NSURL *)fileURL errorCode:(NSInteger *)error;
- (void) applyToMaster; - (void) applyInternalCheat:(CocoaDSCheatItem *)cheatItem;
- (NSUInteger) databaseAddSelectedInEntry:(CocoaDSCheatDBEntry *)theEntry; + (void) setMasterCheatList:(CocoaDSCheatManager *)cheatListManager;
+ (void) applyInternalCheatWithItem:(CocoaDSCheatItem *)cheatItem;
- (NSUInteger) runExactValueSearch:(NSInteger)value byteSize:(UInt8)byteSize signType:(NSInteger)signType; + (void) applyInternalCheatWithAddress:(UInt32)address value:(UInt32)value bytes:(NSUInteger)bytes;
- (NSUInteger) runComparativeSearch:(NSInteger)typeID byteSize:(UInt8)byteSize signType:(NSInteger)signType; + (NSMutableArray *) cheatListWithListObject:(CHEATS *)cheatList;
- (void) searchReset; + (NSMutableArray *) cheatListWithItemStructArray:(CHEATS_LIST *)cheatItemArray count:(NSUInteger)itemCount;
+ (NSMutableDictionary *) cheatItemWithType:(NSInteger)cheatTypeID description:(NSString *)description;
@end
@interface CocoaDSCheatSearch : NSObject
{
CHEATSEARCH *listData;
NSMutableArray *addressList;
pthread_rwlock_t *rwlockCoreExecute;
BOOL isUsingDummyRWlock;
NSUInteger searchCount;
}
@property (readonly) CHEATSEARCH *listData;
@property (readonly) NSMutableArray *addressList;
@property (assign) pthread_rwlock_t *rwlockCoreExecute;
@property (readonly) NSUInteger searchCount;
- (NSUInteger) runExactValueSearch:(NSInteger)value byteSize:(UInt8)byteSize signType:(NSInteger)signType;
- (void) runExactValueSearchOnThread:(id)object;
- (NSUInteger) runComparativeSearch:(NSInteger)typeID byteSize:(UInt8)byteSize signType:(NSInteger)signType;
- (void) runComparativeSearchOnThread:(id)object;
- (void) reset;
+ (NSMutableArray *) addressListWithListObject:(CHEATSEARCH *)addressList maxItems:(NSUInteger)maxItemCount;
@end
@interface CocoaDSCheatSearchParams : NSObject
{
NSInteger comparativeSearchType;
NSInteger value;
UInt8 byteSize;
NSInteger signType;
}
@property (assign) NSInteger comparativeSearchType;
@property (assign) NSInteger value;
@property (assign) UInt8 byteSize;
@property (assign) NSInteger signType;
@end @end

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,6 @@ class ClientExecutionControl;
@class CocoaDSFirmware; @class CocoaDSFirmware;
@class CocoaDSGPU; @class CocoaDSGPU;
@class CocoaDSOutput; @class CocoaDSOutput;
@class CocoaDSCheatManager;
typedef struct typedef struct
{ {
@ -49,7 +48,6 @@ typedef struct
CocoaDSController *cdsController; CocoaDSController *cdsController;
CocoaDSFirmware *cdsFirmware; CocoaDSFirmware *cdsFirmware;
CocoaDSGPU *cdsGPU; CocoaDSGPU *cdsGPU;
CocoaDSCheatManager *cdsCheatManager;
NSMutableArray *cdsOutputList; NSMutableArray *cdsOutputList;
pthread_t coreThread; pthread_t coreThread;
@ -74,7 +72,6 @@ typedef struct
@property (retain) CocoaDSFirmware *cdsFirmware; @property (retain) CocoaDSFirmware *cdsFirmware;
@property (readonly) CocoaDSController *cdsController; @property (readonly) CocoaDSController *cdsController;
@property (readonly) CocoaDSGPU *cdsGPU; @property (readonly) CocoaDSGPU *cdsGPU;
@property (readonly) CocoaDSCheatManager *cdsCheatManager;
@property (readonly) NSMutableArray *cdsOutputList; @property (readonly) NSMutableArray *cdsOutputList;
@property (assign) BOOL masterExecute; @property (assign) BOOL masterExecute;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2011-2023 DeSmuME team Copyright (C) 2011-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -20,7 +20,6 @@
#import "cocoa_input.h" #import "cocoa_input.h"
#import "cocoa_firmware.h" #import "cocoa_firmware.h"
#import "cocoa_GPU.h" #import "cocoa_GPU.h"
#import "cocoa_cheat.h"
#import "cocoa_globals.h" #import "cocoa_globals.h"
#import "cocoa_output.h" #import "cocoa_output.h"
#import "cocoa_rom.h" #import "cocoa_rom.h"
@ -49,7 +48,6 @@ volatile bool execute = true;
@synthesize cdsFirmware; @synthesize cdsFirmware;
@synthesize cdsController; @synthesize cdsController;
@synthesize cdsGPU; @synthesize cdsGPU;
@synthesize cdsCheatManager;
@synthesize cdsOutputList; @synthesize cdsOutputList;
@dynamic masterExecute; @dynamic masterExecute;
@ -124,7 +122,6 @@ volatile bool execute = true;
cdsFirmware = nil; cdsFirmware = nil;
cdsController = [[CocoaDSController alloc] init]; cdsController = [[CocoaDSController alloc] init];
cdsGPU = [[CocoaDSGPU alloc] init]; cdsGPU = [[CocoaDSGPU alloc] init];
cdsCheatManager = [[CocoaDSCheatManager alloc] init];
cdsOutputList = [[NSMutableArray alloc] initWithCapacity:32]; cdsOutputList = [[NSMutableArray alloc] initWithCapacity:32];
ClientInputHandler *inputHandler = [cdsController inputHandler]; ClientInputHandler *inputHandler = [cdsController inputHandler];
@ -167,11 +164,10 @@ volatile bool execute = true;
pthread_attr_destroy(&threadAttr); pthread_attr_destroy(&threadAttr);
[cdsGPU setOutputList:cdsOutputList rwlock:&threadParam.rwlockOutputList]; [cdsGPU setOutputList:cdsOutputList rwlock:&threadParam.rwlockOutputList];
[cdsCheatManager setRwlockCoreExecute:&threadParam.rwlockCoreExecute];
macOS_driver *newDriver = new macOS_driver; macOS_driver *newDriver = new macOS_driver;
newDriver->SetCoreThreadMutexLock(&threadParam.mutexThreadExecute); newDriver->SetCoreThreadMutexLock(&threadParam.mutexThreadExecute);
newDriver->SetCoreExecuteRWLock(&threadParam.rwlockCoreExecute); newDriver->SetCoreExecuteRWLock(self.rwlockCoreExecute);
newDriver->SetExecutionControl(execControl); newDriver->SetExecutionControl(execControl);
driver = newDriver; driver = newDriver;
@ -607,7 +603,7 @@ volatile bool execute = true;
execControl->SetExecutionBehavior((ExecutionBehavior)coreState); execControl->SetExecutionBehavior((ExecutionBehavior)coreState);
pthread_rwlock_rdlock(&threadParam.rwlockOutputList); pthread_rwlock_rdlock(&threadParam.rwlockOutputList);
char frameStatusCStr[64] = {0}; char frameStatusCStr[128] = {0};
switch ((ExecutionBehavior)coreState) switch ((ExecutionBehavior)coreState)
{ {
@ -618,7 +614,7 @@ volatile bool execute = true;
[cdsOutput setIdle:YES]; [cdsOutput setIdle:YES];
} }
snprintf(frameStatusCStr, sizeof(frameStatusCStr), "%llu", (unsigned long long)[self frameNumber]); sprintf(frameStatusCStr, "%llu", (unsigned long long)[self frameNumber]);
[_fpsTimer invalidate]; [_fpsTimer invalidate];
_fpsTimer = nil; _fpsTimer = nil;
@ -632,7 +628,7 @@ volatile bool execute = true;
[cdsOutput setIdle:NO]; [cdsOutput setIdle:NO];
} }
snprintf(frameStatusCStr, sizeof(frameStatusCStr), "%llu", (unsigned long long)[self frameNumber]); sprintf(frameStatusCStr, "%llu", (unsigned long long)[self frameNumber]);
[_fpsTimer invalidate]; [_fpsTimer invalidate];
_fpsTimer = nil; _fpsTimer = nil;
@ -646,7 +642,7 @@ volatile bool execute = true;
[cdsOutput setIdle:NO]; [cdsOutput setIdle:NO];
} }
snprintf(frameStatusCStr, sizeof(frameStatusCStr), "%s", "Executing..."); sprintf(frameStatusCStr, "%s", "Executing...");
if (_fpsTimer == nil) if (_fpsTimer == nil)
{ {
@ -672,7 +668,7 @@ volatile bool execute = true;
} }
} }
snprintf(frameStatusCStr, sizeof(frameStatusCStr), "Jumping to frame %llu.", (unsigned long long)execControl->GetFrameJumpTarget()); sprintf(frameStatusCStr, "Jumping to frame %llu.", (unsigned long long)execControl->GetFrameJumpTarget());
[_fpsTimer invalidate]; [_fpsTimer invalidate];
_fpsTimer = nil; _fpsTimer = nil;
@ -728,42 +724,50 @@ volatile bool execute = true;
- (void) setArm9ImageURL:(NSURL *)fileURL - (void) setArm9ImageURL:(NSURL *)fileURL
{ {
execControl->SetARM9ImagePath([CocoaDSUtil cPathFromFileURL:fileURL]); const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
execControl->SetARM9ImagePath(filePath);
} }
- (NSURL *) arm9ImageURL - (NSURL *) arm9ImageURL
{ {
return [CocoaDSUtil fileURLFromCPath:execControl->GetARM9ImagePath()]; const char *filePath = execControl->GetARM9ImagePath();
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
} }
- (void) setArm7ImageURL:(NSURL *)fileURL - (void) setArm7ImageURL:(NSURL *)fileURL
{ {
execControl->SetARM7ImagePath([CocoaDSUtil cPathFromFileURL:fileURL]); const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
execControl->SetARM7ImagePath(filePath);
} }
- (NSURL *) arm7ImageURL - (NSURL *) arm7ImageURL
{ {
return [CocoaDSUtil fileURLFromCPath:execControl->GetARM7ImagePath()]; const char *filePath = execControl->GetARM7ImagePath();
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
} }
- (void) setFirmwareImageURL:(NSURL *)fileURL - (void) setFirmwareImageURL:(NSURL *)fileURL
{ {
execControl->SetFirmwareImagePath([CocoaDSUtil cPathFromFileURL:fileURL]); const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
execControl->SetFirmwareImagePath(filePath);
} }
- (NSURL *) firmwareImageURL - (NSURL *) firmwareImageURL
{ {
return [CocoaDSUtil fileURLFromCPath:execControl->GetFirmwareImagePath()]; const char *filePath = execControl->GetFirmwareImagePath();
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
} }
- (void) setSlot1R4URL:(NSURL *)fileURL - (void) setSlot1R4URL:(NSURL *)fileURL
{ {
execControl->SetSlot1R4Path([CocoaDSUtil cPathFromFileURL:fileURL]); const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
execControl->SetSlot1R4Path(filePath);
} }
- (NSURL *) slot1R4URL - (NSURL *) slot1R4URL
{ {
return [CocoaDSUtil fileURLFromCPath:execControl->GetSlot1R4Path()]; const char *filePath = execControl->GetSlot1R4Path();
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
} }
- (void) updateFirmwareMACAddressString - (void) updateFirmwareMACAddressString
@ -992,9 +996,8 @@ volatile bool execute = true;
return NO; return NO;
} }
const char *cSramPath = [CocoaDSUtil cPathFromFileURL:sramURL]; std::string sramPath = (sramURL != nil) ? [[sramURL path] cStringUsingEncoding:NSUTF8StringEncoding] : "";
std::string sramPath = (cSramPath != NULL) ? std::string(cSramPath) : ""; const char *fileName = [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding];
const char *fileName = [CocoaDSUtil cPathFromFileURL:fileURL];
NSDateFormatter *df = [[NSDateFormatter alloc] init]; NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"Y M d H m s SSS"]; [df setDateFormat:@"Y M d H m s SSS"];
@ -1152,7 +1155,6 @@ static void* RunCoreThread(void *arg)
CoreThreadParam *param = (CoreThreadParam *)arg; CoreThreadParam *param = (CoreThreadParam *)arg;
CocoaDSCore *cdsCore = (CocoaDSCore *)param->cdsCore; CocoaDSCore *cdsCore = (CocoaDSCore *)param->cdsCore;
CocoaDSGPU *cdsGPU = [cdsCore cdsGPU]; CocoaDSGPU *cdsGPU = [cdsCore cdsGPU];
ClientCheatManager *cheatManager = [[cdsCore cdsCheatManager] internalManager];
ClientExecutionControl *execControl = [cdsCore execControl]; ClientExecutionControl *execControl = [cdsCore execControl];
ClientInputHandler *inputHandler = execControl->GetClientInputHandler(); ClientInputHandler *inputHandler = execControl->GetClientInputHandler();
NSMutableArray *cdsOutputList = [cdsCore cdsOutputList]; NSMutableArray *cdsOutputList = [cdsCore cdsOutputList];
@ -1233,8 +1235,6 @@ static void* RunCoreThread(void *arg)
// Execute the frame and increment the frame counter. // Execute the frame and increment the frame counter.
pthread_rwlock_wrlock(&param->rwlockCoreExecute); pthread_rwlock_wrlock(&param->rwlockCoreExecute);
cheatManager->ApplyToMaster();
cheatManager->ApplyPendingInternalCheatWrites();
NDS_exec<false>(); NDS_exec<false>();
SPU_Emulate_user(); SPU_Emulate_user();
execControl->FetchOutputPostNDSExec(); execControl->FetchOutputPostNDSExec();

View File

@ -142,7 +142,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
return result; return result;
} }
const char *statePath = [CocoaDSUtil cPathFromFileURL:saveStateURL]; const char *statePath = [[saveStateURL path] cStringUsingEncoding:NSUTF8StringEncoding];
bool cResult = savestate_load(statePath); bool cResult = savestate_load(statePath);
if(cResult) if(cResult)
{ {
@ -161,7 +161,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
return result; return result;
} }
const char *statePath = [CocoaDSUtil cPathFromFileURL:saveStateURL]; const char *statePath = [[saveStateURL path] cStringUsingEncoding:NSUTF8StringEncoding];
bool cResult = savestate_save(statePath); bool cResult = savestate_save(statePath);
if(cResult) if(cResult)
{ {
@ -180,7 +180,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
return result; return result;
} }
const char *romPath = [CocoaDSUtil cPathFromFileURL:romURL]; const char *romPath = [[romURL path] cStringUsingEncoding:NSUTF8StringEncoding];
NSInteger resultCode = NDS_LoadROM(romPath, NULL, NULL); NSInteger resultCode = NDS_LoadROM(romPath, NULL, NULL);
if (resultCode > 0) if (resultCode > 0)
{ {
@ -199,7 +199,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
return result; return result;
} }
const char *replayPath = [CocoaDSUtil cPathFromFileURL:replayURL]; const char *replayPath = [[replayURL path] cStringUsingEncoding:NSUTF8StringEncoding];
const char *resultCode = FCEUI_LoadMovie(replayPath, true, false, -1); const char *resultCode = FCEUI_LoadMovie(replayPath, true, false, -1);
if (resultCode == NULL) if (resultCode == NULL)
{ {
@ -212,7 +212,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
+ (BOOL) importRomSave:(NSURL *)romSaveURL + (BOOL) importRomSave:(NSURL *)romSaveURL
{ {
BOOL result = NO; BOOL result = NO;
const char *romSavePath = [CocoaDSUtil cPathFromFileURL:romSaveURL]; const char *romSavePath = [[romSaveURL path] cStringUsingEncoding:NSUTF8StringEncoding];
NSInteger resultCode = MMU_new.backupDevice.importData(romSavePath, 0); NSInteger resultCode = MMU_new.backupDevice.importData(romSavePath, 0);
if (resultCode == 0) if (resultCode == 0)
@ -243,7 +243,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
#endif #endif
case ROMSAVEFORMAT_NOGBA: case ROMSAVEFORMAT_NOGBA:
{ {
const char *destinationPath = [CocoaDSUtil cPathFromFilePath:[[destinationURL path] stringByAppendingPathExtension:@FILE_EXT_ROM_SAVE_NOGBA]]; const char *destinationPath = [[[destinationURL path] stringByAppendingPathExtension:@FILE_EXT_ROM_SAVE_NOGBA] cStringUsingEncoding:NSUTF8StringEncoding];
bool resultCode = MMU_new.backupDevice.exportData(destinationPath); bool resultCode = MMU_new.backupDevice.exportData(destinationPath);
if (resultCode) if (resultCode)
{ {
@ -254,7 +254,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
case ROMSAVEFORMAT_RAW: case ROMSAVEFORMAT_RAW:
{ {
const char *destinationPath = [CocoaDSUtil cPathFromFilePath:[[destinationURL path] stringByAppendingPathExtension:@FILE_EXT_ROM_SAVE_RAW]]; const char *destinationPath = [[[destinationURL path] stringByAppendingPathExtension:@FILE_EXT_ROM_SAVE_RAW] cStringUsingEncoding:NSUTF8StringEncoding];
bool resultCode = MMU_new.backupDevice.exportData(destinationPath); bool resultCode = MMU_new.backupDevice.exportData(destinationPath);
if (resultCode) if (resultCode)
{ {
@ -358,55 +358,55 @@ static NSMutableDictionary *_gURLDictionary = nil;
NSURL *romURL = [CocoaDSFile directoryURLByKind:@"ROM" version:versionString port:portString]; NSURL *romURL = [CocoaDSFile directoryURLByKind:@"ROM" version:versionString port:portString];
if (romURL != nil) if (romURL != nil)
{ {
strlcpy(path.pathToRoms, [CocoaDSUtil cPathFromFileURL:romURL], MAX_PATH); strlcpy(path.pathToRoms, [[romURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *romSaveURL = [CocoaDSFile directoryURLByKind:@"ROM Save" version:versionString port:portString]; NSURL *romSaveURL = [CocoaDSFile directoryURLByKind:@"ROM Save" version:versionString port:portString];
if (romSaveURL != nil) if (romSaveURL != nil)
{ {
strlcpy(path.pathToBattery, [CocoaDSUtil cPathFromFileURL:romSaveURL], MAX_PATH); strlcpy(path.pathToBattery, [[romSaveURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *saveStateURL = [CocoaDSFile directoryURLByKind:@"Save State" version:versionString port:portString]; NSURL *saveStateURL = [CocoaDSFile directoryURLByKind:@"Save State" version:versionString port:portString];
if (saveStateURL != nil) if (saveStateURL != nil)
{ {
strlcpy(path.pathToStates, [CocoaDSUtil cPathFromFileURL:saveStateURL], MAX_PATH); strlcpy(path.pathToStates, [[saveStateURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *screenshotURL = [CocoaDSFile directoryURLByKind:@"Screenshot" version:versionString port:portString]; NSURL *screenshotURL = [CocoaDSFile directoryURLByKind:@"Screenshot" version:versionString port:portString];
if (screenshotURL != nil) if (screenshotURL != nil)
{ {
strlcpy(path.pathToScreenshots, [CocoaDSUtil cPathFromFileURL:screenshotURL], MAX_PATH); strlcpy(path.pathToScreenshots, [[screenshotURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *aviURL = [CocoaDSFile directoryURLByKind:@"Video" version:versionString port:portString]; NSURL *aviURL = [CocoaDSFile directoryURLByKind:@"Video" version:versionString port:portString];
if (aviURL != nil) if (aviURL != nil)
{ {
strlcpy(path.pathToAviFiles, [CocoaDSUtil cPathFromFileURL:aviURL], MAX_PATH); strlcpy(path.pathToAviFiles, [[aviURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *cheatURL = [CocoaDSFile directoryURLByKind:@"Cheat" version:versionString port:portString]; NSURL *cheatURL = [CocoaDSFile directoryURLByKind:@"Cheat" version:versionString port:portString];
if (cheatURL != nil) if (cheatURL != nil)
{ {
strlcpy(path.pathToCheats, [CocoaDSUtil cPathFromFileURL:cheatURL], MAX_PATH); strlcpy(path.pathToCheats, [[cheatURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *soundSamplesURL = [CocoaDSFile directoryURLByKind:@"Sound Sample" version:versionString port:portString]; NSURL *soundSamplesURL = [CocoaDSFile directoryURLByKind:@"Sound Sample" version:versionString port:portString];
if (soundSamplesURL != nil) if (soundSamplesURL != nil)
{ {
strlcpy(path.pathToSounds, [CocoaDSUtil cPathFromFileURL:soundSamplesURL], MAX_PATH); strlcpy(path.pathToSounds, [[soundSamplesURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *firmwareURL = [CocoaDSFile directoryURLByKind:@"Firmware Configuration" version:versionString port:portString]; NSURL *firmwareURL = [CocoaDSFile directoryURLByKind:@"Firmware Configuration" version:versionString port:portString];
if (firmwareURL != nil) if (firmwareURL != nil)
{ {
strlcpy(path.pathToFirmware, [CocoaDSUtil cPathFromFileURL:firmwareURL], MAX_PATH); strlcpy(path.pathToFirmware, [[firmwareURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *luaURL = [CocoaDSFile directoryURLByKind:@"Lua Script" version:versionString port:portString]; NSURL *luaURL = [CocoaDSFile directoryURLByKind:@"Lua Script" version:versionString port:portString];
if (luaURL != nil) if (luaURL != nil)
{ {
strlcpy(path.pathToLua, [CocoaDSUtil cPathFromFileURL:luaURL], MAX_PATH); strlcpy(path.pathToLua, [[luaURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
} }
@ -438,55 +438,55 @@ static NSMutableDictionary *_gURLDictionary = nil;
NSURL *romURL = (NSURL *)[URLDictionary valueForKey:@"ROM"]; NSURL *romURL = (NSURL *)[URLDictionary valueForKey:@"ROM"];
if (romURL != nil) if (romURL != nil)
{ {
strlcpy(path.pathToRoms, [CocoaDSUtil cPathFromFileURL:romURL], MAX_PATH); strlcpy(path.pathToRoms, [[romURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *romSaveURL = (NSURL *)[URLDictionary valueForKey:@"ROM Save"]; NSURL *romSaveURL = (NSURL *)[URLDictionary valueForKey:@"ROM Save"];
if (romSaveURL != nil) if (romSaveURL != nil)
{ {
strlcpy(path.pathToBattery, [CocoaDSUtil cPathFromFileURL:romSaveURL], MAX_PATH); strlcpy(path.pathToBattery, [[romSaveURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *saveStateURL = (NSURL *)[URLDictionary valueForKey:@"Save State"]; NSURL *saveStateURL = (NSURL *)[URLDictionary valueForKey:@"Save State"];
if (saveStateURL != nil) if (saveStateURL != nil)
{ {
strlcpy(path.pathToStates, [CocoaDSUtil cPathFromFileURL:saveStateURL], MAX_PATH); strlcpy(path.pathToStates, [[saveStateURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *screenshotURL = (NSURL *)[URLDictionary valueForKey:@"Screenshot"]; NSURL *screenshotURL = (NSURL *)[URLDictionary valueForKey:@"Screenshot"];
if (screenshotURL != nil) if (screenshotURL != nil)
{ {
strlcpy(path.pathToScreenshots, [CocoaDSUtil cPathFromFileURL:screenshotURL], MAX_PATH); strlcpy(path.pathToScreenshots, [[screenshotURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *aviURL = (NSURL *)[URLDictionary valueForKey:@"Video"]; NSURL *aviURL = (NSURL *)[URLDictionary valueForKey:@"Video"];
if (aviURL != nil) if (aviURL != nil)
{ {
strlcpy(path.pathToAviFiles, [CocoaDSUtil cPathFromFileURL:aviURL], MAX_PATH); strlcpy(path.pathToAviFiles, [[aviURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *cheatURL = (NSURL *)[URLDictionary valueForKey:@"Cheat"]; NSURL *cheatURL = (NSURL *)[URLDictionary valueForKey:@"Cheat"];
if (cheatURL != nil) if (cheatURL != nil)
{ {
strlcpy(path.pathToCheats, [CocoaDSUtil cPathFromFileURL:cheatURL], MAX_PATH); strlcpy(path.pathToCheats, [[cheatURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *soundSamplesURL = (NSURL *)[URLDictionary valueForKey:@"Sound Sample"]; NSURL *soundSamplesURL = (NSURL *)[URLDictionary valueForKey:@"Sound Sample"];
if (soundSamplesURL != nil) if (soundSamplesURL != nil)
{ {
strlcpy(path.pathToSounds, [CocoaDSUtil cPathFromFileURL:soundSamplesURL], MAX_PATH); strlcpy(path.pathToSounds, [[soundSamplesURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *firmwareURL = (NSURL *)[URLDictionary valueForKey:@"Firmware Configuration"]; NSURL *firmwareURL = (NSURL *)[URLDictionary valueForKey:@"Firmware Configuration"];
if (firmwareURL != nil) if (firmwareURL != nil)
{ {
strlcpy(path.pathToFirmware, [CocoaDSUtil cPathFromFileURL:firmwareURL], MAX_PATH); strlcpy(path.pathToFirmware, [[firmwareURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
NSURL *luaURL = (NSURL *)[URLDictionary valueForKey:@"Lua Script"]; NSURL *luaURL = (NSURL *)[URLDictionary valueForKey:@"Lua Script"];
if (luaURL != nil) if (luaURL != nil)
{ {
strlcpy(path.pathToLua, [CocoaDSUtil cPathFromFileURL:luaURL], MAX_PATH); strlcpy(path.pathToLua, [[luaURL path] cStringUsingEncoding:NSUTF8StringEncoding], MAX_PATH);
} }
} }
@ -738,14 +738,6 @@ static NSMutableDictionary *_gURLDictionary = nil;
portStr = @"Cocoa"; portStr = @"Cocoa";
} }
versionURL = [CocoaDSFile userAppSupportURL:nil version:@"0.9.14"];
versionPath = [versionURL path];
if (versionPath != nil && [[[filePath stringByDeletingLastPathComponent] stringByDeletingLastPathComponent] isEqualToString:versionPath])
{
versionStr = @"0.9.14";
portStr = @"Cocoa";
}
fileVersion = [[versionStr stringByAppendingString:@" "] stringByAppendingString:portStr]; fileVersion = [[versionStr stringByAppendingString:@" "] stringByAppendingString:portStr];
return fileVersion; return fileVersion;

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2023 DeSmuME team Copyright (C) 2012-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -990,7 +990,7 @@ FirmwareConfigInterface::FirmwareConfigInterface()
_internalData = (FirmwareConfig *)malloc(sizeof(FirmwareConfig)); _internalData = (FirmwareConfig *)malloc(sizeof(FirmwareConfig));
NDS_GetDefaultFirmwareConfig(*_internalData); NDS_GetDefaultFirmwareConfig(*_internalData);
srand((uint32_t)time(NULL)); srand(time(NULL));
// Generate a random firmware MAC address and its associated string. // Generate a random firmware MAC address and its associated string.
const uint32_t defaultFirmwareMACAddressValue = (uint32_t)_internalData->MACAddress[2] | ((uint32_t)_internalData->MACAddress[3] << 8) | ((uint32_t)_internalData->MACAddress[4] << 16) | ((uint32_t)_internalData->MACAddress[5] << 24); const uint32_t defaultFirmwareMACAddressValue = (uint32_t)_internalData->MACAddress[2] | ((uint32_t)_internalData->MACAddress[3] << 8) | ((uint32_t)_internalData->MACAddress[4] << 16) | ((uint32_t)_internalData->MACAddress[5] << 24);

View File

@ -1,6 +1,6 @@
/* /*
Copyright (C) 2011 Roger Manuel Copyright (C) 2011 Roger Manuel
Copyright (C) 2012-2023 DeSmuME Team Copyright (C) 2012-2022 DeSmuME Team
This file is free software: you can redistribute it and/or modify This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -30,7 +30,7 @@
#define NSSTRING_TITLE_EXPORT_ROM_SAVE_PANEL NSLocalizedString(@"Export ROM Save File", nil) #define NSSTRING_TITLE_EXPORT_ROM_SAVE_PANEL NSLocalizedString(@"Export ROM Save File", nil)
#define NSSTRING_TITLE_SELECT_ROM_PANEL NSLocalizedString(@"Select ROM", nil) #define NSSTRING_TITLE_SELECT_ROM_PANEL NSLocalizedString(@"Select ROM", nil)
#define NSSTRING_TITLE_SELECT_ADVANSCENE_DB_PANEL NSLocalizedString(@"Select ADVANsCEne Database", nil) #define NSSTRING_TITLE_SELECT_ADVANSCENE_DB_PANEL NSLocalizedString(@"Select ADVANsCEne Database", nil)
#define NSSTRING_TITLE_OPEN_CHEAT_DB_PANEL NSLocalizedString(@"Open Cheat Database", nil) #define NSSTRING_TITLE_SELECT_R4_CHEAT_DB_PANEL NSLocalizedString(@"Select R4 Cheat Database", nil)
#define NSSTRING_TITLE_SELECT_ARM7_IMAGE_PANEL NSLocalizedString(@"Select ARM7 BIOS Image", nil) #define NSSTRING_TITLE_SELECT_ARM7_IMAGE_PANEL NSLocalizedString(@"Select ARM7 BIOS Image", nil)
#define NSSTRING_TITLE_SELECT_ARM9_IMAGE_PANEL NSLocalizedString(@"Select ARM9 BIOS Image", nil) #define NSSTRING_TITLE_SELECT_ARM9_IMAGE_PANEL NSLocalizedString(@"Select ARM9 BIOS Image", nil)
#define NSSTRING_TITLE_SELECT_FIRMWARE_IMAGE_PANEL NSLocalizedString(@"Select Firmware Image", nil) #define NSSTRING_TITLE_SELECT_FIRMWARE_IMAGE_PANEL NSLocalizedString(@"Select Firmware Image", nil)
@ -46,8 +46,8 @@
#define NSSTRING_TITLE_ENABLE_SPEED_LIMIT NSLocalizedString(@"Enable Speed Limit", nil) #define NSSTRING_TITLE_ENABLE_SPEED_LIMIT NSLocalizedString(@"Enable Speed Limit", nil)
#define NSSTRING_TITLE_DISABLE_AUTO_FRAME_SKIP NSLocalizedString(@"Disable Auto Frame Skip", nil) #define NSSTRING_TITLE_DISABLE_AUTO_FRAME_SKIP NSLocalizedString(@"Disable Auto Frame Skip", nil)
#define NSSTRING_TITLE_ENABLE_AUTO_FRAME_SKIP NSLocalizedString(@"Enable Auto Frame Skip", nil) #define NSSTRING_TITLE_ENABLE_AUTO_FRAME_SKIP NSLocalizedString(@"Enable Auto Frame Skip", nil)
#define NSSTRING_TITLE_DISABLE_CHEATS NSLocalizedString(@"Disable Cheat System", nil) #define NSSTRING_TITLE_DISABLE_CHEATS NSLocalizedString(@"Disable Cheats", nil)
#define NSSTRING_TITLE_ENABLE_CHEATS NSLocalizedString(@"Enable Cheat System", nil) #define NSSTRING_TITLE_ENABLE_CHEATS NSLocalizedString(@"Enable Cheats", nil)
#define NSSTRING_TITLE_DISABLE_HUD NSLocalizedString(@"Disable HUD", nil) #define NSSTRING_TITLE_DISABLE_HUD NSLocalizedString(@"Disable HUD", nil)
#define NSSTRING_TITLE_ENABLE_HUD NSLocalizedString(@"Enable HUD", nil) #define NSSTRING_TITLE_ENABLE_HUD NSLocalizedString(@"Enable HUD", nil)
#define NSSTRING_TITLE_EXIT_FULL_SCREEN NSLocalizedString(@"Exit Full Screen", nil) #define NSSTRING_TITLE_EXIT_FULL_SCREEN NSLocalizedString(@"Exit Full Screen", nil)
@ -303,12 +303,41 @@ enum
SPU_SYNC_METHOD_P = 2 SPU_SYNC_METHOD_P = 2
}; };
enum
{
CHEAT_TYPE_INTERNAL = 0,
CHEAT_TYPE_ACTION_REPLAY = 1,
CHEAT_TYPE_CODE_BREAKER = 2
};
enum
{
CHEATSEARCH_SEARCHSTYLE_EXACT_VALUE = 0,
CHEATSEARCH_SEARCHSTYLE_COMPARATIVE = 1
};
enum
{
CHEATSEARCH_COMPARETYPE_GREATER_THAN = 0,
CHEATSEARCH_COMPARETYPE_LESSER_THAN = 1,
CHEATSEARCH_COMPARETYPE_EQUALS_TO = 2,
CHEATSEARCH_COMPARETYPE_NOT_EQUALS_TO = 3
};
enum enum
{ {
CHEATSEARCH_UNSIGNED = 0, CHEATSEARCH_UNSIGNED = 0,
CHEATSEARCH_SIGNED = 1 CHEATSEARCH_SIGNED = 1
}; };
enum
{
CHEATEXPORT_ERROR_FILE_NOT_FOUND = 1,
CHEATEXPORT_ERROR_WRONG_FILE_FORMAT = 2,
CHEATEXPORT_ERROR_SERIAL_NOT_FOUND = 3,
CHEATEXPORT_ERROR_EXPORT_FAILED = 4
};
/* /*
PORT MESSAGES PORT MESSAGES
*/ */

View File

@ -97,7 +97,7 @@ private:
public: public:
MacInputHandler(); MacInputHandler();
virtual ~MacInputHandler(); ~MacInputHandler();
CocoaDSController* GetCocoaController(); CocoaDSController* GetCocoaController();
void SetCocoaController(CocoaDSController *theController); void SetCocoaController(CocoaDSController *theController);

Some files were not shown because too many files have changed in this diff Show More