mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
Add custom layout settings.
This commit is contained in:
parent
ac4ea522cb
commit
e0a4450bbd
9 changed files with 104 additions and 13 deletions
|
@ -77,6 +77,23 @@ void Config::ReadValues() {
|
||||||
Settings::values.layout_option =
|
Settings::values.layout_option =
|
||||||
static_cast<Settings::LayoutOption>(sdl2_config->GetInteger("Layout", "layout_option", 0));
|
static_cast<Settings::LayoutOption>(sdl2_config->GetInteger("Layout", "layout_option", 0));
|
||||||
Settings::values.swap_screen = sdl2_config->GetBoolean("Layout", "swap_screen", false);
|
Settings::values.swap_screen = sdl2_config->GetBoolean("Layout", "swap_screen", false);
|
||||||
|
Settings::values.custom_layout = sdl2_config->GetBoolean("Layout", "custom_layout", false);
|
||||||
|
Settings::values.custom_top_left =
|
||||||
|
static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_left", 0));
|
||||||
|
Settings::values.custom_top_top =
|
||||||
|
static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_top", 0));
|
||||||
|
Settings::values.custom_top_right =
|
||||||
|
static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_right", 400));
|
||||||
|
Settings::values.custom_top_bottom =
|
||||||
|
static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_bottom", 240));
|
||||||
|
Settings::values.custom_bottom_left =
|
||||||
|
static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_left", 40));
|
||||||
|
Settings::values.custom_bottom_top =
|
||||||
|
static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_top", 240));
|
||||||
|
Settings::values.custom_bottom_right =
|
||||||
|
static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_right", 360));
|
||||||
|
Settings::values.custom_bottom_bottom =
|
||||||
|
static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_bottom", 480));
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto");
|
Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto");
|
||||||
|
|
|
@ -71,6 +71,21 @@ bg_green =
|
||||||
# 0 (default): Default Top Bottom Screen, 1: Single Screen Only, 2: Large Screen Small Screen
|
# 0 (default): Default Top Bottom Screen, 1: Single Screen Only, 2: Large Screen Small Screen
|
||||||
layout_option =
|
layout_option =
|
||||||
|
|
||||||
|
# Toggle custom layout (using the settings below) on or off.
|
||||||
|
# 0 (default): Off , 1: On
|
||||||
|
custom_layout =
|
||||||
|
|
||||||
|
# Screen placement when using Custom layout option
|
||||||
|
# 0x, 0y is the top left corner of the render window.
|
||||||
|
custom_top_left =
|
||||||
|
custom_top_top =
|
||||||
|
custom_top_right =
|
||||||
|
custom_top_bottom =
|
||||||
|
custom_bottom_left =
|
||||||
|
custom_bottom_top =
|
||||||
|
custom_bottom_right =
|
||||||
|
custom_bottom_bottom =
|
||||||
|
|
||||||
#Whether to toggle frame limiter on or off.
|
#Whether to toggle frame limiter on or off.
|
||||||
# 0: Off , 1 (default): On
|
# 0: Off , 1 (default): On
|
||||||
toggle_framelimit =
|
toggle_framelimit =
|
||||||
|
|
|
@ -57,6 +57,15 @@ void Config::ReadValues() {
|
||||||
Settings::values.layout_option =
|
Settings::values.layout_option =
|
||||||
static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt());
|
static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt());
|
||||||
Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool();
|
Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool();
|
||||||
|
Settings::values.custom_layout = qt_config->value("custom_layout", false).toBool();
|
||||||
|
Settings::values.custom_top_left = qt_config->value("custom_top_left", 0).toInt();
|
||||||
|
Settings::values.custom_top_top = qt_config->value("custom_top_top", 0).toInt();
|
||||||
|
Settings::values.custom_top_right = qt_config->value("custom_top_right", 400).toInt();
|
||||||
|
Settings::values.custom_top_bottom = qt_config->value("custom_top_bottom", 240).toInt();
|
||||||
|
Settings::values.custom_bottom_left = qt_config->value("custom_bottom_left", 40).toInt();
|
||||||
|
Settings::values.custom_bottom_top = qt_config->value("custom_bottom_top", 240).toInt();
|
||||||
|
Settings::values.custom_bottom_right = qt_config->value("custom_bottom_right", 360).toInt();
|
||||||
|
Settings::values.custom_bottom_bottom = qt_config->value("custom_bottom_bottom", 480).toInt();
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
|
|
||||||
qt_config->beginGroup("Audio");
|
qt_config->beginGroup("Audio");
|
||||||
|
@ -166,6 +175,15 @@ void Config::SaveValues() {
|
||||||
qt_config->beginGroup("Layout");
|
qt_config->beginGroup("Layout");
|
||||||
qt_config->setValue("layout_option", static_cast<int>(Settings::values.layout_option));
|
qt_config->setValue("layout_option", static_cast<int>(Settings::values.layout_option));
|
||||||
qt_config->setValue("swap_screen", Settings::values.swap_screen);
|
qt_config->setValue("swap_screen", Settings::values.swap_screen);
|
||||||
|
qt_config->setValue("custom_layout", Settings::values.custom_layout);
|
||||||
|
qt_config->setValue("custom_top_left", Settings::values.custom_top_left);
|
||||||
|
qt_config->setValue("custom_top_top", Settings::values.custom_top_top);
|
||||||
|
qt_config->setValue("custom_top_right", Settings::values.custom_top_right);
|
||||||
|
qt_config->setValue("custom_top_bottom", Settings::values.custom_top_bottom);
|
||||||
|
qt_config->setValue("custom_bottom_left", Settings::values.custom_bottom_left);
|
||||||
|
qt_config->setValue("custom_bottom_top", Settings::values.custom_bottom_top);
|
||||||
|
qt_config->setValue("custom_bottom_right", Settings::values.custom_bottom_right);
|
||||||
|
qt_config->setValue("custom_bottom_bottom", Settings::values.custom_bottom_bottom);
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
|
|
||||||
qt_config->beginGroup("Audio");
|
qt_config->beginGroup("Audio");
|
||||||
|
|
|
@ -14,6 +14,8 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||||
this->setConfiguration();
|
this->setConfiguration();
|
||||||
|
|
||||||
ui->toggle_vsync->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
ui->toggle_vsync->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
||||||
|
|
||||||
|
ui->layoutBox->setEnabled(!Settings::values.custom_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureGraphics::~ConfigureGraphics() {}
|
ConfigureGraphics::~ConfigureGraphics() {}
|
||||||
|
|
|
@ -126,7 +126,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox2">
|
<widget class="QGroupBox" name="layoutBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Layout</string>
|
<string>Layout</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/framebuffer_layout.h"
|
#include "common/framebuffer_layout.h"
|
||||||
|
#include "core/settings.h"
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
|
|
||||||
namespace Layout {
|
namespace Layout {
|
||||||
|
@ -135,4 +136,22 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool swapped
|
||||||
res.bottom_screen = swapped ? large_screen : small_screen;
|
res.bottom_screen = swapped ? large_screen : small_screen;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FramebufferLayout CustomFrameLayout(unsigned width, unsigned height) {
|
||||||
|
ASSERT(width > 0);
|
||||||
|
ASSERT(height > 0);
|
||||||
|
|
||||||
|
FramebufferLayout res{width, height, true, true, {}, {}};
|
||||||
|
|
||||||
|
MathUtil::Rectangle<unsigned> top_screen{
|
||||||
|
Settings::values.custom_top_left, Settings::values.custom_top_top,
|
||||||
|
Settings::values.custom_top_right, Settings::values.custom_top_bottom};
|
||||||
|
MathUtil::Rectangle<unsigned> bot_screen{
|
||||||
|
Settings::values.custom_bottom_left, Settings::values.custom_bottom_top,
|
||||||
|
Settings::values.custom_bottom_right, Settings::values.custom_bottom_bottom};
|
||||||
|
|
||||||
|
res.top_screen = top_screen;
|
||||||
|
res.bottom_screen = bot_screen;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,4 +44,12 @@ FramebufferLayout SingleFrameLayout(unsigned width, unsigned height, bool is_swa
|
||||||
* @return Newly created FramebufferLayout object with default screen regions initialized
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
||||||
*/
|
*/
|
||||||
FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool is_swapped);
|
FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool is_swapped);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory method for constructing a custom FramebufferLayout
|
||||||
|
* @param width Window framebuffer width in pixels
|
||||||
|
* @param height Window framebuffer height in pixels
|
||||||
|
* @return Newly created FramebufferLayout object with default screen regions initialized
|
||||||
|
*/
|
||||||
|
FramebufferLayout CustomFrameLayout(unsigned width, unsigned height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,9 @@ void EmuWindow::GyroscopeChanged(float x, float y, float z) {
|
||||||
|
|
||||||
void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) {
|
void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) {
|
||||||
Layout::FramebufferLayout layout;
|
Layout::FramebufferLayout layout;
|
||||||
|
if (Settings::values.custom_layout == true) {
|
||||||
|
layout = Layout::CustomFrameLayout(width, height);
|
||||||
|
} else {
|
||||||
switch (Settings::values.layout_option) {
|
switch (Settings::values.layout_option) {
|
||||||
case Settings::LayoutOption::SingleScreen:
|
case Settings::LayoutOption::SingleScreen:
|
||||||
layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen);
|
layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen);
|
||||||
|
@ -128,5 +131,6 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height)
|
||||||
layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen);
|
layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
NotifyFramebufferLayoutChanged(layout);
|
NotifyFramebufferLayoutChanged(layout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ enum class LayoutOption {
|
||||||
Default,
|
Default,
|
||||||
SingleScreen,
|
SingleScreen,
|
||||||
LargeScreen,
|
LargeScreen,
|
||||||
Custom,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace NativeInput {
|
namespace NativeInput {
|
||||||
|
@ -94,6 +93,15 @@ struct Values {
|
||||||
|
|
||||||
LayoutOption layout_option;
|
LayoutOption layout_option;
|
||||||
bool swap_screen;
|
bool swap_screen;
|
||||||
|
bool custom_layout;
|
||||||
|
u16 custom_top_left;
|
||||||
|
u16 custom_top_top;
|
||||||
|
u16 custom_top_right;
|
||||||
|
u16 custom_top_bottom;
|
||||||
|
u16 custom_bottom_left;
|
||||||
|
u16 custom_bottom_top;
|
||||||
|
u16 custom_bottom_right;
|
||||||
|
u16 custom_bottom_bottom;
|
||||||
|
|
||||||
float bg_red;
|
float bg_red;
|
||||||
float bg_green;
|
float bg_green;
|
||||||
|
|
Loading…
Reference in a new issue