fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
7277dd1
v2.1.5
1-- Kirby's Airride (NTSC-J v1.0) 2 3local core =require ( "games.core" ) 4 5local game =core . newGame () 6 7local addr =0x80585B64 8local off =0x44 9 10local 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. 18local 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 43for port , address in ipairs ( controllers ) do 44for offset , info in pairs ( controller_struct ) do 45game . memorymap [ address + offset ] ={ 46type =info . type , 47debug =info . debug , 48name =info . name : format ( port ), 49} 50end 51end 52 53game . translateJoyStick =function ( x , y ) return x , y end 54game . translateCStick =function ( x , y ) return x , y end 55game . translateTriggers =function ( l , r ) return l , r end 56 57game . pluggedValue =0x01 -- value the game sets the controller.plugged byte to 58 59return game