mirror of
https://github.com/djdevin/recnet-plugin.git
synced 2026-09-08 06:31:29 -07:00
stupid dumb photon patch
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using ExitGames.Client.Photon;
|
||||
using HarmonyLib;
|
||||
using Photon.Realtime;
|
||||
|
||||
namespace CannedNet.Client.Patches;
|
||||
|
||||
[HarmonyPatch]
|
||||
public class Photon_AppSettings_Patch
|
||||
{
|
||||
private static bool Prepare()
|
||||
{
|
||||
var type = Type.GetType("PUNNetworkManager");
|
||||
if (type == null)
|
||||
{
|
||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
type = asm.GetType("PUNNetworkManager");
|
||||
if (type != null) break;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
Plugin.Log.LogError("Could not find PUNNetworkManager type");
|
||||
return false;
|
||||
}
|
||||
|
||||
var method = type.GetMethod("FJOLIPKKIBE", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
|
||||
if (method == null)
|
||||
{
|
||||
Plugin.Log.LogError("Could not find FJOLIPKKIBE method");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static MethodBase TargetMethod()
|
||||
{
|
||||
var type = Type.GetType("PUNNetworkManager");
|
||||
if (type == null)
|
||||
{
|
||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
type = asm.GetType("PUNNetworkManager");
|
||||
if (type != null) break;
|
||||
}
|
||||
}
|
||||
|
||||
return type?.GetMethod("FJOLIPKKIBE", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);
|
||||
}
|
||||
|
||||
private static void Postfix(ref AppSettings __result)
|
||||
{
|
||||
Plugin.Log.LogInfo("okay im patching now");
|
||||
__result = new()
|
||||
{
|
||||
AppVersion = __result?.AppVersion,
|
||||
AppIdRealtime = "c74d22b7-6665-41cf-9ce8-fc70b625caa6",
|
||||
AppIdVoice = "f7adbf03-edae-4a7d-bb4b-9e06de75bd96",
|
||||
AppIdChat = "4538ca46-903b-48d9-bf33-247ea468a29d",
|
||||
FixedRegion = "us",
|
||||
UseNameServer = true,
|
||||
Protocol = ConnectionProtocol.Udp,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using BepInEx;
|
||||
using BepInEx;
|
||||
using BepInEx.Logging;
|
||||
using BepInEx.Unity.IL2CPP;
|
||||
using HarmonyLib;
|
||||
@@ -8,13 +8,18 @@ namespace CannedNet.Client;
|
||||
[BepInPlugin("lapis.cannednet.client", "CannedNet Client", "1.0.0")]
|
||||
public class Plugin : BasePlugin
|
||||
{
|
||||
private const string PhotonDataUrl = "https://ns.lapis.codes/photon";
|
||||
|
||||
internal static new ManualLogSource Log;
|
||||
|
||||
public static string appIdRT;
|
||||
public static string appIdVoice;
|
||||
public static string appIdChat;
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
Log = base.Log;
|
||||
Log.LogInfo($"I JUST HIT THE JACKPOTTTT!!!!! YUH YUH YUH!");
|
||||
|
||||
Harmony.CreateAndPatchAll(typeof(Plugin).Assembly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user