* @brief Load a file in to the given buffer * @param pszName Path of file * @param p Target buffer * @return Size of file */
| 1003 | * @return Size of file |
| 1004 | */ |
| 1005 | DWORD 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 |
no test coverage detected