commit 4c878118cc95a16be5dd6cc948a3fe9f255dac03
Author: Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Sun Aug 27 08:00:40 2023 -0600
Commit: Jon Bell <j.to.the.bell@gmail.com>
CommitDate: Sun Aug 27 08:00:40 2023 -0600
WIP- save wip in game loop refactor
---
source/FakoBios.h | 2 +
source/p8GlobalLuaFunctions.h | 317 +++++++++++++++++++++++++++++++++++++++++-
source/picoluaapi.cpp | 8 +-
source/vm.cpp | 282 ++++++++++++++++++++-----------------
source/vm.h | 6 +-
5 files changed, 479 insertions(+), 136 deletions(-)
diff --git a/source/FakoBios.h b/source/FakoBios.h
index 7a354aa..5fca200 100644
--- a/source/FakoBios.h
+++ b/source/FakoBios.h
@@ -7,6 +7,8 @@
#endif
//from PicoLove api.lua
+//this shouldn't really count as the bios
+//this is the cart loader cart
const char * fake08BiosP8 = R"#(
pico-8 cartridge // http://www.pico-8.com
diff --git a/source/p8GlobalLuaFunctions.h b/source/p8GlobalLuaFunctions.h
index 6d40bd3..943ea79 100644
--- a/source/p8GlobalLuaFunctions.h
+++ b/source/p8GlobalLuaFunctions.h
@@ -4,6 +4,7 @@
//from zepto 8 bios.p8
+//this is the bios-- needs to get loaded first, and then will run every cart
const char * p8GlobalLuaFunctions = R"#(
-- The functions below are normally attached to the program code, but are here for simplicity
@@ -17,6 +18,11 @@ getmetatable('').__index = function(str,i) return string.sub(str,i,i) end
--from zepto 8 bios.p8
-- PicoLove functions did not return values added/deleted
+__z8_load_code = load
+--todo: see if we need the other z8 stuff
+__z8_stopped = false
+__z8_persist_delay = 0
+
function all(c)
if (c==nil or #c==0) return function() end
local i,prev = 1,nil
@@ -96,6 +102,10 @@ function serial(chan, address, len)
end
+local error = error
+local tonumber = tonumber
+local __cartdata = __cartdata
+
---------------------------------
--Coroutines
---------------------------------
@@ -103,12 +113,12 @@ yield = coroutine.yield
cocreate = coroutine.create
coresume = coroutine.resume
costatus = coroutine.status
+yield = coroutine.yield
---------------------------------
--Debug
---------------------------------
trace = debug.traceback
-debug = nil
sub = string.sub
pack = table.pack
@@ -330,6 +340,311 @@ eris.restore_all = function(persisted)
_G[k] = v
end
end
+
+function flip()
+ _update_buttons()
+ yield()
+end
+
+-- Load a cart from file or URL
+function load(arg)
+ local success, msg
+
+ success, msg = __load(arg), ""
+
+ /*
+ if success then
+ print('ok')
+ else
+ color(14)
+ print('failed')
+ local x,y = cursor()
+ cursor(0, y)
+ print(msg)
+ end
+ */
+end
+
+--todo: make this bettter/verify the list
+function __is_api(funcname)
+ local picofuncnames = {
+ time = 1, t = 1, sub = 1, chr = 1, ord = 1, tostr = 1, tonum = 1,
+ add = 1, del = 1, deli = 1, clip = 1, color = 1, pal = 1, palt = 1,
+ fillp = 1, pget = 1, pset = 1, sget = 1, sset = 1, fget = 1,
+ fset = 1, circ = 1, circfill = 1, rect = 1, rectfill = 1, oval = 1,
+ ovalfill = 1, line = 1, spr = 1, sspr = 1, mget = 1, mset = 1,
+ tline = 1, peek = 1, poke = 1, peek2 = 1, poke2 = 1, peek4 = 1,
+ poke4 = 1, memcpy = 1, memset = 1, max = 1, min = 1, mid = 1, flr = 1,
+ ceil = 1, cos = 1, sin = 1, atan2 = 1, rnd = 1, srand = 1, band = 1,
+ bor = 1, bxor = 1, bnot = 1, shl = 1, shr = 1, lshr = 1, rotl = 1, rotr = 1,
+ }
+ return picofuncnames[funcname] == 1
+end
+
+function create_sandbox()
+ local t = {}
+ for k,v in pairs(_ENV) do
+ if __is_api(k) then
+ t[k] = v
+ end
+ end
+ return t;
+end
+
+
+-- copied directly from zepto 8 for the time being
+
+--
+-- Utility functions
+--
+function __z8_reset_state()
+ -- From the PICO-8 documentation:
+ -- “The draw state is reset each time a program is run. This is equivalent to calling:
+ -- clip() camera() pal() color(6)”
+ -- Note from Sam: color() is actually short for color(6)
+ -- Note from Sam: also add fillp() here.
+ clip() camera() pal() color() fillp()
+end
+
+function __z8_reset_cartdata()
+ __cartdata(nil)
+end
+
+function __z8_run_cart(cart_code)
+ local glue_code = [[--
+ if (_init) _init()
+ if _update or _update60 or _draw then
+ local do_frame = true
+ while true do
+ if _update60 then
+ _update_buttons()
+ _update60()
+ elseif _update then
+ if (do_frame) _update_buttons() _update()
+ do_frame = not do_frame
+ else
+ _update_buttons()
+ end
+ if (_draw and do_frame) _draw()
+ yield()
+ end
+ end
+ ]]
+
+ __z8_loop = cocreate(function()
+
+ -- First reload cart into memory
+ memset(0, 0, 0x8000)
+ reload()
+
+ __z8_reset_state()
+ __z8_reset_cartdata()
+
+ -- Load cart and run the user-provided functions. Note that if the
+ -- cart code returns before the end, our added code will not be
+ -- executed, and nothing will work. This is also PICO-8’s behaviour.
+ -- The code has to be appended as a string because the functions
+ -- may be stored in local variables.
+ --__z8_load_code points to lua's load function https://www.lua.org/manual/5.2/manual.html#pdf-load
+ local code, ex = __z8_load_code(cart_code..glue_code, nil, nil,
+ create_sandbox())
+ if not code then
+ color(14) print('syntax error')
+ color(6) print(ex)
+ error()
+ end
+
+ -- Run cart code
+ code()
+ end)
+end
+
+-- FIXME: this function is quite a mess
+function __z8_tick()
+ if (costatus(__z8_loop) == "dead") return -1
+ ret, err = coresume(__z8_loop)
+
+ -- XXX: test eris persistence
+ __z8_persist_delay += 1
+ if __z8_persist_delay > 30 and btnp(13) then
+ __z8_persist_delay = 0
+ if backup then
+ __z8_loop = unpersist(backup)
+ else
+ backup = persist(__z8_loop)
+ end
+ end
+
+ if __z8_stopped then
+ __z8_stopped = false -- FIXME: what now?
+ elseif not ret then
+ -- FIXME: I use __stub because printh() prints nothing in Visual Studio
+ __stub(tostr(err))
+ end
+ return 0
+end
+
+
+--
+-- Splash sequence
+--
+function __z8_boot_sequence()
+ __z8_reset_state()
+
+ local boot =
+ {
+ [1] = function() for i=2,127,8 do for j=0,127 do pset(i,j,rnd()*4+j/40) end end end,
+ [7] = function() for i=0,127,4 do for j=0,127,2 do pset(i,j,(i+j)/8%8+6) end end end,
+ [12] = function() for i=2,127,4 do for j=0,127,3 do pset(i,j,rnd()*4+10) end end end,
+ [17] = function() for i=1,127,2 do for j=0,127 do pset(i,j,pget(i+1,j)) end end end,
+ [22] = function() for j=0,31 do memset(0x6040+j*256,0,192) end end,
+ [27] = cls,
+ [36] = function() local notes = { 0x.5dde, 0x5deb.5be3, 0x.5fef, 0x.57ef, 0x.53ef }
+ for j=0,#notes-1 do poke4(0x3200+j*4,notes[j+1]) end poke(0x3241, 0x0a)
+ sfx(0)
+ local logo = "###### #### ### ###### #### ### "
+ .. " ## ## ## ## ## ## ## ## ##"
+ .. " ### ##### ##### ## ## ## ### ### "
+ .. " ### ## #### ## ### ## ## ##"
+ .. "###### ##### ## ## ###### #####"
+ .. "###### ##### ## ## #### ### "
+ for j=0,#logo-1 do pset(j%42,6+j/42,sub(logo,j+1,j+1)=='#'and 7) end
+ local a = {0,0,12,0,0,0,13,7,11,0,14,7,7,7,10,0,15,7,9,0,0,0,8,0,0}
+ for j=0,#a-1 do pset(41+j%5,2+j/5,a[j+1]) end end,
+ [45] = function() color(6) print("\n\n\nzepto-8 0.0.0 alpha") end,
+ [50] = function() print("(c) 2016-20 sam hocevar et al.\n") end,
+ [52] = function() print("type help for help\n") end,
+ }
+
+ for step=0,54 do if boot[step] then boot[step]() end flip() end
+
+ __z8_loop = cocreate(__z8_shell)
+end
+
+local function print_clear(s)
+ -- empty next line
+ local y, c = @0x5f27, color(0)
+ rectfill(0, y, 127, y + 5)
+ color(c)
+ print(s)
+end
+
+local function do_command(cmd)
+ local c = color()
+ if string.match(cmd, '^ *$') then
+ -- empty line
+ elseif string.match(cmd, '^ *run *$') then
+ run()
+ elseif string.match(cmd, '^ *load[ |(]') then
+ load(string.gsub(cmd, '^ *load *', ''))
+ elseif cmd == 'help' then
+ color(12)
+ print_clear('') print_clear('commands') print_clear('')
+ color(6)
+ print_clear('load <filename>')
+ print_clear('run')
+ print_clear('')
+ color(12)
+ print_clear('example: load #15133')
+ print_clear(' load #dancer')
+ print_clear('')
+ else
+ color(14)
+ print_clear('syntax error')
+ end
+ color(c)
+end
+
+function __z8_shell()
+ -- activate project
+ poke(0x5f2d, 1)
+ local history = {}
+ local cmd, caret = "", 0
+ local start_y = @0x5f27
+ while true do
+ local exec = false
+ -- read next characters and act on them
+ local chars = stat(30) and stat(31) or ""
+ for n = 1, #chars do
+ local c = sub(chars, n, n)
+ if c == "\8" then
+ if caret > 0 then
+ caret -= 1
+ cmd = sub(cmd, 0, caret)..sub(cmd, caret + 2, #cmd)
+ end
+ elseif c == "\x7f" then
+ if caret < #cmd then
+ cmd = sub(cmd, 0, caret)..sub(cmd, caret + 2, #cmd)
+ end
+ elseif c == "\r" then
+ exec = true
+ elseif #cmd < 255 then
+ cmd = sub(cmd, 0, caret)..c..sub(cmd, caret + 1, #cmd)
+ caret += 1
+ end
+ end
+ -- left/right/up/down handled by buttons instead of keys (FIXME)
+ if btnp(0) then
+ caret = max(caret - 1, 0)
+ elseif btnp(1) then
+ caret = min(caret + 1, #cmd)
+ elseif btnp(2) and #history > 0 then
+ if not history_pos then
+ history_pos = #history + 1
+ end
+ if history_pos == #history + 1 then
+ cmd_bak = cmd
+ end
+ if history_pos > 1 then
+ history_pos -= 1
+ cmd = history[history_pos]
+ caret = #cmd
+ end
+ elseif btnp(3) and #history > 0 then
+ if not history_pos then
+ cmd, caret = "", 0
+ elseif history_pos <= #history then
+ history_pos += 1
+ cmd = history[history_pos] or cmd_bak
+ caret = #cmd
+ end
+ end
+ -- fixme: print() behaves slightly differently when
+ -- scrolling in the command prompt
+ local pen = @0x5f25
+ if exec then
+ -- return was pressed, so print an empty line to ensure scrolling
+ cursor(0, start_y)
+ print('')
+ start_y = @0x5f27
+ do_command(cmd)
+ start_y = @0x5f27
+ flip()
+ if (#cmd > 0 and cmd != history[#history]) add(history, cmd)
+ history_pos = nil
+ cmd, caret = "", 0
+ else
+ rectfill(0, start_y, (__z8_strlen(cmd) + 3) * 4, start_y + 5, 0)
+ color(7)
+ print('> ', 0, start_y, 7)
+ print(cmd, 8, start_y, 7)
+ -- display cursor and immediately hide it after we flip() so that it
+ -- does not remain in later frames
+ local on = t() * 5 % 2 > 1
+ if (on) rectfill(caret * 4 + 8, start_y, caret * 4 + 11, start_y + 4, 8)
+ flip()
+ if (on) rectfill(caret * 4 + 8, start_y, caret * 4 + 11, start_y + 4, 0)
+ end
+ poke(0x5f25, pen)
+ end
+end
+
+
+--
+-- Initialise the VM
+--
+__z8_loop = cocreate(__z8_boot_sequence)
+
)#";
diff --git a/source/picoluaapi.cpp b/source/picoluaapi.cpp
index a720481..6c3db0e 100644
--- a/source/picoluaapi.cpp
+++ b/source/picoluaapi.cpp
@@ -708,11 +708,11 @@ int fillp(lua_State *L) {
return 1;
}
-int flip(lua_State *L) {
- _vmForLuaApi->vm_flip();
+// int flip(lua_State *L) {
+// _vmForLuaApi->vm_flip();
- return 0;
-}
+// return 0;
+// }
//Input
diff --git a/source/vm.cpp b/source/vm.cpp
index 3631629..c42fd19 100644
--- a/source/vm.cpp
+++ b/source/vm.cpp
@@ -46,7 +46,7 @@ Vm::Vm(
_loadedCart(nullptr),
_luaState(nullptr),
_cleanupDeps(false),
- _targetFps(30),
+ //_targetFps(30),
_picoFrameCount(0),
_cartChangeQueued(false),
_nextCartKey(""),
@@ -167,7 +167,7 @@ bool Vm::loadCart(Cart* cart) {
lua_register(_luaState, "__loadsettingscart", loadsettingscart);
lua_register(_luaState, "__togglepausemenu", togglepausemenu);
lua_register(_luaState, "__resetcart", resetcart);
- lua_register(_luaState, "load", load);
+ //lua_register(_luaState, "load", load);
//settings
lua_register(_luaState, "__getsetting", getsetting);
@@ -216,7 +216,7 @@ bool Vm::loadCart(Cart* cart) {
//stubbed in graphics:
lua_register(_luaState, "fillp", fillp);
- lua_register(_luaState, "flip", flip);
+ //lua_register(_luaState, "flip", flip);
//input
lua_register(_luaState, "btn", btn);
@@ -277,6 +277,7 @@ bool Vm::loadCart(Cart* cart) {
// Push the eris.init_persist_all function on the top of the lua stack (or nil if it doesn't exist)
// we call this function to establish the default global state of things not to save in the save state
// needs to be called after globals are loaded but before the cart is run, or _init is called
+ //TODO: move these calls to the glue code?
lua_getglobal(_luaState, "eris");
lua_getfield(_luaState, -1, "init_persist_all");
@@ -289,7 +290,31 @@ bool Vm::loadCart(Cart* cart) {
//pop the eris.init_persist_all fuction off the stack now that we're done with it
lua_pop(_luaState, 1);
- int loadedCart = luaL_loadstring(_luaState, cart->LuaString.c_str());
+ //need to add game loop to the bottom of the cart code
+ const char* gameLoop = R"#(
+--game loop
+if (_init) _init()
+if _update or _update60 or _draw then
+ local do_frame = true
+ while true do
+ if _update60 then
+ _update_buttons()
+ _update60()
+ elseif _update then
+ if (do_frame) _update_buttons() _update()
+ do_frame = not do_frame
+ else
+ _update_buttons()
+ end
+ if (_draw and do_frame) _draw()
+ yield()
+ end
+end
+ )#";
+
+ auto cartLua = cart->LuaString + gameLoop;
+
+ int loadedCart = luaL_loadstring(_luaState, cartLua.c_str());
if (loadedCart != LUA_OK) {
_cartLoadError = "Error loading cart lua:\n";
_cartLoadError.append(lua_tostring(_luaState, -1));
@@ -332,32 +357,32 @@ bool Vm::loadCart(Cart* cart) {
#endif
// Push the _init function on the top of the lua stack (or nil if it doesn't exist)
- lua_getglobal(_luaState, "_init");
+ // lua_getglobal(_luaState, "_init");
- if (lua_isfunction(_luaState, -1)) {
- if (lua_pcall(_luaState, 0, 0, 0)){
- _cartLoadError = lua_tostring(_luaState, -1);
- Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
- lua_pop(_luaState, 1);
- QueueCartChange(BiosCartName);
- return false;
- }
- }
+ // if (lua_isfunction(_luaState, -1)) {
+ // if (lua_pcall(_luaState, 0, 0, 0)){
+ // _cartLoadError = lua_tostring(_luaState, -1);
+ // Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
+ // lua_pop(_luaState, 1);
+ // QueueCartChange(BiosCartName);
+ // return false;
+ // }
+ // }
- //pop the _init fuction off the stack now that we're done with it
- lua_pop(_luaState, 0);
+ // //pop the _init fuction off the stack now that we're done with it
+ // lua_pop(_luaState, 0);
//check for update, mark correct target fps
- lua_getglobal(_luaState, "_update60");
- if (lua_isfunction(_luaState, -1)) {
- _targetFps = 60;
- }
- else {
- _targetFps = 30;
- }
- lua_pop(_luaState, 0);
+ // lua_getglobal(_luaState, "_update60");
+ // if (lua_isfunction(_luaState, -1)) {
+ // _targetFps = 60;
+ // }
+ // else {
+ // _targetFps = 30;
+ // }
+ // lua_pop(_luaState, 0);
//customize bios per host's requirements
@@ -375,6 +400,7 @@ bool Vm::loadCart(Cart* cart) {
}
}
+ //move this to cart glue code?
if (_cartBreadcrumb.length() > 0) {
ExecuteLua("__addbreadcrumb(\"" + _cartBreadcrumb +"\", \"" + _prevCartKey +"\")", "");
}
@@ -538,75 +564,75 @@ void Vm::deserializeCartDataToMemory(std::string cartDataStr) {
}
}
-void Vm::UpdateAndDraw() {
- update_buttons();
-
- _picoFrameCount++;
-
- if (_cartChangeQueued) {
- _prevCartKey = CurrentCartFilename();
- if (_nextCartSize > 0){
- LoadCart(_nextCartData, _nextCartSize);
- }
- else {
- LoadCart(_nextCartKey);
- }
- }
-
- if (_pauseMenu){
-
- lua_getglobal(_luaState, "__f08_menu_update");
- lua_call(_luaState, 0, 0);
- lua_pop(_luaState, 0);
-
- lua_getglobal(_luaState, "__f08_menu_draw");
- lua_call(_luaState, 0, 0);
- lua_pop(_luaState, 0);
- }
- else{
- // Push the _update function on the top of the lua stack
- if (_targetFps == 60) {
- lua_getglobal(_luaState, "_update60");
- if (!lua_isfunction(_luaState, -1)) {
- lua_getglobal(_luaState, "_update");
- }
- } else {
- lua_getglobal(_luaState, "_update");
- if (!lua_isfunction(_luaState, -1)) {
- lua_getglobal(_luaState, "_update60");
- }
- }
-
- if (lua_isfunction(_luaState, -1)) {
- if (lua_pcall(_luaState, 0, 0, 0)){
- _cartLoadError = lua_tostring(_luaState, -1);
- Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
- lua_pop(_luaState, 1);
- QueueCartChange(BiosCartName);
- return;
- }
- }
- //pop the update fuction off the stack now that we're done with it
- lua_pop(_luaState, 0);
-
- lua_getglobal(_luaState, "_draw");
- if (lua_isfunction(_luaState, -1)) {
- if (lua_pcall(_luaState, 0, 0, 0)){
- _cartLoadError = lua_tostring(_luaState, -1);
- Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
- lua_pop(_luaState, 1);
- QueueCartChange(BiosCartName);
- return;
- }
- }
- lua_pop(_luaState, 0);
-
- if (_input->btnp(6)) {
- togglePauseMenu();
- }
- }
-
-}
+// void Vm::UpdateAndDraw() {
+// update_buttons();
+
+// _picoFrameCount++;
+
+// if (_cartChangeQueued) {
+// _prevCartKey = CurrentCartFilename();
+// if (_nextCartSize > 0){
+// LoadCart(_nextCartData, _nextCartSize);
+// }
+// else {
+// LoadCart(_nextCartKey);
+// }
+// }
+
+// if (_pauseMenu){
+
+// lua_getglobal(_luaState, "__f08_menu_update");
+// lua_call(_luaState, 0, 0);
+// lua_pop(_luaState, 0);
+
+// lua_getglobal(_luaState, "__f08_menu_draw");
+// lua_call(_luaState, 0, 0);
+// lua_pop(_luaState, 0);
+// }
+// else{
+// // Push the _update function on the top of the lua stack
+// if (_targetFps == 60) {
+// lua_getglobal(_luaState, "_update60");
+// if (!lua_isfunction(_luaState, -1)) {
+// lua_getglobal(_luaState, "_update");
+// }
+// } else {
+// lua_getglobal(_luaState, "_update");
+// if (!lua_isfunction(_luaState, -1)) {
+// lua_getglobal(_luaState, "_update60");
+// }
+// }
+
+// if (lua_isfunction(_luaState, -1)) {
+// if (lua_pcall(_luaState, 0, 0, 0)){
+// _cartLoadError = lua_tostring(_luaState, -1);
+// Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
+// lua_pop(_luaState, 1);
+// QueueCartChange(BiosCartName);
+// return;
+// }
+// }
+// //pop the update fuction off the stack now that we're done with it
+// lua_pop(_luaState, 0);
+
+// lua_getglobal(_luaState, "_draw");
+// if (lua_isfunction(_luaState, -1)) {
+// if (lua_pcall(_luaState, 0, 0, 0)){
+// _cartLoadError = lua_tostring(_luaState, -1);
+// Logger_Write("Error: %s\n", lua_tostring(_luaState, -1));
+// lua_pop(_luaState, 1);
+// QueueCartChange(BiosCartName);
+// return;
+// }
+// }
+// lua_pop(_luaState, 0);
+
+// if (_input->btnp(6)) {
+// togglePauseMenu();
+// }
+// }
+
+// }
uint8_t* Vm::GetPicoInteralFb(){
return _graphics->GetP8FrameBuffer();
@@ -976,52 +1002,52 @@ void Vm::update_buttons() {
}
}
-void Vm::vm_flip() {
- if (!_host->shouldRunMainLoop()){
- abortLua = true;
- if (abortLua){
- longjmp(place, 1);
- }
- }
+// void Vm::vm_flip() {
+// if (!_host->shouldRunMainLoop()){
+// abortLua = true;
+// if (abortLua){
+// longjmp(place, 1);
+// }
+// }
- if (!_host->shouldQuit() && !_cartChangeQueued) {
- update_buttons();
+// if (!_host->shouldQuit() && !_cartChangeQueued) {
+// update_buttons();
- _picoFrameCount++;
+// _picoFrameCount++;
- //todo: pause menu here, but for now just load bios
- if (_input->btnp(6)) {
- //QueueCartChange(BiosCartName);
- togglePauseMenu();
+// //todo: pause menu here, but for now just load bios
+// if (_input->btnp(6)) {
+// //QueueCartChange(BiosCartName);
+// togglePauseMenu();
- //shouldn't get here
- return;
- }
+// //shouldn't get here
+// return;
+// }
- _host->changeStretch();
+// _host->changeStretch();
- _host->setTargetFps(_targetFps);
+// _host->setTargetFps(_targetFps);
- uint8_t* picoFb = GetPicoInteralFb();
- uint8_t* screenPaletteMap = GetScreenPaletteMap();
+// uint8_t* picoFb = GetPicoInteralFb();
+// uint8_t* screenPaletteMap = GetScreenPaletteMap();
- if (_pauseMenu){
- //pause menu probably needs refactor out of lua. For now this is better than just quitting
- lua_getglobal(_luaState, "__f08_menu_update");
- lua_call(_luaState, 0, 0);
- lua_pop(_luaState, 0);
+// if (_pauseMenu){
+// //pause menu probably needs refactor out of lua. For now this is better than just quitting
+// lua_getglobal(_luaState, "__f08_menu_update");
+// lua_call(_luaState, 0, 0);
+// lua_pop(_luaState, 0);
- lua_getglobal(_luaState, "__f08_menu_draw");
- lua_call(_luaState, 0, 0);
- lua_pop(_luaState, 0);
- }
+// lua_getglobal(_luaState, "__f08_menu_draw");
+// lua_call(_luaState, 0, 0);
+// lua_pop(_luaState, 0);
+// }
- _host->drawFrame(picoFb, screenPaletteMap, _memory->drawState.drawMode);
+// _host->drawFrame(picoFb, screenPaletteMap, _memory->drawState.drawMode);
- //is this better at the end of the loop?
- _host->waitForTargetFps();
- }
-}
+// //is this better at the end of the loop?
+// _host->waitForTargetFps();
+// }
+// }
void Vm::vm_run() {
if (_loadedCart) {
diff --git a/source/vm.h b/source/vm.h
index e4c3031..75bfd2d 100644
--- a/source/vm.h
+++ b/source/vm.h
@@ -32,7 +32,7 @@ class Vm {
bool _cleanupDeps;
- int _targetFps;
+ //int _targetFps;
int _picoFrameCount;
//bool _hasUpdate;
@@ -74,7 +74,7 @@ class Vm {
void LoadCart(string filename, bool loadBiosOnFail = true);
void LoadCart(const unsigned char* cartData, size_t size, bool loadBiosOnFail = true);
- void UpdateAndDraw();
+ // void UpdateAndDraw();
uint8_t* GetPicoInteralFb();
uint8_t* GetScreenPaletteMap();
@@ -132,7 +132,7 @@ class Vm {
void update_buttons();
- void vm_flip();
+ // void vm_flip();
void vm_run();
void vm_extcmd(string cmd);