Skip to content

Instantly share code, notes, and snippets.

View sonic2kk's full-sized avatar

Eamonn Rea sonic2kk

  • The Organization
  • 13:36 (UTC)
View GitHub Profile
@sonic2kk
sonic2kk / get_all_steam_shortcut_appids.sh
Last active October 22, 2023 13:51
Fetch all Steam Shortcut App IDs from shortcuts.vdf using Bash.
#!/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"
function convert_aid {
@sonic2kk
sonic2kk / get_all_steam_shortcut_names.sh
Last active October 24, 2023 02:06
Fetch all Steam Shortcut AppNames from shortcuts.vdf using Bash.
#!/usr/bin/env bash
# Magic that represents 'AppName' and 'appname' column begin and end
# Most of the time (including from Steam itself) this will be 'AppName', but accounts for edge-cases as well
magic_appname_camelcase="014170704e616d6500" # 'AppName'
magic_appname_lowercase="6170706e616d65" # 'appname'
magic_appname_end="0001" # end bytes before next column begins
# Paste in your Steam UserID
steam_userid=""
@sonic2kk
sonic2kk / get_all_steam_shortcut_startdirs.sh
Last active October 24, 2023 17:28
Get all Steam Shortcut StartDirs from shortcuts.vdf using Bash.
#!/usr/bin/env bash
# Magic that represents 'Startdir' column begin and end
# Should always be CamelCase, but you could account for 'startdir' with '7374617274646972'
magic_startdir_camelcase="0001537461727444697200" # 'StartDir'
magic_startdir_end="0001" # end bytes before next column begins
# Paste in your Steam UserID
steam_userid=""
shortcuts_vdf="$HOME/.steam/root/userdata/${steam_userid}/config/shortcuts.vdf"
@sonic2kk
sonic2kk / get_all_steam_shortcut_exes.sh
Last active October 27, 2023 21:46
Get all Steam Shortcut Exe paths using Bash.
#!/usr/bin/env bash
# Magic that represents 'exe' column begin and end
# Should always be Exe, but you could account for 'exe' with '6578650a'
magic_exe_camelcase="000145786500" # 'Exe'
magic_exe_end="0001" # end bytes before next column begins
# Paste in your Steam UserID
steam_userid=""
shortcuts_vdf="$HOME/.steam/root/userdata/${steam_userid}/config/shortcuts.vdf"
@sonic2kk
sonic2kk / get_value_from_shortcut_entry.sh
Last active October 24, 2023 20:21
Parse value from shortcuts.vdf hexadecimal shortcut entry using the hex start pattern using Bash. Does not work with appid unfortunately, as it has a slightly different format.
#!/usr/bin/env bash
# Get value in shortcut entry hex between start and end patterns, with null byte removed, converted to plaintext
function get_shortcut_column_value {
shortcut_hex="$1"
shortcut_pattern_start="$2"
shortcut_pattern_end="0001"
printf "${shortcut_hex}" | grep -oP "${shortcut_pattern_start}\K.*?(?=${shortcut_pattern_end})" | xxd -r -p | tr -d '\0'
}
@sonic2kk
sonic2kk / get_all_steam_shortcut_blocks.sh
Last active October 24, 2023 20:23
Return each Steam shortcut entry from shortcuts.vdf in hexadecimal, so each value can be individually parsed.
#!/usr/bin/env bash
# shortcuts.vdf starts with different bytes than all other shortcuts, this magic basically translates to: '00shortcuts000030000002',
# where '0000' is spacing, '30' represents the shortcut index (1), '00' is more spacing, and '0002' is the start of the next column
magic_shortcut_filestart="0073686f7274637574730000300002"
magic_shortcut_blockstart="00080800.*?0002" # How all other shortcut blocks start, with 00080800, then the shortcut number (could be 31,32,even higher for more shortcuts, so we don't care about the value between), then 0002 for the next block start
magic_shortcut_blockend="000808" # How all shortcuts end
# Paste in your Steam UserID
steam_userid=""
@sonic2kk
sonic2kk / get_some_steam_shortcut_information.sh
Created October 24, 2023 20:25
Parse some Steam Shortcut information from shortcuts.vdf using Bash.
#!/usr/bin/env bash
# AppID is a special case I haven't made generic yet since it doesn't have an end byte the same way other fields do afaik
# Adapted from my gist: https://gist.github.com/sonic2kk/4a3383b401931a171a4addc29bdf903f
function get_shortcut_appid {
# Magic that represents 'appid' column
magic_appid="617070696400"
shortcut_hex="$1"
function convert_aid {
@sonic2kk
sonic2kk / get_long_steam_shortcut_appid.sh
Created June 3, 2024 19:39
Fetch all Steam Shortcut App IDs from `shortcuts.vdf` and convert them to the Long Shortcut AppIDs using Bash.
#!/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