stars.lua screen does not update int the sim

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 46d644fcd792f581c89597227ad2e5d3fae4dac8
Author: William Wilgus <[email protected]>
Date:   Mon Jan 12 01:22:07 2026 -0500

    stars.lua screen does not update int the sim
    
    SDL needs to do lcd_update from the main thread
    stars.lua uses an event that runs in a timer thread
    so in the sim the screen never updates
    
    Change-Id: I6002525363010c3133ebbfb490763f747c5d773a

diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 4d7c5e8f04..4404598ad3 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -1052,6 +1052,11 @@ LUALIB_API int luaopen_rock(lua_State *L)
 {
     luaL_register(L, LUA_ROCKLIBNAME, rocklib);
     luaL_register(L, LUA_ROCKLIBNAME, rocklib_aux);
+#ifdef SIMULATOR /* rb.SIMULATOR = true allows checking for the SIM in lua */
+        lua_pushboolean(L, 1);
+        luaS_newlloc(L, "SIMULATOR", TSTR_INBIN);
+        lua_setfield(L, -2, "SIMULATOR");
+#endif
     lua_getglobal(L, "require");
     lua_pushstring(L, "rb_defines");
     if (lua_pcall (L, 1, 0, 0))
diff --git a/apps/plugins/lua_scripts/stars.lua b/apps/plugins/lua_scripts/stars.lua
index e05007afb6..2a46b00707 100644
--- a/apps/plugins/lua_scripts/stars.lua
+++ b/apps/plugins/lua_scripts/stars.lua
@@ -414,7 +414,11 @@ action_event(rb.actions.ACTION_NONE) -- we can call this now but not after regis
 local eva = rockev.register("action", action_event)
 local evc = rockev.register("timer", action_drift, rb.HZ/7)
 
+if not rb.SIMULATOR then
 while not action_quit() do rb.sleep(rb.HZ) end
+else -- the SIM requires lcd_update to be called from the main thread
+while not action_quit() do _lcd:update(); rb.sleep(10) end
+end
 
 if start_x and start_y then
     file = io.open(fname, "w")
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.