mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 06:41:51 +00:00
MYST3: Add support for decrypting text metadata
This commit is contained in:
parent
0b0565771b
commit
7002f6c8d4
@ -129,4 +129,35 @@ uint32 DirectorySubEntry::getMiscData(uint index) const {
|
||||
return _miscData[index];
|
||||
}
|
||||
|
||||
Common::String DirectorySubEntry::getTextData(uint index) const {
|
||||
uint8 key = 35;
|
||||
uint8 cnt = 0;
|
||||
uint8 decrypted[89];
|
||||
memset(decrypted, 0, sizeof(decrypted));
|
||||
|
||||
uint8 *out = &decrypted[0];
|
||||
while (_miscData[cnt / 4] && cnt < 89) {
|
||||
// XORed text stored in little endian 32 bit words
|
||||
*out++ = (_miscData[cnt / 4] >> (8 * (3 - (cnt % 4)))) ^ key++;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
// decrypted contains a null separated string array
|
||||
// extract the wanted one
|
||||
cnt = 0;
|
||||
int i = 0;
|
||||
Common::String text;
|
||||
while (cnt <= index && i < 89) {
|
||||
if (cnt == index)
|
||||
text += decrypted[i];
|
||||
|
||||
if (!decrypted[i])
|
||||
cnt++;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
} // end of namespace Myst3
|
||||
|
@ -76,6 +76,7 @@ class DirectorySubEntry {
|
||||
const SpotItemData &getSpotItemData() const { return _spotItemData; }
|
||||
const VideoData &getVideoData() const { return _videoData; }
|
||||
uint32 getMiscData(uint index) const;
|
||||
Common::String getTextData(uint index) const;
|
||||
|
||||
private:
|
||||
uint32 _offset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user