Skip to content

Commit

Permalink
Added support for Mario Golf - Toadstool Tour (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkacjios committed Mar 26, 2022
1 parent 24e7d89 commit 3417cef
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions source/modules/games/GFTE01-0.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
-- Mario Golf - Toadstool Tour (NTSC-U v1.0)

local core = require("games.core")

local game = core.newGame()

local controllers = {
[1] = 0x8026BB60 + 0x38 * 0,
[2] = 0x8026BB60 + 0x38 * 1,
[3] = 0x8026BB60 + 0x38 * 2,
[4] = 0x8026BB60 + 0x38 * 3,
}

local controller_struct = {
[0x00] = { type = "u16", name = "controller.%d.buttons.pressed" },
[0x02] = { type = "u16", name = "controller.%d.buttons.pressed_previous" },
[0x04] = { type = "u16", name = "controller.%d.buttons.instant" },
[0x06] = { type = "u16", name = "controller.%d.buttons.released" },
[0x1B] = { type = "u8", name = "controller.%d.analog.byte.l" },
[0x1C] = { type = "u8", name = "controller.%d.analog.byte.r" },
[0x1D] = { type = "u8", name = "controller.%d.plugged" },
[0x20] = { type = "float", name = "controller.%d.joystick.x" },
[0x24] = { type = "float", name = "controller.%d.joystick.y" },
[0x28] = { type = "float", name = "controller.%d.cstick.x" },
[0x2C] = { type = "float", name = "controller.%d.cstick.y" },
[0x30] = { type = "float", name = "controller.%d.analog.l" },
[0x34] = { type = "float", name = "controller.%d.analog.r" },
}

for port, address in ipairs(controllers) do
for offset, info in pairs(controller_struct) do
game.memorymap[address + offset] = {
type = info.type,
debug = info.debug,
name = info.name:format(port),
}
end
end

game.translateJoyStick = function(x, y) return x, y end
game.translateCStick = function(x, y) return x, y end
game.translateTriggers = function(l, r) return l, r end

return game

0 comments on commit 3417cef

Please sign in to comment.