mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 05:05:56 +00:00
Rebuild the game at start when an enabled mod has unbuilt code cheats
Code cheats need the game lifted and compiled with them. Running the setup again did that, but it lifted and compiled everything and prepared the shaders again. - The setup keeps the generated C and the objects in its temp folder (about 1.3 GB). gen.py rewrites only the chunks whose C changed, so Ninja recompiles only those. One new code cheat on 1.4.3 took a 47 s lift and 19 s of compile and link on 24 cores. - Prepare's key no longer follows the compile key, only the runtime, the translator and the game version, so a rebuild keeps the prepared shaders. - The cleanup writes build-cache/rebuild.txt, the command that opens the setup window in a new --rebuild mode on the install folder. That mode runs at once and starts the game again when it succeeds. - At start, runtime/cheats.c runs that command and exits when an enabled mod has code cheats the build lacks (plat_spawn, new for Windows and Linux). build-cache/rebuild.skip keeps a failed or cancelled rebuild from starting again for the same cheats. "Rebuild the game now" on the Cheats tab tries again, and [mods] mods_rebuild = off turns the rebuild off. Scripted runs never start it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3dd7f846b8
commit
1bebcfd9ef
21 files changed
+337
-48
No files matched your search
@@ -1711,6 +1711,26 @@ int plat_restart(void) {
|
||||
return e == 0;
|
||||
}
|
||||
|
||||
int plat_spawn(const char *const *argv, const char *cwd) {
|
||||
posix_spawn_file_actions_t fa;
|
||||
posix_spawn_file_actions_init(&fa);
|
||||
posix_spawn_file_actions_addclosefrom_np(&fa, 3);
|
||||
posix_spawn_file_actions_addchdir_np(&fa, cwd);
|
||||
posix_spawnattr_t at;
|
||||
posix_spawnattr_init(&at);
|
||||
sigset_t none, all;
|
||||
sigemptyset(&none);
|
||||
sigfillset(&all);
|
||||
posix_spawnattr_setsigmask(&at, &none);
|
||||
posix_spawnattr_setsigdefault(&at, &all);
|
||||
posix_spawnattr_setflags(&at, POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSID);
|
||||
pid_t pid;
|
||||
int e = posix_spawn(&pid, argv[0], &fa, &at, (char *const *)argv, environ);
|
||||
posix_spawnattr_destroy(&at);
|
||||
posix_spawn_file_actions_destroy(&fa);
|
||||
return e == 0;
|
||||
}
|
||||
|
||||
int plat_restart_wait(uint32_t timeout_ms) {
|
||||
const char *v = getenv(RESTART_WAIT);
|
||||
if (!v) return 0;
|
||||
|
||||
Reference in new issue
Block a user