diff options
author | Shauren <shauren.trinity@gmail.com> | 2017-06-26 00:03:06 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2017-06-26 00:03:06 +0200 |
commit | b55fb35b937a51821c7529cbaf11a9af2cf35183 (patch) | |
tree | 8b524f924bf767915aad15f513e0d7afc2178d7c | |
parent | 0d4c19b33e5ead7a9f5dc088de8f56f0b8e71c73 (diff) |
Tools/Extractors: Add retard check
-rw-r--r-- | src/tools/map_extractor/System.cpp | 36 | ||||
-rw-r--r-- | src/tools/vmap4_extractor/vmapexport.cpp | 32 |
2 files changed, 66 insertions, 2 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index 0bd5064bbfe..c30668f8e6f 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -1306,13 +1306,42 @@ bool OpenCascStorage(int locale) return true; } - catch (boost::filesystem::filesystem_error& error) + catch (boost::filesystem::filesystem_error const& error) { - printf("error opening casc storage : %s\n", error.what()); + printf("Error opening CASC storage: %s\n", error.what()); return false; } } +static bool RetardCheck() +{ + try + { + boost::filesystem::path storageDir(boost::filesystem::canonical(input_path) / "Data"); + boost::filesystem::directory_iterator end; + for (boost::filesystem::directory_iterator itr(storageDir); itr != end; ++itr) + { + if (itr->path().extension() == ".MPQ") + { + printf("MPQ files found in Data directory!\n"); + printf("This tool works only with World of Warcraft: Legion\n"); + printf("\n"); + printf("To extract maps for Wrath of the Lich King, rebuild tools using 3.3.5 branch!\n"); + printf("\n"); + printf("Press ENTER to exit...\n"); + getchar(); + return false; + } + } + } + catch (std::exception const& error) + { + printf("Error checking client version: %s\n", error.what()); + } + + return true; +} + int main(int argc, char * arg[]) { Trinity::Banner::Show("Map & DBC Extractor", [](char const* text) { printf("%s\n", text); }, nullptr); @@ -1325,6 +1354,9 @@ int main(int argc, char * arg[]) int FirstLocale = -1; uint32 build = 0; + if (!RetardCheck()) + return 1; + for (int i = 0; i < TOTAL_LOCALES; ++i) { if (CONF_Locale && !(CONF_Locale & (1 << i))) diff --git a/src/tools/vmap4_extractor/vmapexport.cpp b/src/tools/vmap4_extractor/vmapexport.cpp index cdbe522234c..35c6eb1f452 100644 --- a/src/tools/vmap4_extractor/vmapexport.cpp +++ b/src/tools/vmap4_extractor/vmapexport.cpp @@ -337,6 +337,35 @@ bool processArgv(int argc, char ** argv, const char *versionString) return result; } +static bool RetardCheck() +{ + try + { + boost::filesystem::path storageDir(boost::filesystem::canonical(input_path) / "Data"); + boost::filesystem::directory_iterator end; + for (boost::filesystem::directory_iterator itr(storageDir); itr != end; ++itr) + { + if (itr->path().extension() == ".MPQ") + { + printf("MPQ files found in Data directory!\n"); + printf("This tool works only with World of Warcraft: Legion\n"); + printf("\n"); + printf("To extract maps for Wrath of the Lich King, rebuild tools using 3.3.5 branch!\n"); + printf("\n"); + printf("Press ENTER to exit...\n"); + getchar(); + return false; + } + } + } + catch (std::exception const& error) + { + printf("Error checking client version: %s\n", error.what()); + } + + return true; +} + //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx // Main // @@ -357,6 +386,9 @@ int main(int argc, char ** argv) if (!processArgv(argc, argv, versionString)) return 1; + if (!RetardCheck()) + return 1; + // some simple check if working dir is dirty else { |