Include m5kro's patch
This commit is contained in:
parent
cad31a0967
commit
98dbc3b017
3 changed files with 81 additions and 3 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
|
@ -1,7 +1,7 @@
|
|||
# Ignore all files
|
||||
*.*
|
||||
|
||||
# Except
|
||||
# File Types
|
||||
!*.mps
|
||||
!*.dat
|
||||
!*.json
|
||||
|
|
@ -16,12 +16,15 @@
|
|||
!*.ks
|
||||
!*.tjs
|
||||
!*.yaml
|
||||
!Data/*
|
||||
!*.rb
|
||||
|
||||
# Other Needed Files
|
||||
!Data/*
|
||||
!.gitignore
|
||||
!README.md
|
||||
!UPDATE.bat
|
||||
|
||||
!# Images
|
||||
# Images
|
||||
!gauge_frame.png_
|
||||
!ornament_frame2ー2.png_
|
||||
!メニュー背景用.png_
|
||||
72
UPDATE.bat
Normal file
72
UPDATE.bat
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
REM Check if patch-config.txt exists
|
||||
if not exist patch-config.txt (
|
||||
echo "Config file (patch-config.txt) not found! Assuming no patching needed."
|
||||
exit /b
|
||||
)
|
||||
|
||||
REM Read configuration from file
|
||||
for /f "tokens=1,2 delims==" %%a in (patch-config.txt) do (
|
||||
if "%%a"=="username" set "username=%%b"
|
||||
if "%%a"=="repo" set "repo=%%b"
|
||||
if "%%a"=="branch" set "branch=%%b"
|
||||
)
|
||||
|
||||
REM Get the latest hash
|
||||
echo "Getting latest commit SHA hash"
|
||||
powershell -Command "(Invoke-WebRequest -Uri 'https://api.github.com/repos/%username%/%repo%/branches/%branch%').Content | ConvertFrom-Json | Select-Object -ExpandProperty commit | Select-Object -ExpandProperty sha" > latest_patch_sha.txt
|
||||
|
||||
REM Read the latest SHA from the file
|
||||
set /p latest_patch_sha=<latest_patch_sha.txt
|
||||
|
||||
REM Check if previous_patch_sha.txt exists
|
||||
if not exist previous_patch_sha.txt (
|
||||
echo "Previous SHA hash not found!"
|
||||
echo "Assuming first time patching..."
|
||||
goto download_extract
|
||||
)
|
||||
|
||||
REM Read the stored SHA from previous check
|
||||
set /p previous_patch_sha=<previous_patch_sha.txt
|
||||
|
||||
REM Trim whitespace from SHA strings
|
||||
set "previous_patch_sha=%previous_patch_sha: =%"
|
||||
set "latest_patch_sha=%latest_patch_sha: =%"
|
||||
|
||||
REM Compare trimmed SHAs
|
||||
if "%latest_patch_sha%" neq "%previous_patch_sha%" (
|
||||
echo "Update found! Patching...
|
||||
goto download_extract
|
||||
) else (
|
||||
echo "Patch is up to date."
|
||||
)
|
||||
|
||||
REM Delete latest_patch_sha.txt
|
||||
del latest_patch_sha.txt
|
||||
|
||||
endlocal
|
||||
exit /b
|
||||
|
||||
:download_extract
|
||||
REM Download zip file
|
||||
echo "Downloading latest patch..."
|
||||
powershell -Command "Invoke-WebRequest -Uri 'https://codeload.github.com/%username%/%repo%/zip/refs/heads/%branch%' -OutFile 'repo.zip'"
|
||||
|
||||
REM Extract contents, overwriting conflicts
|
||||
echo "Extracting..."
|
||||
powershell -Command "Expand-Archive -Path '.\repo.zip' -DestinationPath '.' -Force"
|
||||
echo "Applying patch..."
|
||||
xcopy /s /e /y ".\%repo%-%branch%\*" "."
|
||||
|
||||
REM Clean up
|
||||
echo "Cleaning up..."
|
||||
del repo.zip
|
||||
rmdir /s /q ".\%repo%-main"
|
||||
del latest_patch_sha.txt
|
||||
|
||||
REM Store latest SHA for next check
|
||||
echo %latest_patch_sha% > previous_patch_sha.txt
|
||||
endlocal
|
||||
exit /b
|
||||
3
patch-config.txt
Normal file
3
patch-config.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
username=DazedMTL
|
||||
repo=Academy-Nymphomania
|
||||
branch=main
|
||||
Loading…
Reference in a new issue