patch_anti_logincrash.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env bash
  2. DIR=$(dirname "${BASH_SOURCE[0]}")
  3. FILE="GenshinImpact_Data/Plugins/xlua.dll"
  4. sum=($(md5sum $FILE))
  5. if [ "${sum}" != "ce5877ad4524266636f77817ef7eedb4" ]; then
  6. # The patch might corrupt invalid/outdated files if this check is skippd.
  7. echo "Wrong file version or patch is already applied"
  8. echo "md5sum: ${sum}" && exit 1
  9. fi
  10. # =========== DO NOT REMOVE START ===========
  11. if [[ -e "$DIR/$FILE" ]]; then
  12. # There is a good reason for this check. Do not pollute the game directory.
  13. echo "Please move all patch files outside the game directory prior executing."
  14. echo " -> See README.md for proper installation instructions" && exit 1
  15. fi
  16. # =========== DO NOT REMOVE END ===========
  17. if ! command -v xdelta3 &>/dev/null; then
  18. echo "xdelta3 application is required"
  19. exit 1
  20. fi
  21. echo "[WARNING] Patch for 1.4.0 to fix a login and runtime crash"
  22. echo ""
  23. # ===========================================================
  24. echo "[WARNING] Hereby you are violating the game's Terms of Service!"
  25. echo " Do you accept the risk and possible consequences?"
  26. read -p "Accept? [y/n] " choice
  27. if [[ ! "$choice" == [JjSsYy]* ]]; then
  28. exit 1
  29. fi
  30. echo "--- Applying xLua patch"
  31. # Backup file
  32. mv "$FILE" "$FILE.bak"
  33. xdelta3 -d -s "$FILE.bak" "$DIR/patch_files/xlua_patch.vcdiff" "$FILE"
  34. # Done!
  35. echo "==> Patch applied! Enjoy the game."
  36. exit 0