Impl sceSystemServiceLoadExec (#3647)

* Add support for restarting the emulator with new configurations

- Implement `Restart` function in `Emulator` to enable process relaunch with updated parameters.
- Modify `sceSystemServiceLoadExec` to use the restart functionality.

* Add logging for emulator restart and system service load execution

* Add IPC emulator PID output command

Impl `PID` output command to return the emulator process ID
- required for launches supporting emulator restart

* Add log file append mode support (used after restarting to keep the same log file)

* Keep game root between restarts

* add --wait-for-debugger option flag

* add --wait-for-pid flag

used for sync between parent & child process during restart

* impl restart via ipc

* fix override game root

* add qt flags to allow restart
This commit is contained in:
Vinicius Rangel
2025-09-25 23:01:52 -03:00
committed by GitHub
parent a6f5e4c7dc
commit 71f343d2d6
16 changed files with 432 additions and 43 deletions

View File

@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "ipc.h"
@@ -12,6 +12,7 @@
#include "common/thread.h"
#include "common/types.h"
#include "core/debug_state.h"
#include "core/debugger.h"
#include "input/input_handler.h"
#include "sdl_window.h"
@@ -40,6 +41,7 @@
* Command list:
* - CAPABILITIES:
* - ENABLE_MEMORY_PATCH: enables PATCH_MEMORY command
* - ENABLE_EMU_CONTROL: enables PAUSE, RESUME, STOP, TOGGLE_FULLSCREEN commands
* - INPUT CMD:
* - RUN: start the emulator execution
* - START: start the game execution
@@ -53,7 +55,7 @@
* - STOP: stop and quit the emulator
* - TOGGLE_FULLSCREEN: enable / disable fullscreen
* - OUTPUT CMD:
* - N/A
* - RESTART(argn: number, argv: ...string): Request restart of the emulator, must call STOP
**/
void IPC::Init() {
@@ -81,6 +83,15 @@ void IPC::Init() {
}
}
void IPC::SendRestart(const std::vector<std::string>& args) {
std::cerr << ";RESTART\n";
std::cerr << ";" << args.size() << "\n";
for (const auto& arg : args) {
std::cerr << ";" << arg << "\n";
}
std::cerr.flush();
}
void IPC::InputLoop() {
auto next_str = [&] -> const std::string& {
static std::string line_buffer;