Mesen-X/GUI.NET/Dependencies/LuaScripts/ReverseMode.lua
Jeremy Chadwick a891307efc Debugger: Clean up Lua examples (#627)
- Remove extraneous semi-colons
- Remove spaces after opening paren on functions
- Remove trailing spaces on lines
- Add newlines as last byte of file where applicable
2019-05-22 20:09:27 -04:00

24 lines
670 B
Lua

-----------------------
-- Name: Reverse Mode
-- Author: upsilandre
-----------------------
-- Flips the game screen horizontally and inverts the left & right buttons
-- on the controller, allowing you to play through games in reverse.
-----------------------
bufferO = {}
function Main()
input = emu.getInput(0)
input.left, input.right = input.right, input.left
emu.setInput(0, input)
bufferI = emu.getScreenBuffer()
for y = 0, 239 do
for x = 0, 255 do
bufferO[y*256 + x] = bufferI[y*256 + 255 - x]
end
end
emu.setScreenBuffer(bufferO)
end
emu.addEventCallback(Main, emu.eventType.inputPolled)
emu.displayMessage("Script", "Reverse Mode")