MCPcopy Create free account
hub / github.com/Scobalula/Greyhound / InsertAssetFile

Function InsertAssetFile

src/External/CascLib/src/CascRootFile_OW.cpp:244–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244DWORD InsertAssetFile(
245 TCascStorage * hs,
246 CASC_FILE_TREE & FileTree,
247 char * szFileName,
248 size_t nPlainName, // Offset of the plain name in the name template
249 LPBYTE pbCKey,
250 LPBYTE pbGuid)
251{
252 PCASC_CKEY_ENTRY pCKeyEntry;
253 DWORD dwErrCode = ERROR_SUCCESS;
254 BYTE GuidReversed[8];
255
256 // Try to find the CKey
257 if((pCKeyEntry = FindCKeyEntry_CKey(hs, pbCKey)) != NULL)
258 {
259 // Save the character at the end of the name (dot or EOS)
260 char chSaveChar = szFileName[nPlainName + 16];
261
262 // Imprint the GUID as binary value
263 BinaryReverse64(GuidReversed, pbGuid);
264 StringFromBinary(GuidReversed, sizeof(GuidReversed), szFileName + nPlainName);
265 szFileName[nPlainName + 16] = chSaveChar;
266
267 // Insert the asset to the file tree
268 if(FileTree.InsertByName(pCKeyEntry, szFileName) == NULL)
269 dwErrCode = ERROR_NOT_ENOUGH_MEMORY;
270 }
271 return dwErrCode;
272}
273
274//-----------------------------------------------------------------------------
275// Handler definition for OVERWATCH root file

Callers 1

InsertAssetFilesFunction · 0.85

Calls 4

FindCKeyEntry_CKeyFunction · 0.85
BinaryReverse64Function · 0.85
StringFromBinaryFunction · 0.85
InsertByNameMethod · 0.80

Tested by

no test coverage detected