From ac4e82177d1fec6c8d8892066808e7e412a87810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9lestin=20Matte?= Date: Tue, 10 Feb 2026 09:48:42 +0100 Subject: [PATCH 1/2] Add movie.getInitialSystemTime() Also useful for bruteforcers --- docs/guides/lua.md | 7 +++++++ src/program/lua/Movie.cpp | 8 ++++++++ src/program/lua/Movie.h | 2 ++ 3 files changed, 17 insertions(+) diff --git a/docs/guides/lua.md b/docs/guides/lua.md index c46484b1..679e4a70 100644 --- a/docs/guides/lua.md +++ b/docs/guides/lua.md @@ -304,6 +304,13 @@ Returns 1 of the current frame is a draw frame, or 0 if not. Returns the full name of the movie file (.ltm). +#### movie.getInitialSystemTime + + (Number seconds, Number nseconds) movie.getInitialSystemTime() + +Returns the system time set at game startup. `seconds` is in whole seconds +and `nseconds` is the number of nanoseconds. + ### Runtime functions Runtime functions must be performed in callback `onFrame()` to be effective on diff --git a/src/program/lua/Movie.cpp b/src/program/lua/Movie.cpp index 6fa6252c..9ba1dbcc 100644 --- a/src/program/lua/Movie.cpp +++ b/src/program/lua/Movie.cpp @@ -39,6 +39,7 @@ static const luaL_Reg movie_functions[] = { "rerecords", Lua::Movie::rerecords}, { "isDraw", Lua::Movie::isDraw}, { "getMovieFileName", Lua::Movie::getMovieFileName}, + { "getInitialSystemTime", Lua::Movie::getInitialSystemTime}, { NULL, NULL } }; @@ -97,3 +98,10 @@ int Lua::Movie::getMovieFileName(lua_State *L) lua_pushstring(L, context->config.moviefile.c_str()); return 1; } + +int Lua::Movie::getInitialSystemTime(lua_State *L) +{ + lua_pushinteger(L, context->config.sc.initial_time_sec); + lua_pushinteger(L, context->config.sc.initial_time_nsec); + return 2; +} diff --git a/src/program/lua/Movie.h b/src/program/lua/Movie.h index ef0a5162..59da6bee 100644 --- a/src/program/lua/Movie.h +++ b/src/program/lua/Movie.h @@ -54,6 +54,8 @@ namespace Movie { /* Get filename of the movie file (.ltm) */ int getMovieFileName(lua_State *L); + /* Get system time set at game start */ + int getInitialSystemTime(lua_State *L); } } From b8b15e593b018cbe535c3dbe24c50cf59b9941c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9lestin=20Matte?= Date: Thu, 12 Feb 2026 00:20:40 +0100 Subject: [PATCH 2/2] Add Add movie.getInitialElapsedTime() --- docs/guides/lua.md | 7 +++++++ src/program/lua/Movie.cpp | 8 ++++++++ src/program/lua/Movie.h | 3 +++ 3 files changed, 18 insertions(+) diff --git a/docs/guides/lua.md b/docs/guides/lua.md index 679e4a70..8d365494 100644 --- a/docs/guides/lua.md +++ b/docs/guides/lua.md @@ -311,6 +311,13 @@ Returns the full name of the movie file (.ltm). Returns the system time set at game startup. `seconds` is in whole seconds and `nseconds` is the number of nanoseconds. +#### movie.getInitialElapsedTime + + (Number seconds, Number nseconds) movie.getInitialElapsedTime() + +Returns the elapsed time set at game startup. `seconds` is in whole seconds +and `nseconds` is the number of nanoseconds. + ### Runtime functions Runtime functions must be performed in callback `onFrame()` to be effective on diff --git a/src/program/lua/Movie.cpp b/src/program/lua/Movie.cpp index 9ba1dbcc..31aeba99 100644 --- a/src/program/lua/Movie.cpp +++ b/src/program/lua/Movie.cpp @@ -40,6 +40,7 @@ static const luaL_Reg movie_functions[] = { "isDraw", Lua::Movie::isDraw}, { "getMovieFileName", Lua::Movie::getMovieFileName}, { "getInitialSystemTime", Lua::Movie::getInitialSystemTime}, + { "getInitialElapsedTime", Lua::Movie::getInitialElapsedTime}, { NULL, NULL } }; @@ -105,3 +106,10 @@ int Lua::Movie::getInitialSystemTime(lua_State *L) lua_pushinteger(L, context->config.sc.initial_time_nsec); return 2; } + +int Lua::Movie::getInitialElapsedTime(lua_State *L) +{ + lua_pushinteger(L, context->config.sc.initial_monotonic_time_sec); + lua_pushinteger(L, context->config.sc.initial_monotonic_time_nsec); + return 2; +} diff --git a/src/program/lua/Movie.h b/src/program/lua/Movie.h index 59da6bee..37b46566 100644 --- a/src/program/lua/Movie.h +++ b/src/program/lua/Movie.h @@ -56,6 +56,9 @@ namespace Movie { /* Get system time set at game start */ int getInitialSystemTime(lua_State *L); + + /* Get elapsed time set at game start */ + int getInitialElapsedTime(lua_State *L); } }