Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The party swaps have a bit of a wacky story to them. Party swaps are one of the best tools in terms of the amount of bytes manipulated, but the way party swaps work are not understandable intuitively. Here is a description of the memory swapped, from MrWint's Save Corruption TAS:
- The species is swapped (1 byte): $d164 + A <-> $d164 + B
- The Pokémon data is swapped (44 bytes): $d16b + 44*A <-> $d16b + 44*B
- The Pokémon OT name is swapped (11 bytes): $d273 + 11* A <-> $d273 + 11*B
- The Pokémon nickname is swapped (11 bytes): $d2b5 + 11*A <-> $d2b5 + 11*B
- Back when I routed the party swaps, I did so through trial and error, observing memory, and with a bit of intuition. Only now when I tried to understand how these party swaps worked, I realized numerous improvements. Unfortuately, due to the timing of the GDQx event not allowing time to redo the TAS, my lack of motivation to understand party swaps which made me not realize how these swaps were inoptimal, and a recent 30 second strat improvement anyway which defeats the purpose of redoing the TAS with the improved swaps, the swaps will stay inoptimal. The following is merely an explanation of the swaps, and do not imply any sort of optimal behaviour. Note that slots are zero-indexed here, but references to Party Pokemon (e.g. Party Mon 1 nickname) are one-indexed.
- - Swap slot 0 and 1, then slot 1 and slot 9. These swaps are necessary to place Party Mon 1 nickname into memory which will be swapped later. This might be able to be merged into a single swap (slot 0 with slot 9)
- - Swap slot 9 and 10, then slot 15 and 16. These swaps do the following:
- - Slot 9 & 10's Data: Swaps Rival Name with the beginning of Item Memory. This also has an effect of swapping the memory where Party Mon 1 nickname was placed in the previous swaps into Rival Name, which provides a save memory location for Party Mon 1 nickname to reside for a later swap where it is swapped into Caught Flags.
- - Slot 9 & 10's Nickname: Swaps the beginning of Item Memory into a later portion of Item Memory. This is undesirable because it requires scrolling later into memory to the items that represent the Rival Name, but may actually be necessary because the next swap does the reverse of this, and also does another crucial aspect of the setup to execute the Hall of Fame script, and may be the best way to achieve the behaviour wanted.
- - Slot 15 & 16's OT: Swaps the beginning of Item Memory into a later portion of Item Memory, therefore reverting the above swap.
- - Slot 15 & 16's Nickname: Swaps some map data with other map data. The important behaviour here is that it swaps a map ID which corresponds to the same map bank as the Hall of Fame, which is necessary to have the Hall of Fame script run.
- - Close the Party Menu and open the Item Menu.
- - Merge the first TM41 with the second TM41 to create TM41 x99. The newly created TM41 x99 stack corresponds to the pointer $63f1, which points to safe memory before the Hall of Fame script.
- - Swap the 2nd TM41 (TM41 x99) with the item below CANCEL (todo list position), to align it correctly with the memory location of the script pointer.
- - Swap slot 16 and 23, then slot 23 and 22. This places the TM41 x99 above into the map script pointer. Swapping 16 and 22 would not work as illustrated by the following diagram:
- If we swap slot 16 with slot 22.
- TM41 x99 <-> Script Pointer (OT)
- Script Pointer <-> Other Map Data B ($d3b2-$d3bc) (nickname)
- But if we swap slot 16 with 23, then 23 with 22.
- TM41 x99 <-> Other Map Data A ($d370-$d37a) (OT)
- Script Pointer <-> Other Map Data B ($d3b2-$d3bc) (nickname)
- Other Map Data A ($d370-$d37a) <-> Script Pointer (OT)
- Other Map Data B ($d3b2-$d3bc) <-> Other Map Data C ($d3a7-$d3b1) (nickname)
- Note that slot 21 as the intermediate swap would not work since it overlaps with other crucial map data, but slot 20 might.
- - Swap slot 19 and 12. This swaps Party Mon 1 nickname stored in rival name from the above swaps into Pokedex Flags. The nickname is specifically crafted to give a caught amount of Pokemon of 60-69, which gives a Pokedex rating that does not require an input to advance through, allowing input to be ended earlier.
- - Exit the Party Menu and Start Menu. The opening walk in the Hall of Fame script is executed, however OAK's Hall of Fame text prints an error (Error 1) because the Party Swaps had also loaded an invalid Map Text pointer which prints an error message that is faster than the normal Hall of Fame text.
- - The Hall of Fame script executes. Input has already ended after clearing the Error 1 text, and the earlier Pokedex Caught Flag manipulation prints an inputless Pokedex rating.
- == Some Extra Stuff ==
- Why can't we swap slot 6 with slot 0 (or slot 12 with slot 6) to place the nickname into Dex Flags? Why do the weird swap trickery?
- Slot 6 with 0 has the following issue:
- OT1-OT4 (inclusive) <-> PartyMon1 (data)
- Nick1 <-> OT1 (OT)
- CaughtFlags ($d2f7-$d301) <-> Nick1 (nickname)
- So what actually happens is we swap the first 11 bytes of PartyMon1 into CaughtFlags.
- But Nicknames and OT overlap, so we can just swap slot 12 and slot 6, right? Unfortunately no.
- CaughtFlags ($d2f7-$d301) <-> Nick1 (OT)
- ItemData ($d339-$d343) <-> CaughtFlags ($d2f7-$d301) (nickname)
- So what actually happens is we swap a portion of ItemData into CaughtFlags.
- This is the big reason why party swaps are hard to deal with, due to the overlap of swaps.
- Optimal swaps would consist of naming the player with the preset YELLOW (or some other manipulated name) and the following (note that these have not been tested):
- 9 <-> 10
- 15 <-> 16
- Item swaps.
- 16 <-> 20
- 20 <-> 22
- 12 <-> 6 (this might be able to be moved earlier)
- Note that these improvements are all irrelevant anyway due to a recent 30 second strat improvement which does an entirely different set of swaps, as well as some other modifications to the route.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement