示例#1
0
bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames)
{
    if(!hasInputPathParam)
        getGamePath();

    printf("\nGame path: %s\n", input_path);

    char path[512];

    // open expansion and common files
    printf("Opening data files from data directory.\n");
    sprintf(path, "%sterrain.MPQ", input_path);
    pArchiveNames.push_back(path);
    sprintf(path, "%smodel.MPQ", input_path);
    pArchiveNames.push_back(path);
    sprintf(path, "%stexture.MPQ", input_path);
    pArchiveNames.push_back(path);
    sprintf(path, "%swmo.MPQ", input_path);
    pArchiveNames.push_back(path);
    sprintf(path, "%sbase.MPQ", input_path);
    pArchiveNames.push_back(path);
    sprintf(path, "%smisc.MPQ", input_path);

    // now, scan for the patch levels in the core dir
    printf("Scanning patch levels from data directory.\n");
    sprintf(path, "%spatch", input_path);
    if (!scan_patches(path, pArchiveNames))
        return(false);

    printf("\n");

    return true;
}
示例#2
0
bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames)
{
    if (!hasInputPathParam)
        getGamePath();

    printf("\nGame path: %s\n", input_path);

    char path[512];
    string in_path(input_path);
    std::vector<std::string> locales, searchLocales;

    searchLocales.push_back("enGB");
    searchLocales.push_back("enUS");
    searchLocales.push_back("deDE");
    searchLocales.push_back("esES");
    searchLocales.push_back("frFR");
    searchLocales.push_back("koKR");
    searchLocales.push_back("zhCN");
    searchLocales.push_back("zhTW");
    searchLocales.push_back("enCN");
    searchLocales.push_back("enTW");
    searchLocales.push_back("esMX");
    searchLocales.push_back("ruRU");

    for (std::vector<std::string>::iterator i = searchLocales.begin(); i != searchLocales.end(); ++i)
    {
        std::string localePath = in_path + *i;
        // check if locale exists:
        struct stat status;
        if (stat(localePath.c_str(), &status))
            continue;
        if ((status.st_mode & S_IFDIR) == 0)
            continue;
        printf("Found locale '%s'\n", i->c_str());
        locales.push_back(*i);
    }
    printf("\n");

    // open locale expansion and common files
    printf("Adding data files from locale directories.\n");
    for (std::vector<std::string>::iterator i = locales.begin(); i != locales.end(); ++i)
    {
        pArchiveNames.push_back(in_path + *i + "/locale-" + *i + ".MPQ");
        pArchiveNames.push_back(in_path + *i + "/expansion-locale-" + *i + ".MPQ");
    }

    // open expansion and common files
    pArchiveNames.push_back(input_path + string("common.MPQ"));
    pArchiveNames.push_back(input_path + string("expansion.MPQ"));

    // now, scan for the patch levels in the core dir
    printf("Scanning patch levels from data directory.\n");
    sprintf(path, "%spatch", input_path);
    if (!scan_patches(path, pArchiveNames))
        return(false);

    // now, scan for the patch levels in locale dirs
    printf("Scanning patch levels from locale directories.\n");
    bool foundOne = false;
    for (std::vector<std::string>::iterator i = locales.begin(); i != locales.end(); ++i)
    {
        printf("Locale: %s\n", i->c_str());
        sprintf(path, "%s%s/patch-%s", input_path, i->c_str(), i->c_str());
        if (scan_patches(path, pArchiveNames))
            foundOne = true;
    }

    printf("\n");

    if (!foundOne)
    {
        printf("no locale found\n");
        return false;
    }

    return true;
}
示例#3
0
bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames) {
    //srand((unsigned int)time(0));

    if(!hasInputPathParam)
        getGamePath();

    printf("\nGame path: %s\n", input_path);

    char path[512];
    std::vector<std::string> locales;

    // scan game directories
    WIN32_FIND_DATA ffData;
    HANDLE hFind;
    DWORD dwError;

    // first, scan for locales (4-letter directories)
    printf("Scanning for locales.\n");
    sprintf(path, "%s*.*", input_path);
    hFind = INVALID_HANDLE_VALUE;
    hFind = FindFirstFile(path, &ffData);
    if (hFind == INVALID_HANDLE_VALUE)
    {
        printf("\nCould not open data directory for reading. Aborting.\n");
        return(false);
    }
    do
    {
        if (ffData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
        {
            if (ffData.cFileName[0] != '.')
            {
                if (strlen(ffData.cFileName) == 4)
                {
                    printf("Found locale: %s\n", ffData.cFileName);
                    locales.push_back(ffData.cFileName);
                }
            }
        }
    } while (FindNextFile(hFind, &ffData) != 0);
    dwError = GetLastError();
    FindClose(hFind);
    if (dwError != ERROR_NO_MORE_FILES)
    {
        printf("\nError reading data directory while scanning locales. Aborting.\n");
        return(false);
    }
    printf("\n");

    if (locales.size() == 0)
    {
        printf("Sorry, no locales found. Aborting.\n");
        return(false);
    }

    // now, scan for the patch levels in the core dir
    printf("Loading patch levels from data directory.\n");
    sprintf(path, "%spatch", input_path);
    if (!scan_patches(path, pArchiveNames)) return(false);

    // now, scan for the patch levels in locale dirs
    printf("Loading patch levels from locale directories.\n");
    for (std::vector<std::string>::iterator i = locales.begin(); i != locales.end(); i++)
    {
        printf("Locale: %s\n", i->c_str());
        sprintf(path, "%s%s\\patch-%s", input_path, i->c_str(), i->c_str());
        if (!scan_patches(path, pArchiveNames)) return(false);
    }

    // open expansion and common files
    printf("Opening data files from data directory.\n");
    sprintf(path, "%sexpansion.mpq", input_path);
    pArchiveNames.push_back(path);
    sprintf(path, "%scommon.mpq", input_path);
    pArchiveNames.push_back(path);
    printf("\n");

    // open locale expansion and common files
    printf("Opening data files from locale directories.\n");
    for (std::vector<std::string>::iterator i = locales.begin(); i != locales.end(); i++)
    {
        printf("Locale: %s\n", i->c_str());
        sprintf(path, "%s%s\\expansion-locale-%s.mpq", input_path, i->c_str(), i->c_str());
        pArchiveNames.push_back(path);
        sprintf(path, "%s%s\\locale-%s.mpq", input_path, i->c_str(), i->c_str());
        pArchiveNames.push_back(path);
        printf("\n");
    }
    return true;
}
示例#4
0
bool fillArchiveNameVector(vector<string>& pArchiveNames)
{
	if(!hasInputPath)
		getGamePath();

	vector<string> locales, languageLocales;

	languageLocales.push_back("enGB");
	languageLocales.push_back("enUS");
	languageLocales.push_back("deDE");
	languageLocales.push_back("esES");
	languageLocales.push_back("frFR");
	languageLocales.push_back("ruRU");

	for(vector<string>::iterator i = languageLocales.begin(); i != languageLocales.end(); ++i)
	{
		string localePath = gamepath + *i;
		struct stat status;
		if(stat(localePath.c_str(), &status))
			continue;
		if((status.st_mode & S_IFDIR) == 0)
			continue;

		gLog("[World of Warcraft Studio - Editor] - Found locales '%s'\n", i->c_str());
		locales.push_back(*i);
	}

	gLog("[World of Warcraft Studio - Editor] - Addind data files from locale dir.\n");
	for(vector<string>::iterator i = locales.begin(); i != locales.end(); ++i)
	{
		switch(loadExpansion())
		{
		case 1: // TBC
			{
				pArchiveNames.push_back(gamepath + string("common.MPQ"));
				pArchiveNames.push_back(gamepath + string("expansion.MPQ"));
				pArchiveNames.push_back(gamepath + string("patch.MPQ"));
				pArchiveNames.push_back(gamepath + string("patch-2.MPQ"));

				pArchiveNames.push_back(gamepath + *i + "\\locale-" + *i + ".MPQ");
				pArchiveNames.push_back(gamepath + *i + "\\expansion-locale-" + *i + ".MPQ");
				pArchiveNames.push_back(gamepath + *i + "\\patch-" + *i + ".MPQ");
				pArchiveNames.push_back(gamepath + *i + "\\patch-" + *i + "-2.MPQ");

				break;
			}

		case 2: // WotLK
			{
				pArchiveNames.push_back(gamepath + string("common.MPQ"));
				pArchiveNames.push_back(gamepath + string("common-2.MPQ"));
				pArchiveNames.push_back(gamepath + string("expansion.MPQ"));
				pArchiveNames.push_back(gamepath + string("lichking.MPQ"));
				pArchiveNames.push_back(gamepath + string("patch.MPQ"));
				pArchiveNames.push_back(gamepath + string("patch-2.MPQ"));

				pArchiveNames.push_back(gamepath + *i + "\\locale-" + *i + ".MPQ");
				pArchiveNames.push_back(gamepath + *i + "\\expansion-locale-" + *i + ".MPQ");
				pArchiveNames.push_back(gamepath + *i + "\\lichking-locale-" + *i + ".MPQ");
				pArchiveNames.push_back(gamepath + *i + "\\patch-" + *i + ".MPQ");
				pArchiveNames.push_back(gamepath + *i + "\\patch-" + *i + "-2.MPQ");

				break;
			}

		case 3: // Cataclysm
			{
				pArchiveNames.push_back(gamepath + string("art.MPQ"));
				pArchiveNames.push_back(gamepath + string("expansion1.MPQ"));
				pArchiveNames.push_back(gamepath + string("expansion2.MPQ"));
				pArchiveNames.push_back(gamepath + string("expansion3.MPQ"));
				pArchiveNames.push_back(gamepath + string("sound.MPQ"));
				pArchiveNames.push_back(gamepath + string("world.MPQ"));

				pArchiveNames.push_back(gamepath + *i + "\\locale-" + *i + ".MPQ");
				pArchiveNames.push_back(gamepath + *i + "\\expansion1-locale-" + *i + ".MPQ");
				pArchiveNames.push_back(gamepath + *i + "\\expansion2-locale-" + *i + ".MPQ");
				pArchiveNames.push_back(gamepath + *i + "\\expansion3-locale-" + *i + ".MPQ");

				break;
			}

		default: // ERROR
			{
				gLog("[World of Warcraft Studio - Editor] - Can't load GameVersion.\n");
				exit(1);

				break;
			}
		}
	}

	gLog("[World of Warcraft Studio - Editor] - Scanning patch levels from data dir.\n");
	sprintf(path, "%spatch", gamepath);
	if(!scan_patches(path, pArchiveNames))
		return(false);

	gLog("[World of Warcraft Studio - Editor] - Scanning patch levels from locale dir.\n");
	bool foundOne = false;
	for(vector<string>::iterator i = locales.begin(); i != locales.end(); ++i)
	{
		sprintf(path, "%s%s/patch-%s", InputPath, i->c_str(), i->c_str());
		if(scan_patches(path, pArchiveNames))
			foundOne = true;
	}

	if(!foundOne)
	{
		gLog("[World of Warcraft Studio - Editor] - Locales not found\n");
		return false;
	}

	return true;
}