mirror of
https://github.com/holub/mame
synced 2025-04-19 15:11:37 +03:00
luaengine: add software name getter (nw)
hiscore: add support for softlist rom hiscores (nw)
This commit is contained in:
parent
e424f4305d
commit
1e95b3b459
@ -9,6 +9,9 @@
|
||||
;This file can be edited with a text editor, but keep the same format:
|
||||
; all fields are separated by a comma (,)
|
||||
; <gamename>:
|
||||
; or
|
||||
; <gamename>,<softwarename>:
|
||||
; for machines with softlists
|
||||
; @<cputag>,<addressspace>,<address>,<length>,<value to wait for
|
||||
; in the first byte/word>,<value to wait for in the last byte/word>
|
||||
; [repeat the above as many times as necessary]
|
||||
@ -13965,3 +13968,6 @@ zodiack:
|
||||
@:maincpu,program,b35f,1,08,08
|
||||
@:maincpu,program,b37f,1,00,00
|
||||
@:maincpu,program,b39f,1,00,00
|
||||
|
||||
genesis,tf3:
|
||||
@:maincpu,program,fff2ac,4,00,90
|
||||
|
@ -64,7 +64,11 @@ function hiscore.startplugin()
|
||||
if not file then
|
||||
file = io.open( hiscore_plugin_path .. "/hiscore.dat", "r" );
|
||||
end
|
||||
rm_match = '^' .. emu.romname() .. ':';
|
||||
if emu.softname() ~= "" then
|
||||
rm_match = '^' .. emu.romname() .. ',' .. emu.softname() .. ':';
|
||||
else
|
||||
rm_match = '^' .. emu.romname() .. ':';
|
||||
end
|
||||
cluster = "";
|
||||
current_is_match = false;
|
||||
if file then
|
||||
@ -113,7 +117,11 @@ function hiscore.startplugin()
|
||||
|
||||
|
||||
function get_file_name ()
|
||||
r = hiscore_path .. '/' .. emu.romname() .. ".hi";
|
||||
if emu.softname() ~= "" then
|
||||
r = hiscore_path .. '/' .. emu.romname() .. "_" .. emu.softname() .. ".hi";
|
||||
else
|
||||
r = hiscore_path .. '/' .. emu.romname() .. ".hi";
|
||||
end
|
||||
return r;
|
||||
end
|
||||
|
||||
@ -225,19 +233,18 @@ function hiscore.startplugin()
|
||||
write_scores(positions)
|
||||
end
|
||||
end
|
||||
current_game = nil
|
||||
current_game = ""
|
||||
mem_check_passed = false
|
||||
scores_have_been_read = false;
|
||||
end
|
||||
|
||||
emu.register_start(function()
|
||||
print("Starting " .. emu.gamename())
|
||||
-- check if we've just soft reset
|
||||
if reset then
|
||||
reset()
|
||||
end
|
||||
-- reset() -- there's no way to reliably save scores after a soft reset currently
|
||||
current_game = emu.romname()
|
||||
dat = read_hiscore_dat()
|
||||
if dat then
|
||||
if dat and dat ~= "" then
|
||||
print( "found hiscore.dat entry for " .. emu.romname() );
|
||||
positions = parse_table( dat );
|
||||
if not positions then
|
||||
|
@ -244,6 +244,16 @@ int lua_engine::l_emu_romname(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// emu_softname - returns softlist name
|
||||
//-------------------------------------------------
|
||||
|
||||
int lua_engine::l_emu_softname(lua_State *L)
|
||||
{
|
||||
lua_pushstring(L, luaThis->machine().options().software_name());
|
||||
return 1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// emu_pause/emu_unpause - pause/unpause game
|
||||
//-------------------------------------------------
|
||||
@ -1418,6 +1428,7 @@ void lua_engine::initialize()
|
||||
.addCFunction ("app_version", l_emu_app_version )
|
||||
.addCFunction ("gamename", l_emu_gamename )
|
||||
.addCFunction ("romname", l_emu_romname )
|
||||
.addCFunction ("softname", l_emu_softname )
|
||||
.addCFunction ("keypost", l_emu_keypost )
|
||||
.addCFunction ("hook_output", l_emu_hook_output )
|
||||
.addCFunction ("sethook", l_emu_set_hook )
|
||||
|
@ -106,6 +106,7 @@ private:
|
||||
static int l_emu_time(lua_State *L);
|
||||
static int l_emu_gamename(lua_State *L);
|
||||
static int l_emu_romname(lua_State *L);
|
||||
static int l_emu_softname(lua_State *L);
|
||||
static int l_emu_keypost(lua_State *L);
|
||||
static int l_emu_hook_output(lua_State *L);
|
||||
static int l_emu_exit(lua_State *L);
|
||||
|
Loading…
Reference in New Issue
Block a user