diff options
author | Robert Göffringmann | 2003-05-28 23:31:43 +0000 |
---|---|---|
committer | Robert Göffringmann | 2003-05-28 23:31:43 +0000 |
commit | 2186ad138b1c6842c1ae2bf25cc55d75002cdb72 (patch) | |
tree | adf574f5a4e1a8648a04881a2b6c2f3abec288b1 | |
parent | b4ee5004d71de2c8ee381d623b860fbff9383c27 (diff) | |
download | scummvm-rg350-2186ad138b1c6842c1ae2bf25cc55d75002cdb72.tar.gz scummvm-rg350-2186ad138b1c6842c1ae2bf25cc55d75002cdb72.tar.bz2 scummvm-rg350-2186ad138b1c6842c1ae2bf25cc55d75002cdb72.zip |
moved music drivers into seperated directory, added music support for diskdemo's adlib driver version.
(maybe other sky versions also have this older adlib driver?)
svn-id: r8069
-rw-r--r-- | sky/logic.h | 2 | ||||
-rw-r--r-- | sky/module.mk | 8 | ||||
-rw-r--r-- | sky/music/adlibchannel.cpp (renamed from sky/adlibchannel.cpp) | 24 | ||||
-rw-r--r-- | sky/music/adlibchannel.h (renamed from sky/adlibchannel.h) | 5 | ||||
-rw-r--r-- | sky/music/adlibmusic.cpp (renamed from sky/adlibmusic.cpp) | 19 | ||||
-rw-r--r-- | sky/music/adlibmusic.h (renamed from sky/adlibmusic.h) | 2 | ||||
-rw-r--r-- | sky/music/gmchannel.cpp (renamed from sky/gmchannel.cpp) | 0 | ||||
-rw-r--r-- | sky/music/gmchannel.h (renamed from sky/gmchannel.h) | 2 | ||||
-rw-r--r-- | sky/music/gmmusic.cpp (renamed from sky/gmmusic.cpp) | 4 | ||||
-rw-r--r-- | sky/music/gmmusic.h (renamed from sky/gmmusic.h) | 2 | ||||
-rw-r--r-- | sky/music/mt32music.cpp (renamed from sky/mt32music.cpp) | 4 | ||||
-rw-r--r-- | sky/music/mt32music.h (renamed from sky/mt32music.h) | 2 | ||||
-rw-r--r-- | sky/music/musicbase.cpp (renamed from sky/musicbase.cpp) | 3 | ||||
-rw-r--r-- | sky/music/musicbase.h (renamed from sky/musicbase.h) | 6 | ||||
-rw-r--r-- | sky/sky.cpp | 7 | ||||
-rw-r--r-- | sky/sky.h | 8 |
16 files changed, 61 insertions, 37 deletions
diff --git a/sky/logic.h b/sky/logic.h index e3fc3a6559..c0de38874a 100644 --- a/sky/logic.h +++ b/sky/logic.h @@ -26,7 +26,7 @@ #include "sky/disk.h" #include "sky/grid.h" #include "sky/autoroute.h" -#include "sky/musicbase.h" +#include "sky/music/musicbase.h" #include "sky/mouse.h" #include "sky/screen.h" diff --git a/sky/module.mk b/sky/module.mk index 9a915cc72b..50a05e1e0b 100644 --- a/sky/module.mk +++ b/sky/module.mk @@ -1,15 +1,11 @@ MODULE := sky MODULE_OBJS = \ - sky/adlibchannel.o \ - sky/adlibmusic.o \ sky/autoroute.o \ sky/cd_intro.o \ sky/compact.o \ sky/debug.o \ sky/disk.o \ - sky/gmchannel.o \ - sky/gmmusic.o \ sky/grid.o \ sky/intro.o \ sky/logic.o \ @@ -20,6 +16,10 @@ MODULE_OBJS = \ sky/sky.o \ sky/sound.o \ sky/text.o \ + sky/music/adlibchannel.o \ + sky/music/adlibmusic.o \ + sky/music/gmchannel.o \ + sky/music/gmmusic.o \ # Include common rules include common.rules diff --git a/sky/adlibchannel.cpp b/sky/music/adlibchannel.cpp index c277a66de5..26ad970814 100644 --- a/sky/adlibchannel.cpp +++ b/sky/music/adlibchannel.cpp @@ -22,8 +22,9 @@ #include "adlibchannel.h" #include "sound/fmopl.h" -SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData) +SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData, uint32 version) { + _gameVersion = version; _musicData = pMusicData; _channelData.startOfData = startOfData; _channelData.eventDataPtr = startOfData; @@ -39,14 +40,25 @@ SkyAdlibChannel::SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData) _channelData.frequency = 0; _channelData.instrumentData = NULL; - uint16 instrumentDataLoc = (_musicData[0x1206] << 8) | _musicData[0x1205]; + uint16 instrumentDataLoc; + + if (_gameVersion == 267) { + instrumentDataLoc = (_musicData[0x11FC] << 8) | _musicData[0x11FB]; + _frequenceTable = (uint16*)(_musicData+0x7F4); + _registerTable = _musicData+0xDF4; + _opOutputTable = _musicData+0xE06; + _adlibRegMirror = _musicData+0xF55; + } else { + instrumentDataLoc = (_musicData[0x1206] << 8) | _musicData[0x1205]; + _frequenceTable = (uint16*)(_musicData+0x7FE); + _registerTable = _musicData+0xDFE; + _opOutputTable = _musicData+0xE10; + _adlibRegMirror = _musicData+0xF5F; + } + _instrumentMap = _musicData+instrumentDataLoc; _instruments = (InstrumentStruct*)(_instrumentMap+0x80); - _frequenceTable = (uint16*)(_musicData+0x7FE); - _registerTable = _musicData+0xDFE; - _opOutputTable = _musicData+0xE10; - _adlibRegMirror = _musicData+0xF5F; _musicVolume = 0x100; } diff --git a/sky/adlibchannel.h b/sky/music/adlibchannel.h index de41ac53df..a9b43c3f9b 100644 --- a/sky/adlibchannel.h +++ b/sky/music/adlibchannel.h @@ -24,7 +24,7 @@ #include "stdafx.h" #include "common/engine.h" -#include "sky/musicbase.h" +#include "sky/music/musicbase.h" typedef struct { uint8 ad_Op1, ad_Op2; @@ -59,11 +59,12 @@ typedef struct { class SkyAdlibChannel : public SkyChannelBase { public: - SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData); + SkyAdlibChannel(uint8 *pMusicData, uint16 startOfData, uint32 version); virtual void stopNote(void); virtual uint8 process(uint16 aktTime); virtual void updateVolume(uint16 pVolume); private: + uint32 _gameVersion; uint8 *_musicData; uint16 _musicVolume; AdlibChannelType _channelData; diff --git a/sky/adlibmusic.cpp b/sky/music/adlibmusic.cpp index 295f7e97bd..b23afd879c 100644 --- a/sky/adlibmusic.cpp +++ b/sky/music/adlibmusic.cpp @@ -19,7 +19,7 @@ * */ -#include "sky/adlibmusic.h" +#include "sky/music/adlibmusic.h" #include "sound/fmopl.h" void SkyAdlibMusic::passMixerFunc(void *param, int16 *buf, uint len) { @@ -27,8 +27,8 @@ void SkyAdlibMusic::passMixerFunc(void *param, int16 *buf, uint len) { ((SkyAdlibMusic*)param)->premixerCall(buf, len); } -SkyAdlibMusic::SkyAdlibMusic(SoundMixer *pMixer, SkyDisk *pSkyDisk) - : SkyMusicBase(pSkyDisk) { +SkyAdlibMusic::SkyAdlibMusic(SoundMixer *pMixer, SkyDisk *pSkyDisk, uint32 version) + : SkyMusicBase(pSkyDisk, version) { _driverFileBase = 60202; _mixer = pMixer; @@ -74,8 +74,15 @@ void SkyAdlibMusic::premixerCall(int16 *buf, uint len) { void SkyAdlibMusic::setupPointers(void) { - _musicDataLoc = (_musicData[0x1202]<<8)|_musicData[0x1201]; - _initSequence = _musicData+0xE91; + printf("game version: %d\n",_gameVersion); + if (_gameVersion == 267) { + // disk demo uses a different adlib driver version, some offsets have changed + _musicDataLoc = (_musicData[0x11F8] << 8) | _musicData[0x11F7]; + _initSequence = _musicData + 0xE87; + } else { + _musicDataLoc = (_musicData[0x1202] << 8) | _musicData[0x1201]; + _initSequence = _musicData + 0xE91; + } _nextMusicPoll = 0; } @@ -85,7 +92,7 @@ void SkyAdlibMusic::setupChannels(uint8 *channelData) { channelData++; for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) { uint16 chDataStart = ((channelData[(cnt << 1) | 1] << 8) | channelData[cnt << 1]) + _musicDataLoc; - _channels[cnt] = new SkyAdlibChannel(_musicData, chDataStart); + _channels[cnt] = new SkyAdlibChannel(_musicData, chDataStart, _gameVersion); } } diff --git a/sky/adlibmusic.h b/sky/music/adlibmusic.h index 31332b63b7..dcde24150c 100644 --- a/sky/adlibmusic.h +++ b/sky/music/adlibmusic.h @@ -30,7 +30,7 @@ class SkyAdlibMusic : public SkyMusicBase { public: - SkyAdlibMusic(SoundMixer *pMixer, SkyDisk *pSkyDisk); + SkyAdlibMusic(SoundMixer *pMixer, SkyDisk *pSkyDisk, uint32 version); ~SkyAdlibMusic(void); private: SoundMixer *_mixer; diff --git a/sky/gmchannel.cpp b/sky/music/gmchannel.cpp index 5db1256388..5db1256388 100644 --- a/sky/gmchannel.cpp +++ b/sky/music/gmchannel.cpp diff --git a/sky/gmchannel.h b/sky/music/gmchannel.h index eb5cb471b9..693eabf3d0 100644 --- a/sky/gmchannel.h +++ b/sky/music/gmchannel.h @@ -25,7 +25,7 @@ #include "stdafx.h" #include "sound/mididrv.h" #include "common/engine.h" -#include "sky/musicbase.h" +#include "sky/music/musicbase.h" typedef struct { uint16 eventDataPtr; diff --git a/sky/gmmusic.cpp b/sky/music/gmmusic.cpp index 98e79ca88d..3d2ddf947d 100644 --- a/sky/gmmusic.cpp +++ b/sky/music/gmmusic.cpp @@ -26,8 +26,8 @@ void SkyGmMusic::passTimerFunc(void *param) { ((SkyGmMusic*)param)->timerCall(); } -SkyGmMusic::SkyGmMusic(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk) - : SkyMusicBase(pSkyDisk) { +SkyGmMusic::SkyGmMusic(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk, uint32 version) + : SkyMusicBase(pSkyDisk, version) { _driverFileBase = 60200; _midiDrv = pMidiDrv; diff --git a/sky/gmmusic.h b/sky/music/gmmusic.h index b3dca05b39..be26bf26fd 100644 --- a/sky/gmmusic.h +++ b/sky/music/gmmusic.h @@ -30,7 +30,7 @@ class SkyGmMusic : public SkyMusicBase { public: - SkyGmMusic(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk); + SkyGmMusic(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk, uint32 version); ~SkyGmMusic(void); private: static void passTimerFunc(void *param); diff --git a/sky/mt32music.cpp b/sky/music/mt32music.cpp index cb99c59f42..53765f9941 100644 --- a/sky/mt32music.cpp +++ b/sky/music/mt32music.cpp @@ -26,8 +26,8 @@ void SkyMT32Music::passTimerFunc(void *param) { ((SkyMT32Music*)param)->timerCall(); } -SkyMT32Music::SkyMT32Music(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk) - : SkyMusicBase(pSkyDisk) { +SkyMT32Music::SkyMT32Music(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk, uint32 version) + : SkyMusicBase(pSkyDisk, version) { _driverFileBase = 60200; _midiDrv = pMidiDrv; diff --git a/sky/mt32music.h b/sky/music/mt32music.h index 76b2a18fc5..9b396b649d 100644 --- a/sky/mt32music.h +++ b/sky/music/mt32music.h @@ -30,7 +30,7 @@ class SkyMT32Music : public SkyMusicBase { public: - SkyMT32Music(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk); + SkyMT32Music(MidiDriver *pMidiDrv, SkyDisk *pSkyDisk, uint32 version); ~SkyMT32Music(void); private: static void passTimerFunc(void *param); diff --git a/sky/musicbase.cpp b/sky/music/musicbase.cpp index cc1670f996..7d930dae18 100644 --- a/sky/musicbase.cpp +++ b/sky/music/musicbase.cpp @@ -21,8 +21,9 @@ #include "musicbase.h" -SkyMusicBase::SkyMusicBase(SkyDisk *pSkyDisk) { +SkyMusicBase::SkyMusicBase(SkyDisk *pSkyDisk, uint32 version) { + _gameVersion = version; _musicData = NULL; _allowedCommands = 0; _skyDisk = pSkyDisk; diff --git a/sky/musicbase.h b/sky/music/musicbase.h index 587d9d8a8d..306cfaa0db 100644 --- a/sky/musicbase.h +++ b/sky/music/musicbase.h @@ -24,7 +24,7 @@ #include "stdafx.h" #include "common/engine.h" -#include "disk.h" +#include "sky/disk.h" #define FILES_PER_SECTION 4 @@ -43,13 +43,15 @@ private: class SkyMusicBase { public: - SkyMusicBase(SkyDisk *pSkyDisk); + SkyMusicBase(SkyDisk *pSkyDisk, uint32 version); virtual ~SkyMusicBase(void); void loadSection(uint8 pSection); void musicCommand(uint16 command); void startMusic(uint16 param) { _onNextPoll.musicToProcess = param & 0xF; }; // 4 protected: + uint32 _gameVersion; + SkyDisk *_skyDisk; uint8 *_musicData; uint8 _allowedCommands; diff --git a/sky/sky.cpp b/sky/sky.cpp index 3478a5e0d4..dee0b10303 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -158,13 +158,14 @@ void SkyState::initialise(void) { _skyDisk = new SkyDisk(_gameDataPath); _skySound = new SkySound(_mixer, _skyDisk); + _gameVersion = _skyDisk->determineGameVersion(); + if (_detector->getMidiDriverType() == MD_ADLIB) { - _skyMusic = new SkyAdlibMusic(_mixer, _skyDisk); + _skyMusic = new SkyAdlibMusic(_mixer, _skyDisk, _gameVersion); } else { - _skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk); + _skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk, _gameVersion); } - _gameVersion = _skyDisk->determineGameVersion(); _skyText = new SkyText(_skyDisk, _gameVersion, _language); _skyMouse = new SkyMouse(_skyDisk); _skyScreen = new SkyScreen(_system, _skyDisk); @@ -33,10 +33,10 @@ #include "sky/struc.h" #include "sky/grid.h" #include "sky/screen.h" -#include "sky/musicbase.h" -#include "sky/adlibmusic.h" -#include "sky/gmmusic.h" -#include "sky/mt32music.h" +#include "sky/music/musicbase.h" +#include "sky/music/adlibmusic.h" +#include "sky/music/gmmusic.h" +#include "sky/music/mt32music.h" #include "sky/mouse.h" class SkyLogic; |