forked from X2CommunityCore/X2WOTCCommunityHighlander
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CookCommunityHighlander.bat
137 lines (116 loc) · 7.2 KB
/
CookCommunityHighlander.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
@echo off
pushd "%~dp0"
SetLocal EnableDelayedExpansion
REM Set the variables below with your game and SDK filepaths, then run the script. Each value should end with double quotes
REM Each variable should be formatted like this "SDKLocation=.\steamapps\common\XCOM 2 War of the Chosen SDK"
SET "SDKLocation=.\steamapps\common\XCOM 2 War of the Chosen SDK"
SET "GameLocation=.\steamapps\common\XCOM 2\XCom2-WarOfTheChosen"
REM When set to 'y', this variable will trigger the user's default notify sound upon completion
SET "UseCompletionSound=y"
REM Verify folders exist before proceeding
echo Verifying SDK and game folders exist...
if not exist "%SDKLocation%" GOTO MissingSDKFolder
if not exist "%GameLocation%" GOTO MissingGameFolder
REM One time only: Create the CookedPCConsole folders in the SDK and output mod directory
echo.
if not exist "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole" (
echo.
echo Creating CookedPCConsole Mod directory...
mkdir "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole"
)
if not exist "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole" (
echo.
echo Creating CookedPCConsole SDK directory...
mkdir "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole"
)
if not exist "%SDKLocation%\XComGame\Published" (
echo.
echo Creating Published SDK directory...
mkdir "%SDKLocation%\XComGame\Published"
)
if not exist "%SDKLocation%\XComGame\Published\CookedPCConsole" (
echo.
echo Creating Published\CookedPCConsole SDK directory...
mkdir "%SDKLocation%\XComGame\Published\CookedPCConsole"
)
REM One time only: Copy specific CookedPCConsole files from vanilla to the SDK, if they don't exist. These are required for a successful cook.
if not exist "%SDKLocation%\XComGame\Published\CookedPCConsole\GuidCache.upk" (
echo.
echo Copying GuidCache.upk to CookedPCConsole folder...
copy /Y "%GameLocation%\XComGame\CookedPCConsole\GuidCache.upk" "%SDKLocation%\XComGame\Published\CookedPCConsole\GuidCache.upk"
)
if not exist "%SDKLocation%\XComGame\Published\CookedPCConsole\GlobalPersistentCookerData.upk" (
echo.
echo Copying GlobalPersistentCookerData.upk to CookedPCConsole folder...
copy /Y "%GameLocation%\XComGame\CookedPCConsole\GlobalPersistentCookerData.upk" "%SDKLocation%\XComGame\Published\CookedPCConsole\GlobalPersistentCookerData.upk"
)
if not exist "%SDKLocation%\XComGame\Published\CookedPCConsole\PersistentCookerShaderData.bin" (
echo.
echo Copying PersistentCookerShaderData.bin to CookedPCConsole folder...
copy /Y "%GameLocation%\XComGame\CookedPCConsole\PersistentCookerShaderData.bin" "%SDKLocation%\XComGame\Published\CookedPCConsole\PersistentCookerShaderData.bin"
)
if not exist "%SDKLocation%\XComGame\Published\CookedPCConsole\*.tfc" (
echo.
echo Copying .tfc files to CookedPCConsole folder...
robocopy "%GameLocation%\XComGame\CookedPCConsole" "%SDKLocation%\XComGame\Published\CookedPCConsole" *.tfc /njh
)
echo.
echo Making final release...
"%SDKLocation%\Binaries\Win64\XComGame.exe" make -final_release -full -nopause
if %ERRORLEVEL% NEQ 0 GOTO BUILD_ERROR
echo.
echo Cooking packages...
"%SDKLocation%\Binaries\Win64\XComGame.exe" CookPackages -platform=pcconsole -final_release -quickanddirty -modcook -sha -multilanguagecook=INT+FRA+ITA+DEU+RUS+POL+KOR+ESN -singlethread -nopause
if %ERRORLEVEL% NEQ 0 GOTO BUILD_ERROR
echo.
echo Copying XComGame.upk to local Highlander mod folder...
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\XComGame.upk" "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\XComGame.upk"
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\XComGame.upk.uncompressed_size" "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\XComGame.upk.uncompressed_size"
echo.
echo Copying XComGame.upk to SDK Highlander mod folder...
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\XComGame.upk" "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\XComGame.upk"
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\XComGame.upk.uncompressed_size" "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\XComGame.upk.uncompressed_size"
echo.
echo Copying Engine.upk to local Highlander mod folder...
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\Engine.upk" "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\Engine.upk"
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\Engine.upk.uncompressed_size" "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\Engine.upk.uncompressed_size"
echo.
echo Copying Engine.upk to SDK Highlander mod folder...
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\Engine.upk" "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\Engine.upk"
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\Engine.upk.uncompressed_size" "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\Engine.upk.uncompressed_size"
echo.
echo Copying Core.upk to local Highlander mod folder...
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\Core.upk" "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\Core.upk"
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\Core.upk.uncompressed_size" "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\Core.upk.uncompressed_size"
echo.
echo Copying Core.upk to SDK Highlander mod folder...
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\Core.upk" "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\Core.upk"
copy /Y "%SDKLocation%\XComGame\Published\CookedPCConsole\Core.upk.uncompressed_size" "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\CookedPCConsole\Core.upk.uncompressed_size"
echo.
echo Cleaning up...
if exist "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\XComGame.u" del "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\XComGame.u"
if exist "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\XComGame.u" del "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\XComGame.u"
if exist "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\Engine.u" del "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\Engine.u"
if exist "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\Engine.u" del "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\Engine.u"
if exist "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\Core.u" del "%GameLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\Core.u"
if exist "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\Core.u" del "%SDKLocation%\XComGame\Mods\X2WOTCCommunityHighlander\Script\Core.u"
echo.
echo.
echo Done.
GOTO END
:MissingSDKFolder
echo The folder '%SDKLocation%' does not exist. Please edit the SDKLocation variable in the script and retry.
GOTO END
:MissingGameFolder
echo The folder '%GameLocation%' does not exist. Please edit the GameLocation variable in the script and retry.
GOTO END
:BUILD_ERROR
echo Errors occured^^! Exit Code: %ERRORLEVEL%
echo.
set /p OpenLogfile=Open the build logfile to review errors [y/n]?:
if !OpenLogfile!==y "%SDKLocation%\XComGame\Logs\Launch.log"
GOTO END
:END
if %UseCompletionSound%==y echo
popd
pause