Advertisement
Guest User

Dah code? o:

a guest
Jul 16th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.15 KB | None | 0 0
  1. void appSetOldRootDirectory(const char *dir, bool recurse)
  2. {
  3.     guard(appSetOldRootDirectory);
  4.     if (dir[0] == 0) dir = "."; // using dir="" will cause scanning of "/dir1", "/dir2" etc (i.e. drive root)
  5.     appStrncpyz(GRootDirectory, dir, ARRAY_COUNT(GRootDirectory));
  6.     ScanGameDirectory(GRootDirectory, recurse);
  7.  
  8. #if GEARS4
  9.     if (GForceGame == GAME_Gears4)
  10.     {
  11.         const CGameFileInfo* manifest = appFindGameFile("BundleManifest.bin");
  12.         if (manifest)
  13.         {
  14.             LoadGears4Manifest(manifest);
  15.         }
  16.         else
  17.         {
  18.             appError("Gears of War 4 requires BundleManifest.bin file which is missing.");
  19.         }
  20.     }
  21. #endif // GEARS4
  22.  
  23.     appPrintf("Found %d game files (%d skipped) at path \"%s\"\n", GameFiles.Num(), GNumForeignFiles, dir);
  24.  
  25. #if UNREAL4
  26.     // Should process .uexp and .ubulk files, register their information for .uasset
  27.     for (int i = 0; i < GameFiles.Num(); i++)
  28.     {
  29.         CGameFileInfo *info = GameFiles[i];
  30.         char SrcFile[MAX_PACKAGE_PATH];
  31.         appStrncpyz(SrcFile, info->RelativeName, ARRAY_COUNT(SrcFile));
  32.         char* s = strrchr(SrcFile, '.');
  33.         if (s && (stricmp(s, ".uasset") == 0 || stricmp(s, ".umap") == 0))
  34.         {
  35.             static const char* additionalExtensions[] =
  36.             {
  37.                 ".ubulk",
  38.                 ".uexp",
  39.             };
  40.             for (int ext = 0; ext < ARRAY_COUNT(additionalExtensions); ext++)
  41.             {
  42.                 strcpy(s, additionalExtensions[ext]);
  43.                 const CGameFileInfo* file = appFindGameFile(SrcFile);
  44.                 if (file)
  45.                 {
  46.                     info->ExtraSizeInKb += file->SizeInKb;
  47.                 }
  48.             }
  49.         }
  50.     }
  51. #endif // UNREAL4
  52.  
  53. #if PRINT_HASH_DISTRIBUTION
  54.     PrintHashDistribution();
  55. #endif
  56.     unguardf("dir=%s", dir);
  57. }
  58.  
  59. void appSetRootDirectoryOld(const char *dir, bool recurse)
  60. {
  61.     guard(appSetRootDirectoryOld);
  62.     if (dir[0] == 0) dir = "."; // using dir="" will cause scanning of "/dir1", "/dir2" etc (i.e. drive root)
  63.     appStrncpyz(GOldRootDirectory, dir, ARRAY_COUNT(GOldRootDirectory));
  64.     ScanOldGameDirectory(GOldRootDirectory, recurse);
  65.  
  66. #if GEARS4
  67.     if (GForceGame == GAME_Gears4)
  68.     {
  69.         const CGameFileInfo* manifest = appFindGameFile("BundleManifest.bin");
  70.         if (manifest)
  71.         {
  72.             LoadGears4Manifest(manifest);
  73.         }
  74.         else
  75.         {
  76.             appError("Gears of War 4 requires BundleManifest.bin file which is missing.");
  77.         }
  78.     }
  79. #endif // GEARS4
  80.  
  81.     appPrintf("Found %d game files (%d skipped) at path \"%s\"\n", OldGameFiles.Num(), GNumOldForeignFiles, dir);
  82.  
  83. #if UNREAL4
  84.     // Should process .uexp and .ubulk files, register their information for .uasset
  85.     for (int i = 0; i < OldGameFiles.Num(); i++)
  86.     {
  87.         CGameFileInfo *info = OldGameFiles[i];
  88.         char SrcFile[MAX_PACKAGE_PATH];
  89.         appStrncpyz(SrcFile, info->RelativeName, ARRAY_COUNT(SrcFile));
  90.         char* s = strrchr(SrcFile, '.');
  91.         if (s && (stricmp(s, ".uasset") == 0 || stricmp(s, ".umap") == 0))
  92.         {
  93.             static const char* additionalExtensions[] =
  94.             {
  95.                 ".ubulk",
  96.                 ".uexp",
  97.             };
  98.             for (int ext = 0; ext < ARRAY_COUNT(additionalExtensions); ext++)
  99.             {
  100.                 strcpy(s, additionalExtensions[ext]);
  101.                 const CGameFileInfo* file = appFindGameFile(SrcFile);
  102.                 if (file)
  103.                 {
  104.                     info->ExtraSizeInKb += file->SizeInKb;
  105.                 }
  106.             }
  107.         }
  108.     }
  109. #endif // UNREAL4
  110.  
  111. #if PRINT_HASH_DISTRIBUTION
  112.     PrintHashDistribution();
  113. #endif
  114.     unguardf("dir=%s", dir);
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement