The module files in Super Smash Bros. Brawl are located in the module folder containing extra code not in the dol. All fighters, menus and stages have these files, which have the suffix .rel. For example, st_donkey.rel is the file for 75m.
Editing stage .rel files (of course)[]
You will need a hex editor.
Open the stage module file (of the format st_XXXX.rel) for the stage you want to replace something with. Let's say you want to replace Flat Zone 2 with a stage based on Final Destination. Each module file has a sequence of bytes somewhere in the file that goes like this:
38 A5 00 00 38 80 00 XX
The value of XX is the ID number of the stage, taken from this list:
STCUSTOM (Phantom Wings' code) 00 st_custom[1-9].rel Battlefield 01 st_battle.rel Final Destination 02 st_final.rel Delfino Plaza 03 st_dolpic.rel Luigi's Mansion 04 st_mansion.rel Mushroomy Kingdom 05 st_mariopast.rel Mario Circuit 06 st_kart.rel 75 m 07 st_donkey.rel Rumble Falls 08 st_jungle.rel Pirate Ship 09 st_pirates.rel Norfair 0B st_norfair.rel Frigate Orpheon 0C st_orpheon.rel Yoshi's Island (Brawl) 0D st_crayon.rel Halberd 0E st_halberd.rel Lylat Cruise 13 st_starfox.rel Pokémon Stadium 2 14 st_stadium.rel Spear Pillar 15 st_tengan.rel Port Town Aero Dive 16 st_fzero.rel Summit 17 st_ice.rel Flat Zone 2 18 st_gw.rel Castle Siege 19 st_emblem.rel WarioWare Inc. 1C st_madein.rel Distant Planet 1D st_earth.rel Skyworld 1E st_palutena.rel Mario Bros. 1F st_famicom.rel New Pork City 20 st_newpork.rel Smashville 21 st_village.rel Shadow Moses Island 22 st_metalgear.rel Green Hill Zone 23 st_greenhill.rel PictoChat 24 st_pictchat.rel Hanenbow 25 st_plankton.rel ConfigTest 26 st_config.rel Result 28 Temple 29 st_dxshrine.rel Yoshi's Island (Melee) 2A st_dxyorster.rel Jungle Japes 2B st_dxgarden.rel Onett 2C st_dxonett.rel Green Greens 2D st_dxgreens.rel Pokémon Stadium 2E st_dxpstadium.rel Rainbow Cruise 2F st_dxrcruise.rel Corneria 30 st_dxcorneria.rel Big Blue 31 st_dxbigblue.rel Brinstar 32 st_dxzebes.rel Bridge of Eldin 33 st_oldin.rel Homerun 34 st_homerun.rel Edit 35 st_stageedit.rel Heal 36 st_heal.rel OnlineTraining 37 st_otrain.rel TargetBreak 38 st_tbreak.rel
So in the example, you would want to open st_final.rel search for:
38 A5 00 00 38 80 00 02
You want to replace the XX value with that of the stage you want to replace. So change the string to:
38 A5 00 00 38 80 00 18
Save the file as st_gw.rel. Now you should be able to put a Final Destination-based stage over stages/melee/STGGW.PAC.
For custom stages using Phantom Wings' Custom SSS code, the XX value you should enter is 00.
Also, Smash World Forums user Bero has given us a tool to easily make .rels! http://www.mediafire.com/?rmr2j837li4867n
A .rel file to use an OnlineTraining-based stage as a custom stage with Phantom Wings' code can be found here: http://www.mediafire.com/?gkeikwjjqz1 In this file, XX is 00, but you can change it with the method above if you want it to replace a stage already in the game. This .rel file is verified to have no Sandbag. (as far as I know, this is something that PW changed in the .rel, but I might be wrong --User:Libertyernie)