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.1
1.5 KiB52 linesraw
1-- The Legend of Zelda: Collectors Edition (NTSC-U v1.0)
2
3local core = require("games.core")
4
5local controllerLocations = { -- these could be pointers, i'm not sure yet
6	menu = 0x801337B8,
7	oot = 0x80134C58,
8	mm = 0x8013E1B8,
9	z1 = 0x800AAF60,
10	z2 = 0x800CA6A0,
11}
12
13local game = core.newGame()
14
15game.memorymap = {
16	[0x80BDA3CB] = { type = "u8", name = "oot.ucode" },
17	[0x80CB033B] = { type = "u8", name = "mm.ucode" },
18	[0x80080644] = { type = "u8", name = "z1.qfc"},
19	[0x800A0544] = { type = "u8", name = "z2.qfc"},
20}
21
22for gamename, addr in pairs(controllerLocations) do
23	local controllers = {
24		[1] = addr + 0xC * 0,
25		[2] = addr + 0xC * 1,
26		[3] = addr + 0xC * 2,
27		[4] = addr + 0xC * 3,
28	}
29
30	local controller_struct = {
31		[0x0] = { type = "short",	name = "controller.%s.%d.buttons.pressed" },
32		[0x2] = { type = "sbyte",	name = "controller.%s.%d.joystick.x" },
33		[0x3] = { type = "sbyte",	name = "controller.%s.%d.joystick.y" },
34		[0x4] = { type = "sbyte",	name = "controller.%s.%d.cstick.x" },
35		[0x5] = { type = "sbyte",	name = "controller.%s.%d.cstick.y" },
36		[0x6] = { type = "byte",	name = "controller.%s.%d.analog.l" },
37		[0x7] = { type = "byte",	name = "controller.%s.%d.analog.r" },
38		[0xA] = { type = "byte",	name = "controller.%s.%d.plugged" },
39	}
40
41	for port, address in ipairs(controllers) do
42		for offset, info in pairs(controller_struct) do
43			game.memorymap[address + offset] = {
44				type = info.type,
45				debug = info.debug,
46				name = info.name:format(gamename, port),
47			}
48		end
49	end
50end
51
52return game