Skip to content

Instantly share code, notes, and snippets.

@bemxio
Last active June 11, 2024 08:52
Show Gist options
  • Save bemxio/8dc582021df01893b9add92412929a0c to your computer and use it in GitHub Desktop.
Save bemxio/8dc582021df01893b9add92412929a0c to your computer and use it in GitHub Desktop.
A Bash script for decrypting all Vice City radio stations from ADF to MP3. You can pass the game's path in an argument, by default uses the Steam installation.
#!/bin/bash
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <https://unlicense.org>
if [ "$(command -v xcat)" ]; then
XCAT="xcat"
elif [ -f "xcat" ]; then
XCAT="./xcat"
else
if [ ! -f "xcat.py" ]; then
echo "xcat not found, downloading..." && curl -OL https://raw.githubusercontent.com/mstrand/xcat/master/xcat.py
fi
XCAT="python3 xcat.py"
fi
if [ -n "$1" ]; then
DIRECTORY="$1"
else
DIRECTORY="$HOME/.steam/steam/steamapps/common/Grand Theft Auto Vice City"
fi
echo "Using files from directory: $DIRECTORY"
SOURCE="adf"
DESTINATION="mp3"
rm -rf $SOURCE $DESTINATION
mkdir $SOURCE $DESTINATION
cp -r "$DIRECTORY/Audio"/*.adf "$SOURCE" || exit 1
for station in "$SOURCE"/*.adf; do
INPUT="$station"
OUTPUT="$DESTINATION/$(basename $station '.adf').mp3"
echo "$INPUT -> $OUTPUT"
$XCAT -n 0x22 "$INPUT" > "$OUTPUT" || exit 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment