New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BS2Emu: Stop clearing the RTC flags #10257
Conversation
The system menu does clear the RTC flags, but we currently aren't updating the cache file, and since we clear them the system menu doesn't know to update the cache either. This means that launching a game via the system menu, and then launching a game directly and exiting via HOME will result in the system menu using an outdated cache and displaying the old game. This causes it to fail to launch the game on the disc channel (since it doesn't match the cache), resulting in it resetting (though it will ignore the cache after resetting). Not clearing the cache avoids this issue.
|
Oh that's an extremely long-standing issue, good find. |
|
It's worth noting that the issue was partially fixed by #8394 - that implemented the RTC flag system, and set it when discs were changed. After it was merged, using "change disc" while a game was running (or while a channel was running, more commonly) would correctly result in the system menu clearing the cache. But I guess I never thought of the more common case of launching a game directly and then never touching "change disc" but instead going directly to the wii menu. |
|
What's the downside to not clearing the flags? Does anything else break? |
|
The downside is that the system menu will always think that the disc changed, even if you used the same disc. But that is more due to how dolphin sets the flag in the first place; it doesn't keep track of what disc is inserted across runs, so each time it's as if the disc was inserted right before emulation started (even if using the default disc function), which sets the flag. Clearing the flag and updating the cache file would be slightly preferable (but somewhat complicated), while not clearing the flag and not updating the cache (which is what this PR does) is fine too (at least if I recall correctly). Clearing the flag without updating the cache (the old behavior) is just a bad idea and not something that can happen on console. |
|
That's pretty small as far as downsides go. |
|
Yeah, that seems fairly safe. |
|
I guess it's worth also adding that in either case, with how dolphin currently works, launching the system menu directly won't use the disc cache (since the flags are still set in that case, and are always set due to the disc being immediately inserted on startup). If you launch a game via the system menu, and then exit back to the system menu without changing discs, the cache will still be used properly. And the cache will also be used properly after this PR if you launch a game directly, then go to the system menu (which will not use the cache), then launch the game from the system menu, and then go back to the system menu again (which will now use the cache). On a real console, you generally can't launch a game without going through the system menu, but if you were to do so you would run into the same behavior of the cache not being updated and the flag not being cleared. |
|
Oh, I did forget one other thing: games actually do look at the RTC flags, but only in OSShutdownSystem/OSRebootSystem/OSReturnToMenu, and only to update state.dat. The use in games is the reason why I know they are called the RTC flags: debug symbols give the names One other oddity is that if the eject flag is set when the system menu launches, it will eject the disc and then shut down. This normally happens if the console is turned on by pressing the eject button (though bootmii as boot2 can make it a bit weirder). However, the code in OSReturnToMenu means that this flag is cleared when exiting games, so there's no problem here. |
The system menu does clear the RTC flags, but we currently aren't updating the cache file, and since we clear them the system menu doesn't know to update the cache either. This means that launching a game via the system menu, and then launching a game directly and exiting via HOME will result in the system menu using an outdated cache and displaying the old game. This causes it to fail to launch the game on the disc channel (since it doesn't match the cache), resulting in it resetting (though it will ignore the cache after resetting). Not clearing the cache avoids this issue.