diff options
Diffstat (limited to 'tools/find-client-packets.bash')
-rw-r--r-- | tools/find-client-packets.bash | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/find-client-packets.bash b/tools/find-client-packets.bash new file mode 100644 index 0000000..34882c8 --- /dev/null +++ b/tools/find-client-packets.bash @@ -0,0 +1,31 @@ +#!/bin/bash +# Crawl soulworker for packet ids + +base=0x401200 +grep -obUaP '(send_)?(eSUB_)?CMD_.*?\x00' "$@" | while IFS=':' read -r off name; do + name="${name/*CMD/PACKET}" + name="$(awk '{print $1}' <<<"$name")" + off=$(rax2 -e "$off+$base") + off=${off//0x/} + while [[ "${#off}" -lt 8 ]]; do off="0$off"; done + rafind2 -nx "68$off" "$@" | while read -r off; do + off=$(rax2 "$off") + head -c $off "$@" | LC_ALL=C tac -rs $'.' | grep -obUaP -m1 '.\x6a.\x6a' | while IFS=':' read -r off2 nul; do + lo=$(xxd -s $((off-off2-3)) -l 1 -g 1 -ps "$@") + hi=$(xxd -s $((off-off2-1)) -l 1 -g 1 -ps "$@") + if [[ "$lo$hi" == '0001' ]] || [[ "$lo$hi" == '0000' ]]; then + break + fi + [[ "$name" == "PACKET_SHOP_CASH_GIFT" ]] && lo=25 + [[ "$name" == "PACKET_ITEM_RESTORE" ]] && lo=22 + [[ "$name" == "PACKET_ITEM_UNSEAL" ]] && lo=24 + [[ "$name" == "PACKET_ITEM_USE_EFFECT" ]] && lo=26 + [[ "$name" == "PACKET_ITEM_APPEARANCE_EQUIP" ]] && lo=52 + [[ "$name" == "PACKET_LEAGUE_DELEGATE" ]] && lo=0a + [[ "$name" == "PACKET_HELPER_SUPPORT_INFO" ]] && lo=05 + printf "%s = 0x%s%s,\n" "$name" "$lo" "$hi" + break + done + break + done +done |