From a2a577273168f80f29a92e9def2141d4a9fea39d Mon Sep 17 00:00:00 2001 From: Nikhil Narayana Date: Mon, 22 Nov 2021 20:31:19 -0800 Subject: [PATCH] https://github.com/project-slippi/Ishiiruka/pull/232 --- Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp | 3 +++ Source/Core/Core/Slippi/SlippiSavestate.cpp | 14 ++++++++++++-- Source/Core/Core/Slippi/SlippiSavestate.h | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp index 63131ef617..c2353c4ab2 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp @@ -113,6 +113,9 @@ CEXISlippi::CEXISlippi() // Initialize local selections to empty localSelections.Reset(); + // Forces savestate to re-init regions when a new ISO is loaded + SlippiSavestate::shouldForceInit = true; + // Update user file and then listen for User #ifndef IS_PLAYBACK user->ListenForLogIn(); diff --git a/Source/Core/Core/Slippi/SlippiSavestate.cpp b/Source/Core/Core/Slippi/SlippiSavestate.cpp index 66b02428f3..d40e46a8b8 100644 --- a/Source/Core/Core/Slippi/SlippiSavestate.cpp +++ b/Source/Core/Core/Slippi/SlippiSavestate.cpp @@ -12,6 +12,9 @@ #include "Core/HW/ProcessorInterface.h" #include "Core/HW/SI/SI.h" #include "Core/HW/VideoInterface.h" +#include "Core/PowerPC/PowerPC.h" + +bool SlippiSavestate::shouldForceInit; SlippiSavestate::SlippiSavestate() { @@ -52,8 +55,9 @@ void SlippiSavestate::initBackupLocs() // Full Unknown Region: [804fec00 - 80BD5C40) // https://docs.google.com/spreadsheets/d/16ccNK_qGrtPfx4U25w7OWIDMZ-NxN1WNBmyQhaDxnEg/edit?usp=sharing - {0x8065c000, 0x8071b000, nullptr}, // Unknown Region Pt1 - {0x80bb0000, 0x811AD5A0, nullptr}, // Unknown Region Pt2, Heap [80bd5c40 - 811AD5A0) + {0x8065c000, 0x8071b000, nullptr}, // Unknown Region Pt1. Maybe get the low bound pointer at + // 804d5c10 and the size of the audio heap at 804d5e18 + {0x0, 0x0, nullptr}, // Unknown Region Pt2, Heap [80bd5c40 - 811AD5A0). }; static std::vector excludeSections = { @@ -104,6 +108,12 @@ void SlippiSavestate::initBackupLocs() return; } + // Get Main Heap Boundaries + fullBackupRegions[3].startAddress = PowerPC::HostRead_U32(0x804d76b8); + fullBackupRegions[3].endAddress = PowerPC::HostRead_U32(0x804d76bc); + WARN_LOG(SLIPPI_ONLINE, "Heap start is: 0x%X", fullBackupRegions[3].startAddress); + WARN_LOG(SLIPPI_ONLINE, "Heap end is: 0x%X", fullBackupRegions[3].endAddress); + // Sort exclude sections std::sort(excludeSections.begin(), excludeSections.end(), cmpFn); diff --git a/Source/Core/Core/Slippi/SlippiSavestate.h b/Source/Core/Core/Slippi/SlippiSavestate.h index 30001129ff..f0ef5ddd91 100644 --- a/Source/Core/Core/Slippi/SlippiSavestate.h +++ b/Source/Core/Core/Slippi/SlippiSavestate.h @@ -26,6 +26,8 @@ public: void Capture(); void Load(std::vector blocks); + static bool shouldForceInit; + private: typedef struct {