diff --git a/bin/twn b/bin/twn index 14a76e8..49dfaf7 100755 --- a/bin/twn +++ b/bin/twn @@ -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" diff --git a/src/twn_engine_context_c.h b/src/twn_engine_context_c.h index 1d27fb7..41358fe 100644 --- a/src/twn_engine_context_c.h +++ b/src/twn_engine_context_c.h @@ -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? */ diff --git a/src/twn_loop.c b/src/twn_loop.c index 9465bd8..238aa8f 100644 --- a/src/twn_loop.c +++ b/src/twn_loop.c @@ -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 */