diff options
Diffstat (limited to 'scumm')
| -rw-r--r-- | scumm/resource.cpp | 4 | ||||
| -rw-r--r-- | scumm/script_v5.cpp | 2 | ||||
| -rw-r--r-- | scumm/scumm.h | 21 | ||||
| -rw-r--r-- | scumm/sound.cpp | 5 | 
4 files changed, 27 insertions, 5 deletions
| diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 9fe9eacc81..4dbd1ff6af 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -222,7 +222,8 @@ bool ScummEngine::openResourceFile(const char *filename, byte encByte) {  		_fileHandle.close();  	} -	_fileHandle.open(filename, getGameDataPath(), File::kFileReadMode, encByte); +	_fileHandle.open(filename); +	_fileHandle.setEnc(encByte);  	return _fileHandle.isOpen();  } @@ -888,6 +889,7 @@ static const uint16 num_steps_table[] = {  	240, 276, 340, 460,  	600, 860, 1200, 1600  }; +  int ScummEngine::convert_extraflags(byte * ptr, byte * src_ptr) {  	int flags = src_ptr[0]; diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp index 3d50febab3..4f0e9bcd8e 100644 --- a/scumm/script_v5.cpp +++ b/scumm/script_v5.cpp @@ -2684,7 +2684,7 @@ void ScummEngine_v5::decodeParseString() {  			break;  		case 15:	// SO_TEXTSTRING  			msg = _scriptPointer; -			_scriptPointer += resStrLen(_scriptPointer)+ 1; +			_scriptPointer += resStrLen(_scriptPointer) + 1;  			switch (textSlot) {  			case 0: diff --git a/scumm/scumm.h b/scumm/scumm.h index e7971cb586..62570d1d74 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -60,6 +60,25 @@ struct ScummGameSettings;  typedef Common::Map<Common::String, int> ObjectIDMap; +class XORFile : public File { +private: +	byte _encbyte; +public: +	XORFile() : _encbyte(0) {} +	void setEnc(byte value) { _encbyte = value; } + +	uint32 read(void *ptr, uint32 len) { +		uint32 realLen = File::read(ptr, len); +		if (_encbyte) { +			byte *p = (byte *)ptr; +			byte *end = p + realLen; +			while (p < end) +				*p++ ^= _encbyte; +		} +		return realLen; +	} +}; +  // Use g_scumm from error() ONLY  extern ScummEngine *g_scumm; @@ -599,7 +618,7 @@ protected:  	void doSentence(int c, int b, int a);  	/* Should be in Resource class */ -	File _fileHandle; +	XORFile _fileHandle;  	uint32 _fileOffset;  	int _resourceHeaderSize;  	Common::String _gameName;	// This is the name we use for opening resource files diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 8d40f16c64..a668c8c82a 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -892,7 +892,7 @@ void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle,  File *Sound::openSfxFile() {  	char buf[256]; -	File *file = new File(); +	XORFile *file = new XORFile();  	_offsetTable = NULL;  	struct SoundFileExtensions { @@ -935,7 +935,8 @@ File *Sound::openSfxFile() {  	if (!file->isOpen()) {  		sprintf(buf, "%s.tlk", _vm->getGameName()); -		file->open(buf, _vm->getGameDataPath(), File::kFileReadMode, 0x69); +		file->open(buf); +		file->setEnc(0x69);  		_soundMode = kVOCMode;  	} else if (_soundMode != kVOCMode) {  		/* Now load the 'offset' index in memory to be able to find the MP3 data | 
