From d7927009d088151ea02d36f10216e10fa9e40f3e Mon Sep 17 00:00:00 2001 From: daniel229 Date: Sun, 5 Oct 2014 13:39:15 +0800 Subject: [PATCH] Replace frame download in danganronpa 2 --- Core/HLE/ReplaceTables.cpp | 13 +++++++++++++ Core/MIPS/MIPSAnalyst.cpp | 1 + 2 files changed, 14 insertions(+) diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index 6d2844fd2c..fc04ec7f91 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -729,6 +729,18 @@ static int Hook_bokunonatsuyasumi4_download_frame() { return 0; } +static int Hook_danganronpa2_1_download_frame() { + const u32 fb_base = currentMIPS->r[MIPS_REG_V0]; + const u32 fb_offset = currentMIPS->r[MIPS_REG_V1]; + const u32 fb_offset_fix = fb_offset & 0xFFFFFFFC; + const u32 fb_address = fb_base + fb_offset_fix; + if (Memory::IsVRAMAddress(fb_address)) { + gpu->PerformMemoryDownload(fb_address, 0x00088000); + CBreakPoints::ExecMemCheck(fb_address, true, 0x00088000, 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 @@ -789,6 +801,7 @@ static const ReplacementTableEntry entries[] = { { "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, }, { "bokunonatsuyasumi4_download_frame", &Hook_bokunonatsuyasumi4_download_frame, 0, REPFLAG_HOOKENTER, 0x8C }, + { "danganronpa2_1_download_frame", &Hook_danganronpa2_1_download_frame, 0, REPFLAG_HOOKENTER, 0x68 }, {} }; diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 693260f3b9..26c13c496f 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -327,6 +327,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0xafc9968e7d246a5e, 1588, "atan", }, { 0xafcb7dfbc4d72588, 44, "vector_transform_3x4", }, { 0xb07f9d82d79deea9, 536, "brandish_download_frame", }, // Brandish, and Sora no kiseki 3rd + { 0xb09c9bc1343a774c, 456, "danganronpa2_1_download_frame", }, // Danganronpa 2 { 0xb0db731f27d3aa1b, 40, "vmax_s", }, { 0xb0ef265e87899f0a, 32, "vector_divide_t_s", }, { 0xb183a37baa12607b, 32, "vscl_t", },