diff options
author | Paul Gilbert | 2016-03-20 14:55:41 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-03-20 14:55:41 -0400 |
commit | 3c852cc240221785598023de56e5a71a0d8806fa (patch) | |
tree | c2a64b811586e4e9d8a4d5baa04d5c4f9d23bd08 /engines/sci/engine/script_patches.h | |
parent | ea54e6244e75c609e6886ba210f80fb22c479d3f (diff) | |
parent | 509a00109e79156e91c062f145ac3aa86ec8584e (diff) | |
download | scummvm-rg350-3c852cc240221785598023de56e5a71a0d8806fa.tar.gz scummvm-rg350-3c852cc240221785598023de56e5a71a0d8806fa.tar.bz2 scummvm-rg350-3c852cc240221785598023de56e5a71a0d8806fa.zip |
Merge branch 'master' into titanic
Diffstat (limited to 'engines/sci/engine/script_patches.h')
-rw-r--r-- | engines/sci/engine/script_patches.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/engines/sci/engine/script_patches.h b/engines/sci/engine/script_patches.h index d15fce321b..645e0946b3 100644 --- a/engines/sci/engine/script_patches.h +++ b/engines/sci/engine/script_patches.h @@ -90,13 +90,32 @@ public: ScriptPatcher(); ~ScriptPatcher(); + // Calculates the magic DWord for fast search and verifies signature/patch data + // Returns the magic DWord in platform-specific byte-order. This is done on purpose for performance. + void calculateMagicDWordAndVerify(const char *signatureDescription, const uint16 *signatureData, bool magicDWordIncluded, uint32 &calculatedMagicDWord, int &calculatedMagicDWordOffset); + + // Called when a script is loaded to check for signature matches and apply patches in such cases void processScript(uint16 scriptNr, byte *scriptData, const uint32 scriptSize); + + // Verifies, if a given signature matches the given script data (pointed to by additional byte offset) bool verifySignature(uint32 byteOffset, const uint16 *signatureData, const char *signatureDescription, const byte *scriptData, const uint32 scriptSize); + // searches for a given signature inside script data + // returns -1 in case it was not found or an offset to the matching data + int32 findSignature(uint32 magicDWord, int magicOffset, const uint16 *signatureData, const char *patchDescription, const byte *scriptData, const uint32 scriptSize); + private: + // Initializes a patch table and creates run time information for it (for enabling/disabling), also calculates magic DWORD) void initSignature(const SciScriptPatcherEntry *patchTable); + + // Enables a patch inside the patch table (used for optional patches like CD+Text support for KQ6 & LB2) void enablePatch(const SciScriptPatcherEntry *patchTable, const char *searchDescription); - int32 findSignature(const SciScriptPatcherEntry *patchEntry, SciScriptPatcherRuntimeEntry *runtimeEntry, const byte *scriptData, const uint32 scriptSize); + + // Searches for a given signature entry inside script data + // returns -1 in case it was not found or an offset to the matching data + int32 findSignature(const SciScriptPatcherEntry *patchEntry, const SciScriptPatcherRuntimeEntry *runtimeEntry, const byte *scriptData, const uint32 scriptSize); + + // Applies a patch to a given script + offset (overwrites parts) void applyPatch(const SciScriptPatcherEntry *patchEntry, byte *scriptData, const uint32 scriptSize, int32 signatureOffset); Selector *_selectorIdTable; |