From d96a5e42c72c75f3d07257c59382549d53864280 Mon Sep 17 00:00:00 2001 From: gamer147 Date: Fri, 29 May 2026 20:35:09 -0400 Subject: [PATCH] fix(loader): descend into envelope data key in user-data dump WriteUserDataFromLoadIndex received the full response envelope { data_headers, data } but read viewer fields from the top level, so every SafeGet missed and the dump contained only steam_id. Descend into the inner data key first (mirrors TryExtractSpecialBattleSettings). Co-Authored-By: Claude Opus 4.8 --- SVSimLoader/CaptureWriter.cs | 11 +++++++++++ SVSimLoader/Patches/ExaminationPatches.cs | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/SVSimLoader/CaptureWriter.cs b/SVSimLoader/CaptureWriter.cs index 2015106..fd5a23c 100644 --- a/SVSimLoader/CaptureWriter.cs +++ b/SVSimLoader/CaptureWriter.cs @@ -131,6 +131,17 @@ internal static class CaptureWriter try { + // SetResponseData hands us the FULL response envelope { data_headers, data }; the + // viewer payload (user_info, user_crystal_count, user_card_list, ...) lives under the + // inner `data` key. Descend into it before extracting — same as + // ExaminationPatches.TryExtractSpecialBattleSettings does. Without this every SafeGet + // below misses and the dump contains nothing but steam_id. The inner payload has no + // top-level `data` key of its own, so this is safe if a caller ever pre-strips it. + if (loadIndexData != null && loadIndexData.IsObject && loadIndexData.Keys.Contains("data")) + { + loadIndexData = loadIndexData["data"]; + } + var dump = new Dictionary { { "steam_id", _lastSeenSteamId } diff --git a/SVSimLoader/Patches/ExaminationPatches.cs b/SVSimLoader/Patches/ExaminationPatches.cs index 13ce38a..cfca631 100644 --- a/SVSimLoader/Patches/ExaminationPatches.cs +++ b/SVSimLoader/Patches/ExaminationPatches.cs @@ -23,8 +23,9 @@ public static class ExaminationPatches } if (SvSimConfig.DumpUserData && __instance.Url != null && __instance.Url.EndsWith("/load/index")) { - // The /load/index response data is the inner `data` payload by this point — the - // outer `data_headers` wrapper has already been stripped by the network task base. + // `data` is the FULL envelope { data_headers, data } (see TryExtractSpecialBattleSettings + // + NetworkTask.cs:108-110). WriteUserDataFromLoadIndex descends into the inner `data` + // key itself, so pass the envelope as-is. CaptureWriter.WriteUserDataFromLoadIndex(data); } if (SvSimConfig.SweepLeaderSkinPools && __instance.Url != null && __instance.Url.EndsWith("/pack/info"))