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

GUIDE: Giant subactions in the DOL

Punkline

Dr. Frankenstack
Joined
May 15, 2015
Messages
423
The GOTO and SUBROUTINE subaction events (14 and 1C) written in Plxx.dat files use the relocation table to convert .dat offsets into absolute pointers once loaded into RAM.

So if one of these events is written anew and NOT added to the relocation table; it will attempt to read the “offset” input as an absolute pointer that can theoretically reach anything written in start.dol.

The tournament mode menu (as an example) can be 0’d out and paired with a code like “Debug Menu replaces Tournament Mode” to safely net a total of 0x9E6C bytes of free space that can be used by whatever you want (from a vanilla copy of Melee.)

So here’s how to use it to write huge subactions to the DOL and access them from any other subaction in Crazy Hand that has at least 2 lines of event data to overwrite. (These edits can be shared as multi-line static overwrites in MCM) DRGN DRGN

---

Step 1: Find a place to put lots of events
In this example I’m using a portion of the tournament mode menu region. The bytes start at dol offset 0x18DCC0 (RAM address 0x801910E0) and end at 0x197B2C (RAM address 0x8019AF4C)

Melee Code Manager has a handy feature that lets you make these DOL <> RAM conversions easily:



I’ll be putting my example at offset 0x190000, which converts to RAM address 0x80193420.


---

Step 2: Write lots of events
Check out Itaru’s Melee Syntax School for some great notes on how to write subactions from scratch.

These are optional, but I’ve made extensive use of Achilles’ custom character data modification subaction event and custom projectile subaction event along with my custom action state logic subaction event in my example to make a ridiculous modification to Luigi’s taunt (Appeal)

Code:
04 00 00 08 A2 00 08 01 04 00 00 26 F4 FF 00 2F 41 00 40 00 3F 80 40 20 3F 80 42 00 04 00 00 06 5F 80 81 65 04 00 00 08 2C 00 50 01 03 84 00 00 00 00 00 00 2D 00 00 13 00 9C 00 8B 0C 00 00 06 28 80 00 00 00 27 00 00 00 00 00 00 00 00 00 00 05 00 05 00 B8 50 00 04 04 00 00 06 10 00 00 00 F8 FF 00 0C 03 80 00 2C BF 80 00 00 5F 80 81 08 04 00 00 08 A2 00 08 01 04 00 00 26 F8 FF 00 0C 02 00 21 BC 80 14 29 5C 60 00 00 00 04 00 00 06 5F 80 81 65 04 00 00 08 2C 00 50 08 03 84 00 00 00 00 00 00 2D 14 00 13 19 04 00 8B 0C 00 00 06 28 80 00 00 00 37 00 00 00 00 00 00 00 00 00 00 05 00 05 00 B8 30 00 04 04 00 00 06 10 00 00 00 F8 FF 00 0C 03 80 00 2C BF 80 00 00 5F 80 81 08 04 00 00 08 A2 00 08 01 04 00 00 26 0C 00 00 04 F4 FF 00 CC 41 00 40 00 3F 80 00 00 3F 80 42 00 04 00 00 02 10 00 00 00 5F 80 80 C8 04 00 00 16 F8 FF 00 14 02 00 00 E0 00 00 00 01 02 00 00 84 40 20 00 00 5F 80 81 66 04 00 00 02 0C 00 00 0A 28 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 05 00 05 00 F4 FF 00 C7 00 00 00 00 00 00 40 40 40 80 42 00 04 00 00 05 10 00 00 00 04 00 00 05 5F 00 00 5B
Try fitting THAT over Luigi’s taunt hitbox~

---

Step 3: Put lots of events in the DOL
If you prefer, you can just copy over the events to the DOL with a hex editor as if it were a .dat file; but it’s possible to use MCM to make this step pretty easy. The bonus of using MCM is that character modifications like this can then be toggled as if they were codes~

When you have all the events you want to add to a subaction, open up MCM and click the “Add New Mod to Library” button. From there, create a “static overwrite” and set the offset to the DOL offset (0x190000) or the equivalent RAM address (80193420) and simply paste in your subaction events in the “new hex” field.


Now that you’ve got the events in MCM, you can toggle them on/off as a static overwrite.
Convenient!


---

Step 4: Tell Crazy Hand where all this new data is located
Write a GOTO (or SUBROUTINE) event in the subaction you want to have read this new data. Instead of using an offset in the second line, simply put the RAM address of the new event data you just added to the DOL. So long as the event you write isn’t added to the relocation table, the RAM address will be read as intended.


---

And that’s it! You’ve extended the space available for writing subactions!

Here’s that silly taunt example. The custom events allow for character data edits, spawning projectiles, and chaining multiple action states with custom event data to a single lengthy subaction. With all that space, it's pretty easy to go nuts:



Code:
-==-


Event Data -- Stupid Luigi Taunt
Use event 14000000 80193420 to run this string of event data
[Punkline]
Version -- DOL Offset ------ Hex to Replace ---------- ASM Code
1.02 ----- 0x80193420 ---

D3E30008 807C04E8
9BC3004D 807C04E8
48212F39 808DAF9C
38600000 C022ADD0
C042ADD4 C062AD08
C082ADC8 C0A2ADCC
4821267D 907C0500
38800053 807C0500
D3C30000 D3230004
D3E30008 807C0500
9BC3004D 807C0500
48212EF1 3B7B0001
2C1B0006 3B9C0004
4180FF48 38600000
808DAF9C 482132C1
907F0518 3B800000
3B600001 807F0518
C002ADE8 D0030024
D0030028 807F0518
9BC30049 C3E2ADEC
C3C2ADF0 38600000
808DAF9C 48213289
5764103A 38840518
7C9F2214 90640000
2C1C0000 80640000
D3E30024 D3C30028
80640000 9BC30049
41820010 80640000
80010030 90030030
3B9C0001 2C1C0002
3B600002 4180FFB0
C3C2ADF4 3B800000
C3E2ADF8 3BA00003
3BC00001 38600000
808DAF9C 48213221
57A4103A 38840518
7C9F2214 90640000
2C1C0000 80640000
D3C30024 D3E30028
80640000 9BC30049
80640000 9BC3004A
41820010 80640000
80010030 90030030
3B9C0001 2C1C0002
3BA00004

->

04 00 00 08 A2 00 08 01 04 00 00 26 F4 FF 00 2F 41 00 40 00 3F 80 40 20 3F 80 42 00 04 00 00 06 5F 80 81 65 04 00 00 08 2C 00 50 01 03 84 00 00 00 00 00 00 2D 00 00 13 00 9C 00 8B 0C 00 00 06 28 80 00 00 00 27 00 00 00 00 00 00 00 00 00 00 05 00 05 00 B8 50 00 04 04 00 00 06 10 00 00 00 F8 FF 00 0C 03 80 00 2C BF 80 00 00 5F 80 81 08 04 00 00 08 A2 00 08 01 04 00 00 26 F8 FF 00 0C 02 00 21 BC 80 14 29 5C 60 00 00 00 04 00 00 06 5F 80 81 65 04 00 00 08 2C 00 50 08 03 84 00 00 00 00 00 00 2D 14 00 13 19 04 00 8B 0C 00 00 06 28 80 00 00 00 37 00 00 00 00 00 00 00 00 00 00 05 00 05 00 B8 30 00 04 04 00 00 06 10 00 00 00 F8 FF 00 0C 03 80 00 2C BF 80 00 00 5F 80 81 08 04 00 00 08 A2 00 08 01 04 00 00 26 0C 00 00 04 F4 FF 00 CC 41 00 40 00 3F 80 00 00 3F 80 42 00 04 00 00 02 10 00 00 00 5F 80 80 C8 04 00 00 16 F8 FF 00 14 02 00 00 E0 00 00 00 01 02 00 00 84 40 20 00 00 5F 80 81 66 04 00 00 02 0C 00 00 0A 28 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 05 00 05 00 F4 FF 00 C7 00 00 00 00 00 00 40 40 40 80 42 00 04 00 00 05 10 00 00 00 04 00 00 05 5F 00 00 5B
 
Last edited:

Ampers

Smash Journeyman
Joined
Feb 2, 2015
Messages
237
Location
St. Louis, MO
Awesome stuff, this is really great!

I have a question that might have already been answered by this post by Itaru but I don't have a computer to test it right now so hopefully someone knows. If I'm not mistaken, there is some amount of available space directly after each character's last subaction, or is this the space Itaru is referring to that is not actually free?

Because I've been working on an addition to Crazy Hand recently that would let you expand the length of subactions by procedurally updating the pointers for every subaction that comes after the one you're expanding and pushing the data forward. Is this not actually something that can be done without the possibility of glitches?
 

Punkline

Dr. Frankenstack
Joined
May 15, 2015
Messages
423
Awesome stuff, this is really great!

I have a question that might have already been answered by this post by Itaru but I don't have a computer to test it right now so hopefully someone knows. If I'm not mistaken, there is some amount of available space directly after each character's last subaction, or is this the space Itaru is referring to that is not actually free?

Because I've been working on an addition to Crazy Hand recently that would let you expand the length of subactions by procedurally updating the pointers for every subaction that comes after the one you're expanding and pushing the data forward. Is this not actually something that can be done without the possibility of glitches?
That was my understanding too at first. I even had some ideas about easily reaching this space with code by using a pointer that the game seems to store in the player data to these blank-looking spaces.

The space I suggested Tyadran use for his mod here was from around that post-subaction area in Roy's data; but Itaru let me know that it wasn't safe. I'm assuming that it's just kind of a gamble right now, not knowing what's safe and what's not.

Itaru Itaru do you know of any reliable empty space in Plxx.dat files to experiment with? For any characters?
 
Last edited:

Itaru

MasterGanon
Joined
Jun 25, 2014
Messages
279
Location
日本 茨城県
That was my understanding too at first. I even had some ideas about easily reaching this space with code by using a pointer that the game seems to store in the player data to these blank-looking spaces.

The space I suggested Tyadran use for his mod here was from around that post-subaction area in Roy's data; but Itaru let me know that it wasn't safe. I'm assuming that it's just kind of a gamble right now, not knowing what's safe and what's not.

Itaru Itaru do you know of any reliable empty space in Plxx.dat files to experiment with? For any characters?
Probably yes.
and, my research note.

For example, the number of ganon's animation is 0x14A. (The number of normal animations is 0x13E and, The number of Special Animations(Victory pose animations, Selected, IntroL(R) and Ending) is 0xC. So, 0x13E + 0xC = 0x14A)

And, I assumed that the size of "free space" for one animation is 2 bites. Because many character has
06000000 00000000 06000600 0C000C00 00000000 00000600 or similar data on the beginning part of "free space".

I think that the size of "free space" of Ganon is

1.jpg



0x14A * 0x2 = 294
YEEEEEEESSSSS!!!!!

And, I checked with falco and DK.

This is completely my intuition. But, I believe it is true.
 

TDRR

Smash Journeyman
Joined
Sep 18, 2017
Messages
286
Location
Venezuela
I personally recommend writing subactions to the Aux code region (4KB, DOL location 0x407540-0x4088B0), as those two regions are the ones that are used the least by most mods (20XXHP is one exception because it uses all of the free space available) Either that or try DRGN's expanded 1.02.01 DOL that has around 60KBs of free space that doesn't kill any functionality (but i'm not sure if GoTo-ing to that space is actually safe)

And if you don't zero out the region you will be using for custom subactions, then you should include this in the end of each subaction (00000000 00000000, that's 16 zeros) to make sure the subaction stops there and doesn't accidentally go into the lines of code from that region (most likely causing funny stuff to happen or a crash)

Even though 4KB isn't a lot of space for custom subactions (well you could fit 10 stupid Luigi taunts on that amount of space) It has the advantage of not removing any normal functionality from the game and being a single big unified region (unlike the screenshot region)

With all that out of the way, DRGN DRGN will MCM ever support the "modpacks" that you once mentioned? (Placing a bunch of stuff in a .zip and MCM installs that on the currently selected ISO) That feature would make sharing custom characters like this very easy.
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
I personally recommend writing subactions to the Aux code region (4KB, DOL location 0x407540-0x4088B0), as those two regions are the ones that are used the least by most mods (20XXHP is one exception because it uses all of the free space available) Either that or try DRGN's expanded 1.02.01 DOL that has around 60KBs of free space that doesn't kill any functionality (but i'm not sure if GoTo-ing to that space is actually safe)

And if you don't zero out the region you will be using for custom subactions, then you should include this in the end of each subaction (00000000 00000000, that's 16 zeros) to make sure the subaction stops there and doesn't accidentally go into the lines of code from that region (most likely causing funny stuff to happen or a crash)

Even though 4KB isn't a lot of space for custom subactions (well you could fit 10 stupid Luigi taunts on that amount of space) It has the advantage of not removing any normal functionality from the game and being a single big unified region (unlike the screenshot region)

With all that out of the way, DRGN DRGN will MCM ever support the "modpacks" that you once mentioned? (Placing a bunch of stuff in a .zip and MCM installs that on the currently selected ISO) That feature would make sharing custom characters like this very easy.
Maybe. I mean, it's certainly doable, I just haven't heard much from people that there's a lot of need or want for it. Also, I have a hard time finding a lot of time to work on Melee related projects in the first place, and there are some other things I'd like to do first that the community would have more immediate benefit from.
 
Top Bottom