Allow loading of Smithbox 2.0.0 Project files #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Smithbox 2.0.0 changed how project settings are formatted, as well as where they are, instead placing them in the user's Local/AppData folder.
This at the very least gets them loading in DarkScript, although I'm not a big fan of how I did it, since it feels very hack-y and weird
Here's a breakdown of the changes:
SmithboxProjectSettingsclass for use with json deserialization with the new project files, which even has different names for some of the same settings (ex. GameRoot is now DataPath)ProjectSettingsFilenow has aProjectDirectoryvariable, since it seemed like the easiest way to pass along the actual project directory since I split theLoadProjectfunction (see below)LoadProjectfunction in ProjectSettingsFile.cs into 3 functions:LoadProject- Contains common project file loading, returns the finalProjectSettingsFileto be used. IfProjectDirectoryis not null, it will combine that with the "event" string to make theProjectEventDirectoryfile path rather than the json's filepath.LoadDSMapStudioProject- The DSMS/Smithbox 1.0.0 Project loading code which couldn't be shared.LoadSmithboxProject- Converts the newSmithboxProjectSettingsclass into a regularProjectSettingsfor a relatively easy fix to compat. Also writes to the newProjectDirectoryvariable.TryGetEmevdFileProjectwas changed to attempt to find the project file where Smithbox stores them. Since they don't have any helpful names, I unfortunately resorted to reading each one until it finds one with a project directory that matches the EMEVD's directory. If someone has 2 projects in the same directory for some reason, this will break, but I don't think thats much of an issueThis PR also features one other minor change to get it to build on SoulsFormats commit 1dd7171, which moved the
Backupfunction from SoulsFormats.SFUtil to SoulsFormats.Utilities.PathHelper.Unfortunately, building on the latest version of SoulsFormats would require rewrites to how DCX Compression data is stored, as commit e816bed replaced most references to the
DCX.Typeenum with aDCX.CompressionInfostruct. Unfortunately for DarkScript's uses, while the Type enum still exists, one of the changes (and reasons for the change) is removing the different DFLT compression type enums for DS1-3 and BB, replacing them with a single struct that stores the different bytes between them itself.