add setting, add to qt, implement
This commit is contained in:
parent
0be78e9550
commit
7f39c35014
8 changed files with 65 additions and 20 deletions
|
|
@ -687,6 +687,7 @@ void QtConfig::ReadRendererValues() {
|
|||
ReadGlobalSetting(Settings::values.use_disk_shader_cache);
|
||||
ReadGlobalSetting(Settings::values.use_vsync_new);
|
||||
ReadGlobalSetting(Settings::values.resolution_factor);
|
||||
ReadGlobalSetting(Settings::values.use_integer_scaling);
|
||||
ReadGlobalSetting(Settings::values.frame_limit);
|
||||
ReadGlobalSetting(Settings::values.turbo_limit);
|
||||
|
||||
|
|
@ -1218,6 +1219,7 @@ void QtConfig::SaveRendererValues() {
|
|||
WriteGlobalSetting(Settings::values.use_disk_shader_cache);
|
||||
WriteGlobalSetting(Settings::values.use_vsync_new);
|
||||
WriteGlobalSetting(Settings::values.resolution_factor);
|
||||
WriteGlobalSetting(Settings::values.use_integer_scaling);
|
||||
WriteGlobalSetting(Settings::values.frame_limit);
|
||||
WriteGlobalSetting(Settings::values.turbo_limit);
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ void ConfigureEnhancements::SetConfiguration() {
|
|||
static_cast<int>(Settings::values.mono_render_option.GetValue()));
|
||||
updateShaders(Settings::values.render_3d.GetValue());
|
||||
ui->toggle_linear_filter->setChecked(Settings::values.filter_mode.GetValue());
|
||||
ui->use_integer_scaling->setChecked(Settings::values.use_integer_scaling.GetValue());
|
||||
ui->toggle_dump_textures->setChecked(Settings::values.dump_textures.GetValue());
|
||||
ui->toggle_custom_textures->setChecked(Settings::values.custom_textures.GetValue());
|
||||
ui->toggle_preload_textures->setChecked(Settings::values.preload_textures.GetValue());
|
||||
|
|
@ -125,6 +126,8 @@ void ConfigureEnhancements::ApplyConfiguration() {
|
|||
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.filter_mode,
|
||||
ui->toggle_linear_filter, linear_filter);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_integer_scaling,
|
||||
ui->use_integer_scaling, use_integer_scaling);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.texture_filter,
|
||||
ui->texture_filter_combobox);
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.dump_textures,
|
||||
|
|
@ -146,6 +149,7 @@ void ConfigureEnhancements::SetupPerGameUI() {
|
|||
ui->widget_resolution->setEnabled(Settings::values.resolution_factor.UsingGlobal());
|
||||
ui->widget_texture_filter->setEnabled(Settings::values.texture_filter.UsingGlobal());
|
||||
ui->toggle_linear_filter->setEnabled(Settings::values.filter_mode.UsingGlobal());
|
||||
ui->use_integer_scaling->setEnabled(Settings::values.use_integer_scaling.UsingGlobal());
|
||||
ui->toggle_dump_textures->setEnabled(Settings::values.dump_textures.UsingGlobal());
|
||||
ui->toggle_custom_textures->setEnabled(Settings::values.custom_textures.UsingGlobal());
|
||||
ui->toggle_preload_textures->setEnabled(Settings::values.preload_textures.UsingGlobal());
|
||||
|
|
@ -164,6 +168,8 @@ void ConfigureEnhancements::SetupPerGameUI() {
|
|||
|
||||
ConfigurationShared::SetColoredTristate(ui->toggle_linear_filter, Settings::values.filter_mode,
|
||||
linear_filter);
|
||||
ConfigurationShared::SetColoredTristate(
|
||||
ui->use_integer_scaling, Settings::values.use_integer_scaling, use_integer_scaling);
|
||||
ConfigurationShared::SetColoredTristate(ui->toggle_dump_textures,
|
||||
Settings::values.dump_textures, dump_textures);
|
||||
ConfigurationShared::SetColoredTristate(ui->toggle_custom_textures,
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ private:
|
|||
|
||||
std::unique_ptr<Ui::ConfigureEnhancements> ui;
|
||||
ConfigurationShared::CheckState linear_filter;
|
||||
ConfigurationShared::CheckState use_integer_scaling;
|
||||
ConfigurationShared::CheckState dump_textures;
|
||||
ConfigurationShared::CheckState custom_textures;
|
||||
ConfigurationShared::CheckState preload_textures;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>440</width>
|
||||
<width>639</width>
|
||||
<height>950</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
@ -110,6 +110,13 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="use_integer_scaling">
|
||||
<property name="text">
|
||||
<string>Use Integer Scaling (if layout allows)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="toggle_linear_filter">
|
||||
<property name="text">
|
||||
|
|
@ -318,14 +325,14 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="disable_right_eye_render">
|
||||
<property name="text">
|
||||
<string>Disable right eye rendering</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Disable Right Eye Rendering</p><p>Disables rendering the right eye image when not using stereoscopic mode. Greatly improves performance in some applications, but can cause flickering in others.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="disable_right_eye_render">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Disable Right Eye Rendering</p><p>Disables rendering the right eye image when not using stereoscopic mode. Greatly improves performance in some applications, but can cause flickering in others.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disable right eye rendering</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ void SdlConfig::ReadValues() {
|
|||
ReadSetting("Renderer", Settings::values.shaders_accurate_mul);
|
||||
ReadSetting("Renderer", Settings::values.use_shader_jit);
|
||||
ReadSetting("Renderer", Settings::values.resolution_factor);
|
||||
ReadSetting("Renderer", Settings::values.use_integer_scaling);
|
||||
ReadSetting("Renderer", Settings::values.use_disk_shader_cache);
|
||||
ReadSetting("Renderer", Settings::values.frame_limit);
|
||||
ReadSetting("Renderer", Settings::values.use_vsync_new);
|
||||
|
|
@ -156,6 +157,7 @@ void SdlConfig::ReadValues() {
|
|||
ReadSetting("Renderer", Settings::values.pp_shader_name);
|
||||
ReadSetting("Renderer", Settings::values.anaglyph_shader_name);
|
||||
ReadSetting("Renderer", Settings::values.filter_mode);
|
||||
ReadSetting("Renderer", Settings::values.use_integer_scaling);
|
||||
|
||||
ReadSetting("Renderer", Settings::values.bg_red);
|
||||
ReadSetting("Renderer", Settings::values.bg_green);
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ void LogSettings() {
|
|||
log_setting("Renderer_ShadersAccurateMul", values.shaders_accurate_mul.GetValue());
|
||||
log_setting("Renderer_UseShaderJit", values.use_shader_jit.GetValue());
|
||||
log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue());
|
||||
log_setting("Renderer_UseIntegerScaling",values.use_integer_scaling.GetValue());
|
||||
log_setting("Renderer_FrameLimit", values.frame_limit.GetValue());
|
||||
log_setting("Renderer_VSyncNew", values.use_vsync_new.GetValue());
|
||||
log_setting("Renderer_PostProcessingShader", values.pp_shader_name.GetValue());
|
||||
|
|
@ -202,6 +203,7 @@ void RestoreGlobalState(bool is_powered_on) {
|
|||
values.shaders_accurate_mul.SetGlobal(true);
|
||||
values.use_vsync_new.SetGlobal(true);
|
||||
values.resolution_factor.SetGlobal(true);
|
||||
values.use_integer_scaling.SetGlobal(true);
|
||||
values.frame_limit.SetGlobal(true);
|
||||
values.texture_filter.SetGlobal(true);
|
||||
values.texture_sampling.SetGlobal(true);
|
||||
|
|
|
|||
|
|
@ -509,6 +509,7 @@ struct Values {
|
|||
SwitchableSetting<bool> use_vsync_new{true, "use_vsync_new"};
|
||||
Setting<bool> use_shader_jit{true, "use_shader_jit"};
|
||||
SwitchableSetting<u32, true> resolution_factor{1, 0, 10, "resolution_factor"};
|
||||
SwitchableSetting<bool> use_integer_scaling{false, "use_integer_scaling"};
|
||||
SwitchableSetting<double, true> frame_limit{100, 0, 1000, "frame_limit"};
|
||||
SwitchableSetting<double, true> turbo_limit{200, 0, 1000, "turbo_limit"};
|
||||
SwitchableSetting<TextureFilter> texture_filter{TextureFilter::NoFilter, "texture_filter"};
|
||||
|
|
|
|||
|
|
@ -34,6 +34,17 @@ static Common::Rectangle<T> MaxRectangle(Common::Rectangle<T> window_area,
|
|||
static_cast<T>(std::round(scale * window_aspect_ratio))};
|
||||
}
|
||||
|
||||
// returns a scaled down version of a rectangle so that the new height is a perfect integer scale of
|
||||
// a given height
|
||||
template <class T>
|
||||
static Common::Rectangle<T> ScaleToIntegerHeight(Common::Rectangle<T> original, int heightBasis) {
|
||||
u32 newHeight = heightBasis * (static_cast<int>(original.GetHeight()) / heightBasis);
|
||||
if (newHeight <= 0) {return original;}
|
||||
u32 newWidth = static_cast<u32>(original.GetWidth() *
|
||||
(static_cast<float>(newHeight) / original.GetHeight()));
|
||||
return Common::Rectangle<T>{0, 0, newWidth, newHeight};
|
||||
}
|
||||
|
||||
FramebufferLayout DefaultFrameLayout(u32 width, u32 height, bool swapped, bool upright) {
|
||||
return LargeFrameLayout(width, height, swapped, upright, 1.0f,
|
||||
Settings::SmallScreenPosition::BelowLarge);
|
||||
|
|
@ -95,7 +106,10 @@ FramebufferLayout SingleFrameLayout(u32 width, u32 height, bool swapped, bool up
|
|||
|
||||
top_screen = MaxRectangle(screen_window_area, emulation_aspect_ratio);
|
||||
bot_screen = MaxRectangle(screen_window_area, emulation_aspect_ratio);
|
||||
|
||||
if (Settings::values.use_integer_scaling) {
|
||||
top_screen = ScaleToIntegerHeight(top_screen, Core::kScreenTopHeight);
|
||||
bot_screen = ScaleToIntegerHeight(bot_screen, Core::kScreenBottomHeight);
|
||||
}
|
||||
if (window_aspect_ratio < emulation_aspect_ratio) {
|
||||
top_screen =
|
||||
top_screen.TranslateX((screen_window_area.GetWidth() - top_screen.GetWidth()) / 2);
|
||||
|
|
@ -106,8 +120,13 @@ FramebufferLayout SingleFrameLayout(u32 width, u32 height, bool swapped, bool up
|
|||
bot_screen = bot_screen.TranslateY((height - bot_screen.GetHeight()) / 2);
|
||||
}
|
||||
#else
|
||||
|
||||
top_screen = MaxRectangle(screen_window_area, TOP_SCREEN_ASPECT_RATIO);
|
||||
bot_screen = MaxRectangle(screen_window_area, BOT_SCREEN_ASPECT_RATIO);
|
||||
if (Settings::values.use_integer_scaling) {
|
||||
top_screen = ScaleToIntegerHeight(top_screen, Core::kScreenTopHeight);
|
||||
bot_screen = ScaleToIntegerHeight(bot_screen, Core::kScreenBottomHeight);
|
||||
}
|
||||
|
||||
const bool stretched = (Settings::values.screen_top_stretch.GetValue() && !swapped) ||
|
||||
(Settings::values.screen_bottom_stretch.GetValue() && swapped);
|
||||
|
|
@ -150,16 +169,14 @@ FramebufferLayout LargeFrameLayout(u32 width, u32 height, bool swapped, bool upr
|
|||
FramebufferLayout res{width, height, true, true, {}, {}, !upright};
|
||||
// Split the window into two parts. Give proportional width to the smaller screen
|
||||
// To do that, find the total emulation box and maximize that based on window size
|
||||
u32 gap = (u32)(Settings::values.screen_gap.GetValue() * scale_factor);
|
||||
u32 gap = (u32)(Settings::values.screen_gap.GetValue());
|
||||
|
||||
float large_height =
|
||||
swapped ? Core::kScreenBottomHeight * scale_factor : Core::kScreenTopHeight * scale_factor;
|
||||
float small_height =
|
||||
static_cast<float>(swapped ? Core::kScreenTopHeight : Core::kScreenBottomHeight);
|
||||
float large_width =
|
||||
swapped ? Core::kScreenBottomWidth * scale_factor : Core::kScreenTopWidth * scale_factor;
|
||||
float small_width =
|
||||
static_cast<float>(swapped ? Core::kScreenTopWidth : Core::kScreenBottomWidth);
|
||||
float large_height = swapped ? Core::kScreenBottomHeight : Core::kScreenTopHeight;
|
||||
float small_height = static_cast<float>(swapped ? Core::kScreenTopHeight / scale_factor
|
||||
: Core::kScreenBottomHeight / scale_factor);
|
||||
float large_width = swapped ? Core::kScreenBottomWidth : Core::kScreenTopWidth;
|
||||
float small_width = static_cast<float>(swapped ? Core::kScreenTopWidth / scale_factor
|
||||
: Core::kScreenBottomWidth / scale_factor);
|
||||
|
||||
float emulation_width;
|
||||
float emulation_height;
|
||||
|
|
@ -177,7 +194,9 @@ FramebufferLayout LargeFrameLayout(u32 width, u32 height, bool swapped, bool upr
|
|||
|
||||
Common::Rectangle<u32> screen_window_area{0, 0, width, height};
|
||||
Common::Rectangle<u32> total_rect = MaxRectangle(screen_window_area, emulation_aspect_ratio);
|
||||
// TODO: Wtf does this `scale_amount` value represent? -OS
|
||||
if (Settings::values.use_integer_scaling) {
|
||||
total_rect = ScaleToIntegerHeight(total_rect, static_cast<int>(emulation_height));
|
||||
}
|
||||
const float scale_amount = static_cast<float>(total_rect.GetHeight()) / emulation_height;
|
||||
gap = static_cast<u32>(static_cast<float>(gap) * scale_amount);
|
||||
|
||||
|
|
@ -298,11 +317,16 @@ FramebufferLayout HybridScreenLayout(u32 width, u32 height, bool swapped, bool u
|
|||
|
||||
Common::Rectangle<u32> screen_window_area{0, 0, width, height};
|
||||
Common::Rectangle<u32> total_rect = MaxRectangle(screen_window_area, hybrid_area_aspect_ratio);
|
||||
if (Settings::values.use_integer_scaling.GetValue()) {
|
||||
total_rect = ScaleToIntegerHeight(total_rect,Core::kScreenBottomHeight);
|
||||
}
|
||||
Common::Rectangle<u32> large_main_screen = MaxRectangle(total_rect, main_screen_aspect_ratio);
|
||||
Common::Rectangle<u32> side_rect = total_rect.Scale(1.f / scale_factor);
|
||||
Common::Rectangle<u32> small_top_screen = MaxRectangle(side_rect, top_screen_aspect_ratio);
|
||||
Common::Rectangle<u32> small_bottom_screen = MaxRectangle(side_rect, bot_screen_aspect_ratio);
|
||||
|
||||
|
||||
|
||||
if (window_aspect_ratio < hybrid_area_aspect_ratio) {
|
||||
large_main_screen = large_main_screen.TranslateX((width - total_rect.GetWidth()) / 2);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue