mirror of
https://github.com/CannedNet/CannedNet.Client.git
synced 2026-10-25 23:18:55 -07:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a8fa38780 | |||
| e54e87595e | |||
| 96e9e6e54f | |||
| d475cffdeb | |||
| 86fa174aaf | |||
| d28a296f67 | |||
| bd5732509f | |||
| 7379bc14a4 |
@@ -0,0 +1,23 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using Org.BouncyCastle.Crypto.Tls;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CannedNet.Client.Patches
|
||||||
|
{
|
||||||
|
internal class ImageFix
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(OHDHPENHDAP), "DHEFMCDHLCG")]
|
||||||
|
internal class ImageSigPatch
|
||||||
|
{
|
||||||
|
// if i miss this jumpshot ill kill myself
|
||||||
|
private static void Postfix(ref bool __result)
|
||||||
|
{
|
||||||
|
__result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,9 @@ using System;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using ExitGames.Client.Photon;
|
using ExitGames.Client.Photon;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using Photon.Pun;
|
||||||
using Photon.Realtime;
|
using Photon.Realtime;
|
||||||
|
using Photon.Voice.PUN;
|
||||||
|
|
||||||
namespace CannedNet.Client.Patches;
|
namespace CannedNet.Client.Patches;
|
||||||
|
|
||||||
@@ -55,6 +57,8 @@ public class Photon_AppSettings_Patch
|
|||||||
private static void Postfix(ref AppSettings __result)
|
private static void Postfix(ref AppSettings __result)
|
||||||
{
|
{
|
||||||
Plugin.Log.LogInfo("okay im patching now");
|
Plugin.Log.LogInfo("okay im patching now");
|
||||||
|
if (Plugin.EnableAdvancedSettings.Value)
|
||||||
|
{
|
||||||
__result = new()
|
__result = new()
|
||||||
{
|
{
|
||||||
AppVersion = __result?.AppVersion,
|
AppVersion = __result?.AppVersion,
|
||||||
@@ -64,6 +68,21 @@ public class Photon_AppSettings_Patch
|
|||||||
FixedRegion = "us",
|
FixedRegion = "us",
|
||||||
UseNameServer = true,
|
UseNameServer = true,
|
||||||
Protocol = ConnectionProtocol.Udp,
|
Protocol = ConnectionProtocol.Udp,
|
||||||
|
Server = Plugin.PhotonHostname.Value
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
__result = new()
|
||||||
|
{
|
||||||
|
AppVersion = __result?.AppVersion,
|
||||||
|
AppIdRealtime = Plugin.AppIdRT.Value,
|
||||||
|
AppIdVoice = Plugin.AppIdVoice.Value,
|
||||||
|
AppIdChat = Plugin.AppIdChat.Value,
|
||||||
|
FixedRegion = "us",
|
||||||
|
UseNameServer = true,
|
||||||
|
Protocol = ConnectionProtocol.Udp
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace CannedNet.Client.Patches;
|
||||||
|
|
||||||
|
[HarmonyPatch(typeof(RecRoomGameRoot))]
|
||||||
|
static class RecRoomGameRootPatch
|
||||||
|
{
|
||||||
|
[HarmonyPatch(nameof(RecRoomGameRoot.Awake))]
|
||||||
|
static void Postfix()
|
||||||
|
{
|
||||||
|
if (GameObject.Find("CannedNetRoot")) return;
|
||||||
|
GameObject modRoot = new GameObject("CannedNetRoot");
|
||||||
|
GameObject.DontDestroyOnLoad(modRoot);
|
||||||
|
modRoot.AddComponent<PhotonVoiceAuth>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using Photon.Pun;
|
||||||
|
using Photon.Voice.PUN;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace CannedNet.Client;
|
||||||
|
|
||||||
|
public class PhotonVoiceAuth : MonoBehaviour
|
||||||
|
{
|
||||||
|
public PhotonVoiceAuth(IntPtr handle) : base(handle)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool authValuesSet = false;
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
if (Plugin.EnableAdvancedSettings.Value)
|
||||||
|
{
|
||||||
|
var realtimeAuth = PhotonNetwork.AuthValues;
|
||||||
|
|
||||||
|
if (realtimeAuth != null)
|
||||||
|
{
|
||||||
|
if (authValuesSet)
|
||||||
|
return;
|
||||||
|
|
||||||
|
PhotonVoiceNetwork.Instance.Client.AuthValues = realtimeAuth;
|
||||||
|
authValuesSet = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!authValuesSet)
|
||||||
|
return;
|
||||||
|
|
||||||
|
authValuesSet = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using BepInEx;
|
using BepInEx;
|
||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
@@ -7,6 +10,8 @@ using BepInEx.Logging;
|
|||||||
using BepInEx.Unity.IL2CPP;
|
using BepInEx.Unity.IL2CPP;
|
||||||
using BepInEx.Unity.IL2CPP.Utils.Collections;
|
using BepInEx.Unity.IL2CPP.Utils.Collections;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using Il2CppInterop.Runtime.Injection;
|
||||||
|
using Photon.Voice.PUN;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
@@ -23,6 +28,9 @@ public class Plugin : BasePlugin
|
|||||||
public static ConfigEntry<string> AppIdVoice { get; private set; }
|
public static ConfigEntry<string> AppIdVoice { get; private set; }
|
||||||
public static ConfigEntry<string> AppIdChat { get; private set; }
|
public static ConfigEntry<string> AppIdChat { get; private set; }
|
||||||
public static ConfigEntry<string> ServerHostname { get; private set; }
|
public static ConfigEntry<string> ServerHostname { get; private set; }
|
||||||
|
public static ConfigEntry<bool> EnableAdvancedSettings { get; private set; }
|
||||||
|
public static ConfigEntry<string> PhotonHostname { get; private set; }
|
||||||
|
public static ConfigEntry<int> PhotonPort { get; private set; }
|
||||||
|
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
@@ -31,10 +39,27 @@ public class Plugin : BasePlugin
|
|||||||
AppIdRT = Config.Bind("Photon", "App Id Realtime", "", "Photon Realtime App ID");
|
AppIdRT = Config.Bind("Photon", "App Id Realtime", "", "Photon Realtime App ID");
|
||||||
AppIdVoice = Config.Bind("Photon", "App Id Voice", "", "Photon Voice App ID");
|
AppIdVoice = Config.Bind("Photon", "App Id Voice", "", "Photon Voice App ID");
|
||||||
AppIdChat = Config.Bind("Photon", "App Id Chat", "", "Photon Chat App ID");
|
AppIdChat = Config.Bind("Photon", "App Id Chat", "", "Photon Chat App ID");
|
||||||
ServerHostname = Config.Bind("Server", "NameServer Host", "https://ns.lapis.codes", "Host for the NameServer.");
|
EnableAdvancedSettings = Config.Bind("Advanced", "Enabled Advanced Settings", false, "Allows other fields below in the advanced section to be modified.");
|
||||||
|
PhotonHostname = Config.Bind("Advanced", "Photon NameServer", "", "Custom Photon NameServer");
|
||||||
|
PhotonPort = Config.Bind("Advanced", "Photon NameServer Port", 0, "Custom Photon NameServer Port (if 0, it will be default)");
|
||||||
|
ServerHostname = Config.Bind("Server", "RecNet NameServer Host", "https://ns.lapis.codes", "Host for the RecNet NameServer.");
|
||||||
|
|
||||||
Harmony.CreateAndPatchAll(typeof(Plugin).Assembly);
|
Harmony.CreateAndPatchAll(typeof(Plugin).Assembly);
|
||||||
|
|
||||||
|
MethodInfo registerMethod = typeof(ClassInjector)
|
||||||
|
.GetMethods(BindingFlags.Public | BindingFlags.Static)
|
||||||
|
.FirstOrDefault(m => m.Name == "RegisterTypeInIl2Cpp" && m.IsGenericMethodDefinition);
|
||||||
|
|
||||||
|
IEnumerable<Type> il2cppTypes = Assembly.GetExecutingAssembly().GetTypes()
|
||||||
|
.Where(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(MonoBehaviour)))
|
||||||
|
.Where(t => t.Namespace == "CannedNet.Client")
|
||||||
|
.Where(t => t.GetConstructor(new[] { typeof(IntPtr) }) != null);
|
||||||
|
|
||||||
|
foreach (Type type in il2cppTypes)
|
||||||
|
{
|
||||||
|
registerMethod?.MakeGenericMethod(type).Invoke(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
SceneManager.sceneLoaded += (Action<Scene, LoadSceneMode>)OnSceneLoaded;
|
SceneManager.sceneLoaded += (Action<Scene, LoadSceneMode>)OnSceneLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,6 +74,16 @@ public class Plugin : BasePlugin
|
|||||||
Log.LogInfo("cheatmanager destroyed");
|
Log.LogInfo("cheatmanager destroyed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (scene.name == "reccenter")
|
||||||
|
{
|
||||||
|
var MarqueeWhateverTheFuck = GameObject.Find("DynamicObjects/[RecCenter_Marquee]");
|
||||||
|
if (MarqueeWhateverTheFuck != null)
|
||||||
|
{
|
||||||
|
MarqueeWhateverTheFuck.transform.GetChild(0).GetComponent<TextMesh>().text = " Is this thing on?";
|
||||||
|
MarqueeWhateverTheFuck.transform.GetChild(1).GetComponent<TextMesh>().text = " Hello?";
|
||||||
|
Log.LogInfo("Rec Center theatre text changed LOL");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user