Add DoState to AchievementManager

While state loading is not allowed in the hardcore mode that most players will use, it is allowed in softcore mode; more importantly, if something fails to unlock or unlocks when it shouldn't in either mode the player can create a save that retains the current achievement state.
This commit is contained in:
LillyJadeKatrin
2024-02-16 14:25:04 -05:00
parent 70116b222d
commit 0627209131
3 changed files with 47 additions and 1 deletions

View File

@ -98,7 +98,7 @@ static size_t s_state_writes_in_queue;
static std::condition_variable s_state_write_queue_is_empty;
// Don't forget to increase this after doing changes on the savestate system
constexpr u32 STATE_VERSION = 167; // Last changed in PR 12494
constexpr u32 STATE_VERSION = 168; // Last changed in PR 12639
// Increase this if the StateExtendedHeader definition changes
constexpr u32 EXTENDED_HEADER_VERSION = 1; // Last changed in PR 12217
@ -198,6 +198,10 @@ static void DoState(Core::System& system, PointerWrap& p)
p.DoMarker("Wiimote");
Gecko::DoState(p);
p.DoMarker("Gecko");
#ifdef USE_RETRO_ACHIEVEMENTS
AchievementManager::GetInstance().DoState(p);
#endif // USE_RETRO_ACHIEVEMENTS
}
void LoadFromBuffer(Core::System& system, std::vector<u8>& buffer)