diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index d906aee..8df9796 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -10,32 +10,32 @@ "rollForward": false }, "gitversion.tool": { - "version": "5.12.0", + "version": "6.7.0", "commands": [ "dotnet-gitversion" ], "rollForward": false }, "thirdlicense": { - "version": "1.4.0", + "version": "1.4.1", "commands": [ "thirdlicense" ], "rollForward": false }, "dotnet-reportgenerator-globaltool": { - "version": "5.5.1", + "version": "5.5.10", "commands": [ "reportgenerator" ], "rollForward": false }, "docfx": { - "version": "2.78.4", + "version": "2.78.5", "commands": [ "docfx" ], "rollForward": false } } -} +} \ No newline at end of file diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml index 049828a..8e5da28 100644 --- a/.github/workflows/build-and-release.yml +++ b/.github/workflows/build-and-release.yml @@ -11,8 +11,7 @@ on: tags: [ "v*" ] env: - TEST_RESOURCES_NAME: 'resources-0.zip' - DOTNET_VERSIONS: 10.0.203 + DOTNET_VERSIONS: 10.0.300 DOTNET_INSTALL_DIR: '/tmp/dotnet/' jobs: @@ -31,29 +30,11 @@ jobs: with: dotnet-version: ${{ env.DOTNET_VERSIONS }} - # Full test for master builds and PR of repo owners - - name: "[Full] Build, test, and bundle" - if: ${{ env.TEST_RESOURCES_URI != '' }} - run: > - dotnet run build.cs -- - --target=Default - --target=Bundle - --dotnet-configuration=Release - --resource-uri=${{ env.TEST_RESOURCES_URI }} - --resource-name=${{ env.TEST_RESOURCES_NAME }} - --resource-usr=${{ env.TEST_RESOURCES_USR }} - --resource-pwd=${{ env.TEST_RESOURCES_PWD }} + - name: "Build, test, and bundle" + run: dotnet run build.cs -- --target=Build-Bundle --dotnet-configuration=Release env: - TEST_RESOURCES_URI: ${{ secrets.TEST_RESOURCES_URI }} - TEST_RESOURCES_USR: ${{ secrets.TEST_RESOURCES_USR }} - TEST_RESOURCES_PWD: ${{ secrets.TEST_RESOURCES_PWD }} - - # Tests without resources for PR of external contributors - - name: "[Basic] Build, test, and bundle" - if: ${{ env.TEST_RESOURCES_URI == '' }} - run: dotnet run build.cs -- --target=Default --target=Bundle --dotnet-configuration=Release - env: - TEST_RESOURCES_URI: ${{ secrets.TEST_RESOURCES_URI }} + PLEOPS_RESOURCES_URL: ${{ secrets.TEST_RESOURCES_URI }} + PLEOPS_RESOURCES_PWD: ${{ secrets.TEST_RESOURCES_PWD }} - name: "Publish artifacts to CI" uses: actions/upload-artifact@v7 diff --git a/.gitignore b/.gitignore index 6e22c5c..6eed833 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,7 @@ # Build outputs obj/ bin/ -build/artifacts/ -build/temp/ +build/ /CHANGELOG.md /CHANGELOG.NEXT.md diff --git a/GitVersion.yml b/GitVersion.yml index 1785a95..fabd68e 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,6 +1,6 @@ -mode: ContinuousDeployment +workflow: GitHubFlow/v1 +mode: ContinuousDelivery branches: - master: - regex: ^master$ - tag: preview + main: + label: preview increment: Patch diff --git a/JUSToolkit.slnx b/JUSToolkit.slnx index 4594463..94588d6 100644 --- a/JUSToolkit.slnx +++ b/JUSToolkit.slnx @@ -13,7 +13,6 @@ - diff --git a/build.cs b/build.cs index e8d715b..cd0a3ad 100644 --- a/build.cs +++ b/build.cs @@ -1,6 +1,6 @@ #!/usr/bin/env dotnet run #:property PublishAot=false -#:package Cake.Frosting.PleOps.Recipe@1.0.4-preview.37 +#:package Cake.Frosting.PleOps.Recipe@1.0.4-preview.62 using System.Diagnostics.CodeAnalysis; using Cake.Common.IO; @@ -9,64 +9,36 @@ using Cake.Core.Diagnostics; using Cake.Frosting; using Cake.Frosting.PleOps.Recipe; -using Cake.Frosting.PleOps.Recipe.Dotnet; +using Cake.Frosting.PleOps.Recipe.Common; return new CakeHost() .AddAssembly(typeof(PleOpsBuildContext).Assembly) - .UseContext() + .UseContext() .UseLifetime() .Run(args); -public sealed class BuildContext : PleOpsBuildContext -{ - public BuildContext(ICakeContext context) - : base(context) - { - } - - public string? TestResourceUri { get; private set; } - - public string? TestResourceName { get; private set; } - - [LogIgnore] - public string? TestResourceUsername { get; private set; } - - [LogIgnore] - public string? TestResourcePassword { get; private set; } - - public override void ReadArguments() - { - base.ReadArguments(); - - Arguments.SetIfPresent("resource-uri", x => TestResourceUri = x); - Arguments.SetIfPresent("resource-name", x => TestResourceName = x); - Arguments.SetIfPresent("resource-usr", x => TestResourceUsername = x); - Arguments.SetIfPresent("resource-pwd", x => TestResourcePassword = x); - } -} - [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] -public sealed class BuildLifetime : FrostingLifetime +public sealed class BuildLifetime : FrostingLifetime { - public override void Setup(BuildContext context, ISetupContext info) + public override void Setup(PleOpsBuildContext context, ISetupContext info) { - context.WarningsAsErrors = false; + context.WarningsAsErrors = true; context.DotNetContext.CoverageTarget = 0; - context.DotNetContext.ApplicationProjects.Add( - new ProjectPublicationInfo( - "./src/JUS.CLI", - [ "win-x64", "linux-x64", "osx-x64" ], - "net10.0")); - context.ReadArguments(); context.DotNetContext.PreviewNuGetFeed = "https://pkgs.dev.azure.com/SceneGate/SceneGate/_packaging/SceneGate-Preview/nuget/v3/index.json"; + context.DotNetContext.AddApplication("./src/JUS.CLI", [ "win-x64", "linux-x64", "osx-x64" ]); + + context.ResourcesContext.ResourcesDirectory = Path.GetFullPath(Path.Combine("src", "JUS.Tests")); + context.ResourcesContext.DownloadUser = "not_needed"; + context.ResourcesContext.DownloadFormat = ResourcesDownloadFormat.ZipBundle; + context.ResourcesContext.DownloadId = "resources-0.zip"; context.Print(); } - public override void Teardown(BuildContext context, ITeardownContext info) + public override void Teardown(PleOpsBuildContext context, ITeardownContext info) { context.DeliveriesContext.Save(); } @@ -75,6 +47,7 @@ public override void Teardown(BuildContext context, ITeardownContext info) [TaskName("Default")] [IsDependentOn(typeof(Cake.Frosting.PleOps.Recipe.Common.SetGitVersionTask))] [IsDependentOn(typeof(Cake.Frosting.PleOps.Recipe.Common.CleanArtifactsTask))] +[IsDependentOn(typeof(DownloadJusTestFilesTask))] [IsDependentOn(typeof(Cake.Frosting.PleOps.Recipe.Dotnet.DotnetTasks.BuildProjectTask))] public sealed class DefaultTask : FrostingTask { @@ -89,6 +62,13 @@ public sealed class BundleTask : FrostingTask { } +[TaskName("Build-Bundle")] +[IsDependentOn(typeof(DefaultTask))] +[IsDependentOn(typeof(BundleTask))] +public sealed class BuildBundleTask : FrostingTask +{ +} + [TaskName("Deploy")] [IsDependentOn(typeof(Cake.Frosting.PleOps.Recipe.Common.SetGitVersionTask))] [IsDependentOn(typeof(Cake.Frosting.PleOps.Recipe.Dotnet.DotnetTasks.DeployProjectTask))] @@ -97,24 +77,23 @@ public sealed class DeployTask : FrostingTask { } -[TaskName("Download-TestFiles")] +[TaskName("Download-JusTestFiles")] [TaskDescription("Download the test resource files")] -[IsDependeeOf(typeof(Cake.Frosting.PleOps.Recipe.Dotnet.TestTask))] [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] -public class DownloadTestFilesTask : FrostingTask +public class DownloadJusTestFilesTask : FrostingTask { - public override bool ShouldRun(BuildContext context) => - !string.IsNullOrEmpty(context.TestResourceUri); + public override bool ShouldRun(PleOpsBuildContext context) => + !string.IsNullOrEmpty(context.ResourcesContext.DownloadAddress); - public override void Run(BuildContext context) + public override void Run(PleOpsBuildContext context) { - string resourcesPath = Path.GetFullPath(Path.Combine("src", "JUS.Tests")); - - string resourceUri = string.Format(context.TestResourceUri!, context.TestResourceName); + ResourcesContext resourceInfo = context.ResourcesContext; + string resourceUri = string.Format(resourceInfo.DownloadAddress!, resourceInfo.DownloadId); var downloadSettings = new DownloadFileSettings { - Username = context.TestResourceUsername, - Password = context.TestResourcePassword, - UseDefaultCredentials = string.IsNullOrWhiteSpace(context.TestResourceUsername) || string.IsNullOrWhiteSpace(context.TestResourcePassword), + Username = resourceInfo.DownloadUser, + Password = resourceInfo.DownloadPassword, + UseDefaultCredentials = string.IsNullOrWhiteSpace(resourceInfo.DownloadUser) + || string.IsNullOrWhiteSpace(resourceInfo.DownloadPassword), }; context.Log.Information(downloadSettings.UseDefaultCredentials ? "Download without credentials" @@ -124,6 +103,6 @@ public override void Run(BuildContext context) var compressedResources = context.DownloadFile(resourceUri, downloadSettings); context.Log.Debug("Unzipping resource"); - context.Unzip(compressedResources, resourcesPath, true); + context.Unzip(compressedResources, context.ResourcesContext.ResourcesDirectory, true); } } diff --git a/docs/articles/tool/install.md b/docs/articles/tool/install.md index 559431e..dc635d7 100644 --- a/docs/articles/tool/install.md +++ b/docs/articles/tool/install.md @@ -18,6 +18,4 @@ Download the latest stable version from the Preview versions can be downloaded from the project [_Actions pipeline artifacts_](https://github.com/priverop/JUSToolkit/actions/workflows/build-and-release.yml). -But they expire after a few days. You may want to follow the -[source code README file](https://github.com/priverop/JUSToolkit) to build the -latest version yourself. +But they expire after a few days, so you may need to build it locally. diff --git a/docs/articles/tool/scenegate.md b/docs/articles/tool/scenegate.md index 351d6c3..b0d3459 100644 --- a/docs/articles/tool/scenegate.md +++ b/docs/articles/tool/scenegate.md @@ -11,8 +11,7 @@ In this guide we'll see how to import the JUSToolkit converters. 1. Download the [latest SceneGate release](https://code.pleonex.dev/SceneGate/SceneGate/releases). 2. Compile this tool (JUSToolkit) and copy `src/JUS.Tool/bin/Debug/net10.0/JUS.Tool.dll`, -and `src/JUS.SceneGatePlugin/bin/Debug/net10.0/JUS.SceneGatePlugin.dll`, to the -downloaded `SceneGate` folder, with the rest of .dll. + to the downloaded `SceneGate` folder, with the rest of .dll. 3. Run `SceneGate.Destktop`, open your legal dump of the game, select it, and double click in the Suggested Converter `Binary2NitroRom`. diff --git a/docs/images/icon_128.png b/docs/images/icon_128.png new file mode 100644 index 0000000..14f4bf2 Binary files /dev/null and b/docs/images/icon_128.png differ diff --git a/nuget.config b/nuget.config index 9cc47fe..cf53fa8 100644 --- a/nuget.config +++ b/nuget.config @@ -14,12 +14,11 @@ - - + + - diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 070bb6f..a810155 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -18,7 +18,7 @@ MIT https://github.com/priverop/JUSToolkit https://github.com/priverop/JUSToolkit - + icon.png videogames;romhacking;translating README.md diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index d3fb91f..132b2de 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -1,12 +1,11 @@ - - - - - - + + + + + diff --git a/src/JUS.CLI/JUS/Graphics/DigCommands.cs b/src/JUS.CLI/JUS/Graphics/DigCommands.cs index 4381c6a..7450a73 100644 --- a/src/JUS.CLI/JUS/Graphics/DigCommands.cs +++ b/src/JUS.CLI/JUS/Graphics/DigCommands.cs @@ -20,9 +20,9 @@ using JUS.Tool.Graphics; using JUS.Tool.Graphics.Converters; using JUS.Tool.Utils; -using Texim.Games.Nitro.Backgrounds.ScreenMaps; using Texim.Images; using Texim.Images.Standard; +using Texim.TileMaps; using Yarhl.FileSystem; using Yarhl.IO; @@ -99,7 +99,7 @@ public static void ImportDig(string input, bool insertTransparent, string dig, s Height = compressed.Tiles.Length / 8, Pixels = compressed.Tiles, }; - IScreenMap map = compressed.Map; + ITileMap map = compressed.Map; var newDig = new Dig(originalDig, newImage); @@ -158,7 +158,7 @@ public static void MergeDig(string[] input, bool insertTransparent, string dig, Height = compressed.Tiles.Length / 8, Pixels = compressed.Tiles, }; - IScreenMap map = compressed.Map; + ITileMap map = compressed.Map; // 3 - Clone original mergedImage = new Dig(mergedImage, newImage); diff --git a/src/JUS.SceneGatePlugin/JUS.SceneGatePlugin.csproj b/src/JUS.SceneGatePlugin/JUS.SceneGatePlugin.csproj deleted file mode 100644 index 89af50b..0000000 --- a/src/JUS.SceneGatePlugin/JUS.SceneGatePlugin.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - SceneGate UI plugin for the JUS game formats. - - net10.0 - - enable - enable - false - - - - - - - - - - - - - - - diff --git a/src/JUS.Tool/BatchConverters/Demo2Alar3.cs b/src/JUS.Tool/BatchConverters/Demo2Alar3.cs index ff46f54..705b87a 100644 --- a/src/JUS.Tool/BatchConverters/Demo2Alar3.cs +++ b/src/JUS.Tool/BatchConverters/Demo2Alar3.cs @@ -21,9 +21,9 @@ using JUS.Tool.Graphics; using JUS.Tool.Graphics.Converters; using JUS.Tool.Utils; -using Texim.Games.Nitro.Backgrounds.ScreenMaps; using Texim.Images; using Texim.Images.Standard; +using Texim.TileMaps; using Yarhl.FileFormat; using Yarhl.FileSystem; using Yarhl.IO; @@ -144,7 +144,7 @@ private void Transform(Node[] pngs, Node dig, Node[] atms) Pixels = compressed.Tiles, }; - IScreenMap map = compressed.Map; + ITileMap map = compressed.Map; // 3 - Clone original mergedImage = new Dig(mergedImage, newImage); diff --git a/src/JUS.Tool/BatchConverters/Png2Alar3.cs b/src/JUS.Tool/BatchConverters/Png2Alar3.cs index 8cb92fc..0d9911e 100644 --- a/src/JUS.Tool/BatchConverters/Png2Alar3.cs +++ b/src/JUS.Tool/BatchConverters/Png2Alar3.cs @@ -21,9 +21,9 @@ using JUS.Tool.Graphics; using JUS.Tool.Graphics.Converters; using JUS.Tool.Utils; -using Texim.Games.Nitro.Backgrounds.ScreenMaps; using Texim.Images; using Texim.Images.Standard; +using Texim.TileMaps; using Yarhl.FileFormat; using Yarhl.FileSystem; using Yarhl.IO; @@ -154,7 +154,7 @@ private void Transform(Node png, Node dig, Node atm) Height = compressed.Tiles.Length / 8, Pixels = compressed.Tiles, }; - IScreenMap map = compressed.Map; + ITileMap map = compressed.Map; // New Dig: original dig changing height, width and pixels var newDig = new Dig(originalDig, newImage); diff --git a/src/JUS.SceneGatePlugin/JusBinaryHeaderConverterMatcher.cs b/src/JUS.Tool/Discovery/JusBinaryHeaderConverterMatcher.cs similarity index 87% rename from src/JUS.SceneGatePlugin/JusBinaryHeaderConverterMatcher.cs rename to src/JUS.Tool/Discovery/JusBinaryHeaderConverterMatcher.cs index b10fd38..525354c 100644 --- a/src/JUS.SceneGatePlugin/JusBinaryHeaderConverterMatcher.cs +++ b/src/JUS.Tool/Discovery/JusBinaryHeaderConverterMatcher.cs @@ -2,12 +2,16 @@ using JUS.Tool.Containers.Converters; using JUS.Tool.Graphics.Converters; using JUS.Tool.Utils; -using SceneGate.UI.Formats.Discovery; +using Yarhl.FileFormat; +using Yarhl.FileFormat.Discovery; using Yarhl.FileSystem; using Yarhl.IO; -namespace JUS.SceneGatePlugin; +namespace JUS.Tool.Discovery; +/// +/// Discover compatible converters for binary formats based on their header bytes. +/// [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] public sealed class JusBinaryHeaderConverterMatcher : IConverterMatcher { @@ -24,6 +28,7 @@ public sealed class JusBinaryHeaderConverterMatcher : IConverterMatcher HeaderFormat.Create("DSTX", 1, 4), ]; + /// public ConverterMatcherResult Match(Node input, ConverterMatcherContext context) { if (input.Format is not IBinary) { @@ -45,7 +50,7 @@ public ConverterMatcherResult Match(Node input, ConverterMatcherContext context) // "should be" if header match, but we can't verify the game code MatchingConfidence level = compatibleSoftware == true ? MatchingConfidence.Confident : MatchingConfidence.ShouldBe; - object converter = compatibleFormat.ConverterFactory(); + IConverter converter = compatibleFormat.ConverterFactory(); return new ConverterMatcherResult(level, compatibleFormat.ConverterType, converter); } @@ -60,7 +65,7 @@ private static bool MatchFormat(ConverterMatcherContext context, HeaderFormat fo return false; } - if (context.Header.ReadAsciiString(0, 4) != format.Id) { + if (context.Header.ReadAscii(0, 4) != format.Id) { return false; } @@ -80,10 +85,10 @@ private sealed record HeaderFormat( byte? Version, byte? Flags, Type ConverterType, - Func ConverterFactory) + Func ConverterFactory) { public static HeaderFormat Create(string id, byte? version, byte? flags) - where T : class, new() + where T : class, IConverter, new() { return new HeaderFormat(id, version, flags, typeof(T), () => new T()); } diff --git a/src/JUS.SceneGatePlugin/JusPathBinaryConverterMatcher.cs b/src/JUS.Tool/Discovery/JusPathBinaryConverterMatcher.cs similarity index 90% rename from src/JUS.SceneGatePlugin/JusPathBinaryConverterMatcher.cs rename to src/JUS.Tool/Discovery/JusPathBinaryConverterMatcher.cs index ab92445..31e36a7 100644 --- a/src/JUS.SceneGatePlugin/JusPathBinaryConverterMatcher.cs +++ b/src/JUS.Tool/Discovery/JusPathBinaryConverterMatcher.cs @@ -1,12 +1,16 @@ using System.Diagnostics.CodeAnalysis; using JUS.Tool.Graphics.Converters; using JUS.Tool.Texts.Converters; -using SceneGate.UI.Formats.Discovery; +using Yarhl.FileFormat; +using Yarhl.FileFormat.Discovery; using Yarhl.FileSystem; using Yarhl.IO; -namespace JUS.SceneGatePlugin; +namespace JUS.Tool.Discovery; +/// +/// Discover compatible converters for binary formats based on their path. +/// [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] public sealed class JusPathBinaryConverterMatcher : IConverterMatcher { @@ -37,6 +41,7 @@ public sealed class JusPathBinaryConverterMatcher : IConverterMatcher FormatLocation.Create("data/jquiz/jquiz_pack.aar/jquiz/jquiz.bin"), ]; + /// public ConverterMatcherResult Match(Node input, ConverterMatcherContext context) { if (input.Format is not IBinary) { @@ -60,14 +65,14 @@ public ConverterMatcherResult Match(Node input, ConverterMatcherContext context) // "should be" if header match, but we can't verify the game code MatchingConfidence level = compatibleSoftware == true ? MatchingConfidence.Confident : MatchingConfidence.ShouldBe; - object converter = compatibleFormat.ConverterFactory(); + IConverter converter = compatibleFormat.ConverterFactory(); return new ConverterMatcherResult(level, compatibleFormat.ConverterType, converter); } - private sealed record FormatLocation(string Path, Type ConverterType, Func ConverterFactory) + private sealed record FormatLocation(string Path, Type ConverterType, Func ConverterFactory) { public static FormatLocation Create(string path) - where T : class, new() + where T : class, IConverter, new() { return new FormatLocation(path, typeof(T), () => new T()); } diff --git a/src/JUS.SceneGatePlugin/JusRegexPathBinaryConverterMatcher.cs b/src/JUS.Tool/Discovery/JusRegexPathBinaryConverterMatcher.cs similarity index 86% rename from src/JUS.SceneGatePlugin/JusRegexPathBinaryConverterMatcher.cs rename to src/JUS.Tool/Discovery/JusRegexPathBinaryConverterMatcher.cs index df191ec..7182d33 100644 --- a/src/JUS.SceneGatePlugin/JusRegexPathBinaryConverterMatcher.cs +++ b/src/JUS.Tool/Discovery/JusRegexPathBinaryConverterMatcher.cs @@ -1,12 +1,16 @@ using System.Diagnostics.CodeAnalysis; using System.Text.RegularExpressions; using JUS.Tool.Texts.Converters; -using SceneGate.UI.Formats.Discovery; +using Yarhl.FileFormat; +using Yarhl.FileFormat.Discovery; using Yarhl.FileSystem; using Yarhl.IO; -namespace JUS.SceneGatePlugin; +namespace JUS.Tool.Discovery; +/// +/// Discover compatible converters for binary formats based a regex for their paths. +/// [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] public sealed class JusRegexPathBinaryConverterMatcher : IConverterMatcher { @@ -19,6 +23,7 @@ public sealed class JusRegexPathBinaryConverterMatcher : IConverterMatcher FormatLocation.Create(@"data/deck/Deck\.aar/deck/\w+/p\d{3}.bin"), ]; + /// public ConverterMatcherResult Match(Node input, ConverterMatcherContext context) { if (input.Format is not IBinary) { @@ -42,14 +47,14 @@ public ConverterMatcherResult Match(Node input, ConverterMatcherContext context) // "should be" if header match, but we can't verify the game code MatchingConfidence level = compatibleSoftware == true ? MatchingConfidence.Confident : MatchingConfidence.ShouldBe; - object converter = compatibleFormat.ConverterFactory(); + IConverter converter = compatibleFormat.ConverterFactory(); return new ConverterMatcherResult(level, compatibleFormat.ConverterType, converter); } - private sealed record FormatLocation(Regex Regex, Type ConverterType, Func ConverterFactory) + private sealed record FormatLocation(Regex Regex, Type ConverterType, Func ConverterFactory) { public static FormatLocation Create(string pattern) - where T : class, new() + where T : class, IConverter, new() { Regex regex = new(pattern, RegexOptions.Compiled); return new FormatLocation(regex, typeof(T), () => new T()); diff --git a/src/JUS.SceneGatePlugin/SupportedSoftware.cs b/src/JUS.Tool/Discovery/SupportedSoftware.cs similarity index 52% rename from src/JUS.SceneGatePlugin/SupportedSoftware.cs rename to src/JUS.Tool/Discovery/SupportedSoftware.cs index c2ae2d9..d97c093 100644 --- a/src/JUS.SceneGatePlugin/SupportedSoftware.cs +++ b/src/JUS.Tool/Discovery/SupportedSoftware.cs @@ -1,12 +1,24 @@ using SceneGate.Ekona.Containers.Rom; using Yarhl.FileSystem; -namespace JUS.SceneGatePlugin; +namespace JUS.Tool.Discovery; +/// +/// Defines the supported software of this library. +/// public static class SupportedSoftware { + /// + /// Gets the game code for the supported version. + /// public static string GameCode => "AJUJ"; + /// + /// Gets a value indicating whether the node belongs to a compatible software version. + /// + /// The node to test. + /// The node representing the root of the game from the input node. + /// Value indicating whether the node belongs to a compatible software, or null if it cannot be determined. public static bool? IsFromCompatibleSoftware(Node assetNode, out Node root) { ProgramInfo? info = GetProgramInfo(assetNode); diff --git a/src/JUS.Tool/Graphics/ALMT.cs b/src/JUS.Tool/Graphics/ALMT.cs index 2643d03..d9abca7 100644 --- a/src/JUS.Tool/Graphics/ALMT.cs +++ b/src/JUS.Tool/Graphics/ALMT.cs @@ -1,4 +1,4 @@ -using Texim.Games.Nitro.Backgrounds.ScreenMaps; +using Texim.TileMaps; namespace JUS.Tool.Graphics { @@ -26,7 +26,7 @@ public enum NitroBackgroundMode /// /// Screen map with format Almt. /// - public class Almt : IScreenMap + public class Almt : ITileMap { /// /// Initializes a new instance of the class. @@ -61,7 +61,7 @@ public Almt(Almt atm) /// /// Almt object to clone. /// ScreenMap object to clone. - public Almt(Almt atm, IScreenMap screenMap) + public Almt(Almt atm, ITileMap screenMap) : this(atm) { Width = screenMap.Width; diff --git a/src/JUS.Tool/Graphics/Converters/Almt2Binary.cs b/src/JUS.Tool/Graphics/Converters/Almt2Binary.cs index 8e8c871..6b10c9c 100644 --- a/src/JUS.Tool/Graphics/Converters/Almt2Binary.cs +++ b/src/JUS.Tool/Graphics/Converters/Almt2Binary.cs @@ -17,7 +17,8 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Texim.Games.Nitro.Backgrounds.ScreenMaps; +using Texim.Games.Nitro.TileMaps; +using Texim.TileMaps; using Yarhl.FileFormat; using Yarhl.IO; diff --git a/src/JUS.Tool/Graphics/Converters/Binary2Almt.cs b/src/JUS.Tool/Graphics/Converters/Binary2Almt.cs index 6e9fb5a..dc4d7cf 100644 --- a/src/JUS.Tool/Graphics/Converters/Binary2Almt.cs +++ b/src/JUS.Tool/Graphics/Converters/Binary2Almt.cs @@ -17,7 +17,9 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -using Texim.Games.Nitro.Backgrounds.ScreenMaps; + +using Texim.Games.Nitro.TileMaps; +using Texim.TileMaps; using Yarhl.FileFormat; using Yarhl.IO; @@ -61,7 +63,7 @@ public Almt Convert(IBinary source) almt.Maps = new MapInfo[numInfos]; for (int i = 0; i < almt.Maps.Length; i++) { - almt.Maps[i] = almt.BgMode == NitroBackgroundMode.Affine ? new MapInfo(reader.ReadByte()) : new MapInfo(reader.ReadUInt16()); + almt.Maps[i] = almt.BgMode == NitroBackgroundMode.Affine ? new MapInfo(reader.ReadByte()) : MapInfo.FromUInt16(reader.ReadUInt16()); } return almt; diff --git a/src/JUS.Tool/Graphics/Converters/BinaryDig2Bitmap.cs b/src/JUS.Tool/Graphics/Converters/BinaryDig2Bitmap.cs index 6246c04..93752af 100644 --- a/src/JUS.Tool/Graphics/Converters/BinaryDig2Bitmap.cs +++ b/src/JUS.Tool/Graphics/Converters/BinaryDig2Bitmap.cs @@ -18,9 +18,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. using JUS.Tool.Utils; -using Texim.Games.Nitro.Backgrounds.ScreenMaps; using Texim.Images; using Texim.Images.Standard; +using Texim.TileMaps; using Yarhl.FileFormat; using Yarhl.FileSystem; using Yarhl.IO; diff --git a/src/JUS.Tool/Graphics/Dig.cs b/src/JUS.Tool/Graphics/Dig.cs index 4758f26..6b7a331 100644 --- a/src/JUS.Tool/Graphics/Dig.cs +++ b/src/JUS.Tool/Graphics/Dig.cs @@ -1,11 +1,8 @@ -using System; -using System.Diagnostics.CodeAnalysis; -using System.Security.Cryptography.X509Certificates; -using Texim.Games.Nitro.Backgrounds.ScreenMaps; +using System.Diagnostics.CodeAnalysis; using Texim.Images; using Texim.Palettes; using Texim.Pixels; -using Yarhl.FileFormat; +using Texim.TileMaps; namespace JUS.Tool.Graphics { @@ -217,7 +214,7 @@ public void PasteImage(Dig subimage, int xPos, int yPos, bool horizontalFlip, bo /// /// Map to modify. /// The with the transparent tile. - public Dig InsertTransparentTile(IScreenMap map) + public Dig InsertTransparentTile(ITileMap map) { var dig = new Dig(this) { Pixels = new IndexedPixel[this.Pixels.Length + 64], diff --git a/src/JUS.Tool/JUS.Tool.csproj b/src/JUS.Tool/JUS.Tool.csproj index 63c747c..d16bb50 100644 --- a/src/JUS.Tool/JUS.Tool.csproj +++ b/src/JUS.Tool/JUS.Tool.csproj @@ -7,12 +7,14 @@ - + + +