plugins/hiscore: add optional value to prefill for software that clears ram and add examples (nw)

This commit is contained in:
cracyc 2016-07-08 09:49:03 -05:00
parent 3f9bcd8286
commit 45de5e113e
2 changed files with 21 additions and 3 deletions

View File

@ -6297,6 +6297,12 @@ gaunt2:
@:maincpu,program,904DE8,C8,00,E3 @:maincpu,program,904DE8,C8,00,E3
;@s:gb.cpp
gameboy,tetris:
@:maincpu,program,d654,32,0,0,ff
;@s:gberet.cpp ;@s:gberet.cpp
gberet: gberet:
@ -9552,6 +9558,12 @@ sonicwi2:
@:maincpu,program,10000e,52,48,03 @:maincpu,program,10000e,52,48,03
;@s:nes.cpp
nes,smb:
@:maincpu,program,7df,4,0,0,ff
;@s:news.cpp ;@s:news.cpp
;newsa:******News (set 2) ;newsa:******News (set 2)
@ -17175,5 +17187,3 @@ percuss:
;Moguchan (by GeoMan) ;Moguchan (by GeoMan)
moguchan: moguchan:
@:maincpu,program,5eda,6,0,0 @:maincpu,program,5eda,6,0,0

View File

@ -38,7 +38,7 @@ function hiscore.startplugin()
local _table = {}; local _table = {};
for line in string.gmatch(dsting, '([^\n]+)') do for line in string.gmatch(dsting, '([^\n]+)') do
local cpu, mem; local cpu, mem;
cputag, space, offs, len, chk_st, chk_ed = string.match(line, '^@([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)'); cputag, space, offs, len, chk_st, chk_ed, fill = string.match(line, '^@([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),?(%x?%x?)');
cpu = manager:machine().devices[cputag]; cpu = manager:machine().devices[cputag];
if not cpu then if not cpu then
emu.print_verbose("hiscore: " .. cputag .. " device not found") emu.print_verbose("hiscore: " .. cputag .. " device not found")
@ -55,6 +55,7 @@ function hiscore.startplugin()
size = tonumber(len, 16), size = tonumber(len, 16),
c_start = tonumber(chk_st, 16), c_start = tonumber(chk_st, 16),
c_end = tonumber(chk_ed, 16), c_end = tonumber(chk_ed, 16),
fill = tonumber(fill, 16)
}; };
end end
return _table; return _table;
@ -254,6 +255,13 @@ function hiscore.startplugin()
emu.print_error("hiscore: hiscore.dat parse error"); emu.print_error("hiscore: hiscore.dat parse error");
return; return;
end end
for i, row in pairs(positions) do
if row.fill then
for i=0,row["size"]-1 do
row["mem"]:write_u8(row["addr"] + i, row.fill)
end
end
end
found_hiscore_entry = true found_hiscore_entry = true
end end
end) end)