mirror of
https://git.sanhost.net/sanasol/hytale-f2p
synced 2026-02-26 09:21:48 -03:00
Disable Discord URL patching entirely
The Discord URL patch was causing buffer overflow crashes and has no practical effect on F2P functionality anyway. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -329,54 +329,13 @@ class ClientPatcher {
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch Discord invite URLs from .gg/hytale to shorter URL
|
||||
* IMPORTANT: New URL must be same length or shorter to avoid corrupting adjacent data
|
||||
* Patch Discord invite URLs - DISABLED
|
||||
* Was causing buffer overflow crashes on Steam Deck/Ubuntu LTS
|
||||
* The Discord URL in the game doesn't affect F2P functionality anyway
|
||||
*/
|
||||
patchDiscordUrl(data) {
|
||||
let count = 0;
|
||||
const result = Buffer.from(data);
|
||||
|
||||
const oldUrl = '.gg/hytale';
|
||||
// Use same-length URL to avoid buffer overflow
|
||||
// Original: .gg/hytale (10 chars)
|
||||
// New: .gg/gME8rUy3MB would be 14 chars - TOO LONG
|
||||
// Using: .gg/sanasolf2p (13 chars) - still too long
|
||||
// Using: .gg/hytalef2p (12 chars) - still too long
|
||||
// Must be exactly 10 chars: .gg/XXXXXX (6 chars after .gg/)
|
||||
const newUrl = '.gg/santop'; // 10 chars - same length, points to our server list
|
||||
|
||||
// Try length-prefixed format first
|
||||
const lpResult = this.replaceBytes(
|
||||
result,
|
||||
this.stringToLengthPrefixed(oldUrl),
|
||||
this.stringToLengthPrefixed(newUrl)
|
||||
);
|
||||
|
||||
if (lpResult.count > 0) {
|
||||
return { buffer: lpResult.buffer, count: lpResult.count };
|
||||
}
|
||||
|
||||
// Fallback to UTF-16LE - but ONLY if same length to avoid corruption
|
||||
const oldUtf16 = this.stringToUtf16LE(oldUrl);
|
||||
const newUtf16 = this.stringToUtf16LE(newUrl);
|
||||
|
||||
if (newUtf16.length > oldUtf16.length) {
|
||||
console.warn(` Warning: Discord URL replacement skipped - new URL longer than old`);
|
||||
return { buffer: result, count: 0 };
|
||||
}
|
||||
|
||||
const positions = this.findAllOccurrences(result, oldUtf16);
|
||||
|
||||
for (const pos of positions) {
|
||||
// Zero-fill first if new is shorter
|
||||
if (newUtf16.length < oldUtf16.length) {
|
||||
result.fill(0x00, pos, pos + oldUtf16.length);
|
||||
}
|
||||
newUtf16.copy(result, pos);
|
||||
count++;
|
||||
}
|
||||
|
||||
return { buffer: result, count };
|
||||
// Disabled - no practical effect and was causing memory corruption
|
||||
return { buffer: Buffer.from(data), count: 0 };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user