From 7c1d4234ab466be0502331a9f398a39f1e142850 Mon Sep 17 00:00:00 2001 From: daniel229 Date: Thu, 11 Sep 2014 15:32:07 +0800 Subject: [PATCH 1/2] Replace frame download in Sakurasou No Pet Na Kanojo --- Core/HLE/ReplaceTables.cpp | 10 ++++++++++ Core/MIPS/MIPSAnalyst.cpp | 1 + 2 files changed, 11 insertions(+) diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index b03d507397d0..f7bcb33248b7 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -643,6 +643,15 @@ static int Hook_orenoimouto_download_frame() { return 0; } +static int Hook_sakurasou_download_frame() { + const u32 fb_address = currentMIPS->r[MIPS_REG_A1]; + if (Memory::IsVRAMAddress(fb_address)) { + gpu->PerformMemoryDownload(fb_address, 0x00044000); + CBreakPoints::ExecMemCheck(fb_address, true, 0x00044000, currentMIPS->pc); + } + return 0; +} + // Can either replace with C functions or functions emitted in Asm/ArmAsm. static const ReplacementTableEntry entries[] = { // TODO: I think some games can be helped quite a bit by implementing the @@ -695,6 +704,7 @@ static const ReplacementTableEntry entries[] = { { "narisokonai_download_frame", &Hook_narisokonai_download_frame, 0, REPFLAG_HOOKENTER, 0x14 }, { "kirameki_school_life_download_frame", &Hook_kirameki_school_life_download_frame, 0, REPFLAG_HOOKENTER, 0x304 }, { "orenoimouto_download_frame", &Hook_orenoimouto_download_frame, 0, REPFLAG_HOOKENTER, 0x88 }, + { "sakurasou_download_frame", &Hook_sakurasou_download_frame, 0, REPFLAG_HOOKENTER, 0x17c }, {} }; diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 08438fbd3b33..4d884a1d6482 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -345,6 +345,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0xbe773f78afd1a70f, 128, "rand", }, { 0xbf5d02ccb8514881, 108, "strcmp", }, { 0xbf791954ebef4afb, 396, "expf", }, + { 0xbfa8c16038b7753d, 868, "sakurasou_download_frame", }, // Sakurasou No Pet Na Kanojo { 0xc062f2545ef5dc39, 1076, "kirameki_school_life_download_frame", },// Kirameki School Life SP,and Boku wa Tomodati ga Sukunai { 0xc0feb88cc04a1dc7, 48, "vector_negate_t", }, { 0xc1f34599d0b9146b, 116, "__subdf3", }, From 5f4a95cdd5d6d3fe2e735f73421e7baa723b7d21 Mon Sep 17 00:00:00 2001 From: daniel229 Date: Sat, 13 Sep 2014 10:21:00 +0800 Subject: [PATCH 2/2] Update as unknown's suggestion --- Core/HLE/ReplaceTables.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index f7bcb33248b7..d1935c71632d 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -644,10 +644,10 @@ static int Hook_orenoimouto_download_frame() { } static int Hook_sakurasou_download_frame() { - const u32 fb_address = currentMIPS->r[MIPS_REG_A1]; + const u32 fb_address = currentMIPS->r[MIPS_REG_V0]; if (Memory::IsVRAMAddress(fb_address)) { - gpu->PerformMemoryDownload(fb_address, 0x00044000); - CBreakPoints::ExecMemCheck(fb_address, true, 0x00044000, currentMIPS->pc); + gpu->PerformMemoryDownload(fb_address, 0x00088000); + CBreakPoints::ExecMemCheck(fb_address, true, 0x00088000, currentMIPS->pc); } return 0; } @@ -704,7 +704,7 @@ static const ReplacementTableEntry entries[] = { { "narisokonai_download_frame", &Hook_narisokonai_download_frame, 0, REPFLAG_HOOKENTER, 0x14 }, { "kirameki_school_life_download_frame", &Hook_kirameki_school_life_download_frame, 0, REPFLAG_HOOKENTER, 0x304 }, { "orenoimouto_download_frame", &Hook_orenoimouto_download_frame, 0, REPFLAG_HOOKENTER, 0x88 }, - { "sakurasou_download_frame", &Hook_sakurasou_download_frame, 0, REPFLAG_HOOKENTER, 0x17c }, + { "sakurasou_download_frame", &Hook_sakurasou_download_frame, 0, REPFLAG_HOOKENTER, 0xF8 }, {} };