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 cheats = {}
|
||||||
local output = {}
|
local output = {}
|
||||||
local line = 0
|
local line = 0
|
||||||
|
local start_time = 0
|
||||||
|
|
||||||
local function load_cheats()
|
local function load_cheats()
|
||||||
local filename = emu.romname()
|
local filename = emu.romname()
|
||||||
@ -146,6 +147,11 @@ function cheat.startplugin()
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function time()
|
||||||
|
return emu.time() - start_time
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local function parse_cheat(cheat)
|
local function parse_cheat(cheat)
|
||||||
cheat.cheat_env = { draw_text = draw_text,
|
cheat.cheat_env = { draw_text = draw_text,
|
||||||
draw_line = draw_line,
|
draw_line = draw_line,
|
||||||
@ -154,6 +160,7 @@ function cheat.startplugin()
|
|||||||
frombcd = frombcd,
|
frombcd = frombcd,
|
||||||
pairs = pairs,
|
pairs = pairs,
|
||||||
ipairs = ipairs,
|
ipairs = ipairs,
|
||||||
|
time = time,
|
||||||
table =
|
table =
|
||||||
{ insert = table.insert,
|
{ insert = table.insert,
|
||||||
remove = table.remove } }
|
remove = table.remove } }
|
||||||
@ -422,6 +429,7 @@ function cheat.startplugin()
|
|||||||
end, "Cheat")
|
end, "Cheat")
|
||||||
|
|
||||||
emu.register_start(function()
|
emu.register_start(function()
|
||||||
|
start_time = emu.time()
|
||||||
cheats = load_cheats()
|
cheats = load_cheats()
|
||||||
for num, cheat in pairs(cheats) do
|
for num, cheat in pairs(cheats) do
|
||||||
parse_cheat(cheat)
|
parse_cheat(cheat)
|
||||||
|
Loading…
Reference in New Issue
Block a user