summaryrefslogtreecommitdiff
path: root/mpq-bios.h
blob: c046f53bf67e654084711c2def103ab3c8543683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef __MPQ_BIOS_H__
#define __MPQ_BIOS_H__

#include "mpqlib-stdint.h"

struct mpq_archive_t;

#define MPQ_FLAGS_ISFILE      0x80000000
#define MPQ_FLAGS_HAS_META    0x04000000
#define MPQ_FLAGS_UNIT        0x01000000
#define MPQ_FLAGS_ADJUST      0x00020000
#define MPQ_FLAGS_ENCRYPTED   0x00010000
#define MPQ_FLAGS_COMPRESSED  0x00000200
#define MPQ_FLAGS_IMPLODED    0x00000100

enum mpqlib_ioctl_t {
    MPQLIB_IOCTL_NO_ACTION = 0,
    MPQLIB_IOCTL_ENTRY_EXISTS,
    MPQLIB_IOCTL_GET_FORMAT_VERSION,
    MPQLIB_IOCTL_GET_SECTOR_SIZE,
    MPQLIB_IOCTL_GET_BLOCK_OFFSET,
    MPQLIB_IOCTL_GET_BLOCK_SIZE,
    MPQLIB_IOCTL_GET_FILE_SIZE,
    MPQLIB_IOCTL_GET_FLAGS,
};

#ifdef __cplusplus
extern "C" {
#endif

void mpqlib_init();
struct mpq_archive_t * mpqlib_open_archive(const char * fname);
struct mpq_archive_t * mpqlib_reopen_archive(int fd);
void mpqlib_printtables(struct mpq_archive_t *);
void mpqlib_close_archive(struct mpq_archive_t *);
int mpqlib_find_hash_entry_by_name(struct mpq_archive_t *, const char * name, uint32_t language, uint32_t platform);
int mpqlib_find_hash_entry_by_hash(struct mpq_archive_t *, uint32_t h, uint32_t hA, uint32_t hB, uint32_t language, uint32_t platform);
uint64_t mpqlib_ioctl(struct mpq_archive_t *, enum mpqlib_ioctl_t command, int entry);

#ifdef __cplusplus
}
#endif

#endif