Last active
April 17, 2025 19:38
-
-
Save ToeKneeRED/7aac359e8d386c6e288dd2015d591207 to your computer and use it in GitHub Desktop.
HogWarp BuildId Updater
This file contains hidden or 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
:: Supply path to your HogwartsLegacyCreatorKit to change HogWarp CK plugin's BuildId | |
:: (can also supply your Creator Kit's parent folder) | |
:: ex. | |
:: .\HogWarpBuildIdUpdater.bat | |
:: .\HogwarpBuildIdUpdater.bat E:\Path\To\HogwartsLegacyCreatorKit | |
:: .\HogwarpBuildIdUpdater.bat E:\Path\To\ | |
@echo off | |
cls | |
title HogWarp BuildId Updater | |
setlocal enabledelayedexpansion | |
set argCount=0 | |
set argVec= | |
set debugMode= | |
set ckPath= | |
:HANDLE_ARGUMENTS | |
for %%x in (%*) do ( | |
set /A argCount+=1 | |
set "argVec[!argCount!]=%%~x" | |
if "%%~x"=="-debug" ( | |
set "debugMode=1" | |
) else if not "%%~x"=="" ( | |
set "ckPath=%%~x" | |
goto SKIP_PROMPT | |
) | |
) | |
:CK_FILE_PATH | |
set /p ckPath=Enter Creator Kit path: | |
set ckPath=%ckPath:"=% | |
:SKIP_PROMPT | |
if not defined ckPath ( | |
goto CK_FILE_PATH | |
) | |
:STRIP_PATH | |
if not "%ckPath:~-1%"=="\" ( | |
goto CK_DIRECTORY | |
) else ( | |
if not "%ckPath:~1%"==":\" ( | |
set "ckPath=%ckPath:~0,-1%" | |
) | |
) | |
:CK_DIRECTORY | |
for %%F in ("%ckPath%") do ( | |
set directory=%%~nxF | |
) | |
:CK_CHECK | |
if /I "%directory%"=="HogwartsLegacyCreatorKit" ( | |
goto VERSION_PATH | |
) else ( | |
set "ckPath=%ckPath%\HogwartsLegacyCreatorKit" | |
if not exist "!ckPath!" ( | |
echo Creator Kit not found | |
goto CK_FILE_PATH | |
) | |
) | |
:VERSION_PATH | |
set "versionPath=%ckPath%\Engine\Binaries\Win64\UE4Editor.version" | |
:VALIDATE_VERSION_FILE | |
if not exist "%versionPath%" ( | |
echo No version file found at: %versionPath% | |
goto CK_FILE_PATH | |
) else ( | |
echo Version file found at: %versionPath% | |
goto MODULE_PATH | |
) | |
:MODULE_PATH | |
set "modulePath=%ckPath%\PhoenixGame\Plugins\HogWarp\Binaries\Win64\UE4Editor.modules" | |
:VALIDATE_MODULE_FILE | |
if not exist "%modulePath%" ( | |
echo No module file found at: %modulePath% | |
echo There should be a 'HogWarp' folder in: %ckPath%\PhoenixGame\Plugins\ | |
echo Make sure you installed the HogWarp plugin in the correct spot! | |
goto CK_DIRECTORY | |
) else ( | |
echo Module file found at: %modulePath% | |
goto CK_BUILD_ID | |
) | |
:CK_BUILD_ID | |
set "ckBuildId=" | |
for /f "tokens=2 delims=:" %%A in ('findstr /C:"\"BuildId\"" "%versionPath%"') do ( | |
set "rawBuildId=%%A" | |
) | |
:CLEAN_CK_BUILD_ID | |
set "ckBuildId=%rawBuildId:"=%" | |
set "ckBuildId=%ckBuildId: =%" | |
set "ckBuildId=%ckBuildId:,=%" | |
:VALIDATE_CK_BUILD_ID | |
if not defined ckBuildId ( | |
echo ERROR: Failed to parse Creator Kit's BuildId | |
goto EXIT | |
) | |
echo Creator Kit BuildId: %ckBuildId% | |
:UPDATE_BUILD_ID | |
echo Updating HogWarp BuildId to match Creator Kit... | |
set "tempFile=%modulePath%.tmp" | |
break > "%tempFile%" | |
for /f "usebackq delims=" %%L in ("%modulePath%") do ( | |
set "line=%%L" | |
setlocal enabledelayedexpansion | |
echo !line! | findstr /C:"\"BuildId\"" >nul | |
if !errorlevel! == 0 ( | |
echo "BuildId": "%ckBuildId%",>>"%tempFile%" | |
) else ( | |
echo !line!>>"%tempFile%" | |
) | |
endlocal | |
) | |
move /Y "%tempFile%" "%modulePath%" >nul | |
echo HogWarp BuildId updated to: %ckBuildId% | |
goto EXIT | |
:EXIT | |
pause | |
exit /b 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment