Enforce Create DirectSound Before Buffer and Stream

Base on research, both DirectSoundCreateStream and
DirectSoundCreateBuffer do check if DirectSound is initialize first then
initialize it. Hopefully some titles wouldn't boot at all will now boot
a bit further.
This commit is contained in:
RadWolfie 2017-10-25 03:26:04 -05:00
parent b019c2ea56
commit 8f887159c5
1 changed files with 11 additions and 2 deletions

View File

@ -787,6 +787,16 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateBuffer)
{
FUNC_EXPORTS;
// Research reveal DirectSound creation check is part of the requirement.
if (!g_pDSound8 && !g_bDSoundCreateCalled) {
HRESULT hRet;
hRet = XTL::EMUPATCH(DirectSoundCreate)(NULL, &g_pDSound8, NULL);
if (hRet != DS_OK) {
CxbxKrnlCleanup("Unable to initialize DirectSound!");
}
}
enterCriticalSection;
LOG_FUNC_BEGIN
@ -1418,11 +1428,10 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateStream)
{
FUNC_EXPORTS;
// Research reveal DirectSound creation check is part of the requirement.
if (!g_pDSound8 && !g_bDSoundCreateCalled) {
HRESULT hRet;
EmuWarning("Initializing DirectSound pointer since it DirectSoundCreate was not called!");
hRet = XTL::EMUPATCH(DirectSoundCreate)(NULL, &g_pDSound8, NULL);
if (hRet != DS_OK) {
CxbxKrnlCleanup("Unable to initialize DirectSound!");