SCUMM: Prepare for translated versions of the MI1 cannibal patch
This commit is contained in:
parent
30ce02e9e3
commit
4bcfd4aa3b
2 changed files with 14 additions and 4 deletions
|
@ -1827,6 +1827,7 @@ bool ScummEngine::tryPatchMI1CannibalScript(byte *buf, int size) {
|
||||||
Common::String expectedMd5;
|
Common::String expectedMd5;
|
||||||
int patchOffset = -1;
|
int patchOffset = -1;
|
||||||
int patchLength = -1;
|
int patchLength = -1;
|
||||||
|
char lang[4];
|
||||||
|
|
||||||
switch (_language) {
|
switch (_language) {
|
||||||
case Common::EN_ANY:
|
case Common::EN_ANY:
|
||||||
|
@ -1836,19 +1837,23 @@ bool ScummEngine::tryPatchMI1CannibalScript(byte *buf, int size) {
|
||||||
expectedMd5 = "98b1126a836ef5bfefff10b605b20555";
|
expectedMd5 = "98b1126a836ef5bfefff10b605b20555";
|
||||||
patchOffset = 167;
|
patchOffset = 167;
|
||||||
patchLength = 22;
|
patchLength = 22;
|
||||||
|
strcpy(lang, "ENG");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note that the patch will not apply to the "Ultimate Talkie" edition
|
||||||
|
// since that script has been patched to a different length.
|
||||||
|
|
||||||
if (size == expectedSize) {
|
if (size == expectedSize) {
|
||||||
// There isn't enough space in the script for the revised
|
// There isn't enough space in the script for the revised
|
||||||
// texts, so these abbreviations will be expanded in
|
// texts, so these abbreviations will be expanded in
|
||||||
// decodeParseString().
|
// decodeParseString().
|
||||||
const byte patchData[] = {
|
const byte patchData[] = {
|
||||||
0x14, 0x03, 0x0F, // print(3,[Text("/LH.1/");
|
0x14, 0x03, 0x0F, // print(3,[Text("/LH.$$$/");
|
||||||
0x2F, 0x4C, 0x48, 0x2E,
|
0x2F, 0x4C, 0x48, 0x2E,
|
||||||
0x31, 0x2F // No terminating 0x00!
|
0x24, 0x24, 0x24, 0x2F // No terminating 0x00!
|
||||||
};
|
};
|
||||||
|
|
||||||
byte *scriptPtr = buf + scriptOffset;
|
byte *scriptPtr = buf + scriptOffset;
|
||||||
|
@ -1868,10 +1873,15 @@ bool ScummEngine::tryPatchMI1CannibalScript(byte *buf, int size) {
|
||||||
if (md5 != expectedMd5)
|
if (md5 != expectedMd5)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Insert the script patch and tag it with the appropriate
|
||||||
|
// language.
|
||||||
|
|
||||||
|
memcpy(scriptPtr + patchOffset, patchData, sizeof(patchData));
|
||||||
|
memcpy(scriptPtr + patchOffset + 7, lang, 3);
|
||||||
|
|
||||||
// Pad the rest of the replaced script part with spaces before
|
// Pad the rest of the replaced script part with spaces before
|
||||||
// terminating the string. Finally, add WaitForMessage().
|
// terminating the string. Finally, add WaitForMessage().
|
||||||
|
|
||||||
memcpy(scriptPtr + patchOffset, patchData, sizeof(patchData));
|
|
||||||
memset(scriptPtr + patchOffset+ sizeof(patchData), 32, patchLength - sizeof(patchData) - 3);
|
memset(scriptPtr + patchOffset+ sizeof(patchData), 32, patchLength - sizeof(patchData) - 3);
|
||||||
scriptPtr[patchOffset + patchLength - 3] = 0;
|
scriptPtr[patchOffset + patchLength - 3] = 0;
|
||||||
scriptPtr[patchOffset + patchLength - 2] = 0xAE;
|
scriptPtr[patchOffset + patchLength - 2] = 0xAE;
|
||||||
|
|
|
@ -2815,7 +2815,7 @@ void ScummEngine_v5::decodeParseString() {
|
||||||
void ScummEngine_v5::printPatchedMI1CannibalString(int textSlot, const byte *ptr) {
|
void ScummEngine_v5::printPatchedMI1CannibalString(int textSlot, const byte *ptr) {
|
||||||
const char *msg = (const char *)ptr;
|
const char *msg = (const char *)ptr;
|
||||||
|
|
||||||
if (strncmp((const char *)ptr, "/LH.1/", 6) == 0) {
|
if (strncmp((const char *)ptr, "/LH.ENG/", 8) == 0) {
|
||||||
msg =
|
msg =
|
||||||
"Oooh, that's nice.\xFF\x03"
|
"Oooh, that's nice.\xFF\x03"
|
||||||
"Simple. Just like one of mine.\xFF\x03"
|
"Simple. Just like one of mine.\xFF\x03"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue