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.6
1.5 KiB58 linesraw
1-- Mario Party 7 (NTSC v1.1)
2
3-- similar to MP6: this game also straight up doesn't use the d-pad
4
5local core = require("games.core")
6
7local game = core.newGame()
8
9local addr = 0x802F2C90
10
11local controllers = {
12	[1] = addr,
13	[2] = addr + 1,
14	[3] = addr + 2,
15	[4] = addr + 3,
16}
17
18local controller_struct = {
19	-- [0x00] = { type = "short",	name = "controller.%d.buttons.pressed" },
20	[44] = { type = "sbyte",	name = "controller.%d.joystick.x" },
21	[40] = { type = "sbyte",	name = "controller.%d.joystick.y" },
22	[36] = { type = "sbyte",	name = "controller.%d.cstick.x" },
23	[32] = { type = "sbyte",	name = "controller.%d.cstick.y" },
24	[28] = { type = "byte",	    name = "controller.%d.analog.l" },
25	[24] = { type = "byte", 	name = "controller.%d.analog.r" },
26	[8] = { type = "u8",		name = "controller.%d.plugged" }, -- similar to melee, where plugging in a controller sets a byte to 00 and unplugging does nothing
27}
28
29for port in ipairs(controllers) do
30    game.memorymap[controllers[1] + (port - 1) * 2] = {
31        type = "short",
32        name = ("controller.%d.buttons.pressed"):format(port),
33    }
34end
35
36for port, address in ipairs(controllers) do
37	for offset, info in pairs(controller_struct) do
38		game.memorymap[address + offset] = {
39			type = info.type,
40			debug = info.debug,
41			name = info.name:format(port),
42		}
43	end
44end
45
46function game.translateJoyStick(x, y)
47	x = x/56
48	y = y/56
49	return x, y
50end
51
52function game.translateCStick(x, y)
53	x = x/44
54	y = y/44
55	return x, y
56end
57
58return game