• 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!

Dual 1v1 Mode

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
Dual 1v1 Mode (1.02) [Zauron, Achilles]
Code:
04078AA4 60000000
04078d10 60000000
042707A8 60000000
042707c0 60000000
042707cc 60000000
040792EC 60000000
040792CC 88780020
040792D0 2C0300FF
00078AC0 00000040
00078D50 00000040
000792FC 00000040
002707DC 00000040
C216C094 00000004
7C1FE850 2C000003
40800010 38000001
3DC08047 980EDB69
381DFFFF 00000000
C216E5B4 00000005
3DE08046 8A0FBF19
2C100000 40820010
61EFDB69 9A0F0000
9A0F0007 38210060
60000000 00000000
------> Video of code <--------

From Zauron:

Dual 1v1 Mode:
In my normal Smash group of 4 players, we have limited time and no one wants to wait out matches, yet we prefer 1v1-style fights. This code allows this by letting all 4 players play at once, but each "set" of 1v1 players can't directly interfere with the other fight (beyond things like messing with the camera or edge hogging). Once each pair has a winner, the two winners can battle it out for the overall winner of the match!

The only downside is that you can no longer play team matches with Friendly Fire turned off - but no one worth their salt plays Teams without Friendly Fire turned on anyway. Also, a side effect is that most stage hazards will no longer affect players - there is information in the hacking section below on how to fix this if you really want stage hazards to still work.

To use:

  1. Turn Friendly Fire to OFF.
  2. Switch to Team mode and set the team colors so that each set of players that should fight each other are the same color. Players will only be able to hurt other players set to the same team color.
  3. (Optional) Switch Team mode back off so players can switch to whatever costume they want.
  4. Start the match
  5. When the match is over, re-shuffle team colors as desired.
--------------------------------

For the currently released version of 20XX (v3.02), I was using this "ported" version, but a few of those lines are just straight up wrong. That is why projectiles still hit all players in FFA mode after setting teams in 20XX 3.02.

A few weeks ago I re-ported the Dual 1v1 code to 1.02 myself, by running both versions of the game at once and analyzing the ASM side-by-side. So I fixed all the bugs with the code, and just needed to add a couple ASM injects to finish it.

[COLLAPSE="ASM Notes"]
Code:
Dual 1v1 SSBM v1.02
- Original code by Zauron, port by Achilles

#Make sure FF (Friendly Fire) is checked for grabs even with Team mode off
04078AA4 60000000

#Make sure FF is checked for melee attacks even with Team mode off
04078d10 60000000

#Make sure FF is checked for projectile vs projectile even with Team mode off
042707A8 60000000

#Make sure team id's are compared for self-damaging projectiles (Link's bombs)
042707c0 60000000
042707cc 60000000
040792EC 60000000

#Check Team of Projectile attacks
040792CC 88780020

#Compare Projectile team to "Neutral"
040792D0 2C0300FF

#Skip attacks from "Neutral" team (leave out this line to make "Neutral" attacks like stage hazards work!)
040792D4 418207B4

#Swap FF logic for grabs (ONLY grab teammates)
00078AC0 00000040

#Swap FF logic for melee attacks (ONLY attack teammates)
00078D50 00000040

#Swap FF logic for projectiles (ONLY hit teammates)
000792FC 00000040

#Swap FF logic for projectile vs projectile attacks (ONLY hit teammate's projectiles)
002707DC 00000040
-------------------------

INGAME: IF NUMBER OF PLAYERS LEFT = 2, SWITCH FF ON
Injection Code @ 8016c094
- r28 looks to always be 8046b0fc at this point

sub r0,r29,r31      # subtract number of dead players from total number of players
cmpwi r0,3           # if 3 or more alive, ignore custom code
bge- DEFAULT
li r0,1
lis r14,0x8047
stb r0,-0x2497(r14)      # turn ingame FF to on at 8046db69

DEFAULT:
subi r0,r29,1      #default line

--------------------------

MATCH START: IF FF IS OFF IN MENU, TURN FF AND TEAMS OFF
Inject @ 8016e5b4 - addi sp,sp,96

lis    r15,0x8046
lbz    r16,-0x40E7(r15)          #load menu FF flag
cmpwi    r16,0                  #is FF off?       
bne-    END
ori    r15,r15,0xdb69
stb    r16,0(r15)                        #turn ingame FF off
stb    r16,0x7(r15)                #turn Teams off
END:
addi    sp,sp,96               #default code line

----------------

FINAL CODE (disregarding the line about neutral attacks):
04078AA4 60000000
04078d10 60000000
042707A8 60000000
042707c0 60000000
042707cc 60000000
040792EC 60000000
040792CC 88780020
040792D0 2C0300FF
00078AC0 00000040
00078D50 00000040
000792FC 00000040
002707DC 00000040
C216C094 00000004
7C1FE850 2C000003
40800010 38000001
3DC08047 980EDB69
381DFFFF 00000000
C216E5B4 00000005
3DE08046 8A0FBF19
2C100000 40820010
61EFDB69 9A0F0000
9A0F0007 38210060
60000000 00000000
[/COLLAPSE]
 
Last edited:

flieskiller

Smash Journeyman
Joined
Jan 3, 2013
Messages
426
if I want to make a toggle to have friendly fire at OFF still working, like in your 20xx, would I need to add a check switch on every 04 lines?
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
Alright boys...additions to this code that need testing!

Nudging Only Affects Teammates (1.02) [Achilles]
C207DDC8 00000004
89FE061B 8A1D067B
7C0F8000 41820008
38600001 2C030000
60000000 00000000

(nudging as in walking next to a player and moving the x-coordinate of that player)


Players on Different Teams can Simultaneously Grab the Same Ledge (1.02) [Achilles]
C2082E74 00000005
89FC067B 8A1D067B
7C0F8000 41820014
3DE08008 61EF2EF4
7DE903A6 4E800420
7C1DE040 00000000
 
Last edited:

flieskiller

Smash Journeyman
Joined
Jan 3, 2013
Messages
426
Achilles, stahp...

Anyway, seems to work fine, though I'd add a check if Friendly Fire is at on or off, because right now the C2 affects when it's at ON.
 

flieskiller

Smash Journeyman
Joined
Jan 3, 2013
Messages
426
I've discovered a bug related to the original code when running on a Gamecube (and Wii too?):

"INGAME: IF NUMBER OF PLAYERS LEFT = 2, SWITCH FF ON
Injection Code @ 8016c094
- r28 looks to always be 8046b0fc at this point"

If the game is paused, r28 is NOT 8046b0fc, but it's 00000000, so the 1st frame of the game paused during a match, the game crashes because it tries to write at a memory address that isn't accessible for the Gamecube. I added a BEQ if r28 = 0 and it works, no more crashes.

my final DOL for it:
7C1FE850 2C1C0000
41820014 2C000003
4080000C 38000001
981C2A6D 381DFFFF
48168204

Also, I waiting patiently for your table about all the toggles, single player mode isn't playable with all the Dual Mode switches.
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
I've discovered a bug related to the original code when running on a Gamecube (and Wii too?):

"INGAME: IF NUMBER OF PLAYERS LEFT = 2, SWITCH FF ON
Injection Code @ 8016c094
- r28 looks to always be 8046b0fc at this point"

If the game is paused, r28 is NOT 8046b0fc, but it's 00000000, so the 1st frame of the game paused during a match, the game crashes because it tries to write at a memory address that isn't accessible for the Gamecube. I added a BEQ if r28 = 0 and it works, no more crashes.

my final DOL for it:
7C1FE850 2C1C0000
41820014 2C000003
4080000C 38000001
981C2A6D 381DFFFF
48168204

Also, I waiting patiently for your table about all the toggles, single player mode isn't playable with all the Dual Mode switches.
Okay. I fixed it. I was trying to save a code line but relying on previous values in registers is sometimes not reliable.

With the table, I just mean something like this:

Code:
-Address--Code Off--Code On-
80078AA4 XXXXXXXX 60000000
80078d10  XXXXXXXX 60000000
802707A8 XXXXXXXX 60000000
...etc
XXXXXXXX is the vanilla hex word at each address. So set Register A as 0x4 if Dual 1v1 not on, or 0x8 if Dual 1v1 is on.

Make Register X the start of the table.
Load address, 0(rX), into Register B.
Add Register A to Register X and load this word and store at Register B.

Then move Register X to next table entry and repeat. End the table with an address value of 00000000. (So after you load the address into Register B, check if it is zero to end the loop)
 
Last edited:

Noc

Smash Journeyman
Joined
Dec 30, 2008
Messages
225
Location
Galveston, TX
Thanks for finally converting this code properly to v1.2 Achilles. I tested all 3 codes above on console (with Neogamma R9 beta 56) and they work.

The way I converted the Dual 1v1 code to v1.2 before was by estimating the offset to use for each line by looking at known v1.0 to v1.2 offsets for codes at nearby memory addresses then trial and error testing offsets near that estimate. So not very surprising some lines were wrong.
 

flieskiller

Smash Journeyman
Joined
Jan 3, 2013
Messages
426
I made the table switch, I did that when the player leaves the debug menu, it sets the right switches at all the places. If you want this code to work in Dolphin, you need the "flush cache on scene change", available in the Gecko Code stickied topic in the Melee Workshop section.


C21b0a0c 00000009
3DE08040 81EFA3A0
3E208000 623145CC
82110000 2C100000
41820024 2C0F0001
4182000C 81D10004
48000008 81D10008
91D00000 3A31000C
4BFFFFD8 38600000
60000000 00000000

ASM notes
Dual 1v1 table to write when leaving debug menu

c21b0a0c
lis r15, 0x8040
lwz r15, -0x5c60(r15)#r15 = load if dual 1v1 switch is on or off (loads at 8040A3A0)
#set start of table
lis r17, 0x8000
ori r17, r17, 0x45cc #r17 = start of table
LOOP: #start of loop
lwz r16, 0(r17) #r16 = table value, line to set the hex
cmpwi r16, 0
beq OUT #table finished = go out
cmpwi r15, 1
BEQ DUALON
lwz r14, 4(r17) #r14: load OFF value
b DUALOFF
DUALON:
lwz r14, 8(r17) #r14: load ON value
DUALOFF:
stw r14, 0(r16) #store r14 into the address of the table
addi r17, r17, 0xc
b LOOP
OUT:
li r3, 0#normal line

table [800045cc]: (0 = address, 4 = OFF, 8 = ON) (must end with a 00000000)
80078AA4
41820020
60000000
80078d10
41820044
60000000
802707A8
41820038
60000000
802707c0
40820020
60000000
802707cc
40820014
60000000
800792EC
40820014
60000000
800792CC
480f1e9d
88780020
800792D0
2c030000
2C0300FF
80078AC0
4182018c
4082018c
80078D50
418204e8
408204e8
800792FC
4182078c
4082078c
802707DC
418204d4
408204d4
00000000
 
Last edited:

Aerros11

Smash Journeyman
Joined
Sep 5, 2009
Messages
284
I want to put these codes into DOL, preferably using DRGN's tool. This mod is actually pretty necessary. Time seems to be a limited resource these days.

I'm assuming then that I'd have to "Add New Mod to Library" for every 04 and C2 code. If I'm correct then what do I do with the 00 codes, as in:


040792D0 2C0300FF
00078AC0 00000040
00078D50 00000040
000792FC 00000040
002707DC 00000040

Sorry for all the questions
 

flieskiller

Smash Journeyman
Joined
Jan 3, 2013
Messages
426
@ Aerros11 Aerros11
00 means only a single byte (40 in this case) is set at the exact address. This is made in a clean way of simply changing the comparison, but the same can be done replacing the entire hex:
04078AC0 4082018c
04078D50 408204e8
040792FC 4082078c
042707DC 408204d4
 

Aerros11

Smash Journeyman
Joined
Sep 5, 2009
Messages
284
@ Aerros11 Aerros11
00 means only a single byte (40 in this case) is set at the exact address. This is made in a clean way of simply changing the comparison, but the same can be done replacing the entire hex:
04078AC0 4082018c
04078D50 408204e8
040792FC 4082078c
042707DC 408204d4

PERFECT! ^ ^
And as previously confirmed, the codes work flawlessly

F**k'n beautiful
 
Top Bottom