Qt5WebEngineCore_patch.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/env bash
  2. # DESCRIPTION
  3. # This script corrects an error within Qt5 Chromium library used by the
  4. # official "classic" Genshin launcher across (almost?) all versions.
  5. # This script is needed since approx. Wine 9.8.
  6. #
  7. # How to use: Execute this script within your launcher installation directory.
  8. # Example: bash /path/to/repo/compat/Qt5WebEngineCore_patch.sh
  9. #
  10. # IMPLEMENTATION DETAILS
  11. # This patch adds an additional `if (sacl == nullptr) return ERROR_SUCCCESS;`
  12. # check in between the following lines: https://github.com/qt/qtwebengine-chromium/blob/69-based/chromium/sandbox/win/src/restricted_token_utils.cc#L289-L291
  13. #
  14. # EXIT STATUS
  15. # 0 : The patch was applied successfully or is not needed by your system.
  16. # other : Patch failure. See stdout or stderr output for details.
  17. DIR=$(dirname "${BASH_SOURCE[0]}")
  18. FILE="Qt5WebEngineCore.dll"
  19. if [ ! -e "$FILE" ]; then
  20. echo "[ERROR] File '$FILE' not found. Please check the script usage notes."
  21. fi
  22. sum=($(md5sum $FILE))
  23. if [[ "$sum" != "6c3e89dfd553a91055959f5f21584931" ]]; then
  24. # The patch might corrupt invalid/outdated files if this check is skippd.
  25. echo "[ERROR] Wrong file version or the patch is already applied"
  26. echo " -> md5sum: ${sum}" && exit 1
  27. fi
  28. if ! command -v xdelta3 &>/dev/null; then
  29. echo "[ERROR] xdelta3 application is required"
  30. echo " -> Debian/Ubuntu: apt install xdelta3"
  31. echo " -> Fedora: dnf install xdelta"
  32. echo " -> Arch/Arch-based: pacman -S xdelta3"
  33. echo " -> macOS: \"port install xdelta\" or \"brew install xdelta\""
  34. exit 1
  35. fi
  36. echo "--- Patching $FILE"
  37. xdelta_fail() {
  38. mv -vf "$FILE.bak" "$FILE"
  39. exit 1
  40. }
  41. mv -f "$FILE" "$FILE.bak"
  42. xdelta3 -d -s "$FILE.bak" "$DIR/Qt5WebEngineCore_patch.vcdiff" "$FILE" || xdelta_fail
  43. echo "==> Patch applied successfully"
  44. exit 0