* KYRA: Clear program queue in AdLibDriver::stopAllChannels()
* KYRA: Fix starting sounds when program queue is full
AdLibDriver::setupPrograms() returns early when the sound program
queue is completely full instead of starting the first sound in
the queue. A crude workaround in startSound() is needed to prevent
the queue to become stuck.
Fix the check so it can distinguish between full and empty queue.
* KYRA: Remove workaround overflowing program queue in EoB
The bug that prevented sounds from starting when the queue
was full and caused the queue to become stuck has been fixed
in the previous commit, so the workaround in startSound()
that simply overflows the queue shouldn't be necessary any
more.
The warning for dropped tracks is still suppressed in EoB
since it seems to be common there.
* KYRA: Simplify queue handling code a bit
* KYRA: Add some safety checks to AdLib driver
Check validity of data read from the sound files to avoid illegal
memory access or undefined behavior:
* Validate channel number before indexing _channels array in
several methods.
* Since baseNote can be anything, adjusting note by 12 may not be
enough in setupNote(). Use division/modulo.
* Clip rawNote and pitchBend to valid range before indexing
_pitchBendTables[] in setupNote().
* Avoid undefined left shift of a negative value (frequency unk1)
in primaryEffect1().
* Ensure valid target address for jumps and similar instructions.
* Catch stack overflow in update_jumpToSubroutine() and underflow
in update_returnFromSubroutine().
* Check location of effect data in update_setupSecondaryEffect1().
* Verify index for _unkTable2[] in updateCallback46().
Also fix debug messages in update_setupRhythmSection() and add a
missing space in a comment.
* KYRA: Safety check for programs running past end of data
Add a safety check that prevents sound channel programs from
running past the end of _soundData (in case the sound file is
truncated or contains malicious data). This is done in a central
place in AdLibDriver::executePrograms() in order to avoid adding
checks to every update* method.
This is achieved by adding a new field to the parser opcode table
which holds the number of bytes an opcode needs for its arguments,
so executePrograms() knows how much data is needed.
* KYRA: Check data size setting up sound program or instrument
* KYRA: Add safety check to PCSoundDriver::getProgram()
* KYRA: Clip a shift exponent to valid range in noteOn()
EarlyQBartender, Hanoi, Hawker's barkeeper, Holloway, Moraji, Photographer, Rajif, Sgt Walls, Tyrell
Also described shooshine man's animations but he is unused as of yet.
For the time being both dancers will be shown in NR05
One needs to start a new (restored content) game to get the second dancer,
because her positioning code is in her Initialize() (as in HysteriaPatron2).
Maybe in the future we will allow only one dancer to appear there
choosing them with a random chance.
Izo, Sadik, Twins, EarlyQ, Leon, Sebastian, Leary, Grayford, Hanoi, Clerk, HowieLee, Isabella, FishDealer, InsectDealer
Also restored a talk animation for Hanoi, which looked to be omitted due to an original bug