rawksd icon indicating copy to clipboard operation
rawksd copied to clipboard

Documentation for "shift" and "dlc" patch types

Open Leseratte10 opened this issue 2 years ago • 6 comments

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?

Leseratte10 avatar Apr 23 '22 16:04 Leseratte10

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.

AerialX avatar Apr 23 '22 19:04 AerialX

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.

Leseratte10 avatar Apr 23 '22 19:04 Leseratte10

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:

  • you'll still need to use a <file/> node of some sort to create an empty destination file if it doesn't already exist
  • If the source file has any <file/> replacements, I think you'll end up copying the external/patched file rather than the underlying data from the disc
  • it's likely completely untested :stuck_out_tongue:

AerialX avatar Apr 23 '22 19:04 AerialX

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 ...

Leseratte10 avatar Apr 23 '22 19:04 Leseratte10

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".

AerialX avatar Apr 23 '22 19:04 AerialX

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

Leseratte10 avatar Apr 23 '22 19:04 Leseratte10