plugins/hiscore: start delay (nw)

This commit is contained in:
cracyc 2019-02-17 13:16:33 -06:00
parent 63979771d8
commit f1e51d745a

View File

@ -33,6 +33,7 @@ function hiscore.startplugin()
local mem_check_passed = false;
local found_hiscore_entry = false;
local timed_save = true;
local delaytime = 0;
local positions = {};
-- Configuration file will be searched in the first path defined
@ -59,6 +60,10 @@ function hiscore.startplugin()
local function parse_table ( dsting )
local _table = {};
for line in string.gmatch(dsting, '([^\n]+)') do
local delay = line:match('^@delay=([%d])')
if delay and #delay > 0 then
delaytime = os.time() + tonumber(delay)
else
local cpu, mem;
local cputag, space, offs, len, chk_st, chk_ed, fill = string.match(line, '^@([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),?(%x?%x?)');
cpu = manager:machine().devices[cputag];
@ -83,6 +88,7 @@ function hiscore.startplugin()
fill = tonumber(fill, 16)
};
end
end
return _table;
end
@ -211,7 +217,7 @@ function hiscore.startplugin()
local function init ()
if not scores_have_been_read then
if check_mem( positions ) then
if (delaytime <= os.time()) and check_mem( positions ) then
default_checksum = check_scores( positions );
if read_scores( positions ) then
emu.print_verbose( "hiscore: scores read OK" );