mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-20 01:01:40 +00:00
Configurable MEM1 and MEM2 sizes at runtime via Dolphin.ini
Changed several enums from Memmap.h to be static vars and implemented Get functions to query them. This seems to have boosted speed a bit in some titles? The new variables and some previously statically initialized items are now initialized via Memory::Init() and the new AddressSpace::Init(). s_ram_size_real and the new s_exram_size_real in particular are initialized from new OnionConfig values "MAIN_MEM1_SIZE" and "MAIN_MEM2_SIZE", only if "MAIN_RAM_OVERRIDE_ENABLE" is true. GUI features have been added to Config > Advanced to adjust the new OnionConfig values. A check has been added to State::doState to ensure savestates with memory configurations different from the current settings aren't loaded. The STATE_VERSION is now 115. FIFO Files have been updated from version 4 to version 5, now including the MEM1 and MEM2 sizes from the time of DFF creation. FIFO Logs not using the new features (OnionConfig MAIN_RAM_OVERRIDE_ENABLE is false) are still backwards compatible. FIFO Logs that do use the new features have a MIN_LOADER_VERSION of 5. Thanks to the order of function calls, FIFO logs are able to automatically configure the new OnionConfig settings to match what is needed. This is a bit hacky, though, so I also threw in a failsafe for if the conditions that allow this to work ever go away. I took the liberty of adding a log message to explain why the core fails to initialize if the MIN_LOADER_VERSION is too great. Some IOS code has had the function "RAMOverrideForIOSMemoryValues" appended to it to recalculate IOS Memory Values from retail IOSes/apploaders to fit the extended memory sizes. Worry not, if MAIN_RAM_OVERRIDE_ENABLE is false, this function does absolutely nothing. A hotfix in DolphinQt/MenuBar.cpp has been implemented for RAM Override.
This commit is contained in:
parent
116cef572b
commit
cc858c63b8
27 changed files with 487 additions and 133 deletions
|
@ -30,6 +30,7 @@
|
|||
#include "Core/CoreTiming.h"
|
||||
#include "Core/GeckoCode.h"
|
||||
#include "Core/HW/HW.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/HW/Wiimote.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Movie.h"
|
||||
|
@ -73,7 +74,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
|
|||
static std::thread g_save_thread;
|
||||
|
||||
// Don't forget to increase this after doing changes on the savestate system
|
||||
constexpr u32 STATE_VERSION = 114; // Last changed in PR 8394
|
||||
constexpr u32 STATE_VERSION = 115; // Last changed in PR 8722
|
||||
|
||||
// Maps savestate versions to Dolphin versions.
|
||||
// Versions after 42 don't need to be added to this list,
|
||||
|
@ -171,6 +172,24 @@ static void DoState(PointerWrap& p)
|
|||
return;
|
||||
}
|
||||
|
||||
// Check to make sure the emulated memory sizes are the same as the savestate
|
||||
u32 state_mem1_size = Memory::GetRamSizeReal();
|
||||
u32 state_mem2_size = Memory::GetExRamSizeReal();
|
||||
p.Do(state_mem1_size);
|
||||
p.Do(state_mem2_size);
|
||||
if (state_mem1_size != Memory::GetRamSizeReal() || state_mem2_size != Memory::GetExRamSizeReal())
|
||||
{
|
||||
OSD::AddMessage(fmt::format("Memory size mismatch!\n"
|
||||
"Current | MEM1 {:08X} ({:3}MB) MEM2 {:08X} ({:3}MB)\n"
|
||||
"State | MEM1 {:08X} ({:3}MB) MEM2 {:08X} ({:3}MB)",
|
||||
Memory::GetRamSizeReal(), Memory::GetRamSizeReal() / 0x100000U,
|
||||
Memory::GetExRamSizeReal(), Memory::GetExRamSizeReal() / 0x100000U,
|
||||
state_mem1_size, state_mem1_size / 0x100000U, state_mem2_size,
|
||||
state_mem2_size / 0x100000U));
|
||||
p.SetMode(PointerWrap::MODE_MEASURE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Movie must be done before the video backend, because the window is redrawn in the video backend
|
||||
// state load, and the frame number must be up-to-date.
|
||||
Movie::DoState(p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue