int main(int argc, char ** argv) { bool success=true; const char *versionString = "V3.00 2010_07"; // Use command line arguments, when some if (!processArgv(argc, argv, versionString)) return 1; // some simple check if working dir is dirty else { std::string sdir = std::string(szWorkDirWmo) + "/dir"; std::string sdir_bin = std::string(szWorkDirWmo) + "/dir_bin"; struct stat status; if (!stat(sdir.c_str(), &status) || !stat(sdir_bin.c_str(), &status)) { printf("Your output directory seems to be polluted, please use an empty directory!\n"); printf("<press return to exit>"); char garbage[2]; return scanf("%c", garbage); } } printf("Extract %s. Beginning work ....\n",versionString); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory if (mkdir(szWorkDirWmo #ifdef __linux__ , 0711 #endif )) success = (errno == EEXIST); // prepare archive name list std::vector<std::string> archiveNames; fillArchiveNameVector(archiveNames); for (size_t i = 0; i < archiveNames.size(); ++i) { MPQArchive *archive = new MPQArchive(archiveNames[i].c_str()); if (!gOpenArchives.size() || gOpenArchives.front() != archive) delete archive; } if (gOpenArchives.empty()) { printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path); return 1; } // extract data if (success) success = ExtractWmo(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc if (success) { DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); if (!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); return 1; } map_count=dbc->getRecordCount (); map_ids=new map_id[map_count]; for (unsigned int x = 0; x < map_count; ++x) { map_ids[x].id=dbc->getRecord (x).getUInt(0); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); printf("Map - %s\n",map_ids[x].name); } delete dbc; ParsMapFiles(); delete[] map_ids; //nError = ERROR_SUCCESS; } printf("\n"); if (!success) { printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); getchar(); } printf("Extract %s. Work complete. No errors.\n",versionString); return 0; }
int main(int argc, char** argv) { printf("mangos-zero vmap (version %s) extractor\n\n", szRawVMAPMagic); bool success = true; // Use command line arguments, when some if (!processArgv(argc, argv)) { return 1; } // some simple check if working dir is dirty else { std::string sdir = std::string(szWorkDirWmo) + "/dir"; std::string sdir_bin = std::string(szWorkDirWmo) + "/dir_bin"; struct stat status; if (!stat(sdir.c_str(), &status) || !stat(sdir_bin.c_str(), &status)) { printf("Your output directory seems to be polluted, please use an empty directory!\n"); printf("<press return to exit>"); char garbage[2]; int ret = scanf("%c", garbage); return 1; } } printf("Beginning work ....\n"); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory if (mkdir(szWorkDirWmo #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) , 0711 #endif )) { success = (errno == EEXIST); } // prepare archive name list std::vector<std::string> archiveNames; fillArchiveNameVector(archiveNames); for (size_t i = 0; i < archiveNames.size(); ++i) { MPQArchive* archive = new MPQArchive(archiveNames[i].c_str()); if (!gOpenArchives.size() || gOpenArchives.front() != archive) { delete archive; } } if (gOpenArchives.empty()) { printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n", input_path); return 1; } ReadLiquidTypeTableDBC(); // extract data if (success) { success = ExtractWmo(); } //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc if (success) { DBCFile* dbc = new DBCFile("DBFilesClient\\Map.dbc"); if (!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); return 1; } map_count = dbc->getRecordCount(); map_ids = new map_id[map_count]; for (unsigned int x = 0; x < map_count; ++x) { map_ids[x].id = dbc->getRecord(x).getUInt(0); strcpy(map_ids[x].name, dbc->getRecord(x).getString(1)); printf("Map - %s\n", map_ids[x].name); } delete dbc; ParsMapFiles(); delete [] map_ids; //nError = ERROR_SUCCESS; // Extract models, listed in DameObjectDisplayInfo.dbc ExtractGameobjectModels(); } printf("\n"); if (!success) { printf("ERROR: Work NOT complete.\n Precise vector data=%d.\nPress any key.\n", preciseVectorData); getchar(); } printf("Work complete. No errors.\n"); delete [] LiqType; return 0; }
int main(int argc, char * arg[]) { printf("AscNHalf map extractor for versions 3.2.2 \n"); printf("============================================================\n\n"); FILE * tf; const char* localeNames[] = { "enUS", "enGB", "deDE", "frFR", "koKR", "zhCN", "zhTW", "esES", "ruRU", 0 }; int maxPatches = 3; int locale = -1; char tmp[100]; tf = fopen("Data/common.MPQ", "r"); if (!tf) { printf("Could not find Data/common.MPQ\n"); return 1; } fclose(tf); new MPQArchive("Data/common.MPQ"); tf = fopen("Data/common-2.MPQ", "r"); if (!tf) { printf("Could not find Data/common-2.MPQ\n"); return 1; } fclose(tf); new MPQArchive("Data/common-2.MPQ"); for( size_t i = 0; localeNames[i] != 0; i++ ) { sprintf(tmp, "Data/%s/locale-%s.MPQ", localeNames[i], localeNames[i]); tf = fopen(tmp, "r"); if (!tf) continue; fclose(tf); locale = i; new MPQArchive(tmp); } tf = fopen("Data/expansion.MPQ", "r"); if (tf) { fclose(tf); new MPQArchive("Data/expansion.MPQ"); if ( -1 != locale ) { sprintf(tmp, "Data/%s/expansion-locale-%s.MPQ", localeNames[locale], localeNames[locale]); new MPQArchive(tmp); } } tf = fopen("Data/lichking.MPQ", "r"); if (tf) { fclose(tf); new MPQArchive("Data/lichking.MPQ"); if ( -1 != locale ) { sprintf(tmp, "Data/%s/lichking-locale-%s.MPQ", localeNames[locale], localeNames[locale]); new MPQArchive(tmp); } } tf = fopen("Data/patch.MPQ", "r"); if (tf) { fclose(tf); new MPQArchive("Data/patch.MPQ"); for(int i = 2; i <= maxPatches; i++) { sprintf(tmp, "Data/patch-%d.MPQ", i); tf = fopen(tmp, "r"); if (!tf) continue; fclose(tf); new MPQArchive(tmp); } if ( -1 != locale ) { sprintf(tmp, "Data/%s/patch-%s.MPQ", localeNames[locale], localeNames[locale]); tf = fopen(tmp, "r"); if (tf) { fclose(tf); new MPQArchive(tmp); for(int i = 2; i <= maxPatches; i++) { sprintf(tmp, "Data/%s/patch-%s-%d.MPQ", localeNames[locale], localeNames[locale], i); tf = fopen(tmp, "r"); if (!tf) continue; fclose(tf); new MPQArchive(tmp); } } } } printf("\nExtracting DBC Files: Identifying files...\n"); std::set<std::string> dbcFiles; int itc = 0; for(std::vector<MPQArchive*>::iterator it = gOpenArchives.begin(); it != gOpenArchives.end(); ++it) { std::vector<std::string> files; files = (*it)->GetFileList(); for (vector<string>::iterator iter = files.begin(); iter != files.end(); ++iter) if (iter->rfind(".dbc") == iter->length() - strlen(".dbc")) dbcFiles.insert(*iter); SimpleProgressBar(++itc, gOpenArchives.size()); } CleanCache(); ClearProgressBar(); printf("Extracting...\n"); CreateDirectory("DBC", NULL); // extract DBCs int count = 0; for (set<string>::iterator iter = dbcFiles.begin(); iter != dbcFiles.end(); ++iter) { string filename = "DBC\\"; filename += (iter->c_str() + strlen("DBFilesClient\\")); if(ExtractFile(iter->c_str(), filename)) ++count; SimpleProgressBar(count, dbcFiles.size()); } CleanCache(); ClearProgressBar(); printf("Extracted %u DBC files\n\n", count); //map.dbc DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); dbc->open(); MapCount = dbc->getRecordCount (); map_ids = new map_id[MapCount]; for(unsigned int x = 0; x < MapCount; x++) { map_ids[x].id = dbc->getRecord (x).getUInt(0); strcpy(map_ids[x].name, dbc->getRecord(x).getString(1)); } delete dbc; CreateDirectory("maps", NULL); ExtractMapsFromMpq(); delete [] map_ids; return 0; // Exit The Program }
int main(int argc, char ** argv) { bool success=true; const char *versionString = "V2.90 2010_05"; // Use command line arguments, when some if(!processArgv(argc, argv, versionString)) return 1; printf("Extract %s. Beginning work ....\n",versionString); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Create the working directory if(mkdir(szWorkDirWmo #ifdef __linux__ , 0711 #endif )) success = (errno == EEXIST); // prepare archive name list std::vector<std::string> archiveNames; fillArchiveNameVector(archiveNames); for (size_t i=0; i < archiveNames.size(); ++i) { MPQArchive *archive = new MPQArchive(archiveNames[i].c_str()); if(!gOpenArchives.size() || gOpenArchives.front() != archive) delete archive; } if(gOpenArchives.empty()) { printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path); return 1; } ReadLiquidTypeTableDBC(); // extract data if(success) success = ExtractWmo(); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx //map.dbc if(success) { DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc"); if(!dbc->open()) { delete dbc; printf("FATAL ERROR: Map.dbc not found in data file.\n"); return 1; } map_count=dbc->getRecordCount (); map_ids=new map_id[map_count]; for(unsigned int x=0;x<map_count;++x) { map_ids[x].id=dbc->getRecord (x).getUInt(0); strcpy(map_ids[x].name,dbc->getRecord(x).getString(1)); printf("Map - %s\n",map_ids[x].name); } delete dbc; ParsMapFiles(); delete [] map_ids; //nError = ERROR_SUCCESS; } clreol(); if(!success) { printf("ERROR: Extract %s. Work NOT complete.\n Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData); getchar(); } printf("Extract %s. Work complete. No errors.\n",versionString); delete [] LiqType; return 0; }