VideoTamperPatch, configurable outside of the BepInEx config
This commit is contained in:
6
Core/Config/BaseOptionConfig.cs
Normal file
6
Core/Config/BaseOptionConfig.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace undead_universal_patch_il2cpp.Core.Config;
|
||||
|
||||
public class BaseOptionConfig
|
||||
{
|
||||
public bool Enabled { get; set; } = false;
|
||||
}
|
||||
@@ -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<T>
|
||||
{
|
||||
@@ -23,7 +23,8 @@ public class DediConfig<T>
|
||||
_options = options;
|
||||
}
|
||||
|
||||
private string GetAlways() {
|
||||
private string GetAlways()
|
||||
{
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
File.WriteAllText(path, _default);
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using undead_universal_patch_il2cpp.Core.Config;
|
||||
|
||||
namespace undead_universal_patch_il2cpp.Core.Content.UndeadGameManager;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using undead_universal_patch_il2cpp.Core.Config;
|
||||
|
||||
namespace undead_universal_patch_il2cpp.Core.Content.UndeadGameManager;
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
63
Patches/Video/VideoTamperPatch.cs
Normal file
63
Patches/Video/VideoTamperPatch.cs
Normal file
@@ -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<BaseOptionConfig> 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, []);
|
||||
}
|
||||
}
|
||||
28
asdf copy.json
Normal file
28
asdf copy.json
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user