GameSettings: Add trait for disabling PGXP texture correction

This commit is contained in:
Connor McLaughlin 2020-09-14 18:20:42 +10:00
parent 1d9a086b8a
commit daa5e02853
3 changed files with 15 additions and 8 deletions

View file

@ -112,7 +112,7 @@ private:
enum : u32 enum : u32
{ {
GAME_LIST_CACHE_SIGNATURE = 0x45434C47, GAME_LIST_CACHE_SIGNATURE = 0x45434C47,
GAME_LIST_CACHE_VERSION = 8 GAME_LIST_CACHE_VERSION = 9
}; };
using DatabaseMap = std::unordered_map<std::string, GameListDatabaseEntry>; using DatabaseMap = std::unordered_map<std::string, GameListDatabaseEntry>;

View file

@ -29,6 +29,7 @@ std::array<std::pair<const char*, const char*>, static_cast<u32>(Trait::Count)>
{"DisableWidescreen", TRANSLATABLE("GameSettingsTrait", "Disable Widescreen")}, {"DisableWidescreen", TRANSLATABLE("GameSettingsTrait", "Disable Widescreen")},
{"DisablePGXP", TRANSLATABLE("GameSettingsTrait", "Disable PGXP")}, {"DisablePGXP", TRANSLATABLE("GameSettingsTrait", "Disable PGXP")},
{"DisablePGXPCulling", TRANSLATABLE("GameSettingsTrait", "Disable PGXP Culling")}, {"DisablePGXPCulling", TRANSLATABLE("GameSettingsTrait", "Disable PGXP Culling")},
{"DisablePGXPTextureCorrection", TRANSLATABLE("GameSettingsTrait", "Disable PGXP Texture Correction")},
{"ForcePGXPVertexCache", TRANSLATABLE("GameSettingsTrait", "Force PGXP Vertex Cache")}, {"ForcePGXPVertexCache", TRANSLATABLE("GameSettingsTrait", "Force PGXP Vertex Cache")},
{"ForcePGXPCPUMode", TRANSLATABLE("GameSettingsTrait", "Force PGXP CPU Mode")}, {"ForcePGXPCPUMode", TRANSLATABLE("GameSettingsTrait", "Force PGXP CPU Mode")},
{"ForceDigitalController", TRANSLATABLE("GameSettingsTrait", "Force Digital Controller")}, {"ForceDigitalController", TRANSLATABLE("GameSettingsTrait", "Force Digital Controller")},
@ -48,11 +49,6 @@ const char* GetTraitDisplayName(Trait trait)
return s_trait_names[static_cast<u32>(trait)].second; return s_trait_names[static_cast<u32>(trait)].second;
} }
bool Entry::HasAnySettings() const
{
return traits.any() || display_active_start_offset >= 0 || display_active_end_offset > 0;
}
template<typename T> template<typename T>
bool ReadOptionalFromStream(ByteStream* stream, std::optional<T>* dest) bool ReadOptionalFromStream(ByteStream* stream, std::optional<T>* dest)
{ {
@ -549,6 +545,18 @@ void Entry::ApplySettings(bool display_osd_messages) const
g_settings.gpu_pgxp_culling = false; g_settings.gpu_pgxp_culling = false;
} }
if (HasTrait(Trait::DisablePGXPTextureCorrection))
{
if (display_osd_messages && g_settings.gpu_pgxp_culling && g_settings.gpu_pgxp_texture_correction)
{
g_host_interface->AddOSDMessage(
g_host_interface->TranslateStdString("OSDMessage", "PGXP texture correction disabled by game settings."),
osd_duration);
}
g_settings.gpu_pgxp_texture_correction = false;
}
if (HasTrait(Trait::ForcePGXPVertexCache)) if (HasTrait(Trait::ForcePGXPVertexCache))
{ {
if (display_osd_messages && g_settings.gpu_pgxp_enable && !g_settings.gpu_pgxp_vertex_cache) if (display_osd_messages && g_settings.gpu_pgxp_enable && !g_settings.gpu_pgxp_vertex_cache)

View file

@ -20,6 +20,7 @@ enum class Trait : u32
DisableWidescreen, DisableWidescreen,
DisablePGXP, DisablePGXP,
DisablePGXPCulling, DisablePGXPCulling,
DisablePGXPTextureCorrection,
ForcePGXPVertexCache, ForcePGXPVertexCache,
ForcePGXPCPUMode, ForcePGXPCPUMode,
ForceDigitalController, ForceDigitalController,
@ -62,8 +63,6 @@ struct Entry
ALWAYS_INLINE void RemoveTrait(Trait trait) { traits[static_cast<int>(trait)] = false; } ALWAYS_INLINE void RemoveTrait(Trait trait) { traits[static_cast<int>(trait)] = false; }
ALWAYS_INLINE void SetTrait(Trait trait, bool enabled) { traits[static_cast<int>(trait)] = enabled; } ALWAYS_INLINE void SetTrait(Trait trait, bool enabled) { traits[static_cast<int>(trait)] = enabled; }
bool HasAnySettings() const;
bool LoadFromStream(ByteStream* stream); bool LoadFromStream(ByteStream* stream);
bool SaveToStream(ByteStream* stream) const; bool SaveToStream(ByteStream* stream) const;