fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
7277dd1
master
1-- Super Monkey Ball 2 (NTSC v1.0) 2 3local core =require ( "games.core" ) 4 5local game =core . newGame () 6 7local controllers ={ 8[ 1 ] =0x80145210 + 0x3C * 0 , 9[ 2 ] =0x80145210 + 0x3C * 1 , 10[ 3 ] =0x80145210 + 0x3C * 2 , 11[ 4 ] =0x80145210 + 0x3C * 3 , 12} 13 14local controller_struct ={ 15[ 0x0 ] ={ type ="short" , name ="controller.%d.buttons.pressed" } , 16[ 0x2 ] ={ type ="sbyte" , name ="controller.%d.joystick.x" } , 17[ 0x3 ] ={ type ="sbyte" , name ="controller.%d.joystick.y" } , 18[ 0x4 ] ={ type ="sbyte" , name ="controller.%d.cstick.x" } , 19[ 0x5 ] ={ type ="sbyte" , name ="controller.%d.cstick.y" } , 20[ 0x6 ] ={ type ="byte" , name ="controller.%d.analog.l" } , 21[ 0x7 ] ={ type ="byte" , name ="controller.%d.analog.r" } , 22[ 0xA ] ={ type ="byte" , name ="controller.%d.plugged" } , 23} 24 25for port , address in ipairs ( controllers ) do 26for offset , info in pairs ( controller_struct ) do 27game . memorymap [ address + offset ] ={ 28type =info . type , 29debug =info . debug , 30name =info . name : format ( port ), 31} 32end 33end 34 35function game . translateJoyStick ( x , y ) 36x =x / 100 37y =y / 100 38return x , y 39end 40 41game . translateCStick =game . translateJoyStick 42 43local min =math . min 44 45function game . translateTriggers ( l , r ) 46return min ( 1 , l / 125 ), min ( 1 , r / 125 ) 47end 48 49return game