int LoadBuildInfo(TCascStorage * hs) { QUERY_KEY InfoFile = {NULL, 0}; QUERY_KEY FileData = {NULL, 0}; TCHAR * szAgentFile; TCHAR * szInfoFile; bool bBuildConfigComplete = false; int nError = ERROR_SUCCESS; // Since HOTS build 30027, the game uses build.info file for storage info if(bBuildConfigComplete == false) { szInfoFile = CombinePath(hs->szRootPath, _T(".build.info")); if(szInfoFile != NULL) { nError = LoadTextFile(szInfoFile, &InfoFile); if(nError == ERROR_SUCCESS) { // Parse the info file nError = ParseInfoFile(hs, &InfoFile); if(nError == ERROR_SUCCESS) bBuildConfigComplete = true; // Free the loaded blob FreeCascBlob(&InfoFile); } CASC_FREE(szInfoFile); } } // If the info file has not been loaded, try the legacy .build.db if(bBuildConfigComplete == false) { szAgentFile = CombinePath(hs->szRootPath, _T(".build.db")); if(szAgentFile != NULL) { nError = LoadTextFile(szAgentFile, &FileData); if(nError == ERROR_SUCCESS) { nError = ParseAgentFile(hs, &FileData); if(nError == ERROR_SUCCESS) bBuildConfigComplete = true; FreeCascBlob(&FileData); } CASC_FREE(szAgentFile); } } // If the .build.info and .build.db file hasn't been loaded, if(nError == ERROR_SUCCESS && bBuildConfigComplete == false) { nError = ERROR_FILE_CORRUPT; } // Load the configuration file if(nError == ERROR_SUCCESS) { nError = FetchAndVerifyConfigFile(hs, &hs->CdnConfigKey, &FileData); if(nError == ERROR_SUCCESS) { nError = LoadCdnConfigFile(hs, &FileData); FreeCascBlob(&FileData); } } // Load the build file if(nError == ERROR_SUCCESS) { nError = FetchAndVerifyConfigFile(hs, &hs->CdnBuildKey, &FileData); if(nError == ERROR_SUCCESS) { nError = LoadCdnBuildFile(hs, &FileData); FreeCascBlob(&FileData); } } // Fill the index directory if(nError == ERROR_SUCCESS) { // First, check for more common "data" subdirectory if((hs->szIndexPath = CheckForIndexDirectory(hs, _T("data"))) != NULL) return ERROR_SUCCESS; // Second, try the "darch" subdirectory (older builds of HOTS - Alpha) if((hs->szIndexPath = CheckForIndexDirectory(hs, _T("darch"))) != NULL) return ERROR_SUCCESS; nError = ERROR_FILE_NOT_FOUND; } return nError; }
int LoadBuildInfo(TCascStorage * hs) { TCHAR * szAgentFile; TCHAR * szInfoFile; void * pvListFile; bool bBuildConfigComplete = false; int nError = ERROR_SUCCESS; // Since HOTS build 30027, the game uses .build.info file for storage info if(bBuildConfigComplete == false) { szInfoFile = CombinePath(hs->szRootPath, _T(".build.info")); if(szInfoFile != NULL) { pvListFile = ListFile_OpenExternal(szInfoFile); if(pvListFile != NULL) { // Parse the info file nError = ParseInfoFile(hs, pvListFile); if(nError == ERROR_SUCCESS) bBuildConfigComplete = true; ListFile_Free(pvListFile); } CASC_FREE(szInfoFile); } } // If the info file has not been loaded, try the legacy .build.db if(bBuildConfigComplete == false) { szAgentFile = CombinePath(hs->szRootPath, _T(".build.db")); if(szAgentFile != NULL) { pvListFile = ListFile_OpenExternal(szAgentFile); if(pvListFile != NULL) { nError = ParseAgentFile(hs, pvListFile); if(nError == ERROR_SUCCESS) bBuildConfigComplete = true; ListFile_Free(pvListFile); } CASC_FREE(szAgentFile); } } // If the .build.info OR .build.db file has been loaded, // proceed with loading the CDN config file and CDN build file if(nError == ERROR_SUCCESS && bBuildConfigComplete) { // Load the configuration file pvListFile = FetchAndVerifyConfigFile(hs, &hs->CdnConfigKey); if(pvListFile != NULL) { nError = LoadCdnConfigFile(hs, pvListFile); ListFile_Free(pvListFile); } else nError = ERROR_FILE_NOT_FOUND; } // Load the build file if(nError == ERROR_SUCCESS && bBuildConfigComplete) { pvListFile = FetchAndVerifyConfigFile(hs, &hs->CdnBuildKey); if(pvListFile != NULL) { nError = LoadCdnBuildFile(hs, pvListFile); ListFile_Free(pvListFile); } else nError = ERROR_FILE_NOT_FOUND; } // Fill the index directory if(nError == ERROR_SUCCESS) { // First, check for more common "data" subdirectory if((hs->szIndexPath = CheckForIndexDirectory(hs, _T("data"))) != NULL) return ERROR_SUCCESS; // Second, try the "darch" subdirectory (older builds of HOTS - Alpha) if((hs->szIndexPath = CheckForIndexDirectory(hs, _T("darch"))) != NULL) return ERROR_SUCCESS; nError = ERROR_FILE_NOT_FOUND; } return nError; }