* Open a chunk file (starting with FORM) for reading. * * @param filename The name of the file to open. * @return An index value refering to the opened file, or FILE_INVALID. */
| 981 | * @return An index value refering to the opened file, or FILE_INVALID. |
| 982 | */ |
| 983 | uint8 ChunkFile_Open_Ex(enum SearchDirectory dir, const char *filename) |
| 984 | { |
| 985 | uint8 index; |
| 986 | uint32 header; |
| 987 | |
| 988 | index = File_Open_Ex(dir, filename, FILE_MODE_READ); |
| 989 | |
| 990 | if(index == FILE_INVALID) return index; |
| 991 | |
| 992 | File_Read(index, &header, 4); |
| 993 | |
| 994 | if (header != HTOBE32(CC_FORM)) { |
| 995 | File_Close(index); |
| 996 | return FILE_INVALID; |
| 997 | } |
| 998 | |
| 999 | File_Seek(index, 4, 1); |
| 1000 | |
| 1001 | return index; |
| 1002 | } |
| 1003 | |
| 1004 | /** |
| 1005 | * Close an opened chunk file. |
nothing calls this directly
no test coverage detected