Merge pull request #14478 from JosJuice/wii-menu-headache

Move achievements code out of DVDInterface::SetDisc
This commit is contained in:
JosJuice 2026-03-17 19:07:41 +01:00 committed by GitHub
commit 3564a256bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 8 deletions

View File

@ -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;
}

View File

@ -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();
}