From e36f894f666e8e477c94be91391c6e4b98a81841 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 5 Oct 2019 08:37:18 -0700 Subject: [PATCH] HLE: Replace Motorstorm pixel read func. Helps with some lighting, see #12363. --- 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 e64adef5fa..a1d9e25e5c 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -1230,6 +1230,15 @@ static int Hook_starocean_clear_framebuf_after() { return 0; } +static int Hook_motorstorm_pixel_read() { + u32 fb_address = Memory::Read_U32(currentMIPS->r[MIPS_REG_A0] + 0x18); + u32 fb_height = Memory::Read_U16(currentMIPS->r[MIPS_REG_A0] + 0x26); + u32 fb_stride = Memory::Read_U16(currentMIPS->r[MIPS_REG_A0] + 0x28); + gpu->PerformMemoryDownload(fb_address, fb_height * fb_stride); + CBreakPoints::ExecMemCheck(fb_address, true, fb_height * fb_stride, currentMIPS->pc); + return 0; +} + #define JITFUNC(f) (&MIPSComp::MIPSFrontendInterface::f) // Can either replace with C functions or functions emitted in Asm/ArmAsm. @@ -1341,6 +1350,7 @@ static const ReplacementTableEntry entries[] = { { "marvelalliance1_copy", &Hook_marvelalliance1_copy_after, 0, REPFLAG_HOOKENTER, 0x69c }, { "starocean_clear_framebuf", &Hook_starocean_clear_framebuf_before, 0, REPFLAG_HOOKENTER, 0 }, { "starocean_clear_framebuf", &Hook_starocean_clear_framebuf_after, 0, REPFLAG_HOOKEXIT, 0 }, + { "motorstorm_pixel_read", &Hook_motorstorm_pixel_read, 0, REPFLAG_HOOKENTER, 0 }, {} }; diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 7a3459f808..9b951848be 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -175,6 +175,7 @@ static const HardHashTableEntry hardcodedHashes[] = { { 0x3024e961d1811dea, 396, "fmod", }, { 0x3050bfd0e729dfbf, 220, "atvoffroadfuryblazintrails_download_frame", }, // ATV Offroad Fury Blazin' Trails (US) { 0x30c9c4f420573eb6, 540, "expf", }, + { 0x311779b4db21dbf3, 124, "motorstorm_pixel_read" }, // Motorstorm Arctic Edge (US) { 0x317afeb882ff324a, 212, "memcpy", }, // Mimana (US) { 0x31ea2e192f5095a1, 52, "vector_add_t", }, { 0x31f523ef18898e0e, 420, "logf", },