fork/m-overlay

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

BkacjiosUnified all HAL games to use same translation functions.3b32a06

v2.1.3
1.5 KiB44 linesraw
1-- Super Smash Bros. Melee (PAL)
2
3local core = require("games.core")
4
5local game = core.newGame()
6
7local controllers = {
8	[1] = 0x804B302C + 0x44 * 0,
9	[2] = 0x804B302C + 0x44 * 1,
10	[3] = 0x804B302C + 0x44 * 2,
11	[4] = 0x804B302C + 0x44 * 3,
12}
13
14local controller_struct = {
15	[0x00] = { type = "int",	name = "controller.%d.buttons.pressed" },
16	--[0x04] = { type = "int",	name = "controller.%d.buttons.pressed_previous" },
17	--[0x08] = { type = "int",	name = "controller.%d.buttons.instant" },
18	--[0x10] = { type = "int",	name = "controller.%d.buttons.released" },
19	--[0x1C] = { type = "byte",	name = "controller.%d.analog.byte.l" },
20	--[0x1D] = { type = "byte",	name = "controller.%d.analog.byte.r" },
21	[0x20] = { type = "float",	name = "controller.%d.joystick.x" },
22	[0x24] = { type = "float",	name = "controller.%d.joystick.y" },
23	[0x28] = { type = "float",	name = "controller.%d.cstick.x" },
24	[0x2C] = { type = "float",	name = "controller.%d.cstick.y" },
25	[0x30] = { type = "float",	name = "controller.%d.analog.l" },
26	[0x34] = { type = "float",	name = "controller.%d.analog.r" },
27	[0x41] = { type = "byte",	name = "controller.%d.plugged" },
28}
29
30for port, address in ipairs(controllers) do
31	for offset, info in pairs(controller_struct) do
32		game.memorymap[address + offset] = {
33			type = info.type,
34			debug = info.debug,
35			name = info.name:format(port),
36		}
37	end
38end
39
40game.translateJoyStick = function(x, y) return x, y end
41game.translateCStick = function(x, y) return x, y end
42game.translateTriggers = function(l, r) return l, r end
43
44return game