diff options
| author | 2016-08-31 22:20:54 -0400 | |
|---|---|---|
| committer | 2016-08-31 22:20:54 -0400 | |
| commit | 09063dc5bb1e2b769c10077bf820a5300494c119 (patch) | |
| tree | ad997ee86470e23e9dfa67a1d9824a57cdcf5571 | |
| parent | Merge pull request #2035 from MerryMage/disable-stretch (diff) | |
| parent | qt: Rename all "toogle" to "toggle". (diff) | |
| download | yuzu-09063dc5bb1e2b769c10077bf820a5300494c119.tar.gz yuzu-09063dc5bb1e2b769c10077bf820a5300494c119.tar.xz yuzu-09063dc5bb1e2b769c10077bf820a5300494c119.zip | |
Merge pull request #2032 from bunnei/qt-graphics
Qt graphics configure & V-Sync option
| -rw-r--r-- | src/citra/config.cpp | 1 | ||||
| -rw-r--r-- | src/citra/default_ini.h | 4 | ||||
| -rw-r--r-- | src/citra/emu_window/emu_window_sdl2.cpp | 1 | ||||
| -rw-r--r-- | src/citra_qt/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/citra_qt/bootmanager.cpp | 59 | ||||
| -rw-r--r-- | src/citra_qt/bootmanager.h | 2 | ||||
| -rw-r--r-- | src/citra_qt/config.cpp | 2 | ||||
| -rw-r--r-- | src/citra_qt/configure.ui | 27 | ||||
| -rw-r--r-- | src/citra_qt/configure_debug.cpp | 4 | ||||
| -rw-r--r-- | src/citra_qt/configure_debug.ui | 4 | ||||
| -rw-r--r-- | src/citra_qt/configure_dialog.cpp | 1 | ||||
| -rw-r--r-- | src/citra_qt/configure_general.cpp | 14 | ||||
| -rw-r--r-- | src/citra_qt/configure_general.ui | 38 | ||||
| -rw-r--r-- | src/citra_qt/configure_graphics.cpp | 37 | ||||
| -rw-r--r-- | src/citra_qt/configure_graphics.h | 29 | ||||
| -rw-r--r-- | src/citra_qt/configure_graphics.ui | 92 | ||||
| -rw-r--r-- | src/citra_qt/main.cpp | 2 | ||||
| -rw-r--r-- | src/core/settings.h | 1 | ||||
| -rw-r--r-- | src/core/system.cpp | 10 | ||||
| -rw-r--r-- | src/core/system.h | 1 | ||||
| -rw-r--r-- | src/video_core/video_core.cpp | 1 |
21 files changed, 251 insertions, 82 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp index f48386b9c..110b883fb 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp | |||
| @@ -71,6 +71,7 @@ void Config::ReadValues() { | |||
| 71 | Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true); | 71 | Settings::values.use_hw_renderer = sdl2_config->GetBoolean("Renderer", "use_hw_renderer", true); |
| 72 | Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true); | 72 | Settings::values.use_shader_jit = sdl2_config->GetBoolean("Renderer", "use_shader_jit", true); |
| 73 | Settings::values.use_scaled_resolution = sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false); | 73 | Settings::values.use_scaled_resolution = sdl2_config->GetBoolean("Renderer", "use_scaled_resolution", false); |
| 74 | Settings::values.use_vsync = sdl2_config->GetBoolean("Renderer", "use_vsync", false); | ||
| 74 | 75 | ||
| 75 | Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0); | 76 | Settings::values.bg_red = (float)sdl2_config->GetReal("Renderer", "bg_red", 1.0); |
| 76 | Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0); | 77 | Settings::values.bg_green = (float)sdl2_config->GetReal("Renderer", "bg_green", 1.0); |
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index 5b8ca12a0..2031620a5 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h | |||
| @@ -55,6 +55,10 @@ use_shader_jit = | |||
| 55 | # 0 (default): Native, 1: Scaled | 55 | # 0 (default): Native, 1: Scaled |
| 56 | use_scaled_resolution = | 56 | use_scaled_resolution = |
| 57 | 57 | ||
| 58 | # Whether to enable V-Sync (caps the framerate at 60FPS) or not. | ||
| 59 | # 0 (default): Off, 1: On | ||
| 60 | use_vsync = | ||
| 61 | |||
| 58 | # The clear color for the renderer. What shows up on the sides of the bottom screen. | 62 | # The clear color for the renderer. What shows up on the sides of the bottom screen. |
| 59 | # Must be in range of 0.0-1.0. Defaults to 1.0 for all. | 63 | # Must be in range of 0.0-1.0. Defaults to 1.0 for all. |
| 60 | bg_red = | 64 | bg_red = |
diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp index 591f68aa4..da12307b7 100644 --- a/src/citra/emu_window/emu_window_sdl2.cpp +++ b/src/citra/emu_window/emu_window_sdl2.cpp | |||
| @@ -108,6 +108,7 @@ EmuWindow_SDL2::EmuWindow_SDL2() { | |||
| 108 | OnResize(); | 108 | OnResize(); |
| 109 | OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); | 109 | OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); |
| 110 | SDL_PumpEvents(); | 110 | SDL_PumpEvents(); |
| 111 | SDL_GL_SetSwapInterval(Settings::values.use_vsync); | ||
| 111 | 112 | ||
| 112 | DoneCurrent(); | 113 | DoneCurrent(); |
| 113 | } | 114 | } |
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 4402ad995..e97d33da4 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt | |||
| @@ -22,6 +22,7 @@ set(SRCS | |||
| 22 | configure_debug.cpp | 22 | configure_debug.cpp |
| 23 | configure_dialog.cpp | 23 | configure_dialog.cpp |
| 24 | configure_general.cpp | 24 | configure_general.cpp |
| 25 | configure_graphics.cpp | ||
| 25 | configure_system.cpp | 26 | configure_system.cpp |
| 26 | configure_input.cpp | 27 | configure_input.cpp |
| 27 | game_list.cpp | 28 | game_list.cpp |
| @@ -54,6 +55,7 @@ set(HEADERS | |||
| 54 | configure_debug.h | 55 | configure_debug.h |
| 55 | configure_dialog.h | 56 | configure_dialog.h |
| 56 | configure_general.h | 57 | configure_general.h |
| 58 | configure_graphics.h | ||
| 57 | configure_system.h | 59 | configure_system.h |
| 58 | configure_input.h | 60 | configure_input.h |
| 59 | game_list.h | 61 | game_list.h |
| @@ -73,6 +75,7 @@ set(UIS | |||
| 73 | configure_audio.ui | 75 | configure_audio.ui |
| 74 | configure_debug.ui | 76 | configure_debug.ui |
| 75 | configure_general.ui | 77 | configure_general.ui |
| 78 | configure_graphics.ui | ||
| 76 | configure_system.ui | 79 | configure_system.ui |
| 77 | configure_input.ui | 80 | configure_input.ui |
| 78 | hotkeys.ui | 81 | hotkeys.ui |
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 414b2f8af..6dddde9ba 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -107,36 +107,13 @@ private: | |||
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) : | 109 | GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) : |
| 110 | QWidget(parent), keyboard_id(0), emu_thread(emu_thread) { | 110 | QWidget(parent), keyboard_id(0), emu_thread(emu_thread), child(nullptr) { |
| 111 | 111 | ||
| 112 | std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); | 112 | std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); |
| 113 | setWindowTitle(QString::fromStdString(window_title)); | 113 | setWindowTitle(QString::fromStdString(window_title)); |
| 114 | 114 | ||
| 115 | keyboard_id = KeyMap::NewDeviceId(); | 115 | keyboard_id = KeyMap::NewDeviceId(); |
| 116 | ReloadSetKeymaps(); | 116 | ReloadSetKeymaps(); |
| 117 | |||
| 118 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose | ||
| 119 | QGLFormat fmt; | ||
| 120 | fmt.setVersion(3,3); | ||
| 121 | fmt.setProfile(QGLFormat::CoreProfile); | ||
| 122 | // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X | ||
| 123 | fmt.setOption(QGL::NoDeprecatedFunctions); | ||
| 124 | |||
| 125 | child = new GGLWidgetInternal(fmt, this); | ||
| 126 | QBoxLayout* layout = new QHBoxLayout(this); | ||
| 127 | |||
| 128 | resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight); | ||
| 129 | layout->addWidget(child); | ||
| 130 | layout->setMargin(0); | ||
| 131 | setLayout(layout); | ||
| 132 | |||
| 133 | OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); | ||
| 134 | |||
| 135 | OnFramebufferSizeChanged(); | ||
| 136 | NotifyClientAreaSizeChanged(std::pair<unsigned,unsigned>(child->width(), child->height())); | ||
| 137 | |||
| 138 | BackupGeometry(); | ||
| 139 | |||
| 140 | } | 117 | } |
| 141 | 118 | ||
| 142 | void GRenderWindow::moveContext() | 119 | void GRenderWindow::moveContext() |
| @@ -281,6 +258,40 @@ void GRenderWindow::OnClientAreaResized(unsigned width, unsigned height) | |||
| 281 | NotifyClientAreaSizeChanged(std::make_pair(width, height)); | 258 | NotifyClientAreaSizeChanged(std::make_pair(width, height)); |
| 282 | } | 259 | } |
| 283 | 260 | ||
| 261 | void GRenderWindow::InitRenderTarget() { | ||
| 262 | if (child) { | ||
| 263 | delete child; | ||
| 264 | } | ||
| 265 | |||
| 266 | if (layout()) { | ||
| 267 | delete layout(); | ||
| 268 | } | ||
| 269 | |||
| 270 | // TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose | ||
| 271 | QGLFormat fmt; | ||
| 272 | fmt.setVersion(3, 3); | ||
| 273 | fmt.setProfile(QGLFormat::CoreProfile); | ||
| 274 | fmt.setSwapInterval(Settings::values.use_vsync); | ||
| 275 | |||
| 276 | // Requests a forward-compatible context, which is required to get a 3.2+ context on OS X | ||
| 277 | fmt.setOption(QGL::NoDeprecatedFunctions); | ||
| 278 | |||
| 279 | child = new GGLWidgetInternal(fmt, this); | ||
| 280 | QBoxLayout* layout = new QHBoxLayout(this); | ||
| 281 | |||
| 282 | resize(VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight); | ||
| 283 | layout->addWidget(child); | ||
| 284 | layout->setMargin(0); | ||
| 285 | setLayout(layout); | ||
| 286 | |||
| 287 | OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); | ||
| 288 | |||
| 289 | OnFramebufferSizeChanged(); | ||
| 290 | NotifyClientAreaSizeChanged(std::pair<unsigned, unsigned>(child->width(), child->height())); | ||
| 291 | |||
| 292 | BackupGeometry(); | ||
| 293 | } | ||
| 294 | |||
| 284 | void GRenderWindow::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) { | 295 | void GRenderWindow::OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) { |
| 285 | setMinimumSize(minimal_size.first, minimal_size.second); | 296 | setMinimumSize(minimal_size.first, minimal_size.second); |
| 286 | } | 297 | } |
diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index 0dcf3e5eb..c1da2bc5f 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h | |||
| @@ -126,6 +126,8 @@ public: | |||
| 126 | 126 | ||
| 127 | void OnClientAreaResized(unsigned width, unsigned height); | 127 | void OnClientAreaResized(unsigned width, unsigned height); |
| 128 | 128 | ||
| 129 | void InitRenderTarget(); | ||
| 130 | |||
| 129 | public slots: | 131 | public slots: |
| 130 | void moveContext(); // overridden | 132 | void moveContext(); // overridden |
| 131 | 133 | ||
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp index ff3bfe1bd..fa3fa210c 100644 --- a/src/citra_qt/config.cpp +++ b/src/citra_qt/config.cpp | |||
| @@ -48,6 +48,7 @@ void Config::ReadValues() { | |||
| 48 | Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool(); | 48 | Settings::values.use_hw_renderer = qt_config->value("use_hw_renderer", true).toBool(); |
| 49 | Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool(); | 49 | Settings::values.use_shader_jit = qt_config->value("use_shader_jit", true).toBool(); |
| 50 | Settings::values.use_scaled_resolution = qt_config->value("use_scaled_resolution", false).toBool(); | 50 | Settings::values.use_scaled_resolution = qt_config->value("use_scaled_resolution", false).toBool(); |
| 51 | Settings::values.use_vsync = qt_config->value("use_vsync", false).toBool(); | ||
| 51 | 52 | ||
| 52 | Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat(); | 53 | Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat(); |
| 53 | Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat(); | 54 | Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat(); |
| @@ -140,6 +141,7 @@ void Config::SaveValues() { | |||
| 140 | qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer); | 141 | qt_config->setValue("use_hw_renderer", Settings::values.use_hw_renderer); |
| 141 | qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit); | 142 | qt_config->setValue("use_shader_jit", Settings::values.use_shader_jit); |
| 142 | qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution); | 143 | qt_config->setValue("use_scaled_resolution", Settings::values.use_scaled_resolution); |
| 144 | qt_config->setValue("use_vsync", Settings::values.use_vsync); | ||
| 143 | 145 | ||
| 144 | // Cast to double because Qt's written float values are not human-readable | 146 | // Cast to double because Qt's written float values are not human-readable |
| 145 | qt_config->setValue("bg_red", (double)Settings::values.bg_red); | 147 | qt_config->setValue("bg_red", (double)Settings::values.bg_red); |
diff --git a/src/citra_qt/configure.ui b/src/citra_qt/configure.ui index 15fe17323..28b4a3b90 100644 --- a/src/citra_qt/configure.ui +++ b/src/citra_qt/configure.ui | |||
| @@ -34,11 +34,16 @@ | |||
| 34 | <string>Input</string> | 34 | <string>Input</string> |
| 35 | </attribute> | 35 | </attribute> |
| 36 | </widget> | 36 | </widget> |
| 37 | <widget class="ConfigureAudio" name="audioTab"> | 37 | <widget class="ConfigureGraphics" name="graphicsTab"> |
| 38 | <attribute name="title"> | 38 | <attribute name="title"> |
| 39 | <string>Audio</string> | 39 | <string>Graphics</string> |
| 40 | </attribute> | 40 | </attribute> |
| 41 | </widget> | 41 | </widget> |
| 42 | <widget class="ConfigureAudio" name="audioTab"> | ||
| 43 | <attribute name="title"> | ||
| 44 | <string>Audio</string> | ||
| 45 | </attribute> | ||
| 46 | </widget> | ||
| 42 | <widget class="ConfigureDebug" name="debugTab"> | 47 | <widget class="ConfigureDebug" name="debugTab"> |
| 43 | <attribute name="title"> | 48 | <attribute name="title"> |
| 44 | <string>Debug</string> | 49 | <string>Debug</string> |
| @@ -80,12 +85,18 @@ | |||
| 80 | <header>configure_debug.h</header> | 85 | <header>configure_debug.h</header> |
| 81 | <container>1</container> | 86 | <container>1</container> |
| 82 | </customwidget> | 87 | </customwidget> |
| 83 | <customwidget> | 88 | <customwidget> |
| 84 | <class>ConfigureInput</class> | 89 | <class>ConfigureInput</class> |
| 85 | <extends>QWidget</extends> | 90 | <extends>QWidget</extends> |
| 86 | <header>configure_input.h</header> | 91 | <header>configure_input.h</header> |
| 87 | <container>1</container> | 92 | <container>1</container> |
| 88 | </customwidget> | 93 | </customwidget> |
| 94 | <customwidget> | ||
| 95 | <class>ConfigureGraphics</class> | ||
| 96 | <extends>QWidget</extends> | ||
| 97 | <header>configure_graphics.h</header> | ||
| 98 | <container>1</container> | ||
| 99 | </customwidget> | ||
| 89 | </customwidgets> | 100 | </customwidgets> |
| 90 | <resources/> | 101 | <resources/> |
| 91 | <connections> | 102 | <connections> |
diff --git a/src/citra_qt/configure_debug.cpp b/src/citra_qt/configure_debug.cpp index dc3d7b906..fa57a7f72 100644 --- a/src/citra_qt/configure_debug.cpp +++ b/src/citra_qt/configure_debug.cpp | |||
| @@ -19,13 +19,13 @@ ConfigureDebug::~ConfigureDebug() { | |||
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | void ConfigureDebug::setConfiguration() { | 21 | void ConfigureDebug::setConfiguration() { |
| 22 | ui->toogle_gdbstub->setChecked(Settings::values.use_gdbstub); | 22 | ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub); |
| 23 | ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub); | 23 | ui->gdbport_spinbox->setEnabled(Settings::values.use_gdbstub); |
| 24 | ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port); | 24 | ui->gdbport_spinbox->setValue(Settings::values.gdbstub_port); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | void ConfigureDebug::applyConfiguration() { | 27 | void ConfigureDebug::applyConfiguration() { |
| 28 | Settings::values.use_gdbstub = ui->toogle_gdbstub->isChecked(); | 28 | Settings::values.use_gdbstub = ui->toggle_gdbstub->isChecked(); |
| 29 | Settings::values.gdbstub_port = ui->gdbport_spinbox->value(); | 29 | Settings::values.gdbstub_port = ui->gdbport_spinbox->value(); |
| 30 | Settings::Apply(); | 30 | Settings::Apply(); |
| 31 | } | 31 | } |
diff --git a/src/citra_qt/configure_debug.ui b/src/citra_qt/configure_debug.ui index 3ba7f44da..bbbb0e3f4 100644 --- a/src/citra_qt/configure_debug.ui +++ b/src/citra_qt/configure_debug.ui | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | <item> | 25 | <item> |
| 26 | <layout class="QHBoxLayout" name="horizontalLayout_3"> | 26 | <layout class="QHBoxLayout" name="horizontalLayout_3"> |
| 27 | <item> | 27 | <item> |
| 28 | <widget class="QCheckBox" name="toogle_gdbstub"> | 28 | <widget class="QCheckBox" name="toggle_gdbstub"> |
| 29 | <property name="text"> | 29 | <property name="text"> |
| 30 | <string>Enable GDB Stub</string> | 30 | <string>Enable GDB Stub</string> |
| 31 | </property> | 31 | </property> |
| @@ -83,7 +83,7 @@ | |||
| 83 | <resources/> | 83 | <resources/> |
| 84 | <connections> | 84 | <connections> |
| 85 | <connection> | 85 | <connection> |
| 86 | <sender>toogle_gdbstub</sender> | 86 | <sender>toggle_gdbstub</sender> |
| 87 | <signal>toggled(bool)</signal> | 87 | <signal>toggled(bool)</signal> |
| 88 | <receiver>gdbport_spinbox</receiver> | 88 | <receiver>gdbport_spinbox</receiver> |
| 89 | <slot>setEnabled(bool)</slot> | 89 | <slot>setEnabled(bool)</slot> |
diff --git a/src/citra_qt/configure_dialog.cpp b/src/citra_qt/configure_dialog.cpp index 459fac4bb..7da8ad067 100644 --- a/src/citra_qt/configure_dialog.cpp +++ b/src/citra_qt/configure_dialog.cpp | |||
| @@ -31,6 +31,7 @@ void ConfigureDialog::applyConfiguration() { | |||
| 31 | ui->generalTab->applyConfiguration(); | 31 | ui->generalTab->applyConfiguration(); |
| 32 | ui->systemTab->applyConfiguration(); | 32 | ui->systemTab->applyConfiguration(); |
| 33 | ui->inputTab->applyConfiguration(); | 33 | ui->inputTab->applyConfiguration(); |
| 34 | ui->graphicsTab->applyConfiguration(); | ||
| 34 | ui->audioTab->applyConfiguration(); | 35 | ui->audioTab->applyConfiguration(); |
| 35 | ui->debugTab->applyConfiguration(); | 36 | ui->debugTab->applyConfiguration(); |
| 36 | } | 37 | } |
diff --git a/src/citra_qt/configure_general.cpp b/src/citra_qt/configure_general.cpp index 62648e665..95aab9f2e 100644 --- a/src/citra_qt/configure_general.cpp +++ b/src/citra_qt/configure_general.cpp | |||
| @@ -20,20 +20,14 @@ ConfigureGeneral::~ConfigureGeneral() { | |||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | void ConfigureGeneral::setConfiguration() { | 22 | void ConfigureGeneral::setConfiguration() { |
| 23 | ui->toogle_deepscan->setChecked(UISettings::values.gamedir_deepscan); | 23 | ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan); |
| 24 | ui->toogle_check_exit->setChecked(UISettings::values.confirm_before_closing); | 24 | ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); |
| 25 | ui->region_combobox->setCurrentIndex(Settings::values.region_value); | 25 | ui->region_combobox->setCurrentIndex(Settings::values.region_value); |
| 26 | ui->toogle_hw_renderer->setChecked(Settings::values.use_hw_renderer); | ||
| 27 | ui->toogle_shader_jit->setChecked(Settings::values.use_shader_jit); | ||
| 28 | ui->toogle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution); | ||
| 29 | } | 26 | } |
| 30 | 27 | ||
| 31 | void ConfigureGeneral::applyConfiguration() { | 28 | void ConfigureGeneral::applyConfiguration() { |
| 32 | UISettings::values.gamedir_deepscan = ui->toogle_deepscan->isChecked(); | 29 | UISettings::values.gamedir_deepscan = ui->toggle_deepscan->isChecked(); |
| 33 | UISettings::values.confirm_before_closing = ui->toogle_check_exit->isChecked(); | 30 | UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); |
| 34 | Settings::values.region_value = ui->region_combobox->currentIndex(); | 31 | Settings::values.region_value = ui->region_combobox->currentIndex(); |
| 35 | Settings::values.use_hw_renderer = ui->toogle_hw_renderer->isChecked(); | ||
| 36 | Settings::values.use_shader_jit = ui->toogle_shader_jit->isChecked(); | ||
| 37 | Settings::values.use_scaled_resolution = ui->toogle_scaled_resolution->isChecked(); | ||
| 38 | Settings::Apply(); | 32 | Settings::Apply(); |
| 39 | } | 33 | } |
diff --git a/src/citra_qt/configure_general.ui b/src/citra_qt/configure_general.ui index 5eb309793..343f804c0 100644 --- a/src/citra_qt/configure_general.ui +++ b/src/citra_qt/configure_general.ui | |||
| @@ -25,14 +25,14 @@ | |||
| 25 | <item> | 25 | <item> |
| 26 | <layout class="QVBoxLayout" name="verticalLayout_2"> | 26 | <layout class="QVBoxLayout" name="verticalLayout_2"> |
| 27 | <item> | 27 | <item> |
| 28 | <widget class="QCheckBox" name="toogle_deepscan"> | 28 | <widget class="QCheckBox" name="toggle_deepscan"> |
| 29 | <property name="text"> | 29 | <property name="text"> |
| 30 | <string>Recursive scan for game folder</string> | 30 | <string>Recursive scan for game folder</string> |
| 31 | </property> | 31 | </property> |
| 32 | </widget> | 32 | </widget> |
| 33 | </item> | 33 | </item> |
| 34 | <item> | 34 | <item> |
| 35 | <widget class="QCheckBox" name="toogle_check_exit"> | 35 | <widget class="QCheckBox" name="toggle_check_exit"> |
| 36 | <property name="text"> | 36 | <property name="text"> |
| 37 | <string>Confirm exit while emulation is running</string> | 37 | <string>Confirm exit while emulation is running</string> |
| 38 | </property> | 38 | </property> |
| @@ -107,40 +107,6 @@ | |||
| 107 | </widget> | 107 | </widget> |
| 108 | </item> | 108 | </item> |
| 109 | <item> | 109 | <item> |
| 110 | <widget class="QGroupBox" name="groupBox_2"> | ||
| 111 | <property name="title"> | ||
| 112 | <string>Performance</string> | ||
| 113 | </property> | ||
| 114 | <layout class="QHBoxLayout" name="horizontalLayout_2"> | ||
| 115 | <item> | ||
| 116 | <layout class="QVBoxLayout" name="verticalLayout_3"> | ||
| 117 | <item> | ||
| 118 | <widget class="QCheckBox" name="toogle_hw_renderer"> | ||
| 119 | <property name="text"> | ||
| 120 | <string>Enable hardware renderer</string> | ||
| 121 | </property> | ||
| 122 | </widget> | ||
| 123 | </item> | ||
| 124 | <item> | ||
| 125 | <widget class="QCheckBox" name="toogle_shader_jit"> | ||
| 126 | <property name="text"> | ||
| 127 | <string>Enable shader JIT</string> | ||
| 128 | </property> | ||
| 129 | </widget> | ||
| 130 | </item> | ||
| 131 | <item> | ||
| 132 | <widget class="QCheckBox" name="toogle_scaled_resolution"> | ||
| 133 | <property name="text"> | ||
| 134 | <string>Enable scaled resolution</string> | ||
| 135 | </property> | ||
| 136 | </widget> | ||
| 137 | </item> | ||
| 138 | </layout> | ||
| 139 | </item> | ||
| 140 | </layout> | ||
| 141 | </widget> | ||
| 142 | </item> | ||
| 143 | <item> | ||
| 144 | <widget class="QGroupBox" name="groupBox_3"> | 110 | <widget class="QGroupBox" name="groupBox_3"> |
| 145 | <property name="title"> | 111 | <property name="title"> |
| 146 | <string>Hotkeys</string> | 112 | <string>Hotkeys</string> |
diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configure_graphics.cpp new file mode 100644 index 000000000..5a8101795 --- /dev/null +++ b/src/citra_qt/configure_graphics.cpp | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "citra_qt/configure_graphics.h" | ||
| 6 | #include "ui_configure_graphics.h" | ||
| 7 | |||
| 8 | #include "core/settings.h" | ||
| 9 | #include "core/system.h" | ||
| 10 | |||
| 11 | ConfigureGraphics::ConfigureGraphics(QWidget *parent) : | ||
| 12 | QWidget(parent), | ||
| 13 | ui(new Ui::ConfigureGraphics) | ||
| 14 | { | ||
| 15 | ui->setupUi(this); | ||
| 16 | this->setConfiguration(); | ||
| 17 | |||
| 18 | ui->toggle_vsync->setEnabled(!System::IsPoweredOn()); | ||
| 19 | } | ||
| 20 | |||
| 21 | ConfigureGraphics::~ConfigureGraphics() { | ||
| 22 | } | ||
| 23 | |||
| 24 | void ConfigureGraphics::setConfiguration() { | ||
| 25 | ui->toggle_hw_renderer->setChecked(Settings::values.use_hw_renderer); | ||
| 26 | ui->toggle_shader_jit->setChecked(Settings::values.use_shader_jit); | ||
| 27 | ui->toggle_scaled_resolution->setChecked(Settings::values.use_scaled_resolution); | ||
| 28 | ui->toggle_vsync->setChecked(Settings::values.use_vsync); | ||
| 29 | } | ||
| 30 | |||
| 31 | void ConfigureGraphics::applyConfiguration() { | ||
| 32 | Settings::values.use_hw_renderer = ui->toggle_hw_renderer->isChecked(); | ||
| 33 | Settings::values.use_shader_jit = ui->toggle_shader_jit->isChecked(); | ||
| 34 | Settings::values.use_scaled_resolution = ui->toggle_scaled_resolution->isChecked(); | ||
| 35 | Settings::values.use_vsync = ui->toggle_vsync->isChecked(); | ||
| 36 | Settings::Apply(); | ||
| 37 | } | ||
diff --git a/src/citra_qt/configure_graphics.h b/src/citra_qt/configure_graphics.h new file mode 100644 index 000000000..dfb0c0461 --- /dev/null +++ b/src/citra_qt/configure_graphics.h | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <memory> | ||
| 8 | #include <QWidget> | ||
| 9 | |||
| 10 | namespace Ui { | ||
| 11 | class ConfigureGraphics; | ||
| 12 | } | ||
| 13 | |||
| 14 | class ConfigureGraphics : public QWidget | ||
| 15 | { | ||
| 16 | Q_OBJECT | ||
| 17 | |||
| 18 | public: | ||
| 19 | explicit ConfigureGraphics(QWidget *parent = nullptr); | ||
| 20 | ~ConfigureGraphics(); | ||
| 21 | |||
| 22 | void applyConfiguration(); | ||
| 23 | |||
| 24 | private: | ||
| 25 | void setConfiguration(); | ||
| 26 | |||
| 27 | private: | ||
| 28 | std::unique_ptr<Ui::ConfigureGraphics> ui; | ||
| 29 | }; | ||
diff --git a/src/citra_qt/configure_graphics.ui b/src/citra_qt/configure_graphics.ui new file mode 100644 index 000000000..da6e19ce1 --- /dev/null +++ b/src/citra_qt/configure_graphics.ui | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <ui version="4.0"> | ||
| 3 | <class>ConfigureGraphics</class> | ||
| 4 | <widget class="QWidget" name="ConfigureGraphics"> | ||
| 5 | <property name="geometry"> | ||
| 6 | <rect> | ||
| 7 | <x>0</x> | ||
| 8 | <y>0</y> | ||
| 9 | <width>400</width> | ||
| 10 | <height>300</height> | ||
| 11 | </rect> | ||
| 12 | </property> | ||
| 13 | <property name="windowTitle"> | ||
| 14 | <string>Form</string> | ||
| 15 | </property> | ||
| 16 | <layout class="QVBoxLayout" name="verticalLayout"> | ||
| 17 | <item> | ||
| 18 | <layout class="QVBoxLayout" name="verticalLayout_3"> | ||
| 19 | <item> | ||
| 20 | <widget class="QGroupBox" name="groupBox"> | ||
| 21 | <property name="title"> | ||
| 22 | <string>Graphics</string> | ||
| 23 | </property> | ||
| 24 | <layout class="QVBoxLayout" name="verticalLayout_2"> | ||
| 25 | <item> | ||
| 26 | <widget class="QCheckBox" name="toggle_hw_renderer"> | ||
| 27 | <property name="text"> | ||
| 28 | <string>Enable hardware renderer</string> | ||
| 29 | </property> | ||
| 30 | </widget> | ||
| 31 | </item> | ||
| 32 | <item> | ||
| 33 | <widget class="QCheckBox" name="toggle_shader_jit"> | ||
| 34 | <property name="text"> | ||
| 35 | <string>Enable shader JIT</string> | ||
| 36 | </property> | ||
| 37 | </widget> | ||
| 38 | </item> | ||
| 39 | <item> | ||
| 40 | <widget class="QCheckBox" name="toggle_scaled_resolution"> | ||
| 41 | <property name="text"> | ||
| 42 | <string>Enable scaled resolution</string> | ||
| 43 | </property> | ||
| 44 | </widget> | ||
| 45 | </item> | ||
| 46 | <item> | ||
| 47 | <widget class="QCheckBox" name="toggle_vsync"> | ||
| 48 | <property name="text"> | ||
| 49 | <string>Enable V-Sync</string> | ||
| 50 | </property> | ||
| 51 | </widget> | ||
| 52 | </item> | ||
| 53 | </layout> | ||
| 54 | </widget> | ||
| 55 | </item> | ||
| 56 | </layout> | ||
| 57 | </item> | ||
| 58 | <item> | ||
| 59 | <spacer name="verticalSpacer"> | ||
| 60 | <property name="orientation"> | ||
| 61 | <enum>Qt::Vertical</enum> | ||
| 62 | </property> | ||
| 63 | <property name="sizeHint" stdset="0"> | ||
| 64 | <size> | ||
| 65 | <width>20</width> | ||
| 66 | <height>40</height> | ||
| 67 | </size> | ||
| 68 | </property> | ||
| 69 | </spacer> | ||
| 70 | </item> | ||
| 71 | </layout> | ||
| 72 | </widget> | ||
| 73 | <resources/> | ||
| 74 | <connections> | ||
| 75 | <connection> | ||
| 76 | <sender>toggle_gdbstub</sender> | ||
| 77 | <signal>toggled(bool)</signal> | ||
| 78 | <receiver>gdbport_spinbox</receiver> | ||
| 79 | <slot>setEnabled(bool)</slot> | ||
| 80 | <hints> | ||
| 81 | <hint type="sourcelabel"> | ||
| 82 | <x>84</x> | ||
| 83 | <y>157</y> | ||
| 84 | </hint> | ||
| 85 | <hint type="destinationlabel"> | ||
| 86 | <x>342</x> | ||
| 87 | <y>158</y> | ||
| 88 | </hint> | ||
| 89 | </hints> | ||
| 90 | </connection> | ||
| 91 | </connections> | ||
| 92 | </ui> | ||
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 68a936087..9fd4482f6 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -243,7 +243,9 @@ bool GMainWindow::InitializeSystem() { | |||
| 243 | if (emu_thread != nullptr) | 243 | if (emu_thread != nullptr) |
| 244 | ShutdownGame(); | 244 | ShutdownGame(); |
| 245 | 245 | ||
| 246 | render_window->InitRenderTarget(); | ||
| 246 | render_window->MakeCurrent(); | 247 | render_window->MakeCurrent(); |
| 248 | |||
| 247 | if (!gladLoadGL()) { | 249 | if (!gladLoadGL()) { |
| 248 | QMessageBox::critical(this, tr("Error while starting Citra!"), | 250 | QMessageBox::critical(this, tr("Error while starting Citra!"), |
| 249 | tr("Failed to initialize the video core!\n\n" | 251 | tr("Failed to initialize the video core!\n\n" |
diff --git a/src/core/settings.h b/src/core/settings.h index 0962a4ecf..fb3fbe391 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -72,6 +72,7 @@ struct Values { | |||
| 72 | bool use_hw_renderer; | 72 | bool use_hw_renderer; |
| 73 | bool use_shader_jit; | 73 | bool use_shader_jit; |
| 74 | bool use_scaled_resolution; | 74 | bool use_scaled_resolution; |
| 75 | bool use_vsync; | ||
| 75 | 76 | ||
| 76 | float bg_red; | 77 | float bg_red; |
| 77 | float bg_green; | 78 | float bg_green; |
diff --git a/src/core/system.cpp b/src/core/system.cpp index 4a4757af3..4fc266cb0 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | 17 | ||
| 18 | namespace System { | 18 | namespace System { |
| 19 | 19 | ||
| 20 | static bool is_powered_on{ false }; | ||
| 21 | |||
| 20 | Result Init(EmuWindow* emu_window) { | 22 | Result Init(EmuWindow* emu_window) { |
| 21 | Core::Init(); | 23 | Core::Init(); |
| 22 | CoreTiming::Init(); | 24 | CoreTiming::Init(); |
| @@ -30,9 +32,15 @@ Result Init(EmuWindow* emu_window) { | |||
| 30 | AudioCore::Init(); | 32 | AudioCore::Init(); |
| 31 | GDBStub::Init(); | 33 | GDBStub::Init(); |
| 32 | 34 | ||
| 35 | is_powered_on = true; | ||
| 36 | |||
| 33 | return Result::Success; | 37 | return Result::Success; |
| 34 | } | 38 | } |
| 35 | 39 | ||
| 40 | bool IsPoweredOn() { | ||
| 41 | return is_powered_on; | ||
| 42 | } | ||
| 43 | |||
| 36 | void Shutdown() { | 44 | void Shutdown() { |
| 37 | GDBStub::Shutdown(); | 45 | GDBStub::Shutdown(); |
| 38 | AudioCore::Shutdown(); | 46 | AudioCore::Shutdown(); |
| @@ -42,6 +50,8 @@ void Shutdown() { | |||
| 42 | HW::Shutdown(); | 50 | HW::Shutdown(); |
| 43 | CoreTiming::Shutdown(); | 51 | CoreTiming::Shutdown(); |
| 44 | Core::Shutdown(); | 52 | Core::Shutdown(); |
| 53 | |||
| 54 | is_powered_on = false; | ||
| 45 | } | 55 | } |
| 46 | 56 | ||
| 47 | } // namespace | 57 | } // namespace |
diff --git a/src/core/system.h b/src/core/system.h index a4a627ea9..fb0ca4e1b 100644 --- a/src/core/system.h +++ b/src/core/system.h | |||
| @@ -16,6 +16,7 @@ enum class Result { | |||
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | Result Init(EmuWindow* emu_window); | 18 | Result Init(EmuWindow* emu_window); |
| 19 | bool IsPoweredOn(); | ||
| 19 | void Shutdown(); | 20 | void Shutdown(); |
| 20 | 21 | ||
| 21 | } | 22 | } |
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index c9975876d..bd6e5eb6b 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp | |||
| @@ -22,6 +22,7 @@ std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin | |||
| 22 | std::atomic<bool> g_hw_renderer_enabled; | 22 | std::atomic<bool> g_hw_renderer_enabled; |
| 23 | std::atomic<bool> g_shader_jit_enabled; | 23 | std::atomic<bool> g_shader_jit_enabled; |
| 24 | std::atomic<bool> g_scaled_resolution_enabled; | 24 | std::atomic<bool> g_scaled_resolution_enabled; |
| 25 | std::atomic<bool> g_vsync_enabled; | ||
| 25 | 26 | ||
| 26 | /// Initialize the video core | 27 | /// Initialize the video core |
| 27 | bool Init(EmuWindow* emu_window) { | 28 | bool Init(EmuWindow* emu_window) { |