AerialX / rawksd

Wii Rawk!
38 stars 11 forks source link

Documentation for "shift" and "dlc" patch types #6

Open Leseratte10 opened 2 years ago

Leseratte10 commented 2 years ago

First of all, it's great that Riivolution is receiving updates again since December. Last release was from 2013 so I assumed it was long dead.

Looking through the source code, this is the first time I'm hearing about the "shift" and "dlc" patch types in Riivolution. I can't find anything about these on the internet.

"shift" is, if I'm reading this correctly, a way to rename a file on disk to have a different name instead. But what about "dlc"? The code is pretty complex and it seems to involve the IOS module. Is there an explaination about what it does and how it works? Is this to patch DLC files? Or to redirect DLC loading to load from the SD instead of from the NAND?

AerialX commented 2 years ago

Is this to patch DLC files? Or to redirect DLC loading to load from the SD instead of from the NAND?

Yeah <dlc/> is easy to explain, it's just a way to override in-game DLC from sd/usb/riifs/wifi.

Specifically, it's used by RawkSD to tell the dipmodule to mount it from the external file source (and look at AppDir/AppFile/TitleFile/etc for all the gory implementation details). The RawkSD pc tool packages up the files appropriately if you need an example of what the data looks like on SD, but I don't think it does anything too unusual compared to the usual structure of unpacked DLC. Most of the magic is in dipmodule to appease the system and tell it that these dlc files exist and so on.

I suppose it could be documented, though it's not a particularly polished feature.

"shift" is, if I'm reading this correctly, a way to rename a file on disk to have a different name instead

I honestly don't remember, it looks like it was likely an unfinished element. At one point there was a way to insert holes into existing disc files (imagine introducing extra space in a CRIWARE CPK style archive for example), to shift or move existing data around in that file to a different offset to make space for new subfiles, or a larger archive file index, etc. If you think of <file/> as an analogue of memcpy, <shift/> would've been memmove. My guess is it never ended up finished once the graces translation was scrapped. There was often the option of just adding new data to the end of the archive and updating the TOC offsets anyway as long as you didn't need to create more space in a file.

Currently it does indeed just effectively copy a disc file, which seems kind of pointless and I couldn't even tell you whether anything has ever used it or not.

Leseratte10 commented 2 years ago

An efficient way to copy a disc file is what I assumed "shift" would do. That's great, because currently there's a mod that includes a bunch of files in the Riivolution bundle that are actually present on disk already, just under a different name. Given that I now know there's an XML entry I can use to "rename" files on disk, these can all be removed from the SD card, saving a bit of space.

Thanks for the explaination of these two types. I'm going to play around with these and see if I can get them to work.

AerialX commented 2 years ago

Given that I now know there's an XML entry I can use to "rename" files on disk, these can all be removed from the SD card, saving a bit of space.

Keep in mind its pitfalls if you really want to use it:

Leseratte10 commented 2 years ago

Do I understand that correctly, if I wanted to take the on-disk file A.bin and make that available to the game under B.bin, I not only need <shift source="/A.bin" destination="/B.bin" /> but I would also need <file disc="/B.bin" external="/whatever.bin" />, with "whatever.bin" being a nonexistant file path? Interesting ...

AerialX commented 2 years ago

This is just an assumption... but if B.bin isn't already present in the game, then likely yes - whatever.bin would need to exist on SD, but could be an empty file. Also would need a create="true".

Leseratte10 commented 2 years ago

Okay, I'll play around with that and see how well I can get it to work. Thanks.