Compare commits
No commits in common. "master" and "release_0_9_13" have entirely different histories.
master
...
release_0_
|
@ -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.
|
||||
|
||||
|
|
@ -7,11 +7,11 @@ on:
|
|||
jobs:
|
||||
build:
|
||||
name: Build DeSmuME (Linux)
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: install dependencies
|
||||
run: sudo apt update && sudo apt install meson libsdl2-dev libpcap-dev libgtk-3-dev
|
||||
|
@ -24,43 +24,13 @@ jobs:
|
|||
- name: ninja
|
||||
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_macos:
|
||||
name: Build DeSmuME (macOS)
|
||||
runs-on: macos-14
|
||||
runs-on: macOS-11
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: xcodebuild
|
||||
run: |
|
||||
|
@ -73,7 +43,7 @@ jobs:
|
|||
7z a DeSmuME.app.zip DeSmuME.app
|
||||
|
||||
- name: Upload artifict
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: macos
|
||||
path: desmume/src/frontend/cocoa/desmume.xcarchive/Products/Applications/DeSmuME.app.zip
|
||||
|
|
|
@ -6,11 +6,11 @@ on:
|
|||
|
||||
jobs:
|
||||
build_linux:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-20.04
|
||||
name: Build Linux
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: sudo apt update && sudo apt install meson libsdl2-dev libpcap-dev
|
||||
|
@ -23,21 +23,21 @@ jobs:
|
|||
- name: Build - ninja
|
||||
run: ninja -C desmume/src/frontend/interface/build
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
- name: Upload artificat
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: linux
|
||||
path: desmume/src/frontend/interface/build/libdesmume.so
|
||||
|
||||
build_macos:
|
||||
runs-on: macos-14
|
||||
runs-on: macos-10.15
|
||||
name: Build MacOS
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install MacOS build deps
|
||||
run: brew install coreutils sdl2 meson
|
||||
run: brew install coreutils gcc sdl2 meson glib
|
||||
|
||||
- name: Build - Meson
|
||||
run: |
|
||||
|
@ -53,14 +53,14 @@ jobs:
|
|||
CC: clang
|
||||
CXX: clang++
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
- name: Upload artificat
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: macos
|
||||
path: desmume/src/frontend/interface/build/libdesmume.dylib
|
||||
|
||||
build_windows:
|
||||
runs-on: windows-2022
|
||||
runs-on: windows-2019
|
||||
name: Build Windows
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -68,20 +68,18 @@ jobs:
|
|||
arch: [ 'x64', 'x86' ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
with:
|
||||
msbuild-architecture: ${{ matrix.arch }}
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd desmume\src\frontend\interface\windows
|
||||
MSBuild.exe DeSmuME_Interface.vcxproj /p:configuration="Release Fastbuild" /p:Platform=${{ matrix.arch }}
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
- name: Upload artificat
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: win-${{ matrix.arch }}
|
||||
path: desmume/src/frontend/interface/windows/__bins/*.dll
|
||||
|
|
|
@ -6,15 +6,16 @@ on:
|
|||
|
||||
jobs:
|
||||
build-sln:
|
||||
runs-on: windows-2022
|
||||
runs-on: windows-2019
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup MSBuild.exe
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
uses: microsoft/setup-msbuild@v1.1
|
||||
with:
|
||||
msbuild-architecture: x64
|
||||
vs-version: 16.1
|
||||
|
||||
- name: Build solution
|
||||
run: |
|
||||
|
@ -23,7 +24,7 @@ jobs:
|
|||
cmd /c desmume\src\frontend\windows\ci_postbuild.bat
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: desmume-win-x64
|
||||
path: desmume/src/frontend/windows/__bins/*.exe
|
||||
|
|
|
@ -12,7 +12,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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.
|
@ -374,7 +374,7 @@ namespace Database
|
|||
size_t regions_num = ARRAY_SIZE(regions);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright 2006 yopyop
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -44,6 +44,7 @@
|
|||
#elif defined(ENABLE_ALTIVEC)
|
||||
#define USEVECTORSIZE_128
|
||||
#define VECTORSIZE 16
|
||||
#include "./utils/colorspacehandler/colorspacehandler_AltiVec.h"
|
||||
#endif
|
||||
|
||||
#if defined(USEVECTORSIZE_512) || defined(USEVECTORSIZE_256) || defined(USEVECTORSIZE_128)
|
||||
|
@ -339,96 +340,12 @@ void DISP_FIFOinit()
|
|||
memset(&disp_fifo, 0, sizeof(DISP_FIFO));
|
||||
}
|
||||
|
||||
template <typename T, size_t ADDROFFSET>
|
||||
void DISP_FIFOsend(const T val)
|
||||
void DISP_FIFOsend_u32(u32 val)
|
||||
{
|
||||
//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);
|
||||
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;
|
||||
}
|
||||
|
||||
disp_fifo.tail++;
|
||||
if (disp_fifo.tail >= 0x6000)
|
||||
{
|
||||
disp_fifo.tail = 0;
|
||||
|
@ -463,7 +380,19 @@ void DISP_FIFOrecv_Line16(u16 *__restrict dst)
|
|||
#ifdef USEMANUALVECTORIZATION
|
||||
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);
|
||||
#endif // ENABLE_ALTIVEC
|
||||
|
||||
_DISP_FIFOrecv_LineAdvance();
|
||||
}
|
||||
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++)
|
||||
{
|
||||
const u32 src = DISP_FIFOrecv_u32();
|
||||
#ifdef MSB_FIRST
|
||||
((u32 *)dst)[i] = (src >> 16) | (src << 16);
|
||||
#else
|
||||
((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>
|
||||
void DISP_FIFOrecv_LineOpaque(u32 *__restrict dst)
|
||||
{
|
||||
|
@ -485,28 +485,26 @@ void DISP_FIFOrecv_LineOpaque(u32 *__restrict dst)
|
|||
{
|
||||
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
|
||||
#endif // USEMANUALVECTORIZATION
|
||||
#endif
|
||||
{
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev)
|
||||
{
|
||||
for (size_t i = 0; i < GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16) / sizeof(u32); i++)
|
||||
{
|
||||
const u32 src = DISP_FIFOrecv_u32();
|
||||
#ifdef MSB_FIRST
|
||||
dst[i] = (src >> 16) | (src << 16) | 0x80008000;
|
||||
#else
|
||||
dst[i] = src | 0x80008000;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -536,14 +534,6 @@ void DISP_FIFOreset()
|
|||
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_BGR666_Rev>(u32 *__restrict dst);
|
||||
template void DISP_FIFOrecv_LineOpaque<NDSColorFormat_BGR888_Rev>(u32 *__restrict dst);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright 2006 yopyop
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -87,7 +87,7 @@ typedef struct
|
|||
extern DISP_FIFO disp_fifo;
|
||||
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();
|
||||
|
||||
void DISP_FIFOrecv_Line16(u16 *__restrict dst);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2006-2007 Theo Berkau
|
||||
Copyright (C) 2007 shash
|
||||
Copyright (C) 2008-2025 DeSmuME team
|
||||
Copyright (C) 2008-2021 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
|
||||
|
@ -56,9 +56,6 @@
|
|||
#elif defined(ENABLE_SSE2)
|
||||
#define USEVECTORSIZE_128
|
||||
#define VECTORSIZE 16
|
||||
#elif defined(ENABLE_NEON_A64)
|
||||
#define USEVECTORSIZE_128
|
||||
#define VECTORSIZE 16
|
||||
#endif
|
||||
|
||||
#if defined(USEVECTORSIZE_512) || defined(USEVECTORSIZE_256) || defined(USEVECTORSIZE_128)
|
||||
|
@ -209,7 +206,7 @@ GPUEngineBase::GPUEngineBase()
|
|||
_asyncClearLineCustom = 0;
|
||||
_asyncClearInterrupt = 0;
|
||||
_asyncClearBackdropColor16 = 0;
|
||||
_asyncClearBackdropColor32.value = 0;
|
||||
_asyncClearBackdropColor32.color = 0;
|
||||
_asyncClearIsRunning = false;
|
||||
_asyncClearUseInternalCustomBuffer = false;
|
||||
|
||||
|
@ -378,7 +375,7 @@ void GPUEngineBase::Reset()
|
|||
renderState.selectedBGLayer = &this->_BGLayer[GPULayerID_BG0];
|
||||
renderState.backdropColor16 = LE_TO_LOCAL_16(this->_paletteBG[0]) & 0x7FFF;
|
||||
renderState.workingBackdropColor16 = renderState.backdropColor16;
|
||||
renderState.workingBackdropColor32.value = LOCAL_TO_LE_32( (this->_targetDisplay->GetColorFormat() == NDSColorFormat_BGR666_Rev) ? COLOR555TO666(LOCAL_TO_LE_16(renderState.workingBackdropColor16)) : COLOR555TO888(LOCAL_TO_LE_16(renderState.workingBackdropColor16)) );
|
||||
renderState.workingBackdropColor32.color = LOCAL_TO_LE_32( (this->_targetDisplay->GetColorFormat() == NDSColorFormat_BGR666_Rev) ? COLOR555TO666(LOCAL_TO_LE_16(renderState.workingBackdropColor16)) : COLOR555TO888(LOCAL_TO_LE_16(renderState.workingBackdropColor16)) );
|
||||
renderState.colorEffect = (ColorEffect)this->_IORegisterMap->BLDCNT.ColorEffect;
|
||||
renderState.blendEVA = 0;
|
||||
renderState.blendEVB = 0;
|
||||
|
@ -696,7 +693,7 @@ void GPUEngineBase::RenderLineClearAsync()
|
|||
|
||||
case NDSColorFormat_BGR666_Rev:
|
||||
case NDSColorFormat_BGR888_Rev:
|
||||
memset_u32(targetBufferHead + (lineInfo.blockOffsetCustom * sizeof(Color4u8)), this->_asyncClearBackdropColor32.value, lineInfo.pixelCount);
|
||||
memset_u32(targetBufferHead + (lineInfo.blockOffsetCustom * sizeof(FragmentColor)), this->_asyncClearBackdropColor32.color, lineInfo.pixelCount);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -719,9 +716,9 @@ void GPUEngineBase::RenderLineClearAsync()
|
|||
}
|
||||
|
||||
void GPUEngineBase::RenderLineClearAsyncStart(bool willClearInternalCustomBuffer,
|
||||
size_t startLineIndex,
|
||||
s32 startLineIndex,
|
||||
u16 clearColor16,
|
||||
Color4u8 clearColor32)
|
||||
FragmentColor clearColor32)
|
||||
{
|
||||
if (this->_asyncClearTask == NULL)
|
||||
{
|
||||
|
@ -730,7 +727,7 @@ void GPUEngineBase::RenderLineClearAsyncStart(bool willClearInternalCustomBuffer
|
|||
|
||||
this->RenderLineClearAsyncFinish();
|
||||
|
||||
this->_asyncClearLineCustom = (s32)startLineIndex;
|
||||
this->_asyncClearLineCustom = startLineIndex;
|
||||
this->_asyncClearBackdropColor16 = clearColor16;
|
||||
this->_asyncClearBackdropColor32 = clearColor32;
|
||||
this->_asyncClearUseInternalCustomBuffer = willClearInternalCustomBuffer;
|
||||
|
@ -753,10 +750,9 @@ void GPUEngineBase::RenderLineClearAsyncFinish()
|
|||
this->_asyncClearInterrupt = 0;
|
||||
}
|
||||
|
||||
void GPUEngineBase::RenderLineClearAsyncWaitForCustomLine(const size_t l)
|
||||
void GPUEngineBase::RenderLineClearAsyncWaitForCustomLine(const s32 l)
|
||||
{
|
||||
const s32 lineCompare = (s32)l;
|
||||
while (lineCompare >= atomic_and_barrier32(&this->_asyncClearLineCustom, 0x000000FF))
|
||||
while (l >= atomic_and_barrier32(&this->_asyncClearLineCustom, 0x000000FF))
|
||||
{
|
||||
// Do nothing -- just spin.
|
||||
}
|
||||
|
@ -851,7 +847,7 @@ void GPUEngineBase::UpdateRenderStates(const size_t l)
|
|||
{
|
||||
currRenderState.workingBackdropColor16 = currRenderState.backdropColor16;
|
||||
}
|
||||
currRenderState.workingBackdropColor32.value = LOCAL_TO_LE_32( (this->_targetDisplay->GetColorFormat() == NDSColorFormat_BGR666_Rev) ? COLOR555TO666(currRenderState.workingBackdropColor16) : COLOR555TO888(currRenderState.workingBackdropColor16) );
|
||||
currRenderState.workingBackdropColor32.color = LOCAL_TO_LE_32( (this->_targetDisplay->GetColorFormat() == NDSColorFormat_BGR666_Rev) ? COLOR555TO666(LOCAL_TO_LE_16(currRenderState.workingBackdropColor16)) : COLOR555TO888(LOCAL_TO_LE_16(currRenderState.workingBackdropColor16)) );
|
||||
|
||||
// Save the current render states to this line's compositor info.
|
||||
compInfo.renderState = currRenderState;
|
||||
|
@ -927,11 +923,6 @@ const GPU_IOREG& GPUEngineBase::GetIORegisterMap() const
|
|||
return *this->_IORegisterMap;
|
||||
}
|
||||
|
||||
bool GPUEngineBase::IsForceBlankSet() const
|
||||
{
|
||||
return (this->_IORegisterMap->DISPCNT.ForceBlank != 0);
|
||||
}
|
||||
|
||||
bool GPUEngineBase::IsMasterBrightMaxOrMin() const
|
||||
{
|
||||
return this->_currentRenderState.masterBrightnessIsMaxOrMin;
|
||||
|
@ -1012,7 +1003,7 @@ void GPUEngineBase::_TransitionLineNativeToCustom(GPUEngineCompositorInfo &compI
|
|||
|
||||
case NDSColorFormat_BGR666_Rev:
|
||||
case NDSColorFormat_BGR888_Rev:
|
||||
memset_u32(compInfo.target.lineColorHeadCustom, compInfo.renderState.workingBackdropColor32.value, compInfo.line.pixelCount);
|
||||
memset_u32(compInfo.target.lineColorHeadCustom, compInfo.renderState.workingBackdropColor32.color, compInfo.line.pixelCount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1035,12 +1026,12 @@ void GPUEngineBase::_TransitionLineNativeToCustom(GPUEngineCompositorInfo &compI
|
|||
{
|
||||
if ( (compInfo.line.widthCustom == GPU_FRAMEBUFFER_NATIVE_WIDTH) && (compInfo.line.renderCount == 1) )
|
||||
{
|
||||
ColorspaceConvertBuffer555xTo6665Opaque<false, false, BESwapDst>((u16 *)compInfo.target.lineColorHeadNative, (u32 *)compInfo.target.lineColorHeadCustom, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
ColorspaceConvertBuffer555To6665Opaque<false, false, BESwapDst>((u16 *)compInfo.target.lineColorHeadNative, (u32 *)compInfo.target.lineColorHeadCustom, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 *workingNativeBuffer32 = this->_targetDisplay->GetWorkingNativeBuffer32();
|
||||
ColorspaceConvertBuffer555xTo6665Opaque<false, false, BESwapDst>((u16 *)compInfo.target.lineColorHeadNative, workingNativeBuffer32 + compInfo.line.blockOffsetNative, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
ColorspaceConvertBuffer555To6665Opaque<false, false, BESwapDst>((u16 *)compInfo.target.lineColorHeadNative, workingNativeBuffer32 + compInfo.line.blockOffsetNative, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
CopyLineExpandHinted<0x3FFF, true, false, false, 4>(compInfo.line, workingNativeBuffer32 + compInfo.line.blockOffsetNative, compInfo.target.lineColorHeadCustom);
|
||||
}
|
||||
break;
|
||||
|
@ -1050,12 +1041,12 @@ void GPUEngineBase::_TransitionLineNativeToCustom(GPUEngineCompositorInfo &compI
|
|||
{
|
||||
if ( (compInfo.line.widthCustom == GPU_FRAMEBUFFER_NATIVE_WIDTH) && (compInfo.line.renderCount == 1) )
|
||||
{
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>((u16 *)compInfo.target.lineColorHeadNative, (u32 *)compInfo.target.lineColorHeadCustom, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>((u16 *)compInfo.target.lineColorHeadNative, (u32 *)compInfo.target.lineColorHeadCustom, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 *workingNativeBuffer32 = this->_targetDisplay->GetWorkingNativeBuffer32();
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>((u16 *)compInfo.target.lineColorHeadNative, workingNativeBuffer32 + compInfo.line.blockOffsetNative, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>((u16 *)compInfo.target.lineColorHeadNative, workingNativeBuffer32 + compInfo.line.blockOffsetNative, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
CopyLineExpandHinted<0x3FFF, true, false, false, 4>(compInfo.line, workingNativeBuffer32 + compInfo.line.blockOffsetNative, compInfo.target.lineColorHeadCustom);
|
||||
}
|
||||
break;
|
||||
|
@ -1260,7 +1251,7 @@ FORCEINLINE void GPUEngineBase::_CompositePixelImmediate(GPUEngineCompositorInfo
|
|||
compInfo.target.xCustom = _gpuDstPitchIndex[srcX];
|
||||
compInfo.target.lineLayerID = compInfo.target.lineLayerIDHeadNative + srcX;
|
||||
compInfo.target.lineColor16 = (u16 *)compInfo.target.lineColorHeadNative + srcX;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)compInfo.target.lineColorHeadNative + srcX;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)compInfo.target.lineColorHeadNative + srcX;
|
||||
|
||||
const bool enableColorEffect = (WILLPERFORMWINDOWTEST) ? (this->_enableColorEffectNative[compInfo.renderState.selectedLayerID][compInfo.target.xNative] != 0) : true;
|
||||
pixelop.Composite16<COMPOSITORMODE, NDSColorFormat_BGR555_Rev, GPULayerType_BG>(compInfo, srcColor16, enableColorEffect, 0, 0);
|
||||
|
@ -1286,12 +1277,12 @@ void GPUEngineBase::_PrecompositeNativeToCustomLineBG(GPUEngineCompositorInfo &c
|
|||
}
|
||||
|
||||
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST>
|
||||
void GPUEngineBase::_CompositeNativeLineOBJ(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const Color4u8 *__restrict srcColorNative32)
|
||||
void GPUEngineBase::_CompositeNativeLineOBJ(GPUEngineCompositorInfo &compInfo, const u16 *__restrict srcColorNative16, const FragmentColor *__restrict srcColorNative32)
|
||||
{
|
||||
compInfo.target.xNative = 0;
|
||||
compInfo.target.xCustom = 0;
|
||||
compInfo.target.lineColor16 = (u16 *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineLayerID = compInfo.target.lineLayerIDHead;
|
||||
|
||||
#ifdef USEMANUALVECTORIZATION
|
||||
|
@ -1335,7 +1326,7 @@ void GPUEngineBase::_CompositeLineDeferred(GPUEngineCompositorInfo &compInfo, co
|
|||
compInfo.target.xNative = 0;
|
||||
compInfo.target.xCustom = 0;
|
||||
compInfo.target.lineColor16 = (u16 *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineLayerID = compInfo.target.lineLayerIDHead;
|
||||
|
||||
size_t i = 0;
|
||||
|
@ -1375,7 +1366,7 @@ void GPUEngineBase::_CompositeVRAMLineDeferred(GPUEngineCompositorInfo &compInfo
|
|||
compInfo.target.xNative = 0;
|
||||
compInfo.target.xCustom = 0;
|
||||
compInfo.target.lineColor16 = (u16 *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineLayerID = compInfo.target.lineLayerIDHead;
|
||||
|
||||
size_t i = 0;
|
||||
|
@ -1404,7 +1395,7 @@ void GPUEngineBase::_CompositeVRAMLineDeferred(GPUEngineCompositorInfo &compInfo
|
|||
}
|
||||
|
||||
const bool enableColorEffect = (WILLPERFORMWINDOWTEST) ? (colorEffectEnable[compInfo.target.xCustom] != 0) : true;
|
||||
pixelop.Composite32<COMPOSITORMODE, OUTPUTFORMAT, LAYERTYPE>(compInfo, ((Color4u8 *)vramColorPtr)[i], enableColorEffect, this->_sprAlphaCustom[compInfo.target.xCustom], this->_sprTypeCustom[compInfo.target.xCustom]);
|
||||
pixelop.Composite32<COMPOSITORMODE, OUTPUTFORMAT, LAYERTYPE>(compInfo, ((FragmentColor *)vramColorPtr)[i], enableColorEffect, this->_sprAlphaCustom[compInfo.target.xCustom], this->_sprTypeCustom[compInfo.target.xCustom]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1838,7 +1829,7 @@ void GPUEngineBase::_RenderSprite16(GPUEngineCompositorInfo &compInfo,
|
|||
{
|
||||
for (size_t i = 0; i < length; i++, frameX++, spriteX+=readXStep)
|
||||
{
|
||||
const u32 spriteX_word = (u32)spriteX >> 1;
|
||||
const u32 spriteX_word = spriteX >> 1;
|
||||
const u32 palIndexAddress = objAddress + (spriteX_word & 0x0003) + ((spriteX_word & 0xFFFC) << 3);
|
||||
const u8 *__restrict palIndexBuffer = (u8 *)MMU_gpu_map(palIndexAddress);
|
||||
const u8 palIndex = *palIndexBuffer;
|
||||
|
@ -1977,7 +1968,7 @@ void GPUEngineBase::SpriteRenderDebug(const u16 lineIndex, u16 *dst)
|
|||
compInfo.target.xCustom = 0;
|
||||
compInfo.target.lineColor = (void **)&compInfo.target.lineColor16;
|
||||
compInfo.target.lineColor16 = (u16 *)compInfo.target.lineColorHeadNative;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)compInfo.target.lineColorHeadNative;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)compInfo.target.lineColorHeadNative;
|
||||
compInfo.target.lineLayerID = NULL;
|
||||
|
||||
this->_SpriteRender<true>(compInfo, dst, NULL, NULL, &this->_sprPrio[lineIndex][0]);
|
||||
|
@ -2109,7 +2100,7 @@ void GPUEngineBase::_SpriteRenderPerform(GPUEngineCompositorInfo &compInfo, u16
|
|||
|
||||
if (auxX >= 0 && auxY >= 0 && auxX < sprSize.width && auxY < sprSize.height)
|
||||
{
|
||||
u32 objOffset = 0;
|
||||
size_t objOffset = 0;
|
||||
|
||||
if (DISPCNT.OBJ_BMP_2D_dim)
|
||||
{
|
||||
|
@ -2271,7 +2262,7 @@ void GPUEngineBase::_RenderLine_Layers(GPUEngineCompositorInfo &compInfo)
|
|||
compInfo.target.xNative = 0;
|
||||
compInfo.target.xCustom = 0;
|
||||
compInfo.target.lineColor16 = (u16 *)compInfo.target.lineColorHeadNative;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)compInfo.target.lineColorHeadNative;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)compInfo.target.lineColorHeadNative;
|
||||
compInfo.target.lineLayerID = compInfo.target.lineLayerIDHead;
|
||||
|
||||
compInfo.renderState.previouslyRenderedLayerID = GPULayerID_Backdrop;
|
||||
|
@ -2512,7 +2503,7 @@ void GPUEngineBase::_RenderLine_LayerOBJ(GPUEngineCompositorInfo &compInfo, item
|
|||
compInfo.target.xNative = srcX;
|
||||
compInfo.target.xCustom = _gpuDstPitchIndex[srcX];
|
||||
compInfo.target.lineColor16 = (u16 *)compInfo.target.lineColorHead + srcX;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)compInfo.target.lineColorHead + srcX;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)compInfo.target.lineColorHead + srcX;
|
||||
compInfo.target.lineLayerID = compInfo.target.lineLayerIDHead + srcX;
|
||||
|
||||
const bool enableColorEffect = (WILLPERFORMWINDOWTEST) ? (this->_enableColorEffectNative[GPULayerID_OBJ][compInfo.target.xNative] != 0) : true;
|
||||
|
@ -2531,7 +2522,7 @@ void GPUEngineBase::_RenderLine_LayerOBJ(GPUEngineCompositorInfo &compInfo, item
|
|||
for (size_t line = 0; line < compInfo.line.renderCount; line++)
|
||||
{
|
||||
compInfo.target.lineColor16 = (u16 *)dstColorPtr;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)dstColorPtr;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)dstColorPtr;
|
||||
compInfo.target.lineLayerID = dstLayerIDPtr;
|
||||
|
||||
for (size_t i = 0; i < item->nbPixelsX; i++)
|
||||
|
@ -2551,14 +2542,14 @@ void GPUEngineBase::_RenderLine_LayerOBJ(GPUEngineCompositorInfo &compInfo, item
|
|||
const size_t dstX = compInfo.target.xCustom + p;
|
||||
|
||||
compInfo.target.lineColor16 = (u16 *)dstColorPtr + dstX;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)dstColorPtr + dstX;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)dstColorPtr + dstX;
|
||||
compInfo.target.lineLayerID = dstLayerIDPtr + dstX;
|
||||
|
||||
const bool enableColorEffect = (WILLPERFORMWINDOWTEST) ? (this->_enableColorEffectNative[GPULayerID_OBJ][compInfo.target.xNative] != 0) : true;
|
||||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev)
|
||||
{
|
||||
pixelop.Composite32<COMPOSITORMODE, OUTPUTFORMAT, GPULayerType_OBJ>(compInfo, ((Color4u8 *)vramColorPtr)[dstX], enableColorEffect, this->_sprAlpha[compInfo.line.indexNative][srcX], this->_sprType[compInfo.line.indexNative][srcX]);
|
||||
pixelop.Composite32<COMPOSITORMODE, OUTPUTFORMAT, GPULayerType_OBJ>(compInfo, ((FragmentColor *)vramColorPtr)[dstX], enableColorEffect, this->_sprAlpha[compInfo.line.indexNative][srcX], this->_sprType[compInfo.line.indexNative][srcX]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2567,8 +2558,8 @@ void GPUEngineBase::_RenderLine_LayerOBJ(GPUEngineCompositorInfo &compInfo, item
|
|||
}
|
||||
}
|
||||
|
||||
vramColorPtr = (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) ? (void *)((Color4u8 *)vramColorPtr + compInfo.line.widthCustom) : (void *)((u16 *)vramColorPtr + compInfo.line.widthCustom);
|
||||
dstColorPtr = (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev) ? (void *)((u16 *)dstColorPtr + compInfo.line.widthCustom) : (void *)((Color4u8 *)dstColorPtr + compInfo.line.widthCustom);
|
||||
vramColorPtr = (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) ? (void *)((FragmentColor *)vramColorPtr + compInfo.line.widthCustom) : (void *)((u16 *)vramColorPtr + compInfo.line.widthCustom);
|
||||
dstColorPtr = (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev) ? (void *)((u16 *)dstColorPtr + compInfo.line.widthCustom) : (void *)((FragmentColor *)dstColorPtr + compInfo.line.widthCustom);
|
||||
dstLayerIDPtr += compInfo.line.widthCustom;
|
||||
}
|
||||
}
|
||||
|
@ -2577,7 +2568,7 @@ void GPUEngineBase::_RenderLine_LayerOBJ(GPUEngineCompositorInfo &compInfo, item
|
|||
for (size_t line = 0; line < compInfo.line.renderCount; line++)
|
||||
{
|
||||
compInfo.target.lineColor16 = (u16 *)dstColorPtr;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)dstColorPtr;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)dstColorPtr;
|
||||
compInfo.target.lineLayerID = dstLayerIDPtr;
|
||||
|
||||
for (size_t i = 0; i < item->nbPixelsX; i++)
|
||||
|
@ -2597,7 +2588,7 @@ void GPUEngineBase::_RenderLine_LayerOBJ(GPUEngineCompositorInfo &compInfo, item
|
|||
const size_t dstX = compInfo.target.xCustom + p;
|
||||
|
||||
compInfo.target.lineColor16 = (u16 *)dstColorPtr + dstX;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)dstColorPtr + dstX;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)dstColorPtr + dstX;
|
||||
compInfo.target.lineLayerID = dstLayerIDPtr + dstX;
|
||||
|
||||
const bool enableColorEffect = (WILLPERFORMWINDOWTEST) ? (this->_enableColorEffectNative[GPULayerID_OBJ][compInfo.target.xNative] != 0) : true;
|
||||
|
@ -2605,7 +2596,7 @@ void GPUEngineBase::_RenderLine_LayerOBJ(GPUEngineCompositorInfo &compInfo, item
|
|||
}
|
||||
}
|
||||
|
||||
dstColorPtr = (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev) ? (void *)((u16 *)dstColorPtr + compInfo.line.widthCustom) : (void *)((Color4u8 *)dstColorPtr + compInfo.line.widthCustom);
|
||||
dstColorPtr = (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev) ? (void *)((u16 *)dstColorPtr + compInfo.line.widthCustom) : (void *)((FragmentColor *)dstColorPtr + compInfo.line.widthCustom);
|
||||
dstLayerIDPtr += compInfo.line.widthCustom;
|
||||
}
|
||||
}
|
||||
|
@ -2929,7 +2920,7 @@ void GPUEngineBase::RenderLayerBG(const GPULayerID layerID, u16 *dstColorBuffer)
|
|||
compInfo.target.xCustom = compInfo.target.xNative;
|
||||
compInfo.target.lineColor = (void **)&compInfo.target.lineColor16;
|
||||
compInfo.target.lineColor16 = (u16 *)compInfo.target.lineColorHeadNative;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)compInfo.target.lineColorHeadNative;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)compInfo.target.lineColorHeadNative;
|
||||
compInfo.target.lineLayerID = NULL;
|
||||
|
||||
for (size_t lineIndex = 0; lineIndex < layerHeight; lineIndex++)
|
||||
|
@ -2948,18 +2939,11 @@ void GPUEngineBase::RenderLayerBG(const GPULayerID layerID, u16 *dstColorBuffer)
|
|||
}
|
||||
}
|
||||
|
||||
void GPUEngineBase::_RenderLineBlank(const size_t l)
|
||||
{
|
||||
// Native rendering only.
|
||||
// Just clear the line using white pixels.
|
||||
memset_u16_fast<GPU_FRAMEBUFFER_NATIVE_WIDTH>(this->_targetDisplay->GetNativeBuffer16() + (l * GPU_FRAMEBUFFER_NATIVE_WIDTH), 0xFFFF);
|
||||
}
|
||||
|
||||
void GPUEngineBase::_HandleDisplayModeOff(const size_t l)
|
||||
{
|
||||
// Native rendering only.
|
||||
// In this display mode, the line is cleared to white.
|
||||
this->_RenderLineBlank(l);
|
||||
// In this display mode, the display is cleared to white.
|
||||
memset_u16_fast<GPU_FRAMEBUFFER_NATIVE_WIDTH>(this->_targetDisplay->GetNativeBuffer16() + (l * GPU_FRAMEBUFFER_NATIVE_WIDTH), 0xFFFF);
|
||||
}
|
||||
|
||||
void GPUEngineBase::_HandleDisplayModeNormal(const size_t l)
|
||||
|
@ -3267,13 +3251,13 @@ GPUEngineA::GPUEngineA()
|
|||
_isLineCaptureNative[3][l] = true;
|
||||
}
|
||||
|
||||
_3DFramebufferMain = (Color4u8 *)malloc_alignedPage(GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(Color4u8));
|
||||
_3DFramebufferMain = (FragmentColor *)malloc_alignedPage(GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(FragmentColor));
|
||||
_3DFramebuffer16 = (u16 *)malloc_alignedPage(GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(u16));
|
||||
_captureWorkingDisplay16 = (u16 *)malloc_alignedPage(GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16));
|
||||
_captureWorkingA16 = (u16 *)malloc_alignedPage(GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16));
|
||||
_captureWorkingB16 = (u16 *)malloc_alignedPage(GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16));
|
||||
_captureWorkingA32 = (Color4u8 *)malloc_alignedPage(GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(Color4u8));
|
||||
_captureWorkingB32 = (Color4u8 *)malloc_alignedPage(GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(Color4u8));
|
||||
_captureWorkingA32 = (FragmentColor *)malloc_alignedPage(GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(FragmentColor));
|
||||
_captureWorkingB32 = (FragmentColor *)malloc_alignedPage(GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(FragmentColor));
|
||||
}
|
||||
|
||||
GPUEngineA::~GPUEngineA()
|
||||
|
@ -3306,13 +3290,13 @@ void GPUEngineA::Reset()
|
|||
const size_t customWidth = this->_targetDisplay->GetWidth();
|
||||
const size_t customHeight = this->_targetDisplay->GetHeight();
|
||||
|
||||
memset(this->_3DFramebufferMain, 0, customWidth * customHeight * sizeof(Color4u8));
|
||||
memset(this->_3DFramebufferMain, 0, customWidth * customHeight * sizeof(FragmentColor));
|
||||
memset(this->_3DFramebuffer16, 0, customWidth * customHeight * sizeof(u16));
|
||||
memset(this->_captureWorkingDisplay16, 0, customWidth * _gpuLargestDstLineCount * sizeof(u16));
|
||||
memset(this->_captureWorkingA16, 0, customWidth * _gpuLargestDstLineCount * sizeof(u16));
|
||||
memset(this->_captureWorkingB16, 0, customWidth * _gpuLargestDstLineCount * sizeof(u16));
|
||||
memset(this->_captureWorkingA32, 0, customWidth * _gpuLargestDstLineCount * sizeof(Color4u8));
|
||||
memset(this->_captureWorkingB32, 0, customWidth * _gpuLargestDstLineCount * sizeof(Color4u8));
|
||||
memset(this->_captureWorkingA32, 0, customWidth * _gpuLargestDstLineCount * sizeof(FragmentColor));
|
||||
memset(this->_captureWorkingB32, 0, customWidth * _gpuLargestDstLineCount * sizeof(FragmentColor));
|
||||
|
||||
memset(&this->_dispCapCnt, 0, sizeof(DISPCAPCNT_parsed));
|
||||
this->_displayCaptureEnable = false;
|
||||
|
@ -3398,7 +3382,7 @@ void GPUEngineA::ParseReg_DISPCAPCNT()
|
|||
this->_dispCapCnt.srcA, this->_dispCapCnt.srcB);*/
|
||||
}
|
||||
|
||||
Color4u8* GPUEngineA::Get3DFramebufferMain() const
|
||||
FragmentColor* GPUEngineA::Get3DFramebufferMain() const
|
||||
{
|
||||
return this->_3DFramebufferMain;
|
||||
}
|
||||
|
@ -3422,30 +3406,30 @@ void GPUEngineA::AllocateWorkingBuffers(NDSColorFormat requestedColorFormat, siz
|
|||
{
|
||||
this->GPUEngineBase::AllocateWorkingBuffers(requestedColorFormat, w, h);
|
||||
|
||||
Color4u8 *old3DFramebufferMain = this->_3DFramebufferMain;
|
||||
FragmentColor *old3DFramebufferMain = this->_3DFramebufferMain;
|
||||
u16 *old3DFramebuffer16 = this->_3DFramebuffer16;
|
||||
u16 *oldCaptureWorkingDisplay16 = this->_captureWorkingDisplay16;
|
||||
u16 *oldCaptureWorkingA16 = this->_captureWorkingA16;
|
||||
u16 *oldCaptureWorkingB16 = this->_captureWorkingB16;
|
||||
Color4u8 *oldCaptureWorkingA32 = this->_captureWorkingA32;
|
||||
Color4u8 *oldCaptureWorkingB32 = this->_captureWorkingB32;
|
||||
FragmentColor *oldCaptureWorkingA32 = this->_captureWorkingA32;
|
||||
FragmentColor *oldCaptureWorkingB32 = this->_captureWorkingB32;
|
||||
|
||||
this->_3DFramebufferMain = (Color4u8 *)malloc_alignedPage(w * h * sizeof(Color4u8));
|
||||
this->_3DFramebufferMain = (FragmentColor *)malloc_alignedPage(w * h * sizeof(FragmentColor));
|
||||
this->_3DFramebuffer16 = (u16 *)malloc_alignedPage(w * h * sizeof(u16));
|
||||
this->_captureWorkingDisplay16 = (u16 *)malloc_alignedPage(w * _gpuLargestDstLineCount * sizeof(u16));
|
||||
this->_captureWorkingA16 = (u16 *)malloc_alignedPage(w * _gpuLargestDstLineCount * sizeof(u16));
|
||||
this->_captureWorkingB16 = (u16 *)malloc_alignedPage(w * _gpuLargestDstLineCount * sizeof(u16));
|
||||
this->_captureWorkingA32 = (Color4u8 *)malloc_alignedPage(w * _gpuLargestDstLineCount * sizeof(Color4u8));
|
||||
this->_captureWorkingB32 = (Color4u8 *)malloc_alignedPage(w * _gpuLargestDstLineCount * sizeof(Color4u8));
|
||||
this->_captureWorkingA32 = (FragmentColor *)malloc_alignedPage(w * _gpuLargestDstLineCount * sizeof(FragmentColor));
|
||||
this->_captureWorkingB32 = (FragmentColor *)malloc_alignedPage(w * _gpuLargestDstLineCount * sizeof(FragmentColor));
|
||||
|
||||
const GPUEngineLineInfo &lineInfo = this->_currentCompositorInfo[GPU_VRAM_BLOCK_LINES].line;
|
||||
|
||||
if (this->_targetDisplay->GetColorFormat() == NDSColorFormat_BGR888_Rev)
|
||||
{
|
||||
this->_VRAMCustomBlockPtr[0] = (Color4u8 *)GPU->GetCustomVRAMBuffer();
|
||||
this->_VRAMCustomBlockPtr[1] = (Color4u8 *)this->_VRAMCustomBlockPtr[0] + (1 * lineInfo.indexCustom * w);
|
||||
this->_VRAMCustomBlockPtr[2] = (Color4u8 *)this->_VRAMCustomBlockPtr[0] + (2 * lineInfo.indexCustom * w);
|
||||
this->_VRAMCustomBlockPtr[3] = (Color4u8 *)this->_VRAMCustomBlockPtr[0] + (3 * lineInfo.indexCustom * w);
|
||||
this->_VRAMCustomBlockPtr[0] = (FragmentColor *)GPU->GetCustomVRAMBuffer();
|
||||
this->_VRAMCustomBlockPtr[1] = (FragmentColor *)this->_VRAMCustomBlockPtr[0] + (1 * lineInfo.indexCustom * w);
|
||||
this->_VRAMCustomBlockPtr[2] = (FragmentColor *)this->_VRAMCustomBlockPtr[0] + (2 * lineInfo.indexCustom * w);
|
||||
this->_VRAMCustomBlockPtr[3] = (FragmentColor *)this->_VRAMCustomBlockPtr[0] + (3 * lineInfo.indexCustom * w);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3551,30 +3535,23 @@ void GPUEngineA::RenderLine(const size_t l)
|
|||
}
|
||||
|
||||
// Fill the display output
|
||||
if ( this->IsForceBlankSet() )
|
||||
switch (compInfo.renderState.displayOutputMode)
|
||||
{
|
||||
this->_RenderLineBlank(l);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (compInfo.renderState.displayOutputMode)
|
||||
{
|
||||
case GPUDisplayMode_Off: // Display Off (clear line to white)
|
||||
this->_HandleDisplayModeOff(l);
|
||||
break;
|
||||
|
||||
case GPUDisplayMode_Normal: // Display BG and OBJ layers
|
||||
this->_HandleDisplayModeNormal(l);
|
||||
break;
|
||||
|
||||
case GPUDisplayMode_VRAM: // Display VRAM framebuffer
|
||||
this->_HandleDisplayModeVRAM<OUTPUTFORMAT>(compInfo.line);
|
||||
break;
|
||||
|
||||
case GPUDisplayMode_MainMemory: // Display Memory FIFO
|
||||
this->_HandleDisplayModeMainMemory(compInfo.line);
|
||||
break;
|
||||
}
|
||||
case GPUDisplayMode_Off: // Display Off (Display white)
|
||||
this->_HandleDisplayModeOff(l);
|
||||
break;
|
||||
|
||||
case GPUDisplayMode_Normal: // Display BG and OBJ layers
|
||||
this->_HandleDisplayModeNormal(l);
|
||||
break;
|
||||
|
||||
case GPUDisplayMode_VRAM: // Display VRAM framebuffer
|
||||
this->_HandleDisplayModeVRAM<OUTPUTFORMAT>(compInfo.line);
|
||||
break;
|
||||
|
||||
case GPUDisplayMode_MainMemory: // Display Memory FIFO
|
||||
this->_HandleDisplayModeMainMemory(compInfo.line);
|
||||
break;
|
||||
}
|
||||
|
||||
//capture after displaying so that we can safely display vram before overwriting it here
|
||||
|
@ -3598,7 +3575,7 @@ void GPUEngineA::RenderLine(const size_t l)
|
|||
template <GPUCompositorMode COMPOSITORMODE, NDSColorFormat OUTPUTFORMAT, bool WILLPERFORMWINDOWTEST>
|
||||
void GPUEngineA::RenderLine_Layer3D(GPUEngineCompositorInfo &compInfo)
|
||||
{
|
||||
const Color4u8 *__restrict framebuffer3D = CurrentRenderer->GetFramebuffer();
|
||||
const FragmentColor *__restrict framebuffer3D = CurrentRenderer->GetFramebuffer();
|
||||
if (framebuffer3D == NULL)
|
||||
{
|
||||
return;
|
||||
|
@ -3613,12 +3590,12 @@ void GPUEngineA::RenderLine_Layer3D(GPUEngineCompositorInfo &compInfo)
|
|||
const u8 *colorEffectEnable = (CurrentRenderer->GetFramebufferWidth() == GPU_FRAMEBUFFER_NATIVE_WIDTH) ? this->_enableColorEffectNative[GPULayerID_BG0] : this->_enableColorEffectCustom[GPULayerID_BG0];
|
||||
|
||||
const float customWidthScale = (float)compInfo.line.widthCustom / (float)GPU_FRAMEBUFFER_NATIVE_WIDTH;
|
||||
const Color4u8 *__restrict srcLinePtr = framebuffer3D + compInfo.line.blockOffsetCustom;
|
||||
const FragmentColor *__restrict srcLinePtr = framebuffer3D + compInfo.line.blockOffsetCustom;
|
||||
|
||||
compInfo.target.xNative = 0;
|
||||
compInfo.target.xCustom = 0;
|
||||
compInfo.target.lineColor16 = (u16 *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineColor32 = (Color4u8 *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineColor32 = (FragmentColor *)compInfo.target.lineColorHead;
|
||||
compInfo.target.lineLayerID = compInfo.target.lineLayerIDHead;
|
||||
|
||||
// Horizontally offset the 3D layer by this amount.
|
||||
|
@ -3732,7 +3709,7 @@ void GPUEngineA::_RenderLine_DisplayCaptureCustom(const IOREG_DISPCAPCNT &DISPCA
|
|||
{
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev)
|
||||
{
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>(this->_fifoLine16, (u32 *)srcBPtr, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>(this->_fifoLine16, (u32 *)srcBPtr, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
}
|
||||
|
||||
this->_RenderLine_DispCapture_Copy<OUTPUTFORMAT, 1, CAPTURELENGTH, true, false>(lineInfo, srcBPtr, dstCustomPtr, captureLengthExt);
|
||||
|
@ -3758,7 +3735,7 @@ void GPUEngineA::_RenderLine_DisplayCaptureCustom(const IOREG_DISPCAPCNT &DISPCA
|
|||
else
|
||||
{
|
||||
u32 *workingNativeBuffer32 = this->_targetDisplay->GetWorkingNativeBuffer32();
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapNone>((u16 *)srcAPtr, workingNativeBuffer32 + lineInfo.blockOffsetNative, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapNone>((u16 *)srcAPtr, workingNativeBuffer32 + lineInfo.blockOffsetNative, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
CopyLineExpandHinted<0x3FFF, true, false, false, 4>(lineInfo, workingNativeBuffer32 + lineInfo.blockOffsetNative, this->_captureWorkingA32);
|
||||
srcAPtr = this->_captureWorkingA32;
|
||||
}
|
||||
|
@ -3775,7 +3752,7 @@ void GPUEngineA::_RenderLine_DisplayCaptureCustom(const IOREG_DISPCAPCNT &DISPCA
|
|||
{
|
||||
if ((OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) && (DISPCAPCNT.SrcB != 0))
|
||||
{
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>(this->_fifoLine16, (u32 *)srcBPtr, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>(this->_fifoLine16, (u32 *)srcBPtr, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
}
|
||||
|
||||
CopyLineExpandHinted<0x3FFF, true, false, false, 4>(lineInfo, srcBPtr, this->_captureWorkingB32);
|
||||
|
@ -3902,7 +3879,7 @@ void GPUEngineA::_RenderLine_DisplayCapture(const GPUEngineCompositorInfo &compI
|
|||
}
|
||||
|
||||
const u16 *vramCustom16 = (u16 *)GPU->GetCustomVRAMBlankBuffer();
|
||||
const Color4u8 *vramCustom32 = (Color4u8 *)GPU->GetCustomVRAMBlankBuffer();
|
||||
const FragmentColor *vramCustom32 = (FragmentColor *)GPU->GetCustomVRAMBlankBuffer();
|
||||
|
||||
if (!willReadNativeVRAM)
|
||||
{
|
||||
|
@ -3913,7 +3890,7 @@ void GPUEngineA::_RenderLine_DisplayCapture(const GPUEngineCompositorInfo &compI
|
|||
}
|
||||
|
||||
vramCustom16 = (u16 *)this->_VRAMCustomBlockPtr[DISPCNT.VRAM_Block] + vramCustomOffset;
|
||||
vramCustom32 = (Color4u8 *)this->_VRAMCustomBlockPtr[DISPCNT.VRAM_Block] + vramCustomOffset;
|
||||
vramCustom32 = (FragmentColor *)this->_VRAMCustomBlockPtr[DISPCNT.VRAM_Block] + vramCustomOffset;
|
||||
}
|
||||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev)
|
||||
|
@ -3922,13 +3899,13 @@ void GPUEngineA::_RenderLine_DisplayCapture(const GPUEngineCompositorInfo &compI
|
|||
{
|
||||
if (willReadNativeVRAM)
|
||||
{
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>(vramNative16, (u32 *)vramCustom32, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>(vramNative16, (u32 *)vramCustom32, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
srcAPtr = (DISPCAPCNT.SrcA == 0) ? (Color4u8 *)compInfo.target.lineColorHead : (Color4u8 *)CurrentRenderer->GetFramebuffer() + compInfo.line.blockOffsetCustom;
|
||||
srcAPtr = (DISPCAPCNT.SrcA == 0) ? (FragmentColor *)compInfo.target.lineColorHead : (FragmentColor *)CurrentRenderer->GetFramebuffer() + compInfo.line.blockOffsetCustom;
|
||||
srcBPtr = (DISPCAPCNT.SrcB == 0) ? vramCustom32 : this->_fifoLine32;
|
||||
dstCustomPtr = (Color4u8 *)this->_VRAMCustomBlockPtr[DISPCAPCNT.VRAMWriteBlock] + dstCustomOffset;
|
||||
dstCustomPtr = (FragmentColor *)this->_VRAMCustomBlockPtr[DISPCAPCNT.VRAMWriteBlock] + dstCustomOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4295,10 +4272,10 @@ u16 GPUEngineA::_RenderLine_DispCapture_BlendFunc(const u16 srcA, const u16 srcB
|
|||
}
|
||||
|
||||
template<NDSColorFormat COLORFORMAT>
|
||||
Color4u8 GPUEngineA::_RenderLine_DispCapture_BlendFunc(const Color4u8 srcA, const Color4u8 srcB, const u8 blendEVA, const u8 blendEVB)
|
||||
FragmentColor GPUEngineA::_RenderLine_DispCapture_BlendFunc(const FragmentColor srcA, const FragmentColor srcB, const u8 blendEVA, const u8 blendEVB)
|
||||
{
|
||||
Color4u8 outColor;
|
||||
outColor.value = 0;
|
||||
FragmentColor outColor;
|
||||
outColor.color = 0;
|
||||
|
||||
u16 r = 0;
|
||||
u16 g = 0;
|
||||
|
@ -4351,17 +4328,17 @@ void GPUEngineA::_RenderLine_DispCapture_Blend_Buffer(const void *srcA, const vo
|
|||
#endif
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev)
|
||||
{
|
||||
const Color4u8 *srcA_32 = (const Color4u8 *)srcA;
|
||||
const Color4u8 *srcB_32 = (const Color4u8 *)srcB;
|
||||
Color4u8 *dst32 = (Color4u8 *)dst;
|
||||
const FragmentColor *srcA_32 = (const FragmentColor *)srcA;
|
||||
const FragmentColor *srcB_32 = (const FragmentColor *)srcB;
|
||||
FragmentColor *dst32 = (FragmentColor *)dst;
|
||||
|
||||
#ifdef USEMANUALVECTORIZATION
|
||||
#pragma LOOPVECTORIZE_DISABLE
|
||||
#endif
|
||||
for (; i < length; i++)
|
||||
{
|
||||
const Color4u8 colorA = srcA_32[i];
|
||||
const Color4u8 colorB = srcB_32[i];
|
||||
const FragmentColor colorA = srcA_32[i];
|
||||
const FragmentColor colorB = srcB_32[i];
|
||||
|
||||
dst32[i] = this->_RenderLine_DispCapture_BlendFunc<OUTPUTFORMAT>(colorA, colorB, blendEVA, blendEVB);
|
||||
}
|
||||
|
@ -4406,9 +4383,9 @@ void GPUEngineA::_RenderLine_DispCapture_Blend(const GPUEngineLineInfo &lineInfo
|
|||
for (size_t line = 0; line < lineInfo.renderCount; line++)
|
||||
{
|
||||
this->_RenderLine_DispCapture_Blend_Buffer<OUTPUTFORMAT>(srcA, srcB, dst, blendEVA, blendEVB, captureLengthExt);
|
||||
srcA = (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) ? (void *)((Color4u8 *)srcA + lineInfo.widthCustom) : (void *)((u16 *)srcA + lineInfo.widthCustom);
|
||||
srcB = (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) ? (void *)((Color4u8 *)srcB + lineInfo.widthCustom) : (void *)((u16 *)srcB + lineInfo.widthCustom);
|
||||
dst = (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) ? (void *)((Color4u8 *)dst + lineInfo.widthCustom) : (void *)((u16 *)dst + lineInfo.widthCustom);
|
||||
srcA = (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) ? (void *)((FragmentColor *)srcA + lineInfo.widthCustom) : (void *)((u16 *)srcA + lineInfo.widthCustom);
|
||||
srcB = (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) ? (void *)((FragmentColor *)srcB + lineInfo.widthCustom) : (void *)((u16 *)srcB + lineInfo.widthCustom);
|
||||
dst = (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) ? (void *)((FragmentColor *)dst + lineInfo.widthCustom) : (void *)((u16 *)dst + lineInfo.widthCustom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4438,7 +4415,7 @@ void GPUEngineA::_HandleDisplayModeVRAM(const GPUEngineLineInfo &lineInfo)
|
|||
{
|
||||
const u16 *src = (u16 *)this->_VRAMCustomBlockPtr[DISPCNT.VRAM_Block] + lineInfo.blockOffsetCustom;
|
||||
u32 *dst = (u32 *)customBuffer + lineInfo.blockOffsetCustom;
|
||||
ColorspaceConvertBuffer555xTo6665Opaque<false, false, BESwapSrcDst>(src, dst, lineInfo.pixelCount);
|
||||
ColorspaceConvertBuffer555To6665Opaque<false, false, BESwapSrcDst>(src, dst, lineInfo.pixelCount);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4555,36 +4532,29 @@ void GPUEngineB::RenderLine(const size_t l)
|
|||
{
|
||||
GPUEngineCompositorInfo &compInfo = this->_currentCompositorInfo[l];
|
||||
|
||||
if ( this->IsForceBlankSet() )
|
||||
switch (compInfo.renderState.displayOutputMode)
|
||||
{
|
||||
this->_RenderLineBlank(l);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (compInfo.renderState.displayOutputMode)
|
||||
case GPUDisplayMode_Off: // Display Off(Display white)
|
||||
this->_HandleDisplayModeOff(l);
|
||||
break;
|
||||
|
||||
case GPUDisplayMode_Normal: // Display BG and OBJ layers
|
||||
{
|
||||
case GPUDisplayMode_Off: // Display Off (clear line to white)
|
||||
this->_HandleDisplayModeOff(l);
|
||||
break;
|
||||
|
||||
case GPUDisplayMode_Normal: // Display BG and OBJ layers
|
||||
if (compInfo.renderState.isAnyWindowEnabled)
|
||||
{
|
||||
if (compInfo.renderState.isAnyWindowEnabled)
|
||||
{
|
||||
this->_RenderLine_Layers<OUTPUTFORMAT, true>(compInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->_RenderLine_Layers<OUTPUTFORMAT, false>(compInfo);
|
||||
}
|
||||
|
||||
this->_HandleDisplayModeNormal(l);
|
||||
break;
|
||||
this->_RenderLine_Layers<OUTPUTFORMAT, true>(compInfo);
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
else
|
||||
{
|
||||
this->_RenderLine_Layers<OUTPUTFORMAT, false>(compInfo);
|
||||
}
|
||||
|
||||
this->_HandleDisplayModeNormal(l);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (compInfo.line.indexNative >= 191)
|
||||
|
@ -4758,21 +4728,14 @@ void GPUSubsystem::_UpdateFPSRender3D()
|
|||
this->_videoFrameIndex++;
|
||||
if (this->_videoFrameIndex == 60)
|
||||
{
|
||||
this->_render3DFrameCount = GFX3D_GetRender3DFrameCount();
|
||||
GFX3D_ResetRender3DFrameCount();
|
||||
this->_render3DFrameCount = gfx3d.render3DFrameCount;
|
||||
gfx3d.render3DFrameCount = 0;
|
||||
this->_videoFrameIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GPUSubsystem::SetEventHandler(GPUEventHandler *eventHandler)
|
||||
{
|
||||
if ( (eventHandler == NULL) && (this->_event != this->_defaultEventHandler) )
|
||||
{
|
||||
this->ForceFrameStop();
|
||||
this->_event = this->_defaultEventHandler;
|
||||
return;
|
||||
}
|
||||
|
||||
this->_event = eventHandler;
|
||||
}
|
||||
|
||||
|
@ -4980,7 +4943,7 @@ void GPUSubsystem::SetFramebufferPageCount(size_t pageCount)
|
|||
pageCount = MAX_FRAMEBUFFER_PAGES;
|
||||
}
|
||||
|
||||
this->_displayInfo.framebufferPageCount = (u32)pageCount;
|
||||
this->_displayInfo.framebufferPageCount = pageCount;
|
||||
}
|
||||
|
||||
size_t GPUSubsystem::GetCustomFramebufferWidth() const
|
||||
|
@ -5014,9 +4977,9 @@ void GPUSubsystem::SetCustomFramebufferSize(size_t w, size_t h)
|
|||
u8 *oldGpuDstToSrcSSSE3_u16_8e = _gpuDstToSrcSSSE3_u16_8e;
|
||||
u8 *oldGpuDstToSrcSSSE3_u32_4e = _gpuDstToSrcSSSE3_u32_4e;
|
||||
|
||||
for (u32 srcX = 0, currentPitchCount = 0; srcX < GPU_FRAMEBUFFER_NATIVE_WIDTH; srcX++)
|
||||
for (size_t srcX = 0, currentPitchCount = 0; srcX < GPU_FRAMEBUFFER_NATIVE_WIDTH; srcX++)
|
||||
{
|
||||
const u32 pitch = (u32)ceilf(((float)srcX+1.0f) * customWidthScale) - (float)currentPitchCount;
|
||||
const size_t pitch = (size_t)ceilf((srcX+1) * customWidthScale) - currentPitchCount;
|
||||
_gpuDstPitchCount[srcX] = pitch;
|
||||
_gpuDstPitchIndex[srcX] = currentPitchCount;
|
||||
currentPitchCount += pitch;
|
||||
|
@ -5104,8 +5067,8 @@ void GPUSubsystem::SetCustomFramebufferSize(size_t w, size_t h)
|
|||
this->_display[NDSDisplayID_Touch]->SetDisplaySize(w, h);
|
||||
|
||||
this->_displayInfo.isCustomSizeRequested = ( (w != GPU_FRAMEBUFFER_NATIVE_WIDTH) || (h != GPU_FRAMEBUFFER_NATIVE_HEIGHT) );
|
||||
this->_displayInfo.customWidth = (u32)w;
|
||||
this->_displayInfo.customHeight = (u32)h;
|
||||
this->_displayInfo.customWidth = w;
|
||||
this->_displayInfo.customHeight = h;
|
||||
|
||||
if (!this->_display[NDSDisplayID_Main]->IsCustomSizeRequested())
|
||||
{
|
||||
|
@ -5147,7 +5110,7 @@ void GPUSubsystem::SetColorFormat(const NDSColorFormat outputFormat)
|
|||
this->_display[NDSDisplayID_Touch]->SetColorFormat(outputFormat);
|
||||
|
||||
this->_displayInfo.colorFormat = this->_display[NDSDisplayID_Main]->GetColorFormat();
|
||||
this->_displayInfo.pixelBytes = (u32)this->_display[NDSDisplayID_Main]->GetPixelBytes();
|
||||
this->_displayInfo.pixelBytes = this->_display[NDSDisplayID_Main]->GetPixelBytes();
|
||||
|
||||
if (!this->_displayInfo.isCustomSizeRequested)
|
||||
{
|
||||
|
@ -5165,7 +5128,7 @@ void GPUSubsystem::_AllocateFramebuffers(NDSColorFormat outputFormat, size_t w,
|
|||
void *oldMasterFramebuffer = this->_masterFramebuffer;
|
||||
void *oldCustomVRAM = this->_customVRAM;
|
||||
|
||||
const size_t pixelBytes = (outputFormat == NDSColorFormat_BGR555_Rev) ? sizeof(u16) : sizeof(Color4u8);
|
||||
const size_t pixelBytes = (outputFormat == NDSColorFormat_BGR555_Rev) ? sizeof(u16) : sizeof(FragmentColor);
|
||||
const size_t newCustomVRAMBlockSize = this->_lineInfo[GPU_VRAM_BLOCK_LINES].indexCustom * w;
|
||||
const size_t newCustomVRAMBlankSize = _gpuLargestDstLineCount * GPU_VRAM_BLANK_REGION_LINES * w;
|
||||
const size_t nativeFramebufferSize = GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(u16);
|
||||
|
@ -5173,8 +5136,8 @@ void GPUSubsystem::_AllocateFramebuffers(NDSColorFormat outputFormat, size_t w,
|
|||
|
||||
void *newCustomVRAM = NULL;
|
||||
|
||||
this->_displayInfo.framebufferPageCount = (u32)pageCount;
|
||||
this->_displayInfo.framebufferPageSize = (u32)( (nativeFramebufferSize * 2) + (customFramebufferSize * 2) );
|
||||
this->_displayInfo.framebufferPageCount = pageCount;
|
||||
this->_displayInfo.framebufferPageSize = (nativeFramebufferSize * 2) + (customFramebufferSize * 2);
|
||||
this->_masterFramebuffer = malloc_alignedPage(this->_displayInfo.framebufferPageSize * this->_displayInfo.framebufferPageCount);
|
||||
|
||||
if (outputFormat != NDSColorFormat_BGR555_Rev)
|
||||
|
@ -5244,10 +5207,10 @@ void GPUSubsystem::_AllocateFramebuffers(NDSColorFormat outputFormat, size_t w,
|
|||
break;
|
||||
|
||||
case NDSColorFormat_BGR888_Rev:
|
||||
newCustomVRAM = (void *)malloc_alignedPage(((newCustomVRAMBlockSize * 4) + newCustomVRAMBlankSize) * sizeof(Color4u8));
|
||||
memset(newCustomVRAM, 0, ((newCustomVRAMBlockSize * 4) + newCustomVRAMBlankSize) * sizeof(Color4u8));
|
||||
newCustomVRAM = (void *)malloc_alignedPage(((newCustomVRAMBlockSize * 4) + newCustomVRAMBlankSize) * sizeof(FragmentColor));
|
||||
memset(newCustomVRAM, 0, ((newCustomVRAMBlockSize * 4) + newCustomVRAMBlankSize) * sizeof(FragmentColor));
|
||||
this->_customVRAM = newCustomVRAM;
|
||||
this->_customVRAMBlank = (Color4u8 *)newCustomVRAM + (newCustomVRAMBlockSize * 4);
|
||||
this->_customVRAMBlank = (FragmentColor *)newCustomVRAM + (newCustomVRAMBlockSize * 4);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -5371,7 +5334,7 @@ void* GPUSubsystem::GetCustomVRAMAddressUsingMappedAddress(const u32 mappedAddr,
|
|||
const size_t blockLine = (vramPixel >> 8) & 0x000000FF; // blockLine = (vramPixel % (GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_VRAM_BLOCK_LINES)) / GPU_FRAMEBUFFER_NATIVE_WIDTH
|
||||
const size_t linePixel = vramPixel & 0x000000FF; // linePixel = (vramPixel % (GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_VRAM_BLOCK_LINES)) % GPU_FRAMEBUFFER_NATIVE_WIDTH
|
||||
|
||||
return (COLORFORMAT == NDSColorFormat_BGR888_Rev) ? (void *)((Color4u8 *)this->GetEngineMain()->GetCustomVRAMBlockPtr(blockID) + (this->_lineInfo[blockLine].indexCustom * this->_lineInfo[blockLine].widthCustom) + _gpuDstPitchIndex[linePixel] + offset) : (void *)((u16 *)this->GetEngineMain()->GetCustomVRAMBlockPtr(blockID) + (this->_lineInfo[blockLine].indexCustom * this->_lineInfo[blockLine].widthCustom) + _gpuDstPitchIndex[linePixel] + offset);
|
||||
return (COLORFORMAT == NDSColorFormat_BGR888_Rev) ? (void *)((FragmentColor *)this->GetEngineMain()->GetCustomVRAMBlockPtr(blockID) + (this->_lineInfo[blockLine].indexCustom * this->_lineInfo[blockLine].widthCustom) + _gpuDstPitchIndex[linePixel] + offset) : (void *)((u16 *)this->GetEngineMain()->GetCustomVRAMBlockPtr(blockID) + (this->_lineInfo[blockLine].indexCustom * this->_lineInfo[blockLine].widthCustom) + _gpuDstPitchIndex[linePixel] + offset);
|
||||
}
|
||||
|
||||
bool GPUSubsystem::GetWillPostprocessDisplays() const
|
||||
|
@ -5490,7 +5453,7 @@ void GPUSubsystem::RenderLine(const size_t l)
|
|||
this->_engineSub->UpdateRenderStates(l);
|
||||
}
|
||||
|
||||
if ( (isFramebufferRenderNeeded[GPUEngineID_Main] || this->_engineMain->IsForceBlankSet() || isDisplayCaptureNeeded) && !this->_willFrameSkip )
|
||||
if ( (isFramebufferRenderNeeded[GPUEngineID_Main] || isDisplayCaptureNeeded) && !this->_willFrameSkip )
|
||||
{
|
||||
// GPUEngineA:WillRender3DLayer() and GPUEngineA:WillCapture3DLayerDirect() both rely on register
|
||||
// states that might change on a per-line basis. Therefore, we need to check these states on a
|
||||
|
@ -5538,7 +5501,7 @@ void GPUSubsystem::RenderLine(const size_t l)
|
|||
this->_engineMain->UpdatePropertiesWithoutRender(l);
|
||||
}
|
||||
|
||||
if ( (isFramebufferRenderNeeded[GPUEngineID_Sub] || this->_engineSub->IsForceBlankSet()) && !this->_willFrameSkip)
|
||||
if (isFramebufferRenderNeeded[GPUEngineID_Sub] && !this->_willFrameSkip)
|
||||
{
|
||||
switch (this->_engineSub->GetTargetDisplay()->GetColorFormat())
|
||||
{
|
||||
|
@ -5577,13 +5540,13 @@ void GPUSubsystem::RenderLine(const size_t l)
|
|||
|
||||
this->_displayInfo.didPerformCustomRender[NDSDisplayID_Main] = this->_display[NDSDisplayID_Main]->DidPerformCustomRender();
|
||||
this->_displayInfo.renderedBuffer[NDSDisplayID_Main] = this->_display[NDSDisplayID_Main]->GetRenderedBuffer();
|
||||
this->_displayInfo.renderedWidth[NDSDisplayID_Main] = (u32)this->_display[NDSDisplayID_Main]->GetRenderedWidth();
|
||||
this->_displayInfo.renderedHeight[NDSDisplayID_Main] = (u32)this->_display[NDSDisplayID_Main]->GetRenderedHeight();
|
||||
this->_displayInfo.renderedWidth[NDSDisplayID_Main] = this->_display[NDSDisplayID_Main]->GetRenderedWidth();
|
||||
this->_displayInfo.renderedHeight[NDSDisplayID_Main] = this->_display[NDSDisplayID_Main]->GetRenderedHeight();
|
||||
|
||||
this->_displayInfo.didPerformCustomRender[NDSDisplayID_Touch] = this->_display[NDSDisplayID_Touch]->DidPerformCustomRender();
|
||||
this->_displayInfo.renderedBuffer[NDSDisplayID_Touch] = this->_display[NDSDisplayID_Touch]->GetRenderedBuffer();
|
||||
this->_displayInfo.renderedWidth[NDSDisplayID_Touch] = (u32)this->_display[NDSDisplayID_Touch]->GetRenderedWidth();
|
||||
this->_displayInfo.renderedHeight[NDSDisplayID_Touch] = (u32)this->_display[NDSDisplayID_Touch]->GetRenderedHeight();
|
||||
this->_displayInfo.renderedWidth[NDSDisplayID_Touch] = this->_display[NDSDisplayID_Touch]->GetRenderedWidth();
|
||||
this->_displayInfo.renderedHeight[NDSDisplayID_Touch] = this->_display[NDSDisplayID_Touch]->GetRenderedHeight();
|
||||
|
||||
this->_displayInfo.engineID[NDSDisplayID_Main] = this->_display[NDSDisplayID_Main]->GetEngineID();
|
||||
this->_displayInfo.engineID[NDSDisplayID_Touch] = this->_display[NDSDisplayID_Touch]->GetEngineID();
|
||||
|
@ -5675,16 +5638,16 @@ void GPUSubsystem::ClearWithColor(const u16 colorBGRA5551)
|
|||
}
|
||||
else
|
||||
{
|
||||
Color4u8 color32;
|
||||
FragmentColor color32;
|
||||
|
||||
switch (this->_displayInfo.colorFormat)
|
||||
{
|
||||
case NDSColorFormat_BGR666_Rev:
|
||||
color32.value = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>(colorBGRA5551 & 0x7FFF) );
|
||||
color32.color = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>(colorBGRA5551 & 0x7FFF) );
|
||||
break;
|
||||
|
||||
case NDSColorFormat_BGR888_Rev:
|
||||
color32.value = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>(colorBGRA5551 & 0x7FFF) );
|
||||
color32.color = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>(colorBGRA5551 & 0x7FFF) );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -5694,7 +5657,7 @@ void GPUSubsystem::ClearWithColor(const u16 colorBGRA5551)
|
|||
for (size_t i = 0; i < this->_displayInfo.framebufferPageCount; i++)
|
||||
{
|
||||
memset_u16((u8 *)this->_masterFramebuffer + (this->_displayInfo.framebufferPageSize * i), color16, nativeFramebufferPixCount);
|
||||
memset_u32((u8 *)this->_masterFramebuffer + (this->_displayInfo.framebufferPageSize * i) + (nativeFramebufferPixCount * sizeof(u16)), color32.value, customFramebufferPixCount);
|
||||
memset_u32((u8 *)this->_masterFramebuffer + (this->_displayInfo.framebufferPageSize * i) + (nativeFramebufferPixCount * sizeof(u16)), color32.color, customFramebufferPixCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5783,11 +5746,11 @@ void GPUSubsystem::_ConvertAndUpscaleForLoadstate(const NDSDisplayID displayID,
|
|||
switch (this->_display[displayID]->GetColorFormat())
|
||||
{
|
||||
case NDSColorFormat_BGR666_Rev:
|
||||
ColorspaceConvertBuffer555xTo6665Opaque<false, false, BESwapDst>(src, working, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
ColorspaceConvertBuffer555To6665Opaque<false, false, BESwapDst>(src, working, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
break;
|
||||
|
||||
case NDSColorFormat_BGR888_Rev:
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>(src, working, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>(src, working, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -6215,11 +6178,11 @@ void NDSDisplay::ResolveLinesDisplayedNative()
|
|||
{
|
||||
if (this->_customColorFormat == NDSColorFormat_BGR888_Rev)
|
||||
{
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>(src, working, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>(src, working, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvertBuffer555xTo6665Opaque<false, false, BESwapDst>(src, working, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
ColorspaceConvertBuffer555To6665Opaque<false, false, BESwapDst>(src, working, GPU_FRAMEBUFFER_NATIVE_WIDTH);
|
||||
}
|
||||
|
||||
CopyLineExpandHinted<0x3FFF, true, false, false, 4>(lineInfo, working, dst);
|
||||
|
@ -6259,7 +6222,7 @@ void NDSDisplay::ResolveFramebufferToCustom(NDSDisplayInfo &mutableInfo)
|
|||
{
|
||||
case NDSColorFormat_BGR666_Rev:
|
||||
case NDSColorFormat_BGR888_Rev:
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>(src, working, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>(src, working, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -6301,7 +6264,7 @@ void NDSDisplay::ResolveFramebufferToCustom(NDSDisplayInfo &mutableInfo)
|
|||
|
||||
case NDSColorFormat_BGR666_Rev:
|
||||
case NDSColorFormat_BGR888_Rev:
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>(this->_nativeBuffer16, (u32 *)this->_customBuffer, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>(this->_nativeBuffer16, (u32 *)this->_customBuffer, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -6350,7 +6313,7 @@ NDSColorFormat NDSDisplay::GetColorFormat() const
|
|||
void NDSDisplay::SetColorFormat(NDSColorFormat colorFormat)
|
||||
{
|
||||
this->_customColorFormat = colorFormat;
|
||||
this->_customPixelBytes = (colorFormat == NDSColorFormat_BGR555_Rev) ? sizeof(u16) : sizeof(Color4u8);
|
||||
this->_customPixelBytes = (colorFormat == NDSColorFormat_BGR555_Rev) ? sizeof(u16) : sizeof(FragmentColor);
|
||||
}
|
||||
|
||||
size_t NDSDisplay::GetPixelBytes() const
|
||||
|
@ -6478,8 +6441,8 @@ void NDSDisplay::ApplyMasterBrightness(void *dst, const size_t pixCount, const G
|
|||
}
|
||||
else
|
||||
{
|
||||
((Color4u8 *)dst)[i] = colorop.increase<OUTPUTFORMAT>(((Color4u8 *)dst)[i], intensityClamped);
|
||||
((Color4u8 *)dst)[i].a = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F : 0xFF;
|
||||
((FragmentColor *)dst)[i] = colorop.increase<OUTPUTFORMAT>(((FragmentColor *)dst)[i], intensityClamped);
|
||||
((FragmentColor *)dst)[i].a = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F : 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6525,8 +6488,8 @@ void NDSDisplay::ApplyMasterBrightness(void *dst, const size_t pixCount, const G
|
|||
}
|
||||
else
|
||||
{
|
||||
((Color4u8 *)dst)[i] = colorop.decrease<OUTPUTFORMAT>(((Color4u8 *)dst)[i], intensityClamped);
|
||||
((Color4u8 *)dst)[i].a = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F : 0xFF;
|
||||
((FragmentColor *)dst)[i] = colorop.decrease<OUTPUTFORMAT>(((FragmentColor *)dst)[i], intensityClamped);
|
||||
((FragmentColor *)dst)[i].a = (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) ? 0x1F : 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2006-2007 Theo Berkau
|
||||
Copyright (C) 2007 shash
|
||||
Copyright (C) 2009-2023 DeSmuME team
|
||||
Copyright (C) 2009-2022 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
|
||||
|
@ -117,7 +117,7 @@ typedef union
|
|||
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_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 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 ExOBJPalette_Enable:1; // 31: A+B; 0=Disable, 1=Enable OBJ extended Palette
|
||||
#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_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)
|
||||
|
@ -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 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 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 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);
|
||||
|
@ -600,7 +600,7 @@ typedef union
|
|||
// 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 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 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
|
||||
|
@ -1330,7 +1330,7 @@ typedef struct
|
|||
GPUDisplayMode displayOutputMode;
|
||||
u16 backdropColor16;
|
||||
u16 workingBackdropColor16;
|
||||
Color4u8 workingBackdropColor32;
|
||||
FragmentColor workingBackdropColor32;
|
||||
ColorEffect colorEffect;
|
||||
u8 blendEVA;
|
||||
u8 blendEVB;
|
||||
|
@ -1342,11 +1342,11 @@ typedef struct
|
|||
|
||||
TBlendTable *blendTable555;
|
||||
u16 *brightnessUpTable555;
|
||||
Color4u8 *brightnessUpTable666;
|
||||
Color4u8 *brightnessUpTable888;
|
||||
FragmentColor *brightnessUpTable666;
|
||||
FragmentColor *brightnessUpTable888;
|
||||
u16 *brightnessDownTable555;
|
||||
Color4u8 *brightnessDownTable666;
|
||||
Color4u8 *brightnessDownTable888;
|
||||
FragmentColor *brightnessDownTable666;
|
||||
FragmentColor *brightnessDownTable888;
|
||||
|
||||
u8 WIN0_enable[6];
|
||||
u8 WIN1_enable[6];
|
||||
|
@ -1387,7 +1387,7 @@ typedef struct
|
|||
size_t xCustom;
|
||||
void **lineColor;
|
||||
u16 *lineColor16;
|
||||
Color4u8 *lineColor32;
|
||||
FragmentColor *lineColor32;
|
||||
u8 *lineLayerID;
|
||||
} GPUEngineTargetState;
|
||||
|
||||
|
@ -1503,7 +1503,7 @@ protected:
|
|||
volatile s32 _asyncClearLineCustom;
|
||||
volatile s32 _asyncClearInterrupt;
|
||||
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.
|
||||
|
||||
void _ResortBGLayers();
|
||||
|
@ -1523,11 +1523,11 @@ protected:
|
|||
|
||||
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 _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 _CompositeVRAMLineDeferred_LoopOp(GPUEngineCompositorInfo &compInfo, const u8 *__restrict windowTestPtr, const u8 *__restrict colorEffectEnablePtr, const void *__restrict vramColorPtr);
|
||||
|
||||
|
@ -1543,8 +1543,6 @@ protected:
|
|||
void _RenderLine_SetupSprites(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 _HandleDisplayModeNormal(const size_t l);
|
||||
|
||||
|
@ -1611,7 +1609,6 @@ public:
|
|||
|
||||
const GPU_IOREG& GetIORegisterMap() const;
|
||||
|
||||
bool IsForceBlankSet() const;
|
||||
bool IsMasterBrightMaxOrMin() const;
|
||||
|
||||
bool GetEnableState();
|
||||
|
@ -1623,9 +1620,9 @@ public:
|
|||
void ApplySettings();
|
||||
|
||||
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 RenderLineClearAsyncWaitForCustomLine(const size_t l);
|
||||
void RenderLineClearAsyncWaitForCustomLine(const s32 l);
|
||||
|
||||
void TransitionRenderStatesToDisplayInfo(NDSDisplayInfo &mutableInfo);
|
||||
|
||||
|
@ -1654,12 +1651,12 @@ private:
|
|||
|
||||
protected:
|
||||
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];
|
||||
u16 *_VRAMNativeBlockCaptureCopyPtr[4];
|
||||
|
||||
Color4u8 *_3DFramebufferMain;
|
||||
FragmentColor *_3DFramebufferMain;
|
||||
u16 *_3DFramebuffer16;
|
||||
|
||||
u16 *_VRAMNativeBlockPtr[4];
|
||||
|
@ -1671,8 +1668,8 @@ protected:
|
|||
u16 *_captureWorkingDisplay16;
|
||||
u16 *_captureWorkingA16;
|
||||
u16 *_captureWorkingB16;
|
||||
Color4u8 *_captureWorkingA32;
|
||||
Color4u8 *_captureWorkingB32;
|
||||
FragmentColor *_captureWorkingA32;
|
||||
FragmentColor *_captureWorkingB32;
|
||||
|
||||
DISPCAPCNT_parsed _dispCapCnt;
|
||||
bool _displayCaptureEnable;
|
||||
|
@ -1695,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
|
||||
|
||||
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>
|
||||
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>
|
||||
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
|
||||
|
@ -1719,7 +1716,7 @@ public:
|
|||
void ParseReg_DISPCAPCNT();
|
||||
bool IsLineCaptureNative(const size_t blockID, const size_t blockLine);
|
||||
void* GetCustomVRAMBlockPtr(const size_t blockID);
|
||||
Color4u8* Get3DFramebufferMain() const;
|
||||
FragmentColor* Get3DFramebufferMain() const;
|
||||
u16* Get3DFramebuffer16() const;
|
||||
virtual void AllocateWorkingBuffers(NDSColorFormat requestedColorFormat, size_t w, size_t h);
|
||||
|
||||
|
@ -1822,8 +1819,8 @@ public:
|
|||
bool IsCustomSizeRequested() const;
|
||||
|
||||
void* GetRenderedBuffer() const;
|
||||
size_t GetRenderedWidth() const;
|
||||
size_t GetRenderedHeight() const;
|
||||
size_t GetRenderedWidth() const;
|
||||
size_t GetRenderedHeight() const;
|
||||
|
||||
bool IsEnabled() const;
|
||||
void SetIsEnabled(bool stateIsEnabled);
|
||||
|
|
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -32,11 +32,11 @@ static CACHE_ALIGN u32 _gpuDstPitchIndex[GPU_FRAMEBUFFER_NATIVE_WIDTH]; // Key:
|
|||
|
||||
u8 PixelOperation::BlendTable555[17][17][32][32];
|
||||
u16 PixelOperation::BrightnessUpTable555[17][0x8000];
|
||||
Color4u8 PixelOperation::BrightnessUpTable666[17][0x8000];
|
||||
Color4u8 PixelOperation::BrightnessUpTable888[17][0x8000];
|
||||
FragmentColor PixelOperation::BrightnessUpTable666[17][0x8000];
|
||||
FragmentColor PixelOperation::BrightnessUpTable888[17][0x8000];
|
||||
u16 PixelOperation::BrightnessDownTable555[17][0x8000];
|
||||
Color4u8 PixelOperation::BrightnessDownTable666[17][0x8000];
|
||||
Color4u8 PixelOperation::BrightnessDownTable888[17][0x8000];
|
||||
FragmentColor PixelOperation::BrightnessDownTable666[17][0x8000];
|
||||
FragmentColor PixelOperation::BrightnessDownTable888[17][0x8000];
|
||||
|
||||
static CACHE_ALIGN ColorOperation colorop;
|
||||
static CACHE_ALIGN PixelOperation pixelop;
|
||||
|
@ -71,9 +71,9 @@ FORCEINLINE u16 ColorOperation::blend(const u16 colA, const u16 colB, const TBle
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
u16 r16 = ( (colA.r * blendEVA) + (colB.r * blendEVB) ) / 16;
|
||||
u16 g16 = ( (colA.g * blendEVA) + (colB.g * blendEVB) ) / 16;
|
||||
|
@ -96,7 +96,7 @@ FORCEINLINE Color4u8 ColorOperation::blend(const Color4u8 colA, const Color4u8 c
|
|||
return outColor;
|
||||
}
|
||||
|
||||
FORCEINLINE u16 ColorOperation::blend3D(const Color4u8 colA, const u16 colB) const
|
||||
FORCEINLINE u16 ColorOperation::blend3D(const FragmentColor colA, const u16 colB) const
|
||||
{
|
||||
const u16 alpha = colA.a + 1;
|
||||
COLOR c2;
|
||||
|
@ -113,9 +113,9 @@ FORCEINLINE u16 ColorOperation::blend3D(const Color4u8 colA, const u16 colB) con
|
|||
}
|
||||
|
||||
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 blendedColor;
|
||||
FragmentColor blendedColor;
|
||||
const u16 alpha = colA.a + 1;
|
||||
|
||||
if (COLORFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
|
@ -149,10 +149,10 @@ FORCEINLINE u16 ColorOperation::increase(const u16 col, const u16 blendEVY) cons
|
|||
}
|
||||
|
||||
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 newColor;
|
||||
newColor.value = 0;
|
||||
FragmentColor newColor;
|
||||
newColor.color = 0;
|
||||
|
||||
u32 r = col.r;
|
||||
u32 g = col.g;
|
||||
|
@ -188,10 +188,10 @@ FORCEINLINE u16 ColorOperation::decrease(const u16 col, const u16 blendEVY) cons
|
|||
}
|
||||
|
||||
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 newColor;
|
||||
newColor.value = 0;
|
||||
FragmentColor newColor;
|
||||
newColor.color = 0;
|
||||
|
||||
u32 r = col.r;
|
||||
u32 g = col.g;
|
||||
|
@ -242,8 +242,8 @@ void PixelOperation::InitLUTs()
|
|||
cur.bits.blue = (cur.bits.blue + ((31 - cur.bits.blue) * i / 16));
|
||||
cur.bits.alpha = 0;
|
||||
PixelOperation::BrightnessUpTable555[i][j] = cur.val;
|
||||
PixelOperation::BrightnessUpTable666[i][j].value = LOCAL_TO_LE_32( COLOR555TO666(cur.val) );
|
||||
PixelOperation::BrightnessUpTable888[i][j].value = LOCAL_TO_LE_32( COLOR555TO888(cur.val) );
|
||||
PixelOperation::BrightnessUpTable666[i][j].color = LOCAL_TO_LE_32( COLOR555TO666(cur.val) );
|
||||
PixelOperation::BrightnessUpTable888[i][j].color = LOCAL_TO_LE_32( COLOR555TO888(cur.val) );
|
||||
|
||||
cur.val = j;
|
||||
cur.bits.red = (cur.bits.red - (cur.bits.red * i / 16));
|
||||
|
@ -251,8 +251,8 @@ void PixelOperation::InitLUTs()
|
|||
cur.bits.blue = (cur.bits.blue - (cur.bits.blue * i / 16));
|
||||
cur.bits.alpha = 0;
|
||||
PixelOperation::BrightnessDownTable555[i][j] = cur.val;
|
||||
PixelOperation::BrightnessDownTable666[i][j].value = LOCAL_TO_LE_32( COLOR555TO666(cur.val) );
|
||||
PixelOperation::BrightnessDownTable888[i][j].value = LOCAL_TO_LE_32( COLOR555TO888(cur.val) );
|
||||
PixelOperation::BrightnessDownTable666[i][j].color = LOCAL_TO_LE_32( COLOR555TO666(cur.val) );
|
||||
PixelOperation::BrightnessDownTable888[i][j].color = LOCAL_TO_LE_32( COLOR555TO888(cur.val) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ template <NDSColorFormat OUTPUTFORMAT, bool ISDEBUGRENDER>
|
|||
FORCEINLINE void PixelOperation::_copy16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16) const
|
||||
{
|
||||
u16 &dstColor16 = *compInfo.target.lineColor16;
|
||||
Color4u8 &dstColor32 = *compInfo.target.lineColor32;
|
||||
FragmentColor &dstColor32 = *compInfo.target.lineColor32;
|
||||
u8 &dstLayerID = *compInfo.target.lineLayerID;
|
||||
|
||||
switch (OUTPUTFORMAT)
|
||||
|
@ -289,11 +289,11 @@ FORCEINLINE void PixelOperation::_copy16(GPUEngineCompositorInfo &compInfo, cons
|
|||
break;
|
||||
|
||||
case NDSColorFormat_BGR666_Rev:
|
||||
dstColor32.value = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>(srcColor16) );
|
||||
dstColor32.color = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>(srcColor16) );
|
||||
break;
|
||||
|
||||
case NDSColorFormat_BGR888_Rev:
|
||||
dstColor32.value = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>(srcColor16) );
|
||||
dstColor32.color = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>(srcColor16) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -304,10 +304,10 @@ FORCEINLINE void PixelOperation::_copy16(GPUEngineCompositorInfo &compInfo, cons
|
|||
}
|
||||
|
||||
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
|
||||
{
|
||||
u16 &dstColor16 = *compInfo.target.lineColor16;
|
||||
Color4u8 &dstColor32 = *compInfo.target.lineColor32;
|
||||
FragmentColor &dstColor32 = *compInfo.target.lineColor32;
|
||||
u8 &dstLayerID = *compInfo.target.lineLayerID;
|
||||
|
||||
switch (OUTPUTFORMAT)
|
||||
|
@ -341,7 +341,7 @@ template <NDSColorFormat OUTPUTFORMAT>
|
|||
FORCEINLINE void PixelOperation::_brightnessUp16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16) const
|
||||
{
|
||||
u16 &dstColor16 = *compInfo.target.lineColor16;
|
||||
Color4u8 &dstColor32 = *compInfo.target.lineColor32;
|
||||
FragmentColor &dstColor32 = *compInfo.target.lineColor32;
|
||||
u8 &dstLayerID = *compInfo.target.lineLayerID;
|
||||
|
||||
switch (OUTPUTFORMAT)
|
||||
|
@ -365,10 +365,10 @@ FORCEINLINE void PixelOperation::_brightnessUp16(GPUEngineCompositorInfo &compIn
|
|||
}
|
||||
|
||||
template <NDSColorFormat OUTPUTFORMAT>
|
||||
FORCEINLINE void PixelOperation::_brightnessUp32(GPUEngineCompositorInfo &compInfo, const Color4u8 srcColor32) const
|
||||
FORCEINLINE void PixelOperation::_brightnessUp32(GPUEngineCompositorInfo &compInfo, const FragmentColor srcColor32) const
|
||||
{
|
||||
u16 &dstColor16 = *compInfo.target.lineColor16;
|
||||
Color4u8 &dstColor32 = *compInfo.target.lineColor32;
|
||||
FragmentColor &dstColor32 = *compInfo.target.lineColor32;
|
||||
u8 &dstLayerID = *compInfo.target.lineLayerID;
|
||||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev)
|
||||
|
@ -390,7 +390,7 @@ template <NDSColorFormat OUTPUTFORMAT>
|
|||
FORCEINLINE void PixelOperation::_brightnessDown16(GPUEngineCompositorInfo &compInfo, const u16 srcColor16) const
|
||||
{
|
||||
u16 &dstColor16 = *compInfo.target.lineColor16;
|
||||
Color4u8 &dstColor32 = *compInfo.target.lineColor32;
|
||||
FragmentColor &dstColor32 = *compInfo.target.lineColor32;
|
||||
u8 &dstLayerID = *compInfo.target.lineLayerID;
|
||||
|
||||
switch (OUTPUTFORMAT)
|
||||
|
@ -414,10 +414,10 @@ FORCEINLINE void PixelOperation::_brightnessDown16(GPUEngineCompositorInfo &comp
|
|||
}
|
||||
|
||||
template <NDSColorFormat OUTPUTFORMAT>
|
||||
FORCEINLINE void PixelOperation::_brightnessDown32(GPUEngineCompositorInfo &compInfo, const Color4u8 srcColor32) const
|
||||
FORCEINLINE void PixelOperation::_brightnessDown32(GPUEngineCompositorInfo &compInfo, const FragmentColor srcColor32) const
|
||||
{
|
||||
u16 &dstColor16 = *compInfo.target.lineColor16;
|
||||
Color4u8 &dstColor32 = *compInfo.target.lineColor32;
|
||||
FragmentColor &dstColor32 = *compInfo.target.lineColor32;
|
||||
u8 &dstLayerID = *compInfo.target.lineLayerID;
|
||||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR555_Rev)
|
||||
|
@ -555,14 +555,14 @@ FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compI
|
|||
}
|
||||
else
|
||||
{
|
||||
Color4u8 &dstColor32 = *compInfo.target.lineColor32;
|
||||
FragmentColor &dstColor32 = *compInfo.target.lineColor32;
|
||||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
{
|
||||
switch (selectedEffect)
|
||||
{
|
||||
case ColorEffect_Disable:
|
||||
dstColor32.value = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>(srcColor16) );
|
||||
dstColor32.color = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>(srcColor16) );
|
||||
break;
|
||||
|
||||
case ColorEffect_IncreaseBrightness:
|
||||
|
@ -575,8 +575,8 @@ FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compI
|
|||
|
||||
case ColorEffect_Blend:
|
||||
{
|
||||
Color4u8 srcColor32;
|
||||
srcColor32.value = LE_TO_LOCAL_32( ColorspaceConvert555To6665Opaque<false>(srcColor16) );
|
||||
FragmentColor srcColor32;
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
@ -587,7 +587,7 @@ FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compI
|
|||
switch (selectedEffect)
|
||||
{
|
||||
case ColorEffect_Disable:
|
||||
dstColor32.value = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>(srcColor16) );
|
||||
dstColor32.color = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>(srcColor16) );
|
||||
break;
|
||||
|
||||
case ColorEffect_IncreaseBrightness:
|
||||
|
@ -600,8 +600,8 @@ FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compI
|
|||
|
||||
case ColorEffect_Blend:
|
||||
{
|
||||
Color4u8 srcColor32;
|
||||
srcColor32.value = LE_TO_LOCAL_32( ColorspaceConvert555To8888Opaque<false>(srcColor16) );
|
||||
FragmentColor srcColor32;
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ FORCEINLINE void PixelOperation::_unknownEffect16(GPUEngineCompositorInfo &compI
|
|||
}
|
||||
|
||||
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;
|
||||
TBlendTable *selectedBlendTable = compInfo.renderState.blendTable555;
|
||||
|
@ -663,7 +663,7 @@ FORCEINLINE void PixelOperation::_unknownEffect32(GPUEngineCompositorInfo &compI
|
|||
}
|
||||
else
|
||||
{
|
||||
Color4u8 &dstColor32 = *compInfo.target.lineColor32;
|
||||
FragmentColor &dstColor32 = *compInfo.target.lineColor32;
|
||||
|
||||
switch (selectedEffect)
|
||||
{
|
||||
|
@ -716,7 +716,7 @@ FORCEINLINE void PixelOperation::Composite16(GPUEngineCompositorInfo &compInfo,
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -758,8 +758,6 @@ static FORCEINLINE void CopyLinesForVerticalCount(void *__restrict dstLineHead,
|
|||
#include "GPU_Operations_AVX2.cpp"
|
||||
#elif defined(ENABLE_SSE2)
|
||||
#include "GPU_Operations_SSE2.cpp"
|
||||
#elif defined(ENABLE_NEON_A64)
|
||||
#include "GPU_Operations_NEON.cpp"
|
||||
#else
|
||||
|
||||
template <s32 INTEGERSCALEHINT, bool SCALEVERTICAL, bool NEEDENDIANSWAP, size_t ELEMENTSIZE>
|
||||
|
@ -1015,7 +1013,7 @@ void GPUEngineBase::_MosaicLine(GPUEngineCompositorInfo &compInfo)
|
|||
}
|
||||
|
||||
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.
|
||||
}
|
||||
|
@ -1088,7 +1086,7 @@ void GPUEngineBase::_PerformWindowTestingNative(GPUEngineCompositorInfo &compInf
|
|||
}
|
||||
|
||||
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.
|
||||
return 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2021-2023 DeSmuME team
|
||||
Copyright (C) 2021 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
|
||||
|
@ -47,16 +47,16 @@ public:
|
|||
|
||||
FORCEINLINE u16 blend(const u16 colA, const u16 colB, const u16 blendEVA, const u16 blendEVB) 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 u16 blend3D(const Color4u8 colA, const u16 colB) const;
|
||||
template<NDSColorFormat COLORFORMAT> FORCEINLINE Color4u8 blend3D(const Color4u8 colA, const Color4u8 colB) const;
|
||||
FORCEINLINE u16 blend3D(const FragmentColor colA, const u16 colB) const;
|
||||
template<NDSColorFormat COLORFORMAT> FORCEINLINE FragmentColor blend3D(const FragmentColor colA, const FragmentColor colB) 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 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
|
||||
|
@ -66,31 +66,31 @@ private:
|
|||
|
||||
protected:
|
||||
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 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 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 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:
|
||||
static CACHE_ALIGN u8 BlendTable555[17][17][32][32];
|
||||
static CACHE_ALIGN u16 BrightnessUpTable555[17][0x8000];
|
||||
static CACHE_ALIGN Color4u8 BrightnessUpTable666[17][0x8000];
|
||||
static CACHE_ALIGN Color4u8 BrightnessUpTable888[17][0x8000];
|
||||
static CACHE_ALIGN FragmentColor BrightnessUpTable666[17][0x8000];
|
||||
static CACHE_ALIGN FragmentColor BrightnessUpTable888[17][0x8000];
|
||||
static CACHE_ALIGN u16 BrightnessDownTable555[17][0x8000];
|
||||
static CACHE_ALIGN Color4u8 BrightnessDownTable666[17][0x8000];
|
||||
static CACHE_ALIGN Color4u8 BrightnessDownTable888[17][0x8000];
|
||||
static CACHE_ALIGN FragmentColor BrightnessDownTable666[17][0x8000];
|
||||
static CACHE_ALIGN FragmentColor BrightnessDownTable888[17][0x8000];
|
||||
static void InitLUTs();
|
||||
|
||||
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 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
|
||||
|
|
|
@ -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
|
||||
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.
|
||||
// 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) );
|
||||
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) );
|
||||
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) );
|
||||
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) );
|
||||
|
||||
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) );
|
||||
v256u32 ra_hi = _mm256_and_si256( colA_Hi, _mm256_set1_epi32(0x000000FF) );
|
||||
v256u32 ga_hi = _mm256_and_si256( _mm256_srli_epi32(colA_Hi, 8), _mm256_set1_epi32(0x000000FF) );
|
||||
v256u32 ba_hi = _mm256_and_si256( _mm256_srli_epi32(colA_Hi, 16), _mm256_set1_epi32(0x000000FF) );
|
||||
v256u32 aa_hi = _mm256_srli_epi32(colA_Hi, 24);
|
||||
|
||||
v256u16 ra = _mm256_packus_epi32(ra_lo, ra_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>
|
||||
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.
|
||||
// The color format of A is assumed to match the color format of B.
|
||||
v256u8 alpha;
|
||||
v256u32 alpha;
|
||||
v256u16 alphaLo;
|
||||
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 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));
|
||||
|
||||
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 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);
|
||||
|
||||
alphaLo = _mm256_unpacklo_epi8(alpha, _mm256_setzero_si256());
|
||||
|
@ -1130,13 +1128,13 @@ FORCEINLINE void PixelOperation_AVX2::_copy16(GPUEngineCompositorInfo &compInfo,
|
|||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
{
|
||||
ColorspaceConvert555xTo6665Opaque_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo6665Opaque_AVX2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555To6665Opaque_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555To6665Opaque_AVX2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo8888Opaque_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo8888Opaque_AVX2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555To8888Opaque_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555To8888Opaque_AVX2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
|
||||
_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)
|
||||
{
|
||||
ColorspaceConvert555xTo6665Opaque_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo6665Opaque_AVX2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555To6665Opaque_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555To6665Opaque_AVX2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo8888Opaque_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo8888Opaque_AVX2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555To8888Opaque_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555To8888Opaque_AVX2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
|
||||
passMask16[0] = _mm256_permute4x64_epi64(passMask16[0], 0xD8);
|
||||
|
@ -1306,13 +1304,13 @@ FORCEINLINE void PixelOperation_AVX2::_brightnessUp16(GPUEngineCompositorInfo &c
|
|||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
{
|
||||
ColorspaceConvert555xTo666x_AVX2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555xTo666x_AVX2<false>(src1, dst[2], dst[3]);
|
||||
ColorspaceConvert555XTo666X_AVX2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555XTo666X_AVX2<false>(src1, dst[2], dst[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo888x_AVX2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555xTo888x_AVX2<false>(src1, dst[2], dst[3]);
|
||||
ColorspaceConvert555XTo888X_AVX2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555XTo888X_AVX2<false>(src1, dst[2], dst[3]);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ColorspaceConvert555xTo666x_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo666x_AVX2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555XTo666X_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555XTo666X_AVX2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo888x_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo888x_AVX2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555XTo888X_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555XTo888X_AVX2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
|
||||
passMask16[0] = _mm256_permute4x64_epi64(passMask16[0], 0xD8);
|
||||
|
@ -1473,13 +1471,13 @@ FORCEINLINE void PixelOperation_AVX2::_brightnessDown16(GPUEngineCompositorInfo
|
|||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
{
|
||||
ColorspaceConvert555xTo666x_AVX2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555xTo666x_AVX2<false>(src1, dst[2], dst[3]);
|
||||
ColorspaceConvert555XTo666X_AVX2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555XTo666X_AVX2<false>(src1, dst[2], dst[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo888x_AVX2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555xTo888x_AVX2<false>(src1, dst[2], dst[3]);
|
||||
ColorspaceConvert555XTo888X_AVX2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555XTo888X_AVX2<false>(src1, dst[2], dst[3]);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ColorspaceConvert555xTo666x_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo666x_AVX2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555XTo666X_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555XTo666X_AVX2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo888x_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo888x_AVX2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555XTo888X_AVX2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555XTo888X_AVX2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
|
||||
passMask16[0] = _mm256_permute4x64_epi64(passMask16[0], 0xD8);
|
||||
|
@ -1676,13 +1674,13 @@ FORCEINLINE void PixelOperation_AVX2::_unknownEffectMask16(GPUEngineCompositorIn
|
|||
}
|
||||
else if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
{
|
||||
ColorspaceConvert555xTo666x_AVX2<false>(src0, tmpSrc[0], tmpSrc[1]);
|
||||
ColorspaceConvert555xTo666x_AVX2<false>(src1, tmpSrc[2], tmpSrc[3]);
|
||||
ColorspaceConvert555XTo666X_AVX2<false>(src0, tmpSrc[0], tmpSrc[1]);
|
||||
ColorspaceConvert555XTo666X_AVX2<false>(src1, tmpSrc[2], tmpSrc[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo888x_AVX2<false>(src0, tmpSrc[0], tmpSrc[1]);
|
||||
ColorspaceConvert555xTo888x_AVX2<false>(src1, tmpSrc[2], tmpSrc[3]);
|
||||
ColorspaceConvert555XTo888X_AVX2<false>(src0, tmpSrc[0], tmpSrc[1]);
|
||||
ColorspaceConvert555XTo888X_AVX2<false>(src1, tmpSrc[2], tmpSrc[3]);
|
||||
}
|
||||
|
||||
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 + 1),
|
||||
_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];
|
||||
|
@ -2507,7 +2505,7 @@ void GPUEngineBase::_MosaicLine(GPUEngineCompositorInfo &compInfo)
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -2751,10 +2749,10 @@ size_t GPUEngineBase::_CompositeVRAMLineDeferred_LoopOp(GPUEngineCompositorInfo
|
|||
case NDSColorFormat_BGR888_Rev:
|
||||
{
|
||||
const v256u32 src32[4] = {
|
||||
_mm256_load_si256((v256u32 *)((Color4u8 *)vramColorPtr + i) + 0),
|
||||
_mm256_load_si256((v256u32 *)((Color4u8 *)vramColorPtr + i) + 1),
|
||||
_mm256_load_si256((v256u32 *)((Color4u8 *)vramColorPtr + i) + 2),
|
||||
_mm256_load_si256((v256u32 *)((Color4u8 *)vramColorPtr + i) + 3)
|
||||
_mm256_load_si256((v256u32 *)((FragmentColor *)vramColorPtr + i) + 0),
|
||||
_mm256_load_si256((v256u32 *)((FragmentColor *)vramColorPtr + i) + 1),
|
||||
_mm256_load_si256((v256u32 *)((FragmentColor *)vramColorPtr + i) + 2),
|
||||
_mm256_load_si256((v256u32 *)((FragmentColor *)vramColorPtr + i) + 3)
|
||||
};
|
||||
|
||||
if (LAYERTYPE != GPULayerType_OBJ)
|
||||
|
@ -2908,7 +2906,7 @@ void GPUEngineBase::_PerformWindowTestingNative(GPUEngineCompositorInfo &compInf
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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
|
|
@ -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
|
||||
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
|
||||
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)
|
||||
{
|
||||
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.
|
||||
// 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 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) );
|
||||
|
@ -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 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));
|
||||
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) );
|
||||
|
@ -1175,9 +785,6 @@ FORCEINLINE v128u16 ColorOperation_SSE2::blend3D(const v128u32 &colA_Lo, const v
|
|||
template <NDSColorFormat COLORFORMAT>
|
||||
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.
|
||||
// The color format of A is assumed to match the color format of B.
|
||||
v128u16 rgbALo;
|
||||
|
@ -1197,12 +804,13 @@ FORCEINLINE v128u32 ColorOperation_SSE2::blend3D(const v128u32 &colA, const v128
|
|||
rgbALo = _mm_unpacklo_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));
|
||||
|
||||
const v128u8 invAlpha = _mm_subs_epu8(_mm_set1_epi8(32), alpha);
|
||||
const v128u16 alphaLo = _mm_unpacklo_epi8(alpha, invAlpha);
|
||||
const v128u16 alphaHi = _mm_unpackhi_epi8(alpha, invAlpha);
|
||||
v128u32 invAlpha = _mm_subs_epu8(_mm_set1_epi8(32), alpha);
|
||||
v128u16 alphaLo = _mm_unpacklo_epi8(alpha, invAlpha);
|
||||
v128u16 alphaHi = _mm_unpackhi_epi8(alpha, invAlpha);
|
||||
|
||||
rgbALo = _mm_maddubs_epi16(rgbALo, alphaLo);
|
||||
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 rgbBHi = _mm_unpackhi_epi8(colB, _mm_setzero_si128());
|
||||
|
||||
#ifdef ENABLE_SSSE3
|
||||
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) );
|
||||
v128u32 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)) );
|
||||
#endif
|
||||
|
||||
v128u16 alphaLo = _mm_unpacklo_epi8(alpha, _mm_setzero_si128());
|
||||
v128u16 alphaHi = _mm_unpackhi_epi8(alpha, _mm_setzero_si128());
|
||||
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)
|
||||
{
|
||||
ColorspaceConvert555xTo6665Opaque_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo6665Opaque_SSE2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555To6665Opaque_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555To6665Opaque_SSE2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo8888Opaque_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo8888Opaque_SSE2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555To8888Opaque_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555To8888Opaque_SSE2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
|
||||
_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)
|
||||
{
|
||||
ColorspaceConvert555xTo6665Opaque_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo6665Opaque_SSE2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555To6665Opaque_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555To6665Opaque_SSE2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo8888Opaque_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo8888Opaque_SSE2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555To8888Opaque_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555To8888Opaque_SSE2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
|
||||
const v128u32 dst32[4] = {
|
||||
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
|
||||
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
|
||||
_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] = {
|
||||
|
@ -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 + 1),
|
||||
_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);
|
||||
|
@ -1499,13 +1104,13 @@ FORCEINLINE void PixelOperation_SSE2::_brightnessUp16(GPUEngineCompositorInfo &c
|
|||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
{
|
||||
ColorspaceConvert555xTo666x_SSE2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555xTo666x_SSE2<false>(src1, dst[2], dst[3]);
|
||||
ColorspaceConvert555XTo666X_SSE2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555XTo666X_SSE2<false>(src1, dst[2], dst[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo888x_SSE2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555xTo888x_SSE2<false>(src1, dst[2], dst[3]);
|
||||
ColorspaceConvert555XTo888X_SSE2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555XTo888X_SSE2<false>(src1, dst[2], dst[3]);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ColorspaceConvert555xTo666x_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo666x_SSE2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555XTo666X_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555XTo666X_SSE2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo888x_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo888x_SSE2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555XTo888X_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555XTo888X_SSE2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
|
||||
const v128u32 dst32[4] = {
|
||||
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
|
||||
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
|
||||
_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);
|
||||
|
@ -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 + 1),
|
||||
_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);
|
||||
|
@ -1670,13 +1275,13 @@ FORCEINLINE void PixelOperation_SSE2::_brightnessDown16(GPUEngineCompositorInfo
|
|||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
{
|
||||
ColorspaceConvert555xTo666x_SSE2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555xTo666x_SSE2<false>(src1, dst[2], dst[3]);
|
||||
ColorspaceConvert555XTo666X_SSE2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555XTo666X_SSE2<false>(src1, dst[2], dst[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo888x_SSE2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555xTo888x_SSE2<false>(src1, dst[2], dst[3]);
|
||||
ColorspaceConvert555XTo888X_SSE2<false>(src0, dst[0], dst[1]);
|
||||
ColorspaceConvert555XTo888X_SSE2<false>(src1, dst[2], dst[3]);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ColorspaceConvert555xTo666x_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo666x_SSE2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555XTo666X_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555XTo666X_SSE2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo888x_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555xTo888x_SSE2<false>(src1, src32[2], src32[3]);
|
||||
ColorspaceConvert555XTo888X_SSE2<false>(src0, src32[0], src32[1]);
|
||||
ColorspaceConvert555XTo888X_SSE2<false>(src1, src32[2], src32[3]);
|
||||
}
|
||||
|
||||
const v128u32 dst32[4] = {
|
||||
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 0),
|
||||
_mm_load_si128((v128u32 *)compInfo.target.lineColor32 + 1),
|
||||
_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);
|
||||
|
@ -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 + 1),
|
||||
_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);
|
||||
|
@ -1889,13 +1494,13 @@ FORCEINLINE void PixelOperation_SSE2::_unknownEffectMask16(GPUEngineCompositorIn
|
|||
}
|
||||
else if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
{
|
||||
ColorspaceConvert555xTo666x_SSE2<false>(src0, tmpSrc[0], tmpSrc[1]);
|
||||
ColorspaceConvert555xTo666x_SSE2<false>(src1, tmpSrc[2], tmpSrc[3]);
|
||||
ColorspaceConvert555XTo666X_SSE2<false>(src0, tmpSrc[0], tmpSrc[1]);
|
||||
ColorspaceConvert555XTo666X_SSE2<false>(src1, tmpSrc[2], tmpSrc[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorspaceConvert555xTo888x_SSE2<false>(src0, tmpSrc[0], tmpSrc[1]);
|
||||
ColorspaceConvert555xTo888x_SSE2<false>(src1, tmpSrc[2], tmpSrc[3]);
|
||||
ColorspaceConvert555XTo888X_SSE2<false>(src0, tmpSrc[0], tmpSrc[1]);
|
||||
ColorspaceConvert555XTo888X_SSE2<false>(src1, tmpSrc[2], tmpSrc[3]);
|
||||
}
|
||||
|
||||
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 + 1),
|
||||
_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)
|
||||
|
@ -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 + 1),
|
||||
_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)
|
||||
|
@ -2682,7 +2287,7 @@ void GPUEngineBase::_MosaicLine(GPUEngineCompositorInfo &compInfo)
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -2925,10 +2530,10 @@ size_t GPUEngineBase::_CompositeVRAMLineDeferred_LoopOp(GPUEngineCompositorInfo
|
|||
case NDSColorFormat_BGR888_Rev:
|
||||
{
|
||||
const v128u32 src32[4] = {
|
||||
_mm_load_si128((v128u32 *)((Color4u8 *)vramColorPtr + i) + 0),
|
||||
_mm_load_si128((v128u32 *)((Color4u8 *)vramColorPtr + i) + 1),
|
||||
_mm_load_si128((v128u32 *)((Color4u8 *)vramColorPtr + i) + 2),
|
||||
_mm_load_si128((v128u32 *)((Color4u8 *)vramColorPtr + i) + 3)
|
||||
_mm_load_si128((v128u32 *)((FragmentColor *)vramColorPtr + i) + 0),
|
||||
_mm_load_si128((v128u32 *)((FragmentColor *)vramColorPtr + i) + 1),
|
||||
_mm_load_si128((v128u32 *)((FragmentColor *)vramColorPtr + i) + 2),
|
||||
_mm_load_si128((v128u32 *)((FragmentColor *)vramColorPtr + i) + 3)
|
||||
};
|
||||
|
||||
if (LAYERTYPE != GPULayerType_OBJ)
|
||||
|
@ -3083,7 +2688,7 @@ void GPUEngineBase::_PerformWindowTestingNative(GPUEngineCompositorInfo &compInf
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2007 shash
|
||||
Copyright (C) 2007-2023 DeSmuME team
|
||||
Copyright (C) 2007-2022 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
|
||||
|
@ -1068,6 +1068,7 @@ static void execsqrt() {
|
|||
}
|
||||
|
||||
static void execdiv() {
|
||||
|
||||
s64 num,den;
|
||||
s64 res,mod;
|
||||
u8 mode = MMU_new.div.mode;
|
||||
|
@ -1095,29 +1096,15 @@ static void execdiv() {
|
|||
break;
|
||||
}
|
||||
|
||||
if(den == 0)
|
||||
if(den==0)
|
||||
{
|
||||
res = ((num < 0) ? 1 : -1);
|
||||
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
|
||||
if ((u64)T1ReadQuad(MMU.ARM9_REG, 0x298) == 0)
|
||||
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
|
||||
{
|
||||
res = num / den;
|
||||
|
@ -1829,46 +1816,44 @@ static void writereg_POWCNT1(const int size, const u32 adr, const u32 val)
|
|||
bool isGeomEnabled = !!nds.power1.gfx3d_geometry;
|
||||
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)
|
||||
{
|
||||
|
||||
//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_r = T1ReadLong(MMU.MMU_MEM[proc^1][0x40], 0x180) & 0xFFFF;
|
||||
u32 iter = (val & 0x0F00) >> 8;
|
||||
|
||||
sync_l = ( sync_l & 0x000F ) | ( val & 0x6F00 );
|
||||
sync_r = ( sync_r & 0x6F00 ) | ( iter );
|
||||
sync_l = ( sync_l & 0x000F ) | ( val & 0x0F00 );
|
||||
sync_r = ( sync_r & 0x6F00 ) | ( (val >> 8) & 0x000F );
|
||||
|
||||
// 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
|
||||
// The arm7 as they are written by the arm7
|
||||
if (nds.ensataEmulation) {
|
||||
sync_l |= val & 0x6000;
|
||||
|
||||
if (proc) {
|
||||
// However this hack would break soft reset because it also syncs through ipcsync.
|
||||
// So we have to add some additional checks to ensure that it's handshake instead of reset.
|
||||
if ((iter & 8) || (nds.ensataIpcSyncCounter)) {
|
||||
// sync_r = (sync_r & 0xF0FF) | (iter << 8); // This is not necessary.
|
||||
sync_l = (sync_l & 0xFFF0) | iter;
|
||||
nds.ensataIpcSyncCounter = iter;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// After ensata handshake, arm9 will write 0x100 as a signal if Ensata is detected.
|
||||
// This will prevent reset from working, so we have to ignore this.
|
||||
if (nds.ensataHandshake == ENSATA_HANDSHAKE_complete) {
|
||||
nds.ensataHandshake = ENSATA_HANDSHAKE_none;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(nds.ensataEmulation && proc==1 && nds.ensataIpcSyncCounter<9) {
|
||||
u32 iteration = (val&0x0F00)>>8;
|
||||
|
||||
if(iteration==8-nds.ensataIpcSyncCounter)
|
||||
nds.ensataIpcSyncCounter++;
|
||||
else printf("ERROR: ENSATA IPC SYNC HACK FAILED; BAD THINGS MAY HAPPEN\n");
|
||||
|
||||
//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
|
||||
//the arm7 as they are written by the arm7
|
||||
sync_r &= 0xF0FF;
|
||||
sync_r |= (iteration<<8);
|
||||
sync_l &= 0xFFF0;
|
||||
sync_l |= iteration;
|
||||
}
|
||||
|
||||
// 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^1][0x40], 0x180, sync_r);
|
||||
|
||||
|
@ -1962,8 +1947,8 @@ u32 TGXSTAT::read32()
|
|||
|
||||
// stack position always equal zero. possible timings is wrong
|
||||
// using in "The Wild West"
|
||||
u32 proj_level = (u32)GFX3D_GetMatrixStackIndex(MATRIXMODE_PROJECTION);
|
||||
u32 mv_level = (u32)GFX3D_GetMatrixStackIndex(MATRIXMODE_POSITION);
|
||||
int proj_level = mtxStackIndex[MATRIXMODE_PROJECTION] & 1;
|
||||
int mv_level = mtxStackIndex[MATRIXMODE_POSITION] & 31;
|
||||
ret |= ((proj_level << 13) | (mv_level << 8));
|
||||
|
||||
ret |= sb<<14; //stack busy
|
||||
|
@ -1974,7 +1959,7 @@ u32 TGXSTAT::read32()
|
|||
if(gxFIFO.size==0) ret |= BIT(26); //fifo empty
|
||||
//determine busy flag.
|
||||
//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(gxFIFO.size!=0) ret |= BIT(27);
|
||||
|
||||
|
@ -1983,7 +1968,7 @@ u32 TGXSTAT::read32()
|
|||
|
||||
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);
|
||||
//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),
|
||||
// and additionally resets the Projection Stack Pointer (Bit13)
|
||||
// (and probably (?) also the Texture Stack Pointer)??
|
||||
GFX3D_ResetMatrixStackPointer();
|
||||
mtxStackIndex[MATRIXMODE_PROJECTION] = 0;
|
||||
se = 0; //clear stack error flag
|
||||
}
|
||||
//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)
|
||||
{
|
||||
u32 addrMasked = 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)
|
||||
switch (addr & 0x0FFFFFFC)
|
||||
{
|
||||
// Display Engine A
|
||||
case REG_DISPA_DISPCNT:
|
||||
|
@ -3235,99 +3210,6 @@ bool validateIORegsRead(u32 addr, u8 size)
|
|||
#define VALIDATE_IO_REGS_READ(PROC, SIZE) ;
|
||||
#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 *
|
||||
//=========================================================================================================
|
||||
//=========================================================================================================
|
||||
|
@ -3376,28 +3258,6 @@ void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
|
|||
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();
|
||||
GPUEngineB *subEngine = GPU->GetEngineSub();
|
||||
|
||||
|
@ -3565,19 +3425,7 @@ void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
|
|||
return;
|
||||
|
||||
case REG_DISPA_DISPMMEMFIFO:
|
||||
DISP_FIFOsend<u8, 0>(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);
|
||||
DISP_FIFOsend_u32(val);
|
||||
return;
|
||||
|
||||
case REG_DISPB_BG0HOFS:
|
||||
|
@ -3742,6 +3590,18 @@ void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
|
|||
case REG_DIVCNT+3: printf("ERROR 8bit DIVCNT+3 WRITE\n"); return;
|
||||
#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
|
||||
case 0x04FFF000:
|
||||
if(nds.ensataEmulation)
|
||||
|
@ -3754,21 +3614,7 @@ void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
|
|||
case eng_3D_GXSTAT:
|
||||
MMU_new.gxstat.write(8,adr,val);
|
||||
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+1:
|
||||
write_auxspicnt(ARMCPU_ARM9, 8, adr & 1, val);
|
||||
|
@ -3790,45 +3636,10 @@ void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
|
|||
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 eng_3D_CLEAR_COLOR:
|
||||
T1WriteByte(MMU.ARM9_REG, 0x0350, val);
|
||||
gfx3d_glClearColor<u8>(0, val);
|
||||
return;
|
||||
|
||||
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 eng_3D_CLEAR_COLOR+0: case eng_3D_CLEAR_COLOR+1:
|
||||
case eng_3D_CLEAR_COLOR+2: case eng_3D_CLEAR_COLOR+3:
|
||||
T1WriteByte((u8*)&gfx3d.state.clearColor,adr-eng_3D_CLEAR_COLOR,val);
|
||||
break;
|
||||
|
||||
case REG_VRAMCNTA:
|
||||
case REG_VRAMCNTB:
|
||||
|
@ -3842,11 +3653,6 @@ void FASTCALL _MMU_ARM9_write08(u32 adr, u8 val)
|
|||
case REG_VRAMCNTI:
|
||||
MMU_VRAMmapControl(adr-REG_VRAMCNTA, val);
|
||||
break;
|
||||
|
||||
|
||||
// ensata sound register
|
||||
case 0x04FFF200:
|
||||
break;
|
||||
|
||||
#ifdef LOG_CARD
|
||||
case 0x040001A0 : /* TODO (clear): ??? */
|
||||
|
@ -3930,23 +3736,13 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
|
||||
switch (adr >> 4)
|
||||
{
|
||||
case 0x400033: // Edge Mark Color Table
|
||||
((u16 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> (sizeof(u16) >> 1)] = val;
|
||||
gfx3d_UpdateEdgeMarkColorTable<u16>((u8)(adr & 0x0000000F), val);
|
||||
return;
|
||||
|
||||
case 0x400036:
|
||||
case 0x400037: // Fog Table
|
||||
((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);
|
||||
//toon table
|
||||
case 0x0400038:
|
||||
case 0x0400039:
|
||||
case 0x040003A:
|
||||
case 0x040003B:
|
||||
((u16 *)(MMU.ARM9_REG))[(adr & 0xFFF)>>1] = val;
|
||||
gfx3d_UpdateToonTable((adr & 0x3F) >> 1, val);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4196,11 +3992,7 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
return;
|
||||
|
||||
case REG_DISPA_DISPMMEMFIFO:
|
||||
DISP_FIFOsend<u16, 0>(val);
|
||||
return;
|
||||
|
||||
case REG_DISPA_DISPMMEMFIFO+2:
|
||||
DISP_FIFOsend<u16, 2>(val);
|
||||
DISP_FIFOsend_u32(val);
|
||||
return;
|
||||
|
||||
case REG_DISPA_MASTERBRIGHT:
|
||||
|
@ -4441,6 +4233,14 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
MMU_new.gxstat.write(16,adr,val);
|
||||
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
|
||||
case eng_3D_ALPHA_TEST_REF:
|
||||
HostWriteWord(MMU.ARM9_REG, 0x0340, val);
|
||||
|
@ -4448,24 +4248,14 @@ void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
|
|||
return;
|
||||
|
||||
case eng_3D_CLEAR_COLOR:
|
||||
T1WriteWord(MMU.ARM9_REG, 0x0350, val);
|
||||
gfx3d_glClearColor<u16>(0, val);
|
||||
return;
|
||||
|
||||
case eng_3D_CLEAR_COLOR+2:
|
||||
T1WriteWord(MMU.ARM9_REG, 0x0352, val);
|
||||
gfx3d_glClearColor<u16>(2, val);
|
||||
return;
|
||||
T1WriteWord((u8*)&gfx3d.state.clearColor,adr-eng_3D_CLEAR_COLOR,val);
|
||||
break;
|
||||
|
||||
// Clear background depth setup - Parameters:2
|
||||
case eng_3D_CLEAR_DEPTH:
|
||||
HostWriteWord(MMU.ARM9_REG, 0x0354, val);
|
||||
gfx3d_glClearDepth<u16, 0>(val);
|
||||
return;
|
||||
|
||||
case eng_3D_CLRIMAGE_OFFSET:
|
||||
HostWriteWord(MMU.ARM9_REG, 0x0356, val);
|
||||
gfx3d_glClearImageOffset<u16, 0>(val);
|
||||
gfx3d_glClearDepth(val);
|
||||
return;
|
||||
|
||||
// Fog Color - Parameters:4b
|
||||
|
@ -4658,23 +4448,16 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
|||
// lookups by the compiler
|
||||
switch (adr >> 4)
|
||||
{
|
||||
case 0x400033: // Edge Mark Color Table
|
||||
((u32 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> (sizeof(u32) >> 1)] = 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]
|
||||
case 0x400033: //edge color table
|
||||
((u32 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> 2] = val;
|
||||
return;
|
||||
|
||||
case 0x400038:
|
||||
case 0x400039:
|
||||
case 0x40003A:
|
||||
case 0x40003B: // Toon Table
|
||||
((u32 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> (sizeof(u32) >> 1)] = val;
|
||||
gfx3d_UpdateToonTable<u32>((u8)(adr & 0x0000003F), val);
|
||||
case 0x40003B: //toon table
|
||||
((u32 *)(MMU.ARM9_REG))[(adr & 0xFFF) >> 2] = val;
|
||||
gfx3d_UpdateToonTable((adr & 0x3F) >> 1, val);
|
||||
return;
|
||||
|
||||
case 0x400040:
|
||||
|
@ -4852,7 +4635,7 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
|||
return;
|
||||
|
||||
case REG_DISPA_DISPMMEMFIFO:
|
||||
DISP_FIFOsend<u32, 0>(val);
|
||||
DISP_FIFOsend_u32(val);
|
||||
return;
|
||||
|
||||
case REG_DISPA_MASTERBRIGHT:
|
||||
|
@ -4978,6 +4761,12 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
|||
|
||||
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?
|
||||
case 0x04FFF010:
|
||||
if(nds.ensataEmulation && nds.ensataHandshake == ENSATA_HANDSHAKE_ack && val == 0x13579bdf)
|
||||
|
@ -4992,7 +4781,7 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
|||
//todo - these are usually write only regs (these and 1000 more)
|
||||
//shouldnt we block them from getting written? ugh
|
||||
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");
|
||||
nds.ensataHandshake = ENSATA_HANDSHAKE_query;
|
||||
|
@ -5010,15 +4799,13 @@ void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
|
|||
return;
|
||||
|
||||
case eng_3D_CLEAR_COLOR:
|
||||
T1WriteLong(MMU.ARM9_REG, 0x0350, val);
|
||||
gfx3d_glClearColor<u32>(0, val);
|
||||
return;
|
||||
T1WriteLong((u8*)&gfx3d.state.clearColor,0,val);
|
||||
break;
|
||||
|
||||
// Clear background depth setup - Parameters:2
|
||||
case eng_3D_CLEAR_DEPTH:
|
||||
HostWriteLong(MMU.ARM9_REG, 0x0354, val);
|
||||
gfx3d_glClearDepth<u16, 0>((u16)(val & 0x0000FFFF));
|
||||
gfx3d_glClearImageOffset<u16, 0>((u16)(val >> 16));
|
||||
gfx3d_glClearDepth(val);
|
||||
return;
|
||||
|
||||
// Fog Color - Parameters:4b
|
||||
|
@ -5511,10 +5298,6 @@ u32 FASTCALL _MMU_ARM9_read32(u32 adr)
|
|||
case REG_KEYINPUT:
|
||||
LagFrameFlag=0;
|
||||
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]);
|
||||
}
|
||||
|
@ -5610,21 +5393,6 @@ void FASTCALL _MMU_ARM7_write08(u32 adr, u8 val)
|
|||
printf("Unsupported 8bit write to timer registers");
|
||||
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:
|
||||
{
|
||||
//if(val!=0) MMU.AUX_SPI_CMD = val & 0xFF; //zero 20-aug-2013 - this seems pointless
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2006 yopyop
|
||||
Copyright (C) 2007 shash
|
||||
Copyright (C) 2007-2023 DeSmuME team
|
||||
Copyright (C) 2007-2017 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
|
||||
|
@ -626,10 +626,6 @@ FORCEINLINE void* MMU_gpu_map(const u32 vram_addr)
|
|||
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> u16 _MMU_read16(u32 addr);
|
||||
|
|
|
@ -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
|
|
@ -635,8 +635,7 @@ bool GameInfo::isDSiEnhanced()
|
|||
|
||||
bool GameInfo::isHomebrew()
|
||||
{
|
||||
return ((header.ARM9src < 0x4000) && (T1ReadLong(header.logo, 0) != 0x51AEFF24) && (T1ReadLong(header.logo, 4) != 0x699AA221)) ||
|
||||
(!memcmp(header.gameCode, "####", 4)); // <- ndstool default signature
|
||||
return ((header.ARM9src < 0x4000) && (T1ReadLong(header.logo, 0) != 0x51AEFF24) && (T1ReadLong(header.logo, 4) != 0x699AA221));
|
||||
}
|
||||
|
||||
static int rom_init_path(const char *filename, const char *physicalName, const char *logicalFilename)
|
||||
|
@ -1454,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.
|
||||
//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::ResetJitIfNeeded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2200,11 +2196,7 @@ void NDS_exec(s32 nb)
|
|||
}
|
||||
currFrameCounter++;
|
||||
DEBUG_Notify.NextFrame();
|
||||
if (cheats != NULL)
|
||||
{
|
||||
cheats->process(CHEAT_TYPE_INTERNAL);
|
||||
CHEATS::ResetJitIfNeeded();
|
||||
}
|
||||
if(cheats) cheats->process(CHEAT_TYPE_INTERNAL);
|
||||
|
||||
GDBSTUB_MUTEX_UNLOCK();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Copyright (C) 2006 yopyop
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,106 +20,61 @@
|
|||
#ifndef 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"
|
||||
|
||||
#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 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
|
||||
{
|
||||
protected:
|
||||
bool _isShaderFixedLocationSupported;
|
||||
bool _is64kUBOSupported;
|
||||
bool _isDualSourceBlendingSupported;
|
||||
bool _isSampleShadingSupported;
|
||||
bool _isConservativeDepthSupported;
|
||||
bool _isConservativeDepthAMDSupported;
|
||||
|
||||
OpenGLGeometryResource *_gResource;
|
||||
OpenGLRenderStatesResource *_rsResource;
|
||||
GLsync _syncBufferSetup;
|
||||
CACHE_ALIGN OGLPolyStates _pendingPolyStates[POLYLIST_SIZE];
|
||||
|
||||
virtual Render3DError InitExtensions();
|
||||
|
||||
virtual Render3DError CreateVBOs();
|
||||
virtual Render3DError CreatePBOs();
|
||||
virtual Render3DError CreateFBOs();
|
||||
virtual void DestroyFBOs();
|
||||
virtual Render3DError CreateMultisampledFBO(GLsizei numSamples);
|
||||
|
@ -129,48 +84,40 @@ protected:
|
|||
virtual void DestroyVAOs();
|
||||
|
||||
virtual Render3DError CreateGeometryPrograms();
|
||||
virtual Render3DError CreateClearImageProgram(const char *vsCString, const char *fsCString);
|
||||
virtual void DestroyClearImageProgram();
|
||||
virtual void DestroyGeometryPrograms();
|
||||
virtual Render3DError CreateGeometryZeroDstAlphaProgram(const char *vtxShaderCString, const char *fragShaderCString);
|
||||
virtual Render3DError CreateMSGeometryZeroDstAlphaProgram(const char *vtxShaderCString, const char *fragShaderCString);
|
||||
virtual void DestroyMSGeometryZeroDstAlphaProgram();
|
||||
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);
|
||||
virtual Render3DError CreateFramebufferOutput8888Program(const char *vtxShaderCString, const char *fragShaderCString);
|
||||
virtual Render3DError CreateEdgeMarkProgram(const char *vtxShaderCString, const char *fragShaderCString);
|
||||
virtual Render3DError CreateFogProgram(const OGLFogProgramKey fogProgramKey, const char *vtxShaderCString, const char *fragShaderCString);
|
||||
virtual Render3DError CreateFramebufferOutput6665Program(const size_t outColorIndex, 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 Render3DError InitFinalRenderStates(const std::set<std::string> *oglExtensionSet);
|
||||
virtual void _SetupGeometryShaders(const OGLGeometryFlags flags);
|
||||
virtual void _RenderGeometryVertexAttribEnable();
|
||||
virtual void _RenderGeometryVertexAttribDisable();
|
||||
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 void _RenderGeometryLoopBegin();
|
||||
virtual void _RenderGeometryLoopEnd();
|
||||
virtual Render3DError EnableVertexAttributes();
|
||||
virtual Render3DError DisableVertexAttributes();
|
||||
virtual Render3DError ZeroDstAlphaPass(const CPoly *clippedPolyList, const size_t clippedPolyCount, bool enableAlphaBlending, size_t indexOffset, POLYGON_ATTR lastPolyAttr);
|
||||
virtual void _ResolveWorkingBackFacing();
|
||||
virtual void _ResolveGeometry();
|
||||
virtual void _ResolveFinalFramebuffer();
|
||||
virtual void _FramebufferProcessVertexAttribEnable();
|
||||
virtual void _FramebufferProcessVertexAttribDisable();
|
||||
virtual Render3DError _FramebufferConvertColorFormat();
|
||||
|
||||
virtual Render3DError BeginRender(const GFX3D_State &renderState, const GFX3D_GeometryList &renderGList);
|
||||
virtual Render3DError ReadBackPixels();
|
||||
virtual Render3DError BeginRender(const GFX3D &engine);
|
||||
virtual Render3DError PostprocessFramebuffer();
|
||||
|
||||
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 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 SetFramebufferSize(size_t w, size_t h);
|
||||
|
||||
public:
|
||||
OpenGLRenderer_3_2();
|
||||
~OpenGLRenderer_3_2();
|
||||
|
||||
virtual Render3DError InitExtensions();
|
||||
virtual Render3DError RenderFinish();
|
||||
virtual Render3DError RenderPowerOff();
|
||||
virtual Render3DError SetFramebufferSize(size_t w, size_t h);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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
|
|
@ -348,7 +348,7 @@ int MemROMReaderWrite(void * file, void * buffer, u32 size)
|
|||
if(remain<todo)
|
||||
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);
|
||||
mem.pos += todo;
|
||||
return todo;
|
||||
|
|
|
@ -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); }
|
||||
|
||||
#define K_ADPCM_LOOPING_RECOVERY_INDEX 99999
|
||||
|
||||
#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)
|
||||
#define COSINE_INTERPOLATION_RESOLUTION 8192
|
||||
|
||||
//#ifdef FASTBUILD
|
||||
#undef FORCEINLINE
|
||||
|
@ -103,10 +96,20 @@ static const u16 adpcmtbl[89] =
|
|||
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 u8 precalcindextbl[89][8];
|
||||
static u16 catmullrom_lut[CATMULLROM_INTERPOLATION_RESOLUTION][4];
|
||||
static u16 cos_lut[COSINE_INTERPOLATION_RESOLUTION];
|
||||
static double cos_lut[COSINE_INTERPOLATION_RESOLUTION];
|
||||
|
||||
static const double ARM7_CLOCK = 33513982;
|
||||
|
||||
|
@ -126,14 +129,6 @@ static FORCEINLINE T MinMax(T val, T min, T max)
|
|||
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---------------
|
||||
|
||||
int SPU_ChangeSoundCore(int coreid, int newBufferSizeBytes)
|
||||
|
@ -205,23 +200,9 @@ void SPU_ReInit(bool fakeBoot)
|
|||
|
||||
int SPU_Init(int coreid, int newBufferSizeBytes)
|
||||
{
|
||||
// Build the interpolation LUTs
|
||||
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);
|
||||
}
|
||||
// Build the cosine interpolation LUT
|
||||
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_Reset();
|
||||
|
@ -385,11 +366,7 @@ void SPU_struct::ShutUp()
|
|||
|
||||
static FORCEINLINE void adjust_channel_timer(channel_struct *chan)
|
||||
{
|
||||
// ARM7_CLOCK / (DESMUME_SAMPLE_RATE*2) / (2^16 - 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;
|
||||
chan->sampinc = (((double)ARM7_CLOCK) / (DESMUME_SAMPLE_RATE * 2)) / (double)(0x10000 - chan->timer);
|
||||
}
|
||||
|
||||
void SPU_struct::KeyProbe(int chan_num)
|
||||
|
@ -422,12 +399,6 @@ void SPU_struct::KeyOn(int channel)
|
|||
thischan.totlength = thischan.length + thischan.loopstart;
|
||||
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);
|
||||
|
||||
|
||||
|
@ -440,33 +411,39 @@ void SPU_struct::KeyOn(int channel)
|
|||
case 0: // 8-bit
|
||||
// thischan.loopstart = thischan.loopstart << 2;
|
||||
// thischan.length = (thischan.length << 2) + thischan.loopstart;
|
||||
thischan.sampcntFrac = 0, thischan.sampcntInt = -3;
|
||||
thischan.sampcnt = -3;
|
||||
break;
|
||||
case 1: // 16-bit
|
||||
// thischan.loopstart = thischan.loopstart << 1;
|
||||
// thischan.length = (thischan.length << 1) + thischan.loopstart;
|
||||
thischan.sampcntFrac = 0, thischan.sampcntInt = -3;
|
||||
thischan.sampcnt = -3;
|
||||
break;
|
||||
case 2: // ADPCM
|
||||
thischan.pcm16b[0] = (s16)read16(thischan.addr);
|
||||
thischan.index = read08(thischan.addr + 2) & 0x7F;
|
||||
thischan.sampcntFrac = 0, thischan.sampcntInt = -3;
|
||||
thischan.loop_index = K_ADPCM_LOOPING_RECOVERY_INDEX;
|
||||
// thischan.loopstart = thischan.loopstart << 3;
|
||||
// thischan.length = (thischan.length << 3) + thischan.loopstart;
|
||||
break;
|
||||
{
|
||||
thischan.pcm16b = (s16)read16(thischan.addr);
|
||||
thischan.pcm16b_last = thischan.pcm16b;
|
||||
thischan.index = read08(thischan.addr + 2) & 0x7F;;
|
||||
thischan.lastsampcnt = 7;
|
||||
thischan.sampcnt = -3;
|
||||
thischan.loop_index = K_ADPCM_LOOPING_RECOVERY_INDEX;
|
||||
// thischan.loopstart = thischan.loopstart << 3;
|
||||
// thischan.length = (thischan.length << 3) + thischan.loopstart;
|
||||
break;
|
||||
}
|
||||
case 3: // PSG
|
||||
thischan.sampcntFrac = 0, thischan.sampcntInt = -1;
|
||||
thischan.x = 0x7FFF;
|
||||
break;
|
||||
{
|
||||
thischan.sampcnt = -1;
|
||||
thischan.x = 0x7FFF;
|
||||
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.totlength_shifted == 0)
|
||||
if(thischan.double_totlength_shifted == 0)
|
||||
{
|
||||
printf("INFO: Stopping channel %d due to zero length\n",channel);
|
||||
thischan.status = CHANSTAT_STOPPED;
|
||||
|
@ -516,7 +493,7 @@ u8 SPU_struct::ReadByte(u32 addr)
|
|||
//SOUNDBIAS
|
||||
case 0x504: return regs.soundbias >> 0;
|
||||
case 0x505: return regs.soundbias >> 8;
|
||||
|
||||
|
||||
//SNDCAP0CNT/SNDCAP1CNT
|
||||
case 0x508:
|
||||
case 0x509:
|
||||
|
@ -765,7 +742,7 @@ void SPU_struct::ProbeCapture(int which)
|
|||
u32 len = cap.len;
|
||||
if(len==0) len=1;
|
||||
cap.runtime.maxdad = cap.dad + len*4;
|
||||
cap.runtime.sampcntFrac = cap.runtime.sampcntInt = 0;
|
||||
cap.runtime.sampcnt = 0;
|
||||
cap.runtime.fifo.reset();
|
||||
}
|
||||
|
||||
|
@ -1041,109 +1018,161 @@ void SPU_struct::WriteLong(u32 addr, u32 val)
|
|||
} //switch on address
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE s32 Interpolate(const s16 *pcm16b, u8 pcm16bOffs, u32 subPos)
|
||||
template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE s32 Interpolate(s32 a, s32 b, double ratio)
|
||||
{
|
||||
double sampleA = (double)a;
|
||||
double sampleB = (double)b;
|
||||
ratio = ratio - sputrunc(ratio);
|
||||
|
||||
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:
|
||||
{
|
||||
// Cosine Interpolation Formula:
|
||||
// ratio2 = (1 - cos(ratio * M_PI)) / 2
|
||||
// sampleI = sampleA * (1 - ratio2) + sampleB * ratio2
|
||||
// Delay: 1 sample, Maximum gain: 1.0
|
||||
s32 a = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 1)];
|
||||
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);
|
||||
}
|
||||
|
||||
return s32floor((cos_lut[(unsigned int)(ratio * (double)COSINE_INTERPOLATION_RESOLUTION)] * (sampleB - sampleA)) + sampleA);
|
||||
break;
|
||||
|
||||
case SPUInterpolation_Linear:
|
||||
{
|
||||
// Linear Interpolation Formula:
|
||||
// sampleI = sampleA * (1 - ratio) + sampleB * ratio
|
||||
// Delay: 1 sample, Maximum gain: 1.0
|
||||
s32 a = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 1)];
|
||||
s32 b = pcm16b[SPUCHAN_PCM16B_AT(pcm16bOffs - 0)];
|
||||
s32 subPos16 = subPos >> (32 - 16);
|
||||
return a + ((b - a)*subPos16 >> 16);
|
||||
}
|
||||
|
||||
return s32floor((ratio * (sampleB - sampleA)) + sampleA);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Delay: 0 samples, Maximum gain: 1.0
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
||||
const u32 shift = (pos&1) * 4;
|
||||
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);
|
||||
return a;
|
||||
}
|
||||
|
||||
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
|
||||
if(chan->num < 14)
|
||||
template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE void Fetch8BitData(channel_struct *chan, s32 *data)
|
||||
{
|
||||
if (chan->sampcnt < 0)
|
||||
{
|
||||
// Doing this avoids using a LUT
|
||||
return ((pos%8u) > chan->waveduty) ? (-0x7FFF) : (+0x7FFF);
|
||||
*data = 0;
|
||||
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
|
||||
{
|
||||
if(chan->x & 0x1)
|
||||
if(chan->lastsampcnt == sputrunc(chan->sampcnt))
|
||||
{
|
||||
chan->x = (chan->x >> 1) ^ 0x6000;
|
||||
return -0x7FFF;
|
||||
*data = (s32)chan->psgnoise_last;
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
u32 max = sputrunc(chan->sampcnt);
|
||||
for(u32 i = chan->lastsampcnt; i < max; i++)
|
||||
{
|
||||
chan->x >>= 1;
|
||||
return +0x7FFF;
|
||||
if(chan->x & 0x1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// Do nothing if we haven't reached the end
|
||||
if(chan->sampcntInt < chan->totlength_shifted) return;
|
||||
const int shift = (FORMAT == 0 ? 2 : 1);
|
||||
|
||||
// Kill the channel if we don't repeat
|
||||
if(chan->repeat != 1)
|
||||
chan->sampcnt += chan->sampinc;
|
||||
|
||||
if (chan->sampcnt > chan->double_totlength_shifted)
|
||||
{
|
||||
SPU->KeyOff(chan->num);
|
||||
return;
|
||||
}
|
||||
|
||||
// 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)
|
||||
// Do we loop? Or are we done?
|
||||
if (chan->repeat == 1)
|
||||
{
|
||||
chan->pcm16b[SPUCHAN_PCM16B_AT(chan->pcm16bOffs)] = (s16)read16(chan->addr);
|
||||
chan->index = read08(chan->addr+2) & 0x7F;
|
||||
while (chan->sampcnt > chan->double_totlength_shifted)
|
||||
chan->sampcnt -= chan->double_totlength_shifted - (double)(chan->loopstart << shift);
|
||||
//chan->sampcnt = (double)(chan->loopstart << shift);
|
||||
}
|
||||
else
|
||||
{
|
||||
chan->pcm16b[SPUCHAN_PCM16B_AT(chan->pcm16bOffs)] = chan->loop_pcm16b;
|
||||
chan->index = chan->loop_index;
|
||||
SPU->KeyOff(chan->num);
|
||||
SPU->bufpos = SPU->buflength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap sampcnt
|
||||
u32 step = chan->totlength_shifted - (chan->loopstart << format_shift[FORMAT]);
|
||||
while (chan->sampcntInt >= chan->totlength_shifted) chan->sampcntInt -= step;
|
||||
static FORCEINLINE void TestForLoop2(SPU_struct *SPU, channel_struct *chan)
|
||||
{
|
||||
// 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)
|
||||
|
@ -1227,36 +1281,26 @@ template<int FORMAT, SPUInterpolationMode INTERPOLATE_MODE, int CHANNELS>
|
|||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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>
|
||||
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)
|
||||
{
|
||||
case 0: ___SPU_ChanUpdate<0,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 3: ___SPU_ChanUpdate<3,SPUInterpolation_None>(actuallyMix, SPU, chan); break;
|
||||
case 3: ___SPU_ChanUpdate<3,INTERPOLATE_MODE>(actuallyMix, SPU, chan); break;
|
||||
default: assert(false);
|
||||
}
|
||||
}
|
||||
|
@ -1292,10 +1334,9 @@ FORCEINLINE static void _SPU_ChanUpdate(const bool actuallyMix, SPU_struct* cons
|
|||
{
|
||||
switch(CommonSettings.spuInterpolationMode)
|
||||
{
|
||||
case SPUInterpolation_None: __SPU_ChanUpdate<SPUInterpolation_None>(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_CatmullRom: __SPU_ChanUpdate<SPUInterpolation_CatmullRom>(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_Cosine: __SPU_ChanUpdate<SPUInterpolation_Cosine>(actuallyMix, SPU, chan); break;
|
||||
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++)
|
||||
{
|
||||
SPU_struct::REGS::CAP& cap = SPU->regs.cap[capchan];
|
||||
channel_struct& srcChan = SPU->channels[1 + 2 * capchan];
|
||||
if (SPU->regs.cap[capchan].runtime.running)
|
||||
{
|
||||
u32 nSamplesToProcess = srcChan.sampincInt + AddAndReturnCarry(&cap.runtime.sampcntFrac, srcChan.sampincFrac);
|
||||
cap.runtime.sampcntInt += nSamplesToProcess;
|
||||
while(nSamplesToProcess--)
|
||||
SPU_struct::REGS::CAP& cap = SPU->regs.cap[capchan];
|
||||
u32 last = sputrunc(cap.runtime.sampcnt);
|
||||
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?
|
||||
//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)
|
||||
{
|
||||
cap.runtime.curdad = cap.dad;
|
||||
cap.runtime.sampcntInt -= cap.len*multiplier;
|
||||
cap.runtime.sampcnt -= cap.len*multiplier;
|
||||
}
|
||||
} //sampinc loop
|
||||
} //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++)
|
||||
{
|
||||
SPU_struct::REGS::CAP& cap = SPU->regs.cap[capchan];
|
||||
channel_struct& srcChan = SPU->channels[1 + 2 * capchan];
|
||||
if (cap.runtime.running)
|
||||
{
|
||||
for (int samp = 0; samp < length; samp++)
|
||||
{
|
||||
u32 nSamplesToProcess = srcChan.sampincInt + AddAndReturnCarry(&cap.runtime.sampcntFrac, srcChan.sampincFrac);
|
||||
cap.runtime.sampcntInt += nSamplesToProcess;
|
||||
while (nSamplesToProcess--)
|
||||
u32 last = sputrunc(cap.runtime.sampcnt);
|
||||
cap.runtime.sampcnt += SPU->channels[1+2*capchan].sampinc;
|
||||
u32 curr = sputrunc(cap.runtime.sampcnt);
|
||||
for (u32 j = last; j < curr; j++)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
postProcessBuffer = (s16 *)realloc(postProcessBuffer, postProcessBufferSize);
|
||||
}
|
||||
|
||||
|
||||
if (soundProcessor->PostProcessSamples != NULL)
|
||||
{
|
||||
processedSampleCount = soundProcessor->PostProcessSamples(postProcessBuffer, freeSampleCount, _currentSynchMode, _currentSynchronizer);
|
||||
|
@ -1916,7 +1957,7 @@ void WAV_WavSoundUpdate(void* soundData, int numSamples, WAVMode mode)
|
|||
void spu_savestate(EMUFILE &os)
|
||||
{
|
||||
//version
|
||||
os.write_32LE(7);
|
||||
os.write_32LE(6);
|
||||
|
||||
SPU_struct *spu = SPU_core;
|
||||
|
||||
|
@ -1932,18 +1973,18 @@ void spu_savestate(EMUFILE &os)
|
|||
os.write_u8(chan.repeat);
|
||||
os.write_u8(chan.format);
|
||||
os.write_u8(chan.status);
|
||||
os.write_u8(chan.pcm16bOffs);
|
||||
os.write_32LE(chan.addr);
|
||||
os.write_16LE(chan.timer);
|
||||
os.write_16LE(chan.loopstart);
|
||||
os.write_32LE(chan.length);
|
||||
os.write_32LE(chan.sampcntFrac);
|
||||
os.write_32LE(chan.sampcntInt);
|
||||
os.write_32LE(chan.sampincFrac);
|
||||
os.write_32LE(chan.sampincInt);
|
||||
for (int i = 0; i < SPUINTERPOLATION_TAPS; i++) os.write_16LE(chan.pcm16b[i]);
|
||||
os.write_doubleLE(chan.sampcnt);
|
||||
os.write_doubleLE(chan.sampinc);
|
||||
os.write_32LE(chan.lastsampcnt);
|
||||
os.write_16LE(chan.pcm16b);
|
||||
os.write_16LE(chan.pcm16b_last);
|
||||
os.write_32LE(chan.index);
|
||||
os.write_16LE(chan.x);
|
||||
os.write_16LE(chan.psgnoise_last);
|
||||
os.write_u8(chan.keyon);
|
||||
}
|
||||
|
||||
|
@ -1969,8 +2010,7 @@ void spu_savestate(EMUFILE &os)
|
|||
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.maxdad);
|
||||
os.write_32LE(spu->regs.cap[i].runtime.sampcntFrac);
|
||||
os.write_32LE(spu->regs.cap[i].runtime.sampcntInt);
|
||||
os.write_doubleLE(spu->regs.cap[i].runtime.sampcnt);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
|
@ -2004,53 +2044,29 @@ bool spu_loadstate(EMUFILE &is, int size)
|
|||
is.read_u8(chan.repeat);
|
||||
is.read_u8(chan.format);
|
||||
is.read_u8(chan.status);
|
||||
if (version >= 7) is.read_u8(chan.pcm16bOffs); else chan.pcm16bOffs = 0;
|
||||
is.read_32LE(chan.addr);
|
||||
is.read_16LE(chan.timer);
|
||||
is.read_16LE(chan.loopstart);
|
||||
is.read_32LE(chan.length);
|
||||
chan.totlength = chan.length + chan.loopstart;
|
||||
chan.totlength_shifted = chan.totlength << format_shift[chan.format];
|
||||
if(version >= 7) {
|
||||
is.read_32LE(chan.sampcntFrac);
|
||||
is.read_32LE(chan.sampcntInt);
|
||||
is.read_32LE(chan.sampincFrac);
|
||||
is.read_32LE(chan.sampincInt);
|
||||
}
|
||||
else if (version >= 2)
|
||||
chan.double_totlength_shifted = (double)(chan.totlength << format_shift[chan.format]);
|
||||
//printf("%f\n",chan.double_totlength_shifted);
|
||||
if (version >= 2)
|
||||
{
|
||||
double temp;
|
||||
s64 temp2;
|
||||
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);
|
||||
is.read_doubleLE(chan.sampcnt);
|
||||
is.read_doubleLE(chan.sampinc);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME
|
||||
// What even is supposed to be happening here?
|
||||
// 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(*(u32 *)&chan.sampcnt);
|
||||
is.read_32LE(*(u32 *)&chan.sampinc);
|
||||
}
|
||||
is.read_32LE(chan.lastsampcnt);
|
||||
is.read_16LE(chan.pcm16b);
|
||||
is.read_16LE(chan.pcm16b_last);
|
||||
is.read_32LE(chan.index);
|
||||
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)
|
||||
is.read_u8(chan.keyon);
|
||||
|
@ -2089,18 +2105,7 @@ bool spu_loadstate(EMUFILE &is, int size)
|
|||
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.maxdad);
|
||||
if (version >= 7) {
|
||||
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);
|
||||
}
|
||||
is.read_doubleLE(spu->regs.cap[i].runtime.sampcnt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,9 +36,10 @@ class EMUFILE;
|
|||
#define CHANSTAT_STOPPED 0
|
||||
#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.
|
||||
FORCEINLINE u32 sputrunc(float f) { return u32floor(f); }
|
||||
FORCEINLINE u32 sputrunc(double d) { return u32floor(d); }
|
||||
FORCEINLINE s32 spumuldiv7(s32 val, u8 multiplier) {
|
||||
assert(multiplier <= 127);
|
||||
return (multiplier == 127) ? val : ((val * multiplier) >> 7);
|
||||
|
@ -48,8 +49,7 @@ enum SPUInterpolationMode
|
|||
{
|
||||
SPUInterpolation_None = 0,
|
||||
SPUInterpolation_Linear = 1,
|
||||
SPUInterpolation_Cosine = 2,
|
||||
SPUInterpolation_CatmullRom = 3
|
||||
SPUInterpolation_Cosine = 2
|
||||
};
|
||||
|
||||
struct SoundInterface_struct
|
||||
|
@ -84,21 +84,22 @@ struct channel_struct
|
|||
format(0),
|
||||
keyon(0),
|
||||
status(0),
|
||||
pcm16bOffs(0),
|
||||
addr(0),
|
||||
timer(0),
|
||||
loopstart(0),
|
||||
length(0),
|
||||
totlength(0),
|
||||
totlength_shifted(0),
|
||||
sampcntFrac(0),
|
||||
sampcntInt(0),
|
||||
sampincFrac(0),
|
||||
sampincInt(0),
|
||||
double_totlength_shifted(0.0),
|
||||
sampcnt(0.0),
|
||||
sampinc(0.0),
|
||||
lastsampcnt(0),
|
||||
pcm16b(0),
|
||||
pcm16b_last(0),
|
||||
loop_pcm16b(0),
|
||||
index(0),
|
||||
loop_index(0),
|
||||
x(0)
|
||||
x(0),
|
||||
psgnoise_last(0)
|
||||
{}
|
||||
u32 num;
|
||||
u8 vol;
|
||||
|
@ -110,24 +111,22 @@ struct channel_struct
|
|||
u8 format;
|
||||
u8 keyon;
|
||||
u8 status;
|
||||
u8 pcm16bOffs;
|
||||
u32 addr;
|
||||
u16 timer;
|
||||
u16 loopstart;
|
||||
u32 length;
|
||||
u32 totlength;
|
||||
s32 totlength_shifted;
|
||||
u32 sampcntFrac;
|
||||
s32 sampcntInt;
|
||||
u32 sampincFrac;
|
||||
u32 sampincInt;
|
||||
s16 pcm16b[SPUINTERPOLATION_TAPS];
|
||||
double double_totlength_shifted;
|
||||
double sampcnt;
|
||||
double sampinc;
|
||||
// ADPCM specific
|
||||
u32 lastsampcnt;
|
||||
s16 pcm16b, pcm16b_last;
|
||||
s16 loop_pcm16b;
|
||||
s32 index;
|
||||
int loop_index;
|
||||
// PSG noise
|
||||
u16 x;
|
||||
s16 psgnoise_last;
|
||||
};
|
||||
|
||||
class SPUFifo
|
||||
|
@ -197,8 +196,7 @@ public:
|
|||
u8 running;
|
||||
u32 curdad;
|
||||
u32 maxdad;
|
||||
u32 sampcntFrac;
|
||||
u32 sampcntInt;
|
||||
double sampcnt;
|
||||
SPUFifo fifo;
|
||||
} runtime;
|
||||
} cap[2];
|
||||
|
|
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -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());
|
||||
}
|
|
@ -2419,7 +2419,7 @@ TEMPLATE static u32 FASTCALL OP_UMLAL_S(const u32 i)
|
|||
cpu->R[REG_POS(i,12)] += tmp;
|
||||
|
||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_POS(i,16)]);
|
||||
cpu->CPSR.bits.Z = (cpu->R[REG_POS(i,16)]==0) && (cpu->R[REG_POS(i,12)]==0);
|
||||
cpu->CPSR.bits.Z = (cpu->R[REG_POS(i,16)]==0) & (cpu->R[REG_POS(i,12)]==0);
|
||||
|
||||
MUL_UMxxL_END(3);
|
||||
}
|
||||
|
@ -2479,7 +2479,7 @@ TEMPLATE static u32 FASTCALL OP_SMULL_S(const u32 i)
|
|||
cpu->R[REG_POS(i,16)] = (u32)(res>>32);
|
||||
|
||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_POS(i,16)]);
|
||||
cpu->CPSR.bits.Z = (cpu->R[REG_POS(i,16)]==0) && (cpu->R[REG_POS(i,12)]==0);
|
||||
cpu->CPSR.bits.Z = (cpu->R[REG_POS(i,16)]==0) & (cpu->R[REG_POS(i,12)]==0);
|
||||
|
||||
MUL_SMxxL_END(2);
|
||||
}
|
||||
|
@ -2494,7 +2494,7 @@ TEMPLATE static u32 FASTCALL OP_SMLAL_S(const u32 i)
|
|||
cpu->R[REG_POS(i,12)] += tmp;
|
||||
|
||||
cpu->CPSR.bits.N = BIT31(cpu->R[REG_POS(i,16)]);
|
||||
cpu->CPSR.bits.Z = (cpu->R[REG_POS(i,16)]==0) && (cpu->R[REG_POS(i,12)]==0);
|
||||
cpu->CPSR.bits.Z = (cpu->R[REG_POS(i,16)]==0) & (cpu->R[REG_POS(i,12)]==0);
|
||||
|
||||
MUL_SMxxL_END(3);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
using namespace AsmJit;
|
||||
|
||||
#if (LOG_JIT_LEVEL > 0)
|
||||
#include "../modules/Disassembler.h"
|
||||
#define LOG_JIT 1
|
||||
#define JIT_COMMENT(...) c.comment(__VA_ARGS__)
|
||||
#define printJIT(buf, val) { \
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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
|
||||
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_MINOR 0
|
||||
#define MAX_CHEAT_LIST 100
|
||||
#define MAX_XX_CODE 1024
|
||||
#define CHEAT_FILE_MIN_FGETS_BUFFER 32768
|
||||
#define CHEAT_DB_GAME_TITLE_SIZE 256
|
||||
|
||||
#define CHEAT_TYPE_EMPTY 0xFF
|
||||
#define CHEAT_TYPE_INTERNAL 0
|
||||
#define CHEAT_TYPE_AR 1
|
||||
#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
|
||||
{
|
||||
CHEATS_LIST()
|
||||
{
|
||||
memset(this,0,sizeof(*this));
|
||||
type = CHEAT_TYPE_EMPTY;
|
||||
type = 0xFF;
|
||||
}
|
||||
u8 type;
|
||||
u8 enabled;
|
||||
BOOL enabled;
|
||||
// TODO
|
||||
u8 freezeType; // 0 - normal freeze
|
||||
// 1 - can decrease
|
||||
// 2 - can increase
|
||||
u32 code[MAX_XX_CODE][2];
|
||||
|
||||
union
|
||||
{
|
||||
char description[1024];
|
||||
|
||||
struct
|
||||
{
|
||||
char descriptionMajor[512];
|
||||
char descriptionMinor[512];
|
||||
};
|
||||
};
|
||||
|
||||
char description[1024];
|
||||
u32 num;
|
||||
u8 size;
|
||||
};
|
||||
|
@ -76,85 +56,56 @@ struct CHEATS_LIST
|
|||
class CHEATS
|
||||
{
|
||||
private:
|
||||
std::vector<CHEATS_LIST> _list;
|
||||
u8 _filename[MAX_PATH];
|
||||
size_t _currentGet;
|
||||
std::vector<CHEATS_LIST> list;
|
||||
u8 filename[MAX_PATH];
|
||||
u32 currentGet;
|
||||
|
||||
void clear();
|
||||
void ARparser(CHEATS_LIST& cheat);
|
||||
char *clearCode(char *s);
|
||||
|
||||
public:
|
||||
CHEATS()
|
||||
: _currentGet(0)
|
||||
: currentGet(0)
|
||||
{
|
||||
memset(_filename, 0, sizeof(_filename));
|
||||
memset(filename, 0, sizeof(filename));
|
||||
}
|
||||
~CHEATS() {}
|
||||
|
||||
void clear();
|
||||
void init(const char *thePath);
|
||||
const char* getFilePath() const;
|
||||
void setFilePath(const char *thePath);
|
||||
|
||||
size_t addItem(const CHEATS_LIST &srcCheat);
|
||||
bool add(u8 size, u32 address, u32 val, char *description, bool enabled);
|
||||
bool add(u8 size, u32 address, u32 val, char *description, u8 enabled);
|
||||
|
||||
bool updateItemAtIndex(const CHEATS_LIST &srcCheat, const size_t 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 init(char *path);
|
||||
BOOL add(u8 size, u32 address, u32 val, char *description, BOOL enabled);
|
||||
BOOL update(u8 size, u32 address, u32 val, char *description, BOOL enabled, u32 pos);
|
||||
BOOL move(u32 srcPos, u32 dstPos);
|
||||
BOOL add_AR(char *code, char *description, BOOL enabled);
|
||||
BOOL update_AR(char *code, char *description, BOOL enabled, u32 pos);
|
||||
BOOL add_AR_Direct(CHEATS_LIST cheat);
|
||||
BOOL add_CB(char *code, char *description, BOOL enabled);
|
||||
BOOL update_CB(char *code, char *description, BOOL enabled, u32 pos);
|
||||
BOOL remove(u32 pos);
|
||||
void getListReset();
|
||||
bool getList(CHEATS_LIST *cheat);
|
||||
BOOL getList(CHEATS_LIST *cheat);
|
||||
CHEATS_LIST* getListPtr();
|
||||
bool copyItemFromIndex(const size_t pos, CHEATS_LIST &outCheatItem);
|
||||
CHEATS_LIST* getItemPtrAtIndex(const size_t pos) const;
|
||||
size_t getListSize() const;
|
||||
size_t getActiveCount() const;
|
||||
void setDescription(const char *description, const size_t pos);
|
||||
bool save();
|
||||
bool load();
|
||||
bool process(int targetType) const;
|
||||
BOOL get(CHEATS_LIST *cheat, u32 pos);
|
||||
CHEATS_LIST* getItemByIndex(const u32 pos);
|
||||
u32 getSize();
|
||||
size_t getActiveCount();
|
||||
void setDescription(const char *description, u32 pos);
|
||||
BOOL save();
|
||||
BOOL load();
|
||||
void process(int targetType);
|
||||
void getXXcodeString(CHEATS_LIST theList, char *res_buf);
|
||||
|
||||
static void JitNeedsReset();
|
||||
static bool ResetJitIfNeeded();
|
||||
|
||||
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);
|
||||
static BOOL XXCodeFromString(CHEATS_LIST *cheatItem, const std::string codeString);
|
||||
static BOOL XXCodeFromString(CHEATS_LIST *cheatItem, const char *codeString);
|
||||
};
|
||||
|
||||
class CHEATSEARCH
|
||||
{
|
||||
private:
|
||||
u8 *_statMem;
|
||||
u8 *_mem;
|
||||
u32 _amount;
|
||||
u32 _lastRecord;
|
||||
u8 *statMem;
|
||||
u8 *mem;
|
||||
u32 amount;
|
||||
u32 lastRecord;
|
||||
|
||||
u32 _type;
|
||||
u32 _size;
|
||||
|
@ -162,168 +113,90 @@ private:
|
|||
|
||||
public:
|
||||
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(); }
|
||||
bool start(u8 type, u8 size, u8 sign);
|
||||
void close();
|
||||
~CHEATSEARCH() { close(); }
|
||||
BOOL start(u8 type, u8 size, u8 sign);
|
||||
BOOL close();
|
||||
u32 search(u32 val);
|
||||
u32 search(u8 comp);
|
||||
u32 getAmount();
|
||||
bool getList(u32 *address, u32 *curVal);
|
||||
BOOL getList(u32 *address, u32 *curVal);
|
||||
void getListReset();
|
||||
};
|
||||
|
||||
#define CHEATDB_OFFSET_FILE_DESCRIPTION 0x00000010
|
||||
#define CHEATDB_FILEOFFSET_FIRST_FAT_ENTRY 0x00000100
|
||||
|
||||
enum CheatDBFileFormat
|
||||
enum CHEATS_DB_TYPE
|
||||
{
|
||||
CheatDBFileFormat_Undefined = 0,
|
||||
CheatDBFileFormat_R4 = 1,
|
||||
CheatDBFileFormat_Unknown = 65535
|
||||
CHEATS_DB_R4 = 0
|
||||
};
|
||||
|
||||
// This struct maps to the FAT entries in the R4 cheat database file.
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
typedef struct FAT_R4
|
||||
{
|
||||
u8 serial[4];
|
||||
u32 CRC;
|
||||
u8 serial[4];
|
||||
u32 CRC;
|
||||
u64 addr;
|
||||
} FAT_R4;
|
||||
#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
|
||||
{
|
||||
private:
|
||||
CheatDBFile _dbFile;
|
||||
CheatDBGameList _tempGameList;
|
||||
CheatDBGame *_selectedDbGame;
|
||||
CHEATS_LIST *_cheats;
|
||||
CheatSystemError _lastError;
|
||||
CHEATS_DB_TYPE type;
|
||||
bool encrypted;
|
||||
FILE *fp;
|
||||
u32 fsize;
|
||||
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:
|
||||
CHEATSEXPORT();
|
||||
~CHEATSEXPORT();
|
||||
|
||||
bool load(const char *path);
|
||||
void close();
|
||||
|
||||
CHEATS_LIST *getCheats() const;
|
||||
size_t getCheatsNum() const;
|
||||
const char* getGameTitle() const;
|
||||
const char* getDescription() const;
|
||||
CheatSystemError getErrorCode() const;
|
||||
};
|
||||
CHEATSEXPORT() :
|
||||
fp(NULL),
|
||||
fsize(0),
|
||||
dataSize(0),
|
||||
encOffset(0),
|
||||
type(CHEATS_DB_R4),
|
||||
encrypted(false),
|
||||
numCheats(0),
|
||||
cheats(0),
|
||||
CRC(0),
|
||||
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);
|
||||
void CheatItemGenerateDescriptionHierarchical(const char *itemName, const char *itemNote, CHEATS_LIST &outCheatItem);
|
||||
void CheatItemGenerateDescriptionFlat(const char *folderName, const char *folderNote, const char *itemName, const char *itemNote, CHEATS_LIST &outCheatItem);
|
||||
u8 *gametitle;
|
||||
u8 date[17];
|
||||
u32 CRC;
|
||||
bool load(char *path);
|
||||
void close();
|
||||
CHEATS_LIST *getCheats();
|
||||
u32 getCheatsNum();
|
||||
u8 getErrorCode() { return error; }
|
||||
};
|
||||
|
||||
extern CHEATS *cheats;
|
||||
extern CHEATSEARCH *cheatSearch;
|
||||
|
||||
|
||||
|
|
|
@ -397,7 +397,7 @@ bool CommandLine::parse(int argc,char **argv)
|
|||
|
||||
if(opt_help)
|
||||
{
|
||||
printf("%s",help_string);
|
||||
printf(help_string);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -571,7 +571,7 @@ bool CommandLine::validate()
|
|||
|
||||
void CommandLine::errorHelp(const char* binName)
|
||||
{
|
||||
printerror("%s",help_string);
|
||||
printerror(help_string);
|
||||
}
|
||||
|
||||
void CommandLine::process_movieCommands()
|
||||
|
@ -612,23 +612,23 @@ void CommandLine::process_addonCommands()
|
|||
slot1_Change(NDS_SLOT1_R4);
|
||||
else if(slot1 == "RETAILNAND")
|
||||
slot1_Change(NDS_SLOT1_RETAIL_NAND);
|
||||
else if(slot1 == "RETAILMCROM")
|
||||
slot1_Change(NDS_SLOT1_RETAIL_MCROM);
|
||||
else if(slot1 == "RETAILDEBUG")
|
||||
slot1_Change(NDS_SLOT1_RETAIL_DEBUG);
|
||||
else if(slot1 == "RETAILMCROM")
|
||||
slot1_Change(NDS_SLOT1_RETAIL_MCROM);
|
||||
else if(slot1 == "RETAILDEBUG")
|
||||
slot1_Change(NDS_SLOT1_RETAIL_DEBUG);
|
||||
|
||||
if (_rtc_day != -1 || _rtc_hour != -1) {
|
||||
DateTime now = DateTime::get_Now();
|
||||
int cur_day = now.get_DayOfWeek();
|
||||
int cur_hour = now.get_Hour();
|
||||
int cur_total = cur_day * 24 + cur_hour;
|
||||
int day = (_rtc_day != -1 ? _rtc_day : cur_day);
|
||||
int hour = (_rtc_hour != -1 ? _rtc_hour : cur_hour);
|
||||
int total = day * 24 + hour;
|
||||
int diff = total - cur_total;
|
||||
if (diff < 0)
|
||||
diff += 24 * 7;
|
||||
rtcHourOverride = diff;
|
||||
}
|
||||
if (_rtc_day != -1 || _rtc_hour != -1) {
|
||||
DateTime now = DateTime::get_Now();
|
||||
int cur_day = now.get_DayOfWeek();
|
||||
int cur_hour = now.get_Hour();
|
||||
int cur_total = cur_day * 24 + cur_hour;
|
||||
int day = (_rtc_day != -1 ? _rtc_day : cur_day);
|
||||
int hour = (_rtc_hour != -1 ? _rtc_hour : cur_hour);
|
||||
int total = day * 24 + hour;
|
||||
int diff = total - cur_total;
|
||||
if (diff < 0)
|
||||
diff += 24 * 7;
|
||||
rtcHourOverride = diff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -366,13 +366,6 @@ BOOL armcp15_moveCP2ARM(armcp15_t *armcp15, u32 * R, u8 CRn, u8 CRm, u8 opcode1,
|
|||
}
|
||||
}
|
||||
return FALSE;
|
||||
case 13:
|
||||
if(opcode1 == 0 && opcode2 == 1)
|
||||
{
|
||||
*R = armcp15->processID;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
default:
|
||||
LOG("Unsupported CP15 operation : MRC\n");
|
||||
return FALSE;
|
||||
|
@ -495,13 +488,6 @@ BOOL armcp15_moveARM2CP(armcp15_t *armcp15, u32 val, u8 CRn, u8 CRm, u8 opcode1,
|
|||
}
|
||||
}
|
||||
return FALSE;
|
||||
case 13:
|
||||
if(opcode1 == 0 && opcode2 == 1)
|
||||
{
|
||||
armcp15->processID = val;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
bool fail(bool unset=false) { bool ret = this->_failbit; if(unset) unfail(); return ret; }
|
||||
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){
|
||||
return _fread(ptr,bytes);
|
||||
|
@ -327,8 +327,6 @@ public:
|
|||
|
||||
virtual void truncate(s32 length);
|
||||
|
||||
virtual bool eof() { return !!::feof(this->_fp); }
|
||||
|
||||
virtual int fprintf(const char *format, ...) {
|
||||
va_list argptr;
|
||||
va_start(argptr, format);
|
||||
|
|
|
@ -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
|
||||
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
|
||||
|
||||
|
||||
namespace
|
||||
static u32 Deposterize_InterpLTE(const u32 pixA, const u32 pixB)
|
||||
{
|
||||
template <u32 DEN>
|
||||
struct UnpackedPixel
|
||||
const u32 aB = (pixB & 0xFF000000) >> 24;
|
||||
if (aB == 0)
|
||||
{
|
||||
u32 r;
|
||||
u32 g;
|
||||
u32 b;
|
||||
u32 a;
|
||||
return pixA;
|
||||
}
|
||||
|
||||
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 ( ((r/DEN) << 0) |
|
||||
((g/DEN) << 8) |
|
||||
((b/DEN) << 16) |
|
||||
((a/DEN) << 24) );
|
||||
}
|
||||
return (rC | (gC << 8) | (bC << 16) | (aC << 24));
|
||||
}
|
||||
|
||||
static u32 Deposterize_Blend(const u32 pixA, const u32 pixB, const u32 weightA, const u32 weightB)
|
||||
{
|
||||
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)
|
||||
{
|
||||
UnpackedPixel<2> pixOut = {
|
||||
pixA.r,
|
||||
pixA.g,
|
||||
pixA.b,
|
||||
pixA.a
|
||||
};
|
||||
|
||||
if (pixB.a == 0)
|
||||
{
|
||||
pixOut.r = pixOut.r << 1;
|
||||
pixOut.g = pixOut.g << 1;
|
||||
pixOut.b = pixOut.b << 1;
|
||||
pixOut.a = pixOut.a << 1;
|
||||
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();
|
||||
}
|
||||
return Deposterize_Blend(Deposterize_Blend(Deposterize_Blend(Deposterize_Blend(blend[0], blend[5], 2, 14),
|
||||
Deposterize_Blend(blend[0], blend[1], 2, 14),
|
||||
8, 8),
|
||||
Deposterize_Blend(Deposterize_Blend(blend[0], blend[7], 2, 14),
|
||||
Deposterize_Blend(blend[0], blend[3], 2, 14),
|
||||
8, 8),
|
||||
8, 8),
|
||||
Deposterize_Blend(Deposterize_Blend(Deposterize_Blend(blend[0], blend[6], 7, 9),
|
||||
Deposterize_Blend(blend[0], blend[2], 7, 9),
|
||||
8, 8),
|
||||
Deposterize_Blend(Deposterize_Blend(blend[0], blend[8], 7, 9),
|
||||
Deposterize_Blend(blend[0], blend[4], 7, 9),
|
||||
8, 8),
|
||||
8, 8),
|
||||
12, 4);
|
||||
}
|
||||
|
||||
void RenderDeposterize(SSurface Src, SSurface Dst)
|
||||
|
@ -169,15 +127,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
|
|||
continue;
|
||||
}
|
||||
|
||||
color[0] = src[i];
|
||||
color[1] = (x < w-1) ? src[i+1] : src[i];
|
||||
color[2] = (x < w-1) ? src[i+w+1] : src[i];
|
||||
color[3] = src[i];
|
||||
color[4] = (x > 0) ? src[i+w-1] : src[i];
|
||||
color[5] = (x > 0) ? src[i-1] : src[i];
|
||||
color[6] = src[i];
|
||||
color[7] = src[i];
|
||||
color[8] = src[i];
|
||||
color[0] = src[i];
|
||||
color[1] = (x < w-1) ? src[i+1] : src[i];
|
||||
color[2] = (x < w-1) ? src[i+w+1] : src[i];
|
||||
color[3] = src[i];
|
||||
color[4] = (x > 0) ? src[i+w-1] : src[i];
|
||||
color[5] = (x > 0) ? src[i-1] : src[i];
|
||||
color[6] = src[i];
|
||||
color[7] = src[i];
|
||||
color[8] = src[i];
|
||||
|
||||
workingDst[i] = Deposterize_BlendPixel(color);
|
||||
}
|
||||
|
@ -192,15 +150,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
|
|||
continue;
|
||||
}
|
||||
|
||||
color[0] = src[i];
|
||||
color[1] = (x < w-1) ? src[i+1] : src[i];
|
||||
color[2] = (x < w-1) ? src[i+w+1] : src[i];
|
||||
color[3] = src[i+w];
|
||||
color[4] = (x > 0) ? src[i+w-1] : src[i];
|
||||
color[5] = (x > 0) ? src[i-1] : src[i];
|
||||
color[6] = (x > 0) ? src[i-w-1] : src[i];
|
||||
color[7] = src[i-w];
|
||||
color[8] = (x < w-1) ? src[i-w+1] : src[i];
|
||||
color[0] = src[i];
|
||||
color[1] = (x < w-1) ? src[i+1] : src[i];
|
||||
color[2] = (x < w-1) ? src[i+w+1] : src[i];
|
||||
color[3] = src[i+w];
|
||||
color[4] = (x > 0) ? src[i+w-1] : src[i];
|
||||
color[5] = (x > 0) ? src[i-1] : src[i];
|
||||
color[6] = (x > 0) ? src[i-w-1] : src[i];
|
||||
color[7] = src[i-w];
|
||||
color[8] = (x < w-1) ? src[i-w+1] : src[i];
|
||||
|
||||
workingDst[i] = Deposterize_BlendPixel(color);
|
||||
}
|
||||
|
@ -214,15 +172,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
|
|||
continue;
|
||||
}
|
||||
|
||||
color[0] = src[i];
|
||||
color[1] = (x < w-1) ? src[i+1] : src[i];
|
||||
color[2] = src[i];
|
||||
color[3] = src[i];
|
||||
color[4] = src[i];
|
||||
color[5] = (x > 0) ? src[i-1] : src[i];
|
||||
color[6] = (x > 0) ? src[i-w-1] : src[i];
|
||||
color[7] = src[i];
|
||||
color[8] = (x < w-1) ? src[i-w+1] : src[i];
|
||||
color[0] = src[i];
|
||||
color[1] = (x < w-1) ? src[i+1] : src[i];
|
||||
color[2] = src[i];
|
||||
color[3] = src[i];
|
||||
color[4] = src[i];
|
||||
color[5] = (x > 0) ? src[i-1] : src[i];
|
||||
color[6] = (x > 0) ? src[i-w-1] : src[i];
|
||||
color[7] = src[i];
|
||||
color[8] = (x < w-1) ? src[i-w+1] : src[i];
|
||||
|
||||
workingDst[i] = Deposterize_BlendPixel(color);
|
||||
}
|
||||
|
@ -237,15 +195,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
|
|||
continue;
|
||||
}
|
||||
|
||||
color[0] = workingDst[i];
|
||||
color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i];
|
||||
color[2] = (x < w-1) ? workingDst[i+w+1] : workingDst[i];
|
||||
color[3] = workingDst[i];
|
||||
color[4] = (x > 0) ? workingDst[i+w-1] : workingDst[i];
|
||||
color[5] = (x > 0) ? workingDst[i-1] : workingDst[i];
|
||||
color[6] = workingDst[i];
|
||||
color[7] = workingDst[i];
|
||||
color[8] = workingDst[i];
|
||||
color[0] = workingDst[i];
|
||||
color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i];
|
||||
color[2] = (x < w-1) ? workingDst[i+w+1] : workingDst[i];
|
||||
color[3] = workingDst[i];
|
||||
color[4] = (x > 0) ? workingDst[i+w-1] : workingDst[i];
|
||||
color[5] = (x > 0) ? workingDst[i-1] : workingDst[i];
|
||||
color[6] = workingDst[i];
|
||||
color[7] = workingDst[i];
|
||||
color[8] = workingDst[i];
|
||||
|
||||
finalDst[i] = Deposterize_BlendPixel(color);
|
||||
}
|
||||
|
@ -260,15 +218,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
|
|||
continue;
|
||||
}
|
||||
|
||||
color[0] = workingDst[i];
|
||||
color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i];
|
||||
color[2] = (x < w-1) ? workingDst[i+w+1] : workingDst[i];
|
||||
color[3] = workingDst[i+w];
|
||||
color[4] = (x > 0) ? workingDst[i+w-1] : workingDst[i];
|
||||
color[5] = (x > 0) ? workingDst[i-1] : workingDst[i];
|
||||
color[6] = (x > 0) ? workingDst[i-w-1] : workingDst[i];
|
||||
color[7] = workingDst[i-w];
|
||||
color[8] = (x < w-1) ? workingDst[i-w+1] : workingDst[i];
|
||||
color[0] = workingDst[i];
|
||||
color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i];
|
||||
color[2] = (x < w-1) ? workingDst[i+w+1] : workingDst[i];
|
||||
color[3] = workingDst[i+w];
|
||||
color[4] = (x > 0) ? workingDst[i+w-1] : workingDst[i];
|
||||
color[5] = (x > 0) ? workingDst[i-1] : workingDst[i];
|
||||
color[6] = (x > 0) ? workingDst[i-w-1] : workingDst[i];
|
||||
color[7] = workingDst[i-w];
|
||||
color[8] = (x < w-1) ? workingDst[i-w+1] : workingDst[i];
|
||||
|
||||
finalDst[i] = Deposterize_BlendPixel(color);
|
||||
}
|
||||
|
@ -282,15 +240,15 @@ void RenderDeposterize(SSurface Src, SSurface Dst)
|
|||
continue;
|
||||
}
|
||||
|
||||
color[0] = workingDst[i];
|
||||
color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i];
|
||||
color[2] = workingDst[i];
|
||||
color[3] = workingDst[i];
|
||||
color[4] = workingDst[i];
|
||||
color[5] = (x > 0) ? workingDst[i-1] : workingDst[i];
|
||||
color[6] = (x > 0) ? workingDst[i-w-1] : workingDst[i];
|
||||
color[7] = workingDst[i];
|
||||
color[8] = (x < w-1) ? workingDst[i-w+1] : workingDst[i];
|
||||
color[0] = workingDst[i];
|
||||
color[1] = (x < w-1) ? workingDst[i+1] : workingDst[i];
|
||||
color[2] = workingDst[i];
|
||||
color[3] = workingDst[i];
|
||||
color[4] = workingDst[i];
|
||||
color[5] = (x > 0) ? workingDst[i-1] : workingDst[i];
|
||||
color[6] = (x > 0) ? workingDst[i-w-1] : workingDst[i];
|
||||
color[7] = workingDst[i];
|
||||
color[8] = (x < w-1) ? workingDst[i-w+1] : workingDst[i];
|
||||
|
||||
finalDst[i] = Deposterize_BlendPixel(color);
|
||||
}
|
||||
|
|
|
@ -16,15 +16,12 @@
|
|||
// * 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.
|
||||
//
|
||||
// 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.
|
||||
// Also add render functions compatible with filter.h.
|
||||
// 2014-02-06 (rogerman): Modified for use in DeSmuME by removing C++11 code.
|
||||
// Also add render functions compatible with filter.h.
|
||||
|
||||
#include "xbrz.h"
|
||||
#include "filter.h"
|
||||
|
@ -1155,31 +1152,23 @@ struct ColorDistanceARGB
|
|||
{
|
||||
static double dist(uint32_t pix1, uint32_t pix2, double luminanceWeight)
|
||||
{
|
||||
const int a1 = getAlpha(pix1);
|
||||
const int a2 = getAlpha(pix2);
|
||||
|
||||
// Requirements for a color distance handling alpha channel: with a1, a2 in [0, 1]
|
||||
const double a1 = getAlpha(pix1) / 255.0 ;
|
||||
const double a2 = getAlpha(pix2) / 255.0 ;
|
||||
/*
|
||||
Requirements for a color distance handling alpha channel: with a1, a2 in [0, 1]
|
||||
|
||||
// 1. if a1 = a2, distance should be: a1 * distYCbCr()
|
||||
// 2. if a1 = 0, distance should be: a2 * distYCbCr(black, white) = a2 * 255
|
||||
// 3. if a1 = 1, ??? maybe: 255 * (1 - a2) + a2 * distYCbCr()
|
||||
|
||||
if (a1 == 0)
|
||||
return a2;
|
||||
if (a2 == 0)
|
||||
return a1;
|
||||
1. if a1 = a2, distance should be: a1 * distYCbCr()
|
||||
2. if a1 = 0, distance should be: a2 * distYCbCr(black, white) = a2 * 255
|
||||
3. if a1 = 1, ??? maybe: 255 * (1 - a2) + a2 * distYCbCr()
|
||||
*/
|
||||
|
||||
//return std::min(a1, a2) * DistYCbCrBuffer::dist(pix1, pix2) + 255 * abs(a1 - a2);
|
||||
//=> following code is 15% faster:
|
||||
const double d = DistYCbCrBuffer::dist(pix1, pix2);
|
||||
if (a1 == 255 && a2 == 255)
|
||||
return d;
|
||||
if (a1 == a2)
|
||||
return a1 * d / 255.0;
|
||||
const double d = DistYCbCrBuffer::dist(pix1, pix2);
|
||||
if (a1 < a2)
|
||||
return a1 * d / 255.0 + (a2 - a1);
|
||||
return a1 * d + 255 * (a2 - a1);
|
||||
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)));
|
||||
}
|
||||
|
|
|
@ -13,15 +13,12 @@
|
|||
// * 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.
|
||||
//
|
||||
// 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.
|
||||
// Also integrate xbrz's config.h file into this one.
|
||||
// 2014-02-06 (rogerman): Modified for use in DeSmuME by removing C++11 code.
|
||||
// Also integrate xbrz's config.h file into this one.
|
||||
|
||||
#ifndef XBRZ_HEADER_3847894708239054
|
||||
#define XBRZ_HEADER_3847894708239054
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
static _KEY1 enc(&MMU.ARM7_BIOS[0x0030]);
|
||||
const char *defaultNickname = DESMUME_NAME;
|
||||
const char *defaultMessage = DESMUME_NAME " makes you happy!";
|
||||
const char *defaultMacAddressStr = "0009BF123456";
|
||||
|
||||
u16 CFIRMWARE::_getBootCodeCRC16(const u8 *arm9Data, const u32 arm9Size, const u8 *arm7Data, const u32 arm7Size)
|
||||
{
|
||||
|
@ -676,47 +675,6 @@ int copy_firmware_user_data( u8 *dest_buffer, const u8 *fw_data)
|
|||
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)
|
||||
{
|
||||
memset(&outConfig, 0, sizeof(FirmwareConfig));
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
|
||||
extern const char *defaultNickname;
|
||||
extern const char *defaultMessage;
|
||||
extern const char* defaultMacAddressStr;
|
||||
|
||||
struct FirmwareConfig
|
||||
{
|
||||
|
@ -448,8 +447,6 @@ public:
|
|||
|
||||
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_GetCurrentWFCUserID(u8 *outMAC, u8 *outUserID);
|
||||
void NDS_ApplyFirmwareSettings(NDSFirmwareData *outFirmware,
|
||||
|
|
|
@ -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
|
||||
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;
|
||||
|
||||
_semQueue = ssem_new((int)pendingFrameCount);
|
||||
_semQueue = ssem_new(pendingFrameCount);
|
||||
}
|
||||
|
||||
AVFileTypeVideoCodecID ClientAVCaptureFileStream::GetVideoCodecID()
|
||||
|
@ -484,7 +484,7 @@ void ClientAVCaptureObject::ConvertVideoSlice555Xto888(const VideoConvertParam &
|
|||
const u16 *__restrict src = (const u16 *__restrict)param.src;
|
||||
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
|
||||
|
@ -494,7 +494,7 @@ void ClientAVCaptureObject::ConvertVideoSlice888Xto888(const VideoConvertParam &
|
|||
const u32 *__restrict src = (const u32 *__restrict)param.src;
|
||||
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)
|
||||
|
|
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -256,18 +256,15 @@ double ClientDisplayPresenter::GetScaleFactor() const
|
|||
void ClientDisplayPresenter::SetScaleFactor(const double scaleFactor)
|
||||
{
|
||||
const bool willChangeScaleFactor = (this->_scaleFactor != scaleFactor);
|
||||
|
||||
if (!willChangeScaleFactor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->_scaleFactor = scaleFactor;
|
||||
this->_glyphTileSize = (double)HUD_TEXTBOX_BASEGLYPHSIZE * scaleFactor;
|
||||
this->_glyphSize = (double)this->_glyphTileSize * 0.75;
|
||||
|
||||
this->LoadHUDFont();
|
||||
this->_UpdateViewScale();
|
||||
if (willChangeScaleFactor)
|
||||
{
|
||||
this->_glyphTileSize = (double)HUD_TEXTBOX_BASEGLYPHSIZE * scaleFactor;
|
||||
this->_glyphSize = (double)this->_glyphTileSize * 0.75;
|
||||
|
||||
this->LoadHUDFont();
|
||||
}
|
||||
}
|
||||
|
||||
void ClientDisplayPresenter::_UpdateClientSize()
|
||||
|
@ -295,10 +292,6 @@ void ClientDisplayPresenter::_UpdateViewScale()
|
|||
}
|
||||
|
||||
this->_hudObjectScale *= this->_scaleFactor;
|
||||
|
||||
pthread_mutex_lock(&this->_mutexHUDString);
|
||||
this->_hudNeedsUpdate = true;
|
||||
pthread_mutex_unlock(&this->_mutexHUDString);
|
||||
}
|
||||
|
||||
// NDS screen layout
|
||||
|
|
|
@ -1543,27 +1543,6 @@
|
|||
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 */; };
|
||||
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 */; };
|
||||
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, ); }; };
|
||||
|
@ -2446,17 +2425,6 @@
|
|||
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 */; };
|
||||
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 */; };
|
||||
AB8967DD16D2ED2700F826F1 /* DisplayWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -4057,7 +4022,6 @@
|
|||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -4144,7 +4107,6 @@
|
|||
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>"; };
|
||||
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>"; };
|
||||
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; };
|
||||
|
@ -4250,7 +4212,6 @@
|
|||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -4416,13 +4377,10 @@
|
|||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
ABE187E928274F0100B68164 /* DeSmuME_i386.profdata */ = {isa = PBXFileReference; lastKnownFileType = file; path = DeSmuME_i386.profdata; 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>"; };
|
||||
ABE670251415DE6C00E8E4C9 /* tinystr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tinystr.cpp; sourceTree = "<group>"; };
|
||||
|
@ -4435,7 +4393,6 @@
|
|||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -4975,7 +4932,6 @@
|
|||
ABC2ECD613B1C87000FAAA2A /* Images */,
|
||||
AB00E87C14205EBC00DE561F /* MainMenu.xib */,
|
||||
AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */,
|
||||
AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */,
|
||||
AB350D3A147A1D93007165AC /* HID_usage_strings.plist */,
|
||||
8D1107310486CEB800E47090 /* Info.plist */,
|
||||
AB02791814415E4C0075E58C /* Info (Debug).plist */,
|
||||
|
@ -5268,7 +5224,6 @@
|
|||
children = (
|
||||
AB3ACB6614C2361100D7D192 /* appDelegate.h */,
|
||||
AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */,
|
||||
AB6E17F32A675BF1003A564D /* CheatDatabaseWindowController.h */,
|
||||
AB3BF4361E25D6B4003E2B24 /* DisplayViewCALayer.h */,
|
||||
AB8967D716D2ED0700F826F1 /* DisplayWindowController.h */,
|
||||
AB3A655C16CC5416001F5D4A /* EmuControllerDelegate.h */,
|
||||
|
@ -5288,7 +5243,6 @@
|
|||
AB3FBD7E2176DE95005722D0 /* WifiSettingsPanel.h */,
|
||||
AB54718A1E27610500508C5C /* MacMetalDisplayViewShaders.metal */,
|
||||
AB3ACB6714C2361100D7D192 /* appDelegate.mm */,
|
||||
AB6E17F42A675BF1003A564D /* CheatDatabaseWindowController.mm */,
|
||||
AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */,
|
||||
AB3BF4371E25D9AE003E2B24 /* DisplayViewCALayer.mm */,
|
||||
AB8967D816D2ED0700F826F1 /* DisplayWindowController.mm */,
|
||||
|
@ -5392,10 +5346,7 @@
|
|||
AB407F381A620D6E00313213 /* OptimizationProfiles */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
ABECD444282DF23100AA6C0C /* DeSmuME_i386.profdata */,
|
||||
ABA5AB11282E63E20005F25D /* DeSmuME_x86_64.profdata */,
|
||||
ABCC191C2831F3E100B795C4 /* DeSmuME_x86_64h.profdata */,
|
||||
AB7DA2432833EEBA001E9A9E /* DeSmuME_arm64.profdata */,
|
||||
ABE187E928274F0100B68164 /* DeSmuME_i386.profdata */,
|
||||
);
|
||||
path = OptimizationProfiles;
|
||||
sourceTree = "<group>";
|
||||
|
@ -5687,7 +5638,6 @@
|
|||
AB1D4BB126E6F8D700A9AE42 /* GPU_Operations.cpp */,
|
||||
AB1D4BB426E6F8D700A9AE42 /* GPU_Operations_SSE2.cpp */,
|
||||
AB1D4BAF26E6F8D700A9AE42 /* GPU_Operations_AVX2.cpp */,
|
||||
ABD86C842D83E20500505422 /* GPU_Operations_NEON.cpp */,
|
||||
ABD1FEB81345AC8400AF11D1 /* lua-engine.cpp */,
|
||||
ABD1FEB91345AC8400AF11D1 /* matrix.cpp */,
|
||||
ABD1FEBA1345AC8400AF11D1 /* mc.cpp */,
|
||||
|
@ -5697,7 +5647,6 @@
|
|||
ABD1FEC01345AC8400AF11D1 /* NDSSystem.cpp */,
|
||||
ABD1FEC11345AC8400AF11D1 /* OGLRender.cpp */,
|
||||
AB68A0DA16B139BC00DE0546 /* OGLRender_3_2.cpp */,
|
||||
ABDD89F02C30BE97003482B7 /* OGLRender_ES3.cpp */,
|
||||
ABD1FEC21345AC8400AF11D1 /* path.cpp */,
|
||||
ABD1FEC31345AC8400AF11D1 /* rasterize.cpp */,
|
||||
ABD1FEC41345AC8400AF11D1 /* readwrite.cpp */,
|
||||
|
@ -5732,7 +5681,6 @@
|
|||
AB1D4BB326E6F8D700A9AE42 /* GPU_Operations.h */,
|
||||
AB1D4BB226E6F8D700A9AE42 /* GPU_Operations_SSE2.h */,
|
||||
AB1D4BB026E6F8D700A9AE42 /* GPU_Operations_AVX2.h */,
|
||||
ABD86C832D83E20500505422 /* GPU_Operations_NEON.h */,
|
||||
AB796CA215CDCB6B00C59155 /* instruction_attributes.h */,
|
||||
AB796CA315CDCB6B00C59155 /* instructions.h */,
|
||||
ABD1FE841345AC8400AF11D1 /* lua-engine.h */,
|
||||
|
@ -5746,7 +5694,6 @@
|
|||
ABD1FE8C1345AC8400AF11D1 /* NDSSystem.h */,
|
||||
ABD1FE8D1345AC8400AF11D1 /* OGLRender.h */,
|
||||
ABBB421516B4A5F30012E5AB /* OGLRender_3_2.h */,
|
||||
ABDD89EF2C30BE97003482B7 /* OGLRender_ES3.h */,
|
||||
ABD1FE8F1345AC8400AF11D1 /* PACKED.h */,
|
||||
ABD1FE8E1345AC8400AF11D1 /* PACKED_END.h */,
|
||||
ABD1FE901345AC8400AF11D1 /* path.h */,
|
||||
|
@ -5785,7 +5732,6 @@
|
|||
ABD1FF031345AC9B00AF11D1 /* slot2_expMemory.cpp */,
|
||||
ABD1FF041345AC9B00AF11D1 /* slot2_gbagame.cpp */,
|
||||
ABD1FF051345AC9B00AF11D1 /* slot2_guitarGrip.cpp */,
|
||||
AB8800532AD5EC4F0090D47F /* slot2_hcv1000.cpp */,
|
||||
ABD1FF061345AC9B00AF11D1 /* slot2_mpcf.cpp */,
|
||||
ABD1FF071345AC9C00AF11D1 /* slot2_none.cpp */,
|
||||
ABD1FF081345AC9C00AF11D1 /* slot2_paddle.cpp */,
|
||||
|
@ -6499,7 +6445,6 @@
|
|||
8C43E79727E3CD0100A35F65 /* Icon_Input_420x420.png in Resources */,
|
||||
8C43E79827E3CD0100A35F65 /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
8C43E79927E3CD0100A35F65 /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E18032A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
8C43E79A27E3CD0100A35F65 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
8C43E79B27E3CD0100A35F65 /* Icon_Reset_420x420.png in Resources */,
|
||||
8C43E79C27E3CD0100A35F65 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -6619,7 +6564,6 @@
|
|||
8C43E8F527E3CD4C00A35F65 /* Icon_Input_420x420.png in Resources */,
|
||||
8C43E8F627E3CD4C00A35F65 /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
8C43E8F727E3CD4C00A35F65 /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E18042A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
8C43E8F827E3CD4C00A35F65 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
8C43E8F927E3CD4C00A35F65 /* Icon_Reset_420x420.png in Resources */,
|
||||
8C43E8FA27E3CD4C00A35F65 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -6739,7 +6683,6 @@
|
|||
8CCD840827E40B730024BDD5 /* Icon_Input_420x420.png in Resources */,
|
||||
8CCD840927E40B730024BDD5 /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
8CCD840A27E40B730024BDD5 /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E180B2A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
8CCD840B27E40B730024BDD5 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
8CCD840C27E40B730024BDD5 /* Icon_Reset_420x420.png in Resources */,
|
||||
8CCD840D27E40B730024BDD5 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -6859,7 +6802,6 @@
|
|||
AB36C78827F2C8AE00C763C8 /* Icon_Input_420x420.png in Resources */,
|
||||
AB36C78927F2C8AE00C763C8 /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
AB36C78A27F2C8AE00C763C8 /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E18082A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
AB36C78B27F2C8AE00C763C8 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
AB36C78C27F2C8AE00C763C8 /* Icon_Reset_420x420.png in Resources */,
|
||||
AB36C78D27F2C8AE00C763C8 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -6979,7 +6921,6 @@
|
|||
AB497A0E27F2E97A00E8A244 /* Icon_Input_420x420.png in Resources */,
|
||||
AB497A0F27F2E97A00E8A244 /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
AB497A1027F2E97A00E8A244 /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E18072A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
AB497A1127F2E97A00E8A244 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
AB497A1227F2E97A00E8A244 /* Icon_Reset_420x420.png in Resources */,
|
||||
AB497A1327F2E97A00E8A244 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -7099,7 +7040,6 @@
|
|||
AB790193215B84F20082AE82 /* Icon_Input_420x420.png in Resources */,
|
||||
AB790194215B84F20082AE82 /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
AB790195215B84F20082AE82 /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E18062A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
AB790196215B84F20082AE82 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
AB790197215B84F20082AE82 /* Icon_Reset_420x420.png in Resources */,
|
||||
AB790198215B84F20082AE82 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -7219,7 +7159,6 @@
|
|||
AB796CE015CDCBA200C59155 /* Icon_Input_420x420.png in Resources */,
|
||||
AB7EC7F6189B2B92009D198A /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
ABB0FBCC1A9EED350060C55A /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E18012A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
AB796CE215CDCBA200C59155 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
AB796CE315CDCBA200C59155 /* Icon_Reset_420x420.png in Resources */,
|
||||
AB796CE415CDCBA200C59155 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -7339,7 +7278,6 @@
|
|||
AB790036215B84E50082AE82 /* Icon_Input_420x420.png in Resources */,
|
||||
AB790037215B84E50082AE82 /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
AB790038215B84E50082AE82 /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E18052A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
AB790039215B84E50082AE82 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
AB79003A215B84E50082AE82 /* Icon_Reset_420x420.png in Resources */,
|
||||
AB79003B215B84E50082AE82 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -7459,7 +7397,6 @@
|
|||
AB8F3C5F1A53AC2600A80BF6 /* Icon_Input_420x420.png in Resources */,
|
||||
AB8F3C601A53AC2600A80BF6 /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
ABB0FBCE1A9EED350060C55A /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E18022A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
AB8F3C621A53AC2600A80BF6 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
AB8F3C631A53AC2600A80BF6 /* Icon_Reset_420x420.png in Resources */,
|
||||
AB8F3C641A53AC2600A80BF6 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -7589,7 +7526,6 @@
|
|||
ABC8588628273FEE00A03EA9 /* Icon_Input_420x420.png in Resources */,
|
||||
ABC8588728273FEE00A03EA9 /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
ABC8588828273FEE00A03EA9 /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E18092A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
ABC8588928273FEE00A03EA9 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
ABC8588A28273FEE00A03EA9 /* Icon_Reset_420x420.png in Resources */,
|
||||
ABC8588B28273FEE00A03EA9 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -7709,7 +7645,6 @@
|
|||
ABD2CD3C26E05CB000FB15F7 /* Icon_Input_420x420.png in Resources */,
|
||||
ABD2CD3D26E05CB000FB15F7 /* Icon_AutoholdSet_420x420.png in Resources */,
|
||||
ABD2CD3E26E05CB000FB15F7 /* Icon_MicrophoneBlack_256x256.png in Resources */,
|
||||
AB6E180A2A6B218D003A564D /* CheatDatabaseViewer.xib in Resources */,
|
||||
ABD2CD3F26E05CB000FB15F7 /* Icon_OpenROM_420x420.png in Resources */,
|
||||
ABD2CD4026E05CB000FB15F7 /* Icon_Reset_420x420.png in Resources */,
|
||||
ABD2CD4126E05CB000FB15F7 /* Icon_RotateCCW_420x420.png in Resources */,
|
||||
|
@ -7979,7 +7914,6 @@
|
|||
8C43E7F027E3CD0100A35F65 /* ClientExecutionControl.cpp in Sources */,
|
||||
8C43E7F127E3CD0100A35F65 /* rsemaphore.c in Sources */,
|
||||
8C43E7F227E3CD0100A35F65 /* movie.cpp in Sources */,
|
||||
AB6E17F72A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
|
||||
8C43E7F327E3CD0100A35F65 /* slot1comp_rom.cpp in Sources */,
|
||||
8C43E7F427E3CD0100A35F65 /* NDSSystem.cpp in Sources */,
|
||||
8C43E7F527E3CD0100A35F65 /* MacBaseCaptureTool.mm in Sources */,
|
||||
|
@ -8085,7 +8019,6 @@
|
|||
8C43E86627E3CD0100A35F65 /* ftfstype.c in Sources */,
|
||||
8C43E86B27E3CD0100A35F65 /* macosx_10_5_compat.cpp in Sources */,
|
||||
8C43E86C27E3CD0100A35F65 /* retro_dirent.c in Sources */,
|
||||
AB8800562AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
8C43E87427E3CD0100A35F65 /* slot2_passme.cpp in Sources */,
|
||||
8C43E87727E3CD0100A35F65 /* psnames.c in Sources */,
|
||||
8C43E87827E3CD0100A35F65 /* ftotval.c in Sources */,
|
||||
|
@ -8150,7 +8083,6 @@
|
|||
8C43E92F27E3CD4C00A35F65 /* common.cpp in Sources */,
|
||||
8C43E93027E3CD4C00A35F65 /* cp15.cpp in Sources */,
|
||||
8C43E93127E3CD4C00A35F65 /* psaux.c in Sources */,
|
||||
AB8800572AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
8C43E93227E3CD4C00A35F65 /* cpu_detect_x86_gcc.cpp in Sources */,
|
||||
8C43E93327E3CD4C00A35F65 /* crc.cpp in Sources */,
|
||||
8C43E93427E3CD4C00A35F65 /* MacOGLDisplayView.mm in Sources */,
|
||||
|
@ -8224,7 +8156,6 @@
|
|||
8C43E97827E3CD4C00A35F65 /* slot2_rumblepak.cpp in Sources */,
|
||||
8C43E97927E3CD4C00A35F65 /* sndOSX.cpp in Sources */,
|
||||
8C43E97A27E3CD4C00A35F65 /* SndOut.cpp in Sources */,
|
||||
AB6E17F82A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
|
||||
8C43E97B27E3CD4C00A35F65 /* psnames.c in Sources */,
|
||||
8C43E97C27E3CD4C00A35F65 /* Slot2WindowDelegate.mm in Sources */,
|
||||
8C43E97D27E3CD4C00A35F65 /* truetype.c in Sources */,
|
||||
|
@ -8382,7 +8313,6 @@
|
|||
8CCD846127E40B730024BDD5 /* ClientExecutionControl.cpp in Sources */,
|
||||
8CCD846227E40B730024BDD5 /* slot1.cpp in Sources */,
|
||||
8CCD846327E40B730024BDD5 /* slot1_none.cpp in Sources */,
|
||||
AB6E17FE2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
|
||||
8CCD846427E40B730024BDD5 /* slot1_r4.cpp in Sources */,
|
||||
8CCD846527E40B730024BDD5 /* cff.c in Sources */,
|
||||
8CCD846627E40B730024BDD5 /* MacBaseCaptureTool.mm in Sources */,
|
||||
|
@ -8488,7 +8418,6 @@
|
|||
8CCD84DF27E40B730024BDD5 /* type1cid.c in Sources */,
|
||||
8CCD84E427E40B730024BDD5 /* cocoa_slot2.mm in Sources */,
|
||||
8CCD84E627E40B730024BDD5 /* ftbase.c in Sources */,
|
||||
AB88005D2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
8CCD84EA27E40B730024BDD5 /* fsnitro.cpp in Sources */,
|
||||
8CCD84EB27E40B730024BDD5 /* macosx_10_5_compat.cpp in Sources */,
|
||||
8CCD84EC27E40B730024BDD5 /* OGLRender_3_2.cpp in Sources */,
|
||||
|
@ -8533,7 +8462,6 @@
|
|||
AB36C7AF27F2C8AE00C763C8 /* decrypt.cpp in Sources */,
|
||||
AB36C7B027F2C8AE00C763C8 /* directory.cpp in Sources */,
|
||||
AB36C7B127F2C8AE00C763C8 /* Disassembler.cpp in Sources */,
|
||||
AB88005A2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
AB36C7B227F2C8AE00C763C8 /* disc.cpp in Sources */,
|
||||
AB36C7B327F2C8AE00C763C8 /* dlditool.cpp in Sources */,
|
||||
AB36C7B427F2C8AE00C763C8 /* driver.cpp in Sources */,
|
||||
|
@ -8719,7 +8647,6 @@
|
|||
AB36C86B27F2C8AE00C763C8 /* macosx_10_5_compat.cpp in Sources */,
|
||||
AB36C86C27F2C8AE00C763C8 /* OGLRender_3_2.cpp in Sources */,
|
||||
AB36C86D27F2C8AE00C763C8 /* ftfntfmt.c in Sources */,
|
||||
AB6E17FB2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
|
||||
AB36C86E27F2C8AE00C763C8 /* EmuControllerDelegate.mm in Sources */,
|
||||
AB36C86F27F2C8AE00C763C8 /* ClientAVCaptureObject.cpp in Sources */,
|
||||
AB36C87027F2C8AE00C763C8 /* cocoa_GPU.mm in Sources */,
|
||||
|
@ -8777,7 +8704,6 @@
|
|||
AB79006E215B84E50082AE82 /* emufile.cpp in Sources */,
|
||||
AB79006F215B84E50082AE82 /* fatdir.cpp in Sources */,
|
||||
AB790070215B84E50082AE82 /* ftbase.c in Sources */,
|
||||
AB6E17F92A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
|
||||
AB790071215B84E50082AE82 /* fatfile.cpp in Sources */,
|
||||
AB790072215B84E50082AE82 /* FIFO.cpp in Sources */,
|
||||
AB790073215B84E50082AE82 /* sfnt.c in Sources */,
|
||||
|
@ -8909,7 +8835,6 @@
|
|||
AB7900EF215B84E50082AE82 /* coreaudiosound.cpp in Sources */,
|
||||
AB7900F0215B84E50082AE82 /* ringbuffer.cpp in Sources */,
|
||||
AB7900F1215B84E50082AE82 /* arm_jit.cpp in Sources */,
|
||||
AB8800582AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
AB7900F2215B84E50082AE82 /* smooth.c in Sources */,
|
||||
AB7900F3215B84E50082AE82 /* troubleshootingWindowDelegate.mm in Sources */,
|
||||
AB7900F4215B84E50082AE82 /* macOS_driver.cpp in Sources */,
|
||||
|
@ -9026,7 +8951,6 @@
|
|||
AB7901DD215B84F20082AE82 /* driver.cpp in Sources */,
|
||||
AB7901DE215B84F20082AE82 /* emufat.cpp in Sources */,
|
||||
AB7901DF215B84F20082AE82 /* type1cid.c in Sources */,
|
||||
AB8800592AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
AB7901E0215B84F20082AE82 /* emufile.cpp in Sources */,
|
||||
AB7901E1215B84F20082AE82 /* fatdir.cpp in Sources */,
|
||||
AB7901E2215B84F20082AE82 /* fatfile.cpp in Sources */,
|
||||
|
@ -9080,7 +9004,6 @@
|
|||
AB790211215B84F20082AE82 /* type1.c in Sources */,
|
||||
AB790212215B84F20082AE82 /* slot2_paddle.cpp in Sources */,
|
||||
AB790213215B84F20082AE82 /* slot2_piano.cpp in Sources */,
|
||||
AB6E17FA2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
|
||||
AB790214215B84F20082AE82 /* slot2_rumblepak.cpp in Sources */,
|
||||
AB790215215B84F20082AE82 /* sndOSX.cpp in Sources */,
|
||||
AB790216215B84F20082AE82 /* SndOut.cpp in Sources */,
|
||||
|
@ -9238,7 +9161,6 @@
|
|||
AB796D0415CDCBA200C59155 /* emufile.cpp in Sources */,
|
||||
AB796D0515CDCBA200C59155 /* fatdir.cpp in Sources */,
|
||||
ABFEA8011BB4EC1000B08C25 /* ftbase.c in Sources */,
|
||||
AB6E17F52A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
|
||||
AB796D0615CDCBA200C59155 /* fatfile.cpp in Sources */,
|
||||
AB796D0715CDCBA200C59155 /* FIFO.cpp in Sources */,
|
||||
ABFEA8A31BB4EC1100B08C25 /* sfnt.c in Sources */,
|
||||
|
@ -9370,7 +9292,6 @@
|
|||
AB796D6215CDCBA200C59155 /* coreaudiosound.cpp in Sources */,
|
||||
AB796D6315CDCBA200C59155 /* ringbuffer.cpp in Sources */,
|
||||
AB796D6415CDCBA200C59155 /* arm_jit.cpp in Sources */,
|
||||
AB8800542AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
ABFEA8CA1BB4EC1100B08C25 /* smooth.c in Sources */,
|
||||
ABF2B9FB16904133000FF7C0 /* troubleshootingWindowDelegate.mm in Sources */,
|
||||
AB28625920AE3E9F00EAED43 /* macOS_driver.cpp in Sources */,
|
||||
|
@ -9487,7 +9408,6 @@
|
|||
AB8F3C871A53AC2600A80BF6 /* driver.cpp in Sources */,
|
||||
AB8F3C881A53AC2600A80BF6 /* emufat.cpp in Sources */,
|
||||
ABA7316A1BB51FDC00B26147 /* type1cid.c in Sources */,
|
||||
AB8800552AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
AB8F3C891A53AC2600A80BF6 /* emufile.cpp in Sources */,
|
||||
AB8F3C8A1A53AC2600A80BF6 /* fatdir.cpp in Sources */,
|
||||
AB8F3C8B1A53AC2600A80BF6 /* fatfile.cpp in Sources */,
|
||||
|
@ -9541,7 +9461,6 @@
|
|||
ABA731701BB51FDC00B26147 /* type1.c in Sources */,
|
||||
AB8F3CBA1A53AC2600A80BF6 /* slot2_paddle.cpp in Sources */,
|
||||
AB8F3CBB1A53AC2600A80BF6 /* slot2_piano.cpp in Sources */,
|
||||
AB6E17F62A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
|
||||
AB8F3CBC1A53AC2600A80BF6 /* slot2_rumblepak.cpp in Sources */,
|
||||
AB8F3CBD1A53AC2600A80BF6 /* sndOSX.cpp in Sources */,
|
||||
AB8F3CBE1A53AC2600A80BF6 /* SndOut.cpp in Sources */,
|
||||
|
@ -9792,7 +9711,6 @@
|
|||
AB2ABA461C9F9CFA00173B15 /* rthreads.c in Sources */,
|
||||
ABB3C6CB1501C04F00E0C22E /* rasterize.cpp in Sources */,
|
||||
ABB3C6CC1501C04F00E0C22E /* readwrite.cpp in Sources */,
|
||||
AB88005E2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
AB49B553281687B90069F1D7 /* truetype.c in Sources */,
|
||||
ABB3C6CD1501C04F00E0C22E /* render3D.cpp in Sources */,
|
||||
ABB3C6CE1501C04F00E0C22E /* ROMReader.cpp in Sources */,
|
||||
|
@ -9872,7 +9790,6 @@
|
|||
ABC858BF28273FEE00A03EA9 /* filetime.cpp in Sources */,
|
||||
ABC858C028273FEE00A03EA9 /* FIRFilter.cpp in Sources */,
|
||||
ABC858C128273FEE00A03EA9 /* firmware.cpp in Sources */,
|
||||
AB6E17FC2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
|
||||
ABC858C228273FEE00A03EA9 /* async_job.c in Sources */,
|
||||
ABC858C328273FEE00A03EA9 /* gfx3d.cpp in Sources */,
|
||||
ABC858C428273FEE00A03EA9 /* DisplayViewCALayer.mm in Sources */,
|
||||
|
@ -10004,7 +9921,6 @@
|
|||
ABC8594228273FEE00A03EA9 /* buffer.cpp in Sources */,
|
||||
ABC8594328273FEE00A03EA9 /* ftotval.c in Sources */,
|
||||
ABC8594428273FEE00A03EA9 /* compiler.cpp in Sources */,
|
||||
AB88005B2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
ABC8594528273FEE00A03EA9 /* compilercontext.cpp in Sources */,
|
||||
ABC8594628273FEE00A03EA9 /* rthreads.c in Sources */,
|
||||
ABC8594728273FEE00A03EA9 /* macOS_driver.cpp in Sources */,
|
||||
|
@ -10102,7 +10018,6 @@
|
|||
ABD2CD7326E05CB000FB15F7 /* filetime.cpp in Sources */,
|
||||
ABD2CD7426E05CB000FB15F7 /* FIRFilter.cpp in Sources */,
|
||||
ABD2CD7526E05CB000FB15F7 /* firmware.cpp in Sources */,
|
||||
AB6E17FD2A675BF1003A564D /* CheatDatabaseWindowController.mm in Sources */,
|
||||
ABD2CD7626E05CB000FB15F7 /* async_job.c in Sources */,
|
||||
ABD2CD7726E05CB000FB15F7 /* gfx3d.cpp in Sources */,
|
||||
ABD2CD7826E05CB000FB15F7 /* DisplayViewCALayer.mm in Sources */,
|
||||
|
@ -10234,7 +10149,6 @@
|
|||
ABD2CDF626E05CB000FB15F7 /* buffer.cpp in Sources */,
|
||||
ABD2CDF726E05CB000FB15F7 /* ftotval.c in Sources */,
|
||||
ABD2CDF826E05CB000FB15F7 /* compiler.cpp in Sources */,
|
||||
AB88005C2AD5EC500090D47F /* slot2_hcv1000.cpp in Sources */,
|
||||
ABD2CDF926E05CB000FB15F7 /* compilercontext.cpp in Sources */,
|
||||
ABD2CDFA26E05CB000FB15F7 /* rthreads.c in Sources */,
|
||||
ABD2CDFB26E05CB000FB15F7 /* macOS_driver.cpp in Sources */,
|
||||
|
@ -10319,14 +10233,6 @@
|
|||
name = HID_usage_strings.plist;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AB6E17FF2A6B218D003A564D /* CheatDatabaseViewer.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
AB6E18002A6B218D003A564D /* English */,
|
||||
);
|
||||
name = CheatDatabaseViewer.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AB8967DB16D2ED2700F826F1 /* DisplayWindow.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
|
@ -10427,6 +10333,7 @@
|
|||
buildSettings = {
|
||||
ARCHS = arm64;
|
||||
CLANG_OPTIMIZATION_PROFILE_FILE = "$(SRCROOT)/OptimizationProfiles/DeSmuME_arm64.profdata";
|
||||
CLANG_USE_OPTIMIZATION_PROFILE = YES;
|
||||
GCC_FAST_OBJC_DISPATCH = YES;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = fast;
|
||||
|
@ -10759,6 +10666,7 @@
|
|||
ARCHS = x86_64;
|
||||
CLANG_CXX_LIBRARY = "libstdc++";
|
||||
CLANG_OPTIMIZATION_PROFILE_FILE = "$(SRCROOT)/OptimizationProfiles/DeSmuME_x86_64.profdata";
|
||||
CLANG_USE_OPTIMIZATION_PROFILE = YES;
|
||||
GCC_FAST_OBJC_DISPATCH = YES;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = fast;
|
||||
|
@ -10807,6 +10715,7 @@
|
|||
buildSettings = {
|
||||
ARCHS = x86_64h;
|
||||
CLANG_OPTIMIZATION_PROFILE_FILE = "$(SRCROOT)/OptimizationProfiles/DeSmuME_x86_64h.profdata";
|
||||
CLANG_USE_OPTIMIZATION_PROFILE = YES;
|
||||
GCC_FAST_OBJC_DISPATCH = YES;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = fast;
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
location = "self:DeSmuME (Latest).xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
|
|
|
@ -266,11 +266,6 @@
|
|||
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 */; };
|
||||
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 */; };
|
||||
AB1CC80A1AA509DF008B0A16 /* 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 */; };
|
||||
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 */; };
|
||||
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 */; };
|
||||
ABECB50A18A460710052D52A /* 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 */; };
|
||||
ABEF84841873579400E99ADC /* 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 */; };
|
||||
ABF50ABB169F5FDA0018C08D /* assert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABF50A7D169F5FDA0018C08D /* assert.cpp */; };
|
||||
ABF50ABC169F5FDA0018C08D /* buffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABF50A7F169F5FDA0018C08D /* buffer.cpp */; };
|
||||
|
@ -1920,7 +1905,6 @@
|
|||
AB0F29A514BE7213009ABC6F /* Icon_Speaker_420x420.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon_Speaker_420x420.png; path = images/Icon_Speaker_420x420.png; 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>"; };
|
||||
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; };
|
||||
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>"; };
|
||||
|
@ -2011,14 +1995,6 @@
|
|||
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; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -2350,8 +2326,6 @@
|
|||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -2360,7 +2334,6 @@
|
|||
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>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
|
@ -2571,7 +2544,6 @@
|
|||
ABC04DC91F67A2AC00EA6ED7 /* macosx_10_5_compat.cpp */,
|
||||
ABD9A46413DB99B300777194 /* mic_ext.cpp */,
|
||||
ABECB51318A460910052D52A /* OGLDisplayOutput.cpp */,
|
||||
AB3B8DCA2D8A35D900C9CBFD /* OGLDisplayOutput_3_2.cpp */,
|
||||
ABD0A5351501AA5A0074A094 /* ringbuffer.cpp */,
|
||||
ABD104141346652500AF11D1 /* sndOSX.cpp */,
|
||||
AB2145211714DFF4006DDB0F /* audiosamplegenerator.h */,
|
||||
|
@ -2595,7 +2567,6 @@
|
|||
ABD1267420AE812900EFE1B2 /* macOS_driver.h */,
|
||||
ABD9A46313DB99B300777194 /* mic_ext.h */,
|
||||
ABECB51218A460910052D52A /* OGLDisplayOutput.h */,
|
||||
AB3B8DCB2D8A35D900C9CBFD /* OGLDisplayOutput_3_2.h */,
|
||||
ABD0A5371501AA5A0074A094 /* ringbuffer.h */,
|
||||
ABD104011346652500AF11D1 /* sndOSX.h */,
|
||||
AB2F56EE1704C86900E28885 /* utilities.h */,
|
||||
|
@ -2686,7 +2657,6 @@
|
|||
AB05E8201BBFD41200065D18 /* source-sans-pro */,
|
||||
ABC2ECD613B1C87000FAAA2A /* Images */,
|
||||
AB00E87C14205EBC00DE561F /* MainMenu.xib */,
|
||||
ABEFFDDC2A78CB67009C3A2D /* CheatDatabaseViewer.xib */,
|
||||
AB700DB816CDDBC400FBD336 /* DisplayWindow.xib */,
|
||||
AB350D3A147A1D93007165AC /* HID_usage_strings.plist */,
|
||||
8D1107310486CEB800E47090 /* Info.plist */,
|
||||
|
@ -3215,13 +3185,11 @@
|
|||
AB37E3721D6188BC004A2C0D /* colorspacehandler_SSE2.cpp */,
|
||||
AB6FE67226E6F815002B2106 /* colorspacehandler_AVX2.cpp */,
|
||||
AB6FE67426E6F815002B2106 /* colorspacehandler_AVX512.cpp */,
|
||||
AB3B8DCC2D8A35FE00C9CBFD /* colorspacehandler_NEON.cpp */,
|
||||
AB37E36E1D6188BC004A2C0D /* colorspacehandler_AltiVec.cpp */,
|
||||
AB37E36D1D6188BC004A2C0D /* colorspacehandler.h */,
|
||||
AB37E3731D6188BC004A2C0D /* colorspacehandler_SSE2.h */,
|
||||
AB6FE67326E6F815002B2106 /* colorspacehandler_AVX2.h */,
|
||||
AB6FE67526E6F815002B2106 /* colorspacehandler_AVX512.h */,
|
||||
AB3B8DCD2D8A35FE00C9CBFD /* colorspacehandler_NEON.h */,
|
||||
AB37E36F1D6188BC004A2C0D /* colorspacehandler_AltiVec.h */,
|
||||
);
|
||||
path = colorspacehandler;
|
||||
|
@ -3231,7 +3199,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
AB3ACB6614C2361100D7D192 /* appDelegate.h */,
|
||||
ABEBCE352A703E260028CE8A /* CheatDatabaseWindowController.h */,
|
||||
AB3ACB6814C2361100D7D192 /* cheatWindowDelegate.h */,
|
||||
AB3E69811E25FBBF00D4CC75 /* DisplayViewCALayer.h */,
|
||||
AB700DDC16CDE4C300FBD336 /* DisplayWindowController.h */,
|
||||
|
@ -3250,7 +3217,6 @@
|
|||
ABA0356E169127BB00817C69 /* troubleshootingWindowDelegate.h */,
|
||||
AB4B5A1F217E47E400381363 /* WifiSettingsPanel.h */,
|
||||
AB3ACB6714C2361100D7D192 /* appDelegate.mm */,
|
||||
ABEBCE362A703E260028CE8A /* CheatDatabaseWindowController.mm */,
|
||||
AB3ACB6914C2361100D7D192 /* cheatWindowDelegate.mm */,
|
||||
AB3E69821E25FBBF00D4CC75 /* DisplayViewCALayer.mm */,
|
||||
AB700DDD16CDE4C300FBD336 /* DisplayWindowController.mm */,
|
||||
|
@ -3435,7 +3401,6 @@
|
|||
AB6FE66E26E6F7C2002B2106 /* GPU_Operations.cpp */,
|
||||
AB6FE66C26E6F7C2002B2106 /* GPU_Operations_SSE2.cpp */,
|
||||
AB6FE66A26E6F7C2002B2106 /* GPU_Operations_AVX2.cpp */,
|
||||
AB3B8DC62D8A35A000C9CBFD /* GPU_Operations_NEON.cpp */,
|
||||
ABD1FEB81345AC8400AF11D1 /* lua-engine.cpp */,
|
||||
ABD1FEB91345AC8400AF11D1 /* matrix.cpp */,
|
||||
ABD1FEBA1345AC8400AF11D1 /* mc.cpp */,
|
||||
|
@ -3445,7 +3410,6 @@
|
|||
ABD1FEC01345AC8400AF11D1 /* NDSSystem.cpp */,
|
||||
ABD1FEC11345AC8400AF11D1 /* OGLRender.cpp */,
|
||||
AB6FE67026E6F7C2002B2106 /* OGLRender_3_2.cpp */,
|
||||
AB3B8DC82D8A35A000C9CBFD /* OGLRender_ES3.cpp */,
|
||||
ABD1FEC21345AC8400AF11D1 /* path.cpp */,
|
||||
ABD1FEC31345AC8400AF11D1 /* rasterize.cpp */,
|
||||
ABD1FEC41345AC8400AF11D1 /* readwrite.cpp */,
|
||||
|
@ -3480,7 +3444,6 @@
|
|||
AB6FE66F26E6F7C2002B2106 /* GPU_Operations.h */,
|
||||
AB6FE66D26E6F7C2002B2106 /* GPU_Operations_SSE2.h */,
|
||||
AB6FE66B26E6F7C2002B2106 /* GPU_Operations_AVX2.h */,
|
||||
AB3B8DC72D8A35A000C9CBFD /* GPU_Operations_NEON.h */,
|
||||
ABBCE29D15ACB26100A2C965 /* instruction_attributes.h */,
|
||||
ABBCE29E15ACB26100A2C965 /* instructions.h */,
|
||||
ABD1FE841345AC8400AF11D1 /* lua-engine.h */,
|
||||
|
@ -3494,7 +3457,6 @@
|
|||
ABD1FE8C1345AC8400AF11D1 /* NDSSystem.h */,
|
||||
ABD1FE8D1345AC8400AF11D1 /* OGLRender.h */,
|
||||
AB6FE67126E6F7C2002B2106 /* OGLRender_3_2.h */,
|
||||
AB3B8DC92D8A35A000C9CBFD /* OGLRender_ES3.h */,
|
||||
ABD1FE8F1345AC8400AF11D1 /* PACKED.h */,
|
||||
ABD1FE8E1345AC8400AF11D1 /* PACKED_END.h */,
|
||||
ABD1FE901345AC8400AF11D1 /* path.h */,
|
||||
|
@ -3533,7 +3495,6 @@
|
|||
ABD1FF031345AC9B00AF11D1 /* slot2_expMemory.cpp */,
|
||||
ABD1FF041345AC9B00AF11D1 /* slot2_gbagame.cpp */,
|
||||
ABD1FF051345AC9B00AF11D1 /* slot2_guitarGrip.cpp */,
|
||||
AB1B20AB2AD5ED59007CA7EB /* slot2_hcv1000.cpp */,
|
||||
ABD1FF061345AC9B00AF11D1 /* slot2_mpcf.cpp */,
|
||||
ABD1FF071345AC9C00AF11D1 /* slot2_none.cpp */,
|
||||
ABD1FF081345AC9C00AF11D1 /* slot2_paddle.cpp */,
|
||||
|
@ -3909,7 +3870,7 @@
|
|||
attributes = {
|
||||
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";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
|
@ -4053,7 +4014,6 @@
|
|||
ABA1659B2808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */,
|
||||
ABA1659C2808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */,
|
||||
AB6D78942809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */,
|
||||
ABEFFDDF2A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -4173,7 +4133,6 @@
|
|||
ABA165A92808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */,
|
||||
ABA165AA2808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */,
|
||||
AB6D78952809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */,
|
||||
ABEFFDE02A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -4293,7 +4252,6 @@
|
|||
ABA165D32808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */,
|
||||
ABA165D42808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */,
|
||||
AB6D78982809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */,
|
||||
ABEFFDDE2A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -4413,7 +4371,6 @@
|
|||
ABA165C52808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */,
|
||||
ABA165C62808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */,
|
||||
AB6D78972809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */,
|
||||
ABEFFDE22A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -4533,7 +4490,6 @@
|
|||
ABA165B72808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16.png in Resources */,
|
||||
ABA165B82808BD6A00C8CFF5 /* Icon_VolumeTwoThird_DarkMode_16x16@2x.png in Resources */,
|
||||
AB6D78962809FA43007C6B0A /* Icon_MicrophoneIdleNoHardware_256x256.png in Resources */,
|
||||
ABEFFDE12A78CB67009C3A2D /* CheatDatabaseViewer.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -4879,8 +4835,6 @@
|
|||
ABD1267720AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
|
||||
ABD1267820AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
|
||||
AB4B5A22217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
|
||||
ABEBCE382A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */,
|
||||
AB1B20AD2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -5075,8 +5029,6 @@
|
|||
ABD1267920AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
|
||||
ABD1267A20AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
|
||||
AB4B5A23217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
|
||||
ABEBCE392A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */,
|
||||
AB1B20AE2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -5301,8 +5253,6 @@
|
|||
ABD1267520AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
|
||||
ABD1267620AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
|
||||
AB4B5A21217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
|
||||
ABEBCE372A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */,
|
||||
AB1B20AC2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -5527,8 +5477,6 @@
|
|||
ABD1267D20AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
|
||||
ABD1267E20AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
|
||||
AB4B5A25217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
|
||||
ABEBCE3B2A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */,
|
||||
AB1B20B02AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -5723,8 +5671,6 @@
|
|||
ABD1267B20AE812900EFE1B2 /* ClientAVCaptureObject.cpp in Sources */,
|
||||
ABD1267C20AE812900EFE1B2 /* macOS_driver.cpp in Sources */,
|
||||
AB4B5A24217E47E400381363 /* WifiSettingsPanel.mm in Sources */,
|
||||
ABEBCE3A2A703E260028CE8A /* CheatDatabaseWindowController.mm in Sources */,
|
||||
AB1B20AF2AD5ED59007CA7EB /* slot2_hcv1000.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -5771,14 +5717,6 @@
|
|||
name = Localizable.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
ABEFFDDC2A78CB67009C3A2D /* CheatDatabaseViewer.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
ABEFFDDD2A78CB67009C3A2D /* English */,
|
||||
);
|
||||
name = CheatDatabaseViewer.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
|
@ -6069,7 +6007,7 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DeSmuME (Xcode 3)" */ = {
|
||||
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DeSmuME (XCode 3)" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C01FCF4F08A954540054247B /* Debug */,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
#define HOST_DARWIN
|
||||
#define DESMUME_COCOA
|
||||
#define ENABLE_OPENGL_STANDARD
|
||||
#define HAVE_OPENGL
|
||||
#define HAVE_LIBZ
|
||||
//#define HAVE_LUA
|
||||
//#define HAVE_AV_CONFIG_H
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<string>Set Speed</string>
|
||||
<string>Enable/Disable Speed Limiter</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>
|
||||
</array>
|
||||
<key>DefaultInputProfiles</key>
|
||||
|
@ -805,7 +805,7 @@
|
|||
<array/>
|
||||
<key>Enable/Disable Auto Frame Skip</key>
|
||||
<array/>
|
||||
<key>Enable/Disable Cheat System</key>
|
||||
<key>Enable/Disable Cheats</key>
|
||||
<array/>
|
||||
<key>Enable/Disable GPU State</key>
|
||||
<array/>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<dict>
|
||||
<key>Advanscene_AutoDetectRomSaveType</key>
|
||||
<true/>
|
||||
<key>CheatDatabase_RecentFilePath</key>
|
||||
<array/>
|
||||
<key>CoreControl_EnableAutoFrameSkip</key>
|
||||
<true/>
|
||||
<key>CoreControl_FramesToSkipSetting</key>
|
||||
|
@ -831,7 +829,7 @@
|
|||
<array/>
|
||||
<key>Enable/Disable Auto Frame Skip</key>
|
||||
<array/>
|
||||
<key>Enable/Disable Cheat System</key>
|
||||
<key>Enable/Disable Cheats</key>
|
||||
<array/>
|
||||
<key>Enable/Disable GPU State</key>
|
||||
<array/>
|
||||
|
|
|
@ -53,11 +53,6 @@
|
|||
<string>Cocoa</string>
|
||||
<string>OpenEmu</string>
|
||||
</array>
|
||||
<key>0.9.14</key>
|
||||
<array>
|
||||
<string>Cocoa</string>
|
||||
<string>OpenEmu</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>DefaultPaths</key>
|
||||
<dict>
|
||||
|
@ -209,27 +204,6 @@
|
|||
<string>${OPENEMU}</string>
|
||||
</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>
|
||||
<key>DirectoryNames</key>
|
||||
<dict>
|
||||
|
@ -441,32 +415,6 @@
|
|||
<string>SoundSamples</string>
|
||||
</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>
|
||||
<key>FileExtensionByTypes</key>
|
||||
<dict>
|
||||
|
@ -614,24 +562,6 @@
|
|||
<string>nds</string>
|
||||
</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>
|
||||
<key>FileTypeByExtensions</key>
|
||||
<dict>
|
||||
|
@ -779,24 +709,6 @@
|
|||
<string>ROM</string>
|
||||
</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>
|
||||
</plist>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<dict>
|
||||
<key>NSRequiresAquaSystemAppearance</key>
|
||||
<false/>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>DeSmuME requires your host microphone to emulate the NDS microphone.</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
|
@ -246,11 +244,11 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>v0.9.14 (Debug)</string>
|
||||
<string>v0.9.13 (Debug)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>DSmM</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.9.14</string>
|
||||
<string>0.9.13</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.games</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
<dict>
|
||||
<key>NSRequiresAquaSystemAppearance</key>
|
||||
<false/>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
<string>DeSmuME requires your host microphone to emulate the NDS microphone.</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
|
@ -246,11 +244,11 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>v0.9.14</string>
|
||||
<string>v0.9.13</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>DSmM</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.9.14</string>
|
||||
<string>0.9.13</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.games</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2014-2024 DeSmuME team
|
||||
Copyright (C) 2014-2022 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
|
||||
|
@ -4233,7 +4233,8 @@ OGLContextInfo_Legacy::OGLContextInfo_Legacy()
|
|||
glDeleteVertexArraysDESMUME = &glDeleteVertexArrays_LegacyAPPLE;
|
||||
glGenVertexArraysDESMUME = &glGenVertexArrays_LegacyAPPLE;
|
||||
|
||||
_isVAOSupported = _isVBOSupported &&
|
||||
_isVAOSupported = isShaderSupported &&
|
||||
_isVBOSupported &&
|
||||
(this->IsExtensionPresent(oglExtensionSet, "GL_ARB_vertex_array_object") ||
|
||||
this->IsExtensionPresent(oglExtensionSet, "GL_APPLE_vertex_array_object"));
|
||||
|
||||
|
@ -4719,7 +4720,7 @@ void OGLClientSharedData::FetchNativeDisplayToSrcClone(const NDSDisplayInfo *dis
|
|||
return;
|
||||
}
|
||||
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapNone>(displayInfoList[bufferIndex].nativeBuffer16[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapNone>(displayInfoList[bufferIndex].nativeBuffer16[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
this->_srcCloneNeedsUpdate[displayID][bufferIndex] = false;
|
||||
|
||||
if (needsLock)
|
||||
|
@ -4744,7 +4745,7 @@ void OGLClientSharedData::FetchCustomDisplayToSrcClone(const NDSDisplayInfo *dis
|
|||
return;
|
||||
}
|
||||
|
||||
ColorspaceConvertBuffer888xTo8888Opaque<false, false>((u32 *)displayInfoList[bufferIndex].customBuffer[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
ColorspaceConvertBuffer888XTo8888Opaque<false, false>((u32 *)displayInfoList[bufferIndex].customBuffer[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
this->_srcCloneNeedsUpdate[displayID][bufferIndex] = false;
|
||||
|
||||
if (needsLock)
|
||||
|
@ -5038,14 +5039,14 @@ void OGLVideoOutput::_ResizeCPUPixelScaler(const VideoFilterTypeID filterID)
|
|||
|
||||
this->ClientDisplay3DPresenter::_ResizeCPUPixelScaler(filterID);
|
||||
|
||||
glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_ARB, (GLsizei)this->_vfMasterDstBufferSize, this->_vfMasterDstBuffer);
|
||||
glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_ARB, this->_vfMasterDstBufferSize, this->_vfMasterDstBuffer);
|
||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texCPUFilterDstID[NDSDisplayID_Main]);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, (GLsizei)(this->_vf[NDSDisplayID_Main]->GetSrcWidth() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide), (GLsizei)(this->_vf[NDSDisplayID_Main]->GetSrcWidth() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide), 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_vf[NDSDisplayID_Main]->GetDstBufferPtr());
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, this->_vf[NDSDisplayID_Main]->GetSrcWidth() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide, this->_vf[NDSDisplayID_Main]->GetSrcWidth() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_vf[NDSDisplayID_Main]->GetDstBufferPtr());
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texCPUFilterDstID[NDSDisplayID_Touch]);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, (GLsizei)(this->_vf[NDSDisplayID_Touch]->GetSrcWidth() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide), (GLsizei)(this->_vf[NDSDisplayID_Touch]->GetSrcWidth() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide), 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_vf[NDSDisplayID_Touch]->GetDstBufferPtr());
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, this->_vf[NDSDisplayID_Touch]->GetSrcWidth() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide, this->_vf[NDSDisplayID_Touch]->GetSrcWidth() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_vf[NDSDisplayID_Touch]->GetDstBufferPtr());
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
|
@ -5082,7 +5083,7 @@ void OGLVideoOutput::Init()
|
|||
this->PrerenderStateSetupOGL();
|
||||
|
||||
// Set up textures
|
||||
glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_ARB, (GLsizei)this->_vfMasterDstBufferSize, this->_vfMasterDstBuffer);
|
||||
glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_ARB, this->_vfMasterDstBufferSize, this->_vfMasterDstBuffer);
|
||||
|
||||
glGenTextures(2, this->_texCPUFilterDstID);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texCPUFilterDstID[NDSDisplayID_Main]);
|
||||
|
@ -5091,7 +5092,7 @@ void OGLVideoOutput::Init()
|
|||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, (GLsizei)this->_vf[NDSDisplayID_Main]->GetDstWidth(), (GLsizei)this->_vf[NDSDisplayID_Main]->GetDstHeight(), 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_vf[NDSDisplayID_Main]->GetDstBufferPtr());
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, this->_vf[NDSDisplayID_Main]->GetDstWidth(), this->_vf[NDSDisplayID_Main]->GetDstHeight(), 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_vf[NDSDisplayID_Main]->GetDstBufferPtr());
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texCPUFilterDstID[NDSDisplayID_Touch]);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
@ -5099,14 +5100,11 @@ void OGLVideoOutput::Init()
|
|||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, (GLsizei)this->_vf[NDSDisplayID_Touch]->GetDstWidth(), (GLsizei)this->_vf[NDSDisplayID_Touch]->GetDstHeight(), 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_vf[NDSDisplayID_Touch]->GetDstBufferPtr());
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, this->_vf[NDSDisplayID_Touch]->GetDstWidth(), this->_vf[NDSDisplayID_Touch]->GetDstHeight(), 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, this->_vf[NDSDisplayID_Touch]->GetDstBufferPtr());
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
if (this->_contextInfo->IsFBOSupported())
|
||||
{
|
||||
glGenFramebuffersEXT(1, &this->_fboFrameCopyID);
|
||||
}
|
||||
glGenFramebuffersEXT(1, &this->_fboFrameCopyID);
|
||||
}
|
||||
|
||||
void OGLVideoOutput::SetOutputFilter(const OutputFilterTypeID filterID)
|
||||
|
@ -5177,11 +5175,6 @@ void OGLVideoOutput::ProcessDisplays()
|
|||
|
||||
void OGLVideoOutput::CopyFrameToBuffer(uint32_t *dstBuffer)
|
||||
{
|
||||
if (!this->_contextInfo->IsFBOSupported())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GLuint texFrameCopyID = 0;
|
||||
|
||||
glGenTextures(1, &texFrameCopyID);
|
||||
|
@ -5223,12 +5216,11 @@ void OGLVideoOutput::PrerenderStateSetupOGL()
|
|||
// requires.
|
||||
|
||||
// Render State Setup (common to both shaders and fixed-function pipeline)
|
||||
glDisable(GL_BLEND); // The display layer can disable this, but the HUD layer needs this enabled.
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_DITHER);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
// Set up fixed-function pipeline render states.
|
||||
|
@ -5237,13 +5229,8 @@ void OGLVideoOutput::PrerenderStateSetupOGL()
|
|||
glDisable(GL_ALPHA_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_FOG);
|
||||
|
||||
// Note that in fixed-function mode, you can only enable GL_TEXTURE_2D or
|
||||
// GL_TEXTURE_RECTANGLE_ARB at any one time, but you cannot ahve both enabled
|
||||
// at the same time. The display layer requires GL_TEXTURE_RECTANGLE_ARB
|
||||
// enabled, while the HUD layer requires GL_TEXTURE_2D enabled.
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_TEXTURE_RECTANGLE_ARB);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_TEXTURE_RECTANGLE_ARB);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5479,7 +5466,7 @@ void OGLFilter::DownloadDstBufferOGL(uint32_t *dstBuffer, size_t lineOffset, siz
|
|||
}
|
||||
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, this->_fboID);
|
||||
glReadPixels(0, (GLint)lineOffset, this->_dstWidth, (GLsizei)readLineCount, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, dstBuffer);
|
||||
glReadPixels(0, lineOffset, this->_dstWidth, readLineCount, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, dstBuffer);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
}
|
||||
|
||||
|
@ -5582,23 +5569,6 @@ OGLImage::OGLImage(OGLContextInfo *contextInfo, GLsizei imageWidth, GLsizei imag
|
|||
|
||||
UpdateTexCoords(_vf->GetDstWidth(), _vf->GetDstHeight());
|
||||
|
||||
// Render State Setup (common to both shaders and fixed-function pipeline)
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_DITHER);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
// Set up fixed-function pipeline render states.
|
||||
if (!contextInfo->IsShaderSupported())
|
||||
{
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_FOG);
|
||||
glEnable(GL_TEXTURE_RECTANGLE_ARB);
|
||||
}
|
||||
|
||||
// Set up textures
|
||||
glGenTextures(1, &_texCPUFilterDstID);
|
||||
glGenTextures(1, &_texVideoInputDataID);
|
||||
|
@ -5617,7 +5587,7 @@ OGLImage::OGLImage(OGLContextInfo *contextInfo, GLsizei imageWidth, GLsizei imag
|
|||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, (GLsizei)_vf->GetSrcWidth(), (GLsizei)_vf->GetSrcHeight(), 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, _vf->GetSrcBufferPtr());
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, _vf->GetSrcWidth(), _vf->GetSrcHeight(), 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, _vf->GetSrcBufferPtr());
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
const GLint vtxBuffer[8] = {
|
||||
|
@ -5628,14 +5598,14 @@ OGLImage::OGLImage(OGLContextInfo *contextInfo, GLsizei imageWidth, GLsizei imag
|
|||
};
|
||||
|
||||
// Set up VBOs
|
||||
glGenBuffers(1, &_vboVertexID);
|
||||
glGenBuffers(1, &_vboTexCoordID);
|
||||
glGenBuffersARB(1, &_vboVertexID);
|
||||
glGenBuffersARB(1, &_vboTexCoordID);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboVertexID);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vtxBuffer), vtxBuffer, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboTexCoordID);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(_texCoordBuffer), _texCoordBuffer, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboVertexID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(vtxBuffer), vtxBuffer, GL_STATIC_DRAW_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboTexCoordID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(_texCoordBuffer), _texCoordBuffer, GL_STATIC_DRAW_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
// Set up VAO
|
||||
glGenVertexArraysDESMUME(1, &_vaoMainStatesID);
|
||||
|
@ -5643,9 +5613,9 @@ OGLImage::OGLImage(OGLContextInfo *contextInfo, GLsizei imageWidth, GLsizei imag
|
|||
|
||||
if (contextInfo->IsShaderSupported())
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboVertexID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboVertexID);
|
||||
glVertexAttribPointer(OGLVertexAttributeID_Position, 2, GL_INT, GL_FALSE, 0, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboTexCoordID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboTexCoordID);
|
||||
glVertexAttribPointer(OGLVertexAttributeID_TexCoord0, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
|
||||
glEnableVertexAttribArray(OGLVertexAttributeID_Position);
|
||||
|
@ -5653,9 +5623,9 @@ OGLImage::OGLImage(OGLContextInfo *contextInfo, GLsizei imageWidth, GLsizei imag
|
|||
}
|
||||
else
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboVertexID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboVertexID);
|
||||
glVertexPointer(2, GL_INT, 0, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboTexCoordID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboTexCoordID);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, 0);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
|
@ -5693,9 +5663,9 @@ OGLImage::OGLImage(OGLContextInfo *contextInfo, GLsizei imageWidth, GLsizei imag
|
|||
_canUseShaderBasedFilters = (contextInfo->IsShaderSupported() && contextInfo->IsFBOSupported());
|
||||
if (_canUseShaderBasedFilters)
|
||||
{
|
||||
_filterDeposterize = new OGLFilterDeposterize((GLsizei)_vf->GetSrcWidth(), (GLsizei)_vf->GetSrcHeight(), _shaderSupport, _useShader150);
|
||||
_filterDeposterize = new OGLFilterDeposterize(_vf->GetSrcWidth(), _vf->GetSrcHeight(), _shaderSupport, _useShader150);
|
||||
|
||||
_shaderFilter = new OGLFilter((GLsizei)_vf->GetSrcWidth(), (GLsizei)_vf->GetSrcHeight(), 1);
|
||||
_shaderFilter = new OGLFilter(_vf->GetSrcWidth(), _vf->GetSrcHeight(), 1);
|
||||
OGLShaderProgram *shaderFilterProgram = _shaderFilter->GetProgram();
|
||||
shaderFilterProgram->SetShaderSupport(_shaderSupport);
|
||||
shaderFilterProgram->SetVertexAndFragmentShaderOGL(Sample1x1_VertShader_110, PassthroughFragShader_110, false, _useShader150);
|
||||
|
@ -5709,7 +5679,7 @@ OGLImage::OGLImage(OGLContextInfo *contextInfo, GLsizei imageWidth, GLsizei imag
|
|||
}
|
||||
|
||||
_useShaderBasedPixelScaler = false;
|
||||
_filtersPreferGPU = _canUseShaderBasedFilters && _canUseShaderOutput;
|
||||
_filtersPreferGPU = true;
|
||||
_outputFilter = OutputFilterTypeID_Bilinear;
|
||||
}
|
||||
|
||||
|
@ -5721,8 +5691,8 @@ OGLImage::~OGLImage()
|
|||
_isVAOPresent = false;
|
||||
}
|
||||
|
||||
glDeleteBuffers(1, &this->_vboVertexID);
|
||||
glDeleteBuffers(1, &this->_vboTexCoordID);
|
||||
glDeleteBuffersARB(1, &this->_vboVertexID);
|
||||
glDeleteBuffersARB(1, &this->_vboTexCoordID);
|
||||
glDeleteTextures(1, &this->_texCPUFilterDstID);
|
||||
glDeleteTextures(1, &this->_texVideoInputDataID);
|
||||
|
||||
|
@ -6140,10 +6110,10 @@ void OGLImage::SetCPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
|||
{
|
||||
bool needResizeTexture = false;
|
||||
const VideoFilterAttributes newFilterAttr = VideoFilter::GetAttributesByID(filterID);
|
||||
const GLsizei oldDstBufferWidth = (GLsizei)this->_vf->GetDstWidth();
|
||||
const GLsizei oldDstBufferHeight = (GLsizei)this->_vf->GetDstHeight();
|
||||
const GLsizei newDstBufferWidth = (GLsizei)(this->_vf->GetSrcWidth() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide);
|
||||
const GLsizei newDstBufferHeight = (GLsizei)(this->_vf->GetSrcHeight() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide);
|
||||
const GLsizei oldDstBufferWidth = this->_vf->GetDstWidth();
|
||||
const GLsizei oldDstBufferHeight = this->_vf->GetDstHeight();
|
||||
const GLsizei newDstBufferWidth = this->_vf->GetSrcWidth() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide;
|
||||
const GLsizei newDstBufferHeight = this->_vf->GetSrcHeight() * newFilterAttr.scaleMultiply / newFilterAttr.scaleDivide;
|
||||
|
||||
if (oldDstBufferWidth != newDstBufferWidth || oldDstBufferHeight != newDstBufferHeight)
|
||||
{
|
||||
|
@ -6158,6 +6128,7 @@ void OGLImage::SetCPUPixelScalerOGL(const VideoFilterTypeID filterID)
|
|||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texCPUFilterDstID);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, newDstBufferWidth, newDstBufferHeight, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, newMasterBuffer);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
_vfMasterDstBuffer = newMasterBuffer;
|
||||
free_aligned(oldMasterBuffer);
|
||||
|
@ -6170,6 +6141,7 @@ void OGLImage::LoadFrameOGL(const uint32_t *frameData, GLint x, GLint y, GLsizei
|
|||
{
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, this->_texVideoInputDataID);
|
||||
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, x, y, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, frameData);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
memcpy(this->_vf->GetSrcBufferPtr(), frameData, w * h * sizeof(uint32_t));
|
||||
}
|
||||
|
||||
|
@ -6223,8 +6195,10 @@ void OGLImage::ProcessOGL()
|
|||
// Output
|
||||
this->_texVideoOutputID = this->_texVideoPixelScalerID;
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, this->_vboTexCoordID);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(this->_texCoordBuffer), this->_texCoordBuffer);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, this->_vboTexCoordID);
|
||||
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(this->_texCoordBuffer), this->_texCoordBuffer);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
}
|
||||
|
||||
void OGLImage::RenderOGL()
|
||||
|
@ -6264,6 +6238,7 @@ void OGLImage::RenderOGL()
|
|||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, this->_displayTexFilter);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, this->_displayTexFilter);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
// Disable vertex attributes
|
||||
glBindVertexArrayDESMUME(0);
|
||||
|
@ -6330,22 +6305,22 @@ OGLHUDLayer::OGLHUDLayer(OGLVideoOutput *oglVO)
|
|||
_workingCharBufferList->reserve(16);
|
||||
|
||||
// Set up VBOs
|
||||
glGenBuffers(1, &_vboPositionVertexID);
|
||||
glGenBuffers(1, &_vboColorVertexID);
|
||||
glGenBuffers(1, &_vboTexCoordID);
|
||||
glGenBuffers(1, &_vboElementID);
|
||||
glGenBuffersARB(1, &_vboPositionVertexID);
|
||||
glGenBuffersARB(1, &_vboColorVertexID);
|
||||
glGenBuffersARB(1, &_vboTexCoordID);
|
||||
glGenBuffersARB(1, &_vboElementID);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboPositionVertexID);
|
||||
glBufferData(GL_ARRAY_BUFFER, HUD_VERTEX_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboColorVertexID);
|
||||
glBufferData(GL_ARRAY_BUFFER, HUD_VERTEX_COLOR_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboTexCoordID);
|
||||
glBufferData(GL_ARRAY_BUFFER, HUD_VERTEX_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboPositionVertexID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, HUD_VERTEX_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboColorVertexID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, HUD_VERTEX_COLOR_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboTexCoordID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, HUD_VERTEX_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _vboElementID);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLshort) * HUD_TOTAL_ELEMENTS * 6, NULL, GL_STATIC_DRAW);
|
||||
GLshort *idxBufferPtr = (GLshort *)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY_ARB);
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, _vboElementID);
|
||||
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(GLshort) * HUD_TOTAL_ELEMENTS * 6, NULL, GL_STATIC_DRAW_ARB);
|
||||
GLshort *idxBufferPtr = (GLshort *)glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
|
||||
for (size_t i = 0, j = 0, k = 0; i < HUD_TOTAL_ELEMENTS; i++, j+=6, k+=4)
|
||||
{
|
||||
|
@ -6357,8 +6332,8 @@ OGLHUDLayer::OGLHUDLayer(OGLVideoOutput *oglVO)
|
|||
idxBufferPtr[j+5] = k+0;
|
||||
}
|
||||
|
||||
glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
// Set up VAO
|
||||
glGenVertexArraysDESMUME(1, &_vaoMainStatesID);
|
||||
|
@ -6366,13 +6341,13 @@ OGLHUDLayer::OGLHUDLayer(OGLVideoOutput *oglVO)
|
|||
|
||||
if (oglVO->GetContextInfo()->IsShaderSupported())
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboPositionVertexID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboPositionVertexID);
|
||||
glVertexAttribPointer(OGLVertexAttributeID_Position, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboColorVertexID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboColorVertexID);
|
||||
glVertexAttribPointer(OGLVertexAttributeID_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, NULL);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboTexCoordID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboTexCoordID);
|
||||
glVertexAttribPointer(OGLVertexAttributeID_TexCoord0, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _vboElementID);
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, _vboElementID);
|
||||
|
||||
glEnableVertexAttribArray(OGLVertexAttributeID_Position);
|
||||
glEnableVertexAttribArray(OGLVertexAttributeID_Color);
|
||||
|
@ -6380,13 +6355,13 @@ OGLHUDLayer::OGLHUDLayer(OGLVideoOutput *oglVO)
|
|||
}
|
||||
else
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboPositionVertexID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboPositionVertexID);
|
||||
glVertexPointer(2, GL_FLOAT, 0, NULL);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboColorVertexID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboColorVertexID);
|
||||
glColorPointer(4, GL_UNSIGNED_BYTE, 0, NULL);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboTexCoordID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboTexCoordID);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, NULL);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _vboElementID);
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, _vboElementID);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
@ -6405,10 +6380,10 @@ OGLHUDLayer::~OGLHUDLayer()
|
|||
}
|
||||
|
||||
glDeleteVertexArraysDESMUME(1, &this->_vaoMainStatesID);
|
||||
glDeleteBuffers(1, &this->_vboPositionVertexID);
|
||||
glDeleteBuffers(1, &this->_vboColorVertexID);
|
||||
glDeleteBuffers(1, &this->_vboTexCoordID);
|
||||
glDeleteBuffers(1, &this->_vboElementID);
|
||||
glDeleteBuffersARB(1, &this->_vboPositionVertexID);
|
||||
glDeleteBuffersARB(1, &this->_vboColorVertexID);
|
||||
glDeleteBuffersARB(1, &this->_vboTexCoordID);
|
||||
glDeleteBuffersARB(1, &this->_vboElementID);
|
||||
|
||||
glDeleteTextures(1, &this->_texCharMap);
|
||||
|
||||
|
@ -6500,7 +6475,7 @@ void OGLHUDLayer::CopyHUDFont(const FT_Face &fontFace, const size_t glyphSize, c
|
|||
}
|
||||
}
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, texLevel, GL_RGBA, (GLsizei)texSize, (GLsizei)texSize, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, charMapBuffer);
|
||||
glTexImage2D(GL_TEXTURE_2D, texLevel, GL_RGBA, texSize, texSize, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, charMapBuffer);
|
||||
}
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
|
||||
|
@ -6517,25 +6492,25 @@ void OGLHUDLayer::_UpdateVerticesOGL()
|
|||
return;
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, this->_vboPositionVertexID);
|
||||
glBufferData(GL_ARRAY_BUFFER, HUD_VERTEX_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW);
|
||||
float *vtxPositionBufferPtr = (float *)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, this->_vboPositionVertexID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, HUD_VERTEX_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW_ARB);
|
||||
float *vtxPositionBufferPtr = (float *)glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
this->_output->SetHUDPositionVertices((float)this->_output->GetViewportWidth(), (float)this->_output->GetViewportHeight(), vtxPositionBufferPtr);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, this->_vboColorVertexID);
|
||||
glBufferData(GL_ARRAY_BUFFER, HUD_VERTEX_COLOR_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW);
|
||||
uint32_t *vtxColorBufferPtr = (uint32_t *)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, this->_vboColorVertexID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, HUD_VERTEX_COLOR_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW_ARB);
|
||||
uint32_t *vtxColorBufferPtr = (uint32_t *)glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
this->_output->SetHUDColorVertices(vtxColorBufferPtr);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, this->_vboTexCoordID);
|
||||
glBufferData(GL_ARRAY_BUFFER, HUD_VERTEX_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW);
|
||||
float *texCoordBufferPtr = (float *)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, this->_vboTexCoordID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, HUD_VERTEX_ATTRIBUTE_BUFFER_SIZE, NULL, GL_STREAM_DRAW_ARB);
|
||||
float *texCoordBufferPtr = (float *)glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
this->_output->SetHUDTextureCoordinates(texCoordBufferPtr);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
this->_output->ClearHUDNeedsUpdate();
|
||||
}
|
||||
|
@ -6584,8 +6559,6 @@ void OGLHUDLayer::RenderOGL(bool isRenderingFlipped)
|
|||
return;
|
||||
}
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
if (this->_output->GetContextInfo()->IsShaderSupported())
|
||||
{
|
||||
glUseProgram(this->_program->GetProgramID());
|
||||
|
@ -6597,26 +6570,6 @@ void OGLHUDLayer::RenderOGL(bool isRenderingFlipped)
|
|||
this->_needUpdateViewport = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const GLdouble w = this->_output->GetViewportWidth();
|
||||
const GLdouble h = this->_output->GetViewportHeight();
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
if (isRenderingFlipped)
|
||||
{
|
||||
glOrtho(-w/2.0, -w/2.0 + w, -h/2.0 + h, -h/2.0, -1.0, 1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
glOrtho(-w/2.0, -w/2.0 + w, -h/2.0, -h/2.0 + h, -1.0, 1.0);
|
||||
}
|
||||
|
||||
glDisable(GL_TEXTURE_RECTANGLE_ARB);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
if (this->_output->HUDNeedsUpdate())
|
||||
{
|
||||
|
@ -6631,7 +6584,6 @@ void OGLHUDLayer::RenderOGL(bool isRenderingFlipped)
|
|||
{
|
||||
const ClientDisplayPresenterProperties &cdp = this->_output->GetPresenterProperties();
|
||||
|
||||
// Draw the touch lines first.
|
||||
if (this->_output->GetContextInfo()->IsShaderSupported())
|
||||
{
|
||||
glUniform1f(this->_uniformAngleDegrees, cdp.rotation);
|
||||
|
@ -6647,9 +6599,8 @@ void OGLHUDLayer::RenderOGL(bool isRenderingFlipped)
|
|||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glDrawElements(GL_TRIANGLES, (GLsizei)(hudTouchLineLength * 6), GL_UNSIGNED_SHORT, (GLvoid *)((this->_output->GetHUDString().length() + HUD_INPUT_ELEMENT_LENGTH) * 6 * sizeof(uint16_t)));
|
||||
glDrawElements(GL_TRIANGLES, hudTouchLineLength * 6, GL_UNSIGNED_SHORT, (GLvoid *)((this->_output->GetHUDString().length() + HUD_INPUT_ELEMENT_LENGTH) * 6 * sizeof(uint16_t)));
|
||||
|
||||
// Then draw the input buttons overlay.
|
||||
if (this->_output->GetContextInfo()->IsShaderSupported())
|
||||
{
|
||||
glUniform1f(this->_uniformAngleDegrees, 0.0f);
|
||||
|
@ -6700,7 +6651,7 @@ void OGLHUDLayer::RenderOGL(bool isRenderingFlipped)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, -0.50f);
|
||||
}
|
||||
glDrawElements(GL_TRIANGLES, (GLsizei)((this->_output->GetHUDString().length() - 1) * 6), GL_UNSIGNED_SHORT, (GLvoid *)(6 * sizeof(GLshort)));
|
||||
glDrawElements(GL_TRIANGLES, (this->_output->GetHUDString().length() - 1) * 6, GL_UNSIGNED_SHORT, (GLvoid *)(6 * sizeof(GLshort)));
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glBindVertexArrayDESMUME(0);
|
||||
|
@ -6725,14 +6676,14 @@ OGLDisplayLayer::OGLDisplayLayer(OGLVideoOutput *oglVO)
|
|||
pthread_rwlock_init(&_cpuFilterRWLock[NDSDisplayID_Touch][1], NULL);
|
||||
|
||||
// Set up VBOs
|
||||
glGenBuffers(1, &_vboVertexID);
|
||||
glGenBuffers(1, &_vboTexCoordID);
|
||||
glGenBuffersARB(1, &_vboVertexID);
|
||||
glGenBuffersARB(1, &_vboTexCoordID);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboVertexID);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * (4 * 8), NULL, GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboTexCoordID);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * (4 * 8), NULL, GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboVertexID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(GLfloat) * (4 * 8), NULL, GL_STATIC_DRAW_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboTexCoordID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(GLfloat) * (4 * 8), NULL, GL_STREAM_DRAW_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
// Set up VAO
|
||||
glGenVertexArraysDESMUME(1, &_vaoMainStatesID);
|
||||
|
@ -6740,9 +6691,9 @@ OGLDisplayLayer::OGLDisplayLayer(OGLVideoOutput *oglVO)
|
|||
|
||||
if (this->_output->GetContextInfo()->IsShaderSupported())
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboVertexID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboVertexID);
|
||||
glVertexAttribPointer(OGLVertexAttributeID_Position, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboTexCoordID);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboTexCoordID);
|
||||
glVertexAttribPointer(OGLVertexAttributeID_TexCoord0, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
|
||||
glEnableVertexAttribArray(OGLVertexAttributeID_Position);
|
||||
|
@ -6750,10 +6701,10 @@ OGLDisplayLayer::OGLDisplayLayer(OGLVideoOutput *oglVO)
|
|||
}
|
||||
else
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboVertexID);
|
||||
glVertexPointer(2, GL_FLOAT, 0, NULL);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vboTexCoordID);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, NULL);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboVertexID);
|
||||
glVertexPointer(2, GL_FLOAT, 0, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vboTexCoordID);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, 0);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -6816,8 +6767,8 @@ OGLDisplayLayer::~OGLDisplayLayer()
|
|||
glDeleteVertexArraysDESMUME(1, &this->_vaoMainStatesID);
|
||||
}
|
||||
|
||||
glDeleteBuffers(1, &this->_vboVertexID);
|
||||
glDeleteBuffers(1, &this->_vboTexCoordID);
|
||||
glDeleteBuffersARB(1, &this->_vboVertexID);
|
||||
glDeleteBuffersARB(1, &this->_vboTexCoordID);
|
||||
|
||||
if (_output->GetContextInfo()->IsShaderSupported())
|
||||
{
|
||||
|
@ -6863,10 +6814,10 @@ void OGLDisplayLayer::_UpdateRotationScaleOGL()
|
|||
|
||||
void OGLDisplayLayer::_UpdateVerticesOGL()
|
||||
{
|
||||
glBindBuffer(GL_ARRAY_BUFFER, this->_vboVertexID);
|
||||
float *vtxBufferPtr = (float *)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, this->_vboVertexID);
|
||||
float *vtxBufferPtr = (float *)glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
this->_output->SetScreenVertices(vtxBufferPtr);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
|
||||
this->_needUpdateVertices = false;
|
||||
}
|
||||
|
@ -7446,7 +7397,7 @@ void OGLDisplayLayer::ProcessOGL()
|
|||
{
|
||||
texMain = this->_output->GetTexCPUFilterDstID(NDSDisplayID_Main);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texMain);
|
||||
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, (GLsizei)vfMain->GetDstWidth(), (GLsizei)vfMain->GetDstHeight(), GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, vfMain->GetDstBufferPtr());
|
||||
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, vfMain->GetDstWidth(), vfMain->GetDstHeight(), GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, vfMain->GetDstBufferPtr());
|
||||
|
||||
width[NDSDisplayID_Main] = (GLsizei)vfMain->GetDstWidth();
|
||||
height[NDSDisplayID_Main] = (GLsizei)vfMain->GetDstHeight();
|
||||
|
@ -7462,7 +7413,7 @@ void OGLDisplayLayer::ProcessOGL()
|
|||
{
|
||||
texTouch = this->_output->GetTexCPUFilterDstID(NDSDisplayID_Touch);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, texTouch);
|
||||
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, (GLsizei)vfTouch->GetDstWidth(), (GLsizei)vfTouch->GetDstHeight(), GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, vfTouch->GetDstBufferPtr());
|
||||
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, vfTouch->GetDstWidth(), vfTouch->GetDstHeight(), GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, vfTouch->GetDstBufferPtr());
|
||||
|
||||
width[NDSDisplayID_Touch] = (GLsizei)vfTouch->GetDstWidth();
|
||||
height[NDSDisplayID_Touch] = (GLsizei)vfTouch->GetDstHeight();
|
||||
|
@ -7480,15 +7431,15 @@ void OGLDisplayLayer::ProcessOGL()
|
|||
}
|
||||
|
||||
// Update the texture coordinates
|
||||
glBindBuffer(GL_ARRAY_BUFFER, this->_vboTexCoordID);
|
||||
glBufferData(GL_ARRAY_BUFFER, (4 * 8) * sizeof(GLfloat), NULL, GL_STREAM_DRAW);
|
||||
float *texCoordPtr = (float *)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY_ARB);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, this->_vboTexCoordID);
|
||||
glBufferDataARB(GL_ARRAY_BUFFER_ARB, (4 * 8) * sizeof(GLfloat), NULL, GL_STREAM_DRAW_ARB);
|
||||
float *texCoordPtr = (float *)glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
|
||||
this->_output->SetScreenTextureCoordinates((float)width[NDSDisplayID_Main], (float)height[NDSDisplayID_Main],
|
||||
(float)width[NDSDisplayID_Touch], (float)height[NDSDisplayID_Touch],
|
||||
texCoordPtr);
|
||||
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
|
||||
// OpenGL shader-based filters can modify the viewport, so it needs to be reset here.
|
||||
glViewport(0, 0, this->_output->GetViewportWidth(), this->_output->GetViewportHeight());
|
||||
|
@ -7509,8 +7460,6 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
|||
{
|
||||
const bool isShaderSupported = this->_output->GetContextInfo()->IsShaderSupported();
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
if (isShaderSupported)
|
||||
{
|
||||
glUseProgram(this->_finalOutputProgram->GetProgramID());
|
||||
|
@ -7521,13 +7470,9 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
|||
glUniform1i(this->_uniformRenderFlipped, (isRenderingFlipped) ? GL_TRUE : GL_FALSE);
|
||||
this->_needUpdateViewport = false;
|
||||
}
|
||||
|
||||
if (this->_needUpdateRotationScale)
|
||||
{
|
||||
this->_UpdateRotationScaleOGL();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (this->_needUpdateViewport)
|
||||
{
|
||||
const GLdouble w = this->_output->GetViewportWidth();
|
||||
const GLdouble h = this->_output->GetViewportHeight();
|
||||
|
@ -7544,10 +7489,12 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
|||
glOrtho(-w/2.0, -w/2.0 + w, -h/2.0, -h/2.0 + h, -1.0, 1.0);
|
||||
}
|
||||
|
||||
this->_needUpdateViewport = false;
|
||||
}
|
||||
|
||||
if (this->_needUpdateRotationScale)
|
||||
{
|
||||
this->_UpdateRotationScaleOGL();
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glEnable(GL_TEXTURE_RECTANGLE_ARB);
|
||||
}
|
||||
|
||||
if (this->_needUpdateVertices)
|
||||
|
@ -7661,7 +7608,7 @@ void OGLDisplayLayer::RenderOGL(bool isRenderingFlipped)
|
|||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, processedInfo.texID[majorDisplayID]);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, this->_displayTexFilter[majorDisplayID]);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, this->_displayTexFilter[majorDisplayID]);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, (GLint)majorDisplayVtx, 4);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, majorDisplayVtx, 4);
|
||||
|
||||
if (texFetchMajorNeedsLock)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2014-2024 DeSmuME team
|
||||
Copyright (C) 2014-2022 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
|
||||
|
@ -18,18 +18,16 @@
|
|||
#ifndef _OGLDISPLAYOUTPUT_H_
|
||||
#define _OGLDISPLAYOUTPUT_H_
|
||||
|
||||
#ifndef _OGLDISPLAYOUTPUT_3_2_H_
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#ifdef _OGLDISPLAYOUTPUT_3_2_H_
|
||||
#include <OpenGL/gl3.h>
|
||||
#include <OpenGL/gl3ext.h>
|
||||
#else
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#endif
|
||||
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#endif
|
||||
|
||||
#endif // _OGLDISPLAYOUTPUT_3_2_H_
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <pthread.h>
|
||||
|
@ -49,7 +47,7 @@ enum ShaderSupportTier
|
|||
ShaderSupport_MidTier = 3,
|
||||
ShaderSupport_HighTier = 4,
|
||||
ShaderSupport_TopTier = 5,
|
||||
ShaderSupport_FutureTier = 6
|
||||
ShaderSupport_FutureTier = 6,
|
||||
};
|
||||
|
||||
struct OGLProcessedFrameInfo
|
||||
|
|
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -18,6 +18,12 @@
|
|||
#ifndef _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"
|
||||
|
||||
class OGLContextInfo_3_2 : public OGLContextInfo
|
||||
|
|
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -238,9 +238,6 @@ public:
|
|||
@property (assign) BOOL layerSubOBJ;
|
||||
|
||||
@property (assign) NSInteger render3DRenderingEngine;
|
||||
@property (readonly) NSInteger render3DRenderingEngineApplied;
|
||||
@property (readonly) NSInteger render3DRenderingEngineAppliedHostRendererID;
|
||||
@property (readonly) NSString *render3DRenderingEngineAppliedHostRendererName;
|
||||
@property (assign) BOOL render3DHighPrecisionColorInterpolation;
|
||||
@property (assign) BOOL render3DEdgeMarking;
|
||||
@property (assign) BOOL render3DFog;
|
||||
|
@ -264,6 +261,7 @@ public:
|
|||
#endif
|
||||
|
||||
- (BOOL) gpuStateByBit:(const UInt32)stateBit;
|
||||
- (NSString *) render3DRenderingEngineString;
|
||||
- (void) clearWithColor:(const uint16_t)colorBGRA5551;
|
||||
- (void) respondToPauseState:(BOOL)isPaused;
|
||||
|
||||
|
@ -274,14 +272,18 @@ extern "C"
|
|||
{
|
||||
#endif
|
||||
|
||||
bool cgl_initOpenGL_StandardAuto();
|
||||
bool cgl_initOpenGL_LegacyAuto();
|
||||
bool cgl_initOpenGL_3_2_CoreProfile();
|
||||
bool OSXOpenGLRendererInit();
|
||||
bool OSXOpenGLRendererBegin();
|
||||
void OSXOpenGLRendererEnd();
|
||||
bool OSXOpenGLRendererFramebufferDidResize(const bool isFBOSupported, size_t w, size_t h);
|
||||
|
||||
void cgl_deinitOpenGL();
|
||||
bool cgl_beginOpenGL();
|
||||
void cgl_endOpenGL();
|
||||
bool cgl_framebufferDidResizeCallback(const bool isFBOSupported, size_t w, size_t h);
|
||||
bool CreateOpenGLRenderer();
|
||||
void DestroyOpenGLRenderer();
|
||||
void RequestOpenGLRenderer_3_2(bool request_3_2);
|
||||
void SetOpenGLRendererFunctions(bool (*initFunction)(),
|
||||
bool (*beginOGLFunction)(),
|
||||
void (*endOGLFunction)(),
|
||||
bool (*resizeOGLFunction)(const bool isFBOSupported, size_t w, size_t h));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -16,10 +16,6 @@
|
|||
*/
|
||||
|
||||
#import "cocoa_GPU.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#import "cocoa_output.h"
|
||||
#import "cocoa_globals.h"
|
||||
#include "utilities.h"
|
||||
|
@ -55,9 +51,6 @@ GPU3DInterface *core3DList[GPU_3D_RENDERER_COUNT+1] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
int __hostRendererID = -1;
|
||||
char __hostRendererString[256] = {0};
|
||||
|
||||
@implementation CocoaDSGPU
|
||||
|
||||
@dynamic gpuStateFlags;
|
||||
|
@ -81,9 +74,6 @@ char __hostRendererString[256] = {0};
|
|||
@dynamic layerSubOBJ;
|
||||
|
||||
@dynamic render3DRenderingEngine;
|
||||
@dynamic render3DRenderingEngineApplied;
|
||||
@dynamic render3DRenderingEngineAppliedHostRendererID;
|
||||
@dynamic render3DRenderingEngineAppliedHostRendererName;
|
||||
@dynamic render3DHighPrecisionColorInterpolation;
|
||||
@dynamic render3DEdgeMarking;
|
||||
@dynamic render3DFog;
|
||||
|
@ -128,17 +118,11 @@ char __hostRendererString[256] = {0};
|
|||
|
||||
isCPUCoreCountAuto = NO;
|
||||
_needRestoreRender3DLock = NO;
|
||||
|
||||
oglrender_init = &cgl_initOpenGL_StandardAuto;
|
||||
oglrender_deinit = &cgl_deinitOpenGL;
|
||||
oglrender_beginOpenGL = &cgl_beginOpenGL;
|
||||
oglrender_endOpenGL = &cgl_endOpenGL;
|
||||
oglrender_framebufferDidResizeCallback = &cgl_framebufferDidResizeCallback;
|
||||
|
||||
#ifdef OGLRENDER_3_2_H
|
||||
OGLLoadEntryPoints_3_2_Func = &OGLLoadEntryPoints_3_2;
|
||||
OGLCreateRenderer_3_2_Func = &OGLCreateRenderer_3_2;
|
||||
#endif
|
||||
|
||||
SetOpenGLRendererFunctions(&OSXOpenGLRendererInit,
|
||||
&OSXOpenGLRendererBegin,
|
||||
&OSXOpenGLRendererEnd,
|
||||
&OSXOpenGLRendererFramebufferDidResize);
|
||||
|
||||
#ifdef PORT_VERSION_OS_X_APP
|
||||
gpuEvent = new GPUEventHandlerAsync;
|
||||
|
@ -185,10 +169,10 @@ char __hostRendererString[256] = {0};
|
|||
openglDeviceMaxMultisamples = 0;
|
||||
render3DMultisampleSizeString = @"Off";
|
||||
|
||||
bool isTempContextCreated = cgl_initOpenGL_StandardAuto();
|
||||
bool isTempContextCreated = OSXOpenGLRendererInit();
|
||||
if (isTempContextCreated)
|
||||
{
|
||||
cgl_beginOpenGL();
|
||||
OSXOpenGLRendererBegin();
|
||||
|
||||
GLint maxSamplesOGL = 0;
|
||||
|
||||
|
@ -200,8 +184,8 @@ char __hostRendererString[256] = {0};
|
|||
|
||||
openglDeviceMaxMultisamples = maxSamplesOGL;
|
||||
|
||||
cgl_endOpenGL();
|
||||
cgl_deinitOpenGL();
|
||||
OSXOpenGLRendererEnd();
|
||||
DestroyOpenGLRenderer();
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -209,7 +193,7 @@ char __hostRendererString[256] = {0};
|
|||
|
||||
- (void)dealloc
|
||||
{
|
||||
GPU->SetEventHandler(NULL); // Unassigned our event handler before we delete it.
|
||||
DestroyOpenGLRenderer();
|
||||
|
||||
delete fetchObject;
|
||||
delete gpuEvent;
|
||||
|
@ -387,13 +371,17 @@ char __hostRendererString[256] = {0};
|
|||
puts("DeSmuME: Invalid 3D renderer chosen; falling back to SoftRasterizer.");
|
||||
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();
|
||||
GPU->Set3DRendererByID((int)rendererID);
|
||||
GPU->Set3DRendererByID(rendererID);
|
||||
gpuEvent->ApplyRender3DSettingsUnlock();
|
||||
}
|
||||
|
||||
|
@ -406,88 +394,6 @@ char __hostRendererString[256] = {0};
|
|||
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
|
||||
{
|
||||
gpuEvent->ApplyRender3DSettingsLock();
|
||||
|
@ -578,7 +484,7 @@ char __hostRendererString[256] = {0};
|
|||
|
||||
gpuEvent->ApplyRender3DSettingsLock();
|
||||
|
||||
CommonSettings.num_cores = (int)numberCores;
|
||||
CommonSettings.num_cores = numberCores;
|
||||
|
||||
if (renderingEngineID == RENDERID_SOFTRASTERIZER)
|
||||
{
|
||||
|
@ -1112,6 +1018,26 @@ char __hostRendererString[256] = {0};
|
|||
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
|
||||
{
|
||||
gpuEvent->FramebufferLock();
|
||||
|
@ -1893,494 +1819,22 @@ bool GPUEventHandlerAsync::GetRender3DNeedsFinish()
|
|||
|
||||
#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 OSXOpenGLRendererContextPrev = NULL;
|
||||
SILENCE_DEPRECATION_MACOS_10_7( CGLPBufferObj OSXOpenGLRendererPBuffer = NULL );
|
||||
|
||||
// Struct to hold renderer info
|
||||
struct HostRendererInfo
|
||||
bool OSXOpenGLRendererInit()
|
||||
{
|
||||
int32_t rendererID; // Renderer ID, used to associate a renderer with a display device or virtual screen
|
||||
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);
|
||||
|
||||
bool isContextCreated = (OSXOpenGLRendererContext != NULL);
|
||||
if (!isContextCreated)
|
||||
{
|
||||
isContextCreated = __cgl_initOpenGL(kCGLOGLPVersion_3_2_Core);
|
||||
}
|
||||
|
||||
if (!isContextCreated)
|
||||
{
|
||||
isContextCreated = __cgl_initOpenGL(kCGLOGLPVersion_Legacy);
|
||||
isContextCreated = CreateOpenGLRenderer();
|
||||
}
|
||||
|
||||
return isContextCreated;
|
||||
}
|
||||
|
||||
bool cgl_initOpenGL_LegacyAuto()
|
||||
{
|
||||
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()
|
||||
bool OSXOpenGLRendererBegin()
|
||||
{
|
||||
OSXOpenGLRendererContextPrev = CGLGetCurrentContext();
|
||||
CGLSetCurrentContext(OSXOpenGLRendererContext);
|
||||
|
@ -2388,7 +1842,7 @@ bool cgl_beginOpenGL()
|
|||
return true;
|
||||
}
|
||||
|
||||
void cgl_endOpenGL()
|
||||
void OSXOpenGLRendererEnd()
|
||||
{
|
||||
#ifndef PORT_VERSION_OS_X_APP
|
||||
// The OpenEmu plug-in needs the context reset after 3D rendering since OpenEmu's context
|
||||
|
@ -2399,7 +1853,7 @@ void cgl_endOpenGL()
|
|||
#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;
|
||||
|
||||
|
@ -2417,7 +1871,7 @@ bool cgl_framebufferDidResizeCallback(const bool isFBOSupported, size_t w, size_
|
|||
|
||||
// Create a PBuffer if FBOs are not supported.
|
||||
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) )
|
||||
{
|
||||
|
@ -2438,3 +1892,100 @@ bool cgl_framebufferDidResizeCallback(const bool isFBOSupported, size_t w, size_
|
|||
result = true;
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
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
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../../cheatSystem.h"
|
||||
#undef BOOL
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#undef BOOL
|
||||
|
||||
class CHEATS;
|
||||
class CHEATS_LIST;
|
||||
class CHEATSEARCH;
|
||||
class ClientCheatManager;
|
||||
|
||||
enum CheatType
|
||||
{
|
||||
CheatType_Internal = 0,
|
||||
CheatType_ActionReplay = 1,
|
||||
CheatType_CodeBreaker = 2
|
||||
};
|
||||
|
||||
enum CheatFreezeType
|
||||
{
|
||||
CheatFreezeType_Normal = 0,
|
||||
CheatFreezeType_CanDecrease = 1,
|
||||
CheatFreezeType_CanIncrease = 2
|
||||
};
|
||||
/********************************************************************************************
|
||||
CocoaDSCheatItem - OBJECTIVE-C CLASS
|
||||
|
||||
enum CheatSearchStyle
|
||||
{
|
||||
CheatSearchStyle_ExactValue = 0,
|
||||
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();
|
||||
~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();
|
||||
};
|
||||
This is an Objective-C wrapper class for DeSmuME's cheat item struct.
|
||||
|
||||
The cheat item data is not freed upon release of this object. This is by design.
|
||||
|
||||
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
|
||||
{
|
||||
ClientCheatItem *_internalData;
|
||||
BOOL _didAllocateInternalData;
|
||||
BOOL _disableWorkingCopyUpdate;
|
||||
CHEATS_LIST *data;
|
||||
CHEATS_LIST *internalData;
|
||||
BOOL willAdd;
|
||||
pthread_mutex_t mutexData;
|
||||
|
||||
CocoaDSCheatItem *workingCopy;
|
||||
CocoaDSCheatItem *parent;
|
||||
|
||||
BOOL _isMemAddressAlreadyUpdating;
|
||||
}
|
||||
|
||||
@property (readonly, nonatomic, getter=clientData) ClientCheatItem *_internalData;
|
||||
@property (assign) CHEATS_LIST *data;
|
||||
@property (assign) BOOL willAdd;
|
||||
@property (assign, nonatomic) BOOL enabled;
|
||||
@property (assign, nonatomic) NSInteger cheatType;
|
||||
|
@ -332,17 +64,17 @@ public:
|
|||
@property (readonly) CocoaDSCheatItem *workingCopy;
|
||||
@property (assign) CocoaDSCheatItem *parent;
|
||||
|
||||
- (id) initWithCocoaCheatItem:(CocoaDSCheatItem *)cdsCheatItem;
|
||||
- (id) initWithCheatItem:(ClientCheatItem *)cheatItem;
|
||||
- (id) initWithCheatData:(const CHEATS_LIST *)cheatData;
|
||||
- (id) initWithCheatData:(CHEATS_LIST *)cheatData;
|
||||
- (BOOL) retainData;
|
||||
- (char *) descriptionCString;
|
||||
- (void) update;
|
||||
- (CocoaDSCheatItem *) createWorkingCopy;
|
||||
- (void) destroyWorkingCopy;
|
||||
- (void) mergeFromWorkingCopy;
|
||||
- (void) mergeToParent;
|
||||
- (void) setDataWithDictionary:(NSDictionary *)dataDict;
|
||||
- (NSDictionary *) dataDictionary;
|
||||
|
||||
+ (void) setIconDirectory:(NSImage *)iconImage;
|
||||
+ (NSImage *) iconDirectory;
|
||||
+ (void) setIconInternalCheat:(NSImage *)iconImage;
|
||||
+ (NSImage *) iconInternalCheat;
|
||||
+ (void) setIconActionReplay:(NSImage *)iconImage;
|
||||
|
@ -352,116 +84,92 @@ public:
|
|||
|
||||
@end
|
||||
|
||||
@interface CocoaDSCheatDBEntry : NSObject
|
||||
{
|
||||
CheatDBEntry *_dbEntry;
|
||||
|
||||
CocoaDSCheatDBEntry *parent;
|
||||
NSMutableArray *child;
|
||||
NSInteger willAdd;
|
||||
NSString *codeString;
|
||||
|
||||
BOOL needSetMixedState;
|
||||
}
|
||||
/********************************************************************************************
|
||||
CocoaDSCheatManager - OBJECTIVE-C CLASS
|
||||
|
||||
@property (readonly, nonatomic) NSString *name;
|
||||
@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
|
||||
This is an Objective-C wrapper class for DeSmuME's cheat list class.
|
||||
|
||||
Thread Safety:
|
||||
All methods are thread-safe.
|
||||
********************************************************************************************/
|
||||
@interface CocoaDSCheatManager : NSObject
|
||||
{
|
||||
ClientCheatManager *_internalCheatManager;
|
||||
NSMutableArray *sessionList;
|
||||
NSMutableArray *searchResultsList;
|
||||
CHEATS *listData;
|
||||
NSMutableArray *list;
|
||||
|
||||
pthread_rwlock_t *rwlockCoreExecute;
|
||||
BOOL isUsingDummyRWlock;
|
||||
|
||||
NSUInteger untitledCount;
|
||||
NSString *dbTitle;
|
||||
NSString *dbDate;
|
||||
}
|
||||
|
||||
@property (readonly, nonatomic, getter=internalManager) ClientCheatManager *_internalCheatManager;
|
||||
@property (readonly) NSMutableArray *sessionList;
|
||||
@property (readonly, nonatomic) NSString *currentGameCode;
|
||||
@property (readonly, nonatomic) NSUInteger currentGameCRC;
|
||||
@property (readonly, nonatomic) NSUInteger itemTotalCount;
|
||||
@property (readonly, nonatomic) NSUInteger itemActiveCount;
|
||||
@property (readonly) NSMutableArray *searchResultsList;
|
||||
@property (readonly, nonatomic) BOOL searchDidStart;
|
||||
@property (readonly, nonatomic) NSUInteger searchCount;
|
||||
@property (assign, nonatomic) pthread_rwlock_t *rwlockCoreExecute;
|
||||
@property (readonly) CHEATS *listData;
|
||||
@property (readonly) NSMutableArray *list;
|
||||
@property (assign) pthread_rwlock_t *rwlockCoreExecute;
|
||||
@property (assign) NSUInteger untitledCount;
|
||||
@property (copy) NSString *dbTitle;
|
||||
@property (copy) NSString *dbDate;
|
||||
|
||||
- (id) initWithFileURL:(NSURL *)fileURL;
|
||||
- (id) initWithListData:(CHEATS *)cheatList;
|
||||
- (id) initWithFileURL:(NSURL *)fileURL listData:(CHEATS *)cheatList;
|
||||
|
||||
- (CocoaDSCheatItem *) newItem;
|
||||
- (CocoaDSCheatItem *) addExistingItem:(ClientCheatItem *)cheatItem;
|
||||
- (CocoaDSCheatItem *) addExistingCocoaItem:(CocoaDSCheatItem *)cocoaCheatItem;
|
||||
- (void) remove:(CocoaDSCheatItem *)cocoaCheatItem;
|
||||
- (void) removeAtIndex:(NSUInteger)itemIndex;
|
||||
- (BOOL) update:(CocoaDSCheatItem *)cocoaCheatItem;
|
||||
- (BOOL) add:(CocoaDSCheatItem *)cheatItem;
|
||||
- (void) remove:(CocoaDSCheatItem *)cheatItem;
|
||||
- (BOOL) update:(CocoaDSCheatItem *)cheatItem;
|
||||
- (BOOL) save;
|
||||
- (void) directWriteInternalCheat:(CocoaDSCheatItem *)cocoaCheatItem;
|
||||
- (void) loadFromMaster;
|
||||
- (void) applyToMaster;
|
||||
- (NSUInteger) activeCount;
|
||||
- (NSMutableArray *) cheatListFromDatabase:(NSURL *)fileURL errorCode:(NSInteger *)error;
|
||||
- (void) applyInternalCheat:(CocoaDSCheatItem *)cheatItem;
|
||||
|
||||
- (NSUInteger) databaseAddSelectedInEntry:(CocoaDSCheatDBEntry *)theEntry;
|
||||
|
||||
- (NSUInteger) runExactValueSearch:(NSInteger)value byteSize:(UInt8)byteSize signType:(NSInteger)signType;
|
||||
- (NSUInteger) runComparativeSearch:(NSInteger)typeID byteSize:(UInt8)byteSize signType:(NSInteger)signType;
|
||||
- (void) searchReset;
|
||||
+ (void) setMasterCheatList:(CocoaDSCheatManager *)cheatListManager;
|
||||
+ (void) applyInternalCheatWithItem:(CocoaDSCheatItem *)cheatItem;
|
||||
+ (void) applyInternalCheatWithAddress:(UInt32)address value:(UInt32)value bytes:(NSUInteger)bytes;
|
||||
+ (NSMutableArray *) cheatListWithListObject:(CHEATS *)cheatList;
|
||||
+ (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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,7 +31,6 @@ class ClientExecutionControl;
|
|||
@class CocoaDSFirmware;
|
||||
@class CocoaDSGPU;
|
||||
@class CocoaDSOutput;
|
||||
@class CocoaDSCheatManager;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -49,7 +48,6 @@ typedef struct
|
|||
CocoaDSController *cdsController;
|
||||
CocoaDSFirmware *cdsFirmware;
|
||||
CocoaDSGPU *cdsGPU;
|
||||
CocoaDSCheatManager *cdsCheatManager;
|
||||
NSMutableArray *cdsOutputList;
|
||||
|
||||
pthread_t coreThread;
|
||||
|
@ -74,7 +72,6 @@ typedef struct
|
|||
@property (retain) CocoaDSFirmware *cdsFirmware;
|
||||
@property (readonly) CocoaDSController *cdsController;
|
||||
@property (readonly) CocoaDSGPU *cdsGPU;
|
||||
@property (readonly) CocoaDSCheatManager *cdsCheatManager;
|
||||
@property (readonly) NSMutableArray *cdsOutputList;
|
||||
|
||||
@property (assign) BOOL masterExecute;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -20,7 +20,6 @@
|
|||
#import "cocoa_input.h"
|
||||
#import "cocoa_firmware.h"
|
||||
#import "cocoa_GPU.h"
|
||||
#import "cocoa_cheat.h"
|
||||
#import "cocoa_globals.h"
|
||||
#import "cocoa_output.h"
|
||||
#import "cocoa_rom.h"
|
||||
|
@ -49,7 +48,6 @@ volatile bool execute = true;
|
|||
@synthesize cdsFirmware;
|
||||
@synthesize cdsController;
|
||||
@synthesize cdsGPU;
|
||||
@synthesize cdsCheatManager;
|
||||
@synthesize cdsOutputList;
|
||||
|
||||
@dynamic masterExecute;
|
||||
|
@ -124,7 +122,6 @@ volatile bool execute = true;
|
|||
cdsFirmware = nil;
|
||||
cdsController = [[CocoaDSController alloc] init];
|
||||
cdsGPU = [[CocoaDSGPU alloc] init];
|
||||
cdsCheatManager = [[CocoaDSCheatManager alloc] init];
|
||||
cdsOutputList = [[NSMutableArray alloc] initWithCapacity:32];
|
||||
|
||||
ClientInputHandler *inputHandler = [cdsController inputHandler];
|
||||
|
@ -167,11 +164,10 @@ volatile bool execute = true;
|
|||
pthread_attr_destroy(&threadAttr);
|
||||
|
||||
[cdsGPU setOutputList:cdsOutputList rwlock:&threadParam.rwlockOutputList];
|
||||
[cdsCheatManager setRwlockCoreExecute:&threadParam.rwlockCoreExecute];
|
||||
|
||||
macOS_driver *newDriver = new macOS_driver;
|
||||
newDriver->SetCoreThreadMutexLock(&threadParam.mutexThreadExecute);
|
||||
newDriver->SetCoreExecuteRWLock(&threadParam.rwlockCoreExecute);
|
||||
newDriver->SetCoreExecuteRWLock(self.rwlockCoreExecute);
|
||||
newDriver->SetExecutionControl(execControl);
|
||||
driver = newDriver;
|
||||
|
||||
|
@ -607,7 +603,7 @@ volatile bool execute = true;
|
|||
execControl->SetExecutionBehavior((ExecutionBehavior)coreState);
|
||||
pthread_rwlock_rdlock(&threadParam.rwlockOutputList);
|
||||
|
||||
char frameStatusCStr[64] = {0};
|
||||
char frameStatusCStr[128] = {0};
|
||||
|
||||
switch ((ExecutionBehavior)coreState)
|
||||
{
|
||||
|
@ -618,7 +614,7 @@ volatile bool execute = true;
|
|||
[cdsOutput setIdle:YES];
|
||||
}
|
||||
|
||||
snprintf(frameStatusCStr, sizeof(frameStatusCStr), "%llu", (unsigned long long)[self frameNumber]);
|
||||
sprintf(frameStatusCStr, "%llu", (unsigned long long)[self frameNumber]);
|
||||
|
||||
[_fpsTimer invalidate];
|
||||
_fpsTimer = nil;
|
||||
|
@ -632,7 +628,7 @@ volatile bool execute = true;
|
|||
[cdsOutput setIdle:NO];
|
||||
}
|
||||
|
||||
snprintf(frameStatusCStr, sizeof(frameStatusCStr), "%llu", (unsigned long long)[self frameNumber]);
|
||||
sprintf(frameStatusCStr, "%llu", (unsigned long long)[self frameNumber]);
|
||||
|
||||
[_fpsTimer invalidate];
|
||||
_fpsTimer = nil;
|
||||
|
@ -646,7 +642,7 @@ volatile bool execute = true;
|
|||
[cdsOutput setIdle:NO];
|
||||
}
|
||||
|
||||
snprintf(frameStatusCStr, sizeof(frameStatusCStr), "%s", "Executing...");
|
||||
sprintf(frameStatusCStr, "%s", "Executing...");
|
||||
|
||||
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 = nil;
|
||||
|
@ -728,42 +724,50 @@ volatile bool execute = true;
|
|||
|
||||
- (void) setArm9ImageURL:(NSURL *)fileURL
|
||||
{
|
||||
execControl->SetARM9ImagePath([CocoaDSUtil cPathFromFileURL:fileURL]);
|
||||
const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
|
||||
execControl->SetARM9ImagePath(filePath);
|
||||
}
|
||||
|
||||
- (NSURL *) arm9ImageURL
|
||||
{
|
||||
return [CocoaDSUtil fileURLFromCPath:execControl->GetARM9ImagePath()];
|
||||
const char *filePath = execControl->GetARM9ImagePath();
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
|
||||
- (void) setArm7ImageURL:(NSURL *)fileURL
|
||||
{
|
||||
execControl->SetARM7ImagePath([CocoaDSUtil cPathFromFileURL:fileURL]);
|
||||
const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
|
||||
execControl->SetARM7ImagePath(filePath);
|
||||
}
|
||||
|
||||
- (NSURL *) arm7ImageURL
|
||||
{
|
||||
return [CocoaDSUtil fileURLFromCPath:execControl->GetARM7ImagePath()];
|
||||
const char *filePath = execControl->GetARM7ImagePath();
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
|
||||
- (void) setFirmwareImageURL:(NSURL *)fileURL
|
||||
{
|
||||
execControl->SetFirmwareImagePath([CocoaDSUtil cPathFromFileURL:fileURL]);
|
||||
const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
|
||||
execControl->SetFirmwareImagePath(filePath);
|
||||
}
|
||||
|
||||
- (NSURL *) firmwareImageURL
|
||||
{
|
||||
return [CocoaDSUtil fileURLFromCPath:execControl->GetFirmwareImagePath()];
|
||||
const char *filePath = execControl->GetFirmwareImagePath();
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
|
||||
- (void) setSlot1R4URL:(NSURL *)fileURL
|
||||
{
|
||||
execControl->SetSlot1R4Path([CocoaDSUtil cPathFromFileURL:fileURL]);
|
||||
const char *filePath = (fileURL != NULL) ? [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding] : NULL;
|
||||
execControl->SetSlot1R4Path(filePath);
|
||||
}
|
||||
|
||||
- (NSURL *) slot1R4URL
|
||||
{
|
||||
return [CocoaDSUtil fileURLFromCPath:execControl->GetSlot1R4Path()];
|
||||
const char *filePath = execControl->GetSlot1R4Path();
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:filePath encoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
|
||||
- (void) updateFirmwareMACAddressString
|
||||
|
@ -992,9 +996,8 @@ volatile bool execute = true;
|
|||
return NO;
|
||||
}
|
||||
|
||||
const char *cSramPath = [CocoaDSUtil cPathFromFileURL:sramURL];
|
||||
std::string sramPath = (cSramPath != NULL) ? std::string(cSramPath) : "";
|
||||
const char *fileName = [CocoaDSUtil cPathFromFileURL:fileURL];
|
||||
std::string sramPath = (sramURL != nil) ? [[sramURL path] cStringUsingEncoding:NSUTF8StringEncoding] : "";
|
||||
const char *fileName = [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
NSDateFormatter *df = [[NSDateFormatter alloc] init];
|
||||
[df setDateFormat:@"Y M d H m s SSS"];
|
||||
|
@ -1152,7 +1155,6 @@ static void* RunCoreThread(void *arg)
|
|||
CoreThreadParam *param = (CoreThreadParam *)arg;
|
||||
CocoaDSCore *cdsCore = (CocoaDSCore *)param->cdsCore;
|
||||
CocoaDSGPU *cdsGPU = [cdsCore cdsGPU];
|
||||
ClientCheatManager *cheatManager = [[cdsCore cdsCheatManager] internalManager];
|
||||
ClientExecutionControl *execControl = [cdsCore execControl];
|
||||
ClientInputHandler *inputHandler = execControl->GetClientInputHandler();
|
||||
NSMutableArray *cdsOutputList = [cdsCore cdsOutputList];
|
||||
|
@ -1233,8 +1235,6 @@ static void* RunCoreThread(void *arg)
|
|||
|
||||
// Execute the frame and increment the frame counter.
|
||||
pthread_rwlock_wrlock(¶m->rwlockCoreExecute);
|
||||
cheatManager->ApplyToMaster();
|
||||
cheatManager->ApplyPendingInternalCheatWrites();
|
||||
NDS_exec<false>();
|
||||
SPU_Emulate_user();
|
||||
execControl->FetchOutputPostNDSExec();
|
||||
|
|
|
@ -142,7 +142,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
return result;
|
||||
}
|
||||
|
||||
const char *statePath = [CocoaDSUtil cPathFromFileURL:saveStateURL];
|
||||
const char *statePath = [[saveStateURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
bool cResult = savestate_load(statePath);
|
||||
if(cResult)
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
return result;
|
||||
}
|
||||
|
||||
const char *statePath = [CocoaDSUtil cPathFromFileURL:saveStateURL];
|
||||
const char *statePath = [[saveStateURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
bool cResult = savestate_save(statePath);
|
||||
if(cResult)
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
return result;
|
||||
}
|
||||
|
||||
const char *romPath = [CocoaDSUtil cPathFromFileURL:romURL];
|
||||
const char *romPath = [[romURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
NSInteger resultCode = NDS_LoadROM(romPath, NULL, NULL);
|
||||
if (resultCode > 0)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
return result;
|
||||
}
|
||||
|
||||
const char *replayPath = [CocoaDSUtil cPathFromFileURL:replayURL];
|
||||
const char *replayPath = [[replayURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
const char *resultCode = FCEUI_LoadMovie(replayPath, true, false, -1);
|
||||
if (resultCode == NULL)
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
+ (BOOL) importRomSave:(NSURL *)romSaveURL
|
||||
{
|
||||
BOOL result = NO;
|
||||
const char *romSavePath = [CocoaDSUtil cPathFromFileURL:romSaveURL];
|
||||
const char *romSavePath = [[romSaveURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
NSInteger resultCode = MMU_new.backupDevice.importData(romSavePath, 0);
|
||||
if (resultCode == 0)
|
||||
|
@ -243,7 +243,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
#endif
|
||||
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);
|
||||
if (resultCode)
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
|
||||
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);
|
||||
if (resultCode)
|
||||
{
|
||||
|
@ -358,55 +358,55 @@ static NSMutableDictionary *_gURLDictionary = nil;
|
|||
NSURL *romURL = [CocoaDSFile directoryURLByKind:@"ROM" version:versionString port:portString];
|
||||
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];
|
||||
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];
|
||||
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];
|
||||
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];
|
||||
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];
|
||||
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];
|
||||
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];
|
||||
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];
|
||||
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"];
|
||||
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"];
|
||||
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"];
|
||||
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"];
|
||||
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"];
|
||||
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"];
|
||||
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"];
|
||||
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"];
|
||||
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"];
|
||||
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";
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
return fileVersion;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -990,7 +990,7 @@ FirmwareConfigInterface::FirmwareConfigInterface()
|
|||
_internalData = (FirmwareConfig *)malloc(sizeof(FirmwareConfig));
|
||||
NDS_GetDefaultFirmwareConfig(*_internalData);
|
||||
|
||||
srand((uint32_t)time(NULL));
|
||||
srand(time(NULL));
|
||||
|
||||
// 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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
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
|
||||
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_SELECT_ROM_PANEL NSLocalizedString(@"Select ROM", 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_ARM9_IMAGE_PANEL NSLocalizedString(@"Select ARM9 BIOS 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_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_DISABLE_CHEATS NSLocalizedString(@"Disable Cheat System", nil)
|
||||
#define NSSTRING_TITLE_ENABLE_CHEATS NSLocalizedString(@"Enable Cheat System", nil)
|
||||
#define NSSTRING_TITLE_DISABLE_CHEATS NSLocalizedString(@"Disable Cheats", nil)
|
||||
#define NSSTRING_TITLE_ENABLE_CHEATS NSLocalizedString(@"Enable Cheats", nil)
|
||||
#define NSSTRING_TITLE_DISABLE_HUD NSLocalizedString(@"Disable HUD", nil)
|
||||
#define NSSTRING_TITLE_ENABLE_HUD NSLocalizedString(@"Enable HUD", nil)
|
||||
#define NSSTRING_TITLE_EXIT_FULL_SCREEN NSLocalizedString(@"Exit Full Screen", nil)
|
||||
|
@ -303,12 +303,41 @@ enum
|
|||
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
|
||||
{
|
||||
CHEATSEARCH_UNSIGNED = 0,
|
||||
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
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2011 Roger Manuel
|
||||
Copyright (C) 2011-2025 DeSmuME team
|
||||
Copyright (C) 2011-2022 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
|
||||
|
@ -186,9 +186,9 @@ class ClientAVCaptureObject;
|
|||
@property (assign) NSInteger outputFilter;
|
||||
@property (assign) NSInteger pixelScaler;
|
||||
|
||||
- (void) commitPresenterProperties:(const ClientDisplayPresenterProperties &)viewProps needFlush:(BOOL)needFlush;
|
||||
- (void) commitPresenterProperties:(const ClientDisplayPresenterProperties &)viewProps;
|
||||
|
||||
- (void) handleChangeViewPropertiesAndFlush:(BOOL)willFlush;
|
||||
- (void) handleChangeViewProperties;
|
||||
- (void) handleReceiveGPUFrame;
|
||||
- (void) handleReloadReprocessRedraw;
|
||||
- (void) handleReprocessRedraw;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2011 Roger Manuel
|
||||
Copyright (C) 2011-2025 DeSmuME team
|
||||
Copyright (C) 2011-2022 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
|
||||
|
@ -295,7 +295,7 @@
|
|||
|
||||
if (methodID != SNDCORE_DUMMY)
|
||||
{
|
||||
result = SPU_ChangeSoundCore((int)methodID, (int)SPU_BUFFER_BYTES);
|
||||
result = SPU_ChangeSoundCore(methodID, (int)SPU_BUFFER_BYTES);
|
||||
}
|
||||
|
||||
if(result == -1)
|
||||
|
@ -469,10 +469,6 @@
|
|||
theString = @"Cosine";
|
||||
break;
|
||||
|
||||
case SPUInterpolation_CatmullRom:
|
||||
theString = @"Catmull-Rom";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -721,13 +717,13 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) commitPresenterProperties:(const ClientDisplayPresenterProperties &)viewProps needFlush:(BOOL)needFlush
|
||||
- (void) commitPresenterProperties:(const ClientDisplayPresenterProperties &)viewProps
|
||||
{
|
||||
apple_unfairlock_lock(_unfairlockViewProperties);
|
||||
_intermediateViewProps = viewProps;
|
||||
apple_unfairlock_unlock(_unfairlockViewProperties);
|
||||
|
||||
[self handleChangeViewPropertiesAndFlush:needFlush];
|
||||
[self handleChangeViewProperties];
|
||||
}
|
||||
|
||||
- (BOOL) canFilterOnGPU
|
||||
|
@ -1215,7 +1211,7 @@
|
|||
switch (messageID)
|
||||
{
|
||||
case MESSAGE_CHANGE_VIEW_PROPERTIES:
|
||||
[self handleChangeViewPropertiesAndFlush:YES];
|
||||
[self handleChangeViewProperties];
|
||||
break;
|
||||
|
||||
case MESSAGE_RELOAD_REPROCESS_REDRAW:
|
||||
|
@ -1247,18 +1243,14 @@
|
|||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (void) handleChangeViewPropertiesAndFlush:(BOOL)willFlush
|
||||
- (void) handleChangeViewProperties
|
||||
{
|
||||
apple_unfairlock_lock(_unfairlockViewProperties);
|
||||
_cdv->Get3DPresenter()->CommitPresenterProperties(_intermediateViewProps);
|
||||
apple_unfairlock_unlock(_unfairlockViewProperties);
|
||||
|
||||
_cdv->Get3DPresenter()->SetupPresenterProperties();
|
||||
|
||||
if (willFlush)
|
||||
{
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
_cdv->SetViewNeedsFlush();
|
||||
}
|
||||
|
||||
- (void) handleReceiveGPUFrame
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2011 Roger Manuel
|
||||
Copyright (C) 2011-2024 DeSmuME team
|
||||
Copyright (C) 2011-2022 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
|
||||
|
@ -674,7 +674,7 @@ void RomIconToRGBA8888(uint32_t *bitmapData)
|
|||
// The first entry always represents the alpha, so just set it to 0.
|
||||
const uint16_t *clut4 = (uint16_t *)ndsRomBanner.palette;
|
||||
CACHE_ALIGN uint32_t clut32[16];
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, true, BESwapNone>(clut4, clut32, 16);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, true, BESwapNone>(clut4, clut32, 16);
|
||||
clut32[0] = 0x00000000;
|
||||
|
||||
// Load the image from the icon pixel data.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2014-2022 DeSmuME Team
|
||||
Copyright (C) 2014-2018 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
|
||||
|
@ -135,18 +135,18 @@
|
|||
return currentDevice;
|
||||
}
|
||||
|
||||
- (void) setMpcfFileSearchURL:(NSURL *)fileURL
|
||||
- (void) setMpcfFileSearchURL:(NSURL *)theURL
|
||||
{
|
||||
if (fileURL != nil)
|
||||
if (theURL != nil)
|
||||
{
|
||||
BOOL isDirectory = NO;
|
||||
NSString *filePath = [fileURL path];
|
||||
NSString *thePath = [theURL path];
|
||||
|
||||
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||||
[fileManager fileExistsAtPath:[fileURL path] isDirectory:&isDirectory];
|
||||
[fileManager fileExistsAtPath:thePath isDirectory:&isDirectory];
|
||||
|
||||
CFlash_Mode = (isDirectory) ? ADDON_CFLASH_MODE_Path : ADDON_CFLASH_MODE_File;
|
||||
CFlash_Path = [CocoaDSUtil cPathFromFileURL:fileURL];
|
||||
CFlash_Path = [thePath cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
[fileManager release];
|
||||
}
|
||||
|
@ -159,14 +159,14 @@
|
|||
|
||||
- (NSURL *) mpcfFileSearchURL
|
||||
{
|
||||
return [CocoaDSUtil fileURLFromCPath:CFlash_Path.c_str()];
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:CFlash_Path.c_str() encoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
|
||||
- (void) setGbaCartridgeURL:(NSURL *)fileURL
|
||||
{
|
||||
if (fileURL != nil)
|
||||
{
|
||||
GBACartridge_RomPath = [CocoaDSUtil cPathFromFileURL:fileURL];
|
||||
GBACartridge_RomPath = [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -176,14 +176,14 @@
|
|||
|
||||
- (NSURL *) gbaCartridgeURL
|
||||
{
|
||||
return [CocoaDSUtil fileURLFromCPath:GBACartridge_RomPath.c_str()];
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:GBACartridge_RomPath.c_str() encoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
|
||||
- (void) setGbaSRamURL:(NSURL *)fileURL
|
||||
{
|
||||
if (fileURL != nil)
|
||||
{
|
||||
GBACartridge_SRAMPath = [CocoaDSUtil cPathFromFileURL:fileURL];
|
||||
GBACartridge_SRAMPath = [[fileURL path] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -193,7 +193,7 @@
|
|||
|
||||
- (NSURL *) gbaSRamURL;
|
||||
{
|
||||
return [CocoaDSUtil fileURLFromCPath:GBACartridge_SRAMPath.c_str()];
|
||||
return [NSURL fileURLWithPath:[NSString stringWithCString:GBACartridge_SRAMPath.c_str() encoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
|
||||
- (BOOL) doesGbaCartridgeSaveExist
|
||||
|
|
|
@ -34,11 +34,6 @@
|
|||
+ (NSColor *) NSColorFromRGBA8888:(uint32_t)theColor;
|
||||
+ (uint32_t) RGBA8888FromNSColor:(NSColor *)theColor;
|
||||
|
||||
+ (NSString *) filePathFromCPath:(const char *)cPath;
|
||||
+ (NSURL *) fileURLFromCPath:(const char *)cPath;
|
||||
+ (const char *) cPathFromFilePath:(NSString *)filePath;
|
||||
+ (const char *) cPathFromFileURL:(NSURL *)fileURL;
|
||||
|
||||
+ (NSInteger) appVersionNumeric;
|
||||
+ (NSString *) appInternalVersionString;
|
||||
+ (NSString *) appInternalNameAndVersionString;
|
||||
|
|
|
@ -136,31 +136,6 @@
|
|||
#endif
|
||||
}
|
||||
|
||||
+ (NSString *) filePathFromCPath:(const char *)cPath
|
||||
{
|
||||
if (cPath == NULL)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cPath length:strlen(cPath)];
|
||||
}
|
||||
|
||||
+ (NSURL *) fileURLFromCPath:(const char *)cPath
|
||||
{
|
||||
return [NSURL fileURLWithPath:[CocoaDSUtil filePathFromCPath:cPath]];
|
||||
}
|
||||
|
||||
+ (const char *) cPathFromFilePath:(NSString *)filePath
|
||||
{
|
||||
return (filePath != nil) ? [filePath fileSystemRepresentation] : NULL;
|
||||
}
|
||||
|
||||
+ (const char *) cPathFromFileURL:(NSURL *)fileURL
|
||||
{
|
||||
return (fileURL != nil) ? [CocoaDSUtil cPathFromFilePath:[fileURL path]] : NULL;
|
||||
}
|
||||
|
||||
+ (NSInteger) appVersionNumeric
|
||||
{
|
||||
return (NSInteger)EMU_DESMUME_VERSION_NUMERIC();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Copyright (C) 2011 Roger Manuel
|
||||
Copyright (C) 2013-2024 DeSmuME team
|
||||
Copyright (C) 2013 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
|
||||
|
@ -139,7 +139,7 @@
|
|||
}
|
||||
|
||||
uint32_t *bitmapData = (uint32_t *)[imageRep bitmapData];
|
||||
ColorspaceConvertBuffer888xTo8888Opaque<false, true>((const uint32_t *)[self runFilter], bitmapData, w * h);
|
||||
ColorspaceConvertBuffer888XTo8888Opaque<false, true>((const uint32_t *)[self runFilter], bitmapData, w * h);
|
||||
|
||||
#ifdef MSB_FIRST
|
||||
for (size_t i = 0; i < w * h; i++)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2012-2024 DeSmuME team
|
||||
Copyright (C) 2012-2022 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
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
#define HOST_DARWIN
|
||||
#define DESMUME_COCOA
|
||||
#define ENABLE_OPENGL_STANDARD
|
||||
#define HAVE_OPENGL
|
||||
#define HAVE_LIBZ
|
||||
#define FT2_BUILD_LIBRARY
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>v0.9.14 (OpenEmu Plug-in)</string>
|
||||
<string>v0.9.13 (OpenEmu Plug-in)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<string>MacOSX</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.9.14</string>
|
||||
<string>0.9.13</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<string>yes</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2012-2023 DeSmuME team
|
||||
Copyright (C) 2012-2022 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
|
||||
|
@ -195,6 +195,7 @@ volatile bool execute = true;
|
|||
|
||||
// Set up the cheat system
|
||||
cdsCheats = [[CocoaDSCheatManager alloc] init];
|
||||
[cdsCheats setRwlockCoreExecute:&rwlockCoreExecute];
|
||||
addedCheatsDict = [[NSMutableDictionary alloc] initWithCapacity:128];
|
||||
|
||||
// Set up the DS firmware using the internal firmware
|
||||
|
@ -370,7 +371,7 @@ volatile bool execute = true;
|
|||
if (_cdp == NULL)
|
||||
{
|
||||
NSString *gameCoreFontPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"SourceSansPro-Bold" ofType:@"otf"];
|
||||
const char *hudFontPath = [CocoaDSUtil cPathFromFilePath:gameCoreFontPath];
|
||||
const char *hudFontPath = [[NSFileManager defaultManager] fileSystemRepresentationWithPath:gameCoreFontPath];
|
||||
|
||||
_cdp = new OE_OGLDisplayPresenter(fetchObj);
|
||||
_cdp->Init();
|
||||
|
@ -508,7 +509,7 @@ void UpdateDisplayPropertiesFromStates(uint64_t displayModeStates, ClientDisplay
|
|||
// draw at 1x scaling, which starts looking uglier as the view size is increased.
|
||||
if (!_canRespondToViewResize)
|
||||
{
|
||||
NSUInteger legacyVersionScale = 1;
|
||||
int legacyVersionScale = 1;
|
||||
_OEViewSize.width = (int)(transformNormalWidth + 0.0005);
|
||||
_OEViewSize.height = (int)(transformNormalHeight + 0.0005);
|
||||
|
||||
|
@ -534,8 +535,8 @@ void UpdateDisplayPropertiesFromStates(uint64_t displayModeStates, ClientDisplay
|
|||
}
|
||||
|
||||
// Multiply the normal size by our fixed scaling value.
|
||||
_OEViewSize.width *= (int)legacyVersionScale;
|
||||
_OEViewSize.height *= (int)legacyVersionScale;
|
||||
_OEViewSize.width *= legacyVersionScale;
|
||||
_OEViewSize.height *= legacyVersionScale;
|
||||
}
|
||||
|
||||
apple_unfairlock_lock(unfairlockDisplayMode);
|
||||
|
@ -718,6 +719,8 @@ void UpdateDisplayPropertiesFromStates(uint64_t displayModeStates, ClientDisplay
|
|||
|
||||
isRomLoaded = [CocoaDSFile loadRom:[NSURL fileURLWithPath:path]];
|
||||
|
||||
[CocoaDSCheatManager setMasterCheatList:cdsCheats];
|
||||
|
||||
// Set the default options.
|
||||
// Have to do it now because displayModeInfo is only available now -- not at this object's init.
|
||||
NSDictionary<NSString *, id> *userDefaultsDisplayMode = nil;
|
||||
|
@ -1191,32 +1194,34 @@ void UpdateDisplayPropertiesFromStates(uint64_t displayModeStates, ClientDisplay
|
|||
// state on an existing cheat, so be sure to account for both cases.
|
||||
|
||||
// First check if the cheat exists.
|
||||
CocoaDSCheatItem *cocoaCheatItem = (CocoaDSCheatItem *)[addedCheatsDict objectForKey:code];
|
||||
CocoaDSCheatItem *cheatItem = (CocoaDSCheatItem *)[addedCheatsDict objectForKey:code];
|
||||
|
||||
if (cocoaCheatItem == nil)
|
||||
if (cheatItem == nil)
|
||||
{
|
||||
// If the cheat doesn't already exist, then create a new one and add it.
|
||||
ClientCheatItem *newCheatItem = new ClientCheatItem;
|
||||
newCheatItem->SetType(CheatType_ActionReplay); // Default to Action Replay for now
|
||||
newCheatItem->SetFreezeType(CheatFreezeType_Normal);
|
||||
newCheatItem->SetName(NULL); // OpenEmu takes care of this
|
||||
newCheatItem->SetComments(NULL); // OpenEmu does not support cheat item comments
|
||||
newCheatItem->SetRawCodeString([code cStringUsingEncoding:NSUTF8StringEncoding], true);
|
||||
newCheatItem->SetEnabled((enabled) ? true : false);
|
||||
cheatItem = [[[CocoaDSCheatItem alloc] init] autorelease];
|
||||
[cheatItem setCheatType:CHEAT_TYPE_ACTION_REPLAY]; // Default to Action Replay for now
|
||||
[cheatItem setFreezeType:0];
|
||||
[cheatItem setDescription:@""]; // OpenEmu takes care of this
|
||||
[cheatItem setCode:code];
|
||||
[cheatItem setMemAddress:0x00000000]; // UNUSED
|
||||
[cheatItem setBytes:1]; // UNUSED
|
||||
[cheatItem setValue:0]; // UNUSED
|
||||
|
||||
cocoaCheatItem = [[self cdsCheats] addExistingItem:newCheatItem];
|
||||
[cheatItem setEnabled:enabled];
|
||||
[[self cdsCheats] add:cheatItem];
|
||||
|
||||
// OpenEmu doesn't currently save cheats per game, so assume that the
|
||||
// cheat list is short and that code strings are unique. This allows
|
||||
// us to get away with simply saving the cheat code string and hashing
|
||||
// for it later.
|
||||
[addedCheatsDict setObject:cocoaCheatItem forKey:code];
|
||||
[addedCheatsDict setObject:cheatItem forKey:code];
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the cheat does exist, then just set its enable state.
|
||||
[cocoaCheatItem setEnabled:enabled];
|
||||
[[self cdsCheats] update:cocoaCheatItem];
|
||||
[cheatItem setEnabled:enabled];
|
||||
[[self cdsCheats] update:cheatItem];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class CocoaDSCheatDatabase;
|
||||
@class CheatWindowDelegate;
|
||||
@class CocoaDSCheatDBGame;
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
|
||||
@interface CheatDatabaseWindowController : NSWindowController <NSWindowDelegate, NSTableViewDelegate>
|
||||
#else
|
||||
@interface CheatDatabaseWindowController : NSWindowController
|
||||
#endif
|
||||
{
|
||||
NSObject *dummyObject;
|
||||
NSWindow *errorSheet;
|
||||
NSString *defaultWindowTitle;
|
||||
NSArrayController *gameListController;
|
||||
NSTreeController *entryListController;
|
||||
NSSplitView *splitView;
|
||||
NSTableView *gameTable;
|
||||
NSOutlineView *entryOutline;
|
||||
NSFont *codeViewerFont;
|
||||
|
||||
CheatWindowDelegate *cheatManagerDelegate;
|
||||
CocoaDSCheatDatabase *database;
|
||||
|
||||
NSString *filePath;
|
||||
BOOL isFileLoading;
|
||||
BOOL isCurrentGameFound;
|
||||
BOOL isSelectedGameTheCurrentGame;
|
||||
NSInteger currentGameTableRowIndex;
|
||||
NSString *currentGameIndexString;
|
||||
NSString *currentGameSerial;
|
||||
NSUInteger currentGameCRC;
|
||||
BOOL isCompatibilityCheckIgnored;
|
||||
BOOL isOptionWarningSilenced;
|
||||
|
||||
NSString *errorMajorString;
|
||||
NSString *errorMinorString;
|
||||
|
||||
NSDictionary *initProperties;
|
||||
}
|
||||
|
||||
@property (readonly) IBOutlet NSObject *dummyObject;
|
||||
@property (readonly) IBOutlet NSWindow *errorSheet;
|
||||
@property (readonly) IBOutlet NSArrayController *gameListController;
|
||||
@property (readonly) IBOutlet NSTreeController *entryListController;
|
||||
@property (readonly) IBOutlet NSSplitView *splitView;
|
||||
@property (readonly) IBOutlet NSTableView *gameTable;
|
||||
@property (readonly) IBOutlet NSOutlineView *entryOutline;
|
||||
|
||||
@property (retain) CheatWindowDelegate *cheatManagerDelegate;
|
||||
@property (assign) NSFont *codeViewerFont;
|
||||
@property (retain, nonatomic) CocoaDSCheatDatabase *database;
|
||||
@property (readonly) NSString *filePath;
|
||||
@property (readonly) NSString *databaseFormatString;
|
||||
@property (readonly) NSInteger gameCount;
|
||||
@property (readonly) NSString *isEncryptedString;
|
||||
@property (assign) BOOL isFileLoading;
|
||||
@property (assign) BOOL isCurrentGameFound;
|
||||
@property (assign) BOOL isSelectedGameTheCurrentGame;
|
||||
@property (retain, nonatomic) NSString *currentGameSerial;
|
||||
@property (assign, nonatomic) NSUInteger currentGameCRC;
|
||||
@property (readonly, nonatomic) NSString *currentGameCRCString;
|
||||
@property (assign, nonatomic) BOOL isCompatibilityCheckIgnored;
|
||||
@property (assign) BOOL isOptionWarningSilenced;
|
||||
|
||||
@property (assign) NSString *errorMajorString;
|
||||
@property (assign) NSString *errorMinorString;
|
||||
|
||||
- (id) initWithWindowNibName:(NSString *)windowNibName delegate:(CheatWindowDelegate *)theDelegate;
|
||||
- (void) loadFileStart:(NSURL *)theURL;
|
||||
- (void) loadFileOnThread:(id)object;
|
||||
- (void) loadFileDidFinish:(NSNotification *)aNotification;
|
||||
- (void) updateWindow;
|
||||
+ (void) setCurrentGameForAllWindowsSerial:(NSString *)serialString crc:(NSUInteger)crc;
|
||||
- (void) validateGameTableFonts;
|
||||
- (BOOL) validateWillAddColumn;
|
||||
- (void) showErrorSheet:(NSInteger)errorCode;
|
||||
- (void) didEndErrorSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
|
||||
|
||||
- (IBAction) openFile:(id)sender;
|
||||
- (IBAction) selectAll:(id)sender;
|
||||
- (IBAction) selectNone:(id)sender;
|
||||
- (IBAction) addSelected:(id)sender;
|
||||
- (IBAction) selectCurrentGame:(id)sender;
|
||||
- (IBAction) closeErrorSheet:(id)sender;
|
||||
|
||||
@end
|
|
@ -1,818 +0,0 @@
|
|||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#import "CheatDatabaseWindowController.h"
|
||||
#import "cheatWindowDelegate.h"
|
||||
#import "../cocoa_globals.h"
|
||||
#import "../cocoa_cheat.h"
|
||||
#import "../cocoa_util.h"
|
||||
|
||||
NSMutableArray *cheatDatabaseWindowList = nil;
|
||||
|
||||
@implementation CheatDatabaseWindowController
|
||||
|
||||
@synthesize dummyObject;
|
||||
@synthesize errorSheet;
|
||||
@synthesize gameListController;
|
||||
@synthesize entryListController;
|
||||
@synthesize splitView;
|
||||
@synthesize gameTable;
|
||||
@synthesize entryOutline;
|
||||
|
||||
@synthesize cheatManagerDelegate;
|
||||
@synthesize codeViewerFont;
|
||||
@dynamic database;
|
||||
@dynamic filePath;
|
||||
@dynamic databaseFormatString;
|
||||
@dynamic gameCount;
|
||||
@dynamic isEncryptedString;
|
||||
@synthesize isFileLoading;
|
||||
@synthesize isCurrentGameFound;
|
||||
@synthesize isSelectedGameTheCurrentGame;
|
||||
@dynamic currentGameSerial;
|
||||
@synthesize currentGameCRC;
|
||||
@dynamic currentGameCRCString;
|
||||
@dynamic isCompatibilityCheckIgnored;
|
||||
@synthesize isOptionWarningSilenced;
|
||||
|
||||
@synthesize errorMajorString;
|
||||
@synthesize errorMinorString;
|
||||
|
||||
- (id) initWithWindowNibName:(NSString *)windowNibName delegate:(CheatWindowDelegate *)theDelegate
|
||||
{
|
||||
self = [super initWithWindowNibName:windowNibName];
|
||||
if (self == nil)
|
||||
{
|
||||
return self;
|
||||
}
|
||||
|
||||
cheatManagerDelegate = [theDelegate retain];
|
||||
codeViewerFont = [NSFont fontWithName:@"Monaco" size:13.0];
|
||||
|
||||
dummyObject = nil;
|
||||
defaultWindowTitle = [[NSString alloc] initWithString:@"Cheat Database Viewer"];
|
||||
database = nil;
|
||||
isFileLoading = NO;
|
||||
isCurrentGameFound = NO;
|
||||
isSelectedGameTheCurrentGame = NO;
|
||||
currentGameIndexString = [[NSString alloc] initWithString:@"NSNotFound"];
|
||||
currentGameTableRowIndex = NSNotFound;
|
||||
currentGameSerial = nil;
|
||||
currentGameCRC = 0;
|
||||
isCompatibilityCheckIgnored = NO;
|
||||
isOptionWarningSilenced = NO;
|
||||
errorMajorString = @"No error has occurred!";
|
||||
errorMinorString = @"This is just a placeholder message for initialization purposes.";
|
||||
|
||||
if (cheatDatabaseWindowList == nil)
|
||||
{
|
||||
cheatDatabaseWindowList = [[NSMutableArray alloc] initWithObjects:self, nil];
|
||||
}
|
||||
else
|
||||
{
|
||||
[cheatDatabaseWindowList addObject:self];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self setCheatManagerDelegate:nil];
|
||||
[self setDatabase:nil];
|
||||
[currentGameIndexString release];
|
||||
[defaultWindowTitle release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) loadFileStart:(NSURL *)theURL
|
||||
{
|
||||
if (theURL == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// First check if another cheat database window has already opened the file at this URL.
|
||||
CheatDatabaseWindowController *foundWindowController = nil;
|
||||
for (CheatDatabaseWindowController *windowController in cheatDatabaseWindowList)
|
||||
{
|
||||
NSURL *databaseURL = [[windowController database] lastFileURL];
|
||||
NSString *foundDatabaseFilePath = [databaseURL path];
|
||||
|
||||
if ( (foundDatabaseFilePath != nil) && ([foundDatabaseFilePath isEqualToString:[theURL path]]) )
|
||||
{
|
||||
foundWindowController = windowController;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundWindowController != nil)
|
||||
{
|
||||
// If the file is already open, then simply assign that database file to this window.
|
||||
[self setDatabase:[foundWindowController database]];
|
||||
[self updateWindow];
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the file is not open, then we need to open it now. Let's do this on a separate
|
||||
// thread so that we don't lock up the main thread.
|
||||
[self setIsFileLoading:YES];
|
||||
[self setDatabase:nil];
|
||||
|
||||
NSString *threadNamePrefix = @"org.desmume.DeSmuME.loadDatabaseDidFinish_";
|
||||
NSString *fullThreadName = [threadNamePrefix stringByAppendingString:[theURL absoluteString]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(loadFileDidFinish:)
|
||||
name:fullThreadName
|
||||
object:nil];
|
||||
|
||||
[theURL retain];
|
||||
[NSThread detachNewThreadSelector:@selector(loadFileOnThread:) toTarget:self withObject:theURL];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) loadFileOnThread:(id)object
|
||||
{
|
||||
NSAutoreleasePool *threadPool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
NSURL *workingURL = (NSURL *)object;
|
||||
NSString *threadNamePrefix = @"org.desmume.DeSmuME.loadDatabaseDidFinish_";
|
||||
NSString *fullThreadName = [threadNamePrefix stringByAppendingString:[workingURL absoluteString]];
|
||||
|
||||
CheatSystemError error = CheatSystemError_NoError;
|
||||
CocoaDSCheatDatabase *newDatabase = [[CocoaDSCheatDatabase alloc] initWithFileURL:workingURL error:&error];
|
||||
|
||||
NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
workingURL, @"URL",
|
||||
[NSNumber numberWithInteger:(NSInteger)error], @"ErrorCode",
|
||||
nil];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:fullThreadName object:newDatabase userInfo:userInfo];
|
||||
|
||||
[threadPool release];
|
||||
}
|
||||
|
||||
- (void) loadFileDidFinish:(NSNotification *)aNotification
|
||||
{
|
||||
CocoaDSCheatDatabase *newDatabase = [aNotification object];
|
||||
NSDictionary *userInfo = [aNotification userInfo];
|
||||
NSURL *workingURL = (NSURL *)[userInfo valueForKey:@"URL"];
|
||||
CheatSystemError errorCode = (CheatSystemError)[(NSNumber *)[userInfo valueForKey:@"ErrorCode"] integerValue];
|
||||
|
||||
NSString *threadNamePrefix = @"org.desmume.DeSmuME.loadDatabaseDidFinish_";
|
||||
NSString *fullThreadName = [threadNamePrefix stringByAppendingString:[workingURL absoluteString]];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:fullThreadName object:nil];
|
||||
|
||||
[self setIsFileLoading:NO];
|
||||
[self setDatabase:[newDatabase autorelease]];
|
||||
[self updateWindow];
|
||||
|
||||
if (errorCode != CheatSystemError_NoError)
|
||||
{
|
||||
[self showErrorSheet:errorCode];
|
||||
}
|
||||
|
||||
if (database == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Begin the generation of the cheat database recents menu.
|
||||
NSString *legacyFilePath = [[NSUserDefaults standardUserDefaults] stringForKey:@"R4Cheat_DatabasePath"];
|
||||
BOOL useLegacyFilePath = ( (legacyFilePath != nil) && ([legacyFilePath length] > 0) );
|
||||
|
||||
NSArray *dbRecentsList = [[NSUserDefaults standardUserDefaults] arrayForKey:@"CheatDatabase_RecentFilePath"];
|
||||
NSMutableArray *newRecentsList = [NSMutableArray arrayWithCapacity:[dbRecentsList count] + 1];
|
||||
|
||||
if (useLegacyFilePath)
|
||||
{
|
||||
// We need to check if the legacy file path also exists in the recents list.
|
||||
// If it does, then the recents list version takes priority.
|
||||
for (NSDictionary *dbRecentItem in dbRecentsList)
|
||||
{
|
||||
NSString *dbRecentItemFilePath = (NSString *)[dbRecentItem valueForKey:@"FilePath"];
|
||||
if ([dbRecentItemFilePath isEqualToString:legacyFilePath])
|
||||
{
|
||||
useLegacyFilePath = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (useLegacyFilePath)
|
||||
{
|
||||
// The legacy file path must always be the first entry of the recents list.
|
||||
NSDictionary *legacyRecentItem = [NSDictionary dictionaryWithObjectsAndKeys:legacyFilePath, @"FilePath",
|
||||
[legacyFilePath lastPathComponent], @"FileName",
|
||||
nil];
|
||||
[newRecentsList addObject:legacyRecentItem];
|
||||
}
|
||||
|
||||
// Next, we need to add back all of the recent items in the same order in which
|
||||
// they appear in user defaults, with the exception of our newest item.
|
||||
NSString *newFilePath = [[database lastFileURL] path];
|
||||
for (NSDictionary *dbRecentItem in dbRecentsList)
|
||||
{
|
||||
NSString *dbRecentItemFilePath = (NSString *)[dbRecentItem valueForKey:@"FilePath"];
|
||||
if ( ![newFilePath isEqualToString:dbRecentItemFilePath] )
|
||||
{
|
||||
[newRecentsList addObject:dbRecentItem];
|
||||
}
|
||||
}
|
||||
|
||||
// Create our new recent item...
|
||||
NSDictionary *newRecentItem = [NSDictionary dictionaryWithObjectsAndKeys:newFilePath, @"FilePath",
|
||||
[newFilePath lastPathComponent], @"FileName",
|
||||
[NSDate date], @"AddedDate",
|
||||
[[self window] stringWithSavedFrame], @"WindowFrame",
|
||||
[NSNumber numberWithFloat:[[[splitView subviews] objectAtIndex:0] frame].size.height], @"WindowSplitViewDividerPosition",
|
||||
[NSNumber numberWithBool:[self isCompatibilityCheckIgnored]], @"OptionIgnoreCompatibilityCheck",
|
||||
nil];
|
||||
|
||||
// ...and then add the newest recent item, ensuring that it is always last in the list.
|
||||
[newRecentsList addObject:newRecentItem];
|
||||
|
||||
// We're done generating the new recent items list, so write it back to user defaults, and then
|
||||
// send a notification that UI elements needs to be updated.
|
||||
[[NSUserDefaults standardUserDefaults] setObject:newRecentsList forKey:@"CheatDatabase_RecentFilePath"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"org.desmume.DeSmuME.updateCheatDatabaseRecentsMenu" object:[newRecentsList retain] userInfo:nil];
|
||||
}
|
||||
|
||||
- (void) updateWindow
|
||||
{
|
||||
if ([self database] == nil)
|
||||
{
|
||||
[[self window] setTitle:defaultWindowTitle];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[self window] setTitle:[database description]];
|
||||
}
|
||||
|
||||
[[self window] setRepresentedURL:[database lastFileURL]];
|
||||
[gameListController setContent:[database gameList]];
|
||||
|
||||
NSIndexSet *selectedRows = [gameTable selectedRowIndexes];
|
||||
[gameTable deselectAll:nil];
|
||||
[gameTable selectRowIndexes:selectedRows byExtendingSelection:NO];
|
||||
|
||||
CheatWindowDelegate *delegate = [self cheatManagerDelegate];
|
||||
CocoaDSCheatManager *cheatManager = [delegate cdsCheats];
|
||||
[self setCurrentGameSerial:[cheatManager currentGameCode]];
|
||||
[self setCurrentGameCRC:[cheatManager currentGameCRC]];
|
||||
|
||||
[self validateGameTableFonts];
|
||||
[self selectCurrentGame:nil];
|
||||
}
|
||||
|
||||
+ (void) setCurrentGameForAllWindowsSerial:(NSString *)serialString crc:(NSUInteger)crc
|
||||
{
|
||||
if (cheatDatabaseWindowList == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (CheatDatabaseWindowController *windowController in cheatDatabaseWindowList)
|
||||
{
|
||||
[windowController setCurrentGameSerial:serialString];
|
||||
[windowController setCurrentGameCRC:crc];
|
||||
|
||||
[windowController validateGameTableFonts];
|
||||
[[windowController gameTable] setNeedsDisplay];
|
||||
|
||||
[windowController validateWillAddColumn];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) validateGameTableFonts
|
||||
{
|
||||
CheatWindowDelegate *delegate = [self cheatManagerDelegate];
|
||||
CocoaDSCheatManager *cheatManager = [delegate cdsCheats];
|
||||
|
||||
if ( (delegate == nil) || (cheatManager == nil) )
|
||||
{
|
||||
currentGameTableRowIndex = NSNotFound;
|
||||
[currentGameIndexString release];
|
||||
currentGameIndexString = [[NSString alloc] initWithString:@"NSNotFound"];
|
||||
[self setIsCurrentGameFound:NO];
|
||||
return;
|
||||
}
|
||||
|
||||
for (CocoaDSCheatDBGame *game in [gameListController content])
|
||||
{
|
||||
if ( ([game crc] == [self currentGameCRC]) && ([[game serial] isEqualToString:[self currentGameSerial]]) )
|
||||
{
|
||||
[currentGameIndexString release];
|
||||
currentGameIndexString = [[NSString alloc] initWithFormat:@"%llu", (unsigned long long)[game index]];
|
||||
[self setIsCurrentGameFound:YES];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL) validateWillAddColumn
|
||||
{
|
||||
BOOL showWillAddColumn = NO;
|
||||
|
||||
CheatWindowDelegate *delegate = [self cheatManagerDelegate];
|
||||
CocoaDSCheatManager *cheatManager = [delegate cdsCheats];
|
||||
|
||||
NSArray *selectedObjects = [gameListController selectedObjects];
|
||||
if ( (selectedObjects == nil) || ([selectedObjects count] == 0) )
|
||||
{
|
||||
return showWillAddColumn;
|
||||
}
|
||||
|
||||
CocoaDSCheatDBGame *selectedGame = [selectedObjects objectAtIndex:0];
|
||||
|
||||
if ( (delegate != nil) && (cheatManager != nil) && ([selectedGame serial] != nil) )
|
||||
{
|
||||
showWillAddColumn = ( [self isCompatibilityCheckIgnored] || (([[selectedGame serial] isEqualToString:currentGameSerial]) && ([selectedGame crc] == currentGameCRC)) );
|
||||
}
|
||||
|
||||
NSTableColumn *willAddColumn = [entryOutline tableColumnWithIdentifier:@"willAdd"];
|
||||
[willAddColumn setHidden:!showWillAddColumn];
|
||||
|
||||
[self setIsSelectedGameTheCurrentGame:showWillAddColumn];
|
||||
|
||||
return showWillAddColumn;
|
||||
}
|
||||
|
||||
- (void) showErrorSheet:(NSInteger)errorCode
|
||||
{
|
||||
switch (errorCode)
|
||||
{
|
||||
case CheatSystemError_NoError:
|
||||
[self setErrorMajorString:@"No error has occurred."];
|
||||
[self setErrorMinorString:@"This message is a placeholder. You are seeing this error as a test for this app's error handling.\n\nError Code: %i"];
|
||||
break;
|
||||
|
||||
case CheatSystemError_FileOpenFailed:
|
||||
[self setErrorMajorString:@"Failed to open file."];
|
||||
[self setErrorMinorString:[NSString stringWithFormat:@"The system could not open the cheat database file. This problem is usually because another app is using it, or because the file permissions disallow read access.\n\nError Code: %i", (int)errorCode]];
|
||||
break;
|
||||
|
||||
case CheatSystemError_FileFormatInvalid:
|
||||
[self setErrorMajorString:@"Invalid file format."];
|
||||
[self setErrorMinorString:[NSString stringWithFormat:@"DeSmuME could not recognize the file format of the cheat database file. Currently, DeSmuME only recognizes the R4 file format. It is also possible that the file data is corrupted.\n\nError Code: %i", (int)errorCode]];
|
||||
break;
|
||||
|
||||
case CheatSystemError_GameNotFound:
|
||||
{
|
||||
CheatWindowDelegate *delegate = [self cheatManagerDelegate];
|
||||
CocoaDSCheatManager *cheatManager = [delegate cdsCheats];
|
||||
[self setErrorMajorString:@"Current game not found in database."];
|
||||
[self setErrorMinorString:[NSString stringWithFormat:@"The current game (Serial='%@', CRC=%llu) could not be found in the cheat database.\n\nError Code: %i", [cheatManager currentGameCode], (unsigned long long)[cheatManager currentGameCRC], (int)errorCode]];
|
||||
break;
|
||||
}
|
||||
|
||||
case CheatSystemError_LoadEntryError:
|
||||
[self setErrorMajorString:@"Could not read cheat entries."];
|
||||
[self setErrorMinorString:[NSString stringWithFormat:@"The entry data for the selected game could not be read. This is usually due to file data corruption.\n\nError Code: %i", (int)errorCode]];
|
||||
break;
|
||||
|
||||
case CheatSystemError_FileDoesNotExist:
|
||||
[self setErrorMajorString:@"The file does not exist."];
|
||||
[self setErrorMinorString:[NSString stringWithFormat:@"If this file was selected from the Recents Menu, then it has been removed.\n\nError Code: %i", (int)errorCode]];
|
||||
break;
|
||||
|
||||
default:
|
||||
[self setErrorMajorString:@"An unknown error has occurred."];
|
||||
[self setErrorMinorString:[NSString stringWithFormat:@"Error Code: %i", (int)errorCode]];
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_9) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9)
|
||||
if ([[self window] respondsToSelector:@selector(beginSheet:completionHandler:)])
|
||||
{
|
||||
[[self window] beginSheet:errorSheet
|
||||
completionHandler:^(NSModalResponse response) {
|
||||
[self didEndErrorSheet:nil returnCode:response contextInfo:nil];
|
||||
} ];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SILENCE_DEPRECATION_MACOS_10_10( [NSApp beginSheet:errorSheet
|
||||
modalForWindow:[self window]
|
||||
modalDelegate:self
|
||||
didEndSelector:@selector(didEndErrorSheet:returnCode:contextInfo:)
|
||||
contextInfo:nil] );
|
||||
}
|
||||
}
|
||||
|
||||
- (void) didEndErrorSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
|
||||
{
|
||||
[sheet orderOut:self];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Dynamic Properties
|
||||
|
||||
- (void) setDatabase:(CocoaDSCheatDatabase *)theDatabase
|
||||
{
|
||||
[self willChangeValueForKey:@"filePath"];
|
||||
[self willChangeValueForKey:@"databaseFormatString"];
|
||||
[self willChangeValueForKey:@"gameCount"];
|
||||
[self willChangeValueForKey:@"isEncryptedString"];
|
||||
|
||||
[theDatabase retain];
|
||||
[database release];
|
||||
database = theDatabase;
|
||||
|
||||
[self didChangeValueForKey:@"filePath"];
|
||||
[self didChangeValueForKey:@"databaseFormatString"];
|
||||
[self didChangeValueForKey:@"gameCount"];
|
||||
[self didChangeValueForKey:@"isEncryptedString"];
|
||||
}
|
||||
|
||||
- (CocoaDSCheatDatabase *) database
|
||||
{
|
||||
return database;
|
||||
}
|
||||
|
||||
- (NSString *) filePath
|
||||
{
|
||||
if ( (database != nil) && ([database lastFileURL] != nil) )
|
||||
{
|
||||
return [[database lastFileURL] path];
|
||||
}
|
||||
else if ([self isFileLoading])
|
||||
{
|
||||
return @"Loading database file...";
|
||||
}
|
||||
|
||||
return @"No database file loaded.";
|
||||
}
|
||||
|
||||
- (NSString *) databaseFormatString
|
||||
{
|
||||
if (database != nil)
|
||||
{
|
||||
return [database formatString];
|
||||
}
|
||||
|
||||
return @"---";
|
||||
}
|
||||
|
||||
- (NSInteger) gameCount
|
||||
{
|
||||
if (database != nil)
|
||||
{
|
||||
return [[database gameList] count];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (NSString *) isEncryptedString
|
||||
{
|
||||
if (database != nil)
|
||||
{
|
||||
return [database isEncrypted] ? @"Yes" : @"No";
|
||||
}
|
||||
|
||||
return @"---";
|
||||
}
|
||||
|
||||
- (void) setCurrentGameSerial:(NSString *)newString
|
||||
{
|
||||
NSString *oldString = currentGameSerial;
|
||||
currentGameSerial = [newString retain];
|
||||
[oldString release];
|
||||
}
|
||||
|
||||
- (NSString *) currentGameSerial
|
||||
{
|
||||
if ( (currentGameSerial != nil) && ([currentGameSerial length] > 0) )
|
||||
{
|
||||
return currentGameSerial;
|
||||
}
|
||||
|
||||
return @"---";
|
||||
}
|
||||
|
||||
- (void) setCurrentGameCRC:(NSUInteger)crc
|
||||
{
|
||||
[self willChangeValueForKey:@"currentGameCRCString"];
|
||||
currentGameCRC = crc;
|
||||
[self didChangeValueForKey:@"currentGameCRCString"];
|
||||
}
|
||||
|
||||
- (NSUInteger) currentGameCRC
|
||||
{
|
||||
return currentGameCRC;
|
||||
}
|
||||
|
||||
- (NSString *) currentGameCRCString
|
||||
{
|
||||
if (currentGameCRC != 0)
|
||||
{
|
||||
return [NSString stringWithFormat:@"%08lX", (unsigned long)currentGameCRC];
|
||||
}
|
||||
|
||||
return @"---";
|
||||
}
|
||||
|
||||
- (BOOL) isCompatibilityCheckIgnored
|
||||
{
|
||||
return isCompatibilityCheckIgnored;
|
||||
}
|
||||
|
||||
- (void) setIsCompatibilityCheckIgnored:(BOOL)theState
|
||||
{
|
||||
isCompatibilityCheckIgnored = theState;
|
||||
|
||||
if (![self isOptionWarningSilenced] && theState)
|
||||
{
|
||||
NSAlert *criticalErrorAlert = [[[NSAlert alloc] init] autorelease];
|
||||
[criticalErrorAlert setAlertStyle:ALERTSTYLE_CRITICAL];
|
||||
[criticalErrorAlert setMessageText:@"Using an incompatible cheat may ruin your game."];
|
||||
[criticalErrorAlert setInformativeText:@"Cheats are normally restricted to the current game \
|
||||
for compatibility reasons. By choosing to ignore the compatibility check, you can add any cheat to \
|
||||
any game that you want, but you must also assume the risk of an incompatible cheat ruining your game \
|
||||
session or corrupting your game's save data."];
|
||||
[criticalErrorAlert runModal];
|
||||
}
|
||||
|
||||
[self validateWillAddColumn];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark IBActions
|
||||
|
||||
- (IBAction) openFile:(id)sender
|
||||
{
|
||||
NSOpenPanel *panel = [NSOpenPanel openPanel];
|
||||
[panel setCanChooseDirectories:NO];
|
||||
[panel setCanChooseFiles:YES];
|
||||
[panel setResolvesAliases:YES];
|
||||
[panel setAllowsMultipleSelection:NO];
|
||||
[panel setTitle:NSSTRING_TITLE_OPEN_CHEAT_DB_PANEL];
|
||||
NSArray *fileTypes = [NSArray arrayWithObjects:@FILE_EXT_R4_CHEAT_DB, nil];
|
||||
|
||||
// The NSOpenPanel/NSSavePanel method -(void)beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo
|
||||
// is deprecated in Mac OS X v10.6.
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5
|
||||
if (IsOSXVersionSupported(10, 6, 0))
|
||||
{
|
||||
[panel setAllowedFileTypes:fileTypes];
|
||||
[panel beginSheetModalForWindow:[self window]
|
||||
completionHandler:^(NSInteger result) {
|
||||
[self chooseCheatDatabaseDidEnd:panel returnCode:(int)result contextInfo:nil];
|
||||
} ];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SILENCE_DEPRECATION_MACOS_10_6( [panel beginSheetForDirectory:nil
|
||||
file:nil
|
||||
types:fileTypes
|
||||
modalForWindow:[self window]
|
||||
modalDelegate:self
|
||||
didEndSelector:@selector(chooseCheatDatabaseDidEnd:returnCode:contextInfo:)
|
||||
contextInfo:nil] );
|
||||
}
|
||||
}
|
||||
|
||||
- (void) chooseCheatDatabaseDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
|
||||
{
|
||||
[sheet orderOut:self];
|
||||
|
||||
if (returnCode == GUI_RESPONSE_CANCEL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NSURL *selectedFileURL = [[sheet URLs] lastObject]; //hopefully also the first object
|
||||
[self loadFileStart:selectedFileURL];
|
||||
}
|
||||
|
||||
- (IBAction) selectAll:(id)sender
|
||||
{
|
||||
NSMutableArray *entryTree = [entryListController content];
|
||||
if (entryTree == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (CocoaDSCheatDBEntry *entry in entryTree)
|
||||
{
|
||||
[entry setWillAdd:YES];
|
||||
}
|
||||
|
||||
[entryOutline setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (IBAction) selectNone:(id)sender
|
||||
{
|
||||
NSMutableArray *entryTree = [entryListController content];
|
||||
if (entryTree == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (CocoaDSCheatDBEntry *entry in entryTree)
|
||||
{
|
||||
[entry setWillAdd:NO];
|
||||
}
|
||||
|
||||
[entryOutline setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (IBAction) addSelected:(id)sender
|
||||
{
|
||||
CheatWindowDelegate *delegate = [self cheatManagerDelegate];
|
||||
if (delegate == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CocoaDSCheatManager *cheatManager = [delegate cdsCheats];
|
||||
if (cheatManager == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NSMutableArray *entryTree = [entryListController content];
|
||||
if (entryTree == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NSInteger selectedIndex = [gameTable selectedRow];
|
||||
CocoaDSCheatDBGame *selectedGame = (CocoaDSCheatDBGame *)[[gameListController arrangedObjects] objectAtIndex:selectedIndex];
|
||||
|
||||
if ( ![self isCompatibilityCheckIgnored] && ((![[selectedGame serial] isEqualToString:[self currentGameSerial]]) || ([selectedGame crc] != [self currentGameCRC])) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CocoaDSCheatDBEntry *rootEntry = [selectedGame entryRoot];
|
||||
if (rootEntry == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const NSInteger addedItemCount = [cheatManager databaseAddSelectedInEntry:[selectedGame entryRoot]];
|
||||
if (addedItemCount > 0)
|
||||
{
|
||||
[[delegate cheatListController] setContent:[cheatManager sessionList]];
|
||||
[cheatManager save];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction) selectCurrentGame:(id)sender
|
||||
{
|
||||
CheatWindowDelegate *delegate = [self cheatManagerDelegate];
|
||||
if (delegate == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CocoaDSCheatManager *cheatManager = [delegate cdsCheats];
|
||||
if (cheatManager == nil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ([self currentGameSerial] == nil) || ([self currentGameCRC] == 0) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NSUInteger selectionIndex = NSNotFound;
|
||||
|
||||
NSArray *arrangedObjects = (NSArray *)[gameListController arrangedObjects];
|
||||
for (CocoaDSCheatDBGame *game in arrangedObjects)
|
||||
{
|
||||
if ( ([game crc] == [self currentGameCRC]) && ([[game serial] isEqualToString:[self currentGameSerial]]) )
|
||||
{
|
||||
selectionIndex = [arrangedObjects indexOfObject:game];
|
||||
NSIndexSet *indexSet = [NSIndexSet indexSetWithIndex:selectionIndex];
|
||||
[gameTable selectRowIndexes:indexSet byExtendingSelection:NO];
|
||||
[gameTable scrollRowToVisible:selectionIndex];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction) closeErrorSheet:(id)sender
|
||||
{
|
||||
NSWindow *sheet = [(NSControl *)sender window];
|
||||
const NSInteger code = [(NSControl *)sender tag];
|
||||
|
||||
[CocoaDSUtil endSheet:sheet returnCode:code];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark NSWindowDelegate Protocol
|
||||
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
// Save a copy of the default window title before we replace it
|
||||
// with the database file's description.
|
||||
NSString *oldDefaultWindowTitle = defaultWindowTitle;
|
||||
defaultWindowTitle = [[[self window] title] copy];
|
||||
[oldDefaultWindowTitle release];
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification *)notification
|
||||
{
|
||||
NSArray *userDefaultsRecentsList = [[NSUserDefaults standardUserDefaults] arrayForKey:@"CheatDatabase_RecentFilePath"];
|
||||
if ( (userDefaultsRecentsList != nil) && ([userDefaultsRecentsList count] > 0) )
|
||||
{
|
||||
NSMutableArray *dbRecentsList = [NSMutableArray arrayWithCapacity:[userDefaultsRecentsList count]];
|
||||
|
||||
for (NSDictionary *recentItem in userDefaultsRecentsList)
|
||||
{
|
||||
NSString *thisFilePath = [[database lastFileURL] path];
|
||||
NSString *recentItemPath = (NSString *)[recentItem objectForKey:@"FilePath"];
|
||||
|
||||
if ( (thisFilePath != nil) && ([recentItemPath isEqualToString:thisFilePath]) )
|
||||
{
|
||||
NSMutableDictionary *newRecentItem = [NSMutableDictionary dictionaryWithDictionary:recentItem];
|
||||
[newRecentItem setObject:[[self window] stringWithSavedFrame] forKey:@"WindowFrame"];
|
||||
[newRecentItem setObject:[NSNumber numberWithFloat:[[[splitView subviews] objectAtIndex:0] frame].size.height] forKey:@"WindowSplitViewDividerPosition"];
|
||||
[newRecentItem setObject:[NSNumber numberWithBool:[self isCompatibilityCheckIgnored]] forKey:@"OptionIgnoreCompatibilityCheck"];
|
||||
|
||||
[dbRecentsList addObject:newRecentItem];
|
||||
}
|
||||
else
|
||||
{
|
||||
[dbRecentsList addObject:recentItem];
|
||||
}
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:dbRecentsList forKey:@"CheatDatabase_RecentFilePath"];
|
||||
}
|
||||
|
||||
[cheatDatabaseWindowList removeObject:self];
|
||||
[self release];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark NSTableViewDelegate Protocol
|
||||
|
||||
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
|
||||
{
|
||||
NSTableView *table = (NSTableView *)[aNotification object];
|
||||
NSInteger rowIndex = [table selectedRow];
|
||||
|
||||
if (table == gameTable)
|
||||
{
|
||||
if (rowIndex >= 0)
|
||||
{
|
||||
NSArray *selectedObjects = [gameListController selectedObjects];
|
||||
CocoaDSCheatDBGame *selectedGame = [selectedObjects objectAtIndex:0];
|
||||
CocoaDSCheatDBEntry *entryRoot = [database loadGameEntry:selectedGame];
|
||||
[self validateWillAddColumn];
|
||||
[entryListController setContent:[entryRoot child]];
|
||||
|
||||
if (entryRoot == nil)
|
||||
{
|
||||
[self showErrorSheet:CheatSystemError_LoadEntryError];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[entryListController setContent:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
||||
{
|
||||
NSString *cellString = [cell stringValue];
|
||||
if ( (cellString != nil) && [cellString isEqualToString:currentGameIndexString] )
|
||||
{
|
||||
currentGameTableRowIndex = row;
|
||||
}
|
||||
|
||||
if ( (cellString != nil) && (row == currentGameTableRowIndex) )
|
||||
{
|
||||
[cell setFont:[NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize] + 1.0f]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[cell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
|
||||
currentGameTableRowIndex = NSNotFound;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2017-2025 DeSmuME team
|
||||
Copyright (C) 2017 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
|
||||
|
@ -72,7 +72,6 @@ class MacDisplayLayeredView;
|
|||
@property (assign) NSInteger pixelScaler;
|
||||
|
||||
- (void) setupLayer;
|
||||
- (void) updateLayerPresenterProperties:(ClientDisplayPresenterProperties &)props scaleFactor:(const double)scaleFactor needFlush:(BOOL)needFlush;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -184,7 +184,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
if ([self isFullScreen])
|
||||
{
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps needFlush:YES];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// display view to update itself.
|
||||
if (oldBounds.width == newBounds.width && oldBounds.height == newBounds.height)
|
||||
{
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps needFlush:YES];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
}
|
||||
else
|
||||
{
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps needFlush:YES];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
{
|
||||
if ([self isFullScreen])
|
||||
{
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps needFlush:YES];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -261,7 +261,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
- (void) setDisplayOrder:(NSInteger)theOrder
|
||||
{
|
||||
_localViewProps.order = (ClientDisplayOrder)theOrder;
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps needFlush:YES];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
|
||||
- (NSInteger) displayOrder
|
||||
|
@ -288,7 +288,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
case ClientDisplayLayout_Hybrid_16_9:
|
||||
case ClientDisplayLayout_Hybrid_16_10:
|
||||
default:
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps needFlush:YES];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
{
|
||||
case ClientDisplayLayout_Hybrid_16_9:
|
||||
case ClientDisplayLayout_Hybrid_16_10:
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps needFlush:YES];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
break;
|
||||
|
||||
case ClientDisplayLayout_Horizontal:
|
||||
|
@ -450,7 +450,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
// window size changed or not.
|
||||
if (oldBounds.width == newBounds.width && oldBounds.height == newBounds.height)
|
||||
{
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps needFlush:YES];
|
||||
[[[self view] cdsVideoOutput] commitPresenterProperties:_localViewProps];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -494,13 +494,13 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
[[self view] setIsHUDRealTimeClockVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRTC"]];
|
||||
[[self view] setIsHUDInputVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowInput"]];
|
||||
|
||||
[[self view] setHudColorExecutionSpeed:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32((uint32_t)[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_ExecutionSpeed"])]];
|
||||
[[self view] setHudColorVideoFPS:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32((uint32_t)[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_VideoFPS"])]];
|
||||
[[self view] setHudColorRender3DFPS:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32((uint32_t)[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Render3DFPS"])]];
|
||||
[[self view] setHudColorFrameIndex:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32((uint32_t)[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_FrameIndex"])]];
|
||||
[[self view] setHudColorLagFrameCount:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32((uint32_t)[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_LagFrameCount"])]];
|
||||
[[self view] setHudColorCPULoadAverage:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32((uint32_t)[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_CPULoadAverage"])]];
|
||||
[[self view] setHudColorRTC:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32((uint32_t)[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_RTC"])]];
|
||||
[[self view] setHudColorExecutionSpeed:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_ExecutionSpeed"])]];
|
||||
[[self view] setHudColorVideoFPS:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_VideoFPS"])]];
|
||||
[[self view] setHudColorRender3DFPS:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Render3DFPS"])]];
|
||||
[[self view] setHudColorFrameIndex:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_FrameIndex"])]];
|
||||
[[self view] setHudColorLagFrameCount:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_LagFrameCount"])]];
|
||||
[[self view] setHudColorCPULoadAverage:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_CPULoadAverage"])]];
|
||||
[[self view] setHudColorRTC:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_RTC"])]];
|
||||
}
|
||||
|
||||
- (BOOL) masterStatusBarState
|
||||
|
@ -1141,7 +1141,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
|
||||
bool isSupportingCPU = false;
|
||||
bool isSupportingShader = false;
|
||||
OGLFilter::GetSupport((int)[theItem tag], &isSupportingCPU, &isSupportingShader);
|
||||
OGLFilter::GetSupport([theItem tag], &isSupportingCPU, &isSupportingShader);
|
||||
|
||||
enable = isSupportingCPU || (isSupportingShader && [[self view] canUseShaderBasedFilters]);
|
||||
}
|
||||
|
@ -1295,7 +1295,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
[newDisplayOutput setClientDisplay3DView:cdv];
|
||||
|
||||
NSString *fontPath = [[NSBundle mainBundle] pathForResource:@"SourceSansPro-Bold" ofType:@"otf"];
|
||||
cdv->Get3DPresenter()->SetHUDFontPath([CocoaDSUtil cPathFromFilePath:fontPath]);
|
||||
cdv->Get3DPresenter()->SetHUDFontPath([fontPath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
cdv->Get3DPresenter()->SetHUDRenderMipmapped(true);
|
||||
|
||||
if (scaleFactor != 1.0f)
|
||||
|
@ -1465,40 +1465,6 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
- (void)windowDidChangeScreen:(NSNotification *)notification
|
||||
{
|
||||
[self updateDisplayID];
|
||||
|
||||
// We also need to check if the window's backing scale factor changes, which can
|
||||
// occur when moving the window from a normal display to a HiDPI display (in
|
||||
// other words, from a non-Retina display to a Retina display), or vice versa.
|
||||
// We must update the display presenter properties now so that HUD element
|
||||
// locations and NDS touch points remain consistent for both Retina and non-Retina
|
||||
// displays. This feature requires Mac OS X v10.7 Lion or later.
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
|
||||
MacDisplayLayeredView *cdv = [[self view] clientDisplayView];
|
||||
CALayer<DisplayViewCALayer> *localLayer = cdv->GetCALayer();
|
||||
|
||||
if ([[self window] respondsToSelector:@selector(backingScaleFactor)])
|
||||
{
|
||||
const double oldScaleFactor = cdv->Get3DPresenter()->GetScaleFactor();
|
||||
const double newScaleFactor = [[self window] backingScaleFactor];
|
||||
|
||||
if (newScaleFactor != oldScaleFactor)
|
||||
{
|
||||
ClientDisplayPresenterProperties &props = [self localViewProperties];
|
||||
props.clientWidth *= newScaleFactor / oldScaleFactor;
|
||||
props.clientHeight *= newScaleFactor / oldScaleFactor;
|
||||
[[self view] updateLayerPresenterProperties:props scaleFactor:newScaleFactor needFlush:NO];
|
||||
|
||||
if ([localLayer isKindOfClass:[CAOpenGLLayer class]] && [localLayer respondsToSelector:@selector(setContentsScale:)])
|
||||
{
|
||||
[localLayer setContentsScale:newScaleFactor];
|
||||
}
|
||||
|
||||
cdv->Get3DPresenter()->SetScaleFactor(newScaleFactor);
|
||||
cdv->SetViewNeedsFlush();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
|
||||
|
@ -2193,31 +2159,6 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
}
|
||||
}
|
||||
|
||||
- (void) updateLayerPresenterProperties:(ClientDisplayPresenterProperties &)props scaleFactor:(const double)scaleFactor needFlush:(BOOL)needFlush
|
||||
{
|
||||
double checkWidth = props.normalWidth;
|
||||
double checkHeight = props.normalHeight;
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(1.0, props.rotation, checkWidth, checkHeight);
|
||||
props.viewScale = ClientDisplayPresenter::GetMaxScalarWithinBounds(checkWidth, checkHeight, props.clientWidth, props.clientHeight);
|
||||
|
||||
if (localOGLContext != nil)
|
||||
{
|
||||
[localOGLContext update];
|
||||
}
|
||||
else if ([localLayer isKindOfClass:[CAOpenGLLayer class]])
|
||||
{
|
||||
[localLayer setBounds:CGRectMake(0.0f, 0.0f, props.clientWidth / scaleFactor, props.clientHeight / scaleFactor)];
|
||||
}
|
||||
#ifdef ENABLE_APPLE_METAL
|
||||
else if ([localLayer isKindOfClass:[CAMetalLayer class]])
|
||||
{
|
||||
[(CAMetalLayer *)localLayer setDrawableSize:CGSizeMake(props.clientWidth, props.clientHeight)];
|
||||
}
|
||||
#endif
|
||||
|
||||
[[self cdsVideoOutput] commitPresenterProperties:props needFlush:needFlush];
|
||||
}
|
||||
|
||||
#pragma mark InputHIDManagerTarget Protocol
|
||||
- (BOOL) handleHIDQueue:(IOHIDQueueRef)hidQueue hidManager:(InputHIDManager *)hidManager
|
||||
{
|
||||
|
@ -2308,6 +2249,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
if (rect.size.width != oldFrame.size.width || rect.size.height != oldFrame.size.height)
|
||||
{
|
||||
DisplayWindowController *windowController = (DisplayWindowController *)[[self window] delegate];
|
||||
ClientDisplayPresenterProperties &props = [windowController localViewProperties];
|
||||
NSRect newViewportRect = rect;
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_10_7) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
|
||||
|
@ -2318,12 +2260,31 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
#endif
|
||||
|
||||
// Calculate the view scale for the given client size.
|
||||
ClientDisplayPresenterProperties &props = [windowController localViewProperties];
|
||||
double checkWidth = props.normalWidth;
|
||||
double checkHeight = props.normalHeight;
|
||||
ClientDisplayPresenter::ConvertNormalToTransformedBounds(1.0, props.rotation, checkWidth, checkHeight);
|
||||
|
||||
props.clientWidth = newViewportRect.size.width;
|
||||
props.clientHeight = newViewportRect.size.height;
|
||||
props.viewScale = ClientDisplayPresenter::GetMaxScalarWithinBounds(checkWidth, checkHeight, props.clientWidth, props.clientHeight);
|
||||
|
||||
const double scaleFactor = [[self cdsVideoOutput] clientDisplay3DView]->Get3DPresenter()->GetScaleFactor();
|
||||
[self updateLayerPresenterProperties:props scaleFactor:scaleFactor needFlush:YES];
|
||||
if (localOGLContext != nil)
|
||||
{
|
||||
[localOGLContext update];
|
||||
}
|
||||
else if ([localLayer isKindOfClass:[CAOpenGLLayer class]])
|
||||
{
|
||||
const double scaleFactor = [[self cdsVideoOutput] clientDisplay3DView]->Get3DPresenter()->GetScaleFactor();
|
||||
[localLayer setBounds:CGRectMake(0.0f, 0.0f, props.clientWidth / scaleFactor, props.clientHeight / scaleFactor)];
|
||||
}
|
||||
#ifdef ENABLE_APPLE_METAL
|
||||
else if ([localLayer isKindOfClass:[CAMetalLayer class]])
|
||||
{
|
||||
[(CAMetalLayer *)localLayer setDrawableSize:CGSizeMake(props.clientWidth, props.clientHeight)];
|
||||
}
|
||||
#endif
|
||||
|
||||
[[self cdsVideoOutput] commitPresenterProperties:props];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2013-2023 DeSmuME Team
|
||||
Copyright (C) 2013-2022 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
|
||||
|
@ -42,6 +42,8 @@ class AudioSampleBlockGenerator;
|
|||
CocoaDSRom *currentRom;
|
||||
CocoaDSFirmware *cdsFirmware;
|
||||
CocoaDSSpeaker *cdsSpeaker;
|
||||
CocoaDSCheatManager *cdsCheats;
|
||||
CocoaDSCheatManager *dummyCheatList;
|
||||
|
||||
CheatWindowDelegate *cheatWindowDelegate;
|
||||
MacScreenshotCaptureToolDelegate *screenshotCaptureToolDelegate;
|
||||
|
@ -54,8 +56,8 @@ class AudioSampleBlockGenerator;
|
|||
NSObjectController *cheatWindowController;
|
||||
NSObjectController *slot2WindowController;
|
||||
NSArrayController *inputDeviceListController;
|
||||
|
||||
NSMenu *cheatDatabaseRecentsMenu;
|
||||
NSArrayController *cheatListController;
|
||||
NSArrayController *cheatDatabaseController;
|
||||
|
||||
RomInfoPanel *romInfoPanel;
|
||||
|
||||
|
@ -136,6 +138,7 @@ class AudioSampleBlockGenerator;
|
|||
@property (assign) CocoaDSRom *currentRom; // Don't rely on autorelease since the emulator doesn't support concurrent unloading
|
||||
@property (retain) CocoaDSFirmware *cdsFirmware;
|
||||
@property (retain) CocoaDSSpeaker *cdsSpeaker;
|
||||
@property (retain) CocoaDSCheatManager *cdsCheats;
|
||||
|
||||
@property (readonly) IBOutlet CheatWindowDelegate *cheatWindowDelegate;
|
||||
@property (readonly) IBOutlet MacScreenshotCaptureToolDelegate *screenshotCaptureToolDelegate;
|
||||
|
@ -148,8 +151,8 @@ class AudioSampleBlockGenerator;
|
|||
@property (readonly) IBOutlet NSObjectController *cheatWindowController;
|
||||
@property (readonly) IBOutlet NSObjectController *slot2WindowController;
|
||||
@property (readonly) IBOutlet NSArrayController *inputDeviceListController;
|
||||
|
||||
@property (readonly) IBOutlet NSMenu *cheatDatabaseRecentsMenu;
|
||||
@property (readonly) IBOutlet NSArrayController *cheatListController;
|
||||
@property (readonly) IBOutlet NSArrayController *cheatDatabaseController;
|
||||
|
||||
@property (readonly) IBOutlet RomInfoPanel *romInfoPanel;
|
||||
|
||||
|
@ -214,9 +217,6 @@ class AudioSampleBlockGenerator;
|
|||
- (IBAction) stopReplay:(id)sender;
|
||||
- (IBAction) importRomSave:(id)sender;
|
||||
- (IBAction) exportRomSave:(id)sender;
|
||||
- (IBAction) openCheatDatabaseFile:(id)sender;
|
||||
- (IBAction) clearCheatDatabaseRecents:(id)sender;
|
||||
- (IBAction) openRecentCheatDatabase:(id)sender;
|
||||
|
||||
// Emulation Menu
|
||||
- (IBAction) toggleSpeedLimiter:(id)sender;
|
||||
|
@ -302,7 +302,6 @@ class AudioSampleBlockGenerator;
|
|||
- (BOOL) loadRomByURL:(NSURL *)romURL asynchronous:(BOOL)willLoadAsync;
|
||||
- (void) loadRomDidFinish:(NSNotification *)aNotification;
|
||||
- (BOOL) unloadRom;
|
||||
- (void) updateCheatDatabaseRecentsMenu:(NSNotification *)aNotification;
|
||||
|
||||
- (void) addOutputToCore:(CocoaDSOutput *)theOutput;
|
||||
- (void) removeOutputFromCore:(CocoaDSOutput *)theOutput;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2013-2023 DeSmuME Team
|
||||
Copyright (C) 2013-2022 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
|
||||
|
@ -19,7 +19,6 @@
|
|||
#import "DisplayWindowController.h"
|
||||
#import "InputManager.h"
|
||||
#import "cheatWindowDelegate.h"
|
||||
#import "CheatDatabaseWindowController.h"
|
||||
#import "Slot2WindowDelegate.h"
|
||||
#import "MacAVCaptureTool.h"
|
||||
#import "MacScreenshotCaptureTool.h"
|
||||
|
@ -47,6 +46,7 @@
|
|||
@synthesize currentRom;
|
||||
@dynamic cdsFirmware;
|
||||
@dynamic cdsSpeaker;
|
||||
@synthesize cdsCheats;
|
||||
|
||||
@synthesize cheatWindowDelegate;
|
||||
@synthesize screenshotCaptureToolDelegate;
|
||||
|
@ -57,11 +57,11 @@
|
|||
@synthesize cdsCoreController;
|
||||
@synthesize cdsSoundController;
|
||||
@synthesize cheatWindowController;
|
||||
@synthesize cheatListController;
|
||||
@synthesize cheatDatabaseController;
|
||||
@synthesize slot2WindowController;
|
||||
@synthesize inputDeviceListController;
|
||||
|
||||
@synthesize cheatDatabaseRecentsMenu;
|
||||
|
||||
@synthesize romInfoPanel;
|
||||
|
||||
@synthesize displayRotationPanel;
|
||||
|
@ -134,6 +134,7 @@
|
|||
currentRom = nil;
|
||||
cdsFirmware = nil;
|
||||
cdsSpeaker = nil;
|
||||
dummyCheatList = nil;
|
||||
|
||||
isSaveStateEdited = NO;
|
||||
isShowingSaveStateDialog = NO;
|
||||
|
@ -197,11 +198,6 @@
|
|||
name:@"org.desmume.DeSmuME.handleEmulatorExecutionState"
|
||||
object:nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(updateCheatDatabaseRecentsMenu:)
|
||||
name:@"org.desmume.DeSmuME.updateCheatDatabaseRecentsMenu"
|
||||
object:nil];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -235,6 +231,7 @@
|
|||
[[self currentRom] release];
|
||||
[self setCurrentRom:nil];
|
||||
|
||||
[self setCdsCheats:nil];
|
||||
[self setCdsSpeaker:nil];
|
||||
|
||||
[self setIsWorking:NO];
|
||||
|
@ -810,104 +807,6 @@
|
|||
[self restoreCoreState];
|
||||
}
|
||||
|
||||
- (IBAction) openCheatDatabaseFile:(id)sender
|
||||
{
|
||||
CheatDatabaseWindowController *newWindowController = [[CheatDatabaseWindowController alloc] initWithWindowNibName:@"CheatDatabaseViewer" delegate:cheatWindowDelegate];
|
||||
[newWindowController window]; // Just reference the window to force the NSWindow object to load.
|
||||
|
||||
[[newWindowController window] makeKeyAndOrderFront:sender];
|
||||
[[newWindowController window] makeMainWindow];
|
||||
[newWindowController openFile:sender];
|
||||
}
|
||||
|
||||
- (IBAction) clearCheatDatabaseRecents:(id)sender
|
||||
{
|
||||
NSArray *menuItemList = [cheatDatabaseRecentsMenu itemArray];
|
||||
|
||||
for (NSMenuItem *menuItem in menuItemList)
|
||||
{
|
||||
if ( ([menuItem action] == @selector(openRecentCheatDatabase:)) || [menuItem isSeparatorItem] )
|
||||
{
|
||||
[cheatDatabaseRecentsMenu removeItem:menuItem];
|
||||
}
|
||||
}
|
||||
|
||||
NSArray *emptyArray = [[[NSArray alloc] init] autorelease];
|
||||
[[NSUserDefaults standardUserDefaults] setObject:emptyArray forKey:@"CheatDatabase_RecentFilePath"];
|
||||
|
||||
// Also remove the legacy setting.
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"R4Cheat_DatabasePath"];
|
||||
}
|
||||
|
||||
- (IBAction) openRecentCheatDatabase:(id)sender
|
||||
{
|
||||
CheatDatabaseWindowController *newWindowController = [[CheatDatabaseWindowController alloc] initWithWindowNibName:@"CheatDatabaseViewer" delegate:cheatWindowDelegate];
|
||||
[newWindowController window]; // Just reference the window to force the NSWindow object to load.
|
||||
|
||||
[[newWindowController window] makeKeyAndOrderFront:self];
|
||||
[[newWindowController window] makeMainWindow];
|
||||
|
||||
NSArray *recentDBFilePathsList = [[NSUserDefaults standardUserDefaults] arrayForKey:@"CheatDatabase_RecentFilePath"];
|
||||
NSInteger index = [CocoaDSUtil getIBActionSenderTag:sender];
|
||||
NSDictionary *recentItem = (NSDictionary *)[recentDBFilePathsList objectAtIndex:index];
|
||||
NSString *recentItemFilePath = nil;
|
||||
|
||||
if (recentItem != nil)
|
||||
{
|
||||
NSNumber *compatibilityCheckNumber = (NSNumber *)[recentItem objectForKey:@"OptionIgnoreCompatibilityCheck"];
|
||||
if (compatibilityCheckNumber != nil)
|
||||
{
|
||||
[newWindowController setIsOptionWarningSilenced:YES];
|
||||
[newWindowController setIsCompatibilityCheckIgnored:[compatibilityCheckNumber boolValue]];
|
||||
[newWindowController setIsOptionWarningSilenced:NO];
|
||||
}
|
||||
|
||||
// Set up the window properties.
|
||||
NSString *windowFrameString = (NSString *)[recentItem objectForKey:@"WindowFrame"];
|
||||
if (windowFrameString != nil)
|
||||
{
|
||||
[[newWindowController window] setFrameFromString:windowFrameString];
|
||||
}
|
||||
|
||||
NSNumber *windowSplitViewDividerPositionNumber = (NSNumber *)[recentItem objectForKey:@"WindowSplitViewDividerPosition"];
|
||||
if (windowSplitViewDividerPositionNumber != nil)
|
||||
{
|
||||
CGFloat dividerPosition = [windowSplitViewDividerPositionNumber floatValue];
|
||||
[[newWindowController splitView] setPosition:dividerPosition ofDividerAtIndex:0];
|
||||
}
|
||||
|
||||
// Check for the file's existence at its path, and then handle appropriately.
|
||||
recentItemFilePath = (NSString *)[recentItem objectForKey:@"FilePath"];
|
||||
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||||
BOOL doesFileExist = [fileManager fileExistsAtPath:recentItemFilePath];
|
||||
[fileManager release];
|
||||
|
||||
if (!doesFileExist)
|
||||
{
|
||||
// If the file does not exist, then report the error to the user, and the remove the
|
||||
// nonexistent file from the recents menu.
|
||||
[newWindowController showErrorSheet:CheatSystemError_FileDoesNotExist];
|
||||
|
||||
NSMutableArray *newRecentsList = [NSMutableArray arrayWithCapacity:[recentDBFilePathsList count]];
|
||||
|
||||
for (NSDictionary *theItem in recentDBFilePathsList)
|
||||
{
|
||||
if (theItem != recentItem)
|
||||
{
|
||||
[newRecentsList addObject:theItem];
|
||||
}
|
||||
}
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setObject:newRecentsList forKey:@"CheatDatabase_RecentFilePath"];
|
||||
[self updateCheatDatabaseRecentsMenu:nil];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NSURL *dbFileURL = [NSURL fileURLWithPath:recentItemFilePath];
|
||||
[newWindowController loadFileStart:dbFileURL];
|
||||
}
|
||||
|
||||
- (IBAction) toggleExecutePause:(id)sender
|
||||
{
|
||||
[inputManager dispatchCommandUsingIBAction:_cmd sender:sender];
|
||||
|
@ -1123,7 +1022,7 @@
|
|||
{
|
||||
[panel beginSheetModalForWindow:slot1ManagerWindow
|
||||
completionHandler:^(NSInteger result) {
|
||||
[self didEndChooseSlot1R4Directory:panel returnCode:(int)result contextInfo:nil];
|
||||
[self didEndChooseSlot1R4Directory:panel returnCode:result contextInfo:nil];
|
||||
} ];
|
||||
}
|
||||
else
|
||||
|
@ -2036,8 +1935,75 @@
|
|||
[romInfoPanelController setContent:[theRom bindings]];
|
||||
|
||||
// If the ROM has an associated cheat file, load it now.
|
||||
NSString *cheatsPath = [[CocoaDSFile fileURLFromRomURL:[theRom fileURL] toKind:@"Cheat"] path];
|
||||
CocoaDSCore *cdsCore = (CocoaDSCore *)[cdsCoreController content];
|
||||
[cheatWindowDelegate cheatSystemStart:[cdsCore cdsCheatManager]];
|
||||
CocoaDSCheatManager *newCheatList = [[[CocoaDSCheatManager alloc] initWithFileURL:[NSURL fileURLWithPath:cheatsPath]] autorelease];
|
||||
if (newCheatList != nil)
|
||||
{
|
||||
NSMutableDictionary *cheatWindowBindings = (NSMutableDictionary *)[cheatWindowController content];
|
||||
|
||||
[CocoaDSCheatManager setMasterCheatList:newCheatList];
|
||||
[cheatListController setContent:[newCheatList list]];
|
||||
[self setCdsCheats:newCheatList];
|
||||
[cheatWindowBindings setValue:newCheatList forKey:@"cheatList"];
|
||||
|
||||
NSString *filePath = [[NSUserDefaults standardUserDefaults] stringForKey:@"R4Cheat_DatabasePath"];
|
||||
if (filePath != nil)
|
||||
{
|
||||
NSURL *fileURL = [NSURL fileURLWithPath:filePath];
|
||||
NSInteger error = 0;
|
||||
NSMutableArray *dbList = [[self cdsCheats] cheatListFromDatabase:fileURL errorCode:&error];
|
||||
if (dbList != nil)
|
||||
{
|
||||
[cheatDatabaseController setContent:dbList];
|
||||
|
||||
NSString *titleString = [[self cdsCheats] dbTitle];
|
||||
NSString *dateString = [[self cdsCheats] dbDate];
|
||||
|
||||
[cheatWindowBindings setValue:titleString forKey:@"cheatDBTitle"];
|
||||
[cheatWindowBindings setValue:dateString forKey:@"cheatDBDate"];
|
||||
[cheatWindowBindings setValue:[NSString stringWithFormat:@"%ld", (unsigned long)[dbList count]] forKey:@"cheatDBItemCount"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[cheatWindowBindings setValue:@"---" forKey:@"cheatDBItemCount"];
|
||||
|
||||
switch (error)
|
||||
{
|
||||
case CHEATEXPORT_ERROR_FILE_NOT_FOUND:
|
||||
NSLog(@"R4 Cheat Database read failed! Could not load the database file!");
|
||||
[cheatWindowBindings setValue:@"Database not loaded." forKey:@"cheatDBTitle"];
|
||||
[cheatWindowBindings setValue:@"CANNOT LOAD FILE" forKey:@"cheatDBDate"];
|
||||
break;
|
||||
|
||||
case CHEATEXPORT_ERROR_WRONG_FILE_FORMAT:
|
||||
NSLog(@"R4 Cheat Database read failed! Wrong file format!");
|
||||
[cheatWindowBindings setValue:@"Database load error." forKey:@"cheatDBTitle"];
|
||||
[cheatWindowBindings setValue:@"FAILED TO LOAD FILE" forKey:@"cheatDBDate"];
|
||||
break;
|
||||
|
||||
case CHEATEXPORT_ERROR_SERIAL_NOT_FOUND:
|
||||
NSLog(@"R4 Cheat Database read failed! Could not find the serial number for this game in the database!");
|
||||
[cheatWindowBindings setValue:@"ROM not found in database." forKey:@"cheatDBTitle"];
|
||||
[cheatWindowBindings setValue:@"ROM not found." forKey:@"cheatDBDate"];
|
||||
break;
|
||||
|
||||
case CHEATEXPORT_ERROR_EXPORT_FAILED:
|
||||
NSLog(@"R4 Cheat Database read failed! Could not read the database file!");
|
||||
[cheatWindowBindings setValue:@"Database read error." forKey:@"cheatDBTitle"];
|
||||
[cheatWindowBindings setValue:@"CANNOT READ FILE" forKey:@"cheatDBDate"];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[cheatWindowDelegate setCdsCheats:newCheatList];
|
||||
[[cheatWindowDelegate cdsCheatSearch] setRwlockCoreExecute:[cdsCore rwlockCoreExecute]];
|
||||
[cheatWindowDelegate setCheatSearchViewByStyle:CHEATSEARCH_SEARCHSTYLE_EXACT_VALUE];
|
||||
}
|
||||
|
||||
// Add the last loaded ROM to the Recent ROMs list.
|
||||
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[theRom fileURL]];
|
||||
|
@ -2091,11 +2057,22 @@
|
|||
[[windowController window] displayIfNeeded];
|
||||
}
|
||||
|
||||
[cheatWindowDelegate cheatSystemEnd];
|
||||
// Save the ROM's cheat list before unloading.
|
||||
[[self cdsCheats] save];
|
||||
|
||||
// Update the UI to indicate that the ROM has started the process of unloading.
|
||||
[self setStatusText:NSSTRING_STATUS_ROM_UNLOADING];
|
||||
[romInfoPanelController setContent:[CocoaDSRom romNotLoadedBindings]];
|
||||
[cheatListController setContent:nil];
|
||||
[cheatWindowDelegate resetSearch:nil];
|
||||
[cheatWindowDelegate setCdsCheats:nil];
|
||||
[cheatDatabaseController setContent:nil];
|
||||
|
||||
NSMutableDictionary *cheatWindowBindings = (NSMutableDictionary *)[cheatWindowController content];
|
||||
[cheatWindowBindings setValue:@"No ROM loaded." forKey:@"cheatDBTitle"];
|
||||
[cheatWindowBindings setValue:@"No ROM loaded." forKey:@"cheatDBDate"];
|
||||
[cheatWindowBindings setValue:@"---" forKey:@"cheatDBItemCount"];
|
||||
[cheatWindowBindings setValue:nil forKey:@"cheatList"];
|
||||
|
||||
// Unload the ROM.
|
||||
if (![cdsCore emuFlagUseExternalBios] || ![cdsCore emuFlagUseExternalFirmware])
|
||||
|
@ -2106,6 +2083,14 @@
|
|||
[[self currentRom] release];
|
||||
[self setCurrentRom:nil];
|
||||
|
||||
// Release the current cheat list and assign the empty list.
|
||||
[self setCdsCheats:nil];
|
||||
if (dummyCheatList == nil)
|
||||
{
|
||||
dummyCheatList = [[CocoaDSCheatManager alloc] init];
|
||||
}
|
||||
[CocoaDSCheatManager setMasterCheatList:dummyCheatList];
|
||||
|
||||
// Update the UI to indicate that the ROM has finished unloading.
|
||||
[self updateAllWindowTitles];
|
||||
[screenshotCaptureToolDelegate setRomName:[currentRom internalName]];
|
||||
|
@ -2133,93 +2118,6 @@
|
|||
return result;
|
||||
}
|
||||
|
||||
- (void) updateCheatDatabaseRecentsMenu:(NSNotification *)aNotification
|
||||
{
|
||||
NSArray *dbRecentsList = (NSArray *)[aNotification object];
|
||||
BOOL needReleaseObject = (dbRecentsList != nil);
|
||||
|
||||
if ( (dbRecentsList == nil) || ([dbRecentsList count] == 0) )
|
||||
{
|
||||
dbRecentsList = [[NSUserDefaults standardUserDefaults] arrayForKey:@"CheatDatabase_RecentFilePath"];
|
||||
}
|
||||
|
||||
NSMutableArray *newRecentsList = [NSMutableArray arrayWithArray:dbRecentsList];
|
||||
|
||||
// Note that we're relying on the notification object to retain this prior to
|
||||
// sending the notification.
|
||||
if (needReleaseObject)
|
||||
{
|
||||
[dbRecentsList release];
|
||||
}
|
||||
|
||||
NSString *legacyFilePath = [[NSUserDefaults standardUserDefaults] stringForKey:@"R4Cheat_DatabasePath"];
|
||||
BOOL useLegacyFilePath = ( (legacyFilePath != nil) && ([legacyFilePath length] > 0) );
|
||||
|
||||
if (useLegacyFilePath)
|
||||
{
|
||||
// We need to check if the legacy file path also exists in the recents list.
|
||||
// If it does, then the recents list version takes priority.
|
||||
for (NSDictionary *dbRecentItem in dbRecentsList)
|
||||
{
|
||||
NSString *dbRecentItemFilePath = (NSString *)[dbRecentItem valueForKey:@"FilePath"];
|
||||
if ([dbRecentItemFilePath isEqualToString:legacyFilePath])
|
||||
{
|
||||
useLegacyFilePath = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (useLegacyFilePath)
|
||||
{
|
||||
// The legacy file path must always be the first entry of the recents list.
|
||||
NSDictionary *legacyRecentItem = [NSDictionary dictionaryWithObjectsAndKeys:legacyFilePath, @"FilePath",
|
||||
[legacyFilePath lastPathComponent], @"FileName",
|
||||
nil];
|
||||
[newRecentsList insertObject:legacyRecentItem atIndex:0];
|
||||
|
||||
if ([newRecentsList count] == 1)
|
||||
{
|
||||
// If the legacy file path is the only item in the recents list, then we can write it
|
||||
// back to user defaults right now.
|
||||
[[NSUserDefaults standardUserDefaults] setObject:newRecentsList forKey:@"CheatDatabase_RecentFilePath"];
|
||||
}
|
||||
}
|
||||
|
||||
NSArray *recentsMenuItems = [cheatDatabaseRecentsMenu itemArray];
|
||||
for (NSMenuItem *menuItem in recentsMenuItems)
|
||||
{
|
||||
if ( [menuItem action] == @selector(openRecentCheatDatabase:) )
|
||||
{
|
||||
[cheatDatabaseRecentsMenu removeItem:menuItem];
|
||||
}
|
||||
}
|
||||
|
||||
if ([newRecentsList count] > 0)
|
||||
{
|
||||
if ( ![[cheatDatabaseRecentsMenu itemAtIndex:0] isSeparatorItem] )
|
||||
{
|
||||
[cheatDatabaseRecentsMenu insertItem:[NSMenuItem separatorItem] atIndex:0];
|
||||
}
|
||||
}
|
||||
|
||||
// Recent files are added in reverse order, in which least recent files appear below
|
||||
// more recent files in the menu. The most recent file should be at the top of the menu.
|
||||
for (NSDictionary *recentItem in newRecentsList)
|
||||
{
|
||||
NSString *menuNameString = [recentItem objectForKey:@"FileName"];
|
||||
if ( (menuNameString == nil) || ([menuNameString length] == 0) )
|
||||
{
|
||||
menuNameString = [recentItem objectForKey:@"FilePath"];
|
||||
}
|
||||
|
||||
NSMenuItem *newMenuItem = [[[NSMenuItem alloc] initWithTitle:menuNameString action:@selector(openRecentCheatDatabase:) keyEquivalent:@""] autorelease];
|
||||
[newMenuItem setTag:[newRecentsList indexOfObject:recentItem]];
|
||||
[newMenuItem setTarget:self];
|
||||
[cheatDatabaseRecentsMenu insertItem:newMenuItem atIndex:0];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) handleNDSError:(NSNotification *)aNotification
|
||||
{
|
||||
[self setIsUserInterfaceBlockingExecution:YES];
|
||||
|
@ -3171,13 +3069,6 @@
|
|||
enable = NO;
|
||||
}
|
||||
}
|
||||
else if (theAction == @selector(clearCheatDatabaseRecents:))
|
||||
{
|
||||
if ([cheatDatabaseRecentsMenu numberOfItems] < 2)
|
||||
{
|
||||
enable = NO;
|
||||
}
|
||||
}
|
||||
else if (theAction == @selector(changeCoreSpeed:))
|
||||
{
|
||||
NSInteger speedScalar = (NSInteger)([cdsCore speedScalar] * 100.0);
|
||||
|
@ -3281,7 +3172,7 @@
|
|||
{
|
||||
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
|
||||
{
|
||||
[(NSMenuItem*)theItem setState:([[cdsCore cdsGPU] gpuStateByBit:(UInt32)[theItem tag]]) ? GUI_STATE_ON : GUI_STATE_OFF];
|
||||
[(NSMenuItem*)theItem setState:([[cdsCore cdsGPU] gpuStateByBit:[theItem tag]]) ? GUI_STATE_ON : GUI_STATE_OFF];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1170,7 +1170,7 @@ void HandleDeviceRemovalCallback(void *inContext, IOReturn inResult, void *inSen
|
|||
|
||||
ClientCommandAttributes cmdToggleSpeedLimiter = NewCommandAttributesWithFunction("Enable/Disable Speed Limiter", &ClientCommandToggleSpeedLimiter);
|
||||
ClientCommandAttributes cmdToggleAutoFrameSkip = NewCommandAttributesWithFunction("Enable/Disable Auto Frame Skip", &ClientCommandToggleAutoFrameSkip);
|
||||
ClientCommandAttributes cmdToggleCheats = NewCommandAttributesWithFunction("Enable/Disable Cheat System", &ClientCommandToggleCheats);
|
||||
ClientCommandAttributes cmdToggleCheats = NewCommandAttributesWithFunction("Enable/Disable Cheats", &ClientCommandToggleCheats);
|
||||
ClientCommandAttributes cmdCoreExecute = NewCommandAttributesWithFunction("Execute", &ClientCommandCoreExecute);
|
||||
ClientCommandAttributes cmdCorePause = NewCommandAttributesWithFunction("Pause", &ClientCommandCorePause);
|
||||
ClientCommandAttributes cmdToggleExecutePause = NewCommandAttributesWithFunction("Execute/Pause", &ClientCommandToggleExecutePause);
|
||||
|
@ -1227,7 +1227,7 @@ void HandleDeviceRemovalCallback(void *inContext, IOReturn inResult, void *inSen
|
|||
defaultCommandAttributes["Set Speed"] = cmdToggleSpeed;
|
||||
defaultCommandAttributes["Enable/Disable Speed Limiter"] = cmdToggleSpeedLimiter;
|
||||
defaultCommandAttributes["Enable/Disable Auto Frame Skip"] = cmdToggleAutoFrameSkip;
|
||||
defaultCommandAttributes["Enable/Disable Cheat System"] = cmdToggleCheats;
|
||||
defaultCommandAttributes["Enable/Disable Cheats"] = cmdToggleCheats;
|
||||
defaultCommandAttributes["Execute"] = cmdCoreExecute;
|
||||
defaultCommandAttributes["Pause"] = cmdCorePause;
|
||||
defaultCommandAttributes["Execute/Pause"] = cmdToggleExecutePause;
|
||||
|
@ -1802,7 +1802,7 @@ void HandleDeviceRemovalCallback(void *inContext, IOReturn inResult, void *inSen
|
|||
}
|
||||
|
||||
// Check if the audio file is already loaded. If it is, don't load it again.
|
||||
std::string filePathStr = std::string([CocoaDSUtil cPathFromFilePath:filePath]);
|
||||
std::string filePathStr = std::string([filePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
for (AudioFileSampleGeneratorMap::iterator it=audioFileGenerators.begin(); it!=audioFileGenerators.end(); ++it)
|
||||
{
|
||||
if (it->first.find(filePathStr) != std::string::npos)
|
||||
|
@ -1905,7 +1905,7 @@ void HandleDeviceRemovalCallback(void *inContext, IOReturn inResult, void *inSen
|
|||
return NULL;
|
||||
}
|
||||
|
||||
std::string filePathStr = std::string([CocoaDSUtil cPathFromFilePath:filePath]);
|
||||
std::string filePathStr = std::string([filePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
for (AudioFileSampleGeneratorMap::iterator it=audioFileGenerators.begin(); it!=audioFileGenerators.end(); ++it)
|
||||
{
|
||||
if (it->first.find(filePathStr) != std::string::npos)
|
||||
|
|
|
@ -1350,8 +1350,8 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
|||
param.refObject = newCaptureObject;
|
||||
param.fetchObject = currentFetchObj;
|
||||
param.formatID = [self formatID];
|
||||
param.savePath = std::string([CocoaDSUtil cPathFromFilePath:savePath]);
|
||||
param.romName = std::string([CocoaDSUtil cPathFromFilePath:romName]);
|
||||
param.savePath = std::string([savePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
param.romName = std::string([romName cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
param.useDeposterize = [self useDeposterize] ? true : false;
|
||||
param.outputFilterID = (OutputFilterTypeID)[self outputFilterID];
|
||||
param.pixelScalerID = (VideoFilterTypeID)[self pixelScalerID];
|
||||
|
@ -1383,8 +1383,7 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
|||
NSString *fileNameNSString = [[dateFormatter stringFromDate:[NSDate date]] stringByAppendingString:[NSString stringWithCString:param.romName.c_str() encoding:NSUTF8StringEncoding]];
|
||||
[dateFormatter release];
|
||||
|
||||
NSString *savePathNSString = [CocoaDSUtil filePathFromCPath:param.savePath.c_str()];
|
||||
std::string fileName = std::string([CocoaDSUtil cPathFromFilePath:[savePathNSString stringByAppendingPathComponent:fileNameNSString]]);
|
||||
std::string fileName = param.savePath + "/" + std::string([fileNameNSString cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
|
||||
// Create the output file stream.
|
||||
ClientAVCaptureError error = ClientAVCaptureError_None;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2018-2023 DeSmuME team
|
||||
Copyright (C) 2018-2022 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
|
||||
|
@ -87,7 +87,7 @@
|
|||
{
|
||||
[panel beginSheetModalForWindow:[self window]
|
||||
completionHandler:^(NSInteger result) {
|
||||
[self chooseDirectoryPathDidEnd:panel returnCode:(int)result contextInfo:nil];
|
||||
[self chooseDirectoryPathDidEnd:panel returnCode:result contextInfo:nil];
|
||||
} ];
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2017-2025 DeSmuME team
|
||||
Copyright (C) 2017-2022 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
|
||||
|
@ -20,11 +20,6 @@
|
|||
#endif
|
||||
|
||||
#include "MacMetalDisplayView.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <IOKit/graphics/IOGraphicsLib.h>
|
||||
|
||||
#include "../cocoa_globals.h"
|
||||
|
||||
#include "../../../common.h"
|
||||
|
@ -59,118 +54,13 @@
|
|||
|
||||
- (id)init
|
||||
{
|
||||
device = nil;
|
||||
|
||||
self = [super init];
|
||||
if (self == nil)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
#if defined(DEBUG) && (DEBUG == 1)
|
||||
// Report information on every renderer.
|
||||
NSArray< id<MTLDevice> > *mtlDeviceList = MTLCopyAllDevices();
|
||||
int rendererCount = (int)[mtlDeviceList count];
|
||||
printf("Metal Renderer Count: %i\n\n", rendererCount);
|
||||
|
||||
for (int i = 0; i < rendererCount; i++)
|
||||
{
|
||||
id<MTLDevice> mtlDevice = [mtlDeviceList objectAtIndex:i];
|
||||
|
||||
printf("Renderer Index: %i\n", i);
|
||||
printf("Renderer: %s\n", [[mtlDevice name] cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
|
||||
#if HAVE_OSAVAILABLE && defined(MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
|
||||
if (@available(macOS 10.13, *))
|
||||
{
|
||||
printf("Renderer ID: 0x%08llX\n", [mtlDevice registryID]);
|
||||
printf("Removable: %s\n", [mtlDevice isRemovable] ? "YES" : "NO");
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
printf("Renderer ID: UNSUPPORTED, Requires High Sierra\n");
|
||||
printf("Removable: UNSUPPORTED, Requires High Sierra\n");
|
||||
}
|
||||
|
||||
printf("Online: %s\n\n", [mtlDevice isHeadless] ? "NO" : "YES");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check if we're running on a MacBook Pro. If we are, then set our rendering device
|
||||
// to whatever the built-in display is using in order to respect the user setting for
|
||||
// Automatic Graphics Switching.
|
||||
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);
|
||||
}
|
||||
|
||||
if (strstr(modelCString, "MacBookPro") != NULL)
|
||||
{
|
||||
bool isBuiltInDisplayFound = false;
|
||||
NSArray<NSScreen *> *screenList = [NSScreen screens];
|
||||
for (NSScreen *theScreen in screenList)
|
||||
{
|
||||
NSNumber *screenNumber = (NSNumber *)[[theScreen deviceDescription] objectForKey:@"NSScreenNumber"];
|
||||
CGDirectDisplayID displayID = [screenNumber unsignedIntValue];
|
||||
|
||||
isBuiltInDisplayFound = CGDisplayIsBuiltin(displayID);
|
||||
if (isBuiltInDisplayFound)
|
||||
{
|
||||
// If we're running on a MacBook Pro with dual GPUs, we need to set our rendering device to
|
||||
// whatever the built-in display is running. This has a chance of choosing the integrated GPU,
|
||||
// but only under the following conditions:
|
||||
// - The user has Automatic Graphics Switching enabled in System Preferences
|
||||
// - The MacBook Pro's built-in display is online and available (in other words, the
|
||||
// MacBook Pro's lid is open, not closed)
|
||||
// - There are no additional displays connected to the MacBook Pro
|
||||
// - The app has "Prefer External GPU" unchecked in Finder Get Info
|
||||
device = CGDirectDisplayCopyCurrentMetalDevice(displayID);
|
||||
NSString *screenName = NULL;
|
||||
|
||||
// For debugging purposes, let's also report the name of the display that the rendering device
|
||||
// is associated to.
|
||||
#if HAVE_OSAVAILABLE && defined(MAC_OS_X_VERSION_10_15) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_15)
|
||||
if (@available(macOS 10.15, *))
|
||||
{
|
||||
screenName = [theScreen localizedName];
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
io_connect_t displayPort = SILENCE_DEPRECATION_MACOS_10_9( CGDisplayIOServicePort(displayID) );
|
||||
NSDictionary *screenInfo = CFBridgingRelease( IODisplayCreateInfoDictionary(displayPort, kIODisplayOnlyPreferredName) );
|
||||
NSDictionary *localizedNames = (NSDictionary *)[screenInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]];
|
||||
if ([localizedNames count] > 0)
|
||||
{
|
||||
screenName = (NSString *)[localizedNames objectForKey:[[localizedNames allKeys] objectAtIndex:0]];
|
||||
}
|
||||
}
|
||||
|
||||
printf("MacBook Pro Built-in Display: %s\n", [screenName cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (modelStringLen > 0)
|
||||
{
|
||||
free(modelCString);
|
||||
modelCString = NULL;
|
||||
}
|
||||
|
||||
// If no rendering device was set from beforehand, then just use the system default renderer.
|
||||
// For MacBook Pro with dual GPUs, this will NEVER choose the integrated GPU.
|
||||
if (device == nil)
|
||||
{
|
||||
device = MTLCreateSystemDefaultDevice();
|
||||
}
|
||||
|
||||
device = MTLCreateSystemDefaultDevice();
|
||||
if (device == nil)
|
||||
{
|
||||
NSLog(@"Metal: A Metal device could not be found.");
|
||||
|
@ -187,24 +77,23 @@
|
|||
}
|
||||
|
||||
[device retain];
|
||||
printf("Selected Metal Renderer: %s\n\n\n", [[device name] cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
|
||||
NSString *tempVersionStr = @"Metal - Unknown GPU Family";
|
||||
const BOOL isRWTexSupported = [device supportsFeatureSet:(MTLFeatureSet)10002]; // MTLFeatureSet_macOS_ReadWriteTextureTier2
|
||||
const BOOL isRWTexSupported = [device supportsFeatureSet:10002]; // MTLFeatureSet_macOS_ReadWriteTextureTier2
|
||||
|
||||
if ([device supportsFeatureSet:(MTLFeatureSet)10005]) // MTLFeatureSet_macOS_GPUFamily2_v1
|
||||
if ([device supportsFeatureSet:10005]) // MTLFeatureSet_macOS_GPUFamily2_v1
|
||||
{
|
||||
tempVersionStr = @"macOS Metal GPUFamily2_v1";
|
||||
}
|
||||
else if ([device supportsFeatureSet:(MTLFeatureSet)10004]) // MTLFeatureSet_macOS_GPUFamily1_v4
|
||||
else if ([device supportsFeatureSet:10004]) // MTLFeatureSet_macOS_GPUFamily1_v4
|
||||
{
|
||||
tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v4 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v4";
|
||||
}
|
||||
else if ([device supportsFeatureSet:(MTLFeatureSet)10003]) // MTLFeatureSet_macOS_GPUFamily1_v3
|
||||
else if ([device supportsFeatureSet:10003]) // MTLFeatureSet_macOS_GPUFamily1_v3
|
||||
{
|
||||
tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v3 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v3";
|
||||
}
|
||||
else if ([device supportsFeatureSet:(MTLFeatureSet)10001]) // MTLFeatureSet_macOS_GPUFamily1_v2
|
||||
else if ([device supportsFeatureSet:10001]) // MTLFeatureSet_macOS_GPUFamily1_v2
|
||||
{
|
||||
tempVersionStr = (isRWTexSupported) ? @"macOS Metal GPUFamily1_v2 w/ Tier2 R/W Textures" : @"macOS Metal GPUFamily1_v2";
|
||||
}
|
||||
|
@ -2667,7 +2556,7 @@ void MacMetalFetchObject::_FetchNativeDisplayByID(const NDSDisplayID displayID,
|
|||
GPU->PostprocessDisplay(displayID, this->_fetchDisplayInfo[bufferIndex]);
|
||||
|
||||
pthread_rwlock_wrlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
||||
ColorspaceConvertBuffer555xTo8888Opaque<false, false, BESwapDst>(this->_fetchDisplayInfo[bufferIndex].nativeBuffer16[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
ColorspaceConvertBuffer555To8888Opaque<false, false, BESwapDst>(this->_fetchDisplayInfo[bufferIndex].nativeBuffer16[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
pthread_rwlock_unlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
||||
}
|
||||
|
||||
|
@ -2681,7 +2570,7 @@ void MacMetalFetchObject::_FetchCustomDisplayByID(const NDSDisplayID displayID,
|
|||
GPU->PostprocessDisplay(displayID, this->_fetchDisplayInfo[bufferIndex]);
|
||||
|
||||
pthread_rwlock_wrlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
||||
ColorspaceConvertBuffer888xTo8888Opaque<false, false>((u32 *)this->_fetchDisplayInfo[bufferIndex].customBuffer[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
ColorspaceConvertBuffer888XTo8888Opaque<false, false>((u32 *)this->_fetchDisplayInfo[bufferIndex].customBuffer[displayID], this->_srcNativeClone[displayID][bufferIndex], GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
|
||||
pthread_rwlock_unlock(&this->_srcCloneRWLock[displayID][bufferIndex]);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2017-2025 DeSmuME team
|
||||
Copyright (C) 2017-2022 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
|
||||
|
@ -142,14 +142,6 @@ MacOGLClientFetchObject::MacOGLClientFetchObject()
|
|||
(NSOpenGLPixelFormatAttribute)0
|
||||
};
|
||||
|
||||
// Normally, supporting Automatic Graphics Switching and allowing the context
|
||||
// to use the integrated GPU requires NSOpenGLPFAAllowOfflineRenderers in the
|
||||
// pixel format attributes. However, GPUs that can't support Metal are also
|
||||
// too slow to run most of the video filters on OpenGL, and also show poor
|
||||
// performance when running multiple display windows with high GPU scaling
|
||||
// factors. Therefore, we will NOT allow OpenGL to run contexts on the
|
||||
// integrated GPU for performance reasons. -rogerman (2025/03/26)
|
||||
|
||||
#ifdef _OGLDISPLAYOUTPUT_3_2_H_
|
||||
// If we can support a 3.2 Core Profile context, then request that in our
|
||||
// pixel format attributes.
|
||||
|
@ -343,14 +335,6 @@ void MacOGLDisplayPresenter::__InstanceInit(MacOGLClientFetchObject *fetchObject
|
|||
(NSOpenGLPixelFormatAttribute)0
|
||||
};
|
||||
|
||||
// Normally, supporting Automatic Graphics Switching and allowing the context
|
||||
// to use the integrated GPU requires NSOpenGLPFAAllowOfflineRenderers in the
|
||||
// pixel format attributes. However, GPUs that can't support Metal are also
|
||||
// too slow to run most of the video filters on OpenGL, and also show poor
|
||||
// performance when running multiple display windows with high GPU scaling
|
||||
// factors. Therefore, we will NOT allow OpenGL to run contexts on the
|
||||
// integrated GPU for performance reasons. -rogerman (2025/03/26)
|
||||
|
||||
#ifdef _OGLDISPLAYOUTPUT_3_2_H_
|
||||
// If we can support a 3.2 Core Profile context, then request that in our
|
||||
// pixel format attributes.
|
||||
|
|
|
@ -75,8 +75,8 @@
|
|||
param->refObject = NULL;
|
||||
param->fetchObject = [self fetchObject];
|
||||
param->formatID = [self formatID];
|
||||
param->savePath = std::string([CocoaDSUtil cPathFromFilePath:savePath]);
|
||||
param->romName = std::string([CocoaDSUtil cPathFromFilePath:romName]);
|
||||
param->savePath = std::string([savePath cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
param->romName = std::string([romName cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
param->useDeposterize = [self useDeposterize] ? true : false;
|
||||
param->outputFilterID = (OutputFilterTypeID)[self outputFilterID];
|
||||
param->pixelScalerID = (VideoFilterTypeID)[self pixelScalerID];
|
||||
|
@ -291,7 +291,7 @@ static void* RunFileWriteThread(void *arg)
|
|||
NSString *fileName = [[dateFormatter stringFromDate:[NSDate date]] stringByAppendingString:[NSString stringWithCString:param.romName.c_str() encoding:NSUTF8StringEncoding]];
|
||||
[dateFormatter release];
|
||||
|
||||
NSString *savePath = [CocoaDSUtil filePathFromCPath:param.savePath.c_str()];
|
||||
NSString *savePath = [NSString stringWithCString:param.savePath.c_str() encoding:NSUTF8StringEncoding];
|
||||
NSURL *fileURL = [NSURL fileURLWithPath:[savePath stringByAppendingPathComponent:fileName]];
|
||||
[CocoaDSFile saveScreenshot:fileURL bitmapData:newImageRep fileType:(NSBitmapImageFileType)param.formatID];
|
||||
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
NSObjectController *emuControlController;
|
||||
NSObjectController *prefWindowController;
|
||||
NSObjectController *cdsCoreController;
|
||||
NSObjectController *databaseFileController;
|
||||
NSArrayController *gameListController;
|
||||
FileMigrationDelegate *migrationDelegate;
|
||||
MacAVCaptureToolDelegate *avCaptureToolDelegate;
|
||||
WifiSettingsPanelDelegate *wifiSettingsPanelDelegate;
|
||||
|
@ -65,8 +63,6 @@
|
|||
@property (readonly) IBOutlet NSObjectController *emuControlController;
|
||||
@property (readonly) IBOutlet NSObjectController *prefWindowController;
|
||||
@property (readonly) IBOutlet NSObjectController *cdsCoreController;
|
||||
@property (readonly) IBOutlet NSObjectController *databaseFileController;
|
||||
@property (readonly) IBOutlet NSArrayController *gameListController;
|
||||
@property (readonly) IBOutlet FileMigrationDelegate *migrationDelegate;
|
||||
@property (readonly) IBOutlet MacAVCaptureToolDelegate *avCaptureToolDelegate;
|
||||
@property (readonly) IBOutlet WifiSettingsPanelDelegate *wifiSettingsPanelDelegate;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
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
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -28,7 +28,6 @@
|
|||
#import "inputPrefsView.h"
|
||||
|
||||
#import "cocoa_core.h"
|
||||
#import "cocoa_cheat.h"
|
||||
#import "cocoa_GPU.h"
|
||||
#import "cocoa_file.h"
|
||||
#import "cocoa_firmware.h"
|
||||
|
@ -51,8 +50,6 @@
|
|||
@synthesize emuControlController;
|
||||
@synthesize prefWindowController;
|
||||
@synthesize cdsCoreController;
|
||||
@synthesize databaseFileController;
|
||||
@synthesize gameListController;
|
||||
@synthesize avCaptureToolDelegate;
|
||||
@synthesize wifiSettingsPanelDelegate;
|
||||
@synthesize migrationDelegate;
|
||||
|
@ -315,7 +312,6 @@
|
|||
// Bring the application to the front
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
[emuControl restoreDisplayWindowStates];
|
||||
[emuControl updateCheatDatabaseRecentsMenu:nil];
|
||||
|
||||
// Load a new ROM on launch per user preferences.
|
||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"General_AutoloadROMOnLaunch"] != nil)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue