aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorMartin Kiewitz2013-12-20 16:05:36 +0100
committerMartin Kiewitz2013-12-20 16:05:36 +0100
commitd6dafa822ae82a1a9d7aa7eb19327b2a414cd6af (patch)
tree2ea67d45c24036f8fc30be8e01493bf717802ec2 /engines/sci
parente31b2bb1f565a451c45dcd11a2a646134cb5f90b (diff)
downloadscummvm-rg350-d6dafa822ae82a1a9d7aa7eb19327b2a414cd6af.tar.gz
scummvm-rg350-d6dafa822ae82a1a9d7aa7eb19327b2a414cd6af.tar.bz2
scummvm-rg350-d6dafa822ae82a1a9d7aa7eb19327b2a414cd6af.zip
SCI: final script patcher cleanup
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/script_patches.cpp20
-rw-r--r--engines/sci/engine/script_patches.h32
2 files changed, 27 insertions, 25 deletions
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 4766c0465e..d040ec4e75 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -546,7 +546,7 @@ static const uint16 gk1SignatureDay6PoliceBeignet[] = {
static const uint16 gk1PatchDay6PoliceBeignet[] = {
PATCH_ADDTOOFFSET(+16),
0x34, PATCH_UINT16(0x0017), // ldi 23
- 0x65, PATCH_GETORIGINALBYTEADJUST +20, +2, // aTop seconds (1c for PC, 1e for Mac)
+ 0x65, PATCH_GETORIGINALBYTEADJUST(+20, +2), // aTop seconds (1c for PC, 1e for Mac)
PATCH_END
};
@@ -568,7 +568,7 @@ static const uint16 gk1SignatureDay6PoliceSleep[] = {
static const uint16 gk1PatchDay6PoliceSleep[] = {
PATCH_ADDTOOFFSET(+5),
0x34, SIG_UINT16(0x002a), // ldi 42
- 0x65, PATCH_GETORIGINALBYTEADJUST +9, +2, // aTop seconds (1c for PC, 1e for Mac)
+ 0x65, PATCH_GETORIGINALBYTEADJUST(+9, +2), // aTop seconds (1c for PC, 1e for Mac)
PATCH_END
};
@@ -589,7 +589,7 @@ static const uint16 gk1SignatureDay5PhoneFreeze[] = {
static const uint16 gk1PatchDay5PhoneFreeze[] = {
PATCH_ADDTOOFFSET(+3),
0x35, 0x06, // ldi 01
- 0x65, PATCH_GETORIGINALBYTEADJUST +6, +6, // aTop ticks
+ 0x65, PATCH_GETORIGINALBYTEADJUST(+6, +6), // aTop ticks
PATCH_END
};
@@ -861,8 +861,8 @@ static const uint16 kq6PatchInventoryStackFix[] = {
0x12, // and
0x65, 0x30, // aTop state
0x38, // pushi "show"
- PATCH_GETORIGINALBYTE +22,
- PATCH_GETORIGINALBYTE +23,
+ PATCH_GETORIGINALBYTE(+22),
+ PATCH_GETORIGINALBYTE(+23),
0x78, // push1
0x87, 0x00, // lap param[0]
0x31, 0x04, // bnt [call show using global 0]
@@ -871,7 +871,7 @@ static const uint16 kq6PatchInventoryStackFix[] = {
0x89, 0x00, // lsg global[0], save 1 byte total, see above
0x54, 0x06, // self 06 (call x::show)
0x31, // bnt [menu exit code]
- PATCH_GETORIGINALBYTEADJUST +39, +6,// dynamic offset must be 0x0E for PC and 0x0D for mac
+ PATCH_GETORIGINALBYTEADJUST(+39, +6),// dynamic offset must be 0x0E for PC and 0x0D for mac
0x34, PATCH_UINT16(0x2000), // ldi 2000
0x12, // and
0x2f, 0x05, // bt [to return]
@@ -918,7 +918,7 @@ static const uint16 kq6SignatureDrinkMeFix[] = {
static const uint16 kq6PatchDrinkMeFix[] = {
PATCH_ADDTOOFFSET(+5), // skip to bnt offset
- PATCH_GETORIGINALBYTEADJUST +5, +13, // adjust jump to [check for 11h code]
+ PATCH_GETORIGINALBYTEADJUST(+5, +13), // adjust jump to [check for 11h code]
PATCH_ADDTOOFFSET(+162),
0x39, PATCH_SELECTOR8(doit), // pushi (doit)
0x76, // push0
@@ -1113,7 +1113,7 @@ static const uint16 kq6CDSignatureAudioTextSupport4[] = {
static const uint16 kq6CDPatchAudioTextSupport4[] = {
PATCH_ADDTOOFFSET(+12),
- 0x33, PATCH_GETORIGINALBYTEADJUST +13, (uint16)-6, // adjust jump to also include setSize call
+ 0x33, PATCH_GETORIGINALBYTEADJUST(+13, -6), // adjust jump to also include setSize call
PATCH_END
};
@@ -2267,7 +2267,7 @@ void ScriptPatcher::applyPatch(const SciScriptPatcherEntry *patchEntry, byte *sc
offset += patchValue;
break;
}
- case PATCH_GETORIGINALBYTE: {
+ case PATCH_CODE_GETORIGINALBYTE: {
// get original byte from script
if (patchValue >= orgDataSize)
error("Script-Patcher: can not get requested original byte from script");
@@ -2275,7 +2275,7 @@ void ScriptPatcher::applyPatch(const SciScriptPatcherEntry *patchEntry, byte *sc
offset++;
break;
}
- case PATCH_GETORIGINALBYTEADJUST: {
+ case PATCH_CODE_GETORIGINALBYTEADJUST: {
// get original byte from script and adjust it
if (patchValue >= orgDataSize)
error("Script-Patcher: can not get requested original byte from script");
diff --git a/engines/sci/engine/script_patches.h b/engines/sci/engine/script_patches.h
index 563d00a26b..9e572f33fa 100644
--- a/engines/sci/engine/script_patches.h
+++ b/engines/sci/engine/script_patches.h
@@ -44,21 +44,23 @@ namespace Sci {
#define SIG_UINT16(_value_) SIG_CODE_UINT16 | (_value_ & 0xFF), (_value_ >> 8)
#define SIG_CODE_BYTE 0x0000
-#define PATCH_END SIG_END
-#define PATCH_COMMANDMASK SIG_COMMANDMASK
-#define PATCH_VALUEMASK SIG_VALUEMASK
-#define PATCH_BYTEMASK SIG_BYTEMASK
-#define PATCH_CODE_ADDTOOFFSET SIG_CODE_ADDTOOFFSET
-#define PATCH_ADDTOOFFSET(_offset_) SIG_CODE_ADDTOOFFSET | _offset_
-#define PATCH_GETORIGINALBYTE 0xD000
-#define PATCH_GETORIGINALBYTEADJUST 0xC000
-#define PATCH_CODE_SELECTOR16 SIG_CODE_SELECTOR16
-#define PATCH_SELECTOR16(_selectorID_) SIG_CODE_SELECTOR16 | SELECTOR_##_selectorID_
-#define PATCH_CODE_SELECTOR8 SIG_CODE_SELECTOR8
-#define PATCH_SELECTOR8(_selectorID_) SIG_CODE_SELECTOR8 | SELECTOR_##_selectorID_
-#define PATCH_CODE_UINT16 SIG_CODE_UINT16
-#define PATCH_UINT16(_value_) SIG_CODE_UINT16 | (_value_ & 0xFF), (_value_ >> 8)
-#define PATCH_CODE_BYTE SIG_CODE_BYTE
+#define PATCH_END SIG_END
+#define PATCH_COMMANDMASK SIG_COMMANDMASK
+#define PATCH_VALUEMASK SIG_VALUEMASK
+#define PATCH_BYTEMASK SIG_BYTEMASK
+#define PATCH_CODE_ADDTOOFFSET SIG_CODE_ADDTOOFFSET
+#define PATCH_ADDTOOFFSET(_offset_) SIG_CODE_ADDTOOFFSET | _offset_
+#define PATCH_CODE_GETORIGINALBYTE 0xD000
+#define PATCH_GETORIGINALBYTE(_offset_) PATCH_CODE_GETORIGINALBYTE | _offset_
+#define PATCH_CODE_GETORIGINALBYTEADJUST 0xC000
+#define PATCH_GETORIGINALBYTEADJUST(_offset_, _adjustValue_) PATCH_CODE_GETORIGINALBYTEADJUST | _offset_, (uint16)(_adjustValue_)
+#define PATCH_CODE_SELECTOR16 SIG_CODE_SELECTOR16
+#define PATCH_SELECTOR16(_selectorID_) SIG_CODE_SELECTOR16 | SELECTOR_##_selectorID_
+#define PATCH_CODE_SELECTOR8 SIG_CODE_SELECTOR8
+#define PATCH_SELECTOR8(_selectorID_) SIG_CODE_SELECTOR8 | SELECTOR_##_selectorID_
+#define PATCH_CODE_UINT16 SIG_CODE_UINT16
+#define PATCH_UINT16(_value_) SIG_CODE_UINT16 | (_value_ & 0xFF), (_value_ >> 8)
+#define PATCH_CODE_BYTE SIG_CODE_BYTE
// defines maximum scratch area for getting original bytes from unpatched script data
#define PATCH_VALUELIMIT 4096