[Scummvm-cvs-logs] CVS: scummvm/queen defs.h,1.9,1.10 queen.cpp,1.19,1.20 resource.cpp,1.16,1.17 resource.h,1.14,1.15
Joost Peters
joostp at users.sourceforge.net
Mon Oct 20 14:41:02 CEST 2003
Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv7738/queen
Modified Files:
defs.h queen.cpp resource.cpp resource.h
Log Message:
allow loading of rebuilt/compressed datafile
Index: defs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/defs.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- defs.h 18 Oct 2003 11:46:52 -0000 1.9
+++ defs.h 20 Oct 2003 19:18:01 -0000 1.10
@@ -28,6 +28,12 @@
#define InRange(x,l,h) ((x)<=(h) && (x)>=(l)) /* X in [l..h] */
enum {
+ COMPRESSION_NONE = 0,
+ COMPRESSION_MP3 = 1,
+ COMPRESSION_OGG = 2
+};
+
+enum {
GAME_SCREEN_WIDTH = 320,
GAME_SCREEN_HEIGHT = 200,
ROOM_ZONE_HEIGHT = 150,
Index: queen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- queen.cpp 19 Oct 2003 18:52:28 -0000 1.19
+++ queen.cpp 20 Oct 2003 19:18:02 -0000 1.20
@@ -44,6 +44,7 @@
static const GameSettings queen_settings[] = {
/* Flight of the Amazon Queen */
{ "queen", "Flight of the Amazon Queen", GID_QUEEN_FIRST, 99, MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "queen.1" },
+ { "queencomp", "Flight of the Amazon Queen", GID_QUEEN_FIRST, 99, MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "queen.1c" },
{ NULL, NULL, 0, 0, MDT_NONE, 0, NULL}
};
@@ -59,15 +60,18 @@
GameList detectedGames;
const GameSettings *g = &queen_settings[0];
- // Iterate over all files in the given directory
- for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
- const char *gameName = file->displayName().c_str();
+ while(g->detectname) {
+ // Iterate over all files in the given directory
+ for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) {
+ const char *gameName = file->displayName().c_str();
- if (0 == scumm_stricmp(g->detectname, gameName)) {
- // Match found, add to list of candidates, then abort inner loop.
- detectedGames.push_back(*g);
- break;
+ if (0 == scumm_stricmp(g->detectname, gameName)) {
+ // Match found, add to list of candidates, then abort inner loop.
+ detectedGames.push_back(*g);
+ break;
+ }
}
+ g++;
}
return detectedGames;
}
@@ -213,7 +217,7 @@
}
void QueenEngine::initialise(void) {
- _resource = new Resource(_gameDataPath);
+ _resource = new Resource(_gameDataPath, _detector->_game.detectname);
_display = new Display(_system);
_graphics = new Graphics(_display, _resource);
_logic = new Logic(_resource, _graphics, _display);
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/resource.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- resource.cpp 17 Oct 2003 14:26:23 -0000 1.16
+++ resource.cpp 20 Oct 2003 19:18:02 -0000 1.17
@@ -27,7 +27,6 @@
#define DEMO_JAS_VERSION_OFFSET 0x119A8
#define JAS_VERSION_OFFSET 0x12484
-static const char *dataFilename = "queen.1";
static const char *tableFilename = "queen.tbl";
const GameVersion Resource::_gameVersions[] = {
@@ -43,28 +42,30 @@
{ "PE100", true, true, 0x000B40F5 }
};
-Resource::Resource(const Common::String &datafilePath)
+Resource::Resource(const Common::String &datafilePath, const char *datafileName)
: _JAS2Pos(0), _datafilePath(datafilePath), _resourceEntries(0), _resourceTable(NULL) {
_resourceFile = new File();
- _resourceFile->open(dataFilename, _datafilePath);
+ _resourceFile->open(datafileName, _datafilePath);
if (_resourceFile->isOpen() == false)
- error("Could not open resource file '%s%s'", _datafilePath.c_str(), dataFilename);
-
+ error("Could not open resource file '%s%s'", _datafilePath.c_str(), datafileName);
- _gameVersion = detectGameVersion(_resourceFile->size());
+ if (_resourceFile->readUint32BE() == 'QTBL') {
+ readTableCompResource();
+ } else {
+ _gameVersion = detectGameVersion(_resourceFile->size());
- if (!readTableFile()) {
- //check if it is the english floppy version, for which we have a hardcoded version of the tables
- if (!strcmp(_gameVersion->versionString, _gameVersions[VER_ENG_FLOPPY].versionString)) {
- _gameVersion = &_gameVersions[VER_ENG_FLOPPY];
- _resourceEntries = 1076;
- _resourceTable = _resourceTablePEM10;
- } else {
- error("Couldn't find tablefile '%s%s'", _datafilePath.c_str(), tableFilename);
+ if (!readTableFile()) {
+ //check if it is the english floppy version, for which we have a hardcoded version of the tables
+ if (!strcmp(_gameVersion->versionString, _gameVersions[VER_ENG_FLOPPY].versionString)) {
+ _gameVersion = &_gameVersions[VER_ENG_FLOPPY];
+ _resourceEntries = 1076;
+ _resourceTable = _resourceTablePEM10;
+ } else {
+ error("Couldn't find tablefile '%s%s'", _datafilePath.c_str(), tableFilename);
+ }
}
}
-
if (strcmp(_gameVersion->versionString, JASVersion()))
error("Verifying game version failed! (expected: '%s', found: '%s')", _gameVersion->versionString, JASVersion());
@@ -248,6 +249,33 @@
return true;
}
return false;
+}
+
+void Resource::readTableCompResource() {
+ GameVersion *gv = new GameVersion;
+ _resourceFile->read(gv->versionString, 6);
+ gv->isFloppy = _resourceFile->readByte() != 0;
+ gv->isDemo = _resourceFile->readByte() != 0;
+ _compression = _resourceFile->readByte();
+ _resourceEntries = _resourceFile->readUint16BE();
+ _gameVersion = gv;
+
+ _resourceFile->seek(15, SEEK_SET);
+ _resourceTable = new ResourceEntry[_resourceEntries];
+ ResourceEntry *pre = _resourceTable;
+ for (uint32 i = 0; i < _resourceEntries; ++i, ++pre) {
+ _resourceFile->read(pre->filename, 12);
+ pre->filename[12] = '\0';
+ pre->inBundle = _resourceFile->readByte();
+ pre->offset = _resourceFile->readUint32BE();
+ pre->size = _resourceFile->readUint32BE();
+ }
+}
+
+File *Resource::giveMP3(const char *filename) {
+ assert(strstr(filename, ".SB"));
+ _resourceFile->seek(fileOffset(filename), SEEK_SET);
+ return _resourceFile;
}
} // End of namespace Queen
Index: resource.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/resource.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- resource.h 14 Oct 2003 12:55:31 -0000 1.14
+++ resource.h 20 Oct 2003 19:18:02 -0000 1.15
@@ -58,14 +58,16 @@
class Resource {
public:
- Resource(const Common::String &datafilePath);
+ Resource(const Common::String &datafilePath, const char *datafileName);
~Resource(void);
uint8 *loadFile(const char *filename, uint32 skipBytes = 0, byte *dstBuf = NULL);
char *getJAS2Line();
bool exists(const char *filename);
bool isDemo();
bool isFloppy();
+ uint8 compression() { return _compression; }
uint32 fileSize(const char *filename);
+ File *giveMP3(const char *filename);
Language getLanguage();
const char *JASVersion();
@@ -73,6 +75,7 @@
File *_resourceFile;
char *_JAS2Ptr;
uint32 _JAS2Pos;
+ uint8 _compression;
const Common::String _datafilePath;
const GameVersion *_gameVersion;
uint32 _resourceEntries;
@@ -83,6 +86,7 @@
int32 resourceIndex(const char *filename);
uint32 fileOffset(const char *filename);
bool readTableFile();
+ void readTableCompResource();
static const GameVersion *detectGameVersion(uint32 dataFilesize);
};
More information about the Scummvm-git-logs
mailing list