fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
7277dd1
main
1-- Mario Kart Wii (NTSC-U, v1.0) (Issue #17) 2 3-- Code based on RSBE01-2.lua 4 5local core =require ( "games.core" ) 6 7local game =core . newGame () 8 9local ptr_addr =0x809B8F4C --> addr + 0x08 -> addr + 0x0A -> the controller structs 10local ctrl_offset =0xB0 11 12local controllers ={ -- TODO: fix port issues 13ctrl_offset * 0 , 14ctrl_offset * 1 , 15ctrl_offset * 2 , 16ctrl_offset * 3 , 17} 18 19local controller_struct ={ 20[ 0x00 ] ={ type ="short" , name ="%d.buttons.pressed" } , 21[ 0x02 ] ={ type ="float" , name ="%d.joystick.x" } , 22[ 0x06 ] ={ type ="float" , name ="%d.joystick.y" } , 23[ 0x96 ] ={ type ="float" , name ="%d.cstick.x" } , 24[ 0x9A ] ={ type ="float" , name ="%d.cstick.y" } , 25[ 0x8C ] ={ type ="byte" , name ="%d.analog.l" } , 26[ 0x8D ] ={ type ="byte" , name ="%d.analog.r" } , 27[ 0x90 ] ={ type ="byte" , name ="%d.plugged" } , 28} 29 30game . memorymap [ ptr_addr ] ={ 31type ="pointer" ; 32name ="controller" ; 33struct ={ 34[ 0x08 ] ={ 35type ="pointer" ; 36struct ={} 37} 38} 39} 40 41local ptr_offset =0x0A 42local controller_ptr =game . memorymap [ ptr_addr ]. struct [ 0x08 ]. struct 43 44for port , address in ipairs ( controllers ) do 45for offset , info in pairs ( controller_struct ) do 46controller_ptr [ ptr_offset + address + offset ] ={ 47type =info . type ; 48debug =info . debug ; 49name =info . name : format ( port ); 50} 51end 52end 53 54game . translateJoyStick =function ( x , y ) return x , y end 55game . translateCStick =function ( x , y ) return x , y end 56 57return game