From 6333263ef9056fed157d6e57d46f0fab9176fce3 Mon Sep 17 00:00:00 2001 From: sanasol Date: Tue, 27 Jan 2026 03:51:32 +0100 Subject: [PATCH] Fix: Don't fallback to legacy mode when using skip list When HYTALE_PATCH_SKIP is set, the legacy fallback was ignoring the skip list and patching all occurrences anyway. Now if skip list is active or HYTALE_NO_LEGACY_FALLBACK=1, the legacy fallback is disabled. Also found 4th occurrence at 0x1bc5d67 with metadata byte 0x89 that legacy mode was patching - this may be the crash culprit. Co-Authored-By: Claude Opus 4.5 --- backend/utils/clientPatcher.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/utils/clientPatcher.js b/backend/utils/clientPatcher.js index 442e478..398aaf0 100644 --- a/backend/utils/clientPatcher.js +++ b/backend/utils/clientPatcher.js @@ -584,6 +584,17 @@ class ClientPatcher { const { buffer: finalData, count: discordCount } = this.patchDiscordUrl(patchedData); if (count === 0 && discordCount === 0) { + // Check if we're in debug mode with skip - don't fallback if intentionally skipping + const hasSkipList = (process.env.HYTALE_PATCH_SKIP || '').trim().length > 0; + const noLegacyFallback = process.env.HYTALE_NO_LEGACY_FALLBACK === '1'; + + if (hasSkipList || noLegacyFallback) { + console.log('No occurrences patched (skip list active or legacy fallback disabled)'); + fs.writeFileSync(clientPath, patchedData); + this.markAsPatched(clientPath); + return { success: true, patchCount: 0, skipped: true }; + } + console.log('No occurrences found - trying legacy UTF-16LE format...'); // Fallback to legacy patching for older binary formats