diff --git a/SM64Lib.LIBMIO0/MIO0.cs b/SM64Lib.LIBMIO0/MIO0.cs index 2d59c29..ea25b36 100644 --- a/SM64Lib.LIBMIO0/MIO0.cs +++ b/SM64Lib.LIBMIO0/MIO0.cs @@ -1,16 +1,7 @@ namespace SM64Lib.LIBMIO0; -public struct MIO0_Header -{ - public uint dest_size; - public uint comp_offset; - public uint uncomp_offset; - public bool big_endian; -}; - public class MIO0 { - private const int MIO0_HEADER_LENGTH = 16; private static int GET_BIT(byte[] buf, int offset, int bit) @@ -49,7 +40,7 @@ public class MIO0 /// decode MIO0 header /// returns true if valid header, false otherwise /// - public static bool decode_header(byte[] buf, ref MIO0_Header head) + public static bool decode_header(byte[] buf, ref MIO0Header head) { byte[] mio0_ascii_be = new byte[] { 0x4D, 0x49, 0x4F, 0x30 }; byte[] mio0_ascii_le = new byte[] { 0x49, 0x4D, 0x30, 0x4F }; @@ -77,7 +68,7 @@ public class MIO0 /// /// encode MIO0 header from struct /// - public static void encode_header(byte[] buf, ref MIO0_Header head) + public static void encode_header(byte[] buf, ref MIO0Header head) { write_u32_be(buf, 0x4D494F30, 0); // write "MIO0" at start of buffer write_u32_be(buf, head.dest_size, 4); @@ -93,7 +84,7 @@ public class MIO0 public static byte[] mio0_decode(byte[] mio0_buf) { - MIO0_Header head = new(); + MIO0Header head = new(); uint bytes_written = 0; int bit_idx = 0; int comp_idx = 0; @@ -144,5 +135,4 @@ public class MIO0 } return decoded; } - } diff --git a/SM64Lib.LIBMIO0/MIO0Header.cs b/SM64Lib.LIBMIO0/MIO0Header.cs new file mode 100644 index 0000000..ea2d53a --- /dev/null +++ b/SM64Lib.LIBMIO0/MIO0Header.cs @@ -0,0 +1,9 @@ +namespace SM64Lib.LIBMIO0; + +public struct MIO0Header +{ + public uint dest_size; + public uint comp_offset; + public uint uncomp_offset; + public bool big_endian; +}; diff --git a/SM64Lib.LIBMIO0/Properties/AssemblyInfo.cs b/SM64Lib.LIBMIO0/Properties/AssemblyInfo.cs deleted file mode 100644 index ab4224b..0000000 --- a/SM64Lib.LIBMIO0/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Runtime.InteropServices; - -// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly -// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von -// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird -[assembly: Guid("e4cec3b1-5778-4d63-8c97-c95153cdc052")] diff --git a/SM64Lib.LIBMIO0/SM64Lib.LIBMIO0.csproj b/SM64Lib.LIBMIO0/SM64Lib.LIBMIO0.csproj index e86fad2..958d46e 100644 --- a/SM64Lib.LIBMIO0/SM64Lib.LIBMIO0.csproj +++ b/SM64Lib.LIBMIO0/SM64Lib.LIBMIO0.csproj @@ -1,19 +1,9 @@  + net8.0 enable - AnyCPU - Debug;Release;ReleaseBundle;ReleaseStandalone + annotations - - - - - - - - - - - + \ No newline at end of file diff --git a/SM64Lib.N64Graphics/N64Graphics.cs b/SM64Lib.N64Graphics/N64Graphics.cs index 78a4e2b..3575997 100644 --- a/SM64Lib.N64Graphics/N64Graphics.cs +++ b/SM64Lib.N64Graphics/N64Graphics.cs @@ -1,4 +1,6 @@ -namespace SM64Lib.N64Graphics; +using System.Drawing; + +namespace SM64Lib.N64Graphics; public enum N64Codec { RGBA16, RGBA32, IA16, IA8, IA4, I8, I4, CI8, CI4, ONEBPP }; public enum N64IMode { AlphaCopyIntensity, AlphaBinary, AlphaOne }; diff --git a/SM64Lib.N64Graphics/Properties/AssemblyInfo.cs b/SM64Lib.N64Graphics/Properties/AssemblyInfo.cs deleted file mode 100644 index 4796be6..0000000 --- a/SM64Lib.N64Graphics/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Runtime.InteropServices; - -// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar -// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von -// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird -[assembly: Guid("d9258483-950c-46d1-a333-31f32492cd7e")] diff --git a/SM64Lib.N64Graphics/SM64Lib.N64Graphics.csproj b/SM64Lib.N64Graphics/SM64Lib.N64Graphics.csproj index fbe4dea..4015927 100644 --- a/SM64Lib.N64Graphics/SM64Lib.N64Graphics.csproj +++ b/SM64Lib.N64Graphics/SM64Lib.N64Graphics.csproj @@ -1,20 +1,12 @@  + - net8.0-windows - true - AnyCPU - Debug;Release;ReleaseBundle;ReleaseStandalone + net8.0 enable + - - - - - - - - - + + \ No newline at end of file diff --git a/SM64Lib.N64Graphics/TextureFormat.cs b/SM64Lib.N64Graphics/TextureFormat.cs index 06ee4a8..35a378e 100644 --- a/SM64Lib.N64Graphics/TextureFormat.cs +++ b/SM64Lib.N64Graphics/TextureFormat.cs @@ -1,4 +1,5 @@ -using System.Drawing.Imaging; +using System.Drawing; +using System.Drawing.Imaging; using System.Runtime.InteropServices; namespace SM64Lib.N64Graphics; diff --git a/SM64Lib.Text.Exporters/Properties/AssemblyInfo.cs b/SM64Lib.Text.Exporters/Properties/AssemblyInfo.cs deleted file mode 100644 index 09226f9..0000000 --- a/SM64Lib.Text.Exporters/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Runtime.InteropServices; - -// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly -// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von -// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird -[assembly: Guid("e6305a1d-e5da-4bb6-992e-3a341bc99a7b")] diff --git a/SM64Lib.Text.Exporters/SM64Lib.Text.Exporters.csproj b/SM64Lib.Text.Exporters/SM64Lib.Text.Exporters.csproj index 25a9ea5..4ef2c4a 100644 --- a/SM64Lib.Text.Exporters/SM64Lib.Text.Exporters.csproj +++ b/SM64Lib.Text.Exporters/SM64Lib.Text.Exporters.csproj @@ -1,21 +1,17 @@  + - net8.0-windows - AnyCPU - Debug;Release;ReleaseBundle;ReleaseStandalone + net8.0 enable + annotations - - - - - - - + + + \ No newline at end of file diff --git a/SM64Lib.TextValueConverter/Properties/AssemblyInfo.cs b/SM64Lib.TextValueConverter/Properties/AssemblyInfo.cs deleted file mode 100644 index 3e26722..0000000 --- a/SM64Lib.TextValueConverter/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,6 +0,0 @@ -using global::System.Runtime.InteropServices; -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird. -[assembly: Guid("245f4730-1df1-43f7-8bef-9626648c4204")] - diff --git a/SM64Lib.TextValueConverter/SM64Lib.TextValueConverter.csproj b/SM64Lib.TextValueConverter/SM64Lib.TextValueConverter.csproj index b69fba0..efc4b5c 100644 --- a/SM64Lib.TextValueConverter/SM64Lib.TextValueConverter.csproj +++ b/SM64Lib.TextValueConverter/SM64Lib.TextValueConverter.csproj @@ -1,61 +1,15 @@  - - Windows + + net8.0 - $(DefaultItemExcludes);$(ProjectDir)**\*.vb - latest enable - TextValueConverter - DRSN - TextValueConverter - true - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0168 - AnyCPU - Debug;Release;ReleaseBundle;ReleaseStandalone - - - true - - - false - - - false - - - false - - - On - - - Binary - - - Off - - - On + annotations + - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/SM64Lib.TextValueConverter/SM64Lib.TextValueConverter.xml b/SM64Lib.TextValueConverter/SM64Lib.TextValueConverter.xml deleted file mode 100644 index 8172c5b..0000000 --- a/SM64Lib.TextValueConverter/SM64Lib.TextValueConverter.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - SM64Lib.TextValueConverter - - - - diff --git a/SM64RomManager.sln b/SM64Lib.sln similarity index 96% rename from SM64RomManager.sln rename to SM64Lib.sln index bd3d789..59ebf21 100644 --- a/SM64RomManager.sln +++ b/SM64Lib.sln @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SM64Lib.LIBMIO0", "SM64Lib. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SM64Lib.Text.Exporters", "SM64Lib.Text.Exporters\SM64Lib.Text.Exporters.csproj", "{E6305A1D-E5DA-4BB6-992E-3A341BC99A7B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SM64Lib.Patching", "SM64Lib.Patching\SM64Lib.Patching.csproj", "{E64270A7-F7C2-447A-9BB4-2908FBC87FD4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/SM64Lib/Patching/PatchProfile.cs b/SM64Lib/Patching/PatchProfile.cs new file mode 100644 index 0000000..7375087 --- /dev/null +++ b/SM64Lib/Patching/PatchProfile.cs @@ -0,0 +1,71 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Pilz.Cryptography; +using Pilz.IO; +using Pilz.Json.Converters; + +namespace SM64Lib.Patching; + +public class PatchProfile +{ + /// + /// The Name of the Profile. + /// + /// + public string Name { get; set; } = ""; + /// + /// A list with scripts. + /// + /// + public List Scripts { get; set; } = []; + /// + /// The version of this profile. + /// + /// + [JsonConverter(typeof(VersionConverter))] + public Version Version { get; set; } = new Version("1.0.0.0"); + /// + /// The minimum ROM Manager version requied for this tweak. + /// + [JsonConverter(typeof(VersionConverter))] + public Version MinVersion { get; set; } = new Version("1.0.0.0"); + /// + /// The maximum ROM Manager version allowed for this tweak. + /// + [JsonConverter(typeof(VersionConverter))] + public Version MaxVersion { get; set; } = new Version("0.0.0.0"); + /// + /// The description of this profile + /// + /// + public string Description { get; set; } = ""; + /// + /// The Xml file for this profile. + /// + /// + [JsonIgnore] + public string FileName { get; set; } = ""; + /// + /// Indicates if this patch use the old XML format. + /// + [JsonIgnore] + public bool IsLegacy => Path.GetExtension(FileName).Equals(".xml", StringComparison.CurrentCultureIgnoreCase); + /// + /// Contains files embedded into this profile. + /// + public EmbeddedFilesContainer EmbeddedFiles { get; } = new EmbeddedFilesContainer(); + /// + /// Defines an uniquie ID to identify this tweak (e.g. for undo patch). + /// + [JsonConverter(typeof(UniquieIDStringJsonConverter))] + public UniquieID ID { get; set; } = new(); + /// + /// Defines if the tweak is official and secure. + /// + public bool Official { get; set; } = false; + /// + /// Defines if the tweak is recommended for every common SM64 ROM Hack. + /// + public bool Recommended { get; set; } = false; +} + diff --git a/SM64Lib/Patching/PatchScript.cs b/SM64Lib/Patching/PatchScript.cs index a3fbaaf..c85e164 100644 --- a/SM64Lib/Patching/PatchScript.cs +++ b/SM64Lib/Patching/PatchScript.cs @@ -9,69 +9,6 @@ using VersionConverter = Newtonsoft.Json.Converters.VersionConverter; namespace SM64Lib.Patching; -public class PatchProfile -{ - /// - /// The Name of the Profile. - /// - /// - public string Name { get; set; } = ""; - /// - /// A list with scripts. - /// - /// - public List Scripts { get; set; } = []; - /// - /// The version of this profile. - /// - /// - [JsonConverter(typeof(VersionConverter))] - public Version Version { get; set; } = new Version("1.0.0.0"); - /// - /// The minimum ROM Manager version requied for this tweak. - /// - [JsonConverter(typeof(VersionConverter))] - public Version MinVersion { get; set; } = new Version("1.0.0.0"); - /// - /// The maximum ROM Manager version allowed for this tweak. - /// - [JsonConverter(typeof(VersionConverter))] - public Version MaxVersion { get; set; } = new Version("0.0.0.0"); - /// - /// The description of this profile - /// - /// - public string Description { get; set; } = ""; - /// - /// The Xml file for this profile. - /// - /// - [JsonIgnore] - public string FileName { get; set; } = ""; - /// - /// Indicates if this patch use the old XML format. - /// - [JsonIgnore] - public bool IsLegacy => Path.GetExtension(FileName).Equals(".xml", StringComparison.CurrentCultureIgnoreCase); - /// - /// Contains files embedded into this profile. - /// - public EmbeddedFilesContainer EmbeddedFiles { get; } = new EmbeddedFilesContainer(); - /// - /// Defines an uniquie ID to identify this tweak (e.g. for undo patch). - /// - [JsonConverter(typeof(UniquieIDStringJsonConverter))] - public UniquieID ID { get; set; } = new(); - /// - /// Defines if the tweak is official and secure. - /// - public bool Official { get; set; } = false; - /// - /// Defines if the tweak is recommended for every common SM64 ROM Hack. - /// - public bool Recommended { get; set; } = false; -} - /// /// A Profile containing a script and some descriptions. /// @@ -134,42 +71,3 @@ public class PatchScript } } } - -/// -/// Defines the script type, so the behavior on write it. -/// -public enum ScriptType -{ - /// - /// A tweak syntax known from the SM64 Editor. - /// - TweakScript, - /// - /// A Visual Basic code. - /// - VisualBasic, - /// - /// A C# Code. - /// - CSharp, - /// - /// A DLL file containing the Code. - /// - DynamicLinkLibrary, - /// - /// Code that can be applied using Armips. - /// - Armips, - /// - /// Patch a BSP patch using Flips. - /// - BPS, - /// - /// Patch an IPS patch using Flips. - /// - IPS, - /// - /// Patch a PPF patch using ApplyPPF3. - /// - PPF -} \ No newline at end of file diff --git a/SM64Lib/Patching/ScriptType.cs b/SM64Lib/Patching/ScriptType.cs new file mode 100644 index 0000000..8a575af --- /dev/null +++ b/SM64Lib/Patching/ScriptType.cs @@ -0,0 +1,40 @@ +namespace SM64Lib.Patching; + +/// +/// Defines the script type, so the behavior on write it. +/// +public enum ScriptType +{ + /// + /// A tweak syntax known from the SM64 Editor. + /// + TweakScript, + /// + /// A Visual Basic code. + /// + VisualBasic, + /// + /// A C# Code. + /// + CSharp, + /// + /// A DLL file containing the Code. + /// + DynamicLinkLibrary, + /// + /// Code that can be applied using Armips. + /// + Armips, + /// + /// Patch a BSP patch using Flips. + /// + BPS, + /// + /// Patch an IPS patch using Flips. + /// + IPS, + /// + /// Patch a PPF patch using ApplyPPF3. + /// + PPF +} diff --git a/SM64Lib/SM64Lib.csproj b/SM64Lib/SM64Lib.csproj index c5f2bf1..c3e97fd 100644 --- a/SM64Lib/SM64Lib.csproj +++ b/SM64Lib/SM64Lib.csproj @@ -1,70 +1,17 @@  - Windows - net8.0-windows + net8.0 latest enable - true - 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0660,CS0661,CA1009 - AnyCPU - Debug;Release;ReleaseBundle;ReleaseStandalone - - - true - - - false - - - false - - - false - - - On - - - Binary - - - Off - - - On - - - true - MinimumRecommendedRules.ruleset - TRACE;RelMono - + - - - - - - - - - - - - - - - - - - -