aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/fileio.h
diff options
context:
space:
mode:
authorStrangerke2011-09-14 00:10:59 +0200
committerStrangerke2011-09-14 00:10:59 +0200
commit82e0b6fc4bb719e9b3e647c3fcb40cefec9fcd28 (patch)
tree06fffb4df55aebef45f1c2f4d1cbd9ac35607d4b /engines/cge/fileio.h
parenta702da70acf5e78e6c6c459d459e09602f89a952 (diff)
downloadscummvm-rg350-82e0b6fc4bb719e9b3e647c3fcb40cefec9fcd28.tar.gz
scummvm-rg350-82e0b6fc4bb719e9b3e647c3fcb40cefec9fcd28.tar.bz2
scummvm-rg350-82e0b6fc4bb719e9b3e647c3fcb40cefec9fcd28.zip
CGE: Rewrite fileIO
Diffstat (limited to 'engines/cge/fileio.h')
-rw-r--r--engines/cge/fileio.h43
1 files changed, 17 insertions, 26 deletions
diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h
index 443cddde14..4d2539cc37 100644
--- a/engines/cge/fileio.h
+++ b/engines/cge/fileio.h
@@ -40,14 +40,12 @@ namespace CGE {
#define kBtLeafCount ((kBtSize - 4 /*sizeof(Hea) */) / (kBtKeySize + 4 + 2 /*sizeof(BtKeypack) */))
#define kBtValNone 0xFFFF
#define kBtValRoot 0
-#define kLineMaxSize 512
-#define kBufferSize 2048
#define kCatName "VOL.CAT"
#define kDatName "VOL.DAT"
struct BtKeypack {
char _key[kBtKeySize];
- uint32 _mark;
+ uint32 _pos;
uint16 _size;
};
@@ -61,20 +59,6 @@ struct Header {
uint16 _down;
};
-class IoHand {
-public:
- Common::File *_file;
- uint16 _error;
-
- IoHand(const char *name);
- IoHand();
- virtual ~IoHand();
- uint16 read(void *buf, uint16 len);
- long mark();
- long size();
- long seek(long pos);
-};
-
struct BtPage {
Header _header;
union {
@@ -86,20 +70,28 @@ struct BtPage {
BtKeypack _leaf[kBtLeafCount];
};
- void read(Common::ReadStream &s);
+ void readBTree(Common::ReadStream &s);
};
-class BtFile : public IoHand {
+class ResourceManager {
struct {
BtPage *_page;
- uint16 _pgNo;
- int _indx;
+ uint16 _pageNo;
+ int _index;
} _buff[kBtLevel];
- BtPage *getPage(int lev, uint16 pgn);
+ BtPage *getPage(int level, uint16 pageId);
+ uint16 catRead(void *buf, uint16 length);
+ Common::File *_catFile;
+ Common::File *_datFile;
+ uint16 XCrypt(void *buf, uint16 length);
public:
- BtFile(const char *name);
- virtual ~BtFile();
+
+ ResourceManager();
+ ~ResourceManager();
+ uint16 read(void *buf, uint16 length);
+ bool seek(int32 offs, int whence = 0);
+
BtKeypack *find(const char *key);
bool exist(const char *name);
};
@@ -120,8 +112,7 @@ public:
Common::String readLine();
};
-extern IoHand *_dat;
-extern BtFile *_cat;
+extern ResourceManager *_resman;
} // End of namespace CGE