Merge pull request #1636 from Azimer/AziAudio-Reintegration

Windows XP Fixes
This commit is contained in:
zilmar 2019-08-01 15:03:36 +09:30 committed by GitHub
commit 07033b4837
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -112,7 +112,7 @@ uint32_t SoundDriverBase::AI_ReadLength()
void SoundDriverBase::LoadAiBuffer(uint8_t *start, uint32_t length) 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; uint8_t *ptrStart = start != NULL ? start : nullBuff;
uint32_t writePtr = 0, bytesToMove = length; uint32_t writePtr = 0, bytesToMove = length;

View File

@ -346,6 +346,8 @@ CScriptInstance::AddListener(HANDLE fd, IOEVENTTYPE evt, void* callback, void* d
void CScriptInstance::RemoveListenerByIndex(UINT index) void CScriptInstance::RemoveListenerByIndex(UINT index)
{ {
typedef BOOL (__stdcall *Dynamic_CancelIoEx)(HANDLE, LPOVERLAPPED);
Dynamic_CancelIoEx _CancelIoEx;
IOLISTENER* lpListener = m_Listeners[index]; IOLISTENER* lpListener = m_Listeners[index];
if (lpListener->data != NULL) if (lpListener->data != NULL)
@ -353,7 +355,16 @@ void CScriptInstance::RemoveListenerByIndex(UINT index)
free(lpListener->data); 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); free(lpListener);