reinici real (execv) des del service menu

El Reiniciar fins ara recarregava recursos però no rellegia el preset
ni recreava la finestra (idioma/dificultat/preset es quedaven pendents
fins al pròxim arrencada manual). Ara Director rep argv al constructor
i, quan Section::name passa a RESET, fa execv del propi binari
(_execv a Windows). El procés es reemplaça → init complet amb tots
els canvis aplicats.

Refactor: extret shutdownSubsystems() de close() i compartit amb
relaunch(). Si execv falla els subsistemes ja s'han destruït, no
podem tornar al bucle: exit amb error.

A Emscripten s'amaga l'opció Reiniciar al service menu (execv no
existeix; el cheat code per teclat encara cau al reset clàssic com
fallback).
This commit is contained in:
2026-05-17 10:12:22 +02:00
parent 2c1673d2dd
commit 11eec8f222
4 changed files with 64 additions and 18 deletions
+9 -1
View File
@@ -564,13 +564,21 @@ void ServiceMenu::addSettingsOptions() {
}
void ServiceMenu::addSystemOptions() {
// Al navegador no podem reiniciar el procés (execv no existeix), així que amaguem
// l'opció en compte de mostrar un fals reset que no recarrega params/finestra.
#ifdef __EMSCRIPTEN__
constexpr bool RESET_HIDDEN = true;
#else
constexpr bool RESET_HIDDEN = false;
#endif
options_.push_back(std::make_unique<ActionOption>(
Lang::getText("[SERVICE_MENU] RESET"),
SettingsGroup::SYSTEM,
[this]() -> void {
Section::name = Section::Name::RESET;
toggle();
}));
},
RESET_HIDDEN));
options_.push_back(std::make_unique<ActionOption>(
Lang::getText("[SERVICE_MENU] QUIT"),