patch_anti_logincrash.sh 1.6 KB

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