diff options
author | Shauren <shauren.trinity@gmail.com> | 2012-02-21 21:29:19 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2012-02-21 21:29:19 +0100 |
commit | 45201fd49f434dd2f9960bd25a1e30b97a3092a6 (patch) | |
tree | 1f9fd2e4b796baf9cb4472f3c09bca1e167d4351 | |
parent | 26f1abdbcafde2425346eb54983cb83eff9b7925 (diff) |
Tools/Extractors: Map extractor will now also extract *.db2 files
-rw-r--r-- | src/tools/map_extractor/System.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 8db9599ef2e..94639e5ba06 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -1031,6 +1031,43 @@ void ExtractDBCFiles(int l, bool basicLocale) printf("Extracted %u DBC files\n\n", count); } +void ExtractDB2Files(int l, bool basicLocale) +{ + printf("Extracting db2 files...\n"); + + SFILE_FIND_DATA foundFile; + memset(&foundFile, 0, sizeof(foundFile)); + HANDLE listFile = SListFileFindFirstFile(LocaleMpq, NULL, "DBFilesClient\\*db2", &foundFile); + HANDLE dbcFile = NULL; + uint32 count = 0; + if (listFile) + { + std::string outputPath = "./dbc/"; + if (!basicLocale) + { + outputPath += Locales[l]; + outputPath += "/"; + } + + std::string filename; + + do + { + if (!SFileOpenFileEx(LocaleMpq, foundFile.cFileName, SFILE_OPEN_PATCHED_FILE, &dbcFile)) + continue; + + filename = foundFile.cFileName; + filename = outputPath + filename.substr(filename.rfind('\\')); + if (ExtractFile(dbcFile, filename.c_str())) + ++count; + + SFileCloseFile(dbcFile); + } while (SListFileFindNextFile(listFile, &foundFile)); + } + + printf("Extracted %u DB2 files\n\n", count); +} + bool LoadLocaleMPQFile(int locale) { TCHAR buff[512]; @@ -1165,6 +1202,7 @@ int main(int argc, char * arg[]) } ExtractDBCFiles(i, FirstLocale < 0); + ExtractDB2Files(i, FirstLocale < 0); if (FirstLocale < 0) { |