Ticket #8851: bs1-mac-en-v2.patch
File bs1-mac-en-v2.patch, 3.4 KB (added by , 16 years ago) |
---|
-
engines/sword1/sword1.cpp
139 139 140 140 _systemVars.playSpeech = 1; 141 141 _mouseState = 0; 142 143 // Some Mac versions use big endian for the speech files but not all of them. 144 // The speech files have always the clu extension (and not the clm for big endian) 145 // and the only way I have found to try to guess if we should use big endian is by 146 // testing the language. 147 // Mac BS1 english full version: big endian. 148 // PC BS1 (all language) & Mac BS1 french : little endian. 149 // Mac BS1 all other language: not known. Currently set on little endian. 150 // Mac BS1 demo: not known, set to the same than the full version (i.e. english uses big endian). 151 if (SwordEngine::isMac() && _systemVars.language == BS1_ENGLISH) 152 _sound->setIsBigEndianSpeech(true); 142 153 143 154 _logic->initialize(); 144 155 _objectMan->initialize(); -
engines/sword1/sound.h
94 94 int addToQueue(int32 fxNo); 95 95 96 96 void engine(void); 97 98 void setIsBigEndianSpeech(bool); 97 99 98 100 private: 99 101 uint8 _sfxVolL, _sfxVolR, _speechVolL, _speechVolR; … … 116 118 uint8 _endOfQueue; 117 119 Audio::Mixer *_mixer; 118 120 ResMan *_resMan; 121 bool _bigEndianSpeech; 119 122 char _filePath[100]; 120 123 static const char _musicList[270]; 121 124 static const uint16 _roomsFixedFx[TOTAL_ROOMS][TOTAL_FX_PER_ROOM]; -
engines/sword1/sound.cpp
51 51 strcpy(_filePath, searchPath); 52 52 _mixer = mixer; 53 53 _resMan = pResMan; 54 _bigEndianSpeech = false; 54 55 _cowHeader = NULL; 55 56 _endOfQueue = 0; 56 57 _currentCowFile = 0; … … 67 68 closeCowSystem(); 68 69 } 69 70 71 void Sound::setIsBigEndianSpeech(bool isBE) { 72 _bigEndianSpeech = isBE; 73 } 74 70 75 int Sound::addToQueue(int32 fxNo) { 71 76 bool alreadyInQueue = false; 72 77 for (uint8 cnt = 0; (cnt < _endOfQueue) && (!alreadyInQueue); cnt++) … … 384 389 int16 *dstData = (int16*)malloc(resSize * 2); 385 390 int32 samplesLeft = resSize; 386 391 while (srcPos < cSize && samplesLeft > 0) { 387 length = (int16) READ_LE_UINT16(srcData + srcPos);392 length = (int16)(_bigEndianSpeech ? READ_BE_UINT16(srcData + srcPos) : READ_LE_UINT16(srcData + srcPos)); 388 393 srcPos++; 389 394 if (length < 0) { 390 395 length = -length; 391 396 if (length > samplesLeft) 392 397 length = samplesLeft; 398 399 int16 value; 400 if (_bigEndianSpeech) { 401 value = (int16)SWAP_BYTES_16(*((uint16*)(srcData + srcPos))); 402 } else { 403 value = srcData[srcPos]; 404 } 405 393 406 for (uint16 cnt = 0; cnt < (uint16)length; cnt++) 394 dstData[dstPos++] = srcData[srcPos]; 407 dstData[dstPos++] = value; 408 395 409 srcPos++; 396 410 } else { 397 411 if (length > samplesLeft) 398 412 length = samplesLeft; 399 memcpy(dstData + dstPos, srcData + srcPos, length * 2); 400 dstPos += length; 401 srcPos += length; 413 414 if (_bigEndianSpeech) { 415 for (uint16 cnt = 0; cnt < (uint16)length; cnt++) 416 dstData[dstPos++] = (int16)SWAP_BYTES_16(*((uint16*)(srcData + (srcPos++)))); 417 } else { 418 memcpy(dstData + dstPos, srcData + srcPos, length * 2); 419 dstPos += length; 420 srcPos += length; 421 } 402 422 } 403 423 samplesLeft -= length; 404 424 }