[Scummvm-cvs-logs] SF.net SVN: scummvm:[42764] scummvm/branches/branch-1-0-0/engines/kyra/ staticres.cpp
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Jul 25 16:53:52 CEST 2009
Revision: 42764
http://scummvm.svn.sourceforge.net/scummvm/?rev=42764&view=rev
Author: lordhoto
Date: 2009-07-25 14:53:51 +0000 (Sat, 25 Jul 2009)
Log Message:
-----------
Add HACK, which assures that kyra.dat is only opened once and kept open for the whole run.
Modified Paths:
--------------
scummvm/branches/branch-1-0-0/engines/kyra/staticres.cpp
Modified: scummvm/branches/branch-1-0-0/engines/kyra/staticres.cpp
===================================================================
--- scummvm/branches/branch-1-0-0/engines/kyra/staticres.cpp 2009-07-25 14:38:54 UTC (rev 42763)
+++ scummvm/branches/branch-1-0-0/engines/kyra/staticres.cpp 2009-07-25 14:53:51 UTC (rev 42764)
@@ -67,6 +67,23 @@
return false;
return true;
}
+
+class CachedArchiveMember : public Common::ArchiveMember {
+ Common::String _name;
+ Common::SeekableReadStream *_stream;
+public:
+ CachedArchiveMember(Common::SeekableReadStream *stream, Common::String name)
+ : _name(name), _stream(stream) {}
+
+ ~CachedArchiveMember() { delete _stream; }
+
+ Common::String getName() const { return _name; }
+
+ Common::SeekableReadStream *createReadStream() const {
+ return new Common::SeekableSubReadStream(_stream, 0, _stream->size());
+ }
+};
+
} // end of anonymous namespace
// used for the KYRA.DAT file which still uses
@@ -151,9 +168,9 @@
continue;
}
- delete file; file = 0;
+ Common::ArchiveMemberPtr kyraDat(new CachedArchiveMember(file, "KYRA.DAT"));
- if (!res->loadPakFile(staticDataFilename(), *i))
+ if (!res->loadPakFile(staticDataFilename(), kyraDat))
continue;
if (tryKyraDatLoad()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list