fork/m-overlay

git clone https://git.julia.blue/fork/m-overlay

blackops7799I lost track of what I'm even doing lola7d6bcc

GUI
811 B41 linesraw
1local PANEL = {}
2
3local memory = require("memory.watcher")
4
5local BUTTONS = {
6	NONE		= 0x0000,
7	DPAD_LEFT	= 0x0001,
8	DPAD_RIGHT	= 0x0002,
9	DPAD_DOWN	= 0x0004,
10	DPAD_UP		= 0x0008,
11	Z			= 0x0010,
12	R			= 0x0020,
13	L			= 0x0040,
14	A			= 0x0100,
15	B			= 0x0200,
16	X			= 0x0400,
17	Y			= 0x0800,
18	START		= 0x1000,
19}
20
21function PANEL:Initialize()
22	self:super()
23
24	self:MakeAccessor("Port", "m_iPort", 0)
25	self:MakeAccessor("Button", "m_sButton", "NONE")
26end
27
28function PANEL:IsButtonPressed()
29	local controller = memory.controller[self.m_iPort]
30	local button = BUTTONS[self.m_sButton:upper()]
31
32	if not button or not controller then return false end
33
34	if controller.plugged ~= 0xFF and bit.band(controller.buttons.pressed, button) == button then
35		return true
36	end
37
38	return false
39end
40
41gui.register("InputButton", PANEL, "Panel")