diff --git a/src/core/hle/DSOUND/DirectSound/DirectSoundBuffer.cpp b/src/core/hle/DSOUND/DirectSound/DirectSoundBuffer.cpp index 2c4ed4f71..db660d044 100644 --- a/src/core/hle/DSOUND/DirectSound/DirectSoundBuffer.cpp +++ b/src/core/hle/DSOUND/DirectSound/DirectSoundBuffer.cpp @@ -748,11 +748,6 @@ xbox::hresult_xt WINAPI xbox::EMUPATCH(IDirectSoundBuffer_SetBufferData) pThis->X_lock.dwLockBytes2); } - //TODO: Current workaround method since dwBufferBytes do set to zero. Otherwise it will produce lock error message. - if (dwBufferBytes == 0) { - - return DS_OK; - } HRESULT hRet = DSERR_OUTOFMEMORY; DWORD dwStatus; @@ -765,6 +760,12 @@ xbox::hresult_xt WINAPI xbox::EMUPATCH(IDirectSoundBuffer_SetBufferData) pThis->EmuDirectSoundBuffer8->GetStatus(&dwStatus); } + //TODO: Current workaround method since dwBufferBytes do set to zero. Otherwise it will produce lock error message. + if (dwBufferBytes == 0) { + + return DS_OK; + } + // Allocate memory whenever made request internally if (pvBufferData == xbox::zeroptr && DSoundSGEMenAllocCheck(dwBufferBytes)) { diff --git a/src/core/hle/DSOUND/common/XbInternalDSVoice.cpp b/src/core/hle/DSOUND/common/XbInternalDSVoice.cpp index 0515f3aa0..08045768d 100644 --- a/src/core/hle/DSOUND/common/XbInternalDSVoice.cpp +++ b/src/core/hle/DSOUND/common/XbInternalDSVoice.cpp @@ -28,22 +28,26 @@ // Interface for get format template -void GetFormat_4034_lower(T& settings, xbox::audio_format& format) +xbox::audio_format GetFormat_4034_lower(T& settings) { - format.audio_codec = settings.p_audio_format->wfx.wFormatTag = format.audio_codec; + xbox::audio_format format; + format.audio_codec = settings.p_audio_format->wfx.wFormatTag; format.nChannels = settings.p_audio_format->wfx.nChannels; format.cbSize = settings.p_audio_format->wfx.cbSize; format.nSamplesPerSec = settings.p_audio_format->wfx.nSamplesPerSec; format.bitsPerSample = settings.p_audio_format->wfx.wBitsPerSample; + return format; } template -void GetFormat_4039_upper(T& settings, xbox::audio_format& format) +xbox::audio_format GetFormat_4039_upper(T& settings) { + xbox::audio_format format; format.audio_codec = settings.audio_codec; format.nChannels = settings.nChannels; format.cbSize = settings.cbSize; format.nSamplesPerSec = settings.nSamplesPerSec_default; format.bitsPerSample = settings.bitsPerSample; + return format; } // Interface for set format diff --git a/src/core/hle/DSOUND/common/XbInternalStruct.hpp b/src/core/hle/DSOUND/common/XbInternalStruct.hpp index 746d85811..bed3827c6 100644 --- a/src/core/hle/DSOUND/common/XbInternalStruct.hpp +++ b/src/core/hle/DSOUND/common/XbInternalStruct.hpp @@ -146,7 +146,7 @@ struct CDirectSoundVoice : CUnknownGenericManager { static_assert(sizeof(_settings) == 0x300); // Not really require // Generic interface without need to check xdk's build revision every time. - typedef void (*pGetFormat)(_settings& settings, audio_format& format); + typedef audio_format (*pGetFormat)(_settings& settings); typedef void (*pSetFormat)(_settings& settings, audio_format format); typedef uint32_t (*pGetUint32)(_settings& settings); typedef void (*pSetUint32)(_settings& settings, uint32_t value); @@ -165,8 +165,8 @@ struct CDirectSoundVoice : CUnknownGenericManager { } funcs; static_assert(sizeof(funcs) == 0x24); // Not really require - inline void GetFormat(audio_format& format) { - funcs.GetFormat(settings, format); + inline audio_format GetFormat() { + return funcs.GetFormat(settings); }; inline void SetFormat(audio_format format) { funcs.SetFormat(settings, format);