From b796a6b0751ebaac1477ef10a70aa00c90eaf5f9 Mon Sep 17 00:00:00 2001 From: zombieb Date: Wed, 20 Aug 2025 15:40:39 -0400 Subject: [PATCH] VideoTamperPatch, configurable outside of the BepInEx config --- Core/Config/BaseOptionConfig.cs | 6 ++ Core/{ => Config}/DediConfig.cs | 5 +- Core/Content/GameManager/GameConfigurator.cs | 1 + Core/Content/GameManager/GameManSpawns.cs | 1 + Core/Init.cs | 2 + Patches/Video/VideoTamperPatch.cs | 63 ++++++++++++++++++++ asdf copy.json | 28 +++++++++ 7 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 Core/Config/BaseOptionConfig.cs rename Core/{ => Config}/DediConfig.cs (92%) create mode 100644 Patches/Video/VideoTamperPatch.cs create mode 100644 asdf copy.json diff --git a/Core/Config/BaseOptionConfig.cs b/Core/Config/BaseOptionConfig.cs new file mode 100644 index 0000000..85e0cce --- /dev/null +++ b/Core/Config/BaseOptionConfig.cs @@ -0,0 +1,6 @@ +namespace undead_universal_patch_il2cpp.Core.Config; + +public class BaseOptionConfig +{ + public bool Enabled { get; set; } = false; +} \ No newline at end of file diff --git a/Core/DediConfig.cs b/Core/Config/DediConfig.cs similarity index 92% rename from Core/DediConfig.cs rename to Core/Config/DediConfig.cs index 74c785b..82a9a0c 100644 --- a/Core/DediConfig.cs +++ b/Core/Config/DediConfig.cs @@ -2,7 +2,7 @@ using System; using System.IO; using System.Text.Json; -namespace undead_universal_patch_il2cpp.Core; +namespace undead_universal_patch_il2cpp.Core.Config; public class DediConfig { @@ -23,7 +23,8 @@ public class DediConfig _options = options; } - private string GetAlways() { + private string GetAlways() + { if (!File.Exists(path)) { File.WriteAllText(path, _default); diff --git a/Core/Content/GameManager/GameConfigurator.cs b/Core/Content/GameManager/GameConfigurator.cs index e214bce..712755a 100644 --- a/Core/Content/GameManager/GameConfigurator.cs +++ b/Core/Content/GameManager/GameConfigurator.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using undead_universal_patch_il2cpp.Core.Config; namespace undead_universal_patch_il2cpp.Core.Content.UndeadGameManager; diff --git a/Core/Content/GameManager/GameManSpawns.cs b/Core/Content/GameManager/GameManSpawns.cs index 6bea64b..93f703a 100644 --- a/Core/Content/GameManager/GameManSpawns.cs +++ b/Core/Content/GameManager/GameManSpawns.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using undead_universal_patch_il2cpp.Core.Config; namespace undead_universal_patch_il2cpp.Core.Content.UndeadGameManager; diff --git a/Core/Init.cs b/Core/Init.cs index 3d22f9c..b275b33 100644 --- a/Core/Init.cs +++ b/Core/Init.cs @@ -7,6 +7,7 @@ using undead_universal_patch_il2cpp.Core.Config; using undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CustomEmotes; using undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CustomPhoton; using undead_universal_patch_il2cpp.Core.Content.UndeadGameManager; +using undead_universal_patch_il2cpp.Patches.Video; using UnityEngine; namespace undead_universal_patch_il2cpp.Core; @@ -50,6 +51,7 @@ public class Initialization { if (GameManagerConfig.AnyGameFreeSpawn.Value) GameFreeSpawns.config.Get(); if (GameManagerConfig.StaticGameConfig.Value) GameConfigurator.config.Get(); + VideoTamperPatch.config.Get(); } private static void AttachGameObjects() diff --git a/Patches/Video/VideoTamperPatch.cs b/Patches/Video/VideoTamperPatch.cs new file mode 100644 index 0000000..47ec2ea --- /dev/null +++ b/Patches/Video/VideoTamperPatch.cs @@ -0,0 +1,63 @@ +using System.Reflection; +using System.Text.Json; +using HarmonyLib; +using undead_universal_patch_il2cpp.Core; +using undead_universal_patch_il2cpp.Core.Config; + +namespace undead_universal_patch_il2cpp.Patches.Video; + +[HarmonyPatch] +public class VideoTamperPatch +{ + public static DediConfig config = new("VideoTamperPatchConfig", JsonSerializer.Serialize( + new BaseOptionConfig + { + Enabled = false + } + ), null); + + static PatchTypesResult patchTypesResult = Util.PreparePatchTypes( + "Video anti-tamper hash disabler patch", + "RecRoom.Core.Cinematics.CinematicVideoPlayer", + "Start" + ); + + static bool Prepare() + { + if (config.Get().Enabled) return patchTypesResult.Success; + else return false; + } + + static MethodBase TargetMethod() => patchTypesResult.Method; + + static void Prefix(ref object __instance) + { + PropertyInfo useProp = __instance.GetType().GetRuntimeProperty("useAntiTamperHash"); + if (useProp == null) + { + UniversalPatchPlugin.Log.LogError("VideoTamperPatch prefix: useAntiTamperHash was not found!"); + return; + } + + useProp.SetValue(__instance, false); + } + + static void Postfix(ref object __instance) + { + PropertyInfo autoProp = __instance.GetType().GetRuntimeProperty("autoPlay"); + if (autoProp == null) + { + UniversalPatchPlugin.Log.LogError("VideoTamperPatch postfix: autoPlay was not found!"); + return; + } + + MethodInfo playMethod = __instance.GetType().GetMethod("Play"); + if (playMethod == null) + { + UniversalPatchPlugin.Log.LogError("VideoTamperPatch postfix: playMethod was not found!"); + return; + } + + if ((bool)autoProp.GetValue(__instance)) playMethod.Invoke(__instance, []); + } +} \ No newline at end of file diff --git a/asdf copy.json b/asdf copy.json new file mode 100644 index 0000000..f04e521 --- /dev/null +++ b/asdf copy.json @@ -0,0 +1,28 @@ +{ + "Accessibility": 2, + "AllowsJuniors": true, + "CloningAllowed": false, + "Description": "john madden", + "DisableMicAutoMute": true, + "Name": "splootyneam", + "ReleaseStatus": 2, + "ReplicationId": "fec8e7b3-660e-4df4-9c33-b40eb4093823", + "Scenes": [ + { + "CanMatchmakeInto": true, + "IsSandbox": true, + "MaxPlayers": 1, + "Name": "Home", + "ReleaseStatus": 2, + "ReplicationId": "1fdb87da-df23-4c96-a28b-4cb5fd3f7667", + "RoomSceneLocationId": "aafb38f1-beb9-4af3-94e3-2985d502302a", + "SupportsJoinInProgress": false, + "UseAgeBasedMatchmaking": false, + "UseLevelBasedMatchmaking": false, + "UseRecRoyaleMatchmaking": false + } + ], + "SupportsLevelVoting": false, + "SupportsTeleportVR": true, + "SupportsWalkVR": true +} \ No newline at end of file