This repository has been archived on 2026-05-30. You can view files and clone it, but cannot push or open issues or pull requests.
Files
undead-universal-patch-il2cpp/Plugin.cs
2025-03-30 15:38:03 -04:00

74 lines
4.7 KiB
C#

using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
namespace undead_universal_patch_il2cpp;
[BepInPlugin("dev.proxnet.recroom.universalpatch.noneac.il2cpp", "Undead Universal Patch", "1.2.0")]
public class Plugin : BasePlugin
{
public static new readonly ManualLogSource Log = Logger.CreateLogSource("UUPatch");
static Harmony _hi = new("dev.proxnet.recroom.universalpatch.noneac.il2cpp");
public override bool Unload()
{
Log.LogInfo("Destroying.");
_hi.UnpatchSelf();
return true;
}
public override void Load()
{
GenericConfig.LogAllRequests = Config.Bind("Generic", "LogAllRequests", GenericConfigDefaults.LogAllRequests,
"Log all HTTP 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.");
GenericConfig.AmplitudeRedirectPatch = Config.Bind("Generic", "AmplitudeRedirectPatch", GenericConfigDefaults.AmplitudeRedirectPatch,
"Redirect all Amplitude API requests to the nameserver on '/amplitude'.");
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)");
PhotonConfig.PatchPhotonIds = Config.Bind("Photon", "PatchPhotonIds", PhotonConfigDefaults.PatchPhotonIds,
"Enable/disable changing the target IDs in PhotonServerSettings." +
"\nCustom server settings are not yet supported.");
PhotonConfig.AppID = Config.Bind("Photon", "AppID", PhotonConfigDefaults.AppID,
"The new target (PUN) App ID from the Photon dashboard.");
PhotonConfig.VoiceAppID = Config.Bind("Photon", "VoiceAppID", PhotonConfigDefaults.VoiceAppID,
"The new target Voice App ID from the Photon dashboard.");
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." +
"\nDo not enable if you either don't know what this does.");
GalvanicConfig.RegenerateKeypair = Config.Bind("GalvanicCorrosion", "RegenerateKeypair", GalvanicConfigDefaults.RegenerateKeypair,
"Regenerate the keypair upon startup. DO NOT ENABLE IF YOU WANT TO KEEP YOUR ACCOUNT.");
GalvanicConfig.Export = Config.Bind("GalvanicCorrosion", "Export", GalvanicConfigDefaults.Export,
"Export the keypair to a plaintext file in the game directory. Set to 'IWantToExportMyKeys' to enable." +
"\n**DO NOT ENABLE IF YOU DO NOT KNOW WHAT THIS DOES.**" +
"\n**DO NOT ENABLE THIS IF SOMEONE UNTRUSTWORTHY TOLD YOU TO.**" +
"\n**THESE KEYS CONTAIN THE CREDENTIALS THAT GRANT ACCESS TO YOUR ACCOUNTS.**");
GalvanicConfig.Import = Config.Bind("GalvanicCorrosion", "Import", GalvanicConfigDefaults.Import,
"Import the Galvanic Authentication keys from a file." +
"\nBe sure to not enable this at the same time as `Export`, as that will cause the keys to" +
"\nbe unnecessarily written and read to and from the disk.");
_hi.PatchAll();
if (GalvanicConfig.RegenerateKeypair.Value)
{
Log.LogInfo("Regenerating keypair");
GalvanicAuth.PrepareKeys();
}
if (GalvanicConfig.Export.Value == "IWantToExportMyKeys") GalvanicAuth.Export();
if (GalvanicConfig.Import.Value) GalvanicAuth.Import();
if (GalvanicConfig.Enabled.Value) GalvanicWebAuth.GetToken();
}
}