From ed6ffb012136f34eefa60bf55f897e597a12d08f Mon Sep 17 00:00:00 2001 From: Niaz Date: Sat, 7 May 2022 12:21:11 +0200 Subject: [PATCH 01/11] Added boilerplate for new plugin --- BundleManager.sln | 7 ++ LuaList/LuaList.cs | 59 ++++++++++++ LuaList/LuaList.csproj | 99 +++++++++++++++++++ LuaList/LuaListEditor.Designer.cs | 35 +++++++ LuaList/LuaListEditor.cs | 32 +++++++ LuaList/LuaListPlugin.cs | 30 ++++++ LuaList/Properties/AssemblyInfo.cs | 36 +++++++ LuaList/Properties/Resources.Designer.cs | 63 ++++++++++++ LuaList/Properties/Resources.resx | 117 +++++++++++++++++++++++ LuaList/Properties/Settings.Designer.cs | 26 +++++ LuaList/Properties/Settings.settings | 7 ++ VaultFormat/AttribSysVaultForm.cs | 3 - VaultFormat/AttribSysVaultPlugin.cs | 2 +- 13 files changed, 512 insertions(+), 4 deletions(-) create mode 100644 LuaList/LuaList.cs create mode 100644 LuaList/LuaList.csproj create mode 100644 LuaList/LuaListEditor.Designer.cs create mode 100644 LuaList/LuaListEditor.cs create mode 100644 LuaList/LuaListPlugin.cs create mode 100644 LuaList/Properties/AssemblyInfo.cs create mode 100644 LuaList/Properties/Resources.Designer.cs create mode 100644 LuaList/Properties/Resources.resx create mode 100644 LuaList/Properties/Settings.Designer.cs create mode 100644 LuaList/Properties/Settings.settings diff --git a/BundleManager.sln b/BundleManager.sln index e215bd9..17495f6 100644 --- a/BundleManager.sln +++ b/BundleManager.sln @@ -55,6 +55,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{DA4D9C10-E EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorldCollisionHandler", "WorldCollisionHandler\WorldCollisionHandler.csproj", "{754DDA1C-8F2F-4F6C-8BC0-D6553A9A7451}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaList", "LuaList\LuaList.csproj", "{D1395FDE-6A64-4D9F-9DCA-60825BD0A43C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -133,6 +135,10 @@ Global {754DDA1C-8F2F-4F6C-8BC0-D6553A9A7451}.Debug|Any CPU.Build.0 = Debug|Any CPU {754DDA1C-8F2F-4F6C-8BC0-D6553A9A7451}.Release|Any CPU.ActiveCfg = Release|Any CPU {754DDA1C-8F2F-4F6C-8BC0-D6553A9A7451}.Release|Any CPU.Build.0 = Release|Any CPU + {D1395FDE-6A64-4D9F-9DCA-60825BD0A43C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1395FDE-6A64-4D9F-9DCA-60825BD0A43C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1395FDE-6A64-4D9F-9DCA-60825BD0A43C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1395FDE-6A64-4D9F-9DCA-60825BD0A43C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -156,6 +162,7 @@ Global {4FC1C1EE-618A-4B65-A103-A51568A01629} = {3BA7CE56-4E22-418F-9D13-F2189413D30B} {7743D330-6A1A-496C-872B-E36C9EB38CE7} = {60F98E02-807F-4EDC-8747-147C365606B1} {754DDA1C-8F2F-4F6C-8BC0-D6553A9A7451} = {60F98E02-807F-4EDC-8747-147C365606B1} + {D1395FDE-6A64-4D9F-9DCA-60825BD0A43C} = {60F98E02-807F-4EDC-8747-147C365606B1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {566130B7-31A2-4407-A2E1-C22E60C85C2C} diff --git a/LuaList/LuaList.cs b/LuaList/LuaList.cs new file mode 100644 index 0000000..49e833f --- /dev/null +++ b/LuaList/LuaList.cs @@ -0,0 +1,59 @@ +using BundleFormat; +using PluginAPI; +using BundleUtilities; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace LuaList +{ + public class LuaList : IEntryData + { + public IEntryEditor GetEditor(BundleEntry entry) + { + LuaListEditor luaListEditor = new LuaListEditor(); + luaListEditor.LuaList = this; + luaListEditor.EditEvent += () => + { + Write(entry); + }; + return luaListEditor; + } + + public EntryType GetEntryType(BundleEntry entry) + { + return EntryType.LUAList; + } + + private void Clear() + { + + } + + public bool Read(BundleEntry entry, ILoader loader = null) + { + Clear(); + + MemoryStream ms = entry.MakeStream(); + BinaryReader2 br = new BinaryReader2(ms); + + br.Close(); + ms.Close(); + + return true; + } + + public bool Write(BundleEntry entry) + { + MemoryStream ms = new MemoryStream(); + BinaryWriter bw = new BinaryWriter(ms); + + bw.Close(); + ms.Close(); + + return true; + } + } +} diff --git a/LuaList/LuaList.csproj b/LuaList/LuaList.csproj new file mode 100644 index 0000000..c2d452d --- /dev/null +++ b/LuaList/LuaList.csproj @@ -0,0 +1,99 @@ + + + + + Debug + AnyCPU + {D1395FDE-6A64-4D9F-9DCA-60825BD0A43C} + Library + LuaList + LuaList + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + Form + + + LuaListEditor.cs + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {49b81828-760c-42db-9fad-96755597c871} + BundleFormat + + + {34471573-f236-4a7c-abd9-c1fe4686b37e} + BundleUtilities + + + {757f0204-f091-464d-aa42-fe8919ff73bb} + PluginAPI + + + + + xcopy "$(TargetPath)" "$(SolutionDir)BundleManager\bin\$(ConfigurationName)\plugins\" /s /e /y + + \ No newline at end of file diff --git a/LuaList/LuaListEditor.Designer.cs b/LuaList/LuaListEditor.Designer.cs new file mode 100644 index 0000000..dad5947 --- /dev/null +++ b/LuaList/LuaListEditor.Designer.cs @@ -0,0 +1,35 @@ + +namespace LuaList +{ + partial class LuaListEditor + { + + private System.ComponentModel.IContainer components = null; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "Form1"; + } + + #endregion + } +} + diff --git a/LuaList/LuaListEditor.cs b/LuaList/LuaListEditor.cs new file mode 100644 index 0000000..f7a2d18 --- /dev/null +++ b/LuaList/LuaListEditor.cs @@ -0,0 +1,32 @@ +using System.Windows.Forms; +using PluginAPI; + +namespace LuaList +{ + public delegate void Notify(); // delegate + public partial class LuaListEditor : Form, IEntryEditor + { + public event Notify EditEvent; + + private LuaList _luaList; + public LuaList LuaList + { + get => _luaList; + set + { + _luaList = value; + UpdateDisplay(); + } + } + + private void UpdateDisplay() + { + + } + + public LuaListEditor() + { + InitializeComponent(); + } + } +} diff --git a/LuaList/LuaListPlugin.cs b/LuaList/LuaListPlugin.cs new file mode 100644 index 0000000..bfd89dc --- /dev/null +++ b/LuaList/LuaListPlugin.cs @@ -0,0 +1,30 @@ +using BundleFormat; +using PluginAPI; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace LuaList +{ + + public class LuaListPlugin : Plugin + { + public override void Init() + { + EntryTypeRegistry.Register(EntryType.LUAList, new LuaList()); + } + + public override string GetID() + { + return "lualistplugin"; + } + + public override string GetName() + { + return "Lua List Resource Handler"; + } + + } +} diff --git a/LuaList/Properties/AssemblyInfo.cs b/LuaList/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3bcbfaf --- /dev/null +++ b/LuaList/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("LuaList")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LuaList")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 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("d1395fde-6a64-4d9f-9dca-60825bd0a43c")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// indem Sie "*" wie unten gezeigt eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/LuaList/Properties/Resources.Designer.cs b/LuaList/Properties/Resources.Designer.cs new file mode 100644 index 0000000..c52b803 --- /dev/null +++ b/LuaList/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace LuaList.Properties { + using System; + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LuaList.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/LuaList/Properties/Resources.resx b/LuaList/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/LuaList/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LuaList/Properties/Settings.Designer.cs b/LuaList/Properties/Settings.Designer.cs new file mode 100644 index 0000000..687764d --- /dev/null +++ b/LuaList/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace LuaList.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/LuaList/Properties/Settings.settings b/LuaList/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/LuaList/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/VaultFormat/AttribSysVaultForm.cs b/VaultFormat/AttribSysVaultForm.cs index 161584b..918191e 100644 --- a/VaultFormat/AttribSysVaultForm.cs +++ b/VaultFormat/AttribSysVaultForm.cs @@ -1,13 +1,10 @@ using System; using System.Collections; -using System.Collections.Generic; using System.Globalization; using System.Windows.Forms; using PluginAPI; using BundleUtilities; -using System.Threading.Tasks; using LangEditor; -using BundleFormat; namespace VaultFormat { diff --git a/VaultFormat/AttribSysVaultPlugin.cs b/VaultFormat/AttribSysVaultPlugin.cs index 573cd1b..978cf2c 100644 --- a/VaultFormat/AttribSysVaultPlugin.cs +++ b/VaultFormat/AttribSysVaultPlugin.cs @@ -9,7 +9,7 @@ namespace VaultFormat { - public class VehicleListPlugin : Plugin + public class AttribsSysVaultPlugin : Plugin { public override void Init() { From 68576abf404d72923a739a981d54088887b39d90 Mon Sep 17 00:00:00 2001 From: Niaz Date: Sat, 7 May 2022 13:44:56 +0200 Subject: [PATCH 02/11] Add Read/Write for Header --- LuaList/LuaList.cs | 68 +++++++++++++++-- LuaList/LuaList.csproj | 4 + LuaList/LuaListEditor.Designer.cs | 27 ++++++- LuaList/LuaListEditor.cs | 15 +++- LuaList/LuaListEditor.resx | 120 ++++++++++++++++++++++++++++++ LuaList/ULongHexTypeConverter.cs | 70 +++++++++++++++++ 6 files changed, 291 insertions(+), 13 deletions(-) create mode 100644 LuaList/LuaListEditor.resx create mode 100644 LuaList/ULongHexTypeConverter.cs diff --git a/LuaList/LuaList.cs b/LuaList/LuaList.cs index 49e833f..6d25661 100644 --- a/LuaList/LuaList.cs +++ b/LuaList/LuaList.cs @@ -1,16 +1,32 @@ using BundleFormat; using PluginAPI; using BundleUtilities; -using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using System.ComponentModel; +using System; namespace LuaList { + public class LuaList : IEntryData { + public int version { get; set; } //0x0 0x4 int32_t Version number 1 + public byte[] padding { get; set; } //0x4 0x4 padding + [TypeConverter(typeof(ULongHexTypeConverter))] + public ulong CgsId { get; set; } //0x8 0x8 CgsID List ID Encoded + public byte[] Unk0 { get; set; } //0x10 0x4 Unk0* Script list Unk0 format + public byte[] typePointer { get; set; }//0x14 0x4 char[32] * * Types + public byte[] variablePointer { get; set; } //0x18 0x4 char[32] * * Variables + public int numScripts { get; set; } //0x1C 0x4 uint32_t Num scripts + public int dataLength { get; set; } //0x20 0x4 uint32_t Data length Not including padding to end + public string listTitle { get; set; } //0x24 0x80 char[128] List title + public short numTypes { get; set; } //0xA4 0x1 uint8_t Num types + public short numVariables { get; set; } //0xA5 0x1 uint8_t Num variables + public byte[] unknownData { get; set; } + public IEntryEditor GetEditor(BundleEntry entry) { LuaListEditor luaListEditor = new LuaListEditor(); @@ -27,18 +43,41 @@ public EntryType GetEntryType(BundleEntry entry) return EntryType.LUAList; } - private void Clear() - { - + public int getLengthOfHeader() { + List bytes = new List(); + bytes.Add(BitConverter.GetBytes(version)); + bytes.Add(padding); + bytes.Add(BitConverter.GetBytes(CgsId)); + bytes.Add(Unk0); + bytes.Add(typePointer); + bytes.Add(variablePointer); + bytes.Add(BitConverter.GetBytes(numScripts)); + bytes.Add(BitConverter.GetBytes(dataLength)); + bytes.Add(Encoding.ASCII.GetBytes((listTitle.PadRight(128).Substring(0, 128).ToCharArray()))); + bytes.Add(BitConverter.GetBytes(numTypes)); + bytes.Add(BitConverter.GetBytes(numVariables)); + return bytes.SelectMany(i => i).Count(); } public bool Read(BundleEntry entry, ILoader loader = null) { - Clear(); - MemoryStream ms = entry.MakeStream(); BinaryReader2 br = new BinaryReader2(ms); + version = br.ReadInt32(); + padding = br.ReadBytes(4); + CgsId = br.ReadUInt64(); + Unk0 = br.ReadBytes(4); + typePointer = br.ReadBytes(4); + variablePointer = br.ReadBytes(4); + numScripts = br.ReadInt32(); + dataLength = br.ReadInt32(); + listTitle = new string(br.ReadChars(128)); + numTypes = br.ReadInt16(); + numVariables = br.ReadInt16(); + + unknownData = br.ReadBytes(dataLength - getLengthOfHeader()); + br.Close(); ms.Close(); @@ -49,10 +88,25 @@ public bool Write(BundleEntry entry) { MemoryStream ms = new MemoryStream(); BinaryWriter bw = new BinaryWriter(ms); - + bw.Write(version); + bw.Write(padding); + bw.Write(CgsId); + bw.Write(Unk0); + bw.Write(typePointer); + bw.Write(variablePointer); + bw.Write(numScripts); + bw.Write(dataLength); + bw.Write(listTitle.PadRight(128).Substring(0, 128).ToCharArray()); + bw.Write(numTypes); + bw.Write(numVariables); + bw.Write(unknownData); + bw.Flush(); + byte[] data = ms.ToArray(); bw.Close(); ms.Close(); + entry.EntryBlocks[0].Data = data; + entry.Dirty = true; return true; } } diff --git a/LuaList/LuaList.csproj b/LuaList/LuaList.csproj index c2d452d..dd49335 100644 --- a/LuaList/LuaList.csproj +++ b/LuaList/LuaList.csproj @@ -58,6 +58,10 @@ + + + LuaListEditor.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/LuaList/LuaListEditor.Designer.cs b/LuaList/LuaListEditor.Designer.cs index dad5947..78a4c74 100644 --- a/LuaList/LuaListEditor.Designer.cs +++ b/LuaList/LuaListEditor.Designer.cs @@ -3,7 +3,7 @@ namespace LuaList { partial class LuaListEditor { - + private System.ComponentModel.IContainer components = null; protected override void Dispose(bool disposing) @@ -23,13 +23,34 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); + this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); + this.SuspendLayout(); + // + // propertyGrid1 + // + this.propertyGrid1.Location = new System.Drawing.Point(-2, -4); + this.propertyGrid1.Name = "propertyGrid1"; + this.propertyGrid1.Size = new System.Drawing.Size(802, 456); + this.propertyGrid1.TabIndex = 0; + this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid1_PropertyValueChanged); + // + // LuaListEditor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; + this.Controls.Add(this.propertyGrid1); + this.Name = "LuaListEditor"; + this.Text = "Lua List Editor"; + this.ResumeLayout(false); + + this.Controls.Add(this.propertyGrid1); + } #endregion + + private System.Windows.Forms.PropertyGrid propertyGrid1; } } diff --git a/LuaList/LuaListEditor.cs b/LuaList/LuaListEditor.cs index f7a2d18..a56b6ff 100644 --- a/LuaList/LuaListEditor.cs +++ b/LuaList/LuaListEditor.cs @@ -1,3 +1,4 @@ +using System; using System.Windows.Forms; using PluginAPI; @@ -15,18 +16,26 @@ public LuaList LuaList set { _luaList = value; - UpdateDisplay(); + UpdateComponent(); } } - private void UpdateDisplay() + public void UpdateComponent() { - + + propertyGrid1.SelectedObject = LuaList; } public LuaListEditor() { InitializeComponent(); + UpdateComponent(); } + + private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) + { + EditEvent?.Invoke(); + } + } } diff --git a/LuaList/LuaListEditor.resx b/LuaList/LuaListEditor.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/LuaList/LuaListEditor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/LuaList/ULongHexTypeConverter.cs b/LuaList/ULongHexTypeConverter.cs new file mode 100644 index 0000000..a685f2a --- /dev/null +++ b/LuaList/ULongHexTypeConverter.cs @@ -0,0 +1,70 @@ +using System; +using System.ComponentModel; + +namespace LuaList +{ + // Included... + // [1] Define TypeConverter class for hex. + // [2] use it when defining a member of a data class using attribute TypeConverter. + // [3] Connect the data class to a PropertyGrid. + + + // [1] define UInt32HexTypeConverter is-a TypeConverter + public class ULongHexTypeConverter : TypeConverter + { + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof(string)) + { + return true; + } + else + { + return base.CanConvertFrom(context, sourceType); + } + } + + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + if (destinationType == typeof(string)) + { + return true; + } + else + { + return base.CanConvertTo(context, destinationType); + } + } + + public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) + { + if (destinationType == typeof(string) && value.GetType() == typeof(ulong)) + { + return string.Format("0x{0:X8}", value); + } + else + { + return base.ConvertTo(context, culture, value, destinationType); + } + } + + public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) + { + if (value.GetType() == typeof(string)) + { + string input = (string)value; + + if (input.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) + { + input = input.Substring(2); + } + + return ulong.Parse(input, System.Globalization.NumberStyles.HexNumber, culture); + } + else + { + return base.ConvertFrom(context, culture, value); + } + } + } +} From 91bcfdc566b1201def8128e5eef92c4e01589e4b Mon Sep 17 00:00:00 2001 From: Niaz Date: Sat, 7 May 2022 14:51:12 +0200 Subject: [PATCH 03/11] Add LuaListEntry --- LuaList/LuaList.cs | 29 ++++++++++---- LuaList/LuaListEntry.cs | 67 ++++++++++++++++++++++++++++++++ LuaList/ULongHexTypeConverter.cs | 2 +- 3 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 LuaList/LuaListEntry.cs diff --git a/LuaList/LuaList.cs b/LuaList/LuaList.cs index 6d25661..d676bc1 100644 --- a/LuaList/LuaList.cs +++ b/LuaList/LuaList.cs @@ -20,11 +20,14 @@ public class LuaList : IEntryData public byte[] Unk0 { get; set; } //0x10 0x4 Unk0* Script list Unk0 format public byte[] typePointer { get; set; }//0x14 0x4 char[32] * * Types public byte[] variablePointer { get; set; } //0x18 0x4 char[32] * * Variables + [ReadOnly(true)] public int numScripts { get; set; } //0x1C 0x4 uint32_t Num scripts public int dataLength { get; set; } //0x20 0x4 uint32_t Data length Not including padding to end public string listTitle { get; set; } //0x24 0x80 char[128] List title - public short numTypes { get; set; } //0xA4 0x1 uint8_t Num types - public short numVariables { get; set; } //0xA5 0x1 uint8_t Num variables + public byte numTypes { get; set; } //0xA4 0x1 uint8_t Num types + public byte numVariables { get; set; } //0xA5 0x1 uint8_t Num variables + public byte[] padding2 { get; set; } // 26 bytes long + public List entries { get; set; } public byte[] unknownData { get; set; } public IEntryEditor GetEditor(BundleEntry entry) @@ -72,11 +75,17 @@ public bool Read(BundleEntry entry, ILoader loader = null) variablePointer = br.ReadBytes(4); numScripts = br.ReadInt32(); dataLength = br.ReadInt32(); - listTitle = new string(br.ReadChars(128)); - numTypes = br.ReadInt16(); - numVariables = br.ReadInt16(); + listTitle = br.ReadLenString(128); + numTypes = br.ReadByte(); + numVariables = br.ReadByte(); + padding2 = br.ReadBytes(26); - unknownData = br.ReadBytes(dataLength - getLengthOfHeader()); + entries = new List(); + for (int i = 0; i < numScripts; i++) { + LuaListEntry luaentry = new LuaListEntry(); + luaentry.Read(loader, br); + entries.Add(luaentry); + } br.Close(); ms.Close(); @@ -94,12 +103,16 @@ public bool Write(BundleEntry entry) bw.Write(Unk0); bw.Write(typePointer); bw.Write(variablePointer); - bw.Write(numScripts); + bw.Write(entries.Count); bw.Write(dataLength); bw.Write(listTitle.PadRight(128).Substring(0, 128).ToCharArray()); bw.Write(numTypes); bw.Write(numVariables); - bw.Write(unknownData); + bw.Write(padding2); + foreach (LuaListEntry luaentry in entries) + { + luaentry.Write(bw); + } bw.Flush(); byte[] data = ms.ToArray(); bw.Close(); diff --git a/LuaList/LuaListEntry.cs b/LuaList/LuaListEntry.cs new file mode 100644 index 0000000..675d3e1 --- /dev/null +++ b/LuaList/LuaListEntry.cs @@ -0,0 +1,67 @@ +using BundleUtilities; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.ComponentModel; +using System; + +namespace LuaList +{ + public class LuaListEntry + { + [TypeConverter(typeof(ULongHexTypeConverter))] + public ulong CgsId { get; set; } + public string Name { get; set; } = ""; + public string Goal { get; set; } = ""; + public string Description { get; set; } = ""; + public string unknown1 { get; set; } = ""; + public int unknown2 { get; set; } = 0; + public int unknown3 { get; set; } = 0; + public int Type { get; set; } = 0; + public int Variables { get; set; } = 0; + public byte[] padding { get; set; } = new byte[8]; + + public int getDataSize() { + List bytes = new List(); + bytes.Add(BitConverter.GetBytes(CgsId)); + bytes.Add(Encoding.ASCII.GetBytes((Name.PadRight(128).Substring(0, 128).ToCharArray()))); + bytes.Add(Encoding.ASCII.GetBytes((Goal.PadRight(128).Substring(0, 128).ToCharArray()))); + bytes.Add(Encoding.ASCII.GetBytes((Description.PadRight(128).Substring(0, 128).ToCharArray()))); + bytes.Add(Encoding.ASCII.GetBytes((unknown1.PadRight(128).Substring(0, 128).ToCharArray()))); + bytes.Add(BitConverter.GetBytes(unknown2)); + bytes.Add(BitConverter.GetBytes(unknown3)); + bytes.Add(BitConverter.GetBytes(Type)); + bytes.Add(BitConverter.GetBytes(Variables)); + bytes.Add(padding); + return bytes.SelectMany(i => i).Count(); + } + + public void Read(ILoader loader, BinaryReader2 br) { + CgsId = br.ReadUInt64(); + Name = br.ReadLenString(128); + Goal = br.ReadLenString(128); + Description = br.ReadLenString(128); + unknown1 = br.ReadLenString(128); + unknown2 = br.ReadInt32(); + unknown3 = br.ReadInt32(); + Type = br.ReadInt32(); + Variables = br.ReadInt32(); + padding = br.ReadBytes(8); + } + + public void Write(BinaryWriter wr) + { + wr.Write(CgsId); + wr.Write(Encoding.ASCII.GetBytes((Name.PadRight(128).Substring(0, 128).ToCharArray()))); + wr.Write(Encoding.ASCII.GetBytes((Goal.PadRight(128).Substring(0, 128).ToCharArray()))); + wr.Write(Encoding.ASCII.GetBytes((Description.PadRight(128).Substring(0, 128).ToCharArray()))); + wr.Write(Encoding.ASCII.GetBytes((unknown1.PadRight(128).Substring(0, 128).ToCharArray()))); + wr.Write(unknown2); + wr.Write(unknown3); + wr.Write(Type); + wr.Write(Variables); + wr.Write(padding); + } + } +} diff --git a/LuaList/ULongHexTypeConverter.cs b/LuaList/ULongHexTypeConverter.cs index a685f2a..d12f3a5 100644 --- a/LuaList/ULongHexTypeConverter.cs +++ b/LuaList/ULongHexTypeConverter.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; namespace LuaList From 022e2cb482d0ec073e5704663599f97520ee7d7e Mon Sep 17 00:00:00 2001 From: Niaz Date: Sat, 7 May 2022 16:48:41 +0200 Subject: [PATCH 04/11] Update LuaList.csproj --- LuaList/LuaList.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/LuaList/LuaList.csproj b/LuaList/LuaList.csproj index dd49335..f39b773 100644 --- a/LuaList/LuaList.csproj +++ b/LuaList/LuaList.csproj @@ -56,6 +56,7 @@ LuaListEditor.cs + From e41a62e28145db5d28acff068e58c9399f536dd9 Mon Sep 17 00:00:00 2001 From: Niaz Date: Fri, 20 May 2022 11:24:53 +0200 Subject: [PATCH 05/11] Add new category for undefined datastructures --- LuaList/LuaList.cs | 17 +++++++++++++---- LuaList/LuaListEntry.cs | 7 ++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/LuaList/LuaList.cs b/LuaList/LuaList.cs index d676bc1..2ea3959 100644 --- a/LuaList/LuaList.cs +++ b/LuaList/LuaList.cs @@ -13,21 +13,30 @@ namespace LuaList public class LuaList : IEntryData { - public int version { get; set; } //0x0 0x4 int32_t Version number 1 + public int version { get; set; } //0x0 0x4 int32_t Version number 1 + [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] public byte[] padding { get; set; } //0x4 0x4 padding [TypeConverter(typeof(ULongHexTypeConverter))] public ulong CgsId { get; set; } //0x8 0x8 CgsID List ID Encoded + [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] public byte[] Unk0 { get; set; } //0x10 0x4 Unk0* Script list Unk0 format - public byte[] typePointer { get; set; }//0x14 0x4 char[32] * * Types - public byte[] variablePointer { get; set; } //0x18 0x4 char[32] * * Variables - [ReadOnly(true)] + [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + public byte[] typePointer { get; set; }//0x14 0x4 char[32] * * Types + [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + public byte[] variablePointer { get; set; } //0x18 0x4 char[32] * * Variables + [ReadOnly(true), Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] public int numScripts { get; set; } //0x1C 0x4 uint32_t Num scripts + [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] public int dataLength { get; set; } //0x20 0x4 uint32_t Data length Not including padding to end public string listTitle { get; set; } //0x24 0x80 char[128] List title + [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] public byte numTypes { get; set; } //0xA4 0x1 uint8_t Num types + [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] public byte numVariables { get; set; } //0xA5 0x1 uint8_t Num variables + [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] public byte[] padding2 { get; set; } // 26 bytes long public List entries { get; set; } + [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] public byte[] unknownData { get; set; } public IEntryEditor GetEditor(BundleEntry entry) diff --git a/LuaList/LuaListEntry.cs b/LuaList/LuaListEntry.cs index 675d3e1..3ff9e0a 100644 --- a/LuaList/LuaListEntry.cs +++ b/LuaList/LuaListEntry.cs @@ -1,4 +1,4 @@ -using BundleUtilities; +using BundleUtilities; using System.Collections.Generic; using System.IO; using System.Linq; @@ -15,11 +15,16 @@ public class LuaListEntry public string Name { get; set; } = ""; public string Goal { get; set; } = ""; public string Description { get; set; } = ""; + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public string unknown1 { get; set; } = ""; + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public int unknown2 { get; set; } = 0; + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public int unknown3 { get; set; } = 0; public int Type { get; set; } = 0; public int Variables { get; set; } = 0; + + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte[] padding { get; set; } = new byte[8]; public int getDataSize() { From 07e1aebe471a99b4bfa2c5a8cf7a987ad4df4937 Mon Sep 17 00:00:00 2001 From: Niaz Date: Fri, 20 May 2022 12:12:01 +0200 Subject: [PATCH 06/11] Fix typo --- LuaList/LuaList.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/LuaList/LuaList.cs b/LuaList/LuaList.cs index 2ea3959..8675352 100644 --- a/LuaList/LuaList.cs +++ b/LuaList/LuaList.cs @@ -14,29 +14,29 @@ namespace LuaList public class LuaList : IEntryData { public int version { get; set; } //0x0 0x4 int32_t Version number 1 - [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte[] padding { get; set; } //0x4 0x4 padding [TypeConverter(typeof(ULongHexTypeConverter))] public ulong CgsId { get; set; } //0x8 0x8 CgsID List ID Encoded - [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte[] Unk0 { get; set; } //0x10 0x4 Unk0* Script list Unk0 format - [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte[] typePointer { get; set; }//0x14 0x4 char[32] * * Types - [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte[] variablePointer { get; set; } //0x18 0x4 char[32] * * Variables - [ReadOnly(true), Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + [ReadOnly(true), Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public int numScripts { get; set; } //0x1C 0x4 uint32_t Num scripts - [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public int dataLength { get; set; } //0x20 0x4 uint32_t Data length Not including padding to end public string listTitle { get; set; } //0x24 0x80 char[128] List title - [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte numTypes { get; set; } //0xA4 0x1 uint8_t Num types - [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte numVariables { get; set; } //0xA5 0x1 uint8_t Num variables - [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte[] padding2 { get; set; } // 26 bytes long public List entries { get; set; } - [Category("Undefined Datastructure"), Description("This is currently not implented and can be ignored")] + [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte[] unknownData { get; set; } public IEntryEditor GetEditor(BundleEntry entry) From 4d4e25c44272773980845a1b0b988525ab8e50d9 Mon Sep 17 00:00:00 2001 From: Niaz Date: Sat, 4 Jun 2022 14:31:22 +0200 Subject: [PATCH 07/11] Clean up LuaListDataType --- LuaList/LuaList.cs | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/LuaList/LuaList.cs b/LuaList/LuaList.cs index 8675352..a15c86f 100644 --- a/LuaList/LuaList.cs +++ b/LuaList/LuaList.cs @@ -10,34 +10,22 @@ namespace LuaList { - public class LuaList : IEntryData { - public int version { get; set; } //0x0 0x4 int32_t Version number 1 - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public byte[] padding { get; set; } //0x4 0x4 padding + public int version { get; set; } //0x0 0x4 int32_t Version number 1 0x4 0x4 padding [TypeConverter(typeof(ULongHexTypeConverter))] public ulong CgsId { get; set; } //0x8 0x8 CgsID List ID Encoded - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public byte[] Unk0 { get; set; } //0x10 0x4 Unk0* Script list Unk0 format - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public byte[] typePointer { get; set; }//0x14 0x4 char[32] * * Types - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public byte[] variablePointer { get; set; } //0x18 0x4 char[32] * * Variables - [ReadOnly(true), Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public int numScripts { get; set; } //0x1C 0x4 uint32_t Num scripts - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public int dataLength { get; set; } //0x20 0x4 uint32_t Data length Not including padding to end + public byte[] Unk0; //0x10 0x4 Unk0* Script list Unk0 format + public byte[] typePointer;//0x14 0x4 char[32] * * Types + public byte[] variablePointer; //0x18 0x4 char[32] * * Variables + public int dataLength; //0x20 0x4 uint32_t Data length Not including padding to end public string listTitle { get; set; } //0x24 0x80 char[128] List title [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte numTypes { get; set; } //0xA4 0x1 uint8_t Num types [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] public byte numVariables { get; set; } //0xA5 0x1 uint8_t Num variables - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public byte[] padding2 { get; set; } // 26 bytes long public List entries { get; set; } - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public byte[] unknownData { get; set; } + public byte[] unknownData; public IEntryEditor GetEditor(BundleEntry entry) { @@ -58,12 +46,12 @@ public EntryType GetEntryType(BundleEntry entry) public int getLengthOfHeader() { List bytes = new List(); bytes.Add(BitConverter.GetBytes(version)); - bytes.Add(padding); + bytes.Add(new byte[4]); bytes.Add(BitConverter.GetBytes(CgsId)); bytes.Add(Unk0); bytes.Add(typePointer); bytes.Add(variablePointer); - bytes.Add(BitConverter.GetBytes(numScripts)); + bytes.Add(BitConverter.GetBytes(entries.Count)); bytes.Add(BitConverter.GetBytes(dataLength)); bytes.Add(Encoding.ASCII.GetBytes((listTitle.PadRight(128).Substring(0, 128).ToCharArray()))); bytes.Add(BitConverter.GetBytes(numTypes)); @@ -77,17 +65,17 @@ public bool Read(BundleEntry entry, ILoader loader = null) BinaryReader2 br = new BinaryReader2(ms); version = br.ReadInt32(); - padding = br.ReadBytes(4); + br.ReadBytes(4); CgsId = br.ReadUInt64(); Unk0 = br.ReadBytes(4); typePointer = br.ReadBytes(4); variablePointer = br.ReadBytes(4); - numScripts = br.ReadInt32(); + var numScripts = br.ReadInt32(); dataLength = br.ReadInt32(); listTitle = br.ReadLenString(128); numTypes = br.ReadByte(); numVariables = br.ReadByte(); - padding2 = br.ReadBytes(26); + br.ReadBytes(26); entries = new List(); for (int i = 0; i < numScripts; i++) { @@ -107,17 +95,17 @@ public bool Write(BundleEntry entry) MemoryStream ms = new MemoryStream(); BinaryWriter bw = new BinaryWriter(ms); bw.Write(version); - bw.Write(padding); + bw.WriteUniquePadding(4); bw.Write(CgsId); bw.Write(Unk0); bw.Write(typePointer); bw.Write(variablePointer); bw.Write(entries.Count); - bw.Write(dataLength); + bw.Write(dataLength); //Calculate this bw.Write(listTitle.PadRight(128).Substring(0, 128).ToCharArray()); bw.Write(numTypes); bw.Write(numVariables); - bw.Write(padding2); + bw.WriteUniquePadding(26); foreach (LuaListEntry luaentry in entries) { luaentry.Write(bw); From ffb8d4353e7d4a750dd88298acf835807248f6c7 Mon Sep 17 00:00:00 2001 From: Niaz Date: Sun, 5 Jun 2022 14:48:57 +0200 Subject: [PATCH 08/11] Add types and variables of LuaList --- LuaList/LuaList.cs | 165 ++++++++++++++++++++++++++++++---------- LuaList/LuaListEntry.cs | 16 ++-- 2 files changed, 133 insertions(+), 48 deletions(-) diff --git a/LuaList/LuaList.cs b/LuaList/LuaList.cs index a15c86f..7c2bcea 100644 --- a/LuaList/LuaList.cs +++ b/LuaList/LuaList.cs @@ -12,21 +12,15 @@ namespace LuaList { public class LuaList : IEntryData { - public int version { get; set; } //0x0 0x4 int32_t Version number 1 0x4 0x4 padding + public int version { get; set; } [TypeConverter(typeof(ULongHexTypeConverter))] - public ulong CgsId { get; set; } //0x8 0x8 CgsID List ID Encoded - public byte[] Unk0; //0x10 0x4 Unk0* Script list Unk0 format - public byte[] typePointer;//0x14 0x4 char[32] * * Types - public byte[] variablePointer; //0x18 0x4 char[32] * * Variables - public int dataLength; //0x20 0x4 uint32_t Data length Not including padding to end - public string listTitle { get; set; } //0x24 0x80 char[128] List title - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public byte numTypes { get; set; } //0xA4 0x1 uint8_t Num types - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public byte numVariables { get; set; } //0xA5 0x1 uint8_t Num variables - public List entries { get; set; } - public byte[] unknownData; + public ulong CgsId { get; set; } + public int dataLength; + public string listTitle { get; set; } + public List entries { get; set; } + public List types { get; set; } + public List variables { get; set; } public IEntryEditor GetEditor(BundleEntry entry) { LuaListEditor luaListEditor = new LuaListEditor(); @@ -43,47 +37,104 @@ public EntryType GetEntryType(BundleEntry entry) return EntryType.LUAList; } - public int getLengthOfHeader() { + public int getLengthOfHeader() + { List bytes = new List(); bytes.Add(BitConverter.GetBytes(version)); bytes.Add(new byte[4]); bytes.Add(BitConverter.GetBytes(CgsId)); - bytes.Add(Unk0); - bytes.Add(typePointer); - bytes.Add(variablePointer); + bytes.Add(BitConverter.GetBytes(192)); + bytes.Add(BitConverter.GetBytes(1231)); + bytes.Add(BitConverter.GetBytes(312312)); bytes.Add(BitConverter.GetBytes(entries.Count)); bytes.Add(BitConverter.GetBytes(dataLength)); bytes.Add(Encoding.ASCII.GetBytes((listTitle.PadRight(128).Substring(0, 128).ToCharArray()))); - bytes.Add(BitConverter.GetBytes(numTypes)); - bytes.Add(BitConverter.GetBytes(numVariables)); + bytes.Add(new byte[] { (byte)types.Count() }); + bytes.Add(new byte[] { (byte)variables.Count() }); + bytes.Add(new byte[26]); return bytes.SelectMany(i => i).Count(); } + public int getLengthOfTypes() + { + if (types.Count == 0) + { + return 0; + } + return (types.Count * 32) + 32; // Pointer Array of 32 bytes + } + + public int getLengthOfVariables() + { + if (variables.Count == 0) + { + return 0; + } + return (variables.Count * 32) + 32; // Pointer Array of 32 bytes + } + + public int getLengthOfEntries() + { + return entries.Sum(i => i.getDataSize()); + } + public bool Read(BundleEntry entry, ILoader loader = null) { MemoryStream ms = entry.MakeStream(); BinaryReader2 br = new BinaryReader2(ms); - version = br.ReadInt32(); - br.ReadBytes(4); - CgsId = br.ReadUInt64(); - Unk0 = br.ReadBytes(4); - typePointer = br.ReadBytes(4); - variablePointer = br.ReadBytes(4); - var numScripts = br.ReadInt32(); - dataLength = br.ReadInt32(); - listTitle = br.ReadLenString(128); - numTypes = br.ReadByte(); - numVariables = br.ReadByte(); - br.ReadBytes(26); + version = br.ReadInt32(); //0x0 0x4 int32_t Version number 1 + br.ReadBytes(4); // 0x4 0x4 padding + CgsId = br.ReadUInt64(); //0x8 0x8 CgsID List ID Encoded + var entriesPointer = br.ReadInt32(); //0x10 0x4 Unk0* Script list Unk0 format + var typePointer = br.ReadInt32(); //0x14 0x4 char[32] * * Types + var variablePointer = br.ReadInt32(); //0x18 0x4 char[32] * * Variables + var numScripts = br.ReadInt32(); //0x1C 0x4 uint32_t Num scripts + var dataLength = br.ReadInt32(); //0x20 0x4 uint32_t Data length Not including padding to end + listTitle = br.ReadLenString(128); //0x24 0x80 char[128] List title + var numTypes = br.ReadByte(); //0xA4 0x1 uint8_t Num types + var numVariables = br.ReadByte(); //0xA5 0x1 uint8_t Num variables + br.ReadBytes(26); // padding entries = new List(); - for (int i = 0; i < numScripts; i++) { + for (int i = 0; i < numScripts; i++) + { LuaListEntry luaentry = new LuaListEntry(); luaentry.Read(loader, br); entries.Add(luaentry); } + br.BaseStream.Position = typePointer; + long currentAddress = br.BaseStream.Position; + types = new List(); + for (int i = 0; i < numTypes; i++) + { + int pointer = br.ReadInt32(); + currentAddress = br.BaseStream.Position; + br.BaseStream.Position = pointer; + types.Add(br.ReadLenString(32)); + br.BaseStream.Position = currentAddress; + } + br.BaseStream.Position = variablePointer; + variables = new List(); + for (int i = 0; i < numVariables; i++) + { + int pointer = br.ReadInt32(); + currentAddress = br.BaseStream.Position; + br.BaseStream.Position = pointer; + if (dataLength - pointer > 31) + { + variables.Add(br.ReadLenString(32)); + } + else + { + Console.WriteLine(dataLength - pointer); + variables.Add(br.ReadLenString(dataLength - pointer)); + } + br.BaseStream.Position = currentAddress; + } + Console.WriteLine(getLengthOfHeader() + getLengthOfEntries() + getLengthOfTypes() + getLengthOfVariables()); + Console.WriteLine(dataLength); br.Close(); ms.Close(); @@ -97,19 +148,53 @@ public bool Write(BundleEntry entry) bw.Write(version); bw.WriteUniquePadding(4); bw.Write(CgsId); - bw.Write(Unk0); - bw.Write(typePointer); - bw.Write(variablePointer); + bw.Write(getLengthOfHeader()); + bw.Write(getLengthOfHeader() + getLengthOfEntries()); + bw.Write(getLengthOfHeader() + getLengthOfEntries() + getLengthOfTypes()); bw.Write(entries.Count); - bw.Write(dataLength); //Calculate this - bw.Write(listTitle.PadRight(128).Substring(0, 128).ToCharArray()); - bw.Write(numTypes); - bw.Write(numVariables); - bw.WriteUniquePadding(26); + bw.Write(getLengthOfHeader() + getLengthOfEntries() + getLengthOfTypes() + getLengthOfVariables()); //Calculate this + bw.Write(listTitle.PadRight(128, '\0').Substring(0, 128).ToCharArray()); + bw.Write((byte)types.Count); + bw.Write((byte)variables.Count); + bw.WriteUniquePadding(26); foreach (LuaListEntry luaentry in entries) { luaentry.Write(bw); } + var counter = 0; + var pointerAddress = bw.BaseStream.Position; + // Skip pointer address for now + bw.BaseStream.Position = bw.BaseStream.Position + 32; + foreach (string type in types) + { + // Save pointer to text + int pointer = (int)bw.BaseStream.Position; + bw.Write(type.PadRight(32, '\0').Substring(0, 32).ToCharArray()); + long currentAddress = bw.BaseStream.Position; + // Go to pointer array + bw.BaseStream.Position = pointerAddress + (4 * counter); + bw.Write(pointer); + counter++; + // Go back to old position + bw.BaseStream.Position = currentAddress; + } + counter = 0; + pointerAddress = bw.BaseStream.Position; + // Skip pointer address for now + bw.BaseStream.Position = bw.BaseStream.Position + 32; + foreach (string variable in variables) + { + // Save pointer to text + int pointer = (int)bw.BaseStream.Position; + bw.Write(variable.PadRight(32, '\0').Substring(0, 32).ToCharArray()); + long currentAddress = bw.BaseStream.Position; + // Go to pointer array + bw.BaseStream.Position = pointerAddress + (4 * counter); + bw.Write(pointer); + counter++; + // Go back to old position + bw.BaseStream.Position = currentAddress; + } bw.Flush(); byte[] data = ms.ToArray(); bw.Close(); diff --git a/LuaList/LuaListEntry.cs b/LuaList/LuaListEntry.cs index 3ff9e0a..3a2b54b 100644 --- a/LuaList/LuaListEntry.cs +++ b/LuaList/LuaListEntry.cs @@ -30,10 +30,10 @@ public class LuaListEntry public int getDataSize() { List bytes = new List(); bytes.Add(BitConverter.GetBytes(CgsId)); - bytes.Add(Encoding.ASCII.GetBytes((Name.PadRight(128).Substring(0, 128).ToCharArray()))); - bytes.Add(Encoding.ASCII.GetBytes((Goal.PadRight(128).Substring(0, 128).ToCharArray()))); - bytes.Add(Encoding.ASCII.GetBytes((Description.PadRight(128).Substring(0, 128).ToCharArray()))); - bytes.Add(Encoding.ASCII.GetBytes((unknown1.PadRight(128).Substring(0, 128).ToCharArray()))); + bytes.Add(Encoding.ASCII.GetBytes((Name.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); + bytes.Add(Encoding.ASCII.GetBytes((Goal.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); + bytes.Add(Encoding.ASCII.GetBytes((Description.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); + bytes.Add(Encoding.ASCII.GetBytes((unknown1.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); bytes.Add(BitConverter.GetBytes(unknown2)); bytes.Add(BitConverter.GetBytes(unknown3)); bytes.Add(BitConverter.GetBytes(Type)); @@ -58,10 +58,10 @@ public void Read(ILoader loader, BinaryReader2 br) { public void Write(BinaryWriter wr) { wr.Write(CgsId); - wr.Write(Encoding.ASCII.GetBytes((Name.PadRight(128).Substring(0, 128).ToCharArray()))); - wr.Write(Encoding.ASCII.GetBytes((Goal.PadRight(128).Substring(0, 128).ToCharArray()))); - wr.Write(Encoding.ASCII.GetBytes((Description.PadRight(128).Substring(0, 128).ToCharArray()))); - wr.Write(Encoding.ASCII.GetBytes((unknown1.PadRight(128).Substring(0, 128).ToCharArray()))); + wr.Write(Encoding.ASCII.GetBytes((Name.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); + wr.Write(Encoding.ASCII.GetBytes((Goal.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); + wr.Write(Encoding.ASCII.GetBytes((Description.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); + wr.Write(Encoding.ASCII.GetBytes((unknown1.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); wr.Write(unknown2); wr.Write(unknown3); wr.Write(Type); From 155a4f2646ba9a6f7769d5e6117793454e429d62 Mon Sep 17 00:00:00 2001 From: Niaz Date: Sat, 11 Jun 2022 11:33:49 +0200 Subject: [PATCH 09/11] Add EncryptedString Read/Write - also remove some padding --- BundleUtilities/Utilities.cs | 26 +++++++++++++++++++ ...nverter.cs => EncryptedStringConverter.cs} | 14 +++------- LuaList/LuaList.cs | 11 ++++---- LuaList/LuaList.csproj | 6 ++++- LuaList/LuaListEntry.cs | 23 +++++++--------- 5 files changed, 51 insertions(+), 29 deletions(-) rename LuaList/{ULongHexTypeConverter.cs => EncryptedStringConverter.cs} (81%) diff --git a/BundleUtilities/Utilities.cs b/BundleUtilities/Utilities.cs index 3c46c1a..c2b2760 100644 --- a/BundleUtilities/Utilities.cs +++ b/BundleUtilities/Utilities.cs @@ -46,6 +46,18 @@ public void Log(string logMessage, TextWriter txtWriter) } } } + + public static class Util + { + // reverse byte order (64-bit) + public static UInt64 ReverseBytes(UInt64 value) + { + return (value & 0x00000000000000FFUL) << 56 | (value & 0x000000000000FF00UL) << 40 | + (value & 0x0000000000FF0000UL) << 24 | (value & 0x00000000FF000000UL) << 8 | + (value & 0x000000FF00000000UL) >> 8 | (value & 0x0000FF0000000000UL) >> 24 | + (value & 0x00FF000000000000UL) >> 40 | (value & 0xFF00000000000000UL) >> 56; + } + } public static class Utilities { public static ulong calcLookup8(string text) @@ -56,6 +68,20 @@ public static ulong calcLookup8(string text) return hashValue; } + public static EncryptedString ReadEncryptedString(this BinaryReader self) + { + ulong value = self.ReadUInt64(); + EncryptedString id = new EncryptedString(value); + return id; + } + + public static void WriteEncryptedString(this BinaryWriter self, EncryptedString id, bool xbox = false) + { + ulong value = id.Encrypted; + if (xbox) + value = Util.ReverseBytes(value); + self.Write(value); + } public static bool IsValidPath(string path) { diff --git a/LuaList/ULongHexTypeConverter.cs b/LuaList/EncryptedStringConverter.cs similarity index 81% rename from LuaList/ULongHexTypeConverter.cs rename to LuaList/EncryptedStringConverter.cs index d12f3a5..44027b5 100644 --- a/LuaList/ULongHexTypeConverter.cs +++ b/LuaList/EncryptedStringConverter.cs @@ -10,7 +10,7 @@ namespace LuaList // [1] define UInt32HexTypeConverter is-a TypeConverter - public class ULongHexTypeConverter : TypeConverter + public class EncryptedStringConverter : TypeConverter { public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { @@ -38,9 +38,9 @@ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinati public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { - if (destinationType == typeof(string) && value.GetType() == typeof(ulong)) + if (destinationType == typeof(string) && value.GetType() == typeof(BundleUtilities.EncryptedString)) { - return string.Format("0x{0:X8}", value); + return ((BundleUtilities.EncryptedString)value).Value; } else { @@ -53,13 +53,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, System.Global if (value.GetType() == typeof(string)) { string input = (string)value; - - if (input.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) - { - input = input.Substring(2); - } - - return ulong.Parse(input, System.Globalization.NumberStyles.HexNumber, culture); + return new BundleUtilities.EncryptedString(input); } else { diff --git a/LuaList/LuaList.cs b/LuaList/LuaList.cs index 7c2bcea..fdafe4d 100644 --- a/LuaList/LuaList.cs +++ b/LuaList/LuaList.cs @@ -13,8 +13,9 @@ namespace LuaList public class LuaList : IEntryData { public int version { get; set; } - [TypeConverter(typeof(ULongHexTypeConverter))] - public ulong CgsId { get; set; } + + [TypeConverter(typeof(EncryptedStringConverter))] + public EncryptedString CgsId { get; set; } public int dataLength; public string listTitle { get; set; } @@ -42,7 +43,7 @@ public int getLengthOfHeader() List bytes = new List(); bytes.Add(BitConverter.GetBytes(version)); bytes.Add(new byte[4]); - bytes.Add(BitConverter.GetBytes(CgsId)); + bytes.Add(BitConverter.GetBytes(CgsId.Encrypted)); bytes.Add(BitConverter.GetBytes(192)); bytes.Add(BitConverter.GetBytes(1231)); bytes.Add(BitConverter.GetBytes(312312)); @@ -85,7 +86,7 @@ public bool Read(BundleEntry entry, ILoader loader = null) version = br.ReadInt32(); //0x0 0x4 int32_t Version number 1 br.ReadBytes(4); // 0x4 0x4 padding - CgsId = br.ReadUInt64(); //0x8 0x8 CgsID List ID Encoded + CgsId = br.ReadEncryptedString(); //0x8 0x8 CgsID List ID Encoded var entriesPointer = br.ReadInt32(); //0x10 0x4 Unk0* Script list Unk0 format var typePointer = br.ReadInt32(); //0x14 0x4 char[32] * * Types var variablePointer = br.ReadInt32(); //0x18 0x4 char[32] * * Variables @@ -147,7 +148,7 @@ public bool Write(BundleEntry entry) BinaryWriter bw = new BinaryWriter(ms); bw.Write(version); bw.WriteUniquePadding(4); - bw.Write(CgsId); + bw.WriteEncryptedString(CgsId); bw.Write(getLengthOfHeader()); bw.Write(getLengthOfHeader() + getLengthOfEntries()); bw.Write(getLengthOfHeader() + getLengthOfEntries() + getLengthOfTypes()); diff --git a/LuaList/LuaList.csproj b/LuaList/LuaList.csproj index f39b773..4a81178 100644 --- a/LuaList/LuaList.csproj +++ b/LuaList/LuaList.csproj @@ -59,7 +59,7 @@ - + LuaListEditor.cs @@ -96,6 +96,10 @@ {757f0204-f091-464d-aa42-fe8919ff73bb} PluginAPI + + {557FC08F-7ACD-44D7-AC1F-FB815A267A36} + VehicleList + diff --git a/LuaList/LuaListEntry.cs b/LuaList/LuaListEntry.cs index 3a2b54b..54fb134 100644 --- a/LuaList/LuaListEntry.cs +++ b/LuaList/LuaListEntry.cs @@ -10,8 +10,8 @@ namespace LuaList { public class LuaListEntry { - [TypeConverter(typeof(ULongHexTypeConverter))] - public ulong CgsId { get; set; } + [TypeConverter(typeof(EncryptedStringConverter))] + public EncryptedString CgsId { get; set; } public string Name { get; set; } = ""; public string Goal { get; set; } = ""; public string Description { get; set; } = ""; @@ -24,26 +24,23 @@ public class LuaListEntry public int Type { get; set; } = 0; public int Variables { get; set; } = 0; - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public byte[] padding { get; set; } = new byte[8]; - public int getDataSize() { List bytes = new List(); - bytes.Add(BitConverter.GetBytes(CgsId)); + bytes.Add(BitConverter.GetBytes(CgsId.Encrypted)); bytes.Add(Encoding.ASCII.GetBytes((Name.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); bytes.Add(Encoding.ASCII.GetBytes((Goal.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); bytes.Add(Encoding.ASCII.GetBytes((Description.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); bytes.Add(Encoding.ASCII.GetBytes((unknown1.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); bytes.Add(BitConverter.GetBytes(unknown2)); bytes.Add(BitConverter.GetBytes(unknown3)); - bytes.Add(BitConverter.GetBytes(Type)); - bytes.Add(BitConverter.GetBytes(Variables)); - bytes.Add(padding); + bytes.Add(BitConverter.GetBytes((int)Type)); + bytes.Add(BitConverter.GetBytes((int)Variables)); + bytes.Add(new byte[8]); return bytes.SelectMany(i => i).Count(); } public void Read(ILoader loader, BinaryReader2 br) { - CgsId = br.ReadUInt64(); + CgsId = br.ReadEncryptedString(); Name = br.ReadLenString(128); Goal = br.ReadLenString(128); Description = br.ReadLenString(128); @@ -52,12 +49,12 @@ public void Read(ILoader loader, BinaryReader2 br) { unknown3 = br.ReadInt32(); Type = br.ReadInt32(); Variables = br.ReadInt32(); - padding = br.ReadBytes(8); + br.ReadBytes(8); // padding } public void Write(BinaryWriter wr) { - wr.Write(CgsId); + wr.WriteEncryptedString(CgsId); wr.Write(Encoding.ASCII.GetBytes((Name.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); wr.Write(Encoding.ASCII.GetBytes((Goal.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); wr.Write(Encoding.ASCII.GetBytes((Description.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); @@ -66,7 +63,7 @@ public void Write(BinaryWriter wr) wr.Write(unknown3); wr.Write(Type); wr.Write(Variables); - wr.Write(padding); + wr.WriteUniquePadding(8); } } } From 04028baab549a551a85b7e05cf6794e6d4cb85fd Mon Sep 17 00:00:00 2001 From: Niaz Date: Sat, 23 Jul 2022 21:22:54 +0200 Subject: [PATCH 10/11] Replace last unknown fields --- LuaList/LuaListEntry.cs | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/LuaList/LuaListEntry.cs b/LuaList/LuaListEntry.cs index 54fb134..50c137f 100644 --- a/LuaList/LuaListEntry.cs +++ b/LuaList/LuaListEntry.cs @@ -8,6 +8,18 @@ namespace LuaList { + public enum ScoreMultiplier { + StandardPoints = 0, + DoublePoints = 1 , + TriplePoints = 2 + } + + public enum ScoringMethod + { + ScoreByPosition = 0, + ScoreBySuccessOrFail = 1 + } + public class LuaListEntry { [TypeConverter(typeof(EncryptedStringConverter))] @@ -15,12 +27,8 @@ public class LuaListEntry public string Name { get; set; } = ""; public string Goal { get; set; } = ""; public string Description { get; set; } = ""; - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public string unknown1 { get; set; } = ""; - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public int unknown2 { get; set; } = 0; - [Category("Undefined Datastructure"), Description("This is currently not implemented and can be ignored")] - public int unknown3 { get; set; } = 0; + public ScoreMultiplier ScoreMultiplier { get; set; } = ScoreMultiplier.StandardPoints; + public ScoringMethod ScoringMethod { get; set; } = ScoringMethod.ScoreBySuccessOrFail; public int Type { get; set; } = 0; public int Variables { get; set; } = 0; @@ -29,10 +37,9 @@ public int getDataSize() { bytes.Add(BitConverter.GetBytes(CgsId.Encrypted)); bytes.Add(Encoding.ASCII.GetBytes((Name.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); bytes.Add(Encoding.ASCII.GetBytes((Goal.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); - bytes.Add(Encoding.ASCII.GetBytes((Description.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); - bytes.Add(Encoding.ASCII.GetBytes((unknown1.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); - bytes.Add(BitConverter.GetBytes(unknown2)); - bytes.Add(BitConverter.GetBytes(unknown3)); + bytes.Add(Encoding.ASCII.GetBytes((Description.PadRight(256, '\0').Substring(0, 256).ToCharArray()))); + bytes.Add(BitConverter.GetBytes((int)ScoreMultiplier)); + bytes.Add(BitConverter.GetBytes((int)ScoringMethod)); bytes.Add(BitConverter.GetBytes((int)Type)); bytes.Add(BitConverter.GetBytes((int)Variables)); bytes.Add(new byte[8]); @@ -43,10 +50,9 @@ public void Read(ILoader loader, BinaryReader2 br) { CgsId = br.ReadEncryptedString(); Name = br.ReadLenString(128); Goal = br.ReadLenString(128); - Description = br.ReadLenString(128); - unknown1 = br.ReadLenString(128); - unknown2 = br.ReadInt32(); - unknown3 = br.ReadInt32(); + Description = br.ReadLenString(256); + ScoreMultiplier = (ScoreMultiplier) br.ReadInt32(); + ScoringMethod = (ScoringMethod) br.ReadInt32(); Type = br.ReadInt32(); Variables = br.ReadInt32(); br.ReadBytes(8); // padding @@ -57,10 +63,9 @@ public void Write(BinaryWriter wr) wr.WriteEncryptedString(CgsId); wr.Write(Encoding.ASCII.GetBytes((Name.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); wr.Write(Encoding.ASCII.GetBytes((Goal.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); - wr.Write(Encoding.ASCII.GetBytes((Description.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); - wr.Write(Encoding.ASCII.GetBytes((unknown1.PadRight(128, '\0').Substring(0, 128).ToCharArray()))); - wr.Write(unknown2); - wr.Write(unknown3); + wr.Write(Encoding.ASCII.GetBytes((Description.PadRight(256, '\0').Substring(0, 256).ToCharArray()))); + wr.Write((int)ScoreMultiplier); + wr.Write((int)ScoringMethod); wr.Write(Type); wr.Write(Variables); wr.WriteUniquePadding(8); From ba1b878ed2c4f664b5c0db3599339b69ccc95d5c Mon Sep 17 00:00:00 2001 From: Niaz Date: Sat, 23 Jul 2022 22:06:00 +0200 Subject: [PATCH 11/11] Initialise EncryptedString --- LuaList/LuaListEntry.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LuaList/LuaListEntry.cs b/LuaList/LuaListEntry.cs index 50c137f..54aa17d 100644 --- a/LuaList/LuaListEntry.cs +++ b/LuaList/LuaListEntry.cs @@ -23,7 +23,7 @@ public enum ScoringMethod public class LuaListEntry { [TypeConverter(typeof(EncryptedStringConverter))] - public EncryptedString CgsId { get; set; } + public EncryptedString CgsId { get; set; } = new EncryptedString("SC_1000000"); public string Name { get; set; } = ""; public string Goal { get; set; } = ""; public string Description { get; set; } = "";