Advertisement
Zoinkity

Doubutsu no Mori Disclaimer

Jan 6th, 2021
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.04 KB | None | 0 0
  1. The previously-released Doubutsu no Mori patches are irredeemably broken and cannot be fixed without completely rewriting existing code. Band-aid patching will not suffice.
  2. *Under no circumstances should this be used as the base of any further work.*
  3.  
  4. This extends well beyond the message generation soft-locking when a save file is loaded or buffer overflows during certain events.
  5.  
  6. There are multiple problems, but the single most important is that rewritten text functions and event generation are not threadsafe.
  7. For those of you who are unaware, typical N64 software uses a series of threads and messaging, just like your OS. There are prominent threads dedicated to audio, video, main execution loop, debugging, an idle thread, etc. as well as many minor or disposable threads, such as timers.
  8. Doubutsu no Mori, and by extension the Zelda titles, use an overlay system where blocks of code are loaded into allocated blocks of memory and the addresses corrected. It's relatively the same concept as utilizing TLB mapping to abstract addressing but does not require the same kind of KB address alignment (at least out of the box). Only the main runtime and certain buffers are always available at given addresses. Some code will always be at a fixed address (though not always loaded), others will always be loaded together and their relative addressing predictable, and most will be at arbitrary addresses--though often, but not always, those may be the same addresses.
  9. When the patches were first created, the previous paragraph would have been a good thing to know.
  10.  
  11. The intrinsic problem is two-fold. Some of what was believed to be static addressing in fact is not, and some of what was believed relative also wasn't. There are conditions when overlays driving events are attempting to call necessary rewritten text and script functions that aren't loaded, and other times where the offsets within an overlay called by another are no longer valid. The fact it even works half of the time is almost incredible.
  12.  
  13.  
  14. Another serious issue regards proper nouns. The table of nouns (names, items, etc.) used in speech, messages, and whatnot presumes a fixed size, has a fixed number of entries, and is directly referenced in so many places manually it would be a pain to try to move or resize. A somewhat late addition was a script command that acts as a reference to a string in a table, to be inserted only at display time. This part (probably and or mostly) works well enough.
  15. The issue is that it wasn't planned from the beginning and isn't integrated as well as it should be. In general, anything hitting the noun table should be assumed one of these entries and inserted verbatim. The easiest way to implement that is to restore the original text bank as nothing but a series of references into a new text bank, which contains the actual text. The advantage is then every blasted message generator won't need to be patched to produce these values--a generator which isn't at as static an address as expected. As it stands, even with reference words it is impossible to display all the debug text strings.
  16. This affects far more than I'd care to admit. Missized text balloons, clipped names, nonsense in messages, and noun table overflows when the full-length text is mistakenly used are the most common issues. The feature and everything that would utilize it needs to be rewritten from the ground up.
  17.  
  18. There are other relatively correctable problems, mostly buffer overflows. That's fairly easy to fix in most cases by just changing overlay size allocations.
  19.  
  20.  
  21. As far as project resources, there are more sensible ways to handle inserting and resizing overlays, plus the original compression algorithm has been reversed (unless you just use the original tool from the leaked source). Sylk is...not a good format, and UPS was literally because every other option at the time was worse.
  22.  
  23. Who knew dropping the entirety of the GC script for the semi-sequel wouldn't work as well as expected? It would be exceptionally wise to just redo the patch from scratch.
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement