mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-28 12:58:05 +03:00
Merge pull request #13514 from LillyJadeKatrin/retroachievements-failed-load-bug
Call AchievementManager CloseGame on load failures
This commit is contained in:
commit
741ffc3114
1 changed files with 19 additions and 16 deletions
|
@ -717,27 +717,27 @@ void AchievementManager::CloseGame()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard lg{m_lock};
|
std::lock_guard lg{m_lock};
|
||||||
|
m_active_challenges.clear();
|
||||||
|
m_active_leaderboards.clear();
|
||||||
|
m_game_badge.width = 0;
|
||||||
|
m_game_badge.height = 0;
|
||||||
|
m_game_badge.data.clear();
|
||||||
|
m_unlocked_badges.clear();
|
||||||
|
m_locked_badges.clear();
|
||||||
|
m_leaderboard_map.clear();
|
||||||
|
m_rich_presence.fill('\0');
|
||||||
|
m_queue.Cancel();
|
||||||
|
m_image_queue.Cancel();
|
||||||
|
m_system.store(nullptr, std::memory_order_release);
|
||||||
|
if (Config::Get(Config::RA_DISCORD_PRESENCE_ENABLED))
|
||||||
|
Discord::UpdateDiscordPresence();
|
||||||
if (rc_client_get_game_info(m_client))
|
if (rc_client_get_game_info(m_client))
|
||||||
{
|
{
|
||||||
m_active_challenges.clear();
|
|
||||||
m_active_leaderboards.clear();
|
|
||||||
m_game_badge.width = 0;
|
|
||||||
m_game_badge.height = 0;
|
|
||||||
m_game_badge.data.clear();
|
|
||||||
m_unlocked_badges.clear();
|
|
||||||
m_locked_badges.clear();
|
|
||||||
m_leaderboard_map.clear();
|
|
||||||
m_rich_presence.fill('\0');
|
|
||||||
rc_api_destroy_fetch_game_data_response(&m_game_data);
|
rc_api_destroy_fetch_game_data_response(&m_game_data);
|
||||||
m_game_data = {};
|
|
||||||
m_queue.Cancel();
|
|
||||||
m_image_queue.Cancel();
|
|
||||||
rc_client_unload_game(m_client);
|
rc_client_unload_game(m_client);
|
||||||
m_system.store(nullptr, std::memory_order_release);
|
|
||||||
if (Config::Get(Config::RA_DISCORD_PRESENCE_ENABLED))
|
|
||||||
Discord::UpdateDiscordPresence();
|
|
||||||
INFO_LOG_FMT(ACHIEVEMENTS, "Game closed.");
|
|
||||||
}
|
}
|
||||||
|
INFO_LOG_FMT(ACHIEVEMENTS, "Game closed.");
|
||||||
|
m_game_data = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
m_update_callback(UpdatedItems{.all = true});
|
m_update_callback(UpdatedItems{.all = true});
|
||||||
|
@ -984,6 +984,7 @@ void AchievementManager::LoadGameCallback(int result, const char* error_message,
|
||||||
OSD::Duration::VERY_LONG, OSD::Color::RED);
|
OSD::Duration::VERY_LONG, OSD::Color::RED);
|
||||||
OSD::AddMessage("Please update Dolphin to a newer version.", OSD::Duration::VERY_LONG,
|
OSD::AddMessage("Please update Dolphin to a newer version.", OSD::Duration::VERY_LONG,
|
||||||
OSD::Color::RED);
|
OSD::Color::RED);
|
||||||
|
instance.CloseGame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (result != RC_OK)
|
if (result != RC_OK)
|
||||||
|
@ -997,6 +998,7 @@ void AchievementManager::LoadGameCallback(int result, const char* error_message,
|
||||||
rc_client_set_read_memory_function(instance.m_client, MemoryPeeker);
|
rc_client_set_read_memory_function(instance.m_client, MemoryPeeker);
|
||||||
instance.m_system.store(&Core::System::GetInstance(), std::memory_order_release);
|
instance.m_system.store(&Core::System::GetInstance(), std::memory_order_release);
|
||||||
}
|
}
|
||||||
|
instance.CloseGame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1006,6 +1008,7 @@ void AchievementManager::LoadGameCallback(int result, const char* error_message,
|
||||||
ERROR_LOG_FMT(ACHIEVEMENTS, "Failed to retrieve game information from client.");
|
ERROR_LOG_FMT(ACHIEVEMENTS, "Failed to retrieve game information from client.");
|
||||||
OSD::AddMessage("Failed to load achievements for this title.", OSD::Duration::VERY_LONG,
|
OSD::AddMessage("Failed to load achievements for this title.", OSD::Duration::VERY_LONG,
|
||||||
OSD::Color::RED);
|
OSD::Color::RED);
|
||||||
|
instance.CloseGame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
INFO_LOG_FMT(ACHIEVEMENTS, "Loaded data for game ID {}.", game->id);
|
INFO_LOG_FMT(ACHIEVEMENTS, "Loaded data for game ID {}.", game->id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue