aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Montoir2007-03-02 23:57:37 +0000
committerGregory Montoir2007-03-02 23:57:37 +0000
commit77aa551722288cb0a8f45a70cc46057e9339b87f (patch)
tree45ec8da8e815e195c1700279699a72f5da8b8f2c
parent4a1039fbc66999d20d8c305ea62dc245f9c6f231 (diff)
downloadscummvm-rg350-77aa551722288cb0a8f45a70cc46057e9339b87f.tar.gz
scummvm-rg350-77aa551722288cb0a8f45a70cc46057e9339b87f.tar.bz2
scummvm-rg350-77aa551722288cb0a8f45a70cc46057e9339b87f.zip
only request the user to update the queen.tbl if the game she/he's trying to play really *requires* it.
svn-id: r25944
-rw-r--r--engines/queen/resource.cpp48
-rw-r--r--engines/queen/resource.h14
-rw-r--r--tools/qtable/qtable.c42
3 files changed, 54 insertions, 50 deletions
diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp
index b57608be6e..cd122717fe 100644
--- a/engines/queen/resource.cpp
+++ b/engines/queen/resource.cpp
@@ -34,22 +34,22 @@ static ResourceEntry *_resourceTablePEM10;
const char *Resource::_tableFilename = "queen.tbl";
const RetailGameVersion Resource::_gameVersions[] = {
- { "PEM10", 0x00000008, 22677657 },
- { "CEM10", 0x0000584E, 190787021 },
- { "PFM10", 0x0002CD93, 22157304 },
- { "CFM10", 0x00032585, 186689095 },
- { "PGM10", 0x00059ACA, 22240013 },
- { "CGM10", 0x0005F2A7, 217648975 },
- { "PIM10", 0x000866B1, 22461366 },
- { "CIM10", 0x0008BEE2, 190795582 },
- { "CSM10", 0x000B343C, 190730602 },
- { "CHM10", 0x000DA981, 190705558 },
- { "PE100", 0x00101EC6, 3724538 },
- { "PE100", 0x00102B7F, 3732177 },
- { "PEint", 0x00103838, 1915913 },
- { "aEM10", 0x00103F1E, 351775 },
- { "CE101", 0x00107D8D, 563335 },
- { "PE100", 0x001086D4, 597032 }
+ { "PEM10", 1, 0x00000008, 22677657 },
+ { "CEM10", 1, 0x0000584E, 190787021 },
+ { "PFM10", 1, 0x0002CD93, 22157304 },
+ { "CFM10", 1, 0x00032585, 186689095 },
+ { "PGM10", 1, 0x00059ACA, 22240013 },
+ { "CGM10", 1, 0x0005F2A7, 217648975 },
+ { "PIM10", 1, 0x000866B1, 22461366 },
+ { "CIM10", 1, 0x0008BEE2, 190795582 },
+ { "CSM10", 1, 0x000B343C, 190730602 },
+ { "CHM10", 1, 0x000DA981, 190705558 },
+ { "PE100", 1, 0x00101EC6, 3724538 },
+ { "PE100", 1, 0x00102B7F, 3732177 },
+ { "PEint", 1, 0x00103838, 1915913 },
+ { "aEM10", 2, 0x00103F1E, 351775 },
+ { "CE101", 2, 0x00107D8D, 563335 },
+ { "PE100", 2, 0x001086D4, 597032 }
};
static int compareResourceEntry(const void *a, const void *b) {
@@ -75,7 +75,7 @@ Resource::Resource()
if (_version.features & GF_REBUILT) {
readTableEntries(&_resourceFile);
} else {
- readTableFile(_version.tableOffset);
+ readTableFile(_version.queenTblVersion, _version.queenTblOffset);
}
checkJASVersion();
@@ -145,7 +145,8 @@ bool Resource::detectVersion(DetectedGameVersion *ver, Common::File *f) {
f->skip(2);
ver->compression = f->readByte();
ver->features = GF_REBUILT;
- ver->tableOffset = 0;
+ ver->queenTblVersion = 0;
+ ver->queenTblOffset = 0;
} else {
const RetailGameVersion *gameVersion = detectGameVersionFromSize(f->size());
if (gameVersion == NULL) {
@@ -155,7 +156,8 @@ bool Resource::detectVersion(DetectedGameVersion *ver, Common::File *f) {
strcpy(ver->str, gameVersion->str);
ver->compression = COMPRESSION_NONE;
ver->features = 0;
- ver->tableOffset = gameVersion->tableOffset;
+ ver->queenTblVersion = gameVersion->queenTblVersion;
+ ver->queenTblOffset = gameVersion->queenTblOffset;
strcpy(ver->str, gameVersion->str);
// Handle game versions for which versionStr information is irrevelant
@@ -264,12 +266,14 @@ void Resource::seekResourceFile(int num, uint32 offset) {
_resourceFile.seek(offset);
}
-void Resource::readTableFile(uint32 offset) {
+void Resource::readTableFile(uint8 version, uint32 offset) {
Common::File tableFile;
tableFile.open(_tableFilename);
if (tableFile.isOpen() && tableFile.readUint32BE() == MKID_BE('QTBL')) {
- if (tableFile.readUint32BE() != CURRENT_TBL_VERSION) {
- warning("Incorrect version of queen.tbl, please update it");
+ uint32 tableVersion = tableFile.readUint32BE();
+ if (version > tableVersion) {
+ error("The game you are trying to play requires version %d of queen.tbl, "
+ "you have version %d ; please update it", version, tableVersion);
}
tableFile.seek(offset);
readTableEntries(&tableFile);
diff --git a/engines/queen/resource.h b/engines/queen/resource.h
index 43e325f2ba..bb6cd4ceb5 100644
--- a/engines/queen/resource.h
+++ b/engines/queen/resource.h
@@ -39,7 +39,8 @@ enum GameFeatures {
struct RetailGameVersion {
char str[6];
- uint32 tableOffset;
+ uint8 queenTblVersion;
+ uint32 queenTblOffset;
uint32 dataFileSize;
};
@@ -49,7 +50,8 @@ struct DetectedGameVersion {
uint8 features;
uint8 compression;
char str[6];
- uint32 tableOffset;
+ uint8 queenTblVersion;
+ uint32 queenTblOffset;
};
struct ResourceEntry {
@@ -118,10 +120,6 @@ public:
};
enum {
- CURRENT_TBL_VERSION = 2
- };
-
- enum {
JAS_VERSION_OFFSET_DEMO = 0x119A8,
JAS_VERSION_OFFSET_INTV = 0xCF8,
JAS_VERSION_OFFSET_PC = 0x12484
@@ -149,8 +147,8 @@ protected:
//! seeks resource file to specific bundle and file offset
void seekResourceFile(int num, uint32 offset);
- //! extarct the resource table for the specified game version
- void readTableFile(uint32 offset);
+ //! extract the resource table for the specified game version
+ void readTableFile(uint8 version, uint32 offset);
//! read the resource table from the specified file
void readTableEntries(Common::File *file);
diff --git a/tools/qtable/qtable.c b/tools/qtable/qtable.c
index 82885abbbf..67467a4917 100644
--- a/tools/qtable/qtable.c
+++ b/tools/qtable/qtable.c
@@ -49,7 +49,8 @@ typedef struct GameVersion {
uint32 dataSize;
DataFileEntry *dataFileEntries;
uint16 dataFileEntriesCount;
- uint32 offset;
+ uint8 queenTblVersion;
+ uint32 queenTblOffset;
} GameVersion;
#include "fat_eng_floppy.h"
@@ -73,22 +74,22 @@ typedef struct GameVersion {
#define FAT(x) x, (sizeof(x)/sizeof(x[0]))
static GameVersion gameVersionsTable[] = {
- { "PEM10", 22677657, FAT(fatEngFl), 0 },
- { "CEM10", 190787021, FAT(fatEngCd), 0 },
- { "PFM10", 22157304, FAT(fatFreFl), 0 },
- { "CFM10", 186689095, FAT(fatFreCd), 0 },
- { "PGM10", 22240013, FAT(fatGerFl), 0 },
- { "CGM10", 217648975, FAT(fatGerCd), 0 },
- { "PIM10", 22461366, FAT(fatItaFl), 0 },
- { "CIM10", 190795582, FAT(fatItaCd), 0 },
- { "CSM10", 190730602, FAT(fatSpaCd), 0 },
- { "CHM10", 190705558, FAT(fatHebCd), 0 },
- { "PE100", 3724538, FAT(fatPCDemoPcGames), 0 },
- { "PE100", 3732177, FAT(fatPCDemo), 0 },
- { "PEint", 1915913, FAT(fatPCInterview), 0 },
- { "aEM10", 351775, FAT(fatAmigaEngFl), 0 },
- { "CE101", 563335, FAT(fatAmigaDemo), 0 },
- { "PE100", 597032, FAT(fatAmigaInterview), 0 }
+ { "PEM10", 22677657, FAT(fatEngFl), 1, 0 },
+ { "CEM10", 190787021, FAT(fatEngCd), 1, 0 },
+ { "PFM10", 22157304, FAT(fatFreFl), 1, 0 },
+ { "CFM10", 186689095, FAT(fatFreCd), 1, 0 },
+ { "PGM10", 22240013, FAT(fatGerFl), 1, 0 },
+ { "CGM10", 217648975, FAT(fatGerCd), 1, 0 },
+ { "PIM10", 22461366, FAT(fatItaFl), 1, 0 },
+ { "CIM10", 190795582, FAT(fatItaCd), 1, 0 },
+ { "CSM10", 190730602, FAT(fatSpaCd), 1, 0 },
+ { "CHM10", 190705558, FAT(fatHebCd), 1, 0 },
+ { "PE100", 3724538, FAT(fatPCDemoPcGames), 1, 0 },
+ { "PE100", 3732177, FAT(fatPCDemo), 1, 0 },
+ { "PEint", 1915913, FAT(fatPCInterview), 1, 0 },
+ { "aEM10", 351775, FAT(fatAmigaEngFl), 2, 0 },
+ { "CE101", 563335, FAT(fatAmigaDemo), 2, 0 },
+ { "PE100", 597032, FAT(fatAmigaInterview), 2, 0 }
};
static const uint32 QTBL_TAG = 0x5154424C;
@@ -150,7 +151,8 @@ static void createTableFile(TableFile *tf) {
const DataFileEntry *dfe = &dfet->fileEntries[j];
writeEntry(out, dfe);
}
- gameVersionsTable[i].offset = offset;
+ assert(gameVersionsTable[i].queenTblVersion <= CURRENT_VERSION);
+ gameVersionsTable[i].queenTblOffset = offset;
/* update offset */
offset += 2 + dfet->fileEntriesCount * (12 + 1 + 4 + 4);
}
@@ -159,10 +161,10 @@ static void createTableFile(TableFile *tf) {
static void printGameVersionTable() {
int i;
- printf("const GameVersion Resource::_gameVersions[] = {\n");
+ printf("const RetailGameVersion Resource::_gameVersions[] = {\n");
for (i = 0; i < ARRAYSIZE(gameVersionsTable); ++i) {
const GameVersion *gv = &gameVersionsTable[i];
- printf("\t{ \"%s\", 0x%08X, %9d },\n", gv->id, gv->offset, gv->dataSize);
+ printf("\t{ \"%s\", %d, 0x%08X, %9d },\n", gv->id, gv->queenTblVersion, gv->queenTblOffset, gv->dataSize);
}
printf("};\n");
}