kcat / dsoal

A DirectSound DLL replacer that enables surround sound, HRTF, and EAX support via OpenAL Soft
GNU Lesser General Public License v2.1
348 stars 48 forks source link

Metal Gear Solid 2 - Failed creating IDirectSound8 Object. #71

Open drunohazarb opened 1 year ago

drunohazarb commented 1 year ago

Game refuses to launch with DSOAL, displaying the following error. Works fine with IndirectSound.

mgs2 error

DSOAL_LOGLEVEL=1 Output: 25b8:fixme:dsound:DSDevice_GetInterface Unhandled GUID: {2a8af120-e9de-4132-aaa5-4bdda5f325b8}

DSOAL_LOGLEVEL=3 Output:

2b7c:trace:dsound:load_libopenal Found ALC_EXT_thread_local_context
2b8c:trace:dsound:DllMain (743D0000, 2, 00000000)
2b90:trace:dsound:DllMain (743D0000, 2, 00000000)
2b94:trace:dsound:DllMain (743D0000, 2, 00000000)
2b9c:trace:dsound:DllMain (743D0000, 2, 00000000)
2ba0:trace:dsound:DllMain (743D0000, 2, 00000000)
2ba4:trace:dsound:DllMain (743D0000, 2, 00000000)
2ba8:trace:dsound:DllMain (743D0000, 2, 00000000)
2bb8:trace:dsound:DllMain (743D0000, 2, 00000000)
2bb0:trace:dsound:DllMain (743D0000, 2, 00000000)
2bb4:trace:dsound:DllMain (743D0000, 2, 00000000)
2bac:trace:dsound:DllMain (743D0000, 2, 00000000)
2bbc:trace:dsound:DllMain (743D0000, 2, 00000000)
2bc0:trace:dsound:DllMain (743D0000, 2, 00000000)
2bc4:trace:dsound:DllMain (743D0000, 2, 00000000)
2b7c:trace:dsound:DSOAL_DirectSoundEnumerateA (008EC2B7, 0019FE40)
2b7c:trace:dsound:enumerate_mmdevices Calling back with NULL (Primary Sound Driver)
2b7c:trace:dsound:DSOAL_DirectSoundCreate8 ((null), 01210E60, 00000000)
2b7c:trace:dsound:DSDevice_Create Creating device instance 0F6D3578
2b7c:trace:dsound:DS8_AddRef (0F6D3578) ref 1
2b7c:trace:dsound:DS8_Initialize (0F6D3578)->((null))
2b7c:trace:dsound:DSOAL_GetDeviceID (DSDEVID_DefaultPlayback, 0019FD64)
2b7c:trace:dsound:DS8_Initialize Searching shared devices for {6169a582-37ee-4455-8079-6c0b18145d21}
2b7c:trace:dsound:DSShare_Create Creating shared device 133256A8
2b7c:warn:dsound:DSShare_Create PKEY_AudioEndpoint_PhysicalSpeakers is not a ULONG: 0x0000
2b7c:trace:dsound:DSShare_Create Got speaker config 0:8 from physical speakers 0x00000000
2be4:trace:dsound:DllMain (743D0000, 2, 00000000)
2b7c:trace:dsound:DSShare_Create Opened AL device: OpenAL Soft on Speakers (Razer Surround Audio Controller)
01fc:trace:dsound:DllMain (743D0000, 2, 00000000)
2038:trace:dsound:DllMain (743D0000, 2, 00000000)
2b7c:trace:dsound:DSShare_Create Found EAX5.0
2b7c:trace:dsound:DSShare_Create Found AL_EXT_FLOAT32
2b7c:trace:dsound:DSShare_Create Found AL_EXT_MCFORMATS
2b7c:trace:dsound:DSShare_Create Found AL_SOFT_deferred_updates
2b7c:trace:dsound:DSShare_Create Found AL_SOFT_source_spatialize
2b7c:trace:dsound:DSShare_Create Found AL_SOFTX_map_buffer
2b7c:trace:dsound:DSShare_Create Allocated 128 hardware sources and 384 software sources
2b7c:trace:dsound:DSShare_starttimer Calling timer every 6 ms for 100 refreshes per second
2b7c:trace:dsound:DS8_GetSpeakerConfig (0F6D3578)->(0019FDB0)
2b7c:trace:dsound:DS8_SetCooperativeLevel (0F6D3578)->(006D06F8, 2)
2b7c:trace:dsound:DS8_CreateSoundBuffer (0F6D3578)->(0019FD58, 0019FD7C, 00000000)
2b7c:trace:dsound:DS8_CreateSoundBuffer Requested buffer:
    Size        = 36
    Flags       = 0x00000011
    BufferBytes = 0
2b7c:trace:dsound:DS8_CreateSoundBuffer Requested 3D algorithm GUID: {00000000-0000-0000-0000-000000000000}
1f54:trace:dsound:DllMain (743D0000, 2, 00000000)
2b7c:trace:dsound:DSPrimary_AddRef (0F6D359C) ref 1
2b7c:trace:dsound:DSPrimary_Initialize (0F6D359C)->(0F6D357C, 0019FD58)
2b7c:trace:dsound:DS8_CreateSoundBuffer 00000000
2b7c:trace:dsound:DSPrimary_SetFormat (0F6D359C)->(0019FD80)
2b7c:trace:dsound:DSPrimary_SetFormat Requested primary format:
    FormatTag      = 0001
    Channels       = 2
    SamplesPerSec  = 44100
    AvgBytesPerSec = 176400
    BlockAlign     = 4
    BitsPerSample  = 16
2b7c:trace:dsound:DSPrimary_Release (0F6D359C) ref 0
1f54:trace:dsound:DSShare_thread Shared device (133256A8) message loop start
2b7c:trace:dsound:DS8_QueryInterface (0F6D3578)->({c50a7e93-f395-4834-9ef6-7fa99de50966}, 143C89E4)
2b7c:trace:dsound:DS8_AddRef (0F6D3578) ref 2
2b7c:trace:dsound:DS8_AddRef (0F6D3578) ref 3
2b7c:trace:dsound:DS8_CreateSoundBuffer (0F6D3578)->(0019FAE4, 03672884, 00000000)
2b7c:trace:dsound:DS8_CreateSoundBuffer Requested buffer:
    Size        = 36
    Flags       = 0x00000011
    BufferBytes = 0
2b7c:trace:dsound:DS8_CreateSoundBuffer Requested 3D algorithm GUID: {00000000-0000-0000-0000-000000000000}
2b7c:trace:dsound:DSPrimary_AddRef (0F6D359C) ref 1
2b7c:trace:dsound:DSPrimary_Initialize (0F6D359C)->(0F6D357C, 0019FAE4)
2b7c:trace:dsound:DS8_CreateSoundBuffer 00000000
1f68:trace:dsound:DllMain (743D0000, 2, 00000000)
2b7c:trace:dsound:DS8_QueryInterface (0F6D3578)->({2a8af120-e9de-4132-aaa5-4bdda5f325b8}, 0019FAB0)
2b7c:fixme:dsound:DSDevice_GetInterface Unhandled GUID: {2a8af120-e9de-4132-aaa5-4bdda5f325b8}
2488:trace:dsound:DllMain (743D0000, 2, 00000000)
1f68:trace:dsound:DllMain (743D0000, 3, 00000000)
2488:trace:dsound:DllMain (743D0000, 3, 00000000)
2b7c:trace:dsound:DSPrimary_Release (0F6D359C) ref 0
2b7c:trace:dsound:DS8_Release (0F6D3578) ref 2
2b7c:trace:dsound:DS8_Release (0F6D3578) ref 1
2b7c:trace:dsound:DllMain (743D0000, 0, 00000001)
kcat commented 1 year ago

The 2a8af120-e9de-4132-aaa5-4bdda5f325b8 GUID doesn't seem to be recognized, and a search on DuckDuckGo only returns two results from a few years ago:

https://www.indirectsound.com/downloads.html

  • Use Microsoft's COM object when IID {2A8AF120-E9DE-4132-AAA5-4BDDA5F325B8} is queried
    • This can at least partially fix DirectMusic in some games, but it may also cause problems of its own (in No One Lives Forever 2, for example, this changes restores missing music but there can still be crashes inside DirectMusic which may or may not be related)
    • DirectMusic's IDirectMusicPerformance8::CreateAudioPath() can call DirectSound and query it for an undocumented IID. IndirectSound will now recognize this IID, pass it on directly to Microsoft's official DirectSound, and return the resulting COM object to the application. This means, however, that DirectMusic is using a pure DirectSound COM object that is not controlled by IndirectSound in any way (specifically, the COM object that DirectMusic has does not support hardware acceleration).

https://winehq.org/mailman3/hyperkitty/list/wine-devel@winehq.org/message/HUVEHTNUPPS5R7MQRCEDGFUPC7UVFG7S/

It seems to be an undocumented internal interface that DirectMusic uses to get non-public functionality, but nothing's been found out about it since then.

drunohazarb commented 1 year ago

Checks out, this game requires the native DirectMusic to be installed to work under Wine, regardless of IndirectSound.

Looks like we won't be seeing an open-source re-implementation of this interface without putting some serious effort on reverse engineering DirectMusic. Hope Codeweavers and Valve can get there some day.

mirh commented 1 year ago

https://github.com/google-code-export/hourglass-win32/blob/master/src/wintasee/hooks/soundhooks.cpp#L2032 I found this on the other hand (from the guys here I guess).

But they are pretty strange numbers tbh (on top of the fact not even XP sources seem to have them). For instance {d28de0d0-2794-492f-a3ff-e24180d54379} is reported to be IID_IDirectSoundSynthSink elsewhere (dmusic), not IID_IDirectSoundSinkSync (dsound) which has another guid. Is the directmusic even in the scope of the project?

mirh commented 1 year ago

Ok after banging my head to hell and beyond with Ghidra.. I think it may be IID_IDirectSoundPrivate? (the name would also confirm the suspect the wine devs had, and it would explain why it was so hidden).

And it wasn't even showing in the "code drops", because it seems like that used to be {d6e525ae-b125-4ec4-be13-126d0cf7afb6} before DX9 was released (which couldn't cut it in time for the XP SP1 and ~2002 xbox leaks).

If it can help, it's either called from dmime.dll or dmusic.dll.

mirh commented 1 month ago

@lmichaelis a mystery for you perhaps