aboutsummaryrefslogtreecommitdiff
path: root/tools/create_kyradat
diff options
context:
space:
mode:
authorJohannes Schickel2009-09-17 12:42:50 +0000
committerJohannes Schickel2009-09-17 12:42:50 +0000
commitf5f209797d4ed85917bdb243405c5b7797751c9b (patch)
tree5eb62e6b5cd96e0468a3b39ed55272da4c27a1dd /tools/create_kyradat
parent4ca0e9797054aaf2f35e32212cdcb50376d10fdd (diff)
downloadscummvm-rg350-f5f209797d4ed85917bdb243405c5b7797751c9b.tar.gz
scummvm-rg350-f5f209797d4ed85917bdb243405c5b7797751c9b.tar.bz2
scummvm-rg350-f5f209797d4ed85917bdb243405c5b7797751c9b.zip
- Got rid of special id "kAmigaVersion"
- Changed handling of platform settings via game platform settings and not via special id svn-id: r44148
Diffstat (limited to 'tools/create_kyradat')
-rw-r--r--tools/create_kyradat/create_kyradat.cpp26
-rw-r--r--tools/create_kyradat/create_kyradat.h8
-rw-r--r--tools/create_kyradat/extract.cpp30
-rw-r--r--tools/create_kyradat/games.cpp6
4 files changed, 44 insertions, 26 deletions
diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp
index 08f20141bc..341d8cb8fb 100644
--- a/tools/create_kyradat/create_kyradat.cpp
+++ b/tools/create_kyradat/create_kyradat.cpp
@@ -308,7 +308,7 @@ bool getFilename(char *dstFilename, const Game *g, const int id) {
return false;
const ExtractType *type = findExtractType(i->type);
- type->createFilename(dstFilename, g->game, g->lang, g->special, i->filename);
+ type->createFilename(dstFilename, g->game, g->lang, g->platform, g->special, i->filename);
return true;
}
@@ -318,9 +318,6 @@ const SpecialExtension specialTable[] = {
{ kTalkieVersion, "CD" },
{ kDemoVersion, "DEM" },
{ kDemoCDVersion, "CD.DEM" },
- { kFMTownsVersionE , "TNS" },
- { kFMTownsVersionJ, "TNS" },
- { kAmigaVersion, "AMG" },
{ k2CDFile1E, "CD" },
{ k2CDFile1F, "CD" },
@@ -333,10 +330,6 @@ const SpecialExtension specialTable[] = {
{ k2CDDemoF, "CD" },
{ k2CDDemoG, "CD" },
- { k2TownsFile1E, "TNS" },
- { k2TownsFile1J, "TNS" },
- { k2TownsFile2E, "TNS" },
- { k2TownsFile2J, "TNS" },
{ k2DemoVersion, "DEM" },
{ k2DemoLol, "DEM" },
@@ -356,6 +349,13 @@ const Language languageTable[] = {
{ -1, 0 }
};
+const PlatformExtension platformTable[] = {
+ { kPlatformAmiga, "AMG" },
+ { kPlatformFMTowns, "TNS" },
+
+ { -1, 0 }
+};
+
// index generation
enum {
@@ -388,11 +388,9 @@ uint32 getFeatures(const Game *g) {
features |= GF_DEMO;
else if (g->special == kDemoCDVersion)
features |= (GF_DEMO | GF_TALKIE);
- else if (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ ||
- g->special == k2TownsFile1E || g->special == k2TownsFile1J ||
- g->special == k2TownsFile2E || g->special == k2TownsFile2J)
+ else if (g->platform == kPlatformFMTowns)
features |= GF_FMTOWNS;
- else if (g->special == kAmigaVersion)
+ else if (g->platform == kPlatformAmiga)
features |= GF_AMIGA;
else
features |= GF_FLOPPY;
@@ -435,7 +433,7 @@ bool checkIndex(const byte *s, const int srcSize) {
bool updateIndex(PAKFile &out, const Game *g) {
char filename[32];
- createFilename(filename, g->game, -1, g->special, "INDEX");
+ createFilename(filename, g->game, -1, g->platform, g->special, "INDEX");
byte *index = new byte[kIndexSize];
assert(index);
@@ -463,7 +461,7 @@ bool updateIndex(PAKFile &out, const Game *g) {
bool checkIndex(PAKFile &out, const Game *g) {
char filename[32];
- createFilename(filename, g->game, -1, g->special, "INDEX");
+ createFilename(filename, g->game, -1, g->platform, g->special, "INDEX");
uint32 size = 0;
const uint8 *data = out.getFileData(filename, &size);
diff --git a/tools/create_kyradat/create_kyradat.h b/tools/create_kyradat/create_kyradat.h
index 7e48aca45b..4eb1831a1c 100644
--- a/tools/create_kyradat/create_kyradat.h
+++ b/tools/create_kyradat/create_kyradat.h
@@ -32,6 +32,13 @@ struct Language {
extern const Language languageTable[];
+struct PlatformExtension {
+ int platform;
+ const char *ext;
+};
+
+extern const PlatformExtension platformTable[];
+
enum kExtractID {
kForestSeq = 1,
kKallakWritingSeq,
@@ -279,7 +286,6 @@ enum kSpecial {
kDemoVersion,
kFMTownsVersionE,
kFMTownsVersionJ,
- kAmigaVersion,
k2CDFile1E,
k2CDFile1F,
diff --git a/tools/create_kyradat/extract.cpp b/tools/create_kyradat/extract.cpp
index 6537a270b9..7c2c72c900 100644
--- a/tools/create_kyradat/extract.cpp
+++ b/tools/create_kyradat/extract.cpp
@@ -25,11 +25,11 @@
// Filename creation
-void createFilename(char *dstFilename, const int gid, const int lang, const int special, const char *filename);
+void createFilename(char *dstFilename, const int gid, const int lang, const int platform, const int special, const char *filename);
namespace {
-void createLangFilename(char *dstFilename, const int gid, const int lang, const int special, const char *filename);
+void createLangFilename(char *dstFilename, const int gid, const int lang, const int platform, const int special, const char *filename);
// Extraction function prototypes
@@ -83,7 +83,7 @@ const ExtractType extractTypeTable[] = {
} // end of anonymous namespace
-void createFilename(char *dstFilename, const int gid, const int lang, const int special, const char *filename) {
+void createFilename(char *dstFilename, const int gid, const int lang, const int platform, const int special, const char *filename) {
strcpy(dstFilename, filename);
static const char *gidExtensions[] = { "", ".K2", ".K3", 0, ".LOL" };
@@ -96,11 +96,18 @@ void createFilename(char *dstFilename, const int gid, const int lang, const int
break;
}
}
+
+ for (const PlatformExtension *platformE = platformTable; platformE->platform != -1; ++platformE) {
+ if (platformE->platform == platform) {
+ strcat(dstFilename, ".");
+ strcat(dstFilename, platformE->ext);
+ }
+ }
}
namespace {
-void createLangFilename(char *dstFilename, const int gid, const int lang, const int special, const char *filename) {
+void createLangFilename(char *dstFilename, const int gid, const int lang, const int platform, const int special, const char *filename) {
strcpy(dstFilename, filename);
for (const Language *langE = languageTable; langE->lang != -1; ++langE) {
@@ -121,6 +128,13 @@ void createLangFilename(char *dstFilename, const int gid, const int lang, const
break;
}
}
+
+ for (const PlatformExtension *platformE = platformTable; platformE->platform != -1; ++platformE) {
+ if (platformE->platform == platform) {
+ strcat(dstFilename, ".");
+ strcat(dstFilename, platformE->ext);
+ }
+ }
}
} // end of anonymous namespace
@@ -172,7 +186,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32
uint32 targetsize = size + 4;
for (uint32 i = 0; i < size; ++i) {
if (!data[i]) {
- if (g->special == kAmigaVersion) {
+ if (g->platform == kPlatformAmiga) {
if (i + 1 >= size)
++entries;
else if (!data[i+1] && !(i & 1))
@@ -289,7 +303,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32
}
} while (input < c);
- } else if (g->special == kAmigaVersion) {
+ } else if (g->platform == kPlatformAmiga) {
// we need to strip some aligment zeros out here
int dstPos = 0;
for (uint32 i = 0; i < size; ++i) {
@@ -345,7 +359,7 @@ bool extractStrings10(PAKFile &out, const Game *g, const byte *data, const uint3
bool extractRooms(PAKFile &out, const Game *g, const byte *data, const uint32 size, const char *filename, int id, int lang) {
// different entry size for the FM-TOWNS version
- const int roomEntrySize = (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ) ? (0x69) : ((g->special == kAmigaVersion) ? 0x52 : 0x51);
+ const int roomEntrySize = (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ) ? (0x69) : ((g->platform == kPlatformAmiga) ? 0x52 : 0x51);
const int countRooms = size / roomEntrySize;
uint8 *buffer = new uint8[countRooms * 9 + 4];
@@ -355,7 +369,7 @@ bool extractRooms(PAKFile &out, const Game *g, const byte *data, const uint32 si
WRITE_BE_UINT32(output, countRooms); output += 4;
const byte *src = data;
- if (g->special == kAmigaVersion) {
+ if (g->platform == kPlatformAmiga) {
for (int i = 0; i < countRooms; ++i) {
*output++ = *src++; assert(*src == 0); ++src;
memcpy(output, src, 8); output += 0x8;
diff --git a/tools/create_kyradat/games.cpp b/tools/create_kyradat/games.cpp
index 69d8d172ef..35a7e46d2d 100644
--- a/tools/create_kyradat/games.cpp
+++ b/tools/create_kyradat/games.cpp
@@ -32,7 +32,7 @@ const Game kyra1Games[] = {
{ kKyra1, EN_ANY, kPlatformPC, kDemoCDVersion, "226fdba99cb11ef1047131d9a50e6292" },
// Amiga
- { kKyra1, EN_ANY, kPlatformAmiga, kAmigaVersion, "b620564b6b7e0787b053ca9e35bd9f52" },
+ { kKyra1, EN_ANY, kPlatformAmiga, -1, "b620564b6b7e0787b053ca9e35bd9f52" },
// Floppy
{ kKyra1, EN_ANY, kPlatformPC, -1, "76a4fc84e173cadb6369785787e1546e" },
@@ -760,7 +760,7 @@ struct GameNeed {
const GameNeed gameNeedTable[] = {
{ kKyra1, kPlatformPC, -1, kyra1FloppyNeed },
- { kKyra1, kPlatformAmiga, kAmigaVersion, kyra1AmigaNeed },
+ { kKyra1, kPlatformAmiga, -1, kyra1AmigaNeed },
{ kKyra1, kPlatformPC, kTalkieVersion, kyra1CDNeed },
@@ -817,7 +817,7 @@ const GameNeed gameNeedTable[] = {
const int *getNeedList(const Game *g) {
for (const GameNeed *need = gameNeedTable; need->game != -1; ++need) {
- if (need->game == g->game && need->special == g->special)
+ if (need->game == g->game && g->platform == need->platform && need->special == g->special)
return need->entries;
}