no message
This commit is contained in:
parent
091901ddfa
commit
5f7b2fb727
|
@ -564,7 +564,10 @@ static duk_ret_t duk_pmem(duk_context* duk)
|
|||
s32 val = memory->persistent.data[index];
|
||||
|
||||
if(!duk_is_null_or_undefined(duk, 1))
|
||||
{
|
||||
memory->persistent.data[index] = duk_to_int(duk, 1);
|
||||
machine->data->syncPMEM = true;
|
||||
}
|
||||
|
||||
duk_push_int(duk, val);
|
||||
|
||||
|
|
|
@ -1069,6 +1069,7 @@ static s32 lua_pmem(lua_State *lua)
|
|||
if(top >= 2)
|
||||
{
|
||||
memory->persistent.data[index] = getLuaNumber(lua, 2);
|
||||
machine->data->syncPMEM = true;
|
||||
}
|
||||
|
||||
lua_pushinteger(lua, val);
|
||||
|
|
|
@ -93,11 +93,11 @@ static void tick(Run* run)
|
|||
|
||||
enum {Size = sizeof(tic_persistent)};
|
||||
|
||||
// TODO: remove PMEM checking...
|
||||
if(memcmp(&run->tic->persistent, &run->persistent, Size) != 0)
|
||||
if(run->tickData.syncPMEM)
|
||||
{
|
||||
fsSaveRootFile(run->console->fs, run->saveid, &run->tic->persistent, Size, true);
|
||||
memcpy(&run->persistent, &run->tic->persistent, Size);
|
||||
run->tickData.syncPMEM = false;
|
||||
}
|
||||
|
||||
if(run->exit)
|
||||
|
@ -184,6 +184,7 @@ void initRun(Run* run, Console* console, tic_mem* tic)
|
|||
.exit = onExit,
|
||||
.preprocessor = processDoFile,
|
||||
.forceExit = forceExit,
|
||||
.syncPMEM = false,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ TIC80_API void tic80_load(tic80* tic, void* cart, s32 size)
|
|||
tic80->tickData.start = 0;
|
||||
tic80->tickData.freq = getFreq;
|
||||
tic80->tickData.counter = getCounter;
|
||||
tic80->tickData.syncPMEM = false;
|
||||
TickCounter = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@ typedef struct
|
|||
u64 (*freq)();
|
||||
u64 start;
|
||||
|
||||
bool syncPMEM;
|
||||
|
||||
void (*preprocessor)(void* data, char* dst);
|
||||
|
||||
void* data;
|
||||
|
|
|
@ -905,6 +905,7 @@ static void wren_pmem(WrenVM* vm)
|
|||
if(top > 2)
|
||||
{
|
||||
memory->persistent.data[index] = getWrenNumber(vm, 2);
|
||||
machine->data->syncPMEM = true;
|
||||
}
|
||||
|
||||
wrenSetSlotDouble(vm, 0, val);
|
||||
|
|
Loading…
Reference in New Issue