Anniversary Edition/Framework

From OniGalore
< Anniversary Edition
Revision as of 02:59, 6 April 2013 by Iritscen (talk | contribs) (first stab at describing how XML patching works; unanswered questions are how the AEI handles conflicting patches and how exactly patched .onis get put back into the mix to be combined into .dats)
Jump to navigation Jump to search

The Anniversary Edition Seven introduced a revised framework which installs from scratch, separate from any previous Editions. Following is a rundown of what the Installer is doing, from start to finish. To learn how to make your own mod package, which is required in order for the AE Installer to handle your mod properly, see Making a mod package. To understand the material below, you should first be familiar with Oni's .dat files on a general level, so OBD is recommended reading.

Initialization

When first running the Installer, this is a one-time process that uses OniSplit to break the .dat/.raw(/.sep) files in Oni's GDF and breaks them into their constituent resources, yielding thousands of .oni files. These files are stored in temporary folders, one for each level. Next, the Installer performs what is called globalization: in order to allow modders access to (nearly) all data in all levels, it moves the .onis from each game level's folder to level 0, discarding duplicates (for instance, instead of making all characters available globally, BWest would put the ONCCs in each level for the characters they needed, to save memory; this means that the same character data can occur many times throughout the game data). The exception to this globalization is each level's AKEV and all child resources, its title, fail and win screens, and its LSI. Finally, the Installer recombines those folders of .oni files into the .dat/.raw(/.sep) files for each level, in AE/AEInstaller/vanilla/. Note that no data has been modded yet, just reformatted.

Installation

After this, the user can choose some mods to install. When the Install button is clicked, the Installer starts off by deleting the existing .dat/.raw(/.sep) files in AE/GDF to start from a blank slate. It then iterates through each mod package you selected, and sends a command to OniSplit to combine the .dat for that level (in AEInstaller/vanilla/) with the .oni files from whichever packages have files meant for that level. The final .dat/.raw(/.sep) files are then created in AE/GDF.

When one package overlaps with another in some way, such as two packages that provide new textures for the same character, which one will take precedence? The answer is that the Installer goes in ascending order by package number. If five copies of the same .oni file are encountered one after another, only the last-encountered one will be used. Thus, a package numbered 11111 will override package 11110 wherever their files conflict, when they are both installed. Note that this is on a file-by-file basis, so package 11111 could be used intentionally to override only certain files in 11110, say, to improve or fix them. On the other hand, this might be an undesirable interaction. It's left as an exercise to the modders to be aware when there's an unwanted interaction and to mark their mod as being incompatible with the other one.

XML patching

To read about the purpose of XML patches, visit the page Making a mod package. Here, we'll simply describe the process by which they are installed. XML patching takes place before installation, because the .oni files need to be patched before they are combined back into .dats. Therefore, when about to begin installing the user's selected mods, the Installer looks for any patches (.oni-patch files) in those mods. For each file to be patched, the AEI then finds the highest-numbered package which has such a .oni file (in other words, patches have higher priority than any package does by number -- regardless of the number of the package containing said patch). If there is no copy of that .oni file in any selected mod, the AEI extracts the .oni from the vanilla .dat of the level named by the patch (like .onis, .oni-patch files are to be placed in the folder levelX_Final, with X being the number of the level whose resources are added to or replaced). Once all the .oni files to be patched have been collected from mods and vanilla .dats, the patching instructions found in the .oni-patches are combined into one temporary file for performance reasons, and this file is passed to xmlTools. The .oni files having been patched, they are then combined along with the unpatched .onis from the selected mods into .dats, as described above.