os/2: port from SDL2-2.0.4 to SDL2-2.0.5:

changes to SDL_os2audio.c, SDL_os2video.c, os2/SDL_systhread.c in order
to accomodate SDL2-2.0.5 changes.
- audio:  WaitDone() is gone, CloseDevice() interface changes.
- events / video:  DropFile() changes:
          SDL_DROPBEGIN and SDL_DROPCOMPLETE events, window IDs for drops.
- thread: struct SDL_Thread->stacksize
This commit is contained in:
Ozkan Sezer 2020-10-14 23:01:03 +03:00
parent 5f3f67b16b
commit 222f026899
3 changed files with 23 additions and 22 deletions

View File

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -209,13 +209,6 @@ static void OS2_PlayDevice(_THIS)
pAData->ulNextBuf = (pAData->ulNextBuf + 1) % pAData->cMixBuffers; pAData->ulNextBuf = (pAData->ulNextBuf + 1) % pAData->cMixBuffers;
} }
static void OS2_WaitDone(_THIS)
{
PSDL_PrivateAudioData pAData = (PSDL_PrivateAudioData)this->hidden;
DosWaitEventSem( pAData->hevBuf, 3000 );
}
static void OS2_CloseDevice(_THIS) static void OS2_CloseDevice(_THIS)
{ {
PSDL_PrivateAudioData pAData = (PSDL_PrivateAudioData)this->hidden; PSDL_PrivateAudioData pAData = (PSDL_PrivateAudioData)this->hidden;
@ -264,7 +257,6 @@ static void OS2_CloseDevice(_THIS)
DosCloseEventSem( pAData->hevBuf ); DosCloseEventSem( pAData->hevBuf );
SDL_free( pAData ); SDL_free( pAData );
this->hidden = NULL;
} }
static int OS2_OpenDevice(_THIS, void *handle, const char *devname, static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
@ -314,7 +306,6 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
if ( ulRC != MCIERR_SUCCESS ) if ( ulRC != MCIERR_SUCCESS )
{ {
stMCIAmpOpen.usDeviceID = (USHORT)~0; stMCIAmpOpen.usDeviceID = (USHORT)~0;
OS2_CloseDevice( this );
return _MCIError( "MCI_OPEN", ulRC ); return _MCIError( "MCI_OPEN", ulRC );
} }
pAData->usDeviceId = stMCIAmpOpen.usDeviceID; pAData->usDeviceId = stMCIAmpOpen.usDeviceID;
@ -338,7 +329,6 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
MCI_WAIT | MCI_SET_OFF | MCI_SET_ITEM, MCI_WAIT | MCI_SET_OFF | MCI_SET_ITEM,
&stMCIAmpSet, 0 ); &stMCIAmpSet, 0 );
// Set record volume. // Set record volume.
stMCIAmpSet.ulLevel = _getEnvULong( "SDL_AUDIO_RECVOL", 100, 90 ); stMCIAmpSet.ulLevel = _getEnvULong( "SDL_AUDIO_RECVOL", 100, 90 );
stMCIAmpSet.ulItem = MCI_AMP_SET_AUDIO; stMCIAmpSet.ulItem = MCI_AMP_SET_AUDIO;
@ -394,7 +384,6 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
if ( ulRC != MCIERR_SUCCESS ) if ( ulRC != MCIERR_SUCCESS )
{ {
pAData->stMCIMixSetup.ulBitsPerSample = 0; pAData->stMCIMixSetup.ulBitsPerSample = 0;
OS2_CloseDevice( this );
return _MCIError( "MCI_MIXSETUP", ulRC ); return _MCIError( "MCI_MIXSETUP", ulRC );
} }
@ -412,7 +401,6 @@ static int OS2_OpenDevice(_THIS, void *handle, const char *devname,
MCI_WAIT | MCI_ALLOCATE_MEMORY, &stMCIBuffer, 0 ); MCI_WAIT | MCI_ALLOCATE_MEMORY, &stMCIBuffer, 0 );
if ( ulRC != MCIERR_SUCCESS ) if ( ulRC != MCIERR_SUCCESS )
{ {
OS2_CloseDevice( this );
return _MCIError( "MCI_BUFFER", ulRC ); return _MCIError( "MCI_BUFFER", ulRC );
} }
pAData->cMixBuffers = stMCIBuffer.ulNumBuffers; pAData->cMixBuffers = stMCIBuffer.ulNumBuffers;
@ -452,11 +440,12 @@ static int OS2_Init(SDL_AudioDriverImpl * impl)
impl->OpenDevice = OS2_OpenDevice; impl->OpenDevice = OS2_OpenDevice;
impl->PlayDevice = OS2_PlayDevice; impl->PlayDevice = OS2_PlayDevice;
impl->WaitDevice = OS2_WaitDevice; impl->WaitDevice = OS2_WaitDevice;
impl->WaitDone = OS2_WaitDone;
impl->GetDeviceBuf = OS2_GetDeviceBuf; impl->GetDeviceBuf = OS2_GetDeviceBuf;
impl->CloseDevice = OS2_CloseDevice; impl->CloseDevice = OS2_CloseDevice;
// [Digi]: SDL 2.0 does not support recording yet (2016-02-24). // TODO: IMPLEMENT CAPTURE SUPPORT:
// impl->CaptureFromDevice = ;
// impl->FlushCapture = ;
// impl->HasCaptureSupport = SDL_TRUE; // impl->HasCaptureSupport = SDL_TRUE;
return 1; /* this audio target is available. */ return 1; /* this audio target is available. */

View File

@ -74,14 +74,24 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
if ( pThreadParms == NULL ) if ( pThreadParms == NULL )
return SDL_OutOfMemory(); return SDL_OutOfMemory();
// Save the function which we will have to call to clear the RTL of calling app! if (thread->stacksize == 0)
pThreadParms->pfnCurrentEndThread = pfnEndThread; thread->stacksize = 65536;
// Also save the real parameters we have to pass to thread function // Also save the real parameters we have to pass to thread function
pThreadParms->args = args; pThreadParms->args = args;
// Start the thread using the runtime library of calling app! if (pfnBeginThread) {
thread->handle = (SYS_ThreadHandle) // Save the function which we will have to call to clear the RTL of calling app!
( (size_t) pfnBeginThread( RunThread, NULL, 65535, pThreadParms ) ); pThreadParms->pfnCurrentEndThread = pfnEndThread;
// Start the thread using the runtime library of calling app!
thread->handle = (SYS_ThreadHandle)
pfnBeginThread( RunThread, NULL, thread->stacksize, pThreadParms );
}
else {
pThreadParms->pfnCurrentEndThread = _endthread;
thread->handle = (SYS_ThreadHandle)
_beginthread( RunThread, NULL, thread->stacksize, pThreadParms );
}
if ( thread->handle == -1 ) if ( thread->handle == -1 )
return SDL_SetError( "Not enough resources to create thread" ); return SDL_SetError( "Not enough resources to create thread" );

View File

@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@ -428,7 +428,7 @@ static MRESULT _wmDrop(PWINDATA pWinData, PDRAGINFO pDragInfo)
// Send to SDL full file name converted to UTF-8. // Send to SDL full file name converted to UTF-8.
pcFName = OS2_SysToUTF8( acFName ); pcFName = OS2_SysToUTF8( acFName );
SDL_SendDropFile( pcFName ); SDL_SendDropFile( pWinData->window, pcFName );
SDL_free( pcFName ); SDL_free( pcFName );
// Notify a source that a drag operation is complete. // Notify a source that a drag operation is complete.
@ -442,6 +442,8 @@ static MRESULT _wmDrop(PWINDATA pWinData, PDRAGINFO pDragInfo)
DrgDeleteDraginfoStrHandles( pDragInfo ); DrgDeleteDraginfoStrHandles( pDragInfo );
DrgFreeDraginfo( pDragInfo ); DrgFreeDraginfo( pDragInfo );
SDL_SendDropComplete( pWinData->window );
return (MRESULT)FALSE; return (MRESULT)FALSE;
} }