diff options
| -rw-r--r-- | scumm/resource.cpp | 14 | ||||
| -rw-r--r-- | scumm/scumm.h | 3 | ||||
| -rw-r--r-- | scumm/scummvm.cpp | 10 | ||||
| -rw-r--r-- | scumm/sound.cpp | 64 | 
4 files changed, 22 insertions, 69 deletions
| diff --git a/scumm/resource.cpp b/scumm/resource.cpp index 60930b7c13..c8211f06a7 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -1487,11 +1487,17 @@ int Scumm::readSoundResourceSmallHeader(int type, int idx) {  	//   8 bytes MTrk header  	//   7 bytes MIDI tempo sysex  	//     + some default instruments -	// TODO:  - make some real MIDI instrument definitions -	//        - proper handling of the short (non-music, SFX) AD resources format -	//        - check the LE/BE handling for platforms other than PC -	if (ad_offs != 0) { +	if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && wa_offs != 0) { +		if (_features & GF_OLD_BUNDLE) { +			_fileHandle.seek(wa_offs, SEEK_SET); +			_fileHandle.read(createResource(type, idx, wa_size), wa_size); +		} else { +			_fileHandle.seek(wa_offs - 6, SEEK_SET); +			_fileHandle.read(createResource(type, idx, wa_size + 6), wa_size + 6); +		} +		return 1; +	} else if (ad_offs != 0) {  		byte *ptr;  		if (_features & GF_OLD_BUNDLE) {  			ptr = (byte *) calloc(ad_size - 4, 1); diff --git a/scumm/scumm.h b/scumm/scumm.h index a8ee2cfebe..54c9dd1d82 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -1002,6 +1002,8 @@ protected:  public:  	byte _proc_special_palette[256];  	byte *_shadowPalette; +	int _midiDriver; // Use the MD_ values from mididrv.h +  protected:  	int _shadowPaletteSize;  	byte _currentPalette[3 * 256]; @@ -1011,7 +1013,6 @@ protected:  	byte _haveMsg;  	bool _useTalkAnims;  	uint16 _defaultTalkDelay; -	int _midiDriver; // Use the MD_ values from mididrv.h  	int tempMusic;  	int _saveSound;  public: diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 29cfe19125..397a9f8cf6 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -612,6 +612,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)  	_mixer->setVolume(kDefaultSFXVolume * kDefaultMasterVolume / 255);  	_mixer->setMusicVolume(kDefaultMusicVolume); +	warning("_midiDriver is %d", _midiDriver);  	// Init iMuse  	_imuse = NULL;  	_imuseDigital = NULL; @@ -620,11 +621,14 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)  		_imuseDigital = new IMuseDigital(this);  	} else if ((_features & GF_AMIGA) && (_features & GF_OLD_BUNDLE)) {  		_playerV2 = NULL; -	} else if (_version <= 2) { -		if ((_version == 1) && (_gameId == GID_MANIAC)) +	} else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK) && (_version < 5)) || (_version <= 2)) { +		if ((_version == 1) && (_gameId == GID_MANIAC)) {  			_playerV2 = NULL; -		else +		} else {  			_playerV2 = new Player_V2(this); +			if (_midiDriver == MD_PCJR) +				_playerV2->set_pcjr(false); +		}  	} else {  		_imuse = IMuse::create (syst, _mixer, detector->createMidi());  		if (_imuse) { diff --git a/scumm/sound.cpp b/scumm/sound.cpp index abcf1ffc97..7c5f9e922f 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -322,65 +322,6 @@ void Sound::playSound(int soundID) {  			return;  		} else if (_scumm->_features & GF_FMTOWNS) {  			size = READ_LE_UINT32(ptr); -#if 0 -			// FIXME - this is just some debug output for Zak256 -			if (size != 30) { -				char name[9]; -				memcpy(name, ptr+22, 8); -				name[8] = 0; -				printf("Going to play Zak256 sound '%s':\n", name); -				hexdump(ptr, 0x40); -			} -			/* -			There seems to be some pattern in the Zak256 sound data. Two typical -			examples are these: -			 -			d7 10 00 00 53 4f d1 10  |....SO..| -			00 00 00 00 04 00 ff 00  |........| -			64 00 00 00 01 00 64 6f  |d.....do| -			6f 72 6f 70 65 6e 40 a8  |oropen@.| -			57 14 a1 10 00 00 50 08  |W.....P.| -			00 00 00 00 00 00 b3 07  |........| -			00 00 3c 00 00 00 04 80  |..<.....| -			03 02 0a 01 8c 82 87 81  |........| -	 -			5b 07 00 00 53 4f 55 07  |[...SOU.| -			00 00 00 00 04 00 ff 00  |........| -			64 00 00 00 01 00 64 72  |d.....dr| -			77 6f 70 65 6e 00 53 a8  |wopen.S.| -			57 14 25 07 00 00 92 03  |W.%.....| -			00 00 00 00 00 00 88 03  |........| -			00 00 3c 00 00 00 82 82  |..<.....| -			83 84 86 88 89 8b 89 89  |........| -			 -			As you can see, there are quite some patterns, e.g. -			the "3c 00 00 00" - the sound data starts at offset 0x36 -			 -			Indy 3 uses a different format. The very first sound played -			in Indy 3 looks as follows: -			5a 25 00 00 53 4f 54 25  |Z%..SOT%| -			00 00 53 4f db 0a 00 00  |..SO....| -			57 41 c8 00 18 00 00 00  |WA......| -			00 00 00 00 9e 05 00 00  |........| -			00 00 00 00 fd 32 00 f8  |.....2..| -			02 f9 08 ff 22 08 00 ff  |...."...| -			20 5c 00 ff 10 03 00 fd  | \......| -			64 00 f8 00 f9 00 ff 22  |d......"| - -			Indy 3, opening a door: -			d1 00 00 00 53 4f cb 00  |....SO..| -			00 00 53 4f a2 00 00 00  |..SO....| -			57 41 64 00 18 00 00 00  |WAd.....| -			00 00 00 00 00 00 00 00  |........| -			00 00 7e 00 f9 0c ff 20  |..~.... | -			90 01 ff 22 c2 01 ff 0a  |..."....| -			03 00 ff 04 57 06 ff 00  |....W...| -			04 00 ff 0a 00 00 ff 00  |........| -			 -			So there seems to be a "SO" chunk which contains again a SO chunk and a WA chunk. -			WA probably again contains audio data? -			*/ -#endif  			rate = 11025;  			int type = *(ptr + 0x0D); @@ -512,7 +453,7 @@ void Sound::playSound(int soundID) {  		return;  	} -	if (_scumm->_version <= 2) { +	if (((_scumm->_midiDriver == MD_PCJR) || (_scumm->_midiDriver == MD_PCSPK) && (_scumm->_version < 5)) || (_scumm->_version <= 2)) {  		//TODO: support maniac v1 sounds  		if ((_scumm->_version == 1) && (_scumm->_gameId == GID_MANIAC))   			return; @@ -523,8 +464,9 @@ void Sound::playSound(int soundID) {  		if (amigatest) {  			// TODO: support amiga sounds  		} else { -			if (_scumm->_playerV2) +			if (_scumm->_playerV2) {  				_scumm->_playerV2->startSound (soundID, ptr); +			}  		}  		return;  	} | 
