This is what I've got so far:
-- license:BSD-3-Clause
-- copyright-holders:Radek Dutkiewicz
local exports = {}
exports.name = "inputlag"
exports.version = "1.0.0"
exports.description = "Input Lag Test"
exports.license = "The BSD 3-Clause License"
exports.author = { name = "Radek Dutkiewicz" }
local inputlag = exports
function inputlag.startplugin()
local scr = {}
local inp = {}
local pressed = false
local function draw_square()
local pressed = inp:code_pressed(inp:code_from_token("KEYCODE_LEFT"))
if pressed then
scr:draw_box(0, 0, scr:width() / 8, scr:height() / 8, 0xff000000, 0);
scr:draw_box(0, 0, scr:width() / 16, scr:height() / 16, 0xffffffff, 0);
else
scr:draw_box(0, 0, scr:width() / 8, scr:height() / 8, 0xff000000, 0);
end
end
emu.register_start(function()
scr = manager:machine().screens[":screen"]
inp = manager:machine():input()
emu.register_frame_done(draw_square)
end)
end
return exports
It's working, but I'm pretty sure I'm not getting the input of the game's core with any potential delays, just raw Mame engine's input. Also framedelay 1-9 isn't doing anything.
LUA isn't that bad, but I have to emphasise, documentation of the functions exposed by Mame for LUA is almost non existent.