TSAGE: Bugfix for correctly persisting patch data

This commit is contained in:
Paul Gilbert 2011-06-15 00:08:40 +10:00
parent f47b25810a
commit c18172565b
2 changed files with 9 additions and 6 deletions

View File

@ -1307,7 +1307,7 @@ void SoundManager::_sfUnInstallDriver(SoundDriver *driver) {
}
void SoundManager::_sfInstallPatchBank(SoundDriver *driver, const byte *bankData) {
driver->installPatch(bankData);
driver->installPatch(bankData, _vm->_memoryManager.getSize(bankData));
}
/**
@ -2391,6 +2391,7 @@ AdlibSoundDriver::AdlibSoundDriver(): SoundDriver() {
_v44082[ADLIB_CHANNEL_COUNT] = 0x90;
Common::set_to(_pitchBlend, _pitchBlend + ADLIB_CHANNEL_COUNT, 0x2000);
memset(_v4409E, 0, ADLIB_CHANNEL_COUNT * sizeof(int));
_patchData = NULL;
}
AdlibSoundDriver::~AdlibSoundDriver() {
@ -2433,8 +2434,10 @@ const GroupData *AdlibSoundDriver::getGroupData() {
return &_groupData;
}
void AdlibSoundDriver::installPatch(const byte *data) {
_patchData = data;
void AdlibSoundDriver::installPatch(const byte *data, int size) {
byte *patchData = ALLOCATE(size);
Common::copy(data, data + size, patchData);
_patchData = patchData;
}
int AdlibSoundDriver::setMasterVolume(int volume) {
@ -2612,7 +2615,7 @@ void AdlibSoundDriver::setFrequency(int channel) {
}
ch -= tempVal >> 2;
if (ch >= 128)
if (ch < 0)
ch = 0;
}

View File

@ -82,7 +82,7 @@ public:
virtual void close() {} // Method #1
virtual bool reset() { return true; } // Method #2
virtual const GroupData *getGroupData() { return NULL; } // Method #3
virtual void installPatch(const byte *data) {} // Method #4
virtual void installPatch(const byte *data, int size) {} // Method #4
virtual void poll() {} // Method #5
virtual void proc12() {} // Method #6
virtual int setMasterVolume(int volume) { return 0; } // Method #7
@ -421,7 +421,7 @@ public:
virtual void close();
virtual bool reset();
virtual const GroupData *getGroupData();
virtual void installPatch(const byte *data);
virtual void installPatch(const byte *data, int size);
virtual int setMasterVolume(int volume);
virtual void proc32(int channel, int program, int v0, int v1);
virtual void updateVoice(int channel);