# Steam Deck Debug Commands

## GDB Stack Trace

Run patched game under gdb to get crash location:

```bash
cd ~/.hytalef2p/release/package/game/latest

gdb -ex "run --app-dir /home/deck/.hytalef2p/release/package/game/latest --java-exec /home/deck/.hytalef2p/release/package/jre/latest/bin/java --auth-mode authenticated --uuid c500dc3e-2791-4df6-be1e-5574600339c0 --name Player --identity-token eyJhbGciOiJFZERTQSIsImtpZCI6IjIwMjUtMTAtMDEtc2FuYXNvbCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjNTAwZGMzZS0yNzkxLTRkZjYtYmUxZS01NTc0NjAwMzM5YzAiLCJuYW1lIjoiUGxheWVyIiwidXNlcm5hbWUiOiJQbGF5ZXIiLCJwcm9maWxlIjp7InVzZXJuYW1lIjoiUGxheWVyIn0sImVudGl0bGVtZW50cyI6WyJnYW1lLmJhc2UiXSwic2NvcGUiOiJoeXRhbGU6c2VydmVyIGh5dGFsZTpjbGllbnQiLCJpYXQiOjE3Njk0NzkzMjgsImV4cCI6MTc2OTUxNTMyOCwiaXNzIjoiaHR0cHM6Ly9zZXNzaW9ucy5zYW5hc29sLndzIiwianRpIjoiYTAxYjI1MDItZWE1Mi00NTM2LWI3ODQtN2RjNzljMjlkZjM0In0.BtV846L9_rWRINFvDqrtg1ZJhIVQRNsrN550UULN9j5yhMxP1TJx4bDxS2bkpRtxVmkdcA_xhQWapRSlFywZAA --session-token eyJhbGciOiJFZERTQSIsImtpZCI6IjIwMjUtMTAtMDEtc2FuYXNvbCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJjNTAwZGMzZS0yNzkxLTRkZjYtYmUxZS01NTc0NjAwMzM5YzAiLCJzY29wZSI6Imh5dGFsZTpzZXJ2ZXIiLCJpYXQiOjE3Njk0NzkzMjgsImV4cCI6MTc2OTUxNTMyOCwiaXNzIjoiaHR0cHM6Ly9zZXNzaW9ucy5zYW5hc29sLndzIiwianRpIjoiMzI0M2EwZTAtMjU2Mi00MzQ1LTljNGMtZWUyZDA5NDQ1NWI0In0.38ae2bCyAtjI0egmuy0v7u6caIi9hJGJFVeoeSvckQmaZMf-KaeHu4k5cF17d9eKXUxfEK_Ahjb1PTvIQhKtAA --user-dir /home/deck/.hytalesaves" ./Client/HytaleClient
```

After crash, in gdb prompt:
```
bt
bt full
info registers
quit
```

## Hex Dump Commands

Search for full hytale.com UTF-16LE:
```bash
xxd ~/.hytalef2p/release/package/game/latest/Client/HytaleClient.original | grep "6800 7900 7400 6100 6c00 6500 2e00 6300 6f00 6d00"
```

Search for partial matches:
```bash
xxd ~/.hytalef2p/release/package/game/latest/Client/HytaleClient.original | grep -i "h.y.t" | head -10
```

## Test Different Patch Modes

Restore and test:
```bash
# Restore original
cp ~/.hytalef2p/release/package/game/latest/Client/HytaleClient.original ~/.hytalef2p/release/package/game/latest/Client/HytaleClient
rm ~/.hytalef2p/release/package/game/latest/Client/HytaleClient.patched_custom

# Test UTF-16LE mode with same-length domain
HYTALE_PATCH_MODE=utf16le HYTALE_AUTH_DOMAIN=sanasol.ws HYTALE_SKIP_SENTRY_PATCH=1 HYTALE_SKIP_SUBDOMAIN_PATCH=1 npm start

# Test length-prefixed mode (default)
HYTALE_AUTH_DOMAIN=sanasol.ws HYTALE_SKIP_SENTRY_PATCH=1 HYTALE_SKIP_SUBDOMAIN_PATCH=1 npm start
```

## Binary Validation

```bash
file ~/.hytalef2p/release/package/game/latest/Client/HytaleClient
ldd ~/.hytalef2p/release/package/game/latest/Client/HytaleClient
```
