| 44 | } |
| 45 | |
| 46 | static const char * GetPatchFileName(TMPQArchive * ha, const char * szFileName, char * szBuffer) |
| 47 | { |
| 48 | TMPQNamePrefix * pPrefix; |
| 49 | |
| 50 | // Are there patches in the current MPQ? |
| 51 | if(ha->dwFlags & MPQ_FLAG_PATCH) |
| 52 | { |
| 53 | // The patch prefix must be already known here |
| 54 | assert(ha->pPatchPrefix != NULL); |
| 55 | pPrefix = ha->pPatchPrefix; |
| 56 | |
| 57 | // The patch name for "OldWorld\\XXX\\YYY" is "Base\\XXX\YYY" |
| 58 | // We need to remove the "OldWorld\\" prefix |
| 59 | if(!_strnicmp(szFileName, "OldWorld\\", 9)) |
| 60 | szFileName += 9; |
| 61 | |
| 62 | // Create the file name from the known patch entry |
| 63 | memcpy(szBuffer, pPrefix->szPatchPrefix, pPrefix->nLength); |
| 64 | strcpy(szBuffer + pPrefix->nLength, szFileName); |
| 65 | szFileName = szBuffer; |
| 66 | } |
| 67 | |
| 68 | return szFileName; |
| 69 | } |
| 70 | |
| 71 | static bool OpenLocalFile(const char * szFileName, HANDLE * PtrFile) |
| 72 | { |