diff --git a/LethalPerformance/LethalPerformance.csproj b/LethalPerformance/LethalPerformance.csproj
index 82b6c30..d26768b 100644
--- a/LethalPerformance/LethalPerformance.csproj
+++ b/LethalPerformance/LethalPerformance.csproj
@@ -20,8 +20,10 @@
+
+
@@ -29,6 +31,14 @@
+
+
+
+ Unity\%(Filename)%(Extension)
+
+
+
+
diff --git a/LethalPerformance/LethalPerformancePlugin.cs b/LethalPerformance/LethalPerformancePlugin.cs
index b7502b6..0c9bac3 100644
--- a/LethalPerformance/LethalPerformancePlugin.cs
+++ b/LethalPerformance/LethalPerformancePlugin.cs
@@ -7,6 +7,10 @@
using HarmonyLib;
using Unity.Burst;
using Unity.Burst.LowLevel;
+using Unity.Collections;
+using Unity.Mathematics;
+using Unity.Netcode;
+using UnityEngine;
namespace LethalPerformance;
@@ -20,16 +24,16 @@ public class LethalPerformancePlugin : BaseUnityPlugin
private Harmony? m_Harmony;
- private void Awake()
+ private unsafe void Awake()
{
Instance = this;
Logger = base.Logger;
WorkingDirectory = new FileInfo(Info.Location).DirectoryName;
- /*m_Harmony = new Harmony(MyPluginInfo.PLUGIN_GUID);
- m_Harmony.PatchAll(typeof(LethalPerformancePlugin).Assembly);*/
-
LoadGameBurstLib();
+
+ m_Harmony = new Harmony(MyPluginInfo.PLUGIN_GUID);
+ m_Harmony.PatchAll(typeof(LethalPerformancePlugin).Assembly);
}
private void LoadGameBurstLib()
diff --git a/LethalPerformance/Patches/Patch_HDCamera.cs b/LethalPerformance/Patches/Patch_HDCamera.cs
new file mode 100644
index 0000000..16db543
--- /dev/null
+++ b/LethalPerformance/Patches/Patch_HDCamera.cs
@@ -0,0 +1,22 @@
+using HarmonyLib;
+using Unity.Burst;
+using UnityEngine.Rendering.HighDefinition;
+
+namespace LethalPerformance.Patches;
+[HarmonyPatch(typeof(HDCamera), nameof(HDCamera.UpdateShaderVariablesXRCB))]
+internal static unsafe class Patch_HDCamera
+{
+ public static readonly Testing.TestDelegate s_TestDelegate = BurstCompiler.CompileFunctionPointer(Testing.Test).Invoke;
+
+ [HarmonyPrefix]
+ public static unsafe bool Prefix(HDCamera __instance, ref ShaderVariablesXR cb)
+ {
+ fixed (void* p = &cb, views = __instance.m_XRViewConstants)
+ {
+ s_TestDelegate((Testing.ReadableViewConstants*)views, __instance.viewCount, (Testing.ReadableShaderVariablesXR*)p);
+
+ cb = *(ShaderVariablesXR*)p;
+ return false;
+ }
+ }
+}
diff --git a/LethalPerformance/Unity/.gitinclude b/LethalPerformance/Unity/.gitinclude
new file mode 100644
index 0000000..e69de29