mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-19 15:51:54 +00:00
2021.11.9
This commit is contained in:
13 files changed
+204
-170
No files matched your search
+4
-4
@@ -1,15 +1,15 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<GamePlatform Condition="'$(GamePlatform)' == ''">Steam</GamePlatform>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2021.6.30</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.6.30</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2021.11.9</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.11.9</GameVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.IL2CPP" Version="6.0.0-be.513" />
|
||||
<PackageReference Include="BepInEx.IL2CPP" Version="6.0.0-be.515" />
|
||||
<PackageReference Include="AmongUs.GameLibs.$(GamePlatform)" Version="$(GameVersion)" PrivateAssets="all" />
|
||||
|
||||
<PackageReference Include="BepInEx.AutoPlugin" Version="1.0.0" PrivateAssets="all" />
|
||||
<PackageReference Include="BepInEx.AutoPlugin" Version="1.0.1" PrivateAssets="all" />
|
||||
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="1.0.1" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using BepInEx.IL2CPP;
|
||||
using HarmonyLib;
|
||||
using InnerNet;
|
||||
using Reactor.Extensions;
|
||||
using UnhollowerBaseLib;
|
||||
using UnhollowerBaseLib.Attributes;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -63,20 +64,10 @@ namespace Reactor.Debugger
|
||||
{
|
||||
var data = PlayerControl.LocalPlayer.Data;
|
||||
|
||||
var newIsImpostor = GUILayout.Toggle(data.IsImpostor, "Is Impostor");
|
||||
if (data.IsImpostor != newIsImpostor)
|
||||
var newIsImpostor = GUILayout.Toggle(data.Role.IsImpostor, "Is Impostor");
|
||||
if (data.Role.IsImpostor != newIsImpostor)
|
||||
{
|
||||
if (newIsImpostor)
|
||||
{
|
||||
PlayerControl.LocalPlayer.RpcSetInfected(new[]
|
||||
{
|
||||
data
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerControl.LocalPlayer.RemoveInfected();
|
||||
}
|
||||
PlayerControl.LocalPlayer.RpcSetRole(newIsImpostor ? RoleTypes.Impostor : RoleTypes.Crewmate);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Spawn a dummy"))
|
||||
@@ -90,10 +81,10 @@ namespace Reactor.Debugger
|
||||
playerControl.NetTransform.enabled = false;
|
||||
playerControl.SetName($"{TranslationController.Instance.GetString(StringNames.Dummy, Array.Empty<Il2CppSystem.Object>())} {i}");
|
||||
playerControl.SetColor((byte) (i % Palette.PlayerColors.Length));
|
||||
playerControl.SetHat(i % (uint) HatManager.Instance.AllHats.Count, playerControl.Data.ColorId);
|
||||
playerControl.SetPet(i % (uint) HatManager.Instance.AllPets.Count);
|
||||
playerControl.SetSkin(i % (uint) HatManager.Instance.AllSkins.Count);
|
||||
GameData.Instance.RpcSetTasks(playerControl.PlayerId, new byte[0]);
|
||||
playerControl.SetHat(HatManager.Instance.AllHats.ToArray().ElementAt(i % HatManager.Instance.AllHats.Count).ProdId, playerControl.Data.DefaultOutfit.ColorId);
|
||||
playerControl.SetPet(HatManager.Instance.AllPets.ToArray().ElementAt(i % HatManager.Instance.AllPets.Count).ProdId);
|
||||
playerControl.SetSkin(HatManager.Instance.AllSkins.ToArray().ElementAt(i % HatManager.Instance.AllSkins.Count).ProdId);
|
||||
GameData.Instance.RpcSetTasks(playerControl.PlayerId, new Il2CppStructArray<byte>(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Reactor.Debugger
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GameSettingMenu), nameof(GameSettingMenu.OnEnable))]
|
||||
[HarmonyPatch(typeof(GameSettingMenu), nameof(GameSettingMenu.Start))]
|
||||
public static class GameSettingMenuPatch
|
||||
{
|
||||
public static void Prefix(GameSettingMenu __instance)
|
||||
|
||||
@@ -4,29 +4,29 @@
|
||||
".NETStandard,Version=v2.1": {
|
||||
"AmongUs.GameLibs.Steam": {
|
||||
"type": "Direct",
|
||||
"requested": "[2021.6.30, )",
|
||||
"resolved": "2021.6.30",
|
||||
"contentHash": "TdlFO+S61WREk/sOV2YUmzQ6MFNXk5o+uxLv4i4ft/Z1VRkxFo66/ff3cR1ZfI8DuXni/Ao9rS4dJP+j85pEFA=="
|
||||
"requested": "[2021.11.9, )",
|
||||
"resolved": "2021.11.9",
|
||||
"contentHash": "mqaIx7oPavuwMTRZDMmBrLOAWNG6s1tCOvpysnNPZT58b3epU+WMJKBruw9fUCf53t333d71xVUov6PRcwnSZQ=="
|
||||
},
|
||||
"BepInEx.AutoPlugin": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.0, )",
|
||||
"resolved": "1.0.0",
|
||||
"contentHash": "rQUxf9ds83egTM/IM2V0VchMc6kosgF7D1SYPU4VOve/QbDYGD9daGeDvHX2yN2Kj+cPesnKZl5eBBKrTVhJHg=="
|
||||
"requested": "[1.0.1, )",
|
||||
"resolved": "1.0.1",
|
||||
"contentHash": "G4YpTHG9rtkDJof+ld7Er4E+sCOlgsjG4bJ1itx1ub7dgff6qqHLy9ksX1ehgO0AdBOPVyVl/GKJg9o7iNl8HA=="
|
||||
},
|
||||
"BepInEx.IL2CPP": {
|
||||
"type": "Direct",
|
||||
"requested": "[6.0.0-be.513, )",
|
||||
"resolved": "6.0.0-be.513",
|
||||
"contentHash": "3qJWnrBdNG6NnQZlcFL+gkauElheUqXsDhO/6Szhdvz1x7qpncoJw/5+zSjJLKt8VCQFFJ2u7Wxz4LBvpvYoFg==",
|
||||
"requested": "[6.0.0-be.515, )",
|
||||
"resolved": "6.0.0-be.515",
|
||||
"contentHash": "T4PAFl5wB/UsoVafc2rrbzJyUDMjdgCdeC1f/M3fB1vJKJY9UF67XTSgI3qo3AvQMR3x+4n+MuEXWwTo5Urnlw==",
|
||||
"dependencies": {
|
||||
"BepInEx.Core": "6.0.0-be.513",
|
||||
"BepInEx.Core": "6.0.0-be.515",
|
||||
"BepInEx.Il2Cpp.TlsAdapter": "1.0.1",
|
||||
"HarmonyX": "2.5.7",
|
||||
"Iced": "1.15.0",
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.Tool": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.5",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.5",
|
||||
"Il2CppAssemblyUnhollower.Tool": "0.4.19.5",
|
||||
"Il2CppDumper": "6.6.4",
|
||||
"MonoMod.RuntimeDetour": "21.10.10.1",
|
||||
"Samboy063.Cpp2IL.Core": "2021.5.3"
|
||||
@@ -40,8 +40,8 @@
|
||||
},
|
||||
"BepInEx.Core": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.0.0-be.513",
|
||||
"contentHash": "MBUNReAFudLPyxH7/w9iHLcy6T/agSSmM4dyLMy+Hhqle5Hvi07d3x+6Usq0IizuQZIje8ngL16rud2FBTLgeQ==",
|
||||
"resolved": "6.0.0-be.515",
|
||||
"contentHash": "VyWAWja6n8KcJRsLmY2Qp4IYddBOtwgnlnuwM4kYy8XLV6et45ua64RjWWb2vcVIWZvrXjeCwwxW2rb8lJKLMQ==",
|
||||
"dependencies": {
|
||||
"HarmonyX": "2.5.7",
|
||||
"MonoMod.Utils": "21.10.10.1",
|
||||
@@ -77,27 +77,27 @@
|
||||
},
|
||||
"Il2CppAssemblyUnhollower.BaseLib": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.4.19.3",
|
||||
"contentHash": "/gNECLNOWQR6KDZTZQtBOGG445ajBQTqX9L9TO8WkiAc7QT27KafO3/MmwGjephZcA7V81UZ8RUcq0rVKa2yfA==",
|
||||
"resolved": "0.4.19.5",
|
||||
"contentHash": "UP0vtj0iDigQ/HZBq6+sP/btgDLc5Ibt1WkFrPvXvOtkgjt+cIdKpJmxVZHwMluUmP6Wsy3RCXeLlXE9eC/15Q==",
|
||||
"dependencies": {
|
||||
"Iced": "1.15.0"
|
||||
}
|
||||
},
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.4.19.3",
|
||||
"contentHash": "U0cA2XdoULAQPxa294VRot+08jQLgbuQNOzkgGCnCP79eq6Qc4e4CKQ6+nrsd4i2AeswTWOauDzL400PdtVoVw==",
|
||||
"resolved": "0.4.19.5",
|
||||
"contentHash": "dxn4ADz0VlWQtSnNhVIaFzQREnSwZEvS6YaFmwuKW+wbLdHTk9D9bDbS5QkL8glKdgoW2ifpvCBgKd1QAui/1w==",
|
||||
"dependencies": {
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.3"
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.5"
|
||||
}
|
||||
},
|
||||
"Il2CppAssemblyUnhollower.Tool": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.4.19.3",
|
||||
"contentHash": "eb0IyfXxOS1t6wSJ+TuEWcNXBtd98p6Hun1IG7I2ZGDiRQByKy9qPYRh2VG2JLXlVMcCVNybLUnnDWo9cupHcw==",
|
||||
"resolved": "0.4.19.5",
|
||||
"contentHash": "TYfW5UA77dy0a0N1XaIkZJLMyJIXdHO9q3jyuhTdsZdpuD/oi7qZt1GDlpI5dsg2nf9HKVAlIPNagtIqK9pYvw==",
|
||||
"dependencies": {
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.5",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.5",
|
||||
"Mono.Cecil": "0.11.3"
|
||||
}
|
||||
},
|
||||
@@ -472,7 +472,7 @@
|
||||
"reactor": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"BepInEx.IL2CPP": "6.0.0-be.513"
|
||||
"BepInEx.IL2CPP": "6.0.0-be.515"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,29 +4,29 @@
|
||||
".NETStandard,Version=v2.1": {
|
||||
"AmongUs.GameLibs.Steam": {
|
||||
"type": "Direct",
|
||||
"requested": "[2021.6.30, )",
|
||||
"resolved": "2021.6.30",
|
||||
"contentHash": "TdlFO+S61WREk/sOV2YUmzQ6MFNXk5o+uxLv4i4ft/Z1VRkxFo66/ff3cR1ZfI8DuXni/Ao9rS4dJP+j85pEFA=="
|
||||
"requested": "[2021.11.9, )",
|
||||
"resolved": "2021.11.9",
|
||||
"contentHash": "mqaIx7oPavuwMTRZDMmBrLOAWNG6s1tCOvpysnNPZT58b3epU+WMJKBruw9fUCf53t333d71xVUov6PRcwnSZQ=="
|
||||
},
|
||||
"BepInEx.AutoPlugin": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.0, )",
|
||||
"resolved": "1.0.0",
|
||||
"contentHash": "rQUxf9ds83egTM/IM2V0VchMc6kosgF7D1SYPU4VOve/QbDYGD9daGeDvHX2yN2Kj+cPesnKZl5eBBKrTVhJHg=="
|
||||
"requested": "[1.0.1, )",
|
||||
"resolved": "1.0.1",
|
||||
"contentHash": "G4YpTHG9rtkDJof+ld7Er4E+sCOlgsjG4bJ1itx1ub7dgff6qqHLy9ksX1ehgO0AdBOPVyVl/GKJg9o7iNl8HA=="
|
||||
},
|
||||
"BepInEx.IL2CPP": {
|
||||
"type": "Direct",
|
||||
"requested": "[6.0.0-be.513, )",
|
||||
"resolved": "6.0.0-be.513",
|
||||
"contentHash": "3qJWnrBdNG6NnQZlcFL+gkauElheUqXsDhO/6Szhdvz1x7qpncoJw/5+zSjJLKt8VCQFFJ2u7Wxz4LBvpvYoFg==",
|
||||
"requested": "[6.0.0-be.515, )",
|
||||
"resolved": "6.0.0-be.515",
|
||||
"contentHash": "T4PAFl5wB/UsoVafc2rrbzJyUDMjdgCdeC1f/M3fB1vJKJY9UF67XTSgI3qo3AvQMR3x+4n+MuEXWwTo5Urnlw==",
|
||||
"dependencies": {
|
||||
"BepInEx.Core": "6.0.0-be.513",
|
||||
"BepInEx.Core": "6.0.0-be.515",
|
||||
"BepInEx.Il2Cpp.TlsAdapter": "1.0.1",
|
||||
"HarmonyX": "2.5.7",
|
||||
"Iced": "1.15.0",
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.Tool": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.5",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.5",
|
||||
"Il2CppAssemblyUnhollower.Tool": "0.4.19.5",
|
||||
"Il2CppDumper": "6.6.4",
|
||||
"MonoMod.RuntimeDetour": "21.10.10.1",
|
||||
"Samboy063.Cpp2IL.Core": "2021.5.3"
|
||||
@@ -40,8 +40,8 @@
|
||||
},
|
||||
"BepInEx.Core": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.0.0-be.513",
|
||||
"contentHash": "MBUNReAFudLPyxH7/w9iHLcy6T/agSSmM4dyLMy+Hhqle5Hvi07d3x+6Usq0IizuQZIje8ngL16rud2FBTLgeQ==",
|
||||
"resolved": "6.0.0-be.515",
|
||||
"contentHash": "VyWAWja6n8KcJRsLmY2Qp4IYddBOtwgnlnuwM4kYy8XLV6et45ua64RjWWb2vcVIWZvrXjeCwwxW2rb8lJKLMQ==",
|
||||
"dependencies": {
|
||||
"HarmonyX": "2.5.7",
|
||||
"MonoMod.Utils": "21.10.10.1",
|
||||
@@ -77,27 +77,27 @@
|
||||
},
|
||||
"Il2CppAssemblyUnhollower.BaseLib": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.4.19.3",
|
||||
"contentHash": "/gNECLNOWQR6KDZTZQtBOGG445ajBQTqX9L9TO8WkiAc7QT27KafO3/MmwGjephZcA7V81UZ8RUcq0rVKa2yfA==",
|
||||
"resolved": "0.4.19.5",
|
||||
"contentHash": "UP0vtj0iDigQ/HZBq6+sP/btgDLc5Ibt1WkFrPvXvOtkgjt+cIdKpJmxVZHwMluUmP6Wsy3RCXeLlXE9eC/15Q==",
|
||||
"dependencies": {
|
||||
"Iced": "1.15.0"
|
||||
}
|
||||
},
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.4.19.3",
|
||||
"contentHash": "U0cA2XdoULAQPxa294VRot+08jQLgbuQNOzkgGCnCP79eq6Qc4e4CKQ6+nrsd4i2AeswTWOauDzL400PdtVoVw==",
|
||||
"resolved": "0.4.19.5",
|
||||
"contentHash": "dxn4ADz0VlWQtSnNhVIaFzQREnSwZEvS6YaFmwuKW+wbLdHTk9D9bDbS5QkL8glKdgoW2ifpvCBgKd1QAui/1w==",
|
||||
"dependencies": {
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.3"
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.5"
|
||||
}
|
||||
},
|
||||
"Il2CppAssemblyUnhollower.Tool": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.4.19.3",
|
||||
"contentHash": "eb0IyfXxOS1t6wSJ+TuEWcNXBtd98p6Hun1IG7I2ZGDiRQByKy9qPYRh2VG2JLXlVMcCVNybLUnnDWo9cupHcw==",
|
||||
"resolved": "0.4.19.5",
|
||||
"contentHash": "TYfW5UA77dy0a0N1XaIkZJLMyJIXdHO9q3jyuhTdsZdpuD/oi7qZt1GDlpI5dsg2nf9HKVAlIPNagtIqK9pYvw==",
|
||||
"dependencies": {
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.5",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.5",
|
||||
"Mono.Cecil": "0.11.3"
|
||||
}
|
||||
},
|
||||
@@ -472,7 +472,7 @@
|
||||
"reactor": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"BepInEx.IL2CPP": "6.0.0-be.513"
|
||||
"BepInEx.IL2CPP": "6.0.0-be.515"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Reactor.Extensions;
|
||||
|
||||
[RegisterInIl2Cpp]
|
||||
public class Dispatcher : MonoBehaviour
|
||||
{
|
||||
public Dispatcher(IntPtr ptr) : base(ptr)
|
||||
{
|
||||
}
|
||||
|
||||
public static Dispatcher Instance { get; private set; } = null!;
|
||||
|
||||
private static readonly Queue<Action> _queue = new();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
lock (_queue)
|
||||
{
|
||||
while (_queue.Count > 0)
|
||||
{
|
||||
_queue.Dequeue().Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Enqueue(Action action)
|
||||
{
|
||||
lock (_queue)
|
||||
{
|
||||
_queue.Enqueue(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using HarmonyLib;
|
||||
using Il2CppSystem.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace Reactor.Networking.Patches
|
||||
{
|
||||
internal static class AuthPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(X509Certificate2Collection), nameof(X509Certificate2Collection.Contains))]
|
||||
public static class AcceptCustomCertificatesPatch
|
||||
{
|
||||
public static bool Prefix(X509Certificate2Collection __instance, ref bool __result)
|
||||
{
|
||||
if (AuthManager.Instance && AuthManager.Instance.connection != null && AuthManager.Instance.connection.serverCertificates.Equals(__instance))
|
||||
{
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,7 @@ namespace Reactor.Networking.Patches
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.GetConnectionData))]
|
||||
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.GetConnectionData))]
|
||||
public static class HandshakePatch
|
||||
{
|
||||
public static void Postfix(ref Il2CppStructArray<byte> __result)
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using HarmonyLib;
|
||||
using Hazel.Udp;
|
||||
using Il2CppSystem.Net;
|
||||
using InnerNet;
|
||||
|
||||
namespace Reactor.Patches
|
||||
{
|
||||
internal static class CustomServersPatch
|
||||
{
|
||||
/// <summary>
|
||||
/// Send the account id only to Among Us official servers
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.GetConnectionData))]
|
||||
public static class DontSendAccountIdPatch
|
||||
{
|
||||
public static void Prefix(ref bool useDtlsLayout)
|
||||
{
|
||||
var serverManager = ServerManager.Instance;
|
||||
if (!serverManager || serverManager.CurrentRegion?.TryCast<DnsRegionInfo>() is not { } regionInfo || !regionInfo.Fqdn.EndsWith("among.us"))
|
||||
{
|
||||
useDtlsLayout = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encrypt connection only to Among Us official servers
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(AuthManager), nameof(AuthManager.CreateDtlsConnection))]
|
||||
public static class DontEncryptCustomServersPatch
|
||||
{
|
||||
public static bool Prefix(ref UnityUdpClientConnection __result, string targetIp, ushort targetPort)
|
||||
{
|
||||
var serverManager = ServerManager.Instance;
|
||||
if (serverManager.CurrentRegion.TryCast<DnsRegionInfo>() is not { } regionInfo || !regionInfo.Fqdn.EndsWith("among.us"))
|
||||
{
|
||||
var remoteEndPoint = new IPEndPoint(IPAddress.Parse(targetIp), targetPort - 3);
|
||||
__result = new UnityUdpClientConnection(remoteEndPoint);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Reactor.Extensions;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Reactor.Patches
|
||||
{
|
||||
internal class RegionInfoWatcher : IDisposable
|
||||
{
|
||||
private FileSystemWatcher Watcher { get; }
|
||||
public bool Reload { get; set; }
|
||||
|
||||
internal RegionInfoWatcher()
|
||||
{
|
||||
@@ -20,7 +21,19 @@ namespace Reactor.Patches
|
||||
{
|
||||
if (new FileInfo(e.Name).Length > 0)
|
||||
{
|
||||
Reload = true;
|
||||
Dispatcher.Instance.Enqueue(() =>
|
||||
{
|
||||
ServerManager.Instance.LoadServers();
|
||||
|
||||
Object.FindObjectOfType<RegionTextMonitor>()?.Start();
|
||||
if (Object.FindObjectOfType<RegionMenu>() is { } regionMenu)
|
||||
{
|
||||
regionMenu.OnDisable();
|
||||
regionMenu.OnEnable();
|
||||
}
|
||||
|
||||
Logger<ReactorPlugin>.Info("Region file reloaded");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,7 +42,7 @@ namespace Reactor.Patches
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Watcher?.Dispose();
|
||||
Watcher.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,24 +7,6 @@ using InnerNet;
|
||||
|
||||
namespace Reactor.Patches
|
||||
{
|
||||
/// <summary>
|
||||
/// Fixes hardcoded ports
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.SetEndpoint))]
|
||||
public static class SetEndpointPatch
|
||||
{
|
||||
public static void Prefix(InnerNetClient __instance, ref string addr, ref ushort port)
|
||||
{
|
||||
var serverManager = ServerManager.Instance;
|
||||
if (__instance.GameMode == GameModes.OnlineGame && serverManager.CurrentServer != null && addr == serverManager.OnlineNetAddress && port != serverManager.OnlineNetPort)
|
||||
{
|
||||
Logger<ReactorPlugin>.Info($"Set endpoint to {addr}:{port}");
|
||||
Logger<ReactorPlugin>.Info($"Correcting port to {serverManager.OnlineNetPort}");
|
||||
port = serverManager.OnlineNetPort;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.Connect))]
|
||||
public static class ConnectPatch
|
||||
{
|
||||
@@ -52,7 +34,7 @@ namespace Reactor.Patches
|
||||
.ToArray();
|
||||
|
||||
__instance.cachedServers = servers;
|
||||
Logger<ReactorPlugin>.Info($"Populated {__instance.Name} ({__instance.Fqdn}:{__instance.Port}) with {servers.Length} server(s) {{{servers.Join()}}}");
|
||||
Logger<ReactorPlugin>.Info($"Populated {__instance.Name} ({__instance.Fqdn}:{__instance.Port}) with {servers.Length} server(s) {{{servers.Select(x => x.ToString()).Join()}}}");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -66,19 +48,4 @@ namespace Reactor.Patches
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// De-inlines AmongUsClient#SetEndpoint from JoinGameButton
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(JoinGameButton), nameof(JoinGameButton.OnClick))]
|
||||
public static class JoinGameButtonPatch
|
||||
{
|
||||
public static void Postfix(JoinGameButton __instance)
|
||||
{
|
||||
if (__instance.GameMode == GameModes.OnlineGame)
|
||||
{
|
||||
AmongUsClient.Instance.SetEndpoint(DestroyableSingleton<ServerManager>.Instance.OnlineNetAddress, DestroyableSingleton<ServerManager>.Instance.OnlineNetPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
-13
@@ -4,6 +4,7 @@ using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using BepInEx.IL2CPP;
|
||||
using HarmonyLib;
|
||||
using Reactor.Extensions;
|
||||
using Reactor.Networking;
|
||||
using Reactor.Networking.MethodRpc;
|
||||
using Reactor.Networking.Serialization;
|
||||
@@ -11,6 +12,7 @@ using Reactor.Patches;
|
||||
using Reactor.Unstrip;
|
||||
using UnhollowerBaseLib.Attributes;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Reactor
|
||||
{
|
||||
@@ -44,11 +46,20 @@ namespace Reactor
|
||||
|
||||
this.AddComponent<ReactorComponent>().Plugin = this;
|
||||
this.AddComponent<Coroutines.Component>();
|
||||
this.AddComponent<Dispatcher>();
|
||||
|
||||
ReactorVersionShower.Initialize();
|
||||
FreeNamePatch.Initialize();
|
||||
SplashSkip.Initialize();
|
||||
DefaultBundle.Load();
|
||||
|
||||
SceneManager.add_sceneLoaded((Action<Scene, LoadSceneMode>) ((scene, _) =>
|
||||
{
|
||||
if (scene.name == "MainMenu")
|
||||
{
|
||||
ModManager.Instance.ShowModStamp();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public override bool Unload()
|
||||
@@ -69,23 +80,11 @@ namespace Reactor
|
||||
{
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
ModManager.Instance.ShowModStamp();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Plugin!.RegionInfoWatcher.Reload)
|
||||
{
|
||||
Plugin.RegionInfoWatcher.Reload = false;
|
||||
ServerManager.Instance.LoadServers();
|
||||
Plugin.Log.LogInfo("Region file reloaded");
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.F5))
|
||||
{
|
||||
Plugin.Log.LogInfo("Reloading all configs");
|
||||
Plugin!.Log.LogInfo("Reloading all configs");
|
||||
|
||||
foreach (var pluginInfo in IL2CPPChainloader.Instance.Plugins.Values)
|
||||
{
|
||||
|
||||
+24
-24
@@ -4,29 +4,29 @@
|
||||
".NETStandard,Version=v2.1": {
|
||||
"AmongUs.GameLibs.Steam": {
|
||||
"type": "Direct",
|
||||
"requested": "[2021.6.30, )",
|
||||
"resolved": "2021.6.30",
|
||||
"contentHash": "TdlFO+S61WREk/sOV2YUmzQ6MFNXk5o+uxLv4i4ft/Z1VRkxFo66/ff3cR1ZfI8DuXni/Ao9rS4dJP+j85pEFA=="
|
||||
"requested": "[2021.11.9, )",
|
||||
"resolved": "2021.11.9",
|
||||
"contentHash": "mqaIx7oPavuwMTRZDMmBrLOAWNG6s1tCOvpysnNPZT58b3epU+WMJKBruw9fUCf53t333d71xVUov6PRcwnSZQ=="
|
||||
},
|
||||
"BepInEx.AutoPlugin": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.0.0, )",
|
||||
"resolved": "1.0.0",
|
||||
"contentHash": "rQUxf9ds83egTM/IM2V0VchMc6kosgF7D1SYPU4VOve/QbDYGD9daGeDvHX2yN2Kj+cPesnKZl5eBBKrTVhJHg=="
|
||||
"requested": "[1.0.1, )",
|
||||
"resolved": "1.0.1",
|
||||
"contentHash": "G4YpTHG9rtkDJof+ld7Er4E+sCOlgsjG4bJ1itx1ub7dgff6qqHLy9ksX1ehgO0AdBOPVyVl/GKJg9o7iNl8HA=="
|
||||
},
|
||||
"BepInEx.IL2CPP": {
|
||||
"type": "Direct",
|
||||
"requested": "[6.0.0-be.513, )",
|
||||
"resolved": "6.0.0-be.513",
|
||||
"contentHash": "3qJWnrBdNG6NnQZlcFL+gkauElheUqXsDhO/6Szhdvz1x7qpncoJw/5+zSjJLKt8VCQFFJ2u7Wxz4LBvpvYoFg==",
|
||||
"requested": "[6.0.0-be.515, )",
|
||||
"resolved": "6.0.0-be.515",
|
||||
"contentHash": "T4PAFl5wB/UsoVafc2rrbzJyUDMjdgCdeC1f/M3fB1vJKJY9UF67XTSgI3qo3AvQMR3x+4n+MuEXWwTo5Urnlw==",
|
||||
"dependencies": {
|
||||
"BepInEx.Core": "6.0.0-be.513",
|
||||
"BepInEx.Core": "6.0.0-be.515",
|
||||
"BepInEx.Il2Cpp.TlsAdapter": "1.0.1",
|
||||
"HarmonyX": "2.5.7",
|
||||
"Iced": "1.15.0",
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.Tool": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.5",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.5",
|
||||
"Il2CppAssemblyUnhollower.Tool": "0.4.19.5",
|
||||
"Il2CppDumper": "6.6.4",
|
||||
"MonoMod.RuntimeDetour": "21.10.10.1",
|
||||
"Samboy063.Cpp2IL.Core": "2021.5.3"
|
||||
@@ -50,8 +50,8 @@
|
||||
},
|
||||
"BepInEx.Core": {
|
||||
"type": "Transitive",
|
||||
"resolved": "6.0.0-be.513",
|
||||
"contentHash": "MBUNReAFudLPyxH7/w9iHLcy6T/agSSmM4dyLMy+Hhqle5Hvi07d3x+6Usq0IizuQZIje8ngL16rud2FBTLgeQ==",
|
||||
"resolved": "6.0.0-be.515",
|
||||
"contentHash": "VyWAWja6n8KcJRsLmY2Qp4IYddBOtwgnlnuwM4kYy8XLV6et45ua64RjWWb2vcVIWZvrXjeCwwxW2rb8lJKLMQ==",
|
||||
"dependencies": {
|
||||
"HarmonyX": "2.5.7",
|
||||
"MonoMod.Utils": "21.10.10.1",
|
||||
@@ -87,27 +87,27 @@
|
||||
},
|
||||
"Il2CppAssemblyUnhollower.BaseLib": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.4.19.3",
|
||||
"contentHash": "/gNECLNOWQR6KDZTZQtBOGG445ajBQTqX9L9TO8WkiAc7QT27KafO3/MmwGjephZcA7V81UZ8RUcq0rVKa2yfA==",
|
||||
"resolved": "0.4.19.5",
|
||||
"contentHash": "UP0vtj0iDigQ/HZBq6+sP/btgDLc5Ibt1WkFrPvXvOtkgjt+cIdKpJmxVZHwMluUmP6Wsy3RCXeLlXE9eC/15Q==",
|
||||
"dependencies": {
|
||||
"Iced": "1.15.0"
|
||||
}
|
||||
},
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.4.19.3",
|
||||
"contentHash": "U0cA2XdoULAQPxa294VRot+08jQLgbuQNOzkgGCnCP79eq6Qc4e4CKQ6+nrsd4i2AeswTWOauDzL400PdtVoVw==",
|
||||
"resolved": "0.4.19.5",
|
||||
"contentHash": "dxn4ADz0VlWQtSnNhVIaFzQREnSwZEvS6YaFmwuKW+wbLdHTk9D9bDbS5QkL8glKdgoW2ifpvCBgKd1QAui/1w==",
|
||||
"dependencies": {
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.3"
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.5"
|
||||
}
|
||||
},
|
||||
"Il2CppAssemblyUnhollower.Tool": {
|
||||
"type": "Transitive",
|
||||
"resolved": "0.4.19.3",
|
||||
"contentHash": "eb0IyfXxOS1t6wSJ+TuEWcNXBtd98p6Hun1IG7I2ZGDiRQByKy9qPYRh2VG2JLXlVMcCVNybLUnnDWo9cupHcw==",
|
||||
"resolved": "0.4.19.5",
|
||||
"contentHash": "TYfW5UA77dy0a0N1XaIkZJLMyJIXdHO9q3jyuhTdsZdpuD/oi7qZt1GDlpI5dsg2nf9HKVAlIPNagtIqK9pYvw==",
|
||||
"dependencies": {
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.3",
|
||||
"Il2CppAssemblyUnhollower.BaseLib": "0.4.19.5",
|
||||
"Il2CppAssemblyUnhollower.BaseLib.Legacy": "0.4.19.5",
|
||||
"Mono.Cecil": "0.11.3"
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user