Line 2:
Line 2:
{{yagcd}} <!-- http://hitmen.c02.at/files/yagcd/yagcd/chap13.html#sec13.3 and http://hitmen.c02.at/files/yagcd/yagcd/chap18.html#sec18.2.3 -->
{{yagcd}} <!-- http://hitmen.c02.at/files/yagcd/yagcd/chap13.html#sec13.3 and http://hitmen.c02.at/files/yagcd/yagcd/chap18.html#sec18.2.3 -->
−
'''Apploaders''' are small stubs bundled with every app, responsible for loading the rest of the app and executing it.
+
'''Apploaders''' are small bits of code included on every [[Wii disc|disc]] that tell the [[System Menu]] what regions of the disc to load for the disc to be booted.
−
== Disc Apploader ==
+
Each apploader has 4 functions: <code>entry</code>, <code>init</code>, <code>main</code>, and <code>finalize</code>. The <code>entry</code> function takes 3 pointers as arguments, and fills them with the <code>init</code>, <code>main</code>, and <code>finalize</code> functions{{Ref|https://github.com/dbarnett/wiimu/blob/a2bbe46a9b0af48be76564716a28a7b69aa77e74/source/disc.c#L322}}. <code>init</code> takes a print function as an argument and returns nothing. Meanwhile, <code>main</code> takes 3 pointers, which get filled with arguments to pass to DVDLowRead, and keeps getting called until it returns something other than 1. <code>finalize</code> takes no arguments, but returns the entrypoint, which the System Menu then jumps to.
−
Disc apploaders are called by the [[System Menu]]. The <code>entry</code> function takes 3 pointers as arguments, and fills them with the <code>init</code>, <code>main</code>, and <code>finalize</code> functions{{Ref|https://github.com/dbarnett/wiimu/blob/a2bbe46a9b0af48be76564716a28a7b69aa77e74/source/disc.c#L322}}. <code>init</code> takes a print function as an argument and returns nothing. Meanwhile, <code>main</code> takes 3 pointers, which get filled with arguments to pass to DVDLowRead, and keeps getting called until it returns something other than 1. <code>finalize</code> takes no arguments, but returns the entrypoint, which the System Menu then jumps to.
−
Disc apploaders appear to have [[Revolution OS]] strings; this probably means dev units had Revolution OS directly linked with them, possibly similar to the [[NAND Boot Program]].
+
Apploaders appear to have [[Revolution OS]] strings; this probably means dev units had Revolution OS directly linked with them, possibly similar to the [[NAND Boot Program]].
−
An open-source disc apploader is available from [https://hackmii.com/2008/08/open-source-apploader-iso-template/ HackMii].
+
An open-source apploader is available from [https://hackmii.com/2008/08/open-source-apploader-iso-template/ HackMii].
−
−
== NANDLoader ==
−
The NANDLoader is a small bit of code in every channel that initializes the [[Broadway]] and then jumps to the main function of the executable. It is an example of an apploader, used for channels.
−
−
There are open source tools available to inject a NANDLoader into regular binaries like {{User|DacoTaco}}'s [[OpenDolBoot]].
−
−
=== Wii ===
−
On the [[Wii]] the NANDLoader is included in a title's main binary ( app, in dol format). It is usually the first text section and should always be written to 0x80003400 (PowerPC reset vector){{check}}.
−
The NANDLoader should initialize the PowerPC and jump to the binary's main function.
−
−
=== vWii ===
−
On the [[vWii]], because the [https://wiiubrew.org/wiki/Espresso Espresso] only boots [https://wiiubrew.org/wiki/Ancast_Image Ancast Images], the NANDLoader must be signed. Nintendo solved this by adding title 1-512 (known as '''BC-NAND''') as a NANDLoader. When launching a title other than the [[System Menu]], IOS will start this NANDLoader to initialize the PowerPC. This NANDLoader in turn loads the title's main binary and jumps straight to it's entrypoint, skipping the title's NANDLoader which is included in title's binary.
−
−
Because the [[Homebrew Channel]] had its own NANDLoader, fail0verflow never bothered to set an entrypoint, as the custom NANDLoader knew where to jump. This resulted in the channel initially not being compatible with [[vWii]]. [[fail0verflow]] solved this by adding an entrypoint to the dol header. This resulted in the channel's NANDLoader being run on the Wii, and skipped in vWii.
−
−
== Starlet ELF Loader ==
−
This is a small stub present in [[boot2]] and every [[IOS]], in the same binary as the kernel, responsible for loading the kernel itself. Like with PowerPC apploaders, this software is required as an intermediate step.
−
−
== WFS Loader ==
−
Dragon Quest X has a special apploader that loads from a WFS USB device. For [[vWii]] compatibility, a special 1-513 title, internally known as '''BC-WFS''', comes preinstalled on all vWiis with this apploader, as a complete [https://wiiubrew.org/wiki/Ancast_Image Ancast Image].
== References ==
== References ==