diff options
| author | JosJuice <josjuice@gmail.com> | 2026-03-17 09:07:34 +0100 |
|---|---|---|
| committer | OatmealDome <julian@oatmealdome.me> | 2026-03-17 17:28:07 -0400 |
| commit | 4d4e975a9013f204b74db763ff78fb986f400076 (patch) | |
| tree | d3b4f8ff60fa731ddc81cfb5b2a236e6e7d9c2b2 | |
| parent | d8558142ead21b3fa39809c4aedb982fbfc85feb (diff) | |
Move achievements code out of DVDInterface::SetDisc
This should stop AchievementManager::LoadGame from being called for the
default ISO when CBoot::BootUp is booting something other than a disc or
IPL (most notably, the Wii Menu), while still detecting all disc changes
that happen while a disc game is running.
| -rw-r--r-- | Source/Core/Core/Boot/Boot.cpp | 13 | ||||
| -rw-r--r-- | Source/Core/Core/HW/DVD/DVDInterface.cpp | 8 |
2 files changed, 13 insertions, 8 deletions
diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 2ccf0cdcc4..888173ed9a 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -524,6 +524,7 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard, NOTICE_LOG_FMT(BOOT, "Booting from disc: {}", disc.path); const DiscIO::VolumeDisc* volume = SetDisc(system.GetDVDInterface(), std::move(disc.volume), disc.auto_disc_change_paths); + AchievementManager::GetInstance().LoadGame(volume); if (!volume) return false; @@ -642,17 +643,17 @@ bool CBoot::BootUp(Core::System& system, const Core::CPUThreadGuard& guard, if (!Load_BS2(system, ipl.path)) return false; + const DiscIO::VolumeDisc* volume = nullptr; if (ipl.disc) { NOTICE_LOG_FMT(BOOT, "Inserting disc: {}", ipl.disc->path); - SetDisc(system.GetDVDInterface(), DiscIO::CreateDiscForCore(ipl.disc->path), - ipl.disc->auto_disc_change_paths); - } - else - { - AchievementManager::GetInstance().LoadGame(nullptr); + + volume = SetDisc(system.GetDVDInterface(), DiscIO::CreateDiscForCore(ipl.disc->path), + ipl.disc->auto_disc_change_paths); } + AchievementManager::GetInstance().LoadGame(volume); + SConfig::OnTitleDirectlyBooted(guard); return true; } diff --git a/Source/Core/Core/HW/DVD/DVDInterface.cpp b/Source/Core/Core/HW/DVD/DVDInterface.cpp index 33b0efc548..8420366ffb 100644 --- a/Source/Core/Core/HW/DVD/DVDInterface.cpp +++ b/Source/Core/Core/HW/DVD/DVDInterface.cpp @@ -420,8 +420,6 @@ void DVDInterface::SetDisc(std::unique_ptr<DiscIO::VolumeDisc> disc, m_auto_disc_change_index = 0; } - AchievementManager::GetInstance().LoadGame(disc.get()); - // Assume that inserting a disc requires having an empty disc before if (had_disc != has_disc) ExpansionInterface::g_rtc_flags[ExpansionInterface::RTCFlag::DiscChanged] = true; @@ -444,6 +442,7 @@ void DVDInterface::AutoChangeDiscCallback(Core::System& system, u64 userdata, s6 void DVDInterface::EjectDiscCallback(Core::System& system, u64 userdata, s64 cyclesLate) { + AchievementManager::GetInstance().LoadGame(nullptr); system.GetDVDInterface().SetDisc(nullptr, {}); } @@ -454,9 +453,14 @@ void DVDInterface::InsertDiscCallback(Core::System& system, u64 userdata, s64 cy DiscIO::CreateDiscForCore(di.m_disc_path_to_insert); if (new_disc) + { + AchievementManager::GetInstance().LoadGame(new_disc.get()); di.SetDisc(std::move(new_disc), {}); + } else + { PanicAlertFmtT("The disc that was about to be inserted couldn't be found."); + } di.m_disc_path_to_insert.clear(); } |
