mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-08 12:35:48 +00:00
System: Fix setting-altering patches not applying on startup
This commit is contained in:
parent
0428a93315
commit
4236beabaf
@ -186,6 +186,7 @@ public:
|
|||||||
ALWAYS_INLINE bool IsManuallyActivated() const { return (m_metadata.activation == CodeActivation::Manual); }
|
ALWAYS_INLINE bool IsManuallyActivated() const { return (m_metadata.activation == CodeActivation::Manual); }
|
||||||
ALWAYS_INLINE bool HasOptions() const { return m_metadata.has_options; }
|
ALWAYS_INLINE bool HasOptions() const { return m_metadata.has_options; }
|
||||||
|
|
||||||
|
bool HasAnySettingOverrides() const;
|
||||||
void ApplySettingOverrides();
|
void ApplySettingOverrides();
|
||||||
|
|
||||||
virtual void SetOptionValue(u32 value) = 0;
|
virtual void SetOptionValue(u32 value) = 0;
|
||||||
@ -264,6 +265,14 @@ Cheats::CheatCode::CheatCode(Metadata metadata) : m_metadata(std::move(metadata)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cheats::CheatCode::~CheatCode() = default;
|
||||||
|
|
||||||
|
bool Cheats::CheatCode::HasAnySettingOverrides() const
|
||||||
|
{
|
||||||
|
return (m_metadata.disable_widescreen_rendering || m_metadata.override_aspect_ratio.has_value() ||
|
||||||
|
m_metadata.override_cpu_overclock.has_value());
|
||||||
|
}
|
||||||
|
|
||||||
void Cheats::CheatCode::ApplySettingOverrides()
|
void Cheats::CheatCode::ApplySettingOverrides()
|
||||||
{
|
{
|
||||||
if (m_metadata.disable_widescreen_rendering && g_settings.gpu_widescreen_hack)
|
if (m_metadata.disable_widescreen_rendering && g_settings.gpu_widescreen_hack)
|
||||||
@ -286,8 +295,6 @@ void Cheats::CheatCode::ApplySettingOverrides()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cheats::CheatCode::~CheatCode() = default;
|
|
||||||
|
|
||||||
static std::array<const char*, 1> s_cheat_code_type_names = {{"Gameshark"}};
|
static std::array<const char*, 1> s_cheat_code_type_names = {{"Gameshark"}};
|
||||||
static std::array<const char*, 1> s_cheat_code_type_display_names{{TRANSLATE_NOOP("Cheats", "Gameshark")}};
|
static std::array<const char*, 1> s_cheat_code_type_display_names{{TRANSLATE_NOOP("Cheats", "Gameshark")}};
|
||||||
|
|
||||||
@ -927,6 +934,25 @@ void Cheats::UnloadAll()
|
|||||||
s_database_cheat_codes_enabled = false;
|
s_database_cheat_codes_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Cheats::HasAnySettingOverrides()
|
||||||
|
{
|
||||||
|
for (const std::string& name : s_enabled_patches)
|
||||||
|
{
|
||||||
|
for (std::unique_ptr<CheatCode>& code : s_patch_codes)
|
||||||
|
{
|
||||||
|
if (name == code->GetName())
|
||||||
|
{
|
||||||
|
if (code->HasAnySettingOverrides())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Cheats::ApplySettingOverrides()
|
void Cheats::ApplySettingOverrides()
|
||||||
{
|
{
|
||||||
// only need to check patches for this
|
// only need to check patches for this
|
||||||
|
@ -129,6 +129,9 @@ extern void ReloadCheats(bool reload_files, bool reload_enabled_list, bool verbo
|
|||||||
/// Releases all cheat-related state.
|
/// Releases all cheat-related state.
|
||||||
extern void UnloadAll();
|
extern void UnloadAll();
|
||||||
|
|
||||||
|
/// Returns true if any patches have setting overrides specified.
|
||||||
|
extern bool HasAnySettingOverrides();
|
||||||
|
|
||||||
/// Applies setting changes based on patches.
|
/// Applies setting changes based on patches.
|
||||||
extern void ApplySettingOverrides();
|
extern void ApplySettingOverrides();
|
||||||
|
|
||||||
|
@ -1928,7 +1928,11 @@ bool System::Initialize(std::unique_ptr<CDImage> disc, DiscRegion disc_region, b
|
|||||||
UpdateMemorySaveStateSettings();
|
UpdateMemorySaveStateSettings();
|
||||||
|
|
||||||
if (!IsReplayingGPUDump())
|
if (!IsReplayingGPUDump())
|
||||||
|
{
|
||||||
Cheats::ReloadCheats(true, true, false, true);
|
Cheats::ReloadCheats(true, true, false, true);
|
||||||
|
if (Cheats::HasAnySettingOverrides())
|
||||||
|
ApplySettings(true);
|
||||||
|
}
|
||||||
|
|
||||||
PerformanceCounters::Clear();
|
PerformanceCounters::Clear();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user