ReplaceTables: Fix Amagoushi no Yakata 3D investigation hit-test readback

- Fixes #22514

The 3D investigation mode renders an ID picking pass into VRAM and reads
it back on the CPU to build the hit-test table. Hook the decode function
to flush the framebuffers to VRAM first, and force lower resolution for
effects to avoid stutter.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
RulariaandClaude Opus 5.5 authored and Henrik Rydgård committed 2026-10-17 15:15:59 +02:00
1 parent 370a9ca963
commit ed347bf0e4
3 files changed
+16

No files matched your search

+10
View File
@@ -985,6 +985,15 @@ static int Hook_soranokiseki_sc_download_frame() {
return 0;
}
static int Hook_amagoushi_download_frame() {
// Amagoushi no Yakata (ULJS00216) offscreen picking pass renders to 0x04000000 or 0x04080000.
// Flush GPU framebuffer to VRAM before CPU decodes pixels into hit-test table.
gpu->PerformReadbackToMemory(0x04000000, 0x00044000);
gpu->PerformReadbackToMemory(0x04080000, 0x00044000);
NotifyMemInfo(MemBlockFlags::WRITE, 0x04000000, 0x00044000, "amagoushi_download_frame");
return 0;
}
static int Hook_bokunonatsuyasumi4_download_frame() {
const u32 fb_address = currentMIPS->r[MIPS_REG_A3];
if (Memory::IsVRAMAddress(fb_address)) {
@@ -1917,6 +1926,7 @@ static const ReplacementTableEntry entries[] = {
{ "kagaku_no_ensemble_download_frame", &Hook_kagaku_no_ensemble_download_frame, 0, REPFLAG_HOOKENTER, 0x38 },
{ "soranokiseki_fc_download_frame", &Hook_soranokiseki_fc_download_frame, 0, REPFLAG_HOOKENTER, 0x180 },
{ "soranokiseki_sc_download_frame", &Hook_soranokiseki_sc_download_frame, 0, REPFLAG_HOOKENTER, },
{ "amagoushi_download_frame", &Hook_amagoushi_download_frame, 0, REPFLAG_HOOKENTER },
{ "bokunonatsuyasumi4_download_frame", &Hook_bokunonatsuyasumi4_download_frame, 0, REPFLAG_HOOKENTER, 0x8C },
{ "danganronpa2_1_download_frame", &Hook_danganronpa2_1_download_frame, 0, REPFLAG_HOOKENTER, 0x68 },
{ "danganronpa2_2_download_frame", &Hook_danganronpa2_2_download_frame, 0, REPFLAG_HOOKENTER, 0x94 },
+1
View File
@@ -125,6 +125,7 @@ static const HardHashTableEntry hardcodedHashes[] = {
{ 0x11624abe9542fb01, 180, "everybodysgolf_copy_portrait", }, // Everybody's Golf (EUR)
{ 0x1252e902d0b49bfb, 44, "vector_sub_q_2", },
{ 0x12df3d33a58d0298, 52, "sceVfpuMatrix3Unit", },
{ 0x12eed64025f5052bULL, 268, "amagoushi_download_frame", }, // Amagoushi no Yakata (ULJS00216)
{ 0x12feef7b017d3431, 700, "memmove", },
{ 0x1322c7e3fe6dff4d, 784, "_free_r", },
{ 0x1376c115d5f1d90c, 36, "strlen", },
+5
View File
@@ -1472,6 +1472,11 @@ ULUS10435 = true
ULES01277 = true
[ForceLowerResolutionForEffectsOn]
# Amagoushi no Yakata series - offscreen solid color ID picking pass (issue #22514)
ULJS00216 = true
ULJS00230 = true
NPJH50186 = true
# The water effect of DiRT 2 and Outrun doesn't work in higher resolutions.
# Colin McRae's DiRT 2 - issue #13012 (water)