diff --git a/Source/Project64-audio/Driver/SoundBase.cpp b/Source/Project64-audio/Driver/SoundBase.cpp index ad6f31c0c..fcc722c96 100644 --- a/Source/Project64-audio/Driver/SoundBase.cpp +++ b/Source/Project64-audio/Driver/SoundBase.cpp @@ -112,7 +112,7 @@ uint32_t SoundDriverBase::AI_ReadLength() void SoundDriverBase::LoadAiBuffer(uint8_t *start, uint32_t length) { - uint8_t nullBuff[MAX_SIZE]; + static uint8_t nullBuff[MAX_SIZE]; uint8_t *ptrStart = start != NULL ? start : nullBuff; uint32_t writePtr = 0, bytesToMove = length; diff --git a/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp b/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp index 1cefdacbc..5e9dd0ffc 100644 --- a/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp +++ b/Source/Project64/UserInterface/Debugger/ScriptInstance.cpp @@ -346,6 +346,8 @@ CScriptInstance::AddListener(HANDLE fd, IOEVENTTYPE evt, void* callback, void* d void CScriptInstance::RemoveListenerByIndex(UINT index) { + typedef BOOL (__stdcall *Dynamic_CancelIoEx)(HANDLE, LPOVERLAPPED); + Dynamic_CancelIoEx _CancelIoEx; IOLISTENER* lpListener = m_Listeners[index]; if (lpListener->data != NULL) @@ -353,7 +355,16 @@ void CScriptInstance::RemoveListenerByIndex(UINT index) free(lpListener->data); } - CancelIoEx(lpListener->fd, (LPOVERLAPPED)lpListener); + HMODULE hKernel = LoadLibrary("Kernel32.dll"); + _CancelIoEx = (Dynamic_CancelIoEx)GetProcAddress(hKernel, "CancelIoEx"); + + //CancelIoEx(lpListener->fd, (LPOVERLAPPED)lpListener); + if (_CancelIoEx != NULL) + _CancelIoEx(lpListener->fd, (LPOVERLAPPED)lpListener); + else + // This isn't a good replacement and the script aspects of the debugger shouldn't + // be used in WindowsXP + CancelIo(lpListener->fd); free(lpListener);