emoose / xbox-winfsp

Brings native support for Xbox filesystems (FATX, STFS & GDFX/XGD/XDVDFS) to Windows.
62 stars 6 forks source link

Add package creation support #3

Open cfbrevamped opened 3 years ago

cfbrevamped commented 3 years ago

Hey there, was just wondering if there's any way you could add package creation support.

I know it's not a small request, but we're currently working on a tool for a game, and we're trying to make as user-friendly as possible. We're trying to do all save file processing in the background, so being able to automate it with a command-line tool would be huge. We haven't seen any command line tools for for STFS extraction/replacing/resigning at all, only GUI solutions like modio, horizon, and velocity.

Thanks a ton in advance.

emoose commented 3 years ago

Don't really know of any cmd-line tools that can do that neither unfortunately, X360PkgTool by xorloser is maybe only command-line STFS tool that I can think of, but doesn't seem like that has any support for the things you need.

If your tool is written in .NET you could maybe link it to one of the C# STFS libraries that are around such as Le Fluffie's X360 project, pretty sure that has methods for creating packages programmatically (if you aren't using .NET maybe you could make a quick cmd-line .NET app that wraps the functions from there and make your tool run that instead)

Probably not likely xbox-winfsp will have support for writing packages soon though... but didn't realize there was such a lack of tools for this, I did try working on a cmd-line STFS util years ago but didn't go that far with it, maybe I'll try looking into that again.

cfbrevamped commented 3 years ago

Thanks so much for the response!

Unfortunately our tool is written in JS using Electron, so we've just decided to package tools (such as pfdtool by flatz for PS3 decryption/encryption) and call them in the background when running the app to automatically decrypt/extract, modify save data, then repackage/re-encrypt all in the background.

We were able to find an old project by Rocky5 (did a lot of work on original xbox homebrew and some 360 stuff) who created a tool that would do what we need, but when running or trying to build ourselves, it's throwing an out-of-bounds error. Not sure if you're familiar with the tool at all but here it is CON_Rebuilder.zip

If you ever do happen to look into it again let us know, and again, thanks for the information!

emoose commented 3 years ago

Ah neat, looks like that's wrapping the X360 lib I linked, but also gives me an OOB error too... Looking at the code it seems to be trying to get cmd-line args without checking if they're actually there, seems like it needs to be ran like: CON_Rebuilder.exe rebuild "[file-name-inside-package]" "[path-to-file-to-replace-with]" "[path-to-CON]" "[path-to-KV.bin]"

Seemed to run fine when trying that with a random CON + KV.bin, looks like it updated the CON without any exceptions at least, but no idea if the file it wrote actually works or not though.