d2x-cios
d2x-cios copied to clipboard
Add support for base IOS59
IOS59 is required by Dragon Quest X and the USB Repair Channel. It's similar to IOS58. but implements WFS functions for installing special game content to a USB drive. Adding support for this base IOS should (theoretically) allow these titles to boot via a backup loader. Known versions of IOS59 are v6689, v7201, and v9249.
I've been planning to do that anyways in the future, together with support for the other Wii Mini base IOS. However I can only begin with that when #76 is fixed (or a workaround is found) so that proper cIOS binaries can be compiled. Currently, it seems to be impossible for some reason to create working binaries from the source code in this repository, even when using the exact same compiler that was used in the past.
I tried creating a new entry in ciosmaps.xml
based on the IOS57/IOS58 entries, but it failed to install when attempting with the d2x installer.
<base ios="59" version="9249" contentscount="28" modulescount="5">
<content id="0x20" patchscount="7">
<!-- cIOS signature fields -->
<patch offset="0x00" size="4" originalbytes="0x66,0x69,0x72,0x6d" newbytes="0x1e,0xe7,0xc1,0x05"/>
<patch offset="0x04" size="4" originalbytes="0x77,0x61,0x72,0x65" newbytes="0x00,0x00,0x00,0x01"/>
<patch offset="0x08" size="4" originalbytes="0x2e,0x36,0x34,0x2e" newbytes="0x00,0x00,0x00,0x0a"/>
<patch offset="0x0c" size="4" originalbytes="0x31,0x30,0x30,0x34" newbytes="0x00,0x00,0x00,0x3b"/>
<patch offset="0x10" size="16" originalbytes="0x31,0x33,0x31,0x31,0x32,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00" newbytes="0x64,0x32,0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"/>
<patch offset="0x20" size="16" originalbytes="0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00" newbytes="0x62,0x65,0x74,0x61,0x35,0x33,0x2d,0x61,0x6c,0x74,0x00,0x00,0x00,0x00,0x00,0x00"/>
<patch offset="0x30" size="16" originalbytes="0x61,0x64,0x6d,0x69,0x6e,0x40,0x46,0x57,0x50,0x55,0x42,0x4c,0x49,0x53,0x48,0x00" newbytes="0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00"/>
</content>
<content id="0x1c" />
<content id="0x2" patchscount="2">
<!-- Disable DI DVD Video commands -->
<patch offset="0x6E5" size="1" originalbytes="0x01" newbytes="0x00"/>
<patch offset="0x775" size="1" originalbytes="0x01" newbytes="0x00"/>
</content>
<content id="0x3" />
<content id="0x4" />
<content id="0x5" patchscount="1">
<!-- Register alternative SDI module name without the initial slash -->
<patch offset="0x2138" size="40"
originalbytes="0xE6,0x00,0x03,0x70,0xE1,0x2F,0xFF,0x1E,0xE6,0x00,0x03,0x90,0xE1,0x2F,0xFF,0x1E,0xE6,0x00,0x03,0xB0,0xE1,0x2F,0xFF,0x1E,0xE6,0x00,0x03,0xD0,0xE1,0x2F,0xFF,0x1E,0xE6,0x00,0x03,0xF0,0xE1,0x2F,0xFF,0x1E"
newbytes ="0xE9,0x2D,0x40,0x00,0xE9,0x2D,0x00,0x03,0xEB,0x00,0x00,0x04,0xE8,0xBD,0x00,0x03,0xE2,0x80,0x00,0x01,0xEB,0x00,0x00,0x01,0xE8,0xBD,0x40,0x00,0xE1,0x2F,0xFF,0x1E,0xE6,0x00,0x03,0x70,0xE1,0x2F,0xFF,0x1E"
/>
</content>
<content id="0x6" />
<content id="0x7" />
<content id="0x8" />
<content id="0x9" />
<content id="0xa" />
<content id="0xb" />
<content id="0xc" />
<content id="0xd" />
<content id="0xe" />
<content id="0xf" />
<content id="0x10" />
<content id="0x11" />
<content id="0x12" />
<content id="0x13" />
<content id="0x21" />
<content id="0x22" />
<content id="0x18" patchscount="3">
<!-- Reroute ARM syscall write to USB Gecko -->
<!--patch offset="0x1F554" size="4" originalbytes="0xFF,0xFF,0x1F,0x20" newbytes="0xFF,0xFF,0x7B,0xD0"/-->
<!-- USB Gecko routines -->
<!--patch offset="0x270FC" size="128"
originalbytes="0x46,0x72,0x1C,0x01,0x20,0x05,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x06,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x07,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x08,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x09,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x0A,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x0C,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x0D,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x0E,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x0F,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x10,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x11,0xDF,0xAB,0x47,0x10,0x46,0x72,0x1C,0x01,0x20,0x12,0xDF,0xAB"
newbytes ="0xE9,0xAD,0x40,0x1F,0xE1,0x5E,0x30,0xB2,0xE2,0x03,0x30,0xFF,0xE3,0x53,0x00,0xAB,0x1A,0x00,0x00,0x07,0xE3,0x50,0x00,0x04,0x1A,0x00,0x00,0x05,0xE5,0x9F,0x30,0x58,0xE5,0xD1,0x20,0x00,0xEB,0x00,0x00,0x04,0xE2,0x81,0x10,0x01,0xE3,0x52,0x00,0x00,0x1A,0xFF,0xFF,0xFA,0xE8,0x3D,0x40,0x1F,0xE1,0xB0,0xF0,0x0E,0xE3,0xA0,0x00,0xD0,0xE5,0x83,0x00,0x00,0xE3,0xA0,0x02,0x0B,0xE1,0x80,0x0A,0x02,0xE5,0x83,0x00,0x10,0xE3,0xA0,0x00,0x19,0xE5,0x83,0x00,0x0C,0xE5,0x93,0x00,0x0C,0xE3,0x10,0x00,0x01,0x1A,0xFF,0xFF,0xFC,0xE5,0x93,0x00,0x10,0xE3,0x10,0x03,0x01,0xE3,0xA0,0x00,0x00,0xE5,0x83,0x00,0x00,0x0A,0xFF,0xFF,0xF0,0xE1,0xA0,0xF0,0x0E,0x0D,0x80,0x68,0x14"
/-->
<!-- Reroute IRQ9 to mload -->
<patch offset="0x28544" size="4" originalbytes="0xFF,0xFF,0x5D,0x32" newbytes="0x13,0x6D,0x00,0x11"/>
<!-- Korean key check -->
<patch offset="0x21424" size="1" originalbytes="0xD0" newbytes="0xE0"/>
<!-- Korean key -->
<patch offset="0x29078" size="16" originalbytes="0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00" newbytes="0x63,0xB8,0x2B,0xB4,0xF4,0x61,0x4E,0x2E,0x13,0xF2,0xFE,0xFB,0xBA,0x4C,0x9B,0x7E"/>
</content>
<content id="0x23" module="MLOAD" tmdmoduleid="-1"/>
<!--content id="0x24" module="EHCI" tmdmoduleid="3"/-->
<content id="0x24" module="USBS" tmdmoduleid="-1"/>
<content id="0x25" module="DIPP" tmdmoduleid="-1"/>
<content id="0x26" module="ES" tmdmoduleid="-1"/>
<content id="0x27" module="FFSP" tmdmoduleid="-1"/>
</base>
I also tried extracting, modifying, and repacking the WAD file with the above changes to the IOS contents. I then installed the new WAD using YAWMM (I tried variants installed to both IOS slot 59 and 244). The WAD installed, but the Wii seems to crash/freeze when loading it (using a backup of Dragon Quest X as a test case). I tried booting from both USB Loader GX (set to use IOS244 for the game load) and Neogamma (for a burned disc, set to reboot into IOS59 [which I replaced with the modified version]). I'm wondering if the USBS module could be conflicting with the WFS module that IOS59 uses. I'll try another version using the EHCI module instead of USBS later this week.
I think it's more likely that the *.app files need some modifications for IOS59 as well, same as when I ported the cIOS to the Wii Mini.
I believe you’re right.
I tried using EHCI instead of USBS and it gave the same result, a crash or black screen (depending on the loader), when attempting to boot.
Unfortunately I'm not sure which hex values in which *.app files I'd need to further edit.
Yeah, it's not easy to A) find the positions in the *.app files and edit them without breaking something else, and B) to even find what needs to go there by analyzing the IOS59. Not that easy to explain either. In the future when the cIOS code can actually be compiled to proper binaries I might look at that again and add the necessary code for IOS59, but I'm not really interested in doing all that with a hex editor again.
I just added code changes to the cIOS in my fork at Leseratte10/d2xl-cIOS@601207d726ba6aabc7cb22f8892db639b5b94d03 - the *.app files did indeed need some changes for IOS59. Maybe you'll get that to work using this version (if you don't want to use my fork you could also apply that commit onto this repository) - I don't have any game using IOS59 so I cannot test this at all.
Thank you. I was able to get it to compile/patch/install, but unfortunately the Wii seems to freeze whenever attempting to load the patched cIOS59. Not quite sure what the issue could be. For now, I'll just stick to emulating in Dolphin.