From 5331c5bf84eafc077ec77979726c48f968b3f0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 29 Apr 2023 11:47:37 +0200 Subject: [PATCH] Implement auto restart for Linux too. --- SDL/SDLMain.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index bb6fd39896..0a989aa419 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -192,6 +192,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string switch (type) { case SystemRequestType::RESTART_APP: g_RestartRequested = true; + // TODO: Also save param1 and then split it into an argv. return true; case SystemRequestType::EXIT_APP: // Do a clean exit @@ -1400,6 +1401,10 @@ int main(int argc, char *argv[]) { if (g_RestartRequested) { #if PPSSPP_PLATFORM(MAC) RestartMacApp(); +#elif PPSSPP_PLATFORM(LINUX) + // Hackery from https://unix.stackexchange.com/questions/207935/how-to-restart-or-reset-a-running-process-in-linux, + char *exec_argv[] = { argv[0], nullptr }; + execv("/proc/self/exe", exec_argv); #endif } return 0;