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

Function LoadSqpTable

3rdParty/StormLib/src/SBaseSubTypes.cpp:158–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158void * LoadSqpTable(TMPQArchive * ha, DWORD dwByteOffset, DWORD cbTableSize, DWORD dwKey)
159{
160 ULONGLONG ByteOffset;
161 LPBYTE pbSqpTable;
162
163 // Allocate buffer for the table
164 pbSqpTable = STORM_ALLOC(BYTE, cbTableSize);
165 if(pbSqpTable != NULL)
166 {
167 // Load the table
168 ByteOffset = ha->MpqPos + dwByteOffset;
169 if(FileStream_Read(ha->pStream, &ByteOffset, pbSqpTable, cbTableSize))
170 {
171 // Decrypt the SQP table
172 DecryptMpqBlock(pbSqpTable, cbTableSize, dwKey);
173 return pbSqpTable;
174 }
175
176 // Free the table
177 STORM_FREE(pbSqpTable);
178 }
179
180 return NULL;
181}
182
183TMPQHash * LoadSqpHashTable(TMPQArchive * ha)
184{

Callers 2

LoadSqpHashTableFunction · 0.85
LoadSqpBlockTableFunction · 0.85

Calls 2

FileStream_ReadFunction · 0.85
DecryptMpqBlockFunction · 0.85

Tested by

no test coverage detected