• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Completed Boot to Custom Match

UnclePunch

Smash Ace
Joined
Nov 9, 2014
Messages
673
I made a code like this a few years ago but after doing some research on the match struct + seeing Punkline Punkline use the assembler to AND bits together, I decided to make a completely customizable Boot to Match code.

Customizable Aspects:
Timer count up
Timer count down
No timer
Play/.Disable music
Create/Disable HUD
Number of players HUDs to create
Show/hide score near percent
Stop/Run timer while paused (shows timer while paused as well)
Show/Hide pause HUD
Check for/disable LRA Start
Check for/disable Z to retry
Show/Hide analog stick on pause
Enable/disable all hitbox collision
Enable/Disable bomb rain
Enable/Disable teams mode
Enable/Disable KOCounter
Enable/Disable Items
Stage
Timer value (seconds and ms)
Item Switch
Camera Shake multiplier
Multispawn (displays stock icons in top left like yoshi team in adventure mode)

Character
Human/CPU
Costume
Port Number
Spawn Point
Subcolor
Handicap
Team ID
Nametag ID
Rumble
Fall at match start
CPU AI Type
CPU level
Starting percent
Respawn percent
Starting stamina percent
Attack ratio
Defense Ratio
Model Scale

1) Enable Boot to Match Code
$Boot to Match [UnclePunch]
041A45A0 3800000E
First, enable this code to boot the game into the debug match scene. By default, it will start you as Link vs Mario, but you can use the next code to customize all aspects of the match.

2) Customize the Custom Match Code
Code:
#To be inserted at 801b148c
.macro branchl reg, address
lis \reg, \address @h
ori \reg,\reg,\address @l
mtctr \reg
bctrl
.endm

.macro branch reg, address
lis \reg, \address @h
ori \reg,\reg,\address @l
mtctr \reg
bctr
.endm

.macro load reg, address
lis \reg, \address @h
ori \reg, \reg, \address @l
.endm

################################
## Match variable definitions ##
################################
.set Timer_Frozen,0x0
.set Timer_Unknown,0x1
.set Timer_CountDown,0x02
.set Timer_CountUp,0x03

.set HUDCount_One,0x04
.set HUDCount_Two,0x08
.set HUDCount_Three,0x0C
.set HUDCount_Four,0x10
.set HUDCount_Five,0x14
.set HUDCount_Six,0x18

.set MatchType_Stock,0x20
.set MatchType_Time,0x00
########################
.set Music_On,0x8
.set Music_Off,0x0

.set READY_On,0x00
.set READY_Off,0x20
########################
.set Offscreen_Unk,0x40
.set Offscreen_Unk2,0x00

.set HUD_Create,0x02
.set HUD_DontCreate,0x00

.set SingleButton_On,0x10
.set SingleButton_Off,0x00
########################
.set HUD_ShowScore,0x80
.set HUD_HideScore,0x00

.set Timer_RunWhilePaused,0x01
.set Timer_StopWhilePaused,0x00
.set Pause_HideHUD,0x02
.set Pause_ShowLRAStart,0x04
.set Pause_CheckForLRAStart,0x08
.set Pause_ShowZRetry,0x10
.set Pause_CheckForZ,0x20
.set Pause_ShowAnalogStick,0x40
########################
.set Stock_RunStockLogic,0x20
.set Stock_NoStockLogic,0x0
########################
.set HitboxCollision_Disable,0x20
.set HitboxCollision_Enable,0x00

.set Stock_SkipUnkStockCode,0x40

.set Match_SkipCheckForGameEnd,0x80
.set Match_CheckForGameEnd,0x00
########################
.set BombRain_On,0x01
.set BombRain_Off,0x00
########################
.set Teams_On,0x1
.set Teams_Off,0x0
########################
.set KOCounter_Enable,0x1
.set KOCounter_Disable,0x0
########################
.set Items_Off,-1
.set Items_VeryLow,0
.set Items_Low,1
.set Items_Medium,2
.set Items_High,3
.set Items_VeryHigh,4
########################
#Character External IDs
.set CaptainFalcon,0x0
.set DK,0x1
.set Fox,0x2
.set GaW,0x3
.set Kirby,0x4
.set Bowser,0x5
.set Link,0x6
.set Luigi,0x7
.set Mario,0x8
.set Marth,0x9
.set Mewtwo,0xA
.set Ness,0xB
.set Peach,0xC
.set Pikachu,0xD
.set IceClimbers,0xE
.set Jigglypuff,0xF
.set Samus,0x10
.set Yoshi,0x11
.set Zelda,0x12
.set Sheik,0x13
.set Falco,0x14
.set YLink,0x15
.set Doc,0x16
.set Roy,0x17
.set Pichu,0x18
.set Ganondorf,0x19
########################

#Stage External IDs
.set FoD,0x2
.set PokemonStadium,0x3
.set PeachsCastle,0x4
.set KongoJungle,0x5
.set Brinstar,0x6
.set Corneria,0x7
.set YoshiStory,0x8
.set Onett,0x9
.set MuteCity,0xA
.set RainbowCruise,0xB
.set JungleJapes,0xC
.set GreatBay,0xD
.set HyruleTemple,0xE
.set BrinstarDepths,0xF
.set YoshiIsland,0x10
.set GreenGreens,0x11
.set Fourside,0x12
.set MushroomKingdomI,0x13
.set MushroomKingdomII,0x14
.set Akaneia,0x15
.set Venom,0x16
.set PokeFloats,0x17
.set BigBlue,0x18
.set IcicleMountain,0x19
.set IceTop,0x1A
.set FlatZone,0x1B
.set DreamLand,0x1C
.set YoshiIsland64,0x1D
.set KongoJungle64,0x1E
.set Battlefield,0x1F
.set FinalDestination,0x20

########################
.set PlayerStatus_Human,0x0
.set PlayerStatus_CPU,0x1
.set PlayerStatus_Demo,0x2
.set PlayerStatus_None,0x3
########################
.set Subcolor_Normal,0x0
.set Subcolor_Light,0x1
.set Subcolor_Dark,0x2
.set Subcolor_Black,0x3
.set Subcolor_Gray,0x4
########################
.set Team_None,0x0
.set Team_Red,0x0
.set Team_Blue,0x1
.set Team_Green,0x2
#######################
.set Nametag_None,0x78
########################
.set Rumble_Off,0x00
.set Rumble_On,0x80

.set Spawn_Fall,0x00
.set Spawn_Normal,0x40
########################
.set CPUType_Stay,0x0
.set CPUType_Escape,0x2
.set CPUType_Jump,0x3
.set CPUType_Normal,0x4
.set CPUType_Normal2,0x5
.set CPUType_Nana,0x6
.set CPUType_Defensive,0x7
.set CPUType_Struggle,0x8
.set CPUType_Freak,0x9
.set CPUType_Cooperate,0xA
.set CPUType_SpLwLink,0xB
.set CPUType_SpLwSamus,0xC
.set CPUType_OnlyItem,0xD
.set CPUType_EvZelda,0xE
.set CPUType_NoAct,0xF
.set CPUType_Air,0x10
.set CPUType_Item,0x11
.set CPUType_GuardEdge,0x12
########################

################
## Start Code ##
################

  load     r3,0x80480530           #Match Struct In Memory
  bl    MatchInfoStruct         #Custom Match Struct
  mflr    r4
  li    r5,0xF0                   #Struct Length
  branchl    r12,0x800031f4     #memcpy
  b    exit

MatchInfoStruct:
blrl

######################################################

################
## Match Info ##
################

#Timer, HUD, Pause, and Player Count
  .byte Timer_CountDown | HUDCount_Two | MatchType_Stock
  .byte Music_On | READY_On
  .byte Offscreen_Unk2 | HUD_Create
  .byte HUD_HideScore | Timer_StopWhilePaused | Pause_ShowLRAStart | Pause_CheckForLRAStart | Pause_ShowAnalogStick
#Stocks, Grab behavior, Game End Logic, Bomb Rain
  .byte Stock_RunStockLogic
  .byte HitboxCollision_Enable | Match_CheckForGameEnd
  .byte BombRain_Off
  .byte 0
#Teams, KO Counter, Item frequency
  .byte Teams_Off
  .byte KOCounter_Disable
  .byte 0
  .byte Items_Off
#Item behavior, Stage ID
  .byte 0
  .byte 0
  .hword FinalDestination
#Timer (in seconds)
  .long 480       #seconds
  .byte 0         #milliseconds
#Unknown
  .byte 0
  .byte 0
  .byte 0
#Unknown (read on game end)
  .long 0
#Unknown
  .long 0
#Item Switch
  .long 0xFFFFFFFF  #all enabled
  .long 0xFFFFFFFF  #all enabled
#Unknown
  .long 0x00000000
#Camera Shake Multiplier
  .float 1.0
#Unknown
  .float 1.0
#Unknown
  .float 1.0
#Function to run during StartMelee
  .long 0x0
#Unknown
  .long 0x0
#Function to run while checking for Pause input
  .long 0x0
#Unknown
  .long 0x0
#Function to run every match frame 1(paused or unpaused)
  .long 0x0
#Function to run every match frame 2(paused or unpaused)
  .long 0x0
#Function to run when the match ends
  .long 0x0
#Unknown
  .long 0x0
#isMultispawn (displays a bunch of stocks in the top left, like adventure mode yoshi team)
  .long 0x0
#Unknown
  .long 0x0

#################
## Player Info ##
#################

#Player 1
.byte Marth
.byte PlayerStatus_Human
.byte 4                         #Stock Count
.byte 0                         #Costume ID
.byte 0                         #Port number override (0 = default)
.byte -1                        #Spawn point override (-1 = default)
.byte 0                         #Initial Facing Direction? (0 is default)
.byte Subcolor_Normal           #Subcolor
.byte 9                         #Handicap (9 seems to be the default)
.byte Team_None                 #Team ID
.byte Nametag_None              #Nametag ID (0x78 is none)
.byte 0                         #Unknown
.byte Rumble_Off | Spawn_Normal #Rumble + Spawn Flag
.byte 0                         #Unknown bitflags
.byte CPUType_Normal            #CPU type, only takes affect when player is a CPU
.byte 1                         #CPU level, only takes affect when player is a CPU
.hword 0                        #Starting damage
.hword 0                        #Damage after respawning
.hword 0                        #Starting stamina percent
.hword 0                        #Nothing
.float 1.0                      #Attack Ratio
.float 1.0                      #Defense Ratio
.float 1.0                      #Model Scale

#Player 2 Info
.byte Marth
.byte PlayerStatus_Human
.byte 4                         #Stock Count
.byte 0                         #Costume ID
.byte 0                         #Port number override (0 = default)
.byte -1                        #Spawn point override (-1 = default)
.byte 0                         #Initial Facing Direction? (0 is default)
.byte Subcolor_Normal           #Subcolor
.byte 9                         #Handicap (9 seems to be the default)
.byte Team_None                 #Team ID
.byte Nametag_None              #Nametag ID (0x78 is none)
.byte 0                         #Unknown
.byte Rumble_Off | Spawn_Normal #Rumble + Spawn Flag
.byte 0                         #Unknown bitflags
.byte CPUType_Normal            #CPU type, only takes affect when player is a CPU
.byte 1                         #CPU level, only takes affect when player is a CPU
.hword 0                        #Starting damage
.hword 0                        #Damage after respawning
.hword 0                        #Starting stamina percent
.hword 0                        #Nothing
.float 1.0                      #Attack Ratio
.float 1.0                      #Defense Ratio
.float 1.0                      #Model Scale

#Player 3 Info
.byte Marth
.byte PlayerStatus_None
.byte 4                         #Stock Count
.byte 0                         #Costume ID
.byte 0                         #Port number override (0 = default)
.byte -1                        #Spawn point override (-1 = default)
.byte 0                         #Initial Facing Direction? (0 is default)
.byte Subcolor_Normal           #Subcolor
.byte 9                         #Handicap (9 seems to be the default)
.byte Team_None                 #Team ID
.byte Nametag_None              #Nametag ID (0x78 is none)
.byte 0                         #Unknown
.byte Rumble_Off | Spawn_Normal #Rumble + Spawn Flag
.byte 0                         #Unknown bitflags
.byte CPUType_Normal            #CPU type, only takes affect when player is a CPU
.byte 1                         #CPU level, only takes affect when player is a CPU
.hword 0                        #Starting damage
.hword 0                        #Damage after respawning
.hword 0                        #Starting stamina percent
.hword 0                        #Nothing
.float 1.0                      #Attack Ratio
.float 1.0                      #Defense Ratio
.float 1.0                      #Model Scale

#Player 4 Info
.byte Marth
.byte PlayerStatus_None
.byte 4                         #Stock Count
.byte 0                         #Costume ID
.byte 0                         #Port number override (0 = default)
.byte -1                        #Spawn point override (-1 = default)
.byte 0                         #Initial Facing Direction? (0 is default)
.byte Subcolor_Normal           #Subcolor
.byte 9                         #Handicap (9 seems to be the default)
.byte Team_None                 #Team ID
.byte Nametag_None              #Nametag ID (0x78 is none)
.byte 0                         #Unknown
.byte Rumble_Off | Spawn_Normal #Rumble + Spawn Flag
.byte 0                         #Unknown bitflags
.byte CPUType_Normal            #CPU type, only takes affect when player is a CPU
.byte 1                         #CPU level, only takes affect when player is a CPU
.hword 0                        #Starting damage
.hword 0                        #Damage after respawning
.hword 0                        #Starting stamina percent
.hword 0                        #Nothing
.float 1.0                      #Attack Ratio
.float 1.0                      #Defense Ratio
.float 1.0                      #Model Scale

################################################################

exit:
lmw    r27, 0x0014 (sp)
Scroll down to where it says:

################
## Match Info ##
################

and change all the match settings. Each setting has a name and can be adjusted by changing the name to the names defined at the top of the code.
Then scroll down to where it says

#################
## Player Info ##
#################

and change all the player info.

3) Assemble the Custom Match Code
Once the code is customized, you need to assemble the code (convert it into a gecko code / dol mod). You can do this using MCM, CodeWrite, or ASMWiird. The injection address is given on the first line of the assembly code. After the code is assembled, you can add the code and the game will boot into the match.

Using this code is a bit advanced, but I did it more-so to get all the info I knew about the match struct out there.
 
Last edited:

Punkline

Dr. Frankenstack
Joined
May 15, 2015
Messages
423
I’ve always wanted something like this for testing codes and doing research. These symbols are very informative too; thanks for posting this!

Symbols like the ones you've used here are really powerful for making configurable codes and documenting information. Using mask symbols on the data side of things really helps make things easy to refactor. If you find yourself writing code that parses data like this in the future, then you might also be interested in pairing named masks with named CR bits.
If you use masks values to define pre-compiled TRUE and FALSE options for a code -- then you can just throw the word directly into CR to skip up to 32 comparison instructions with mtcr or mtcrf. This ends up saving lines of code, and can potentially make for very versatile functions if used to create an argument structure. Thoughtfully named CR bits and labels can then also be used to make legible branch conditions with use of the “bf” and “bt” branch format.

For example, in this little mockup I'm pretending to write an injection code that overhauls the collision bubble display that uses parameters to guide the parser:



To preserve the volatile CR bits during calls, you could instead put them in cr2...cr4 and treat them like saved registers -- backing up any bits that were in there previously, and restoring them before returning.
 
Last edited:

Benny P

Smash Journeyman
Joined
Dec 10, 2014
Messages
465
Location
Coming Soon
Where's the customizable parts of the code?


$Boot to Match [UnclePunch]
041A45A0 3800000E

I was thinking of Fox vs Falco on BattleField or Fox vs Marth on FD

ahh im still not sure how to do it after looking inside the tab

Ohh wait i missed the tab lol
 
Last edited:

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,178
Location
Sacramento, CA
First off, I'd just like to say that this mod is awesome. When I first saw it years ago, I knew that it would be useful, and I've finally gotten around to playing with it. I've been using it a bunch lately in some automation for testing stage/character assets and creating Tri-CSPs. However, there are a few odd issues, probably due to this using the debug 'DAIRANTOU' scene. For example, the pause camera doesn't work as it does in normal VS mode (it shows pause-related textures, but doesn't reposition to focus on a character and you can't move it), and dynamic bones seem to behave weirdly. I'm wondering if there's some way to fix these issues. Can we get the game to treat this more like a standard VS match? Or is there a way to boot to a standard VS match scene with this mod's level of customization? (Or at the very least, with specified characters and stage.)

I got around the pause camera issues for my purposes; the values for that camera just aren't initialized, and nopping 8016cb50 tricks the game into initializing them before they're needed. After unpause, it doesn't fully switch back to the other standard camera for some reason, so it starts moving strangely (as a combination of the two cameras), but that luckily doesn't matter for what I'm using for atm.

The issue of dynamics not working is a much bigger problem though. While collecting CSP screenshots, I'm getting capes, hair, and dresses that aren't in the right place.
 
Last edited:
Top Bottom