Merge pull request #806 from brooksytech/dev

Restore Duckstation libretro with gcc12 fix
This commit is contained in:
Brooksytech 2022-12-15 12:33:03 -08:00 committed by GitHub
commit 5e2507fb28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 2 deletions

View file

@ -7,7 +7,7 @@ PKG_VERSION="24c373245ebdab946f11627520edea76e1f23b8e"
PKG_ARCH="any"
PKG_LICENSE="GPLv3"
PKG_SITE="https://github.com/stenzek/duckstation"
PKG_URL="$PKG_SITE/archive/$PKG_VERSION.tar.gz"
PKG_URL="$PKG_SITE.git"
PKG_DEPENDS_TARGET="toolchain SDL2 nasm:host pulseaudio openssl libidn2 nghttp2 zlib curl libevdev"
PKG_SECTION="libretro"
PKG_SHORTDESC="DuckStation - PlayStation 1, aka. PSX Emulator"

View file

@ -0,0 +1,53 @@
diff --git a/src/core/cpu_core.h b/src/core/cpu_core.h
index c9199153..5d82b5c0 100644
--- a/src/core/cpu_core.h
+++ b/src/core/cpu_core.h
@@ -84,6 +84,8 @@ struct State
std::array<u8, DCACHE_SIZE> dcache = {};
std::array<u32, ICACHE_LINES> icache_tags = {};
std::array<u8, ICACHE_SIZE> icache_data = {};
+
+ static constexpr u32 GTERegisterOffset(u32 index) { return offsetof(State, gte_regs.r32) + (sizeof(u32) * index); }
};
extern State g_state;
diff --git a/src/core/cpu_recompiler_code_generator.cpp b/src/core/cpu_recompiler_code_generator.cpp
index 68492b03..e550844e 100644
--- a/src/core/cpu_recompiler_code_generator.cpp
+++ b/src/core/cpu_recompiler_code_generator.cpp
@@ -2377,7 +2377,7 @@ Value CodeGenerator::DoGTERegisterRead(u32 index)
default:
{
- EmitLoadCPUStructField(value.host_reg, RegSize_32, offsetof(State, gte_regs.r32[index]));
+ EmitLoadCPUStructField(value.host_reg, RegSize_32, State::GTERegisterOffset(index));
}
break;
}
@@ -2406,7 +2406,7 @@ void CodeGenerator::DoGTERegisterWrite(u32 index, const Value& value)
{
// sign-extend z component of vector registers
Value temp = ConvertValueSize(value.ViewAsSize(RegSize_16), RegSize_32, true);
- EmitStoreCPUStructField(offsetof(State, gte_regs.r32[index]), temp);
+ EmitStoreCPUStructField(State::GTERegisterOffset(index), temp);
return;
}
break;
@@ -2419,7 +2419,7 @@ void CodeGenerator::DoGTERegisterWrite(u32 index, const Value& value)
{
// zero-extend unsigned values
Value temp = ConvertValueSize(value.ViewAsSize(RegSize_16), RegSize_32, false);
- EmitStoreCPUStructField(offsetof(State, gte_regs.r32[index]), temp);
+ EmitStoreCPUStructField(State::GTERegisterOffset(index), temp);
return;
}
break;
@@ -2461,7 +2461,7 @@ void CodeGenerator::DoGTERegisterWrite(u32 index, const Value& value)
default:
{
// written as-is, 2x16 or 1x32 bits
- EmitStoreCPUStructField(offsetof(State, gte_regs.r32[index]), value);
+ EmitStoreCPUStructField(State::GTERegisterOffset(index), value);
return;
}
}

View file

@ -1454,6 +1454,7 @@
<core default="true">pcsx_rearmed32</core>
<core>pcsx_rearmed</core>
<core>swanstation</core>
<core>duckstation</core>
</cores>
</emulator>
<emulator name="Duckstation">

View file

@ -1484,6 +1484,7 @@
<emulator name="retroarch">
<cores>
<core default="true">swanstation</core>
<core>duckstation</core>
</cores>
</emulator>
<emulator name="Duckstation">

View file

@ -28,7 +28,7 @@ LIBRETRO_CORES="2048 81 a5200 atari800 beetle-gba beetle-lynx beetle-ngp beetle-
sameduck scummvm smsplus-gx snes9x snes9x2002 snes9x2005_plus snes9x2010 stella \
stella-2014 swanstation TIC-80 tgbdual tyrquake xrick uae4arm uzem vba-next vbam \
vecx vice yabasanshiro xmil mesen virtualjaguar ecwolf_libretro vitaquake2 \
bsnes-mercury-performance"
bsnes-mercury-performance duckstation"
PKG_DEPENDS_TARGET="${PKG_EMUS} ${PKG_RETROARCH} ${LIBRETRO_CORES}"