From bbc6337263b6c2b09a88f72c14192d37be3e5b4e Mon Sep 17 00:00:00 2001 From: TotalCaesar659 <14265316+TotalCaesar659@users.noreply.github.com> Date: Sat, 18 Apr 2020 21:08:20 +0300 Subject: [PATCH] Add "Switch UMD" menu point to Linux version --- Qt/mainwindow.cpp | 16 +++++++++++++++- Qt/mainwindow.h | 1 + Windows/MainWindowMenu.cpp | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index e40a912e24..35a4b2e278 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -11,6 +11,7 @@ #include "base/NativeApp.h" #include "Core/MIPS/MIPSDebugInterface.h" #include "Core/Debugger/SymbolMap.h" +#include "Core/HLE/sceUmd.h" #include "Core/SaveState.h" #include "Core/System.h" #include "GPU/GPUInterface.h" @@ -141,7 +142,7 @@ void MainWindow::closeAct() void MainWindow::openmsAct() { QString confighome = getenv("XDG_CONFIG_HOME"); - QString memorystick = confighome + "/ppsspp/PSP"; + QString memorystick = confighome + "/ppsspp"; QDesktopServices::openUrl(QUrl(memorystick)); } @@ -249,6 +250,17 @@ void MainWindow::resetAct() NativeMessageReceived("reset", ""); } +void MainWindow::switchUMDAct() +{ + QString filename = QFileDialog::getOpenFileName(NULL, "Switch UMD", g_Config.currentDirectory.c_str(), "PSP ROMs (*.pbp *.elf *.iso *.cso *.prx)"); + if (QFile::exists(filename)) + { + QFileInfo info(filename); + g_Config.currentDirectory = info.absolutePath().toStdString(); + __UmdReplace(filename.toStdString().c_str()); + } +} + void MainWindow::breakonloadAct() { g_Config.bAutoRun = !g_Config.bAutoRun; @@ -534,6 +546,8 @@ void MainWindow::createMenus() ->addEnableState(UISTATE_INGAME); emuMenu->add(new MenuAction(this, SLOT(resetAct()), QT_TR_NOOP("R&eset"), Qt::CTRL + Qt::Key_B)) ->addEnableState(UISTATE_INGAME); + emuMenu->add(new MenuAction(this, SLOT(switchUMDAct()), QT_TR_NOOP("Switch UMD"), Qt::CTRL + Qt::Key_U)) + ->addEnableState(UISTATE_INGAME); MenuTree* displayRotationMenu = new MenuTree(this, emuMenu, QT_TR_NOOP("Display rotation")); displayRotationGroup = new MenuActionGroup(this, displayRotationMenu, SLOT(displayRotationGroup_triggered(QAction *)), QStringList() << "Landscape" << "Portrait" << "Landscape reversed" << "Portrait reversed", diff --git a/Qt/mainwindow.h b/Qt/mainwindow.h index 2c5fa4836c..150fc53471 100644 --- a/Qt/mainwindow.h +++ b/Qt/mainwindow.h @@ -95,6 +95,7 @@ private slots: void pauseAct(); void stopAct(); void resetAct(); + void switchUMDAct(); void displayRotationGroup_triggered(QAction *action) { g_Config.iInternalScreenRotation = action->data().toInt(); } // Debug diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 3b5e7e6c35..6fdaeb742b 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -438,7 +438,7 @@ namespace MainWindow { filter[i] = '\0'; } - if (W32Util::BrowseForFileName(true, GetHWND(), L"Switch Umd", 0, ConvertUTF8ToWString(filter).c_str(), L"*.pbp;*.elf;*.iso;*.cso;", fn)) { + if (W32Util::BrowseForFileName(true, GetHWND(), L"Switch UMD", 0, ConvertUTF8ToWString(filter).c_str(), L"*.pbp;*.elf;*.iso;*.cso;", fn)) { fn = ReplaceAll(fn, "\\", "/"); __UmdReplace(fn); }