diff options
author | 2017-07-23 20:41:08 -0500 | |
---|---|---|
committer | 2017-07-23 20:41:08 -0500 | |
commit | 81079946a4e1308ec4c02f69e9aebc27ec4bb3d1 (patch) | |
tree | 3e1d9906808ace432f82536a46e3352e37bd0b4e /plugins/console/init.lua | |
parent | 90abd22229b3567c6c836c0bc40fa5facfbabd33 (diff) |
luaengine: debugger_manager support [Carl]
Diffstat (limited to 'plugins/console/init.lua')
-rw-r--r-- | plugins/console/init.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/console/init.lua b/plugins/console/init.lua index ba3ba7d6bd4..0c503adbaa5 100644 --- a/plugins/console/init.lua +++ b/plugins/console/init.lua @@ -16,6 +16,8 @@ function console.startplugin() local ln = require("linenoise") local preload = false local matches = {} + local lastindex = 0 + local consolebuf print(" _/ _/ _/_/ _/ _/ _/_/_/_/"); print(" _/_/ _/_/ _/ _/ _/_/ _/_/ _/ "); print(" _/ _/ _/ _/_/_/_/ _/ _/ _/ _/_/_/ "); @@ -197,7 +199,25 @@ return ln.linenoise('\x1b[1;36m[MAME]\x1b[0m> ') return "\x01" .. "-1" end + emu.register_start(function() + if not consolebuf and manager:machine():debugger() then + consolebuf = manager:machine():debugger().consolelog + lastindex = 0 + end + end) + + emu.register_stop(function() consolebuf = nil end) + emu.register_periodic(function() + if consolebuf and (#consolebuf > lastindex) then + local last = #consolebuf + print("\n") + while lastindex < last do + lastindex = lastindex + 1 + print(consolebuf[lastindex]) + end + ln.refresh() + end if conth.yield then conth:continue(get_completions(conth.result:match("([^\x01]*)\x01(.*)"))) return |