summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2017-03-21 22:57:31 -0400
committerGravatar GitHub2017-03-21 22:57:31 -0400
commitccc3985cc0efe520bf4f53d4fcac7bfe1abdc82c (patch)
tree38120c3cf4e7af72dc8122f9f278b77aa52b663b /src
parentRemoved a linebreak from the README. (diff)
parentAdd custom layout settings. (diff)
downloadyuzu-ccc3985cc0efe520bf4f53d4fcac7bfe1abdc82c.tar.gz
yuzu-ccc3985cc0efe520bf4f53d4fcac7bfe1abdc82c.tar.xz
yuzu-ccc3985cc0efe520bf4f53d4fcac7bfe1abdc82c.zip
Merge pull request #2512 from SonofUgly/custom-layout
Add custom layout settings.
Diffstat (limited to 'src')
-rw-r--r--src/citra/config.cpp17
-rw-r--r--src/citra/default_ini.h15
-rw-r--r--src/citra_qt/config.cpp18
-rw-r--r--src/citra_qt/configure_graphics.cpp2
-rw-r--r--src/citra_qt/configure_graphics.ui2
-rw-r--r--src/common/framebuffer_layout.cpp19
-rw-r--r--src/common/framebuffer_layout.h8
-rw-r--r--src/core/frontend/emu_window.cpp26
-rw-r--r--src/core/settings.h10
9 files changed, 104 insertions, 13 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index ef1229912..a4162e9ad 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -94,6 +94,23 @@ void Config::ReadValues() {
94 Settings::values.layout_option = 94 Settings::values.layout_option =
95 static_cast<Settings::LayoutOption>(sdl2_config->GetInteger("Layout", "layout_option", 0)); 95 static_cast<Settings::LayoutOption>(sdl2_config->GetInteger("Layout", "layout_option", 0));
96 Settings::values.swap_screen = sdl2_config->GetBoolean("Layout", "swap_screen", false); 96 Settings::values.swap_screen = sdl2_config->GetBoolean("Layout", "swap_screen", false);
97 Settings::values.custom_layout = sdl2_config->GetBoolean("Layout", "custom_layout", false);
98 Settings::values.custom_top_left =
99 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_left", 0));
100 Settings::values.custom_top_top =
101 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_top", 0));
102 Settings::values.custom_top_right =
103 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_right", 400));
104 Settings::values.custom_top_bottom =
105 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_bottom", 240));
106 Settings::values.custom_bottom_left =
107 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_left", 40));
108 Settings::values.custom_bottom_top =
109 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_top", 240));
110 Settings::values.custom_bottom_right =
111 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_right", 360));
112 Settings::values.custom_bottom_bottom =
113 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_bottom", 480));
97 114
98 // Audio 115 // Audio
99 Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto"); 116 Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto");
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
index af9f7aa2a..084372df4 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -84,6 +84,21 @@ bg_green =
84# 0 (default): Default Top Bottom Screen, 1: Single Screen Only, 2: Large Screen Small Screen 84# 0 (default): Default Top Bottom Screen, 1: Single Screen Only, 2: Large Screen Small Screen
85layout_option = 85layout_option =
86 86
87# Toggle custom layout (using the settings below) on or off.
88# 0 (default): Off , 1: On
89custom_layout =
90
91# Screen placement when using Custom layout option
92# 0x, 0y is the top left corner of the render window.
93custom_top_left =
94custom_top_top =
95custom_top_right =
96custom_top_bottom =
97custom_bottom_left =
98custom_bottom_top =
99custom_bottom_right =
100custom_bottom_bottom =
101
87#Whether to toggle frame limiter on or off. 102#Whether to toggle frame limiter on or off.
88# 0: Off , 1 (default): On 103# 0: Off , 1 (default): On
89toggle_framelimit = 104toggle_framelimit =
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 6ccfa1577..bf0ac7c66 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -79,6 +79,15 @@ void Config::ReadValues() {
79 Settings::values.layout_option = 79 Settings::values.layout_option =
80 static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt()); 80 static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt());
81 Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool(); 81 Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool();
82 Settings::values.custom_layout = qt_config->value("custom_layout", false).toBool();
83 Settings::values.custom_top_left = qt_config->value("custom_top_left", 0).toInt();
84 Settings::values.custom_top_top = qt_config->value("custom_top_top", 0).toInt();
85 Settings::values.custom_top_right = qt_config->value("custom_top_right", 400).toInt();
86 Settings::values.custom_top_bottom = qt_config->value("custom_top_bottom", 240).toInt();
87 Settings::values.custom_bottom_left = qt_config->value("custom_bottom_left", 40).toInt();
88 Settings::values.custom_bottom_top = qt_config->value("custom_bottom_top", 240).toInt();
89 Settings::values.custom_bottom_right = qt_config->value("custom_bottom_right", 360).toInt();
90 Settings::values.custom_bottom_bottom = qt_config->value("custom_bottom_bottom", 480).toInt();
82 qt_config->endGroup(); 91 qt_config->endGroup();
83 92
84 qt_config->beginGroup("Audio"); 93 qt_config->beginGroup("Audio");
@@ -207,6 +216,15 @@ void Config::SaveValues() {
207 qt_config->beginGroup("Layout"); 216 qt_config->beginGroup("Layout");
208 qt_config->setValue("layout_option", static_cast<int>(Settings::values.layout_option)); 217 qt_config->setValue("layout_option", static_cast<int>(Settings::values.layout_option));
209 qt_config->setValue("swap_screen", Settings::values.swap_screen); 218 qt_config->setValue("swap_screen", Settings::values.swap_screen);
219 qt_config->setValue("custom_layout", Settings::values.custom_layout);
220 qt_config->setValue("custom_top_left", Settings::values.custom_top_left);
221 qt_config->setValue("custom_top_top", Settings::values.custom_top_top);
222 qt_config->setValue("custom_top_right", Settings::values.custom_top_right);
223 qt_config->setValue("custom_top_bottom", Settings::values.custom_top_bottom);
224 qt_config->setValue("custom_bottom_left", Settings::values.custom_bottom_left);
225 qt_config->setValue("custom_bottom_top", Settings::values.custom_bottom_top);
226 qt_config->setValue("custom_bottom_right", Settings::values.custom_bottom_right);
227 qt_config->setValue("custom_bottom_bottom", Settings::values.custom_bottom_bottom);
210 qt_config->endGroup(); 228 qt_config->endGroup();
211 229
212 qt_config->beginGroup("Audio"); 230 qt_config->beginGroup("Audio");
diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configure_graphics.cpp
index 54f799b47..4c0bd4246 100644
--- a/src/citra_qt/configure_graphics.cpp
+++ b/src/citra_qt/configure_graphics.cpp
@@ -14,6 +14,8 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
14 this->setConfiguration(); 14 this->setConfiguration();
15 15
16 ui->toggle_vsync->setEnabled(!Core::System::GetInstance().IsPoweredOn()); 16 ui->toggle_vsync->setEnabled(!Core::System::GetInstance().IsPoweredOn());
17
18 ui->layoutBox->setEnabled(!Settings::values.custom_layout);
17} 19}
18 20
19ConfigureGraphics::~ConfigureGraphics() {} 21ConfigureGraphics::~ConfigureGraphics() {}
diff --git a/src/citra_qt/configure_graphics.ui b/src/citra_qt/configure_graphics.ui
index a091f4c60..228f2a869 100644
--- a/src/citra_qt/configure_graphics.ui
+++ b/src/citra_qt/configure_graphics.ui
@@ -126,7 +126,7 @@
126 </layout> 126 </layout>
127 </item> 127 </item>
128 <item> 128 <item>
129 <widget class="QGroupBox" name="groupBox2"> 129 <widget class="QGroupBox" name="layoutBox">
130 <property name="title"> 130 <property name="title">
131 <string>Layout</string> 131 <string>Layout</string>
132 </property> 132 </property>
diff --git a/src/common/framebuffer_layout.cpp b/src/common/framebuffer_layout.cpp
index 46c008d9c..a2a0e7dad 100644
--- a/src/common/framebuffer_layout.cpp
+++ b/src/common/framebuffer_layout.cpp
@@ -6,6 +6,7 @@
6 6
7#include "common/assert.h" 7#include "common/assert.h"
8#include "common/framebuffer_layout.h" 8#include "common/framebuffer_layout.h"
9#include "core/settings.h"
9#include "video_core/video_core.h" 10#include "video_core/video_core.h"
10 11
11namespace Layout { 12namespace Layout {
@@ -135,4 +136,22 @@ FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool swapped
135 res.bottom_screen = swapped ? large_screen : small_screen; 136 res.bottom_screen = swapped ? large_screen : small_screen;
136 return res; 137 return res;
137} 138}
139
140FramebufferLayout CustomFrameLayout(unsigned width, unsigned height) {
141 ASSERT(width > 0);
142 ASSERT(height > 0);
143
144 FramebufferLayout res{width, height, true, true, {}, {}};
145
146 MathUtil::Rectangle<unsigned> top_screen{
147 Settings::values.custom_top_left, Settings::values.custom_top_top,
148 Settings::values.custom_top_right, Settings::values.custom_top_bottom};
149 MathUtil::Rectangle<unsigned> bot_screen{
150 Settings::values.custom_bottom_left, Settings::values.custom_bottom_top,
151 Settings::values.custom_bottom_right, Settings::values.custom_bottom_bottom};
152
153 res.top_screen = top_screen;
154 res.bottom_screen = bot_screen;
155 return res;
156}
138} 157}
diff --git a/src/common/framebuffer_layout.h b/src/common/framebuffer_layout.h
index a125646a3..f1df5c55a 100644
--- a/src/common/framebuffer_layout.h
+++ b/src/common/framebuffer_layout.h
@@ -44,4 +44,12 @@ FramebufferLayout SingleFrameLayout(unsigned width, unsigned height, bool is_swa
44 * @return Newly created FramebufferLayout object with default screen regions initialized 44 * @return Newly created FramebufferLayout object with default screen regions initialized
45 */ 45 */
46FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool is_swapped); 46FramebufferLayout LargeFrameLayout(unsigned width, unsigned height, bool is_swapped);
47
48/**
49 * Factory method for constructing a custom FramebufferLayout
50 * @param width Window framebuffer width in pixels
51 * @param height Window framebuffer height in pixels
52 * @return Newly created FramebufferLayout object with default screen regions initialized
53 */
54FramebufferLayout CustomFrameLayout(unsigned width, unsigned height);
47} 55}
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index 73a44bfe7..5fdb3a7e8 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -89,17 +89,21 @@ void EmuWindow::GyroscopeChanged(float x, float y, float z) {
89 89
90void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) { 90void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) {
91 Layout::FramebufferLayout layout; 91 Layout::FramebufferLayout layout;
92 switch (Settings::values.layout_option) { 92 if (Settings::values.custom_layout == true) {
93 case Settings::LayoutOption::SingleScreen: 93 layout = Layout::CustomFrameLayout(width, height);
94 layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen); 94 } else {
95 break; 95 switch (Settings::values.layout_option) {
96 case Settings::LayoutOption::LargeScreen: 96 case Settings::LayoutOption::SingleScreen:
97 layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen); 97 layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen);
98 break; 98 break;
99 case Settings::LayoutOption::Default: 99 case Settings::LayoutOption::LargeScreen:
100 default: 100 layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen);
101 layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen); 101 break;
102 break; 102 case Settings::LayoutOption::Default:
103 default:
104 layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen);
105 break;
106 }
103 } 107 }
104 NotifyFramebufferLayoutChanged(layout); 108 NotifyFramebufferLayoutChanged(layout);
105} 109}
diff --git a/src/core/settings.h b/src/core/settings.h
index d1a9f0da8..03c64c94c 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -15,7 +15,6 @@ enum class LayoutOption {
15 Default, 15 Default,
16 SingleScreen, 16 SingleScreen,
17 LargeScreen, 17 LargeScreen,
18 Custom,
19}; 18};
20 19
21namespace NativeButton { 20namespace NativeButton {
@@ -99,6 +98,15 @@ struct Values {
99 98
100 LayoutOption layout_option; 99 LayoutOption layout_option;
101 bool swap_screen; 100 bool swap_screen;
101 bool custom_layout;
102 u16 custom_top_left;
103 u16 custom_top_top;
104 u16 custom_top_right;
105 u16 custom_top_bottom;
106 u16 custom_bottom_left;
107 u16 custom_bottom_top;
108 u16 custom_bottom_right;
109 u16 custom_bottom_bottom;
102 110
103 float bg_red; 111 float bg_red;
104 float bg_green; 112 float bg_green;