patch_anti_logincrash.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/env bash
  2. echo "[NOTE] This patch is not required since game version 2.3.0. It will be provided if necessary."
  3. echo " Please open a new issue if your game crashes when entering the stone door."
  4. exit 0
  5. #echo "[NOTE] As of 2021-11-27 this patch is not required. This might be a mistake"
  6. #echo " of the game developers. If your game suddenly freezes (while entering the door),"
  7. #echo " edit this script file and comment/remove the line below."
  8. #exit 0
  9. #echo "[NOTE] This patch is not required as of 2021-11-24. However, it might become"
  10. #echo " necessary afterwards (Friday?). If that's the case, comment the line below."
  11. #exit 0
  12. # MacOS and *BSD do not have md5sum: use md5 instead
  13. if [[ $(uname) == "Darwin" || $(uname) == *"BSD" ]]; then
  14. md5sum() {
  15. md5 -q $@
  16. }
  17. fi
  18. DIR=$(dirname "${BASH_SOURCE[0]}")
  19. FILE="GenshinImpact_Data/Plugins/xlua.dll"
  20. sum=($(md5sum $FILE))
  21. if [ "${sum}" != "da363219983ec77614163dc015bf4298" ]; then # original
  22. # The patch might corrupt invalid/outdated files if this check is skippd.
  23. echo "[ERROR] Wrong file version or the patch is already applied"
  24. echo " -> md5sum: ${sum}" && exit 1
  25. fi
  26. # =========== DO NOT REMOVE START ===========
  27. if [[ -e "$DIR/$FILE" ]]; then
  28. # There is a good reason for this check. Do not pollute the game directory.
  29. echo "[ERROR] Invalid patch download directory. Please move all"
  30. echo " patch files outside the game directory prior executing."
  31. echo " -> See README.md for proper installation instructions" && exit 1
  32. fi
  33. # =========== DO NOT REMOVE END ===========
  34. if ! command -v xdelta3 &>/dev/null; then
  35. echo "[ERROR] xdelta3 application is required"
  36. exit 1
  37. fi
  38. echo "[INFO] Patch to fix a login and runtime crash"
  39. echo ""
  40. # ===========================================================
  41. echo "[WARNING] Hereby you are violating the game's Terms of Service!"
  42. echo " Do you accept the risk and possible consequences?"
  43. read -p "Accept? [y/n] " choice
  44. if [[ ! "$choice" == [JjSsYy]* ]]; then
  45. exit 1
  46. fi
  47. echo
  48. echo "--- Applying xLua patch"
  49. xdelta_fail() {
  50. mv -vf "$FILE.bak" "$FILE"
  51. exit 1
  52. }
  53. mv -f "$FILE" "$FILE.bak"
  54. # Perform patch or restore .bak on failure
  55. xdelta3 -d -s "$FILE.bak" "$DIR/patch_files/xlua_patch.vcdiff" "$FILE" || xdelta_fail
  56. # Done!
  57. echo "==> Patch applied! Enjoy the game."
  58. exit 0