Emulator Issues #11952
Regression in launching Gamecube games from Wii Menu
The Legend of Zelda: The Wind Waker
Possibly affects other games.
Game ID? GZLE01
MD5 Hash? d8e4d45af2032a081a0f446384e9261b
What's the problem? Describe what went wrong.
Dolphin crashes with "IntCPU: Unknown instruction 00000000 at PC = 803a6f80 last_PC = 81301020 LR = 803a6f80" when launching Wind Waker from the emulated wii menu.
What steps will reproduce the problem?
Launch Wind Waker from the emulated wii menu.
Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.
Is the issue present in the latest stable version?
Latest stable doesn't support MIOS.
If the issue isn't present in the latest stable version, which is the first broken version? First broken version was 5.0-3301
What are your PC specifications? (CPU, GPU, Operating System, more)
Doesn't work on both my systems, under both Linux and Windows.
One has an i5-2320 + GTX560Ti, the other is an i5-7200U + GTX950M.
Sounds like MIOS isn't working. It patches certain games that would crash on a Wii vs GC. Is your Wind Waker modified in any way, such as being off region for the System Menu?
No, this is the original US iso (the hash indicates it's a correct dump), and running on a fresh 4.3U System Menu install.
This is caused by https://github.com/dolphin-emu/dolphin/pull/8394
All the gamecube titles I tested crash Dolphin when run via MIOS.
5.0-3297 works yet 3301 doesn't so this is probably another issue. I do have some games like melee that launch correctly even on the latest build, but WW and Super Mario Strikers fail (though Strikers issue is maybe unrelated to the change in 3301?)
5.0-3301 does sound like it could break something like this - https://dolphin-emu.org/download/dev/9d070a5df79a7f34dc4936855da36a333803fa12/
I may be wrong, but the issue seems to stem from the patch @ Gecko::ENTRY_POINT (0x1800 + 0xA8) in PatchFixedFunctions. MIOS installs a hook at this location. On previous versions this wasn't a big deal because the MIOS hook was installed then not touched again, but since this version, this patch is applied after MIOS was run and overwrite its hook, as the call to UpdateRunningGame in MIOS.cpp cause the patches to be applied again.
I was able to reproduce this issue by editing the header of Paper Mario TTYD to GZLE01 and then launching it via the system menu.
MIOS does one set of patches (which all involve copying functions to 80001800, 80001840, 80001940, and 80002200, plus some game patch stuff) for GZL/GSR/PZL, and another set for GT3P/GT3F/GT3D. It also has distinct patches for each of GC6J/GC6E/GC6P, and for GPOJ v5; all of these patch the game and also copy a function to 80002200. There's also some strict-looking checks made on GNHE, but I can't quite tell how they work. (For the record, as was mentioned in IRC, MIOS does not do any patching for DTK; the system menu just enables DTK more or less normally.)
I only experienced crashes when using GZLE or GT3P, and didn't experience any for GC6E or GPOJ. I did get a unknown GFX fifo unknown opcode warning with GC6E, but I suspect that's just a side effect of patching the wrong game.
The responsible patch does seem to be the one at
Gecko::ENTRY_POINT (800018A8), as commenting out that patch stops the crash. The patch modifies 80001800 to be D01F1BAD which decodes to
stfs f0,0x1BAE(r31), instead of the original 9421FFD8
stwu sp, -0x0028(sp), and that seems to be the source of the issue, but I don't fully understand what's going on or how that should be fixed.