|
| 1 | +-- The Legend of Zelda - Twilight Princess Wii (NTSC v1.0) |
| 2 | + |
| 3 | +local core = require("games.core") |
| 4 | + |
| 5 | +local game = { |
| 6 | + memorymap = {} |
| 7 | +} |
| 8 | + |
| 9 | +local controllers = { |
| 10 | + [1] = 0x804C2F08 + 0xC * 0, |
| 11 | + [2] = 0x804C2F08 + 0xC * 1, |
| 12 | + [3] = 0x804C2F08 + 0xC * 2, |
| 13 | + [4] = 0x804C2F08 + 0xC * 3, |
| 14 | +} |
| 15 | + |
| 16 | +local controller_struct = { |
| 17 | + [0x0] = { type = "short", name = "controller.%d.buttons.pressed" }, |
| 18 | + [0x2] = { type = "sbyte", name = "controller.%d.joystick.x" }, |
| 19 | + [0x3] = { type = "sbyte", name = "controller.%d.joystick.y" }, |
| 20 | + [0x4] = { type = "sbyte", name = "controller.%d.cstick.x" }, |
| 21 | + [0x5] = { type = "sbyte", name = "controller.%d.cstick.y" }, |
| 22 | + [0x6] = { type = "byte", name = "controller.%d.analog.l" }, |
| 23 | + [0x7] = { type = "byte", name = "controller.%d.analog.r" }, |
| 24 | + [0xA] = { type = "byte", name = "controller.%d.plugged" }, |
| 25 | +} |
| 26 | + |
| 27 | +for port, address in ipairs(controllers) do |
| 28 | + for offset, info in pairs(controller_struct) do |
| 29 | + game.memorymap[address + offset] = { |
| 30 | + type = info.type, |
| 31 | + debug = info.debug, |
| 32 | + name = info.name:format(port), |
| 33 | + } |
| 34 | + end |
| 35 | +end |
| 36 | + |
| 37 | +game.translateAxis = core.translateAxis |
| 38 | +game.translateTriggers = core.translateTriggers |
| 39 | + |
| 40 | +return game |
0 commit comments