patch_mac_rendering.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env bash
  2. # DESCRIPTION
  3. # This is the patch script to to prevent the game from using unsupported gpu features
  4. #
  5. # EXIT STATUS
  6. # 0 : The patch was applied successfully.
  7. # other : Patch failure. See stdout or stderr output for details.
  8. # Templates for the next patch testing phase
  9. #echo " === !! UNTESTED PATCH. CHECK FOR BANS USING A TRASH ACCOUNT !! ==="
  10. #echo " === REPORT RESULTS TO THE MAIN REPOSITORY. THANK YOU. ==="
  11. #echo ""
  12. #echo "If you would like to test this patch, modify this script and remove the line below this one."
  13. #exit 1
  14. if ! [[ $(uname) == "Darwin" ]]; then
  15. echo "You don't need this patch if you are not on macOS."
  16. exit 1
  17. fi
  18. DIR=$(dirname "${BASH_SOURCE[0]}")
  19. DATADIR=$(find . -maxdepth 1 -type d -name "*_Data")
  20. GGM="$DATADIR/globalgamemanagers"
  21. if [[ -e "$GGM.bak" ]]; then
  22. echo "A backup already exists"
  23. exit 1
  24. fi
  25. echo "--- Patching globalgamemanagers"
  26. mv -f "$GGM" "$GGM.bak"
  27. # this works for both CN/OS server
  28. xxd -p -c 100000000 < "$GGM.bak" | sed "s/67616d657300000001/67616d657300000000/" | xxd -r -p > "$GGM"
  29. # Done!
  30. echo "==> Patch applied! Enjoy the game."
  31. echo
  32. echo "[NOTICE] Please refrain from sharing this project in public so"
  33. echo " that there can be Linux patches in the future. Thank you."
  34. exit 0