mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-15 03:08:36 +12:00
Qt: simplify Boot options a bit (#4158)
This commit is contained in:
parent
6141bc5598
commit
2444385763
4 changed files with 35 additions and 93 deletions
|
@ -492,17 +492,8 @@ void game_list_frame::doubleClickedSlot(const QModelIndex& index)
|
||||||
i = m_xgrid->item(index.row(), index.column())->data(Qt::ItemDataRole::UserRole).toInt();
|
i = m_xgrid->item(index.row(), index.column())->data(Qt::ItemDataRole::UserRole).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1)
|
LOG_NOTICE(LOADER, "Booting from gamelist per doubleclick...");
|
||||||
{
|
Q_EMIT RequestBoot(m_game_data[i].info.path);
|
||||||
if (Boot(m_game_data[i].info))
|
|
||||||
{
|
|
||||||
LOG_SUCCESS(LOADER, "Boot from gamelist per doubleclick: done");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
open_dir(m_game_data[i].info.path);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void game_list_frame::ShowContextMenu(const QPoint &pos)
|
void game_list_frame::ShowContextMenu(const QPoint &pos)
|
||||||
|
@ -570,10 +561,8 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
|
||||||
|
|
||||||
connect(boot, &QAction::triggered, [=]
|
connect(boot, &QAction::triggered, [=]
|
||||||
{
|
{
|
||||||
if (Boot(currGame))
|
LOG_NOTICE(LOADER, "Booting from gamelist per context menu...");
|
||||||
{
|
Q_EMIT RequestBoot(currGame.path);
|
||||||
LOG_SUCCESS(LOADER, "Boot from gamelist per Boot: done");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
connect(configure, &QAction::triggered, [=]
|
connect(configure, &QAction::triggered, [=]
|
||||||
{
|
{
|
||||||
|
@ -671,27 +660,6 @@ void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
|
||||||
myMenu.exec(globalPos);
|
myMenu.exec(globalPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool game_list_frame::Boot(const GameInfo& game)
|
|
||||||
{
|
|
||||||
Q_EMIT RequestIconPathSet(game.path);
|
|
||||||
|
|
||||||
Emu.SetForceBoot(true);
|
|
||||||
Emu.Stop();
|
|
||||||
|
|
||||||
if (!Emu.BootGame(game.path))
|
|
||||||
{
|
|
||||||
QMessageBox::warning(this, tr("Warning!"), tr("Failed to boot ") + qstr(game.path));
|
|
||||||
LOG_ERROR(LOADER, "Failed to boot %s", game.path);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Q_EMIT RequestAddRecentGame(gui::Recent_Game(qstr(Emu.GetBoot()), qstr("[" + game.serial + "] " + game.name)));
|
|
||||||
Refresh(true);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void game_list_frame::RemoveCustomConfiguration(int row)
|
void game_list_frame::RemoveCustomConfiguration(int row)
|
||||||
{
|
{
|
||||||
const std::string config_path = fs::get_config_dir() + "data/" + m_game_data[row].info.serial + "/config.yml";
|
const std::string config_path = fs::get_config_dir() + "data/" + m_game_data[row].info.serial + "/config.yml";
|
||||||
|
|
|
@ -209,8 +209,7 @@ private Q_SLOTS:
|
||||||
void doubleClickedSlot(const QModelIndex& index);
|
void doubleClickedSlot(const QModelIndex& index);
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void GameListFrameClosed();
|
void GameListFrameClosed();
|
||||||
void RequestIconPathSet(const std::string& path);
|
void RequestBoot(const std::string& path);
|
||||||
void RequestAddRecentGame(const q_string_pair& entry);
|
|
||||||
void RequestIconSizeChange(const int& val);
|
void RequestIconSizeChange(const int& val);
|
||||||
protected:
|
protected:
|
||||||
/** Override inherited method from Qt to allow signalling when close happened.*/
|
/** Override inherited method from Qt to allow signalling when close happened.*/
|
||||||
|
@ -219,7 +218,6 @@ protected:
|
||||||
bool eventFilter(QObject *object, QEvent *event) override;
|
bool eventFilter(QObject *object, QEvent *event) override;
|
||||||
private:
|
private:
|
||||||
QPixmap PaintedPixmap(const QImage& img, bool paintConfigIcon = false);
|
QPixmap PaintedPixmap(const QImage& img, bool paintConfigIcon = false);
|
||||||
bool Boot(const GameInfo& info);
|
|
||||||
void PopulateGameGrid(int maxCols, const QSize& image_size, const QColor& image_color);
|
void PopulateGameGrid(int maxCols, const QSize& image_size, const QColor& image_color);
|
||||||
void FilterData();
|
void FilterData();
|
||||||
void SortGameList();
|
void SortGameList();
|
||||||
|
|
|
@ -227,6 +227,25 @@ void main_window::SetAppIconFromPath(const std::string& path)
|
||||||
m_appIcon = QApplication::windowIcon();
|
m_appIcon = QApplication::windowIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void main_window::Boot(const std::string& path, bool direct, bool add_only, bool force_boot)
|
||||||
|
{
|
||||||
|
SetAppIconFromPath(path);
|
||||||
|
Emu.SetForceBoot(force_boot);
|
||||||
|
|
||||||
|
if (Emu.BootGame(path, add_only))
|
||||||
|
{
|
||||||
|
LOG_SUCCESS(LOADER, "Boot successful.");
|
||||||
|
const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] ";
|
||||||
|
AddRecentAction(gui::Recent_Game(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle())));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_ERROR(GENERAL, "Boot failed: path=%s direct=%d add_only=%d force_boot=%d", path, direct, add_only, force_boot);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_gameListFrame->Refresh(true);
|
||||||
|
}
|
||||||
|
|
||||||
void main_window::BootElf()
|
void main_window::BootElf()
|
||||||
{
|
{
|
||||||
bool stopped = false;
|
bool stopped = false;
|
||||||
|
@ -253,30 +272,14 @@ void main_window::BootElf()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_NOTICE(LOADER, "(S)ELF: booting...");
|
|
||||||
|
|
||||||
// If we resolved the filepath earlier we would end up setting the last opened dir to the unwanted
|
// If we resolved the filepath earlier we would end up setting the last opened dir to the unwanted
|
||||||
// game folder in case of having e.g. a Game Folder with collected links to elf files.
|
// game folder in case of having e.g. a Game Folder with collected links to elf files.
|
||||||
// Don't set last path earlier in case of cancelled dialog
|
// Don't set last path earlier in case of cancelled dialog
|
||||||
guiSettings->SetValue(gui::fd_boot_elf, filePath);
|
guiSettings->SetValue(gui::fd_boot_elf, filePath);
|
||||||
const std::string path = sstr(QFileInfo(filePath).canonicalFilePath());
|
const std::string path = sstr(QFileInfo(filePath).canonicalFilePath());
|
||||||
|
|
||||||
SetAppIconFromPath(path);
|
LOG_NOTICE(LOADER, "Booting from BootElf...");
|
||||||
Emu.SetForceBoot(true);
|
Boot(path, true);
|
||||||
Emu.Stop();
|
|
||||||
|
|
||||||
if (!Emu.BootGame(path, true))
|
|
||||||
{
|
|
||||||
LOG_ERROR(GENERAL, "PS3 executable not found at path (%s)", path);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_SUCCESS(LOADER, "(S)ELF: boot done.");
|
|
||||||
|
|
||||||
const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] ";
|
|
||||||
AddRecentAction(gui::Recent_Game(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle())));
|
|
||||||
m_gameListFrame->Refresh(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window::BootGame()
|
void main_window::BootGame()
|
||||||
|
@ -298,24 +301,11 @@ void main_window::BootGame()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emu.SetForceBoot(true);
|
|
||||||
Emu.Stop();
|
|
||||||
guiSettings->SetValue(gui::fd_boot_game, QFileInfo(dirPath).path());
|
guiSettings->SetValue(gui::fd_boot_game, QFileInfo(dirPath).path());
|
||||||
const std::string path = sstr(dirPath);
|
const std::string path = sstr(dirPath);
|
||||||
SetAppIconFromPath(path);
|
|
||||||
|
|
||||||
if (!Emu.BootGame(path))
|
LOG_NOTICE(LOADER, "Booting from BootGame...");
|
||||||
{
|
Boot(path);
|
||||||
LOG_ERROR(GENERAL, "PS3 executable not found in selected folder (%s)", path);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_SUCCESS(LOADER, "Boot Game: boot done.");
|
|
||||||
|
|
||||||
const std::string serial = Emu.GetTitleID().empty() ? "" : "[" + Emu.GetTitleID() + "] ";
|
|
||||||
AddRecentAction(gui::Recent_Game(qstr(Emu.GetBoot()), qstr(serial + Emu.GetTitle())));
|
|
||||||
m_gameListFrame->Refresh(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window::InstallPkg(const QString& dropPath)
|
void main_window::InstallPkg(const QString& dropPath)
|
||||||
|
@ -813,6 +803,7 @@ void main_window::BootRecentAction(const QAction* act)
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString pth = act->data().toString();
|
const QString pth = act->data().toString();
|
||||||
|
const std::string path = sstr(pth);
|
||||||
QString nam;
|
QString nam;
|
||||||
bool containsPath = false;
|
bool containsPath = false;
|
||||||
|
|
||||||
|
@ -844,7 +835,7 @@ void main_window::BootRecentAction(const QAction* act)
|
||||||
|
|
||||||
guiSettings->SetValue(gui::rg_entries, guiSettings->List2Var(m_rg_entries));
|
guiSettings->SetValue(gui::rg_entries, guiSettings->List2Var(m_rg_entries));
|
||||||
|
|
||||||
LOG_ERROR(GENERAL, "Recent Game not valid, removed from Boot Recent list: %s", sstr(pth));
|
LOG_ERROR(GENERAL, "Recent Game not valid, removed from Boot Recent list: %s", path);
|
||||||
|
|
||||||
// refill menu with actions
|
// refill menu with actions
|
||||||
for (int i = 0; i < m_recentGameActs.count(); i++)
|
for (int i = 0; i < m_recentGameActs.count(); i++)
|
||||||
|
@ -855,30 +846,15 @@ void main_window::BootRecentAction(const QAction* act)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_WARNING(GENERAL, "Boot Recent list refreshed");
|
LOG_WARNING(GENERAL, "Boot Recent list refreshed");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ERROR(GENERAL, "Path invalid and not in m_rg_paths: %s", sstr(pth));
|
LOG_ERROR(GENERAL, "Path invalid and not in m_rg_paths: %s", path);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetAppIconFromPath(sstr(pth));
|
LOG_NOTICE(LOADER, "Booting from recent games list...");
|
||||||
|
Boot(path, true);
|
||||||
Emu.SetForceBoot(true);
|
|
||||||
Emu.Stop();
|
|
||||||
|
|
||||||
if (!Emu.BootGame(sstr(pth), true))
|
|
||||||
{
|
|
||||||
LOG_ERROR(LOADER, "Failed to boot %s", sstr(pth));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LOG_SUCCESS(LOADER, "Boot from Recent List: done");
|
|
||||||
AddRecentAction(gui::Recent_Game(qstr(Emu.GetBoot()), nam));
|
|
||||||
m_gameListFrame->Refresh(true);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QAction* main_window::CreateRecentAction(const q_string_pair& entry, const uint& sc_idx)
|
QAction* main_window::CreateRecentAction(const q_string_pair& entry, const uint& sc_idx)
|
||||||
|
@ -1370,8 +1346,7 @@ void main_window::CreateDockWindows()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_gameListFrame, &game_list_frame::RequestIconPathSet, this, &main_window::SetAppIconFromPath);
|
connect(m_gameListFrame, &game_list_frame::RequestBoot, [this](const std::string& path){ Boot(path); });
|
||||||
connect(m_gameListFrame, &game_list_frame::RequestAddRecentGame, this, &main_window::AddRecentAction);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window::ConfigureGuiFromSettings(bool configure_all)
|
void main_window::ConfigureGuiFromSettings(bool configure_all)
|
||||||
|
|
|
@ -85,6 +85,7 @@ public Q_SLOTS:
|
||||||
void RepaintGui();
|
void RepaintGui();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
void Boot(const std::string& path, bool direct = false, bool add_only = false, bool force_boot = true);
|
||||||
void BootElf();
|
void BootElf();
|
||||||
void BootGame();
|
void BootGame();
|
||||||
void DecryptSPRXLibraries();
|
void DecryptSPRXLibraries();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue