https://bugs.winehq.org/show_bug.cgi?id=46513
Bug ID: 46513 Summary: MCI_Open handling of filenames passed with MCI_OPEN_TYPE is insufficient (3D Pinball Space Cadet) Product: Wine Version: 4.0-rc7 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winmm&mci Assignee: wine-bugs@winehq.org Reporter: wenger.quentin@bluewin.ch Distribution: ---
Created attachment 63364 --> https://bugs.winehq.org/attachment.cgi?id=63364 Patch checking for a dot in lpstrDeviceType and switching to MCI_OPEN_ELEMENT accordingly.
I stumbled upon the error
fixme:mci:MCI_LoadMciDriver Couldn't load driver for type L"PINBALL.MID"
(as reported in the "Additional Comments" on https://appdb.winehq.org/objectManager.php?sClass=version&iId=1673&i...) while playing with 3D Pinball Space Cadet. This error prevents the MIDI background music of the game from playing.
For reference, aplaymidi and the testing mcishell (wintest.exe) both play the file without problems.
I tracked down this error to the function MCI_Open receiving MCI_OPEN_TYPE and the string "pinball.mid" as lpstrDeviceType, instead of MCI_OPEN_ELEMENT and the string in lpstrElementName.
While this may seem like a bug in Pinball, the function MCI_Open actually already applies some check for this situation (see the comment in lines 1763-1766 of mci.c). However, the check is based on some '!' character present in the string, which does not cover Pinball's case.
I did create a patch for my own needs, see attachment.
Please note that I provide no guarantee about the scope accuracy of this patch - it does solve the problem, but maybe checking for the presence of a dot in the string is too broad and creates bug with other programs...
Assuming that the logic of the patch is good, it may also be wanted to merge/simplify/rewrite the checks somewhat, eg. merging the ERR(...), etc.