diff --git a/LICENSE b/LICENSE
index 41b0998..cf30809 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2024 proxnet.dev
+Copyright (c) 2025 proxnet.dev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/Patches/BestHTTP.cs b/Patches/BestHTTP.cs
index fd91db6..2b74390 100644
--- a/Patches/BestHTTP.cs
+++ b/Patches/BestHTTP.cs
@@ -54,8 +54,6 @@
return false;
}
- if (uriInstance.Host.Contains("api.amplitude.com") && GenericConfig.DisableAmplitude.Value) return false;
-
if (GenericConfig.LogAllRequests.Value) Plugin.Log.LogInfo($"BestHTTP_MonoOne request (Before) URL: {uriInstance.ToString()}");
Uri newUri;
@@ -117,9 +115,6 @@
return false;
}
- // TODO: Not the most elegant way to patch out amplitude - find a better way
- if (uriInstance.Host.Contains("api.amplitude.com") && GenericConfig.DisableAmplitude.Value) return false;
-
if (GenericConfig.LogAllRequests.Value) Plugin.Log.LogInfo($"BestHTTP_MonoTwo request (Before) URL: {uriInstance.ToString()}");
Uri newUri;
diff --git a/Patches/Photon.cs b/Patches/Photon.cs
index 860749d..0b11b60 100644
--- a/Patches/Photon.cs
+++ b/Patches/Photon.cs
@@ -16,7 +16,7 @@
Type hostingOptionType = AccessTools.Inner(serverSettingsType, "HostingOption");
if (serverSettingsType == null)
{
- Plugin.Log.LogFatal("Photon patch failed early, this Photon client is unsupported!");
+ Plugin.Log.LogFatal("Photon patch failed early (ServerSettings), this Photon client is unsupported!");
return null;
}
@@ -30,7 +30,7 @@
}
if (hostingOptionType == null)
{
- Plugin.Log.LogFatal("Photon patch failed early, this Photon client (HostingOption) is unsupported!");
+ Plugin.Log.LogFatal("Photon patch failed early (HostingOption), this Photon client is unsupported!");
return null;
}
ScriptableObject settingsInstance = ScriptableObject.CreateInstance(serverSettingsType);
@@ -84,7 +84,7 @@
Type photonNetworkType = AccessTools.TypeByName("PhotonNetwork");
if (photonNetworkType == null)
{
- string[] possibleTypeNames = ["GEFAIHCLLBI", "IHFKMIAHBFP", "DAHGDBPKKAJ"];
+ string[] possibleTypeNames = ["GEFAIHCLLBI", "IHFKMIAHBFP", "DAHGDBPKKAJ", "OLBGNNAHMHG"];
foreach (string possibleTypeName in possibleTypeNames)
{
photonNetworkType = AccessTools.TypeByName(possibleTypeName);
@@ -100,7 +100,7 @@
FieldInfo photonServerSettingsField = photonNetworkType.GetField("PhotonServerSettings");
if (photonServerSettingsField == null)
{
- string[] possibleTypeNames = ["OCOJPLFBNOG", "PBKGCAGGOLJ", "FJHKNHIIABD"];
+ string[] possibleTypeNames = ["OCOJPLFBNOG", "PBKGCAGGOLJ", "FJHKNHIIABD", "HDEOHIIBAEP"];
foreach (string possibleTypeName in possibleTypeNames)
{
photonServerSettingsField = photonNetworkType.GetField(possibleTypeName);
diff --git a/Patches/Resource.cs b/Patches/Resource.cs
index 3f29304..9a55605 100644
--- a/Patches/Resource.cs
+++ b/Patches/Resource.cs
@@ -7,11 +7,18 @@
class Resource
{
static bool Ran = false;
+ [HarmonyPrepare]
+ static bool Prepare()
+ {
+ // Improves performance over the previous version
+ // This is actually untested. (The performance claim and this Prepare method.)
+ return PhotonConfig.PatchPhotonIds.Value && PhotonConfig.PatchEvent.Value == "Load";
+ }
[HarmonyPostfix]
static void Postfix(ref string path, ref object __result)
{
- //Plugin.Log.LogInfo($"Resource loading '{path}'");
- if (path.Contains("PhotonServerSettings") && PhotonConfig.PatchPhotonIds.Value && PhotonConfig.PatchEvent.Value == "Load")
+ //Plugin.Log.LogInfo($"Resource loading '{path}'"); // uncomment to log every loaded resource
+ if (path.Contains("PhotonServerSettings"))
{
if (Ran) return; // Photon.Patch calls Resources.Load, which may result in a loop if not handled properly
Ran = true;
diff --git a/Patches/UWRPatch-Str-Str-Rx-Tx.cs b/Patches/UWRPatch-Str-Str-Rx-Tx.cs
index a009262..634a374 100644
--- a/Patches/UWRPatch-Str-Str-Rx-Tx.cs
+++ b/Patches/UWRPatch-Str-Str-Rx-Tx.cs
@@ -25,15 +25,6 @@
return AccessTools.Constructor(targetType, [ typeof(string), typeof(string), rxType, txType ]);
}
- [HarmonyPrefix]
- public static bool Prefix(ref string url)
- {
- // TODO: This is duplicated across all UWR patch files, reduce boilerplate
- // TODO: This is not the most elegant way to patch out amplitude - find a better fix
- if (url.Contains("api.amplitude.com") && GenericConfig.DisableAmplitude.Value) return false;
- else return true;
- }
-
[HarmonyPostfix]
static void Postfix(object __instance) => UWRPatchNoArg.InPostfix(__instance, UWRParams);
}
diff --git a/Patches/UWRPatch-Str-Str.cs b/Patches/UWRPatch-Str-Str.cs
index 69a7446..f3e2442 100644
--- a/Patches/UWRPatch-Str-Str.cs
+++ b/Patches/UWRPatch-Str-Str.cs
@@ -22,15 +22,6 @@
return AccessTools.Constructor(targetType, [ typeof(string), typeof(string) ]);
}
- [HarmonyPrefix]
- public static bool Prefix(ref string url)
- {
- // TODO: This is duplicated across all UWR patch files, reduce boilerplate
- // TODO: This is not the most elegant way to patch out amplitude - find a better fix
- if (url.Contains("api.amplitude.com") && GenericConfig.DisableAmplitude.Value) return false;
- else return true;
- }
-
[HarmonyPostfix]
static void Postfix(object __instance) => UWRPatchNoArg.InPostfix(__instance, UWRParams);
}
diff --git a/Patches/UWRPatch-Str.cs b/Patches/UWRPatch-Str.cs
index b6ad4d3..8561c57 100644
--- a/Patches/UWRPatch-Str.cs
+++ b/Patches/UWRPatch-Str.cs
@@ -22,15 +22,6 @@
return AccessTools.Constructor(targetType, [ typeof(string) ]);
}
- [HarmonyPrefix]
- public static bool Prefix(ref string url)
- {
- // TODO: This is duplicated across all UWR patch files, reduce boilerplate
- // TODO: This is not the most elegant way to patch out amplitude - find a better fix
- if (url.Contains("api.amplitude.com") && GenericConfig.DisableAmplitude.Value) return false;
- else return true;
- }
-
[HarmonyPostfix]
static void Postfix(object __instance) => UWRPatchNoArg.InPostfix(__instance, UWRParams);
}
diff --git a/Plugin.cs b/Plugin.cs
index 878716c..1d3226c 100644
--- a/Plugin.cs
+++ b/Plugin.cs
@@ -10,12 +10,12 @@
{
public static readonly ManualLogSource Log = BepInEx.Logging.Logger.CreateLogSource("UUPatch");
- Harmony _hi = new("dev.proxnet.recroom.universalpatch.noneac.mono");
+ Harmony _harmonyInstance = new("dev.proxnet.recroom.universalpatch.noneac.mono");
private void OnDestroy()
{
Log.LogInfo("Destroying.");
- _hi.UnpatchSelf();
+ _harmonyInstance.UnpatchSelf();
}
private void Awake()
@@ -32,13 +32,13 @@
"\nExamples include 'server.example.com', 'test.example.com:3939', and '127.0.2.5:19502'." +
"\nUsed by legacy MoTD patch as well as the gameserver patch.");
GameserverConfig.UseSocketHost = Config.Bind("Gameserver", "UseSocketHost", GameserverConfigDefaults.UseSocketHost,
- "Flag that controls the usage of SocketHost and SecureSocketProtocol." +
- "\nWhen enabled, the WebSocket URL will be modified to use the SocketHost and" +
+ "Flag that controls the usage of SecureSocketProtocol and SocketHost." +
+ "\nWhen enabled, the WebSocket URL will be modified to use the SocketHost with" +
"\nthe appropriate protocol ('wss' or 'ws')." +
"\nWhen disabled, the WebSocket URL will use the same host and secure status as the web server." +
- "\nPaths are completely unchanged.");
+ "\nEndpoints are completely unchanged.");
GameserverConfig.SecureSocketProtocol = Config.Bind("Gameserver", "SecureSocketProtocol", GameserverConfigDefaults.SecureSocketProtocol,
- "The secure protocol status to use ('wss' or 'ws').");
+ "The secure protocol status to use ('wss' for true or 'ws' for false).");
GameserverConfig.SocketHost = Config.Bind("Gameserver", "SocketHost", GameserverConfigDefaults.SocketHost,
"The WebSocket host to use.");
GenericConfig.DisableAmplitude = Config.Bind("Generic", "DisableAmplitude", GenericConfigDefaults.DisableAmplitude,
@@ -49,8 +49,7 @@
"\nYou can prevent the game from sending analytics with this bool." +
"\nThe WWW rewrite patch must validate for this to work.");
/*GenericConfig.UnhideEditorRooms = Config.Bind("Generic", "UnhideEditorRooms", GenericConfigDefaults.UnhideEditorRooms,
- "Some rooms may have the flag 'IsEditorOnly' set, which prevents you from switching to that room." +
- "\nUse this flag to always set this value to 'false', allowing you to switch to any internal activity.");*/
+ "Allow you to switch to any internal activity.");*/
GenericConfig.IsNameserver = Config.Bind("Generic", "IsNameserver", GenericConfigDefaults.IsNameserver, "" +
"Enable if you use a nameserver. This will disable URL rewriting for all WebSocket, WWW, and UWR patches.");
GenericConfig.LogAllRequests = Config.Bind("Generic", "LogAllRequests", GenericConfigDefaults.LogAllRequests,
@@ -90,12 +89,13 @@
Log.LogInfo("Finding appropriate patches ...");
// Run all applicable patches
- _hi.PatchAll();
- Log.LogInfo("PATCH LIST START ===========");
- foreach (var method in _hi.GetPatchedMethods()) Log.LogInfo($"- {method.ToString()}");
- Log.LogInfo("PATCH LIST END ===========");
+ _harmonyInstance.PatchAll();
+ Log.LogInfo("PATCH LIST START =========================");
+ foreach (var method in _harmonyInstance.GetPatchedMethods()) Log.LogInfo($"- {method.ToString()}");
+ Log.LogInfo("PATCH LIST END =========================");
//GenericUtils.PrintAllNamespaces();
if (PhotonConfig.PatchEvent.Value == "Awake" && PhotonConfig.PatchPhotonIds.Value) Patches.Photon.Patch();
+
}
}
diff --git a/Utils.cs b/Utils.cs
index 8d89791..ab00051 100644
--- a/Utils.cs
+++ b/Utils.cs
@@ -20,13 +20,11 @@
public static string GetGameserverBaseUrl()
{
- string protocol = GetGameserverProtocol();
- return $"{protocol}://{GameserverConfig.Host.Value}";
+ return $"{GetGameserverProtocol()}://{GameserverConfig.Host.Value}";
}
public static string GetGameserverSocketBaseUrl()
{
- string protocol = GameserverConfig.SecureProtocol.Value ? "wss" : "ws";
- if (GameserverConfig.UseSocketHost.Value) return $"{protocol}://{GameserverConfig.SocketHost.Value}";
+ if (GameserverConfig.UseSocketHost.Value) return $"{GetGameserverSocketProtocol()}://{GameserverConfig.SocketHost.Value}";
else return $"{GetGameserverProtocol()}://${GameserverConfig.Host.Value}";
}
public static string GetNameserverProtocol()
diff --git a/undead-universal-patch-mono.csproj b/undead-universal-patch-mono.csproj
index c8acab1..ef92f60 100644
--- a/undead-universal-patch-mono.csproj
+++ b/undead-universal-patch-mono.csproj
@@ -4,7 +4,7 @@
net35
undead_universal_patch_mono
Non-EAC, Mono build patcher for Rec Room (*2016*-*Dec-2018)
- 1.0.0
+ 1.0.2
true
latest