- The raw OPL music player no longer checks against the chip count for writing to the second

OPL2; OPLwriteReg() will now do nothing when called to act on a chip that doesn't exist. This
  is so that it can use the second half of a single OPL3.

SVN r3949 (trunk)
This commit is contained in:
Randy Heit 2012-11-09 04:57:25 +00:00
parent b513931473
commit 8670d6e4f4
2 changed files with 7 additions and 10 deletions

View file

@ -68,8 +68,11 @@ void OPLio::OPLwriteReg(int which, uint reg, uchar data)
reg |= (which & 1) << 8; reg |= (which & 1) << 8;
which >>= 1; which >>= 1;
} }
if (chips[which] != NULL)
{
chips[which]->WriteReg(reg, data); chips[which]->WriteReg(reg, data);
} }
}
/* /*
* Write to an operator pair. To be used for register bases of 0x20, 0x40, * Write to an operator pair. To be used for register bases of 0x20, 0x40,

View file

@ -411,10 +411,7 @@ int OPLmusicFile::PlayTick ()
break; break;
default: // It's something to stuff into the OPL chip default: // It's something to stuff into the OPL chip
if (WhichChip < NumChips)
{
io->OPLwriteReg(WhichChip, reg, data); io->OPLwriteReg(WhichChip, reg, data);
}
break; break;
} }
} }
@ -454,11 +451,8 @@ int OPLmusicFile::PlayTick ()
{ {
data = *score++; data = *score++;
} }
if (WhichChip < NumChips)
{
io->OPLwriteReg(WhichChip, reg, data); io->OPLwriteReg(WhichChip, reg, data);
} }
}
break; break;
case DosBox2: case DosBox2:
@ -485,7 +479,7 @@ int OPLmusicFile::PlayTick ()
{ {
return (data + 1) << 8; return (data + 1) << 8;
} }
else if (code < to_reg_size && which < NumChips) else if (code < to_reg_size)
{ {
io->OPLwriteReg(which, to_reg[code], data); io->OPLwriteReg(which, to_reg[code], data);
} }