| 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 |
#define PATH_INIT_C |
| 31 |
|
| 32 |
|
| 33 |
#include "q3map2.h" |
| 34 |
|
| 35 |
|
| 36 |
#define MAX_BASE_PATHS 10 |
| 37 |
#define MAX_GAME_PATHS 10 |
| 38 |
#define MAX_PAK_PATHS 200 |
| 39 |
|
| 40 |
qboolean customHomePath = qfalse; |
| 41 |
char *homePath; |
| 42 |
|
| 43 |
#if GDEF_OS_MACOS |
| 44 |
char *macLibraryApplicationSupportPath; |
| 45 |
#elif GDEF_OS_XDG |
| 46 |
char *xdgDataHomePath; |
| 47 |
#endif |
| 48 |
|
| 49 |
char installPath[ MAX_OS_PATH ]; |
| 50 |
|
| 51 |
int numBasePaths; |
| 52 |
char *basePaths[ MAX_BASE_PATHS ]; |
| 53 |
int numGamePaths; |
| 54 |
char *gamePaths[ MAX_GAME_PATHS ]; |
| 55 |
int numPakPaths; |
| 56 |
char *pakPaths[ MAX_PAK_PATHS ]; |
| 57 |
char *homeBasePath = NULL; |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
char *LokiGetHomeDir( void ){ |
| 71 |
#if GDEF_OS_WINDOWS |
| 72 |
return NULL; |
| 73 |
#else |
| 74 |
static char buf[ 4096 ]; |
| 75 |
struct passwd pw, *pwp; |
| 76 |
char *home; |
| 77 |
|
| 78 |
|
| 79 |
home = getenv( "HOME" ); |
| 80 |
|
| 81 |
|
| 82 |
if( home == NULL ) |
| 83 |
{ |
| 84 |
if ( getpwuid_r( getuid(), &pw, buf, sizeof( buf ), &pwp ) == 0 ) { |
| 85 |
return pw.pw_dir; |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
return home; |
| 91 |
#endif |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
void LokiInitPaths( char *argv0 ){ |
| 102 |
char *home; |
| 103 |
|
| 104 |
if ( homePath == NULL ) { |
| 105 |
|
| 106 |
home = LokiGetHomeDir(); |
| 107 |
if ( home == NULL ) { |
| 108 |
home = "."; |
| 109 |
} |
| 110 |
|
| 111 |
|
| 112 |
homePath = home; |
| 113 |
} |
| 114 |
else{ |
| 115 |
home = homePath; |
| 116 |
} |
| 117 |
|
| 118 |
#if GDEF_OS_MACOS |
| 119 |
char *subPath = "/Library/Application Support"; |
| 120 |
macLibraryApplicationSupportPath = safe_malloc( sizeof( char ) * ( strlen( home ) + strlen( subPath ) ) + 1 ); |
| 121 |
sprintf( macLibraryApplicationSupportPath, "%s%s", home, subPath ); |
| 122 |
#elif GDEF_OS_XDG |
| 123 |
xdgDataHomePath = getenv( "XDG_DATA_HOME" ); |
| 124 |
|
| 125 |
if ( xdgDataHomePath == NULL ) { |
| 126 |
char *subPath = "/.local/share"; |
| 127 |
xdgDataHomePath = safe_malloc( sizeof( char ) * ( strlen( home ) + strlen( subPath ) ) + 1 ); |
| 128 |
sprintf( xdgDataHomePath, "%s%s", home, subPath ); |
| 129 |
} |
| 130 |
#endif |
| 131 |
|
| 132 |
#if GDEF_OS_WINDOWS |
| 133 |
|
| 134 |
strcpy( installPath, "../" ); |
| 135 |
#else |
| 136 |
|
| 137 |
char temp[ MAX_OS_PATH ]; |
| 138 |
char *path; |
| 139 |
char *last; |
| 140 |
qboolean found; |
| 141 |
|
| 142 |
|
| 143 |
path = getenv( "PATH" ); |
| 144 |
|
| 145 |
|
| 146 |
Q_strncpyz( temp, argv0, sizeof( temp ) ); |
| 147 |
if ( strrchr( temp, '/' ) ) { |
| 148 |
argv0 = strrchr( argv0, '/' ) + 1; |
| 149 |
} |
| 150 |
else if ( path != NULL ) { |
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
found = qfalse; |
| 171 |
last = path; |
| 172 |
|
| 173 |
|
| 174 |
while ( last[ 0 ] != '\0' && found == qfalse ) |
| 175 |
{ |
| 176 |
|
| 177 |
temp[ 0 ] = '\0'; |
| 178 |
|
| 179 |
|
| 180 |
last = strchr( path, ':' ); |
| 181 |
if ( last == NULL ) { |
| 182 |
last = path + strlen( path ); |
| 183 |
} |
| 184 |
|
| 185 |
|
| 186 |
if ( *path == '~' ) { |
| 187 |
Q_strncpyz( temp, home, sizeof( temp ) ); |
| 188 |
path++; |
| 189 |
} |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
if ( last > ( path + 1 ) ) { |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
Q_strncat( temp, sizeof( temp ), path, ( last - path + 1) ); |
| 198 |
Q_strcat( temp, sizeof( temp ), "/" ); |
| 199 |
} |
| 200 |
Q_strcat( temp, sizeof( temp ), argv0 ); |
| 201 |
|
| 202 |
|
| 203 |
if ( access( temp, X_OK ) == 0 ) { |
| 204 |
found = qtrue; |
| 205 |
} |
| 206 |
path = last + 1; |
| 207 |
} |
| 208 |
} |
| 209 |
|
| 210 |
|
| 211 |
if ( realpath( temp, installPath ) ) { |
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
*( strrchr( installPath, '/' ) ) = '\0'; |
| 217 |
*( strrchr( installPath, '/' ) ) = '\0'; |
| 218 |
} |
| 219 |
#endif |
| 220 |
} |
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
void CleanPath( char *path ){ |
| 230 |
while ( *path ) |
| 231 |
{ |
| 232 |
if ( *path == '\\' ) { |
| 233 |
*path = '/'; |
| 234 |
} |
| 235 |
path++; |
| 236 |
} |
| 237 |
} |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
game_t *GetGame( char *arg ){ |
| 248 |
int i; |
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
if ( arg == NULL || arg[ 0 ] == '\0' ) { |
| 253 |
return NULL; |
| 254 |
} |
| 255 |
|
| 256 |
|
| 257 |
if ( !Q_stricmp( arg, "quake1" ) || |
| 258 |
!Q_stricmp( arg, "quake2" ) || |
| 259 |
!Q_stricmp( arg, "unreal" ) || |
| 260 |
!Q_stricmp( arg, "ut2k3" ) || |
| 261 |
!Q_stricmp( arg, "dn3d" ) || |
| 262 |
!Q_stricmp( arg, "dnf" ) || |
| 263 |
!Q_stricmp( arg, "hl" ) ) { |
| 264 |
Sys_Printf( "April fools, silly rabbit!\n" ); |
| 265 |
exit( 0 ); |
| 266 |
} |
| 267 |
|
| 268 |
|
| 269 |
i = 0; |
| 270 |
while ( games[ i ].arg != NULL ) |
| 271 |
{ |
| 272 |
if ( Q_stricmp( arg, games[ i ].arg ) == 0 ) { |
| 273 |
return &games[ i ]; |
| 274 |
} |
| 275 |
i++; |
| 276 |
} |
| 277 |
|
| 278 |
|
| 279 |
return NULL; |
| 280 |
} |
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
void AddBasePath( char *path ){ |
| 290 |
|
| 291 |
if ( path == NULL || path[ 0 ] == '\0' || numBasePaths >= MAX_BASE_PATHS ) { |
| 292 |
return; |
| 293 |
} |
| 294 |
|
| 295 |
|
| 296 |
basePaths[ numBasePaths ] = safe_malloc( strlen( path ) + 1 ); |
| 297 |
strcpy( basePaths[ numBasePaths ], path ); |
| 298 |
CleanPath( basePaths[ numBasePaths ] ); |
| 299 |
if ( EnginePath[0] == '\0' ) strcpy( EnginePath, basePaths[ numBasePaths ] ); |
| 300 |
numBasePaths++; |
| 301 |
} |
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
void AddHomeBasePath( char *path ){ |
| 311 |
int i; |
| 312 |
char temp[ MAX_OS_PATH ]; |
| 313 |
|
| 314 |
if ( homePath == NULL ) { |
| 315 |
return; |
| 316 |
} |
| 317 |
|
| 318 |
|
| 319 |
if ( path == NULL || path[ 0 ] == '\0' ) { |
| 320 |
return; |
| 321 |
} |
| 322 |
|
| 323 |
if ( strcmp( path, "." ) == 0 ) { |
| 324 |
|
| 325 |
strcpy( temp, homePath ); |
| 326 |
} |
| 327 |
else { |
| 328 |
char *tempHomePath; |
| 329 |
tempHomePath = homePath; |
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
#if GDEF_OS_MACOS |
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
tempHomePath = macLibraryApplicationSupportPath; |
| 344 |
path = path + 1; |
| 345 |
#elif GDEF_OS_XDG |
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
sprintf( temp, "%s/%s", xdgDataHomePath, ( path + 1 ) ); |
| 362 |
if ( access( temp, X_OK ) == 0 ) { |
| 363 |
if ( customHomePath == qfalse ) { |
| 364 |
tempHomePath = xdgDataHomePath; |
| 365 |
} |
| 366 |
path = path + 1; |
| 367 |
} |
| 368 |
#endif |
| 369 |
|
| 370 |
|
| 371 |
sprintf( temp, "%s/%s", tempHomePath, path ); |
| 372 |
} |
| 373 |
|
| 374 |
|
| 375 |
for ( i = ( MAX_BASE_PATHS - 2 ); i >= 0; i-- ) |
| 376 |
basePaths[ i + 1 ] = basePaths[ i ]; |
| 377 |
|
| 378 |
|
| 379 |
basePaths[ 0 ] = safe_malloc( strlen( temp ) + 1 ); |
| 380 |
strcpy( basePaths[ 0 ], temp ); |
| 381 |
CleanPath( basePaths[ 0 ] ); |
| 382 |
numBasePaths++; |
| 383 |
} |
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
void AddGamePath( char *path ){ |
| 393 |
int i; |
| 394 |
|
| 395 |
|
| 396 |
if ( path == NULL || path[ 0 ] == '\0' || numGamePaths >= MAX_GAME_PATHS ) { |
| 397 |
return; |
| 398 |
} |
| 399 |
|
| 400 |
|
| 401 |
gamePaths[ numGamePaths ] = safe_malloc( strlen( path ) + 1 ); |
| 402 |
strcpy( gamePaths[ numGamePaths ], path ); |
| 403 |
CleanPath( gamePaths[ numGamePaths ] ); |
| 404 |
numGamePaths++; |
| 405 |
|
| 406 |
|
| 407 |
for ( i = 0; i < numGamePaths - 1; i++ ) |
| 408 |
{ |
| 409 |
if ( strcmp( gamePaths[i], gamePaths[numGamePaths - 1] ) == 0 ) { |
| 410 |
free( gamePaths[numGamePaths - 1] ); |
| 411 |
gamePaths[numGamePaths - 1] = NULL; |
| 412 |
numGamePaths--; |
| 413 |
break; |
| 414 |
} |
| 415 |
} |
| 416 |
|
| 417 |
} |
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
void AddPakPath( char *path ){ |
| 426 |
|
| 427 |
if ( path == NULL || path[ 0 ] == '\0' || numPakPaths >= MAX_PAK_PATHS ) { |
| 428 |
return; |
| 429 |
} |
| 430 |
|
| 431 |
|
| 432 |
pakPaths[ numPakPaths ] = safe_malloc( strlen( path ) + 1 ); |
| 433 |
strcpy( pakPaths[ numPakPaths ], path ); |
| 434 |
CleanPath( pakPaths[ numPakPaths ] ); |
| 435 |
numPakPaths++; |
| 436 |
} |
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
void InitPaths( int *argc, char **argv ){ |
| 447 |
int i, j, k, len, len2; |
| 448 |
char temp[ MAX_OS_PATH ]; |
| 449 |
|
| 450 |
int noBasePath = 0; |
| 451 |
int noHomePath = 0; |
| 452 |
int noMagicPath = 0; |
| 453 |
|
| 454 |
|
| 455 |
Sys_FPrintf( SYS_VRB, "--- InitPaths ---\n" ); |
| 456 |
|
| 457 |
|
| 458 |
LokiInitPaths( argv[ 0 ] ); |
| 459 |
|
| 460 |
|
| 461 |
game = &games[ 0 ]; |
| 462 |
numBasePaths = 0; |
| 463 |
numGamePaths = 0; |
| 464 |
|
| 465 |
EnginePath[0] = '\0'; |
| 466 |
|
| 467 |
|
| 468 |
for ( i = 0; i < *argc; i++ ) |
| 469 |
{ |
| 470 |
|
| 471 |
if ( argv[ i ] == NULL ) { |
| 472 |
continue; |
| 473 |
} |
| 474 |
|
| 475 |
|
| 476 |
if ( strcmp( argv[ i ], "-game" ) == 0 ) { |
| 477 |
if ( ++i >= *argc || !argv[ i ] ) { |
| 478 |
Error( "Out of arguments: No game specified after %s", argv[ i - 1 ] ); |
| 479 |
} |
| 480 |
argv[ i - 1 ] = NULL; |
| 481 |
game = GetGame( argv[ i ] ); |
| 482 |
if ( game == NULL ) { |
| 483 |
game = &games[ 0 ]; |
| 484 |
} |
| 485 |
argv[ i ] = NULL; |
| 486 |
} |
| 487 |
|
| 488 |
|
| 489 |
else if ( strcmp( argv[ i ], "-fs_forbiddenpath" ) == 0 ) { |
| 490 |
if ( ++i >= *argc || !argv[ i ] ) { |
| 491 |
Error( "Out of arguments: No path specified after %s.", argv[ i - 1 ] ); |
| 492 |
} |
| 493 |
argv[ i - 1 ] = NULL; |
| 494 |
if ( g_numForbiddenDirs < VFS_MAXDIRS ) { |
| 495 |
strncpy( g_strForbiddenDirs[g_numForbiddenDirs], argv[i], PATH_MAX ); |
| 496 |
g_strForbiddenDirs[g_numForbiddenDirs][PATH_MAX] = 0; |
| 497 |
++g_numForbiddenDirs; |
| 498 |
} |
| 499 |
argv[ i ] = NULL; |
| 500 |
} |
| 501 |
|
| 502 |
|
| 503 |
else if ( strcmp( argv[ i ], "-fs_nobasepath" ) == 0 ) { |
| 504 |
noBasePath = 1; |
| 505 |
|
| 506 |
noMagicPath = 1; |
| 507 |
argv[ i ] = NULL; |
| 508 |
} |
| 509 |
|
| 510 |
|
| 511 |
else if ( strcmp( argv[ i ], "-fs_nomagicpath") == 0) { |
| 512 |
noMagicPath = 1; |
| 513 |
argv[ i ] = NULL; |
| 514 |
} |
| 515 |
|
| 516 |
|
| 517 |
else if ( strcmp( argv[ i ], "-fs_basepath" ) == 0 ) { |
| 518 |
if ( ++i >= *argc || !argv[ i ] ) { |
| 519 |
Error( "Out of arguments: No path specified after %s.", argv[ i - 1 ] ); |
| 520 |
} |
| 521 |
argv[ i - 1 ] = NULL; |
| 522 |
AddBasePath( argv[ i ] ); |
| 523 |
argv[ i ] = NULL; |
| 524 |
} |
| 525 |
|
| 526 |
|
| 527 |
else if ( strcmp( argv[ i ], "-fs_game" ) == 0 ) { |
| 528 |
if ( ++i >= *argc || !argv[ i ] ) { |
| 529 |
Error( "Out of arguments: No path specified after %s.", argv[ i - 1 ] ); |
| 530 |
} |
| 531 |
argv[ i - 1 ] = NULL; |
| 532 |
AddGamePath( argv[ i ] ); |
| 533 |
argv[ i ] = NULL; |
| 534 |
} |
| 535 |
|
| 536 |
|
| 537 |
else if ( strcmp( argv[ i ], "-fs_home" ) == 0 ) { |
| 538 |
if ( ++i >= *argc || !argv[ i ] ) { |
| 539 |
Error( "Out of arguments: No path specified after %s.", argv[ i - 1 ] ); |
| 540 |
} |
| 541 |
argv[ i - 1 ] = NULL; |
| 542 |
customHomePath = qtrue; |
| 543 |
homePath = argv[i]; |
| 544 |
argv[ i ] = NULL; |
| 545 |
} |
| 546 |
|
| 547 |
|
| 548 |
else if ( strcmp( argv[ i ], "-fs_nohomepath" ) == 0 ) { |
| 549 |
noHomePath = 1; |
| 550 |
argv[ i ] = NULL; |
| 551 |
} |
| 552 |
|
| 553 |
|
| 554 |
else if ( strcmp( argv[ i ], "-fs_homebase" ) == 0 ) { |
| 555 |
if ( ++i >= *argc || !argv[ i ] ) { |
| 556 |
Error( "Out of arguments: No path specified after %s.", argv[ i - 1 ] ); |
| 557 |
} |
| 558 |
argv[ i - 1 ] = NULL; |
| 559 |
homeBasePath = argv[i]; |
| 560 |
argv[ i ] = NULL; |
| 561 |
} |
| 562 |
|
| 563 |
|
| 564 |
else if ( strcmp( argv[ i ], "-fs_homepath" ) == 0 ) { |
| 565 |
if ( ++i >= *argc || !argv[ i ] ) { |
| 566 |
Error( "Out of arguments: No path specified after %s.", argv[ i - 1 ] ); |
| 567 |
} |
| 568 |
argv[ i - 1 ] = NULL; |
| 569 |
homePath = argv[i]; |
| 570 |
homeBasePath = "."; |
| 571 |
argv[ i ] = NULL; |
| 572 |
} |
| 573 |
|
| 574 |
|
| 575 |
else if ( strcmp( argv[ i ], "-fs_pakpath" ) == 0 ) { |
| 576 |
if ( ++i >= *argc || !argv[ i ] ) { |
| 577 |
Error( "Out of arguments: No path specified after %s.", argv[ i - 1 ] ); |
| 578 |
} |
| 579 |
argv[ i - 1 ] = NULL; |
| 580 |
AddPakPath( argv[ i ] ); |
| 581 |
argv[ i ] = NULL; |
| 582 |
} |
| 583 |
} |
| 584 |
|
| 585 |
|
| 586 |
for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ ) |
| 587 |
{ |
| 588 |
for ( ; j < *argc && argv[ j ] == NULL; j++ ) ; |
| 589 |
argv[ i ] = argv[ j ]; |
| 590 |
if ( argv[ i ] != NULL ) { |
| 591 |
k++; |
| 592 |
} |
| 593 |
} |
| 594 |
*argc = k; |
| 595 |
|
| 596 |
|
| 597 |
AddGamePath( game->gamePath ); |
| 598 |
|
| 599 |
|
| 600 |
if ( numBasePaths == 0 && noBasePath == 0 && noMagicPath == 0 ) { |
| 601 |
|
| 602 |
len2 = strlen( game->magic ); |
| 603 |
for ( i = 0; i < *argc && numBasePaths == 0; i++ ) |
| 604 |
{ |
| 605 |
|
| 606 |
strcpy( temp, argv[ i ] ); |
| 607 |
CleanPath( temp ); |
| 608 |
len = strlen( temp ); |
| 609 |
Sys_FPrintf( SYS_VRB, "Searching for \"%s\" in \"%s\" (%d)...\n", game->magic, temp, i ); |
| 610 |
|
| 611 |
|
| 612 |
for ( j = 0; j < ( len - len2 ); j++ ) |
| 613 |
{ |
| 614 |
|
| 615 |
if ( Q_strncasecmp( &temp[ j ], game->magic, len2 ) == 0 ) { |
| 616 |
|
| 617 |
while ( temp[ ++j ] != '/' && temp[ j ] != '\0' ) ; |
| 618 |
temp[ j ] = '\0'; |
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
{ |
| 623 |
char *lastSlash = strrchr( temp, '/' ); |
| 624 |
if ( lastSlash && !Q_stricmp( lastSlash + 1, game->gamePath ) ) { |
| 625 |
*lastSlash = '\0'; |
| 626 |
} |
| 627 |
} |
| 628 |
|
| 629 |
|
| 630 |
AddBasePath( temp ); |
| 631 |
break; |
| 632 |
} |
| 633 |
} |
| 634 |
} |
| 635 |
|
| 636 |
|
| 637 |
if ( numBasePaths == 0 ) { |
| 638 |
AddBasePath( installPath ); |
| 639 |
} |
| 640 |
|
| 641 |
|
| 642 |
if ( numBasePaths == 0 ) { |
| 643 |
Error( "Failed to find a valid base path." ); |
| 644 |
} |
| 645 |
} |
| 646 |
|
| 647 |
if ( noBasePath == 1 ) { |
| 648 |
numBasePaths = 0; |
| 649 |
} |
| 650 |
|
| 651 |
if ( noHomePath == 0 ) { |
| 652 |
|
| 653 |
if ( homeBasePath ) { |
| 654 |
AddHomeBasePath( homeBasePath ); |
| 655 |
} |
| 656 |
else{ |
| 657 |
AddHomeBasePath( game->homeBasePath ); |
| 658 |
} |
| 659 |
} |
| 660 |
|
| 661 |
|
| 662 |
if ( numBasePaths > MAX_BASE_PATHS ) { |
| 663 |
numBasePaths = MAX_BASE_PATHS; |
| 664 |
} |
| 665 |
if ( numGamePaths > MAX_GAME_PATHS ) { |
| 666 |
numGamePaths = MAX_GAME_PATHS; |
| 667 |
} |
| 668 |
|
| 669 |
|
| 670 |
for ( j = 0; j < numGamePaths; j++ ) |
| 671 |
{ |
| 672 |
|
| 673 |
for ( i = 0; i < numBasePaths; i++ ) |
| 674 |
{ |
| 675 |
|
| 676 |
sprintf( temp, "%s/%s/", basePaths[ i ], gamePaths[ j ] ); |
| 677 |
vfsInitDirectory( temp ); |
| 678 |
} |
| 679 |
} |
| 680 |
|
| 681 |
|
| 682 |
if ( numPakPaths > MAX_PAK_PATHS ) { |
| 683 |
numPakPaths = MAX_PAK_PATHS; |
| 684 |
} |
| 685 |
|
| 686 |
|
| 687 |
for ( i = 0; i < numPakPaths; i++ ) |
| 688 |
{ |
| 689 |
|
| 690 |
vfsInitDirectory( pakPaths[ i ] ); |
| 691 |
} |
| 692 |
|
| 693 |
|
| 694 |
Sys_Printf( "\n" ); |
| 695 |
} |