mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-03-18 03:11:11 +00:00
RetroAchievements: Block loading discs that don't match current title
This commit is contained in:
parent
3564a256bf
commit
6fdd45ddf6
@ -26,6 +26,7 @@
|
||||
#include "Core/Config/FreeLookSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigLoaders/GameConfigLoader.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/GeckoCode.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
@ -215,6 +216,25 @@ void AchievementManager::LoadGame(const DiscIO::Volume* volume)
|
||||
}
|
||||
}
|
||||
|
||||
void AchievementManager::ChangeDisc(const DiscIO::Volume* volume)
|
||||
{
|
||||
if (volume == nullptr)
|
||||
{
|
||||
INFO_LOG_FMT(ACHIEVEMENTS, "Ejecting disc.");
|
||||
LoadGame(nullptr);
|
||||
}
|
||||
else if (volume->GetGameID() != SConfig::GetInstance().GetGameID())
|
||||
{
|
||||
INFO_LOG_FMT(ACHIEVEMENTS, "Inserting disc that doesn't belong to the running game.");
|
||||
LoadGame(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG_FMT(ACHIEVEMENTS, "Inserting disc.");
|
||||
LoadGame(volume);
|
||||
}
|
||||
}
|
||||
|
||||
bool AchievementManager::IsGameLoaded() const
|
||||
{
|
||||
auto* game_info = rc_client_get_game_info(m_client);
|
||||
|
||||
@ -121,6 +121,7 @@ public:
|
||||
void Login(const std::string& password);
|
||||
bool HasAPIToken() const;
|
||||
void LoadGame(const DiscIO::Volume* volume);
|
||||
void ChangeDisc(const DiscIO::Volume* volume);
|
||||
bool IsGameLoaded() const;
|
||||
void SetBackgroundExecutionAllowed(bool allowed);
|
||||
|
||||
@ -333,6 +334,8 @@ public:
|
||||
|
||||
constexpr void LoadGame(const DiscIO::Volume*) {}
|
||||
|
||||
constexpr void ChangeDisc(const DiscIO::Volume*) {}
|
||||
|
||||
constexpr void SetBackgroundExecutionAllowed(bool allowed) {}
|
||||
|
||||
constexpr void DoFrame() {}
|
||||
|
||||
@ -442,7 +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);
|
||||
AchievementManager::GetInstance().ChangeDisc(nullptr);
|
||||
system.GetDVDInterface().SetDisc(nullptr, {});
|
||||
}
|
||||
|
||||
@ -454,7 +454,7 @@ void DVDInterface::InsertDiscCallback(Core::System& system, u64 userdata, s64 cy
|
||||
|
||||
if (new_disc)
|
||||
{
|
||||
AchievementManager::GetInstance().LoadGame(new_disc.get());
|
||||
AchievementManager::GetInstance().ChangeDisc(new_disc.get());
|
||||
di.SetDisc(std::move(new_disc), {});
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user