Opened 3 days ago

Closed 9 hours ago

#15233 closed defect (fixed)

SCI: PQ2: Airport music crash

Reported by: ArthurWalden Owned by: sluicebox
Priority: normal Component: Engine: SCI
Version: Keywords:
Cc: ArthurWalden Game: Police Quest 2

Description

I am using ScummVM version 2.8.1.

I am playing Police Quest 2 and my game keeps crashing. It started in the airport on the screen with the Siva car rental agency. Now it's happening repeatedly on that screen and in the restroom. The game just suddenly drops to Windows.

I am playing the English GOG version of the game.

I am running the game on Windows 10 Home, version 23H2.

Attachments (1)

pq2.057 (22.0 KB ) - added by ArthurWalden 3 days ago.

Download all attachments as: .zip

Change History (10)

by ArthurWalden, 3 days ago

Attachment: pq2.057 added

comment:1 by antoniou79, 2 days ago

Hello, could you please specify your audio settings (Global and Game specific) for the game, and any specific custom options for the game, eg. having enabled the "Prefer Digital Sound Effects" option.

I am testing on Windows 10, with a recent developer build of 2.9.0git and I do get some random crashes, starting from your saved game. I think the crashes may be related to the audio device settings. I have set my global audio device to be an MT-32 emulator, and I'm not overriding it for the game specifically.

So far I got 2 crashes -- I have to wait a while to get them -- a random interval seemingly, and I have left and re-entered the screen too. Sometimes, I don't get them at all (ie. I've waited up to 10 minutes and got no crash).

Also maybe related, on a rare occasion a single music note is played and then nothing.

At the point of crash:
For first crash, console output was:

WARNING: Ignoring MIDI event f0!
WARNING: Ignoring MIDI event f0!
WARNING: Ignoring MIDI event f0!
WARNING: Ignoring MIDI event f0!
WARNING: Ignoring MIDI event f0!
WARNING: Ignoring MIDI event f0!
Segmentation fault

It seems that the "WARNING: Ignoring MIDI event f0!" messages occur every once in a while (in that screen at least) and they are not necessarily leading to crash.

For the second crash I encountered, I just got:

Assertion failed: reverb < kReverbConfigNr, file engines/sci/sound/drivers/midi.cpp, line 517

Edit: I've also tested with 2.8.1 and Microsoft GS Wavetable Synth [Windows MIDI] audio device set for the game (which produces an early warning "WARNING: Game has no native support for General MIDI, applying auto-mapping!").
The log at the time of crash now was:

...
[2024-06-28 15:52:23] WARNING: Ignoring MIDI event f0!
[2024-06-28 15:52:27] WARNING: Ignoring MIDI event f0!
[2024-06-28 15:52:27] WARNING: Ignoring MIDI event f0!
[2024-06-28 15:52:39] WARNING: MidiParser_SCI::parseNextEvent: Unsupported event code f7!
[2024-06-28 15:52:39] WARNING: Ignoring MIDI event f0!

There were plenty of "WARNING: Ignoring MIDI event f0!" messages before the game crashed.

Another oddity to note. Loading from the provided saved game, I usually get a "drum" note and then nothing. But, only once so far, I actually got proper music, upon loading that saved game.

Last edited 2 days ago by antoniou79 (previous) (diff)

comment:2 by ArthurWalden, 2 days ago

Interesting. However, I'm not sure my audio settings have anything to do with it. None of the crashes had any error messages or in any way resemble what you describe. Instead, the game suddenly drops to windows.

One thing (that may also be what I experienced 20 years ago): I just started the game again, managed to get through the airport without crashing (had to do everything very efficiently), got back to the police station, and now the game appears stable again. The crashing all seemed to happen at the airport. Similarly, I haven't gotten to it on this playthrough yet, but I believe I had similar problems 20 years ago at the day 2 murder scene and maybe the motel. I think these crashes may be location specific.

In any case, I overrode global settings to set my game to VirtualMIDISynth #1 [Windows MIDI].

in reply to:  2 comment:3 by antoniou79, 2 days ago

Replying to ArthurWalden:

Interesting. However, I'm not sure my audio settings have anything to do with it. None of the crashes had any error messages or in any way resemble what you describe. Instead, the game suddenly drops to windows.

You'll have to check the ScummVM log file for warning or error messages.
https://docs.scummvm.org/en/latest/help/report_bugs.html#logfile

Please note, you'll need to check the log file after the crash, and before relaunching ScummVM, since in most Operating Systems, this log file gets rewritten upon launching ScummVM.

Last edited 2 days ago by antoniou79 (previous) (diff)

comment:4 by ArthurWalden, 2 days ago

This was all I saw:[2024-06-28 15:26:50] Vorbis FLAC MP3 RGB zLib MPEG2 FluidSynth Theora VPX AAC A/52 FreeType2 FriBiDi JPEG PNG GIF taskbar TTS cloud (servers, local) ENet SDL2 TinyGL OpenGL (with shaders)

It does not look like an error message.

comment:5 by antoniou79, 2 days ago

A crash took a long while to happen when debugging via Visual Studio, but in the end I got one.

This was the "assertion failed" one mentioned above.

Call Stack looked like this at the time:

 	ucrtbased.dll!00007ff94ce7eaa5()	Unknown	Non-user code. Cannot find or open the PDB file.
 	ucrtbased.dll!00007ff94ce7e8c3()	Unknown	Non-user code. Cannot find or open the PDB file.
 	ucrtbased.dll!00007ff94ce8158f()	Unknown	Non-user code. Cannot find or open the PDB file.
>	scummvm.exe!Sci::MidiPlayer_Midi::setReverb(char reverb='8') Line 517	C++	Symbols loaded.
 	scummvm.exe!Sci::MidiParser_SCI::processEvent(const EventInfo & info={...}, bool fireEvents=true) Line 794	C++	Symbols loaded.
 	scummvm.exe!MidiParser::onTimer() Line 249	C++	Symbols loaded.
 	scummvm.exe!Sci::MusicEntry::onTimer() Line 1073	C++	Symbols loaded.
 	scummvm.exe!Sci::SciMusic::onTimer() Line 221	C++	Symbols loaded.
 	scummvm.exe!Sci::SciMusic::miditimerCallback(void * p=0x00000163dced0b20) Line 207	C++	Symbols loaded.
 	scummvm.exe!MidiDriver_Emulated::readBuffer(short * data=0x00000163ea165aa0, const int numSamples=512) Line 105	C++	Symbols loaded.
 	scummvm.exe!Audio::RateConverter_Impl<1,1,0>::interpolateConvert(Audio::AudioStream & input={...}, short * outBuffer=0x00000163dcecd26c, unsigned int numSamples=1024, unsigned short volL=256, unsigned short volR=256) Line 218	C++	Symbols loaded.
 	scummvm.exe!Audio::RateConverter_Impl<1,1,0>::convert(Audio::AudioStream & input={...}, short * outBuffer=0x00000163dceccf60, unsigned int numSamples=1024, unsigned short volL=256, unsigned short volR=256) Line 298	C++	Symbols loaded.
 	scummvm.exe!Audio::Channel::mix(short * data=0x00000163dceccf60, unsigned int len=1024) Line 719	C++	Symbols loaded.
 	scummvm.exe!Audio::MixerImpl::mixCallback(unsigned char * samples=0x00000163dceccf60, unsigned int len=1024) Line 331	C++	Symbols loaded.
 	scummvm.exe!SdlMixerManager::callbackHandler(unsigned char * samples=0x00000163dceccf60, int len=4096) Line 205	C++	Symbols loaded.
 	scummvm.exe!SdlMixerManager::sdlCallback(void * this_=0x00000163dcd77750, unsigned char * samples=0x00000163dceccf60, int len=4096) Line 212	C++	Symbols loaded.
 	scummvm.exe!SDL_RunAudio(void * devicep=0x00000163dceeadd0) Line 737	C	Symbols loaded.
 	scummvm.exe!SDL_RunThread(void * data=0x00000163dcef4260) Line 289	C	Symbols loaded.
 	scummvm.exe!RunThread(void * data=0x00000163dcedba70) Line 91	C	Symbols loaded.
 	scummvm.exe!RunThreadViaCreateThread(void * data=0x00000163dcedba70) Line 100	C	Symbols loaded.
 	[External Code]		Annotated Frame

The invalid reverb value in this case was 56 (ie. char value '8'). The assertion is made against the kReverbConfigNr which is 11.

Edit: Another crash, at another point in 2.9.0git via Visual Studio debugging (same saved game file, same scene):

"Exception thrown at 0x00007FF652CAB0AF in scummvm.exe: 0xC0000005: Access violation reading location 0x0000021B599D5140."

Call stack:

>	scummvm.exe!MidiParser::processEvent(const EventInfo & info={...}, bool fireEvents=true) Line 289	C++	Symbols loaded.
 	scummvm.exe!Sci::MidiParser_SCI::processEvent(const EventInfo & info={...}, bool fireEvents=true) Line 897	C++	Symbols loaded.
 	scummvm.exe!MidiParser::onTimer() Line 249	C++	Symbols loaded.
 	scummvm.exe!Sci::MusicEntry::onTimer() Line 1073	C++	Symbols loaded.
 	scummvm.exe!Sci::SciMusic::onTimer() Line 221	C++	Symbols loaded.
 	scummvm.exe!Sci::SciMusic::miditimerCallback(void * p=0x0000021a592c3800) Line 207	C++	Symbols loaded.
 	scummvm.exe!MidiDriver_Emulated::readBuffer(short * data=0x0000021a59941080, const int numSamples=512) Line 105	C++	Symbols loaded.
 	scummvm.exe!Audio::RateConverter_Impl<1,1,0>::interpolateConvert(Audio::AudioStream & input={...}, short * outBuffer=0x0000021a593d7964, unsigned int numSamples=1024, unsigned short volL=256, unsigned short volR=256) Line 218	C++	Symbols loaded.
 	scummvm.exe!Audio::RateConverter_Impl<1,1,0>::convert(Audio::AudioStream & input={...}, short * outBuffer=0x0000021a593d7690, unsigned int numSamples=1024, unsigned short volL=256, unsigned short volR=256) Line 298	C++	Symbols loaded.
 	scummvm.exe!Audio::Channel::mix(short * data=0x0000021a593d7690, unsigned int len=1024) Line 719	C++	Symbols loaded.
 	scummvm.exe!Audio::MixerImpl::mixCallback(unsigned char * samples=0x0000021a593d7690, unsigned int len=1024) Line 331	C++	Symbols loaded.
 	scummvm.exe!SdlMixerManager::callbackHandler(unsigned char * samples=0x0000021a593d7690, int len=4096) Line 205	C++	Symbols loaded.
 	scummvm.exe!SdlMixerManager::sdlCallback(void * this_=0x0000021a59155660, unsigned char * samples=0x0000021a593d7690, int len=4096) Line 212	C++	Symbols loaded.
 	scummvm.exe!SDL_RunAudio(void * devicep=0x0000021a5905b8a0) Line 737	C	Symbols loaded.
 	scummvm.exe!SDL_RunThread(void * data=0x0000021a593c5050) Line 289	C	Symbols loaded.
 	scummvm.exe!RunThread(void * data=0x0000021a592ac210) Line 91	C	Symbols loaded.
 	scummvm.exe!RunThreadViaCreateThread(void * data=0x0000021a592ac210) Line 100	C	Symbols loaded.
 	[External Code]		Annotated Frame

Last edited 2 days ago by antoniou79 (previous) (diff)

comment:6 by sluicebox, 2 days ago

Priority: highnormal

antoniou79, great triaging! I wasn't able to reproduce any of this until you figured it out, because I have the default sound config. Now I get all the same results as you.

For the record this is game version 1.002.001. I believe the problem sound is 29.

A lot of suspicious things happening here. My approach to these hairy SCI0 sound issues has been to figure out as much as I can with scripts and debugging, reduce it down to the simplest case, and then present it to athrxx and beg him to solve it. =)

comment:7 by sluicebox, 12 hours ago

Making progress, I've found the bugs that are causing this

comment:8 by sluicebox <22204938+sluicebox@…>, 10 hours ago

In cf842571:

SCI: Fix SCI0 MIDI filtering when multiple stop events

SCI0 MIDI filtering creates a new event stream, but it was generating
malformed events when there were multiple stop events (status byte FC).
This caused MidiParser_SCI::parseEvent to miss the stop event written by
the filter code. The parser would continue reading and parsing out of
bounds heap memory until crashing seemingly randomly.

Now the filter always stops on the first stop event and always writes
out its own stop event correctly.

Fixes PQ2 airport music, bug #15233

Thanks to @antoniou79 for triaging the bug report

comment:9 by sluicebox, 9 hours ago

Keywords: pq2 crash removed
Owner: set to sluicebox
Resolution: fixed
Status: newclosed
Summary: SCI: PQ2: My Game Keeps CrashingSCI: PQ2: Airport music crash

Fixed in cf842571

This will appear in the next daily build. The attached save game should now play the suspense music correctly instead of only a few notes. It will also correctly loop the music at the end instead of stopping.

This also fixes the music that plays when entering the airport from the outside; it wouldn't loop, or it would have a large gap before looping, and it also might crash.

Thanks for reporting this!

Note: See TracTickets for help on using tickets.