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

Function GetFileEntryLocale2

3rdParty/StormLib/src/SBaseFileTable.cpp:1810–1841  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1808// Support for file table
1809
1810TFileEntry * GetFileEntryLocale2(TMPQArchive * ha, const char * szFileName, LCID lcLocale, LPDWORD PtrHashIndex)
1811{
1812 TMPQHash * pHash;
1813 DWORD dwFileIndex;
1814
1815 // First, we have to search the classic hash table
1816 // This is because on renaming, deleting, or changing locale,
1817 // we will need the pointer to hash table entry
1818 if(ha->pHashTable != NULL)
1819 {
1820 pHash = GetHashEntryLocale(ha, szFileName, lcLocale, 0);
1821 if(pHash != NULL && MPQ_BLOCK_INDEX(pHash) < ha->dwFileTableSize)
1822 {
1823 if(PtrHashIndex != NULL)
1824 PtrHashIndex[0] = (DWORD)(pHash - ha->pHashTable);
1825 return ha->pFileTable + MPQ_BLOCK_INDEX(pHash);
1826 }
1827 }
1828
1829#ifdef FULL
1830 // If we have HET table in the MPQ, try to find the file in HET table
1831 if(ha->pHetTable != NULL)
1832 {
1833 dwFileIndex = GetFileIndex_Het(ha, szFileName);
1834 if(dwFileIndex != HASH_ENTRY_FREE)
1835 return ha->pFileTable + dwFileIndex;
1836 }
1837#endif
1838
1839 // Not found
1840 return NULL;
1841}
1842
1843TFileEntry * GetFileEntryLocale(TMPQArchive * ha, const char * szFileName, LCID lcLocale)
1844{

Callers 2

GetFileEntryLocaleFunction · 0.85
SFileOpenFileExFunction · 0.85

Calls 2

GetHashEntryLocaleFunction · 0.85
GetFileIndex_HetFunction · 0.85

Tested by

no test coverage detected