1
+ -- Mario Golf - Toadstool Tour (JP v1.0)
2
+
3
+ local core = require (" games.core" )
4
+
5
+ local game = core .newGame ()
6
+
7
+ local controllers = {
8
+ [1 ] = 0x8026EF60 + 0x38 * 0 ,
9
+ [2 ] = 0x8026EF60 + 0x38 * 1 ,
10
+ [3 ] = 0x8026EF60 + 0x38 * 2 ,
11
+ [4 ] = 0x8026EF60 + 0x38 * 3 ,
12
+ }
13
+
14
+ local controller_struct = {
15
+ [0x00 ] = { type = " u16" , name = " controller.%d.buttons.pressed" },
16
+ [0x02 ] = { type = " u16" , name = " controller.%d.buttons.pressed_previous" },
17
+ [0x04 ] = { type = " u16" , name = " controller.%d.buttons.instant" },
18
+ [0x06 ] = { type = " u16" , name = " controller.%d.buttons.released" },
19
+ [0x1B ] = { type = " u8" , name = " controller.%d.analog.byte.l" },
20
+ [0x1C ] = { type = " u8" , name = " controller.%d.analog.byte.r" },
21
+ [0x1D ] = { type = " u8" , name = " controller.%d.plugged" },
22
+ [0x20 ] = { type = " float" , name = " controller.%d.joystick.x" },
23
+ [0x24 ] = { type = " float" , name = " controller.%d.joystick.y" },
24
+ [0x28 ] = { type = " float" , name = " controller.%d.cstick.x" },
25
+ [0x2C ] = { type = " float" , name = " controller.%d.cstick.y" },
26
+ [0x30 ] = { type = " float" , name = " controller.%d.analog.l" },
27
+ [0x34 ] = { type = " float" , name = " controller.%d.analog.r" },
28
+ }
29
+
30
+ for 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
38
+ end
39
+
40
+ game .translateJoyStick = function (x , y ) return x , y end
41
+ game .translateCStick = function (x , y ) return x , y end
42
+ game .translateTriggers = function (l , r ) return l , r end
43
+
44
+ return game
0 commit comments