20XX 4.0 Stage Swap Modifications
Open up the 20XX 4.0 Start.dol file in a hex editor and go to offset 0x3F8C80.
Here you will see ASCII for all the stages on the Stage Select Screen (SSS) and can make modifications as to what stage will be loaded. Other advanced modification options include custom stage flags for ASM code and RAM byte replacements intended to be used for file name changes.
20XX 4.0 will support up to four Stage Select Screens. The current beta only uses three, which are controlled by pressing D-Pad Up/Down on the SSS.
MnSlMap.1sd = default stages
MnSlMap.2sd = competitive hacked stages
MnSlMap.3sd = other stages & single player stages
MnSlMap.4sd = not yet supported
But you can change these stages to whatever you want. It is important to note though, that when MnSlMap.2sd is active, other 20XX ASM codes are being executed. So it's probably wise to just not modify that one.
(Picture taken with version Beta04 DOL)
New Stage ID (8-bit each)
This will be the ID of the stage to load
- 0x00 = No swap, load default stage
- 0x15 = Aerial Arena, but further codes are needed to make this "stage" load
- 0x1A = Use the Target Stage chosen in the 20XX Debug Menu
Stage IDs
Stage Flags (8-bit each)
The stage flag byte for the current MnSlMap is stored @ 0x803FA2E5 upon stage selection.
The first three bits of the byte are used in another code for custom spawn points, which I will not be getting into right now. So if you happen to use this stage flag for anything, make sure the first three bits are 0. This is mainly for people wanting to write ASM codes for stage mods. So say you made one page contain two N64 Dream Lands, you could set one to have a stage flag of 0x10 which could mean it doesn't have wind. (But you would then have to write the ASM code, executed while playing on DL, to check the stage flag value before performing the wind logic). This gives a lot of flexibility and power.
Just leave this as 0x00 if you aren't using stage flags.
Example of existing stage flags:
Code:
STAGE FLAG VALUES - 20XX 4.07
*Note: These code flags are additive. So if you wanted frozen water mode for Pokemon, the stage flag would be (0x08 + 0x80) = 0x88
Battlefield:
(10) = water BG, set in stage init function
(40) = Custom Plats 1
(80) = Custom Plats 2
(C0) = Custom Plats 3
Pokemon Stadium:
(08) = water mode
(10) = rock mode
(20) = grass mode
(40) = fire mode
(80) = frozen, checked every frame on stadium
Final Destination
(40) = long stage floor (only for vanilla/textured final destination files, no model imports)
(80) = no background transitions
Brinstar
(80) = Disable rising lava
All-Star Rest
(80) = Disable portal from exiting stage
Corneria
(80) = Disable ships
(40) = Disable gun
Princess Peach's Castle
(80) = Disable Bullet Bill and switches
Mushroom Kingdom II
(80) = Disable Pidgit, Birdo, and Logs
Trophy Snag
(80) = Disable trophy drop
RAM Pointers for Byte Replacement (32-bit each) & Byte Replacement at Pointer Address (8-bit)
These fields allow one to perform 8-bit RAM overwrites when a stage is selected. The intended purpose of this feature is to cater to having multiple files of the same base stage within the ISO. A good example of when you want to use this is for
@zankyou 's model import stages, while also keeping the original stage in the game.
An example of this feature's use is in the above picture for Princess Peach's Castle on MnSlMap.2sd. When the stage is selected, the Stage-to-load ID is swapped to 0x39 (Roy's Target Test stage) and then the byte at RAM address 0x803E9817 is changed from [default value] to 0x6B.
In 20XX 4.0 (Beta04), I added another Roy Target Test stage (GrTFe.dat) to the ISO file system which was Zankyou's model import of Pokemon Kalos League. I named this new file:
GrTFe.kat
(k for Kalos, I guess)
"k" = 0x6B in ASCII Hex
0x803E9817 is the byte location of GrTFe.
dat
I know this by searching for "GrTFe" (the hex value for this ASCII) in the DOL and then using DRGN's Code Manager Tools to convert the DOL offset to the RAM offset.
So with the above configurations, when Princess Peach's Castle is selected on MnSlMap.2sd, it will load Roy's Targest Stage instead, and will try to load the file GrTFe.kat instead of GrTFe.dat.
If you don't want to use an 8-bit overwrite, just leave the pointer value as 0x00000000.
Setting this 8-bit overwrite value to 0xFF will result in the use of the Random Byte Overwrites. See below.
NOTE: The default 8-bit value that was overwritten at the address, is returned to it's default value after the match ends.
Random Byte Overwrites (8-bit each, 32 bit total)
When the byte replacement is set to 0xFF, a random byte replacement will be used. Up to four random bytes can be specified. This feature is not available for MnSlMap.1sd.
Say you have 4 different Dream Land files you want to have the game randomize between.
You could add these into your ISO file system as GrOp.1at, GrOp.2at, GrOp.3at, GrOp.4at.
Then set the first byte replacement to 0xFF to use the random bytes for the specified SSS selection. Then for the random bytes, you would put the four in succession: 0x31323334 (0x31 = "1", 0x32 = "2", etc.). And then make sure to add in the pointer to the corresponding ASCII "GrOp.dat" RAM location.
If you only wanted to use 3 of those Dream Lands, it would be 0x31323300.
(end it with a 0x00).
-------------------
I think that's all for now.
----------------------------------------
Note: all this is subject to change in the future if I feel like making changes, lol.