diff --git a/src/CxbxKrnl/EmuDSound.cpp b/src/CxbxKrnl/EmuDSound.cpp index b63dfb165..4adc1e1fb 100755 --- a/src/CxbxKrnl/EmuDSound.cpp +++ b/src/CxbxKrnl/EmuDSound.cpp @@ -821,14 +821,14 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateBuffer) // TODO: Garbage Collection *ppBuffer = new X_CDirectSoundBuffer(); - (*ppBuffer)->EmuDirectSoundBuffer8 = 0; - (*ppBuffer)->EmuDirectSound3DBuffer8 = 0; - (*ppBuffer)->EmuBuffer = 0; + (*ppBuffer)->EmuDirectSoundBuffer8 = nullptr; + (*ppBuffer)->EmuDirectSound3DBuffer8 = nullptr; + (*ppBuffer)->EmuBuffer = xbnullptr; (*ppBuffer)->EmuBufferDesc = pDSBufferDesc; (*ppBuffer)->EmuLockOffset = 0; - (*ppBuffer)->EmuLockPtr1 = 0; + (*ppBuffer)->EmuLockPtr1 = xbnullptr; (*ppBuffer)->EmuLockBytes1 = 0; - (*ppBuffer)->EmuLockPtr2 = 0; + (*ppBuffer)->EmuLockPtr2 = xbnullptr; (*ppBuffer)->EmuLockBytes2 = 0; (*ppBuffer)->EmuFlags = dwEmuFlags; @@ -840,7 +840,7 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateBuffer) if (hRet != DS_OK) { CxbxKrnlCleanup("CreateSoundBuffer Failed!"); - (*ppBuffer)->EmuDirectSoundBuffer8 = NULL; + (*ppBuffer)->EmuDirectSoundBuffer8 = nullptr; } else { hRet = pTempBuffer->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID*)&((*ppBuffer)->EmuDirectSoundBuffer8)); pTempBuffer->Release(); @@ -853,7 +853,7 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateBuffer) HRESULT hRet3D = (*ppBuffer)->EmuDirectSoundBuffer8->QueryInterface(IID_IDirectSound3DBuffer8, (LPVOID*)&((*ppBuffer)->EmuDirectSound3DBuffer8)); if (hRet3D != DS_OK) { EmuWarning("CreateSound3DBuffer8 Failed!"); - (*ppBuffer)->EmuDirectSound3DBuffer8 = NULL; + (*ppBuffer)->EmuDirectSound3DBuffer8 = nullptr; } } @@ -1462,13 +1462,13 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateStream) GeneratePCMFormat(pDSBufferDesc, pdssd->lpwfxFormat, dwEmuFlags); - (*ppStream)->EmuDirectSoundBuffer8 = 0; - (*ppStream)->EmuDirectSound3DBuffer8 = 0; - (*ppStream)->EmuBuffer = 0; + (*ppStream)->EmuDirectSoundBuffer8 = nullptr; + (*ppStream)->EmuDirectSound3DBuffer8 = nullptr; + (*ppStream)->EmuBuffer = xbnullptr; (*ppStream)->EmuBufferDesc = pDSBufferDesc; - (*ppStream)->EmuLockPtr1 = 0; + (*ppStream)->EmuLockPtr1 = xbnullptr; (*ppStream)->EmuLockBytes1 = 0; - (*ppStream)->EmuLockPtr2 = 0; + (*ppStream)->EmuLockPtr2 = xbnullptr; (*ppStream)->EmuLockBytes2 = 0; (*ppStream)->EmuFlags = dwEmuFlags; (*ppStream)->EmuPlayFlags = DSBPLAY_LOOPING; @@ -1481,7 +1481,7 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateStream) if (hRet != DS_OK) { CxbxKrnlCleanup("CreateSoundBuffer Failed!"); - (*ppStream)->EmuDirectSoundBuffer8 = NULL; + (*ppStream)->EmuDirectSoundBuffer8 = nullptr; } else { hRet = pTempBuffer->QueryInterface(IID_IDirectSoundBuffer8, (LPVOID*)&((*ppStream)->EmuDirectSoundBuffer8)); pTempBuffer->Release(); @@ -1498,7 +1498,7 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateStream) HRESULT hRet3D = (*ppStream)->EmuDirectSoundBuffer8->QueryInterface(IID_IDirectSound3DBuffer8, (LPVOID*)&((*ppStream)->EmuDirectSound3DBuffer8)); if (hRet3D != DS_OK) { EmuWarning("CreateSound3DBuffer Failed!"); - (*ppStream)->EmuDirectSound3DBuffer8 = NULL; + (*ppStream)->EmuDirectSound3DBuffer8 = nullptr; } } } diff --git a/src/CxbxKrnl/EmuDSoundInline.hpp b/src/CxbxKrnl/EmuDSoundInline.hpp index e5c393886..e809f8ab8 100644 --- a/src/CxbxKrnl/EmuDSoundInline.hpp +++ b/src/CxbxKrnl/EmuDSoundInline.hpp @@ -82,7 +82,7 @@ void DSoundBufferXboxAdpcmDecoder( // Allocate some temp buffers uint8_t* buffer1 = (uint8_t*)malloc(dwDecodedAudioBytes); - uint8_t* buffer2 = NULL; + uint8_t* buffer2 = nullptr; if (dwAudioBytes2 != 0) { buffer2 = (uint8_t*)malloc(dwDecodedAudioBytes2); @@ -94,7 +94,7 @@ void DSoundBufferXboxAdpcmDecoder( TXboxAdpcmDecoder_Decode_Memory((uint8_t*)pAudioPtr2, dwAudioBytes2, &buffer2[0], pDSBufferDesc->lpwfxFormat->nChannels); } // Lock this Xbox ADPCM buffer - void* pPtrX = NULL, *pPtrX2 = NULL; + void* pPtrX = xbnullptr, *pPtrX2 = xbnullptr; DWORD dwBytesX = 0, dwBytesX2 = 0; HRESULT hr = DS_OK; @@ -109,7 +109,7 @@ void DSoundBufferXboxAdpcmDecoder( if (dwDecodedAudioBytes > dwBytesX) dwDecodedAudioBytes = dwBytesX; memcpy(pPtrX, buffer1, dwDecodedAudioBytes); - if (pPtrX2 != NULL) { + if (pPtrX2 != xbnullptr) { if (dwDecodedAudioBytes2 > dwBytesX2) dwDecodedAudioBytes2 = dwBytesX2; memcpy(pPtrX2, buffer2, dwDecodedAudioBytes2); } @@ -121,7 +121,7 @@ void DSoundBufferXboxAdpcmDecoder( if (dwDecodedAudioBytes > dwAudioBytes) dwDecodedAudioBytes = dwAudioBytes; memcpy(pAudioPtr, buffer1, dwDecodedAudioBytes); - if (pAudioPtr2 != NULL) { + if (pAudioPtr2 != xbnullptr) { if (dwDecodedAudioBytes2 > dwAudioBytes2) dwDecodedAudioBytes2 = dwAudioBytes2; memcpy(pAudioPtr2, buffer2, dwDecodedAudioBytes2); } @@ -219,7 +219,7 @@ inline void GeneratePCMFormat( } pDSBufferDesc->dwReserved = 0; - if (lpwfxFormat != NULL) { + if (lpwfxFormat != xbnullptr) { //TODO: RadWolfie - Need implement support for WAVEFORMATEXTENSIBLE as stated in CDirectSoundStream_SetFormat function note below // Do we need to convert it? Or just only do the WAVEFORMATEX only? @@ -260,7 +260,7 @@ inline void GeneratePCMFormat( bIsSpecial = true; dwEmuFlags |= DSB_FLAG_RECIEVEDATA; - EmuWarning("Creating dummy WAVEFORMATEX (pdsbd->lpwfxFormat = NULL)..."); + EmuWarning("Creating dummy WAVEFORMATEX (pdsbd->lpwfxFormat = xbnullptr)..."); // HACK: This is a special sound buffer, create dummy WAVEFORMATEX data. // It's supposed to recieve data rather than generate it. Buffers created @@ -313,7 +313,7 @@ inline void GeneratePCMFormat( } //TODO: is this needed? - if (pDSBufferDesc->lpwfxFormat != NULL) { + if (pDSBufferDesc->lpwfxFormat != nullptr) { // we only support 2 channels right now if (pDSBufferDesc->lpwfxFormat->nChannels > 2) { pDSBufferDesc->lpwfxFormat->nChannels = 2;