enderalse/_build/build.cmd
2024-01-30 06:17:34 +01:00

73 lines
2.9 KiB (Stored with Git LFS)
Batchfile

@echo off
set "TARGET_DIR=%~dp0..\..\Enderal SE Build"
if exist "%TARGET_DIR%" rd /s /q "%TARGET_DIR%"
mkdir "%TARGET_DIR%"
cd /D "%TARGET_DIR%"
set "TARGET_DIR=%cd%"
set "BSARCH=%~dp0bsarch.exe"
set "TEMP_DIR=%~d0\__enderalreleasetemp"
cd /D "%~dp0.." || exit 1
set "SRC_DIR=%cd%"
cd /D "%~dp0."
call :resettemp
if not exist "%TEMP_DIR%\lodsettings" mkdir "%TEMP_DIR%\lodsettings"
if not exist "%TEMP_DIR%\meshes" mkdir "%TEMP_DIR%\meshes"
xcopy "%SRC_DIR%\lodsettings" "%TEMP_DIR%\lodsettings" /S /H /R /Y >nul
xcopy "%SRC_DIR%\meshes" "%TEMP_DIR%\meshes" /S /H /R /Y >nul
"%BSARCH%" pack "%TEMP_DIR%" "%TARGET_DIR%\E - Meshes.bsa" -q -sse -mt -share
call :resettemp
if not exist "%TEMP_DIR%\interface" mkdir "%TEMP_DIR%\interface"
if not exist "%TEMP_DIR%\strings" mkdir "%TEMP_DIR%\strings"
if not exist "%TEMP_DIR%\scripts" mkdir "%TEMP_DIR%\scripts"
xcopy "%SRC_DIR%\interface" "%TEMP_DIR%\interface" /S /H /R /Y >nul
xcopy "%SRC_DIR%\strings" "%TEMP_DIR%\strings" /S /H /R /Y >nul
xcopy "%SRC_DIR%\scripts" "%TEMP_DIR%\scripts" /S /H /R /Y >nul
rename "%TEMP_DIR%\scripts\SKSE_placeholder.pex" "SKSE.pex"
"%BSARCH%" pack "%TEMP_DIR%" "%TARGET_DIR%\E - Misc.bsa" -q -sse -mt
call :resettemp
if not exist "%TEMP_DIR%\textures" mkdir "%TEMP_DIR%\textures"
if not exist "%TEMP_DIR%\textures\enderal" mkdir "%TEMP_DIR%\textures\enderal"
xcopy "%SRC_DIR%\textures\enderal" "%TEMP_DIR%\textures\enderal" /S /H /R /Y >nul
for %%a IN (actors,armor) do rd /s /q "%TEMP_DIR%\textures\enderal\%%a"
"%BSARCH%" pack "%TEMP_DIR%" "%TARGET_DIR%\E - Textures2.bsa" -q -sse -mt -z -share
xcopy "%SRC_DIR%\textures" "%TEMP_DIR%\textures" /S /H /R /Y >nul
rd /s /q "%TEMP_DIR%\textures\enderal"
for %%a IN (actors,armor) do if not exist "%TEMP_DIR%\textures\enderal\%%a" mkdir "%TEMP_DIR%\textures\enderal\%%a"
for %%a IN (actors,armor) do xcopy "%SRC_DIR%\textures\enderal\%%a" "%TEMP_DIR%\textures\enderal\%%a" /S /H /R /Y >nul
"%BSARCH%" pack "%TEMP_DIR%" "%TARGET_DIR%\E - Textures1.bsa" -q -sse -mt -z -share
rd /s /q "%TEMP_DIR%"
echo Copying loose files...
for /f "tokens=* usebackq" %%a IN ("loose_files.txt") do call :copyloose "%%a"
if exist "%SRC_DIR%\..\Enderal SE - Media" xcopy "%SRC_DIR%\..\Enderal SE - Media" "%TARGET_DIR%" /S /H /R /Y >nul
cd /D "%~dp0.."
"%~dp07za.exe" a "%TARGET_DIR%\ScriptsEnderal.zip" "source\scripts"
cd /D "%~dp0..\source\Enderal DLL"
"%~dp07za.exe" a "%TARGET_DIR%\SKSE\Plugins\fs_src.zip" "." -x!build -x!.vs
cd /D "%~dp0..\source\Steam DLL"
"%~dp07za.exe" a "%TARGET_DIR%\SKSE\Plugins\fs_steam_src.zip" "." -x!build -x!.vs -x!gog
goto :eof
:resettemp
if exist "%TEMP_DIR%" rd /s /q "%TEMP_DIR%"
mkdir "%TEMP_DIR%"
goto :eof
:copyloose
if not exist "%TARGET_DIR%\%~1\..\." mkdir "%TARGET_DIR%\%~1\..\."
if exist "%SRC_DIR%\%~1" echo Copying %~1 && copy /Y "%SRC_DIR%\%~1" "%TARGET_DIR%\%~1" >nul
goto :eof