@@ -21,20 +21,21 @@ public class Plugin : BaseUnityPlugin
2121 public const string PLUGIN_GUID = "io.daxcess.repoxr" ;
2222 public const string PLUGIN_NAME = "RepoXR" ;
2323 public const string PLUGIN_VERSION = "1.1.0" ;
24-
25- #if DEBUG
24+
25+ #if DEBUG
2626 private const string SKIP_CHECKSUM_VAR = $ "--repoxr-skip-checksum={ PLUGIN_VERSION } -dev";
27- #else
27+ #else
2828 private const string SKIP_CHECKSUM_VAR = $ "--repoxr-skip-checksum={ PLUGIN_VERSION } ";
29- #endif
29+ #endif
3030
31- private const string HASHES_OVERRIDE_URL = "https://gist.githubusercontent.com/DaXcess/033e8ff514c505d2372e6f55a412dc00/raw/RepoXR%2520Game%2520Hashes" ;
31+ private const string HASHES_OVERRIDE_URL =
32+ "https://gist.githubusercontent.com/DaXcess/033e8ff514c505d2372e6f55a412dc00/raw/RepoXR%2520Game%2520Hashes" ;
3233
3334 private readonly string [ ] GAME_ASSEMBLY_HASHES =
3435 [
3536 "137D6E8475DEA976831CC95D7F56F4B7DA311E52A57B4C420591A5122F25589F" // v0.3.0
3637 ] ;
37-
38+
3839 public new static Config Config { get ; private set ; } = null ! ;
3940 public static Flags Flags { get ; private set ; } = 0 ;
4041
@@ -105,14 +106,17 @@ private void Awake()
105106 }
106107#endif
107108
109+ if ( Environment . GetCommandLineArgs ( ) . Contains ( "--repoxr-debug-eyetracking" , StringComparer . OrdinalIgnoreCase ) )
110+ Flags |= Flags . EyeTrackingDebug ;
111+
108112 Native . BringGameWindowToFront ( ) ;
109113 Config . SetupGlobalCallbacks ( ) ;
110114
111115 SceneManager . sceneLoaded += ( scene , _ ) => UniversalEntrypoint . OnSceneLoad ( scene . name ) ;
112116 }
113117
114118 public static string GetCommitHash ( )
115- {
119+ {
116120 try
117121 {
118122 var attribute = Assembly . GetExecutingAssembly ( ) . GetCustomAttribute < AssemblyInformationalVersionAttribute > ( ) ;
@@ -131,17 +135,17 @@ private bool VerifyGameVersion()
131135 {
132136 var location = Path . Combine ( Paths . ManagedPath , "Assembly-CSharp.dll" ) ;
133137 var hash = BitConverter . ToString ( Utils . ComputeHash ( File . ReadAllBytes ( location ) ) ) . Replace ( "-" , "" ) ;
134-
138+
135139 // Attempt local lookup first
136140 if ( GAME_ASSEMBLY_HASHES . Contains ( hash ) )
137141 {
138142 Logger . LogInfo ( "Game version verified using local hashes" ) ;
139143
140144 return true ;
141145 }
142-
146+
143147 Logger . LogWarning ( "Failed to verify game version using local hashes, checking remotely for updated hashes..." ) ;
144-
148+
145149 // Attempt to fetch a gist with known working assembly hashes
146150 // This allows me to keep RepoXR up and running if the game updates, without having to push an update out
147151 try
@@ -150,7 +154,7 @@ private bool VerifyGameVersion()
150154 var hashes = Utils . ParseConfig ( contents ) ;
151155
152156 var found = false ;
153-
157+
154158 foreach ( var versionedHash in hashes )
155159 {
156160 try
@@ -206,8 +210,9 @@ private bool PreloadRuntimeDependencies()
206210 }
207211 catch ( Exception ex )
208212 {
209- Logger . LogError ( $ "Unexpected error occured while preloading runtime dependencies (incorrect folder structure?): { ex . Message } ") ;
210-
213+ Logger . LogError (
214+ $ "Unexpected error occured while preloading runtime dependencies (incorrect folder structure?): { ex . Message } ") ;
215+
211216 return false ;
212217 }
213218
@@ -231,7 +236,7 @@ public static void ToggleVR()
231236 Flags |= Flags . VR ;
232237 }
233238 }
234-
239+
235240 private static bool InitializeVR ( )
236241 {
237242 RepoXR . Logger . LogInfo ( "Loading VR..." ) ;
@@ -245,21 +250,23 @@ private static bool InitializeVR()
245250
246251 return false ;
247252 }
248-
249- if ( OpenXR . GetActiveRuntimeName ( out var name ) && OpenXR . GetActiveRuntimeVersion ( out var major , out var minor , out var patch ) )
253+
254+ if ( OpenXR . GetActiveRuntimeName ( out var name ) &&
255+ OpenXR . GetActiveRuntimeVersion ( out var major , out var minor , out var patch ) )
250256 RepoXR . Logger . LogInfo ( $ "OpenXR runtime being used: { name } ({ major } .{ minor } .{ patch } )") ;
251257 else
252258 RepoXR . Logger . LogError ( "Could not get OpenXR runtime info?" ) ;
253259
254260 HarmonyPatcher . PatchVR ( ) ;
255-
261+
256262 RepoXR . Logger . LogDebug ( "Inserted VR patches using Harmony" ) ;
257-
263+
258264 // Change render pipeline settings if needed
259265 XRSettings . eyeTextureResolutionScale = Config . CameraResolution . Value / 100f ;
260-
266+
261267 // Input settings
262- InputSystem . settings . backgroundBehavior = InputSettings . BackgroundBehavior . IgnoreFocus ; // Prevent VR from getting disabled when losing focus
268+ InputSystem . settings . backgroundBehavior =
269+ InputSettings . BackgroundBehavior . IgnoreFocus ; // Prevent VR from getting disabled when losing focus
263270
264271 return true ;
265272 }
@@ -276,5 +283,6 @@ public static MethodInfo GetConfigGetter()
276283public enum Flags
277284{
278285 VR = 1 << 0 ,
279- StartupFailed = 1 << 1
286+ StartupFailed = 1 << 1 ,
287+ EyeTrackingDebug = 1 << 2
280288}
0 commit comments