emergency fix for patcher (Darkshade version)
This commit is contained in:
parent
626515e333
commit
1ce46a4e47
3 changed files with 35 additions and 22 deletions
|
|
@ -1,14 +1,11 @@
|
|||
@echo off
|
||||
setlocal
|
||||
|
||||
REM Copy GAMEUPDATE.bat to a new file
|
||||
copy "gameupdate\patch.bat" "gameupdate\patch2.bat"
|
||||
|
||||
REM Run the new file
|
||||
call "gameupdate\patch2.bat"
|
||||
|
||||
REM Delete the new file
|
||||
del "gameupdate\patch2.bat"
|
||||
|
||||
endlocal
|
||||
@echo on
|
||||
pushd "%~dp0"
|
||||
if not exist "gameupdate\patch.bat" (
|
||||
echo ERROR: gameupdate\patch.bat not found!
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
call "gameupdate\patch.bat"
|
||||
popd
|
||||
endlocal
|
||||
|
|
@ -185,9 +185,9 @@ exit /b
|
|||
REM Escape single quotes in paths
|
||||
set "escaped_root=%ROOT_DIR:'=''%"
|
||||
|
||||
REM Download zip file to root
|
||||
REM Download zip file to root via GitLab API (bypasses Cloudflare DDoS protection)
|
||||
echo "Downloading latest patch..."
|
||||
!_my_shell! -Command "Set-Location -LiteralPath '%escaped_root%'; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri 'https://gitgud.io/%username%/%repo%/-/archive/%branch%/%repo%-%branch%.zip' -OutFile 'repo.zip'"
|
||||
!_my_shell! -Command "Set-Location -LiteralPath '%escaped_root%'; $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri 'https://gitgud.io/api/v4/projects/%username%%%2F%repo%/repository/archive.zip?sha=%branch%' -Headers @{'User-Agent'='git/2.0'} -OutFile 'repo.zip'"
|
||||
if !errorlevel! neq 0 (
|
||||
pause
|
||||
exit /b
|
||||
|
|
@ -204,11 +204,20 @@ if !errorlevel! neq 0 (
|
|||
exit /b
|
||||
)
|
||||
echo "Applying patch..."
|
||||
xcopy /s /e /y "%ROOT_DIR%\%repo%-%branch%\*" "%ROOT_DIR%\"
|
||||
if !errorlevel! neq 0 (
|
||||
REM API zip uses a different folder name (repo-branch-sha), find it dynamically
|
||||
set "EXTRACTED_DIR="
|
||||
for /d %%D in ("%ROOT_DIR%\%repo%-*") do set "EXTRACTED_DIR=%%D"
|
||||
if not defined EXTRACTED_DIR (
|
||||
echo Patch application failed - extracted folder not found!
|
||||
del "%ROOT_DIR%\repo.zip"
|
||||
pause
|
||||
exit /b
|
||||
)
|
||||
robocopy "!EXTRACTED_DIR!" "%ROOT_DIR%" /s /e /xf "GameUpdate.bat" "patch.bat"
|
||||
if !errorlevel! geq 8 (
|
||||
echo Patch application failed!
|
||||
del "%ROOT_DIR%\repo.zip"
|
||||
rmdir /s /q "%ROOT_DIR%\%repo%-%branch%"
|
||||
rmdir /s /q "!EXTRACTED_DIR!"
|
||||
pause
|
||||
exit /b
|
||||
)
|
||||
|
|
@ -256,7 +265,7 @@ if exist "%ROOT_DIR%\data.dts" (
|
|||
REM Clean up
|
||||
echo "Cleaning up..."
|
||||
del "%ROOT_DIR%\repo.zip"
|
||||
rmdir /s /q "%ROOT_DIR%\%repo%-%branch%"
|
||||
if defined EXTRACTED_DIR rmdir /s /q "!EXTRACTED_DIR!"
|
||||
del "%ROOT_DIR%\latest_patch_sha.txt"
|
||||
REM Store latest SHA for next check in gameupdate
|
||||
echo %latest_patch_sha% > "%SCRIPT_DIR%previous_patch_sha.txt"
|
||||
|
|
|
|||
|
|
@ -80,9 +80,9 @@ if [ -f "$ROOT_DIR/data.dts" ]; then
|
|||
fi
|
||||
|
||||
download_extract() {
|
||||
# Download zip file into root
|
||||
# Download zip file into root via GitLab API (bypasses Cloudflare DDoS protection)
|
||||
echo "Downloading latest patch..."
|
||||
curl -sL "https://gitgud.io/$username/$repo/-/archive/$branch/$repo-$branch.zip" -o "$ROOT_DIR/repo.zip"
|
||||
curl -sL -A "git/2.0" "https://gitgud.io/api/v4/projects/$username%2F$repo/repository/archive.zip?sha=$branch" -o "$ROOT_DIR/repo.zip"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Download failed!"
|
||||
rm -f "$ROOT_DIR/repo.zip"
|
||||
|
|
@ -101,7 +101,14 @@ download_extract() {
|
|||
fi
|
||||
|
||||
echo "Applying patch..."
|
||||
cp -r "$ROOT_DIR/$repo-$branch/"* "$ROOT_DIR/"
|
||||
# API zip uses a different folder name (repo-branch-sha), find it dynamically
|
||||
EXTRACTED_DIR=$(find "$ROOT_DIR" -maxdepth 1 -type d -name "${repo}-*" | head -1)
|
||||
if [ -z "$EXTRACTED_DIR" ]; then
|
||||
echo "Patch application failed - extracted folder not found!"
|
||||
rm -f "$ROOT_DIR/repo.zip"
|
||||
return 1
|
||||
fi
|
||||
cp -r "$EXTRACTED_DIR/"* "$ROOT_DIR/"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Patch application failed!"
|
||||
rm -f "$ROOT_DIR/repo.zip"
|
||||
|
|
@ -111,7 +118,7 @@ download_extract() {
|
|||
|
||||
echo "Cleaning up..."
|
||||
rm -f "$ROOT_DIR/repo.zip"
|
||||
rm -rf "$ROOT_DIR/$repo-$branch"
|
||||
[ -n "$EXTRACTED_DIR" ] && rm -rf "$EXTRACTED_DIR"
|
||||
rm -f "$ROOT_DIR/latest_patch_sha.txt"
|
||||
|
||||
# Store latest SHA for next check in gameupdate
|
||||
|
|
|
|||
Loading…
Reference in a new issue