|
| 1 | +-- Kirby's Airride (NTSC-J v1.0) |
| 2 | + |
| 3 | +local game = { |
| 4 | + memorymap = {} |
| 5 | +} |
| 6 | + |
| 7 | +local addr = 0x80585B64 |
| 8 | +local off = 0x44 |
| 9 | + |
| 10 | +local controllers = { |
| 11 | + [1] = addr + off * 0, |
| 12 | + [2] = addr + off * 1, |
| 13 | + [3] = addr + off * 2, |
| 14 | + [4] = addr + off * 3, |
| 15 | +} |
| 16 | + |
| 17 | +-- Notably similar addresses to Melee, which makes sense since both games are made by HAL. |
| 18 | +local controller_struct = { |
| 19 | + [0x00] = { type = "int", name = "controller.%d.buttons.pressed" }, |
| 20 | + [0x20] = { type = "float", name = "controller.%d.joystick.x" }, |
| 21 | + [0x24] = { type = "float", name = "controller.%d.joystick.y" }, |
| 22 | + [0x28] = { type = "float", name = "controller.%d.cstick.x" }, |
| 23 | + [0x2C] = { type = "float", name = "controller.%d.cstick.y" }, |
| 24 | + [0x30] = { type = "float", name = "controller.%d.analog.l" }, |
| 25 | + [0x34] = { type = "float", name = "controller.%d.analog.r" }, |
| 26 | + [0x41] = { type = "byte", name = "controller.%d.plugged" }, |
| 27 | + |
| 28 | + -- A note about plugged: |
| 29 | + -- Byte 0x41 of each controller is set from 0x00 to 0x01 only after the |
| 30 | + -- controller has been plugged in or the game was started with the |
| 31 | + -- controller plugged in, however, the overlay does not seem to |
| 32 | + -- detect this behavior, therefore showing all controllers regardless |
| 33 | + -- of memory status as unplugged. |
| 34 | + |
| 35 | + -- Melee has a similar issue, but instead of setting byte 0x41 to 0x01, |
| 36 | + -- it starts as 0xFF and gets set to 0x00. |
| 37 | + |
| 38 | + -- I've fixed this issue by detecting whether or not the current game is |
| 39 | + -- Kirby Air Ride and changing the number to compare against from 0x00 to |
| 40 | + -- 0x01 for Kirby Air Ride only. |
| 41 | +} |
| 42 | + |
| 43 | +for port, address in ipairs(controllers) do |
| 44 | + for offset, info in pairs(controller_struct) do |
| 45 | + game.memorymap[address + offset] = { |
| 46 | + type = info.type, |
| 47 | + debug = info.debug, |
| 48 | + name = info.name:format(port), |
| 49 | + } |
| 50 | + end |
| 51 | +end |
| 52 | + |
| 53 | +game.translateAxis = function(x, y) return x, y end |
| 54 | +game.translateTriggers = function(l, r) return l, r end |
| 55 | + |
| 56 | +return game |
0 commit comments