MCPcopy Create free account
hub / github.com/diasurgical/devilution / GetPatchFileName

Function GetPatchFileName

3rdParty/StormLib/src/SFileOpenFileEx.cpp:46–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46static 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
71static bool OpenLocalFile(const char * szFileName, HANDLE * PtrFile)
72{

Callers 1

OpenPatchedFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected