fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
7277dd1
main
1-- Billy Hatcher and the Giant Egg (NTSC-U v1.0) 2 3local core =require ( "games.core" ) 4 5local game =core . newGame () 6 7local addr =0x80279822 8local off =0x40 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 17local controller_struct ={ 18[ 0x00 ] ={ type ="u16" , name ="controller.%d.buttons.pressed" } , 19[ 0x16 ] ={ type ="u16" , name ="controller.%d.analog.r" } , 20[ 0x18 ] ={ type ="u16" , name ="controller.%d.analog.l" } , 21[ 0x1A ] ={ type ="u16" , name ="controller.%d.joystick.x" } , 22[ 0x1C ] ={ type ="u16" , name ="controller.%d.joystick.y" } , 23[ 0x1E ] ={ type ="u16" , name ="controller.%d.cstick.x" } , 24[ 0x20 ] ={ type ="u16" , name ="controller.%d.cstick.y" } , 25[ 0x32 ] ={ type ="byte" , name ="controller.%d.plugged" } , 26} 27 28for port , address in ipairs ( controllers ) do 29for offset , info in pairs ( controller_struct ) do 30game . memorymap [ address + offset ] ={ 31type =info . type , 32debug =info . debug , 33name =info . name : format ( port ), 34} 35end 36end 37 38local function convertAxis ( a ) 39if a > 0xFF then 40a =a - 0xFFFF - 1 41end 42return a 43end 44 45game . translateJoyStick =function ( x , y ) 46x =convertAxis ( x ) 47y =convertAxis ( y ) 48return x / 100 , y / 100 49end 50 51game . translateCStick =function ( x , y ) 52x =convertAxis ( x ) 53y =convertAxis ( y ) 54return x / 44 , y / 44 55end 56 57game . translateTriggers =function ( l , r ) return l / 150 , r / 150 end 58 59return game