lua_injection.sh 875 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. # This patch script modifies the xLua dll:
  3. #
  4. # Function luaopen_xlua (1802aa7b0)
  5. # JMP to 1803931ac
  6. #
  7. # Code at 1803931ac:
  8. # if (!luaL_loadfilex(L,"no message",0))
  9. # lua_pcall(L,0,0,0);
  10. #
  11. # PE Header modification to allow code execution
  12. DIR=$(dirname "${BASH_SOURCE[0]}")
  13. FILE="GenshinImpact_Data/Plugins/xlua.dll"
  14. sum=($(md5sum $FILE))
  15. if [ "${sum}" != "2ec35c55430c7fcd3b313df8cd105d9e" ]; then
  16. echo "Wrong file version or patch is already applied"
  17. echo "md5sum: ${sum}" && exit 1
  18. fi
  19. if ! command -v xdelta3 &>/dev/null; then
  20. echo "xdelta3 application is required" && exit 1
  21. fi
  22. # Backup file
  23. mv "$FILE" "$FILE.bak"
  24. xdelta3 -d -s "$FILE.bak" "$DIR/raw/lua_injection.vcdiff" "$FILE"
  25. if [ $? -ne 0 ]; then
  26. exit $?
  27. else
  28. echo "==> Patch applied. Creating symlink for script..."
  29. ln -s "$DIR/lua_injection.lua" "no message"
  30. fi
  31. exit $?