backend refactor yay!!! 1.4.0

This commit is contained in:
2025-08-09 04:46:40 -04:00
parent 8d1bac8201
commit 808da23afa
21 changed files with 616 additions and 77 deletions

View File

@@ -1,12 +1,16 @@
using System;
using System.Text.Json;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using undead_universal_patch_il2cpp.Core;
using undead_universal_patch_il2cpp.Core.AssetChanges;
using undead_universal_patch_il2cpp.Core.UndeadGameManager;
namespace undead_universal_patch_il2cpp;
[BepInPlugin("dev.proxnet.recroom.universalpatch.noneac.il2cpp", "Undead Universal Patch", "1.3.0")]
[BepInPlugin("dev.proxnet.recroom.universalpatch.noneac.il2cpp", "Undead Universal Patch", "1.4.0")]
public class Plugin : BasePlugin
{
public static new readonly ManualLogSource Log = Logger.CreateLogSource("UUPatch");
@@ -24,20 +28,32 @@ public class Plugin : BasePlugin
{
Util.LocalInstanceGuid = Guid.NewGuid().ToString();
Log.LogInfo("It's time to Room some Rec and chew bubble gum, and I'm all out of gum");
Log.LogInfo("It's time to Room some Rec and chew bubble gum..... and I'm all out of gum");
GenericConfig.PatchDebug = Config.Bind("Generic", "PatchDebug", GenericConfigDefaults.PatchDebug,
"Enable logging messages sent by patches for debugging. Usually not needed. Enable when submitting issues or bug reports.");
GenericConfig.LogAllRequests = Config.Bind("Generic", "LogAllRequests", GenericConfigDefaults.LogAllRequests,
"Log all HTTP requests sent by the game.");
"Log all BestHTTP requests sent by the game.");
GenericConfig.CertificatePatch = Config.Bind("Generic", "CertificatePatch", GenericConfigDefaults.CertificatePatch,
"The game expects a certain certificate from rec.net when making HTTPS requests. Enable this to allow any valid certificate.");
GenericConfig.HilePatch = Config.Bind("Generic", "HilePatch", GenericConfigDefaults.HilePatch,
"The game will close after a short period of time if BepInEx is found. Enable to stop this from happening.");
"The game will close after a short period of time if BepInEx is found. Enable to stop this from happening." +
"This will also enable the AGRoomRuntimeConfig patch. See the README for more info.");
GenericConfig.SignalRHandshakeFix = Config.Bind("Generic", "SignalRHandshakeFix", GenericConfigDefaults.SignalRHandshakeFix,
"Replace apostrophes with quotes in the initial SignalR handshake.");
GenericConfig.ImageSignaturePatch = Config.Bind("Generic", "ImageSignaturePatch", GenericConfigDefaults.ImageSignaturePatch,
"When enabled, all image signatures will be valid." +
"\nWorks only if the server appends a properly formatted signature header (signature does not need to be valid)");
GenericConfig
GenericConfig.RegistrationPatch = Config.Bind("Generic", "RegistrationPatch", GenericConfigDefaults.RegistrationPatch,
"Always disable the registration prompt.");
AssetChangesConfig.AGRoomChanges = Config.Bind("AssetChangesConfig", "AGRoomChanges", AssetChangesConfigDefaults.AGRoomChanges,
$"Use patches from '{AGRoomChanges.config.path}' to change the properties of internal AGRooms. See README.md");
GameManagerConfig.AnyGameFreeSpawn = Config.Bind("GameManagerConfig", "AnyGameFreeSpawn", GameManagerConfigDefaults.AnyGameFreeSpawn,
$"Use patches from '{GameFreeSpawns.config.path}' to spawn in any valid player spawnpoint in specified games. See README.md");
GameManagerConfig.StaticGameTeamConfig = Config.Bind("GameManagerConfig", "StaticGameTeamConfig", GameManagerConfigDefaults.StaticGameTeamConfig,
$"Use patches from '{TeamConfigurator.config.path}' to set the static configuration of teams in specified games. See README.md");
PhotonConfig.PatchPhotonIds = Config.Bind("Photon", "PatchPhotonIds", PhotonConfigDefaults.PatchPhotonIds,
"Patch Photon configuration.");
PhotonConfig.PunLogging = Config.Bind("Photon", "PunLogging", PhotonConfigDefaults.PunLogging,
@@ -55,10 +71,12 @@ public class Plugin : BasePlugin
"Address of the Photon master server (ignored if not using self-hosted)");
PhotonConfig.ServerPort = Config.Bind("Photon", "ServerPort", PhotonConfigDefaults.ServerPort,
"Photon master server UDP port (ignored if not using self-hosted)");
NameserverConfig.Rewrite = Config.Bind("Nameserver", "Rewrite", NameserverConfigDefaults.Rewrite,
"Enable/disable rewriting the URL for nameserver requests.");
NameserverConfig.NewUrl = Config.Bind("Nameserver", "NewUrl", NameserverConfigDefaults.NewUrl,
"The new full URL to use when sending a nameserver request.");
GalvanicConfig.Enabled = Config.Bind("GalvanicCorrosion", "Enabled", GalvanicConfigDefaults.Enabled,
"Use Galvanic Corrosion features. Authenticates with a GC server." +
"\nThe host and protocol in Nameserver.NewUrl will be used for the server's base URL." +
@@ -76,15 +94,35 @@ public class Plugin : BasePlugin
"\nbe unnecessarily written and read to and from the disk.");
_hi.PatchAll();
if (GalvanicConfig.RegenerateKeypair.Value)
if (GalvanicConfig.Enabled.Value && GalvanicConfig.RegenerateKeypair.Value)
{
Log.LogInfo("Regenerating keypair");
Galvanic.GalvanicAuth.PrepareKeys();
GalvanicAuth.PrepareKeys();
}
if (GalvanicConfig.Export.Value == "IWantToExportMyKeys") Galvanic.GalvanicAuth.Export();
if (GalvanicConfig.Import.Value) Galvanic.GalvanicAuth.Import();
if (GalvanicConfig.Enabled.Value) Galvanic.GalvanicWebAuth.GetToken();
if (GalvanicConfig.Enabled.Value && GalvanicConfig.Export.Value == "IWantToExportMyKeys") GalvanicAuth.Export();
if (GalvanicConfig.Enabled.Value && GalvanicConfig.Import.Value) GalvanicAuth.Import();
if (GalvanicConfig.Enabled.Value) GalvanicWebAuth.GetToken();
Log.LogInfo("PATCH LIST START =========================");
foreach (var method in _hi.GetPatchedMethods()) Log.LogInfo($"- {method.ToString()}");
Log.LogInfo("PATCH LIST END =========================");
Log.LogInfo("Undead Universal IL2CPP Patch for Rec Room by @zombieb; loaded.");
try
{
CacheChangePatchConfigs();
}
catch (Exception ex)
{
Log.LogError($"Could not load change patches: {ex}");
}
}
private static void CacheChangePatchConfigs()
{
if (AssetChangesConfig.AGRoomChanges.Value) AGRoomChanges.config.Get();
if (GameManagerConfig.AnyGameFreeSpawn.Value) GameFreeSpawns.config.Get();
if (GameManagerConfig.StaticGameTeamConfig.Value) TeamConfigurator.config.Get();
}
}