From 0e7c4fef8b0f21caad305023779b1c30a4d8529f Mon Sep 17 00:00:00 2001 From: otavepto <153766569+otavepto@users.noreply.github.com> Date: Sat, 8 Jun 2024 18:04:36 +0300 Subject: [PATCH] clear achievement progress in `Steam_User_Stats::ResetAllStats()` --- CHANGELOG.md | 6 +++++- dll/steam_user_stats.cpp | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 345d4aed..bdac8565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,6 @@ you can disable the achievement progress notifications via `disable_achievement_progress` inside `configs.overlay.ini` * **[schmurger]** implemented the function `Steam_User_Stats::GetAchievementProgressLimits()` * **[Detanup01]** added missing interfaces `ISteamScreenshot` `v001` and `v002` + fixed lots of build warnings in Visual Studio -* initial support for building with `MSYS2` on Windows, this is still highly experimental and not everything might work as expected, for example the overlay will crash at runtime * third-party dependencies could now be built with a `premake` script, offering more flexibility. for example you can choose to extract or build certain libraries only @@ -16,6 +15,9 @@ --- +* initial support for building with `MSYS2` on Windows, this is still highly experimental and **non-functional** + the original SDK is created as `MSVC` library, and all games on Windows link with it. + MinGW toolchain has a completely different ABI and the output binary will **not work**, this is more of tech demo at the moment * enable controller support by default for the regular emu build * fixed an old buffer overrun bug in `Steam_User_Stats::UpdateAvgRateStat()` * fixed an old bug in the shutdown functions, now they will refuse incorrect requests like the original API library, solving a crash in some games @@ -29,6 +31,8 @@ * corrected callback vs call result in `Steam_Apps::RequestAllProofOfPurchaseKeys()` * added new button to the overlay `toggle user info` to show/hide user info, also + make user info hidden by default * made all overlay popups toggleable, clicking its button another time will hide or show the popup, depending on its previous state +* allow `Steam_User_Stats::ClearAchievement()` to reflect the status in the overlay +* the emu will now close and generate a file called `EMU_MISSING_INTERFACE.txt` (beside the library) if an app requested a missing interface * deprecated and removed the special Git branches `ci-build-*`, they were intended for automation but no longer maintained --- diff --git a/dll/steam_user_stats.cpp b/dll/steam_user_stats.cpp index 1b8a491d..28bbd760 100644 --- a/dll/steam_user_stats.cpp +++ b/dll/steam_user_stats.cpp @@ -1330,12 +1330,22 @@ bool Steam_User_Stats::ResetAllStats( bool bAchievementsToo ) if (bAchievementsToo) { bool needs_disk_write = false; - for (auto &item : user_achievements) { - // assume "earned" is true in case the json obj exists, but the key is absent - if (item.value("earned", true) == true) needs_disk_write = true; + for (auto &kv : user_achievements.items()) { + try { + auto &name = kv.key(); + auto &item = kv.value(); + // assume "earned" is true in case the json obj exists, but the key is absent + if (item.value("earned", true) == true) needs_disk_write = true; - item["earned"] = false; - item["earned_time"] = 0; + item["earned"] = false; + item["earned_time"] = static_cast(0); + item["progress"] = static_cast(0); + item["max_progress"] = static_cast(0); + + overlay->AddAchievementNotification(name, item, false); + } catch(const std::exception& e) { + PRINT_DEBUG("ERROR: %s", e.what()); + } } if (needs_disk_write) save_achievements();