enderalse/_build/build.cmd
2021-11-30 02:19:29 +01:00

64 lines
2.8 KiB (Stored with Git LFS)
Batchfile

@echo off
set "BSARCH=%~dp0bsarch.exe"
set "TARGET_DIR=%~d0\Enderal SE Build"
set "TEMP_DIR=%~d0\__enderalreleasetemp"
cd /D "%~dp0.." || exit 1
set "SRC_DIR=%cd%"
cd /D "%~dp0."
if exist "%TARGET_DIR%" rd /s /q "%TARGET_DIR%"
mkdir "%TARGET_DIR%"
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
"%BSARCH%" pack "%TEMP_DIR%" "%TARGET_DIR%\E - Misc.bsa" -q -sse -mt
call :resettemp
for %%a IN (actors,architecture,armor,clutter,terrain,dungeons,dyndolod) do if not exist "%TEMP_DIR%\textures\%%a" mkdir "%TEMP_DIR%\textures\%%a"
for %%a IN (actors,architecture,armor,clutter,terrain,dungeons,dyndolod) do xcopy "%SRC_DIR%\textures\%%a" "%TEMP_DIR%\textures\%%a" /S /H /R /Y >nul
"%BSARCH%" pack "%TEMP_DIR%" "%TARGET_DIR%\E - Textures1.bsa" -q -sse -mt -z -share
call :resettemp
for %%a IN (actors,architecture,armor,forgottenstories,landscape) do if not exist "%TEMP_DIR%\textures\enderal\%%a" mkdir "%TEMP_DIR%\textures\enderal\%%a"
for %%a IN (actors,architecture,armor,forgottenstories,landscape) do xcopy "%SRC_DIR%\textures\enderal\%%a" "%TEMP_DIR%\textures\enderal\%%a" /S /H /R /Y >nul
"%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
for %%a IN (actors,architecture,armor,clutter,terrain,dungeons,dyndolod) do rd /s /q "%TEMP_DIR%\textures\%%a"
for %%a IN (actors,architecture,armor,forgottenstories,landscape) do rd /s /q "%TEMP_DIR%\textures\enderal\%%a"
"%BSARCH%" pack "%TEMP_DIR%" "%TARGET_DIR%\E - Textures3.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"
cd /D "%~dp0.."
"%~dp07za.exe" a "%TARGET_DIR%\ScriptsEnderal.zip" "source" -x!"source\fs.dll"
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