agssim: move register declaration to top
[rofl0r-agsutils.git] / RoomFile.h
blob998ab7c3b6ddd396436bc1b23781cc539deaf61c
1 #ifndef ROOMFILE_H
2 #define ROOMFILE_H
4 #include <assert.h>
5 #include <stddef.h>
6 #include "File.h"
9 enum RoomFileBlockType {
10 BLOCKTYPE_MAIN = 1,
11 BLOCKTYPE_MIN = BLOCKTYPE_MAIN,
12 BLOCKTYPE_SCRIPT = 2,
13 BLOCKTYPE_COMPSCRIPT = 3,
14 BLOCKTYPE_COMPSCRIPT2 = 4,
15 BLOCKTYPE_OBJECTNAMES = 5,
16 BLOCKTYPE_ANIMBKGRND = 6,
17 BLOCKTYPE_COMPSCRIPT3 = 7, /* only bytecode script type supported by released engine code */
18 BLOCKTYPE_PROPERTIES = 8,
19 BLOCKTYPE_OBJECTSCRIPTNAMES = 9,
20 BLOCKTYPE_MAX = BLOCKTYPE_OBJECTSCRIPTNAMES,
21 BLOCKTYPE_EOF = 0xFF
24 struct RoomFile {
25 short version;
26 off_t blockpos[BLOCKTYPE_MAX+1];
27 unsigned blocklen[BLOCKTYPE_MAX+1];
30 /* 0: error, 1: succcess. expect pointer to zero-initialized struct */
31 int RoomFile_read(AF *f, struct RoomFile *r);
32 char *RoomFile_extract_source(AF *f, struct RoomFile *r, size_t *sizep);
34 /* this function actually isn't room specific at all, it works with all
35 script containers as it looks out for the start signature. */
36 ssize_t ARF_find_code_start(AF* f, size_t start);
39 #pragma RcB2 DEP "RoomFile.c"
41 #endif