Retroachievements hardcore v2
This is a portion of an integration with the RetroAchievements tools and libraries for connecting to the website, downloading data, unlocking achievements and submitting to leaderboards for games running in Dolphin. In this PR, I add a switch for Hardcore Mode, which RetroAchievements uses as a marker that the player performs achievements and leaderboards in as similar of a configuration to the native hardware as possible. As such, this disables several emulator features that would give players an unusual advantage over the native hardware, such as the ability to load savestates, slow down the emulator speed, bypass visual restrictions, examine/modify memory, or apply cheats. This is the second version of this PR, replacing the original at https://github.com/dolphin-emu/dolphin/pull/11882 due to the extensive nature of the change requested.
I believe speeding up the game should also be disabled. Not only could it enable glitches that would otherwise not be possible, any achievements that are based on patience will no longer be a challenge; not saying that it would be a fun experience or a good achievement trigger. Honestly, restricting the slowdown feature but not the speedup feature just seems arbitrary.
That's actually RetroAchievements policy to allow turbo specifically to avoid achievements being too tedious (for example, there's enough achievements for the original Final Fantasy to require it to be played to completion at minimum seven times), though I'm curious what kind of glitches you're referring to.
That's actually RetroAchievements policy to allow turbo specifically to avoid achievements being too tedious (for example, there's enough achievements for the original Final Fantasy to require it to be played to completion at minimum seven times), though I'm curious what kind of glitches you're referring to.
If it's their policy, then that's that. The glitches were just me speculating.
Speeding up emulation can't cause any emulation glitches (unless you're using dual core, in which case you can get emulation glitches at potentially any speed if your computer happens to lag at the wrong time).
I played with this a little bit, some notes:
- The Cheat Search in Tools -> Cheats Manager still works even in Hardcore mode. Probably should disable that one, you can use it as a makeshift memory viewer.
- As long as we don't have a list of allowed Patches you should probably just disable the whole system while Hardcore is active. We should improve that later, but it's better to not have an official Dolphin build out there where you can have both that and Hardcore active at the same time.
- The TAS Input window (Movie -> TAS Input) should probably be disabled too.
- Setting the Speed Limit to Unlimited results in a message that the minimum speed is 100%. That should probably be allowed.
- You may or may not want to disable CPU overclock and RAM size overrides? Not sure on that one.
- I find it really weird that you have this protection against cheating but you can just load whatever save files you want. I don't see any protection against this in other emulators either so I guess it's fine but I dunno, feels odd to me.
- Will do.
- Fair, somehow I thought that was baked into cheats, will do.
- I can do this but I would like to know what it is TAS Input does so I know why it should be disallowed.
- I'll investigate this but there's probably around a 95% chance that Unlimited is perfectly allowed, it's just bugging on the actual messaging, I'll double check.
- I highly doubt RAM size needs to be disabled for hardcore - while we use "similar to hardware" as a guideline I don't see how a performance boost would necessarily make a game easier, unless you're suggesting decreasing RAM to strangle AI which ... yeah that seems like a stretch. Would overclocking the CPU provide much of an advantage either? Like, just because a game is performing better doesn't translate into the player performing better, I think these are both obscure enough to not bother with. I can check with RA though.
- Loading save states are definitely not allowed. If you're talking about loading in-game saves however, RA devs are actually trained to protect against save files to the best of their ability. It's not perfect, it never is, but if there's enough confidence that the player can't just immediately load an in-game save file and immediately unlock things, then they tend to consider that sufficient - shorter achievements tend to require the player to achieve the entire thing in a single live session without the save file ever coming into play; longer achievements will only trigger upon the specific action taking place so a player can't just load a 120 star file and unlock the 120 star achievement, they need to at least collect the 120th star in an active session.
TAS Input allows you to manually set the exact controller state for every frame. It's used for, well, TASing.
Yeah okay I'll disable that.
I'm not very familiar with how the RetroAchievements integration works, so I'd like to ask: Is there anything stopping you from opening the Homebrew Channel, launching Gecko OS and starting the game with cheats like it's 2009?
Currently no, but after talking with you in DM I'll be creating a separate bugfix PR to shut down RetroAchievements if the game metadata changes after booting, as even outside of hardcore mode that would completely destroy any ability to calculate runtime status.
Currently no, but after talking with you in DM I'll be creating a separate bugfix PR to shut down RetroAchievements if the game metadata changes after booting, as even outside of hardcore mode that would completely destroy any ability to calculate runtime status.
Step one in this direction is here: https://github.com/dolphin-emu/dolphin/pull/12036 Step two will utilize this to create a deep copy of the volume within DVDInterface::SetDisc and other places and pass that to AchievementManager for hashing, thus connecting AchievementManager game load and game close to the points in Dolphin code where the currently running software is changed.
Discussed with JosJuice but it appears that, especially with the pending changes to when and where RA opens and closes game data, Riivolution patches will automatically be hashed with the disc and thus will be disabled unless RA explicitly enables them via the site. Action Replay patches are already blocked under the Cheats banner, so to my knowledge I only need to disable memory patches.
I think you've missed an important distinction: Riivolution patches can patch files on the disc or memory. The latter type of patch, Riivolution memory patches, are not the same thing as what Dolphin simply calls "patches".
Then yes, I have. Where do Riivolution memory patches get applied? I've been looking in PatchEngine currently.
https://github.com/dolphin-emu/dolphin/blob/03661223069aab4291b65c86727b4b9711b5878b/Source/Core/DiscIO/RiivolutionPatcher.cpp#L609
[...] so to my knowledge I only need to disable memory patches.
A few games are outright broken in Dolphin without the memory patches we ship with the emulator. Any progress in how this is going to be handled? Or are those games simply going to be locked out of hardcore mode?
They'll be disabled for now but it'll be a work in progress. That said, nobody has yet told me what games and what their symptoms are.
Check the game INIs for [OnLoad] and [OnFrame], but off the top of my head:
- RE2 and 3 have broken audio without patches because their audio engine has a bug that is masked by CPU cache behavior on hardware.
- There's a few Wii games from Disney that intentionally use CPU cache behavior to not boot on Dolphin.
- Zelda Twilight Princess runs slow unless you have very good hardware due to the way they render the minimap.
There's probably a few more but that's all I remember.
Got it. Initially they'll be disabled but I'll do my research - especially if Zelda is involved, no way do we want to prevent that from having achievements.
The speed hack from Zelda TP doesn't come enabled by default as it reduces the fidelity of the mini map, also current hardware is generally powerful enough to avoid the issue even without the patch.
The other games, though, are severely hindered or simply don't work without the patches...
If you consider this a blocking problem, let me know. Otherwise, I'll get to it once I get the rest of the integration working for the games that don't require memory patches.
I played with this a little bit, some notes:
- The Cheat Search in Tools -> Cheats Manager still works even in Hardcore mode. Probably should disable that one, you can use it as a makeshift memory viewer.
- As long as we don't have a list of allowed Patches you should probably just disable the whole system while Hardcore is active. We should improve that later, but it's better to not have an official Dolphin build out there where you can have both that and Hardcore active at the same time.
- The TAS Input window (Movie -> TAS Input) should probably be disabled too.
- Setting the Speed Limit to Unlimited results in a message that the minimum speed is 100%. That should probably be allowed.
- You may or may not want to disable CPU overclock and RAM size overrides? Not sure on that one.
- I find it really weird that you have this protection against cheating but you can just load whatever save files you want. I don't see any protection against this in other emulators either so I guess it's fine but I dunno, feels odd to me.
The exact nature of what from TAS needs to be disabled in hardcore mode is still in discussion but the 1st, 2nd and 4th items on this list have now been resolved.
Speeding up emulation can't cause any emulation glitches (unless you're using dual core, in which case you can get emulation glitches at potentially any speed if your computer happens to lag at the wrong time).
In that case, should dual core be disabled in hardcore mode?
I highly doubt that's necessary. Seems like it would be one hell of a stretch for a player to manipulate that kind of glitch to their advantage.
I don't see a particular comment here that would be worthwhile linking this to so I'll leave a general comment saying that discussions about how games are booted and how roms can be swapped while playing have been split off into separate PR #12216.
Commit 2b91913286b0589a59bea726c1ce83b8d49b62c9 clearly contains more than intended.
e: Maybe not actually, but you should probably break out the UI changes from the Core changes anyway.
I would recommend changing most (maybe all?) instances of Config::Get(Config::RA_HARDCORE_ENABLED) with an indirection into the AchievementsManager. That way you can transparently re-enable the locked features when Achievements are disabled for another reason anyway, such as eg. when the game you loaded doesn't have any achievements or similar.
Regarding the ifdefs, it would probably more sensible if the AchievementsManager just always existed, but was just a dummy in the no-rcheevos case. I do think actually checking in Core makes sense so you can't slip into a disallowed function by eg. using nogui or with an obscure path we didn't catch, but also checking in the UI to actually grey out the options or produce good error messages is reasonable.
Yeah, that seems reasonable too
Regarding the ifdefs, it would probably more sensible if the AchievementsManager just always existed, but was just a dummy in the no-rcheevos case.
Now that most of the achievement work has been merged in and is near complete, I'm open to discussions about how much of the USE_RETRO_ACHIEVEMENTS ifdef could be scaled back for the long term, though undoubtedly that would be a different PR.