ScummVM API documentation
winexe_ne.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 COMMON_WINEXE_NE_H
23 #define COMMON_WINEXE_NE_H
24 
25 #include "common/list.h"
26 #include "common/str.h"
27 #include "common/formats/winexe.h"
28 
29 namespace Common {
30 
40 template<class T> class Array;
41 class SeekableReadStream;
42 
49 class NEResources : public WinResources {
50 public:
51  NEResources();
52  ~NEResources();
53 
55  void clear();
56 
59 
61  bool loadFromEXE(SeekableReadStream *stream, DisposeAfterUse::Flag disposeFileHandle = DisposeAfterUse::YES);
62 
64  const Array<WinResourceID> getIDList(const WinResourceID &type) const;
65 
68 
70  String loadString(uint32 stringID);
71 
72 protected:
73  VersionInfo *parseVersionInfo(SeekableReadStream *stream);
74 
75 private:
77  struct Resource {
78  WinResourceID id;
79 
80  WinResourceID type;
81 
82  uint32 offset;
83  uint32 size;
84 
85  uint16 flags;
86  uint16 handle;
87  uint16 usage;
88  };
89 
90  SeekableReadStream *_exe;
91  DisposeAfterUse::Flag _disposeFileHandle;
92 
94  List<Resource> _resources;
95 
98  TypeMap _nameTable;
99 
101  uint32 getResourceTableOffset();
103  bool readResourceTable(uint32 offset);
104 
106  bool readNameTable(uint32 offset, uint32 size);
107 
109  const Resource *findResource(const WinResourceID &type, const WinResourceID &id) const;
110 
112  static String getResourceString(SeekableReadStream &exe, uint32 offset);
113 };
114 
117 } // End of namespace Common
118 
119 #endif
Definition: str.h:59
SeekableReadStream * getResource(const WinResourceID &type, const WinResourceID &id)
Definition: array.h:52
Definition: stream.h:745
virtual bool loadFromEXE(const Path &fileName)
const Array< WinResourceID > getIDList(const WinResourceID &type) const
Definition: winexe_ne.h:49
String loadString(uint32 stringID)
Definition: hashmap.h:85
Definition: algorithm.h:29
Definition: winexe.h:69
bool loadFromEXE(SeekableReadStream *stream, DisposeAfterUse::Flag disposeFileHandle=DisposeAfterUse::YES)
Definition: winexe.h:110
Definition: winexe.h:149