Skip to content
Permalink
Browse files

fix sanity and organize wfxformat into functions

  • Loading branch information
RadWolfie committed Feb 21, 2020
1 parent 51d5759 commit b2d5b5c7e8f5575d6014f889f232b830ccf0b4c9
@@ -141,6 +141,7 @@ file (GLOB CXBXR_HEADER_EMU
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbState.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbVertexBuffer.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbVertexShader.h"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/common/windows/WFXformat.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DirectSound.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DirectSoundGlobal.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp"
@@ -109,6 +109,7 @@ struct X_CDirectSoundBuffer
X_DSENVOLOPEDESC Xb_EnvolopeDesc;
X_DSVOICEPROPS Xb_VoiceProperties;
DWORD Xb_Frequency;
DWORD Xb_Flags;
};

//Custom flags (4 bytes support up to 31 shifts,starting from 0)
@@ -263,7 +264,8 @@ class X_CDirectSoundStream
X_DSENVOLOPEDESC Xb_EnvolopeDesc;
X_DSVOICEPROPS Xb_VoiceProperties;
DWORD Xb_Frequency;
DWORD Host_dwLastWritePos;
DWORD Host_dwLastWritePos;
DWORD Xb_Flags;
};

// ******************************************************************
@@ -205,14 +205,14 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateBuffer)
// TODO: Garbage Collection
*ppBuffer = new X_CDirectSoundBuffer();

DSoundBufferSetDefault((*ppBuffer), 0);
DSoundBufferSetDefault((*ppBuffer), 0, pdsbd->dwFlags);
(*ppBuffer)->Host_lock = { 0 };
(*ppBuffer)->Xb_rtStopEx = 0LL;

DSoundBufferRegionSetDefault(*ppBuffer);

// We have to set DSBufferDesc last due to EmuFlags must be either 0 or previously written value to preserve other flags.
GeneratePCMFormat(DSBufferDesc, pdsbd->lpwfxFormat, (*ppBuffer)->EmuFlags, pdsbd->dwBufferBytes,
GeneratePCMFormat(DSBufferDesc, pdsbd->lpwfxFormat, pdsbd->dwFlags, (*ppBuffer)->EmuFlags, pdsbd->dwBufferBytes,
&(*ppBuffer)->X_BufferCache, (*ppBuffer)->X_BufferCacheSize, (*ppBuffer)->Xb_VoiceProperties, pdsbd->lpMixBinsOutput);
(*ppBuffer)->EmuBufferDesc = DSBufferDesc;

@@ -929,8 +929,8 @@ HRESULT WINAPI XTL::EMUPATCH(IDirectSoundBuffer_SetFormat)
LOG_FUNC_ARG(pwfxFormat)
LOG_FUNC_END;

HRESULT hRet = HybridDirectSoundBuffer_SetFormat(pThis->EmuDirectSoundBuffer8, pwfxFormat,
pThis->EmuBufferDesc, pThis->EmuFlags,
HRESULT hRet = HybridDirectSoundBuffer_SetFormat(pThis->EmuDirectSoundBuffer8, pwfxFormat, pThis->Xb_Flags,
pThis->EmuBufferDesc, pThis->EmuFlags,
pThis->EmuPlayFlags, pThis->EmuDirectSound3DBuffer8,
0, pThis->X_BufferCache, pThis->X_BufferCacheSize,
pThis->Xb_VoiceProperties, xbnullptr, pThis->Xb_Frequency);

0 comments on commit b2d5b5c

Please sign in to comment.
You can’t perform that action at this time.