Skip to content

Instantly share code, notes, and snippets.

@kairusds
Last active January 3, 2023 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kairusds/e8596216f1299cf5c2031f5d6ff4c05a to your computer and use it in GitHub Desktop.
Save kairusds/e8596216f1299cf5c2031f5d6ff4c05a to your computer and use it in GitHub Desktop.
Decompile Terraria's source code on Linux using ILSpy and SteamRE's DepotDownloader
# Get .NET SDK 6.0 for Linux distros (https://learn.microsoft.com/en-us/dotnet/core/install/linux)
# Build ILSpy
git clone --recurse-submodules https://github.com/icsharpcode/ILSpy
dotnet build ILSpy/ILSpy.XPlat.slnf
# For Alpine Linux, replace `.bashrc` with `.profile`
# If you're using a different shell, refer to its documentation.
echo "# ILSpy" >> ~/.bashrc
echo 'export PATH="$PATH:'"$(find $PWD/ILSpy/ICSharpCode.ILSpyCmd/bin/Debug/net* -print -quit)\"" >> ~/.bashrc
source ~/.bashrc
# Download Terraria Windows Ver using SteamRE/DepotDownloader
wget -c $(curl -ksL "https://api.github.com/repos/SteamRE/DepotDownloader/releases/latest" | jq -r ".assets[0].browser_download_url") \
--progress=bar:force:noscroll -q --show-progress
unzip -d "sdl" depotdownloader*.zip
nano spss # In one line type your Steam account password
dotnet sdl/DepotDownloader.dll -app 105600 -depot 105601 -username <username> -password "$(cat spss)"
# Download depot with specific version
# Get manifest ID (the green one) from https://steamdb.info/depot/105601/history/
# Match the manifest's date with the release date on https://terraria.wiki.gg/wiki/Desktop_version_history
dotnet sdl/DepotDownloader.dll -app 105600 -depot 105601 -manifest 9089490579085838330 -username <username> -password "$(cat spss)"
# Start decompiling with ILSpy
mkdir td
ilspycmd -p -o td $(find sdl/depots/105601/*/Terraria.exe -print -quit)
# Wait for a few minutes
# The command should exit by itself without any output if it's done and you can check the files with `ls td`
# Remove the steam account password file and the DepotDownloader config which contains your login key
rm ~/spss
rm $(find ~/ -name "account.config")
# Extra: Zipping the folder (+downloading to the local machine if decompiled from a server)
zip -9r td Terraria-Decompiled.zip
# On local machine
scp <username>@<hostname>:/root/Terraria-Decompiled.zip .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment