mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-05-05 14:53:51 +00:00
chore(file): add tests for SFile functions
This commit is contained in:
parent
1e86f98691
commit
40d58978e1
20 changed files with 567 additions and 18 deletions
|
|
@ -10,10 +10,12 @@
|
|||
#endif
|
||||
|
||||
#if defined(WHOA_SYSTEM_MAC) || defined(WHOA_SYSTEM_LINUX)
|
||||
#define ERROR_SUCCESS 0x0
|
||||
#define ERROR_INVALID_HANDLE 0x6
|
||||
#define ERROR_NOT_ENOUGH_MEMORY 0x8
|
||||
#define ERROR_INVALID_PARAMETER 0x57
|
||||
#define ERROR_SUCCESS 0
|
||||
#define ERROR_FILE_NOT_FOUND 2
|
||||
#define ERROR_INVALID_HANDLE 6
|
||||
#define ERROR_NOT_ENOUGH_MEMORY 8
|
||||
#define ERROR_HANDLE_EOF 38
|
||||
#define ERROR_INVALID_PARAMETER 87
|
||||
#endif
|
||||
|
||||
[[noreturn]] void STORMCDECL SErrDisplayAppFatal(const char* format, ...);
|
||||
|
|
|
|||
|
|
@ -12,18 +12,78 @@
|
|||
DECLARE_STORM_HANDLE(HSARCHIVE);
|
||||
DECLARE_STORM_HANDLE(HSFILE);
|
||||
|
||||
int32_t STORMAPI SFileOpenArchive(const char* archivename, int32_t priority, uint32_t flags, HSARCHIVE* handle);
|
||||
#define SFILE_ARCHIVE_READ_FROM_CD_ONLY 0x000001
|
||||
#define SFILE_ARCHIVE_ENABLE_OVERLAPPED 0x000002
|
||||
#define SFILE_ARCHIVE_DONT_CHECKDISK 0x000004
|
||||
#define SFILE_ARCHIVE_DONT_SEARCH 0x000008
|
||||
#define SFILE_ARCHIVE_ARC4_DECRYPT 0x000010
|
||||
#define SFILE_ARCHIVE_DECRYPTION_TYPES 0x000010
|
||||
#define SFILE_ARCHIVE_WRITE_PERMISSION 0x000010
|
||||
#define SFILE_ARCHIVE_OPEN_LAST_ARCHIVE 0x000020
|
||||
#define SFILE_ARCHIVE_LOAD_MD5_VALUES 0x000040
|
||||
#define SFILE_ARCHIVE_LOAD_CRC_VALUES 0x000080
|
||||
#define SFILE_ARCHIVE_LOAD_TIMESTAMPS 0x000100
|
||||
#define SFILE_ARCHIVE_CHECK_MD5_VALUES 0x000200
|
||||
#define SFILE_ARCHIVE_USE_NEW_BLOCK_HASH_FORMAT 0x000400
|
||||
#define SFILE_ARCHIVE_INIT_TABLE_ON_OPEN 0x000800
|
||||
#define SFILE_ARCHIVE_LOAD_DELTA_VALUES 0x001000
|
||||
#define SFILE_ARCHIVE_LOAD_DELTA_AS_RAW 0x002000
|
||||
#define SFILE_ARCHIVE_DONT_TRUNCATE 0x004000
|
||||
#define SFILE_ARCHIVE_DISK_DELETE_CAN_FAIL 0x010000
|
||||
#define SFILE_ARCHIVE_SC1161_PERMISSIVE 0x020000
|
||||
|
||||
#define SFILE_OPENFLAG_CHECKDISK 1
|
||||
#define SFILE_OPENFLAG_CHECKDISK_NOPATH 2
|
||||
#define SFILE_OPENFLAG_NATIVEHANDLE 4 // made up
|
||||
#define SFILE_OPENFLAG_PERM_SHARED_WRITE 0x8000
|
||||
#define SFILE_OPENFLAG_PRESERVE_PATH_SEPARATORS 0x10000
|
||||
|
||||
#define SFILE_BEGIN 0
|
||||
#define SFILE_CURRENT 1
|
||||
#define SFILE_END 2
|
||||
|
||||
/* // Leaving as documentation
|
||||
|
||||
#define SFILE_AUTH_UNABLETOAUTHENTICATE 0
|
||||
#define SFILE_AUTH_NOSIGNATURE 1
|
||||
#define SFILE_AUTH_BADSIGNATURE 2
|
||||
#define SFILE_AUTH_UNKNOWNSIGNATURE 3
|
||||
#define SFILE_AUTH_FIRSTAUTHENTIC 5
|
||||
#define SFILE_AUTH_AUTHENTICBLIZZARD 5
|
||||
|
||||
#define SFILE_DIRECT_ENABLE_RELATIVE 1
|
||||
#define SFILE_DIRECT_ENABLE_NOPATH 2
|
||||
|
||||
#define SFILE_PLATFORM_ANY 0
|
||||
#define SFILE_PLATFORM_WIN32 1
|
||||
#define SFILE_PLATFORM_MAC 2
|
||||
|
||||
enum SARCHIVE_TYPE {
|
||||
SARCHIVE_MPQ,
|
||||
SARCHIVE_ZIP,
|
||||
};
|
||||
|
||||
enum SFILE_TYPE {
|
||||
SFILE_PLAIN,
|
||||
SFILE_COMPRESSED,
|
||||
SFILE_PAQ,
|
||||
SFILE_OLD_SFILE,
|
||||
SFILE_ZIP_FILE,
|
||||
};
|
||||
*/
|
||||
|
||||
int32_t STORMAPI SFileCloseArchive(HSARCHIVE handle);
|
||||
|
||||
int32_t STORMAPI SFileCloseFile(HSFILE handle);
|
||||
|
||||
uint32_t STORMAPI SFileGetFileSize(HSFILE handle, uint32_t* filesizehigh = nullptr);
|
||||
|
||||
int32_t STORMAPI SFileOpenArchive(const char* archivename, int32_t priority, uint32_t flags, HSARCHIVE* handle);
|
||||
|
||||
int32_t STORMAPI SFileOpenFileEx(HSARCHIVE archivehandle, const char* filename, uint32_t flags, HSFILE* handle);
|
||||
|
||||
int32_t STORMAPI SFileReadFile(HSFILE handle, void* buffer, uint32_t bytestoread, uint32_t* bytesread, LPOVERLAPPED overlapped);
|
||||
|
||||
uint32_t STORMAPI SFileGetFileSize(HSFILE handle, uint32_t* filesizehigh);
|
||||
int32_t STORMAPI SFileReadFile(HSFILE handle, void* buffer, uint32_t bytestoread, uint32_t* bytesread = nullptr, LPOVERLAPPED overlapped = nullptr);
|
||||
|
||||
uint32_t STORMAPI SFileSetFilePointer(HSFILE handle, int32_t distancetomove, int32_t* distancetomovehigh, uint32_t movemethod);
|
||||
|
||||
int32_t STORMAPI SFileCloseFile(HSFILE handle);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue