diff --git a/src/android/app/src/main/jni/config.cpp b/src/android/app/src/main/jni/config.cpp index 75c16d2a8..d29346e52 100644 --- a/src/android/app/src/main/jni/config.cpp +++ b/src/android/app/src/main/jni/config.cpp @@ -201,7 +201,6 @@ void Config::ReadValues() { ReadSetting("Layout", Settings::values.custom_portrait_bottom_bottom); #endif - // Utility ReadSetting("Utility", Settings::values.dump_textures); ReadSetting("Utility", Settings::values.custom_textures); diff --git a/src/common/settings.h b/src/common/settings.h index f12d37365..ab1c0b063 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -204,8 +204,8 @@ public: explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val, const std::string& name) requires(ranged) - : value{default_val}, - default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {} + : value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val}, + label{name} {} /** * Returns a reference to the setting's value. @@ -450,7 +450,7 @@ struct Values { Setting allow_plugin_loader{true, "allow_plugin_loader"}; // Renderer - SwitchableSetting graphics_api { + SwitchableSetting graphics_api{ #if defined(ENABLE_OPENGL) GraphicsAPI::OpenGL, #elif defined(ENABLE_VULKAN) @@ -461,8 +461,7 @@ struct Values { // TODO: Add a null renderer backend for this, perhaps. #error "At least one renderer must be enabled." #endif - GraphicsAPI::Software, GraphicsAPI::Vulkan, "graphics_api" - }; + GraphicsAPI::Software, GraphicsAPI::Vulkan, "graphics_api"}; SwitchableSetting physical_device{0, "physical_device"}; Setting use_gles{false, "use_gles"}; Setting renderer_debug{false, "renderer_debug"}; @@ -499,17 +498,15 @@ struct Values { Setting custom_bottom_bottom{480, "custom_bottom_bottom"}; Setting custom_second_layer_opacity{100, "custom_second_layer_opacity"}; -#ifdef ANDROID - Setting custom_portrait_layout{false, "custom_portrait_layout"}; - Setting custom_portrait_top_left{0, "custom_portrait_top_left"}; - Setting custom_portrait_top_top{0, "custom_portrait_top_top"}; - Setting custom_portrait_top_right{400, "custom_portrait_top_right"}; - Setting custom_portrait_top_bottom{240, "custom_portrait_top_bottom"}; - Setting custom_portrait_bottom_left{40, "custom_portrait_bottom_left"}; - Setting custom_portrait_bottom_top{240, "custom_portrait_bottom_top"}; - Setting custom_portrait_bottom_right{360, "custom_portrait_bottom_right"}; - Setting custom_portrait_bottom_bottom{480, "custom_portrait_bottom_bottom"}; -#endif + Setting custom_portrait_layout{false, "custom_portrait_layout"}; + Setting custom_portrait_top_left{0, "custom_portrait_top_left"}; + Setting custom_portrait_top_top{0, "custom_portrait_top_top"}; + Setting custom_portrait_top_right{400, "custom_portrait_top_right"}; + Setting custom_portrait_top_bottom{240, "custom_portrait_top_bottom"}; + Setting custom_portrait_bottom_left{40, "custom_portrait_bottom_left"}; + Setting custom_portrait_bottom_top{240, "custom_portrait_bottom_top"}; + Setting custom_portrait_bottom_right{360, "custom_portrait_bottom_right"}; + Setting custom_portrait_bottom_bottom{480, "custom_portrait_bottom_bottom"}; SwitchableSetting bg_red{0.f, "bg_red"}; SwitchableSetting bg_green{0.f, "bg_green"}; diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp index 3bb8eb40d..f586081b1 100644 --- a/src/core/frontend/emu_window.cpp +++ b/src/core/frontend/emu_window.cpp @@ -183,8 +183,8 @@ void EmuWindow::UpdateCurrentFramebufferLayout(u32 width, u32 height, bool is_po const auto min_size = Layout::GetMinimumSizeFromLayout(layout_option, Settings::values.upright_screen.GetValue()); - if ((Settings::values.custom_layout.GetValue() == true && ! is_portrait_mode) || - (Settings::values.custom_portrait_layout.GetValue() == true && is_portrait_mode)) { + if ((Settings::values.custom_layout.GetValue() == true && !is_portrait_mode) || + (Settings::values.custom_portrait_layout.GetValue() == true && is_portrait_mode)) { layout = Layout::CustomFrameLayout(width, height, Settings::values.swap_screen.GetValue(), is_portrait_mode); } else { diff --git a/src/core/frontend/framebuffer_layout.cpp b/src/core/frontend/framebuffer_layout.cpp index 94f328895..5385d7368 100644 --- a/src/core/frontend/framebuffer_layout.cpp +++ b/src/core/frontend/framebuffer_layout.cpp @@ -376,30 +376,22 @@ FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped, bool ASSERT(height > 0); FramebufferLayout res{width, height, true, true, {}, {}, !Settings::values.upright_screen}; - u16 top_left = is_portrait_mode ? - Settings::values.custom_portrait_top_left.GetValue() : - Settings::values.custom_top_left.GetValue(); - u16 top_right = is_portrait_mode ? - Settings::values.custom_portrait_top_right.GetValue() : - Settings::values.custom_top_right.GetValue(); - u16 top_top = is_portrait_mode ? - Settings::values.custom_portrait_top_top.GetValue() : - Settings::values.custom_top_top.GetValue(); - u16 top_bottom = is_portrait_mode ? - Settings::values.custom_portrait_top_bottom.GetValue() : - Settings::values.custom_top_bottom.GetValue(); - u16 bottom_left = is_portrait_mode ? - Settings::values.custom_portrait_bottom_left.GetValue() : - Settings::values.custom_bottom_left.GetValue(); - u16 bottom_right = is_portrait_mode ? - Settings::values.custom_portrait_bottom_right.GetValue() : - Settings::values.custom_bottom_right.GetValue(); - u16 bottom_top = is_portrait_mode ? - Settings::values.custom_portrait_bottom_top.GetValue() : - Settings::values.custom_bottom_top.GetValue(); - u16 bottom_bottom = is_portrait_mode ? - Settings::values.custom_portrait_bottom_bottom.GetValue() : - Settings::values.custom_bottom_bottom.GetValue(); + u16 top_left = is_portrait_mode ? Settings::values.custom_portrait_top_left.GetValue() + : Settings::values.custom_top_left.GetValue(); + u16 top_right = is_portrait_mode ? Settings::values.custom_portrait_top_right.GetValue() + : Settings::values.custom_top_right.GetValue(); + u16 top_top = is_portrait_mode ? Settings::values.custom_portrait_top_top.GetValue() + : Settings::values.custom_top_top.GetValue(); + u16 top_bottom = is_portrait_mode ? Settings::values.custom_portrait_top_bottom.GetValue() + : Settings::values.custom_top_bottom.GetValue(); + u16 bottom_left = is_portrait_mode ? Settings::values.custom_portrait_bottom_left.GetValue() + : Settings::values.custom_bottom_left.GetValue(); + u16 bottom_right = is_portrait_mode ? Settings::values.custom_portrait_bottom_right.GetValue() + : Settings::values.custom_bottom_right.GetValue(); + u16 bottom_top = is_portrait_mode ? Settings::values.custom_portrait_bottom_top.GetValue() + : Settings::values.custom_bottom_top.GetValue(); + u16 bottom_bottom = is_portrait_mode ? Settings::values.custom_portrait_bottom_bottom.GetValue() + : Settings::values.custom_bottom_bottom.GetValue(); Common::Rectangle top_screen{top_left, top_top, top_right, top_bottom}; Common::Rectangle bot_screen{bottom_left, bottom_top, bottom_right, bottom_bottom}; @@ -416,21 +408,20 @@ FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped, bool FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondary) { bool is_portrait_mode = - Settings::values.layout_option.GetValue() == Settings::LayoutOption::MobilePortrait; - if (Settings::values.custom_layout.GetValue() == true && ! is_portrait_mode) { + Settings::values.layout_option.GetValue() == Settings::LayoutOption::MobilePortrait; + if (Settings::values.custom_layout.GetValue() == true && !is_portrait_mode) { return 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(), - is_portrait_mode); - }else if (Settings::values.custom_portrait_layout.GetValue() == true && is_portrait_mode) { - return CustomFrameLayout(std::max(Settings::values.custom_portrait_top_right.GetValue(), - Settings::values.custom_portrait_bottom_right.GetValue()), - std::max(Settings::values.custom_portrait_top_bottom.GetValue(), - Settings::values.custom_portrait_bottom_bottom.GetValue()), - Settings::values.swap_screen.GetValue(), - is_portrait_mode); + Settings::values.swap_screen.GetValue(), is_portrait_mode); + } else if (Settings::values.custom_portrait_layout.GetValue() == true && is_portrait_mode) { + return CustomFrameLayout( + std::max(Settings::values.custom_portrait_top_right.GetValue(), + Settings::values.custom_portrait_bottom_right.GetValue()), + std::max(Settings::values.custom_portrait_top_bottom.GetValue(), + Settings::values.custom_portrait_bottom_bottom.GetValue()), + Settings::values.swap_screen.GetValue(), is_portrait_mode); } int width, height; diff --git a/src/core/frontend/framebuffer_layout.h b/src/core/frontend/framebuffer_layout.h index 79f8a8039..37cbb564c 100644 --- a/src/core/frontend/framebuffer_layout.h +++ b/src/core/frontend/framebuffer_layout.h @@ -145,7 +145,8 @@ FramebufferLayout SeparateWindowsLayout(u32 width, u32 height, bool is_secondary * @param height Window framebuffer height in pixels * @return Newly created FramebufferLayout object with default screen regions initialized */ -FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped, bool is_portrait_mode = false); +FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped, + bool is_portrait_mode = false); /** * Convenience method to get frame layout by resolution scale