Skip to content

Instantly share code, notes, and snippets.

@vhd
Last active November 24, 2021 23:29
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 vhd/5f3824cb1a463a51e4c2532835ed5b02 to your computer and use it in GitHub Desktop.
Save vhd/5f3824cb1a463a51e4c2532835ed5b02 to your computer and use it in GitHub Desktop.
Patch for Steam version of Farming Simulator 22 on Apple M1
#!/bin/bash
FS22PATH=~/Library/Application\ Support/Steam/steamapps/common/Farming\ Simulator\ 22/Farming\ Simulator\ 2022.app/Contents/MacOS
FILE1=${FS22PATH}/FarmingSimulator2022Game
FILE2=${FS22PATH}/FarmingSimulator2022Game_
FILE_ESC=$(printf %q "$FILE2")
IS_SCRIPT=$(file "$FILE1" | grep "POSIX shell script")
IS_BINARY=$(file "$FILE1" | grep "universal binary")
if [ -n "$IS_SCRIPT" ]; then
echo "Already patched"
elif [ -n "$IS_BINARY" ]; then
echo "Binary found. Replacing with launcher..."
mv "$FILE1" "$FILE2"
echo "#!/bin/sh" > "$FILE1"
echo "arch -arm64 $FILE_ESC" >> "$FILE1"
chmod +x "$FILE1"
else
echo "Something went wrong. Run integrity check and try again"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment