Kitty Corp Meow Mix Forums

Super Smash Bros. Brawl Hacking => Programming => Topic started by: average modder on March 30, 2017, 08:05:15 PM



Title: All-Star Special Versus Mode
Post by: average modder on March 30, 2017, 08:05:15 PM
I've been modding brawl for a while now, adding all sorts of characters and creating some of my own from scratch. I've actually gotten quite good at animating, editing psa, and working with the core files of BrawlEx.

My brother and I love to play All-Star Versus mode (the special versus where you can change characters each stock). I was wondering if anyone knew anything about the file location and/or coding behind this feature. The reason is, we like to put the computers on random, but the random icon only select from the original roster, and never select newly added characters.

I have updated the "random" list in CSSRoster.dat, and when random is used in standard vs mode, it does select newly added custom characters. However, it appears that the random icon in All-Star Vs selects from a different list. I am trying to find where this list is located so I could possibly add the newly added custom fighters to it.

But any information with regards to the All-Star Special Vs mode would be appreciated. Thanks


Title: Re: All-Star Special Versus Mode
Post by: average modder on April 27, 2017, 01:00:04 PM
Literally any help would be appreciated, even just conjecture


Title: Re: All-Star Special Versus Mode
Post by: average modder on December 30, 2017, 12:47:02 PM
I'm sorry to revive a dead post, but I'm still trying to figure this out and would love any information anyone has on all-star special versus mode. I'll take anything at this point. Thanks!


Title: Re: All-Star Special Versus Mode
Post by: wiiztec on August 27, 2018, 09:27:38 PM
You need to change the bottom part of this for random to not exclude the new characters then convert it to hex with asmwiird and replace the lines in your GCT starting with C277FB7C until the next line that starts with C2

hook:8077FB7C
stwu r1,-80(r1)
stmw r14,8(r1)   #Creates a stack frame so I can use all the registers without worrying about [censored]ing [censored] up
lis r14,0x8058
ori r14,r14,0x8003   #Loads the address of the beginning of my ASV memory bank +3 bytes into r14
lis r15,0x9018
ori r15,r15,0x0FB8   #Loads the address of player 1's mem2 character ID into r15 (changes character immeidately if poked with a diffferent ID)
lis r29,0x8058
ori r29,r29,0x8300
lwz r22,-0x0C(r29)   #Loads the address of player 1's mem1 character ID into r22 (reloads current character when poked with a different ID)
cmpwi r25,0x14   #r25 is 0x14 before a match starts and after it ends
bne mc   #Branch to main code if r25 is not 0x14, it's usually only 0x14 before the start or after the end of a match
cmplwi r26,0xBEEF   #on the rare occasion r25 is 0x14 in the middle of a match r26 will not have an address in it
blt mc   #branches to main code if r26's value indicates it's the middle of a match despite r25 being 0x14
loop:stw r7,0x99(r14)   #Clears next char offset, death counter, & stock head offset (r7 is always 0 when this instruction executes)
stb r7,0x68(r29)   #Clears counter for CSS portrait data
addi r14,r14,0xA0   #adds offset to next player ASV data
addi r29,r29,0x6C   #adds offset to next player CSP data
addi r9,r9,1
cmpwi r9,4
bne loop   #increments loop counter and allows escape once instructions have been run through for all players
mc:cmpwi r30,0x10B
bne end   #if current action is not unloaded branch to end
cmpwi r23,0xBD
bne end   #if previous action is not death branch to end
lwz r12,8(r31)
lwz r11,0x110(r12)   #loads alternate character ID into r11
cmpwi r11,0xF
bne co   #Checks if Ice climbers, branch to continue on if not
lhz r11,0xFC(r12)
cmpwi r11,1
beq end   #Checks if it was nana who died, branches to end to prevent swapping to next char if so
co:lwz r12,0x1C(r31)
lwz r12,0x28(r12)
lwz r12,0x10(r12)
lbz r12,0x55(r12)   #Loads player number ID into r12
lis r26,0x901C
ori r26,r26,0x4928
stbx r7,r26,r12   #Clears TSCD AD flag???
mulli r16,r12,0xA0   #multiplies the PNID by the per player ASV data offset and stores the result in r16
mulli r17,r12,0x5C   #multiplies the PNID by the per player character ID offset in mem2 and stores the result in r17
mulli r23,r12,0x80   #multiplies the PNID by the per player character ID offset in mem1 and stores the result in r23
add r16,r16,r14   #adds the current player ASV data offset to the address of the beginning of the ASV data bank and stores the result in r16
sub r22,r22,r23   #subtracts the -offset to the current player from the address of player 1's character ID in mem1 and stores the result in r22
lbz r20,0x99(r16)   #loads offset to next character from current players ASV data +0x99 into r20
rc:lbzx r19,r16,r20   #loads character ID into r19
cmplwi r19,0xCC   #checks if the character ID to be loaded is CC which is an indicator signifying the end of the picked characters
blt lc   #branches to load character if it's less than CC (all legitimite character ID's are less than CC)   
cmpwi r20,-3
beq end   #sanity check to prevent an infinite loop if the first char id in the ASV data bank is CC
li r20,-3   #sets next character offset to -3 to loop back to the first picked character after CC is encountered
b rc   #loops back to reload character ID
lc:lwzx r19,r16,r20   #loads character ID, costume ID, portrait ID, & next character ID into r19
srwi r18,r19,24   #shifts only character ID from r19 to r18
cmpwi r18,0x3D
bne nr2   #checks if character ID is 3D which I designated to signify random and branches to not random 2 if it's not
mflr r24
bl rndm   #preserves previous contents of link register in r24 and branch & links to random ASV subroutine
mtlr r24   #moves r24's contents back to link register
nr2:srwi r19,r19,8   #shifts next character ID out of r19
lis r11,0x8128
ori r11,r11,0xAE64   #Loads player 1 stock count address into r11
li r6,0x52
slwi r6,r6,12   #Loads player offset for stock count address into r6
mullw r6,r6,r12   #Multiplies player offset for stock count address by PNID and stores result in r6
lwzx r6,r11,r6
cmpwi r6,1
beq end   #Loads player stock count and branches to end if it's 1 preventing the results screen from showing the next character
lbz r23,0(r22)
cmpw r23,r18   #Loads the mem1 char ID(current character) into r23 and compares it to the character ID in r18(character to be swapped to)
bne dc   #if not equal branch to do code (really struggling to come up with branch names at this point)
li r23,0x12   #Loads character ID of sona into r23, sona is a character not selectable from the CSS so it will always for a reload
stb r23,0(r22)   #stores sona character ID to mem1 char ID address (force reload is necessary for stock heads to swap properly)
dc:stbx r18,r15,r17   #stores char ID to mem2 char ID address
addi r15,r15,5   #moves address in r15 up by 5 bytes
sthx r19,r15,r17   #stores costume and portrait ID's
addi r20,r20,3
stb r20,0x99(r16)   #increments next character offset by 3 and stores to current player ASV data +0x99
lbz r21,0x9A(r16)   
addi r21,r21,1
stb r21,0x9A(r16)   #loads player death count increments it by 1 and stores to current player ASV data +0x9A
end:lmw r14,8(r1)   #reloads previous register values back from the stack
addi r1,r1,80   #sets stack pointer back to where it was before now that the space is free again
lwz r3,44(r29)   #original instruction at code hook
b sr   #unconditional branch to skip random
rndm:stwu r1,-100(r1)
stmw r9,8(r1)   #creates stack frame for random ASV subroutine
lis r27,0x8003
ori r27,r27,0xFC7C   #loads address of brawl RNG function into r27
mflr r8   #preserves current link register in r8
mtctr r27   #moves brawl RNG function address into ctr
li r3,0x34   #sets paramater for value range to randomly select from to 0x00-0x34
bctrl   #branch to ctr and link (branches to brawl RNG function)
mtlr r8   #copies the contents of r8 back into the link register
lmw r9,8(r1)   #reloads previous register values back from the stack
addi r1,r1,100   #sets stack pointer back to where it was before now that the space is free again
mr r18,r3   #copies the contents of r3 (the random value the RNG function gave me is in r3) to r18
cmpwi r18,0x11
beq rndm   #if ID is sopo rechoose random ID
cmpwi r18,0x12
beq rndm   #if ID is sona rechoose random ID
cmpwi r18,0x1D
beq rndm   #if ID is pokemon trainer's charizard rechoose random ID
cmpwi r18,0x1F
beq rndm   #if ID is pokemon trainer's squirtle rechoose random ID
cmpwi r18,0x21
beq rndm   #if ID is pokemon trainer's ivysaur rechoose random ID
cmpwi r18,0x2C
blt blr   #if ID is less than 0x2C ID is good so branch to blr
cmpwi r18,0x31
ble rndm   #if ID is giga bowser, warioman, or alloys rechoose random ID
blr:blr   #branches to the address in the link register which should be the mtlr r24 above
sr:   #the codehandler puts a branch back to the line after the instruction I hooked here


Title: Re: All-Star Special Versus Mode
Post by: average modder on August 28, 2018, 03:09:42 PM
Thank you so much for your response! I've been waiting so long for this! You are totally awesome! I will try to implement this soon!


Title: Re: All-Star Special Versus Mode
Post by: average modder on October 18, 2018, 11:42:00 AM
Sorry to bother you again, but it appears that the numbers that are excluded do not correspond to the fighter config files.

Here is an example of the code you so generously provided.

cmpwi r18,0x1F
beq rndm   #if ID is pokemon trainer's squirtle rechoose random ID
cmpwi r18,0x21
beq rndm   #if ID is pokemon trainer's ivysaur rechoose random ID

But the fighter config files in the brawlex/ProjectM build shows 1E as squirtle, and 1F as ivysaur. 21 is Lucario. But in game, all three of these are selected by random during all-star versus anyways. So my question is, how are the characters identified if not by their fighter config ID? Thanks

And if I added a character as Fighter41 for example, how would I edit the code? I have some decent programming experience, but it doesn't seem to select my new character, but instead causes an occasional crash. I know this is asking a lot, but if you could provide an example, that would be awesome. Thanks


Title: Re: All-Star Special Versus Mode
Post by: wiiztec on November 17, 2018, 06:54:39 PM
They're selected by character ID and pokemon trainer's pokemon are the non independant versions. I didn't type out pokemon trainer's for no reason you know. to add characters you edit this line

li r3,0x34   #sets paramater for value range to randomly select from to 0x00-0x34

to li r3,0x(1 greater than ID of highest character ID you want included in the random selection)

Then you need to add to those branches at the end to exclude at least the empty slots since they'll crash

Also you need to edit this

hook:806DEFD4
stwu r1,-128(r1)
stmw r2,8(r1) #create stack frame
lis r14,0x8058
ori r14,r14,0x8003 #loads ASV data bank address into r14
lis r15,0x9018
ori r15,r15,0x0FB8 #loads the address of player 1's mem2 character ID into r15
loop:lbz r18,-3(r14) #loads first picked char ID from player ASV data
cmpwi r18,0xCC
beq drc #branches to don't replace character if char ID is CC (sanity check for if you unpick all chars with the CSP's)
cmpwi r18,0x3D
bne nr1 #branches to not random 1 if char ID isn't 3D (my invented ID for random)
mflr r27 #preserves contents of link register in r27
bl -0xA8 #branch & links to random in the match part C2 code above
mtlr r27 #restores link register contents from r27
nr1:lhz r19,-2(r14) #loads first picked char costume & portrait ID's from player ASV data
stb r18,0(r15) #stores first picked char to mem2 char ID address
sth r19,5(r15) #stores first picked char costume & portrait ID's to mem2 char ID address +5
b co #unconditioal branch to continue on
drc:lbz r3,184(r24) #loads CSS character selection (original instruction at 806DEF94)
stb r3,152(r23) #stores char ID to be loaded at start of match (original instruction at 806DEF98)
li r6,0 #sets r6 to 0
sth r6,157(r23) #stores r6 as player costume & portrait ID (original instruction at 806DEFCC)
co:addi r14,r14,0xA0 #adds offset to next player ASV data
addi r15,r15,0x5C #adds offset to next player mem2 char ID address
addi r22,r22,1
cmpwi r22,6
bne loop #increments loop counter and allows escape once instructions have been run through for all players (?why 6 not 4?)
end:lmw r2,8(r1) #reloads previous register values back from the stack
addi r1,r1,128 #sets stack pointer back to where it was before now that the space is free again

And add 0x04 to the bl -0xA8 line for each line you add to the other code, you count in hex like 0, 4, 8, C, 10,14,18,1C,20 etc so for example if you added 5 line's you'd change it to -0xBC