Loading is not normally allowed while audio is being played in SCI games.
Stopping sounds is needed in ScummVM, as the player may load via
Control-F5 at any point, even while a sound is playing.
The palettes are reversed by default. This is useful when rendering
sprites, as they use reversed ids as well.
When a color is read directly as an int, it is in the original
unreversed order.
So, reverse it by hand when it's coming from lingo or other sources.
This was done in multiple places by subtracting the color id from 255.
The function transformColor handles this now.
Reversing the color means: 255 - color_id.
Game controller input is now enabled whenever a compatible device is
connected. The keymapper's keymaps are refreshed when a joystick is added
or removed.
Fixes#10366.
The Miles MT-32 MIDI driver extends MidiDriver_BASE, but does not
override its sysEx method, which does nothing by default. This
resulted in a few initialization sysex messages for The 7th Guest
not being sent.
I've added an implementation for this method.
Adapted from 3657db3a7b7bf640edb768f6ffc37df9d5073d22
The 7th Guest initializes GM devices during the "loading GM drivers"
screen, which is a normal video that plays "audio" that consists of
initialization messages (mostly Roland GS sysexes). The original
interpreter plays this video twice, which is enough time to play the
entire INI_SC.XMI initialization file. ScummVM apparently plays video
a bit faster, and there is not enough time to play the entire init
file. Because of this GM initialization is incomplete.
I've fixed this by making the init video loop until the audio has
finished playing.
Note: I have only tested this with the original DOS version of the
game. I don't know if the file reference I've used to identify the
GM init video is the same on other platforms. If not, this change
might not work and/or have unintended results.
The GM music for The 7th Guest contains several drumkit selection
messages which use an incorrect drumkit number. This relied on a
correction mechanism of the Roland SC-55, which would correct these
numbers to valid selections. This mechanism was not present in later
GS and GM devices, causing error messages and wrong drumkits.
I've fixed this by adding code which simulates the correction
mechanism of the SC-55.
The 7th Guest sends several SysEx messages for Roland GS devices during
startup. ScummVM did not send these messages.
The Groovie MusicPlayerMidi class encapsulates the MidiDriver which is
actually used for sending MIDI events. However, it did not implement the
sysEx method, so the empty implementation of MidiDriver_BASE was used.
I've added a sysEx method which forwards the messages to the actual
MidiDriver.
The current patch mechanism allows only replacing intructions in current
scripts, but not adding new instructions out of nowhere.
Thus, issue like #9646 is about to be closed as WONTFIX.
This new mechanism adds a hook on vm.cpp, before executing opcodes, and
if required, executs a new code.
It solves one of the issues of #9646, the others can be solved as well using that mechanism.