-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmunge.bat
336 lines (294 loc) · 9.22 KB
/
munge.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
@echo off
setlocal enabledelayedexpansion
REM For a good explanation of delayed variable expansion type set /? at the command prompt
REM it is only explained in the command line help not the windows help
REM -------------- SETUP THE SCRIPT VARIABLES -------------------------
set WORLD_PARAMETERS=
set SIDE_PARAMETERS=
set MUNGE_LOAD=0
set MUNGE_SIDE=0
set MUNGE_COMMON=0
set MUNGE_SHELL=0
set MUNGE_MOVIES=0
set MUNGE_LOCALIZE=0
set MUNGE_SOUND=0
set MUNGE_PLATFORM=PC
set MUNGE_LANGVERSION=ENGLISH
set MUNGE_LANGDIR=ENG
set MUNGE_ALL=1
set DISPLAY_MESSAGES=1
set XBOX_COPY=1
REM -------------- PROCESS COMMAND LINE ARGS -------------------------
:whilescriptparameters
if "%1"=="" goto endscriptparameters
REM **NOTE**
REM the first goto statement inside of the compound conditional seems to help variable
REM expansion. It is needed so it doesn't expand all of the variable inside the
REM conditional before it runs the statements. Unfortunately we can use the delayed
REM expansion operator "!" on the special variables %0-%9
if /i "%1"=="/WORLD" (
REM this goto statement is needed read note above
goto :whileworldparameters
:whileworldparameters
shift
set parameter=%1
if "!parameter!" == "" goto whilescriptparameters
if "!parameter:~0,1!" == "/" goto whilescriptparameters
set WORLD_PARAMETERS=!parameter! !WORLD_PARAMETERS!
set MUNGE_ALL=0
goto whileworldparameters
) else if /i "%1"=="/SIDE" (
REM this goto statement is needed read note above
goto :whilesideparameters
:whilesideparameters
shift
set parameter=%1
if "!parameter!" == "" goto whilescriptparameters
if "!parameter:~0,1!" == "/" goto whilescriptparameters
set SIDE_PARAMETERS=!parameter! !SIDE_PARAMETERS!
set MUNGE_ALL=0
goto whilesideparameters
) else if /i "%1"=="/LOAD" (
set MUNGE_LOAD=1
set MUNGE_ALL=0
) else if /i "%1"=="/NOMESSAGES" (
set DISPLAY_MESSAGES=0
) else if /i "%1"=="/SOUND" (
set MUNGE_SOUND=1
set MUNGE_ALL=0
set MUNGESTREAMS=1
REM this goto statement is needed read note above
goto :whilesoundparameters
:whilesoundparameters
shift
set parameter=%1
if "!parameter!" == "" (
goto whilescriptparameters
) else if /i "!parameter!"=="NOSTREAMS" (
set MUNGESTREAMS=0
) else if "!parameter:~0,1!" == "/" (
goto whilescriptparameters
) else (
set SOUNDLVL=!parameter! !SOUNDLVL!
set MUNGE_ALL=0
)
goto whilesoundparameters
) else if /i "%1"=="/COMMON" (
set MUNGE_COMMON=1
set MUNGE_ALL=0
) else if /i "%1"=="/SHELL" (
set MUNGE_SHELL=1
set MUNGE_ALL=0
) else if /i "%1"=="/MOVIES" (
set MUNGE_MOVIES=1
set MUNGE_ALL=0
) else if /i "%1"=="/LOCALIZE" (
set MUNGE_LOCALIZE=1
set MUNGE_ALL=0
) else if /i "%1"=="/NOXBOXCOPY" (
set XBOX_COPY=0
) else if /i "%1"=="/PLATFORM" (
REM this goto statement is needed read note above
goto :whileplatformparameters
:whileplatformparameters
shift
set parameter=%1
if /i "!parameter!"=="PC" (
set MUNGE_PLATFORM=PC
) else if /i "!parameter!"=="PS2" (
set MUNGE_PLATFORM=PS2
) else if /i "!parameter!"=="XBOX" (
set MUNGE_PLATFORM=XBOX
) else (
echo "
echo "Error (Invalid Platform Parameter): %1
echo "
goto PRINT_USAGE_AND_EXIT
)
shift
goto whilescriptparameters
) else if /i "%1"=="/LANGUAGE" (
REM this goto statement is needed read note above
goto :whilelanguageparameters
:whilelanguageparameters
shift
set parameter=%1
if /i "!parameter!"=="ENGLISH" (
set MUNGE_PLATFORM=ENGLISH
set MUNGE_LANGDIR=ENG
) else if /i "!parameter!"=="UK" (
rem set MUNGE_PLATFORM=UK
set MUNGE_LANGDIR=UK_
set MUNGE_LANGVERSION=UK_
) else if /i "!parameter!"=="FRENCH" (
rem set MUNGE_PLATFORM=FRENCH
set MUNGE_LANGDIR=FRENCH
set MUNGE_LANGVERSION=FRENCH
) else if /i "!parameter!"=="GERMAN" (
rem set MUNGE_PLATFORM=GERMAN
set MUNGE_LANGDIR=GERMAN
set MUNGE_LANGVERSION=GERMAN
) else if /i "!parameter!"=="JAPANESE" (
rem set MUNGE_PLATFORM=JAPANESE
set MUNGE_LANGDIR=JAPANESE
set MUNGE_LANGVERSION=JAPANESE
) else if /i "!parameter!"=="ITALIAN" (
rem set MUNGE_PLATFORM=ITALIAN
set MUNGE_LANGDIR=ITALIAN
set MUNGE_LANGVERSION=ITALIAN
) else if /i "!parameter!"=="SPANISH" (
rem set MUNGE_PLATFORM=SPANISH
set MUNGE_LANGDIR=SPANISH
set MUNGE_LANGVERSION=SPANISH
) else (
echo "
echo "Error (Invalid Language Parameter): %1
echo "
goto PRINT_USAGE_AND_EXIT
)
shift
goto whilescriptparameters
) else (
echo "
echo "Error (Invalid Parameter): %1
echo "
goto PRINT_USAGE_AND_EXIT
)
shift
goto whilescriptparameters
:endscriptparameters
REM ----------- POST PROCESS SOME VARIABLES ---------------
IF /I "%MUNGE_LANGVERSION%"=="ENGLISH" (
set MUNGE_OVERRIDE_DIR=
) else (
set MUNGE_OVERRIDE_DIR=%MUNGE_PLATFORM%_%MUNGE_LANGDIR%
)
if /i "%WORLD_PARAMETERS%"=="" (
set WORLD_PARAMETERS=NOTHING
) else (
REM see if NOTHING then override the variable
for %%A in (%WORLD_PARAMETERS%) do (
if /i "%%A"=="NOTHING" (
set WORLD_PARAMETERS=NOTHING
)
)
)
if /i "%SIDE_PARAMETERS%"=="" (
set SIDE_PARAMETERS=NOTHING
) else (
REM see if NOTHING then override the variable
for %%A in (%SIDE_PARAMETERS%) do (
if /i "%%A"=="NOTHING" (
set SIDE_PARAMETERS=NOTHING
)
)
)
if %MUNGE_ALL% EQU 1 (
set WORLD_PARAMETERS=EVERYTHING
set SIDE_PARAMETERS=EVERYTHING
set MUNGE_LOAD=1
set MUNGE_SIDE=1
set MUNGE_COMMON=1
set MUNGE_SHELL=1
set MUNGE_MOVIES=1
set MUNGE_LOCALIZE=1
set MUNGE_SOUND=1
)
REM -------------- SETUP LOGGING -----------------------
set MUNGE_LOG="%CD%\%MUNGE_PLATFORM%_MungeLog.txt"
if exist %MUNGE_LOG% ( del %MUNGE_LOG% )
REM echo ********************************************************************* >> %MUNGE_LOG%
REM echo munge.bat %MUNGE_PLATFORM% %MUNGE_LANGVERSION% >> %MUNGE_LOG%
REM echo MUNGE_BIN_DIR=%MUNGE_BIN_DIR% >> %MUNGE_LOG%
REM echo MUNGE_OVERRIDE_DIR=_SOURCE_%MUNGE_LANGVERSION% >> %MUNGE_LOG%
REM echo MUNGE_LANGDIR=_SOURCE_%MUNGE_LANGDIR% >> %MUNGE_LOG%
REM echo ********************************************************************* >> %MUNGE_LOG%
REM if "%MUNGE_BIN_DIR%"=="" (
set MUNGE_BIN_DIR=%CD%\..\..\ToolsFL\Bin
REM echo MUNGE_BIN_DIR=%MUNGE_BIN_DIR%
REM set PATH=%CD%\..\..\ToolsFL\Bin;%PATH%
REM )
REM -------------- MUNGE COMMON -----------------------
if %MUNGE_COMMON% EQU 1 (
echo Common\munge %MUNGE_PLATFORM%
cd Common
call munge.bat %MUNGE_PLATFORM%
cd ..
)
REM -------------- MUNGE SHELL -----------------------
if %MUNGE_SHELL% EQU 1 (
echo Shell\munge %MUNGE_PLATFORM%
cd Shell
call munge.bat %MUNGE_PLATFORM%
cd ..
)
REM -------------- MUNGE LOAD -----------------------
if %MUNGE_LOAD% EQU 1 (
echo Load\munge %MUNGE_PLATFORM%
cd Load
call munge.bat %MUNGE_PLATFORM%
cd ..
)
REM -------------- MUNGE SIDES -----------------------
if /i "%SIDE_PARAMETERS%" NEQ "NOTHING" (
echo Sides\munge %MUNGE_PLATFORM%
cd Sides
call munge.bat %MUNGE_PLATFORM% %SIDE_PARAMETERS%
cd ..
)
REM -------------- MUNGE WORLDS -----------------------
if /i "%WORLD_PARAMETERS%" NEQ "NOTHING" (
echo Worlds\munge %MUNGE_PLATFORM%
cd Worlds
call munge.bat %MUNGE_PLATFORM% %WORLD_PARAMETERS%
cd ..
)
REM -------------- MUNGE SOUNDS -----------------------
if %MUNGE_SOUND% EQU 1 (
echo Sound\munge %MUNGE_PLATFORM%
cd Sound
call munge.bat %MUNGE_PLATFORM%
cd ..
)
if /I "%MUNGE_PLATFORM%"=="XBOX" (
if %XBOX_COPY% EQU 1 (
echo Copying files to XBOX...
echo on
xbcp -d -y -t -r -f ..\_lvl_xbox\*.lvl xe:\Battlefront2\Data\_lvl_xbox\ 2>>%MUNGE_LOG%
xbcp -d -y -t -r -f ..\_lvl_xbox\*.mvs xe:\Battlefront2\Data\_lvl_xbox\ 2>>%MUNGE_LOG%
xbcp -d -y -t -r -f ..\sound\global\dsstdfx.bin xe:\Battlefront2\Data\ 2>>%MUNGE_LOG%
@echo off
)
)
REM If the munge log has anything in it, view it
if %DISPLAY_MESSAGES% EQU 1 (
for /f %%i in (%MUNGE_LOG%) do (if %%~zi GTR 0 ( start Notepad.exe %MUNGE_LOG% ) else ( if exist %MUNGE_LOG% (del %MUNGE_LOG%) ) )
)
REM pause
goto END
REM -------------- PRINT SCRIPT USAGE AND EXIT -----------------------
:PRINT_USAGE_AND_EXIT
echo "Usage: munge [/PLATFORM [PC|PS2|XBOX]]
echo " [/LANGUAGE [ENGLISH|UK|FRENCH|GERMAN|JAPANESE|ITALIAN|SPANISH]]
echo " [/WORLD [EVERYTHING|NOTHING|<world1> <world2> ...]]
echo " [/SIDE [EVERYTHING|NOTHING|<side1> <side2> ...]]
echo " [/LOAD] [/SOUND] [/COMMON] [/SHELL] [/MOVIES] [/LOCALIZE]
echo "
echo "Options:
echo " If no parameters are specified then everything is munged.
echo " /PLATFORM The platform to munge the data for (default PC)
echo " /LANGUAGE The lanuage used for building (default ENGLISH)
echo " /WORLD Selectively munges world data. If "EVERYTHING" or "NOTHING" is
echo " specified all world data is munged or not respectively
echo " /SIDE Selectively munges side data. If "EVERYTHING" or "NOTHING" is
echo " specified all side data is munged or not respectively
echo " /LOAD If specified munges loading screen data
echo " /SOUND If specified munges sound data
echo " /COMMON If specified munges common data
echo " /SHELL If specified munges shell data
echo " /MOVIES If specified munges movie data
echo " /LOCALIZE If specified munges localization data
echo " /NOXBOXCOPY If specified skips the data copy to the xbox
REM -------------- EXIT SCRIPT -----------------------
:END
endlocal