From 47dc3c25f219fcc4aca15f7928432283043f35f7 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Sun, 7 Sep 2025 17:23:49 -0500 Subject: [PATCH] Fix serialization/deserialization when logging session/system data --- src/system/game-data.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 8c6f63450f7..7cc61b52dd2 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -424,7 +424,13 @@ export class GameData { } if (isLocal || isBeta) { - console.debug(JSON.parse(JSON.stringify(systemData))); + try { + console.debug( + this.parseSystemData(JSON.stringify(systemData, (_, v: any) => (typeof v === "bigint" ? v.toString() : v))), + ); + } catch (err) { + console.debug("Attempt to log system data failed:", err); + } } localStorage.setItem(`data_${loggedInUser?.username}`, encrypt(systemDataStr, bypassLogin)); @@ -1042,7 +1048,15 @@ export class GameData { try { const initSessionFromData = (fromSession: SessionSaveData) => { if (isLocal || isBeta) { - console.debug(JSON.parse(JSON.stringify(fromSession))); + try { + console.debug( + this.parseSessionData( + JSON.stringify(fromSession, (_, v: any) => (typeof v === "bigint" ? v.toString() : v)), + ), + ); + } catch (err) { + console.debug("Attempt to log session data failed:", err); + } } // overwrite slot ID if somehow not set. fromSession.slotId = slotId;