patch_anti_logincrash.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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}" != "f91c11ec6ac002d3f11c469f5b003976" ]; 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. if [[ -e "$DIR/$FILE" ]]; then
  11. # Script may not be placed into the main directory
  12. echo "Please move all patch files outside the game directory prior executing."
  13. echo " -> See README.md for proper installation instructions" && exit 1
  14. fi
  15. if ! command -v xdelta3 &>/dev/null; then
  16. echo "xdelta3 application is required"
  17. exit 1
  18. fi
  19. echo "[WARNING] (Temporary) patch for 1.2.0 to fix a login and runtime crash"
  20. echo ""
  21. # ===========================================================
  22. echo "[WARNING] Hereby you are violating the game's Terms of Service!"
  23. echo " Do you accept the risk and possible consequences?"
  24. read -p "Accept? [y/n] " choice
  25. if [[ ! "$choice" == [JjSsYy]* ]]; then
  26. exit 1
  27. fi
  28. echo "--- Setting up script"
  29. cp -f "$DIR/patch_files/xlua_script.lua" "no message"
  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