summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar SonofUgly2017-02-01 00:22:47 -0800
committerGravatar SonofUgly2017-02-23 10:49:56 -0800
commite0a4450bbd40d69d288023ab5a95eaa0b00100fd (patch)
tree288cacc8a345cea50d8c6a25c17e4ebbb1ec41d9 /src
parentMerge pull request #2485 from Kloen/killing-warnings-computehash64 (diff)
downloadyuzu-e0a4450bbd40d69d288023ab5a95eaa0b00100fd.tar.gz
yuzu-e0a4450bbd40d69d288023ab5a95eaa0b00100fd.tar.xz
yuzu-e0a4450bbd40d69d288023ab5a95eaa0b00100fd.zip
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 827c90e55..2314e3f95 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -77,6 +77,23 @@ void Config::ReadValues() {
77 Settings::values.layout_option = 77 Settings::values.layout_option =
78 static_cast<Settings::LayoutOption>(sdl2_config->GetInteger("Layout", "layout_option", 0)); 78 static_cast<Settings::LayoutOption>(sdl2_config->GetInteger("Layout", "layout_option", 0));
79 Settings::values.swap_screen = sdl2_config->GetBoolean("Layout", "swap_screen", false); 79 Settings::values.swap_screen = sdl2_config->GetBoolean("Layout", "swap_screen", false);
80 Settings::values.custom_layout = sdl2_config->GetBoolean("Layout", "custom_layout", false);
81 Settings::values.custom_top_left =
82 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_left", 0));
83 Settings::values.custom_top_top =
84 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_top", 0));
85 Settings::values.custom_top_right =
86 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_right", 400));
87 Settings::values.custom_top_bottom =
88 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_top_bottom", 240));
89 Settings::values.custom_bottom_left =
90 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_left", 40));
91 Settings::values.custom_bottom_top =
92 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_top", 240));
93 Settings::values.custom_bottom_right =
94 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_right", 360));
95 Settings::values.custom_bottom_bottom =
96 static_cast<u16>(sdl2_config->GetInteger("Layout", "custom_bottom_bottom", 480));
80 97
81 // Audio 98 // Audio
82 Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto"); 99 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 d728fb9e8..fd9a9273a 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -71,6 +71,21 @@ bg_green =
71# 0 (default): Default Top Bottom Screen, 1: Single Screen Only, 2: Large Screen Small Screen 71# 0 (default): Default Top Bottom Screen, 1: Single Screen Only, 2: Large Screen Small Screen
72layout_option = 72layout_option =
73 73
74# Toggle custom layout (using the settings below) on or off.
75# 0 (default): Off , 1: On
76custom_layout =
77
78# Screen placement when using Custom layout option
79# 0x, 0y is the top left corner of the render window.
80custom_top_left =
81custom_top_top =
82custom_top_right =
83custom_top_bottom =
84custom_bottom_left =
85custom_bottom_top =
86custom_bottom_right =
87custom_bottom_bottom =
88
74#Whether to toggle frame limiter on or off. 89#Whether to toggle frame limiter on or off.
75# 0: Off , 1 (default): On 90# 0: Off , 1 (default): On
76toggle_framelimit = 91toggle_framelimit =
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index f776e16b2..2c03d3e93 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -57,6 +57,15 @@ void Config::ReadValues() {
57 Settings::values.layout_option = 57 Settings::values.layout_option =
58 static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt()); 58 static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt());
59 Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool(); 59 Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool();
60 Settings::values.custom_layout = qt_config->value("custom_layout", false).toBool();
61 Settings::values.custom_top_left = qt_config->value("custom_top_left", 0).toInt();
62 Settings::values.custom_top_top = qt_config->value("custom_top_top", 0).toInt();
63 Settings::values.custom_top_right = qt_config->value("custom_top_right", 400).toInt();
64 Settings::values.custom_top_bottom = qt_config->value("custom_top_bottom", 240).toInt();
65 Settings::values.custom_bottom_left = qt_config->value("custom_bottom_left", 40).toInt();
66 Settings::values.custom_bottom_top = qt_config->value("custom_bottom_top", 240).toInt();
67 Settings::values.custom_bottom_right = qt_config->value("custom_bottom_right", 360).toInt();
68 Settings::values.custom_bottom_bottom = qt_config->value("custom_bottom_bottom", 480).toInt();
60 qt_config->endGroup(); 69 qt_config->endGroup();
61 70
62 qt_config->beginGroup("Audio"); 71 qt_config->beginGroup("Audio");
@@ -166,6 +175,15 @@ void Config::SaveValues() {
166 qt_config->beginGroup("Layout"); 175 qt_config->beginGroup("Layout");
167 qt_config->setValue("layout_option", static_cast<int>(Settings::values.layout_option)); 176 qt_config->setValue("layout_option", static_cast<int>(Settings::values.layout_option));
168 qt_config->setValue("swap_screen", Settings::values.swap_screen); 177 qt_config->setValue("swap_screen", Settings::values.swap_screen);
178 qt_config->setValue("custom_layout", Settings::values.custom_layout);
179 qt_config->setValue("custom_top_left", Settings::values.custom_top_left);
180 qt_config->setValue("custom_top_top", Settings::values.custom_top_top);
181 qt_config->setValue("custom_top_right", Settings::values.custom_top_right);
182 qt_config->setValue("custom_top_bottom", Settings::values.custom_top_bottom);
183 qt_config->setValue("custom_bottom_left", Settings::values.custom_bottom_left);
184 qt_config->setValue("custom_bottom_top", Settings::values.custom_bottom_top);
185 qt_config->setValue("custom_bottom_right", Settings::values.custom_bottom_right);
186 qt_config->setValue("custom_bottom_bottom", Settings::values.custom_bottom_bottom);
169 qt_config->endGroup(); 187 qt_config->endGroup();
170 188
171 qt_config->beginGroup("Audio"); 189 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 1541cc39d..e5b1147a5 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -116,17 +116,21 @@ void EmuWindow::GyroscopeChanged(float x, float y, float z) {
116 116
117void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) { 117void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) {
118 Layout::FramebufferLayout layout; 118 Layout::FramebufferLayout layout;
119 switch (Settings::values.layout_option) { 119 if (Settings::values.custom_layout == true) {
120 case Settings::LayoutOption::SingleScreen: 120 layout = Layout::CustomFrameLayout(width, height);
121 layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen); 121 } else {
122 break; 122 switch (Settings::values.layout_option) {
123 case Settings::LayoutOption::LargeScreen: 123 case Settings::LayoutOption::SingleScreen:
124 layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen); 124 layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen);
125 break; 125 break;
126 case Settings::LayoutOption::Default: 126 case Settings::LayoutOption::LargeScreen:
127 default: 127 layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen);
128 layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen); 128 break;
129 break; 129 case Settings::LayoutOption::Default:
130 default:
131 layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen);
132 break;
133 }
130 } 134 }
131 NotifyFramebufferLayoutChanged(layout); 135 NotifyFramebufferLayoutChanged(layout);
132} 136}
diff --git a/src/core/settings.h b/src/core/settings.h
index e22ce0f16..52cebc627 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -14,7 +14,6 @@ enum class LayoutOption {
14 Default, 14 Default,
15 SingleScreen, 15 SingleScreen,
16 LargeScreen, 16 LargeScreen,
17 Custom,
18}; 17};
19 18
20namespace NativeInput { 19namespace NativeInput {
@@ -94,6 +93,15 @@ struct Values {
94 93
95 LayoutOption layout_option; 94 LayoutOption layout_option;
96 bool swap_screen; 95 bool swap_screen;
96 bool custom_layout;
97 u16 custom_top_left;
98 u16 custom_top_top;
99 u16 custom_top_right;
100 u16 custom_top_bottom;
101 u16 custom_bottom_left;
102 u16 custom_bottom_top;
103 u16 custom_bottom_right;
104 u16 custom_bottom_bottom;
97 105
98 float bg_red; 106 float bg_red;
99 float bg_green; 107 float bg_green;