Files

31 lines
957 B
Lua

-- input.lua -- main.c's key map against injected keys. input.sh checks the
-- INPUT: line for the mapped byte sequence.
local dir = (debug.getinfo(1, "S").source:gsub("^@", ""):match("^(.*)/") or ".")
local H = dofile(dir .. "/harness.lua")
local INPUT_MARK = tonumber(os.getenv("INPUT_MARK") or "0x01A00000")
H.config{ tablet = "INPUT" }
H.sequence(3100, 20, {
{ ":lk401:K26", "A" },
{ ":lk401:K77", "Up" },
{ ":lk401:K76", "Down" },
{ ":lk401:K74", "Left" },
{ ":lk401:K75", "Right" },
{ ":lk401:K10", "0 )" },
{ ":lk401:K68", "Return" },
{ ":lk401:K67", "Delete" },
{ ":lk401:K13", "Q" },
{ ":lk401:K22", "P" },
})
H.result_dump(function()
local n = H.r32(INPUT_MARK + 0x40)
local t = {}
for i = 0, n - 1 do t[#t + 1] = string.format("%02X", H.r32(INPUT_MARK + (3 + i) * 0x20)) end
print(string.format("INPUT: magic=%08X updates=%d n=%d bytes=%s",
H.r32(INPUT_MARK), H.r32(INPUT_MARK + 0x20), n, table.concat(t, " ")))
end)
H.run()