[Scummvm-cvs-logs] SF.net SVN: scummvm:[34067] scummvm/trunk

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Wed Aug 20 21:57:58 CEST 2008


Revision: 34067
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34067&view=rev
Author:   athrxx
Date:     2008-08-20 19:57:57 +0000 (Wed, 20 Aug 2008)

Log Message:
-----------
- add support for Italian floppy version
- more work on fm-towns music tempo

Modified Paths:
--------------
    scummvm/trunk/dists/engine-data/kyra.dat
    scummvm/trunk/engines/kyra/detection.cpp
    scummvm/trunk/engines/kyra/sound_towns.cpp
    scummvm/trunk/engines/kyra/staticres.cpp
    scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
    scummvm/trunk/tools/create_kyradat/hof_floppy.h

Modified: scummvm/trunk/engines/kyra/detection.cpp
===================================================================
--- scummvm/trunk/engines/kyra/detection.cpp	2008-08-20 17:52:36 UTC (rev 34066)
+++ scummvm/trunk/engines/kyra/detection.cpp	2008-08-20 19:57:57 UTC (rev 34067)
@@ -397,6 +397,18 @@
 		KYRA2_FLOPPY_FLAGS
 	},
 
+	{ // Floppy version extracted
+		{
+			"kyra2",
+			"Extracted",
+			AD_ENTRY1("FATE.PAK", "e0a70c31b022cb4bb3061890020fc27c"),
+			Common::IT_ITA,
+			Common::kPlatformPC,
+			Common::ADGF_NO_FLAGS
+		},
+		KYRA2_FLOPPY_FLAGS
+	},
+
 	{ // CD version
 		{
 			"kyra2",

Modified: scummvm/trunk/engines/kyra/sound_towns.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_towns.cpp	2008-08-20 17:52:36 UTC (rev 34066)
+++ scummvm/trunk/engines/kyra/sound_towns.cpp	2008-08-20 19:57:57 UTC (rev 34067)
@@ -1598,7 +1598,8 @@
 	void pause() { _musicPlaying = false; }
 	void cont() { _musicPlaying = true; }
 
-	void callback();
+	void musicCallback();
+	void sfxCallback();
 	void nextTick(int32 *buffer, uint32 bufferSize);
 
 	bool looping() { return _looping == _updateChannelsFlag ? true : false; }
@@ -1622,7 +1623,9 @@
 	TownsPC98_OpnPercussionSource *_pcm;
 
 	void startSoundEffect();
-	void setTempo(uint8 tempo);
+	
+	void setMusicTempo(uint8 tempo);
+	void setSfxTempo(uint16 tempo);
 
 	void lock() { _mutex.lock(); }
 	void unlock() { _mutex.unlock(); }
@@ -1651,15 +1654,15 @@
 	uint8 *_patches;
 	uint8 *_ssgPatches;
 
-	uint8 _cbCounter;
 	uint8 _updateChannelsFlag;
 	uint8 _updateSSGFlag;
 	uint8 _updatePCMFlag;
+	uint8 _updateSfxFlag;
 	uint8 _finishedChannelsFlag;
 	uint8 _finishedSSGFlag;
 	uint8 _finishedPCMFlag;
+	uint8 _finishedSfxFlag;
 
-	uint16 _tempo;
 	bool _musicPlaying;
 	bool _sfxPlaying;
 	uint8 _fading;
@@ -1673,10 +1676,10 @@
 	uint8 *_sfxData;
 	uint16 _sfxOffsets[2];
 
-	int32 _samplesTillCallback;
-	int32 _samplesTillCallbackRemainder;
-	int32 _samplesPerCallback;
-	int32 _samplesPerCallbackRemainder;
+	int32 _samplesTillMusicCallback;
+	int32 _samplesPerMusicCallback;
+	int32 _samplesTillSfxCallback;
+	int32 _samplesPerSfxCallback;
 
 	const int _numChan;
 	const int _numSSG;
@@ -2208,7 +2211,7 @@
 }
 
 bool TownsPC98_OpnChannel::control_f5_setTempo(uint8 para) {
-	_drv->setTempo(para);
+	_drv->setMusicTempo(para);
 	return true;
 }
 
@@ -2599,6 +2602,7 @@
 	} else {
 		// end of sfx track - restore ssg music channel
 		_flags |= CHS_EOT;
+		_drv->_finishedSfxFlag |= _idFlag;
 		_drv->_ssgChannels[_chanNum]->restore();
 	}
 
@@ -3038,14 +3042,15 @@
 	_ssgChannels(0), _sfxChannels(0), _pcmChannel(0),	_looping(0), _opnCarrier(_drvTables + 76),
 	_opnFreqTable(_drvTables + 84), _opnFreqTableSSG(_drvTables + 252),	_opnFxCmdLen(_drvTables + 36),
 	_opnLvlPresets(_drvTables + (type == OD_TOWNS ? 52 : 228)), _oprRates(0), _oprRateshift(0), _oprAttackDecay(0),
-	_oprFrq(0), _oprSinTbl(0), _oprLevelOut(0), _oprDetune(0), _cbCounter(4), _musicTickCounter(0),
+	_oprFrq(0), _oprSinTbl(0), _oprLevelOut(0), _oprDetune(0), _musicTickCounter(0), _updateSfxFlag(type == OD_TOWNS ? 0 : 6),
 	_updateChannelsFlag(type == OD_TYPE26 ? 0x07 : 0x3F), _updateSSGFlag(type == OD_TOWNS ? 0 : 7),
 	_updatePCMFlag(type == OD_TYPE86 ? 1 : 0), _finishedChannelsFlag(0), _finishedSSGFlag(0),
-	_finishedPCMFlag(0), _samplesTillCallback(0), _samplesTillCallbackRemainder(0),
+	_finishedPCMFlag(0), _samplesTillMusicCallback(0), _samplesTillSfxCallback (0), _finishedSfxFlag(0),
 	_sfxData(0), _ready(false), _numSSG(type == OD_TOWNS ? 0 : 3), _hasPCM(type == OD_TYPE86 ? true : false),
 	_sfxOffs(0), _numChan(type == OD_TYPE26 ? 3 : 6), _hasStereo(type == OD_TYPE26 ? false : true),
 	_ssgPatches(0), _ssg(0), _pcm(0), _baserate(55125.0f / (float)getRate()) {
-	setTempo(84);
+	setMusicTempo(84);
+	setSfxTempo(654);
 }
 
 TownsPC98_OpnDriver::~TownsPC98_OpnDriver() {
@@ -3171,21 +3176,23 @@
 	int32 samplesLeft = numSamples >> 1;
 
 	while (samplesLeft) {
-		if (!_samplesTillCallback) {
-			callback();
+		if (!_samplesTillMusicCallback) {
+			musicCallback();
+			_samplesTillMusicCallback = _samplesPerMusicCallback;
+		}
 
-			_samplesTillCallback = _samplesPerCallback;
-			_samplesTillCallbackRemainder += _samplesPerCallbackRemainder;
-			if (_samplesTillCallbackRemainder >= _tempo) {
-				_samplesTillCallback++;
-				_samplesTillCallbackRemainder -= _tempo;
-			}
+		if (!_samplesTillSfxCallback) {
+			sfxCallback();
+			_samplesTillSfxCallback = _samplesPerSfxCallback;
 		}
 
-		int32 render = MIN(samplesLeft, _samplesTillCallback);
+		int32 render = MIN(_samplesTillSfxCallback, _samplesTillMusicCallback);
+		render = MIN(samplesLeft, render);
 		samplesLeft -= render;
-		_samplesTillCallback -= render;
 
+		_samplesTillMusicCallback -= render;		
+		_samplesTillSfxCallback -= render;
+
 		nextTick(tmp, render);
 
 		if (_ssg)
@@ -3257,8 +3264,7 @@
 	_regProtectionFlag = false;
 
 	_patches = src_a + 4;
-	_cbCounter = 4;
-	_finishedChannelsFlag = _finishedSSGFlag = 0;
+	_finishedChannelsFlag = _finishedSSGFlag = _finishedPCMFlag = 0;
 
 	_musicPlaying = (loadPaused ? false : true);
 
@@ -3286,6 +3292,7 @@
 	_sfxOffsets[0] = READ_LE_UINT16(&_sfxData[(trackNum << 2)]);
 	_sfxOffsets[1] = READ_LE_UINT16(&_sfxData[(trackNum << 2) + 2]);
 	_sfxPlaying = true;
+	_finishedSfxFlag = 0;
 	unlock();
 }
 
@@ -3348,28 +3355,12 @@
 	unlock();
 }
 
-void TownsPC98_OpnDriver::callback() {
+void TownsPC98_OpnDriver::musicCallback() {
 	lock();
 
-	if (_sfxChannels && _sfxPlaying) {
-		if (_sfxData)
-			startSoundEffect();
-
-		_sfxOffs = 3;
-		_trackPtr = _sfxBuffer;
-
-		for (int i = 0; i < 2; i++) {
-			_sfxChannels[i]->processEvents();
-			_sfxChannels[i]->processFrequency();
-		}
-
-		_trackPtr = _musicBuffer;
-	}
-
 	_sfxOffs = 0;
 
-	if (!--_cbCounter && _musicPlaying) {
-		_cbCounter = 4;
+	if (_musicPlaying) {
 		_musicTickCounter++;
 
 		for (int i = 0; i < _numChan; i++) {
@@ -3401,6 +3392,30 @@
 	unlock();
 }
 
+void TownsPC98_OpnDriver::sfxCallback() {
+	lock();
+
+	if (_sfxChannels && _sfxPlaying) {
+		if (_sfxData)
+			startSoundEffect();
+
+		_sfxOffs = 3;
+		_trackPtr = _sfxBuffer;
+
+		for (int i = 0; i < 2; i++) {
+			_sfxChannels[i]->processEvents();
+			_sfxChannels[i]->processFrequency();
+		}
+
+		_trackPtr = _musicBuffer;
+	}
+
+	if (_finishedSfxFlag == _updateSfxFlag)
+		_sfxPlaying = false;
+
+	unlock();
+}
+
 void TownsPC98_OpnDriver::nextTick(int32 *buffer, uint32 bufferSize) {
 	if (!_ready)
 		return;
@@ -3501,13 +3516,14 @@
 	_sfxData = 0;
 }
 
-void TownsPC98_OpnDriver::setTempo(uint8 tempo) {
-	_tempo = tempo;
+void TownsPC98_OpnDriver::setMusicTempo(uint8 tempo) {
+	float spc = (float)(0x100 - tempo) * 10.0 * _baserate;
+	_samplesPerMusicCallback = (int32) spc;
+}
 
-	float spc = (float)(0x100 - _tempo) * 2.5 * _baserate;
-	_samplesPerCallback = (int32) spc;
-	spc -= _samplesPerCallback;
-	_samplesPerCallbackRemainder = (spc > 0.5) ? 1 : 0;
+void TownsPC98_OpnDriver::setSfxTempo(uint16 tempo) {
+	float spc = (float)(0x400 - tempo) * _baserate;
+	_samplesPerSfxCallback = (int32) spc;
 }
 
 SoundTowns::SoundTowns(KyraEngine_v1 *vm, Audio::Mixer *mixer)
@@ -3845,7 +3861,7 @@
 	//	This has been disabled for now since I don't know
 	//	how to make up the correct track number. It probably
 	//	needs a map.
-	// _driver->loadSoundEffectData(_sfxTrackData, track);
+	//_driver->loadSoundEffectData(_sfxTrackData, track);
 }
 
 

Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp	2008-08-20 17:52:36 UTC (rev 34066)
+++ scummvm/trunk/engines/kyra/staticres.cpp	2008-08-20 19:57:57 UTC (rev 34067)
@@ -43,7 +43,7 @@
 
 namespace Kyra {
 
-#define RESFILE_VERSION 31
+#define RESFILE_VERSION 32
 
 bool StaticResource::checkKyraDat() {
 	Common::File kyraDat;

Modified: scummvm/trunk/tools/create_kyradat/create_kyradat.cpp
===================================================================
--- scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2008-08-20 17:52:36 UTC (rev 34066)
+++ scummvm/trunk/tools/create_kyradat/create_kyradat.cpp	2008-08-20 19:57:57 UTC (rev 34067)
@@ -31,7 +31,7 @@
 #include "md5.h"
 
 enum {
-	kKyraDatVersion = 31,
+	kKyraDatVersion = 32,
 	kIndexSize = 12
 };
 

Modified: scummvm/trunk/tools/create_kyradat/hof_floppy.h
===================================================================
--- scummvm/trunk/tools/create_kyradat/hof_floppy.h	2008-08-20 17:52:36 UTC (rev 34066)
+++ scummvm/trunk/tools/create_kyradat/hof_floppy.h	2008-08-20 19:57:57 UTC (rev 34067)
@@ -28,6 +28,16 @@
 	{ -1, 0, 0 }
 };
 
+const ExtractEntry kyra2File1I[] = {
+	{ k2SeqplayPakFiles, 0x00021189, 0x000211B7 },
+	{ k2SeqplayStrings, 0x00022C62, 0x0002352A },
+	{ k2SeqplaySfxFiles, 0x0002352A, 0x0002369D },
+	{ k2SeqplayIntroTracks, 0x000236AA, 0x000236AA },
+	{ k2SeqplayFinaleTracks, 0x000236C7, 0x000236D9 },
+	{ k2SeqplaySeqData, 0x00022250, 0x00022944 },
+	{ -1, 0, 0 }
+};
+
 const ExtractEntry kyra2File2E[] = {
 	{ k2IngamePakFiles, 0x0035E4E, 0x00362ED },
 	{ k2IngameSfxFiles, 0x00034700, 0x00034DF1 },
@@ -58,12 +68,24 @@
 	{ -1, 0, 0 }
 };
 
+const ExtractEntry kyra2File2I[] = {
+	{ k2IngamePakFiles, 0x00036816, 0x00036CB5 },
+	{ k2IngameSfxFiles, 0x000350C6, 0x000357B7 },
+	{ k2IngameSfxIndex, 0x0002AB80, 0x0002AED8 },
+	{ k2IngameTracks, 0x0003BE78, 0x0003BEF6 },
+	{ k2IngameTalkObjIndex, 0x00034872, 0x000348EA },
+	{ k2IngameItemAnimData, 0x0003C4E2, 0x0003C82A },
+	{ -1, 0, 0 }
+};
+
 const Game kyra2FloppyGames[] = {
 	{ kKyra2, EN_ANY, k2FloppyFile1, "9b0f5e57b5a2ed88b5b989cbb402b6c7", kyra2File1E},
 	{ kKyra2, FR_FRA, k2FloppyFile1, "df31cc9e37e1cf68df2fdc75ddf2d87b", kyra2File1F},
 	{ kKyra2, DE_DEU, k2FloppyFile1, "0ca4f9a1438264a4c63c3218e064ed3b", kyra2File1G},
+	{ kKyra2, IT_ITA, k2FloppyFile1, "178d3ab913f61bfba21d2fb196405e8c", kyra2File1I},
 	{ kKyra2, EN_ANY, k2FloppyFile2, "7c3eadbe5122722cf2e5e1611e19dfb9", kyra2File2E},
 	{ kKyra2, FR_FRA, k2FloppyFile2, "fc2c6782778e6c6d5a553d1cb73c98ad", kyra2File2F},
 	{ kKyra2, DE_DEU, k2FloppyFile2, "0d9b0eb7b0ad889ec942d74d80dde1bf", kyra2File2G},
+	{ kKyra2, IT_ITA, k2FloppyFile2, "3a61ed6b7c00ddae383a0361799e2ba6", kyra2File2I},
 	GAME_DUMMY_ENTRY
 };


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list