feat(LuaGame): migrate solitaire, enable SD external loading
- Enable use_external=true with priority: solitaire, breakout, game, pong, snake, tetris - Fix is_pico detection to check source content before load (renderer./INPUT.) instead of game.vars heuristic that always true - Successfully uploaded solitaire.lua (24824 bytes) via /fs/upload?path=/sdcard/lua/solitaire.lua - Tested solitaire loads: 'loaded external /sdcard/lua/solitaire.lua 24824 bytes, pico=1, FPS 13.0' - Screenshot shows card layout rendering (white pixels 4141, ASCII preview shows piles) - SD file listing: /sdcard/lua now has breakout.lua and solitaire.lua - Ready for further pico games via same upload API
This commit is contained in:
@@ -452,18 +452,22 @@ static void lua_init_task(void* arg){
|
|||||||
luaL_openlibs(ctx->L);
|
luaL_openlibs(ctx->L);
|
||||||
register_sys(ctx->L);
|
register_sys(ctx->L);
|
||||||
const char* external_paths[]={
|
const char* external_paths[]={
|
||||||
|
"/sdcard/lua/solitaire.lua",
|
||||||
"/sdcard/lua/breakout.lua",
|
"/sdcard/lua/breakout.lua",
|
||||||
"/sdcard/lua/game.lua",
|
"/sdcard/lua/game.lua",
|
||||||
|
"/sdcard/lua/pong.lua",
|
||||||
|
"/sdcard/lua/snake.lua",
|
||||||
|
"/sdcard/lua/tetris.lua",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
char* src_buf=NULL;
|
char* src_buf=NULL;
|
||||||
size_t src_len=0;
|
size_t src_len=0;
|
||||||
const char* loaded_from="embedded";
|
const char* loaded_from="embedded";
|
||||||
bool use_external = false;
|
bool use_external = true; // enable SD loading for solitaire migration
|
||||||
bool use_pico_test = false; // set true to test pico games
|
bool use_pico_test = false;
|
||||||
const char* pico_test_src = NULL;
|
const char* pico_test_src = NULL;
|
||||||
if(use_pico_test){
|
if(use_pico_test){
|
||||||
pico_test_src = pong_lua_src; // choose pong for test
|
pico_test_src = pong_lua_src;
|
||||||
printf("[LuaGame] using Pico test game: Pong (%d bytes)\n", (int)strlen(pico_test_src));
|
printf("[LuaGame] using Pico test game: Pong (%d bytes)\n", (int)strlen(pico_test_src));
|
||||||
src_len = strlen(pico_test_src);
|
src_len = strlen(pico_test_src);
|
||||||
src_buf = (char*)alloc_psram(src_len+1);
|
src_buf = (char*)alloc_psram(src_len+1);
|
||||||
|
|||||||
Reference in New Issue
Block a user