mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-17 07:07:10 +00:00
CGE: Some more cleanup in fileIo
This commit is contained in:
parent
5d8bbc2f48
commit
c9900b605a
@ -79,8 +79,8 @@ void CGEEngine::init() {
|
||||
_miniShp = NULL;
|
||||
_miniShpList = NULL;
|
||||
_sprite = NULL;
|
||||
_dat = new IoHand(kDatName, XCrypt);
|
||||
_cat = new BtFile(kCatName, XCrypt);
|
||||
_dat = new IoHand(kDatName);
|
||||
_cat = new BtFile(kCatName);
|
||||
|
||||
// Create debugger console
|
||||
_console = new CGEConsole(this);
|
||||
|
@ -38,12 +38,11 @@ namespace CGE {
|
||||
/*-----------------------------------------------------------------------
|
||||
* IOHand
|
||||
*-----------------------------------------------------------------------*/
|
||||
IoHand::IoHand(Crypt *crypt) : _error(0), _crypt(crypt), _seed(kCryptSeed) {
|
||||
IoHand::IoHand() : _error(0) {
|
||||
_file = new Common::File();
|
||||
}
|
||||
|
||||
IoHand::IoHand(const char *name, Crypt *crypt)
|
||||
: _error(0), _crypt(crypt), _seed(kCryptSeed) {
|
||||
IoHand::IoHand(const char *name) : _error(0) {
|
||||
_file = new Common::File();
|
||||
_file->open(name);
|
||||
}
|
||||
@ -60,8 +59,7 @@ uint16 IoHand::read(void *buf, uint16 len) {
|
||||
uint16 bytesRead = _file->read(buf, len);
|
||||
if (!bytesRead)
|
||||
error("Read %s - %d bytes", _file->getName(), len);
|
||||
if (_crypt)
|
||||
_seed = _crypt(buf, len);
|
||||
XCrypt(buf, len);
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
@ -104,9 +102,8 @@ void BtPage::read(Common::ReadStream &s) {
|
||||
/*-----------------------------------------------------------------------
|
||||
* BtFile
|
||||
*-----------------------------------------------------------------------*/
|
||||
BtFile::BtFile(const char *name, Crypt *crpt)
|
||||
: IoHand(name, crpt) {
|
||||
debugC(1, kCGEDebugFile, "BtFile::BtFile(%s, crpt)", name);
|
||||
BtFile::BtFile(const char *name) : IoHand(name) {
|
||||
debugC(1, kCGEDebugFile, "BtFile::BtFile(%s)", name);
|
||||
|
||||
for (int i = 0; i < kBtLevel; i++) {
|
||||
_buff[i]._page = new BtPage;
|
||||
|
@ -62,15 +62,12 @@ struct Header {
|
||||
};
|
||||
|
||||
class IoHand {
|
||||
protected:
|
||||
uint16 _seed;
|
||||
Crypt *_crypt;
|
||||
public:
|
||||
Common::File *_file;
|
||||
uint16 _error;
|
||||
|
||||
IoHand(const char *name, Crypt crypt);
|
||||
IoHand(Crypt *crypt);
|
||||
IoHand(const char *name);
|
||||
IoHand();
|
||||
virtual ~IoHand();
|
||||
uint16 read(void *buf, uint16 len);
|
||||
long mark();
|
||||
@ -101,7 +98,7 @@ class BtFile : public IoHand {
|
||||
|
||||
BtPage *getPage(int lev, uint16 pgn);
|
||||
public:
|
||||
BtFile(const char *name, Crypt *crpt);
|
||||
BtFile(const char *name);
|
||||
virtual ~BtFile();
|
||||
BtKeypack *find(const char *key);
|
||||
bool exist(const char *name);
|
||||
|
Loading…
Reference in New Issue
Block a user