Minor Improvement

- Added check if DirectSound3DBuffer8 is null due to dummy WAVEFORMATEX
causing issue for DSBCAPS_3D flag.
- Another code standard fix.
- Forward SetConeOutsideVolume to hybrid function to reduce duplicate
code.
This commit is contained in:
RadWolfie 2017-06-24 11:51:26 -05:00
parent c3121b740a
commit 836376c0a1
2 changed files with 41 additions and 23 deletions

View File

@ -1414,7 +1414,7 @@ extern "C" HRESULT __stdcall XTL::EMUPATCH(IDirectSoundBuffer_StopEx)
LOG_FUNC_END;
HRESULT hRet = D3D_OK;
//TODO: RadWolfie - Rayman 3 crash at end of first intro for this issue... if only return DS_OK, then it works fine until end of 2nd intro it crashed.
if (pThis != nullptr && pThis->EmuDirectSoundBuffer8 != nullptr) {
// TODO : Test Stop (emulated via Stop + SetCurrentPosition(0)) :
hRet = pThis->EmuDirectSoundBuffer8->Stop();
@ -1916,8 +1916,9 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_Flush)
LOG_UNIMPLEMENTED_DSOUND();
if (pThis != NULL)
if (pThis != NULL) {
DSoundBufferRemoveSynchPlaybackFlag(pThis->EmuFlags);
}
leaveCriticalSection;
@ -2056,8 +2057,6 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_SetConeOutsideVolume)
{
FUNC_EXPORTS;
enterCriticalSection;
DbgPrintf("EmuDSound: CDirectSoundStream_SetConeOutsideVolume\n"
"(\n"
" pThis : 0x%.08X\n"
@ -2066,14 +2065,7 @@ HRESULT WINAPI XTL::EMUPATCH(CDirectSoundStream_SetConeOutsideVolume)
");\n",
pThis, lConeOutsideVolume, dwApply);
HRESULT hRet = DS_OK;
if (pThis != NULL && pThis->EmuDirectSound3DBuffer8 != NULL) {
pThis->EmuDirectSound3DBuffer8->SetConeOutsideVolume(lConeOutsideVolume, dwApply);
}
leaveCriticalSection;
return hRet;
return HybridDirectSound3DBuffer_SetConeOutsideVolume(pThis->EmuDirectSound3DBuffer8, lConeOutsideVolume, dwApply);
}
// ******************************************************************
@ -2933,8 +2925,11 @@ HRESULT WINAPI XTL::EMUPATCH(IDirectSound_GetOutputLevels)
pThis, pOutputLevels, bResetPeakValues);
// TODO: Anything? Either way, I've never seen a game to date use this...
LOG_UNIMPLEMENTED_DSOUND();
static bool bShowOnce = true;
if (bShowOnce) {
bShowOnce = false;
LOG_UNIMPLEMENTED_DSOUND();
}
leaveCriticalSection;

View File

@ -727,7 +727,10 @@ inline HRESULT HybridDirectSound3DBuffer_SetAllParameters(
{
enterCriticalSection;
HRESULT hRet = pDS3DBuffer->SetAllParameters(pDS3DBufferParams, dwApply);
HRESULT hRet = DS_OK;
if (pDS3DBuffer != nullptr) {
hRet = pDS3DBuffer->SetAllParameters(pDS3DBufferParams, dwApply);
}
leaveCriticalSection;
@ -755,7 +758,9 @@ inline HRESULT HybridDirectSound3DBuffer_SetConeAngles(
enterCriticalSection;
HRESULT hRet = DS_OK;
pDS3DBuffer->SetConeAngles(dwInsideConeAngle, dwOutsideConeAngle, dwApply);
if (pDS3DBuffer != nullptr) {
hRet = pDS3DBuffer->SetConeAngles(dwInsideConeAngle, dwOutsideConeAngle, dwApply);
}
leaveCriticalSection;
@ -791,7 +796,10 @@ inline HRESULT HybridDirectSound3DBuffer_SetConeOutsideVolume(
enterCriticalSection;
HRESULT hRet = pDS3DBuffer->SetConeOutsideVolume(lConeOutsideVolume, dwApply);
HRESULT hRet = DS_OK;
if (pDS3DBuffer != nullptr) {
hRet = pDS3DBuffer->SetConeOutsideVolume(lConeOutsideVolume, dwApply);
}
leaveCriticalSection;
@ -961,7 +969,10 @@ inline HRESULT HybridDirectSound3DBuffer_SetMaxDistance(
enterCriticalSection;
HRESULT hRet = pDS3DBuffer->SetMaxDistance(flMaxDistance, dwApply);
HRESULT hRet = DS_OK;
if (pDS3DBuffer != nullptr) {
hRet = pDS3DBuffer->SetMaxDistance(flMaxDistance, dwApply);
}
leaveCriticalSection;
@ -978,11 +989,14 @@ inline HRESULT HybridDirectSound3DBuffer_SetMinDistance(
enterCriticalSection;
HRESULT hRet = pDS3DBuffer->SetMinDistance(flMinDistance, dwApply);
HRESULT hRet = DS_OK;
if (pDS3DBuffer != nullptr) {
hRet = pDS3DBuffer->SetMinDistance(flMinDistance, dwApply);
}
leaveCriticalSection;
return DS_OK;
return hRet;
}
/*
//TODO: PC DirectSound does not have SetMixBins method function.
@ -1016,7 +1030,10 @@ inline HRESULT HybridDirectSound3DBuffer_SetMode(
enterCriticalSection;
HRESULT hRet = pDS3DBuffer->SetMode(dwMode, dwApply);
HRESULT hRet = DS_OK;
if (pDS3DBuffer != nullptr) {
hRet = pDS3DBuffer->SetMode(dwMode, dwApply);
}
leaveCriticalSection;
@ -1082,7 +1099,10 @@ inline HRESULT HybridDirectSound3DBuffer_SetPosition(
enterCriticalSection;
HRESULT hRet = pDS3DBuffer->SetPosition(x, y, z, dwApply);
HRESULT hRet = DS_OK;
if (pDS3DBuffer != nullptr) {
hRet = pDS3DBuffer->SetPosition(x, y, z, dwApply);
}
leaveCriticalSection;
@ -1133,7 +1153,10 @@ inline HRESULT HybridDirectSound3DBuffer_SetVelocity(
enterCriticalSection;
HRESULT hRet = pDS3DBuffer->SetVelocity(x, y, z, dwApply);
HRESULT hRet = DS_OK;
if (pDS3DBuffer != nullptr) {
hRet = pDS3DBuffer->SetVelocity(x, y, z, dwApply);
}
leaveCriticalSection;