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

Function LoadFileWithMem

Source/engine.cpp:1005–1026  ·  view source on GitHub ↗

* @brief Load a file in to the given buffer * @param pszName Path of file * @param p Target buffer * @return Size of file */

Source from the content-addressed store, hash-verified

1003 * @return Size of file
1004 */
1005DWORD LoadFileWithMem(const char *pszName, void *p)
1006{
1007 DWORD dwFileLen;
1008 HANDLE hsFile;
1009
1010 assert(pszName);
1011 if (p == NULL) {
1012 app_fatal("LoadFileWithMem(NULL):\n%s", pszName);
1013 }
1014
1015 WOpenFile(pszName, &hsFile, FALSE);
1016
1017 dwFileLen = WGetFileSize(hsFile, NULL, pszName);
1018 if (dwFileLen == 0) {
1019 app_fatal("Zero length SFILE:\n%s", pszName);
1020 }
1021
1022 WReadFile(hsFile, p, dwFileLen, pszName);
1023 WCloseFile(hsFile);
1024
1025 return dwFileLen;
1026}
1027
1028/**
1029 * @brief Apply the color swaps to a CL2 sprite

Callers 3

PlaceUniqueMonstFunction · 0.85
doom_load_graphicsFunction · 0.85
LoadPlrGFXFunction · 0.85

Calls 5

app_fatalFunction · 0.85
WOpenFileFunction · 0.85
WGetFileSizeFunction · 0.85
WReadFileFunction · 0.85
WCloseFileFunction · 0.85

Tested by

no test coverage detected