mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 08:22:32 +00:00
Test 2
This commit is contained in:
parent
7d807dc5d4
commit
09bebefcee
@ -295,6 +295,7 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector<std::str
|
||||
std::quick_exit(0);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_QT_GUI
|
||||
void Emulator::saveLastEbootPath(const QString& path) {
|
||||
lastEbootPath = path;
|
||||
}
|
||||
@ -336,7 +337,7 @@ void Emulator::Restart() {
|
||||
LOG_ERROR(Loader, "No previous EBOOT path found! Cannot restart.");
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
// Relaunch emulator with last game
|
||||
#ifdef Q_OS_WIN
|
||||
QString emulatorPath =
|
||||
|
@ -39,9 +39,12 @@ public:
|
||||
private:
|
||||
void LoadSystemModules(const std::string& game_serial);
|
||||
Common::ElfInfo game_info;
|
||||
|
||||
#ifdef ENABLE_QT_GUI
|
||||
QString lastEbootPath;
|
||||
void saveLastEbootPath(const QString& path);
|
||||
QString getLastEbootPath();
|
||||
#endif
|
||||
bool isRunning = false;
|
||||
Core::MemoryManager* memory;
|
||||
Input::GameController* controller;
|
||||
|
@ -766,10 +766,12 @@ void MainWindow::BootGame() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef ENABLE_QT_GUI
|
||||
|
||||
QString MainWindow::getLastEbootPath() {
|
||||
return QString();
|
||||
}
|
||||
#endif
|
||||
|
||||
void MainWindow::InstallDragDropPkg(std::filesystem::path file, int pkgNum, int nPkg) {
|
||||
if (Loader::DetectFileType(file) == Loader::FileTypes::Pkg) {
|
||||
@ -1240,7 +1242,10 @@ void MainWindow::StartEmulator(std::filesystem::path path) {
|
||||
QMessageBox::critical(nullptr, tr("Run Game"), QString(tr("Game is already running!")));
|
||||
return;
|
||||
}
|
||||
|
||||
lastGamePath = path; // Store the last played game
|
||||
isGameRunning = true;
|
||||
|
||||
#ifdef __APPLE__
|
||||
// SDL on macOS requires main thread.
|
||||
Core::Emulator emulator;
|
||||
@ -1254,6 +1259,8 @@ void MainWindow::StartEmulator(std::filesystem::path path) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ENABLE_QT_GUI
|
||||
|
||||
void MainWindow::StopGame() {
|
||||
if (!isGameRunning) {
|
||||
QMessageBox::information(this, tr("Stop Game"), tr("No game is currently running."));
|
||||
@ -1278,20 +1285,21 @@ void MainWindow::RestartGame() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::string> recentFiles = Config::getRecentFiles();
|
||||
if (recentFiles.empty()) {
|
||||
if (lastGamePath.empty()) {
|
||||
QMessageBox::warning(this, tr("Restart Game"), tr("No recent game found."));
|
||||
return;
|
||||
}
|
||||
|
||||
QString lastGamePath = QString::fromStdString(recentFiles.front());
|
||||
|
||||
// Stop the current game first
|
||||
// Stop the current game properly
|
||||
StopGame();
|
||||
|
||||
// Wait for cleanup
|
||||
QThread::sleep(1);
|
||||
// Ensure the game has fully stopped before restarting
|
||||
while (isGameRunning) {
|
||||
QCoreApplication::processEvents();
|
||||
QThread::msleep(100); // Small delay to allow cleanup
|
||||
}
|
||||
|
||||
// Restart the game
|
||||
StartEmulator(Common::FS::PathFromQString(lastGamePath));
|
||||
// Restart the emulator with the last played game
|
||||
StartEmulator(lastGamePath);
|
||||
}
|
||||
#endif
|
||||
|
@ -67,7 +67,10 @@ private:
|
||||
void SetUiIcons(bool isWhite);
|
||||
void InstallPkg();
|
||||
void BootGame();
|
||||
#ifdef ENABLE_QT_GUI
|
||||
QString getLastEbootPath();
|
||||
std::filesystem::path lastGamePath;
|
||||
#endif
|
||||
void AddRecentFiles(QString filePath);
|
||||
void LoadTranslation();
|
||||
void PlayBackgroundMusic();
|
||||
|
Loading…
Reference in New Issue
Block a user