diff --git a/RecodeItLib/Remapper/ReCodeItRemapper.cs b/RecodeItLib/Remapper/ReCodeItRemapper.cs index b8295d5..569c88c 100644 --- a/RecodeItLib/Remapper/ReCodeItRemapper.cs +++ b/RecodeItLib/Remapper/ReCodeItRemapper.cs @@ -1,5 +1,4 @@ using Mono.Cecil; -using Mono.Cecil.Cil; using Mono.Cecil.Rocks; using ReCodeIt.CrossCompiler; using ReCodeIt.Enums; @@ -346,28 +345,6 @@ public class ReCodeItRemapper // Remove existing instructions ilProcessor.Clear(); - - if (method.ReturnType.FullName != "System.Void") - { - // Return appropriate default value based on return type - if (method.ReturnType.IsValueType) - { - // Load 0 onto the stack (works for most value types) - ilProcessor.Emit(OpCodes.Ldc_I4_0); - - // Convert to Int64 if needed - if (method.ReturnType.FullName == "System.Int64") - ilProcessor.Emit(OpCodes.Conv_I8); - } - else - { - // Load null for reference types - ilProcessor.Emit(OpCodes.Ldnull); - } - } - - // Add a return instruction - ilProcessor.Emit(OpCodes.Ret); } } } diff --git a/RecodeItLib/Utils/DataProvider.cs b/RecodeItLib/Utils/DataProvider.cs index 83da3d0..f18600a 100644 --- a/RecodeItLib/Utils/DataProvider.cs +++ b/RecodeItLib/Utils/DataProvider.cs @@ -53,6 +53,13 @@ public static class DataProvider Settings = JsonConvert.DeserializeObject(jsonText, settings); + if (Settings is null) + { + Logger.Log("Settings were null, creating new settings", ConsoleColor.Red); + Settings = CreateFakeSettings(); + SaveAppSettings(); + } + Logger.Log($"Settings loaded from '{settingsPath}'"); } @@ -85,6 +92,7 @@ public static class DataProvider if (!File.Exists(path)) { Logger.Log($"Error loading mapping.json from `{path}`, First time running? Please select a mapping path in the gui", ConsoleColor.Red); + return []; } var jsonText = File.ReadAllText(path);