forked from rofl0r/agsutils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Clib32.h
68 lines (57 loc) · 2.01 KB
/
Clib32.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef CLIB32_H
#define CLIB32_H
#include <stdio.h>
#include "./ByteArray.h"
#define MAX_FILES 10000
#define MAXMULTIFILES 25
struct MultiFileLib {
char data_filenames[MAXMULTIFILES][20];
size_t num_data_files;
char filenames[MAX_FILES][25];
unsigned offset[MAX_FILES];
unsigned length[MAX_FILES];
char file_datafile[MAX_FILES]; // number of datafile
size_t num_files;
};
struct MultiFileLibNew {
char data_filenames[MAXMULTIFILES][50];
size_t num_data_files;
char filenames[MAX_FILES][100];
unsigned offset[MAX_FILES];
unsigned length[MAX_FILES];
char file_datafile[MAX_FILES]; // number of datafile
size_t num_files;
};
struct AgsFile {
struct ByteArray f;
struct MultiFileLibNew mflib;
int libversion;
char* fn;
char *dir;
};
/* generic interface */
void AgsFile_init(struct AgsFile *buf, char* filename);
void AgsFile_close(struct AgsFile *f);
/* reader interface */
int AgsFile_open(struct AgsFile *buf);
int AgsFile_getVersion(struct AgsFile *f);
size_t AgsFile_getFileCount(struct AgsFile *f);
char *AgsFile_getFileName(struct AgsFile *f, size_t index);
size_t AgsFile_getOffset(struct AgsFile *f, size_t index);
size_t AgsFile_getFileSize(struct AgsFile *f, size_t index);
int AgsFile_getFileNumber(struct AgsFile *f, size_t index);
size_t AgsFile_getDataFileCount(struct AgsFile *f);
char *AgsFile_getDataFileName(struct AgsFile *f, size_t index);
int AgsFile_dump(struct AgsFile* f, size_t index, char* outfn);
/* writer interface */
// the directory containing the files passed via setFile
void AgsFile_setSourceDir(struct AgsFile *f, char* sourcedir);
void AgsFile_setVersion(struct AgsFile *f, int version);
void AgsFile_setFileCount(struct AgsFile *f, size_t count);
int AgsFile_setFile(struct AgsFile *f, size_t index, char* fn);
void AgsFile_setDataFileCount(struct AgsFile *f, size_t count);
void AgsFile_setFileNumber(struct AgsFile *f, size_t index, int number);
int AgsFile_setDataFile(struct AgsFile *f, size_t index, char* fn);
int AgsFile_write(struct AgsFile *f);
//RcB: DEP "Clib32.c"
#endif