diff options
| -rw-r--r-- | src/citra/config.cpp | 3 | ||||
| -rw-r--r-- | src/citra_qt/config.cpp | 3 | ||||
| -rw-r--r-- | src/citra_qt/configure_graphics.cpp | 3 | ||||
| -rw-r--r-- | src/citra_qt/main.cpp | 8 | ||||
| -rw-r--r-- | src/citra_qt/main.h | 1 | ||||
| -rw-r--r-- | src/common/emu_window.h | 2 | ||||
| -rw-r--r-- | src/common/framebuffer_layout.cpp | 6 | ||||
| -rw-r--r-- | src/common/framebuffer_layout.h | 3 | ||||
| -rw-r--r-- | src/common/math_util.h | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 5 |
10 files changed, 27 insertions, 13 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 305e3ba53..fd30bfc85 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp | |||
| @@ -73,7 +73,8 @@ void Config::ReadValues() { | |||
| 73 | Settings::values.bg_blue = (float)sdl2_config->GetReal("Renderer", "bg_blue", 1.0); | 73 | Settings::values.bg_blue = (float)sdl2_config->GetReal("Renderer", "bg_blue", 1.0); |
| 74 | 74 | ||
| 75 | // Layout | 75 | // Layout |
| 76 | Settings::values.layout_option = static_cast<Settings::LayoutOption>(sdl2_config->GetInteger("Layout", "layout_option", 0)); | 76 | Settings::values.layout_option = |
| 77 | static_cast<Settings::LayoutOption>(sdl2_config->GetInteger("Layout", "layout_option", 0)); | ||
| 77 | Settings::values.swap_screen = sdl2_config->GetBoolean("Layout", "swap_screen", false); | 78 | Settings::values.swap_screen = sdl2_config->GetBoolean("Layout", "swap_screen", false); |
| 78 | 79 | ||
| 79 | // Audio | 80 | // Audio |
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index f4f1a354d..3d2312619 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp | |||
| @@ -55,7 +55,8 @@ void Config::ReadValues() { | |||
| 55 | qt_config->endGroup(); | 55 | qt_config->endGroup(); |
| 56 | 56 | ||
| 57 | qt_config->beginGroup("Layout"); | 57 | qt_config->beginGroup("Layout"); |
| 58 | Settings::values.layout_option = static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt()); | 58 | Settings::values.layout_option = |
| 59 | static_cast<Settings::LayoutOption>(qt_config->value("layout_option").toInt()); | ||
| 59 | Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool(); | 60 | Settings::values.swap_screen = qt_config->value("swap_screen", false).toBool(); |
| 60 | qt_config->endGroup(); | 61 | qt_config->endGroup(); |
| 61 | 62 | ||
diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configure_graphics.cpp index c6c28197e..29834e11b 100644 --- a/src/citra_qt/configure_graphics.cpp +++ b/src/citra_qt/configure_graphics.cpp | |||
| @@ -32,7 +32,8 @@ void ConfigureGraphics::applyConfiguration() { | |||
| 32 | Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked(); | 32 | Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked(); |
| 33 | Settings::values.use_scaled_resolution = ui->toggle_scaled_resolution->isChecked(); | 33 | Settings::values.use_scaled_resolution = ui->toggle_scaled_resolution->isChecked(); |
| 34 | Settings::values.use_vsync = ui->toggle_vsync->isChecked(); | 34 | Settings::values.use_vsync = ui->toggle_vsync->isChecked(); |
| 35 | Settings::values.layout_option = static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex()); | 35 | Settings::values.layout_option = |
| 36 | static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex()); | ||
| 36 | Settings::values.swap_screen = ui->swap_screen->isChecked(); | 37 | Settings::values.swap_screen = ui->swap_screen->isChecked(); |
| 37 | Settings::Apply(); | 38 | Settings::Apply(); |
| 38 | } | 39 | } |
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 8322e2305..c1589424e 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -196,6 +196,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { | |||
| 196 | 196 | ||
| 197 | // Setup hotkeys | 197 | // Setup hotkeys |
| 198 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); | 198 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); |
| 199 | RegisterHotkey("Main Window", "Swap Screens", QKeySequence::NextChild); | ||
| 199 | RegisterHotkey("Main Window", "Start Emulation"); | 200 | RegisterHotkey("Main Window", "Start Emulation"); |
| 200 | LoadHotkeys(); | 201 | LoadHotkeys(); |
| 201 | 202 | ||
| @@ -203,6 +204,8 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { | |||
| 203 | SLOT(OnMenuLoadFile())); | 204 | SLOT(OnMenuLoadFile())); |
| 204 | connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, | 205 | connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, |
| 205 | SLOT(OnStartGame())); | 206 | SLOT(OnStartGame())); |
| 207 | connect(GetHotkey("Main Window", "Swap Screens", this), SIGNAL(activated()), this, | ||
| 208 | SLOT(OnSwapScreens())); | ||
| 206 | 209 | ||
| 207 | std::string window_title = | 210 | std::string window_title = |
| 208 | Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); | 211 | Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); |
| @@ -550,6 +553,11 @@ void GMainWindow::OnConfigure() { | |||
| 550 | } | 553 | } |
| 551 | } | 554 | } |
| 552 | 555 | ||
| 556 | void GMainWindow::OnSwapScreens() { | ||
| 557 | Settings::values.swap_screen = !Settings::values.swap_screen; | ||
| 558 | Settings::Apply(); | ||
| 559 | } | ||
| 560 | |||
| 553 | void GMainWindow::OnCreateGraphicsSurfaceViewer() { | 561 | void GMainWindow::OnCreateGraphicsSurfaceViewer() { |
| 554 | auto graphicsSurfaceViewerWidget = new GraphicsSurfaceWidget(Pica::g_debug_context, this); | 562 | auto graphicsSurfaceViewerWidget = new GraphicsSurfaceWidget(Pica::g_debug_context, this); |
| 555 | addDockWidget(Qt::RightDockWidgetArea, graphicsSurfaceViewerWidget); | 563 | addDockWidget(Qt::RightDockWidgetArea, graphicsSurfaceViewerWidget); |
diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 2cf308d80..82eb90aae 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h | |||
| @@ -105,6 +105,7 @@ private slots: | |||
| 105 | /// Called whenever a user selects the "File->Select Game List Root" menu item | 105 | /// Called whenever a user selects the "File->Select Game List Root" menu item |
| 106 | void OnMenuSelectGameListRoot(); | 106 | void OnMenuSelectGameListRoot(); |
| 107 | void OnMenuRecentFile(); | 107 | void OnMenuRecentFile(); |
| 108 | void OnSwapScreens(); | ||
| 108 | void OnConfigure(); | 109 | void OnConfigure(); |
| 109 | void OnDisplayTitleBars(bool); | 110 | void OnDisplayTitleBars(bool); |
| 110 | void ToggleWindowMode(); | 111 | void ToggleWindowMode(); |
diff --git a/src/common/emu_window.h b/src/common/emu_window.h index 6fac572f5..835c4d500 100644 --- a/src/common/emu_window.h +++ b/src/common/emu_window.h | |||
| @@ -200,7 +200,7 @@ public: | |||
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | /** | 202 | /** |
| 203 | * Convenience method to update the VideoCore EmuWindow | 203 | * Convenience method to update the current frame layout |
| 204 | * Read from the current settings to determine which layout to use. | 204 | * Read from the current settings to determine which layout to use. |
| 205 | */ | 205 | */ |
| 206 | void UpdateCurrentFramebufferLayout(unsigned width, unsigned height); | 206 | void UpdateCurrentFramebufferLayout(unsigned width, unsigned height); |
diff --git a/src/common/framebuffer_layout.cpp b/src/common/framebuffer_layout.cpp index d50c141bb..e8538dcfd 100644 --- a/src/common/framebuffer_layout.cpp +++ b/src/common/framebuffer_layout.cpp | |||
| @@ -51,11 +51,15 @@ FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool swapp | |||
| 51 | bot_screen.TranslateX((screen_window_area.GetWidth() - bot_screen.GetWidth()) / 2); | 51 | bot_screen.TranslateX((screen_window_area.GetWidth() - bot_screen.GetWidth()) / 2); |
| 52 | } else { | 52 | } else { |
| 53 | // Window is narrower than the emulation content => apply borders to the top and bottom | 53 | // Window is narrower than the emulation content => apply borders to the top and bottom |
| 54 | top_screen = top_screen.TranslateY(height / 2 - top_screen.GetHeight()); | ||
| 55 | // Recalculate the bottom screen to account for the width difference between top and bottom | 54 | // Recalculate the bottom screen to account for the width difference between top and bottom |
| 56 | screen_window_area = {0, 0, width, top_screen.GetHeight()}; | 55 | screen_window_area = {0, 0, width, top_screen.GetHeight()}; |
| 57 | bot_screen = maxRectangle(screen_window_area, BOT_SCREEN_ASPECT_RATIO); | 56 | bot_screen = maxRectangle(screen_window_area, BOT_SCREEN_ASPECT_RATIO); |
| 58 | bot_screen = bot_screen.TranslateX((top_screen.GetWidth() - bot_screen.GetWidth()) / 2); | 57 | bot_screen = bot_screen.TranslateX((top_screen.GetWidth() - bot_screen.GetWidth()) / 2); |
| 58 | if (swapped) { | ||
| 59 | bot_screen = bot_screen.TranslateY(height / 2 - bot_screen.GetHeight()); | ||
| 60 | } else { | ||
| 61 | top_screen = top_screen.TranslateY(height / 2 - top_screen.GetHeight()); | ||
| 62 | } | ||
| 59 | } | 63 | } |
| 60 | // Move the top screen to the bottom if we are swapped. | 64 | // Move the top screen to the bottom if we are swapped. |
| 61 | res.top_screen = swapped ? top_screen.TranslateY(height / 2) : top_screen; | 65 | res.top_screen = swapped ? top_screen.TranslateY(height / 2) : top_screen; |
diff --git a/src/common/framebuffer_layout.h b/src/common/framebuffer_layout.h index c69a80732..7f88c9463 100644 --- a/src/common/framebuffer_layout.h +++ b/src/common/framebuffer_layout.h | |||
| @@ -33,7 +33,8 @@ FramebufferLayout DefaultFrameLayout(unsigned width, unsigned height, bool is_sw | |||
| 33 | FramebufferLayout SingleFrameLayout(unsigned width, unsigned height, bool is_swapped); | 33 | FramebufferLayout SingleFrameLayout(unsigned width, unsigned height, bool is_swapped); |
| 34 | 34 | ||
| 35 | /** | 35 | /** |
| 36 | * Factory method for constructing a Frame with the a 4x size Top screen with a 1x size bottom screen on the right | 36 | * Factory method for constructing a Frame with the a 4x size Top screen with a 1x size bottom |
| 37 | * screen on the right | ||
| 37 | * This is useful in particular because it matches well with a 1920x1080 resolution monitor | 38 | * This is useful in particular because it matches well with a 1920x1080 resolution monitor |
| 38 | * @param width Window framebuffer width in pixels | 39 | * @param width Window framebuffer width in pixels |
| 39 | * @param height Window framebuffer height in pixels | 40 | * @param height Window framebuffer height in pixels |
diff --git a/src/common/math_util.h b/src/common/math_util.h index 570ec8e56..9e630d93d 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h | |||
| @@ -45,10 +45,8 @@ struct Rectangle { | |||
| 45 | return Rectangle{left, top + y, right, bottom + y}; | 45 | return Rectangle{left, top + y, right, bottom + y}; |
| 46 | } | 46 | } |
| 47 | Rectangle<T> Scale(const float s) const { | 47 | Rectangle<T> Scale(const float s) const { |
| 48 | ASSERT(s > 0); | 48 | return Rectangle{left, top, static_cast<T>((right + left) * s), |
| 49 | return Rectangle { | 49 | static_cast<T>((top + bottom) * s)}; |
| 50 | left, top, static_cast<T>((right + left) * s), static_cast<T>((top + bottom) * s) | ||
| 51 | }; | ||
| 52 | } | 50 | } |
| 53 | }; | 51 | }; |
| 54 | 52 | ||
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index fd0d74ace..93f0ac105 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -406,9 +406,8 @@ void RendererOpenGL::DrawScreens() { | |||
| 406 | glUniform1i(uniform_color_texture, 0); | 406 | glUniform1i(uniform_color_texture, 0); |
| 407 | 407 | ||
| 408 | if (layout.top_screen_enabled) { | 408 | if (layout.top_screen_enabled) { |
| 409 | DrawSingleScreenRotated(screen_infos[0], (float)top_screen.left, | 409 | DrawSingleScreenRotated(screen_infos[0], (float)top_screen.left, (float)top_screen.top, |
| 410 | (float)top_screen.top, (float)top_screen.GetWidth(), | 410 | (float)top_screen.GetWidth(), (float)top_screen.GetHeight()); |
| 411 | (float)top_screen.GetHeight()); | ||
| 412 | } | 411 | } |
| 413 | if (layout.bottom_screen_enabled) { | 412 | if (layout.bottom_screen_enabled) { |
| 414 | DrawSingleScreenRotated(screen_infos[1], (float)bottom_screen.left, | 413 | DrawSingleScreenRotated(screen_infos[1], (float)bottom_screen.left, |