diff options
Diffstat (limited to 'src/citra_qt/main.cpp')
| -rw-r--r-- | src/citra_qt/main.cpp | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 01841b33c..298649aaf 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include "citra_qt/bootmanager.h" | 13 | #include "citra_qt/bootmanager.h" |
| 14 | #include "citra_qt/config.h" | 14 | #include "citra_qt/config.h" |
| 15 | #include "citra_qt/game_list.h" | ||
| 15 | #include "citra_qt/hotkeys.h" | 16 | #include "citra_qt/hotkeys.h" |
| 16 | #include "citra_qt/main.h" | 17 | #include "citra_qt/main.h" |
| 17 | 18 | ||
| @@ -59,6 +60,9 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) | |||
| 59 | render_window = new GRenderWindow(this, emu_thread.get()); | 60 | render_window = new GRenderWindow(this, emu_thread.get()); |
| 60 | render_window->hide(); | 61 | render_window->hide(); |
| 61 | 62 | ||
| 63 | game_list = new GameList(); | ||
| 64 | ui.horizontalLayout->addWidget(game_list); | ||
| 65 | |||
| 62 | profilerWidget = new ProfilerWidget(this); | 66 | profilerWidget = new ProfilerWidget(this); |
| 63 | addDockWidget(Qt::BottomDockWidgetArea, profilerWidget); | 67 | addDockWidget(Qt::BottomDockWidgetArea, profilerWidget); |
| 64 | profilerWidget->hide(); | 68 | profilerWidget->hide(); |
| @@ -137,6 +141,8 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) | |||
| 137 | microProfileDialog->setVisible(settings.value("microProfileDialogVisible").toBool()); | 141 | microProfileDialog->setVisible(settings.value("microProfileDialogVisible").toBool()); |
| 138 | settings.endGroup(); | 142 | settings.endGroup(); |
| 139 | 143 | ||
| 144 | game_list->LoadInterfaceLayout(settings); | ||
| 145 | |||
| 140 | ui.action_Use_Hardware_Renderer->setChecked(Settings::values.use_hw_renderer); | 146 | ui.action_Use_Hardware_Renderer->setChecked(Settings::values.use_hw_renderer); |
| 141 | SetHardwareRendererEnabled(ui.action_Use_Hardware_Renderer->isChecked()); | 147 | SetHardwareRendererEnabled(ui.action_Use_Hardware_Renderer->isChecked()); |
| 142 | 148 | ||
| @@ -160,8 +166,10 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) | |||
| 160 | UpdateRecentFiles(); | 166 | UpdateRecentFiles(); |
| 161 | 167 | ||
| 162 | // Setup connections | 168 | // Setup connections |
| 169 | connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString))); | ||
| 163 | connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile())); | 170 | connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile())); |
| 164 | connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); | 171 | connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); |
| 172 | connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this, SLOT(OnMenuSelectGameListRoot())); | ||
| 165 | connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); | 173 | connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); |
| 166 | connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); | 174 | connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); |
| 167 | connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); | 175 | connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); |
| @@ -193,6 +201,8 @@ GMainWindow::GMainWindow() : emu_thread(nullptr) | |||
| 193 | 201 | ||
| 194 | show(); | 202 | show(); |
| 195 | 203 | ||
| 204 | game_list->PopulateAsync(settings.value("gameListRootDir").toString(), settings.value("gameListDeepScan").toBool()); | ||
| 205 | |||
| 196 | QStringList args = QApplication::arguments(); | 206 | QStringList args = QApplication::arguments(); |
| 197 | if (args.length() >= 2) { | 207 | if (args.length() >= 2) { |
| 198 | BootGame(args[1].toStdString()); | 208 | BootGame(args[1].toStdString()); |
| @@ -264,8 +274,12 @@ void GMainWindow::BootGame(const std::string& filename) { | |||
| 264 | // Update the GUI | 274 | // Update the GUI |
| 265 | registersWidget->OnDebugModeEntered(); | 275 | registersWidget->OnDebugModeEntered(); |
| 266 | callstackWidget->OnDebugModeEntered(); | 276 | callstackWidget->OnDebugModeEntered(); |
| 277 | if (ui.action_Single_Window_Mode->isChecked()) { | ||
| 278 | game_list->hide(); | ||
| 279 | } | ||
| 267 | render_window->show(); | 280 | render_window->show(); |
| 268 | 281 | ||
| 282 | emulation_running = true; | ||
| 269 | OnStartGame(); | 283 | OnStartGame(); |
| 270 | } | 284 | } |
| 271 | 285 | ||
| @@ -294,6 +308,9 @@ void GMainWindow::ShutdownGame() { | |||
| 294 | ui.action_Pause->setEnabled(false); | 308 | ui.action_Pause->setEnabled(false); |
| 295 | ui.action_Stop->setEnabled(false); | 309 | ui.action_Stop->setEnabled(false); |
| 296 | render_window->hide(); | 310 | render_window->hide(); |
| 311 | game_list->show(); | ||
| 312 | |||
| 313 | emulation_running = false; | ||
| 297 | } | 314 | } |
| 298 | 315 | ||
| 299 | void GMainWindow::StoreRecentFile(const QString& filename) | 316 | void GMainWindow::StoreRecentFile(const QString& filename) |
| @@ -337,12 +354,16 @@ void GMainWindow::UpdateRecentFiles() { | |||
| 337 | } | 354 | } |
| 338 | } | 355 | } |
| 339 | 356 | ||
| 357 | void GMainWindow::OnGameListLoadFile(QString game_path) { | ||
| 358 | BootGame(game_path.toLatin1().data()); | ||
| 359 | } | ||
| 360 | |||
| 340 | void GMainWindow::OnMenuLoadFile() { | 361 | void GMainWindow::OnMenuLoadFile() { |
| 341 | QSettings settings; | 362 | QSettings settings; |
| 342 | QString rom_path = settings.value("romsPath", QString()).toString(); | 363 | QString rom_path = settings.value("romsPath", QString()).toString(); |
| 343 | 364 | ||
| 344 | QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); | 365 | QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); |
| 345 | if (filename.size()) { | 366 | if (!filename.isEmpty()) { |
| 346 | settings.setValue("romsPath", QFileInfo(filename).path()); | 367 | settings.setValue("romsPath", QFileInfo(filename).path()); |
| 347 | StoreRecentFile(filename); | 368 | StoreRecentFile(filename); |
| 348 | 369 | ||
| @@ -355,13 +376,23 @@ void GMainWindow::OnMenuLoadSymbolMap() { | |||
| 355 | QString symbol_path = settings.value("symbolsPath", QString()).toString(); | 376 | QString symbol_path = settings.value("symbolsPath", QString()).toString(); |
| 356 | 377 | ||
| 357 | QString filename = QFileDialog::getOpenFileName(this, tr("Load Symbol Map"), symbol_path, tr("Symbol map (*)")); | 378 | QString filename = QFileDialog::getOpenFileName(this, tr("Load Symbol Map"), symbol_path, tr("Symbol map (*)")); |
| 358 | if (filename.size()) { | 379 | if (!filename.isEmpty()) { |
| 359 | settings.setValue("symbolsPath", QFileInfo(filename).path()); | 380 | settings.setValue("symbolsPath", QFileInfo(filename).path()); |
| 360 | 381 | ||
| 361 | LoadSymbolMap(filename.toLatin1().data()); | 382 | LoadSymbolMap(filename.toLatin1().data()); |
| 362 | } | 383 | } |
| 363 | } | 384 | } |
| 364 | 385 | ||
| 386 | void GMainWindow::OnMenuSelectGameListRoot() { | ||
| 387 | QSettings settings; | ||
| 388 | |||
| 389 | QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); | ||
| 390 | if (!dir_path.isEmpty()) { | ||
| 391 | settings.setValue("gameListRootDir", dir_path); | ||
| 392 | game_list->PopulateAsync(dir_path, settings.value("gameListDeepScan").toBool()); | ||
| 393 | } | ||
| 394 | } | ||
| 395 | |||
| 365 | void GMainWindow::OnMenuRecentFile() { | 396 | void GMainWindow::OnMenuRecentFile() { |
| 366 | QAction* action = qobject_cast<QAction*>(sender()); | 397 | QAction* action = qobject_cast<QAction*>(sender()); |
| 367 | assert(action); | 398 | assert(action); |
| @@ -423,17 +454,22 @@ void GMainWindow::ToggleWindowMode() { | |||
| 423 | // Render in the main window... | 454 | // Render in the main window... |
| 424 | render_window->BackupGeometry(); | 455 | render_window->BackupGeometry(); |
| 425 | ui.horizontalLayout->addWidget(render_window); | 456 | ui.horizontalLayout->addWidget(render_window); |
| 426 | render_window->setVisible(true); | ||
| 427 | render_window->setFocusPolicy(Qt::ClickFocus); | 457 | render_window->setFocusPolicy(Qt::ClickFocus); |
| 428 | render_window->setFocus(); | 458 | if (emulation_running) { |
| 459 | render_window->setVisible(true); | ||
| 460 | render_window->setFocus(); | ||
| 461 | } | ||
| 429 | 462 | ||
| 430 | } else { | 463 | } else { |
| 431 | // Render in a separate window... | 464 | // Render in a separate window... |
| 432 | ui.horizontalLayout->removeWidget(render_window); | 465 | ui.horizontalLayout->removeWidget(render_window); |
| 433 | render_window->setParent(nullptr); | 466 | render_window->setParent(nullptr); |
| 434 | render_window->setVisible(true); | ||
| 435 | render_window->RestoreGeometry(); | ||
| 436 | render_window->setFocusPolicy(Qt::NoFocus); | 467 | render_window->setFocusPolicy(Qt::NoFocus); |
| 468 | if (emulation_running) { | ||
| 469 | render_window->setVisible(true); | ||
| 470 | render_window->RestoreGeometry(); | ||
| 471 | game_list->show(); | ||
| 472 | } | ||
| 437 | } | 473 | } |
| 438 | } | 474 | } |
| 439 | 475 | ||
| @@ -456,6 +492,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { | |||
| 456 | settings.setValue("singleWindowMode", ui.action_Single_Window_Mode->isChecked()); | 492 | settings.setValue("singleWindowMode", ui.action_Single_Window_Mode->isChecked()); |
| 457 | settings.setValue("displayTitleBars", ui.actionDisplay_widget_title_bars->isChecked()); | 493 | settings.setValue("displayTitleBars", ui.actionDisplay_widget_title_bars->isChecked()); |
| 458 | settings.setValue("firstStart", false); | 494 | settings.setValue("firstStart", false); |
| 495 | game_list->SaveInterfaceLayout(settings); | ||
| 459 | SaveHotkeys(settings); | 496 | SaveHotkeys(settings); |
| 460 | 497 | ||
| 461 | // Shutdown session if the emu thread is active... | 498 | // Shutdown session if the emu thread is active... |