diff options
| author | 2016-04-13 11:40:06 -0500 | |
|---|---|---|
| committer | 2016-04-13 11:40:06 -0500 | |
| commit | 94007d2887aab45dfa0c5fa2b511834db85946ab (patch) | |
| tree | 94fa02b313fd6dfbabde5d037aa7d57a5d21348a /plugins/cheat/init.lua | |
| parent | 3c774adb53b45141b477dac3885764bf57fb231b (diff) | |
plugins/cheat: add game time for cheats which want a time delay (nw)
Diffstat (limited to 'plugins/cheat/init.lua')
| -rw-r--r-- | plugins/cheat/init.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/cheat/init.lua b/plugins/cheat/init.lua index 86d36af052e..8d1b542593b 100644 --- a/plugins/cheat/init.lua +++ b/plugins/cheat/init.lua @@ -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) |
