[Scummvm-cvs-logs] SF.net SVN: scummvm:[35088] scummvm/trunk/engines/kyra/sound_towns.cpp
athrxx at users.sourceforge.net
athrxx at users.sourceforge.net
Sat Nov 15 20:08:41 CET 2008
Revision: 35088
http://scummvm.svn.sourceforge.net/scummvm/?rev=35088&view=rev
Author: athrxx
Date: 2008-11-15 19:08:35 +0000 (Sat, 15 Nov 2008)
Log Message:
-----------
(hopefully) fix valgrind warnings
Modified Paths:
--------------
scummvm/trunk/engines/kyra/sound_towns.cpp
Modified: scummvm/trunk/engines/kyra/sound_towns.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_towns.cpp 2008-11-15 18:56:39 UTC (rev 35087)
+++ scummvm/trunk/engines/kyra/sound_towns.cpp 2008-11-15 19:08:35 UTC (rev 35088)
@@ -2553,7 +2553,7 @@
TownsPC98_OpnSquareSineSource::TownsPC98_OpnSquareSineSource(const uint32 timerbase) : _tlTable(0),
_tleTable(0), _updateRequest(-1), _tickLength(timerbase * 27), _ready(0), _reg(0), _rand(1), _outN(1),
_nTick(0), _evpUpdateCnt(0), _evpTimer(0x1f), _pReslt(0x1f), _attack(0), _cont(false), _evpUpdate(true),
- _timer(0) {
+ _timer(0), _noiseGenerator(0) {
memset(_channels, 0, sizeof(Channel) * 3);
@@ -2642,6 +2642,9 @@
}
void TownsPC98_OpnSquareSineSource::writeReg(uint8 address, uint8 value, bool force) {
+ if (!_ready)
+ return;
+
if (address > 10 || *_reg[address] == value) {
if ((address == 11 || address == 12 || address == 13) && value)
warning("TownsPC98_OpnSquareSineSource: unsupported reg address: %d", address);
@@ -3015,10 +3018,19 @@
uint8 h = regAddress & 0xf0;
uint8 l = (regAddress & 0x0f);
+
+ ChanInternal *c = 0;
+ TownsPC98_OpnOperator **co = 0;
+ TownsPC98_OpnOperator *o = 0;
- ChanInternal *c = &_chanInternal[(h < 0x30) ? ((value & 3) + ((value & 4) ? 3 : 0)) : ((l & 3) + 3 * part)];
- TownsPC98_OpnOperator **co = c->opr;
- TownsPC98_OpnOperator *o = (h < 0x30) ? 0 : c->opr[oprOrdr[(l - (l & 3)) >> 2]];
+ if (regAddress > 0x2F) {
+ c = &_chanInternal[(l & 3) + 3 * part];
+ co = c->opr;
+ o = c->opr[oprOrdr[(l - (l & 3)) >> 2]];
+ } else if (regAddress == 0x28) {
+ c = &_chanInternal[(value & 3) + ((value & 4) ? 3 : 0)];
+ co = c->opr;
+ }
switch (h) {
case 0x00:
@@ -3036,9 +3048,9 @@
// Key on/off
for (int i = 0; i < 4; i++) {
if ((value >> (4 + i)) & 1)
- co[i]->keyOn();
+ co[oprOrdr[i]]->keyOn();
else
- co[i]->keyOff();
+ co[oprOrdr[i]]->keyOff();
}
} else if (l == 4) {
// Timer A
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