diff options
author | Johannes Schickel | 2009-11-19 17:43:15 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-11-19 17:43:15 +0000 |
commit | 34b447147df73ba4ee282be69d8f4f9453ed3499 (patch) | |
tree | 0e8457aa903cf06a5a758a5f28dccace956771aa | |
parent | 113c720ee1b6bcde6fe1740ed9a059aad7a6967c (diff) | |
download | scummvm-rg350-34b447147df73ba4ee282be69d8f4f9453ed3499.tar.gz scummvm-rg350-34b447147df73ba4ee282be69d8f4f9453ed3499.tar.bz2 scummvm-rg350-34b447147df73ba4ee282be69d8f4f9453ed3499.zip |
More cleanup.
svn-id: r45988
-rw-r--r-- | tools/create_kyradat/create_kyradat.cpp | 36 | ||||
-rw-r--r-- | tools/create_kyradat/extract.cpp | 4 | ||||
-rw-r--r-- | tools/create_kyradat/extract.h | 2 |
3 files changed, 27 insertions, 15 deletions
diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp index b645798ce9..ecd68758a8 100644 --- a/tools/create_kyradat/create_kyradat.cpp +++ b/tools/create_kyradat/create_kyradat.cpp @@ -309,14 +309,14 @@ const ExtractFilename *getFilenameDesc(const int id) { // filename processing -bool getFilename(char *dstFilename, const Game *g, const int id) { +bool getFilename(char *dstFilename, const ExtractInformation *info, const int id) { const ExtractFilename *i = getFilenameDesc(id); if (!i) return false; const ExtractType *type = findExtractType(i->type); - type->createFilename(dstFilename, g->game, g->lang, g->platform, g->special, i->filename); + type->createFilename(dstFilename, info, i->filename); return true; } @@ -428,7 +428,13 @@ bool checkIndex(const byte *s, const int srcSize) { bool updateIndex(PAKFile &out, const Game *g) { char filename[32]; - createFilename(filename, g->game, -1, g->platform, g->special, "INDEX"); + ExtractInformation extractInfo; + extractInfo.game = g->game; + extractInfo.lang = -1; + extractInfo.platform = g->platform; + extractInfo.special = g->special; + + createFilename(filename, &extractInfo, "INDEX"); byte *index = new byte[kIndexSize]; assert(index); @@ -456,7 +462,13 @@ bool updateIndex(PAKFile &out, const Game *g) { bool checkIndex(PAKFile &out, const Game *g) { char filename[32]; - createFilename(filename, g->game, -1, g->platform, g->special, "INDEX"); + ExtractInformation extractInfo; + extractInfo.game = g->game; + extractInfo.lang = -1; + extractInfo.platform = g->platform; + extractInfo.special = g->special; + + createFilename(filename, &extractInfo, "INDEX"); uint32 size = 0; const uint8 *data = out.getFileData(filename, &size); @@ -1027,6 +1039,12 @@ bool getExtractionData(const Game *g, Search &search, IdMap &map); bool process(PAKFile &out, const Game *g, const byte *data, const uint32 size) { char filename[128]; + ExtractInformation extractInfo; + extractInfo.game = g->game; + extractInfo.lang = g->lang; + extractInfo.platform = g->platform; + extractInfo.special = g->special; + if (!checkIndex(out, g)) { fprintf(stderr, "ERROR: corrupted INDEX file\n"); return false; @@ -1053,7 +1071,7 @@ bool process(PAKFile &out, const Game *g, const byte *data, const uint32 size) { // Try whether the data is present in the kyra.dat file already filename[0] = 0; - if (!getFilename(filename, g, *entry)) + if (!getFilename(filename, &extractInfo, *entry)) error("couldn't find filename for id %d", *entry); PAKFile::cFileList *list = out.getFileList(); @@ -1069,17 +1087,11 @@ bool process(PAKFile &out, const Game *g, const byte *data, const uint32 size) { if (breakProcess) return false; - ExtractInformation extractInfo; - extractInfo.game = g->game; - extractInfo.lang = g->lang; - extractInfo.platform = g->platform; - extractInfo.special = g->special; - for (IdMap::const_iterator i = ids.begin(); i != ids.end(); ++i) { const int id = i->first; filename[0] = 0; - if (!getFilename(filename, g, id)) { + if (!getFilename(filename, &extractInfo, id)) { fprintf(stderr, "ERROR: couldn't get filename for id %d\n", id); return false; } diff --git a/tools/create_kyradat/extract.cpp b/tools/create_kyradat/extract.cpp index 04f70e62c8..50f58a2db6 100644 --- a/tools/create_kyradat/extract.cpp +++ b/tools/create_kyradat/extract.cpp @@ -87,7 +87,7 @@ void createFilename(char *dstFilename, const ExtractInformation *info, const cha strcpy(dstFilename, filename); static const char *gidExtensions[] = { "", ".K2", ".K3", 0, ".LOL" }; - strcat(dstFilename, gidExtensions[info->gid]); + strcat(dstFilename, gidExtensions[info->game]); for (const SpecialExtension *specialE = specialTable; specialE->special != -1; ++specialE) { if (specialE->special == info->special) { @@ -119,7 +119,7 @@ void createLangFilename(char *dstFilename, const ExtractInformation *info, const } static const char *gidExtensions[] = { "", ".K2", ".K3", 0, ".LOL" }; - strcat(dstFilename, gidExtensions[gid]); + strcat(dstFilename, gidExtensions[info->game]); for (const SpecialExtension *specialE = specialTable; specialE->special != -1; ++specialE) { if (specialE->special == info->special) { diff --git a/tools/create_kyradat/extract.h b/tools/create_kyradat/extract.h index 650c10fc1c..b0a694577b 100644 --- a/tools/create_kyradat/extract.h +++ b/tools/create_kyradat/extract.h @@ -68,7 +68,7 @@ struct ExtractType { const ExtractType *findExtractType(const int type); // TODO: Do not export this in the future -void createFilename(char *dstFilename, const int gid, const int lang, const int platform, const int special, const char *filename); +void createFilename(char *dstFilename, const ExtractInformation *info, const char *filename); #endif |