Exemple #1
0
// Adds a listfile into the MPQ archive.
int WINAPI SFileAddListFile(HANDLE hMpq, const char * szListFile)
{
    TMPQArchive * ha = (TMPQArchive *)hMpq;
    int nError = ERROR_SUCCESS;

    // Add the listfile for each MPQ in the patch chain
    while(ha != NULL)
    {
        if(szListFile != NULL)
            SFileAddExternalListFile(ha, hMpq, szListFile);
        else
            SFileAddInternalListFile(ha, hMpq);

        // Also, add three special files to the listfile:
        // (listfile) itself, (attributes) and (signature)
        SListFileCreateNodeForAllLocales(ha, LISTFILE_NAME);
        SListFileCreateNodeForAllLocales(ha, SIGNATURE_NAME);
        SListFileCreateNodeForAllLocales(ha, ATTRIBUTES_NAME);

        // Move to the next archive in the chain
        ha = ha->haPatch;
    }

    return nError;
}
Exemple #2
0
// Adds a listfile into the MPQ archive.
int WINAPI SFileAddListFile(HANDLE hMpq, const char * szListFile)
{
    TMPQArchive * ha = (TMPQArchive *)hMpq;
    int nError = ERROR_SUCCESS;

    // Add the listfile for each MPQ in the patch chain
	TMPQArchive* halist[MAX_PATCH_NUM + 1] = {0};
	halist[0] = ha;
	if (ha != NULL)
	{
		DWORD nCount = 1;
		for (DWORD i = 0; i < ha->dwPatchCount; ++i)
		{
			halist[1+i] = ha->haPatchList[i];
			++nCount;
		}

		for (DWORD i = 0; i < nCount; ++i)
		{
			ha = halist[i];

			if(szListFile != NULL)
				SFileAddExternalListFile(ha, hMpq, szListFile);
			else
				SFileAddInternalListFile(ha, hMpq);

			// Also, add three special files to the listfile:
			// (listfile) itself, (attributes) and (signature)
			SListFileCreateNodeForAllLocales(ha, LISTFILE_NAME);
			SListFileCreateNodeForAllLocales(ha, SIGNATURE_NAME);
			SListFileCreateNodeForAllLocales(ha, ATTRIBUTES_NAME);
		}
	}

    return nError;
}