summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/main.cpp30
-rw-r--r--src/citra_qt/main.h12
2 files changed, 19 insertions, 23 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 3c1ae8848..717552468 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -75,7 +75,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
75 75
76 QStringList args = QApplication::arguments(); 76 QStringList args = QApplication::arguments();
77 if (args.length() >= 2) { 77 if (args.length() >= 2) {
78 BootGame(args[1].toStdString()); 78 BootGame(args[1]);
79 } 79 }
80} 80}
81 81
@@ -272,7 +272,7 @@ void GMainWindow::OnDisplayTitleBars(bool show) {
272 } 272 }
273} 273}
274 274
275bool GMainWindow::LoadROM(const std::string& filename) { 275bool GMainWindow::LoadROM(const QString& filename) {
276 // Shutdown previous session if the emu thread is still active... 276 // Shutdown previous session if the emu thread is still active...
277 if (emu_thread != nullptr) 277 if (emu_thread != nullptr)
278 ShutdownGame(); 278 ShutdownGame();
@@ -290,12 +290,13 @@ bool GMainWindow::LoadROM(const std::string& filename) {
290 290
291 Core::System& system{Core::System::GetInstance()}; 291 Core::System& system{Core::System::GetInstance()};
292 292
293 const Core::System::ResultStatus result{system.Load(render_window, filename)}; 293 const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())};
294 294
295 if (result != Core::System::ResultStatus::Success) { 295 if (result != Core::System::ResultStatus::Success) {
296 switch (result) { 296 switch (result) {
297 case Core::System::ResultStatus::ErrorGetLoader: 297 case Core::System::ResultStatus::ErrorGetLoader:
298 LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filename.c_str()); 298 LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!",
299 filename.toStdString().c_str());
299 QMessageBox::critical(this, tr("Error while loading ROM!"), 300 QMessageBox::critical(this, tr("Error while loading ROM!"),
300 tr("The ROM format is not supported.")); 301 tr("The ROM format is not supported."));
301 break; 302 break;
@@ -335,7 +336,7 @@ bool GMainWindow::LoadROM(const std::string& filename) {
335 return true; 336 return true;
336} 337}
337 338
338void GMainWindow::BootGame(const std::string& filename) { 339void GMainWindow::BootGame(const QString& filename) {
339 LOG_INFO(Frontend, "Citra starting..."); 340 LOG_INFO(Frontend, "Citra starting...");
340 StoreRecentFile(filename); // Put the filename on top of the list 341 StoreRecentFile(filename); // Put the filename on top of the list
341 342
@@ -411,8 +412,8 @@ void GMainWindow::ShutdownGame() {
411 emulation_running = false; 412 emulation_running = false;
412} 413}
413 414
414void GMainWindow::StoreRecentFile(const std::string& filename) { 415void GMainWindow::StoreRecentFile(const QString& filename) {
415 UISettings::values.recent_files.prepend(QString::fromStdString(filename)); 416 UISettings::values.recent_files.prepend(filename);
416 UISettings::values.recent_files.removeDuplicates(); 417 UISettings::values.recent_files.removeDuplicates();
417 while (UISettings::values.recent_files.size() > max_recent_files_item) { 418 while (UISettings::values.recent_files.size() > max_recent_files_item) {
418 UISettings::values.recent_files.removeLast(); 419 UISettings::values.recent_files.removeLast();
@@ -447,7 +448,7 @@ void GMainWindow::UpdateRecentFiles() {
447} 448}
448 449
449void GMainWindow::OnGameListLoadFile(QString game_path) { 450void GMainWindow::OnGameListLoadFile(QString game_path) {
450 BootGame(game_path.toStdString()); 451 BootGame(game_path);
451} 452}
452 453
453void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) { 454void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) {
@@ -470,20 +471,21 @@ void GMainWindow::OnMenuLoadFile() {
470 for (const auto& piece : game_list->supported_file_extensions) 471 for (const auto& piece : game_list->supported_file_extensions)
471 extensions += "*." + piece + " "; 472 extensions += "*." + piece + " ";
472 473
473 QString file_filter = tr("3DS executable") + " (" + extensions + ")"; 474 QString file_filter = tr("3DS Executable") + " (" + extensions + ")";
475 file_filter += ";;" + tr("All Files (*.*)");
474 476
475 QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), 477 QString filename = QFileDialog::getOpenFileName(this, tr("Load File"),
476 UISettings::values.roms_path, file_filter); 478 UISettings::values.roms_path, file_filter);
477 if (!filename.isEmpty()) { 479 if (!filename.isEmpty()) {
478 UISettings::values.roms_path = QFileInfo(filename).path(); 480 UISettings::values.roms_path = QFileInfo(filename).path();
479 481
480 BootGame(filename.toStdString()); 482 BootGame(filename);
481 } 483 }
482} 484}
483 485
484void GMainWindow::OnMenuLoadSymbolMap() { 486void GMainWindow::OnMenuLoadSymbolMap() {
485 QString filename = QFileDialog::getOpenFileName( 487 QString filename = QFileDialog::getOpenFileName(
486 this, tr("Load Symbol Map"), UISettings::values.symbols_path, tr("Symbol map (*)")); 488 this, tr("Load Symbol Map"), UISettings::values.symbols_path, tr("Symbol Map (*.*)"));
487 if (!filename.isEmpty()) { 489 if (!filename.isEmpty()) {
488 UISettings::values.symbols_path = QFileInfo(filename).path(); 490 UISettings::values.symbols_path = QFileInfo(filename).path();
489 491
@@ -506,7 +508,7 @@ void GMainWindow::OnMenuRecentFile() {
506 QString filename = action->data().toString(); 508 QString filename = action->data().toString();
507 QFileInfo file_info(filename); 509 QFileInfo file_info(filename);
508 if (file_info.exists()) { 510 if (file_info.exists()) {
509 BootGame(filename.toStdString()); 511 BootGame(filename);
510 } else { 512 } else {
511 // Display an error message and remove the file from the list. 513 // Display an error message and remove the file from the list.
512 QMessageBox::information(this, tr("File not found"), 514 QMessageBox::information(this, tr("File not found"),
@@ -625,7 +627,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
625 QWidget::closeEvent(event); 627 QWidget::closeEvent(event);
626} 628}
627 629
628bool IsSingleFileDropEvent(QDropEvent* event) { 630static bool IsSingleFileDropEvent(QDropEvent* event) {
629 const QMimeData* mimeData = event->mimeData(); 631 const QMimeData* mimeData = event->mimeData();
630 return mimeData->hasUrls() && mimeData->urls().length() == 1; 632 return mimeData->hasUrls() && mimeData->urls().length() == 1;
631} 633}
@@ -634,7 +636,7 @@ void GMainWindow::dropEvent(QDropEvent* event) {
634 if (IsSingleFileDropEvent(event) && ConfirmChangeGame()) { 636 if (IsSingleFileDropEvent(event) && ConfirmChangeGame()) {
635 const QMimeData* mimeData = event->mimeData(); 637 const QMimeData* mimeData = event->mimeData();
636 QString filename = mimeData->urls().at(0).toLocalFile(); 638 QString filename = mimeData->urls().at(0).toLocalFile();
637 BootGame(filename.toStdString()); 639 BootGame(filename);
638 } 640 }
639} 641}
640 642
diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h
index 102fd151d..debc35c92 100644
--- a/src/citra_qt/main.h
+++ b/src/citra_qt/main.h
@@ -73,14 +73,8 @@ private:
73 73
74 void ConnectWidgetEvents(); 74 void ConnectWidgetEvents();
75 75
76 /** 76 bool LoadROM(const QString& filename);
77 * Initializes the emulation system. 77 void BootGame(const QString& filename);
78 * @param system_mode The system mode with which to intialize the kernel.
79 * @returns Whether the system was properly initialized.
80 */
81 bool InitializeSystem(u32 system_mode);
82 bool LoadROM(const std::string& filename);
83 void BootGame(const std::string& filename);
84 void ShutdownGame(); 78 void ShutdownGame();
85 79
86 /** 80 /**
@@ -94,7 +88,7 @@ private:
94 * 88 *
95 * @param filename the filename to store 89 * @param filename the filename to store
96 */ 90 */
97 void StoreRecentFile(const std::string& filename); 91 void StoreRecentFile(const QString& filename);
98 92
99 /** 93 /**
100 * Updates the recent files menu. 94 * Updates the recent files menu.