From 408ff4672ec0827050ce3b287689033e643340a2 Mon Sep 17 00:00:00 2001 From: Xilophor Date: Sun, 2 Mar 2025 20:20:34 -0500 Subject: [PATCH 1/2] Add increased debug logging --- LobbyCompatibility/Features/LobbyHelper.cs | 1 + LobbyCompatibility/Patches/LobbyDataIsJoinablePostfix.cs | 2 ++ LobbyCompatibility/Patches/SetLoadingScreenPrefix.cs | 8 +++++--- .../Patches/SteamMatchmakingOnLobbyCreatedPostfix.cs | 3 +++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/LobbyCompatibility/Features/LobbyHelper.cs b/LobbyCompatibility/Features/LobbyHelper.cs index fc26bdf..0e24abe 100644 --- a/LobbyCompatibility/Features/LobbyHelper.cs +++ b/LobbyCompatibility/Features/LobbyHelper.cs @@ -21,6 +21,7 @@ public static class LobbyHelper public static LobbyDistanceFilter? LatestLobbyRequestDistanceFilter; private static List? _clientPlugins; public static LobbyDiff LatestLobbyDiff { get; private set; } = new(new List()); + public static IEnumerable>? LatestLobbyData { get; internal set; } private static Dictionary LobbyDiffCache { get; } = new(); /// diff --git a/LobbyCompatibility/Patches/LobbyDataIsJoinablePostfix.cs b/LobbyCompatibility/Patches/LobbyDataIsJoinablePostfix.cs index bb34233..19192f7 100644 --- a/LobbyCompatibility/Patches/LobbyDataIsJoinablePostfix.cs +++ b/LobbyCompatibility/Patches/LobbyDataIsJoinablePostfix.cs @@ -20,6 +20,8 @@ internal static class LobbyDataIsJoinablePostfix [HarmonyPostfix] private static bool Postfix(bool isJoinable, ref Lobby lobby) { + LobbyHelper.LatestLobbyData = lobby.Data; + // If original result was false, return false -- if lobby is modded through our mod, it will be Joinable || JoinableModded if (!isJoinable) return false; diff --git a/LobbyCompatibility/Patches/SetLoadingScreenPrefix.cs b/LobbyCompatibility/Patches/SetLoadingScreenPrefix.cs index c72efcf..c887e33 100644 --- a/LobbyCompatibility/Patches/SetLoadingScreenPrefix.cs +++ b/LobbyCompatibility/Patches/SetLoadingScreenPrefix.cs @@ -2,6 +2,7 @@ using LobbyCompatibility.Behaviours; using LobbyCompatibility.Features; using Steamworks; +using Steamworks.Data; namespace LobbyCompatibility.Patches; @@ -24,9 +25,10 @@ private static bool Prefix(bool isLoading, RoomEnter result, MenuManager __insta if (result != RoomEnter.Error) return true; - LobbyCompatibilityPlugin.Logger?.LogDebug("Error while joining! Logging Diff..."); - LobbyCompatibilityPlugin.Logger?.LogDebug( - LobbyHelper.LatestLobbyDiff.PluginDiffs.Join(converter: diff => diff.GetDisplayText())); + LobbyCompatibilityPlugin.Logger?.LogError("Error while joining! Logging Lobby Data..."); + LobbyCompatibilityPlugin.Logger?.LogDebug(LobbyHelper.LatestLobbyData.Join()); + LobbyCompatibilityPlugin.Logger?.LogError("Logging Client Mods..."); + LobbyCompatibilityPlugin.Logger?.LogDebug(PluginHelper.GetAllPluginInfo().CalculateCompatibilityLevel(lobbyData: LobbyHelper.LatestLobbyData).Join()); if (!string.IsNullOrEmpty(GameNetworkManager.Instance.disconnectionReasonMessage)) return true; diff --git a/LobbyCompatibility/Patches/SteamMatchmakingOnLobbyCreatedPostfix.cs b/LobbyCompatibility/Patches/SteamMatchmakingOnLobbyCreatedPostfix.cs index 46ea4c7..bd5e6ea 100644 --- a/LobbyCompatibility/Patches/SteamMatchmakingOnLobbyCreatedPostfix.cs +++ b/LobbyCompatibility/Patches/SteamMatchmakingOnLobbyCreatedPostfix.cs @@ -58,5 +58,8 @@ private static void Postfix(Result result, ref Lobby lobby) if (lobby.GetData(LobbyMetadata.Tag) == "none") lobby.SetData(LobbyMetadata.Tag, "modded"); } + + // Log Lobby Data + LobbyCompatibilityPlugin.Logger?.LogDebug(lobby.Data.Join()); } } \ No newline at end of file From 3d41e5cf940dc091a00e23c5112379a40ae4c63f Mon Sep 17 00:00:00 2001 From: Xilophor Date: Sun, 11 May 2025 12:32:45 -0400 Subject: [PATCH 2/2] Removed two unnecessary logging lines as recommended --- LobbyCompatibility/Patches/SetLoadingScreenPrefix.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/LobbyCompatibility/Patches/SetLoadingScreenPrefix.cs b/LobbyCompatibility/Patches/SetLoadingScreenPrefix.cs index c887e33..0427e92 100644 --- a/LobbyCompatibility/Patches/SetLoadingScreenPrefix.cs +++ b/LobbyCompatibility/Patches/SetLoadingScreenPrefix.cs @@ -25,9 +25,7 @@ private static bool Prefix(bool isLoading, RoomEnter result, MenuManager __insta if (result != RoomEnter.Error) return true; - LobbyCompatibilityPlugin.Logger?.LogError("Error while joining! Logging Lobby Data..."); LobbyCompatibilityPlugin.Logger?.LogDebug(LobbyHelper.LatestLobbyData.Join()); - LobbyCompatibilityPlugin.Logger?.LogError("Logging Client Mods..."); LobbyCompatibilityPlugin.Logger?.LogDebug(PluginHelper.GetAllPluginInfo().CalculateCompatibilityLevel(lobbyData: LobbyHelper.LatestLobbyData).Join()); if (!string.IsNullOrEmpty(GameNetworkManager.Instance.disconnectionReasonMessage))