fork/m-overlay

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

BkacjiosAdd support for Naruto - Gekitou Ninja Taisen! 4 (JP v1.0)661c706

settings-overhaul
1.3 KiB55 linesraw
1-- Naruto - Gekitou Ninja Taisen! 4 (JP v1.0)
2
3local core = require("games.core")
4
5local game = {
6	memorymap = {}
7}
8
9local polling_addresses = {
10	0x80222D40,
11	0x80222D74,
12	0x80222DA8,
13	0x80222DDC,
14	0x80222E10,
15}
16
17local controllers = {
18	[1] = 0x40 * 0,
19	[2] = 0x40 * 1,
20	[3] = 0x40 * 2,
21	[4] = 0x40 * 3,
22}
23
24local controller_struct = {
25	[0x0] = { type = "short",	name = "controller.%d.buttons.pressed" },
26	[0x2] = { type = "sbyte",	name = "controller.%d.joystick.x" },
27	[0x3] = { type = "sbyte",	name = "controller.%d.joystick.y" },
28	[0x4] = { type = "sbyte",	name = "controller.%d.cstick.x" },
29	[0x5] = { type = "sbyte",	name = "controller.%d.cstick.y" },
30	[0x6] = { type = "byte",	name = "controller.%d.analog.l" },
31	[0x7] = { type = "byte",	name = "controller.%d.analog.r" },
32	[0xA] = { type = "byte",	name = "controller.%d.plugged" },
33}
34
35for _, polling_addr in ipairs(polling_addresses) do
36	-- For every polling address..
37	for port, controller_addr in ipairs(controllers) do
38		-- For every controller 
39		for offset, info in pairs(controller_struct) do
40			game.memorymap[polling_addr + controller_addr + offset] = {
41				type = info.type,
42				debug = info.debug,
43				name = info.name:format(port),
44			}
45		end
46	end
47end
48
49function game.translateAxis(x, y)
50	return x/78, y/78
51end
52
53game.translateTriggers = core.translateTriggers
54
55return game