no message

This commit is contained in:
BADIM-PC\Vadim 2018-02-15 17:19:04 +03:00
parent 091901ddfa
commit 5f7b2fb727
6 changed files with 11 additions and 2 deletions

View File

@ -564,7 +564,10 @@ static duk_ret_t duk_pmem(duk_context* duk)
s32 val = memory->persistent.data[index]; s32 val = memory->persistent.data[index];
if(!duk_is_null_or_undefined(duk, 1)) if(!duk_is_null_or_undefined(duk, 1))
{
memory->persistent.data[index] = duk_to_int(duk, 1); memory->persistent.data[index] = duk_to_int(duk, 1);
machine->data->syncPMEM = true;
}
duk_push_int(duk, val); duk_push_int(duk, val);

View File

@ -1069,6 +1069,7 @@ static s32 lua_pmem(lua_State *lua)
if(top >= 2) if(top >= 2)
{ {
memory->persistent.data[index] = getLuaNumber(lua, 2); memory->persistent.data[index] = getLuaNumber(lua, 2);
machine->data->syncPMEM = true;
} }
lua_pushinteger(lua, val); lua_pushinteger(lua, val);

View File

@ -93,11 +93,11 @@ static void tick(Run* run)
enum {Size = sizeof(tic_persistent)}; enum {Size = sizeof(tic_persistent)};
// TODO: remove PMEM checking... if(run->tickData.syncPMEM)
if(memcmp(&run->tic->persistent, &run->persistent, Size) != 0)
{ {
fsSaveRootFile(run->console->fs, run->saveid, &run->tic->persistent, Size, true); fsSaveRootFile(run->console->fs, run->saveid, &run->tic->persistent, Size, true);
memcpy(&run->persistent, &run->tic->persistent, Size); memcpy(&run->persistent, &run->tic->persistent, Size);
run->tickData.syncPMEM = false;
} }
if(run->exit) if(run->exit)
@ -184,6 +184,7 @@ void initRun(Run* run, Console* console, tic_mem* tic)
.exit = onExit, .exit = onExit,
.preprocessor = processDoFile, .preprocessor = processDoFile,
.forceExit = forceExit, .forceExit = forceExit,
.syncPMEM = false,
}, },
}; };

View File

@ -104,6 +104,7 @@ TIC80_API void tic80_load(tic80* tic, void* cart, s32 size)
tic80->tickData.start = 0; tic80->tickData.start = 0;
tic80->tickData.freq = getFreq; tic80->tickData.freq = getFreq;
tic80->tickData.counter = getCounter; tic80->tickData.counter = getCounter;
tic80->tickData.syncPMEM = false;
TickCounter = 0; TickCounter = 0;
} }

View File

@ -58,6 +58,8 @@ typedef struct
u64 (*freq)(); u64 (*freq)();
u64 start; u64 start;
bool syncPMEM;
void (*preprocessor)(void* data, char* dst); void (*preprocessor)(void* data, char* dst);
void* data; void* data;

View File

@ -905,6 +905,7 @@ static void wren_pmem(WrenVM* vm)
if(top > 2) if(top > 2)
{ {
memory->persistent.data[index] = getWrenNumber(vm, 2); memory->persistent.data[index] = getWrenNumber(vm, 2);
machine->data->syncPMEM = true;
} }
wrenSetSlotDouble(vm, 0, val); wrenSetSlotDouble(vm, 0, val);