From 227b864ebf21319a3031b4914bd4fc69826b6f58 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Sun, 26 May 2024 00:54:48 +0300 Subject: [PATCH] Fix crash when using PV IDs above 32767 with MM+ UI. Co-authored-by: korenkonder --- Source/DivaModLoader/PvLoader.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/DivaModLoader/PvLoader.cpp b/Source/DivaModLoader/PvLoader.cpp index d6b10ad..a91c64b 100644 --- a/Source/DivaModLoader/PvLoader.cpp +++ b/Source/DivaModLoader/PvLoader.cpp @@ -73,6 +73,13 @@ void PvLoader::init() WRITE_MEMORY(0x140580860, uint8_t, 0x90, 0x90, 0x90, 0xEB); WRITE_MEMORY(0x140580883, uint8_t, 0x90, 0x90, 0x90, 0xEB); + // Prevent truncation to u16 when using MM+ UI, there's enough space for an u32 since the next element is 4 byte aligned + WRITE_NOP(0x1406DE563, 1); + WRITE_NOP(0x1406DEA21, 1); + WRITE_NOP(0x1406DEA28, 3); + WRITE_MEMORY(0x1406DF6F4, uint8_t, 0x90, 0x8B); + WRITE_NOP(0x1406DF748, 1); + // Scan the pv_db file before reading it to not waste time looking for entries that don't exist in the file WRITE_CALL(originalPvLoaderParseStart, implOfPvLoaderParseStart); WRITE_NOP(reinterpret_cast(originalPvLoaderParseStart) + 0xC, 0x3);