From 0313178d32c70445a85580c67dcaf1fc69ac19d4 Mon Sep 17 00:00:00 2001 From: blakdulz Date: Fri, 12 May 2023 17:39:52 +0700 Subject: [PATCH] QT add Custom Layout Menu Option. This add Custom Layout selector in Both Menu and Enhancment Setting. This will allow to use or change Custom Layout mode or by using toggle. Still No Overlay Editor, just manual edit box, and this Not saved or carried at per game settings --- src/common/settings.h | 1 + src/core/frontend/emu_window.cpp | 4 + src/core/frontend/framebuffer_layout.cpp | 8 + .../configuration/configure_enhancements.cpp | 17 + .../configuration/configure_enhancements.ui | 1285 ++++++++++------- src/lime_qt/main.cpp | 8 + src/lime_qt/main.ui | 9 + 7 files changed, 786 insertions(+), 546 deletions(-) diff --git a/src/common/settings.h b/src/common/settings.h index e7228aef3..e52116c19 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -42,6 +42,7 @@ enum class LayoutOption : u32 { SeparateWindows, #endif HybridScreen, + CustomLayout, // Similiar to default, but better for mobile devices in portrait mode. Top screen in clamped to // the top of the frame, and the bottom screen is enlarged to match the top screen. MobilePortrait, diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index 63c446983..15e11d294 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -228,6 +228,10 @@ void EmuWindow::UpdateCurrentFramebufferLayout(u32 width, u32 height, bool is_po Layout::LargeFrameLayout(width, height, Settings::values.swap_screen.GetValue(), false, 2.25f, Layout::VerticalAlignment::Top); break; + case Settings::LayoutOption::CustomLayout: + layout = + Layout::CustomFrameLayout(width, height, Settings::values.swap_screen.GetValue()); + break; case Settings::LayoutOption::Default: default: layout = diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index 11d2249ac..19f1a27ac 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp @@ -482,6 +482,14 @@ FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondar large_screen_proportion, VerticalAlignment::Top); } + case Settings::LayoutOption::CustomLayout: + layout = CustomFrameLayout(std::max(Settings::values.custom_top_right.GetValue(), + Settings::values.custom_bottom_right.GetValue()), + std::max(Settings::values.custom_top_bottom.GetValue(), + Settings::values.custom_bottom_bottom.GetValue()), + Settings::values.swap_screen.GetValue()); + break; + case Settings::LayoutOption::Default: default: width = Core::kScreenTopWidth * res_scale; diff --git a/src/lime_qt/configuration/configure_enhancements.cpp b/src/lime_qt/configuration/configure_enhancements.cpp index 0d7162595..637c40762 100644 --- a/src/lime_qt/configuration/configure_enhancements.cpp +++ b/src/lime_qt/configuration/configure_enhancements.cpp @@ -83,6 +83,14 @@ void ConfigureEnhancements::SetConfiguration() { ui->toggle_swap_screen->setChecked(Settings::values.swap_screen.GetValue()); ui->toggle_upright_screen->setChecked(Settings::values.upright_screen.GetValue()); ui->large_screen_proportion->setValue(Settings::values.large_screen_proportion.GetValue()); + ui->custom_top_left->setValue(Settings::values.custom_top_left.GetValue()); + ui->custom_top_top->setValue(Settings::values.custom_top_top.GetValue()); + ui->custom_top_right->setValue(Settings::values.custom_top_right.GetValue()); + ui->custom_top_bottom->setValue(Settings::values.custom_top_bottom.GetValue()); + ui->custom_bottom_left->setValue(Settings::values.custom_bottom_left.GetValue()); + ui->custom_bottom_top->setValue(Settings::values.custom_bottom_top.GetValue()); + ui->custom_bottom_right->setValue(Settings::values.custom_bottom_right.GetValue()); + ui->custom_bottom_bottom->setValue(Settings::values.custom_bottom_bottom.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()); @@ -150,6 +158,15 @@ void ConfigureEnhancements::ApplyConfiguration() { } Settings::values.large_screen_proportion = ui->large_screen_proportion->value(); + Settings::values.custom_top_left = ui->custom_top_left->value(); + Settings::values.custom_top_top = ui->custom_top_top->value(); + Settings::values.custom_top_right = ui->custom_top_right->value(); + Settings::values.custom_top_bottom = ui->custom_top_bottom->value(); + Settings::values.custom_bottom_left = ui->custom_bottom_left->value(); + Settings::values.custom_bottom_top = ui->custom_bottom_top->value(); + Settings::values.custom_bottom_right = ui->custom_bottom_right->value(); + Settings::values.custom_bottom_bottom = ui->custom_bottom_bottom->value(); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.filter_mode, ui->toggle_linear_filter, linear_filter); ConfigurationShared::ApplyPerGameSetting(&Settings::values.texture_filter, diff --git a/src/lime_qt/configuration/configure_enhancements.ui b/src/lime_qt/configuration/configure_enhancements.ui index ef77b2bc6..bbfca444a 100644 --- a/src/lime_qt/configuration/configure_enhancements.ui +++ b/src/lime_qt/configuration/configure_enhancements.ui @@ -1,549 +1,742 @@ - ConfigureEnhancements - - - - 0 - 0 - 440 - 748 - - - - - 0 - 0 - - - - Form - - - - - - Renderer - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Internal Resolution - - - - - - - - Auto (Window Size) - - - - - Native (400x240) - - - - - 2x Native (800x480) - - - - - 3x Native (1200x720) - - - - - 4x Native (1600x960) - - - - - 5x Native (2000x1200) - - - - - 6x Native (2400x1440) - - - - - 7x Native (2800x1680) - - - - - 8x Native (3200x1920) - - - - - 9x Native (3600x2160) - - - - - 10x Native (4000x2400) - - - - - - - - - - - Enable Linear Filtering - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Post-Processing Shader - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Texture Filter - - - - - - - - None - - - - - Anime4K - - - - - Bicubic - - - - - ScaleForce - - - - - xBRZ - - - - - MMPX - - - - - - - - - - - - - - Stereoscopy - - - - - - - - Stereoscopic 3D Mode - - - - - - - - Off - - - - - Side by Side - - - - - Anaglyph - - - - - Interlaced - - - - - Reverse Interlaced - - - - - - - - - - - - Depth - - - - - - - % - - - 0 - - - 100 - - - 0 - - - - - - - - - - - Eye to Render in Monoscopic Mode - - - - - - - - Left Eye (default) - - - - - Right Eye - - - - - - - - - - - - - Layout - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Screen Layout: - - - - - - - - Default - - - - - Single Screen - - - - - Large Screen - - - - - Side by Side - - - - - Separate Windows - - - - - Hybrid Screen - - - - - - - - - - - Swap Screens - - - - - - - Rotate Screens Upright - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Large Screen Proportion: - - - - - - - 1.000000000000000 - - - 16.000000000000000 - - - 4.000000000000000 - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Background Color: - - - - - - - - 40 - 16777215 - - - - - - - - - - - - - - Utility - - - - - - <html><head/><body><p>Replace textures with PNG files.</p><p>Textures are loaded from load/textures/[Title ID]/.</p></body></html> - - - Use Custom Textures - - - - - - - <html><head/><body><p>Dump textures to PNG files.</p><p>Textures are dumped to dump/textures/[Title ID]/.</p></body></html> - - - Dump Textures - - - - - - - <html><head/><body><p>Load all custom textures into memory on boot, instead of loading them when the game requires them.</p></body></html> - - - Preload Custom Textures - - - - - - - <html><head/><body><p>Load custom textures asynchronously with background threads to reduce loading stutter</p></body></html> - - - Async Custom Texture Loading - - - - - - - - - - Qt::Vertical - - - - 20 - 165 - - - - - - - - resolution_factor_combobox - toggle_linear_filter - shader_combobox - texture_filter_combobox - render_3d_combobox - factor_3d - mono_rendering_eye - layout_combobox - toggle_swap_screen - toggle_upright_screen - large_screen_proportion - bg_button - toggle_custom_textures - toggle_dump_textures - toggle_preload_textures - - - + ConfigureEnhancements + + + + 0 + 0 + 440 + 748 + + + + + 0 + 0 + + + + Form + + + + + + + 0 + 480 + + + + QFrame::NoFrame + + + 1 + + + true + + + + + 0 + 0 + 422 + 932 + + + + + + + Renderer + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Internal Resolution + + + + + + + + Auto (Window Size) + + + + + Native (400x240) + + + + + 2x Native (800x480) + + + + + 3x Native (1200x720) + + + + + 4x Native (1600x960) + + + + + 5x Native (2000x1200) + + + + + 6x Native (2400x1440) + + + + + 7x Native (2800x1680) + + + + + 8x Native (3200x1920) + + + + + 9x Native (3600x2160) + + + + + 10x Native (4000x2400) + + + + + + + + + + + Enable Linear Filtering + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Post-Processing Shader + + + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Texture Filter + + + + + + + + None + + + + + Anime4K + + + + + Bicubic + + + + + Nearest Neighbor + + + + + ScaleForce + + + + + xBRZ + + + + + + + + + + + + + + Stereoscopy + + + + + + + + Stereoscopic 3D Mode + + + + + + + + Off + + + + + Side by Side + + + + + Anaglyph + + + + + Interlaced + + + + + Reverse Interlaced + + + + + + + + + + + + Depth + + + + + + + % + + + 0 + + + 100 + + + 0 + + + + + + + + + + + Eye to Render in Monoscopic Mode + + + + + + + + Left Eye (default) + + + + + Right Eye + + + + + + + + + + + + + Layout + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Screen Layout: + + + + + + + + Default + + + + + Single Screen + + + + + Large Screen + + + + + Side by Side + + + + + Separate Windows + + + + + Custom Layout + + + + + + + + + + + Swap Screens + + + + + + + Rotate Screens Upright + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Large Screen Proportion: + + + + + + + 1.000000000000000 + + + 16.000000000000000 + + + 4.000000000000000 + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Background Color: + + + + + + + + 40 + 16777215 + + + + + + + + + + + + 0 + 0 + + + + Custom Layout + + + + + + Top Screen + + + + + + Left + + + + + + + QAbstractSpinBox::NoButtons + + + 2147483647 + + + + + + + Top + + + + + + + QAbstractSpinBox::NoButtons + + + 2147483647 + + + + + + + Right + + + + + + + QAbstractSpinBox::NoButtons + + + 2147483647 + + + + + + + Bottom + + + + + + + QAbstractSpinBox::NoButtons + + + 2147483647 + + + + + + + + + + + 0 + 0 + + + + Bottom Screen + + + + + + Left + + + + + + + QAbstractSpinBox::NoButtons + + + 2147483647 + + + + + + + Top + + + + + + + QAbstractSpinBox::NoButtons + + + 2147483647 + + + + + + + Right + + + + + + + QAbstractSpinBox::NoButtons + + + 2147483647 + + + + + + + Bottom + + + + + + + QAbstractSpinBox::NoButtons + + + 2147483647 + + + + + + + + + + + + + + + + Utility + + + + + + <html><head/><body><p>Replace textures with PNG files.</p><p>Textures are loaded from load/textures/[Title ID]/.</p></body></html> + + + Use Custom Textures + + + + + + + <html><head/><body><p>Dump textures to PNG files.</p><p>Textures are dumped to dump/textures/[Title ID]/.</p></body></html> + + + Dump Textures + + + + + + + <html><head/><body><p>Load all custom textures into memory on boot, instead of loading them when the game requires them.</p></body></html> + + + Preload Custom Textures + + + + + + + <html><head/><body><p>Load custom textures asynchronously with background threads to reduce loading stutter</p></body></html> + + + Async Custom Texture Loading + + + + + + + + + + + + + + resolution_factor_combobox + toggle_linear_filter + shader_combobox + texture_filter_combobox + render_3d_combobox + factor_3d + mono_rendering_eye + layout_combobox + toggle_swap_screen + toggle_upright_screen + large_screen_proportion + bg_button + toggle_custom_textures + toggle_dump_textures + toggle_preload_textures + + + diff --git a/src/lime_qt/main.cpp b/src/lime_qt/main.cpp index 8e254ba08..8caf078b5 100644 --- a/src/lime_qt/main.cpp +++ b/src/lime_qt/main.cpp @@ -468,6 +468,7 @@ void GMainWindow::InitializeWidgets() { actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Hybrid_Screen); actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Side_by_Side); actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Separate_Windows); + actionGroup_ScreenLayouts->addAction(ui->action_Screen_Layout_Custom_Layout); } void GMainWindow::InitializeDebugWidgets() { @@ -923,6 +924,7 @@ void GMainWindow::ConnectMenuEvents() { connect_menu(ui->action_Screen_Layout_Hybrid_Screen, &GMainWindow::ChangeScreenLayout); connect_menu(ui->action_Screen_Layout_Side_by_Side, &GMainWindow::ChangeScreenLayout); connect_menu(ui->action_Screen_Layout_Separate_Windows, &GMainWindow::ChangeScreenLayout); + connect_menu(ui->action_Screen_Layout_Custom_Layout, &GMainWindow::ChangeScreenLayout); connect_menu(ui->action_Screen_Layout_Swap_Screens, &GMainWindow::OnSwapScreens); connect_menu(ui->action_Screen_Layout_Upright_Screens, &GMainWindow::OnRotateScreens); @@ -2406,6 +2408,8 @@ void GMainWindow::ChangeScreenLayout() { new_layout = Settings::LayoutOption::SideScreen; } else if (ui->action_Screen_Layout_Separate_Windows->isChecked()) { new_layout = Settings::LayoutOption::SeparateWindows; + } else if (ui->action_Screen_Layout_Custom_Layout->isChecked()) { + new_layout = Settings::LayoutOption::CustomLayout; } Settings::values.layout_option = new_layout; @@ -2427,6 +2431,8 @@ void GMainWindow::ToggleScreenLayout() { case Settings::LayoutOption::SideScreen: return Settings::LayoutOption::SeparateWindows; case Settings::LayoutOption::SeparateWindows: + return Settings::LayoutOption::CustomLayout; + case Settings::LayoutOption::CustomLayout: return Settings::LayoutOption::Default; default: LOG_ERROR(Frontend, "Unknown layout option {}", @@ -3463,6 +3469,8 @@ void GMainWindow::SyncMenuUISettings() { Settings::LayoutOption::SideScreen); ui->action_Screen_Layout_Separate_Windows->setChecked( Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows); + ui->action_Screen_Layout_Custom_Layout->setChecked(Settings::values.layout_option.GetValue() == + Settings::LayoutOption::CustomLayout); ui->action_Screen_Layout_Swap_Screens->setChecked(Settings::values.swap_screen.GetValue()); ui->action_Screen_Layout_Upright_Screens->setChecked( Settings::values.upright_screen.GetValue()); diff --git a/src/lime_qt/main.ui b/src/lime_qt/main.ui index 7d4fb2471..c381282f5 100644 --- a/src/lime_qt/main.ui +++ b/src/lime_qt/main.ui @@ -138,6 +138,7 @@ + @@ -544,6 +545,14 @@ Separate Windows + + + true + + + Custom Layout + + true