ScummVM API documentation
archive.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef LASTEXPRESS_ARCHIVE_H
23#define LASTEXPRESS_ARCHIVE_H
24
25#include "lastexpress/lastexpress.h"
26
27#include "common/file.h"
28
29namespace LastExpress {
30
31struct Seq;
32
33/*
34 * HPF Archive Format
35 *
36 * * uint32 {4} Number of files
37 *
38 * For each file:
39 * * char {12} Name (zero-terminated)
40 * * uint32 {4} Offset (expressed in sectors of 2048 bytes)
41 * * uint16 {2} Size (expressed in sectors of 2048 bytes)
42 * * uint16 {2} Current position (expressed in sectors of 2048 bytes)
43 * * uint16 {2} File status flags:
44 * - Bit 0: "Is on CD"
45 * - Bit 1: "Is loaded"
46 */
47
48typedef struct HPF {
49 char name[12];
50 uint32 offset;
51 uint16 size;
52 uint16 currentPos;
53 uint16 status;
54
55 // For Gold Edition only
56 Common::ArchiveMemberPtr archiveRef;
57 Common::String archiveName;
58
59 HPF() {
60 memset(name, 0, sizeof(name));
61 offset = 0;
62 size = 0;
63 currentPos = 0;
64 status = 0;
65
66 archiveRef = nullptr;
67 archiveName = "";
68 };
69} HPF;
70
71enum HPFFlags {
72 kHPFFileIsOnCD = 1 << 0,
73 kHPFFileIsLoaded = 1 << 1,
74};
75
76
78public:
80 virtual ~ArchiveManager();
81
82 HPF *search(const char *name, HPF *archive, int archiveSize);
83 virtual bool lockCD(int32 index);
84 virtual bool isCDAvailable(int cdNum, char *outPath, int pathSize);
85 virtual bool lockCache(char *filename);
86 virtual void initHPFS();
87 virtual void shutDownHPFS();
88 void unlockCD();
89 virtual HPF *openHPF(const char *filename);
90 void readHD(void *dstBuf, int offset, uint32 size);
91 void readCD(void *dstBuf, int offset, uint32 size);
92 virtual void readHPF(HPF *archive, void *dstBuf, uint32 size);
93 void seekHPF(HPF *archive, uint32 position);
94 void closeHPF(HPF *archive);
95
96 virtual int loadBG(const char *filename);
97 Seq *loadSeq(const char *filename, uint8 ticksToWaitUntilCycleRestart, int character);
98 void loadMice();
99
100protected:
101 LastExpressEngine *_engine = nullptr;
102
103 Common::File *_cdFilePointer = nullptr;
104 int32 _cdFilePosition = 0;
105 int32 _cdArchiveNumFiles = 0;
106
107 Common::File *_hdFilePointer = nullptr;
108 int32 _hdFilePosition = 0;
109 int32 _hdArchiveNumFiles = 0;
110
111 HPF *_cdArchive = nullptr;
112 HPF *_hdArchive = nullptr;
113 int32 _cdArchiveIndex = 0;
114};
115
116} // End of namespace LastExpress
117
118#endif // LASTEXPRESS_ARCHIVE_H
Definition: file.h:47
Definition: str.h:59
Definition: archive.h:77
Definition: lastexpress.h:523
Definition: archive.h:29
Definition: archive.h:48
Definition: lastexpress.h:212