fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
f7324a4
settings-overhaul
1-- Super Smash Bros. Melee (NTSC v1.2) / Dairantou Smash Brothers DX (Japan v1.2) 2 3local game ={ 4memorymap ={} 5} 6 7-- Controls/Saves the volume levels of the game 8game . memorymap [ 0x8045C384 ] ={ type ="s8" , name ="volume.slider" } -- Scale is (-100 to 100) 9 10-- You can change these values in real time to change the volume, but when opening the sound menu, it will readjust to the slider value above 11game . memorymap [ 0x804D3887 ] ={ type ="u8" , name ="volume.music" } -- Scale is (0-127) 12game . memorymap [ 0x804D388F ] ={ type ="u8" , name ="volume.ui" } -- Scale is (0-127) 13 14game . memorymap [ 0x80479D60 ] ={ type ="u32" , name ="frame" } 15game . memorymap [ 0x8049E753 ] ={ type ="u8" , name ="stage" , debug =true } 16game . memorymap [ 0x80479D30 ] ={ type ="u8" , name ="menu.major" , debug =true } 17game . memorymap [ 0x80479D33 ] ={ type ="u8" , name ="menu.minor" , debug =true } 18game . memorymap [ 0x804D6598 ] ={ type ="u8" , name ="menu.player_one_port" , debug =true } -- What port is currently acting as "Player 1" in single player games 19game . memorymap [ 0x804807C8 ] ={ type ="bool" , name ="menu.teams" } 20 21game . memorymap [ 0x8066A2DF ] ={ type ="data" , len =7 , name ="romstring.akaneia" } 22game . memorymap [ 0x8066A2C3 ] ={ type ="data" , len =12 , name ="romstring.beyondmelee" } 23 24game . memorymap [ 0x804D5F90 ] ={ type ="u32" , name ="rng.seed" } 25 26local controllers ={ 27[ 1 ] =0x804C1FAC + 0x44 * 0 , 28[ 2 ] =0x804C1FAC + 0x44 * 1 , 29[ 3 ] =0x804C1FAC + 0x44 * 2 , 30[ 4 ] =0x804C1FAC + 0x44 * 3 , 31} 32 33local controller_struct ={ 34[ 0x00 ] ={ type ="u32" , name ="controller.%d.buttons.pressed" } , 35[ 0x04 ] ={ type ="u32" , name ="controller.%d.buttons.pressed_previous" } , 36[ 0x08 ] ={ type ="u32" , name ="controller.%d.buttons.instant" } , 37[ 0x10 ] ={ type ="u32" , name ="controller.%d.buttons.released" } , 38[ 0x1C ] ={ type ="u8" , name ="controller.%d.analog.byte.l" } , 39[ 0x1D ] ={ type ="u8" , name ="controller.%d.analog.byte.r" } , 40[ 0x20 ] ={ type ="float" , name ="controller.%d.joystick.x" } , 41[ 0x24 ] ={ type ="float" , name ="controller.%d.joystick.y" } , 42[ 0x28 ] ={ type ="float" , name ="controller.%d.cstick.x" } , 43[ 0x2C ] ={ type ="float" , name ="controller.%d.cstick.y" } , 44[ 0x30 ] ={ type ="float" , name ="controller.%d.analog.l" } , 45[ 0x34 ] ={ type ="float" , name ="controller.%d.analog.r" } , 46[ 0x41 ] ={ type ="u8" , name ="controller.%d.plugged" } , 47} 48 49for port , address in ipairs ( controllers ) do 50for offset , info in pairs ( controller_struct ) do 51game . memorymap [ address + offset ] ={ 52type =info . type , 53debug =info . debug , 54name =info . name : format ( port ), 55} 56end 57end 58 59local player_static_addresses ={ 600x80453080 , -- Player 1 610x80453F10 , -- Player 2 620x80454DA0 , -- Player 3 630x80455C30 , -- Player 4 640x80456AC0 , -- Player 5 650x80457950 , -- Player 6 66} 67 68local entity_pointer_offsets ={ 69[ 0xB0 ] ="entity" , 70[ 0xB4 ] ="partner" , -- Partner entity (For sheik/zelda/iceclimbers) 71} 72 73local player_static_struct ={ 74[ 0x004 ] ={ type ="u32" , name ="character" } , 75[ 0x008 ] ={ type ="u32" , name ="mode" } , 76[ 0x00C ] ={ type ="u16" , name ="transformed" } , 77[ 0x044 ] ={ type ="u8" , name ="skin" } , 78--[0x045] = { type = "u8", name = "port" }, 79[ 0x046 ] ={ type ="u8" , name ="color" } , 80[ 0x047 ] ={ type ="u8" , name ="team" } , 81--[0x048] = { type = "u8", name = "index" }, 82--[0x049] = { type = "u8", name = "cpu_level", debug = true }, 83--[0x04A] = { type = "u8", name = "cpu_type", debug = true }, -- 4 = 20XX, 22 = normalish, 19 = Alt Normal 84} 85 86for id , address in ipairs ( player_static_addresses ) do 87for offset , info in pairs ( player_static_struct ) do 88game . memorymap [ address + offset ] ={ 89type =info . type , 90debug =info . debug , 91name =( "player.%i.%s" ): format ( id , info . name ), 92} 93end 94 95for offset , name in pairs ( entity_pointer_offsets ) do 96game . memorymap [ address + offset ] ={ 97type ="pointer" , 98name =( "player.%i.%s" ): format ( id , name ), 99struct ={ 100[ 0x60 + 0x0004 ] ={ type ="u32" , name ="character" } , 101--[0x60 + 0x000C] = { type = "u8", name = "port" }, 102--[0x60 + 0x0618] = { type = "u8", name = "index" }, 103[ 0x60 + 0x0619 ] ={ type ="u8" , name ="skin" } , 104[ 0x60 + 0x061A ] ={ type ="u8" , name ="color" } , 105[ 0x60 + 0x061B ] ={ type ="u8" , name ="team" } , 106 107[ 0x60 + 0x0620 ] ={ type ="float" , name ="controller.joystick.x" } , 108[ 0x60 + 0x0624 ] ={ type ="float" , name ="controller.joystick.y" } , 109[ 0x60 + 0x0638 ] ={ type ="float" , name ="controller.cstick.x" } , 110[ 0x60 + 0x063C ] ={ type ="float" , name ="controller.cstick.y" } , 111[ 0x60 + 0x0650 ] ={ type ="float" , name ="controller.analog.float" } , 112[ 0x60 + 0x065C ] ={ type ="u32" , name ="controller.buttons.pressed" } , 113[ 0x60 + 0x0660 ] ={ type ="u32" , name ="controller.buttons.pressed_previous" } , 114 115--[[ 116[0x60 + 0x1A94] = { type = "u32", name = "cpu_type" }, 117[0x60 + 0x1A98] = { type = "u32", name = "cpu_level" }, 118]] 119} , 120} 121end 122end 123 124-- https://github.com/project-slippi/slippi-ssbm-asm/blob/9c36ffc5e4787c6caadfb12727c5fcff07d64642/Online/Online.s#L29 125local CSSDT_BUF_ADDR =0x80005614 126 127game . memorymap [ CSSDT_BUF_ADDR ] ={ 128type ="pointer" , 129name ="slippi" , 130struct ={ 131-- https://github.com/project-slippi/slippi-ssbm-asm/blob/9c36ffc5e4787c6caadfb12727c5fcff07d64642/Online/Online.s#L253 132[ 0x000 ] ={ 133type ="pointer" , 134--name = "slippi_ptr", 135struct ={ 136[ 0x00 ] ={ type ="u8" , name ="connection_state" } , 137[ 0x01 ] ={ type ="u8" , name ="local_player.ready" } , 138[ 0x02 ] ={ type ="u8" , name ="remote_player.ready" } , 139[ 0x03 ] ={ type ="u8" , name ="local_player.index" , debug =true } , 140[ 0x04 ] ={ type ="u8" , name ="remote_player.index" } , 141[ 0x05 ] ={ type ="u32" , name ="rng_offset" } , 142[ 0x09 ] ={ type ="u8" , name ="delay_frames" } , 143[ 0x0A ] ={ type ="u8" , name ="local_player.chatmsg_id" } , 144[ 0x0B ] ={ type ="u8" , name ="opponent.chatmsg_id" } , 145[ 0x0C ] ={ type ="u8" , name ="chatmsg.index" } , 146[ 0x0D ] ={ type ="u32" , name ="vs.left_names" } , 147[ 0x11 ] ={ type ="u32" , name ="vs.right_names" } , 148[ 0x15 ] ={ type ="data" , len =31 , name ="local_player.name" } , 149[ 0x34 ] ={ type ="data" , len =31 , name ="players.1.name" } , 150[ 0x53 ] ={ type ="data" , len =31 , name ="players.2.name" } , 151[ 0x72 ] ={ type ="data" , len =31 , name ="players.3.name" } , 152[ 0x91 ] ={ type ="data" , len =31 , name ="players.4.name" } , 153[ 0xB0 ] ={ type ="data" , len =63 , name ="opponent.name" } , 154[ 0xEF ] ={ type ="data" , len =10 , name ="players.1.code" } , 155[ 0xF9 ] ={ type ="data" , len =10 , name ="players.2.code" } , 156[ 0x103 ] ={ type ="data" , len =10 , name ="players.3.code" } , 157[ 0x10D ] ={ type ="data" , len =10 , name ="players.4.code" } , 158[ 0x117 ] ={ type ="data" , len =241 , name ="error_msg" } , 159} 160} , 161} 162} 163 164-- https://github.com/project-slippi/slippi-ssbm-asm/blob/9c36ffc5e4787c6caadfb12727c5fcff07d64642/Online/Online.s#L10 165local ONLINE_BUF_ADDR =0x804D6CBC 166 167game . memorymap [ ONLINE_BUF_ADDR ] ={ 168type ="pointer" , 169name ="online" , 170struct ={ 171-- https://github.com/project-slippi/slippi-ssbm-asm/blob/9c36ffc5e4787c6caadfb12727c5fcff07d64642/Online/Online.s#L182-L225 172[ 0x07 ] ={ type ="u32" , name ="rng_offset" } 173} 174} 175 176-- Where character ID's are stored in the CSS menu 177local player_select_external_addresses ={ 1780x8043208B , 1790x80432093 , 1800x8043209B , 1810x804320A3 , 182} 183 184local player_select_external ={ 185[ 0x04 ] ="character" , 186[ 0x05 ] ="skin" , 187} 188 189for id , address in ipairs ( player_select_external_addresses ) do 190for offset , name in pairs ( player_select_external ) do 191game . memorymap [ address + offset ] ={ 192type ="u8" , 193name =( "player.%i.select.%s" ): format ( id , name ), 194} 195end 196end 197 198local player_card_addresses ={ 1990x803F0E06 , 2000x803F0E2A , 2010x803F0E4E , 2020x803F0E72 , 203} 204 205local player_card ={ 206[ 0x00 ] ="team" , 207[ 0x01 ] ="mode" , 208--[0x02] = "mode", -- Duplicate? 209[ 0x03 ] ="skin" , 210[ 0x04 ] ="character" , 211[ 0x05 ] ="hovered" , 212} 213 214for id , address in ipairs ( player_card_addresses ) do 215for offset , name in pairs ( player_card ) do 216game . memorymap [ address + offset ] ={ 217type ="byte" , 218name =( "player.%i.card.%s" ): format ( id , name ), 219} 220end 221end 222 223local startmatch_addr =0x80480530 224 225local startmatch_struct ={ 226[ 0x00 ] ={ type ="u8" , name ="match.flags.game" } , 227[ 0x01 ] ={ type ="u8" , name ="match.flags.friendlyfire" } , 228[ 0x02 ] ={ type ="u8" , name ="match.flags.other" } , 229[ 0x07 ] ={ type ="bool" , name ="match.bombrain" } , 230[ 0x08 ] ={ type ="bool" , name ="match.teams" } , 231[ 0x0B ] ={ type ="s8" , name ="match.settings.item_frequency" } , 232[ 0x0C ] ={ type ="s8" , name ="match.settings.self_destruct" } , 233[ 0x0E ] ={ type ="short" , name ="match.stage" } , 234} 235 236for offset , info in pairs ( startmatch_struct ) do 237game . memorymap [ startmatch_addr + offset ] =info 238end 239 240game . memorymap [ 0x804D640F ] ={ type ="bool" , name ="match.paused" } 241 242local match_info =0x8046B6A0 243local match_info_struct ={ 244[ 0x0005 ] ={ type ="bool" , name ="match.playing" , debug =true } , 245[ 0x0008 ] ={ type ="u8" , name ="match.result" , debug =true } , 246[ 0x000E ] ={ type ="bool" , name ="match.finished" , debug =true } , 247} 248 249local player_cursors_pointers ={ 2500x804A0BC0 , 2510x804A0BC4 , 2520x804A0BC8 , 2530x804A0BCC , 254} 255 256local player_cursor_struct ={ 257--[0x00] = { type = "u32", name = "unknown_ptr" }, 258[ 0x05 ] ={ type ="u8" , name ="state" } , -- The state of the pointer (0 = in the bottom area, 1 = holding coin, 2 = empty hand) 259[ 0x0B ] ={ type ="u8" , name ="b_frame_counter" } , -- How many frames the player is holding B for (At 32, it will forcibly exit back to the menus) 260[ 0x0C ] ={ type ="float" , name ="position.x" } , 261[ 0x10 ] ={ type ="float" , name ="position.y" } , 262} 263 264for port , addr in pairs ( player_cursors_pointers ) do 265game . memorymap [ addr ] ={ type ="pointer" , name =( "player.%i.cursor" ): format ( port ), struct =player_cursor_struct } 266end 267 268for offset , info in pairs ( match_info_struct ) do 269game . memorymap [ match_info + offset ] =info 270end 271 272function game . translateAxis ( x , y ) 273return x , y 274end 275 276function game . translateTriggers ( l , r ) 277return l , r 278end 279 280return game