[Scummvm-cvs-logs] SF.net SVN: scummvm:[51965] scummvm/branches/gsoc2010-plugins/backends/fs/ psp/psp-stream.h

toneman1138 at users.sourceforge.net toneman1138 at users.sourceforge.net
Wed Aug 11 03:43:07 CEST 2010


Revision: 51965
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51965&view=rev
Author:   toneman1138
Date:     2010-08-11 01:43:06 +0000 (Wed, 11 Aug 2010)

Log Message:
-----------
manually merged psp-stream.h

Modified Paths:
--------------
    scummvm/branches/gsoc2010-plugins/backends/fs/psp/psp-stream.h

Modified: scummvm/branches/gsoc2010-plugins/backends/fs/psp/psp-stream.h
===================================================================
--- scummvm/branches/gsoc2010-plugins/backends/fs/psp/psp-stream.h	2010-08-11 01:11:16 UTC (rev 51964)
+++ scummvm/branches/gsoc2010-plugins/backends/fs/psp/psp-stream.h	2010-08-11 01:43:06 UTC (rev 51965)
@@ -35,25 +35,39 @@
  */
 class PSPIoStream : public StdioStream, public Suspendable {
 protected:
-	Common::String _path;			/* Need to maintain for reopening after suspend */
-	bool _writeMode;				/* "" */
-	int _pos;						/* "" */
-	mutable int _ferror;			/* Save file ferror */
-	mutable bool _feof;						/* and eof */
-
+	Common::String _path;
+	int _fileSize;
+	bool _writeMode;	// for resuming in the right mode
+	int _physicalPos;	// position in the real file
+	int _pos;			// position. Sometimes virtual
+	bool _inCache;		// whether we're in cache (virtual) mode
+	bool _eos;			// EOS flag
+	
 	enum {
 		SuspendError = 2,
 		ResumeError = 3
 	};
 
-	int _errorSuspend;
+	enum {
+		CACHE_SIZE = 1024,
+		MIN_READ_SIZE = 1024	// reading less than 1024 takes exactly the same time as 1024
+	};
+	
+	// For caching
+	char *_cache;
+	int _cacheStartOffset;		// starting offset of the cache. -1 when cache is invalid
+	
+	mutable int _ferror;		// file error state
+	int _errorSuspend;			// for debugging
 	mutable int _errorSource;
-
-	// Error checking
 	int _errorPos;
 	void * _errorHandle;
 	int _suspendCount;
 
+	bool synchronizePhysicalPos();		// synchronize the physical and virtual positions
+	bool isOffsetInCache(uint32 pos);	// check if an offset is found in cache
+	bool isCacheValid() { return _cacheStartOffset != -1; }
+	
 public:
 
 	/**


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