From 107fa1c09ab2d3301abcbd025fa253f355753f1d Mon Sep 17 00:00:00 2001 From: daniel229 Date: Sun, 3 Jan 2016 22:13:42 +0800 Subject: [PATCH 1/5] Replace function in ATV Offroad Fury Pro --- Core/HLE/ReplaceTables.cpp | 9 +++++++++ Core/MIPS/MIPSAnalyst.cpp | 1 + 2 files changed, 10 insertions(+) diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index 4237f9a9a9..d8a1633a2f 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -1043,6 +1043,14 @@ static int Hook_sdgundamggenerationportable_download_frame() { return 0; } +static int Hook_atvoffroadfurypro_download_frame() { + const u32 fb_address = currentMIPS->r[MIPS_REG_A1]; + if (Memory::IsVRAMAddress(fb_address)) { + gpu->PerformMemoryDownload(fb_address, 0x00088000); + CBreakPoints::ExecMemCheck(fb_address, true, 0x00088000, currentMIPS->pc); +} + return 0; +} #ifdef ARM #define JITFUNC(f) (&MIPSComp::ArmJit::f) @@ -1141,6 +1149,7 @@ static const ReplacementTableEntry entries[] = { { "youkosohitsujimura_download_frame", &Hook_youkosohitsujimura_download_frame, 0, REPFLAG_HOOKENTER, 0x94 }, { "tonyhawkp8_upload_tutorial_frame", &Hook_tonyhawkp8_upload_tutorial_frame, 0, REPFLAG_HOOKENTER, }, { "sdgundamggenerationportable_download_frame", &Hook_sdgundamggenerationportable_download_frame, 0, REPFLAG_HOOKENTER, 0x34 }, + { "atvoffroadfurypro_download_frame", &Hook_atvoffroadfurypro_download_frame, 0, REPFLAG_HOOKENTER, }, {} }; diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 86f61f314d..efbb41ee63 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -95,6 +95,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0x06e2826e02056114, 56, "wcslen", }, { 0x073cf0b61d3b875a, 416, "hexyzforce_monoclome_thread", }, // Hexyz Force (US) { 0x075fa9b234b41e9b, 32, "fmodf", }, + { 0x09ab0791e1da9647, 180, "atvoffroadfurypro_download_frame", }, // ATV Offroad Fury Pro (US) { 0x0a051019bdd786c3, 184, "strcasecmp", }, { 0x0a1bed70958935d2, 644, "youkosohitsujimura_download_frame", }, // Youkoso Hitsuji-Mura Portable { 0x0a46dc426054bb9d, 24, "vector_add_t", }, From 3b461a00cc74bcce909fb3f71cf30be4e6cc5ae5 Mon Sep 17 00:00:00 2001 From: daniel229 Date: Sun, 3 Jan 2016 22:20:50 +0800 Subject: [PATCH 2/5] Replace function in ATV Offroad Fury Blazin' Trails --- 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 d8a1633a2f..facdb57f27 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -1052,6 +1052,15 @@ static int Hook_atvoffroadfurypro_download_frame() { return 0; } +static int Hook_atvoffroadfuryblazintrails_download_frame() { + const u32 fb_address = currentMIPS->r[MIPS_REG_A1]; + if (Memory::IsVRAMAddress(fb_address)) { + gpu->PerformMemoryDownload(fb_address, 0x00088000); + CBreakPoints::ExecMemCheck(fb_address, true, 0x00088000, currentMIPS->pc); +} + return 0; +} + #ifdef ARM #define JITFUNC(f) (&MIPSComp::ArmJit::f) #elif defined(ARM64) @@ -1150,6 +1159,7 @@ static const ReplacementTableEntry entries[] = { { "tonyhawkp8_upload_tutorial_frame", &Hook_tonyhawkp8_upload_tutorial_frame, 0, REPFLAG_HOOKENTER, }, { "sdgundamggenerationportable_download_frame", &Hook_sdgundamggenerationportable_download_frame, 0, REPFLAG_HOOKENTER, 0x34 }, { "atvoffroadfurypro_download_frame", &Hook_atvoffroadfurypro_download_frame, 0, REPFLAG_HOOKENTER, }, + { "atvoffroadfuryblazintrails_download_frame", &Hook_atvoffroadfuryblazintrails_download_frame, 0, REPFLAG_HOOKENTER, }, {} }; diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index efbb41ee63..e894021fc1 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -227,6 +227,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0x5642a63f3802a792, 456, "orenoimouto_download_frame", }, // Ore no Imouto ga Konnani Kawaii Wake ga Nai { 0x56c9929e8c8c5768, 24, "fabsf", }, { 0x572b2d9e57e6e363, 788, "memcpy_thingy", }, + { 0x573b69fc56d689a7, 216, "atvoffroadfuryblazintrails_download_frame", }, // ATV Offroad Fury Blazin' Trails (US) { 0x580200b840b47c58, 1856, "_realloc_r", }, { 0x5961f681bbd69035, 28, "vfad_q", }, { 0x598b91c64cf7e036, 2388, "qsort", }, From 05612bbc255c5b9c4bc4472bb248d8d7ddc64c03 Mon Sep 17 00:00:00 2001 From: daniel229 Date: Sun, 3 Jan 2016 22:28:38 +0800 Subject: [PATCH 3/5] Replace function in Little Busters! Converted Edition --- 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 facdb57f27..617b173d72 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -1061,6 +1061,15 @@ static int Hook_atvoffroadfuryblazintrails_download_frame() { return 0; } +static int Hook_littlebustersce_download_frame() { + const u32 fb_address = currentMIPS->r[MIPS_REG_A0]; + if (Memory::IsVRAMAddress(fb_address)) { + gpu->PerformMemoryDownload(fb_address, 0x00088000); + CBreakPoints::ExecMemCheck(fb_address, true, 0x00088000, currentMIPS->pc); +} + return 0; +} + #ifdef ARM #define JITFUNC(f) (&MIPSComp::ArmJit::f) #elif defined(ARM64) @@ -1160,6 +1169,7 @@ static const ReplacementTableEntry entries[] = { { "sdgundamggenerationportable_download_frame", &Hook_sdgundamggenerationportable_download_frame, 0, REPFLAG_HOOKENTER, 0x34 }, { "atvoffroadfurypro_download_frame", &Hook_atvoffroadfurypro_download_frame, 0, REPFLAG_HOOKENTER, }, { "atvoffroadfuryblazintrails_download_frame", &Hook_atvoffroadfuryblazintrails_download_frame, 0, REPFLAG_HOOKENTER, }, + { "littlebustersce_download_frame", &Hook_littlebustersce_download_frame, 0, REPFLAG_HOOKENTER, }, {} }; diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index e894021fc1..73713e8671 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -428,6 +428,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0xdcdf7e1c1a3dc260, 372, "strncmp", }, { 0xdcfc28e624a81bf1, 5476, "_dtoa_r", }, { 0xddfa5a85937aa581, 32, "vdot_q", }, + { 0xdeb6a583659e3948, 1080, "littlebustersce_download_frame", }, // Little Busters! Converted Edition (JP) { 0xe0214719d8a0aa4e, 104, "strstr", }, { 0xe029f0699ca3a886, 76, "matrix300_transform_by", }, { 0xe086d5c9ce89148f, 212, "bokunonatsuyasumi4_download_frame", }, // Boku no Natsuyasumi 2 and 4, From de8503f83be9174ae12f685ffe863ad1a8bef5ce Mon Sep 17 00:00:00 2001 From: daniel229 Date: Sun, 3 Jan 2016 22:35:46 +0800 Subject: [PATCH 4/5] Replace function in Shinigami to Shoujo --- 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 617b173d72..1d3da8a7f1 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -1070,6 +1070,15 @@ static int Hook_littlebustersce_download_frame() { return 0; } +static int Hook_shinigamitoshoujo_download_frame() { + const u32 fb_address = currentMIPS->r[MIPS_REG_S2]; + if (Memory::IsVRAMAddress(fb_address)) { + gpu->PerformMemoryDownload(fb_address, 0x00088000); + CBreakPoints::ExecMemCheck(fb_address, true, 0x00088000, currentMIPS->pc); + } + return 0; +} + #ifdef ARM #define JITFUNC(f) (&MIPSComp::ArmJit::f) #elif defined(ARM64) @@ -1170,6 +1179,7 @@ static const ReplacementTableEntry entries[] = { { "atvoffroadfurypro_download_frame", &Hook_atvoffroadfurypro_download_frame, 0, REPFLAG_HOOKENTER, }, { "atvoffroadfuryblazintrails_download_frame", &Hook_atvoffroadfuryblazintrails_download_frame, 0, REPFLAG_HOOKENTER, }, { "littlebustersce_download_frame", &Hook_littlebustersce_download_frame, 0, REPFLAG_HOOKENTER, }, + { "shinigamitoshoujo_download_frame", &Hook_shinigamitoshoujo_download_frame, 0, REPFLAG_HOOKENTER, 0xBC }, {} }; diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 73713e8671..80b1bc221e 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -317,6 +317,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0x92c7d2de74068c9c, 32, "vcross_t", }, { 0x93d8a275ba288b26, 32, "vdot_t", }, { 0x94c7083b64a946b4, 2028, "powf", }, + { 0x94eb1e7dccca76a4, 680, "shinigamitoshoujo_download_frame", }, // Shinigami to Shoujo (JP) { 0x95a52ce1bc460108, 2036, "_malloc_r", }, { 0x95bd33ac373c019a, 24, "fabsf", }, { 0x9705934b0950d68d, 280, "dl_write_framebuffer_ptr", }, From 1e984b48efb7c9fe9dcc3db67de61eb1fbd739d0 Mon Sep 17 00:00:00 2001 From: daniel229 Date: Mon, 4 Jan 2016 09:08:52 +0800 Subject: [PATCH 5/5] update functions --- Core/HLE/ReplaceTables.cpp | 18 ++++++++++-------- Core/MIPS/MIPSAnalyst.cpp | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index 1d3da8a7f1..74233f6a83 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -1044,19 +1044,21 @@ static int Hook_sdgundamggenerationportable_download_frame() { } static int Hook_atvoffroadfurypro_download_frame() { - const u32 fb_address = currentMIPS->r[MIPS_REG_A1]; + const u32 fb_address = currentMIPS->r[MIPS_REG_S2]; + const u32 fb_size = (currentMIPS->r[MIPS_REG_S4] >> 3) * currentMIPS->r[MIPS_REG_S3]; if (Memory::IsVRAMAddress(fb_address)) { - gpu->PerformMemoryDownload(fb_address, 0x00088000); - CBreakPoints::ExecMemCheck(fb_address, true, 0x00088000, currentMIPS->pc); + gpu->PerformMemoryDownload(fb_address, fb_size); + CBreakPoints::ExecMemCheck(fb_address, true, fb_size, currentMIPS->pc); } return 0; } static int Hook_atvoffroadfuryblazintrails_download_frame() { - const u32 fb_address = currentMIPS->r[MIPS_REG_A1]; + const u32 fb_address = currentMIPS->r[MIPS_REG_S5]; + const u32 fb_size = (currentMIPS->r[MIPS_REG_S3] >> 3) * currentMIPS->r[MIPS_REG_S2]; if (Memory::IsVRAMAddress(fb_address)) { - gpu->PerformMemoryDownload(fb_address, 0x00088000); - CBreakPoints::ExecMemCheck(fb_address, true, 0x00088000, currentMIPS->pc); + gpu->PerformMemoryDownload(fb_address, fb_size); + CBreakPoints::ExecMemCheck(fb_address, true, fb_size, currentMIPS->pc); } return 0; } @@ -1176,8 +1178,8 @@ static const ReplacementTableEntry entries[] = { { "youkosohitsujimura_download_frame", &Hook_youkosohitsujimura_download_frame, 0, REPFLAG_HOOKENTER, 0x94 }, { "tonyhawkp8_upload_tutorial_frame", &Hook_tonyhawkp8_upload_tutorial_frame, 0, REPFLAG_HOOKENTER, }, { "sdgundamggenerationportable_download_frame", &Hook_sdgundamggenerationportable_download_frame, 0, REPFLAG_HOOKENTER, 0x34 }, - { "atvoffroadfurypro_download_frame", &Hook_atvoffroadfurypro_download_frame, 0, REPFLAG_HOOKENTER, }, - { "atvoffroadfuryblazintrails_download_frame", &Hook_atvoffroadfuryblazintrails_download_frame, 0, REPFLAG_HOOKENTER, }, + { "atvoffroadfurypro_download_frame", &Hook_atvoffroadfurypro_download_frame, 0, REPFLAG_HOOKENTER, 0xA0 }, + { "atvoffroadfuryblazintrails_download_frame", &Hook_atvoffroadfuryblazintrails_download_frame, 0, REPFLAG_HOOKENTER, 0x80 }, { "littlebustersce_download_frame", &Hook_littlebustersce_download_frame, 0, REPFLAG_HOOKENTER, }, { "shinigamitoshoujo_download_frame", &Hook_shinigamitoshoujo_download_frame, 0, REPFLAG_HOOKENTER, 0xBC }, {} diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 80b1bc221e..7d39a6d36b 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -95,7 +95,6 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0x06e2826e02056114, 56, "wcslen", }, { 0x073cf0b61d3b875a, 416, "hexyzforce_monoclome_thread", }, // Hexyz Force (US) { 0x075fa9b234b41e9b, 32, "fmodf", }, - { 0x09ab0791e1da9647, 180, "atvoffroadfurypro_download_frame", }, // ATV Offroad Fury Pro (US) { 0x0a051019bdd786c3, 184, "strcasecmp", }, { 0x0a1bed70958935d2, 644, "youkosohitsujimura_download_frame", }, // Youkoso Hitsuji-Mura Portable { 0x0a46dc426054bb9d, 24, "vector_add_t", }, @@ -162,6 +161,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0x2f639673670caa0e, 772, "dl_write_matrix_2", }, { 0x2f718936b371fc44, 40, "vcos_s", }, { 0x3024e961d1811dea, 396, "fmod", }, + { 0x3050bfd0e729dfbf, 220, "atvoffroadfuryblazintrails_download_frame", }, // ATV Offroad Fury Blazin' Trails (US) { 0x30c9c4f420573eb6, 540, "expf", }, { 0x317afeb882ff324a, 212, "memcpy", }, // Mimana (US) { 0x31ea2e192f5095a1, 52, "vector_add_t", }, @@ -227,7 +227,6 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0x5642a63f3802a792, 456, "orenoimouto_download_frame", }, // Ore no Imouto ga Konnani Kawaii Wake ga Nai { 0x56c9929e8c8c5768, 24, "fabsf", }, { 0x572b2d9e57e6e363, 788, "memcpy_thingy", }, - { 0x573b69fc56d689a7, 216, "atvoffroadfuryblazintrails_download_frame", }, // ATV Offroad Fury Blazin' Trails (US) { 0x580200b840b47c58, 1856, "_realloc_r", }, { 0x5961f681bbd69035, 28, "vfad_q", }, { 0x598b91c64cf7e036, 2388, "qsort", }, @@ -253,6 +252,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0x6962da85a6dad937, 60, "strrchr", }, { 0x69a3c4f774859404, 64, "vmmul_q_transp2", }, { 0x6ab54910104ef000, 628, "sd_gundam_g_generation_download_frame", }, // SD Gundam G Generation World + { 0x6ac2cd44e042592b, 252, "atvoffroadfurypro_download_frame", }, // ATV Offroad Fury Pro (US) { 0x6b022e20ee3fa733, 68, "__negdf2", }, { 0x6b2a6347c0dfcb57, 152, "strcpy", }, { 0x6b4148322c569cb3, 240, "wmemchr", },