From fc79bd1536887a03ac8aa425505ed0c295ffe09c Mon Sep 17 00:00:00 2001 From: miniduikboot Date: Sun, 30 Jun 2024 23:29:53 +0200 Subject: [PATCH] Add Message24EndGameHostMigration serialization Looks like Innersloth added this but hasn't actually used this. Weird.. When sent it makes the new host perform a full rejoin, which gums up Impostor's spawning logic. Fixing that causes the client to gum itself up. Sigh. After some testing it seems like host migration still works fine, so this investigation wasn't needed. Committing for posterity. Co-Authored-By: js6pak --- src/Impostor.Api/Net/Messages/MessageFlags.cs | 1 + .../S2C/Message24EndGameHostMigrationS2C.cs | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/Impostor.Api/Net/Messages/S2C/Message24EndGameHostMigrationS2C.cs diff --git a/src/Impostor.Api/Net/Messages/MessageFlags.cs b/src/Impostor.Api/Net/Messages/MessageFlags.cs index 8be5a58..a1a9a11 100644 --- a/src/Impostor.Api/Net/Messages/MessageFlags.cs +++ b/src/Impostor.Api/Net/Messages/MessageFlags.cs @@ -28,6 +28,7 @@ namespace Impostor.Api.Net.Messages public const byte SetActivePodType = 21; public const byte QueryPlatformIds = 22; public const byte QueryLobbyInfo = 23; + public const byte EndGameHostMigration = 24; private static readonly Dictionary FlagCache; diff --git a/src/Impostor.Api/Net/Messages/S2C/Message24EndGameHostMigrationS2C.cs b/src/Impostor.Api/Net/Messages/S2C/Message24EndGameHostMigrationS2C.cs new file mode 100644 index 0000000..18f1d24 --- /dev/null +++ b/src/Impostor.Api/Net/Messages/S2C/Message24EndGameHostMigrationS2C.cs @@ -0,0 +1,21 @@ +using Impostor.Api.Games; + +namespace Impostor.Api.Net.Messages.S2C +{ + public class Message24EndGameHostMigrationS2C + { + public static void Serialize(IMessageWriter writer, GameCode gameCode, int hostClientId) + { + writer.StartMessage(MessageFlags.EndGameHostMigration); + gameCode.Serialize(writer); + writer.Write(hostClientId); + writer.EndMessage(); + } + + public static void Deserialize(IMessageReader reader, out GameCode gameCode, out int hostClientId) + { + gameCode = reader.ReadInt32(); + hostClientId = reader.ReadInt32(); + } + } +} -- 2.39.5