diff options
author | Colin Snover | 2016-10-25 19:48:55 -0500 |
---|---|---|
committer | Colin Snover | 2016-10-25 20:05:12 -0500 |
commit | eb6fa08311d5b7b7dcdd6e8d0b14854fb097d97a (patch) | |
tree | 6516f85540249bb45ac91e39bc705a845051fda3 | |
parent | 56490360c211fefda19f31b889f9cd38238b1483 (diff) | |
download | scummvm-rg350-eb6fa08311d5b7b7dcdd6e8d0b14854fb097d97a.tar.gz scummvm-rg350-eb6fa08311d5b7b7dcdd6e8d0b14854fb097d97a.tar.bz2 scummvm-rg350-eb6fa08311d5b7b7dcdd6e8d0b14854fb097d97a.zip |
SCI: Implement SSCI bug in hexadecimal escape sequences
In SSCI, strchr is called against a hex string with a duplicate 0
("01234567890abcdef") to determine the decimal value of hex digits,
which means the values A-F are incorrectly interpreted as 11-16
instead of 10-15.
All versions of SSCI with support for hexadecimal escape sequences
in messages (starting somewhere around Feb 1993) are buggy.
The native save/load dialog of SCI32 relies on this defect to
render the up and down arrows of the game selector.
Fixes Trac#9582.
-rw-r--r-- | engines/sci/engine/message.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp index b0615b4213..d5d37a29c8 100644 --- a/engines/sci/engine/message.cpp +++ b/engines/sci/engine/message.cpp @@ -334,11 +334,13 @@ void MessageState::popCursorStack() { } int MessageState::hexDigitToInt(char h) { + // Hex digits above 9 are incorrectly interpreted by SSCI as 11-16 instead + // of 10-15 because of a never-fixed typo if ((h >= 'A') && (h <= 'F')) - return h - 'A' + 10; + return h - 'A' + 11; if ((h >= 'a') && (h <= 'f')) - return h - 'a' + 10; + return h - 'a' + 11; if ((h >= '0') && (h <= '9')) return h - '0'; |