public static void ColorGridOrBlockRequestValidationPatch(HarmonyInstance harmony) { harmony.Patch(typeof(MyCubeGrid).GetMethod("ColorGridOrBlockRequestValidation", BindingFlags.NonPublic | BindingFlags.Instance), new HarmonyMethod(typeof(Patch).GetMethod("PrefixColorGridOrBlockRequestValidation", BindingFlags.Public | BindingFlags.Static))); HaEConsole.WriteLine($"Patched MyCubeGrid.ColorGridOrBlockRequestValidation"); }
public static void IsSettingsExperimentalPatch(HarmonyInstance harmony) { harmony.Patch(typeof(MySession).GetMethod("IsSettingsExperimental", BindingFlags.Public | BindingFlags.Instance), new HarmonyMethod(typeof(Patch).GetMethod("PrefixIsSettingsExperimental", BindingFlags.Public | BindingFlags.Static))); HaEConsole.WriteLine($"Patched MySession.IsSettingsExperimental"); }
public static void PBProfilingPatch(HarmonyInstance harmony) { harmony.Patch(typeof(MyProgrammableBlock).GetMethod("ExecuteCode", BindingFlags.Public | BindingFlags.Instance), null, new HarmonyMethod(typeof(ProfilerPatches).GetMethod("SuffixProfilePB", BindingFlags.NonPublic | BindingFlags.Static))); HaEConsole.WriteLine($"Patched MyProgrammableBlock.ExecuteCode"); }
public static void ApplyPatch() { HaEConsole.WriteLine($"Patching ProfilerPatches..."); var harmony = HarmonyInstance.Create("com.HaE.HamTweaks.Profiler"); PBProfilingPatch(harmony); HaEConsole.WriteLine($"ProfilerPatches: Patched 1 method"); }
public static void ApplyPatch() { var harmony = HarmonyInstance.Create("com.HaE.HamTweaks.UXTweaks"); HaEConsole.WriteLine($"Patching UXPatches..."); IsSettingsExperimentalPatch(harmony); //ColorGridOrBlockRequestValidationPatch(harmony); HaEConsole.WriteLine($"UXPatches: Patched 2 methods"); }
public void ApplyLightingPatch() { if (!HaEHamTweaks.config.lightingPatch) { HaEConsole.WriteLine("lighting patch disabled."); return; } HaEConsole.WriteLine("lighting patch is no longer supported."); //RendertweakPatches.ApplyPatch(); //string filePath = MyFileSystem.ContentPath + "\\Shaders\\Lighting\\LightDefs.hlsli"; //StreamReader reader = new StreamReader(filePath); //string input = reader.ReadToEnd(); //reader.Close(); //if (input.Contains($"#define MAX_TILE_LIGHTS 256")) //{ // using (StreamWriter writer = new StreamWriter(filePath, false)) // { // { // string output = input.Replace("#define MAX_TILE_LIGHTS 256", $"#define MAX_TILE_LIGHTS {RendertweakPatches.pointlightCount}"); // writer.Write(output); // } // writer.Close(); // } // try // { // Directory.Delete(MyFileSystem.UserDataPath + "\\ShaderCache2", true); // } catch(DirectoryNotFoundException e) // { // HaEConsole.WriteLine("Could not find shadercache!"); // } // MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Info, MyMessageBoxButtonsType.YES_NO, // new StringBuilder("Please restart SE for lighting change to take effect!"), // new StringBuilder("HaE HamTweaks:"), // null, null, null, null, new Action<MyGuiScreenMessageBox.ResultEnum>(ExitCallback))); //} }