diff options
Diffstat (limited to 'plugins/hiscore/init.lua')
-rw-r--r-- | plugins/hiscore/init.lua | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/plugins/hiscore/init.lua b/plugins/hiscore/init.lua index a89acfb33e3..ded3f0e44d2 100644 --- a/plugins/hiscore/init.lua +++ b/plugins/hiscore/init.lua @@ -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,29 +60,34 @@ function hiscore.startplugin() local function parse_table ( dsting ) local _table = {}; for line in string.gmatch(dsting, '([^\n]+)') do - local cpu, mem; - local cputag, space, offs, len, chk_st, chk_ed, fill = string.match(line, '^@([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),?(%x?%x?)'); - cpu = manager:machine().devices[cputag]; - if not cpu then - error(cputag .. " device not found") - end - local rgnname, rgntype = space:match("([^/]*)/?([^/]*)") - if rgntype == "share" then - mem = manager:machine():memory().shares[rgnname] + local delay = line:match('^@delay=([.%d]*)') + if delay and #delay > 0 then + delaytime = emu.time() + tonumber(delay) else - mem = cpu.spaces[space] - end - if not mem then - error(space .. " space not found") + local cpu, mem; + local cputag, space, offs, len, chk_st, chk_ed, fill = string.match(line, '^@([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),?(%x?%x?)'); + cpu = manager:machine().devices[cputag]; + if not cpu then + error(cputag .. " device not found") + end + local rgnname, rgntype = space:match("([^/]*)/?([^/]*)") + if rgntype == "share" then + mem = manager:machine():memory().shares[rgnname] + else + mem = cpu.spaces[space] + end + if not mem then + error(space .. " space not found") + end + _table[ #_table + 1 ] = { + mem = mem, + addr = tonumber(offs, 16), + size = tonumber(len, 16), + c_start = tonumber(chk_st, 16), + c_end = tonumber(chk_ed, 16), + fill = tonumber(fill, 16) + }; end - _table[ #_table + 1 ] = { - mem = mem, - addr = tonumber(offs, 16), - size = tonumber(len, 16), - c_start = tonumber(chk_st, 16), - c_end = tonumber(chk_ed, 16), - fill = tonumber(fill, 16) - }; 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 <= emu.time()) and check_mem( positions ) then default_checksum = check_scores( positions ); if read_scores( positions ) then emu.print_verbose( "hiscore: scores read OK" ); |