mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
port from 2.0.12 to 2.0.13 / current SDL-hg repository.
- video: VideoBootStrap->available() is gone. - thread: all important SDL_CreateThread internal data now put into struct SDL_Thread: changes to SDL_SYS_CreateThread().
This commit is contained in:
parent
5da796fe52
commit
54ced668c4
@ -40,57 +40,39 @@
|
|||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
|
||||||
|
|
||||||
typedef struct ThreadStartParms {
|
|
||||||
void *args;
|
|
||||||
pfnSDL_CurrentEndThread pfnCurrentEndThread;
|
|
||||||
} tThreadStartParms, *pThreadStartParms;
|
|
||||||
|
|
||||||
static void RunThread(void *data)
|
static void RunThread(void *data)
|
||||||
{
|
{
|
||||||
pThreadStartParms pThreadParms = (pThreadStartParms) data;
|
SDL_Thread *thread = (SDL_Thread *) data;
|
||||||
pfnSDL_CurrentEndThread pfnEndThread = pThreadParms->pfnCurrentEndThread;
|
pfnSDL_CurrentEndThread pfnEndThread = (pfnSDL_CurrentEndThread) thread->endfunc;
|
||||||
void *args = pThreadParms->args;
|
|
||||||
|
|
||||||
SDL_free( pThreadParms );
|
|
||||||
|
|
||||||
if ( ppSDLTLSData != NULL )
|
if ( ppSDLTLSData != NULL )
|
||||||
*ppSDLTLSData = NULL;
|
*ppSDLTLSData = NULL;
|
||||||
|
|
||||||
SDL_RunThread( args );
|
SDL_RunThread( thread );
|
||||||
|
|
||||||
if ( pfnEndThread != NULL )
|
if ( pfnEndThread != NULL )
|
||||||
pfnEndThread();
|
pfnEndThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
|
SDL_SYS_CreateThread(SDL_Thread * thread,
|
||||||
pfnSDL_CurrentBeginThread pfnBeginThread,
|
pfnSDL_CurrentBeginThread pfnBeginThread,
|
||||||
pfnSDL_CurrentEndThread pfnEndThread)
|
pfnSDL_CurrentEndThread pfnEndThread)
|
||||||
{
|
{
|
||||||
pThreadStartParms pThreadParms = SDL_malloc( sizeof(tThreadStartParms) );
|
|
||||||
|
|
||||||
if ( pThreadParms == NULL )
|
|
||||||
return SDL_OutOfMemory();
|
|
||||||
|
|
||||||
if (thread->stacksize == 0)
|
if (thread->stacksize == 0)
|
||||||
thread->stacksize = 65536;
|
thread->stacksize = 65536;
|
||||||
|
|
||||||
// Also save the real parameters we have to pass to thread function
|
|
||||||
pThreadParms->args = args;
|
|
||||||
|
|
||||||
if (pfnBeginThread) {
|
if (pfnBeginThread) {
|
||||||
// Save the function which we will have to call to clear the RTL of calling app!
|
// Save the function which we will have to call to clear the RTL of calling app!
|
||||||
pThreadParms->pfnCurrentEndThread = pfnEndThread;
|
thread->endfunc = pfnEndThread;
|
||||||
// Start the thread using the runtime library of calling app!
|
// Start the thread using the runtime library of calling app!
|
||||||
thread->handle = (SYS_ThreadHandle)
|
thread->handle = (SYS_ThreadHandle)
|
||||||
pfnBeginThread( RunThread, NULL, thread->stacksize, pThreadParms );
|
pfnBeginThread( RunThread, NULL, thread->stacksize, thread );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pThreadParms->pfnCurrentEndThread = _endthread;
|
thread->endfunc = _endthread;
|
||||||
thread->handle = (SYS_ThreadHandle)
|
thread->handle = (SYS_ThreadHandle)
|
||||||
_beginthread( RunThread, NULL, thread->stacksize, pThreadParms );
|
_beginthread( RunThread, NULL, thread->stacksize, thread );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( thread->handle == -1 )
|
if ( thread->handle == -1 )
|
||||||
|
@ -1599,7 +1599,7 @@ static int OS2_VideoInit(_THIS)
|
|||||||
stSDLDisplayMode.driverdata = pDisplayData;
|
stSDLDisplayMode.driverdata = pDisplayData;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_AddVideoDisplay( &stSDLDisplay );
|
SDL_AddVideoDisplay( &stSDLDisplay, SDL_FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
OS2_InitMouse( _this, pVData->hab );
|
OS2_InitMouse( _this, pVData->hab );
|
||||||
@ -1705,7 +1705,7 @@ static SDL_VideoDevice *OS2_CreateDevice(int devindex)
|
|||||||
if (!device)
|
if (!device)
|
||||||
{
|
{
|
||||||
SDL_OutOfMemory();
|
SDL_OutOfMemory();
|
||||||
return (0);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function pointers */
|
/* Set the function pointers */
|
||||||
@ -1753,21 +1753,22 @@ static SDL_VideoDevice *OS2_CreateDevice(int devindex)
|
|||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SDL_VideoDevice *OS2DIVE_CreateDevice(int devindex)
|
||||||
// Output video system availability checking.
|
|
||||||
|
|
||||||
static int OS2DIVE_Available(void)
|
|
||||||
{
|
{
|
||||||
VIDEOOUTPUTINFO stVOInfo;
|
VIDEOOUTPUTINFO stVOInfo;
|
||||||
|
if (!voDive.QueryInfo(&stVOInfo)) {
|
||||||
return voDive.QueryInfo( &stVOInfo );
|
return NULL;
|
||||||
|
}
|
||||||
|
return OS2_CreateDevice(devindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int OS2VMAN_Available(void)
|
static SDL_VideoDevice *OS2VMAN_CreateDevice(int devindex)
|
||||||
{
|
{
|
||||||
VIDEOOUTPUTINFO stVOInfo;
|
VIDEOOUTPUTINFO stVOInfo;
|
||||||
|
if (!voVMan.QueryInfo(&stVOInfo)) {
|
||||||
return voVMan.QueryInfo( &stVOInfo );
|
return NULL;
|
||||||
|
}
|
||||||
|
return OS2_CreateDevice(devindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1777,13 +1778,13 @@ static int OS2VMAN_Available(void)
|
|||||||
VideoBootStrap OS2DIVE_bootstrap =
|
VideoBootStrap OS2DIVE_bootstrap =
|
||||||
{
|
{
|
||||||
OS2DRIVER_NAME_DIVE, "OS/2 video driver",
|
OS2DRIVER_NAME_DIVE, "OS/2 video driver",
|
||||||
OS2DIVE_Available, OS2_CreateDevice
|
OS2DIVE_CreateDevice
|
||||||
};
|
};
|
||||||
|
|
||||||
VideoBootStrap OS2VMAN_bootstrap =
|
VideoBootStrap OS2VMAN_bootstrap =
|
||||||
{
|
{
|
||||||
OS2DRIVER_NAME_VMAN, "OS/2 video driver",
|
OS2DRIVER_NAME_VMAN, "OS/2 video driver",
|
||||||
OS2VMAN_Available, OS2_CreateDevice
|
OS2VMAN_CreateDevice
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SDL_VIDEO_DRIVER_OS2 */
|
#endif /* SDL_VIDEO_DRIVER_OS2 */
|
||||||
|
Loading…
Reference in New Issue
Block a user