aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohannes Schickel2009-08-10 16:42:39 +0000
committerJohannes Schickel2009-08-10 16:42:39 +0000
commit091ecc8fd09b302e9a0c86375f9b848a576700f3 (patch)
treeddaeecd13202f3c928f0c3c32515ead49ce39969 /tools
parentfe7453be1c32b6187706a6be70a0dbbe4edb3e02 (diff)
downloadscummvm-rg350-091ecc8fd09b302e9a0c86375f9b848a576700f3.tar.gz
scummvm-rg350-091ecc8fd09b302e9a0c86375f9b848a576700f3.tar.bz2
scummvm-rg350-091ecc8fd09b302e9a0c86375f9b848a576700f3.zip
- Fix extraction of Kyra 1 amiga string tables in kyra.dat
- Fix "taken" string offsets in kyra.dat - Add temporary workaround for only one "taken" string being present in Kyra 1 amiga. - Update kyra.dat svn-id: r43208
Diffstat (limited to 'tools')
-rw-r--r--tools/create_kyradat/amiga.h2
-rw-r--r--tools/create_kyradat/create_kyradat.cpp18
2 files changed, 15 insertions, 5 deletions
diff --git a/tools/create_kyradat/amiga.h b/tools/create_kyradat/amiga.h
index 26fcddf614..4dbc404d28 100644
--- a/tools/create_kyradat/amiga.h
+++ b/tools/create_kyradat/amiga.h
@@ -14,7 +14,7 @@ const ExtractEntry kyra1AmigaEng[] = {
{ kCharacterImageFilenames, 0x0000C814, 0x0000C904 },
{ kDefaultShapes, 0x00039230, 0x000396BA },
{ kItemNames, 0x0001A3B8, 0x0001A738 },
- { kTakenStrings, 0x0000F9F4, 0x0000FAF0 },
+ { kTakenStrings, 0x0000FAE8, 0x0000FAF0 },
{ kPlacedStrings, 0x0000FAF0, 0x0000FAFA },
{ kDroppedStrings, 0x000101F2, 0x000101FC },
{ kNoDropStrings, 0x0000C98E, 0x0000C9D6 },
diff --git a/tools/create_kyradat/create_kyradat.cpp b/tools/create_kyradat/create_kyradat.cpp
index ead0c232b1..2e53efbaff 100644
--- a/tools/create_kyradat/create_kyradat.cpp
+++ b/tools/create_kyradat/create_kyradat.cpp
@@ -498,7 +498,11 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32
for (uint32 i = 0; i < size; ++i) {
if (!data[i]) {
if (g->special == kAmigaVersion) {
- if (!((i + 1) & 0x1))
+ if (i + 1 >= size)
+ ++entries;
+ else if (!data[i+1])
+ continue;
+ else
++entries;
} else {
++entries;
@@ -554,6 +558,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32
uint8 *buffer = new uint8[targetsize];
assert(buffer);
+ memset(buffer, 0, targetsize);
uint8 *output = buffer;
const uint8 *input = (const uint8*) data;
@@ -561,7 +566,7 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32
if (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ ||
g->special == k2TownsFile1E || g->special == k2TownsFile1J ||
g->special == k2TownsFile2E || g->special == k2TownsFile2J || fmtPatch == 5) {
- const byte * c = data + size;
+ const byte *c = data + size;
do {
if (fmtPatch == 2 && input - data == 0x3C0 && input[0x10] == 0x32) {
memcpy(output, input, 0x0F);
@@ -611,8 +616,13 @@ bool extractStrings(PAKFile &out, const Game *g, const byte *data, const uint32
// we need to strip some aligment zeros out here
int dstPos = 0;
for (uint32 i = 0; i < size; ++i) {
- if (!data[i] && ((i+1) & 0x1))
- continue;
+ if (!data[i]) {
+ if (i + 1 > size)
+ continue;
+ else if (i + 1 < size && !data[i+1])
+ continue;
+ }
+
*output++ = data[i];
++dstPos;
}