GS: Remove Zoom and Offsets

Crop is far superior since it operates at pixel increments, and lets
you control all four edges independently.
This commit is contained in:
Connor McLaughlin 2022-12-10 18:40:18 +10:00 committed by refractionpcsx2
parent b706c25b68
commit a67d3e9aee
11 changed files with 33 additions and 236 deletions

View File

@ -112,7 +112,6 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget*
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.PCRTCOverscan, "EmuCore/GS", "pcrtc_overscan", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.PCRTCAntiBlur, "EmuCore/GS", "pcrtc_antiblur", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.DisableInterlaceOffset, "EmuCore/GS", "disable_interlace_offset", false);
SettingWidgetBinder::BindWidgetToFloatSetting(sif, m_ui.zoom, "EmuCore/GS", "Zoom", 100.0f);
SettingWidgetBinder::BindWidgetToFloatSetting(sif, m_ui.stretchY, "EmuCore/GS", "StretchY", 100.0f);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.cropLeft, "EmuCore/GS", "CropLeft", 0);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.cropTop, "EmuCore/GS", "CropTop", 0);
@ -357,11 +356,6 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget*
dialog->registerWidgetHelp(m_ui.interlacing, tr("Deinterlacing"), tr("Automatic (Default)"), tr(""));
dialog->registerWidgetHelp(m_ui.zoom, tr("Zoom"), tr("100%"),
tr("Zoom = 100: Fit the entire image to the window without any cropping."
"Above/Below 100: Zoom In/Out."
"0: Automatic-Zoom-In until the black-bars are gone (Aspect ratio is kept, some of the image goes out of screen)."));
dialog->registerWidgetHelp(m_ui.stretchY, tr("Stretch Height"), tr("100%"), tr(""));
dialog->registerWidgetHelp(m_ui.fullscreenModes, tr("Fullscreen Mode"), tr("Borderless Fullscreen"), tr(""));

View File

@ -201,34 +201,40 @@
</item>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_21">
<item row="4" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Zoom:</string>
<string>Bilinear Filtering:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="bilinearFiltering">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear (Smooth)</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear (Sharp)</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_24">
<property name="text">
<string>Vertical Stretch:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="zoom">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>300</number>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_24">
<property name="text">
<string>Stretch Height:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="stretchY">
<property name="suffix">
<string>%</string>
@ -241,14 +247,14 @@
</property>
</widget>
</item>
<item row="7" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
<string>Crop:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1,0,1,0,1,0,1">
<item>
<widget class="QLabel" name="label_39">
@ -320,7 +326,7 @@
</item>
</layout>
</item>
<item row="8" column="0" colspan="2">
<item row="7" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_5">
<item row="3" column="0">
<widget class="QCheckBox" name="PCRTCOffsets">
@ -383,32 +389,6 @@
</item>
</layout>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>Bilinear Filtering:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="bilinearFiltering">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear (Smooth)</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear (Sharp)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="hardwareRenderingTab">

View File

@ -567,14 +567,8 @@ struct Pcsx2Config
GSInterlaceMode InterlaceMode{GSInterlaceMode::Automatic};
GSPostBilinearMode LinearPresent{ GSPostBilinearMode::BilinearSmooth };
float Zoom{100.0f};
float StretchY{100.0f};
#ifndef PCSX2_CORE
float OffsetX{0.0f};
float OffsetY{0.0f};
#else
int Crop[4]{};
#endif
float OsdScale{100.0};

View File

@ -2838,8 +2838,6 @@ void FullscreenUI::DrawGraphicsSettingsPage()
DrawIntListSetting(bsi, "Deinterlacing",
"Selects the algorithm used to convert the PS2's interlaced output to progressive for display.", "EmuCore/GS", "deinterlace_mode",
static_cast<int>(GSInterlaceMode::Automatic), s_deinterlacing_options, std::size(s_deinterlacing_options));
DrawIntRangeSetting(bsi, "Zoom", "Increases or decreases the virtual picture size both horizontally and vertically.", "EmuCore/GS",
"Zoom", 100, 10, 300, "%d%%");
DrawIntRangeSetting(bsi, "Vertical Stretch", "Increases or decreases the virtual picture size vertically.", "EmuCore/GS", "StretchY",
100, 10, 300, "%d%%");
DrawIntRectSetting(bsi, "Crop", "Crops the image, while respecting aspect ratio.", "EmuCore/GS", "CropLeft", 0, "CropTop", 0,

View File

@ -1715,16 +1715,6 @@ static void HotkeyAdjustUpscaleMultiplier(s32 delta)
GetMTGS().ApplySettings();
}
static void HotkeyAdjustZoom(double delta)
{
const double new_zoom = std::clamp(EmuConfig.GS.Zoom + delta, 1.0, 200.0);
Host::AddKeyedFormattedOSDMessage("ZoomChanged", Host::OSD_QUICK_DURATION, "Zoom set to %.1f%%.", new_zoom);
EmuConfig.GS.Zoom = new_zoom;
// no need to go through the full settings update for this
GetMTGS().RunOnGSThread([new_zoom]() { GSConfig.Zoom = new_zoom; });
}
BEGIN_HOTKEY_LIST(g_gs_hotkeys)
{"Screenshot", "Graphics", "Save Screenshot", [](s32 pressed) {
if (!pressed)
@ -1810,14 +1800,6 @@ BEGIN_HOTKEY_LIST(g_gs_hotkeys)
GetMTGS().RunOnGSThread([new_mode]() { GSConfig.InterlaceMode = new_mode; });
}},
{"ZoomIn", "Graphics", "Zoom In", [](s32 pressed) {
if (!pressed)
HotkeyAdjustZoom(1.0);
}},
{"ZoomOut", "Graphics", "Zoom Out", [](s32 pressed) {
if (!pressed)
HotkeyAdjustZoom(-1.0);
}},
{"ToggleTextureDumping", "Graphics", "Toggle Texture Dumping", [](s32 pressed) {
if (!pressed)
{

View File

@ -455,12 +455,7 @@ static GSVector4 CalculateDrawDstRect(s32 window_width, s32 window_height, const
else if (arr > 1)
target_height = std::floor(f_height / arr + 0.5f);
float zoom = GSConfig.Zoom / 100.0;
if (zoom == 0) //auto zoom in untill black-bars are gone (while keeping the aspect ratio).
zoom = std::max((float)arr, (float)(1.0 / arr));
target_width *= zoom;
target_height *= zoom * GSConfig.StretchY / 100.0f;
target_height *= GSConfig.StretchY / 100.0f;
if (GSConfig.IntegerScaling)
{
@ -524,12 +519,6 @@ static GSVector4 CalculateDrawDstRect(s32 window_width, s32 window_height, const
}
}
#ifndef PCSX2_CORE
const float unit = .01f * std::min(target_x, target_y);
target_x += unit * GSConfig.OffsetX;
target_y += unit * GSConfig.OffsetY;
#endif
GSVector4 ret(target_x, target_y, target_x + target_width, target_y + target_height);
if (flip_y)

View File

@ -381,17 +381,11 @@ bool Pcsx2Config::GSOptions::OptionsAreEqual(const GSOptions& right) const
OpEqu(InterlaceMode) &&
OpEqu(LinearPresent) &&
OpEqu(Zoom) &&
OpEqu(StretchY) &&
#ifndef PCSX2_CORE
OpEqu(OffsetX) &&
OpEqu(OffsetY) &&
#else
OpEqu(Crop[0]) &&
OpEqu(Crop[1]) &&
OpEqu(Crop[2]) &&
OpEqu(Crop[3]) &&
#endif
OpEqu(OsdScale) &&
@ -474,7 +468,6 @@ void Pcsx2Config::GSOptions::LoadSave(SettingsWrapper& wrap)
SettingsWrapBitBool(SyncToHostRefreshRate);
SettingsWrapEnumEx(AspectRatio, "AspectRatio", AspectRatioNames);
SettingsWrapEnumEx(FMVAspectRatioSwitch, "FMVAspectRatioSwitch", FMVAspectRatioSwitchNames);
SettingsWrapEntry(Zoom);
SettingsWrapEntry(StretchY);
SettingsWrapEntryEx(Crop[0], "CropLeft");
SettingsWrapEntryEx(Crop[1], "CropTop");

View File

@ -900,8 +900,6 @@ void AppConfig::GSWindowOptions::LoadSave(IniInterface& ini)
NULL};
ini.EnumEntry(L"FMVAspectRatioSwitch", g_Conf->EmuOptions.GS.FMVAspectRatioSwitch, FMVAspectRatioSwitchNames, g_Conf->EmuOptions.GS.FMVAspectRatioSwitch);
ini.Entry(wxT("Zoom"), g_Conf->EmuOptions.GS.Zoom, g_Conf->EmuOptions.GS.Zoom);
if (ini.IsLoading())
SanityCheck();
}

View File

@ -161,44 +161,6 @@ namespace Implementations
Host::AddKeyedFormattedOSDMessage("AspectRatio", 2.0f, "Aspect ratio: %s", arts);
}
// NOTE: The settings below are super janky and race the GS thread when updating.
// But because they don't go through the proper settings update procedure, it's necessary to avoid reopening GS.
void SetOffset(float x, float y)
{
g_Conf->EmuOptions.GS.OffsetX = x;
g_Conf->EmuOptions.GS.OffsetY = y;
EmuConfig.GS.OffsetX = x;
EmuConfig.GS.OffsetY = y;
GSConfig.OffsetX = x;
GSConfig.OffsetY = y;
Host::AddKeyedFormattedOSDMessage("WindowOffset", 2.0f, "Offset: x=%f, y=%f", x, y);
}
void GSwindow_OffsetYplus()
{
SetOffset(EmuConfig.GS.OffsetX, EmuConfig.GS.OffsetY + 1);
}
void GSwindow_OffsetYminus()
{
SetOffset(EmuConfig.GS.OffsetX, EmuConfig.GS.OffsetY - 1);
}
void GSwindow_OffsetXplus()
{
SetOffset(EmuConfig.GS.OffsetX + 1, EmuConfig.GS.OffsetY);
}
void GSwindow_OffsetXminus()
{
SetOffset(EmuConfig.GS.OffsetX - 1, EmuConfig.GS.OffsetY);
}
void GSwindow_OffsetReset()
{
SetOffset(0, 0);
}
void SetZoomY(float zoom)
{
if (zoom <= 0)
@ -222,49 +184,6 @@ namespace Implementations
SetZoomY(100);
}
void SetZoom(float zoom)
{
if (zoom < 0)
return;
g_Conf->EmuOptions.GS.Zoom = zoom;
EmuConfig.GS.Zoom = zoom;
GSConfig.Zoom = zoom;
if (zoom == 0)
Host::AddKeyedOSDMessage("WindowZoom", "Zoom: 0 (auto, no black bars)");
else
Host::AddKeyedFormattedOSDMessage("WindowZoom", 2.0f, "Zoom: %f", zoom);
}
void GSwindow_ZoomIn()
{
float z = EmuConfig.GS.Zoom;
if (z == 0)
z = 100;
z++;
SetZoom(z);
}
void GSwindow_ZoomOut()
{
float z = EmuConfig.GS.Zoom;
if (z == 0)
z = 100;
z--;
SetZoom(z);
}
void GSwindow_ZoomToggle()
{
float z = EmuConfig.GS.Zoom;
if (z == 100)
z = 0;
else
z = 100;
SetZoom(z);
}
void Sys_Suspend()
{
CoreThread.Suspend();
@ -612,40 +531,10 @@ static const GlobalCommandDescriptor CommandDeclarations[] =
true,
},
{
"GSwindow_ZoomIn",
Implementations::GSwindow_ZoomIn,
NULL,
NULL,
false,
},
{
"GSwindow_ZoomOut",
Implementations::GSwindow_ZoomOut,
NULL,
NULL,
false,
},
{
"GSwindow_ZoomToggle",
Implementations::GSwindow_ZoomToggle,
NULL,
NULL,
false,
},
{"GSwindow_ZoomInY", Implementations::GSwindow_ZoomInY, NULL, NULL, false},
{"GSwindow_ZoomOutY", Implementations::GSwindow_ZoomOutY, NULL, NULL, false},
{"GSwindow_ZoomResetY", Implementations::GSwindow_ZoomResetY, NULL, NULL, false},
{"GSwindow_OffsetYminus", Implementations::GSwindow_OffsetYminus, NULL, NULL, false},
{"GSwindow_OffsetYplus", Implementations::GSwindow_OffsetYplus, NULL, NULL, false},
{"GSwindow_OffsetXminus", Implementations::GSwindow_OffsetXminus, NULL, NULL, false},
{"GSwindow_OffsetXplus", Implementations::GSwindow_OffsetXplus, NULL, NULL, false},
{"GSwindow_OffsetReset", Implementations::GSwindow_OffsetReset, NULL, NULL, false},
{
"Sys_SuspendResume",
Implementations::Sys_SuspendResume,

View File

@ -256,8 +256,6 @@ namespace Panels
wxComboBox* m_combo_FMVAspectRatioSwitch;
wxComboBox* m_combo_vsync;
wxTextCtrl* m_text_Zoom;
pxCheckBox* m_check_CloseGS;
pxCheckBox* m_check_SizeLock;
pxCheckBox* m_check_VsyncEnable;

View File

@ -51,8 +51,6 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel(wxWindow* parent)
_("Adaptive"),
};
m_text_Zoom = CreateNumericalTextCtrl(this, 5);
m_combo_AspectRatio = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
std::size(aspect_ratio_labels), aspect_ratio_labels, wxCB_READONLY);
@ -80,14 +78,6 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel(wxWindow* parent)
L"4:3: Temporarily switch to a 4:3 aspect ratio while an FMV plays to correctly display a 4:3 FMV. \n\n"
L"16:9: Temporarily switch to a 16:9 aspect ratio while an FMV plays to correctly display a widescreen 16:9 FMV."));
m_text_Zoom->SetToolTip(pxEt(L"Zoom = 100: Fit the entire image to the window without any cropping.\n"
L"Above/Below 100: Zoom In/Out.\n\n"
L"0: Automatic-Zoom-In until the black-bars are gone (Aspect ratio is kept, some of the image goes out of screen).\n\n"
L"NOTE: Some games draw their own black-bars, which will not be removed with '0'.\n\n"
L"Keyboard: \n"
L"CTRL + NUMPAD-PLUS: Zoom-In, \n"
L"CTRL + NUMPAD-MINUS: Zoom-Out, \nCTRL + NUMPAD-*: Toggle 100/0"));
m_combo_vsync->SetToolTip(pxEt(L"Vsync eliminates screen tearing but typically has a big performance hit. It usually only applies to fullscreen mode."));
m_check_HideMouse->SetToolTip(pxEt(L"Check this to force the mouse cursor invisible inside the GS window; useful if using the mouse as a primary control device for gaming. By default the mouse auto-hides after 2 seconds of inactivity."));
@ -117,9 +107,6 @@ Panels::GSWindowSettingsPanel::GSWindowSettingsPanel(wxWindow* parent)
s_AspectRatio += Label(_("Custom Window Size:")) | pxMiddle;
s_AspectRatio += s_customsize | pxAlignRight;
s_AspectRatio += Label(_("Zoom:")) | pxMiddle;
s_AspectRatio += m_text_Zoom | pxAlignRight;
wxFlexGridSizer& s_vsync(*new wxFlexGridSizer(2, StdPadding, StdPadding));
s_vsync.AddGrowableCol(1);
@ -166,7 +153,6 @@ void Panels::GSWindowSettingsPanel::ApplyConfigToGui(AppConfig& configToApply, i
m_combo_AspectRatio->SetSelection((int)gsconf.AspectRatio);
m_combo_FMVAspectRatioSwitch->SetSelection(enum_cast(gsconf.FMVAspectRatioSwitch));
m_text_Zoom->ChangeValue(wxString::FromDouble(gsconf.Zoom, 2));
m_check_DclickFullscreen->SetValue(conf.IsToggleFullscreenOnDoubleClick);
@ -192,10 +178,6 @@ void Panels::GSWindowSettingsPanel::Apply()
gsconf.FMVAspectRatioSwitch = (FMVAspectRatioSwitchType)m_combo_FMVAspectRatioSwitch->GetSelection();
EmuConfig.CurrentAspectRatio = gsconf.AspectRatio;
double new_zoom = 0.0;
if (m_text_Zoom->GetValue().ToDouble(&new_zoom))
gsconf.Zoom = new_zoom;
gsconf.VsyncEnable = static_cast<VsyncMode>(m_combo_vsync->GetSelection());
appconf.IsToggleFullscreenOnDoubleClick = m_check_DclickFullscreen->GetValue();