Amagoushi no Yakata: Read the picking pass back at sceGeDrawSync instead

The hook on the decode function fixed hit-testing, but the solid color
picking frames could stay visible on screen, more so at high render
resolutions. Reading back at sceGeDrawSync(0), right after the game
waits for the pass, doesn't show them. Only the framebuffer the last
list drew to is read back. Rularia found and tested this at 10x on
ULJS00216.

The new ColorPickingDrawSyncReadback compat flag replaces the
ReplaceTables hook, and ULJS00247 (the third game's UMD) is added
alongside the others.

Co-Authored-By: Rularia <Rularia@outlook.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed 2026-10-17 15:19:31 +02:00
1 parent ed347bf0e4
commit 0a0458ed7a
6 files changed
+22 -12

No files matched your search

+1
View File
@@ -169,6 +169,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
CheckSetting(iniFile, gameID, "DepthCLUTIntoHalves", &flags_.DepthCLUTIntoHalves);
CheckSetting(iniFile, gameID, "AccurateSplines", &flags_.AccurateSplines);
CheckSetting(iniFile, gameID, "ReadbackShadow", &flags_.ReadbackShadow);
CheckSetting(iniFile, gameID, "ColorPickingDrawSyncReadback", &flags_.ColorPickingDrawSyncReadback);
}
void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID) {
+1
View File
@@ -124,6 +124,7 @@ struct CompatFlags {
bool DepthCLUTIntoHalves;
bool AccurateSplines;
bool ReadbackShadow;
bool ColorPickingDrawSyncReadback;
};
struct VRCompat {
-10
View File
@@ -985,15 +985,6 @@ 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)) {
@@ -1926,7 +1917,6 @@ 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 },
+10 -1
View File
@@ -467,7 +467,16 @@ static u32 sceGeDrawSync(u32 mode) {
else if (!PSP_CoreParameter().compat.flags().DrawSyncInstant)
hleEatCycles(1240);
gstate_c.textureSyncTimeDomain++;
return hleLogDebug(Log::sceGe, gpu->DrawSync(mode));
u32 result = gpu->DrawSync(mode);
if (mode == 0 && PSP_CoreParameter().compat.flags().ColorPickingDrawSyncReadback) {
// The game waits for its picking pass here and then reads it from VRAM. It renders to one
// of two buffers, so read back the one the last list drew to.
const u32 fb = 0x04000000 | gstate.getFrameBufRawAddress();
if (fb == 0x04000000 || fb == 0x04080000) {
gpu->PerformReadbackToMemory(fb, 0x00044000);
}
}
return hleLogDebug(Log::sceGe, result);
}
static int sceGeContinue() {
-1
View File
@@ -125,7 +125,6 @@ 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", },
+10
View File
@@ -1475,6 +1475,7 @@ ULES01277 = true
# Amagoushi no Yakata series - offscreen solid color ID picking pass (issue #22514)
ULJS00216 = true
ULJS00230 = true
ULJS00247 = true
NPJH50186 = true
# The water effect of DiRT 2 and Outrun doesn't work in higher resolutions.
@@ -2267,3 +2268,12 @@ NPJG00047 = true
ULJS00394 = true
ULJS19068 = true
NPJH50518 = true
[ColorPickingDrawSyncReadback]
# In 3D investigation mode, the Amagoushi no Yakata games render a solid color ID picking pass, wait for it
# with sceGeDrawSync(0) and read it from VRAM to find what the cursor is over (#22514). Read back the
# framebuffer the last list drew to at each sceGeDrawSync(0).
ULJS00216 = true
ULJS00230 = true
ULJS00247 = true
NPJH50186 = true