[Scummvm-cvs-logs] SF.net SVN: scummvm: [25944] scummvm/trunk
cyx at users.sourceforge.net
cyx at users.sourceforge.net
Sat Mar 3 00:57:37 CET 2007
Revision: 25944
http://scummvm.svn.sourceforge.net/scummvm/?rev=25944&view=rev
Author: cyx
Date: 2007-03-02 15:57:37 -0800 (Fri, 02 Mar 2007)
Log Message:
-----------
only request the user to update the queen.tbl if the game she/he's trying to play really *requires* it.
Modified Paths:
--------------
scummvm/trunk/engines/queen/resource.cpp
scummvm/trunk/engines/queen/resource.h
scummvm/trunk/tools/qtable/qtable.c
Modified: scummvm/trunk/engines/queen/resource.cpp
===================================================================
--- scummvm/trunk/engines/queen/resource.cpp 2007-03-02 23:53:20 UTC (rev 25943)
+++ scummvm/trunk/engines/queen/resource.cpp 2007-03-02 23:57:37 UTC (rev 25944)
@@ -34,22 +34,22 @@
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 @@
if (_version.features & GF_REBUILT) {
readTableEntries(&_resourceFile);
} else {
- readTableFile(_version.tableOffset);
+ readTableFile(_version.queenTblVersion, _version.queenTblOffset);
}
checkJASVersion();
@@ -145,7 +145,8 @@
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 @@
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 @@
_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);
Modified: scummvm/trunk/engines/queen/resource.h
===================================================================
--- scummvm/trunk/engines/queen/resource.h 2007-03-02 23:53:20 UTC (rev 25943)
+++ scummvm/trunk/engines/queen/resource.h 2007-03-02 23:57:37 UTC (rev 25944)
@@ -39,7 +39,8 @@
struct RetailGameVersion {
char str[6];
- uint32 tableOffset;
+ uint8 queenTblVersion;
+ uint32 queenTblOffset;
uint32 dataFileSize;
};
@@ -49,7 +50,8 @@
uint8 features;
uint8 compression;
char str[6];
- uint32 tableOffset;
+ uint8 queenTblVersion;
+ uint32 queenTblOffset;
};
struct ResourceEntry {
@@ -118,10 +120,6 @@
};
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 @@
//! 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);
Modified: scummvm/trunk/tools/qtable/qtable.c
===================================================================
--- scummvm/trunk/tools/qtable/qtable.c 2007-03-02 23:53:20 UTC (rev 25943)
+++ scummvm/trunk/tools/qtable/qtable.c 2007-03-02 23:57:37 UTC (rev 25944)
@@ -49,7 +49,8 @@
uint32 dataSize;
DataFileEntry *dataFileEntries;
uint16 dataFileEntriesCount;
- uint32 offset;
+ uint8 queenTblVersion;
+ uint32 queenTblOffset;
} GameVersion;
#include "fat_eng_floppy.h"
@@ -73,22 +74,22 @@
#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 @@
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 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");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list