mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-09 00:37:50 +00:00
Compare commits
3 Commits
8ffde4ac3b
...
2ab1e6326d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2ab1e6326d | ||
![]() |
c68549e9ef | ||
![]() |
fd285f6348 |
@ -165,17 +165,26 @@ void AchievementManager::LoadGame(const DiscIO::Volume* volume)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (volume == nullptr)
|
|
||||||
{
|
|
||||||
WARN_LOG_FMT(ACHIEVEMENTS, "Called Load Game without a game.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!m_client)
|
if (!m_client)
|
||||||
{
|
{
|
||||||
ERROR_LOG_FMT(ACHIEVEMENTS,
|
ERROR_LOG_FMT(ACHIEVEMENTS,
|
||||||
"Attempted to load game achievements without achievement client initialized.");
|
"Attempted to load game achievements without achievement client initialized.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (volume == nullptr)
|
||||||
|
{
|
||||||
|
WARN_LOG_FMT(ACHIEVEMENTS, "Software format unsupported by AchievementManager.");
|
||||||
|
if (rc_client_get_game_info(m_client))
|
||||||
|
{
|
||||||
|
rc_client_begin_change_media_from_hash(m_client, "", ChangeMediaCallback, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rc_client_set_read_memory_function(m_client, MemoryVerifier);
|
||||||
|
rc_client_begin_load_game(m_client, "", LoadGameCallback, NULL);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
rc_client_set_unofficial_enabled(m_client, Config::Get(Config::RA_UNOFFICIAL_ENABLED));
|
rc_client_set_unofficial_enabled(m_client, Config::Get(Config::RA_UNOFFICIAL_ENABLED));
|
||||||
rc_client_set_encore_mode_enabled(m_client, Config::Get(Config::RA_ENCORE_ENABLED));
|
rc_client_set_encore_mode_enabled(m_client, Config::Get(Config::RA_ENCORE_ENABLED));
|
||||||
rc_client_set_spectator_mode_enabled(m_client, Config::Get(Config::RA_SPECTATOR_ENABLED));
|
rc_client_set_spectator_mode_enabled(m_client, Config::Get(Config::RA_SPECTATOR_ENABLED));
|
||||||
@ -598,11 +607,6 @@ rc_client_t* AchievementManager::GetClient()
|
|||||||
return m_client;
|
return m_client;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc_api_fetch_game_data_response_t* AchievementManager::GetGameData()
|
|
||||||
{
|
|
||||||
return &m_game_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
const AchievementManager::Badge& AchievementManager::GetGameBadge() const
|
const AchievementManager::Badge& AchievementManager::GetGameBadge() const
|
||||||
{
|
{
|
||||||
return m_game_badge.data.empty() ? m_default_game_badge : m_game_badge;
|
return m_game_badge.data.empty() ? m_default_game_badge : m_game_badge;
|
||||||
@ -736,12 +740,8 @@ void AchievementManager::CloseGame()
|
|||||||
if (Config::Get(Config::RA_DISCORD_PRESENCE_ENABLED))
|
if (Config::Get(Config::RA_DISCORD_PRESENCE_ENABLED))
|
||||||
Discord::UpdateDiscordPresence();
|
Discord::UpdateDiscordPresence();
|
||||||
if (rc_client_get_game_info(m_client))
|
if (rc_client_get_game_info(m_client))
|
||||||
{
|
|
||||||
rc_api_destroy_fetch_game_data_response(&m_game_data);
|
|
||||||
rc_client_unload_game(m_client);
|
rc_client_unload_game(m_client);
|
||||||
}
|
|
||||||
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});
|
||||||
@ -995,36 +995,30 @@ void AchievementManager::LoadGameCallback(int result, const char* error_message,
|
|||||||
OSD::Color::RED);
|
OSD::Color::RED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (result == RC_NO_GAME_LOADED && instance.m_dll_found)
|
|
||||||
|
auto* game = rc_client_get_game_info(client);
|
||||||
|
if (result == RC_OK)
|
||||||
{
|
{
|
||||||
// Allow developer tools for unidentified games
|
if (!game)
|
||||||
rc_client_set_read_memory_function(instance.m_client, MemoryPeeker);
|
{
|
||||||
instance.m_system.store(&Core::System::GetInstance(), std::memory_order_release);
|
ERROR_LOG_FMT(ACHIEVEMENTS, "Failed to retrieve game information from client.");
|
||||||
WARN_LOG_FMT(ACHIEVEMENTS, "Unrecognized title ready for development.");
|
OSD::AddMessage("Failed to load achievements for this title.", OSD::Duration::VERY_LONG,
|
||||||
OSD::AddMessage("Unrecognized title loaded for development.", OSD::Duration::VERY_LONG,
|
OSD::Color::RED);
|
||||||
OSD::Color::YELLOW);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
INFO_LOG_FMT(ACHIEVEMENTS, "Loaded data for game ID {}.", game->id);
|
||||||
|
instance.m_display_welcome_message = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (result != RC_OK)
|
else
|
||||||
{
|
{
|
||||||
WARN_LOG_FMT(ACHIEVEMENTS, "Failed to load data for current game.");
|
WARN_LOG_FMT(ACHIEVEMENTS, "Failed to load data for current game.");
|
||||||
OSD::AddMessage("Achievements are not supported for this title.", OSD::Duration::VERY_LONG,
|
OSD::AddMessage("Achievements are not supported for this title.", OSD::Duration::VERY_LONG,
|
||||||
OSD::Color::RED);
|
OSD::Color::RED);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* game = rc_client_get_game_info(client);
|
|
||||||
if (!game)
|
|
||||||
{
|
|
||||||
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::Color::RED);
|
|
||||||
instance.CloseGame();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
INFO_LOG_FMT(ACHIEVEMENTS, "Loaded data for game ID {}.", game->id);
|
|
||||||
|
|
||||||
rc_client_set_read_memory_function(instance.m_client, MemoryPeeker);
|
rc_client_set_read_memory_function(instance.m_client, MemoryPeeker);
|
||||||
instance.m_display_welcome_message = true;
|
|
||||||
instance.FetchGameBadges();
|
instance.FetchGameBadges();
|
||||||
instance.m_system.store(&Core::System::GetInstance(), std::memory_order_release);
|
instance.m_system.store(&Core::System::GetInstance(), std::memory_order_release);
|
||||||
instance.m_update_callback({.all = true});
|
instance.m_update_callback({.all = true});
|
||||||
|
@ -160,7 +160,6 @@ public:
|
|||||||
const Badge& GetPlayerBadge() const;
|
const Badge& GetPlayerBadge() const;
|
||||||
std::string_view GetGameDisplayName() const;
|
std::string_view GetGameDisplayName() const;
|
||||||
rc_client_t* GetClient();
|
rc_client_t* GetClient();
|
||||||
rc_api_fetch_game_data_response_t* GetGameData();
|
|
||||||
const Badge& GetGameBadge() const;
|
const Badge& GetGameBadge() const;
|
||||||
const Badge& GetAchievementBadge(AchievementId id, bool locked) const;
|
const Badge& GetAchievementBadge(AchievementId id, bool locked) const;
|
||||||
const LeaderboardStatus* GetLeaderboardInfo(AchievementId leaderboard_id);
|
const LeaderboardStatus* GetLeaderboardInfo(AchievementId leaderboard_id);
|
||||||
@ -278,9 +277,6 @@ private:
|
|||||||
std::atomic_bool m_background_execution_allowed = true;
|
std::atomic_bool m_background_execution_allowed = true;
|
||||||
Badge m_player_badge;
|
Badge m_player_badge;
|
||||||
Hash m_game_hash{};
|
Hash m_game_hash{};
|
||||||
u32 m_game_id = 0;
|
|
||||||
rc_api_fetch_game_data_response_t m_game_data{};
|
|
||||||
bool m_is_game_loaded = false;
|
|
||||||
Badge m_game_badge;
|
Badge m_game_badge;
|
||||||
bool m_display_welcome_message = false;
|
bool m_display_welcome_message = false;
|
||||||
std::unordered_map<AchievementId, Badge> m_unlocked_badges;
|
std::unordered_map<AchievementId, Badge> m_unlocked_badges;
|
||||||
|
@ -603,6 +603,8 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AchievementManager::GetInstance().LoadGame(nullptr);
|
||||||
|
|
||||||
SConfig::OnTitleDirectlyBooted(guard);
|
SConfig::OnTitleDirectlyBooted(guard);
|
||||||
|
|
||||||
ppc_state.pc = executable.reader->GetEntryPoint();
|
ppc_state.pc = executable.reader->GetEntryPoint();
|
||||||
@ -635,6 +637,8 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
|
|||||||
if (!BootNANDTitle(system, nand_title.id))
|
if (!BootNANDTitle(system, nand_title.id))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
AchievementManager::GetInstance().LoadGame(nullptr);
|
||||||
|
|
||||||
SConfig::OnTitleDirectlyBooted(guard);
|
SConfig::OnTitleDirectlyBooted(guard);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -661,6 +665,8 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
|
|||||||
ipl.disc->auto_disc_change_paths);
|
ipl.disc->auto_disc_change_paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AchievementManager::GetInstance().LoadGame(nullptr);
|
||||||
|
|
||||||
SConfig::OnTitleDirectlyBooted(guard);
|
SConfig::OnTitleDirectlyBooted(guard);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -668,6 +674,7 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard,
|
|||||||
bool operator()(const BootParameters::DFF& dff) const
|
bool operator()(const BootParameters::DFF& dff) const
|
||||||
{
|
{
|
||||||
NOTICE_LOG_FMT(BOOT, "Booting DFF: {}", dff.dff_path);
|
NOTICE_LOG_FMT(BOOT, "Booting DFF: {}", dff.dff_path);
|
||||||
|
AchievementManager::GetInstance().LoadGame(nullptr);
|
||||||
return system.GetFifoPlayer().Open(dff.dff_path);
|
return system.GetFifoPlayer().Open(dff.dff_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,9 +479,7 @@ bool ESDevice::LaunchPPCTitle(u64 title_id)
|
|||||||
if (!Core::IsRunning(system))
|
if (!Core::IsRunning(system))
|
||||||
return BootstrapPPC();
|
return BootstrapPPC();
|
||||||
|
|
||||||
INFO_LOG_FMT(ACHIEVEMENTS,
|
AchievementManager::GetInstance().LoadGame(nullptr);
|
||||||
"WAD and NAND formats not currently supported by Achievement Manager.");
|
|
||||||
AchievementManager::GetInstance().CloseGame();
|
|
||||||
|
|
||||||
core_timing.RemoveEvent(s_bootstrap_ppc_for_launch_event);
|
core_timing.RemoveEvent(s_bootstrap_ppc_for_launch_event);
|
||||||
core_timing.ScheduleEvent(ticks, s_bootstrap_ppc_for_launch_event);
|
core_timing.ScheduleEvent(ticks, s_bootstrap_ppc_for_launch_event);
|
||||||
|
Loading…
Reference in New Issue
Block a user