fork/m-overlay

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

BkacjiosUpdated a bunch of joystick translations to match games x/y values between -1 and 17277dd1

v2.1.1b
1.1 KiB44 linesraw
1-- Mario Party 4 (NTSC v1.1)
2
3local core = require("games.core")
4
5local game = core.newGame()
6
7local addr = 0x801D3A9C
8
9local controllers = {
10	[1] = addr,
11	[2] = addr + 1,
12	[3] = addr + 2,
13	[4] = addr + 3,
14}
15
16local controller_struct = {
17	-- [0x00] = { type = "short",	name = "controller.%d.buttons.pressed" },
18	[40] = { type = "sbyte",	name = "controller.%d.joystick.x" },
19	[36] = { type = "sbyte",	name = "controller.%d.joystick.y" },
20	[32] = { type = "sbyte",	name = "controller.%d.cstick.x" },
21	[28] = { type = "sbyte",	name = "controller.%d.cstick.y" },
22	[24] = { type = "byte",	    name = "controller.%d.analog.l" },
23	[20] = { type = "byte", 	name = "controller.%d.analog.r" },
24	[8] = { type = "u8",		name = "controller.%d.plugged" },
25}
26
27for port in ipairs(controllers) do
28    game.memorymap[controllers[1] + (port - 1) * 2] = {
29        type = "short",
30        name = ("controller.%d.buttons.pressed"):format(port),
31    }
32end
33
34for port, address in ipairs(controllers) do
35	for offset, info in pairs(controller_struct) do
36		game.memorymap[address + offset] = {
37			type = info.type,
38			debug = info.debug,
39			name = info.name:format(port),
40		}
41	end
42end
43
44return game