Figured out and explained by dragonbane0
It is possible to unload actors in the Wind Waker by fragmenting the dynamic memory. This is the most complex glitch in the Wind Waker. It has a lot of potential to save a lot of time in speedruns, but due to its complexity there are no good setups known to make use of it in a fast maneur.
The game has 2 memory spaces for actor data which are dubbed the ACTor space (big; used for file data) and DYNamic space (small; for dynamic actors such as rupee spawns; stores instances of loaded actors with their runtime variables; can be used as backup space in case the ACT space runs out)
- Space gets filled up like a double linked list from top-bottom
- Each entry points to the prior and next one. Free space has a size parameter so the game knows immediately how much can fit there
- A separate list of loaded actors (by name) keeps track of the amount of times actors exist in the game. If the game attempts to construct an actor the counter gets increased by 1, if it gets destroyed the counter is reduced by 1. An actor gets destroyed either when you kill an enemy for example, hit a loading zone or leave the room (the actor gets destroyed after the door closes which occurs AFTER the next room loaded)
- Once 0 instances of an actor remain in the game the memory space associated with it is declared as free (the game notes how big the space is) and the entry is wiped from the loaded actors list
- Once you open the next door the memory manager will attempt to merge the free space with other adjacent free memory blocks which only works if there is no used memory block in-between. This process happens shortly after the next room was loaded and is intended to keep as many big memory blocks as possible and avoid a lot of smaller ones. So if you have actors loaded from room 1, the space gets declared as free in room 2 if the actor is not used in that room as well. Finally in room 3 the space will be merged as best as possible. If you kill all instances of an actor (in this case an enemy) in room 1, the space will already be declared free while you are still in room 1. Thus the memory will be merged in room 2 instead
- Going through many rooms will naturally cause some fragmentation of this list leaving many smaller blocks in-between that can't be merged until you hit a loading zone in which case everything gets cleared
- When a new actor needs to be loaded, the game loops through the list from top to bottom and tries to find a big enough slot to fit the data in. If an actor is too big to fit into any of them including the remaining memory at the very bottom of the list (which can only realistically happen with fragmentation and many actors loaded at the same time), the game throws an allocation error. A failsave kicks in and the game attempts to reserve space in the DYN space instead (this space doesnt get touched by file data otherwise)
- If the DYN space is already filled as well the game throws a second allocation error and finally an archive mount error. All space is filled up or there is not a big enough slot to fit the data in, the actor can not be loaded
- Due a programming oversight the instance counter will still be increased, but since no actor was actually spawned, no destroy process will occur if you leave the room or hit a loading zone. Thus the instance counter can only rise and will never hit 0. This creates a dead actor that will never be cleared from the loaded actor list and has no data associated with it. Thus when the game attempts to spawn an instance of that actor in the future it will already find the entry in the list and assume the actor was loaded, but since there is no pointer to any memory space the spawn process will always fail. Even if plenty of memory space is available later, the game won't attempt to load the actor object again. This can only be fixed by either overflowing the instance counter to set it back to 0 or reboot your console
- Furthermore, the game only has 64 total slots to store loaded actor names. If you happen to fill up this list to the max by creating a bunch of dead actors, no actor can be loaded anymore period. This includes the barrier
Discovered by Hyxost
A glitch known as Invisible Bombs will cause DYN space to fill up. To perform the glitch, you must pull out a bomb on the overworld before the island fully loads. This results in Link pulling out an invisible bombs that will not unload properly. By pulling many invisible bombs you can usually fill up DYN space enough to cause many of the following glitches. Note that pulling out a single invisible bomb and then savewarping will cause the game to perform a full, slow reset to clear all corrupted memory. Also, picking up an invisible bomb that is on the ground will crash your game.
Song Stone Unloading
Video showing the glitch happening:
- ACT space fills up (and gets fragmented) if you go through the entire temple and reach the room before the song stone (even without anything stored)
- Due to too much fragmentation/actors loaded the game can't allocate enough space anywhere for the Bokoblin actor data inside the room before the song stone. An allocation error is thrown. Game switches to the DYN space and finds enough space to store the actor data there
- After the room before the song stone loaded, the unloading/merging process of unused actors/memory space from previous rooms frees up enough space again for the song stone actor (if you dont store a chest)
- Storing a chest fragments the memory even more since in this case the butterfly pendant model has to be loaded and can't be cleared. This is due the instance counter remaining at 1 until you savewarp/hit a loading zone which destroys it. So that piece of memory can't be cleared and merged with other adjacent free memory while you are moving inside the dungeon. It just so happens that having this setup puts the pendant roughly in the middle of the remaining memory which results in the merging process not being able to do much since it is in the way. Thus none of the remaining slots are big enough to fit the song stone actor
- Now the ACT space is filled up/fragmented and the reserve in the DYN space is used as a failsave for the Bokoblin actor
- While attempting to load the song stone in this situation the game throws an allocation error for the ACT space, tries the DYN space and throws a second allocation error. The game now gives up and finally throws an archive mount error
See the Wind Temple page.
Tower of the Gods Skip
Discovered by dragonbane0, with invisible bombs by TrogWW
By fragmenting DYN space enough, you can prevent the cutscene of Tower of Gods raising from playing. This allows you to have control of Link on the cutscene map (the ADMumi map). On this map, savewarping will put you at the bell at the end of TotG, skipping all of the temple. Note that you still need to enter the temple later to get the Command Melody.
There are two known ways to break the cutscene. One is to simply pull invisible bombs over and over again until DYN space is filled up enough. The other is much more complicated.
Various Cutscene Skips
Discovered by TrogWW
With a precise DYN memory setup, it is possible to skip the Helmaroc cutscene and the Tetra to Zelda transformation cutscene while still setting all the flags necessary to progress the game (animation set 2 and the flags for breaking the barrier later). Doing it again has proved itself to be difficult. This is timesave potential.
- This glitch will only work well with big actors (file size wise), since smaller ones would still fit most of the time into one of the slots
- Savewarping/hitting a loading zone will clear most space and fix potential problems/fragmentation. So this glitch will only work well in dungeons/overworld
- Storing multiple chests can only create more fragmentation if the content is different, else you just increase the instance count. It can also lead to the game actually creating bigger slots depending where the second stored chest goes. In the case of Wind Temple storing two different chests can prevent the glitch due different alignment that works out in the games favour
- Door storage can also help to reduce available memory space
- Most of this applies to Twilight Princess as well and could be the cause of the Devil/Ben cutscene glitch
Last updated 01/01/2019