Android: Expose some of the GameSettings traits

This commit is contained in:
Connor McLaughlin 2021-05-19 14:41:57 +10:00
parent a6d76e787f
commit 2bde6d8e10
3 changed files with 62 additions and 0 deletions

View File

@ -135,6 +135,11 @@ public class GamePropertiesActivity extends AppCompatActivity {
activity.createBooleanGameSetting(ps, "GPUPGXP", R.string.settings_pgxp_geometry_correction);
activity.createBooleanGameSetting(ps, "PGXPPreserveProjFP", R.string.settings_pgxp_preserve_projection_precision);
activity.createBooleanGameSetting(ps, "GPUPGXPDepthBuffer", R.string.settings_pgxp_depth_buffer);
activity.createBooleanGameSetting(ps, "ForceSoftwareRenderer", R.string.settings_use_software_renderer);
activity.createBooleanGameSetting(ps, "ForceSoftwareRendererForReadbacks", R.string.settings_use_software_renderer_for_readbacks);
activity.createBooleanGameSetting(ps, "DisableWidescreen", R.string.settings_disable_widescreen);
activity.createBooleanGameSetting(ps, "ForcePGXPVertexCache", R.string.settings_pgxp_vertex_cache);
activity.createBooleanGameSetting(ps, "ForcePGXPCPUMode", R.string.settings_pgxp_cpu_mode);
setPreferenceScreen(ps);
}

View File

@ -348,4 +348,6 @@
<string name="emulation_menu_exit_game">Exit Game</string>
<string name="settings_use_software_renderer_for_readbacks">Use Software Renderer For Readbacks</string>
<string name="settings_summary_use_software_renderer_for_readbacks">Runs the software renderer in parallel for VRAM readbacks. On some devices, this may result in greater performance when using graphical enhancements with the hardware renderer.</string>
<string name="settings_use_software_renderer">Use Software Renderer</string>
<string name="settings_disable_widescreen">Disable Widescreen</string>
</resources>

View File

@ -728,6 +728,26 @@ static std::optional<std::string> GetEntryValueForKey(const Entry& entry, const
else
return entry.input_profile_name;
}
else if (key == "ForceSoftwareRenderer")
{
return entry.HasTrait(Trait::ForceSoftwareRenderer) ? "true" : "false";
}
else if (key == "ForceSoftwareRendererForReadbacks")
{
return entry.HasTrait(Trait::ForceSoftwareRendererForReadbacks) ? "true" : "false";
}
else if (key == "DisableWidescreen")
{
return entry.HasTrait(Trait::DisableWidescreen) ? "true" : "false";
}
else if (key == "ForcePGXPVertexCache")
{
return entry.HasTrait(Trait::ForcePGXPVertexCache) ? "true" : "false";
}
else if (key == "ForcePGXPCPUMode")
{
return entry.HasTrait(Trait::ForcePGXPCPUMode) ? "true" : "false";
}
else
{
Log_ErrorPrintf("Unknown key: %s", std::string(key).c_str());
@ -980,6 +1000,41 @@ static void SetEntryValueForKey(Entry& entry, const std::string_view& key, const
else
entry.input_profile_name = value.value();
}
else if (key == "ForceSoftwareRenderer")
{
if (!value.has_value() || !StringUtil::FromChars<bool>(value.value()).value_or(false))
entry.RemoveTrait(Trait::ForceSoftwareRenderer);
else
entry.AddTrait(Trait::ForceSoftwareRenderer);
}
else if (key == "ForceSoftwareRendererForReadbacks")
{
if (!value.has_value() || !StringUtil::FromChars<bool>(value.value()).value_or(false))
entry.RemoveTrait(Trait::ForceSoftwareRendererForReadbacks);
else
entry.AddTrait(Trait::ForceSoftwareRendererForReadbacks);
}
else if (key == "DisableWidescreen")
{
if (!value.has_value() || !StringUtil::FromChars<bool>(value.value()).value_or(false))
entry.RemoveTrait(Trait::DisableWidescreen);
else
entry.AddTrait(Trait::DisableWidescreen);
}
else if (key == "ForcePGXPVertexCache")
{
if (!value.has_value() || !StringUtil::FromChars<bool>(value.value()).value_or(false))
entry.RemoveTrait(Trait::ForcePGXPVertexCache);
else
entry.AddTrait(Trait::ForcePGXPVertexCache);
}
else if (key == "ForcePGXPCPUMode")
{
if (!value.has_value() || !StringUtil::FromChars<bool>(value.value()).value_or(false))
entry.RemoveTrait(Trait::ForcePGXPCPUMode);
else
entry.AddTrait(Trait::ForcePGXPCPUMode);
}
else
{
Log_ErrorPrintf("Unknown key: %s", std::string(key).c_str());