Core: Fix RAM override setup in IOS.

This is a correction for 0cab1731d6 (part of #14665), where it was
overlooked that the condition to enable the RAM override was flawed: if
the user had enabled the emulated memory size override in Dolphin, but
the running game did not define a simulated memory size greater than the
retail memory size, the RAM override in IOS was wrongly misconfigured,
causing issues with Wii games.

Test plan:

- Launch Dolphin.
- In the **Settings > Advanced** section, tick the **Enable Emulated
  Memory Size Override** check box, and set the maximum memory size for
  both **MEM1** and **MEM2** (i.e. 64 MiB and 128 MiB respectively).
- Play any Wii game (e.g. _Mario Kart Wii_ (RMCE01)).

**Without** the patch, the emulator will hit an invalid read from
`0x83FEE78C` at `0x8019FE6C`:

<img alt="Invalid read when starting Wii game after having enabled the emulated memory override in Dolphin" title="Invalid read when starting Wii game after having enabled the emulated memory override in Dolphin" src="https://github.com/user-attachments/assets/1777485e-a421-4303-8d3d-dd49f1aaa9bf" />

**With** the patch, the emulator can execute the game as usual.
This commit is contained in:
cristian64
2026-09-15 20:53:31 +01:00
parent 9611279be5
commit 2039b5524e
+1 -1
View File
@@ -221,7 +221,7 @@ static void ReleasePPCAncast(Core::System& system)
void RAMOverrideForIOSMemoryValues(Memory::MemoryManager& memory, MemorySetupType setup_type)
{
// Don't touch anything if the feature isn't enabled.
if (!Config::Get(Config::MAIN_RAM_OVERRIDE_ENABLE) ||
if (!Config::Get(Config::MAIN_RAM_OVERRIDE_ENABLE) &&
SConfig::GetInstance().GetSimulatedMemorySize() <= Memory::MEM1_SIZE_RETAIL)
{
return;