-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
109 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/bin/bash | ||
check_win_version '10' | ||
|
||
check_deps() { | ||
if [ -z "$(which xdelta3 2>/dev/null)" ] | ||
then | ||
print_error yad "xdelta3 not found in your system! Install xdelta3 in your system! \nArch-based: sudo pacman -S xdelta3" | ||
return 1 | ||
fi | ||
} | ||
|
||
check_gi_patch() { | ||
DIR="$WINEPREFIX/drive_c/Program Files/gi_patch" | ||
if [ ! -d "$DIR" ] | ||
then | ||
if try_download "https://github.com/VHSgunzo/gi_patch/releases/download/v1/gi_patch.tar.gz" "$WINEPREFIX/drive_c/Program Files" | ||
then | ||
if unpack_tar_gz "$DIR.tar.gz" "$WINEPREFIX/drive_c/Program Files" | ||
then | ||
try_rm "$DIR.tar.gz" &>/dev/null | ||
return 0 | ||
else | ||
try_rm "$DIR"* &>/dev/null | ||
return 1 | ||
fi | ||
else | ||
return 1 | ||
fi | ||
fi | ||
} | ||
|
||
launch_helper() { | ||
DATADIR=$(find -type d -name "*_Data") | ||
FILE="UnityPlayer.dll" | ||
CEXE1="$DATADIR/upload_crash.exe" | ||
CEXE2="$DATADIR/Plugins/crashreport.exe" | ||
sum=($(md5sum $FILE)) | ||
if [ "$sum" == "e1291ef7269feb9dcb1873e7096050c2" ] | ||
then | ||
print_info notify "Patch is already applied!" | ||
else | ||
if [ "${sum}" == "c61817c8246b018ba028b579a12a5a19" ]; then | ||
reltype="os" | ||
print_info notify "Applying patch for: International (OS) version" | ||
else | ||
print_error yad "Wrong file version\nmd5sum: ${sum}" | ||
return 1 | ||
fi | ||
if print_question "Hereby you are violating the game's Terms of Service! \nDo you accept the risk and possible consequences?" | ||
then | ||
print_info notify "Setting up blocked servers" | ||
if [ -z "$(grep "Genshin logging servers" /etc/hosts)" ]; then | ||
print_info yad "Blocking logging servers in /etc/hosts\n\n0.0.0.0 log-upload-os.mihoyo.com\n0.0.0.0 overseauspider.yuanshen.com" | ||
pkexec sh -c 'echo -e "\n# Genshin logging servers (do not remove!)\n0.0.0.0 log-upload-os.mihoyo.com\n0.0.0.0 overseauspider.yuanshen.com\n" >> /etc/hosts' | ||
else | ||
print_info notify "Logging servers are already blocked. Skip." | ||
fi | ||
if [ -z "$(grep "Optional Unity proxy" /etc/hosts)" ]; then | ||
if print_question "Blocking common Unity proxy/cdn servers in /etc/hosts\nIf issues arise in other games consider commenting a few lines to check what makes the difference.\n\n0.0.0.0 prd-lender.cdp.internal.unity3d.com\n0.0.0.0 thind-prd-knob.data.ie.unity3d.com\n0.0.0.0 thind-gke-usc.prd.data.corp.unity3d.com\n0.0.0.0 cdp.cloud.unity3d.com\n0.0.0.0 remote-config-proxy-prd.uca.cloud.unity3d.com\n\nBlock Unity proxy/cdn servers?" | ||
then | ||
pkexec sh -c 'echo -e "# Optional Unity proxy/cdn servers\n0.0.0.0 prd-lender.cdp.internal.unity3d.com\n0.0.0.0 thind-prd-knob.data.ie.unity3d.com\n0.0.0.0 thind-gke-usc.prd.data.corp.unity3d.com\n0.0.0.0 cdp.cloud.unity3d.com\n0.0.0.0 remote-config-proxy-prd.uca.cloud.unity3d.com\n" >> /etc/hosts' | ||
fi | ||
else | ||
print_info notify "Unity proxy/cdn servers are already blocked. Skip." | ||
fi | ||
print_info notify "Renaming the crash reporter(s)" | ||
if [[ -e "$CEXE1" ]]; then | ||
try_mv "$CEXE1" "$CEXE1.bak" | ||
fi | ||
if [[ -e "$CEXE2" ]]; then | ||
try_mv "$CEXE2" "$CEXE2.bak" | ||
fi | ||
try_cp "$DIR/mhyprot2_running.reg" ./ | ||
print_info notify "Patching UnityPlayer" | ||
try_mv "$FILE" "$FILE.bak" | ||
if xdelta3 -d -s "$FILE.bak" "$DIR/unityplayer_patch_${reltype}.vcdiff" "$FILE" | ||
then | ||
print_info notify "Patch applied! Enjoy the game." | ||
else | ||
try_mv "$FILE.bak" "$FILE" | ||
return 1 | ||
fi | ||
else | ||
return 1 | ||
fi | ||
fi | ||
[ ! -f "$WINEPREFIX/drive_c/users/$USER/Temp/mhyprot2.Sys" ] && try_cp "mhyprot2.Sys" "$WINEPREFIX/drive_c/users/$USER/Temp/" | ||
$WINE regedit mhyprot2_running.reg >/dev/null 2>&1 | ||
} | ||
|
||
if check_deps | ||
then | ||
if check_gi_patch | ||
then | ||
if ! launch_helper | ||
then | ||
lu_exit | ||
fi | ||
else | ||
lu_exit | ||
fi | ||
else | ||
lu_exit | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters