From a2c1bb6bea31cebf68e368917a2a4cf38591b17f Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Mon, 22 Jul 2024 23:22:21 +0900 Subject: [PATCH 01/30] =?UTF-8?q?SendAllStreamedObjects=E3=81=AE=E3=83=91?= =?UTF-8?q?=E3=82=B1=E3=83=83=E3=83=88=E3=82=92=E5=88=86=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/InnerNetClientPatch.cs | 72 ++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Patches/InnerNetClientPatch.cs diff --git a/Patches/InnerNetClientPatch.cs b/Patches/InnerNetClientPatch.cs new file mode 100644 index 000000000..4d46650cf --- /dev/null +++ b/Patches/InnerNetClientPatch.cs @@ -0,0 +1,72 @@ +using System; +using Il2CppSystem.Collections.Generic; +using HarmonyLib; +using Hazel; +using InnerNet; + +namespace TownOfHost.Patches; + +[HarmonyPatch(typeof(InnerNetClient))] +static class InnerNetClientPatch +{ + [HarmonyPatch(nameof(InnerNetClient.SendOrDisconnect)), HarmonyPrefix] + public static void SendOrDisconnectPatch(InnerNetClient __instance, MessageWriter msg) + { + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"Sending message size: {msg.Length}", "InnerNetClient"); + } + } + [HarmonyPatch(nameof(InnerNetClient.SendAllStreamedObjects)), HarmonyPrefix] + public static bool SendAllStreamedObjectsPatch(InnerNetClient __instance, ref bool __result) + { + __result = false; + List obj = __instance.allObjects; + lock (obj) + { + for (int i = 0; i < __instance.allObjects.Count; i++) + { + InnerNetObject innerNetObject = __instance.allObjects[i]; + if (innerNetObject && innerNetObject.IsDirty && (innerNetObject.AmOwner || (innerNetObject.OwnerId == -2 && __instance.AmHost))) + { + MessageWriter messageWriter = __instance.Streams[(int)innerNetObject.sendMode]; + messageWriter.StartMessage(1); + messageWriter.WritePacked(innerNetObject.NetId); + try + { + if (innerNetObject.Serialize(messageWriter, false)) + { + messageWriter.EndMessage(); + } + else + { + messageWriter.CancelMessage(); + } + if (innerNetObject.Chunked && innerNetObject.IsDirty) + { + __result = true; + } + } + catch (Exception ex) + { + Logger.Info($"Exception:{ex.Message}", "InnerNetClient"); + messageWriter.CancelMessage(); + } + if (messageWriter.HasBytes(7)) + { + messageWriter.EndMessage(); + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"SendAllStreamedObjects", "InnerNetClient"); + } + __instance.SendOrDisconnect(messageWriter); + messageWriter.Clear(SendOption.Reliable); + messageWriter.StartMessage(5); + messageWriter.Write(__instance.GameId); + } + } + } + } + return false; + } +} From f4ecd487059be42f104b464052261a2933d8cc63 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Mon, 22 Jul 2024 23:50:04 +0900 Subject: [PATCH 02/30] =?UTF-8?q?=E3=83=91=E3=83=83=E3=83=81=E3=81=AE?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 55 +++++++++++++++++++++++++- Patches/InnerNetClientPatch.cs | 72 ---------------------------------- 2 files changed, 53 insertions(+), 74 deletions(-) delete mode 100644 Patches/InnerNetClientPatch.cs diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index 0efba6fd3..39879373c 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -4,6 +4,7 @@ using UnityEngine; using TownOfHost.Modules; using static TownOfHost.Translator; +using Hazel; namespace TownOfHost { @@ -62,7 +63,7 @@ public static void Postfix(MMOnlineManager __instance) { message = GetString("UnsupportedVersion"); } - else if(!Main.IsPublicAvailableOnThisVersion) + else if (!Main.IsPublicAvailableOnThisVersion) { message = GetString("PublicNotAvailableOnThisVersion"); } @@ -126,10 +127,60 @@ public static void Prefix(InnerNet.InnerNetClient __instance, int clientId, bool [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.SendAllStreamedObjects))] class InnerNetObjectSerializePatch { - public static void Prefix() + public static bool Prefix(InnerNetClient __instance, ref bool __result) { if (AmongUsClient.Instance.AmHost) GameOptionsSender.SendAllGameOptions(); + + //9人以上部屋で落ちる現象の対策コード + __result = false; + Il2CppSystem.Collections.Generic.List obj = __instance.allObjects; + lock (obj) + { + for (int i = 0; i < __instance.allObjects.Count; i++) + { + InnerNetObject innerNetObject = __instance.allObjects[i]; + if (innerNetObject && innerNetObject.IsDirty && (innerNetObject.AmOwner || (innerNetObject.OwnerId == -2 && __instance.AmHost))) + { + MessageWriter messageWriter = __instance.Streams[(int)innerNetObject.sendMode]; + messageWriter.StartMessage(1); + messageWriter.WritePacked(innerNetObject.NetId); + try + { + if (innerNetObject.Serialize(messageWriter, false)) + { + messageWriter.EndMessage(); + } + else + { + messageWriter.CancelMessage(); + } + if (innerNetObject.Chunked && innerNetObject.IsDirty) + { + __result = true; + } + } + catch (System.Exception ex) + { + Logger.Info($"Exception:{ex.Message}", "InnerNetClient"); + messageWriter.CancelMessage(); + } + if (messageWriter.HasBytes(7)) + { + messageWriter.EndMessage(); + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"SendAllStreamedObjects", "InnerNetClient"); + } + __instance.SendOrDisconnect(messageWriter); + messageWriter.Clear(SendOption.Reliable); + messageWriter.StartMessage(5); + messageWriter.Write(__instance.GameId); + } + } + } + } + return false; } } } \ No newline at end of file diff --git a/Patches/InnerNetClientPatch.cs b/Patches/InnerNetClientPatch.cs deleted file mode 100644 index 4d46650cf..000000000 --- a/Patches/InnerNetClientPatch.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using Il2CppSystem.Collections.Generic; -using HarmonyLib; -using Hazel; -using InnerNet; - -namespace TownOfHost.Patches; - -[HarmonyPatch(typeof(InnerNetClient))] -static class InnerNetClientPatch -{ - [HarmonyPatch(nameof(InnerNetClient.SendOrDisconnect)), HarmonyPrefix] - public static void SendOrDisconnectPatch(InnerNetClient __instance, MessageWriter msg) - { - if (DebugModeManager.IsDebugMode) - { - Logger.Info($"Sending message size: {msg.Length}", "InnerNetClient"); - } - } - [HarmonyPatch(nameof(InnerNetClient.SendAllStreamedObjects)), HarmonyPrefix] - public static bool SendAllStreamedObjectsPatch(InnerNetClient __instance, ref bool __result) - { - __result = false; - List obj = __instance.allObjects; - lock (obj) - { - for (int i = 0; i < __instance.allObjects.Count; i++) - { - InnerNetObject innerNetObject = __instance.allObjects[i]; - if (innerNetObject && innerNetObject.IsDirty && (innerNetObject.AmOwner || (innerNetObject.OwnerId == -2 && __instance.AmHost))) - { - MessageWriter messageWriter = __instance.Streams[(int)innerNetObject.sendMode]; - messageWriter.StartMessage(1); - messageWriter.WritePacked(innerNetObject.NetId); - try - { - if (innerNetObject.Serialize(messageWriter, false)) - { - messageWriter.EndMessage(); - } - else - { - messageWriter.CancelMessage(); - } - if (innerNetObject.Chunked && innerNetObject.IsDirty) - { - __result = true; - } - } - catch (Exception ex) - { - Logger.Info($"Exception:{ex.Message}", "InnerNetClient"); - messageWriter.CancelMessage(); - } - if (messageWriter.HasBytes(7)) - { - messageWriter.EndMessage(); - if (DebugModeManager.IsDebugMode) - { - Logger.Info($"SendAllStreamedObjects", "InnerNetClient"); - } - __instance.SendOrDisconnect(messageWriter); - messageWriter.Clear(SendOption.Reliable); - messageWriter.StartMessage(5); - messageWriter.Write(__instance.GameId); - } - } - } - } - return false; - } -} From 8146a1a819780fe1827244593c35e6b544257df4 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:55:10 +0900 Subject: [PATCH 03/30] =?UTF-8?q?SendAllStreamedObjects=E3=83=91=E3=83=83?= =?UTF-8?q?=E3=83=81=E3=81=AEMessageWriter=E3=82=92=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index 39879373c..c8c20f50e 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -134,7 +134,7 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) //9人以上部屋で落ちる現象の対策コード __result = false; - Il2CppSystem.Collections.Generic.List obj = __instance.allObjects; + var obj = __instance.allObjects; lock (obj) { for (int i = 0; i < __instance.allObjects.Count; i++) @@ -142,7 +142,9 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) InnerNetObject innerNetObject = __instance.allObjects[i]; if (innerNetObject && innerNetObject.IsDirty && (innerNetObject.AmOwner || (innerNetObject.OwnerId == -2 && __instance.AmHost))) { - MessageWriter messageWriter = __instance.Streams[(int)innerNetObject.sendMode]; + var messageWriter = MessageWriter.Get(SendOption.Reliable); + messageWriter.StartMessage(5); + messageWriter.Write(__instance.GameId); messageWriter.StartMessage(1); messageWriter.WritePacked(innerNetObject.NetId); try @@ -173,10 +175,8 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) Logger.Info($"SendAllStreamedObjects", "InnerNetClient"); } __instance.SendOrDisconnect(messageWriter); - messageWriter.Clear(SendOption.Reliable); - messageWriter.StartMessage(5); - messageWriter.Write(__instance.GameId); } + messageWriter.Recycle(); } } } From b5b7238419344cbdffc12f5d354b94295cc36819 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:56:07 +0900 Subject: [PATCH 04/30] =?UTF-8?q?WriteSpawnMessage=E3=81=AE=E3=83=91?= =?UTF-8?q?=E3=82=B1=E3=83=83=E3=83=88=E3=82=B5=E3=82=A4=E3=82=BA=E5=89=8A?= =?UTF-8?q?=E6=B8=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 104 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index c8c20f50e..e0999a2ce 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -183,4 +183,108 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) return false; } } + [HarmonyPatch] + class InnerNetClientPatch + { + [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.SendOrDisconnect)), HarmonyPrefix] + public static void SendOrDisconnectPatch(InnerNetClient __instance, MessageWriter msg) + { + if (msg.Length > 1000) + Logger.Info($"SendOrDisconnectPatch:Large Packet({msg.Length})", "InnerNetClient"); + } + [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.SendInitialData)), HarmonyPrefix] + public static bool SendInitialDataPatch(InnerNetClient __instance, int clientId) + { + Logger.Info($"SendInitialDataPatch:", "InnerNetClient"); + var obj = __instance.allObjects; + + lock (obj) + { + var hashSet = new System.Collections.Generic.HashSet(); + //SendGameManagerの代替。初めに発行する必要があるためここへ。 + WriteSpawnMessageEx(__instance, GameManager.Instance, GameManager.Instance.OwnerId, GameManager.Instance.SpawnFlags, clientId); + hashSet.Add(GameManager.Instance.gameObject); + + for (int i = 0; i < __instance.allObjects.Count; i++) + { + var innerNetObject = __instance.allObjects[i]; + if (innerNetObject && (innerNetObject.OwnerId != -4 || __instance.AmModdedHost) && hashSet.Add(innerNetObject.gameObject)) + { + WriteSpawnMessageEx(__instance, innerNetObject, innerNetObject.OwnerId, innerNetObject.SpawnFlags, clientId); + } + } + } + return false; + } + [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.Spawn)), HarmonyPrefix] + public static bool SpawnPatch(InnerNetClient __instance, InnerNetObject netObjParent, int ownerId, SpawnFlags flags) + { + Logger.Info($"SpawnPatch", "InnerNetClient"); + if (__instance.AmHost) + { + ownerId = (ownerId == -3) ? __instance.ClientId : ownerId; + WriteSpawnMessageEx(__instance, netObjParent, ownerId, flags); + } + return false; + } + /// + /// WriteSpawnMessageを単一パケットにまとめて発行する。 + /// + /// + /// + /// + /// + /// + public static void WriteSpawnMessageEx(InnerNetClient __instance, InnerNetObject netObjParent, int ownerId, SpawnFlags flags, int clientId = -1) + { + Logger.Info($"WriteSpawnMessageEx", "InnerNetClient"); + + InnerNetObject[] componentsInChildren = netObjParent.GetComponentsInChildren(); + var msg = MessageWriter.Get(SendOption.Reliable); + if (clientId == -1) + { + msg.StartMessage(5); + msg.Write(__instance.GameId); + } + else + { + msg.StartMessage(6); + msg.Write(__instance.GameId); + msg.Write(clientId); + } + { + msg.StartMessage(4); + { + msg.WritePacked(netObjParent.SpawnId); + msg.WritePacked(ownerId); + msg.Write((byte)flags); + msg.WritePacked(componentsInChildren.Length); + foreach (InnerNetObject innerNetObject in componentsInChildren) + { + innerNetObject.OwnerId = ownerId; + innerNetObject.SpawnFlags = flags; + if (innerNetObject.NetId == 0U) + { + InnerNetObject innerNetObject2 = innerNetObject; + uint netIdCnt = __instance.NetIdCnt; + __instance.NetIdCnt = netIdCnt + 1U; + innerNetObject2.NetId = netIdCnt; + __instance.allObjects.Add(innerNetObject); + __instance.allObjectsFast.Add(innerNetObject.NetId, innerNetObject); + } + msg.WritePacked(innerNetObject.NetId); + msg.StartMessage(1); + { + innerNetObject.Serialize(msg, true); + } + msg.EndMessage(); + } + msg.EndMessage(); + } + msg.EndMessage(); + } + __instance.SendOrDisconnect(msg); + msg.Recycle(); + } + } } \ No newline at end of file From 0644569009dc7b616a7001fa25943996348326bf Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Tue, 30 Jul 2024 07:49:31 +0900 Subject: [PATCH 05/30] =?UTF-8?q?SendInitialDataPatch=E3=81=AEGameManager?= =?UTF-8?q?=E5=91=A8=E3=82=8A=E6=A8=99=E6=BA=96=E5=AE=9F=E8=A3=85=E3=81=AB?= =?UTF-8?q?=E8=BF=91=E3=81=A5=E3=81=91=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index e0999a2ce..4171fd3c3 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -202,8 +202,11 @@ public static bool SendInitialDataPatch(InnerNetClient __instance, int clientId) { var hashSet = new System.Collections.Generic.HashSet(); //SendGameManagerの代替。初めに発行する必要があるためここへ。 - WriteSpawnMessageEx(__instance, GameManager.Instance, GameManager.Instance.OwnerId, GameManager.Instance.SpawnFlags, clientId); - hashSet.Add(GameManager.Instance.gameObject); + var gameManager = GameManager.Instance; + if (gameManager && (gameManager.OwnerId != -4 || __instance.AmModdedHost) && hashSet.Add(gameManager.gameObject)) + { + WriteSpawnMessageEx(__instance, gameManager, gameManager.OwnerId, gameManager.SpawnFlags, clientId); + } for (int i = 0; i < __instance.allObjects.Count; i++) { From 947a7b568112a01ef8e5a635e056887067b8a646 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Tue, 30 Jul 2024 23:36:54 +0900 Subject: [PATCH 06/30] =?UTF-8?q?clientId=E9=80=81=E4=BF=A1=E3=82=92Packed?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index 4171fd3c3..5948bfcc8 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -253,7 +253,7 @@ public static void WriteSpawnMessageEx(InnerNetClient __instance, InnerNetObject { msg.StartMessage(6); msg.Write(__instance.GameId); - msg.Write(clientId); + msg.WritePacked(clientId); } { msg.StartMessage(4); From 2d3d8fae55c2effca240589b6ebc8c198af234f5 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Wed, 31 Jul 2024 01:00:40 +0900 Subject: [PATCH 07/30] =?UTF-8?q?=E5=AF=BE=E7=AD=96=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=89=E5=AE=9F=E8=A1=8C=E5=89=8D=E3=81=ABMessage=E3=83=90?= =?UTF-8?q?=E3=83=83=E3=83=95=E3=82=A1=E3=82=92=E9=80=81=E4=BF=A1=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=81=8A=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index 5948bfcc8..7755c1afc 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -132,6 +132,24 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) if (AmongUsClient.Instance.AmHost) GameOptionsSender.SendAllGameOptions(); + //いったんバッファにたまっている分を送信する + for (int j = 0; j < __instance.Streams.Length; j++) + { + MessageWriter messageWriter2 = __instance.Streams[j]; + if (messageWriter2.HasBytes(7)) + { + messageWriter2.EndMessage(); + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"Send Buffer before SendAllStreamedObjects", "InnerNetClient"); + } + __instance.SendOrDisconnect(messageWriter2); + messageWriter2.Clear((SendOption)j); + messageWriter2.StartMessage(5); + messageWriter2.Write(__instance.GameId); + } + } + //9人以上部屋で落ちる現象の対策コード __result = false; var obj = __instance.allObjects; @@ -240,6 +258,24 @@ public static bool SpawnPatch(InnerNetClient __instance, InnerNetObject netObjPa /// public static void WriteSpawnMessageEx(InnerNetClient __instance, InnerNetObject netObjParent, int ownerId, SpawnFlags flags, int clientId = -1) { + //いったんバッファにたまっている分を送信する + for (int j = 0; j < __instance.Streams.Length; j++) + { + MessageWriter messageWriter2 = __instance.Streams[j]; + if (messageWriter2.HasBytes(7)) + { + messageWriter2.EndMessage(); + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"Send Buffer before WriteSpawnMessageEx", "InnerNetClient"); + } + __instance.SendOrDisconnect(messageWriter2); + messageWriter2.Clear((SendOption)j); + messageWriter2.StartMessage(5); + messageWriter2.Write(__instance.GameId); + } + } + Logger.Info($"WriteSpawnMessageEx", "InnerNetClient"); InnerNetObject[] componentsInChildren = netObjParent.GetComponentsInChildren(); From 0a26e5bf9d55effc4fa383697d6b1f0977e7b7e3 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Wed, 31 Jul 2024 01:01:14 +0900 Subject: [PATCH 08/30] =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0?= =?UTF-8?q?=E3=83=A2=E3=83=BC=E3=83=89=E3=81=A7=E3=83=91=E3=82=B1=E3=83=83?= =?UTF-8?q?=E3=83=88=E3=82=B5=E3=82=A4=E3=82=BA=E3=82=92=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=81=AB=E5=87=BA=E3=81=99=E3=82=88=E3=81=86=E3=81=AB=E3=81=97?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index 7755c1afc..f2017361a 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -207,8 +207,14 @@ class InnerNetClientPatch [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.SendOrDisconnect)), HarmonyPrefix] public static void SendOrDisconnectPatch(InnerNetClient __instance, MessageWriter msg) { - if (msg.Length > 1000) + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"SendOrDisconnectPatch:Packet({msg.Length})", "InnerNetClient"); + } + else if (msg.Length > 1000) + { Logger.Info($"SendOrDisconnectPatch:Large Packet({msg.Length})", "InnerNetClient"); + } } [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.SendInitialData)), HarmonyPrefix] public static bool SendInitialDataPatch(InnerNetClient __instance, int clientId) From c4381653278dc3e049bdaea9e62d93535098f598 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:46:34 +0900 Subject: [PATCH 09/30] =?UTF-8?q?=E9=80=81=E5=8F=97=E4=BF=A1=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E3=81=AE=E6=95=B4=E5=82=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index f2017361a..d18bc157b 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -204,12 +204,25 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) [HarmonyPatch] class InnerNetClientPatch { + [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.HandleMessage)), HarmonyPrefix] + public static bool HandleMessagePatch(InnerNetClient __instance, MessageReader reader, SendOption sendOption) + { + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"HandleMessagePatch:Packet({reader.Length}) ,SendOption:{sendOption}", "InnerNetClient"); + } + else if (reader.Length > 1000) + { + Logger.Info($"HandleMessagePatch:Large Packet({reader.Length})", "InnerNetClient"); + } + return true; + } [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.SendOrDisconnect)), HarmonyPrefix] public static void SendOrDisconnectPatch(InnerNetClient __instance, MessageWriter msg) { if (DebugModeManager.IsDebugMode) { - Logger.Info($"SendOrDisconnectPatch:Packet({msg.Length})", "InnerNetClient"); + Logger.Info($"SendOrDisconnectPatch:Packet({msg.Length}) ,SendOption:{msg.SendOption}", "InnerNetClient"); } else if (msg.Length > 1000) { From fd587111f583eaefd2c95797f2695d8bb170646b Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:47:49 +0900 Subject: [PATCH 10/30] =?UTF-8?q?=E3=83=91=E3=82=B1=E3=83=83=E3=83=88?= =?UTF-8?q?=E3=82=92=E3=81=82=E3=82=8B=E7=A8=8B=E5=BA=A6=E3=81=AE=E3=82=B5?= =?UTF-8?q?=E3=82=A4=E3=82=BA=E3=81=AB=E3=81=BE=E3=81=A8=E3=82=81=E3=82=8B?= =?UTF-8?q?=E5=BD=A2=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 188 ++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 125 deletions(-) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index d18bc157b..925b1cb3c 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -132,25 +132,8 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) if (AmongUsClient.Instance.AmHost) GameOptionsSender.SendAllGameOptions(); - //いったんバッファにたまっている分を送信する - for (int j = 0; j < __instance.Streams.Length; j++) - { - MessageWriter messageWriter2 = __instance.Streams[j]; - if (messageWriter2.HasBytes(7)) - { - messageWriter2.EndMessage(); - if (DebugModeManager.IsDebugMode) - { - Logger.Info($"Send Buffer before SendAllStreamedObjects", "InnerNetClient"); - } - __instance.SendOrDisconnect(messageWriter2); - messageWriter2.Clear((SendOption)j); - messageWriter2.StartMessage(5); - messageWriter2.Write(__instance.GameId); - } - } - //9人以上部屋で落ちる現象の対策コード + var sended = false; __result = false; var obj = __instance.allObjects; lock (obj) @@ -158,11 +141,23 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) for (int i = 0; i < __instance.allObjects.Count; i++) { InnerNetObject innerNetObject = __instance.allObjects[i]; - if (innerNetObject && innerNetObject.IsDirty && (innerNetObject.AmOwner || (innerNetObject.OwnerId == -2 && __instance.AmHost))) + if (innerNetObject && innerNetObject.IsDirty && (innerNetObject.AmOwner || + (innerNetObject.OwnerId == -2 && __instance.AmHost))) { - var messageWriter = MessageWriter.Get(SendOption.Reliable); - messageWriter.StartMessage(5); - messageWriter.Write(__instance.GameId); + var messageWriter = __instance.Streams[(byte)innerNetObject.sendMode]; + if (messageWriter.Length > 500) + { + if (!sended) + { + Logger.Info($"SendAllStreamedObjects: Start", "InnerNetClient"); + sended = true; + } + messageWriter.EndMessage(); + __instance.SendOrDisconnect(messageWriter); + messageWriter.Clear(innerNetObject.sendMode); + messageWriter.StartMessage(5); + messageWriter.Write(__instance.GameId); + } messageWriter.StartMessage(1); messageWriter.WritePacked(innerNetObject.NetId); try @@ -177,6 +172,7 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) } if (innerNetObject.Chunked && innerNetObject.IsDirty) { + Logger.Info($"SendAllStreamedObjects: Chunked", "InnerNetClient"); __result = true; } } @@ -185,19 +181,27 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) Logger.Info($"Exception:{ex.Message}", "InnerNetClient"); messageWriter.CancelMessage(); } - if (messageWriter.HasBytes(7)) - { - messageWriter.EndMessage(); - if (DebugModeManager.IsDebugMode) - { - Logger.Info($"SendAllStreamedObjects", "InnerNetClient"); - } - __instance.SendOrDisconnect(messageWriter); - } - messageWriter.Recycle(); } } } + for (int j = 0; j < __instance.Streams.Length; j++) + { + MessageWriter messageWriter2 = __instance.Streams[j]; + if (messageWriter2.HasBytes(7)) + { + if (!sended) + { + Logger.Info($"SendAllStreamedObjects: Start", "InnerNetClient"); + sended = true; + } + messageWriter2.EndMessage(); + __instance.SendOrDisconnect(messageWriter2); + messageWriter2.Clear((SendOption)j); + messageWriter2.StartMessage(5); + messageWriter2.Write(__instance.GameId); + } + } + if (sended) Logger.Info($"SendAllStreamedObjects: End", "InnerNetClient"); return false; } } @@ -232,117 +236,51 @@ public static void SendOrDisconnectPatch(InnerNetClient __instance, MessageWrite [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.SendInitialData)), HarmonyPrefix] public static bool SendInitialDataPatch(InnerNetClient __instance, int clientId) { - Logger.Info($"SendInitialDataPatch:", "InnerNetClient"); - var obj = __instance.allObjects; + Logger.Info($"SendInitialData: Start", "InnerNetClient"); + MessageWriter messageWriter = MessageWriter.Get(SendOption.Reliable); + messageWriter.StartMessage(6); + messageWriter.Write(__instance.GameId); + messageWriter.WritePacked(clientId); + var obj = __instance.allObjects; lock (obj) { var hashSet = new System.Collections.Generic.HashSet(); - //SendGameManagerの代替。初めに発行する必要があるためここへ。 - var gameManager = GameManager.Instance; - if (gameManager && (gameManager.OwnerId != -4 || __instance.AmModdedHost) && hashSet.Add(gameManager.gameObject)) - { - WriteSpawnMessageEx(__instance, gameManager, gameManager.OwnerId, gameManager.SpawnFlags, clientId); - } + //まずはGameManagerを送信 + GameManager gameManager = GameManager.Instance; + __instance.SendGameManager(clientId, gameManager); + hashSet.Add(gameManager.gameObject); for (int i = 0; i < __instance.allObjects.Count; i++) { - var innerNetObject = __instance.allObjects[i]; + InnerNetObject innerNetObject = __instance.allObjects[i]; if (innerNetObject && (innerNetObject.OwnerId != -4 || __instance.AmModdedHost) && hashSet.Add(innerNetObject.gameObject)) { - WriteSpawnMessageEx(__instance, innerNetObject, innerNetObject.OwnerId, innerNetObject.SpawnFlags, clientId); + if (messageWriter.Length > 500) + { + messageWriter.EndMessage(); + __instance.SendOrDisconnect(messageWriter); + messageWriter.Clear(SendOption.Reliable); + messageWriter.StartMessage(6); + messageWriter.Write(__instance.GameId); + messageWriter.WritePacked(clientId); + + } + __instance.WriteSpawnMessage(innerNetObject, innerNetObject.OwnerId, innerNetObject.SpawnFlags, messageWriter); } } } + messageWriter.EndMessage(); + __instance.SendOrDisconnect(messageWriter); + messageWriter.Recycle(); + Logger.Info($"SendInitialData: End", "InnerNetClient"); return false; } [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.Spawn)), HarmonyPrefix] public static bool SpawnPatch(InnerNetClient __instance, InnerNetObject netObjParent, int ownerId, SpawnFlags flags) { Logger.Info($"SpawnPatch", "InnerNetClient"); - if (__instance.AmHost) - { - ownerId = (ownerId == -3) ? __instance.ClientId : ownerId; - WriteSpawnMessageEx(__instance, netObjParent, ownerId, flags); - } - return false; - } - /// - /// WriteSpawnMessageを単一パケットにまとめて発行する。 - /// - /// - /// - /// - /// - /// - public static void WriteSpawnMessageEx(InnerNetClient __instance, InnerNetObject netObjParent, int ownerId, SpawnFlags flags, int clientId = -1) - { - //いったんバッファにたまっている分を送信する - for (int j = 0; j < __instance.Streams.Length; j++) - { - MessageWriter messageWriter2 = __instance.Streams[j]; - if (messageWriter2.HasBytes(7)) - { - messageWriter2.EndMessage(); - if (DebugModeManager.IsDebugMode) - { - Logger.Info($"Send Buffer before WriteSpawnMessageEx", "InnerNetClient"); - } - __instance.SendOrDisconnect(messageWriter2); - messageWriter2.Clear((SendOption)j); - messageWriter2.StartMessage(5); - messageWriter2.Write(__instance.GameId); - } - } - - Logger.Info($"WriteSpawnMessageEx", "InnerNetClient"); - - InnerNetObject[] componentsInChildren = netObjParent.GetComponentsInChildren(); - var msg = MessageWriter.Get(SendOption.Reliable); - if (clientId == -1) - { - msg.StartMessage(5); - msg.Write(__instance.GameId); - } - else - { - msg.StartMessage(6); - msg.Write(__instance.GameId); - msg.WritePacked(clientId); - } - { - msg.StartMessage(4); - { - msg.WritePacked(netObjParent.SpawnId); - msg.WritePacked(ownerId); - msg.Write((byte)flags); - msg.WritePacked(componentsInChildren.Length); - foreach (InnerNetObject innerNetObject in componentsInChildren) - { - innerNetObject.OwnerId = ownerId; - innerNetObject.SpawnFlags = flags; - if (innerNetObject.NetId == 0U) - { - InnerNetObject innerNetObject2 = innerNetObject; - uint netIdCnt = __instance.NetIdCnt; - __instance.NetIdCnt = netIdCnt + 1U; - innerNetObject2.NetId = netIdCnt; - __instance.allObjects.Add(innerNetObject); - __instance.allObjectsFast.Add(innerNetObject.NetId, innerNetObject); - } - msg.WritePacked(innerNetObject.NetId); - msg.StartMessage(1); - { - innerNetObject.Serialize(msg, true); - } - msg.EndMessage(); - } - msg.EndMessage(); - } - msg.EndMessage(); - } - __instance.SendOrDisconnect(msg); - msg.Recycle(); + return true; } } } \ No newline at end of file From a0aa1bfc1555a25c1f45d690d80e721b9e9be297 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Wed, 4 Sep 2024 23:12:36 +0900 Subject: [PATCH 11/30] =?UTF-8?q?=E5=AF=BE=E7=AD=96=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=89=E3=81=AE=E3=82=AA=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/OptionHolder.cs | 5 +++++ Patches/ClientPatch.cs | 3 +++ Resources/string.csv | 1 + 3 files changed, 9 insertions(+) diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs index 44fa7f46d..15d17ff75 100644 --- a/Modules/OptionHolder.cs +++ b/Modules/OptionHolder.cs @@ -328,6 +328,8 @@ public static CustomGameMode CurrentGameMode public static OptionItem KickPlayerFriendCodeNotExist; public static OptionItem ApplyBanList; + public static OptionItem FixSpawnPacketSize; + public static readonly string[] suffixModes = { "SuffixMode.None", @@ -685,6 +687,9 @@ public static void Load() DebugModeManager.SetupCustomOption(); + //9人以上部屋で落ちる現象の対策 + FixSpawnPacketSize = BooleanOptionItem.Create(1_000_200, "FixSpawnPacketSize", false, TabGroup.MainSettings, true) + .SetGameMode(CustomGameMode.All); OptionSaver.Load(); IsLoaded = true; diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index 925b1cb3c..94080a724 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -133,6 +133,8 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) GameOptionsSender.SendAllGameOptions(); //9人以上部屋で落ちる現象の対策コード + if (!Options.FixSpawnPacketSize.GetBool()) return true; + var sended = false; __result = false; var obj = __instance.allObjects; @@ -236,6 +238,7 @@ public static void SendOrDisconnectPatch(InnerNetClient __instance, MessageWrite [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.SendInitialData)), HarmonyPrefix] public static bool SendInitialDataPatch(InnerNetClient __instance, int clientId) { + if (!Options.FixSpawnPacketSize.GetBool()) return true; Logger.Info($"SendInitialData: Start", "InnerNetClient"); MessageWriter messageWriter = MessageWriter.Get(SendOption.Reliable); messageWriter.StartMessage(6); diff --git a/Resources/string.csv b/Resources/string.csv index 9d2263416..0aa264695 100644 --- a/Resources/string.csv +++ b/Resources/string.csv @@ -348,6 +348,7 @@ "ApplyDenyNameList","Apply DenyName List","DenyNameリストを適用する","启用违禁昵称名单","自動禁止具有不良名字的人加入","Применить файл запрещённых имён (DenyName)","Aplicar Lista de Nomes Proibidos (DenyName)","" "KickPlayerFriendCodeNotExist","Kick Players Whose Friend Code Does Not Exist","フレンドコードが存在しないプレイヤーをキックする","踢出好友编号无效的玩家","將沒有好友代碼的玩家自動踢出","Кикнуть игроков у которых нет Кода Друга","Expulsar Jogadores Sem Código de Amigo","" "ApplyBanList","Apply BanList","BANリストを適用する","启用封禁名单","啟用封禁名單","Применить файл с забаненными игроками (BanList)","Aplicar Lista de Banimentos (BanList)","" +"FixSpawnPacketSize","Set When Disconnect above 8-9 People","8~9人以上で切断される現象の修正" "## モード説明" "HideAndSeekInfo","Hide and Seek:\nNo emergency meetings. Crewmates (Blue) can only win by finishing tasks\nand impostors (Red) can only win by killing all crewmates.","かくれんぼ:\n会議を開くことはできず、クルーはタスク完了、インポスターは全クルー殺害でのみ勝利することができる。\nインポスターは赤、クルーは青に体の色が変更される。","躲猫猫:\n不能开会;船员只能通过完成任务获得胜利;\n内鬼需要杀死所有船员来获得胜利;\n内鬼的皮肤颜色将变为红色,船员变为蓝色,以示区分。","躲貓貓:\n不能拍桌或舉報,船員只能做任務\n偽裝者的勝利條件為殺光所有船員\n狼人的顏色會轉變為紅色,船員則會變為藍色。","Прятки:\nНикто не может созвать срочное собрание, Члены Экипажа могут победить, только выполняя задания. \nПредатели меняют цвет тела на красный, а экипажи на синий.","Esconde-Esconde:\nNão há reuniões de emergência. Tripulantes (Azul) podem ganhar apenas ao completar todas as tarefas,\ne Impostores (Vermelho) ganham apenas quando matarem todos os tripulantes.","" From 778e94931cd7d5f290cb3e8ae739a03790900753 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Wed, 4 Sep 2024 23:17:21 +0900 Subject: [PATCH 12/30] =?UTF-8?q?=E4=B8=80=E9=83=A8=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=82=92=E3=83=87=E3=83=90=E3=83=83=E3=82=B0=E3=83=A2=E3=83=BC?= =?UTF-8?q?=E3=83=89=E3=81=AE=E3=81=BF=E3=81=AB=E6=8A=91=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index 94080a724..f85bce9b3 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -151,7 +151,10 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) { if (!sended) { - Logger.Info($"SendAllStreamedObjects: Start", "InnerNetClient"); + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"SendAllStreamedObjects: Start", "InnerNetClient"); + } sended = true; } messageWriter.EndMessage(); @@ -193,7 +196,10 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) { if (!sended) { - Logger.Info($"SendAllStreamedObjects: Start", "InnerNetClient"); + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"SendAllStreamedObjects: Start", "InnerNetClient"); + } sended = true; } messageWriter2.EndMessage(); @@ -203,7 +209,7 @@ public static bool Prefix(InnerNetClient __instance, ref bool __result) messageWriter2.Write(__instance.GameId); } } - if (sended) Logger.Info($"SendAllStreamedObjects: End", "InnerNetClient"); + if (DebugModeManager.IsDebugMode && sended) Logger.Info($"SendAllStreamedObjects: End", "InnerNetClient"); return false; } } @@ -239,7 +245,10 @@ public static void SendOrDisconnectPatch(InnerNetClient __instance, MessageWrite public static bool SendInitialDataPatch(InnerNetClient __instance, int clientId) { if (!Options.FixSpawnPacketSize.GetBool()) return true; - Logger.Info($"SendInitialData: Start", "InnerNetClient"); + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"SendInitialData: Start", "InnerNetClient"); + } MessageWriter messageWriter = MessageWriter.Get(SendOption.Reliable); messageWriter.StartMessage(6); messageWriter.Write(__instance.GameId); @@ -276,13 +285,19 @@ public static bool SendInitialDataPatch(InnerNetClient __instance, int clientId) messageWriter.EndMessage(); __instance.SendOrDisconnect(messageWriter); messageWriter.Recycle(); - Logger.Info($"SendInitialData: End", "InnerNetClient"); + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"SendInitialData: End", "InnerNetClient"); + } return false; } [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.Spawn)), HarmonyPrefix] public static bool SpawnPatch(InnerNetClient __instance, InnerNetObject netObjParent, int ownerId, SpawnFlags flags) { - Logger.Info($"SpawnPatch", "InnerNetClient"); + if (DebugModeManager.IsDebugMode) + { + Logger.Info($"SpawnPatch", "InnerNetClient"); + } return true; } } From f07040399ce1bf78600522d1a61519fa7ec1d888 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Thu, 5 Sep 2024 08:10:24 +0900 Subject: [PATCH 13/30] =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=AE=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/OptionHolder.cs | 8 ++++---- Resources/string.csv | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs index 15d17ff75..91594b76d 100644 --- a/Modules/OptionHolder.cs +++ b/Modules/OptionHolder.cs @@ -368,7 +368,10 @@ public static void Load() { if (IsLoaded) return; OptionSaver.Initialize(); - + //9人以上部屋で落ちる現象の対策 + FixSpawnPacketSize = BooleanOptionItem.Create(1_000_200, "FixSpawnPacketSize", false, TabGroup.MainSettings, true) + .SetColor(new Color32(255, 255, 0, 255)) + .SetGameMode(CustomGameMode.All); // プリセット _ = PresetOptionItem.Create(0, TabGroup.MainSettings) .SetColor(new Color32(204, 204, 0, 255)) @@ -687,9 +690,6 @@ public static void Load() DebugModeManager.SetupCustomOption(); - //9人以上部屋で落ちる現象の対策 - FixSpawnPacketSize = BooleanOptionItem.Create(1_000_200, "FixSpawnPacketSize", false, TabGroup.MainSettings, true) - .SetGameMode(CustomGameMode.All); OptionSaver.Load(); IsLoaded = true; diff --git a/Resources/string.csv b/Resources/string.csv index 0aa264695..57593c62c 100644 --- a/Resources/string.csv +++ b/Resources/string.csv @@ -348,7 +348,7 @@ "ApplyDenyNameList","Apply DenyName List","DenyNameリストを適用する","启用违禁昵称名单","自動禁止具有不良名字的人加入","Применить файл запрещённых имён (DenyName)","Aplicar Lista de Nomes Proibidos (DenyName)","" "KickPlayerFriendCodeNotExist","Kick Players Whose Friend Code Does Not Exist","フレンドコードが存在しないプレイヤーをキックする","踢出好友编号无效的玩家","將沒有好友代碼的玩家自動踢出","Кикнуть игроков у которых нет Кода Друга","Expulsar Jogadores Sem Código de Amigo","" "ApplyBanList","Apply BanList","BANリストを適用する","启用封禁名单","啟用封禁名單","Применить файл с забаненными игроками (BanList)","Aplicar Lista de Banimentos (BanList)","" -"FixSpawnPacketSize","Set When Disconnect above 8-9 People","8~9人以上で切断される現象の修正" +"FixSpawnPacketSize","(Experimental) Only if disconnection occurs with above 8 people.","(試験的機能) 8人以上で切断が発生する場合のみオン" "## モード説明" "HideAndSeekInfo","Hide and Seek:\nNo emergency meetings. Crewmates (Blue) can only win by finishing tasks\nand impostors (Red) can only win by killing all crewmates.","かくれんぼ:\n会議を開くことはできず、クルーはタスク完了、インポスターは全クルー殺害でのみ勝利することができる。\nインポスターは赤、クルーは青に体の色が変更される。","躲猫猫:\n不能开会;船员只能通过完成任务获得胜利;\n内鬼需要杀死所有船员来获得胜利;\n内鬼的皮肤颜色将变为红色,船员变为蓝色,以示区分。","躲貓貓:\n不能拍桌或舉報,船員只能做任務\n偽裝者的勝利條件為殺光所有船員\n狼人的顏色會轉變為紅色,船員則會變為藍色。","Прятки:\nНикто не может созвать срочное собрание, Члены Экипажа могут победить, только выполняя задания. \nПредатели меняют цвет тела на красный, а экипажи на синий.","Esconde-Esconde:\nNão há reuniões de emergência. Tripulantes (Azul) podem ganhar apenas ao completar todas as tarefas,\ne Impostores (Vermelho) ganham apenas quando matarem todos os tripulantes.","" From 9a7bdecb0f8690875c951d70dfa70f6da262ca71 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Wed, 11 Sep 2024 22:52:01 +0900 Subject: [PATCH 14/30] =?UTF-8?q?SpawnPatch=E3=81=A7=E3=82=82=E3=83=91?= =?UTF-8?q?=E3=82=B1=E3=83=83=E3=83=88=E3=81=AE=E9=80=94=E4=B8=AD=E9=80=81?= =?UTF-8?q?=E4=BF=A1=E3=82=92=E5=AE=9F=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Patches/ClientPatch.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Patches/ClientPatch.cs b/Patches/ClientPatch.cs index f85bce9b3..c4752e5b1 100644 --- a/Patches/ClientPatch.cs +++ b/Patches/ClientPatch.cs @@ -291,14 +291,22 @@ public static bool SendInitialDataPatch(InnerNetClient __instance, int clientId) } return false; } - [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.Spawn)), HarmonyPrefix] - public static bool SpawnPatch(InnerNetClient __instance, InnerNetObject netObjParent, int ownerId, SpawnFlags flags) + [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.Spawn)), HarmonyPostfix] + public static void SpawnPatch(InnerNetClient __instance, InnerNetObject netObjParent, int ownerId, SpawnFlags flags) { if (DebugModeManager.IsDebugMode) { Logger.Info($"SpawnPatch", "InnerNetClient"); } - return true; + var messageWriter = __instance.Streams[(byte)SendOption.Reliable]; + if (messageWriter.Length > 500) + { + messageWriter.EndMessage(); + __instance.SendOrDisconnect(messageWriter); + messageWriter.Clear(SendOption.Reliable); + messageWriter.StartMessage(5); + messageWriter.Write(__instance.GameId); + } } } } \ No newline at end of file From ba9316ff08628651114d570c583d057d65fb0bd7 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Fri, 27 Sep 2024 20:13:45 +0900 Subject: [PATCH 15/30] =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=AB=E3=83=80=E3=81=AB=E4=BF=9D=E5=AD=98=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Utils.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 3bcfda84a..5e6949daf 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1045,14 +1045,27 @@ public static string PadRightV2(this object text, int num) return t?.PadRight(Mathf.Max(num - (bc - t.Length), 0)); } public static void DumpLog() + { + var desktop = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); + CopyLog(desktop); + OpenDirectory(desktop); + if (PlayerControl.LocalPlayer != null) + HudManager.Instance?.Chat?.AddChat(PlayerControl.LocalPlayer, "デスクトップにログを保存しました。バグ報告チケットを作成してこのファイルを添付してください。"); + } + public static void SaveNowLog() + { + var logs = Directory.CreateDirectory("TOH_LOGS"); + // 7日以上前のログを削除 + logs.EnumerateFiles().Where(f => f.CreationTime < DateTime.Now.AddDays(-7)).ToList().ForEach(f => f.Delete()); + CopyLog(logs.FullName); + } + public static void CopyLog(string folder) { string t = DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss"); - string fileName = $"{Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)}/TownOfHost-v{Main.PluginVersion}-{t}.log"; + string fileName = $"{folder}/TownOfHost-v{Main.PluginVersion}-{t}.log"; FileInfo file = new(@$"{Environment.CurrentDirectory}/BepInEx/LogOutput.log"); file.CopyTo(fileName); - OpenDirectory(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)); - if (PlayerControl.LocalPlayer != null) - HudManager.Instance?.Chat?.AddChat(PlayerControl.LocalPlayer, "デスクトップにログを保存しました。バグ報告チケットを作成してこのファイルを添付してください。"); + } public static void OpenDirectory(string path) { From aa35503613a2f877da1cac053d912f0e9e4b9aaf Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Fri, 27 Sep 2024 20:19:26 +0900 Subject: [PATCH 16/30] =?UTF-8?q?=E3=82=A2=E3=83=97=E3=83=AA=E7=B5=82?= =?UTF-8?q?=E4=BA=86=E6=99=82=E3=81=AB=E3=83=AD=E3=82=B0=E3=82=92=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E3=81=99=E3=82=8B=E8=A8=AD=E5=AE=9A=E3=81=AE=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/main.cs b/main.cs index 6e572f8b6..6c9be4baf 100644 --- a/main.cs +++ b/main.cs @@ -247,6 +247,7 @@ public override void Load() SystemEnvironment.SetEnvironmentVariables(); Harmony.PatchAll(); + Application.quitting += new Action(Utils.SaveNowLog); } } public enum CustomDeathReason From a109f781ef848f06dd6c7cf3e5ab71e7d9584343 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Sun, 29 Sep 2024 00:25:46 +0900 Subject: [PATCH 17/30] =?UTF-8?q?TOH=E8=A8=AD=E5=AE=9A=E3=81=AB=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80=E3=82=92=E9=96=8B?= =?UTF-8?q?=E3=81=8F=E3=83=9C=E3=82=BF=E3=83=B3=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Utils.cs | 5 +++++ Patches/ClientOptionsPatch.cs | 5 +++++ Resources/string.csv | 1 + 3 files changed, 11 insertions(+) diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 5e6949daf..0a90b2f69 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1067,6 +1067,11 @@ public static void CopyLog(string folder) file.CopyTo(fileName); } + public static void OpenLogFolder() + { + var logs = Directory.CreateDirectory("TOH_LOGS"); + OpenDirectory(logs.FullName); + } public static void OpenDirectory(string path) { var startInfo = new ProcessStartInfo(path) diff --git a/Patches/ClientOptionsPatch.cs b/Patches/ClientOptionsPatch.cs index 30e678587..c70c8077b 100644 --- a/Patches/ClientOptionsPatch.cs +++ b/Patches/ClientOptionsPatch.cs @@ -11,6 +11,7 @@ public static class OptionsMenuBehaviourStartPatch private static ClientActionItem JapaneseRoleName; private static ClientActionItem UnloadMod; private static ClientActionItem DumpLog; + private static ClientActionItem OpenLogFolder; public static void Postfix(OptionsMenuBehaviour __instance) { @@ -35,6 +36,10 @@ public static void Postfix(OptionsMenuBehaviour __instance) { DumpLog = ClientActionItem.Create("DumpLog", Utils.DumpLog, __instance); } + if (OpenLogFolder == null || OpenLogFolder.ToggleButton == null) + { + OpenLogFolder = ClientActionItem.Create("OpenLogFolder", Utils.OpenLogFolder, __instance); + } if (ModUnloaderScreen.Popup == null) { diff --git a/Resources/string.csv b/Resources/string.csv index 57593c62c..8c74084f3 100644 --- a/Resources/string.csv +++ b/Resources/string.csv @@ -557,6 +557,7 @@ "Cancel","Cancel","キャンセル","取消","","Отменить","Cancelar","" "Unload","DISABLE","無効化","确认","","ОТКЛЮЧИТЬ","DESATIVAR","" "DumpLog","Output Log","ログを出力","输出日志","","Вывести Журнал","Log de Saída","" +"OpenLogFolder","Open Log Folder","ログフォルダを開く" "## ヘルプテキスト" "CommandList","Command List:","コマンド一覧:","指令列表:","指令列表:","Список команд:","Lista de Comandos:","" From aaf62c147388f16945285f6766fad53e9567e3fc Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Sun, 29 Sep 2024 01:07:40 +0900 Subject: [PATCH 18/30] =?UTF-8?q?=E3=83=AD=E3=82=B0=E5=87=BA=E5=8A=9B?= =?UTF-8?q?=E6=99=82=E3=81=AB=E5=87=BA=E5=8A=9B=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=92=E9=81=B8=E6=8A=9E=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Utils.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 0a90b2f69..9a6230bbf 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1072,13 +1072,9 @@ public static void OpenLogFolder() var logs = Directory.CreateDirectory("TOH_LOGS"); OpenDirectory(logs.FullName); } - public static void OpenDirectory(string path) - { - var startInfo = new ProcessStartInfo(path) + public static void OpenDirectory(string path, string filename = null) { - UseShellExecute = true, - }; - Process.Start(startInfo); + Process.Start("Explorer.exe", filename != null ? $"/select,{filename}" : path); } public static string SummaryTexts(byte id, bool isForChat) { From da288117383fd6ec0d70bc704c77dd8ac1021e2d Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Sun, 29 Sep 2024 01:08:24 +0900 Subject: [PATCH 19/30] =?UTF-8?q?=E3=82=B3=E3=83=94=E3=83=BC=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=83=AD=E3=82=B0=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E5=90=8D=E3=82=92=E8=BF=94=E3=81=99=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Utils.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 9a6230bbf..240a4f6e8 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1059,13 +1059,13 @@ public static void SaveNowLog() logs.EnumerateFiles().Where(f => f.CreationTime < DateTime.Now.AddDays(-7)).ToList().ForEach(f => f.Delete()); CopyLog(logs.FullName); } - public static void CopyLog(string folder) + public static string CopyLog(string folder) { string t = DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss"); string fileName = $"{folder}/TownOfHost-v{Main.PluginVersion}-{t}.log"; FileInfo file = new(@$"{Environment.CurrentDirectory}/BepInEx/LogOutput.log"); - file.CopyTo(fileName); - + var logFile = file.CopyTo(fileName); + return logFile.FullName; } public static void OpenLogFolder() { From 8cfac5d52c7b28a7e52c08936c33657c123e0b37 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Sun, 29 Sep 2024 01:09:25 +0900 Subject: [PATCH 20/30] =?UTF-8?q?=E3=83=AD=E3=82=B0=E5=87=BA=E5=8A=9B?= =?UTF-8?q?=E3=82=82=E3=83=AD=E3=82=B0=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80?= =?UTF-8?q?=E3=81=AB=E5=87=BA=E5=8A=9B=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Utils.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 240a4f6e8..a379ba4bd 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1044,17 +1044,21 @@ public static string PadRightV2(this object text, int num) foreach (char c in t) bc += Encoding.GetEncoding("UTF-8").GetByteCount(c.ToString()) == 1 ? 1 : 2; return t?.PadRight(Mathf.Max(num - (bc - t.Length), 0)); } + public static DirectoryInfo GetLogFolder() + { + return Directory.CreateDirectory("TOH_LOGS"); + } public static void DumpLog() { - var desktop = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); - CopyLog(desktop); - OpenDirectory(desktop); + var logs = GetLogFolder(); + var filename = CopyLog(logs.FullName); + OpenDirectory("", filename); if (PlayerControl.LocalPlayer != null) - HudManager.Instance?.Chat?.AddChat(PlayerControl.LocalPlayer, "デスクトップにログを保存しました。バグ報告チケットを作成してこのファイルを添付してください。"); + HudManager.Instance?.Chat?.AddChat(PlayerControl.LocalPlayer, "ログフォルダにログを保存しました。バグ報告チケットを作成してこのファイルを添付してください。"); } public static void SaveNowLog() { - var logs = Directory.CreateDirectory("TOH_LOGS"); + var logs = GetLogFolder(); // 7日以上前のログを削除 logs.EnumerateFiles().Where(f => f.CreationTime < DateTime.Now.AddDays(-7)).ToList().ForEach(f => f.Delete()); CopyLog(logs.FullName); @@ -1069,11 +1073,11 @@ public static string CopyLog(string folder) } public static void OpenLogFolder() { - var logs = Directory.CreateDirectory("TOH_LOGS"); + var logs = GetLogFolder(); OpenDirectory(logs.FullName); } public static void OpenDirectory(string path, string filename = null) - { + { Process.Start("Explorer.exe", filename != null ? $"/select,{filename}" : path); } public static string SummaryTexts(byte id, bool isForChat) From 9e08765602b29717e8b56e7c04a496a733f1a5f1 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Sun, 29 Sep 2024 01:21:29 +0900 Subject: [PATCH 21/30] =?UTF-8?q?=E3=82=AA=E3=83=BC=E3=83=88=E3=83=AD?= =?UTF-8?q?=E3=82=B0=E3=81=AE=E3=83=95=E3=82=A9=E3=83=AB=E3=83=80=E3=82=92?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Utils.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Modules/Utils.cs b/Modules/Utils.cs index a379ba4bd..a74bcf0e0 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1044,9 +1044,14 @@ public static string PadRightV2(this object text, int num) foreach (char c in t) bc += Encoding.GetEncoding("UTF-8").GetByteCount(c.ToString()) == 1 ? 1 : 2; return t?.PadRight(Mathf.Max(num - (bc - t.Length), 0)); } - public static DirectoryInfo GetLogFolder() + public static DirectoryInfo GetLogFolder(bool auto = false) { - return Directory.CreateDirectory("TOH_LOGS"); + var folder = Directory.CreateDirectory("TOH_LOGS"); + if (auto) + { + folder = Directory.CreateDirectory($"{folder.FullName}/AutoLogs"); + } + return folder; } public static void DumpLog() { @@ -1058,7 +1063,7 @@ public static void DumpLog() } public static void SaveNowLog() { - var logs = GetLogFolder(); + var logs = GetLogFolder(true); // 7日以上前のログを削除 logs.EnumerateFiles().Where(f => f.CreationTime < DateTime.Now.AddDays(-7)).ToList().ForEach(f => f.Delete()); CopyLog(logs.FullName); From 0957bf0d7909fe7b735e88108959f777099982b4 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Sun, 29 Sep 2024 01:36:58 +0900 Subject: [PATCH 22/30] =?UTF-8?q?OpenDirectory=E3=81=AE=E7=B0=A1=E7=95=A5?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Utils.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/Utils.cs b/Modules/Utils.cs index a74bcf0e0..a428fd0b6 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1057,7 +1057,7 @@ public static void DumpLog() { var logs = GetLogFolder(); var filename = CopyLog(logs.FullName); - OpenDirectory("", filename); + OpenDirectory(filename); if (PlayerControl.LocalPlayer != null) HudManager.Instance?.Chat?.AddChat(PlayerControl.LocalPlayer, "ログフォルダにログを保存しました。バグ報告チケットを作成してこのファイルを添付してください。"); } @@ -1068,22 +1068,22 @@ public static void SaveNowLog() logs.EnumerateFiles().Where(f => f.CreationTime < DateTime.Now.AddDays(-7)).ToList().ForEach(f => f.Delete()); CopyLog(logs.FullName); } - public static string CopyLog(string folder) + public static string CopyLog(string path) { string t = DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss"); - string fileName = $"{folder}/TownOfHost-v{Main.PluginVersion}-{t}.log"; + string fileName = $"{path}/TownOfHost-v{Main.PluginVersion}-{t}.log"; FileInfo file = new(@$"{Environment.CurrentDirectory}/BepInEx/LogOutput.log"); var logFile = file.CopyTo(fileName); return logFile.FullName; } public static void OpenLogFolder() { - var logs = GetLogFolder(); + var logs = GetLogFolder(true); OpenDirectory(logs.FullName); } - public static void OpenDirectory(string path, string filename = null) + public static void OpenDirectory(string path) { - Process.Start("Explorer.exe", filename != null ? $"/select,{filename}" : path); + Process.Start("Explorer.exe", $"/select,{path}"); } public static string SummaryTexts(byte id, bool isForChat) { From ffa2c6613de42252336bb5d106346d5c9a0e1255 Mon Sep 17 00:00:00 2001 From: yurinakira Date: Sun, 29 Sep 2024 21:08:02 +0900 Subject: [PATCH 23/30] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=82=925.1.9=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cs b/main.cs index 6e572f8b6..a41c6079f 100644 --- a/main.cs +++ b/main.cs @@ -51,7 +51,7 @@ public class Main : BasePlugin // ========== //Sorry for many Japanese comments. public const string PluginGuid = "com.emptybottle.townofhost"; - public const string PluginVersion = "5.1.8"; + public const string PluginVersion = "5.1.9"; // サポートされている最低のAmongUsバージョン public static readonly string LowestSupportedVersion = "2024.8.13"; // このバージョンのみで公開ルームを無効にする場合 From abef1ea79b616539063af2fe96b3d1a989b4128e Mon Sep 17 00:00:00 2001 From: yurinakira Date: Tue, 1 Oct 2024 15:50:26 +0900 Subject: [PATCH 24/30] =?UTF-8?q?=E3=83=AD=E3=82=B0=E5=87=BA=E5=8A=9B?= =?UTF-8?q?=E6=99=82=E3=81=AE=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=81=AE=E7=BF=BB=E8=A8=B3=E5=AF=BE=E5=BF=9C(=E8=8B=B1?= =?UTF-8?q?=E8=AA=9E,=E6=97=A5=E6=9C=AC=E8=AA=9E)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Utils.cs | 2 +- Resources/string.csv | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/Utils.cs b/Modules/Utils.cs index a428fd0b6..5e0dd2776 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1059,7 +1059,7 @@ public static void DumpLog() var filename = CopyLog(logs.FullName); OpenDirectory(filename); if (PlayerControl.LocalPlayer != null) - HudManager.Instance?.Chat?.AddChat(PlayerControl.LocalPlayer, "ログフォルダにログを保存しました。バグ報告チケットを作成してこのファイルを添付してください。"); + HudManager.Instance?.Chat?.AddChat(PlayerControl.LocalPlayer, Translator.GetString("Message.LogsSavedInLogsFolder")); } public static void SaveNowLog() { diff --git a/Resources/string.csv b/Resources/string.csv index 8c74084f3..dc8fa0f82 100644 --- a/Resources/string.csv +++ b/Resources/string.csv @@ -593,6 +593,7 @@ "Message.ExportedOptions","Exported options","オプションデータを出力しました","输出选项数据到文件","","Экспортированные настройки","Opções exportadas","" "Message.LoadedOptions","Loaded options","オプションデータを読み込みました","数据选项已加载","","Загруженные настройки","Opções carregadas","" "Message.OnlyHostCanLoadOptions","Only the host can load options","ホストのみがオプションを読み込めます","只有房主可以加载数据选项","","Только хост может загружать настройки","Apenas o anfitrião pode carregar opções","" +"Message.LogsSavedInLogsFolder","Logs saved in the logs folder.Please create a bug ticket and attach this file.","ログフォルダにログを保存しました。バグ報告チケットを作成してこのファイルを添付してください。","","","","","" "## 警告" "Warning.EgoistCannotWin","Egoist cannot win","エゴイストが勝利できません","野心家无法获胜","利己主義者無法獲勝","Эгоист не может победить!","Egoísta não pode vencer","" From 79b0b3f5d5e1c1ec4b07e758d53ab9a7b278cd43 Mon Sep 17 00:00:00 2001 From: yurinakira Date: Tue, 1 Oct 2024 16:40:32 +0900 Subject: [PATCH 25/30] =?UTF-8?q?9=E4=BA=BA=E4=BB=A5=E4=B8=8A=E3=81=A7?= =?UTF-8?q?=E5=88=87=E6=96=AD=E3=81=95=E3=82=8C=E3=82=8B=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E3=81=AEREADME=E3=81=AB=E3=82=A2=E3=83=8A=E3=82=A6=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README-EN.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README-EN.md b/README-EN.md index 739963a69..e55783ca1 100644 --- a/README-EN.md +++ b/README-EN.md @@ -41,6 +41,7 @@ Note that if a player other than the host plays with this mod installed, the fol - Sheriff, Arsonist, Jackal, and other roles can close doors, but please don't use it because the system can't limit it. - The dead player chat can be seen when exile screen by anti blackout, but this is not a bug. - The "Confirm Ejects" option will not work if any of the following roles are enabled: Sheriff, Arsonist, Jackal, PlagueDoctor. +- When more than about 9 players join a lobby, sometimes particular players may get disconnected.To address this issue, we have added an optional countermeasure function on a trial basis.Host players who are experiencing this issue should enable the countermeasure function and use it. ## Features ### Hotkeys diff --git a/README.md b/README.md index bdc72ca4c..60e79fe57 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ AmongUsバージョン : **2024.8.13** - シェリフ、アーソニスト、ジャッカル等の役職がドア閉めを行えますが、システムで制限することができないため使わないようお願いします。 - 暗転対策関係で追放画面で死人がチャットをすると見えますが、バグではありません。 - シェリフ、アーソニスト、ジャッカル、ペスト医師のいずれかが有効な場合、バニラの「追放を確認」オプションが正常に動作しません。 +- 参加人数が9人程度を上回った場合に特定の人が切断される問題の対策として、試験的に対策機能のオプションを追加しています。問題が発生しているホストプレイヤーは対策機能を有効化して利用してください。 ## 機能 ### ホットキー From 6a61635b2e6254f2aeafaad4d0f8d7d927377bf3 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Tue, 1 Oct 2024 19:36:54 +0900 Subject: [PATCH 26/30] =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=AB=E3=83=80=E3=82=92=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Utils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Utils.cs b/Modules/Utils.cs index a428fd0b6..11e0ba60d 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1046,7 +1046,7 @@ public static string PadRightV2(this object text, int num) } public static DirectoryInfo GetLogFolder(bool auto = false) { - var folder = Directory.CreateDirectory("TOH_LOGS"); + var folder = Directory.CreateDirectory($"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}/TownOfHost/Logs"); if (auto) { folder = Directory.CreateDirectory($"{folder.FullName}/AutoLogs"); From e32fd062bc460127ca126baa344799de1daba5f6 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Tue, 1 Oct 2024 19:37:43 +0900 Subject: [PATCH 27/30] =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=AB=E3=83=80=E3=82=92=E7=92=B0=E5=A2=83=E5=A4=89=E6=95=B0?= =?UTF-8?q?=E3=81=AB=E7=99=BB=E9=8C=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/SystemEnvironment.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modules/SystemEnvironment.cs b/Modules/SystemEnvironment.cs index 8ad623fa2..14da8860b 100644 --- a/Modules/SystemEnvironment.cs +++ b/Modules/SystemEnvironment.cs @@ -8,5 +8,7 @@ public static void SetEnvironmentVariables() { // ユーザ環境変数に最近開かれたTOHアモアスフォルダのパスを設定 Environment.SetEnvironmentVariable("TOWN_OF_HOST_DIR_ROOT", Environment.CurrentDirectory, EnvironmentVariableTarget.User); + // ユーザ環境変数にログフォルダのパスを設定 + Environment.SetEnvironmentVariable("TOWN_OF_HOST_DIR_LOGS", Utils.GetLogFolder().FullName, EnvironmentVariableTarget.User); } } From daa1c5fed371578db369e2645bc9cec25e37dee6 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:00:53 +0900 Subject: [PATCH 28/30] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=85=88=E3=82=92Among?= =?UTF-8?q?Us=E3=81=AE=E3=83=87=E3=83=BC=E3=82=BF=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=AB=E3=83=80=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Modules/Utils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 11e0ba60d..f97b8d0cc 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1046,7 +1046,7 @@ public static string PadRightV2(this object text, int num) } public static DirectoryInfo GetLogFolder(bool auto = false) { - var folder = Directory.CreateDirectory($"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}/TownOfHost/Logs"); + var folder = Directory.CreateDirectory($"{Application.persistentDataPath}/TownOfHost/Logs"); if (auto) { folder = Directory.CreateDirectory($"{folder.FullName}/AutoLogs"); From 87210e4baf15f460cdb47508e969ba6489ee1027 Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:12:56 +0900 Subject: [PATCH 29/30] =?UTF-8?q?=E5=88=87=E6=96=AD=E8=80=85=E3=81=8C?= =?UTF-8?q?=E7=99=BA=E7=94=9F=E3=81=97=E3=81=9F=E6=99=82=E3=81=AE=E3=81=BF?= =?UTF-8?q?=E3=81=A8=E5=BC=B7=E8=AA=BF=E3=81=97=E3=81=9F=E8=A1=A8=E7=8F=BE?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README-EN.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README-EN.md b/README-EN.md index e55783ca1..722586f31 100644 --- a/README-EN.md +++ b/README-EN.md @@ -41,7 +41,7 @@ Note that if a player other than the host plays with this mod installed, the fol - Sheriff, Arsonist, Jackal, and other roles can close doors, but please don't use it because the system can't limit it. - The dead player chat can be seen when exile screen by anti blackout, but this is not a bug. - The "Confirm Ejects" option will not work if any of the following roles are enabled: Sheriff, Arsonist, Jackal, PlagueDoctor. -- When more than about 9 players join a lobby, sometimes particular players may get disconnected.To address this issue, we have added an optional countermeasure function on a trial basis.Host players who are experiencing this issue should enable the countermeasure function and use it. +- When more than about 9 players join a lobby, sometimes particular players may get disconnected.To address this issue, we have added an optional countermeasure function on a trial basis. Please Turn ON only when disconnections occurs. ## Features ### Hotkeys diff --git a/README.md b/README.md index 60e79fe57..45271a690 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ AmongUsバージョン : **2024.8.13** - シェリフ、アーソニスト、ジャッカル等の役職がドア閉めを行えますが、システムで制限することができないため使わないようお願いします。 - 暗転対策関係で追放画面で死人がチャットをすると見えますが、バグではありません。 - シェリフ、アーソニスト、ジャッカル、ペスト医師のいずれかが有効な場合、バニラの「追放を確認」オプションが正常に動作しません。 -- 参加人数が9人程度を上回った場合に特定の人が切断される問題の対策として、試験的に対策機能のオプションを追加しています。問題が発生しているホストプレイヤーは対策機能を有効化して利用してください。 +- 参加人数が9人程度を上回った場合に特定の人が切断される問題の対策として、試験的に対策機能のオプションを追加しています。 切断者が発生する場合のみONにしてください。 ## 機能 ### ホットキー From 2f1bc6137830d11f7966265bed4b59bf5d2130de Mon Sep 17 00:00:00 2001 From: kou-hetare <96226646+kou-hetare@users.noreply.github.com> Date: Tue, 1 Oct 2024 21:29:05 +0900 Subject: [PATCH 30/30] =?UTF-8?q?=E3=83=AD=E3=82=B0=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=81=AE=E5=A4=89=E6=9B=B4=E3=81=AB=E3=81=A4=E3=81=84=E3=81=A6?= =?UTF-8?q?=E8=A8=98=E8=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README-EN.md | 4 +++- README.md | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README-EN.md b/README-EN.md index 722586f31..d5911d926 100644 --- a/README-EN.md +++ b/README-EN.md @@ -42,6 +42,8 @@ Note that if a player other than the host plays with this mod installed, the fol - The dead player chat can be seen when exile screen by anti blackout, but this is not a bug. - The "Confirm Ejects" option will not work if any of the following roles are enabled: Sheriff, Arsonist, Jackal, PlagueDoctor. - When more than about 9 players join a lobby, sometimes particular players may get disconnected.To address this issue, we have added an optional countermeasure function on a trial basis. Please Turn ON only when disconnections occurs. +- The folder for log output has been changed. To see where they are saved, select Open Log Folder from the TOH settings screen. +- Successful completion is now automatically saved in the log folder. ## Features ### Hotkeys @@ -62,7 +64,7 @@ Note that if a player other than the host plays with this mod installed, the fol | HotKey | Function | Usable Scene | | ----------- | ---------------------------------------------------------------------------------- | ------------- | | `Tab` | Option list page feed | Lobby | -| `Ctrl`+`F1` | Output log to desktop | Anywhere | +| `Ctrl`+`F1` | Output log to Log Folder | Anywhere | | `F10` | Open AmongUs folder | Anywhere | | `F11` | Change resolution
480x270 → 640x360 → 800x450 → 1280x720 → 1600x900 → 1920x1080 | Anywhere | | `T`+`F5` | Reload custom translation file | Anywhere | diff --git a/README.md b/README.md index 45271a690..412a7b8c1 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,9 @@ AmongUsバージョン : **2024.8.13** - シェリフ、アーソニスト、ジャッカル等の役職がドア閉めを行えますが、システムで制限することができないため使わないようお願いします。 - 暗転対策関係で追放画面で死人がチャットをすると見えますが、バグではありません。 - シェリフ、アーソニスト、ジャッカル、ペスト医師のいずれかが有効な場合、バニラの「追放を確認」オプションが正常に動作しません。 -- 参加人数が9人程度を上回った場合に特定の人が切断される問題の対策として、試験的に対策機能のオプションを追加しています。 切断者が発生する場合のみONにしてください。 +- 参加人数が9人程度を上回った場合に特定の人が切断される問題の対策として、試験的に対策機能のオプションを追加しています。 切断者が発生する場合のみONにしてください。 +- ログ出力するフォルダを変更しました。保存先を確認するにはTOHの設定画面からログフォルダを開くを選択してください。 +- 正常に終了した場合、ログフォルダに自動保存されるようになりました。 ## 機能 ### ホットキー @@ -62,7 +64,7 @@ AmongUsバージョン : **2024.8.13** | キー | 機能 | 使えるシーン | | ----------- | ----------------------------------------------------------------------------- | --------------- | | `Tab` | オプション一覧のページ送り | ロビー | -| `Ctrl`+`F1` | ログをデスクトップに出力 | どこでも | +| `Ctrl`+`F1` | ログをログフォルダに出力 | どこでも | | `F10` | AmongUsのフォルダを開く | どこでも | | `F11` | 解像度を変更
480x270 → 640x360 → 800x450 → 1280x720 → 1600x900 → 1920x1080 | どこでも | | `T`+`F5` | カスタム翻訳ファイルのリロード | どこでも |