update structure (not compiling yet)

This commit is contained in:
2024-09-01 09:06:35 +02:00
parent 530bae8d57
commit 1c6a2f748c
18 changed files with 151 additions and 300 deletions

View File

@@ -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<para/>
/// returns true if valid header, false otherwise
///</summary>
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
///<summary>
/// encode MIO0 header from struct
///</summary>
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;
}
}

View File

@@ -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;
};

View File

@@ -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")]

View File

@@ -1,19 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU</Platforms>
<Configurations>Debug;Release;ReleaseBundle;ReleaseStandalone</Configurations>
<Nullable>annotations</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs" />
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs" />
</ItemGroup>
</Project>

View File

@@ -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 };

View File

@@ -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")]

View File

@@ -1,20 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<Platforms>AnyCPU</Platforms>
<Configurations>Debug;Release;ReleaseBundle;ReleaseStandalone</Configurations>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs" />
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs" />
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
</ItemGroup>
</Project>

View File

@@ -1,4 +1,5 @@
using System.Drawing.Imaging;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
namespace SM64Lib.N64Graphics;

View File

@@ -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")]

View File

@@ -1,21 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Platforms>AnyCPU</Platforms>
<Configurations>Debug;Release;ReleaseBundle;ReleaseStandalone</Configurations>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>annotations</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SM64Lib\SM64Lib.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EPPlus" Version="7.3.0" />
</ItemGroup>
</Project>

View File

@@ -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")]

View File

@@ -1,61 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyTitle>TextValueConverter</AssemblyTitle>
<Company>DRSN</Company>
<Product>TextValueConverter</Product>
<DefineTrace>true</DefineTrace>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0168</NoWarn>
<Platforms>AnyCPU</Platforms>
<Configurations>Debug;Release;ReleaseBundle;ReleaseStandalone</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineDebug>true</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStandalone|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseBundle|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
<Nullable>annotations</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs" />
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs" />
</ItemGroup>
</Project>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>SM64Lib.TextValueConverter</name>
</assembly>
<members>
</members>
</doc>

View File

@@ -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

View File

@@ -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
{
/// <summary>
/// The Name of the Profile.
/// </summary>
/// <returns></returns>
public string Name { get; set; } = "";
/// <summary>
/// A list with scripts.
/// </summary>
/// <returns></returns>
public List<PatchScript> Scripts { get; set; } = [];
/// <summary>
/// The version of this profile.
/// </summary>
/// <returns></returns>
[JsonConverter(typeof(VersionConverter))]
public Version Version { get; set; } = new Version("1.0.0.0");
/// <summary>
/// The minimum ROM Manager version requied for this tweak.
/// </summary>
[JsonConverter(typeof(VersionConverter))]
public Version MinVersion { get; set; } = new Version("1.0.0.0");
/// <summary>
/// The maximum ROM Manager version allowed for this tweak.
/// </summary>
[JsonConverter(typeof(VersionConverter))]
public Version MaxVersion { get; set; } = new Version("0.0.0.0");
/// <summary>
/// The description of this profile
/// </summary>
/// <returns></returns>
public string Description { get; set; } = "";
/// <summary>
/// The Xml file for this profile.
/// </summary>
/// <returns></returns>
[JsonIgnore]
public string FileName { get; set; } = "";
/// <summary>
/// Indicates if this patch use the old XML format.
/// </summary>
[JsonIgnore]
public bool IsLegacy => Path.GetExtension(FileName).Equals(".xml", StringComparison.CurrentCultureIgnoreCase);
/// <summary>
/// Contains files embedded into this profile.
/// </summary>
public EmbeddedFilesContainer EmbeddedFiles { get; } = new EmbeddedFilesContainer();
/// <summary>
/// Defines an uniquie ID to identify this tweak (e.g. for undo patch).
/// </summary>
[JsonConverter(typeof(UniquieIDStringJsonConverter))]
public UniquieID ID { get; set; } = new();
/// <summary>
/// Defines if the tweak is official and secure.
/// </summary>
public bool Official { get; set; } = false;
/// <summary>
/// Defines if the tweak is recommended for every common SM64 ROM Hack.
/// </summary>
public bool Recommended { get; set; } = false;
}

View File

@@ -9,69 +9,6 @@ using VersionConverter = Newtonsoft.Json.Converters.VersionConverter;
namespace SM64Lib.Patching;
public class PatchProfile
{
/// <summary>
/// The Name of the Profile.
/// </summary>
/// <returns></returns>
public string Name { get; set; } = "";
/// <summary>
/// A list with scripts.
/// </summary>
/// <returns></returns>
public List<PatchScript> Scripts { get; set; } = [];
/// <summary>
/// The version of this profile.
/// </summary>
/// <returns></returns>
[JsonConverter(typeof(VersionConverter))]
public Version Version { get; set; } = new Version("1.0.0.0");
/// <summary>
/// The minimum ROM Manager version requied for this tweak.
/// </summary>
[JsonConverter(typeof(VersionConverter))]
public Version MinVersion { get; set; } = new Version("1.0.0.0");
/// <summary>
/// The maximum ROM Manager version allowed for this tweak.
/// </summary>
[JsonConverter(typeof(VersionConverter))]
public Version MaxVersion { get; set; } = new Version("0.0.0.0");
/// <summary>
/// The description of this profile
/// </summary>
/// <returns></returns>
public string Description { get; set; } = "";
/// <summary>
/// The Xml file for this profile.
/// </summary>
/// <returns></returns>
[JsonIgnore]
public string FileName { get; set; } = "";
/// <summary>
/// Indicates if this patch use the old XML format.
/// </summary>
[JsonIgnore]
public bool IsLegacy => Path.GetExtension(FileName).Equals(".xml", StringComparison.CurrentCultureIgnoreCase);
/// <summary>
/// Contains files embedded into this profile.
/// </summary>
public EmbeddedFilesContainer EmbeddedFiles { get; } = new EmbeddedFilesContainer();
/// <summary>
/// Defines an uniquie ID to identify this tweak (e.g. for undo patch).
/// </summary>
[JsonConverter(typeof(UniquieIDStringJsonConverter))]
public UniquieID ID { get; set; } = new();
/// <summary>
/// Defines if the tweak is official and secure.
/// </summary>
public bool Official { get; set; } = false;
/// <summary>
/// Defines if the tweak is recommended for every common SM64 ROM Hack.
/// </summary>
public bool Recommended { get; set; } = false;
}
/// <summary>
/// A Profile containing a script and some descriptions.
/// </summary>
@@ -134,42 +71,3 @@ public class PatchScript
}
}
}
/// <summary>
/// Defines the script type, so the behavior on write it.
/// </summary>
public enum ScriptType
{
/// <summary>
/// A tweak syntax known from the SM64 Editor.
/// </summary>
TweakScript,
/// <summary>
/// A Visual Basic code.
/// </summary>
VisualBasic,
/// <summary>
/// A C# Code.
/// </summary>
CSharp,
/// <summary>
/// A DLL file containing the Code.
/// </summary>
DynamicLinkLibrary,
/// <summary>
/// Code that can be applied using Armips.
/// </summary>
Armips,
/// <summary>
/// Patch a BSP patch using Flips.
/// </summary>
BPS,
/// <summary>
/// Patch an IPS patch using Flips.
/// </summary>
IPS,
/// <summary>
/// Patch a PPF patch using ApplyPPF3.
/// </summary>
PPF
}

View File

@@ -0,0 +1,40 @@
namespace SM64Lib.Patching;
/// <summary>
/// Defines the script type, so the behavior on write it.
/// </summary>
public enum ScriptType
{
/// <summary>
/// A tweak syntax known from the SM64 Editor.
/// </summary>
TweakScript,
/// <summary>
/// A Visual Basic code.
/// </summary>
VisualBasic,
/// <summary>
/// A C# Code.
/// </summary>
CSharp,
/// <summary>
/// A DLL file containing the Code.
/// </summary>
DynamicLinkLibrary,
/// <summary>
/// Code that can be applied using Armips.
/// </summary>
Armips,
/// <summary>
/// Patch a BSP patch using Flips.
/// </summary>
BPS,
/// <summary>
/// Patch an IPS patch using Flips.
/// </summary>
IPS,
/// <summary>
/// Patch a PPF patch using ApplyPPF3.
/// </summary>
PPF
}

View File

@@ -1,70 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<DefineTrace>true</DefineTrace>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0660,CS0661,CA1009</NoWarn>
<Platforms>AnyCPU</Platforms>
<Configurations>Debug;Release;ReleaseBundle;ReleaseStandalone</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineDebug>true</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStandalone|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseBundle|AnyCPU'">
<DefineDebug>false</DefineDebug>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RelMono|AnyCPU'">
<Optimize>true</Optimize>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DefineConstants>TRACE;RelMono</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.11.0" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="Pilz.Cryptography" Version="2.1.1" />
<PackageReference Include="Pilz.IO" Version="2.0.0" />
<PackageReference Include="Pilz.IO" Version="2.1.0" />
<PackageReference Include="Pilz.Simple3DFileParser" Version="2.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="SM64Lib.Data.System" />
<Import Include="SM64Lib.TextValueConverter" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
<Import Include="Z.Collections.Extensions" />
<Import Include="Z.IO.Extensions" />
<Import Include="Z.Xml.Linq.Extensions" />
</ItemGroup>
<ItemGroup>
<Compile Update="My Project\Application.Designer.cs">