--no-sanity-timer option and its use in twn gdb

This commit is contained in:
veclavtalica 2025-02-15 15:09:01 +03:00
parent ffc3badc50
commit 29d163216c
3 changed files with 10 additions and 3 deletions

View File

@ -15,7 +15,7 @@ case "$1" in
;;
gdb ) unset DEBUGINFOD_URLS
$0 build && gdb --se=libgame.so -ex run --args "$(basename $PWD)" "${@:2}"
$0 build && gdb --se=libgame.so -ex run --args "$(basename $PWD)" --no-sanity-timer "${@:2}"
;;
init ) cp -r "$TWNROOT/apps/templates/$2" "$3"

View File

@ -85,6 +85,7 @@ typedef struct EngineContext {
bool audio_initialized;
bool push_audio_model;
bool cull_faces;
bool no_sanity_timer;
} EngineContext;
/* TODO: does it need to be marked with TWN_API? */

View File

@ -193,9 +193,9 @@ static void main_loop(void) {
input_state_update(&ctx.input);
profile_start("game tick");
start_sanity_timer(2000);
if (!ctx.no_sanity_timer) start_sanity_timer(2000);
game_object_tick();
end_sanity_timer();
if (!ctx.no_sanity_timer) end_sanity_timer();
profile_end("game tick");
input_state_update_postframe(&ctx.input);
@ -813,6 +813,12 @@ int enter_loop(int argc, char **argv) {
force_release = true;
continue;
}
/* do not use sanity timer, useful with attached debugger */
if (SDL_strncmp(argv[i], "--no-sanity-timer", sizeof "--no-sanity-timer" - 1) == 0) {
ctx.no_sanity_timer = true;
continue;
}
}
/* data path not explicitly specified, look into convention defined places */