aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ps2/fileio.h
diff options
context:
space:
mode:
authorMax Lingua2009-03-04 03:55:00 +0000
committerMax Lingua2009-03-04 03:55:00 +0000
commit804910c42219ddbbc428f619515952c1474e9096 (patch)
tree45d7676d7e6033b9ea14c71ff6527fc7e949cf8a /backends/platform/ps2/fileio.h
parent3a35b5b5f25a6ff5d20be5374bdb505f51ee3a43 (diff)
downloadscummvm-rg350-804910c42219ddbbc428f619515952c1474e9096.tar.gz
scummvm-rg350-804910c42219ddbbc428f619515952c1474e9096.tar.bz2
scummvm-rg350-804910c42219ddbbc428f619515952c1474e9096.zip
- 0.13.x friendly ;-)
- new GUI/themes - no more funky colors! - load/delete saved games - cleaned-up Makefile.PS2 : - dropped multiple extra paths - dropped deprecated deps (UCL, MPEG2) - all possible devices are supported to store, play and save games: - CD - HD - USB - MC - REMOTE ! (this could actually be anywhere on the internet as long as you run "ps2client listen" on the machine on the other side that hosts the games) - tested from : - ps2link - uLE - toxicOS - tested with: - bass - bs1 - mi1 - comi - indy4 - ft - ite - ihnm - elvira1 - dig - kyra - lure - simon2 - goblins1 Played all those games in 1 session using RTL. Very smooth, sub-second RTL experience. No crash! - new PAL/NTSC detection : we are now reading the flavor from PS2 ROM, it should work on all PS2 slim too - new PAL TV centering : no more missing chunk of games on top/bottom - we can now read the savefiles from Linux/SDL and other backends! if you add that you can read them from remote together with the games that you already have there, you can imagine the fun ;-) - we fully implement RTL with every games/engine - we nicely reboot / shutdown on quit - fully support for themes/savegames paths. Run from MC, play the games on remote and store your data on USB or HD. No limits! - universal write/read for every media (of course no write on CD/DVD!) - fully async / DMA read-write access to every media (even MC!) - optimized cache/read-ahead for every media - now COMI is fast and enjoyable from remote as it is from CD ;-) - non polluting MC storage, just 1 folder + 1 icon, so that you can copy all your settings / saved games to another MC in one go! svn-id: r39102
Diffstat (limited to 'backends/platform/ps2/fileio.h')
-rw-r--r--backends/platform/ps2/fileio.h58
1 files changed, 48 insertions, 10 deletions
diff --git a/backends/platform/ps2/fileio.h b/backends/platform/ps2/fileio.h
index d09d7313a6..6c2b9402a3 100644
--- a/backends/platform/ps2/fileio.h
+++ b/backends/platform/ps2/fileio.h
@@ -32,21 +32,56 @@ typedef signed long int64;
#include <stdio.h>
#include "common/scummsys.h"
+
+#define CACHE_SIZE (2048 * 32)
+#define MAX_READ_STEP (2048 * 16)
+#define MAX_CACHED_FILES 6
+#define CACHE_READ_THRESHOLD (16 * 2048)
+#define CACHE_FILL_MIN (2048 * 24)
+#define READ_ALIGN 64 // align all reads to the size of an EE cache line
+#define READ_ALIGN_MASK (READ_ALIGN - 1)
+
+
class Ps2File {
public:
- Ps2File(int64 cacheId);
+ Ps2File(void);
virtual ~Ps2File(void);
- virtual bool open(const char *name) = 0;
- virtual uint32 read(void *dest, uint32 len) = 0;
- virtual uint32 write(const void *src, uint32 len) = 0;
- virtual uint32 tell(void) = 0;
- virtual uint32 size(void) = 0;
- virtual int seek(int32 offset, int origin) = 0;
- virtual bool eof(void) = 0;
- int64 _cacheId;
+ virtual bool open(const char *name, int mode);
+ virtual uint32 read(void *dest, uint32 len);
+ virtual uint32 write(const void *src, uint32 len);
+ virtual int32 tell(void);
+ virtual int32 size(void);
+ virtual int seek(int32 offset, int origin);
+ virtual bool eof(void);
+ virtual bool getErr(void);
+ virtual void setErr(bool);
+
+
private:
-};
+ void cacheReadAhead(void);
+ void cacheReadSync(void);
+
+ int _fd;
+ uint32 _fileSize;
+ uint32 _filePos;
+ uint32 _cacheSize;
+ uint32 _cachePos;
+ // uint8 cache[2048];
+ uint8 *_cache;
+
+ int _eof;
+ int _sema;
+
+
+ uint8 *_cacheBuf;
+ bool _cacheOpRunning;
+ uint32 _physFilePos;
+ uint32 _bytesInCache, _cacheOfs;
+
+ uint32 _readBytesBlock;
+ bool _stream;
+};
FILE *ps2_fopen(const char *fname, const char *mode);
int ps2_fclose(FILE *stream);
@@ -64,5 +99,8 @@ int ps2_fputc(int c, FILE *stream);
int ps2_fputs(const char *s, FILE *stream);
int ps2_fprintf(FILE *pOut, const char *zFormat, ...);
+int ps2_ferror(FILE *stream);
+void ps2_clearerr(FILE *stream);
+
#endif // __PS2FILE_IO__