ScummVM API documentation
file_nes.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 SCUMM_FILE_NES_H
23 #define SCUMM_FILE_NES_H
24 
25 #include "scumm/file.h"
26 
27 namespace Scumm {
28 
29 class ScummNESFile : public BaseScummFile {
30 public:
31  enum ROMset {
32  kROMsetUSA,
33  kROMsetEurope,
34  kROMsetSweden,
35  kROMsetFrance,
36  kROMsetGermany,
37  kROMsetSpain,
38  kROMsetItaly,
39  kROMsetNum
40  };
41 
42  struct Resource;
43  struct ResourceGroup;
44  struct LFLEntry;
45  struct LFL;
46 
47  enum ResType {
48  NES_UNKNOWN,
49  NES_GLOBDATA,
50  NES_ROOM,
51  NES_SCRIPT,
52  NES_SOUND,
53  NES_COSTUME,
54  NES_ROOMGFX,
55  NES_COSTUMEGFX,
56  NES_SPRPALS,
57  NES_SPRDESC,
58  NES_SPRLENS,
59  NES_SPROFFS,
60  NES_SPRDATA,
61  NES_CHARSET,
62  NES_PREPLIST
63  };
64 
65 
66 private:
68  ROMset _ROMset;
69  byte *_buf;
70 
71  bool generateIndex();
72  bool generateResource(int res);
73  uint16 extractResource(Common::WriteStream *out, const Resource *res, ResType type);
74 
75  byte fileReadByte();
76  uint16 fileReadUint16LE();
77 
78 public:
79  ScummNESFile();
80 
81  bool open(const Common::Path &filename) override;
82  bool openSubFile(const Common::Path &filename) override;
83 
84  void close() override;
85  bool eos() const override { return _stream->eos(); }
86  int64 pos() const override { return _stream->pos(); }
87  int64 size() const override { return _stream->size(); }
88  bool seek(int64 offs, int whence = SEEK_SET) override { return _stream->seek(offs, whence); }
89  uint32 read(void *dataPtr, uint32 dataSize) override;
90 };
91 
92 } // End of namespace Scumm
93 
94 #endif
virtual int64 size() const =0
Definition: file_nes.h:29
virtual int64 pos() const =0
Definition: stream.h:77
virtual bool seek(int64 offset, int whence=SEEK_SET)=0
virtual bool eos() const =0
Definition: path.h:52
bool eos() const override
Definition: file_nes.h:85
Definition: stream.h:745
int64 pos() const override
Definition: file_nes.h:86
uint32 read(void *dataPtr, uint32 dataSize) override
bool seek(int64 offs, int whence=SEEK_SET) override
Definition: file_nes.h:88
int64 size() const override
Definition: file_nes.h:87
Definition: actor.h:30
Definition: file.h:34