mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-21 12:04:45 +00:00
gui: add option to boot a game by choosing elf file
This commit is contained in:
parent
a0fb47b0ab
commit
318857c19f
3 changed files with 28 additions and 0 deletions
|
@ -328,6 +328,7 @@ void MainWindow::CreateConnects() {
|
|||
|
||||
// Package install.
|
||||
connect(ui->bootInstallPkgAct, &QAction::triggered, this, &MainWindow::InstallPkg);
|
||||
connect(ui->bootGameAct, &QAction::triggered, this, &MainWindow::BootGame);
|
||||
connect(ui->gameInstallPathAct, &QAction::triggered, this, &MainWindow::InstallDirectory);
|
||||
|
||||
// elf viewer
|
||||
|
@ -484,6 +485,27 @@ void MainWindow::InstallPkg() {
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::BootGame() {
|
||||
QFileDialog dialog;
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
dialog.setNameFilter(tr("ELF files (*.bin *.elf *.oelf)"));
|
||||
if (dialog.exec()) {
|
||||
QStringList fileNames = dialog.selectedFiles();
|
||||
int nFiles = fileNames.size();
|
||||
|
||||
if (nFiles > 1) {
|
||||
QMessageBox::critical(nullptr, "Game Boot", QString("Only one file can be selected!"));
|
||||
} else {
|
||||
std::filesystem::path path(fileNames[0].toStdString());
|
||||
#ifdef _WIN64
|
||||
path = std::filesystem::path(fileNames[0].toStdWString());
|
||||
#endif
|
||||
Core::Emulator emulator;
|
||||
emulator.Run(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int nPkg) {
|
||||
if (Loader::DetectFileType(file) == Loader::FileTypes::Pkg) {
|
||||
pkg = PKG();
|
||||
|
|
|
@ -61,6 +61,7 @@ private:
|
|||
void SetLastIconSizeBullet();
|
||||
void SetUiIcons(bool isWhite);
|
||||
void InstallPkg();
|
||||
void BootGame();
|
||||
void AddRecentFiles(QString filePath);
|
||||
QIcon RecolorIcon(const QIcon& icon, bool isWhite);
|
||||
bool isIconBlack = false;
|
||||
|
|
|
@ -30,6 +30,7 @@ QT_BEGIN_NAMESPACE
|
|||
class Ui_MainWindow {
|
||||
public:
|
||||
QAction* bootInstallPkgAct;
|
||||
QAction* bootGameAct;
|
||||
QAction* addElfFolderAct;
|
||||
QAction* exitAct;
|
||||
QAction* showGameListAct;
|
||||
|
@ -92,6 +93,8 @@ public:
|
|||
bootInstallPkgAct = new QAction(MainWindow);
|
||||
bootInstallPkgAct->setObjectName("bootInstallPkgAct");
|
||||
bootInstallPkgAct->setIcon(QIcon(":images/file_icon.png"));
|
||||
bootGameAct = new QAction(MainWindow);
|
||||
bootGameAct->setObjectName("bootGameAct");
|
||||
addElfFolderAct = new QAction(MainWindow);
|
||||
addElfFolderAct->setObjectName("addElfFolderAct");
|
||||
exitAct = new QAction(MainWindow);
|
||||
|
@ -251,6 +254,7 @@ public:
|
|||
menuBar->addAction(menuView->menuAction());
|
||||
menuBar->addAction(menuSettings->menuAction());
|
||||
menuFile->addAction(bootInstallPkgAct);
|
||||
menuFile->addAction(bootGameAct);
|
||||
menuFile->addAction(addElfFolderAct);
|
||||
menuFile->addSeparator();
|
||||
menuFile->addAction(menuRecent->menuAction());
|
||||
|
@ -290,6 +294,7 @@ public:
|
|||
QCoreApplication::translate("MainWindow", "Open/Add Elf Folder", nullptr));
|
||||
bootInstallPkgAct->setText(
|
||||
QCoreApplication::translate("MainWindow", "Install Packages (PKG)", nullptr));
|
||||
bootGameAct->setText(QCoreApplication::translate("MainWindow", "Boot Game", nullptr));
|
||||
#if QT_CONFIG(tooltip)
|
||||
bootInstallPkgAct->setToolTip(QCoreApplication::translate(
|
||||
"MainWindow", "Install application from a .pkg file", nullptr));
|
||||
|
|
Loading…
Add table
Reference in a new issue