Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSARC Unpacker #66

Open
MilchRatchet opened this issue Oct 24, 2021 · 4 comments
Open

PSARC Unpacker #66

MilchRatchet opened this issue Oct 24, 2021 · 4 comments
Labels
Feature Something new UI Replanetizer UI

Comments

@MilchRatchet
Copy link
Contributor

Currently it is non trivial to unpack the psarcs as the download sources of many tools are offline and the rest are either only available through source code or through our discord.

I have no clue how feasible it is to encorporate this here but we should at least consider it.

@MilchRatchet MilchRatchet added Feature Something new UI Replanetizer UI labels Oct 24, 2021
@maikelwever
Copy link
Member

maikelwever commented Dec 10, 2021

Reading from psarcs is not that difficult, enough C# snippets can be found to achieve that. Adding a tool that can extract psarcs in their current folder would be pretty doable. But it's also quite inefficient on storage if you only wanted to read some data.

Reading and writing in-place is the problem mostly, as rewriting the entire arc is slow, and just appending new data will bloat up the file size.

I've been thinking about this in the past, and a virtual filesystem would fix this problem. Specifically, a virtual filesystem that is composed of layers of other filesystems. This way, writes will go to the top level, and reads will pick the first occurrence of a file, from top to bottom.

At the bottom we have the game data folder, which also contains the big psarc file. We mount the psarc file on top of the data folder, since they share the same folder structure anyway. On top we mount a folder that the user specifies, let's call this workspace folder. We send write calls directly to the workspace folder, bypassing the VFS. Some smartness to check if the file we're writing is already identical in the game data folder or psarc would be required, otherwise this would just be a very inefficient psarc unpacker.

Hopefully, you could then just copy your workspace into the game folder on your PS3, and it would load the changed files automatically. I'm not sure if that works or if you'd still need a dummy psarc in that case.

I've been experimenting with such a setup a while ago, using https://github.com/xoofx/zio , which provides a bunch of virtual filesystem tooling for C#. I've also copied some code from another C# psarc unpacker, and put it into a Zio interface: https://github.com/maikelwever/Zio_PSArcFIleSystem , but that's not polished in the slightest at this moment.

The most boring part is to rewrite every single file reading call currently in LibReplanetizer to the new VFS. Most standard library utils (for example walking or globbing through directories) are not compatible with VFS, and would need to be replaced as well.

It would be logical to combine something like the above with a way to open up an entire ps3 disc in Replanetizer, and showing all detected games and levels in the UI.

@MilchRatchet
Copy link
Contributor Author

Hopefully, you could then just copy your workspace into the game folder on your PS3, and it would load the changed files automatically. I'm not sure if that works or if you'd still need a dummy psarc in that case.

I think the files in the psarc take precedent over the other files, meaning if we only wanted to store the files that changed we would need to delete those files from the psarc. The easiest would probably then be to simply have an empty dummy psarc and simply store all files even if they were not changed, this way we could simply ignore having to modify psarcs ever. Not sure whether the VFS is still that useful then.

@stiantoften
Copy link
Contributor

stiantoften commented Dec 11, 2021

It would be useful to have an "export to psarc" option in case you want to pack up the levels for easier installs on other systems. This could be implemented as a seperate thing though, with a disclaimer that the export will take a while since it has to rebuild it all.

@MilchRatchet
Copy link
Contributor Author

I have made a C++ library for interfacing with playstation archives. It is still in an early state but once I have implemented a C API, we could think about integrating this into Replanetizer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Something new UI Replanetizer UI
Projects
None yet
Development

No branches or pull requests

3 participants