diff options
Diffstat (limited to 'src/citra_qt/main.cpp')
| -rw-r--r-- | src/citra_qt/main.cpp | 153 |
1 files changed, 84 insertions, 69 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index cf467532f..82667446b 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -5,25 +5,15 @@ | |||
| 5 | #include <clocale> | 5 | #include <clocale> |
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | #include <thread> | 7 | #include <thread> |
| 8 | |||
| 9 | #include <glad/glad.h> | 8 | #include <glad/glad.h> |
| 10 | |||
| 11 | #define QT_NO_OPENGL | 9 | #define QT_NO_OPENGL |
| 12 | #include <QDesktopWidget> | 10 | #include <QDesktopWidget> |
| 13 | #include <QtGui> | ||
| 14 | #include <QFileDialog> | 11 | #include <QFileDialog> |
| 15 | #include <QMessageBox> | 12 | #include <QMessageBox> |
| 16 | #include "qhexedit.h" | 13 | #include <QtGui> |
| 17 | |||
| 18 | #include "citra_qt/bootmanager.h" | 14 | #include "citra_qt/bootmanager.h" |
| 19 | #include "citra_qt/config.h" | 15 | #include "citra_qt/config.h" |
| 20 | #include "citra_qt/configure_dialog.h" | 16 | #include "citra_qt/configure_dialog.h" |
| 21 | #include "citra_qt/game_list.h" | ||
| 22 | #include "citra_qt/hotkeys.h" | ||
| 23 | #include "citra_qt/main.h" | ||
| 24 | #include "citra_qt/ui_settings.h" | ||
| 25 | |||
| 26 | // Debugger | ||
| 27 | #include "citra_qt/debugger/callstack.h" | 17 | #include "citra_qt/debugger/callstack.h" |
| 28 | #include "citra_qt/debugger/disassembler.h" | 18 | #include "citra_qt/debugger/disassembler.h" |
| 29 | #include "citra_qt/debugger/graphics.h" | 19 | #include "citra_qt/debugger/graphics.h" |
| @@ -35,28 +25,29 @@ | |||
| 35 | #include "citra_qt/debugger/profiler.h" | 25 | #include "citra_qt/debugger/profiler.h" |
| 36 | #include "citra_qt/debugger/ramview.h" | 26 | #include "citra_qt/debugger/ramview.h" |
| 37 | #include "citra_qt/debugger/registers.h" | 27 | #include "citra_qt/debugger/registers.h" |
| 38 | 28 | #include "citra_qt/game_list.h" | |
| 29 | #include "citra_qt/hotkeys.h" | ||
| 30 | #include "citra_qt/main.h" | ||
| 31 | #include "citra_qt/ui_settings.h" | ||
| 32 | #include "common/logging/backend.h" | ||
| 33 | #include "common/logging/filter.h" | ||
| 34 | #include "common/logging/log.h" | ||
| 35 | #include "common/logging/text_formatter.h" | ||
| 39 | #include "common/microprofile.h" | 36 | #include "common/microprofile.h" |
| 40 | #include "common/platform.h" | 37 | #include "common/platform.h" |
| 41 | #include "common/scm_rev.h" | 38 | #include "common/scm_rev.h" |
| 42 | #include "common/scope_exit.h" | 39 | #include "common/scope_exit.h" |
| 43 | #include "common/string_util.h" | 40 | #include "common/string_util.h" |
| 44 | #include "common/logging/backend.h" | ||
| 45 | #include "common/logging/filter.h" | ||
| 46 | #include "common/logging/log.h" | ||
| 47 | #include "common/logging/text_formatter.h" | ||
| 48 | |||
| 49 | #include "core/core.h" | ||
| 50 | #include "core/settings.h" | ||
| 51 | #include "core/system.h" | ||
| 52 | #include "core/arm/disassembler/load_symbol_map.h" | 41 | #include "core/arm/disassembler/load_symbol_map.h" |
| 42 | #include "core/core.h" | ||
| 53 | #include "core/gdbstub/gdbstub.h" | 43 | #include "core/gdbstub/gdbstub.h" |
| 54 | #include "core/loader/loader.h" | 44 | #include "core/loader/loader.h" |
| 55 | 45 | #include "core/settings.h" | |
| 46 | #include "core/system.h" | ||
| 47 | #include "qhexedit.h" | ||
| 56 | #include "video_core/video_core.h" | 48 | #include "video_core/video_core.h" |
| 57 | 49 | ||
| 58 | GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) | 50 | GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { |
| 59 | { | ||
| 60 | Pica::g_debug_context = Pica::DebugContext::Construct(); | 51 | Pica::g_debug_context = Pica::DebugContext::Construct(); |
| 61 | 52 | ||
| 62 | ui.setupUi(this); | 53 | ui.setupUi(this); |
| @@ -91,7 +82,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) | |||
| 91 | 82 | ||
| 92 | graphicsWidget = new GPUCommandStreamWidget(this); | 83 | graphicsWidget = new GPUCommandStreamWidget(this); |
| 93 | addDockWidget(Qt::RightDockWidgetArea, graphicsWidget); | 84 | addDockWidget(Qt::RightDockWidgetArea, graphicsWidget); |
| 94 | graphicsWidget ->hide(); | 85 | graphicsWidget->hide(); |
| 95 | 86 | ||
| 96 | graphicsCommandsWidget = new GPUCommandListWidget(this); | 87 | graphicsCommandsWidget = new GPUCommandListWidget(this); |
| 97 | addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget); | 88 | addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget); |
| @@ -110,7 +101,8 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) | |||
| 110 | graphicsTracingWidget->hide(); | 101 | graphicsTracingWidget->hide(); |
| 111 | 102 | ||
| 112 | auto graphicsSurfaceViewerAction = new QAction(tr("Create Pica surface viewer"), this); | 103 | auto graphicsSurfaceViewerAction = new QAction(tr("Create Pica surface viewer"), this); |
| 113 | connect(graphicsSurfaceViewerAction, SIGNAL(triggered()), this, SLOT(OnCreateGraphicsSurfaceViewer())); | 104 | connect(graphicsSurfaceViewerAction, SIGNAL(triggered()), this, |
| 105 | SLOT(OnCreateGraphicsSurfaceViewer())); | ||
| 114 | 106 | ||
| 115 | QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); | 107 | QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging")); |
| 116 | debug_menu->addAction(graphicsSurfaceViewerAction); | 108 | debug_menu->addAction(graphicsSurfaceViewerAction); |
| @@ -167,35 +159,44 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) | |||
| 167 | UpdateRecentFiles(); | 159 | UpdateRecentFiles(); |
| 168 | 160 | ||
| 169 | // Setup connections | 161 | // Setup connections |
| 170 | connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)), Qt::DirectConnection); | 162 | connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)), |
| 163 | Qt::DirectConnection); | ||
| 171 | connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(OnConfigure())); | 164 | connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(OnConfigure())); |
| 172 | connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()),Qt::DirectConnection); | 165 | connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()), |
| 166 | Qt::DirectConnection); | ||
| 173 | connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); | 167 | connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); |
| 174 | connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this, SLOT(OnMenuSelectGameListRoot())); | 168 | connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this, |
| 169 | SLOT(OnMenuSelectGameListRoot())); | ||
| 175 | connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); | 170 | connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); |
| 176 | connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); | 171 | connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); |
| 177 | connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); | 172 | connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); |
| 178 | connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode())); | 173 | connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode())); |
| 179 | 174 | ||
| 180 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), disasmWidget, SLOT(OnEmulationStarting(EmuThread*))); | 175 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), disasmWidget, |
| 176 | SLOT(OnEmulationStarting(EmuThread*))); | ||
| 181 | connect(this, SIGNAL(EmulationStopping()), disasmWidget, SLOT(OnEmulationStopping())); | 177 | connect(this, SIGNAL(EmulationStopping()), disasmWidget, SLOT(OnEmulationStopping())); |
| 182 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), registersWidget, SLOT(OnEmulationStarting(EmuThread*))); | 178 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), registersWidget, |
| 179 | SLOT(OnEmulationStarting(EmuThread*))); | ||
| 183 | connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping())); | 180 | connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping())); |
| 184 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); | 181 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, |
| 182 | SLOT(OnEmulationStarting(EmuThread*))); | ||
| 185 | connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); | 183 | connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); |
| 186 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), graphicsTracingWidget, SLOT(OnEmulationStarting(EmuThread*))); | 184 | connect(this, SIGNAL(EmulationStarting(EmuThread*)), graphicsTracingWidget, |
| 185 | SLOT(OnEmulationStarting(EmuThread*))); | ||
| 187 | connect(this, SIGNAL(EmulationStopping()), graphicsTracingWidget, SLOT(OnEmulationStopping())); | 186 | connect(this, SIGNAL(EmulationStopping()), graphicsTracingWidget, SLOT(OnEmulationStopping())); |
| 188 | 187 | ||
| 189 | |||
| 190 | // Setup hotkeys | 188 | // Setup hotkeys |
| 191 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); | 189 | RegisterHotkey("Main Window", "Load File", QKeySequence::Open); |
| 192 | RegisterHotkey("Main Window", "Start Emulation"); | 190 | RegisterHotkey("Main Window", "Start Emulation"); |
| 193 | LoadHotkeys(); | 191 | LoadHotkeys(); |
| 194 | 192 | ||
| 195 | connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, SLOT(OnMenuLoadFile())); | 193 | connect(GetHotkey("Main Window", "Load File", this), SIGNAL(activated()), this, |
| 196 | connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, SLOT(OnStartGame())); | 194 | SLOT(OnMenuLoadFile())); |
| 195 | connect(GetHotkey("Main Window", "Start Emulation", this), SIGNAL(activated()), this, | ||
| 196 | SLOT(OnStartGame())); | ||
| 197 | 197 | ||
| 198 | std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); | 198 | std::string window_title = |
| 199 | Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); | ||
| 199 | setWindowTitle(window_title.c_str()); | 200 | setWindowTitle(window_title.c_str()); |
| 200 | 201 | ||
| 201 | show(); | 202 | show(); |
| @@ -208,8 +209,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) | |||
| 208 | } | 209 | } |
| 209 | } | 210 | } |
| 210 | 211 | ||
| 211 | GMainWindow::~GMainWindow() | 212 | GMainWindow::~GMainWindow() { |
| 212 | { | ||
| 213 | // will get automatically deleted otherwise | 213 | // will get automatically deleted otherwise |
| 214 | if (render_window->parent() == nullptr) | 214 | if (render_window->parent() == nullptr) |
| 215 | delete render_window; | 215 | delete render_window; |
| @@ -217,19 +217,18 @@ GMainWindow::~GMainWindow() | |||
| 217 | Pica::g_debug_context.reset(); | 217 | Pica::g_debug_context.reset(); |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | void GMainWindow::OnDisplayTitleBars(bool show) | 220 | void GMainWindow::OnDisplayTitleBars(bool show) { |
| 221 | { | ||
| 222 | QList<QDockWidget*> widgets = findChildren<QDockWidget*>(); | 221 | QList<QDockWidget*> widgets = findChildren<QDockWidget*>(); |
| 223 | 222 | ||
| 224 | if (show) { | 223 | if (show) { |
| 225 | for (QDockWidget* widget: widgets) { | 224 | for (QDockWidget* widget : widgets) { |
| 226 | QWidget* old = widget->titleBarWidget(); | 225 | QWidget* old = widget->titleBarWidget(); |
| 227 | widget->setTitleBarWidget(nullptr); | 226 | widget->setTitleBarWidget(nullptr); |
| 228 | if (old != nullptr) | 227 | if (old != nullptr) |
| 229 | delete old; | 228 | delete old; |
| 230 | } | 229 | } |
| 231 | } else { | 230 | } else { |
| 232 | for (QDockWidget* widget: widgets) { | 231 | for (QDockWidget* widget : widgets) { |
| 233 | QWidget* old = widget->titleBarWidget(); | 232 | QWidget* old = widget->titleBarWidget(); |
| 234 | widget->setTitleBarWidget(new QWidget()); | 233 | widget->setTitleBarWidget(new QWidget()); |
| 235 | if (old != nullptr) | 234 | if (old != nullptr) |
| @@ -249,7 +248,8 @@ bool GMainWindow::InitializeSystem() { | |||
| 249 | if (!gladLoadGL()) { | 248 | if (!gladLoadGL()) { |
| 250 | QMessageBox::critical(this, tr("Error while starting Citra!"), | 249 | QMessageBox::critical(this, tr("Error while starting Citra!"), |
| 251 | tr("Failed to initialize the video core!\n\n" | 250 | tr("Failed to initialize the video core!\n\n" |
| 252 | "Please ensure that your GPU supports OpenGL 3.3 and that you have the latest graphics driver.")); | 251 | "Please ensure that your GPU supports OpenGL 3.3 and that you " |
| 252 | "have the latest graphics driver.")); | ||
| 253 | return false; | 253 | return false; |
| 254 | } | 254 | } |
| 255 | 255 | ||
| @@ -260,7 +260,8 @@ bool GMainWindow::InitializeSystem() { | |||
| 260 | case System::Result::ErrorInitVideoCore: | 260 | case System::Result::ErrorInitVideoCore: |
| 261 | QMessageBox::critical(this, tr("Error while starting Citra!"), | 261 | QMessageBox::critical(this, tr("Error while starting Citra!"), |
| 262 | tr("Failed to initialize the video core!\n\n" | 262 | tr("Failed to initialize the video core!\n\n" |
| 263 | "Please ensure that your GPU supports OpenGL 3.3 and that you have the latest graphics driver.")); | 263 | "Please ensure that your GPU supports OpenGL 3.3 and that you " |
| 264 | "have the latest graphics driver.")); | ||
| 264 | break; | 265 | break; |
| 265 | 266 | ||
| 266 | default: | 267 | default: |
| @@ -293,8 +294,12 @@ bool GMainWindow::LoadROM(const std::string& filename) { | |||
| 293 | QMessageBox popup_error; | 294 | QMessageBox popup_error; |
| 294 | popup_error.setTextFormat(Qt::RichText); | 295 | popup_error.setTextFormat(Qt::RichText); |
| 295 | popup_error.setWindowTitle(tr("Error while loading ROM!")); | 296 | popup_error.setWindowTitle(tr("Error while loading ROM!")); |
| 296 | popup_error.setText(tr("The game that you are trying to load must be decrypted before being used with Citra.<br/><br/>" | 297 | popup_error.setText( |
| 297 | "For more information on dumping and decrypting games, please see: <a href='https://citra-emu.org/wiki/Dumping-Game-Cartridges'>https://citra-emu.org/wiki/Dumping-Game-Cartridges</a>")); | 298 | tr("The game that you are trying to load must be decrypted before being used with " |
| 299 | "Citra.<br/><br/>" | ||
| 300 | "For more information on dumping and decrypting games, please see: <a " | ||
| 301 | "href='https://citra-emu.org/wiki/Dumping-Game-Cartridges'>https://" | ||
| 302 | "citra-emu.org/wiki/Dumping-Game-Cartridges</a>")); | ||
| 298 | popup_error.setIcon(QMessageBox::Critical); | 303 | popup_error.setIcon(QMessageBox::Critical); |
| 299 | popup_error.exec(); | 304 | popup_error.exec(); |
| 300 | break; | 305 | break; |
| @@ -306,8 +311,7 @@ bool GMainWindow::LoadROM(const std::string& filename) { | |||
| 306 | case Loader::ResultStatus::Error: | 311 | case Loader::ResultStatus::Error: |
| 307 | 312 | ||
| 308 | default: | 313 | default: |
| 309 | QMessageBox::critical(this, tr("Error while loading ROM!"), | 314 | QMessageBox::critical(this, tr("Error while loading ROM!"), tr("Unknown error!")); |
| 310 | tr("Unknown error!")); | ||
| 311 | break; | 315 | break; |
| 312 | } | 316 | } |
| 313 | return false; | 317 | return false; |
| @@ -332,13 +336,20 @@ void GMainWindow::BootGame(const std::string& filename) { | |||
| 332 | emu_thread->start(); | 336 | emu_thread->start(); |
| 333 | 337 | ||
| 334 | connect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame())); | 338 | connect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame())); |
| 335 | // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues | 339 | // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views |
| 336 | connect(emu_thread.get(), SIGNAL(DebugModeEntered()), disasmWidget, SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); | 340 | // before the CPU continues |
| 337 | connect(emu_thread.get(), SIGNAL(DebugModeEntered()), registersWidget, SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); | 341 | connect(emu_thread.get(), SIGNAL(DebugModeEntered()), disasmWidget, SLOT(OnDebugModeEntered()), |
| 338 | connect(emu_thread.get(), SIGNAL(DebugModeEntered()), callstackWidget, SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); | 342 | Qt::BlockingQueuedConnection); |
| 339 | connect(emu_thread.get(), SIGNAL(DebugModeLeft()), disasmWidget, SLOT(OnDebugModeLeft()), Qt::BlockingQueuedConnection); | 343 | connect(emu_thread.get(), SIGNAL(DebugModeEntered()), registersWidget, |
| 340 | connect(emu_thread.get(), SIGNAL(DebugModeLeft()), registersWidget, SLOT(OnDebugModeLeft()), Qt::BlockingQueuedConnection); | 344 | SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); |
| 341 | connect(emu_thread.get(), SIGNAL(DebugModeLeft()), callstackWidget, SLOT(OnDebugModeLeft()), Qt::BlockingQueuedConnection); | 345 | connect(emu_thread.get(), SIGNAL(DebugModeEntered()), callstackWidget, |
| 346 | SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); | ||
| 347 | connect(emu_thread.get(), SIGNAL(DebugModeLeft()), disasmWidget, SLOT(OnDebugModeLeft()), | ||
| 348 | Qt::BlockingQueuedConnection); | ||
| 349 | connect(emu_thread.get(), SIGNAL(DebugModeLeft()), registersWidget, SLOT(OnDebugModeLeft()), | ||
| 350 | Qt::BlockingQueuedConnection); | ||
| 351 | connect(emu_thread.get(), SIGNAL(DebugModeLeft()), callstackWidget, SLOT(OnDebugModeLeft()), | ||
| 352 | Qt::BlockingQueuedConnection); | ||
| 342 | 353 | ||
| 343 | // Update the GUI | 354 | // Update the GUI |
| 344 | registersWidget->OnDebugModeEntered(); | 355 | registersWidget->OnDebugModeEntered(); |
| @@ -393,10 +404,12 @@ void GMainWindow::StoreRecentFile(const std::string& filename) { | |||
| 393 | } | 404 | } |
| 394 | 405 | ||
| 395 | void GMainWindow::UpdateRecentFiles() { | 406 | void GMainWindow::UpdateRecentFiles() { |
| 396 | unsigned int num_recent_files = std::min(UISettings::values.recent_files.size(), static_cast<int>(max_recent_files_item)); | 407 | unsigned int num_recent_files = |
| 408 | std::min(UISettings::values.recent_files.size(), static_cast<int>(max_recent_files_item)); | ||
| 397 | 409 | ||
| 398 | for (unsigned int i = 0; i < num_recent_files; i++) { | 410 | for (unsigned int i = 0; i < num_recent_files; i++) { |
| 399 | QString text = QString("&%1. %2").arg(i + 1).arg(QFileInfo(UISettings::values.recent_files[i]).fileName()); | 411 | QString text = QString("&%1. %2").arg(i + 1).arg( |
| 412 | QFileInfo(UISettings::values.recent_files[i]).fileName()); | ||
| 400 | actions_recent_files[i]->setText(text); | 413 | actions_recent_files[i]->setText(text); |
| 401 | actions_recent_files[i]->setData(UISettings::values.recent_files[i]); | 414 | actions_recent_files[i]->setData(UISettings::values.recent_files[i]); |
| 402 | actions_recent_files[i]->setToolTip(UISettings::values.recent_files[i]); | 415 | actions_recent_files[i]->setToolTip(UISettings::values.recent_files[i]); |
| @@ -420,7 +433,9 @@ void GMainWindow::OnGameListLoadFile(QString game_path) { | |||
| 420 | } | 433 | } |
| 421 | 434 | ||
| 422 | void GMainWindow::OnMenuLoadFile() { | 435 | void GMainWindow::OnMenuLoadFile() { |
| 423 | QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), UISettings::values.roms_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); | 436 | QString filename = |
| 437 | QFileDialog::getOpenFileName(this, tr("Load File"), UISettings::values.roms_path, | ||
| 438 | tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); | ||
| 424 | if (!filename.isEmpty()) { | 439 | if (!filename.isEmpty()) { |
| 425 | UISettings::values.roms_path = QFileInfo(filename).path(); | 440 | UISettings::values.roms_path = QFileInfo(filename).path(); |
| 426 | 441 | ||
| @@ -429,7 +444,8 @@ void GMainWindow::OnMenuLoadFile() { | |||
| 429 | } | 444 | } |
| 430 | 445 | ||
| 431 | void GMainWindow::OnMenuLoadSymbolMap() { | 446 | void GMainWindow::OnMenuLoadSymbolMap() { |
| 432 | QString filename = QFileDialog::getOpenFileName(this, tr("Load Symbol Map"), UISettings::values.symbols_path, tr("Symbol map (*)")); | 447 | QString filename = QFileDialog::getOpenFileName( |
| 448 | this, tr("Load Symbol Map"), UISettings::values.symbols_path, tr("Symbol map (*)")); | ||
| 433 | if (!filename.isEmpty()) { | 449 | if (!filename.isEmpty()) { |
| 434 | UISettings::values.symbols_path = QFileInfo(filename).path(); | 450 | UISettings::values.symbols_path = QFileInfo(filename).path(); |
| 435 | 451 | ||
| @@ -455,7 +471,8 @@ void GMainWindow::OnMenuRecentFile() { | |||
| 455 | BootGame(filename.toStdString()); | 471 | BootGame(filename.toStdString()); |
| 456 | } else { | 472 | } else { |
| 457 | // Display an error message and remove the file from the list. | 473 | // Display an error message and remove the file from the list. |
| 458 | QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename)); | 474 | QMessageBox::information(this, tr("File not found"), |
| 475 | tr("File \"%1\" not found").arg(filename)); | ||
| 459 | 476 | ||
| 460 | UISettings::values.recent_files.removeOne(filename); | 477 | UISettings::values.recent_files.removeOne(filename); |
| 461 | UpdateRecentFiles(); | 478 | UpdateRecentFiles(); |
| @@ -512,8 +529,7 @@ void GMainWindow::ToggleWindowMode() { | |||
| 512 | void GMainWindow::OnConfigure() { | 529 | void GMainWindow::OnConfigure() { |
| 513 | ConfigureDialog configureDialog(this); | 530 | ConfigureDialog configureDialog(this); |
| 514 | auto result = configureDialog.exec(); | 531 | auto result = configureDialog.exec(); |
| 515 | if (result == QDialog::Accepted) | 532 | if (result == QDialog::Accepted) { |
| 516 | { | ||
| 517 | configureDialog.applyConfiguration(); | 533 | configureDialog.applyConfiguration(); |
| 518 | render_window->ReloadSetKeymaps(); | 534 | render_window->ReloadSetKeymaps(); |
| 519 | config->Save(); | 535 | config->Save(); |
| @@ -531,9 +547,9 @@ bool GMainWindow::ConfirmClose() { | |||
| 531 | if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) | 547 | if (emu_thread == nullptr || !UISettings::values.confirm_before_closing) |
| 532 | return true; | 548 | return true; |
| 533 | 549 | ||
| 534 | auto answer = QMessageBox::question(this, tr("Citra"), | 550 | auto answer = |
| 535 | tr("Are you sure you want to close Citra?"), | 551 | QMessageBox::question(this, tr("Citra"), tr("Are you sure you want to close Citra?"), |
| 536 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); | 552 | QMessageBox::Yes | QMessageBox::No, QMessageBox::No); |
| 537 | return answer != QMessageBox::No; | 553 | return answer != QMessageBox::No; |
| 538 | } | 554 | } |
| 539 | 555 | ||
| @@ -575,9 +591,7 @@ int main(int argc, char* argv[]) { | |||
| 575 | Log::SetFilter(&log_filter); | 591 | Log::SetFilter(&log_filter); |
| 576 | 592 | ||
| 577 | MicroProfileOnThreadCreate("Frontend"); | 593 | MicroProfileOnThreadCreate("Frontend"); |
| 578 | SCOPE_EXIT({ | 594 | SCOPE_EXIT({ MicroProfileShutdown(); }); |
| 579 | MicroProfileShutdown(); | ||
| 580 | }); | ||
| 581 | 595 | ||
| 582 | // Init settings params | 596 | // Init settings params |
| 583 | QCoreApplication::setOrganizationName("Citra team"); | 597 | QCoreApplication::setOrganizationName("Citra team"); |
| @@ -586,7 +600,8 @@ int main(int argc, char* argv[]) { | |||
| 586 | QApplication::setAttribute(Qt::AA_X11InitThreads); | 600 | QApplication::setAttribute(Qt::AA_X11InitThreads); |
| 587 | QApplication app(argc, argv); | 601 | QApplication app(argc, argv); |
| 588 | 602 | ||
| 589 | // Qt changes the locale and causes issues in float conversion using std::to_string() when generating shaders | 603 | // Qt changes the locale and causes issues in float conversion using std::to_string() when |
| 604 | // generating shaders | ||
| 590 | setlocale(LC_ALL, "C"); | 605 | setlocale(LC_ALL, "C"); |
| 591 | 606 | ||
| 592 | GMainWindow main_window; | 607 | GMainWindow main_window; |