diff options
author | Matthew Hoops | 2011-02-22 11:14:38 -0500 |
---|---|---|
committer | Matthew Hoops | 2011-02-22 12:33:41 -0500 |
commit | 3995610ce376e49208ba9489d2079c5f6beac1e3 (patch) | |
tree | 11c9bf8c67e262a31c4ebd6c64ad3c7b03a4b2cc | |
parent | d5c494a239ec4380dca7bbbbe68e0aa453c2a658 (diff) | |
download | scummvm-rg350-3995610ce376e49208ba9489d2079c5f6beac1e3.tar.gz scummvm-rg350-3995610ce376e49208ba9489d2079c5f6beac1e3.tar.bz2 scummvm-rg350-3995610ce376e49208ba9489d2079c5f6beac1e3.zip |
COMMON: Add a convenience function to ignore the language field
-rw-r--r-- | common/pe_exe.cpp | 11 | ||||
-rw-r--r-- | common/pe_exe.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/common/pe_exe.cpp b/common/pe_exe.cpp index d4aa4bcf49..fc35c0fcb2 100644 --- a/common/pe_exe.cpp +++ b/common/pe_exe.cpp @@ -275,6 +275,17 @@ const Array<PEResourceID> PEResources::getLangList(const PEResourceID &type, con return array; } +SeekableReadStream *PEResources::getResource(const PEResourceID &type, const PEResourceID &name) { + Array<PEResourceID> langList = getLangList(type, name); + + if (langList.empty()) + return 0; + + const Resource &resource = _resources[type][name][langList[0]]; + _exe->seek(resource.offset); + return _exe->readStream(resource.size); +} + SeekableReadStream *PEResources::getResource(const PEResourceID &type, const PEResourceID &name, const PEResourceID &lang) { if (!_exe || !_resources.contains(type)) return 0; diff --git a/common/pe_exe.h b/common/pe_exe.h index ca33a2ca72..c86058fb4f 100644 --- a/common/pe_exe.h +++ b/common/pe_exe.h @@ -122,6 +122,9 @@ public: /** Return a list of languages for a given type and name. */ const Array<PEResourceID> getLangList(const PEResourceID &type, const PEResourceID &name) const; + /** Return a stream to the specified resource, taking the first language found (or 0 if non-existent). */ + SeekableReadStream *getResource(const PEResourceID &type, const PEResourceID &name); + /** Return a stream to the specified resource (or 0 if non-existent). */ SeekableReadStream *getResource(const PEResourceID &type, const PEResourceID &name, const PEResourceID &lang); |