-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathresource.h
More file actions
84 lines (70 loc) · 2.25 KB
/
resource.h
File metadata and controls
84 lines (70 loc) · 2.25 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* Raw - Another World Interpreter
* Copyright (C) 2004 Gregory Montoir
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __RESOURCE_H__
#define __RESOURCE_H__
#include "intern.h"
struct MemEntry {
uint8 valid; // 0x0
uint8 type; // 0x1, Resource::ResType
uint8 *bufPtr; // 0x2
uint16 unk4; // 0x4, unused
uint8 rankNum; // 0x6
uint8 bankNum; // 0x7
uint32 bankPos; // 0x8 0xA
uint16 unkC; // 0xC, unused
uint16 packedSize; // 0xE
uint16 unk10; // 0x10, unused
uint16 unpackedSize; // 0x12
};
struct Serializer;
struct Video;
struct Resource {
enum ResType {
RT_SOUND = 0,
RT_MUSIC = 1,
RT_VIDBUF = 2, // full screen video buffer, size=0x7D00
RT_PAL = 3, // palette (1024=vga + 1024=ega), size=2048
RT_SCRIPT = 4,
RT_VBMP = 5
};
enum {
MEM_BLOCK_SIZE = 600 * 1024
};
static const uint16 _memListParts[][4];
Video *_vid;
const char *_dataDir;
MemEntry _memList[150];
uint16 _numMemList;
uint16 _curPtrsId, _newPtrsId;
uint8 *_memPtrStart, *_scriptBakPtr, *_scriptCurPtr, *_vidBakPtr, *_vidCurPtr;
bool _useSegVideo2;
uint8 *_segVideoPal;
uint8 *_segCode;
uint8 *_segVideo1;
uint8 *_segVideo2;
Resource(Video *vid, const char *dataDir);
void readBank(const MemEntry *me, uint8 *dstBuf);
void readEntries();
void load();
void invalidateAll();
void invalidateRes();
void update(uint16 num);
void setupPtrs(uint16 ptrId);
void allocMemBlock();
void freeMemBlock();
void saveOrLoad(Serializer &ser);
};
#endif