Created
June 3, 2024 19:39
-
-
Save sonic2kk/934fc97d27d9d8c4ac9c1d817e163bf1 to your computer and use it in GitHub Desktop.
Fetch all Steam Shortcut App IDs from `shortcuts.vdf` and convert them to the Long Shortcut AppIDs using Bash.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Magic that represents 'appid' column | |
magic_appid="617070696400" | |
# Paste in your Steam UserID | |
steam_userid="" | |
shortcuts_vdf="$HOME/.steam/root/userdata/${steam_userid}/config/shortcuts.vdf" | |
# Parse short AppID (unsigned 32bit integer) and convert it to an unsigned 64bit integer | |
# | |
# This format of AppID is used for Steam shortcut files, such as `.desktop` files on Linux, | |
# and can be used to launch Non-Steam Games with `steam steam://rungameid/<your_long_appid_here>` | |
function convert_aid { | |
hex_aid="$1" | |
little_endian="$( echo "$hex_aid" | tac -rs .. | tr -d '\n' )" | |
short_appid="$((16#${little_endian}))" | |
# Use printf to get unsigned 64bit integer, without printf this will be stored as signed | |
printf "%u\n" "$(( ( ${short_appid} << 32 ) | 0x02000000 ))" | |
} | |
# Get first 8 characters after magic and convert it from hex to 32bit unsigned integer | |
mapfile -t non_steam_appids < <(xxd -ps "$shortcuts_vdf" | grep -oP "${magic_appid}\K.{8}") | |
for nsi in "${non_steam_appids[@]}"; do | |
convert_aid "$nsi" | |
done |
@bkbilly you saved me, thank you very much. I tried different approaches, but they were not working anymore (like crc32 with zlib and the combination of exe and appname). Your way is perfect
thank you guys! been looking for this for quite some time now
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing this bash script, it really helped me port it to python. If you are interested this is the code: