enderalse/_build/build.cmd
2022-08-04 01:38:20 +02:00

83 lines
3.6 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%\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
"%BSARCH%" pack "%TEMP_DIR%" "%TARGET_DIR%\E - Textures1.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"
"%BSARCH%" pack "%TEMP_DIR%" "%TARGET_DIR%\E - Textures2.bsa" -q -sse -mt -z -share
goto :eof
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\scripts" -i!"%~dp0How to modify Enderal scripts.txt"
cd /D "%~dp0..\source\Enderal DLL"
"%~dp07za.exe" a "%TARGET_DIR%\SKSE\Plugins\fs_src.zip" "." -x!build -x!.vs
copy /Y "%~dp0..\source\fs_steam_src.zip" "%TARGET_DIR%\SKSE\Plugins"
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