formatting and removed ifdef around setting declaration

This commit is contained in:
David Griswold 2024-07-15 21:43:00 -05:00
parent 33265a7756
commit 4e5ba66038
5 changed files with 43 additions and 55 deletions

View file

@ -201,7 +201,6 @@ void Config::ReadValues() {
ReadSetting("Layout", Settings::values.custom_portrait_bottom_bottom); ReadSetting("Layout", Settings::values.custom_portrait_bottom_bottom);
#endif #endif
// Utility // Utility
ReadSetting("Utility", Settings::values.dump_textures); ReadSetting("Utility", Settings::values.dump_textures);
ReadSetting("Utility", Settings::values.custom_textures); ReadSetting("Utility", Settings::values.custom_textures);

View file

@ -204,8 +204,8 @@ public:
explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val, explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val,
const std::string& name) const std::string& name)
requires(ranged) requires(ranged)
: value{default_val}, : value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val},
default_value{default_val}, maximum{max_val}, minimum{min_val}, label{name} {} label{name} {}
/** /**
* Returns a reference to the setting's value. * Returns a reference to the setting's value.
@ -450,7 +450,7 @@ struct Values {
Setting<bool> allow_plugin_loader{true, "allow_plugin_loader"}; Setting<bool> allow_plugin_loader{true, "allow_plugin_loader"};
// Renderer // Renderer
SwitchableSetting<GraphicsAPI, true> graphics_api { SwitchableSetting<GraphicsAPI, true> graphics_api{
#if defined(ENABLE_OPENGL) #if defined(ENABLE_OPENGL)
GraphicsAPI::OpenGL, GraphicsAPI::OpenGL,
#elif defined(ENABLE_VULKAN) #elif defined(ENABLE_VULKAN)
@ -461,8 +461,7 @@ struct Values {
// TODO: Add a null renderer backend for this, perhaps. // TODO: Add a null renderer backend for this, perhaps.
#error "At least one renderer must be enabled." #error "At least one renderer must be enabled."
#endif #endif
GraphicsAPI::Software, GraphicsAPI::Vulkan, "graphics_api" GraphicsAPI::Software, GraphicsAPI::Vulkan, "graphics_api"};
};
SwitchableSetting<u32> physical_device{0, "physical_device"}; SwitchableSetting<u32> physical_device{0, "physical_device"};
Setting<bool> use_gles{false, "use_gles"}; Setting<bool> use_gles{false, "use_gles"};
Setting<bool> renderer_debug{false, "renderer_debug"}; Setting<bool> renderer_debug{false, "renderer_debug"};
@ -499,17 +498,15 @@ struct Values {
Setting<u16> custom_bottom_bottom{480, "custom_bottom_bottom"}; Setting<u16> custom_bottom_bottom{480, "custom_bottom_bottom"};
Setting<u16> custom_second_layer_opacity{100, "custom_second_layer_opacity"}; Setting<u16> custom_second_layer_opacity{100, "custom_second_layer_opacity"};
#ifdef ANDROID Setting<bool> custom_portrait_layout{false, "custom_portrait_layout"};
Setting<bool> custom_portrait_layout{false, "custom_portrait_layout"}; Setting<u16> custom_portrait_top_left{0, "custom_portrait_top_left"};
Setting<u16> custom_portrait_top_left{0, "custom_portrait_top_left"}; Setting<u16> custom_portrait_top_top{0, "custom_portrait_top_top"};
Setting<u16> custom_portrait_top_top{0, "custom_portrait_top_top"}; Setting<u16> custom_portrait_top_right{400, "custom_portrait_top_right"};
Setting<u16> custom_portrait_top_right{400, "custom_portrait_top_right"}; Setting<u16> custom_portrait_top_bottom{240, "custom_portrait_top_bottom"};
Setting<u16> custom_portrait_top_bottom{240, "custom_portrait_top_bottom"}; Setting<u16> custom_portrait_bottom_left{40, "custom_portrait_bottom_left"};
Setting<u16> custom_portrait_bottom_left{40, "custom_portrait_bottom_left"}; Setting<u16> custom_portrait_bottom_top{240, "custom_portrait_bottom_top"};
Setting<u16> custom_portrait_bottom_top{240, "custom_portrait_bottom_top"}; Setting<u16> custom_portrait_bottom_right{360, "custom_portrait_bottom_right"};
Setting<u16> custom_portrait_bottom_right{360, "custom_portrait_bottom_right"}; Setting<u16> custom_portrait_bottom_bottom{480, "custom_portrait_bottom_bottom"};
Setting<u16> custom_portrait_bottom_bottom{480, "custom_portrait_bottom_bottom"};
#endif
SwitchableSetting<float> bg_red{0.f, "bg_red"}; SwitchableSetting<float> bg_red{0.f, "bg_red"};
SwitchableSetting<float> bg_green{0.f, "bg_green"}; SwitchableSetting<float> bg_green{0.f, "bg_green"};

View file

@ -183,8 +183,8 @@ void EmuWindow::UpdateCurrentFramebufferLayout(u32 width, u32 height, bool is_po
const auto min_size = const auto min_size =
Layout::GetMinimumSizeFromLayout(layout_option, Settings::values.upright_screen.GetValue()); Layout::GetMinimumSizeFromLayout(layout_option, Settings::values.upright_screen.GetValue());
if ((Settings::values.custom_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)) { (Settings::values.custom_portrait_layout.GetValue() == true && is_portrait_mode)) {
layout = Layout::CustomFrameLayout(width, height, Settings::values.swap_screen.GetValue(), layout = Layout::CustomFrameLayout(width, height, Settings::values.swap_screen.GetValue(),
is_portrait_mode); is_portrait_mode);
} else { } else {

View file

@ -376,30 +376,22 @@ FramebufferLayout CustomFrameLayout(u32 width, u32 height, bool is_swapped, bool
ASSERT(height > 0); ASSERT(height > 0);
FramebufferLayout res{width, height, true, true, {}, {}, !Settings::values.upright_screen}; FramebufferLayout res{width, height, true, true, {}, {}, !Settings::values.upright_screen};
u16 top_left = is_portrait_mode ? u16 top_left = is_portrait_mode ? Settings::values.custom_portrait_top_left.GetValue()
Settings::values.custom_portrait_top_left.GetValue() : : Settings::values.custom_top_left.GetValue();
Settings::values.custom_top_left.GetValue(); u16 top_right = is_portrait_mode ? Settings::values.custom_portrait_top_right.GetValue()
u16 top_right = is_portrait_mode ? : Settings::values.custom_top_right.GetValue();
Settings::values.custom_portrait_top_right.GetValue() : u16 top_top = is_portrait_mode ? Settings::values.custom_portrait_top_top.GetValue()
Settings::values.custom_top_right.GetValue(); : Settings::values.custom_top_top.GetValue();
u16 top_top = is_portrait_mode ? u16 top_bottom = is_portrait_mode ? Settings::values.custom_portrait_top_bottom.GetValue()
Settings::values.custom_portrait_top_top.GetValue() : : Settings::values.custom_top_bottom.GetValue();
Settings::values.custom_top_top.GetValue(); u16 bottom_left = is_portrait_mode ? Settings::values.custom_portrait_bottom_left.GetValue()
u16 top_bottom = is_portrait_mode ? : Settings::values.custom_bottom_left.GetValue();
Settings::values.custom_portrait_top_bottom.GetValue() : u16 bottom_right = is_portrait_mode ? Settings::values.custom_portrait_bottom_right.GetValue()
Settings::values.custom_top_bottom.GetValue(); : Settings::values.custom_bottom_right.GetValue();
u16 bottom_left = is_portrait_mode ? u16 bottom_top = is_portrait_mode ? Settings::values.custom_portrait_bottom_top.GetValue()
Settings::values.custom_portrait_bottom_left.GetValue() : : Settings::values.custom_bottom_top.GetValue();
Settings::values.custom_bottom_left.GetValue(); u16 bottom_bottom = is_portrait_mode ? Settings::values.custom_portrait_bottom_bottom.GetValue()
u16 bottom_right = is_portrait_mode ? : Settings::values.custom_bottom_bottom.GetValue();
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<u32> top_screen{top_left, top_top, top_right, top_bottom}; Common::Rectangle<u32> top_screen{top_left, top_top, top_right, top_bottom};
Common::Rectangle<u32> bot_screen{bottom_left, bottom_top, bottom_right, bottom_bottom}; Common::Rectangle<u32> 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) { FramebufferLayout FrameLayoutFromResolutionScale(u32 res_scale, bool is_secondary) {
bool is_portrait_mode = bool is_portrait_mode =
Settings::values.layout_option.GetValue() == Settings::LayoutOption::MobilePortrait; Settings::values.layout_option.GetValue() == Settings::LayoutOption::MobilePortrait;
if (Settings::values.custom_layout.GetValue() == true && ! is_portrait_mode) { if (Settings::values.custom_layout.GetValue() == true && !is_portrait_mode) {
return CustomFrameLayout(std::max(Settings::values.custom_top_right.GetValue(), return CustomFrameLayout(std::max(Settings::values.custom_top_right.GetValue(),
Settings::values.custom_bottom_right.GetValue()), Settings::values.custom_bottom_right.GetValue()),
std::max(Settings::values.custom_top_bottom.GetValue(), std::max(Settings::values.custom_top_bottom.GetValue(),
Settings::values.custom_bottom_bottom.GetValue()), Settings::values.custom_bottom_bottom.GetValue()),
Settings::values.swap_screen.GetValue(), Settings::values.swap_screen.GetValue(), is_portrait_mode);
is_portrait_mode); } else if (Settings::values.custom_portrait_layout.GetValue() == true && is_portrait_mode) {
}else if (Settings::values.custom_portrait_layout.GetValue() == true && is_portrait_mode) { return CustomFrameLayout(
return CustomFrameLayout(std::max(Settings::values.custom_portrait_top_right.GetValue(), std::max(Settings::values.custom_portrait_top_right.GetValue(),
Settings::values.custom_portrait_bottom_right.GetValue()), Settings::values.custom_portrait_bottom_right.GetValue()),
std::max(Settings::values.custom_portrait_top_bottom.GetValue(), std::max(Settings::values.custom_portrait_top_bottom.GetValue(),
Settings::values.custom_portrait_bottom_bottom.GetValue()), Settings::values.custom_portrait_bottom_bottom.GetValue()),
Settings::values.swap_screen.GetValue(), Settings::values.swap_screen.GetValue(), is_portrait_mode);
is_portrait_mode);
} }
int width, height; int width, height;

View file

@ -145,7 +145,8 @@ FramebufferLayout SeparateWindowsLayout(u32 width, u32 height, bool is_secondary
* @param height Window framebuffer height in pixels * @param height Window framebuffer height in pixels
* @return Newly created FramebufferLayout object with default screen regions initialized * @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 * Convenience method to get frame layout by resolution scale