From 4de7e893309406eb627ad010cc45407ed43373e2 Mon Sep 17 00:00:00 2001 From: daniel229 Date: Fri, 26 Sep 2014 17:13:01 +0800 Subject: [PATCH] Replace download frame in Sora no kiseki SC,and a comment for Sora no kiseki 3rd --- Core/HLE/ReplaceTables.cpp | 22 ++++++++++++++++++++++ Core/MIPS/MIPSAnalyst.cpp | 3 ++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index eb2bba9b5e..873d17fbd5 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -699,6 +699,27 @@ static int Hook_soranokiseki_fc_download_frame() { return 0; } +static int Hook_soranokiseki_sc_download_frame() { + u32 fb_infoaddr; + if (!GetMIPSStaticAddress(fb_infoaddr, 0x28, 0x2C)) { + return 0; + } + const u32 fb_info = Memory::Read_U32(fb_infoaddr); + const MIPSOpcode fb_index_load = Memory::Read_Instruction(currentMIPS->pc + 0x34, true); + if (fb_index_load != MIPS_MAKE_LW(MIPS_GET_RT(fb_index_load), MIPS_GET_RS(fb_index_load), fb_index_load & 0xffff)) { + return 0; + } + const int fb_index_offset = (s16)(fb_index_load & 0xffff); + const u32 fb_index = (Memory::Read_U32(fb_info + fb_index_offset) + 1) & 1; + const u32 fb_address = 0x4000000 + (0x44000 * fb_index); + const u32 dest_address = currentMIPS->r[MIPS_REG_A1]; + if (Memory::IsRAMAddress(dest_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 @@ -757,6 +778,7 @@ static const ReplacementTableEntry entries[] = { { "rezel_cross_download_frame", &Hook_rezel_cross_download_frame, 0, REPFLAG_HOOKENTER, 0x54 }, { "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, }, {} }; diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 839108f3d4..fb90522bc4 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -326,7 +326,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0xafb2c7e56c04c8e9, 48, "vtfm_q", }, { 0xafc9968e7d246a5e, 1588, "atan", }, { 0xafcb7dfbc4d72588, 44, "vector_transform_3x4", }, - { 0xb07f9d82d79deea9, 536, "brandish_download_frame", }, // Brandish + { 0xb07f9d82d79deea9, 536, "brandish_download_frame", }, // Brandish, and Sora no kiseki 3rd { 0xb0db731f27d3aa1b, 40, "vmax_s", }, { 0xb0ef265e87899f0a, 32, "vector_divide_t_s", }, { 0xb183a37baa12607b, 32, "vscl_t", }, @@ -354,6 +354,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 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", }, + { 0xc1220040b0599a75, 472, "soranokiseki_sc_download_frame", }, // Sora no kiseki SC { 0xc1f34599d0b9146b, 116, "__subdf3", }, { 0xc3089f66ee6f0a24, 464, "growlanser_create_saveicon", }, // Growlanswer IV { 0xc319f0d107dd2f45, 888, "__muldf3", },