Jayveer / Decima-Explorer

A program to unpack and pack files from games using the Decima engine.
MIT License
166 stars 23 forks source link

Repacking issues #24

Closed alphazolam closed 4 years ago

alphazolam commented 4 years ago

I am trying to do some file swap mods on HZD PC by repacking Initial.bin, and I can repack the whole 17GB bin file, but when I view the files that I updated during the repack they are either filled with the wrong hex or they crash the game (and also crash ProjectDecima when trying to view).

Also it would be really great if we could undo a repack and restore bin files using some kind of log, to uninstall modifications without having to restore a massive backup file every time. Maybe to decrease the time repacking and make uninstalling easier, we could have all the repack data appended to the end of the bin file and just change the TOC, size and offsets for that data? Then maybe we would only have to really repack the last bits of the file, instead of the whole thing. Not sure if this is possible with Decima though

Jayveer commented 4 years ago

Maybe to decrease the time repacking and make uninstalling easier, we could have all the repack data appended to the end of the bin file and just change the TOC, size and offsets for that data? Then maybe we would only have to really repack the last bits of the file, instead of the whole thing. Not sure if this is possible with Decima though

This is how it's currently doing it, the part that takes a while is that a chunk entry has to be added in the TOC. Also the reason i can't use this to 'undo' a repack is because the original size, and all changed information isn't stored anywhere.

As for HZD repacking, part of the problem may be that I've noticed some files don't decompress properly withe the ooz library so I'll add a fallback to use a oo2core dll if that happens. But as well as that depending on what you're doing just swapping files will most likely cause crashes in the game either way, there are lots of references in the core files which won't line up, hence the crashes.

alphazolam commented 4 years ago

Also the reason i can't use this to 'undo' a repack is because the original size, and all changed information isn't stored anywhere.

Maybe you could save that information of the original filesize and offsets of where data was changed (and from what) in an external log file? I worked on an injector for Rise of the Tomb Raider's TIGER archives and it worked like that, uninstalling by truncating the file to the size in the log entry and changing all the values at the specified offsets back to what they were in that log. There was an entry for each file injected and they were used to uninstall all mods at once.

But as well as that depending on what you're doing just swapping files will most likely cause crashes in the game either way, there are lots of references in the core files which won't line up, hence the crashes.

You are right, but there may still be a way to do character swaps by swapping core files. I've seen a youtube video of it done on PS4, and the author said he did it by swapping "references to HumanoidBodyVariants associated with outfits."

Also, I'm attaching a screenshot of what the hex of my swapped core file looks like after being repacked (this file normally has strings in it). And I wanted to mention that I had to download oo2core_7_win64.dll and put it next to DecimaExplorer, or else the repack would abort without writing anything repacked_file

Thanks for all the work you've done on this BTW, it is amazing

REDxEYE commented 4 years ago

I added support for packing and unpacking archives, you can look at my implementation to find what's wrong with your code https://github.com/REDxEYE/ProjectDecima_python

REDxEYE commented 4 years ago

packing and unpacking feature will be ported to ProjectDecima in 2 or more weeks

Jayveer commented 4 years ago

Maybe you could save that information of the original filesize and offsets of where data was changed (and from what) in an external log file? I worked on an injector for Rise of the Tomb Raider's TIGER archives and it worked like that, uninstalling by truncating the file to the size in the log entry and changing all the values at the specified offsets back to what they were in that log. There was an entry for each file injected and they were used to uninstall all mods at once.

I don't really want to do this as I don't like the idea of saving a file onto the users computer that they themselves haven't initiated. maybe I'll consider it in the future.

You are right, but there may still be a way to do character swaps by swapping core files. I've seen a youtube video of it done on PS4, and the author said he did it by swapping "references to HumanoidBodyVariants associated with outfits."

A 'reference' in this term is rather ambiguous, is it referring to the file hash? The guid? You may want to get more information from the user although it seems they are reluctant to share information so you may not have much luck. I can try to look into how to do these swaps when I get time.

Also, I'm attaching a screenshot of what the hex of my swapped core file looks like after being repacked (this file normally has strings in it). And I wanted to mention that I had to download oo2core_7_win64.dll and put it next to DecimaExplorer, or else the repack would abort without writing anything

Yes sorry, I forgot to mention in the readme that it requires the dll to repack. Also you will want to use the dll that comes with Horizon (version 3) .

Also I was mistaken when I said that Horizon doesn't decompress properly, as it was the PS4 version where that is the case, not the PC version which decompresses fine. Also I gave repacking a go and just like Death Stranding I can repack textures fine so I'm not completely sure what the problem you're having is, but maybe you could try the GUI version of the repacker I just released and see if you have more luck with that.

horizon_repack

Jayveer commented 4 years ago

I will be closing this issue as I'm not seeing any issue as of my post above and have not heard from the user since.