Skip to content

Instantly share code, notes, and snippets.

@aspann
Last active March 31, 2024 23:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aspann/f57a4725d70d8554fa8e3ce266f03585 to your computer and use it in GitHub Desktop.
Save aspann/f57a4725d70d8554fa8e3ce266f03585 to your computer and use it in GitHub Desktop.
Howto patch Sid Meier's Civilization V to run under linux-steam

Sid Meier's Civilization V

Linux steam patch. Disables unneeded movies and sets max-cpus


Setup

Move to the Civilization V folder.

cd "${HOME}/.local/share/Steam/steamapps/common/Sid Meier's Civilization V"

If you have 8 (CPU)threads or less, you can simply patch the binary to not load the intro-movies wich will crash due BinkPlayer, by using this command:

for b in {5676,5884,6088}; do  dd if=/dev/zero of=Civ5XP bs=1 seek=1864$b count=1 conv=notrunc; done

Otherwise create a new bash script (patch_Civ5XP.sh) with the following contents:

#!/bin/bash
## this script pathces Civ5 to run on steam-linux
civDir="${HOME}/.local/share/Steam/steamapps/common/Sid Meier's Civilization V"
oriDir="${PWD}"

if [[ ! -d ${civDir} ]]; then
        echo -e "Sid Meier's Civilization V - Installation not found"
        exit 1
fi

if [[ -f "${civDir}/Civ5XP" && -f "${civDir}/Civ5XP.run" ]]; then
        echo -e "Civ5XP has been patched already.."
        exit 0
fi

if [ -f "${civDir}/Civ5XP" ] && mv "${civDir}/Civ5XP" "${civDir}/Civ5XP.run"

# fetching sources
DMY=`cd /tmp; wget -q -O Civ5XP.c  https://gist.githubusercontent.com/aspann/43b5c514f63aab5b011ec06c60b15bee/raw/2e464ed7b2b1480c66beed2c1cc15af612810fe4/Civ5XP.c > /dev/null 2>&1`
gcc /tmp/Civ5XP.c -o "${civDir}/Civ5XP"

echo -e "ready to launch, please add '-r' to the commandline parameters in steam this undoes the copy action after launch."

exit 0

make it execuatable and run it (this will install Civ5XP.c).

chmod +x patch_Civ5XP.sh && ./patch_Civ5XP.sh

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment