Skip to content

Commit

Permalink
KYRA: add support for Russian Kyra 1 floppy fan translation
Browse files Browse the repository at this point in the history
  • Loading branch information
athrxx committed Jul 27, 2011
1 parent ecdd2e5 commit f44874f
Show file tree
Hide file tree
Showing 14 changed files with 276 additions and 62 deletions.
7 changes: 6 additions & 1 deletion devtools/create_kyradat/create_kyradat.cpp
Expand Up @@ -45,7 +45,7 @@
#include <map>

enum {
kKyraDatVersion = 77
kKyraDatVersion = 78
};

const ExtractFilename extractFilenames[] = {
Expand Down Expand Up @@ -119,6 +119,7 @@ const ExtractFilename extractFilenames[] = {

// AUDIO filename table
{ k1AudioTracks, kTypeStringList, false },
{ k1AudioTracks2, kTypeStringList, false },
{ k1AudioTracksIntro, kTypeStringList, false },

// AMULET anim
Expand Down Expand Up @@ -341,6 +342,7 @@ const TypeTable languageTable[] = {
{ ES_ESP, 4 },
{ IT_ITA, 5 },
{ JA_JPN, 6 },
{ RU_RUS, 7 },
{ -1, -1 }
};

Expand All @@ -366,6 +368,7 @@ const TypeTable specialTable[] = {
{ kTalkieVersion, 1 },
{ kDemoVersion, 2 },
{ kTalkieDemoVersion, 3 },
{ kOldFloppy, 4 },
{ -1, -1 }
};

Expand Down Expand Up @@ -767,6 +770,8 @@ const char *getIdString(const int id) {
return "k1CharacterImageFilenames";
case k1AudioTracks:
return "k1AudioTracks";
case k1AudioTracks2:
return "k1AudioTracks2";
case k1AudioTracksIntro:
return "k1AudioTracksIntro";
case k1ItemNames:
Expand Down
4 changes: 3 additions & 1 deletion devtools/create_kyradat/create_kyradat.h
Expand Up @@ -131,6 +131,7 @@ enum kExtractID {
k1ConfigStrings,

k1AudioTracks,
k1AudioTracks2,
k1AudioTracksIntro,

k1CreditsStrings,
Expand Down Expand Up @@ -275,7 +276,8 @@ enum kSpecial {
kNoSpecial = 0,
kTalkieVersion,
kDemoVersion,
kTalkieDemoVersion
kTalkieDemoVersion,
kOldFloppy,
};

enum kGame {
Expand Down
58 changes: 44 additions & 14 deletions devtools/create_kyradat/extract.cpp
Expand Up @@ -142,6 +142,18 @@ bool extractRaw(PAKFile &out, const ExtractInformation *info, const byte *data,
}

bool extractStrings(PAKFile &out, const ExtractInformation *info, const byte *data, const uint32 size, const char *filename, int id) {
// Skip tables for skipping English string left-overs in the hacky Russian fan translations
static const uint8 rusFanSkip_k2SeqplayStrings[] = { 1, 3, 5, 8, 10, 11, 13, 15, 17, 20, 22, 25, 26, 30, 33, 38, 40, 41, 44, 49, 51, 55, 104, 119, 121, 123 };
static const uint8 rusFanSkip_k1IntroStrings[] = { 3, 5, 9, 11, 13, 16, 18, 21, 24, 32, 34, 36, 38, 41, 44, 49, 52, 55, 57, 59, 61, 64, 66, 69, 72, 75 };
static const uint8 rusFanSkip_k1ThePoisonStrings[] = { 1, 4 };
static const uint8 rusFanSkip_k1FullFlaskStrings[] = { 1, 2, 4, 5, 7 };
static const uint8 rusFanSkip_k1WispJewelStrings[] = { 2 };
static const uint8 rusFanSkip_k1GUIStrings[] = { 1, 3, 6, 8, 11, 13, 18 };
uint32 rusFanSkipIdLen = 0;
const uint8 *rusFanSkipId = 0;
int rusFanEmptyId = 10000;
uint32 skipCount = 0;

int patch = 0;
// FM Towns files that need addional patches
if (info->platform == kPlatformFMTowns) {
Expand All @@ -156,18 +168,36 @@ bool extractStrings(PAKFile &out, const ExtractInformation *info, const byte *da
if (id == k2IngamePakFiles)
patch = 4;

if (id == k2SeqplayStrings && info->lang == Common::RU_RUS)
if (info->lang == Common::RU_RUS) {
patch = 5;
if (id == k2SeqplayStrings) {
rusFanSkipId = rusFanSkip_k2SeqplayStrings;
rusFanSkipIdLen = ARRAYSIZE(rusFanSkip_k2SeqplayStrings);
rusFanEmptyId = 81;
} else if (id == k1IntroStrings) {
rusFanSkipId = rusFanSkip_k1IntroStrings;
rusFanSkipIdLen = ARRAYSIZE(rusFanSkip_k1IntroStrings);
rusFanEmptyId = 30;
} else if (id == k1ThePoisonStrings) {
rusFanSkipId = rusFanSkip_k1ThePoisonStrings;
rusFanSkipIdLen = ARRAYSIZE(rusFanSkip_k1ThePoisonStrings);
} else if (id == k1FullFlaskString) {
rusFanSkipId = rusFanSkip_k1FullFlaskStrings;
rusFanSkipIdLen = ARRAYSIZE(rusFanSkip_k1FullFlaskStrings);
} else if (id == k1GUIStrings) {
rusFanSkipId = rusFanSkip_k1GUIStrings;
rusFanSkipIdLen = ARRAYSIZE(rusFanSkip_k1GUIStrings);
} else if (id == k1WispJewelStrings) {
rusFanSkipId = rusFanSkip_k1WispJewelStrings;
rusFanSkipIdLen = ARRAYSIZE(rusFanSkip_k1WispJewelStrings);
}
}

// HACK
if (id == k2SeqplayIntroTracks && info->game == kLol)
return extractStringsWoSuffix(out, info, data, size, filename, id);
}

// Skip English string left-overs in the hacky Russian fan translation
static const uint8 rusFanSkipId[] = { 1, 3, 5, 8, 10, 11, 13, 15, 17, 20, 22, 25, 26, 30, 33, 38, 40, 41, 44, 49, 51, 55, 104, 119, 121, 123 };
uint32 skipCount = 0;

uint32 entries = 0;
uint32 targetsize = size + 4;
for (uint32 i = 0; i < size; ++i) {
Expand Down Expand Up @@ -210,26 +240,26 @@ bool extractStrings(PAKFile &out, const ExtractInformation *info, const byte *da
}
} else if (patch == 5) {
++skipCount;
while (!data[++i]) {
if (skipCount == 81) {
while (!data[i + 1]) {
if (skipCount == rusFanEmptyId) {
++skipCount;
++entries;
break;
}
if (i == size)
if (++i == size)
break;
targetsize--;
}

for (uint32 ii = 0; ii < ARRAYSIZE(rusFanSkipId); ++ii) {
// Skip English string left-overs in the hacky Russian fan translation
// Skip English string left-overs in the hacky Russian fan translation
for (uint32 ii = 0; ii < rusFanSkipIdLen; ++ii) {
if (skipCount == rusFanSkipId[ii]) {
++skipCount;
uint32 len = strlen((const char*) data + i);
i += len;
targetsize = targetsize - 1 - len;
while (!data[++i]) {
if (i == len)
while (!data[i + 1]) {
if (++i == len)
break;
targetsize--;
}
Expand Down Expand Up @@ -336,15 +366,15 @@ bool extractStrings(PAKFile &out, const ExtractInformation *info, const byte *da

++skipCount;
while (!*input) {
if (skipCount == 81) {
if (skipCount == rusFanEmptyId) {
*output++ = *input;
++skipCount;
}
if (++input == c)
break;
}
// Skip English string left-overs in the hacky Russian fan translation
for (uint32 ii = 0; ii < ARRAYSIZE(rusFanSkipId); ++ii) {
for (uint32 ii = 0; ii < rusFanSkipIdLen; ++ii) {
if (skipCount == rusFanSkipId[ii]) {
++skipCount;
input += strlen((const char*)input);
Expand Down
90 changes: 90 additions & 0 deletions devtools/create_kyradat/games.cpp
Expand Up @@ -44,6 +44,7 @@ const Game kyra1Games[] = {
{ kKyra1, { FR_FRA, -1, -1 }, kPlatformPC, kNoSpecial, { "aa9d6d78d8b199deaf48efeca6d19af2", 0 } },
{ kKyra1, { IT_ITA, -1, -1 }, kPlatformPC, kNoSpecial, { "5d7550306b369a3492f9f3402702477c", 0 } },
{ kKyra1, { ES_ESP, -1, -1 }, kPlatformPC, kNoSpecial, { "9ff130d2558bcd674d4074849d93c362", 0 } },
{ kKyra1, { RU_RUS, -1, -1 }, kPlatformPC, kOldFloppy, { "3b4719e1f8a4d67813b7ada29774aead", 0 } },

// Talkie
{ kKyra1, { EN_ANY, -1, -1 }, kPlatformPC, kTalkieVersion, { "1ebc18f3e7fbb72474a55cb0fa089ed4", 0 } },
Expand Down Expand Up @@ -211,6 +212,93 @@ const int kyra1FloppyNeed[] = {
k1NewGameString,
k1ConfigStrings,
k1AudioTracks,
k1AudioTracks2,
k1AudioTracksIntro,
-1
};

const int kyra1FloppyOldNeed[] = {
k1KallakWritingSeq,
k1MalcolmTreeSeq,
k1WestwoodLogoSeq,
k1KyrandiaLogoSeq,
k1KallakMalcolmSeq,
k1ForestSeq,
k1IntroCPSStrings,
k1IntroCOLStrings,
k1IntroWSAStrings,
k1IntroStrings,
k1RoomList,
k1RoomFilenames,
k1CharacterImageFilenames,
k1DefaultShapes,
k1ItemNames,
k1TakenStrings,
k1PlacedStrings,
k1DroppedStrings,
k1AmuleteAnimSeq,
k1SpecialPalette1,
k1SpecialPalette2,
k1SpecialPalette3,
k1SpecialPalette4,
k1SpecialPalette5,
k1SpecialPalette6,
k1SpecialPalette7,
k1SpecialPalette8,
k1SpecialPalette9,
k1SpecialPalette10,
k1SpecialPalette11,
k1SpecialPalette12,
k1SpecialPalette13,
k1SpecialPalette14,
k1SpecialPalette15,
k1SpecialPalette16,
k1SpecialPalette17,
k1SpecialPalette18,
k1SpecialPalette19,
k1SpecialPalette20,
k1SpecialPalette21,
k1SpecialPalette22,
k1SpecialPalette23,
k1SpecialPalette24,
k1SpecialPalette25,
k1SpecialPalette26,
k1SpecialPalette27,
k1SpecialPalette28,
k1SpecialPalette29,
k1SpecialPalette30,
k1SpecialPalette31,
k1SpecialPalette32,
k1PutDownString,
k1WaitAmuletString,
k1BlackJewelString,
k1HealingTipString,
k1PoisonGoneString,
k1Healing1Shapes,
k1Healing2Shapes,
k1ThePoisonStrings,
k1FluteStrings,
k1PoisonDeathShapes,
k1FluteShapes,
k1Winter1Shapes,
k1Winter2Shapes,
k1Winter3Shapes,
k1DrinkShapes,
k1WispShapes,
k1MagicAnimShapes,
k1BranStoneShapes,
k1WispJewelStrings,
k1MagicJewelStrings,
k1FlaskFullString,
k1FullFlaskString,
k1OutroReunionSeq,
k1OutroHomeString,
k1VeryCleverString,
k1GUIStrings,
k1NewGameString,
k1ConfigStrings,
k1AudioTracks,
k1AudioTracks2,
k1AudioTracksIntro,
-1
};
Expand Down Expand Up @@ -298,6 +386,7 @@ const int kyra1CDNeed[] = {
k1NewGameString,
k1ConfigStrings,
k1AudioTracks,
k1AudioTracks2,
k1AudioTracksIntro,
-1
};
Expand Down Expand Up @@ -941,6 +1030,7 @@ struct GameNeed {

const GameNeed gameNeedTable[] = {
{ kKyra1, kPlatformPC, kNoSpecial, kyra1FloppyNeed },
{ kKyra1, kPlatformPC, kOldFloppy, kyra1FloppyOldNeed },
{ kKyra1, kPlatformAmiga, kNoSpecial, kyra1AmigaNeed },

{ kKyra1, kPlatformPC, kTalkieVersion, kyra1CDNeed },
Expand Down

0 comments on commit f44874f

Please sign in to comment.