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

Punkline

Dr. Frankenstack
Premium
Joined
May 15, 2015
Messages
423
Mytoc provides up to 0xCD0 bytes of space in the rtoc region of start.dol to be used 8 bytes at a time -- creating 410 partitioned blocks.

Note that this is an exceptionally special region of RAM, because it can be accessed from dedicated GPR r2 (rtoc) -- meaning it can be loaded from and written to at ANY point in the game program; and by using only a single instruction.

The codes provide the space as a set of “mastercodes” that come in the form of togglable static overwrites for Melee Code Manager (MCM.)

See this post for some examples of how the code is used.

---

Download Mytoc for MCM here -- put the text file in your Mods Library folder, and check the new Mytoc tab to see the list of Mytoc blocks available to enable as codes. Toggling these will simply free up the described rtoc space for you to use in your own codes.

http://i.imgur.com/dahNvYD.png


It works by exploiting the fact that rtoc redundantly stores many double precision floating point constants used in the same floating point algorithms throughout multiple functions. The redundancy becomes a waste of space once all of the thousands of references (instructions) are reduced down to a common 2 rtoc offsets for doubles:

Of the 410 doubles left behind, I’ve made 100 individually available by default -- creating your personal “mytoc” to use for experiments and complex dol-modding. Enable each block as needed, and use the -0xNNNN(rtoc) offset in your code to access the space.

The other 310 are disabled by default, and can be enabled by deleting the ‘!’ mark at the beginning of each disabled mod. If you want to distribute a code that uses mytoc, you may use one of these disabled regions in your code to prevent conflicts with the mytoc tab in MCM. Just include the static overwrites with your mod!

All 410 are essentially the same, so use them as you see fit. The disabled index is just a guide.

---

As DOL mods (MCM static overwrites) these codes are written entirely in-place and take up absolutely no code space. This is crucial to the scalability of this code, and is reason for why it has so much space available.

As gecko codes, these take up a ridiculous amount of space in the code handler (in the form of 04 codes), and are not recommended. Gecko codes can still use these global rtoc regions with the blocks installed through MCM or hex editor. Doing so will give C2 codes the power to reference common data, which can include other C2 code locations for creating branch tables and calls to functions written as gecko codes.

---

The main purpose of this mod is to appeal to those constructing their own full-game mods, as it will provide a means of organizing large globally-based structures in a very efficient and accessible manner through the rtoc register. It also serves as a true alternative to static data tables constructed for gecko codes that can't reliably reference each other in hacked code handlers.

DRGN DRGN @Achilles1515 UnclePunch UnclePunch @rmn @Zadamanim @MeleeModder The Cape The Cape
 
Last edited:

The Cape

Smash Master
Joined
May 16, 2004
Messages
4,478
Location
Carlisle, PA
So what does this specifically do? Move FSMs or Gecko codes to another location? Can I use Gecko codes with the Debug menu with this?
 

Punkline

Dr. Frankenstack
Premium
Joined
May 15, 2015
Messages
423
Sorry for the delayed response The Cape The Cape . I thought I'd have a code example to show for it, but I scrapped it to pursue a more flexible approach. It still uses Mytoc, but I haven't finished rewriting it yet.

Mytoc basically gives you a bunch of fairly small blocks of RAM to play with--but they're special blocks, because they can be referenced globally with one instruction.

You can use it however you like, but I would advise reserving it for pointers.

You get only 8 bytes of space with each block, but that means one is enough room for 2 pointers. With these globally accessible pointers, you can point to dynamic space.

Things like player entities (the things that hold memory of subaction instructions to display things on the screen) are dynamic -- but they can be referenced from the global player blocks. In this way, we can navigate to them with code without having to rely on exploiting context.

With 2 pointers, you can make the root of a linked list, or stack pointers that all involve a chunk of dynamic data that the code is using to do something complex.

---

Here are some examples of codes that utilize mytoc:
 
Last edited:

Punkline

Dr. Frankenstack
Premium
Joined
May 15, 2015
Messages
423
I was looking through the functions replaced by the big tournament mode menu region in Melee Code Manager a while back, and took note of some rtoc offsets used by the menu functions.

Just like mytoc, these offsets can be referenced from rtoc with a single instruction; and are vestigial outside of the tournament mode menu. The following rtoc offsets may be used like mytoc offsets in ANY DOL that has disabled tournament mode. I think I counted 0x1A0 bytes of useful rtoc-based global pointer space. UnclePunch UnclePunch Fizzi Fizzi DRGN DRGN T tauKhan

Code:
Tournament Mode Menu - Global Constants:

-0x5308(rtoc)    804DA6D8
-0x516C(rtoc)    804DA874
0x1A0 bytes



-0x5308(rtoc)    804DA6D8
-0x5304(rtoc)    804DA6DC
-0x5300(rtoc)    804DA6E0
-0x52FC(rtoc)    804DA6E4
-0x52F8(rtoc)    804DA6E8
-0x52D0(rtoc)    804DA710
-0x52C8(rtoc)    804DA718
-0x52C0(rtoc)    804DA720
-0x52BC(rtoc)    804DA724
-0x52B8(rtoc)    804DA728
-0x52B4(rtoc)    804DA72C
-0x52B0(rtoc)    804DA730
-0x52AC(rtoc)    804DA734
-0x52A8(rtoc)    804DA738
-0x52A4(rtoc)    804DA73C
-0x52A0(rtoc)    804DA740
-0x529C(rtoc)    804DA744
-0x5298(rtoc)    804DA748
-0x5294(rtoc)    804DA74C
-0x5290(rtoc)    804DA750
-0x528C(rtoc)    804DA754
-0x5288(rtoc)    804DA758
-0x5284(rtoc)    804DA75C
-0x5280(rtoc)    804DA760
-0x527C(rtoc)    804DA764
-0x5278(rtoc)    804DA768
-0x5274(rtoc)    804DA76C
-0x5270(rtoc)    804DA770
-0x526C(rtoc)    804DA774
-0x5268(rtoc)    804DA778
-0x5264(rtoc)    804DA77C
-0x5260(rtoc)    804DA780
-0x525C(rtoc)    804DA784
-0x5258(rtoc)    804DA788
-0x5254(rtoc)    804DA78C
-0x5250(rtoc)    804DA790
-0x524C(rtoc)    804DA794
-0x5248(rtoc)    804DA798
-0x5244(rtoc)    804DA79C
-0x5240(rtoc)    804DA7A0
-0x523C(rtoc)    804DA7A4
-0x5238(rtoc)    804DA7A8
-0x5234(rtoc)    804DA7AC
-0x5230(rtoc)    804DA7B0
-0x522C(rtoc)    804DA7B4
-0x5228(rtoc)    804DA7B8
-0x5224(rtoc)    804DA7BC
-0x5220(rtoc)    804DA7C0
-0x521C(rtoc)    804DA7C4
-0x5218(rtoc)    804DA7C8
-0x5214(rtoc)    804DA7CC
-0x5210(rtoc)    804DA7D0
-0x520C(rtoc)    804DA7D4
-0x5208(rtoc)    804DA7D8
-0x5200(rtoc)    804DA7E0
-0x51FC(rtoc)    804DA7E4
-0x51F8(rtoc)    804DA7E8
-0x51F4(rtoc)    804DA7EC
-0x51F0(rtoc)    804DA7F0
-0x51E8(rtoc)    804DA7F8
-0x51E0(rtoc)    804DA800
-0x51D8(rtoc)    804DA808
-0x51D4(rtoc)    804DA80C
-0x51D0(rtoc)    804DA810
-0x51CC(rtoc)    804DA814
-0x51C8(rtoc)    804DA818
-0x51C4(rtoc)    804DA81C
-0x51C0(rtoc)    804DA820
-0x51BC(rtoc)    804DA824
-0x51B8(rtoc)    804DA828
-0x51B4(rtoc)    804DA82C
-0x51B0(rtoc)    804DA830
-0x51AC(rtoc)    804DA834
-0x51A8(rtoc)    804DA838
-0x51A4(rtoc)    804DA83C
-0x51A0(rtoc)    804DA840
-0x519C(rtoc)    804DA844
-0x5198(rtoc)    804DA848
-0x5194(rtoc)    804DA84C
-0x5190(rtoc)    804DA850
-0x518C(rtoc)    804DA854
-0x5188(rtoc)    804DA858
-0x5184(rtoc)    804DA85C
-0x5180(rtoc)    804DA860
-0x517C(rtoc)    804DA864
-0x5178(rtoc)    804DA868
-0x5174(rtoc)    804DA86C
-0x5170(rtoc)    804DA870
-0x516C(rtoc)    804DA874
I highly recommend using these with Dolphin Memory Engine to create temporary pointer variables next time anyone is poking around memory. aldelaro5 aldelaro5
 

SinsOfApathy

Smash Journeyman
Joined
Feb 24, 2015
Messages
474
NNID
Psion312
God ****ing damn it. I just realized that's what 0x4330... was used for. I had been writing convuluted math on several functions trying to figure out what was going on.

Time to finally rewrite like 5 HSD functions to correct them.
 

Punkline

Dr. Frankenstack
Premium
Joined
May 15, 2015
Messages
423
God ****ing damn it. I just realized that's what 0x4330... was used for. I had been writing convuluted math on several functions trying to figure out what was going on.

Time to finally rewrite like 5 HSD functions to correct them.
Haha, yeah. The large exponent basically lowers the fidelity of each increment in the mantissa to an integral step, making it 1:1 after subtraction. Edit:




I’ve always thought it was a clever exploit of the floating point data type and used it a lot in my own codes; but these days I just use quantized load/store instructions to handle int<>float casting through the data type options made available in GQRs.
 
Last edited:
Top Bottom