From af00f4c6d0d6f7ff6cd6534c6cd42ce41fa74ee2 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidoS@users.noreply.github.com> Date: Tue, 10 Sep 2024 20:22:26 -0500 Subject: [PATCH] Stickers: fixed shader replacement hitting stickers --- Stickers/Main.cs | 1 + Stickers/Patches.cs | 14 +++++++++++++- Stickers/Properties/AssemblyInfo.cs | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Stickers/Main.cs b/Stickers/Main.cs index 4b223f4..87e6824 100644 --- a/Stickers/Main.cs +++ b/Stickers/Main.cs @@ -26,6 +26,7 @@ public class StickerMod : MelonMod ApplyPatches(typeof(Patches.PlayerSetupPatches)); ApplyPatches(typeof(Patches.ControllerRayPatches)); ApplyPatches(typeof(Patches.ShaderFilterHelperPatches)); + ApplyPatches(typeof(Patches.CVRToolsPatches)); LoadAssetBundle(); diff --git a/Stickers/Patches.cs b/Stickers/Patches.cs index 4fc6b1b..4c9ff63 100644 --- a/Stickers/Patches.cs +++ b/Stickers/Patches.cs @@ -1,4 +1,5 @@ -using ABI_RC.Core.InteractionSystem; +using ABI_RC.Core; +using ABI_RC.Core.InteractionSystem; using ABI_RC.Core.IO; using ABI_RC.Core.Player; using ABI_RC.Core.Savior; @@ -48,4 +49,15 @@ internal static class ShaderFilterHelperPatches StickerMod.Logger.Warning("ExperimentalShaderLimitEnabled found to be true. Disabling setting to prevent crashes when spawning stickers!"); MetaPort.Instance.settings.SetSettingsBool("ExperimentalShaderLimitEnabled", false); } +} + +internal static class CVRToolsPatches +{ + [HarmonyPrefix] + [HarmonyPatch(typeof(CVRTools), nameof(CVRTools.ReplaceShaders), typeof(Material), typeof(string))] + private static bool Prefix_CVRTools_ReplaceShaders(Material material, string fallbackShaderName = "") + { + if (material == null || material.shader == null) return true; + return material.shader != StickerMod.DecalSimpleShader; // prevent replacing decals with fallback shader + } } \ No newline at end of file diff --git a/Stickers/Properties/AssemblyInfo.cs b/Stickers/Properties/AssemblyInfo.cs index 45de81f..425649a 100644 --- a/Stickers/Properties/AssemblyInfo.cs +++ b/Stickers/Properties/AssemblyInfo.cs @@ -27,6 +27,6 @@ using System.Reflection; namespace NAK.Stickers.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.0.6"; + public const string Version = "1.0.7"; public const string Author = "NotAKidoS"; } \ No newline at end of file