Merge pull request #2943 from Superstarxalien/master

Improve Integer Scaling and Native Resolution Screenshot behavior
This commit is contained in:
Connor McLaughlin 2023-01-30 19:16:42 +10:00 committed by GitHub
commit a30bc94437
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 7 deletions

View file

@ -227,12 +227,18 @@ void HostDisplay::CalculateDrawRect(s32 window_width, s32 window_height, float*
apply_aspect_ratio ?
(display_aspect_ratio / (static_cast<float>(m_display_width) / static_cast<float>(m_display_height))) :
1.0f;
const float display_width = static_cast<float>(m_display_width) * x_scale;
const float display_height = static_cast<float>(m_display_height);
const float active_left = static_cast<float>(m_display_active_left) * x_scale;
const float active_top = static_cast<float>(m_display_active_top);
const float active_width = static_cast<float>(m_display_active_width) * x_scale;
const float active_height = static_cast<float>(m_display_active_height);
const float display_width = g_settings.display_stretch_vertically ?
static_cast<float>(m_display_width) : static_cast<float>(m_display_width) * x_scale;
const float display_height = g_settings.display_stretch_vertically ?
static_cast<float>(m_display_height) / x_scale : static_cast<float>(m_display_height);
const float active_left = g_settings.display_stretch_vertically ?
static_cast<float>(m_display_active_left) : static_cast<float>(m_display_active_left) * x_scale;
const float active_top = g_settings.display_stretch_vertically ?
static_cast<float>(m_display_active_top) / x_scale : static_cast<float>(m_display_active_top);
const float active_width = g_settings.display_stretch_vertically ?
static_cast<float>(m_display_active_width) : static_cast<float>(m_display_active_width) * x_scale;
const float active_height = g_settings.display_stretch_vertically ?
static_cast<float>(m_display_active_height) / x_scale : static_cast<float>(m_display_active_height);
if (out_x_scale)
*out_x_scale = x_scale;
@ -488,7 +494,12 @@ bool HostDisplay::WriteDisplayTextureToFile(std::string filename, bool full_reso
const float ss_width_scale = static_cast<float>(m_display_active_width) / static_cast<float>(m_display_width);
const float ss_height_scale = static_cast<float>(m_display_active_height) / static_cast<float>(m_display_height);
const float ss_aspect_ratio = m_display_aspect_ratio * ss_width_scale / ss_height_scale;
resize_width = static_cast<s32>(static_cast<float>(resize_height) * ss_aspect_ratio);
resize_width = g_settings.display_stretch_vertically ?
m_display_texture_view_width : static_cast<s32>(static_cast<float>(resize_height) * ss_aspect_ratio);
resize_height = g_settings.display_stretch_vertically ?
static_cast<s32>(static_cast<float>(resize_height) /
(m_display_aspect_ratio / (static_cast<float>(m_display_width) / static_cast<float>(m_display_height)))) :
resize_height;
}
else
{

View file

@ -270,6 +270,7 @@ void Settings::Load(SettingsInterface& si)
display_show_enhancements = si.GetBoolValue("Display", "ShowEnhancements", false);
display_all_frames = si.GetBoolValue("Display", "DisplayAllFrames", false);
display_internal_resolution_screenshots = si.GetBoolValue("Display", "InternalResolutionScreenshots", false);
display_stretch_vertically = si.GetBoolValue("Display", "StretchVertically", false);
video_sync_enabled = si.GetBoolValue("Display", "VSync", DEFAULT_VSYNC_VALUE);
display_post_process_chain = si.GetStringValue("Display", "PostProcessChain", "");
display_max_fps = si.GetFloatValue("Display", "MaxFPS", DEFAULT_DISPLAY_MAX_FPS);
@ -487,6 +488,7 @@ void Settings::Save(SettingsInterface& si) const
si.SetBoolValue("Display", "ShowEnhancements", display_show_enhancements);
si.SetBoolValue("Display", "DisplayAllFrames", display_all_frames);
si.SetBoolValue("Display", "InternalResolutionScreenshots", display_internal_resolution_screenshots);
si.SetBoolValue("Display", "StretchVertically", display_stretch_vertically);
si.SetBoolValue("Display", "VSync", video_sync_enabled);
if (display_post_process_chain.empty())
si.DeleteValue("Display", "PostProcessChain");

View file

@ -143,6 +143,7 @@ struct Settings
bool display_show_enhancements = false;
bool display_all_frames = false;
bool display_internal_resolution_screenshots = false;
bool display_stretch_vertically = false;
bool video_sync_enabled = DEFAULT_VSYNC_VALUE;
float display_osd_scale = 100.0f;
float display_max_fps = DEFAULT_DISPLAY_MAX_FPS;

View file

@ -288,6 +288,9 @@ void AdvancedSettingsWidget::addTweakOptions()
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Use Debug Host GPU Device"), "GPU", "UseDebugDevice",
false);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Stretch Display Vertically"), "Display",
"StretchVertically", false);
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Increase Timer Resolution"), "Main",
"IncreaseTimerResolution", true);
@ -354,6 +357,7 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
sif->DeleteValue("Display", "ActiveEndOffset");
sif->DeleteValue("Display", "LineStartOffset");
sif->DeleteValue("Display", "LineEndOffset");
sif->DeleteValue("Display", "StretchVertically");
sif->DeleteValue("GPU", "Multisamples");
sif->DeleteValue("GPU", "PerSampleShading");
sif->DeleteValue("GPU", "PGXPVertexCache");

View file

@ -4506,6 +4506,9 @@ void FullscreenUI::DrawAdvancedSettingsPage()
DrawFloatRangeSetting(bsi, "Display FPS Limit",
"Limits how many frames are displayed to the screen. These frames are still rendered.",
"Display", "MaxFPS", Settings::DEFAULT_DISPLAY_MAX_FPS, 0.0f, 500.0f, "%.2f FPS");
DrawToggleSetting(bsi, "Stretch Display Vertically",
"Stretches the display to match the aspect ratio by multiplying vertically instead of horizontally.",
"Display", "StretchVertically", false);
MenuHeading("PGXP Settings");