[Scummvm-cvs-logs] SF.net SVN: scummvm:[48324] scummvm/trunk/engines/teenagent
megath at users.sourceforge.net
megath at users.sourceforge.net
Sat Mar 20 17:08:28 CET 2010
Revision: 48324
http://scummvm.svn.sourceforge.net/scummvm/?rev=48324&view=rev
Author: megath
Date: 2010-03-20 16:08:28 +0000 (Sat, 20 Mar 2010)
Log Message:
-----------
documented pack classes, restored old substream creation for FilePack
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/pack.cpp
scummvm/trunk/engines/teenagent/pack.h
Modified: scummvm/trunk/engines/teenagent/pack.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/pack.cpp 2010-03-20 15:57:04 UTC (rev 48323)
+++ scummvm/trunk/engines/teenagent/pack.cpp 2010-03-20 16:08:28 UTC (rev 48324)
@@ -49,12 +49,7 @@
offsets = new uint32[_fileCount + 1];
for (uint32 i = 0; i <= _fileCount; ++i) {
offsets[i] = file.readUint32LE();
- //debug(0, "%d: %06x", i, offsets[i]);
}
- /* for (uint32 i = 0; i < count; ++i) {
- debug(0, "%d: len = %d", i, offsets[i + 1] - offsets[i]);
- }
- */
return true;
}
@@ -79,13 +74,7 @@
if (id < 1 || id > _fileCount)
return NULL;
//debug(0, "stream: %04x-%04x", offsets[id - 1], offsets[id]);
- file.seek(offsets[id - 1]);
- uint32 size = offsets[id] - offsets[id - 1];
- byte *ptr = (byte *)malloc(size);
- if (ptr == NULL)
- return NULL;
- uint32 r = file.read(ptr, size);
- return new Common::MemoryReadStream(ptr, r, DisposeAfterUse::YES);
+ return new Common::SeekableSubReadStream(&file, offsets[id - 1], offsets[id]);
}
Modified: scummvm/trunk/engines/teenagent/pack.h
===================================================================
--- scummvm/trunk/engines/teenagent/pack.h 2010-03-20 15:57:04 UTC (rev 48323)
+++ scummvm/trunk/engines/teenagent/pack.h 2010-03-20 16:08:28 UTC (rev 48324)
@@ -46,6 +46,7 @@
virtual Common::SeekableReadStream *getStream(uint32 id) const = 0;
};
+///FilePack keeps opened file and returns substream for each request.
class FilePack : public Pack {
mutable Common::File file;
uint32 *offsets;
@@ -62,6 +63,9 @@
virtual Common::SeekableReadStream *getStream(uint32 id) const;
};
+/** Pack file which reopens file each request. Do not keep file descriptor open.
+ ** Useful for minimizing file descriptors opened at the same time. Critical for PSP backend.
+ **/
class TransientFilePack : public Pack {
uint32 *offsets;
Common::String _filename;
@@ -78,6 +82,7 @@
virtual Common::SeekableReadStream *getStream(uint32 id) const;
};
+///MemoryPack loads whole pack in memory, currently unused.
class MemoryPack : public Pack {
struct Chunk {
byte *data;
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