diff --git a/Assets/mappings.jsonc b/Assets/mappings.jsonc index 8064ca1..21fffa3 100644 --- a/Assets/mappings.jsonc +++ b/Assets/mappings.jsonc @@ -16422,5 +16422,171 @@ "ExcludeEvents": [] } } + }, + { + "NewTypeName": "PlantState", + "OriginalTypeName": "GClass1895", + "UseForceRename": false, + "SearchParams": { + "GenericParams": { + "IsPublic": true, + "IsAbstract": false, + "IsInterface": false, + "IsStruct": false, + "IsEnum": false, + "IsNested": false, + "IsSealed": true, + "HasAttribute": false, + "HasGenericParameters": false + }, + "Methods": { + "ConstructorParameterCount": 1, + "MethodCount": 9, + "IncludeMethods": [ + "Enter", + "Exit", + "ManualAnimatorMoveUpdate", + "ChangePose", + "SetTilt", + "Pickup", + "Examine", + "Plant", + "Cancel" + ], + "ExcludeMethods": [ + "Dispose", + "smethod_0", + "method_0", + "smethod_1", + "method_1", + "method_2", + "Pause", + "Resume", + "method_3", + "Begin", + "End", + "GetIcon", + "RenderModel", + "PoseModelByPivot", + "PoseModelByBounds", + "GetBounds", + "Create", + "ChatShared.IChatMember.Add", + "ChatShared.IChatMember.Remove", + "ChatShared.IChatMember.Receive", + "ChatShared.IChatMember.ReceiveReplay", + "ChatShared.IChatMember.SetBanned", + "ChatShared.IChatMember.SetUnbanned", + "ChatShared.IChatMember.Drop", + "OnUpdate", + "GetEffect", + "OnLateUpdate", + "method_4", + "method_5", + "OnDispose", + "StartFade", + "StopFade", + "Clear", + "ContainsIndex", + "GetNumPixels", + "ToIndexArray", + "ToSamplesArray", + "UnionWith", + "GetCellData", + "GetPixelData", + "DisposeAt", + "GetSample", + "Remap", + "ProcessAnimator", + "GInterface109.OnParameterValueChanged", + "Serialize", + "Deserialize", + "UpdateTimers", + "HandleExits", + "Transit", + "InteractWithTransit", + "Sizes", + "Timers", + "method_16", + "method_17", + "Start", + "Stop", + "method_6", + "add_OnQuit", + "remove_OnQuit", + "ShowDialogScreen", + "ExecuteDialogOption", + "ExecuteQuestAction", + "ExecuteServiceAction", + "SaveDialogState", + "add_SearchStopped", + "remove_SearchStopped", + "add_SearchComplete", + "remove_SearchComplete", + "Search", + "TryPauseFrameRelatedMetrics", + "TryResumeFrameRelatedMetrics", + "Update", + "SetAsCurrent", + "add_OnBuffsUpdated", + "remove_OnBuffsUpdated", + "Add", + "Replace", + "Remove", + "InvokeInternalBuffChange", + "EFT.IExplosiveItem.CreateFragment", + "Contains", + "CanExecute", + "RaiseEvents", + "RollBack", + "Execute", + "ExecuteWithNewCount", + "GInterface143.SetItemInfo", + "GetHashSum", + "GetInfo", + "ExecuteInternal", + "ToDescriptor", + "ToString", + "ToBaseInventoryCommand", + "method_7", + "method_8", + "method_9", + "method_10", + "ExecuteInteractionInternal", + "IsActive", + "IsInteractive", + "method_11", + "GetCommands", + "SetChanges", + "Reset", + "Rollback", + "Save", + "AddTask", + "CreateThread", + "RunInMainTread", + "CheckForFinishedTasks", + "Kill" + ] + }, + "Fields": { + "FieldCount": 2, + "IncludeFields": [], + "ExcludeFields": [] + }, + "Properties": { + "PropertyCount": 0, + "IncludeProperties": [], + "ExcludeProperties": [] + }, + "NestedTypes": { + "NestedTypeCount": -1, + "IncludeNestedTypes": [], + "ExcludeNestedTypes": [] + }, + "Events": { + "IncludeEvents": [], + "ExcludeEvents": [] + } + } } ] \ No newline at end of file diff --git a/ReCodeItCLI/Commands/AutoMatcher.cs b/ReCodeItCLI/Commands/AutoMatcher.cs index fc4ec33..b2edea2 100644 --- a/ReCodeItCLI/Commands/AutoMatcher.cs +++ b/ReCodeItCLI/Commands/AutoMatcher.cs @@ -26,12 +26,6 @@ public class AutoMatchCommand : ICommand { DataProvider.IsCli = true; DataProvider.LoadAppSettings(); - - var remapperSettings = DataProvider.Settings!.Remapper!.MappingSettings; - - remapperSettings!.RenameFields = true; - remapperSettings.RenameProperties = true; - remapperSettings.Publicize = true; Logger.LogSync("Finding match..."); diff --git a/RecodeItGUI/GUI/Main.cs b/RecodeItGUI/GUI/Main.cs index d466f05..af5e5a9 100644 --- a/RecodeItGUI/GUI/Main.cs +++ b/RecodeItGUI/GUI/Main.cs @@ -247,31 +247,31 @@ public partial class ReCodeItForm : Form { ConstructorParameterCount = (int)ConstructorCountEnabled.GetCount(ConstuctorCountUpDown), MethodCount = (int)MethodCountEnabled.GetCount(MethodCountUpDown), - IncludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodIncludeBox), - ExcludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodExcludeBox), + IncludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodIncludeBox).ToHashSet(), + ExcludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodExcludeBox).ToHashSet(), }, Fields = { FieldCount = (int)FieldCountEnabled.GetCount(FieldCountUpDown), - IncludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldIncludeBox), - ExcludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldExcludeBox), + IncludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldIncludeBox).ToHashSet(), + ExcludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldExcludeBox).ToHashSet(), }, Properties = { PropertyCount = (int)PropertyCountEnabled.GetCount(PropertyCountUpDown), - IncludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesIncludeBox), - ExcludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesExcludeBox), + IncludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesIncludeBox).ToHashSet(), + ExcludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesExcludeBox).ToHashSet(), }, NestedTypes = { NestedTypeCount = (int)NestedTypeCountEnabled.GetCount(NestedTypeCountUpDown), - IncludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesIncludeBox), - ExcludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesExcludeBox), + IncludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesIncludeBox).ToHashSet(), + ExcludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesExcludeBox).ToHashSet(), }, Events = { - IncludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsIncludeBox), - ExcludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsExcludeBox) + IncludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsIncludeBox).ToHashSet(), + ExcludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsExcludeBox).ToHashSet() } } }; diff --git a/RecodeItGUI/Utils/GUIHelpers.cs b/RecodeItGUI/Utils/GUIHelpers.cs index 2d02e10..cc12d50 100644 --- a/RecodeItGUI/Utils/GUIHelpers.cs +++ b/RecodeItGUI/Utils/GUIHelpers.cs @@ -286,7 +286,7 @@ internal static class GUIHelpers /// /// /// A new tree node, or null if the provided list is empty - private static TreeNode GenerateNodeFromList(List items, string name) + private static TreeNode GenerateNodeFromList(HashSet items, string name) { var node = new TreeNode(name); diff --git a/RecodeItLib/Models/RemapModel.cs b/RecodeItLib/Models/RemapModel.cs index 65c8cb5..87b5d0b 100644 --- a/RecodeItLib/Models/RemapModel.cs +++ b/RecodeItLib/Models/RemapModel.cs @@ -85,33 +85,33 @@ public class MethodParams { public int ConstructorParameterCount { get; set; } = -1; public int MethodCount { get; set; } = -1; - public List IncludeMethods { get; set; } = []; - public List ExcludeMethods { get; set; } = []; + public HashSet IncludeMethods { get; set; } = []; + public HashSet ExcludeMethods { get; set; } = []; } public class FieldParams { public int FieldCount { get; set; } = -1; - public List IncludeFields { get; set; } = []; - public List ExcludeFields { get; set; } = []; + public HashSet IncludeFields { get; set; } = []; + public HashSet ExcludeFields { get; set; } = []; } public class PropertyParams { public int PropertyCount { get; set; } = -1; - public List IncludeProperties { get; set; } = []; - public List ExcludeProperties { get; set; } = []; + public HashSet IncludeProperties { get; set; } = []; + public HashSet ExcludeProperties { get; set; } = []; } public class NestedTypeParams { public int NestedTypeCount { get; set; } = -1; - public List IncludeNestedTypes { get; set; } = []; - public List ExcludeNestedTypes { get; set; } = []; + public HashSet IncludeNestedTypes { get; set; } = []; + public HashSet ExcludeNestedTypes { get; set; } = []; } public class EventParams { - public List IncludeEvents { get; set; } = []; - public List ExcludeEvents { get; set; } = []; + public HashSet IncludeEvents { get; set; } = []; + public HashSet ExcludeEvents { get; set; } = []; } \ No newline at end of file diff --git a/RecodeItLib/Remapper/AutoMatcher.cs b/RecodeItLib/Remapper/AutoMatcher.cs index ee1b7fd..a4d64cc 100644 --- a/RecodeItLib/Remapper/AutoMatcher.cs +++ b/RecodeItLib/Remapper/AutoMatcher.cs @@ -26,6 +26,12 @@ public class AutoMatcher(List mappings, string mappingPath) .ToList(); var targetTypeDef = FindTargetType(oldTypeName); + + if (targetTypeDef is null) + { + Logger.LogSync($"Could not target type: {oldTypeName}", ConsoleColor.Red); + return; + } Logger.LogSync($"Found target type: {targetTypeDef!.FullName}", ConsoleColor.Green); @@ -152,10 +158,15 @@ public class AutoMatcher(List mappings, string mappingPath) .Where(m => !m.IsConstructor && !m.IsGetter && !m.IsSetter) .Select(s => s.Name.ToString())); - methods.IncludeMethods.Clear(); - methods.IncludeMethods.AddRange(includeMethods); - - methods.ExcludeMethods.AddRange(excludeMethods); + foreach (var include in includeMethods) + { + methods.IncludeMethods.Add(include); + } + + foreach (var exclude in excludeMethods) + { + methods.ExcludeMethods.Add(exclude); + } methods.MethodCount = target.Methods .Count(m => !m.IsConstructor && !m.IsGetter && !m.IsSetter && !m.IsSpecialName); @@ -200,10 +211,15 @@ public class AutoMatcher(List mappings, string mappingPath) .Select(s => s.Name.ToString()) .Except(target.Fields.Select(s => s.Name.ToString())); - fields.IncludeFields.Clear(); - fields.IncludeFields.AddRange(includeFields); - - fields.ExcludeFields.AddRange(excludeFields); + foreach (var include in includeFields) + { + fields.IncludeFields.Add(include); + } + + foreach (var exclude in excludeFields) + { + fields.ExcludeFields.Add(exclude); + } fields.FieldCount = target.Fields.Count; @@ -242,10 +258,15 @@ public class AutoMatcher(List mappings, string mappingPath) .Select(s => s.Name.ToString()) .Except(target.Properties.Select(s => s.Name.ToString())); - props.IncludeProperties.Clear(); - props.IncludeProperties.AddRange(includeProps); - - props.ExcludeProperties.AddRange(excludeProps); + foreach (var include in includeProps) + { + props.IncludeProperties.Add(include); + } + + foreach (var exclude in excludeProps) + { + props.ExcludeProperties.Add(exclude); + } props.PropertyCount = target.Properties.Count;