mirror of
https://github.com/holub/mame
synced 2025-10-04 08:28:39 +03:00
plugins/cheat: add game time for cheats which want a time delay (nw)
This commit is contained in:
parent
3c774adb53
commit
94007d2887
@ -66,6 +66,7 @@ function cheat.startplugin()
|
||||
local cheats = {}
|
||||
local output = {}
|
||||
local line = 0
|
||||
local start_time = 0
|
||||
|
||||
local function load_cheats()
|
||||
local filename = emu.romname()
|
||||
@ -146,6 +147,11 @@ function cheat.startplugin()
|
||||
return result
|
||||
end
|
||||
|
||||
local function time()
|
||||
return emu.time() - start_time
|
||||
end
|
||||
|
||||
|
||||
local function parse_cheat(cheat)
|
||||
cheat.cheat_env = { draw_text = draw_text,
|
||||
draw_line = draw_line,
|
||||
@ -154,6 +160,7 @@ function cheat.startplugin()
|
||||
frombcd = frombcd,
|
||||
pairs = pairs,
|
||||
ipairs = ipairs,
|
||||
time = time,
|
||||
table =
|
||||
{ insert = table.insert,
|
||||
remove = table.remove } }
|
||||
@ -422,6 +429,7 @@ function cheat.startplugin()
|
||||
end, "Cheat")
|
||||
|
||||
emu.register_start(function()
|
||||
start_time = emu.time()
|
||||
cheats = load_cheats()
|
||||
for num, cheat in pairs(cheats) do
|
||||
parse_cheat(cheat)
|
||||
|
Loading…
Reference in New Issue
Block a user