iminashi/Rocksmith2014.NET

Automating steps (unpack, add arrangement, build)

Closed this issue · 3 comments

I'm wondering if there is a built-in method (ie command-line args) to automate some of the tasks, specifically to unpack a psarc, add an arrangement, and then build a new psarc? (And potentially to remove an arrangement, although I'm not 100% sure I'll use that yet)

If not, can you point me in the right direction of which libraries/classes/methods to use for these activities? I'm mostly a C# dev, and am finding myself lost while looking at the F# code!

What I'm trying to do is automate the creation of a Ukulele arrangement for each song. I was able to do this manually with DLC Builder by opening the psarc, manually creating a ukulele arrangement from the bass arrangement, adding the ukulele arrangement as a bonus bass arrangement, and then building a new psarc.

I wrote some code to create the ukulele xml from the bass xml, so that part doesn't need me to manually edit the xml anymore, but I still need to manually open the psarc, click the +, and click build, so it'd be amazing if I could automate that portion too.

Thanks!

EDIT: Am I on the right track by using the logic for UnpackPSARC and PackDirectoryPSARC from Misc Tools?

EDIT 2: After more digging, it looks like PsarcImporter.import might be what I'm looking for.

Think I've got a working proof-of-concept now, so I'll close the issue.

In case anybody wants to do something like this in the future, the important methods are:

  • PsarcImporter.import to import a .psarc and extract it to a temp directory or DLCProjectModule.load to load a .rs2dlc if you previously extracted the .psarc
  • PackageBuilder.buildPackages to build a .psarc from the temp directory

And you can't modify the project's Arrangements collection, so you need to instantiate a new DLCProject with the new Arrangements, something like:

FSharpList<Arrangement> newArrangements = FSharpList<Arrangement>.Cons(fromFileResult.ResultValue.Item1, project.Arrangements);
project = new DLCProject(project.Version, project.Author, project.DLCKey, project.ArtistName, project.JapaneseArtistName,
    project.JapaneseTitle, project.Title, project.AlbumName, project.Year, project.AlbumArtFile, project.AudioFile,
    project.AudioPreviewFile, project.AudioPreviewStartTime, project.PitchShift, project.IgnoredIssues,
    newArrangements, project.Tones);

I guess you got it working? I haven't had much need for automating stuff for PSARC with CLI tools myself (and nobody has asked before), so that's why there is pretty much only the "empty title fix".

Yes, the library is working perfectly for importing and building a psarc, so that part is good. Just need to iron out some bugs in the bass -> ukulele logic now.

Thanks for the great library!