Tools/Extractors: Fixed many false positive err=2 messages and fixed many compile warnings

This commit is contained in:
Shauren committed 2013-05-28 17:37:10 +02:00
1 parent 0938fdeeec
commit 26a22dc3ab
9 files changed
+99 -103

No files matched your search

+29 -8
View File
@@ -92,8 +92,17 @@ uint32 const Builds[] = {13164, 13205, 13287, 13329, 13596, 13623, 13914, 14007,
#define LAST_DBC_IN_DATA_BUILD 13623 // after this build mpqs with dbc are back to locale folder
#define NEW_BASE_SET_BUILD 15211
char* const Locales[] = {"enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU"};
TCHAR* const LocalesT[] =
char const* Locales[] =
{
"enGB", "enUS",
"deDE", "esES",
"frFR", "koKR",
"zhCN", "zhTW",
"enCN", "enTW",
"esMX", "ruRU"
};
TCHAR const* LocalesT[] =
{
_T("enGB"), _T("enUS"),
_T("deDE"), _T("esES"),
@@ -126,7 +135,7 @@ bool FileExists(TCHAR const* fileName)
return false;
}
void Usage(char* prg)
void Usage(char const* prg)
{
printf(
"Usage:\n"\
@@ -135,12 +144,12 @@ void Usage(char* prg)
"-o set output path\n"\
"-e extract only MAP(1)/DBC(2) - standard: both(3)\n"\
"-f height stored as int (less map size but lost some accuracy) 1 by default\n"\
"-b target build (default %u)"\
"-b target build (default %u)\n"\
"Example: %s -f 0 -i \"c:\\games\\game\"", prg, CONF_TargetBuild, prg);
exit(1);
}
void HandleArgs(int argc, char * arg[])
void HandleArgs(int argc, char* arg[])
{
for (int c = 1; c < argc; ++c)
{
@@ -268,7 +277,7 @@ uint32 ReadMapDBC()
}
SFileCloseFile(dbcFile);
printf("Done! (%u maps loaded)\n", map_count);
printf("Done! (%u maps loaded)\n", uint32(map_count));
return map_count;
}
@@ -297,7 +306,7 @@ void ReadAreaTableDBC()
areas[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
SFileCloseFile(dbcFile);
printf("Done! (%u areas loaded)\n", area_count);
printf("Done! (%u areas loaded)\n", uint32(area_count));
}
void ReadLiquidTypeTableDBC()
@@ -1144,10 +1153,14 @@ bool LoadLocaleMPQFile(int locale)
if (!SFileOpenArchive(buff, 0, MPQ_OPEN_READ_ONLY, &LocaleMpq))
{
if (GetLastError() != ERROR_PATH_NOT_FOUND)
{
_tprintf(_T("\nLoading %s locale MPQs\n"), LocalesT[locale]);
_tprintf(_T("Cannot open archive %s\n"), buff);
}
return false;
}
_tprintf(_T("\nLoading %s locale MPQs\n"), LocalesT[locale]);
char const* prefix = NULL;
for (int i = 0; Builds[i] && Builds[i] <= CONF_TargetBuild; ++i)
{
@@ -1174,8 +1187,11 @@ bool LoadLocaleMPQFile(int locale)
_tprintf(_T("Cannot open patch archive %s\n"), buff);
continue;
}
else
_tprintf(_T("Loaded %s\n"), buff);
}
printf("\n");
return true;
}
@@ -1183,6 +1199,7 @@ void LoadCommonMPQFiles(uint32 build)
{
TCHAR filename[512];
_stprintf(filename, _T("%s/Data/world.MPQ"), input_path);
_tprintf(_T("Loading common MPQ files\n"));
if (!SFileOpenArchive(filename, 0, MPQ_OPEN_READ_ONLY, &WorldMpq))
{
if (GetLastError() != ERROR_PATH_NOT_FOUND)
@@ -1241,12 +1258,13 @@ void LoadCommonMPQFiles(uint32 build)
_tprintf(_T("Loaded %s\n"), filename);
}
printf("\n");
}
int main(int argc, char * arg[])
{
printf("Map & DBC Extractor\n");
printf("===================\n\n");
printf("===================\n");
HandleArgs(argc, arg);
@@ -1275,6 +1293,7 @@ int main(int argc, char * arg[])
}
printf("Detected client build: %u\n", build);
printf("\n");
break;
}
@@ -1283,10 +1302,12 @@ int main(int argc, char * arg[])
printf("Detected client build %u for locale %s\n", tempBuild, Locales[i]);
if (tempBuild > CONF_TargetBuild)
{
SFileCloseArchive(LocaleMpq);
printf("Base locale-%s.MPQ has build higher than target build (%u > %u), nothing extracted!\n", Locales[i], tempBuild, CONF_TargetBuild);
continue;
}
printf("\n");
ExtractDBCFiles(i, FirstLocale < 0);
ExtractDB2Files(i, FirstLocale < 0);