removed os2 support & support for building SDL with watcom.

This commit is contained in:
Ozkan Sezer
2022-11-22 19:18:47 +03:00
parent 01d137592c
commit 8d6fda4810
79 changed files with 3 additions and 10017 deletions

View File

@@ -22,17 +22,9 @@
#if defined(__WIN32__) || defined(__GDK__)
#include "core/windows/SDL_windows.h"
#elif defined(__OS2__)
#include <stdlib.h> /* _exit() */
#elif !defined(__WINRT__)
#include <unistd.h> /* _exit(), etc. */
#endif
#if defined(__OS2__)
#include "core/os2/SDL_os2.h"
#if SDL_THREAD_OS2
#include "thread/os2/SDL_systls_c.h"
#endif
#endif
/* this checks for HAVE_DBUS_DBUS_H internally. */
#include "core/linux/SDL_dbus.h"
@@ -198,10 +190,6 @@ SDL_InitSubSystem(Uint32 flags)
flags |= SDL_INIT_EVENTS;
}
#if SDL_THREAD_OS2
SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */
#endif
#if SDL_VIDEO_DRIVER_WINDOWS
if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
if (SDL_HelperWindowCreate() < 0) {
@@ -359,13 +347,6 @@ SDL_Init(Uint32 flags)
void
SDL_QuitSubSystem(Uint32 flags)
{
#if defined(__OS2__)
#if SDL_THREAD_OS2
SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */
#endif
SDL_OS2Quit();
#endif
/* Shut down requested initialized subsystems */
#if !SDL_SENSOR_DISABLED
if ((flags & SDL_INIT_SENSOR)) {

View File

@@ -120,9 +120,6 @@ static const AudioBootStrap *const bootstrap[] = {
#if SDL_AUDIO_DRIVER_OSS
&DSP_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_OS2
&OS2AUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_DISK
&DISKAUDIO_bootstrap,
#endif

View File

@@ -211,7 +211,6 @@ extern AudioBootStrap PSPAUDIO_bootstrap;
extern AudioBootStrap VITAAUD_bootstrap;
extern AudioBootStrap N3DSAUDIO_bootstrap;
extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap;
extern AudioBootStrap OS2AUDIO_bootstrap;
#endif /* SDL_sysaudio_h_ */

View File

@@ -1,450 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_AUDIO_DRIVER_OS2
/* Allow access to a raw mixing buffer */
#include "../../core/os2/SDL_os2.h"
#include "SDL_audio.h"
#include "../SDL_audio_c.h"
#include "SDL_os2audio.h"
/*
void lockIncr(volatile int *piVal);
#pragma aux lockIncr = \
"lock add [eax], 1 "\
parm [eax];
void lockDecr(volatile int *piVal);
#pragma aux lockDecr = \
"lock sub [eax], 1 "\
parm [eax];
*/
static ULONG _getEnvULong(const char *name, ULONG ulMax, ULONG ulDefault)
{
ULONG ulValue;
char* end;
char* envval = SDL_getenv(name);
if (envval == NULL)
return ulDefault;
ulValue = SDL_strtoul(envval, &end, 10);
return (end == envval) || (ulValue > ulMax)? ulDefault : ulMax;
}
static int _MCIError(const char *func, ULONG ulResult)
{
CHAR acBuf[128];
mciGetErrorString(ulResult, acBuf, sizeof(acBuf));
return SDL_SetError("[%s] %s", func, acBuf);
}
static void _mixIOError(const char *function, ULONG ulRC)
{
debug_os2("%s() - failed, rc = 0x%X (%s)",
function, ulRC,
(ulRC == MCIERR_INVALID_MODE) ? "Mixer mode does not match request" :
(ulRC == MCIERR_INVALID_BUFFER) ? "Caller sent an invalid buffer" : "unknown");
}
static LONG APIENTRY cbAudioWriteEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer,
ULONG ulFlags)
{
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm;
ULONG ulRC;
if (ulFlags != MIX_WRITE_COMPLETE) {
debug_os2("flags = 0x%X", ulFlags);
return 0;
}
/*lockDecr((int *)&pAData->ulQueuedBuf);*/
ulRC = DosPostEventSem(pAData->hevBuf);
if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) {
debug_os2("DosPostEventSem(), rc = %u", ulRC);
}
return 1; /* return value doesn't seem to matter. */
}
static LONG APIENTRY cbAudioReadEvent(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer,
ULONG ulFlags)
{
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)pBuffer->ulUserParm;
ULONG ulRC;
if (ulFlags != MIX_READ_COMPLETE) {
debug_os2("flags = 0x%X", ulFlags);
return 0;
}
pAData->stMCIMixSetup.pmixRead(pAData->stMCIMixSetup.ulMixHandle, pBuffer, 1);
ulRC = DosPostEventSem(pAData->hevBuf);
if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) {
debug_os2("DosPostEventSem(), rc = %u", ulRC);
}
return 1;
}
static void OS2_DetectDevices(void)
{
MCI_SYSINFO_PARMS stMCISysInfo;
CHAR acBuf[256];
ULONG ulDevicesNum;
MCI_SYSINFO_LOGDEVICE stLogDevice;
MCI_SYSINFO_PARMS stSysInfoParams;
ULONG ulRC;
ULONG ulHandle = 0;
acBuf[0] = '\0';
stMCISysInfo.pszReturn = acBuf;
stMCISysInfo.ulRetSize = sizeof(acBuf);
stMCISysInfo.usDeviceType = MCI_DEVTYPE_AUDIO_AMPMIX;
ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_QUANTITY,
&stMCISysInfo, 0);
if (ulRC != NO_ERROR) {
debug_os2("MCI_SYSINFO, MCI_SYSINFO_QUANTITY - failed, rc = 0x%X", ulRC);
return;
}
ulDevicesNum = SDL_strtoul(stMCISysInfo.pszReturn, NULL, 10);
for (stSysInfoParams.ulNumber = 0; stSysInfoParams.ulNumber < ulDevicesNum;
stSysInfoParams.ulNumber++) {
/* Get device install name. */
stSysInfoParams.pszReturn = acBuf;
stSysInfoParams.ulRetSize = sizeof(acBuf);
stSysInfoParams.usDeviceType = MCI_DEVTYPE_AUDIO_AMPMIX;
ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_INSTALLNAME,
&stSysInfoParams, 0);
if (ulRC != NO_ERROR) {
debug_os2("MCI_SYSINFO, MCI_SYSINFO_INSTALLNAME - failed, rc = 0x%X", ulRC);
continue;
}
/* Get textual product description. */
stSysInfoParams.ulItem = MCI_SYSINFO_QUERY_DRIVER;
stSysInfoParams.pSysInfoParm = &stLogDevice;
SDL_strlcpy(stLogDevice.szInstallName, stSysInfoParams.pszReturn, MAX_DEVICE_NAME);
ulRC = mciSendCommand(0, MCI_SYSINFO, MCI_WAIT | MCI_SYSINFO_ITEM,
&stSysInfoParams, 0);
if (ulRC != NO_ERROR) {
debug_os2("MCI_SYSINFO, MCI_SYSINFO_ITEM - failed, rc = 0x%X", ulRC);
continue;
}
ulHandle++;
SDL_AddAudioDevice(0, stLogDevice.szProductInfo, NULL, (void *)(ulHandle));
ulHandle++;
SDL_AddAudioDevice(1, stLogDevice.szProductInfo, NULL, (void *)(ulHandle));
}
}
static void OS2_WaitDevice(_THIS)
{
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden;
ULONG ulRC;
/* Wait for an audio chunk to finish */
ulRC = DosWaitEventSem(pAData->hevBuf, 5000);
if (ulRC != NO_ERROR) {
debug_os2("DosWaitEventSem(), rc = %u", ulRC);
}
}
static Uint8 *OS2_GetDeviceBuf(_THIS)
{
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden;
return (Uint8 *) pAData->aMixBuffers[pAData->ulNextBuf].pBuffer;
}
static void OS2_PlayDevice(_THIS)
{
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden;
ULONG ulRC;
PMCI_MIX_BUFFER pMixBuffer = &pAData->aMixBuffers[pAData->ulNextBuf];
/* Queue it up */
/*lockIncr((int *)&pAData->ulQueuedBuf);*/
ulRC = pAData->stMCIMixSetup.pmixWrite(pAData->stMCIMixSetup.ulMixHandle,
pMixBuffer, 1);
if (ulRC != MCIERR_SUCCESS) {
_mixIOError("pmixWrite", ulRC);
} else {
pAData->ulNextBuf = (pAData->ulNextBuf + 1) % pAData->cMixBuffers;
}
}
static void OS2_CloseDevice(_THIS)
{
SDL_PrivateAudioData *pAData = (SDL_PrivateAudioData *)_this->hidden;
MCI_GENERIC_PARMS sMCIGenericParms;
ULONG ulRC;
if (pAData == NULL)
return;
/* Close up audio */
if (pAData->usDeviceId != (USHORT)~0) { /* Device is open. */
if (pAData->stMCIMixSetup.ulBitsPerSample != 0) { /* Mixer was initialized. */
ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP,
MCI_WAIT | MCI_MIXSETUP_DEINIT,
&pAData->stMCIMixSetup, 0);
if (ulRC != MCIERR_SUCCESS) {
debug_os2("MCI_MIXSETUP, MCI_MIXSETUP_DEINIT - failed");
}
}
if (pAData->cMixBuffers != 0) { /* Buffers was allocated. */
MCI_BUFFER_PARMS stMCIBuffer;
stMCIBuffer.ulBufferSize = pAData->aMixBuffers[0].ulBufferLength;
stMCIBuffer.ulNumBuffers = pAData->cMixBuffers;
stMCIBuffer.pBufList = pAData->aMixBuffers;
ulRC = mciSendCommand(pAData->usDeviceId, MCI_BUFFER,
MCI_WAIT | MCI_DEALLOCATE_MEMORY, &stMCIBuffer, 0);
if (ulRC != MCIERR_SUCCESS) {
debug_os2("MCI_BUFFER, MCI_DEALLOCATE_MEMORY - failed");
}
}
ulRC = mciSendCommand(pAData->usDeviceId, MCI_CLOSE, MCI_WAIT,
&sMCIGenericParms, 0);
if (ulRC != MCIERR_SUCCESS) {
debug_os2("MCI_CLOSE - failed");
}
}
if (pAData->hevBuf != NULLHANDLE)
DosCloseEventSem(pAData->hevBuf);
SDL_free(pAData);
}
static int OS2_OpenDevice(_THIS, const char *devname)
{
SDL_PrivateAudioData *pAData;
SDL_AudioFormat test_format;
MCI_AMP_OPEN_PARMS stMCIAmpOpen;
MCI_BUFFER_PARMS stMCIBuffer;
ULONG ulRC;
ULONG ulIdx;
BOOL new_freq;
SDL_bool iscapture = _this->iscapture;
new_freq = FALSE;
SDL_zero(stMCIAmpOpen);
SDL_zero(stMCIBuffer);
for (test_format = SDL_FirstAudioFormat(_this->spec.format); test_format; test_format = SDL_NextAudioFormat()) {
if (test_format == AUDIO_U8 || test_format == AUDIO_S16)
break;
}
if (!test_format) {
debug_os2("Unsupported audio format, AUDIO_S16 used");
test_format = AUDIO_S16;
}
pAData = (SDL_PrivateAudioData *) SDL_calloc(1, sizeof(struct SDL_PrivateAudioData));
if (pAData == NULL)
return SDL_OutOfMemory();
_this->hidden = pAData;
ulRC = DosCreateEventSem(NULL, &pAData->hevBuf, DCE_AUTORESET, TRUE);
if (ulRC != NO_ERROR) {
debug_os2("DosCreateEventSem() failed, rc = %u", ulRC);
return -1;
}
/* Open audio device */
stMCIAmpOpen.usDeviceID = (_this->handle != NULL) ? ((ULONG)_this->handle - 1) : 0;
stMCIAmpOpen.pszDeviceType = (PSZ)MCI_DEVTYPE_AUDIO_AMPMIX;
ulRC = mciSendCommand(0, MCI_OPEN,
(_getEnvULong("SDL_AUDIO_SHARE", 1, 0) != 0)?
MCI_WAIT | MCI_OPEN_TYPE_ID | MCI_OPEN_SHAREABLE :
MCI_WAIT | MCI_OPEN_TYPE_ID,
&stMCIAmpOpen, 0);
if (ulRC != MCIERR_SUCCESS) {
stMCIAmpOpen.usDeviceID = (USHORT)~0;
return _MCIError("MCI_OPEN", ulRC);
}
pAData->usDeviceId = stMCIAmpOpen.usDeviceID;
if (iscapture) {
MCI_CONNECTOR_PARMS stMCIConnector;
MCI_AMP_SET_PARMS stMCIAmpSet;
BOOL fLineIn = _getEnvULong("SDL_AUDIO_LINEIN", 1, 0);
/* Set particular connector. */
SDL_zero(stMCIConnector);
stMCIConnector.ulConnectorType = (fLineIn)? MCI_LINE_IN_CONNECTOR :
MCI_MICROPHONE_CONNECTOR;
mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_CONNECTOR,
MCI_WAIT | MCI_ENABLE_CONNECTOR |
MCI_CONNECTOR_TYPE, &stMCIConnector, 0);
/* Disable monitor. */
SDL_zero(stMCIAmpSet);
stMCIAmpSet.ulItem = MCI_AMP_SET_MONITOR;
mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_SET,
MCI_WAIT | MCI_SET_OFF | MCI_SET_ITEM,
&stMCIAmpSet, 0);
/* Set record volume. */
stMCIAmpSet.ulLevel = _getEnvULong("SDL_AUDIO_RECVOL", 100, 90);
stMCIAmpSet.ulItem = MCI_AMP_SET_AUDIO;
stMCIAmpSet.ulAudio = MCI_SET_AUDIO_ALL; /* Both cnannels. */
stMCIAmpSet.ulValue = (fLineIn) ? MCI_LINE_IN_CONNECTOR :
MCI_MICROPHONE_CONNECTOR ;
mciSendCommand(stMCIAmpOpen.usDeviceID, MCI_SET,
MCI_WAIT | MCI_SET_AUDIO | MCI_AMP_SET_GAIN,
&stMCIAmpSet, 0);
}
_this->spec.format = test_format;
_this->spec.channels = _this->spec.channels > 1 ? 2 : 1;
if (_this->spec.freq < 8000) {
_this->spec.freq = 8000;
new_freq = TRUE;
} else if (_this->spec.freq > 48000) {
_this->spec.freq = 48000;
new_freq = TRUE;
}
/* Setup mixer. */
pAData->stMCIMixSetup.ulFormatTag = MCI_WAVE_FORMAT_PCM;
pAData->stMCIMixSetup.ulBitsPerSample = SDL_AUDIO_BITSIZE(test_format);
pAData->stMCIMixSetup.ulSamplesPerSec = _this->spec.freq;
pAData->stMCIMixSetup.ulChannels = _this->spec.channels;
pAData->stMCIMixSetup.ulDeviceType = MCI_DEVTYPE_WAVEFORM_AUDIO;
if (!iscapture) {
pAData->stMCIMixSetup.ulFormatMode= MCI_PLAY;
pAData->stMCIMixSetup.pmixEvent = cbAudioWriteEvent;
} else {
pAData->stMCIMixSetup.ulFormatMode= MCI_RECORD;
pAData->stMCIMixSetup.pmixEvent = cbAudioReadEvent;
}
ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP,
MCI_WAIT | MCI_MIXSETUP_INIT, &pAData->stMCIMixSetup, 0);
if (ulRC != MCIERR_SUCCESS && _this->spec.freq > 44100) {
new_freq = TRUE;
pAData->stMCIMixSetup.ulSamplesPerSec = 44100;
_this->spec.freq = 44100;
ulRC = mciSendCommand(pAData->usDeviceId, MCI_MIXSETUP,
MCI_WAIT | MCI_MIXSETUP_INIT, &pAData->stMCIMixSetup, 0);
}
debug_os2("Setup mixer [BPS: %u, Freq.: %u, Channels: %u]: %s",
pAData->stMCIMixSetup.ulBitsPerSample,
pAData->stMCIMixSetup.ulSamplesPerSec,
pAData->stMCIMixSetup.ulChannels,
(ulRC == MCIERR_SUCCESS)? "SUCCESS" : "FAIL");
if (ulRC != MCIERR_SUCCESS) {
pAData->stMCIMixSetup.ulBitsPerSample = 0;
return _MCIError("MCI_MIXSETUP", ulRC);
}
if (_this->spec.samples == 0 || new_freq == TRUE) {
/* also see SDL_audio.c:prepare_audiospec() */
/* Pick a default of ~46 ms at desired frequency */
Uint32 samples = (_this->spec.freq / 1000) * 46;
Uint32 power2 = 1;
while (power2 < samples) {
power2 <<= 1;
}
_this->spec.samples = power2;
}
/* Update the fragment size as size in bytes */
SDL_CalculateAudioSpec(&_this->spec);
/* Allocate memory buffers */
stMCIBuffer.ulBufferSize = _this->spec.size;/* (_this->spec.freq / 1000) * 100 */
stMCIBuffer.ulNumBuffers = NUM_BUFFERS;
stMCIBuffer.pBufList = pAData->aMixBuffers;
ulRC = mciSendCommand(pAData->usDeviceId, MCI_BUFFER,
MCI_WAIT | MCI_ALLOCATE_MEMORY, &stMCIBuffer, 0);
if (ulRC != MCIERR_SUCCESS) {
return _MCIError("MCI_BUFFER", ulRC);
}
pAData->cMixBuffers = stMCIBuffer.ulNumBuffers;
_this->spec.size = stMCIBuffer.ulBufferSize;
/* Fill all device buffers with data */
for (ulIdx = 0; ulIdx < stMCIBuffer.ulNumBuffers; ulIdx++) {
pAData->aMixBuffers[ulIdx].ulFlags = 0;
pAData->aMixBuffers[ulIdx].ulBufferLength = stMCIBuffer.ulBufferSize;
pAData->aMixBuffers[ulIdx].ulUserParm = (ULONG)pAData;
SDL_memset(((PMCI_MIX_BUFFER)stMCIBuffer.pBufList)[ulIdx].pBuffer,
_this->spec.silence, stMCIBuffer.ulBufferSize);
}
/* Write buffers to kick off the amp mixer */
ulRC = pAData->stMCIMixSetup.pmixWrite(pAData->stMCIMixSetup.ulMixHandle,
pAData->aMixBuffers, 1);
if (ulRC != MCIERR_SUCCESS) {
_mixIOError("pmixWrite", ulRC);
return -1;
}
return 0;
}
static SDL_bool OS2_Init(SDL_AudioDriverImpl * impl)
{
/* Set the function pointers */
impl->DetectDevices = OS2_DetectDevices;
impl->OpenDevice = OS2_OpenDevice;
impl->PlayDevice = OS2_PlayDevice;
impl->WaitDevice = OS2_WaitDevice;
impl->GetDeviceBuf = OS2_GetDeviceBuf;
impl->CloseDevice = OS2_CloseDevice;
/* TODO: IMPLEMENT CAPTURE SUPPORT:
impl->CaptureFromDevice = ;
impl->FlushCapture = ;
impl->HasCaptureSupport = SDL_TRUE;
*/
return SDL_TRUE; /* this audio target is available. */
}
AudioBootStrap OS2AUDIO_bootstrap = {
"DART", "OS/2 DART", OS2_Init, SDL_FALSE
};
#endif /* SDL_AUDIO_DRIVER_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,54 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifndef SDL_os2mm_h_
#define SDL_os2mm_h_
#include "../SDL_sysaudio.h"
#define INCL_OS2MM
#define INCL_PM
#define INCL_DOS
#define INCL_DOSERRORS
#include <os2.h>
#include <os2me.h>
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *_this
#define NUM_BUFFERS 3
typedef struct SDL_PrivateAudioData
{
USHORT usDeviceId;
BYTE _pad[2];
MCI_MIXSETUP_PARMS stMCIMixSetup;
HEV hevBuf;
ULONG ulNextBuf;
ULONG cMixBuffers;
MCI_MIX_BUFFER aMixBuffers[NUM_BUFFERS];
/* ULONG ulQueuedBuf;*/
} SDL_PrivateAudioData;
#endif /* SDL_os2mm_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,38 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if defined(__OS2__)
#include "SDL_os2.h"
/* SDL_OS2Quit() will be called from SDL_QuitSubSystem() */
void SDL_OS2Quit(void)
{
/* Unload DLL used for iconv. We can do it at any time and use iconv again -
* dynamic library will be loaded on first call iconv_open() (see geniconv). */
libiconv_clean();
}
#endif
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,57 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_os2_h_
#define SDL_os2_h_
#include "SDL_log.h"
#include "SDL_stdinc.h"
#ifdef OS2DEBUG
#if (OS2DEBUG-0 >= 2)
# define debug_os2(s,...) SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, \
__func__ "(): " ##s, ##__VA_ARGS__)
#else
# define debug_os2(s,...) printf(__func__ "(): " ##s "\n", ##__VA_ARGS__)
#endif
#else /* no debug */
# define debug_os2(s,...) do {} while (0)
#endif /* OS2DEBUG */
#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H)
#define OS2_SysToUTF8(S) SDL_iconv_string("UTF-8", "", (char *)(S), SDL_strlen(S)+1)
#define OS2_UTF8ToSys(S) SDL_iconv_string("", "UTF-8", (char *)(S), SDL_strlen(S)+1)
#define libiconv_clean() do {} while(0)
#else
/* StrUTF8New() - geniconv/sys2utf8.c */
#include "geniconv/geniconv.h"
#define OS2_SysToUTF8(S) StrUTF8New(1, (S), SDL_strlen((S)) + 1)
#define OS2_UTF8ToSys(S) StrUTF8New(0, (char *)(S), SDL_strlen((S)) + 1)
#endif
/* SDL_OS2Quit() will be called from SDL_QuitSubSystem() */
void SDL_OS2Quit(void);
#endif /* SDL_os2_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,161 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/*
Universal iconv implementation for OS/2.
Andrey Vasilkin, 2016.
*/
#define INCL_DOSMODULEMGR /* Module Manager */
#define INCL_DOSERRORS /* Error values */
#include <os2.h>
#include "geniconv.h"
/*#define DEBUG*/
#ifdef DEBUG
# include <stdio.h>
# define iconv_debug(s,...) printf(__func__"(): "##s"\n" ,##__VA_ARGS__)
#else
# define iconv_debug(s,...) do {} while (0)
#endif
/* Exports from os2iconv.c */
extern iconv_t _System os2_iconv_open (const char* tocode, const char* fromcode);
extern size_t _System os2_iconv (iconv_t cd,
char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft);
extern int _System os2_iconv_close (iconv_t cd);
/* Functions pointers */
typedef iconv_t (_System *FNICONV_OPEN)(const char*, const char*);
typedef size_t (_System *FNICONV) (iconv_t, char **, size_t *, char **, size_t *);
typedef int (_System *FNICONV_CLOSE)(iconv_t);
static HMODULE hmIconv = NULLHANDLE;
static FNICONV_OPEN fn_iconv_open = os2_iconv_open;
static FNICONV fn_iconv = os2_iconv;
static FNICONV_CLOSE fn_iconv_close = os2_iconv_close;
static int geniconv_init = 0;
static BOOL _loadDLL(const char *dllname,
const char *sym_iconvopen,
const char *sym_iconv,
const char *sym_iconvclose)
{
ULONG rc;
char error[256];
rc = DosLoadModule(error, sizeof(error), dllname, &hmIconv);
if (rc != NO_ERROR) {
iconv_debug("DLL %s not loaded: %s", dllname, error);
return FALSE;
}
rc = DosQueryProcAddr(hmIconv, 0, sym_iconvopen, (PFN *)&fn_iconv_open);
if (rc != NO_ERROR) {
iconv_debug("Error: cannot find entry %s in %s", sym_iconvopen, dllname);
goto fail;
}
rc = DosQueryProcAddr(hmIconv, 0, sym_iconv, (PFN *)&fn_iconv);
if (rc != NO_ERROR) {
iconv_debug("Error: cannot find entry %s in %s", sym_iconv, dllname);
goto fail;
}
rc = DosQueryProcAddr(hmIconv, 0, sym_iconvclose, (PFN *)&fn_iconv_close);
if (rc != NO_ERROR) {
iconv_debug("Error: cannot find entry %s in %s", sym_iconvclose, dllname);
goto fail;
}
iconv_debug("DLL %s used", dllname);
return TRUE;
fail:
DosFreeModule(hmIconv);
hmIconv = NULLHANDLE;
return FALSE;
}
static void _init(void)
{
if (geniconv_init) {
return; /* Already initialized */
}
geniconv_init = 1;
/* Try to load kiconv.dll, iconv2.dll or iconv.dll */
if (!_loadDLL("KICONV", "_libiconv_open", "_libiconv", "_libiconv_close") &&
!_loadDLL("ICONV2", "_libiconv_open", "_libiconv", "_libiconv_close") &&
!_loadDLL("ICONV", "_iconv_open", "_iconv", "_iconv_close") ) {
/* No DLL was loaded - use OS/2 conversion objects API */
iconv_debug("Uni*() API used");
fn_iconv_open = os2_iconv_open;
fn_iconv = os2_iconv;
fn_iconv_close = os2_iconv_close;
}
}
/* Public routines.
* ----------------
*/
/* function to unload the used iconv dynamic library */
void libiconv_clean(void)
{
geniconv_init = 0;
/* reset the function pointers. */
fn_iconv_open = os2_iconv_open;
fn_iconv = os2_iconv;
fn_iconv_close = os2_iconv_close;
if (hmIconv != NULLHANDLE) {
DosFreeModule(hmIconv);
hmIconv = NULLHANDLE;
}
}
iconv_t libiconv_open(const char* tocode, const char* fromcode)
{
_init();
return fn_iconv_open(tocode, fromcode);
}
size_t libiconv(iconv_t cd, char* * inbuf, size_t *inbytesleft,
char* * outbuf, size_t *outbytesleft)
{
return fn_iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft);
}
int libiconv_close(iconv_t cd)
{
return fn_iconv_close(cd);
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,85 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/*
Universal iconv implementation for OS/2.
Andrey Vasilkin, 2016.
*/
#ifndef GENICONV_H
#define GENICONV_H
#include "iconv.h"
#ifdef iconv_open
#undef iconv_open
#endif
#define iconv_open libiconv_open
#ifdef iconv
#undef iconv
#endif
#define iconv libiconv
#ifdef iconv_close
#undef iconv_close
#endif
#define iconv_close libiconv_close
#define iconv_clean libiconv_clean
/* Non-standard function for iconv to unload the used dynamic library */
void libiconv_clean(void);
iconv_t libiconv_open (const char *tocode, const char *fromcode);
int libiconv_close(iconv_t cd);
size_t libiconv (iconv_t cd, char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft);
/* System codepage <-> UTF-8
*
* StrUTF8()
* Converts string from system cp to UTF-8 (to_utf8 is not 0) or from UTF-8 to
* the system cp (to_utf8 is 0). Converted ASCIIZ string will be placed at the
* buffer dst, up to c_dst - 1 (for sys->utf8) or 2 (for utf8->sys) bytes.
* Returns the number of bytes written into dst, not counting the terminating
* 0 byte(s) or -1 on error.
*/
int StrUTF8(int to_utf8, char *dst, int c_dst, char *src, int c_src);
/* StrUTF8New()
* Converts string from system cp to UTF-8 (to_utf8 is not 0) or from UTF-8
* to the system cp (to_utf8 is 0). Memory for the new string is obtained by
* using libc malloc().
* Returns converted string, terminating two bytes 0 is appended to the result.
* Returns null on error.
*/
char *StrUTF8New(int to_utf8, char *str, int c_str);
/* StrUTF8Free()
* Deallocates the memory block allocated by StrUTF8New() (just libc free()).
*/
void StrUTF8Free(char *str);
#endif /* GENICONV_H */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,21 +0,0 @@
#ifndef ICONV_H_ /* minimal iconv.h header based on public knowledge */
#define ICONV_H_
#include <stddef.h> /* size_t */
#include <errno.h>
typedef void *iconv_t;
#ifdef __cplusplus
extern "C" {
#endif
extern iconv_t iconv_open(const char *, const char *);
extern size_t iconv(iconv_t, char **, size_t *, char **, size_t *);
extern int iconv_close(iconv_t);
#ifdef __cplusplus
}
#endif
#endif /* ICONV_H_ */

View File

@@ -1,37 +0,0 @@
#
# Universal iconv implementation for OS/2.
#
# OpenWatcom makefile to build a library that uses kiconv.dll / iconv2.dll /
# iconv.dll or OS/2 Uni*() API.
#
# Andrey Vasilkin, 2016.
#
LIBFILE = geniconv.lib
all: $(LIBFILE) test.exe .symbolic
CFLAGS = -I$(%WATCOM)/h/os2 -I$(%WATCOM)/h -I. -bt=os2 -q -d0 -w2 -DGENICONV_STANDALONE=1
SRCS = geniconv.c os2cp.c os2iconv.c
SRCS+= sys2utf8.c
OBJS = $(SRCS:.c=.obj)
LIBS = libuls.lib libconv.lib $(LIBFILE)
test.exe: $(LIBFILE) test.obj
wlink op quiet system os2v2 file test.obj lib {$(LIBS)} name $*
$(LIBFILE): $(OBJS)
@if exist $@ rm $@
@for %f in ($(OBJS)) do wlib -q -b $* +%f
.c.obj:
wcc386 $(CFLAGS) -fo=$^@ $<
clean: .SYMBOLIC
@if exist *.obj rm *.obj
@if exist *.err rm *.err
@if exist $(LIBFILE) rm $(LIBFILE)
@if exist test.exe rm test.exe

View File

@@ -1,416 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#define INCL_DOSNLS
#define INCL_DOSERRORS
#include <os2.h>
#include "os2cp.h"
#ifndef GENICONV_STANDALONE
#include "../../../SDL_internal.h"
#else
#include <string.h>
#include <ctype.h>
#define SDL_isspace isspace
#define SDL_strchr strchr
#define SDL_memcpy memcpy
#define SDL_strupr strupr
#define SDL_strcmp strcmp
#endif
typedef struct _CP2NAME {
ULONG ulCode;
PSZ pszName;
} CP2NAME;
typedef struct _NAME2CP {
PSZ pszName;
ULONG ulCode;
} NAME2CP;
static CP2NAME aCP2Name[] = {
{367, "ANSI_X3.4-1968"},
{813, "ECMA-118"},
{819, "CP819"},
{850, "850"},
{862, "862"},
{866, "866"},
{874, "ISO-IR-166"},
{878, "KOI8-R"},
{896, "JISX0201-1976"},
{901, "ISO-8859-13"},
{912, "ISO-8859-2"},
{913, "ISO-8859-3"},
{914, "ISO-8859-4"},
{915, "CYRILLIC"},
{920, "ISO-8859-9"},
{923, "ISO-8859-15"},
{943, "MS_KANJI"},
{954, "EUC-JP"},
{964, "EUC-TW"},
{970, "EUC-KR"},
{1051, "HP-ROMAN8"},
{1089, "ARABIC"},
{1129, "VISCII"},
{1168, "KOI8-U"},
{1200, "ISO-10646-UCS-2"},
{1202, "UTF-16LE"},
{1204, "UCS-2BE"},
{1208, "UTF-8"},
{1232, "UTF-32BE"},
{1234, "UTF-32LE"},
{1236, "ISO-10646-UCS-4"},
{1250, "CP1250"},
{1251, "CP1251"},
{1252, "CP1252"},
{1253, "CP1253"},
{1254, "CP1254"},
{1255, "CP1255"},
{1256, "CP1256"},
{1257, "CP1257"},
{1275, "MAC"},
{1383, "CN-GB"},
{1386, "GBK"},
{1392, "GB18030"},
{62210, "HEBREW"}
};
static NAME2CP aName2CP[] = {
{"850", 850},
{"862", 862},
{"866", 866},
{"ANSI_X3.4-1968", 367},
{"ANSI_X3.4-1986", 367},
{"ARABIC", 1089},
{"ASCII", 367},
{"ASMO-708", 1089},
{"CN-GB", 1383},
{"CP1250", 1250},
{"CP1251", 1251},
{"CP1252", 1252},
{"CP1253", 1253},
{"CP1254", 1254},
{"CP1255", 1255},
{"CP1256", 1256},
{"CP1257", 1257},
{"CP367", 367},
{"CP819", 819},
{"CP850", 850},
{"CP862", 862},
{"CP866", 866},
{"CP936", 1386},
{"CSASCII", 367},
{"CSEUCKR", 970},
{"CSEUCPKDFMTJAPANESE", 954},
{"CSEUCTW", 964},
{"CSGB2312", 1383},
{"CSHALFWIDTHKATAKANA", 896},
{"CSHPROMAN8", 1051},
{"CSIBM866", 866},
{"CSISOLATIN1", 819},
{"CSISOLATIN2", 912},
{"CSISOLATIN3", 913},
{"CSISOLATIN4", 914},
{"CSISOLATIN5", 920},
{"CSISOLATINARABIC", 1089},
{"CSISOLATINCYRILLIC", 915},
{"CSISOLATINGREEK", 813},
{"CSISOLATINHEBREW", 62210},
{"CSKOI8R", 878},
{"CSKSC56011987", 970},
{"CSMACINTOSH", 1275},
{"CSPC850MULTILINGUAL", 850},
{"CSPC862LATINHEBREW", 862},
{"CSSHIFTJIS", 943},
{"CSUCS4", 1236},
{"CSUNICODE", 1200},
{"CSUNICODE11", 1204},
{"CSVISCII", 1129},
{"CYRILLIC", 915},
{"ECMA-114", 1089},
{"ECMA-118", 813},
{"ELOT_928", 813},
{"EUC-CN", 1383},
{"EUC-JP", 954},
{"EUC-KR", 970},
{"EUC-TW", 964},
{"EUCCN", 1383},
{"EUCJP", 954},
{"EUCKR", 970},
{"EUCTW", 964},
{"EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", 954},
{"GB18030", 1392},
{"GB2312", 1383},
{"GBK", 1386},
{"GREEK", 813},
{"GREEK8", 813},
{"HEBREW", 62210},
{"HP-ROMAN8", 1051},
{"IBM367", 367},
{"IBM819", 819},
{"IBM850", 850},
{"IBM862", 862},
{"IBM866", 866},
{"ISO-10646-UCS-2", 1200},
{"ISO-10646-UCS-4", 1236},
{"ISO-8859-1", 819},
{"ISO-8859-13", 901},
{"ISO-8859-15", 923},
{"ISO-8859-2", 912},
{"ISO-8859-3", 913},
{"ISO-8859-4", 914},
{"ISO-8859-5", 915},
{"ISO-8859-6", 1089},
{"ISO-8859-7", 813},
{"ISO-8859-8", 62210},
{"ISO-8859-9", 920},
{"ISO-IR-100", 819},
{"ISO-IR-101", 912},
{"ISO-IR-109", 913},
{"ISO-IR-110", 914},
{"ISO-IR-126", 813},
{"ISO-IR-127", 1089},
{"ISO-IR-138", 62210},
{"ISO-IR-144", 915},
{"ISO-IR-148", 920},
{"ISO-IR-149", 970},
{"ISO-IR-166", 874},
{"ISO-IR-179", 901},
{"ISO-IR-203", 923},
{"ISO-IR-6", 367},
{"ISO646-US", 367},
{"ISO8859-1", 819},
{"ISO8859-13", 901},
{"ISO8859-15", 923},
{"ISO8859-2", 912},
{"ISO8859-3", 913},
{"ISO8859-4", 914},
{"ISO8859-5", 915},
{"ISO8859-6", 1089},
{"ISO8859-7", 813},
{"ISO8859-8", 62210},
{"ISO8859-9", 920},
{"ISO_646.IRV:1991", 367},
{"ISO_8859-1", 819},
{"ISO_8859-13", 901},
{"ISO_8859-15", 923},
{"ISO_8859-15:1998", 923},
{"ISO_8859-1:1987", 819},
{"ISO_8859-2", 912},
{"ISO_8859-2:1987", 912},
{"ISO_8859-3", 913},
{"ISO_8859-3:1988", 913},
{"ISO_8859-4", 914},
{"ISO_8859-4:1988", 914},
{"ISO_8859-5", 915},
{"ISO_8859-5:1988", 915},
{"ISO_8859-6", 1089},
{"ISO_8859-6:1987", 1089},
{"ISO_8859-7", 813},
{"ISO_8859-7:1987", 813},
{"ISO_8859-7:2003", 813},
{"ISO_8859-8", 62210},
{"ISO_8859-8:1988", 62210},
{"ISO_8859-9", 920},
{"ISO_8859-9:1989", 920},
{"JISX0201-1976", 896},
{"JIS_X0201", 896},
{"KOI8-R", 878},
{"KOI8-U", 1168},
{"KOREAN", 970},
{"KSC_5601", 970},
{"KS_C_5601-1987", 970},
{"KS_C_5601-1989", 970},
{"L1", 819},
{"L2", 912},
{"L3", 913},
{"L4", 914},
{"L5", 920},
{"L7", 901},
{"LATIN-9", 923},
{"LATIN1", 819},
{"LATIN2", 912},
{"LATIN3", 913},
{"LATIN4", 914},
{"LATIN5", 920},
{"LATIN7", 901},
{"MAC", 1275},
{"MACINTOSH", 1275},
{"MACROMAN", 1275},
{"MS-ANSI", 1252},
{"MS-ARAB", 1256},
{"MS-CYRL", 1251},
{"MS-EE", 1250},
{"MS-GREEK", 1253},
{"MS-HEBR", 1255},
{"MS-TURK", 1254},
{"MS936", 1386},
{"MS_KANJI", 943},
{"R8", 1051},
{"ROMAN8", 1051},
{"SHIFT-JIS", 943},
{"SHIFT_JIS", 943},
{"SJIS", 943},
{"TIS-620", 874},
{"TIS620", 874},
{"TIS620-0", 874},
{"TIS620.2529-1", 874},
{"TIS620.2533-0", 874},
{"TIS620.2533-1", 874},
{"UCS-2", 1200},
{"UCS-2BE", 1204},
{"UCS-4", 1236},
{"UNICODE-1-1", 1204},
{"UNICODEBIG", 1204},
{"US", 367},
{"US-ASCII", 367},
{"UTF-16", 1204},
{"UTF-16BE", 1200},
{"UTF-16LE", 1202},
{"UTF-32", 1236},
{"UTF-32BE", 1232},
{"UTF-32LE", 1234},
{"UTF-8", 1208},
{"VISCII", 1129},
{"VISCII1.1-1", 1129},
{"WINBALTRIM", 1257},
{"WINDOWS-1250", 1250},
{"WINDOWS-1251", 1251},
{"WINDOWS-1252", 1252},
{"WINDOWS-1253", 1253},
{"WINDOWS-1254", 1254},
{"WINDOWS-1255", 1255},
{"WINDOWS-1256", 1256},
{"WINDOWS-1257", 1257},
{"WINDOWS-936", 1386},
{"X0201", 896}
};
char *os2cpToName(unsigned long cp)
{
ULONG ulLo = 0;
ULONG ulHi = (sizeof(aCP2Name) / sizeof(struct _CP2NAME)) - 1;
ULONG ulNext;
LONG lFound = -1;
if (cp == SYSTEM_CP) {
ULONG aulCP[3];
ULONG cCP;
if (DosQueryCp(sizeof(aulCP), aulCP, &cCP) != NO_ERROR) {
return NULL;
}
cp = aulCP[0];
}
if (aCP2Name[0].ulCode > cp || aCP2Name[ulHi].ulCode < cp) {
return NULL;
}
if (aCP2Name[0].ulCode == cp) {
return aCP2Name[0].pszName;
}
if (aCP2Name[ulHi].ulCode == cp) {
return aCP2Name[ulHi].pszName;
}
while ((ulHi - ulLo) > 1) {
ulNext = (ulLo + ulHi) / 2;
if (aCP2Name[ulNext].ulCode < cp) {
ulLo = ulNext;
} else if (aCP2Name[ulNext].ulCode > cp) {
ulHi = ulNext;
} else {
lFound = ulNext;
break;
}
}
return (lFound == -1)? NULL : aCP2Name[lFound].pszName;
}
unsigned long os2cpFromName(char *cp)
{
ULONG ulLo = 0;
ULONG ulHi = (sizeof(aName2CP) / sizeof(struct _NAME2CP)) - 1;
ULONG ulNext;
LONG lFound = -1;
LONG lCmp;
PCHAR pcEnd;
CHAR acBuf[64];
if (cp == NULL) {
ULONG aulCP[3];
ULONG cCP;
return (DosQueryCp(sizeof(aulCP), aulCP, &cCP) != NO_ERROR)? 0 : aulCP[0];
}
while (SDL_isspace((unsigned char) *cp)) {
cp++;
}
pcEnd = SDL_strchr(cp, ' ');
if (pcEnd == NULL) {
pcEnd = SDL_strchr(cp, '\0');
}
ulNext = pcEnd - cp;
if (ulNext >= sizeof(acBuf)) {
return 0;
}
SDL_memcpy(acBuf, cp, ulNext);
acBuf[ulNext] = '\0';
SDL_strupr(acBuf);
lCmp = SDL_strcmp(aName2CP[0].pszName, acBuf);
if (lCmp > 0) {
return 0;
}
if (lCmp == 0) {
return aName2CP[0].ulCode;
}
lCmp = SDL_strcmp(aName2CP[ulHi].pszName, acBuf);
if (lCmp < 0) {
return 0;
}
if (lCmp == 0) {
return aName2CP[ulHi].ulCode;
}
while ((ulHi - ulLo) > 1) {
ulNext = (ulLo + ulHi) / 2;
lCmp = SDL_strcmp(aName2CP[ulNext].pszName, acBuf);
if (lCmp < 0) {
ulLo = ulNext;
} else if (lCmp > 0) {
ulHi = ulNext;
} else {
lFound = ulNext;
break;
}
}
return (lFound == -1)? 0 : aName2CP[lFound].ulCode;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,32 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef OS2CP_H
#define OS2CP_H 1
#define SYSTEM_CP 0
char *os2cpToName(unsigned long cp);
unsigned long os2cpFromName(char *cp);
#endif /* OS2CP_H */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,286 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/*
Implementation iconv via OS/2 conversion objects API.
Andrey Vasilkin.
*/
#define ICONV_THREAD_SAFE 1
#include "geniconv.h"
#define _ULS_CALLCONV_
#define CALLCONV _System
#include <uconv.h>
#ifdef ICONV_THREAD_SAFE
#define INCL_DOSSEMAPHORES
#define INCL_DOSERRORS
#include <os2.h>
#endif
#include "os2cp.h"
#ifndef GENICONV_STANDALONE
#include "../../../SDL_internal.h"
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if !defined(min)
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
#define SDL_min min
#define SDL_strcasecmp stricmp
#define SDL_snprintf _snprintf
#define SDL_malloc malloc
#define SDL_free free
#define SDL_memcpy memcpy
#endif
#define MAX_CP_NAME_LEN 64
typedef struct iuconv_obj {
UconvObject uo_tocode;
UconvObject uo_fromcode;
int buf_len;
UniChar *buf;
#ifdef ICONV_THREAD_SAFE
HMTX hMtx;
#endif
} iuconv_obj;
static int _createUconvObj(const char *code, UconvObject *uobj)
{
UniChar uc_code[MAX_CP_NAME_LEN];
int i;
const unsigned char *ch =
(const unsigned char *)code;
if (code == NULL)
uc_code[0] = 0;
else {
for (i = 0; i < MAX_CP_NAME_LEN; i++) {
uc_code[i] = (unsigned short)*ch;
if (! (*ch))
break;
ch++;
}
}
return UniCreateUconvObject(uc_code, uobj);
}
static int uconv_open(const char *code, UconvObject *uobj)
{
int rc;
if (!SDL_strcasecmp(code, "UTF-16")) {
*uobj = NULL;
return ULS_SUCCESS;
}
rc = _createUconvObj(code, uobj);
if (rc != ULS_SUCCESS) {
unsigned long cp = os2cpFromName((char *)code);
char cp_name[16];
if (cp != 0 && SDL_snprintf(cp_name, sizeof(cp_name), "IBM-%u", cp) > 0) {
rc = _createUconvObj(cp_name, uobj);
}
}
return rc;
}
iconv_t _System os2_iconv_open(const char* tocode, const char* fromcode)
{
UconvObject uo_tocode;
UconvObject uo_fromcode;
int rc;
iuconv_obj *iuobj;
if (tocode == NULL) {
tocode = "";
}
if (fromcode == NULL) {
fromcode = "";
}
if (SDL_strcasecmp(tocode, fromcode) != 0) {
rc = uconv_open(fromcode, &uo_fromcode);
if (rc != ULS_SUCCESS) {
errno = EINVAL;
return (iconv_t)(-1);
}
rc = uconv_open(tocode, &uo_tocode);
if (rc != ULS_SUCCESS) {
UniFreeUconvObject(uo_fromcode);
errno = EINVAL;
return (iconv_t)(-1);
}
} else {
uo_tocode = NULL;
uo_fromcode = NULL;
}
iuobj = (iuconv_obj *) SDL_malloc(sizeof(iuconv_obj));
iuobj->uo_tocode = uo_tocode;
iuobj->uo_fromcode = uo_fromcode;
iuobj->buf_len = 0;
iuobj->buf = NULL;
#ifdef ICONV_THREAD_SAFE
DosCreateMutexSem(NULL, &iuobj->hMtx, 0, FALSE);
#endif
return iuobj;
}
size_t _System os2_iconv(iconv_t cd,
char **inbuf, size_t *inbytesleft ,
char **outbuf, size_t *outbytesleft)
{
UconvObject uo_tocode = ((iuconv_obj *)(cd))->uo_tocode;
UconvObject uo_fromcode = ((iuconv_obj *)(cd))->uo_fromcode;
size_t nonIdenticalConv = 0;
UniChar *uc_buf;
size_t uc_buf_len;
UniChar **uc_str;
size_t *uc_str_len;
int rc;
size_t ret = (size_t)(-1);
if (uo_tocode == NULL && uo_fromcode == NULL) {
uc_buf_len = SDL_min(*inbytesleft, *outbytesleft);
SDL_memcpy(*outbuf, *inbuf, uc_buf_len);
*inbytesleft -= uc_buf_len;
*outbytesleft -= uc_buf_len;
outbuf += uc_buf_len;
inbuf += uc_buf_len;
return uc_buf_len;
}
#ifdef ICONV_THREAD_SAFE
DosRequestMutexSem(((iuconv_obj *)(cd))->hMtx, SEM_INDEFINITE_WAIT);
#endif
if (uo_tocode && uo_fromcode && (((iuconv_obj *)cd)->buf_len >> 1) < *inbytesleft) {
if (((iuconv_obj *)cd)->buf != NULL) {
SDL_free(((iuconv_obj *)cd)->buf);
}
((iuconv_obj *)cd)->buf_len = *inbytesleft << 1;
((iuconv_obj *)cd)->buf = (UniChar *) SDL_malloc(((iuconv_obj *)cd)->buf_len);
}
if (uo_fromcode) {
if (uo_tocode) {
uc_buf = ((iuconv_obj *)cd)->buf;
uc_buf_len = ((iuconv_obj *)cd)->buf_len;
uc_str = &uc_buf;
} else {
uc_str = (UniChar **)outbuf;
uc_buf_len = *outbytesleft;
}
uc_buf_len = uc_buf_len >> 1;
uc_str_len = &uc_buf_len;
rc = UniUconvToUcs(uo_fromcode, (void **)inbuf, inbytesleft,
uc_str, uc_str_len, &nonIdenticalConv);
uc_buf_len = uc_buf_len << 1;
if (!uo_tocode) {
*outbytesleft = uc_buf_len;
}
if (rc != ULS_SUCCESS) {
errno = EILSEQ;
goto done;
} else if (*inbytesleft && !*uc_str_len) {
errno = E2BIG;
goto done;
}
if (!uo_tocode) {
return nonIdenticalConv;
}
uc_buf = ((iuconv_obj *)cd)->buf;
uc_buf_len = ((iuconv_obj *)cd)->buf_len - uc_buf_len;
uc_str = &uc_buf;
uc_str_len = &uc_buf_len;
} else {
uc_str = (UniChar **)inbuf;
uc_str_len = inbytesleft;
}
*uc_str_len = *uc_str_len>>1;
rc = UniUconvFromUcs(uo_tocode, uc_str, uc_str_len, (void **)outbuf,
outbytesleft, &nonIdenticalConv);
if (rc != ULS_SUCCESS) {
switch (rc) {
case ULS_BUFFERFULL:
errno = E2BIG;
break;
case ULS_ILLEGALSEQUENCE:
errno = EILSEQ;
break;
case ULS_INVALID:
errno = EINVAL;
break;
}
goto done;
} else if (*uc_str_len && !*outbytesleft) {
errno = E2BIG;
goto done;
}
ret = nonIdenticalConv;
done:
#ifdef ICONV_THREAD_SAFE
DosReleaseMutexSem(((iuconv_obj *)cd)->hMtx);
#endif
return ret;
}
int _System os2_iconv_close(iconv_t cd)
{
if (!cd) return 0;
#ifdef ICONV_THREAD_SAFE
DosCloseMutexSem(((iuconv_obj *)cd)->hMtx);
#endif
if (((iuconv_obj *)cd)->uo_tocode != NULL) {
UniFreeUconvObject(((iuconv_obj *)cd)->uo_tocode);
}
if (((iuconv_obj *)cd)->uo_fromcode != NULL) {
UniFreeUconvObject(((iuconv_obj *)cd)->uo_fromcode);
}
if (((iuconv_obj *)cd)->buf != NULL) {
SDL_free(((iuconv_obj *)cd)->buf);
}
SDL_free(cd);
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,119 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "geniconv.h"
#ifndef GENICONV_STANDALONE
#include "../../../SDL_internal.h"
#else
#include <stdlib.h>
#define SDL_malloc malloc
#define SDL_realloc realloc
#define SDL_free free
#endif
int StrUTF8(int to_utf8, char *dst, int c_dst, char *src, int c_src)
{
size_t rc;
char *dststart = dst;
iconv_t cd;
char *tocp, *fromcp;
int err = 0;
if (c_dst < 4) {
return -1;
}
if (to_utf8) {
tocp = "UTF-8";
fromcp = "";
} else {
tocp = "";
fromcp = "UTF-8";
}
cd = iconv_open(tocp, fromcp);
if (cd == (iconv_t)-1) {
return -1;
}
while (c_src > 0) {
rc = iconv(cd, &src, (size_t *)&c_src, &dst, (size_t *)&c_dst);
if (rc == (size_t)-1) {
if (errno == EILSEQ) {
/* Try to skip invalid character */
src++;
c_src--;
continue;
}
err = 1;
break;
}
}
iconv_close(cd);
/* Write trailing ZERO (1 byte for UTF-8, 2 bytes for the system cp) */
if (to_utf8) {
if (c_dst < 1) {
dst--;
err = 1; /* The destination buffer overflow */
}
*dst = '\0';
} else {
if (c_dst < 2) {
dst -= (c_dst == 0) ? 2 : 1;
err = 1; /* The destination buffer overflow */
}
*((short *)dst) = '\0';
}
return (err) ? -1 : (dst - dststart);
}
char *StrUTF8New(int to_utf8, char *str, int c_str)
{
int c_newstr = (((c_str > 4) ? c_str : 4) + 1) * 2;
char * newstr = (char *) SDL_malloc(c_newstr);
if (newstr == NULL) {
return NULL;
}
c_newstr = StrUTF8(to_utf8, newstr, c_newstr, str, c_str);
if (c_newstr != -1) {
str = (char *) SDL_realloc(newstr, c_newstr + ((to_utf8) ? 1 : sizeof(short)));
if (str) {
return str;
}
}
SDL_free(newstr);
return NULL;
}
void StrUTF8Free(char *str)
{
SDL_free(str);
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,69 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "geniconv.h"
int main(void)
{
char acBuf[128];
char *inbuf = "ôÅÓÔ - ÐÒÏ×ÅÒËÁ"; /* KOI8-R string */
size_t inbytesleft = strlen(inbuf);
char *outbuf = acBuf;
size_t outbytesleft = sizeof(acBuf);
iconv_t ic;
/* KOI8 -> system cp */
ic = iconv_open("", "KOI8-R");
if (ic == (iconv_t)(-1)) {
puts("iconv_open() fail");
return 1;
}
iconv(ic, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
printf("KOI8-R to system cp: %s\n", acBuf);
iconv_close(ic);
/* System cp -> UTF-8 -> system cp: */
/* System cp -> UTF-8 by StrUTF8New() */
inbuf = StrUTF8New(1, acBuf, strlen(acBuf));
/* UTF-8 -> system cp. by StrUTF8() */
if (StrUTF8(0, acBuf, sizeof(acBuf), inbuf, strlen(inbuf)) == -1) {
puts("StrUTF8() failed");
} else {
printf("system cp. -> UTF-8 -> system cp.: %s\n", acBuf);
}
free(inbuf);
/* Unload used DLL */
iconv_clean();
puts("Done.");
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,4 +0,0 @@
# OpenWatcom exports file for libiconv
++'libiconv'.'ICONV2'..'_libiconv'
++'libiconv_close'.'ICONV2'..'_libiconv_close'
++'libiconv_open'.'ICONV2'..'_libiconv_open'

View File

@@ -27,14 +27,6 @@
#if defined(__WIN32__) || defined(__WINRT__) || defined(__GDK__)
#include "../core/windows/SDL_windows.h"
#endif
#if defined(__OS2__)
#undef HAVE_SYSCTLBYNAME
#define INCL_DOS
#include <os2.h>
#ifndef QSV_NUMPROCESSORS
#define QSV_NUMPROCESSORS 26
#endif
#endif
/* CPU feature detection for SDL */
@@ -680,12 +672,6 @@ SDL_GetCPUCount(void)
SDL_CPUCount = info.dwNumberOfProcessors;
}
#endif
#ifdef __OS2__
if (SDL_CPUCount <= 0) {
DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS,
&SDL_CPUCount, sizeof(SDL_CPUCount) );
}
#endif
#endif
/* There has to be at least 1, right? :) */
if (SDL_CPUCount <= 0) {
@@ -1064,13 +1050,6 @@ SDL_GetSystemRAM(void)
}
}
#endif
#ifdef __OS2__
if (SDL_SystemRAM <= 0) {
Uint32 sysram = 0;
DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4);
SDL_SystemRAM = (int) (sysram / 0x100000U);
}
#endif
#ifdef __RISCOS__
if (SDL_SystemRAM <= 0) {
_kernel_swi_regs regs;

View File

@@ -1,869 +0,0 @@
# Windows exports file for Watcom
# DO NOT EDIT THIS FILE BY HAND. It is autogenerated by gendynapi.pl.
++'_SDL_DYNAPI_entry'.'SDL3.dll'.'SDL_DYNAPI_entry'
++'_SDL_SetError'.'SDL3.dll'.'SDL_SetError'
++'_SDL_Log'.'SDL3.dll'.'SDL_Log'
++'_SDL_LogVerbose'.'SDL3.dll'.'SDL_LogVerbose'
++'_SDL_LogDebug'.'SDL3.dll'.'SDL_LogDebug'
++'_SDL_LogInfo'.'SDL3.dll'.'SDL_LogInfo'
++'_SDL_LogWarn'.'SDL3.dll'.'SDL_LogWarn'
++'_SDL_LogError'.'SDL3.dll'.'SDL_LogError'
++'_SDL_LogCritical'.'SDL3.dll'.'SDL_LogCritical'
++'_SDL_LogMessage'.'SDL3.dll'.'SDL_LogMessage'
++'_SDL_sscanf'.'SDL3.dll'.'SDL_sscanf'
++'_SDL_snprintf'.'SDL3.dll'.'SDL_snprintf'
++'_SDL_CreateThread'.'SDL3.dll'.'SDL_CreateThread'
++'_SDL_RWFromFP'.'SDL3.dll'.'SDL_RWFromFP'
++'_SDL_RegisterApp'.'SDL3.dll'.'SDL_RegisterApp'
++'_SDL_UnregisterApp'.'SDL3.dll'.'SDL_UnregisterApp'
++'_SDL_Direct3D9GetAdapterIndex'.'SDL3.dll'.'SDL_Direct3D9GetAdapterIndex'
++'_SDL_RenderGetD3D9Device'.'SDL3.dll'.'SDL_RenderGetD3D9Device'
# ++'_SDL_iPhoneSetAnimationCallback'.'SDL3.dll'.'SDL_iPhoneSetAnimationCallback'
# ++'_SDL_iPhoneSetEventPump'.'SDL3.dll'.'SDL_iPhoneSetEventPump'
# ++'_SDL_AndroidGetJNIEnv'.'SDL3.dll'.'SDL_AndroidGetJNIEnv'
# ++'_SDL_AndroidGetActivity'.'SDL3.dll'.'SDL_AndroidGetActivity'
# ++'_SDL_AndroidGetInternalStoragePath'.'SDL3.dll'.'SDL_AndroidGetInternalStoragePath'
# ++'_SDL_AndroidGetExternalStorageState'.'SDL3.dll'.'SDL_AndroidGetExternalStorageState'
# ++'_SDL_AndroidGetExternalStoragePath'.'SDL3.dll'.'SDL_AndroidGetExternalStoragePath'
++'_SDL_Init'.'SDL3.dll'.'SDL_Init'
++'_SDL_InitSubSystem'.'SDL3.dll'.'SDL_InitSubSystem'
++'_SDL_QuitSubSystem'.'SDL3.dll'.'SDL_QuitSubSystem'
++'_SDL_WasInit'.'SDL3.dll'.'SDL_WasInit'
++'_SDL_Quit'.'SDL3.dll'.'SDL_Quit'
++'_SDL_ReportAssertion'.'SDL3.dll'.'SDL_ReportAssertion'
++'_SDL_SetAssertionHandler'.'SDL3.dll'.'SDL_SetAssertionHandler'
++'_SDL_GetAssertionReport'.'SDL3.dll'.'SDL_GetAssertionReport'
++'_SDL_ResetAssertionReport'.'SDL3.dll'.'SDL_ResetAssertionReport'
++'_SDL_AtomicTryLock'.'SDL3.dll'.'SDL_AtomicTryLock'
++'_SDL_AtomicLock'.'SDL3.dll'.'SDL_AtomicLock'
++'_SDL_AtomicUnlock'.'SDL3.dll'.'SDL_AtomicUnlock'
++'_SDL_AtomicCAS'.'SDL3.dll'.'SDL_AtomicCAS'
++'_SDL_AtomicSet'.'SDL3.dll'.'SDL_AtomicSet'
++'_SDL_AtomicGet'.'SDL3.dll'.'SDL_AtomicGet'
++'_SDL_AtomicAdd'.'SDL3.dll'.'SDL_AtomicAdd'
++'_SDL_AtomicCASPtr'.'SDL3.dll'.'SDL_AtomicCASPtr'
++'_SDL_AtomicSetPtr'.'SDL3.dll'.'SDL_AtomicSetPtr'
++'_SDL_AtomicGetPtr'.'SDL3.dll'.'SDL_AtomicGetPtr'
++'_SDL_GetNumAudioDrivers'.'SDL3.dll'.'SDL_GetNumAudioDrivers'
++'_SDL_GetAudioDriver'.'SDL3.dll'.'SDL_GetAudioDriver'
++'_SDL_AudioInit'.'SDL3.dll'.'SDL_AudioInit'
++'_SDL_AudioQuit'.'SDL3.dll'.'SDL_AudioQuit'
++'_SDL_GetCurrentAudioDriver'.'SDL3.dll'.'SDL_GetCurrentAudioDriver'
++'_SDL_OpenAudio'.'SDL3.dll'.'SDL_OpenAudio'
++'_SDL_GetNumAudioDevices'.'SDL3.dll'.'SDL_GetNumAudioDevices'
++'_SDL_GetAudioDeviceName'.'SDL3.dll'.'SDL_GetAudioDeviceName'
++'_SDL_OpenAudioDevice'.'SDL3.dll'.'SDL_OpenAudioDevice'
++'_SDL_GetAudioStatus'.'SDL3.dll'.'SDL_GetAudioStatus'
++'_SDL_GetAudioDeviceStatus'.'SDL3.dll'.'SDL_GetAudioDeviceStatus'
++'_SDL_PauseAudio'.'SDL3.dll'.'SDL_PauseAudio'
++'_SDL_PauseAudioDevice'.'SDL3.dll'.'SDL_PauseAudioDevice'
++'_SDL_LoadWAV_RW'.'SDL3.dll'.'SDL_LoadWAV_RW'
++'_SDL_FreeWAV'.'SDL3.dll'.'SDL_FreeWAV'
++'_SDL_BuildAudioCVT'.'SDL3.dll'.'SDL_BuildAudioCVT'
++'_SDL_ConvertAudio'.'SDL3.dll'.'SDL_ConvertAudio'
++'_SDL_MixAudio'.'SDL3.dll'.'SDL_MixAudio'
++'_SDL_MixAudioFormat'.'SDL3.dll'.'SDL_MixAudioFormat'
++'_SDL_LockAudio'.'SDL3.dll'.'SDL_LockAudio'
++'_SDL_LockAudioDevice'.'SDL3.dll'.'SDL_LockAudioDevice'
++'_SDL_UnlockAudio'.'SDL3.dll'.'SDL_UnlockAudio'
++'_SDL_UnlockAudioDevice'.'SDL3.dll'.'SDL_UnlockAudioDevice'
++'_SDL_CloseAudio'.'SDL3.dll'.'SDL_CloseAudio'
++'_SDL_CloseAudioDevice'.'SDL3.dll'.'SDL_CloseAudioDevice'
++'_SDL_SetClipboardText'.'SDL3.dll'.'SDL_SetClipboardText'
++'_SDL_GetClipboardText'.'SDL3.dll'.'SDL_GetClipboardText'
++'_SDL_HasClipboardText'.'SDL3.dll'.'SDL_HasClipboardText'
++'_SDL_GetCPUCount'.'SDL3.dll'.'SDL_GetCPUCount'
++'_SDL_GetCPUCacheLineSize'.'SDL3.dll'.'SDL_GetCPUCacheLineSize'
++'_SDL_HasRDTSC'.'SDL3.dll'.'SDL_HasRDTSC'
++'_SDL_HasAltiVec'.'SDL3.dll'.'SDL_HasAltiVec'
++'_SDL_HasMMX'.'SDL3.dll'.'SDL_HasMMX'
++'_SDL_Has3DNow'.'SDL3.dll'.'SDL_Has3DNow'
++'_SDL_HasSSE'.'SDL3.dll'.'SDL_HasSSE'
++'_SDL_HasSSE2'.'SDL3.dll'.'SDL_HasSSE2'
++'_SDL_HasSSE3'.'SDL3.dll'.'SDL_HasSSE3'
++'_SDL_HasSSE41'.'SDL3.dll'.'SDL_HasSSE41'
++'_SDL_HasSSE42'.'SDL3.dll'.'SDL_HasSSE42'
++'_SDL_GetSystemRAM'.'SDL3.dll'.'SDL_GetSystemRAM'
++'_SDL_GetError'.'SDL3.dll'.'SDL_GetError'
++'_SDL_ClearError'.'SDL3.dll'.'SDL_ClearError'
++'_SDL_Error'.'SDL3.dll'.'SDL_Error'
++'_SDL_PumpEvents'.'SDL3.dll'.'SDL_PumpEvents'
++'_SDL_PeepEvents'.'SDL3.dll'.'SDL_PeepEvents'
++'_SDL_HasEvent'.'SDL3.dll'.'SDL_HasEvent'
++'_SDL_HasEvents'.'SDL3.dll'.'SDL_HasEvents'
++'_SDL_FlushEvent'.'SDL3.dll'.'SDL_FlushEvent'
++'_SDL_FlushEvents'.'SDL3.dll'.'SDL_FlushEvents'
++'_SDL_PollEvent'.'SDL3.dll'.'SDL_PollEvent'
++'_SDL_WaitEvent'.'SDL3.dll'.'SDL_WaitEvent'
++'_SDL_WaitEventTimeout'.'SDL3.dll'.'SDL_WaitEventTimeout'
++'_SDL_PushEvent'.'SDL3.dll'.'SDL_PushEvent'
++'_SDL_SetEventFilter'.'SDL3.dll'.'SDL_SetEventFilter'
++'_SDL_GetEventFilter'.'SDL3.dll'.'SDL_GetEventFilter'
++'_SDL_AddEventWatch'.'SDL3.dll'.'SDL_AddEventWatch'
++'_SDL_DelEventWatch'.'SDL3.dll'.'SDL_DelEventWatch'
++'_SDL_FilterEvents'.'SDL3.dll'.'SDL_FilterEvents'
++'_SDL_EventState'.'SDL3.dll'.'SDL_EventState'
++'_SDL_RegisterEvents'.'SDL3.dll'.'SDL_RegisterEvents'
++'_SDL_GetBasePath'.'SDL3.dll'.'SDL_GetBasePath'
++'_SDL_GetPrefPath'.'SDL3.dll'.'SDL_GetPrefPath'
++'_SDL_GameControllerAddMapping'.'SDL3.dll'.'SDL_GameControllerAddMapping'
++'_SDL_GameControllerMappingForGUID'.'SDL3.dll'.'SDL_GameControllerMappingForGUID'
++'_SDL_GameControllerMapping'.'SDL3.dll'.'SDL_GameControllerMapping'
++'_SDL_IsGameController'.'SDL3.dll'.'SDL_IsGameController'
++'_SDL_GameControllerNameForIndex'.'SDL3.dll'.'SDL_GameControllerNameForIndex'
++'_SDL_GameControllerOpen'.'SDL3.dll'.'SDL_GameControllerOpen'
++'_SDL_GameControllerName'.'SDL3.dll'.'SDL_GameControllerName'
++'_SDL_GameControllerGetAttached'.'SDL3.dll'.'SDL_GameControllerGetAttached'
++'_SDL_GameControllerGetJoystick'.'SDL3.dll'.'SDL_GameControllerGetJoystick'
++'_SDL_GameControllerEventState'.'SDL3.dll'.'SDL_GameControllerEventState'
++'_SDL_GameControllerUpdate'.'SDL3.dll'.'SDL_GameControllerUpdate'
++'_SDL_GameControllerGetAxisFromString'.'SDL3.dll'.'SDL_GameControllerGetAxisFromString'
++'_SDL_GameControllerGetStringForAxis'.'SDL3.dll'.'SDL_GameControllerGetStringForAxis'
++'_SDL_GameControllerGetBindForAxis'.'SDL3.dll'.'SDL_GameControllerGetBindForAxis'
++'_SDL_GameControllerGetAxis'.'SDL3.dll'.'SDL_GameControllerGetAxis'
++'_SDL_GameControllerGetButtonFromString'.'SDL3.dll'.'SDL_GameControllerGetButtonFromString'
++'_SDL_GameControllerGetStringForButton'.'SDL3.dll'.'SDL_GameControllerGetStringForButton'
++'_SDL_GameControllerGetBindForButton'.'SDL3.dll'.'SDL_GameControllerGetBindForButton'
++'_SDL_GameControllerGetButton'.'SDL3.dll'.'SDL_GameControllerGetButton'
++'_SDL_GameControllerClose'.'SDL3.dll'.'SDL_GameControllerClose'
++'_SDL_RecordGesture'.'SDL3.dll'.'SDL_RecordGesture'
++'_SDL_SaveAllDollarTemplates'.'SDL3.dll'.'SDL_SaveAllDollarTemplates'
++'_SDL_SaveDollarTemplate'.'SDL3.dll'.'SDL_SaveDollarTemplate'
++'_SDL_LoadDollarTemplates'.'SDL3.dll'.'SDL_LoadDollarTemplates'
++'_SDL_NumHaptics'.'SDL3.dll'.'SDL_NumHaptics'
++'_SDL_HapticName'.'SDL3.dll'.'SDL_HapticName'
++'_SDL_HapticOpen'.'SDL3.dll'.'SDL_HapticOpen'
++'_SDL_HapticOpened'.'SDL3.dll'.'SDL_HapticOpened'
++'_SDL_HapticIndex'.'SDL3.dll'.'SDL_HapticIndex'
++'_SDL_MouseIsHaptic'.'SDL3.dll'.'SDL_MouseIsHaptic'
++'_SDL_HapticOpenFromMouse'.'SDL3.dll'.'SDL_HapticOpenFromMouse'
++'_SDL_JoystickIsHaptic'.'SDL3.dll'.'SDL_JoystickIsHaptic'
++'_SDL_HapticOpenFromJoystick'.'SDL3.dll'.'SDL_HapticOpenFromJoystick'
++'_SDL_HapticClose'.'SDL3.dll'.'SDL_HapticClose'
++'_SDL_HapticNumEffects'.'SDL3.dll'.'SDL_HapticNumEffects'
++'_SDL_HapticNumEffectsPlaying'.'SDL3.dll'.'SDL_HapticNumEffectsPlaying'
++'_SDL_HapticQuery'.'SDL3.dll'.'SDL_HapticQuery'
++'_SDL_HapticNumAxes'.'SDL3.dll'.'SDL_HapticNumAxes'
++'_SDL_HapticEffectSupported'.'SDL3.dll'.'SDL_HapticEffectSupported'
++'_SDL_HapticNewEffect'.'SDL3.dll'.'SDL_HapticNewEffect'
++'_SDL_HapticUpdateEffect'.'SDL3.dll'.'SDL_HapticUpdateEffect'
++'_SDL_HapticRunEffect'.'SDL3.dll'.'SDL_HapticRunEffect'
++'_SDL_HapticStopEffect'.'SDL3.dll'.'SDL_HapticStopEffect'
++'_SDL_HapticDestroyEffect'.'SDL3.dll'.'SDL_HapticDestroyEffect'
++'_SDL_HapticGetEffectStatus'.'SDL3.dll'.'SDL_HapticGetEffectStatus'
++'_SDL_HapticSetGain'.'SDL3.dll'.'SDL_HapticSetGain'
++'_SDL_HapticSetAutocenter'.'SDL3.dll'.'SDL_HapticSetAutocenter'
++'_SDL_HapticPause'.'SDL3.dll'.'SDL_HapticPause'
++'_SDL_HapticUnpause'.'SDL3.dll'.'SDL_HapticUnpause'
++'_SDL_HapticStopAll'.'SDL3.dll'.'SDL_HapticStopAll'
++'_SDL_HapticRumbleSupported'.'SDL3.dll'.'SDL_HapticRumbleSupported'
++'_SDL_HapticRumbleInit'.'SDL3.dll'.'SDL_HapticRumbleInit'
++'_SDL_HapticRumblePlay'.'SDL3.dll'.'SDL_HapticRumblePlay'
++'_SDL_HapticRumbleStop'.'SDL3.dll'.'SDL_HapticRumbleStop'
++'_SDL_SetHintWithPriority'.'SDL3.dll'.'SDL_SetHintWithPriority'
++'_SDL_SetHint'.'SDL3.dll'.'SDL_SetHint'
++'_SDL_GetHint'.'SDL3.dll'.'SDL_GetHint'
++'_SDL_AddHintCallback'.'SDL3.dll'.'SDL_AddHintCallback'
++'_SDL_DelHintCallback'.'SDL3.dll'.'SDL_DelHintCallback'
++'_SDL_ClearHints'.'SDL3.dll'.'SDL_ClearHints'
++'_SDL_NumJoysticks'.'SDL3.dll'.'SDL_NumJoysticks'
++'_SDL_JoystickNameForIndex'.'SDL3.dll'.'SDL_JoystickNameForIndex'
++'_SDL_JoystickOpen'.'SDL3.dll'.'SDL_JoystickOpen'
++'_SDL_JoystickName'.'SDL3.dll'.'SDL_JoystickName'
++'_SDL_JoystickGetDeviceGUID'.'SDL3.dll'.'SDL_JoystickGetDeviceGUID'
++'_SDL_JoystickGetGUID'.'SDL3.dll'.'SDL_JoystickGetGUID'
++'_SDL_JoystickGetGUIDString'.'SDL3.dll'.'SDL_JoystickGetGUIDString'
++'_SDL_JoystickGetGUIDFromString'.'SDL3.dll'.'SDL_JoystickGetGUIDFromString'
++'_SDL_JoystickGetAttached'.'SDL3.dll'.'SDL_JoystickGetAttached'
++'_SDL_JoystickInstanceID'.'SDL3.dll'.'SDL_JoystickInstanceID'
++'_SDL_JoystickNumAxes'.'SDL3.dll'.'SDL_JoystickNumAxes'
++'_SDL_JoystickNumBalls'.'SDL3.dll'.'SDL_JoystickNumBalls'
++'_SDL_JoystickNumHats'.'SDL3.dll'.'SDL_JoystickNumHats'
++'_SDL_JoystickNumButtons'.'SDL3.dll'.'SDL_JoystickNumButtons'
++'_SDL_JoystickUpdate'.'SDL3.dll'.'SDL_JoystickUpdate'
++'_SDL_JoystickEventState'.'SDL3.dll'.'SDL_JoystickEventState'
++'_SDL_JoystickGetAxis'.'SDL3.dll'.'SDL_JoystickGetAxis'
++'_SDL_JoystickGetHat'.'SDL3.dll'.'SDL_JoystickGetHat'
++'_SDL_JoystickGetBall'.'SDL3.dll'.'SDL_JoystickGetBall'
++'_SDL_JoystickGetButton'.'SDL3.dll'.'SDL_JoystickGetButton'
++'_SDL_JoystickClose'.'SDL3.dll'.'SDL_JoystickClose'
++'_SDL_GetKeyboardFocus'.'SDL3.dll'.'SDL_GetKeyboardFocus'
++'_SDL_GetKeyboardState'.'SDL3.dll'.'SDL_GetKeyboardState'
++'_SDL_GetModState'.'SDL3.dll'.'SDL_GetModState'
++'_SDL_SetModState'.'SDL3.dll'.'SDL_SetModState'
++'_SDL_GetKeyFromScancode'.'SDL3.dll'.'SDL_GetKeyFromScancode'
++'_SDL_GetScancodeFromKey'.'SDL3.dll'.'SDL_GetScancodeFromKey'
++'_SDL_GetScancodeName'.'SDL3.dll'.'SDL_GetScancodeName'
++'_SDL_GetScancodeFromName'.'SDL3.dll'.'SDL_GetScancodeFromName'
++'_SDL_GetKeyName'.'SDL3.dll'.'SDL_GetKeyName'
++'_SDL_GetKeyFromName'.'SDL3.dll'.'SDL_GetKeyFromName'
++'_SDL_StartTextInput'.'SDL3.dll'.'SDL_StartTextInput'
++'_SDL_IsTextInputActive'.'SDL3.dll'.'SDL_IsTextInputActive'
++'_SDL_StopTextInput'.'SDL3.dll'.'SDL_StopTextInput'
++'_SDL_SetTextInputRect'.'SDL3.dll'.'SDL_SetTextInputRect'
++'_SDL_HasScreenKeyboardSupport'.'SDL3.dll'.'SDL_HasScreenKeyboardSupport'
++'_SDL_IsScreenKeyboardShown'.'SDL3.dll'.'SDL_IsScreenKeyboardShown'
++'_SDL_LoadObject'.'SDL3.dll'.'SDL_LoadObject'
++'_SDL_LoadFunction'.'SDL3.dll'.'SDL_LoadFunction'
++'_SDL_UnloadObject'.'SDL3.dll'.'SDL_UnloadObject'
++'_SDL_LogSetAllPriority'.'SDL3.dll'.'SDL_LogSetAllPriority'
++'_SDL_LogSetPriority'.'SDL3.dll'.'SDL_LogSetPriority'
++'_SDL_LogGetPriority'.'SDL3.dll'.'SDL_LogGetPriority'
++'_SDL_LogResetPriorities'.'SDL3.dll'.'SDL_LogResetPriorities'
++'_SDL_LogMessageV'.'SDL3.dll'.'SDL_LogMessageV'
++'_SDL_LogGetOutputFunction'.'SDL3.dll'.'SDL_LogGetOutputFunction'
++'_SDL_LogSetOutputFunction'.'SDL3.dll'.'SDL_LogSetOutputFunction'
++'_SDL_SetMainReady'.'SDL3.dll'.'SDL_SetMainReady'
++'_SDL_ShowMessageBox'.'SDL3.dll'.'SDL_ShowMessageBox'
++'_SDL_ShowSimpleMessageBox'.'SDL3.dll'.'SDL_ShowSimpleMessageBox'
++'_SDL_GetMouseFocus'.'SDL3.dll'.'SDL_GetMouseFocus'
++'_SDL_GetMouseState'.'SDL3.dll'.'SDL_GetMouseState'
++'_SDL_GetRelativeMouseState'.'SDL3.dll'.'SDL_GetRelativeMouseState'
++'_SDL_WarpMouseInWindow'.'SDL3.dll'.'SDL_WarpMouseInWindow'
++'_SDL_SetRelativeMouseMode'.'SDL3.dll'.'SDL_SetRelativeMouseMode'
++'_SDL_GetRelativeMouseMode'.'SDL3.dll'.'SDL_GetRelativeMouseMode'
++'_SDL_CreateCursor'.'SDL3.dll'.'SDL_CreateCursor'
++'_SDL_CreateColorCursor'.'SDL3.dll'.'SDL_CreateColorCursor'
++'_SDL_CreateSystemCursor'.'SDL3.dll'.'SDL_CreateSystemCursor'
++'_SDL_SetCursor'.'SDL3.dll'.'SDL_SetCursor'
++'_SDL_GetCursor'.'SDL3.dll'.'SDL_GetCursor'
++'_SDL_GetDefaultCursor'.'SDL3.dll'.'SDL_GetDefaultCursor'
++'_SDL_FreeCursor'.'SDL3.dll'.'SDL_FreeCursor'
++'_SDL_ShowCursor'.'SDL3.dll'.'SDL_ShowCursor'
++'_SDL_CreateMutex'.'SDL3.dll'.'SDL_CreateMutex'
++'_SDL_LockMutex'.'SDL3.dll'.'SDL_LockMutex'
++'_SDL_TryLockMutex'.'SDL3.dll'.'SDL_TryLockMutex'
++'_SDL_UnlockMutex'.'SDL3.dll'.'SDL_UnlockMutex'
++'_SDL_DestroyMutex'.'SDL3.dll'.'SDL_DestroyMutex'
++'_SDL_CreateSemaphore'.'SDL3.dll'.'SDL_CreateSemaphore'
++'_SDL_DestroySemaphore'.'SDL3.dll'.'SDL_DestroySemaphore'
++'_SDL_SemWait'.'SDL3.dll'.'SDL_SemWait'
++'_SDL_SemTryWait'.'SDL3.dll'.'SDL_SemTryWait'
++'_SDL_SemWaitTimeout'.'SDL3.dll'.'SDL_SemWaitTimeout'
++'_SDL_SemPost'.'SDL3.dll'.'SDL_SemPost'
++'_SDL_SemValue'.'SDL3.dll'.'SDL_SemValue'
++'_SDL_CreateCond'.'SDL3.dll'.'SDL_CreateCond'
++'_SDL_DestroyCond'.'SDL3.dll'.'SDL_DestroyCond'
++'_SDL_CondSignal'.'SDL3.dll'.'SDL_CondSignal'
++'_SDL_CondBroadcast'.'SDL3.dll'.'SDL_CondBroadcast'
++'_SDL_CondWait'.'SDL3.dll'.'SDL_CondWait'
++'_SDL_CondWaitTimeout'.'SDL3.dll'.'SDL_CondWaitTimeout'
++'_SDL_GetPixelFormatName'.'SDL3.dll'.'SDL_GetPixelFormatName'
++'_SDL_PixelFormatEnumToMasks'.'SDL3.dll'.'SDL_PixelFormatEnumToMasks'
++'_SDL_MasksToPixelFormatEnum'.'SDL3.dll'.'SDL_MasksToPixelFormatEnum'
++'_SDL_AllocFormat'.'SDL3.dll'.'SDL_AllocFormat'
++'_SDL_FreeFormat'.'SDL3.dll'.'SDL_FreeFormat'
++'_SDL_AllocPalette'.'SDL3.dll'.'SDL_AllocPalette'
++'_SDL_SetPixelFormatPalette'.'SDL3.dll'.'SDL_SetPixelFormatPalette'
++'_SDL_SetPaletteColors'.'SDL3.dll'.'SDL_SetPaletteColors'
++'_SDL_FreePalette'.'SDL3.dll'.'SDL_FreePalette'
++'_SDL_MapRGB'.'SDL3.dll'.'SDL_MapRGB'
++'_SDL_MapRGBA'.'SDL3.dll'.'SDL_MapRGBA'
++'_SDL_GetRGB'.'SDL3.dll'.'SDL_GetRGB'
++'_SDL_GetRGBA'.'SDL3.dll'.'SDL_GetRGBA'
++'_SDL_CalculateGammaRamp'.'SDL3.dll'.'SDL_CalculateGammaRamp'
++'_SDL_GetPlatform'.'SDL3.dll'.'SDL_GetPlatform'
++'_SDL_GetPowerInfo'.'SDL3.dll'.'SDL_GetPowerInfo'
++'_SDL_HasIntersection'.'SDL3.dll'.'SDL_HasIntersection'
++'_SDL_IntersectRect'.'SDL3.dll'.'SDL_IntersectRect'
++'_SDL_UnionRect'.'SDL3.dll'.'SDL_UnionRect'
++'_SDL_EnclosePoints'.'SDL3.dll'.'SDL_EnclosePoints'
++'_SDL_IntersectRectAndLine'.'SDL3.dll'.'SDL_IntersectRectAndLine'
++'_SDL_GetNumRenderDrivers'.'SDL3.dll'.'SDL_GetNumRenderDrivers'
++'_SDL_GetRenderDriverInfo'.'SDL3.dll'.'SDL_GetRenderDriverInfo'
++'_SDL_CreateWindowAndRenderer'.'SDL3.dll'.'SDL_CreateWindowAndRenderer'
++'_SDL_CreateRenderer'.'SDL3.dll'.'SDL_CreateRenderer'
++'_SDL_CreateSoftwareRenderer'.'SDL3.dll'.'SDL_CreateSoftwareRenderer'
++'_SDL_GetRenderer'.'SDL3.dll'.'SDL_GetRenderer'
++'_SDL_GetRendererInfo'.'SDL3.dll'.'SDL_GetRendererInfo'
++'_SDL_GetRendererOutputSize'.'SDL3.dll'.'SDL_GetRendererOutputSize'
++'_SDL_CreateTexture'.'SDL3.dll'.'SDL_CreateTexture'
++'_SDL_CreateTextureFromSurface'.'SDL3.dll'.'SDL_CreateTextureFromSurface'
++'_SDL_QueryTexture'.'SDL3.dll'.'SDL_QueryTexture'
++'_SDL_SetTextureColorMod'.'SDL3.dll'.'SDL_SetTextureColorMod'
++'_SDL_GetTextureColorMod'.'SDL3.dll'.'SDL_GetTextureColorMod'
++'_SDL_SetTextureAlphaMod'.'SDL3.dll'.'SDL_SetTextureAlphaMod'
++'_SDL_GetTextureAlphaMod'.'SDL3.dll'.'SDL_GetTextureAlphaMod'
++'_SDL_SetTextureBlendMode'.'SDL3.dll'.'SDL_SetTextureBlendMode'
++'_SDL_GetTextureBlendMode'.'SDL3.dll'.'SDL_GetTextureBlendMode'
++'_SDL_UpdateTexture'.'SDL3.dll'.'SDL_UpdateTexture'
++'_SDL_UpdateYUVTexture'.'SDL3.dll'.'SDL_UpdateYUVTexture'
++'_SDL_LockTexture'.'SDL3.dll'.'SDL_LockTexture'
++'_SDL_UnlockTexture'.'SDL3.dll'.'SDL_UnlockTexture'
++'_SDL_RenderTargetSupported'.'SDL3.dll'.'SDL_RenderTargetSupported'
++'_SDL_SetRenderTarget'.'SDL3.dll'.'SDL_SetRenderTarget'
++'_SDL_GetRenderTarget'.'SDL3.dll'.'SDL_GetRenderTarget'
++'_SDL_RenderSetLogicalSize'.'SDL3.dll'.'SDL_RenderSetLogicalSize'
++'_SDL_RenderGetLogicalSize'.'SDL3.dll'.'SDL_RenderGetLogicalSize'
++'_SDL_RenderSetViewport'.'SDL3.dll'.'SDL_RenderSetViewport'
++'_SDL_RenderGetViewport'.'SDL3.dll'.'SDL_RenderGetViewport'
++'_SDL_RenderSetClipRect'.'SDL3.dll'.'SDL_RenderSetClipRect'
++'_SDL_RenderGetClipRect'.'SDL3.dll'.'SDL_RenderGetClipRect'
++'_SDL_RenderSetScale'.'SDL3.dll'.'SDL_RenderSetScale'
++'_SDL_RenderGetScale'.'SDL3.dll'.'SDL_RenderGetScale'
++'_SDL_SetRenderDrawColor'.'SDL3.dll'.'SDL_SetRenderDrawColor'
++'_SDL_GetRenderDrawColor'.'SDL3.dll'.'SDL_GetRenderDrawColor'
++'_SDL_SetRenderDrawBlendMode'.'SDL3.dll'.'SDL_SetRenderDrawBlendMode'
++'_SDL_GetRenderDrawBlendMode'.'SDL3.dll'.'SDL_GetRenderDrawBlendMode'
++'_SDL_RenderClear'.'SDL3.dll'.'SDL_RenderClear'
++'_SDL_RenderDrawPoint'.'SDL3.dll'.'SDL_RenderDrawPoint'
++'_SDL_RenderDrawPoints'.'SDL3.dll'.'SDL_RenderDrawPoints'
++'_SDL_RenderDrawLine'.'SDL3.dll'.'SDL_RenderDrawLine'
++'_SDL_RenderDrawLines'.'SDL3.dll'.'SDL_RenderDrawLines'
++'_SDL_RenderDrawRect'.'SDL3.dll'.'SDL_RenderDrawRect'
++'_SDL_RenderDrawRects'.'SDL3.dll'.'SDL_RenderDrawRects'
++'_SDL_RenderFillRect'.'SDL3.dll'.'SDL_RenderFillRect'
++'_SDL_RenderFillRects'.'SDL3.dll'.'SDL_RenderFillRects'
++'_SDL_RenderCopy'.'SDL3.dll'.'SDL_RenderCopy'
++'_SDL_RenderCopyEx'.'SDL3.dll'.'SDL_RenderCopyEx'
++'_SDL_RenderReadPixels'.'SDL3.dll'.'SDL_RenderReadPixels'
++'_SDL_RenderPresent'.'SDL3.dll'.'SDL_RenderPresent'
++'_SDL_DestroyTexture'.'SDL3.dll'.'SDL_DestroyTexture'
++'_SDL_DestroyRenderer'.'SDL3.dll'.'SDL_DestroyRenderer'
++'_SDL_GL_BindTexture'.'SDL3.dll'.'SDL_GL_BindTexture'
++'_SDL_GL_UnbindTexture'.'SDL3.dll'.'SDL_GL_UnbindTexture'
++'_SDL_RWFromFile'.'SDL3.dll'.'SDL_RWFromFile'
++'_SDL_RWFromMem'.'SDL3.dll'.'SDL_RWFromMem'
++'_SDL_RWFromConstMem'.'SDL3.dll'.'SDL_RWFromConstMem'
++'_SDL_AllocRW'.'SDL3.dll'.'SDL_AllocRW'
++'_SDL_FreeRW'.'SDL3.dll'.'SDL_FreeRW'
++'_SDL_ReadU8'.'SDL3.dll'.'SDL_ReadU8'
++'_SDL_ReadLE16'.'SDL3.dll'.'SDL_ReadLE16'
++'_SDL_ReadBE16'.'SDL3.dll'.'SDL_ReadBE16'
++'_SDL_ReadLE32'.'SDL3.dll'.'SDL_ReadLE32'
++'_SDL_ReadBE32'.'SDL3.dll'.'SDL_ReadBE32'
++'_SDL_ReadLE64'.'SDL3.dll'.'SDL_ReadLE64'
++'_SDL_ReadBE64'.'SDL3.dll'.'SDL_ReadBE64'
++'_SDL_WriteU8'.'SDL3.dll'.'SDL_WriteU8'
++'_SDL_WriteLE16'.'SDL3.dll'.'SDL_WriteLE16'
++'_SDL_WriteBE16'.'SDL3.dll'.'SDL_WriteBE16'
++'_SDL_WriteLE32'.'SDL3.dll'.'SDL_WriteLE32'
++'_SDL_WriteBE32'.'SDL3.dll'.'SDL_WriteBE32'
++'_SDL_WriteLE64'.'SDL3.dll'.'SDL_WriteLE64'
++'_SDL_WriteBE64'.'SDL3.dll'.'SDL_WriteBE64'
++'_SDL_CreateShapedWindow'.'SDL3.dll'.'SDL_CreateShapedWindow'
++'_SDL_IsShapedWindow'.'SDL3.dll'.'SDL_IsShapedWindow'
++'_SDL_SetWindowShape'.'SDL3.dll'.'SDL_SetWindowShape'
++'_SDL_GetShapedWindowMode'.'SDL3.dll'.'SDL_GetShapedWindowMode'
++'_SDL_malloc'.'SDL3.dll'.'SDL_malloc'
++'_SDL_calloc'.'SDL3.dll'.'SDL_calloc'
++'_SDL_realloc'.'SDL3.dll'.'SDL_realloc'
++'_SDL_free'.'SDL3.dll'.'SDL_free'
++'_SDL_getenv'.'SDL3.dll'.'SDL_getenv'
++'_SDL_setenv'.'SDL3.dll'.'SDL_setenv'
++'_SDL_qsort'.'SDL3.dll'.'SDL_qsort'
++'_SDL_abs'.'SDL3.dll'.'SDL_abs'
++'_SDL_isdigit'.'SDL3.dll'.'SDL_isdigit'
++'_SDL_isspace'.'SDL3.dll'.'SDL_isspace'
++'_SDL_toupper'.'SDL3.dll'.'SDL_toupper'
++'_SDL_tolower'.'SDL3.dll'.'SDL_tolower'
++'_SDL_memset'.'SDL3.dll'.'SDL_memset'
++'_SDL_memcpy'.'SDL3.dll'.'SDL_memcpy'
++'_SDL_memmove'.'SDL3.dll'.'SDL_memmove'
++'_SDL_memcmp'.'SDL3.dll'.'SDL_memcmp'
++'_SDL_wcslen'.'SDL3.dll'.'SDL_wcslen'
++'_SDL_wcslcpy'.'SDL3.dll'.'SDL_wcslcpy'
++'_SDL_wcslcat'.'SDL3.dll'.'SDL_wcslcat'
++'_SDL_strlen'.'SDL3.dll'.'SDL_strlen'
++'_SDL_strlcpy'.'SDL3.dll'.'SDL_strlcpy'
++'_SDL_utf8strlcpy'.'SDL3.dll'.'SDL_utf8strlcpy'
++'_SDL_strlcat'.'SDL3.dll'.'SDL_strlcat'
++'_SDL_strdup'.'SDL3.dll'.'SDL_strdup'
++'_SDL_strrev'.'SDL3.dll'.'SDL_strrev'
++'_SDL_strupr'.'SDL3.dll'.'SDL_strupr'
++'_SDL_strlwr'.'SDL3.dll'.'SDL_strlwr'
++'_SDL_strchr'.'SDL3.dll'.'SDL_strchr'
++'_SDL_strrchr'.'SDL3.dll'.'SDL_strrchr'
++'_SDL_strstr'.'SDL3.dll'.'SDL_strstr'
++'_SDL_itoa'.'SDL3.dll'.'SDL_itoa'
++'_SDL_uitoa'.'SDL3.dll'.'SDL_uitoa'
++'_SDL_ltoa'.'SDL3.dll'.'SDL_ltoa'
++'_SDL_ultoa'.'SDL3.dll'.'SDL_ultoa'
++'_SDL_lltoa'.'SDL3.dll'.'SDL_lltoa'
++'_SDL_ulltoa'.'SDL3.dll'.'SDL_ulltoa'
++'_SDL_atoi'.'SDL3.dll'.'SDL_atoi'
++'_SDL_atof'.'SDL3.dll'.'SDL_atof'
++'_SDL_strtol'.'SDL3.dll'.'SDL_strtol'
++'_SDL_strtoul'.'SDL3.dll'.'SDL_strtoul'
++'_SDL_strtoll'.'SDL3.dll'.'SDL_strtoll'
++'_SDL_strtoull'.'SDL3.dll'.'SDL_strtoull'
++'_SDL_strtod'.'SDL3.dll'.'SDL_strtod'
++'_SDL_strcmp'.'SDL3.dll'.'SDL_strcmp'
++'_SDL_strncmp'.'SDL3.dll'.'SDL_strncmp'
++'_SDL_strcasecmp'.'SDL3.dll'.'SDL_strcasecmp'
++'_SDL_strncasecmp'.'SDL3.dll'.'SDL_strncasecmp'
++'_SDL_vsnprintf'.'SDL3.dll'.'SDL_vsnprintf'
++'_SDL_acos'.'SDL3.dll'.'SDL_acos'
++'_SDL_asin'.'SDL3.dll'.'SDL_asin'
++'_SDL_atan'.'SDL3.dll'.'SDL_atan'
++'_SDL_atan2'.'SDL3.dll'.'SDL_atan2'
++'_SDL_ceil'.'SDL3.dll'.'SDL_ceil'
++'_SDL_copysign'.'SDL3.dll'.'SDL_copysign'
++'_SDL_cos'.'SDL3.dll'.'SDL_cos'
++'_SDL_cosf'.'SDL3.dll'.'SDL_cosf'
++'_SDL_fabs'.'SDL3.dll'.'SDL_fabs'
++'_SDL_floor'.'SDL3.dll'.'SDL_floor'
++'_SDL_log'.'SDL3.dll'.'SDL_log'
++'_SDL_pow'.'SDL3.dll'.'SDL_pow'
++'_SDL_scalbn'.'SDL3.dll'.'SDL_scalbn'
++'_SDL_sin'.'SDL3.dll'.'SDL_sin'
++'_SDL_sinf'.'SDL3.dll'.'SDL_sinf'
++'_SDL_sqrt'.'SDL3.dll'.'SDL_sqrt'
++'_SDL_iconv_open'.'SDL3.dll'.'SDL_iconv_open'
++'_SDL_iconv_close'.'SDL3.dll'.'SDL_iconv_close'
++'_SDL_iconv'.'SDL3.dll'.'SDL_iconv'
++'_SDL_iconv_string'.'SDL3.dll'.'SDL_iconv_string'
++'_SDL_CreateRGBSurface'.'SDL3.dll'.'SDL_CreateRGBSurface'
++'_SDL_CreateRGBSurfaceFrom'.'SDL3.dll'.'SDL_CreateRGBSurfaceFrom'
++'_SDL_FreeSurface'.'SDL3.dll'.'SDL_FreeSurface'
++'_SDL_SetSurfacePalette'.'SDL3.dll'.'SDL_SetSurfacePalette'
++'_SDL_LockSurface'.'SDL3.dll'.'SDL_LockSurface'
++'_SDL_UnlockSurface'.'SDL3.dll'.'SDL_UnlockSurface'
++'_SDL_LoadBMP_RW'.'SDL3.dll'.'SDL_LoadBMP_RW'
++'_SDL_SaveBMP_RW'.'SDL3.dll'.'SDL_SaveBMP_RW'
++'_SDL_SetSurfaceRLE'.'SDL3.dll'.'SDL_SetSurfaceRLE'
++'_SDL_SetColorKey'.'SDL3.dll'.'SDL_SetColorKey'
++'_SDL_GetColorKey'.'SDL3.dll'.'SDL_GetColorKey'
++'_SDL_SetSurfaceColorMod'.'SDL3.dll'.'SDL_SetSurfaceColorMod'
++'_SDL_GetSurfaceColorMod'.'SDL3.dll'.'SDL_GetSurfaceColorMod'
++'_SDL_SetSurfaceAlphaMod'.'SDL3.dll'.'SDL_SetSurfaceAlphaMod'
++'_SDL_GetSurfaceAlphaMod'.'SDL3.dll'.'SDL_GetSurfaceAlphaMod'
++'_SDL_SetSurfaceBlendMode'.'SDL3.dll'.'SDL_SetSurfaceBlendMode'
++'_SDL_GetSurfaceBlendMode'.'SDL3.dll'.'SDL_GetSurfaceBlendMode'
++'_SDL_SetClipRect'.'SDL3.dll'.'SDL_SetClipRect'
++'_SDL_GetClipRect'.'SDL3.dll'.'SDL_GetClipRect'
++'_SDL_ConvertSurface'.'SDL3.dll'.'SDL_ConvertSurface'
++'_SDL_ConvertSurfaceFormat'.'SDL3.dll'.'SDL_ConvertSurfaceFormat'
++'_SDL_ConvertPixels'.'SDL3.dll'.'SDL_ConvertPixels'
++'_SDL_FillRect'.'SDL3.dll'.'SDL_FillRect'
++'_SDL_FillRects'.'SDL3.dll'.'SDL_FillRects'
++'_SDL_UpperBlit'.'SDL3.dll'.'SDL_UpperBlit'
++'_SDL_LowerBlit'.'SDL3.dll'.'SDL_LowerBlit'
++'_SDL_SoftStretch'.'SDL3.dll'.'SDL_SoftStretch'
++'_SDL_UpperBlitScaled'.'SDL3.dll'.'SDL_UpperBlitScaled'
++'_SDL_LowerBlitScaled'.'SDL3.dll'.'SDL_LowerBlitScaled'
++'_SDL_GetWindowWMInfo'.'SDL3.dll'.'SDL_GetWindowWMInfo'
++'_SDL_GetThreadName'.'SDL3.dll'.'SDL_GetThreadName'
++'_SDL_ThreadID'.'SDL3.dll'.'SDL_ThreadID'
++'_SDL_GetThreadID'.'SDL3.dll'.'SDL_GetThreadID'
++'_SDL_SetThreadPriority'.'SDL3.dll'.'SDL_SetThreadPriority'
++'_SDL_WaitThread'.'SDL3.dll'.'SDL_WaitThread'
++'_SDL_DetachThread'.'SDL3.dll'.'SDL_DetachThread'
++'_SDL_TLSCreate'.'SDL3.dll'.'SDL_TLSCreate'
++'_SDL_TLSGet'.'SDL3.dll'.'SDL_TLSGet'
++'_SDL_TLSSet'.'SDL3.dll'.'SDL_TLSSet'
++'_SDL_GetTicks'.'SDL3.dll'.'SDL_GetTicks'
++'_SDL_GetPerformanceCounter'.'SDL3.dll'.'SDL_GetPerformanceCounter'
++'_SDL_GetPerformanceFrequency'.'SDL3.dll'.'SDL_GetPerformanceFrequency'
++'_SDL_Delay'.'SDL3.dll'.'SDL_Delay'
++'_SDL_AddTimer'.'SDL3.dll'.'SDL_AddTimer'
++'_SDL_RemoveTimer'.'SDL3.dll'.'SDL_RemoveTimer'
++'_SDL_GetNumTouchDevices'.'SDL3.dll'.'SDL_GetNumTouchDevices'
++'_SDL_GetTouchDevice'.'SDL3.dll'.'SDL_GetTouchDevice'
++'_SDL_GetNumTouchFingers'.'SDL3.dll'.'SDL_GetNumTouchFingers'
++'_SDL_GetTouchFinger'.'SDL3.dll'.'SDL_GetTouchFinger'
++'_SDL_GetVersion'.'SDL3.dll'.'SDL_GetVersion'
++'_SDL_GetRevision'.'SDL3.dll'.'SDL_GetRevision'
++'_SDL_GetRevisionNumber'.'SDL3.dll'.'SDL_GetRevisionNumber'
++'_SDL_GetNumVideoDrivers'.'SDL3.dll'.'SDL_GetNumVideoDrivers'
++'_SDL_GetVideoDriver'.'SDL3.dll'.'SDL_GetVideoDriver'
++'_SDL_VideoInit'.'SDL3.dll'.'SDL_VideoInit'
++'_SDL_VideoQuit'.'SDL3.dll'.'SDL_VideoQuit'
++'_SDL_GetCurrentVideoDriver'.'SDL3.dll'.'SDL_GetCurrentVideoDriver'
++'_SDL_GetNumVideoDisplays'.'SDL3.dll'.'SDL_GetNumVideoDisplays'
++'_SDL_GetDisplayName'.'SDL3.dll'.'SDL_GetDisplayName'
++'_SDL_GetDisplayBounds'.'SDL3.dll'.'SDL_GetDisplayBounds'
++'_SDL_GetDisplayDPI'.'SDL3.dll'.'SDL_GetDisplayDPI'
++'_SDL_GetNumDisplayModes'.'SDL3.dll'.'SDL_GetNumDisplayModes'
++'_SDL_GetDisplayMode'.'SDL3.dll'.'SDL_GetDisplayMode'
++'_SDL_GetDesktopDisplayMode'.'SDL3.dll'.'SDL_GetDesktopDisplayMode'
++'_SDL_GetCurrentDisplayMode'.'SDL3.dll'.'SDL_GetCurrentDisplayMode'
++'_SDL_GetClosestDisplayMode'.'SDL3.dll'.'SDL_GetClosestDisplayMode'
++'_SDL_GetWindowDisplayIndex'.'SDL3.dll'.'SDL_GetWindowDisplayIndex'
++'_SDL_SetWindowDisplayMode'.'SDL3.dll'.'SDL_SetWindowDisplayMode'
++'_SDL_GetWindowDisplayMode'.'SDL3.dll'.'SDL_GetWindowDisplayMode'
++'_SDL_GetWindowPixelFormat'.'SDL3.dll'.'SDL_GetWindowPixelFormat'
++'_SDL_CreateWindow'.'SDL3.dll'.'SDL_CreateWindow'
++'_SDL_CreateWindowFrom'.'SDL3.dll'.'SDL_CreateWindowFrom'
++'_SDL_GetWindowID'.'SDL3.dll'.'SDL_GetWindowID'
++'_SDL_GetWindowFromID'.'SDL3.dll'.'SDL_GetWindowFromID'
++'_SDL_GetWindowFlags'.'SDL3.dll'.'SDL_GetWindowFlags'
++'_SDL_SetWindowTitle'.'SDL3.dll'.'SDL_SetWindowTitle'
++'_SDL_GetWindowTitle'.'SDL3.dll'.'SDL_GetWindowTitle'
++'_SDL_SetWindowIcon'.'SDL3.dll'.'SDL_SetWindowIcon'
++'_SDL_SetWindowData'.'SDL3.dll'.'SDL_SetWindowData'
++'_SDL_GetWindowData'.'SDL3.dll'.'SDL_GetWindowData'
++'_SDL_SetWindowPosition'.'SDL3.dll'.'SDL_SetWindowPosition'
++'_SDL_GetWindowPosition'.'SDL3.dll'.'SDL_GetWindowPosition'
++'_SDL_SetWindowSize'.'SDL3.dll'.'SDL_SetWindowSize'
++'_SDL_GetWindowSize'.'SDL3.dll'.'SDL_GetWindowSize'
++'_SDL_SetWindowMinimumSize'.'SDL3.dll'.'SDL_SetWindowMinimumSize'
++'_SDL_GetWindowMinimumSize'.'SDL3.dll'.'SDL_GetWindowMinimumSize'
++'_SDL_SetWindowMaximumSize'.'SDL3.dll'.'SDL_SetWindowMaximumSize'
++'_SDL_GetWindowMaximumSize'.'SDL3.dll'.'SDL_GetWindowMaximumSize'
++'_SDL_SetWindowBordered'.'SDL3.dll'.'SDL_SetWindowBordered'
++'_SDL_ShowWindow'.'SDL3.dll'.'SDL_ShowWindow'
++'_SDL_HideWindow'.'SDL3.dll'.'SDL_HideWindow'
++'_SDL_RaiseWindow'.'SDL3.dll'.'SDL_RaiseWindow'
++'_SDL_MaximizeWindow'.'SDL3.dll'.'SDL_MaximizeWindow'
++'_SDL_MinimizeWindow'.'SDL3.dll'.'SDL_MinimizeWindow'
++'_SDL_RestoreWindow'.'SDL3.dll'.'SDL_RestoreWindow'
++'_SDL_SetWindowFullscreen'.'SDL3.dll'.'SDL_SetWindowFullscreen'
++'_SDL_GetWindowSurface'.'SDL3.dll'.'SDL_GetWindowSurface'
++'_SDL_UpdateWindowSurface'.'SDL3.dll'.'SDL_UpdateWindowSurface'
++'_SDL_UpdateWindowSurfaceRects'.'SDL3.dll'.'SDL_UpdateWindowSurfaceRects'
++'_SDL_SetWindowGrab'.'SDL3.dll'.'SDL_SetWindowGrab'
++'_SDL_GetWindowGrab'.'SDL3.dll'.'SDL_GetWindowGrab'
++'_SDL_SetWindowBrightness'.'SDL3.dll'.'SDL_SetWindowBrightness'
++'_SDL_GetWindowBrightness'.'SDL3.dll'.'SDL_GetWindowBrightness'
++'_SDL_SetWindowGammaRamp'.'SDL3.dll'.'SDL_SetWindowGammaRamp'
++'_SDL_GetWindowGammaRamp'.'SDL3.dll'.'SDL_GetWindowGammaRamp'
++'_SDL_DestroyWindow'.'SDL3.dll'.'SDL_DestroyWindow'
++'_SDL_IsScreenSaverEnabled'.'SDL3.dll'.'SDL_IsScreenSaverEnabled'
++'_SDL_EnableScreenSaver'.'SDL3.dll'.'SDL_EnableScreenSaver'
++'_SDL_DisableScreenSaver'.'SDL3.dll'.'SDL_DisableScreenSaver'
++'_SDL_GL_LoadLibrary'.'SDL3.dll'.'SDL_GL_LoadLibrary'
++'_SDL_GL_GetProcAddress'.'SDL3.dll'.'SDL_GL_GetProcAddress'
++'_SDL_GL_UnloadLibrary'.'SDL3.dll'.'SDL_GL_UnloadLibrary'
++'_SDL_GL_ExtensionSupported'.'SDL3.dll'.'SDL_GL_ExtensionSupported'
++'_SDL_GL_SetAttribute'.'SDL3.dll'.'SDL_GL_SetAttribute'
++'_SDL_GL_GetAttribute'.'SDL3.dll'.'SDL_GL_GetAttribute'
++'_SDL_GL_CreateContext'.'SDL3.dll'.'SDL_GL_CreateContext'
++'_SDL_GL_MakeCurrent'.'SDL3.dll'.'SDL_GL_MakeCurrent'
++'_SDL_GL_GetCurrentWindow'.'SDL3.dll'.'SDL_GL_GetCurrentWindow'
++'_SDL_GL_GetCurrentContext'.'SDL3.dll'.'SDL_GL_GetCurrentContext'
++'_SDL_GL_GetDrawableSize'.'SDL3.dll'.'SDL_GL_GetDrawableSize'
++'_SDL_GL_SetSwapInterval'.'SDL3.dll'.'SDL_GL_SetSwapInterval'
++'_SDL_GL_GetSwapInterval'.'SDL3.dll'.'SDL_GL_GetSwapInterval'
++'_SDL_GL_SwapWindow'.'SDL3.dll'.'SDL_GL_SwapWindow'
++'_SDL_GL_DeleteContext'.'SDL3.dll'.'SDL_GL_DeleteContext'
++'_SDL_vsscanf'.'SDL3.dll'.'SDL_vsscanf'
++'_SDL_GameControllerAddMappingsFromRW'.'SDL3.dll'.'SDL_GameControllerAddMappingsFromRW'
++'_SDL_GL_ResetAttributes'.'SDL3.dll'.'SDL_GL_ResetAttributes'
++'_SDL_HasAVX'.'SDL3.dll'.'SDL_HasAVX'
++'_SDL_GetDefaultAssertionHandler'.'SDL3.dll'.'SDL_GetDefaultAssertionHandler'
++'_SDL_GetAssertionHandler'.'SDL3.dll'.'SDL_GetAssertionHandler'
++'_SDL_DXGIGetOutputInfo'.'SDL3.dll'.'SDL_DXGIGetOutputInfo'
++'_SDL_RenderIsClipEnabled'.'SDL3.dll'.'SDL_RenderIsClipEnabled'
# ++'_SDL_WinRTRunApp'.'SDL3.dll'.'SDL_WinRTRunApp'
++'_SDL_WarpMouseGlobal'.'SDL3.dll'.'SDL_WarpMouseGlobal'
# ++'_SDL_WinRTGetFSPathUNICODE'.'SDL3.dll'.'SDL_WinRTGetFSPathUNICODE'
# ++'_SDL_WinRTGetFSPathUTF8'.'SDL3.dll'.'SDL_WinRTGetFSPathUTF8'
++'_SDL_sqrtf'.'SDL3.dll'.'SDL_sqrtf'
++'_SDL_tan'.'SDL3.dll'.'SDL_tan'
++'_SDL_tanf'.'SDL3.dll'.'SDL_tanf'
++'_SDL_CaptureMouse'.'SDL3.dll'.'SDL_CaptureMouse'
++'_SDL_SetWindowHitTest'.'SDL3.dll'.'SDL_SetWindowHitTest'
++'_SDL_GetGlobalMouseState'.'SDL3.dll'.'SDL_GetGlobalMouseState'
++'_SDL_HasAVX2'.'SDL3.dll'.'SDL_HasAVX2'
++'_SDL_QueueAudio'.'SDL3.dll'.'SDL_QueueAudio'
++'_SDL_GetQueuedAudioSize'.'SDL3.dll'.'SDL_GetQueuedAudioSize'
++'_SDL_ClearQueuedAudio'.'SDL3.dll'.'SDL_ClearQueuedAudio'
++'_SDL_GetGrabbedWindow'.'SDL3.dll'.'SDL_GetGrabbedWindow'
++'_SDL_SetWindowsMessageHook'.'SDL3.dll'.'SDL_SetWindowsMessageHook'
++'_SDL_JoystickCurrentPowerLevel'.'SDL3.dll'.'SDL_JoystickCurrentPowerLevel'
++'_SDL_GameControllerFromInstanceID'.'SDL3.dll'.'SDL_GameControllerFromInstanceID'
++'_SDL_JoystickFromInstanceID'.'SDL3.dll'.'SDL_JoystickFromInstanceID'
++'_SDL_GetDisplayUsableBounds'.'SDL3.dll'.'SDL_GetDisplayUsableBounds'
++'_SDL_GetWindowBordersSize'.'SDL3.dll'.'SDL_GetWindowBordersSize'
++'_SDL_SetWindowOpacity'.'SDL3.dll'.'SDL_SetWindowOpacity'
++'_SDL_GetWindowOpacity'.'SDL3.dll'.'SDL_GetWindowOpacity'
++'_SDL_SetWindowInputFocus'.'SDL3.dll'.'SDL_SetWindowInputFocus'
++'_SDL_SetWindowModalFor'.'SDL3.dll'.'SDL_SetWindowModalFor'
++'_SDL_RenderSetIntegerScale'.'SDL3.dll'.'SDL_RenderSetIntegerScale'
++'_SDL_RenderGetIntegerScale'.'SDL3.dll'.'SDL_RenderGetIntegerScale'
++'_SDL_DequeueAudio'.'SDL3.dll'.'SDL_DequeueAudio'
++'_SDL_SetWindowResizable'.'SDL3.dll'.'SDL_SetWindowResizable'
++'_SDL_CreateRGBSurfaceWithFormat'.'SDL3.dll'.'SDL_CreateRGBSurfaceWithFormat'
++'_SDL_CreateRGBSurfaceWithFormatFrom'.'SDL3.dll'.'SDL_CreateRGBSurfaceWithFormatFrom'
++'_SDL_GetHintBoolean'.'SDL3.dll'.'SDL_GetHintBoolean'
++'_SDL_JoystickGetDeviceVendor'.'SDL3.dll'.'SDL_JoystickGetDeviceVendor'
++'_SDL_JoystickGetDeviceProduct'.'SDL3.dll'.'SDL_JoystickGetDeviceProduct'
++'_SDL_JoystickGetDeviceProductVersion'.'SDL3.dll'.'SDL_JoystickGetDeviceProductVersion'
++'_SDL_JoystickGetVendor'.'SDL3.dll'.'SDL_JoystickGetVendor'
++'_SDL_JoystickGetProduct'.'SDL3.dll'.'SDL_JoystickGetProduct'
++'_SDL_JoystickGetProductVersion'.'SDL3.dll'.'SDL_JoystickGetProductVersion'
++'_SDL_GameControllerGetVendor'.'SDL3.dll'.'SDL_GameControllerGetVendor'
++'_SDL_GameControllerGetProduct'.'SDL3.dll'.'SDL_GameControllerGetProduct'
++'_SDL_GameControllerGetProductVersion'.'SDL3.dll'.'SDL_GameControllerGetProductVersion'
++'_SDL_HasNEON'.'SDL3.dll'.'SDL_HasNEON'
++'_SDL_GameControllerNumMappings'.'SDL3.dll'.'SDL_GameControllerNumMappings'
++'_SDL_GameControllerMappingForIndex'.'SDL3.dll'.'SDL_GameControllerMappingForIndex'
++'_SDL_JoystickGetAxisInitialState'.'SDL3.dll'.'SDL_JoystickGetAxisInitialState'
++'_SDL_JoystickGetDeviceType'.'SDL3.dll'.'SDL_JoystickGetDeviceType'
++'_SDL_JoystickGetType'.'SDL3.dll'.'SDL_JoystickGetType'
++'_SDL_MemoryBarrierReleaseFunction'.'SDL3.dll'.'SDL_MemoryBarrierReleaseFunction'
++'_SDL_MemoryBarrierAcquireFunction'.'SDL3.dll'.'SDL_MemoryBarrierAcquireFunction'
++'_SDL_JoystickGetDeviceInstanceID'.'SDL3.dll'.'SDL_JoystickGetDeviceInstanceID'
++'_SDL_utf8strlen'.'SDL3.dll'.'SDL_utf8strlen'
++'_SDL_LoadFile_RW'.'SDL3.dll'.'SDL_LoadFile_RW'
++'_SDL_wcscmp'.'SDL3.dll'.'SDL_wcscmp'
++'_SDL_ComposeCustomBlendMode'.'SDL3.dll'.'SDL_ComposeCustomBlendMode'
++'_SDL_DuplicateSurface'.'SDL3.dll'.'SDL_DuplicateSurface'
++'_SDL_Vulkan_LoadLibrary'.'SDL3.dll'.'SDL_Vulkan_LoadLibrary'
++'_SDL_Vulkan_GetVkGetInstanceProcAddr'.'SDL3.dll'.'SDL_Vulkan_GetVkGetInstanceProcAddr'
++'_SDL_Vulkan_UnloadLibrary'.'SDL3.dll'.'SDL_Vulkan_UnloadLibrary'
++'_SDL_Vulkan_GetInstanceExtensions'.'SDL3.dll'.'SDL_Vulkan_GetInstanceExtensions'
++'_SDL_Vulkan_CreateSurface'.'SDL3.dll'.'SDL_Vulkan_CreateSurface'
++'_SDL_Vulkan_GetDrawableSize'.'SDL3.dll'.'SDL_Vulkan_GetDrawableSize'
++'_SDL_LockJoysticks'.'SDL3.dll'.'SDL_LockJoysticks'
++'_SDL_UnlockJoysticks'.'SDL3.dll'.'SDL_UnlockJoysticks'
++'_SDL_GetMemoryFunctions'.'SDL3.dll'.'SDL_GetMemoryFunctions'
++'_SDL_SetMemoryFunctions'.'SDL3.dll'.'SDL_SetMemoryFunctions'
++'_SDL_GetNumAllocations'.'SDL3.dll'.'SDL_GetNumAllocations'
++'_SDL_NewAudioStream'.'SDL3.dll'.'SDL_NewAudioStream'
++'_SDL_AudioStreamPut'.'SDL3.dll'.'SDL_AudioStreamPut'
++'_SDL_AudioStreamGet'.'SDL3.dll'.'SDL_AudioStreamGet'
++'_SDL_AudioStreamClear'.'SDL3.dll'.'SDL_AudioStreamClear'
++'_SDL_AudioStreamAvailable'.'SDL3.dll'.'SDL_AudioStreamAvailable'
++'_SDL_FreeAudioStream'.'SDL3.dll'.'SDL_FreeAudioStream'
++'_SDL_AudioStreamFlush'.'SDL3.dll'.'SDL_AudioStreamFlush'
++'_SDL_acosf'.'SDL3.dll'.'SDL_acosf'
++'_SDL_asinf'.'SDL3.dll'.'SDL_asinf'
++'_SDL_atanf'.'SDL3.dll'.'SDL_atanf'
++'_SDL_atan2f'.'SDL3.dll'.'SDL_atan2f'
++'_SDL_ceilf'.'SDL3.dll'.'SDL_ceilf'
++'_SDL_copysignf'.'SDL3.dll'.'SDL_copysignf'
++'_SDL_fabsf'.'SDL3.dll'.'SDL_fabsf'
++'_SDL_floorf'.'SDL3.dll'.'SDL_floorf'
++'_SDL_logf'.'SDL3.dll'.'SDL_logf'
++'_SDL_powf'.'SDL3.dll'.'SDL_powf'
++'_SDL_scalbnf'.'SDL3.dll'.'SDL_scalbnf'
++'_SDL_fmod'.'SDL3.dll'.'SDL_fmod'
++'_SDL_fmodf'.'SDL3.dll'.'SDL_fmodf'
++'_SDL_SetYUVConversionMode'.'SDL3.dll'.'SDL_SetYUVConversionMode'
++'_SDL_GetYUVConversionMode'.'SDL3.dll'.'SDL_GetYUVConversionMode'
++'_SDL_GetYUVConversionModeForResolution'.'SDL3.dll'.'SDL_GetYUVConversionModeForResolution'
++'_SDL_RenderGetMetalLayer'.'SDL3.dll'.'SDL_RenderGetMetalLayer'
++'_SDL_RenderGetMetalCommandEncoder'.'SDL3.dll'.'SDL_RenderGetMetalCommandEncoder'
# ++'_SDL_IsAndroidTV'.'SDL3.dll'.'SDL_IsAndroidTV'
# ++'_SDL_WinRTGetDeviceFamily'.'SDL3.dll'.'SDL_WinRTGetDeviceFamily'
++'_SDL_log10'.'SDL3.dll'.'SDL_log10'
++'_SDL_log10f'.'SDL3.dll'.'SDL_log10f'
++'_SDL_GameControllerMappingForDeviceIndex'.'SDL3.dll'.'SDL_GameControllerMappingForDeviceIndex'
# ++'_SDL_LinuxSetThreadPriority'.'SDL3.dll'.'SDL_LinuxSetThreadPriority'
++'_SDL_HasAVX512F'.'SDL3.dll'.'SDL_HasAVX512F'
# ++'_SDL_IsChromebook'.'SDL3.dll'.'SDL_IsChromebook'
# ++'_SDL_IsDeXMode'.'SDL3.dll'.'SDL_IsDeXMode'
# ++'_SDL_AndroidBackButton'.'SDL3.dll'.'SDL_AndroidBackButton'
++'_SDL_exp'.'SDL3.dll'.'SDL_exp'
++'_SDL_expf'.'SDL3.dll'.'SDL_expf'
++'_SDL_wcsdup'.'SDL3.dll'.'SDL_wcsdup'
++'_SDL_GameControllerRumble'.'SDL3.dll'.'SDL_GameControllerRumble'
++'_SDL_JoystickRumble'.'SDL3.dll'.'SDL_JoystickRumble'
++'_SDL_NumSensors'.'SDL3.dll'.'SDL_NumSensors'
++'_SDL_SensorGetDeviceName'.'SDL3.dll'.'SDL_SensorGetDeviceName'
++'_SDL_SensorGetDeviceType'.'SDL3.dll'.'SDL_SensorGetDeviceType'
++'_SDL_SensorGetDeviceNonPortableType'.'SDL3.dll'.'SDL_SensorGetDeviceNonPortableType'
++'_SDL_SensorGetDeviceInstanceID'.'SDL3.dll'.'SDL_SensorGetDeviceInstanceID'
++'_SDL_SensorOpen'.'SDL3.dll'.'SDL_SensorOpen'
++'_SDL_SensorFromInstanceID'.'SDL3.dll'.'SDL_SensorFromInstanceID'
++'_SDL_SensorGetName'.'SDL3.dll'.'SDL_SensorGetName'
++'_SDL_SensorGetType'.'SDL3.dll'.'SDL_SensorGetType'
++'_SDL_SensorGetNonPortableType'.'SDL3.dll'.'SDL_SensorGetNonPortableType'
++'_SDL_SensorGetInstanceID'.'SDL3.dll'.'SDL_SensorGetInstanceID'
++'_SDL_SensorGetData'.'SDL3.dll'.'SDL_SensorGetData'
++'_SDL_SensorClose'.'SDL3.dll'.'SDL_SensorClose'
++'_SDL_SensorUpdate'.'SDL3.dll'.'SDL_SensorUpdate'
++'_SDL_IsTablet'.'SDL3.dll'.'SDL_IsTablet'
++'_SDL_GetDisplayOrientation'.'SDL3.dll'.'SDL_GetDisplayOrientation'
++'_SDL_HasColorKey'.'SDL3.dll'.'SDL_HasColorKey'
++'_SDL_CreateThreadWithStackSize'.'SDL3.dll'.'SDL_CreateThreadWithStackSize'
++'_SDL_JoystickGetDevicePlayerIndex'.'SDL3.dll'.'SDL_JoystickGetDevicePlayerIndex'
++'_SDL_JoystickGetPlayerIndex'.'SDL3.dll'.'SDL_JoystickGetPlayerIndex'
++'_SDL_GameControllerGetPlayerIndex'.'SDL3.dll'.'SDL_GameControllerGetPlayerIndex'
++'_SDL_RenderFlush'.'SDL3.dll'.'SDL_RenderFlush'
++'_SDL_RenderDrawPointF'.'SDL3.dll'.'SDL_RenderDrawPointF'
++'_SDL_RenderDrawPointsF'.'SDL3.dll'.'SDL_RenderDrawPointsF'
++'_SDL_RenderDrawLineF'.'SDL3.dll'.'SDL_RenderDrawLineF'
++'_SDL_RenderDrawLinesF'.'SDL3.dll'.'SDL_RenderDrawLinesF'
++'_SDL_RenderDrawRectF'.'SDL3.dll'.'SDL_RenderDrawRectF'
++'_SDL_RenderDrawRectsF'.'SDL3.dll'.'SDL_RenderDrawRectsF'
++'_SDL_RenderFillRectF'.'SDL3.dll'.'SDL_RenderFillRectF'
++'_SDL_RenderFillRectsF'.'SDL3.dll'.'SDL_RenderFillRectsF'
++'_SDL_RenderCopyF'.'SDL3.dll'.'SDL_RenderCopyF'
++'_SDL_RenderCopyExF'.'SDL3.dll'.'SDL_RenderCopyExF'
++'_SDL_GetTouchDeviceType'.'SDL3.dll'.'SDL_GetTouchDeviceType'
# ++'_SDL_UIKitRunApp'.'SDL3.dll'.'SDL_UIKitRunApp'
++'_SDL_SIMDGetAlignment'.'SDL3.dll'.'SDL_SIMDGetAlignment'
++'_SDL_SIMDAlloc'.'SDL3.dll'.'SDL_SIMDAlloc'
++'_SDL_SIMDFree'.'SDL3.dll'.'SDL_SIMDFree'
++'_SDL_RWsize'.'SDL3.dll'.'SDL_RWsize'
++'_SDL_RWseek'.'SDL3.dll'.'SDL_RWseek'
++'_SDL_RWtell'.'SDL3.dll'.'SDL_RWtell'
++'_SDL_RWread'.'SDL3.dll'.'SDL_RWread'
++'_SDL_RWwrite'.'SDL3.dll'.'SDL_RWwrite'
++'_SDL_RWclose'.'SDL3.dll'.'SDL_RWclose'
++'_SDL_LoadFile'.'SDL3.dll'.'SDL_LoadFile'
++'_SDL_Metal_CreateView'.'SDL3.dll'.'SDL_Metal_CreateView'
++'_SDL_Metal_DestroyView'.'SDL3.dll'.'SDL_Metal_DestroyView'
++'_SDL_LockTextureToSurface'.'SDL3.dll'.'SDL_LockTextureToSurface'
++'_SDL_HasARMSIMD'.'SDL3.dll'.'SDL_HasARMSIMD'
++'_SDL_strtokr'.'SDL3.dll'.'SDL_strtokr'
++'_SDL_wcsstr'.'SDL3.dll'.'SDL_wcsstr'
++'_SDL_wcsncmp'.'SDL3.dll'.'SDL_wcsncmp'
++'_SDL_GameControllerTypeForIndex'.'SDL3.dll'.'SDL_GameControllerTypeForIndex'
++'_SDL_GameControllerGetType'.'SDL3.dll'.'SDL_GameControllerGetType'
++'_SDL_GameControllerFromPlayerIndex'.'SDL3.dll'.'SDL_GameControllerFromPlayerIndex'
++'_SDL_GameControllerSetPlayerIndex'.'SDL3.dll'.'SDL_GameControllerSetPlayerIndex'
++'_SDL_JoystickFromPlayerIndex'.'SDL3.dll'.'SDL_JoystickFromPlayerIndex'
++'_SDL_JoystickSetPlayerIndex'.'SDL3.dll'.'SDL_JoystickSetPlayerIndex'
++'_SDL_SetTextureScaleMode'.'SDL3.dll'.'SDL_SetTextureScaleMode'
++'_SDL_GetTextureScaleMode'.'SDL3.dll'.'SDL_GetTextureScaleMode'
++'_SDL_OnApplicationWillTerminate'.'SDL3.dll'.'SDL_OnApplicationWillTerminate'
++'_SDL_OnApplicationDidReceiveMemoryWarning'.'SDL3.dll'.'SDL_OnApplicationDidReceiveMemoryWarning'
++'_SDL_OnApplicationWillResignActive'.'SDL3.dll'.'SDL_OnApplicationWillResignActive'
++'_SDL_OnApplicationDidEnterBackground'.'SDL3.dll'.'SDL_OnApplicationDidEnterBackground'
++'_SDL_OnApplicationWillEnterForeground'.'SDL3.dll'.'SDL_OnApplicationWillEnterForeground'
++'_SDL_OnApplicationDidBecomeActive'.'SDL3.dll'.'SDL_OnApplicationDidBecomeActive'
# ++'_SDL_OnApplicationDidChangeStatusBarOrientation'.'SDL3.dll'.'SDL_OnApplicationDidChangeStatusBarOrientation'
# ++'_SDL_GetAndroidSDKVersion'.'SDL3.dll'.'SDL_GetAndroidSDKVersion'
++'_SDL_isupper'.'SDL3.dll'.'SDL_isupper'
++'_SDL_islower'.'SDL3.dll'.'SDL_islower'
++'_SDL_JoystickAttachVirtual'.'SDL3.dll'.'SDL_JoystickAttachVirtual'
++'_SDL_JoystickDetachVirtual'.'SDL3.dll'.'SDL_JoystickDetachVirtual'
++'_SDL_JoystickIsVirtual'.'SDL3.dll'.'SDL_JoystickIsVirtual'
++'_SDL_JoystickSetVirtualAxis'.'SDL3.dll'.'SDL_JoystickSetVirtualAxis'
++'_SDL_JoystickSetVirtualButton'.'SDL3.dll'.'SDL_JoystickSetVirtualButton'
++'_SDL_JoystickSetVirtualHat'.'SDL3.dll'.'SDL_JoystickSetVirtualHat'
++'_SDL_GetErrorMsg'.'SDL3.dll'.'SDL_GetErrorMsg'
++'_SDL_LockSensors'.'SDL3.dll'.'SDL_LockSensors'
++'_SDL_UnlockSensors'.'SDL3.dll'.'SDL_UnlockSensors'
++'_SDL_Metal_GetLayer'.'SDL3.dll'.'SDL_Metal_GetLayer'
++'_SDL_Metal_GetDrawableSize'.'SDL3.dll'.'SDL_Metal_GetDrawableSize'
++'_SDL_trunc'.'SDL3.dll'.'SDL_trunc'
++'_SDL_truncf'.'SDL3.dll'.'SDL_truncf'
++'_SDL_GetPreferredLocales'.'SDL3.dll'.'SDL_GetPreferredLocales'
++'_SDL_SIMDRealloc'.'SDL3.dll'.'SDL_SIMDRealloc'
# ++'_SDL_AndroidRequestPermission'.'SDL3.dll'.'SDL_AndroidRequestPermission'
++'_SDL_OpenURL'.'SDL3.dll'.'SDL_OpenURL'
++'_SDL_HasSurfaceRLE'.'SDL3.dll'.'SDL_HasSurfaceRLE'
++'_SDL_GameControllerHasLED'.'SDL3.dll'.'SDL_GameControllerHasLED'
++'_SDL_GameControllerSetLED'.'SDL3.dll'.'SDL_GameControllerSetLED'
++'_SDL_JoystickHasLED'.'SDL3.dll'.'SDL_JoystickHasLED'
++'_SDL_JoystickSetLED'.'SDL3.dll'.'SDL_JoystickSetLED'
++'_SDL_GameControllerRumbleTriggers'.'SDL3.dll'.'SDL_GameControllerRumbleTriggers'
++'_SDL_JoystickRumbleTriggers'.'SDL3.dll'.'SDL_JoystickRumbleTriggers'
++'_SDL_GameControllerHasAxis'.'SDL3.dll'.'SDL_GameControllerHasAxis'
++'_SDL_GameControllerHasButton'.'SDL3.dll'.'SDL_GameControllerHasButton'
++'_SDL_GameControllerGetNumTouchpads'.'SDL3.dll'.'SDL_GameControllerGetNumTouchpads'
++'_SDL_GameControllerGetNumTouchpadFingers'.'SDL3.dll'.'SDL_GameControllerGetNumTouchpadFingers'
++'_SDL_GameControllerGetTouchpadFinger'.'SDL3.dll'.'SDL_GameControllerGetTouchpadFinger'
++'_SDL_crc32'.'SDL3.dll'.'SDL_crc32'
++'_SDL_GameControllerGetSerial'.'SDL3.dll'.'SDL_GameControllerGetSerial'
++'_SDL_JoystickGetSerial'.'SDL3.dll'.'SDL_JoystickGetSerial'
++'_SDL_GameControllerHasSensor'.'SDL3.dll'.'SDL_GameControllerHasSensor'
++'_SDL_GameControllerSetSensorEnabled'.'SDL3.dll'.'SDL_GameControllerSetSensorEnabled'
++'_SDL_GameControllerIsSensorEnabled'.'SDL3.dll'.'SDL_GameControllerIsSensorEnabled'
++'_SDL_GameControllerGetSensorData'.'SDL3.dll'.'SDL_GameControllerGetSensorData'
++'_SDL_wcscasecmp'.'SDL3.dll'.'SDL_wcscasecmp'
++'_SDL_wcsncasecmp'.'SDL3.dll'.'SDL_wcsncasecmp'
++'_SDL_round'.'SDL3.dll'.'SDL_round'
++'_SDL_roundf'.'SDL3.dll'.'SDL_roundf'
++'_SDL_lround'.'SDL3.dll'.'SDL_lround'
++'_SDL_lroundf'.'SDL3.dll'.'SDL_lroundf'
++'_SDL_SoftStretchLinear'.'SDL3.dll'.'SDL_SoftStretchLinear'
++'_SDL_RenderGetD3D11Device'.'SDL3.dll'.'SDL_RenderGetD3D11Device'
++'_SDL_UpdateNVTexture'.'SDL3.dll'.'SDL_UpdateNVTexture'
++'_SDL_SetWindowKeyboardGrab'.'SDL3.dll'.'SDL_SetWindowKeyboardGrab'
++'_SDL_SetWindowMouseGrab'.'SDL3.dll'.'SDL_SetWindowMouseGrab'
++'_SDL_GetWindowKeyboardGrab'.'SDL3.dll'.'SDL_GetWindowKeyboardGrab'
++'_SDL_GetWindowMouseGrab'.'SDL3.dll'.'SDL_GetWindowMouseGrab'
++'_SDL_isalpha'.'SDL3.dll'.'SDL_isalpha'
++'_SDL_isalnum'.'SDL3.dll'.'SDL_isalnum'
++'_SDL_isblank'.'SDL3.dll'.'SDL_isblank'
++'_SDL_iscntrl'.'SDL3.dll'.'SDL_iscntrl'
++'_SDL_isxdigit'.'SDL3.dll'.'SDL_isxdigit'
++'_SDL_ispunct'.'SDL3.dll'.'SDL_ispunct'
++'_SDL_isprint'.'SDL3.dll'.'SDL_isprint'
++'_SDL_isgraph'.'SDL3.dll'.'SDL_isgraph'
# ++'_SDL_AndroidShowToast'.'SDL3.dll'.'SDL_AndroidShowToast'
++'_SDL_GetAudioDeviceSpec'.'SDL3.dll'.'SDL_GetAudioDeviceSpec'
++'_SDL_TLSCleanup'.'SDL3.dll'.'SDL_TLSCleanup'
++'_SDL_SetWindowAlwaysOnTop'.'SDL3.dll'.'SDL_SetWindowAlwaysOnTop'
++'_SDL_FlashWindow'.'SDL3.dll'.'SDL_FlashWindow'
++'_SDL_GameControllerSendEffect'.'SDL3.dll'.'SDL_GameControllerSendEffect'
++'_SDL_JoystickSendEffect'.'SDL3.dll'.'SDL_JoystickSendEffect'
++'_SDL_GameControllerGetSensorDataRate'.'SDL3.dll'.'SDL_GameControllerGetSensorDataRate'
++'_SDL_SetTextureUserData'.'SDL3.dll'.'SDL_SetTextureUserData'
++'_SDL_GetTextureUserData'.'SDL3.dll'.'SDL_GetTextureUserData'
++'_SDL_RenderGeometry'.'SDL3.dll'.'SDL_RenderGeometry'
++'_SDL_RenderGeometryRaw'.'SDL3.dll'.'SDL_RenderGeometryRaw'
++'_SDL_RenderSetVSync'.'SDL3.dll'.'SDL_RenderSetVSync'
++'_SDL_asprintf'.'SDL3.dll'.'SDL_asprintf'
++'_SDL_vasprintf'.'SDL3.dll'.'SDL_vasprintf'
++'_SDL_GetWindowICCProfile'.'SDL3.dll'.'SDL_GetWindowICCProfile'
++'_SDL_GetTicks64'.'SDL3.dll'.'SDL_GetTicks64'
# ++'_SDL_LinuxSetThreadPriorityAndPolicy'.'SDL3.dll'.'SDL_LinuxSetThreadPriorityAndPolicy'
++'_SDL_GameControllerGetAppleSFSymbolsNameForButton'.'SDL3.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForButton'
++'_SDL_GameControllerGetAppleSFSymbolsNameForAxis'.'SDL3.dll'.'SDL_GameControllerGetAppleSFSymbolsNameForAxis'
++'_SDL_hid_init'.'SDL3.dll'.'SDL_hid_init'
++'_SDL_hid_exit'.'SDL3.dll'.'SDL_hid_exit'
++'_SDL_hid_device_change_count'.'SDL3.dll'.'SDL_hid_device_change_count'
++'_SDL_hid_enumerate'.'SDL3.dll'.'SDL_hid_enumerate'
++'_SDL_hid_free_enumeration'.'SDL3.dll'.'SDL_hid_free_enumeration'
++'_SDL_hid_open'.'SDL3.dll'.'SDL_hid_open'
++'_SDL_hid_open_path'.'SDL3.dll'.'SDL_hid_open_path'
++'_SDL_hid_write'.'SDL3.dll'.'SDL_hid_write'
++'_SDL_hid_read_timeout'.'SDL3.dll'.'SDL_hid_read_timeout'
++'_SDL_hid_read'.'SDL3.dll'.'SDL_hid_read'
++'_SDL_hid_set_nonblocking'.'SDL3.dll'.'SDL_hid_set_nonblocking'
++'_SDL_hid_send_feature_report'.'SDL3.dll'.'SDL_hid_send_feature_report'
++'_SDL_hid_get_feature_report'.'SDL3.dll'.'SDL_hid_get_feature_report'
++'_SDL_hid_close'.'SDL3.dll'.'SDL_hid_close'
++'_SDL_hid_get_manufacturer_string'.'SDL3.dll'.'SDL_hid_get_manufacturer_string'
++'_SDL_hid_get_product_string'.'SDL3.dll'.'SDL_hid_get_product_string'
++'_SDL_hid_get_serial_number_string'.'SDL3.dll'.'SDL_hid_get_serial_number_string'
++'_SDL_hid_get_indexed_string'.'SDL3.dll'.'SDL_hid_get_indexed_string'
++'_SDL_SetWindowMouseRect'.'SDL3.dll'.'SDL_SetWindowMouseRect'
++'_SDL_GetWindowMouseRect'.'SDL3.dll'.'SDL_GetWindowMouseRect'
++'_SDL_RenderWindowToLogical'.'SDL3.dll'.'SDL_RenderWindowToLogical'
++'_SDL_RenderLogicalToWindow'.'SDL3.dll'.'SDL_RenderLogicalToWindow'
++'_SDL_JoystickHasRumble'.'SDL3.dll'.'SDL_JoystickHasRumble'
++'_SDL_JoystickHasRumbleTriggers'.'SDL3.dll'.'SDL_JoystickHasRumbleTriggers'
++'_SDL_GameControllerHasRumble'.'SDL3.dll'.'SDL_GameControllerHasRumble'
++'_SDL_GameControllerHasRumbleTriggers'.'SDL3.dll'.'SDL_GameControllerHasRumbleTriggers'
++'_SDL_hid_ble_scan'.'SDL3.dll'.'SDL_hid_ble_scan'
++'_SDL_PremultiplyAlpha'.'SDL3.dll'.'SDL_PremultiplyAlpha'
# ++'_SDL_AndroidSendMessage'.'SDL3.dll'.'SDL_AndroidSendMessage'
++'_SDL_GetTouchName'.'SDL3.dll'.'SDL_GetTouchName'
++'_SDL_ClearComposition'.'SDL3.dll'.'SDL_ClearComposition'
++'_SDL_IsTextInputShown'.'SDL3.dll'.'SDL_IsTextInputShown'
++'_SDL_HasIntersectionF'.'SDL3.dll'.'SDL_HasIntersectionF'
++'_SDL_IntersectFRect'.'SDL3.dll'.'SDL_IntersectFRect'
++'_SDL_UnionFRect'.'SDL3.dll'.'SDL_UnionFRect'
++'_SDL_EncloseFPoints'.'SDL3.dll'.'SDL_EncloseFPoints'
++'_SDL_IntersectFRectAndLine'.'SDL3.dll'.'SDL_IntersectFRectAndLine'
++'_SDL_RenderGetWindow'.'SDL3.dll'.'SDL_RenderGetWindow'
++'_SDL_bsearch'.'SDL3.dll'.'SDL_bsearch'
++'_SDL_GameControllerPathForIndex'.'SDL3.dll'.'SDL_GameControllerPathForIndex'
++'_SDL_GameControllerPath'.'SDL3.dll'.'SDL_GameControllerPath'
++'_SDL_JoystickPathForIndex'.'SDL3.dll'.'SDL_JoystickPathForIndex'
++'_SDL_JoystickPath'.'SDL3.dll'.'SDL_JoystickPath'
++'_SDL_JoystickAttachVirtualEx'.'SDL3.dll'.'SDL_JoystickAttachVirtualEx'
++'_SDL_GameControllerGetFirmwareVersion'.'SDL3.dll'.'SDL_GameControllerGetFirmwareVersion'
++'_SDL_JoystickGetFirmwareVersion'.'SDL3.dll'.'SDL_JoystickGetFirmwareVersion'
++'_SDL_GUIDToString'.'SDL3.dll'.'SDL_GUIDToString'
++'_SDL_GUIDFromString'.'SDL3.dll'.'SDL_GUIDFromString'
++'_SDL_HasLSX'.'SDL3.dll'.'SDL_HasLSX'
++'_SDL_HasLASX'.'SDL3.dll'.'SDL_HasLASX'
++'_SDL_RenderGetD3D12Device'.'SDL3.dll'.'SDL_RenderGetD3D12Device'
++'_SDL_utf8strnlen'.'SDL3.dll'.'SDL_utf8strnlen'
# ++'_SDL_GDKGetTaskQueue'.'SDL3.dll'.'SDL_GDKGetTaskQueue'
# ++'_SDL_GDKRunApp'.'SDL3.dll'.'SDL_GDKRunApp'
++'_SDL_GetOriginalMemoryFunctions'.'SDL3.dll'.'SDL_GetOriginalMemoryFunctions'
++'_SDL_ResetKeyboard'.'SDL3.dll'.'SDL_ResetKeyboard'
++'_SDL_GetDefaultAudioInfo'.'SDL3.dll'.'SDL_GetDefaultAudioInfo'
++'_SDL_GetPointDisplayIndex'.'SDL3.dll'.'SDL_GetPointDisplayIndex'
++'_SDL_GetRectDisplayIndex'.'SDL3.dll'.'SDL_GetRectDisplayIndex'
++'_SDL_ResetHint'.'SDL3.dll'.'SDL_ResetHint'
++'_SDL_crc16'.'SDL3.dll'.'SDL_crc16'
++'_SDL_GetWindowSizeInPixels'.'SDL3.dll'.'SDL_GetWindowSizeInPixels'
++'_SDL_GetJoystickGUIDInfo'.'SDL3.dll'.'SDL_GetJoystickGUIDInfo'
++'_SDL_SetPrimarySelectionText'.'SDL3.dll'.'SDL_SetPrimarySelectionText'
++'_SDL_GetPrimarySelectionText'.'SDL3.dll'.'SDL_GetPrimarySelectionText'
++'_SDL_HasPrimarySelectionText'.'SDL3.dll'.'SDL_HasPrimarySelectionText'
++'_SDL_GameControllerGetSensorDataWithTimestamp'.'SDL3.dll'.'SDL_GameControllerGetSensorDataWithTimestamp'
++'_SDL_SensorGetDataWithTimestamp'.'SDL3.dll'.'SDL_SensorGetDataWithTimestamp'
++'_SDL_ResetHints'.'SDL3.dll'.'SDL_ResetHints'
++'_SDL_strcasestr'.'SDL3.dll'.'SDL_strcasestr'

View File

@@ -24,13 +24,6 @@
#if SDL_DYNAMIC_API
#if defined(__OS2__)
#define INCL_DOS
#define INCL_DOSERRORS
#include <os2.h>
#include <dos.h>
#endif
#include "SDL.h"
/* These headers have system specific definitions, so aren't included above */
@@ -356,20 +349,6 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
return retval;
}
#elif defined(__OS2__)
static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym)
{
HMODULE hmodule;
PFN retval = NULL;
char error[256];
if (DosLoadModule(error, sizeof(error), fname, &hmodule) == NO_ERROR) {
if (DosQueryProcAddr(hmodule, 0, sym, &retval) != NO_ERROR) {
DosFreeModule(hmodule);
}
}
return (void *)retval;
}
#else
#error Please define your platform.
#endif

View File

@@ -50,8 +50,6 @@ SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF
#if defined(__WIN32__) || defined(__GDK__)
SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return)
#elif defined(__OS2__)
SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return)
#else
SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return)
#endif
@@ -749,8 +747,6 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_HasColorKey,(SDL_Surface *a),(a),return)
#if defined(__WIN32__) || defined(__GDK__)
SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return)
#elif defined(__OS2__)
SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d, pfnSDL_CurrentBeginThread e, pfnSDL_CurrentEndThread f),(a,b,c,d,e,f),return)
#else
SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithStackSize,(SDL_ThreadFunction a, const char *b, const size_t c, void *d),(a,b,c,d),return)
#endif

View File

@@ -33,7 +33,6 @@ use File::Basename;
chdir(dirname(__FILE__) . '/../..');
my $sdl_dynapi_procs_h = "src/dynapi/SDL_dynapi_procs.h";
my $sdl_dynapi_overrides_h = "src/dynapi/SDL_dynapi_overrides.h";
my $sdl3_exports = "src/dynapi/SDL3.exports";
my %existing = ();
if (-f $sdl_dynapi_procs_h) {
@@ -48,7 +47,6 @@ if (-f $sdl_dynapi_procs_h) {
open(SDL_DYNAPI_PROCS_H, '>>', $sdl_dynapi_procs_h) or die("Can't open $sdl_dynapi_procs_h: $!\n");
open(SDL_DYNAPI_OVERRIDES_H, '>>', $sdl_dynapi_overrides_h) or die("Can't open $sdl_dynapi_overrides_h: $!\n");
open(SDL3_EXPORTS, '>>', $sdl3_exports) or die("Can't open $sdl3_exports: $!\n");
opendir(HEADERS, 'include') or die("Can't open include dir: $!\n");
while (my $d = readdir(HEADERS)) {
@@ -135,7 +133,6 @@ while (my $d = readdir(HEADERS)) {
print("NEW: $decl\n");
print SDL_DYNAPI_PROCS_H "SDL_DYNAPI_PROC($rc,$fn,$paramstr,$argstr,$retstr)\n";
print SDL_DYNAPI_OVERRIDES_H "#define $fn ${fn}_REAL\n";
print SDL3_EXPORTS "++'_${fn}'.'SDL3.dll'.'${fn}'\n";
} else {
print("Failed to parse decl [$decl]!\n");
}
@@ -146,6 +143,5 @@ closedir(HEADERS);
close(SDL_DYNAPI_PROCS_H);
close(SDL_DYNAPI_OVERRIDES_H);
close(SDL3_EXPORTS);
# vi: set ts=4 sw=4 expandtab:

View File

@@ -31,10 +31,6 @@
#if defined(__WIN32__) || defined(__GDK__)
#include "../core/windows/SDL_windows.h" // For GetDoubleClickTime()
#endif
#if defined(__OS2__)
#define INCL_WIN
#include <os2.h>
#endif
/* #define DEBUG_MOUSE */
@@ -57,8 +53,6 @@ SDL_MouseDoubleClickTimeChanged(void *userdata, const char *name, const char *ol
} else {
#if defined(__WIN32__) || defined(__WINGDK__)
mouse->double_click_time = GetDoubleClickTime();
#elif defined(__OS2__)
mouse->double_click_time = WinQuerySysValue(HWND_DESKTOP, SV_DBLCLKTIME);
#else
mouse->double_click_time = 500;
#endif

View File

@@ -1,131 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifdef SDL_FILESYSTEM_OS2
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent filesystem routines */
#include "../../core/os2/SDL_os2.h"
#include "SDL_error.h"
#include "SDL_filesystem.h"
#define INCL_DOSFILEMGR
#define INCL_DOSPROCESS
#define INCL_DOSMODULEMGR
#define INCL_DOSERRORS
#include <os2.h>
char *
SDL_GetBasePath(void)
{
PTIB tib;
PPIB pib;
ULONG ulRC = DosGetInfoBlocks(&tib, &pib);
PCHAR pcEnd;
CHAR acBuf[CCHMAXPATH];
if (ulRC != NO_ERROR) {
SDL_SetError("Can't get process information block (E%lu)", ulRC);
return NULL;
}
ulRC = DosQueryModuleName(pib->pib_hmte, sizeof(acBuf), acBuf);
if (ulRC != NO_ERROR) {
SDL_SetError("Can't query the module name (E%lu)", ulRC);
return NULL;
}
pcEnd = SDL_strrchr(acBuf, '\\');
if (pcEnd != NULL)
pcEnd[1] = '\0';
else {
if (acBuf[1] == ':') /* e.g. "C:FOO" */
acBuf[2] = '\0';
else {
SDL_SetError("No path in module name");
return NULL;
}
}
return OS2_SysToUTF8(acBuf);
}
char *
SDL_GetPrefPath(const char *org, const char *app)
{
PSZ pszPath;
CHAR acBuf[CCHMAXPATH];
int lPosApp, lPosOrg;
PSZ pszApp, pszOrg;
if (!app) {
SDL_InvalidParamError("app");
return NULL;
}
pszPath = SDL_getenv("HOME");
if (!pszPath) {
pszPath = SDL_getenv("ETC");
if (!pszPath) {
SDL_SetError("HOME or ETC environment not set");
return NULL;
}
}
if (!org) {
lPosApp = SDL_snprintf(acBuf, sizeof(acBuf) - 1, "%s", pszPath);
} else {
pszOrg = OS2_UTF8ToSys(org);
if (!pszOrg) {
SDL_OutOfMemory();
return NULL;
}
lPosApp = SDL_snprintf(acBuf, sizeof(acBuf) - 1, "%s\\%s", pszPath, pszOrg);
SDL_free(pszOrg);
}
if (lPosApp < 0)
return NULL;
DosCreateDir(acBuf, NULL);
pszApp = OS2_UTF8ToSys(app);
if (!pszApp) {
SDL_OutOfMemory();
return NULL;
}
lPosOrg = SDL_snprintf(&acBuf[lPosApp], sizeof(acBuf) - lPosApp - 1, "\\%s", pszApp);
SDL_free(pszApp);
if (lPosOrg < 0)
return NULL;
DosCreateDir(acBuf, NULL);
*((PUSHORT)&acBuf[lPosApp + lPosOrg]) = (USHORT)'\0\\';
return OS2_SysToUTF8(acBuf);
}
#endif /* SDL_FILESYSTEM_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -418,9 +418,6 @@ static int is_language_supported(libusb_device_handle *dev, uint16_t lang)
/* This function returns a newly allocated wide string containing the USB
device string numbered by the index. The returned string must be freed
by using free(). */
#if defined(__OS2__) /* don't use iconv on OS/2: no support for wchar_t. */
#define NO_ICONV
#endif
static wchar_t *get_usb_string(libusb_device_handle *dev, uint8_t idx)
{
char buf[512];

View File

@@ -87,9 +87,6 @@ static SDL_JoystickDriver *SDL_joystick_drivers[] = {
#ifdef SDL_JOYSTICK_USBHID /* !!! FIXME: "USBHID" is a generic name, and doubly-confusing with HIDAPI next to it. This is the *BSD interface, rename this. */
&SDL_BSD_JoystickDriver,
#endif
#ifdef SDL_JOYSTICK_OS2
&SDL_OS2_JoystickDriver,
#endif
#ifdef SDL_JOYSTICK_PS2
&SDL_PS2_JoystickDriver,
#endif

View File

@@ -239,7 +239,6 @@ extern SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver;
extern SDL_JoystickDriver SDL_WGI_JoystickDriver;
extern SDL_JoystickDriver SDL_WINDOWS_JoystickDriver;
extern SDL_JoystickDriver SDL_WINMM_JoystickDriver;
extern SDL_JoystickDriver SDL_OS2_JoystickDriver;
extern SDL_JoystickDriver SDL_PS2_JoystickDriver;
extern SDL_JoystickDriver SDL_PSP_JoystickDriver;
extern SDL_JoystickDriver SDL_VITA_JoystickDriver;

View File

@@ -1,799 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifdef SDL_JOYSTICK_OS2
/* OS/2 Joystick driver, contributed by Daniel Caetano */
#define INCL_DOSDEVICES
#define INCL_DOSDEVIOCTL
#define INCL_DOSMEMMGR
#include <os2.h>
/*****************************************************************
* OS/2 Joystick driver defs. Based on docs at edm2.com and in old
* drivers available at hobbes.nmsu.edu and www.os2site.com
*****************************************************************/
#define GAME_GET_VERSION 0x01
#define GAME_GET_PARMS 0x02
#define GAME_GET_CALIB 0x04
#define GAME_GET_STATUS 0x10
#define IOCTL_CAT_USER 0x80
#define GAME_PORT_GET 0x20
#define GAME_PORT_RESET 0x60
#pragma pack(push,1)
typedef struct {
USHORT uJs_AxCnt, uJs_AyCnt; /* A joystick X/Y pos */
USHORT uJs_BxCnt, uJs_ByCnt; /* B joystick X/Y pos */
USHORT usJs_ButtonA1Cnt, usJs_ButtonA2Cnt;/* A1/A2 press cnts */
USHORT usJs_ButtonB1Cnt, usJs_ButtonB2Cnt;/* B1/B2 press cnts */
UCHAR ucJs_JoyStickMask; /* mask of connected joystick pots */
UCHAR ucJs_ButtonStatus; /* bits of switches down */
ULONG ulJs_Ticks; /* total clock ticks (60 Hz) */
} GAME_PORT_STRUCT;
#pragma pack(pop)
typedef struct {
USHORT useA, useB;
USHORT mode;
USHORT format;
USHORT sampDiv;
USHORT scale;
USHORT res1, res2;
} GAME_PARM_STRUCT;
typedef struct {
SHORT x, y;
} GAME_2DPOS_STRUCT;
typedef struct {
SHORT lower, centre, upper;
} GAME_3POS_STRUCT;
typedef struct {
GAME_3POS_STRUCT Ax, Ay, Bx, By;
} GAME_CALIB_STRUCT;
typedef struct {
GAME_2DPOS_STRUCT A, B;
USHORT butMask;
} GAME_DATA_STRUCT;
typedef struct {
GAME_DATA_STRUCT curdata;
USHORT b1cnt, b2cnt, b3cnt, b4cnt;
} GAME_STATUS_STRUCT;
/*****************************************************************/
#include "SDL_joystick.h"
#include "SDL_events.h"
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
static HFILE hJoyPort = NULLHANDLE; /* Joystick GAME$ Port Address */
#define MAX_JOYSTICKS 2 /* Maximum of two joysticks */
#define MAX_AXES 4 /* each joystick can have up to 4 axes */
#define MAX_BUTTONS 8 /* 8 buttons */
#define MAX_HATS 0 /* 0 hats - OS/2 doesn't support it */
#define MAX_BALLS 0 /* and 0 balls - OS/2 doesn't support it */
#define MAX_JOYNAME 128 /* Joystick name may have 128 characters */
/* Calc Button Flag for buttons A to D */
#define JOY_BUTTON_FLAG(n) (1<<n)
/* Joystick data... hold information about detected devices */
typedef struct SYS_JoyData_s
{
Sint8 id; /* Device ID */
char szDeviceName[MAX_JOYNAME]; /* Device Name */
char axes; /* Number of axes */
char buttons; /* Number of buttons */
char hats; /* Number of buttons */
char balls; /* Number of buttons */
int axes_min[MAX_AXES]; /* minimum callibration value for axes */
int axes_med[MAX_AXES]; /* medium callibration value for axes */
int axes_max[MAX_AXES]; /* maximum callibration value for axes */
int buttoncalc[4]; /* Used for buttons 5, 6, 7 and 8. */
} SYS_JoyData_t, *SYS_JoyData_p;
static SYS_JoyData_t SYS_JoyData[MAX_JOYSTICKS];
/* Structure used to convert data from OS/2 driver format to SDL format */
struct _transaxes
{
int offset; /* Center Offset */
float scale1; /* Center to left/up Scale */
float scale2; /* Center to right/down Scale */
};
struct joystick_hwdata
{
Sint8 id;
struct _transaxes transaxes[MAX_AXES];
};
/* Structure used to get values from Joystick Environment Variable */
struct _joycfg
{
char name[MAX_JOYNAME];
unsigned int axes;
unsigned int buttons;
unsigned int hats;
unsigned int balls;
};
/* OS/2 Implementation Function Prototypes */
static int joyPortOpen(HFILE * hGame);
static void joyPortClose(HFILE * hGame);
static int joyGetData(const char *joyenv, char *name, char stopchar, size_t maxchars);
static int joyGetEnv(struct _joycfg * joydata);
static int numjoysticks = 0;
/************************************************************************/
/* Function to scan the system for joysticks. */
/* Joystick 0 should be the system default joystick. */
/* It should return 0, or -1 on an unrecoverable fatal error. */
/************************************************************************/
static int OS2_JoystickInit(void)
{
APIRET rc; /* Generic OS/2 return code */
GAME_PORT_STRUCT stJoyStatus; /* Joystick Status Structure */
GAME_PARM_STRUCT stGameParms; /* Joystick Parameter Structure */
GAME_CALIB_STRUCT stGameCalib; /* Calibration Struct */
ULONG ulDataLen; /* Size of data */
ULONG ulLastTick; /* Tick Counter for timing operations */
Uint8 maxdevs; /* Maximum number of devices */
Uint8 numdevs; /* Number of present devices */
Uint8 maxbut; /* Maximum number of buttons... */
Uint8 i; /* Temporary Count Vars */
Uint8 ucNewJoystickMask; /* Mask for Joystick Detection */
struct _joycfg joycfg; /* Joy Configuration from envvar */
/* Open GAME$ port */
if (joyPortOpen(&hJoyPort) < 0) return 0; /* Cannot open... report no joystick */
/* Get Max Number of Devices */
ulDataLen = sizeof(stGameParms);
rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_GET_PARMS,
NULL, 0, NULL, &stGameParms, ulDataLen, &ulDataLen); /* Ask device info */
if (rc != 0)
{
joyPortClose(&hJoyPort);
return SDL_SetError("Could not read joystick port.");
}
maxdevs = 0;
if (stGameParms.useA != 0) maxdevs++;
if (stGameParms.useB != 0) maxdevs++;
if (maxdevs > MAX_JOYSTICKS) maxdevs = MAX_JOYSTICKS;
/* Defines min/max axes values (callibration) */
ulDataLen = sizeof(stGameCalib);
rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_GET_CALIB,
NULL, 0, NULL, &stGameCalib, ulDataLen, &ulDataLen);
if (rc != 0)
{
joyPortClose(&hJoyPort);
return SDL_SetError("Could not read callibration data.");
}
/* Determine how many joysticks are active */
numdevs = 0; /* Points no device */
ucNewJoystickMask = 0x0F; /* read all 4 joystick axis */
ulDataLen = sizeof(ucNewJoystickMask);
rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_PORT_RESET,
&ucNewJoystickMask, ulDataLen, &ulDataLen, NULL, 0, NULL);
if (rc == 0)
{
ulDataLen = sizeof(stJoyStatus);
rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_PORT_GET,
NULL, 0, NULL, &stJoyStatus, ulDataLen, &ulDataLen);
if (rc != 0)
{
joyPortClose(&hJoyPort);
return SDL_SetError("Could not call joystick port.");
}
ulLastTick = stJoyStatus.ulJs_Ticks;
while (stJoyStatus.ulJs_Ticks == ulLastTick)
{
rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_PORT_GET,
NULL, 0, NULL, &stJoyStatus, ulDataLen, &ulDataLen);
}
if ((stJoyStatus.ucJs_JoyStickMask & 0x03) > 0) numdevs++;
if (((stJoyStatus.ucJs_JoyStickMask >> 2) & 0x03) > 0) numdevs++;
}
if (numdevs > maxdevs) numdevs = maxdevs;
/* If *any* joystick was detected... Let's configure SDL for them */
if (numdevs > 0)
{
/* Verify if it is a "user defined" joystick */
if (joyGetEnv(&joycfg))
{
GAME_3POS_STRUCT * axis[4];
axis[0] = &stGameCalib.Ax;
axis[1] = &stGameCalib.Ay;
axis[2] = &stGameCalib.Bx;
axis[3] = &stGameCalib.By;
/* Say it has one device only (user defined is always one device only) */
numdevs = 1;
/* Define Device 0 as... */
SYS_JoyData[0].id = 0;
/* Define Number of Axes... up to 4 */
if (joycfg.axes>MAX_AXES) joycfg.axes = MAX_AXES;
SYS_JoyData[0].axes = joycfg.axes;
/* Define number of buttons... 8 if 2 axes, 6 if 3 axes and 4 if 4 axes */
maxbut = MAX_BUTTONS;
if (joycfg.axes>2) maxbut -= ((joycfg.axes - 2)<<1); /* MAX_BUTTONS - 2*(axes-2) */
if (joycfg.buttons > maxbut) joycfg.buttons = maxbut;
SYS_JoyData[0].buttons = joycfg.buttons;
/* Define number of hats */
if (joycfg.hats > MAX_HATS) joycfg.hats = MAX_HATS;
SYS_JoyData[0].hats = joycfg.hats;
/* Define number of balls */
if (joycfg.balls > MAX_BALLS) joycfg.balls = MAX_BALLS;
SYS_JoyData[0].balls = joycfg.balls;
/* Initialize Axes Callibration Values */
for (i=0; i<joycfg.axes; i++)
{
SYS_JoyData[0].axes_min[i] = axis[i]->lower;
SYS_JoyData[0].axes_med[i] = axis[i]->centre;
SYS_JoyData[0].axes_max[i] = axis[i]->upper;
}
/* Initialize Buttons 5 to 8 structures */
if (joycfg.buttons>=5) SYS_JoyData[0].buttoncalc[0] = ((axis[2]->lower+axis[3]->centre)>>1);
if (joycfg.buttons>=6) SYS_JoyData[0].buttoncalc[1] = ((axis[3]->lower+axis[3]->centre)>>1);
if (joycfg.buttons>=7) SYS_JoyData[0].buttoncalc[2] = ((axis[2]->upper+axis[3]->centre)>>1);
if (joycfg.buttons>=8) SYS_JoyData[0].buttoncalc[3] = ((axis[3]->upper+axis[3]->centre)>>1);
/* Intialize Joystick Name */
SDL_strlcpy (SYS_JoyData[0].szDeviceName,joycfg.name, SDL_arraysize(SYS_JoyData[0].szDeviceName));
}
/* Default Init ... autoconfig */
else
{
/* if two devices were detected... configure as Joy1 4 axis and Joy2 2 axis */
if (numdevs == 2)
{
/* Define Device 0 as 4 axes, 4 buttons */
SYS_JoyData[0].id=0;
SYS_JoyData[0].axes = 4;
SYS_JoyData[0].buttons = 4;
SYS_JoyData[0].hats = 0;
SYS_JoyData[0].balls = 0;
SYS_JoyData[0].axes_min[0] = stGameCalib.Ax.lower;
SYS_JoyData[0].axes_med[0] = stGameCalib.Ax.centre;
SYS_JoyData[0].axes_max[0] = stGameCalib.Ax.upper;
SYS_JoyData[0].axes_min[1] = stGameCalib.Ay.lower;
SYS_JoyData[0].axes_med[1] = stGameCalib.Ay.centre;
SYS_JoyData[0].axes_max[1] = stGameCalib.Ay.upper;
SYS_JoyData[0].axes_min[2] = stGameCalib.Bx.lower;
SYS_JoyData[0].axes_med[2] = stGameCalib.Bx.centre;
SYS_JoyData[0].axes_max[2] = stGameCalib.Bx.upper;
SYS_JoyData[0].axes_min[3] = stGameCalib.By.lower;
SYS_JoyData[0].axes_med[3] = stGameCalib.By.centre;
SYS_JoyData[0].axes_max[3] = stGameCalib.By.upper;
/* Define Device 1 as 2 axes, 2 buttons */
SYS_JoyData[1].id=1;
SYS_JoyData[1].axes = 2;
SYS_JoyData[1].buttons = 2;
SYS_JoyData[1].hats = 0;
SYS_JoyData[1].balls = 0;
SYS_JoyData[1].axes_min[0] = stGameCalib.Bx.lower;
SYS_JoyData[1].axes_med[0] = stGameCalib.Bx.centre;
SYS_JoyData[1].axes_max[0] = stGameCalib.Bx.upper;
SYS_JoyData[1].axes_min[1] = stGameCalib.By.lower;
SYS_JoyData[1].axes_med[1] = stGameCalib.By.centre;
SYS_JoyData[1].axes_max[1] = stGameCalib.By.upper;
}
/* One joystick only? */
else
{
/* If it is joystick A... */
if ((stJoyStatus.ucJs_JoyStickMask & 0x03) > 0)
{
/* Define Device 0 as 2 axes, 4 buttons */
SYS_JoyData[0].id=0;
SYS_JoyData[0].axes = 2;
SYS_JoyData[0].buttons = 4;
SYS_JoyData[0].hats = 0;
SYS_JoyData[0].balls = 0;
SYS_JoyData[0].axes_min[0] = stGameCalib.Ax.lower;
SYS_JoyData[0].axes_med[0] = stGameCalib.Ax.centre;
SYS_JoyData[0].axes_max[0] = stGameCalib.Ax.upper;
SYS_JoyData[0].axes_min[1] = stGameCalib.Ay.lower;
SYS_JoyData[0].axes_med[1] = stGameCalib.Ay.centre;
SYS_JoyData[0].axes_max[1] = stGameCalib.Ay.upper;
}
/* If not, it is joystick B */
else
{
/* Define Device 1 as 2 axes, 2 buttons */
SYS_JoyData[0].id=1;
SYS_JoyData[0].axes = 2;
SYS_JoyData[0].buttons = 2;
SYS_JoyData[0].hats = 0;
SYS_JoyData[0].balls = 0;
SYS_JoyData[0].axes_min[0] = stGameCalib.Bx.lower;
SYS_JoyData[0].axes_med[0] = stGameCalib.Bx.centre;
SYS_JoyData[0].axes_max[0] = stGameCalib.Bx.upper;
SYS_JoyData[0].axes_min[1] = stGameCalib.By.lower;
SYS_JoyData[0].axes_med[1] = stGameCalib.By.centre;
SYS_JoyData[0].axes_max[1] = stGameCalib.By.upper;
}
}
/* Hack to define Joystick Port Names */
if (numdevs > maxdevs) numdevs = maxdevs;
for (i = 0; i < numdevs; i++)
{
SDL_snprintf(SYS_JoyData[i].szDeviceName,
SDL_arraysize(SYS_JoyData[i].szDeviceName),
"Default Joystick %c", 'A'+SYS_JoyData[i].id);
}
}
}
/* Return the number of devices found */
numjoysticks = numdevs;
return numdevs;
}
static int OS2_NumJoysticks(void)
{
return numjoysticks;
}
static void OS2_JoystickDetect(void)
{
}
static const char *OS2_JoystickGetDeviceName(int device_index)
{
/* No need to verify if device exists, already done in upper layer */
return SYS_JoyData[device_index].szDeviceName;
}
static const char *OS2_JoystickGetDevicePath(int device_index)
{
return NULL;
}
static int OS2_JoystickGetDevicePlayerIndex(int device_index)
{
return -1;
}
static void OS2_JoystickSetDevicePlayerIndex(int device_index, int player_index)
{
}
static SDL_JoystickGUID OS2_JoystickGetDeviceGUID(int device_index)
{
/* the GUID is just the name for now */
const char *name = OS2_JoystickGetDeviceName(device_index);
return SDL_CreateJoystickGUIDForName(name);
}
static SDL_JoystickID OS2_JoystickGetDeviceInstanceID(int device_index)
{
return device_index;
}
/******************************************************************************/
/* Function to open a joystick for use. */
/* The joystick to open is specified by the device index. */
/* This should fill the nbuttons and naxes fields of the joystick structure. */
/* It returns 0, or -1 if there is an error. */
/******************************************************************************/
static int OS2_JoystickOpen(SDL_Joystick *joystick, int device_index)
{
int index; /* Index shortcut for index in joystick structure */
int i; /* Generic Counter */
/* allocate memory for system specific hardware data */
joystick->hwdata = (struct joystick_hwdata *) SDL_calloc(1, sizeof(*joystick->hwdata));
if (!joystick->hwdata)
{
return SDL_OutOfMemory();
}
/* ShortCut Pointer */
index = device_index;
joystick->instance_id = device_index;
/* Define offsets and scales for all axes */
joystick->hwdata->id = SYS_JoyData[index].id;
for (i = 0; i < MAX_AXES; ++i)
{
if ((i < 2) || i < SYS_JoyData[index].axes)
{
joystick->hwdata->transaxes[i].offset = ((SDL_JOYSTICK_AXIS_MAX + SDL_JOYSTICK_AXIS_MIN)>>1) - SYS_JoyData[index].axes_med[i];
joystick->hwdata->transaxes[i].scale1 = (float)SDL_abs((SDL_JOYSTICK_AXIS_MIN/SYS_JoyData[index].axes_min[i]));
joystick->hwdata->transaxes[i].scale2 = (float)SDL_abs((SDL_JOYSTICK_AXIS_MAX/SYS_JoyData[index].axes_max[i]));
}
else
{
joystick->hwdata->transaxes[i].offset = 0;
joystick->hwdata->transaxes[i].scale1 = 1.0f; /* Just in case */
joystick->hwdata->transaxes[i].scale2 = 1.0f; /* Just in case */
}
}
/* fill nbuttons, naxes, and nhats fields */
joystick->nbuttons = SYS_JoyData[index].buttons;
joystick->naxes = SYS_JoyData[index].axes;
/* joystick->nhats = SYS_JoyData[index].hats; */
joystick->nhats = 0; /* No support for hats at this time */
/* joystick->nballs = SYS_JoyData[index].balls; */
joystick->nballs = 0; /* No support for balls at this time */
return 0;
}
static int OS2_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
{
return SDL_Unsupported();
}
static int OS2_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
{
return SDL_Unsupported();
}
static Uint32 OS2_JoystickGetCapabilities(SDL_Joystick *joystick)
{
return 0;
}
static int OS2_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
{
return SDL_Unsupported();
}
static int OS2_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
{
return SDL_Unsupported();
}
static int OS2_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
{
return SDL_Unsupported();
}
/***************************************************************************/
/* Function to update the state of a joystick - called as a device poll. */
/* This function shouldn't update the joystick structure directly, */
/* but instead should call SDL_PrivateJoystick*() to deliver events */
/* and update joystick device state. */
/***************************************************************************/
static void OS2_JoystickUpdate(SDL_Joystick *joystick)
{
APIRET rc; /* Generic OS/2 return code */
int index; /* index shortcurt to joystick index */
int i; /* Generic counter */
int normbut; /* Number of buttons reported by joystick */
int corr; /* Correction for button names */
Sint16 value; /* Values used to update axis values */
struct _transaxes *transaxes; /* Shortcut for Correction structure */
Uint32 pos[MAX_AXES]; /* Vector to inform the Axis status */
ULONG ulDataLen; /* Size of data */
GAME_STATUS_STRUCT stGameStatus; /* Joystick Status Structure */
ulDataLen = sizeof(stGameStatus);
rc = DosDevIOCtl(hJoyPort, IOCTL_CAT_USER, GAME_GET_STATUS,
NULL, 0, NULL, &stGameStatus, ulDataLen, &ulDataLen);
if (rc != 0)
{
SDL_SetError("Could not read joystick status.");
return; /* Could not read data */
}
/* Shortcut pointer */
index = joystick->instance_id;
/* joystick motion events */
if (SYS_JoyData[index].id == 0)
{
pos[0] = stGameStatus.curdata.A.x;
pos[1] = stGameStatus.curdata.A.y;
if (SYS_JoyData[index].axes >= 3) pos[2] = stGameStatus.curdata.B.x;
else pos[2] = 0;
if (SYS_JoyData[index].axes >= 4) pos[3] = stGameStatus.curdata.B.y;
else pos[3] = 0;
/* OS/2 basic drivers do not support more than 4 axes joysticks */
}
else if (SYS_JoyData[index].id == 1)
{
pos[0] = stGameStatus.curdata.B.x;
pos[1] = stGameStatus.curdata.B.y;
pos[2] = 0;
pos[3] = 0;
}
/* Corrects the movements using the callibration */
transaxes = joystick->hwdata->transaxes;
for (i = 0; i < joystick->naxes; i++)
{
value = pos[i] + transaxes[i].offset;
if (value < 0)
{
value *= transaxes[i].scale1;
if (value > 0) value = SDL_JOYSTICK_AXIS_MIN;
}
else
{
value *= transaxes[i].scale2;
if (value < 0) value = SDL_JOYSTICK_AXIS_MAX;
}
SDL_PrivateJoystickAxis(joystick, (Uint8)i, (Sint16)value);
}
/* joystick button A to D events */
if (SYS_JoyData[index].id == 1) corr = 2;
else corr = 0;
normbut = 4; /* Number of normal buttons */
if (joystick->nbuttons < normbut) normbut = joystick->nbuttons;
for (i = corr; (i-corr) < normbut; ++i)
{
/*
Button A: 1110 0000
Button B: 1101 0000
Button C: 1011 0000
Button D: 0111 0000
*/
if ((~stGameStatus.curdata.butMask)>>4 & JOY_BUTTON_FLAG(i))
{
SDL_PrivateJoystickButton(joystick, (Uint8)(i-corr), SDL_PRESSED);
}
else
{
SDL_PrivateJoystickButton(joystick, (Uint8)(i-corr), SDL_RELEASED);
}
}
/* Joystick button E to H buttons */
/*
Button E: Axis 2 X Left
Button F: Axis 2 Y Up
Button G: Axis 2 X Right
Button H: Axis 2 Y Down
*/
if (joystick->nbuttons >= 5)
{
if (stGameStatus.curdata.B.x < SYS_JoyData[index].buttoncalc[0]) SDL_PrivateJoystickButton(joystick, (Uint8)4, SDL_PRESSED);
else SDL_PrivateJoystickButton(joystick, (Uint8)4, SDL_RELEASED);
}
if (joystick->nbuttons >= 6)
{
if (stGameStatus.curdata.B.y < SYS_JoyData[index].buttoncalc[1]) SDL_PrivateJoystickButton(joystick, (Uint8)5, SDL_PRESSED);
else SDL_PrivateJoystickButton(joystick, (Uint8)5, SDL_RELEASED);
}
if (joystick->nbuttons >= 7)
{
if (stGameStatus.curdata.B.x > SYS_JoyData[index].buttoncalc[2]) SDL_PrivateJoystickButton(joystick, (Uint8)6, SDL_PRESSED);
else SDL_PrivateJoystickButton(joystick, (Uint8)6, SDL_RELEASED);
}
if (joystick->nbuttons >= 8)
{
if (stGameStatus.curdata.B.y > SYS_JoyData[index].buttoncalc[3]) SDL_PrivateJoystickButton(joystick, (Uint8)7, SDL_PRESSED);
else SDL_PrivateJoystickButton(joystick, (Uint8)7, SDL_RELEASED);
}
/* joystick hat events */
/* Not Supported under OS/2 */
/* joystick ball events */
/* Not Supported under OS/2 */
}
/******************************************/
/* Function to close a joystick after use */
/******************************************/
static void OS2_JoystickClose(SDL_Joystick *joystick)
{
/* free system specific hardware data */
SDL_free(joystick->hwdata);
}
/********************************************************************/
/* Function to perform any system-specific joystick related cleanup */
/********************************************************************/
static void OS2_JoystickQuit(void)
{
joyPortClose(&hJoyPort);
}
static SDL_bool OS2_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out)
{
return SDL_FALSE;
}
/************************/
/* OS/2 Implementations */
/************************/
/*****************************************/
/* Open Joystick Port, if not opened yet */
/*****************************************/
static int joyPortOpen(HFILE * hGame)
{
APIRET rc; /* Generic Return Code */
ULONG ulAction; /* ? */
ULONG ulVersion; /* Version of joystick driver */
ULONG ulDataLen; /* Size of version data */
/* Verifies if joyport is not already open... */
if (*hGame != NULLHANDLE) return 0;
/* Open GAME$ for read */
rc = DosOpen("GAME$ ", hGame, &ulAction, 0, FILE_READONLY,
FILE_OPEN, OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, NULL);
if (rc != 0)
{
return SDL_SetError("Could not open Joystick Port.");
}
/* Get Joystick Driver Version... must be 2.0 or higher */
ulVersion = 0;
ulDataLen = sizeof(ulVersion);
rc = DosDevIOCtl(*hGame, IOCTL_CAT_USER, GAME_GET_VERSION,
NULL, 0, NULL, &ulVersion, ulDataLen, &ulDataLen);
if (rc != 0)
{
joyPortClose(hGame);
return SDL_SetError("Could not get Joystick Driver version.");
}
if (ulVersion < 0x20)
{
joyPortClose(hGame);
return SDL_SetError("Driver too old. At least IBM driver version 2.0 required.");
}
return 0;
}
/****************************/
/* Close JoyPort, if opened */
/****************************/
static void joyPortClose(HFILE * hGame)
{
if (*hGame != NULLHANDLE) DosClose(*hGame);
*hGame = NULLHANDLE;
}
/***************************/
/* Get SDL Joystick EnvVar */
/***************************/
static int joyGetEnv(struct _joycfg * joydata)
{
const char *joyenv; /* Pointer to tested character */
char tempnumber[5]; /* Temporary place to put numeric texts */
joyenv = SDL_getenv("SDL_OS2_JOYSTICK");
if (joyenv == NULL) return 0;
/* Joystick Environment is defined! */
while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */
/* If the string name starts with '... get if fully */
if (*joyenv == '\'') {
joyenv++;
joyenv += joyGetData(joyenv,joydata->name,'\'',sizeof(joydata->name));
}
/* If not, get it until the next space */
else if (*joyenv == '\"') {
joyenv++;
joyenv += joyGetData(joyenv,joydata->name,'\"',sizeof(joydata->name));
}
else {
joyenv += joyGetData(joyenv,joydata->name, ' ',sizeof(joydata->name));
}
/* Now get the number of axes */
while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */
joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber));
joydata->axes = SDL_atoi(tempnumber);
/* Now get the number of buttons */
while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */
joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber));
joydata->buttons = SDL_atoi(tempnumber);
/* Now get the number of hats */
while (*joyenv == ' ' && *joyenv != 0) joyenv++; /* jump spaces... */
joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber));
joydata->hats = SDL_atoi(tempnumber);
/* Now get the number of balls */
while (*joyenv==' ' && *joyenv != 0) joyenv++; /* jump spaces... */
joyenv += joyGetData(joyenv,tempnumber,' ',sizeof(tempnumber));
joydata->balls = SDL_atoi(tempnumber);
return 1;
}
/************************************************************************/
/* Get a text from in the string starting in joyenv until it finds */
/* the stopchar or maxchars is reached. The result is placed in name. */
/************************************************************************/
static int joyGetData(const char *joyenv, char *name, char stopchar, size_t maxchars)
{
char *nameptr; /* Pointer to the selected character */
int chcnt = 0; /* Count how many characters where copied */
nameptr = name;
while (*joyenv!=stopchar && *joyenv!=0)
{
if (nameptr < (name + (maxchars-1)))
{
*nameptr = *joyenv; /* Only copy if smaller than maximum */
nameptr++;
}
chcnt++;
joyenv++;
}
if (*joyenv == stopchar)
{
joyenv++; /* Jump stopchar */
chcnt++;
}
*nameptr = 0; /* Mark last byte */
return chcnt;
}
SDL_JoystickDriver SDL_OS2_JoystickDriver =
{
OS2_JoystickInit,
OS2_NumJoysticks,
OS2_JoystickDetect,
OS2_JoystickGetDeviceName,
OS2_JoystickGetDevicePath,
OS2_JoystickGetDevicePlayerIndex,
OS2_JoystickSetDevicePlayerIndex,
OS2_JoystickGetDeviceGUID,
OS2_JoystickGetDeviceInstanceID,
OS2_JoystickOpen,
OS2_JoystickRumble,
OS2_JoystickRumbleTriggers,
OS2_JoystickGetCapabilities,
OS2_JoystickSetLED,
OS2_JoystickSendEffect,
OS2_JoystickSetSensorsEnabled,
OS2_JoystickUpdate,
OS2_JoystickClose,
OS2_JoystickQuit,
OS2_JoystickGetGamepadMapping
};
#endif /* SDL_JOYSTICK_OS2 */

View File

@@ -1,103 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifdef SDL_LOADSO_OS2
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent library loading routines */
#include "SDL_loadso.h"
#include "../../core/os2/SDL_os2.h"
#define INCL_DOSMODULEMGR
#define INCL_DOSERRORS
#include <os2.h>
void *
SDL_LoadObject(const char *sofile)
{
ULONG ulRC;
HMODULE hModule;
CHAR acError[256];
PSZ pszModName;
if (!sofile) {
SDL_InvalidParamError("sofile");
return NULL;
}
pszModName = OS2_UTF8ToSys(sofile);
ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule);
if (ulRC != NO_ERROR && !SDL_strrchr(pszModName, '\\') && !SDL_strrchr(pszModName, '/')) {
/* strip .dll extension and retry only if name has no path. */
size_t len = SDL_strlen(pszModName);
if (len > 4 && SDL_strcasecmp(&pszModName[len - 4], ".dll") == 0) {
pszModName[len - 4] = '\0';
ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule);
}
}
if (ulRC != NO_ERROR) {
SDL_SetError("Failed loading %s: %s (E%u)", sofile, acError, ulRC);
hModule = NULLHANDLE;
}
SDL_free(pszModName);
return (void *)hModule;
}
void *
SDL_LoadFunction(void *handle, const char *name)
{
ULONG ulRC;
PFN pFN;
ulRC = DosQueryProcAddr((HMODULE)handle, 0, name, &pFN);
if (ulRC != NO_ERROR) {
/* retry with an underscore prepended, e.g. for gcc-built dlls. */
SDL_bool isstack;
size_t len = SDL_strlen(name) + 1;
char *_name = SDL_small_alloc(char, len + 1, &isstack);
_name[0] = '_';
SDL_memcpy(&_name[1], name, len);
ulRC = DosQueryProcAddr((HMODULE)handle, 0, _name, &pFN);
SDL_small_free(_name, isstack);
}
if (ulRC != NO_ERROR) {
SDL_SetError("Failed loading procedure %s (E%u)", name, ulRC);
return NULL;
}
return (void *)pFN;
}
void
SDL_UnloadObject(void *handle)
{
if (handle != NULL) {
DosFreeModule((HMODULE)handle);
}
}
#endif /* SDL_LOADSO_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -42,8 +42,6 @@
#include "n3ds/SDL_systhread_c.h"
#elif SDL_THREAD_STDCPP
#include "stdcpp/SDL_systhread_c.h"
#elif SDL_THREAD_OS2
#include "os2/SDL_systhread_c.h"
#elif SDL_THREAD_NGAGE
#include "ngage/SDL_systhread_c.h"
#else

View File

@@ -1,129 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_OS2
/* An implementation of mutexes for OS/2 */
#include "SDL_thread.h"
#include "SDL_systhread_c.h"
#include "../../core/os2/SDL_os2.h"
#define INCL_DOSSEMAPHORES
#define INCL_DOSERRORS
#include <os2.h>
struct SDL_mutex {
HMTX _handle;
};
/* Create a mutex */
SDL_mutex *
SDL_CreateMutex(void)
{
ULONG ulRC;
HMTX hMtx;
ulRC = DosCreateMutexSem(NULL, &hMtx, 0, FALSE);
if (ulRC != NO_ERROR) {
debug_os2("DosCreateMutexSem(), rc = %u", ulRC);
return NULL;
}
return (SDL_mutex *)hMtx;
}
/* Free the mutex */
void
SDL_DestroyMutex(SDL_mutex * mutex)
{
HMTX hMtx = (HMTX)mutex;
if (hMtx != NULLHANDLE) {
const ULONG ulRC = DosCloseMutexSem(hMtx);
if (ulRC != NO_ERROR) {
debug_os2("DosCloseMutexSem(), rc = %u", ulRC);
}
}
}
/* Lock the mutex */
int
SDL_LockMutex(SDL_mutex * mutex)
{
ULONG ulRC;
HMTX hMtx = (HMTX)mutex;
if (hMtx == NULLHANDLE)
return SDL_InvalidParamError("mutex");
ulRC = DosRequestMutexSem(hMtx, SEM_INDEFINITE_WAIT);
if (ulRC != NO_ERROR) {
debug_os2("DosRequestMutexSem(), rc = %u", ulRC);
return -1;
}
return 0;
}
/* try Lock the mutex */
int
SDL_TryLockMutex(SDL_mutex * mutex)
{
ULONG ulRC;
HMTX hMtx = (HMTX)mutex;
if (hMtx == NULLHANDLE)
return SDL_InvalidParamError("mutex");
ulRC = DosRequestMutexSem(hMtx, SEM_IMMEDIATE_RETURN);
if (ulRC == ERROR_TIMEOUT)
return SDL_MUTEX_TIMEDOUT;
if (ulRC != NO_ERROR) {
debug_os2("DosRequestMutexSem(), rc = %u", ulRC);
return -1;
}
return 0;
}
/* Unlock the mutex */
int
SDL_UnlockMutex(SDL_mutex * mutex)
{
ULONG ulRC;
HMTX hMtx = (HMTX)mutex;
if (hMtx == NULLHANDLE)
return SDL_InvalidParamError("mutex");
ulRC = DosReleaseMutexSem(hMtx);
if (ulRC != NO_ERROR)
return SDL_SetError("DosReleaseMutexSem(), rc = %u", ulRC);
return 0;
}
#endif /* SDL_THREAD_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,190 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_OS2
/* An implementation of semaphores for OS/2 */
#include "SDL_thread.h"
#include "../../core/os2/SDL_os2.h"
#define INCL_DOSSEMAPHORES
#define INCL_DOSERRORS
#define INCL_DOSMISC
#include <os2.h>
struct SDL_semaphore {
HEV hEv;
HMTX hMtx;
ULONG cPost;
};
SDL_sem *
SDL_CreateSemaphore(Uint32 initial_value)
{
ULONG ulRC;
SDL_sem *pSDLSem = SDL_malloc(sizeof(SDL_sem));
if (pSDLSem == NULL) {
SDL_OutOfMemory();
return NULL;
}
ulRC = DosCreateEventSem(NULL, &pSDLSem->hEv, DCE_AUTORESET, FALSE);
if (ulRC != NO_ERROR) {
debug_os2("DosCreateEventSem(), rc = %u", ulRC);
SDL_free(pSDLSem);
return NULL;
}
ulRC = DosCreateMutexSem(NULL, &pSDLSem->hMtx, 0, FALSE);
if (ulRC != NO_ERROR) {
debug_os2("DosCreateMutexSem(), rc = %u", ulRC);
DosCloseEventSem(pSDLSem->hEv);
SDL_free(pSDLSem);
return NULL;
}
pSDLSem->cPost = initial_value;
return pSDLSem;
}
void
SDL_DestroySemaphore(SDL_sem * sem)
{
if (!sem) return;
DosCloseMutexSem(sem->hMtx);
DosCloseEventSem(sem->hEv);
SDL_free(sem);
}
int
SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout)
{
ULONG ulRC;
ULONG ulStartTime, ulCurTime;
ULONG ulTimeout;
ULONG cPost;
if (sem == NULL)
return SDL_InvalidParamError("sem");
if (timeout != SEM_INDEFINITE_WAIT)
DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulStartTime, sizeof(ULONG));
while (TRUE) {
ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT);
if (ulRC != NO_ERROR)
return SDL_SetError("DosRequestMutexSem() failed, rc = %u", ulRC);
cPost = sem->cPost;
if (sem->cPost != 0)
sem->cPost--;
DosReleaseMutexSem(sem->hMtx);
if (cPost != 0)
break;
if (timeout == SEM_INDEFINITE_WAIT)
ulTimeout = SEM_INDEFINITE_WAIT;
else {
DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulCurTime, sizeof(ULONG));
ulTimeout = ulCurTime - ulStartTime;
if (timeout < ulTimeout)
return SDL_MUTEX_TIMEDOUT;
ulTimeout = timeout - ulTimeout;
}
ulRC = DosWaitEventSem(sem->hEv, ulTimeout);
if (ulRC == ERROR_TIMEOUT)
return SDL_MUTEX_TIMEDOUT;
if (ulRC != NO_ERROR)
return SDL_SetError("DosWaitEventSem() failed, rc = %u", ulRC);
}
return 0;
}
int
SDL_SemTryWait(SDL_sem * sem)
{
return SDL_SemWaitTimeout(sem, 0);
}
int
SDL_SemWait(SDL_sem * sem)
{
return SDL_SemWaitTimeout(sem, SDL_MUTEX_MAXWAIT);
}
Uint32
SDL_SemValue(SDL_sem * sem)
{
ULONG ulRC;
if (sem == NULL) {
SDL_InvalidParamError("sem");
return 0;
}
ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT);
if (ulRC != NO_ERROR)
return SDL_SetError("DosRequestMutexSem() failed, rc = %u", ulRC);
ulRC = sem->cPost;
DosReleaseMutexSem(sem->hMtx);
return ulRC;
}
int
SDL_SemPost(SDL_sem * sem)
{
ULONG ulRC;
if (sem == NULL)
return SDL_InvalidParamError("sem");
ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT);
if (ulRC != NO_ERROR)
return SDL_SetError("DosRequestMutexSem() failed, rc = %u", ulRC);
sem->cPost++;
ulRC = DosPostEventSem(sem->hEv);
if (ulRC != NO_ERROR && ulRC != ERROR_ALREADY_POSTED) {
debug_os2("DosPostEventSem() failed, rc = %u", ulRC);
}
DosReleaseMutexSem(sem->hMtx);
return 0;
}
#endif /* SDL_THREAD_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,133 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_OS2
/* Thread management routines for SDL */
#include "SDL_thread.h"
#include "../SDL_systhread.h"
#include "../SDL_thread_c.h"
#include "../SDL_systhread.h"
#include "SDL_systls_c.h"
#include "../../core/os2/SDL_os2.h"
#ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD
#error This source only adjusted for SDL_PASSED_BEGINTHREAD_ENDTHREAD
#endif
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#include <os2.h>
#include <process.h>
static void RunThread(void *data)
{
SDL_Thread *thread = (SDL_Thread *) data;
pfnSDL_CurrentEndThread pfnEndThread = (pfnSDL_CurrentEndThread) thread->endfunc;
if (ppSDLTLSData != NULL)
*ppSDLTLSData = NULL;
SDL_RunThread(thread);
if (pfnEndThread != NULL)
pfnEndThread();
}
int
SDL_SYS_CreateThread(SDL_Thread * thread,
pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread)
{
if (thread->stacksize == 0)
thread->stacksize = 65536;
if (pfnBeginThread) {
/* Save the function which we will have to call to clear the RTL of calling app! */
thread->endfunc = pfnEndThread;
/* Start the thread using the runtime library of calling app! */
thread->handle = (SYS_ThreadHandle)
pfnBeginThread(RunThread, NULL, thread->stacksize, thread);
} else {
thread->endfunc = _endthread;
thread->handle = (SYS_ThreadHandle)
_beginthread(RunThread, NULL, thread->stacksize, thread);
}
if (thread->handle == -1)
return SDL_SetError("Not enough resources to create thread");
return 0;
}
void
SDL_SYS_SetupThread(const char *name)
{
/* nothing. */
}
SDL_threadID
SDL_ThreadID(void)
{
PTIB tib;
PPIB pib;
DosGetInfoBlocks(&tib, &pib);
return tib->tib_ptib2->tib2_ultid;
}
int
SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
{
ULONG ulRC;
ulRC = DosSetPriority(PRTYS_THREAD,
(priority < SDL_THREAD_PRIORITY_NORMAL)? PRTYC_IDLETIME :
(priority > SDL_THREAD_PRIORITY_NORMAL)? PRTYC_TIMECRITICAL :
PRTYC_REGULAR,
0, 0);
if (ulRC != NO_ERROR)
return SDL_SetError("DosSetPriority() failed, rc = %u", ulRC);
return 0;
}
void
SDL_SYS_WaitThread(SDL_Thread * thread)
{
ULONG ulRC = DosWaitThread((PTID)&thread->handle, DCWW_WAIT);
if (ulRC != NO_ERROR) {
debug_os2("DosWaitThread() failed, rc = %u", ulRC);
}
}
void
SDL_SYS_DetachThread(SDL_Thread * thread)
{
/* nothing. */
}
#endif /* SDL_THREAD_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,25 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
typedef int SYS_ThreadHandle;
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,89 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_OS2
#include "../../core/os2/SDL_os2.h"
#include "SDL_thread.h"
#include "../SDL_thread_c.h"
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#include <os2.h>
SDL_TLSData **ppSDLTLSData = NULL;
static ULONG cTLSAlloc = 0;
/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */
void SDL_OS2TLSAlloc(void)
{
ULONG ulRC;
if (cTLSAlloc == 0 || ppSDLTLSData == NULL) {
/* First call - allocate the thread local memory (1 DWORD) */
ulRC = DosAllocThreadLocalMemory(1, (PULONG *)&ppSDLTLSData);
if (ulRC != NO_ERROR) {
debug_os2("DosAllocThreadLocalMemory() failed, rc = %u", ulRC);
}
}
cTLSAlloc++;
}
/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */
void SDL_OS2TLSFree(void)
{
ULONG ulRC;
if (cTLSAlloc != 0)
cTLSAlloc--;
if (cTLSAlloc == 0 && ppSDLTLSData != NULL) {
/* Last call - free the thread local memory */
ulRC = DosFreeThreadLocalMemory((PULONG)ppSDLTLSData);
if (ulRC != NO_ERROR) {
debug_os2("DosFreeThreadLocalMemory() failed, rc = %u", ulRC);
} else {
ppSDLTLSData = NULL;
}
}
}
SDL_TLSData *SDL_SYS_GetTLSData(void)
{
return (ppSDLTLSData == NULL)? NULL : *ppSDLTLSData;
}
int SDL_SYS_SetTLSData(SDL_TLSData *data)
{
if (!ppSDLTLSData)
return -1;
*ppSDLTLSData = data;
return 0;
}
#endif /* SDL_THREAD_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,38 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_THREAD_OS2
#include "../SDL_thread_c.h"
extern SDL_TLSData **ppSDLTLSData;
/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */
void SDL_OS2TLSAlloc(void);
/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */
void SDL_OS2TLSFree(void);
#endif /* SDL_THREAD_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -45,23 +45,6 @@ typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
unsigned, unsigned *threadID);
typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
#elif defined(__WATCOMC__)
/* This is for Watcom targets except OS2 */
#if __WATCOMC__ < 1240
#define __watcall
#endif
typedef unsigned long (__watcall * pfnSDL_CurrentBeginThread) (void *,
unsigned,
unsigned
(__stdcall *
func) (void
*),
void *arg,
unsigned,
unsigned
*threadID);
typedef void (__watcall * pfnSDL_CurrentEndThread) (unsigned code);
#else
typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
unsigned (__stdcall *

View File

@@ -1,186 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_TIMER_OS2
#include "SDL_timer.h"
#include "../../core/os2/SDL_os2.h"
#define INCL_DOSERRORS
#define INCL_DOSMISC
#define INCL_DOSPROFILE
#define INCL_DOSSEMAPHORES
#define INCL_DOSDATETIME
#define INCL_DOSPROCESS
#define INCL_DOSEXCEPTIONS
#include <os2.h>
/* No need to switch priorities in SDL_Delay() for OS/2 versions > Warp3 fp 42, */
/*#define _SWITCH_PRIORITY*/
typedef unsigned long long ULLONG;
static SDL_bool ticks_started = SDL_FALSE;
static ULONG ulTmrFreq = 0;
static ULLONG ullTmrStart = 0;
void
SDL_TicksInit(void)
{
ULONG ulTmrStart; /* for 32-bit fallback. */
ULONG ulRC;
if (ticks_started) {
return;
}
ticks_started = SDL_TRUE;
ulRC = DosTmrQueryFreq(&ulTmrFreq);
if (ulRC != NO_ERROR) {
debug_os2("DosTmrQueryFreq() failed, rc = %u", ulRC);
} else {
ulRC = DosTmrQueryTime((PQWORD)&ullTmrStart);
if (ulRC == NO_ERROR) {
return;
}
debug_os2("DosTmrQueryTime() failed, rc = %u", ulRC);
}
ulTmrFreq = 0; /* Error - use DosQuerySysInfo() for timer. */
DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulTmrStart, sizeof (ULONG));
ullTmrStart = (ULLONG) ulTmrStart;
}
void
SDL_TicksQuit(void)
{
ticks_started = SDL_FALSE;
}
Uint64
SDL_GetTicks64(void)
{
Uint64 ui64Result;
ULLONG ullTmrNow;
if (!ticks_started) {
SDL_TicksInit();
}
if (ulTmrFreq != 0) {
DosTmrQueryTime((PQWORD)&ullTmrNow);
ui64Result = (ullTmrNow - ullTmrStart) * 1000 / ulTmrFreq;
} else {
/* note that this counter rolls over to 0 every ~49 days. Fix your system so DosTmrQueryTime works if you need to avoid this. */
ULONG ulTmrNow;
DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, &ulTmrNow, sizeof (ULONG));
ui64Result = (((Uint64) ulTmrNow) - ullTmrStart);
}
return ui64Result;
}
Uint64
SDL_GetPerformanceCounter(void)
{
QWORD qwTmrNow;
if (ulTmrFreq == 0 || (DosTmrQueryTime(&qwTmrNow) != NO_ERROR)) {
return SDL_GetTicks64();
}
return *((Uint64 *)&qwTmrNow);
}
Uint64
SDL_GetPerformanceFrequency(void)
{
return (ulTmrFreq == 0)? 1000 : (Uint64)ulTmrFreq;
}
void
SDL_Delay(Uint32 ms)
{
HTIMER hTimer = NULLHANDLE;
ULONG ulRC;
#ifdef _SWITCH_PRIORITY
PPIB pib;
PTIB tib;
BOOL fSetPriority = ms < 50;
ULONG ulSavePriority;
ULONG ulNesting;
#endif
HEV hevTimer;
if (ms == 0) {
DosSleep(0);
return;
}
ulRC = DosCreateEventSem(NULL, &hevTimer, DC_SEM_SHARED, FALSE);
if (ulRC != NO_ERROR) {
debug_os2("DosAsyncTimer() failed, rc = %u", ulRC);
DosSleep(ms);
return;
}
#ifdef _SWITCH_PRIORITY
if (fSetPriority) {
if (DosGetInfoBlocks(&tib, &pib) != NO_ERROR)
fSetPriority = FALSE;
else {
ulSavePriority = tib->tib_ptib2->tib2_ulpri;
if (((ulSavePriority & 0xFF00) == 0x0300) || /* already have high pr. */
(DosEnterMustComplete( &ulNesting) != NO_ERROR))
fSetPriority = FALSE;
else {
DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 0, 0);
}
}
}
#endif
DosResetEventSem(hevTimer, &ulRC);
ulRC = DosAsyncTimer(ms, (HSEM)hevTimer, &hTimer);
#ifdef _SWITCH_PRIORITY
if (fSetPriority) {
if (DosSetPriority(PRTYS_THREAD, (ulSavePriority >> 8) & 0xFF, 0, 0) == NO_ERROR)
DosSetPriority(PRTYS_THREAD, 0, ulSavePriority & 0xFF, 0);
DosExitMustComplete(&ulNesting);
}
#endif
if (ulRC != NO_ERROR) {
debug_os2("DosAsyncTimer() failed, rc = %u", ulRC);
} else {
DosWaitEventSem(hevTimer, SEM_INDEFINITE_WAIT);
}
if (ulRC != NO_ERROR)
DosSleep(ms);
DosCloseEventSem(hevTimer);
}
#endif /* SDL_TIMER_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -474,8 +474,6 @@ extern VideoBootStrap Emscripten_bootstrap;
extern VideoBootStrap QNX_bootstrap;
extern VideoBootStrap OFFSCREEN_bootstrap;
extern VideoBootStrap NGAGE_bootstrap;
extern VideoBootStrap OS2DIVE_bootstrap;
extern VideoBootStrap OS2VMAN_bootstrap;
/* Use SDL_OnVideoThread() sparingly, to avoid regressions in use cases that currently happen to work */
extern SDL_bool SDL_OnVideoThread(void);

View File

@@ -131,10 +131,6 @@ static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_NGAGE
&NGAGE_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_OS2
&OS2DIVE_bootstrap,
&OS2VMAN_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DUMMY
&DUMMY_bootstrap,
#if SDL_INPUT_LINUXEV
@@ -4456,9 +4452,6 @@ SDL_GetMessageBoxCount(void)
#if SDL_VIDEO_DRIVER_HAIKU
#include "haiku/SDL_bmessagebox.h"
#endif
#if SDL_VIDEO_DRIVER_OS2
#include "os2/SDL_os2messagebox.h"
#endif
#if SDL_VIDEO_DRIVER_RISCOS
#include "riscos/SDL_riscosmessagebox.h"
#endif
@@ -4466,7 +4459,7 @@ SDL_GetMessageBoxCount(void)
#include "vita/SDL_vitamessagebox.h"
#endif
#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_OS2 || SDL_VIDEO_DRIVER_RISCOS
#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_RISCOS
static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype)
{
SDL_SysWMinfo info;
@@ -4581,13 +4574,6 @@ SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
retval = 0;
}
#endif
#if SDL_VIDEO_DRIVER_OS2
if (retval == -1 &&
SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_OS2) &&
OS2_ShowMessageBox(messageboxdata, buttonid) == 0) {
retval = 0;
}
#endif
#if SDL_VIDEO_DRIVER_RISCOS
if (retval == -1 &&
SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_RISCOS) &&

View File

@@ -1,171 +0,0 @@
/*
gradd.h structures and constants -- only the ones used by SDL_os2vman.c.
Based on public knowledge from around the internet including pages from
http://www.osfree.org and http://www.edm2.com
*/
#ifndef SDL_gradd_h_
#define SDL_gradd_h_
typedef struct _INITPROCOUT {
ULONG ulLength; /* Length of the INITPROCOUT data structure, in bytes. */
ULONG ulVRAMVirt; /* 32-bit virtual address of VRAM. */
} INITPROCOUT;
typedef INITPROCOUT *PINITPROCOUT;
#define RC_SUCCESS 0
typedef ULONG GID;
typedef ULONG (_System FNVMIENTRY) (
GID gid, ULONG ulFunction,
PVOID pIn,
PVOID pOut /* PINITPROCOUT */
);
#define VMI_CMD_INITPROC 1
#define VMI_CMD_TERMPROC 3
#define VMI_CMD_QUERYMODES 5
#define VMI_CMD_SETMODE 6
#define VMI_CMD_PALETTE 7
#define VMI_CMD_BITBLT 8
#define VMI_CMD_LINE 9
#define VMI_CMD_REQUESTHW 14
#define VMI_CMD_QUERYCURRENTMODE 0x1001
#define QUERYMODE_NUM_MODES 0x01
#define QUERYMODE_MODE_DATA 0x02
typedef struct _HWPALETTEINFO {
ULONG ulLength; /* Size of the HWPALETTEINFO data structure, in bytes. */
ULONG fFlags; /* Palette flag. */
ULONG ulStartIndex; /* Starting palette index. */
ULONG ulNumEntries; /* Number of palette slots to query or set. */
PRGB2 pRGBs; /* Pointer to the array of RGB values. */
} HWPALETTEINFO;
typedef HWPALETTEINFO *PHWPALETTEINFO;
#define PALETTE_GET 0x01
#define PALETTE_SET 0x02
typedef struct _BMAPINFO {
ULONG ulLength; /* Length of the BMAPINFO data structure, in bytes. */
ULONG ulType; /* Description of the Blt. */
ULONG ulWidth; /* Width in pels of the bit map. */
ULONG ulHeight; /* Height in pels of the bit map. */
ULONG ulBpp; /* Number of bits per pel/color depth. */
ULONG ulBytesPerLine; /* Number of aligned bytes per line. */
PBYTE pBits; /* Pointer to bit-map bits. */
} BMAPINFO;
typedef BMAPINFO *PBMAPINFO;
#define BMAP_VRAM 0
#define BMAP_MEMORY 1
typedef struct _LINEPACK {
ULONG ulStyleStep; /* Value to be added to ulStyleValue. */
ULONG ulStyleValue; /* Style value at the current pel. */
ULONG ulFlags; /* Flags used for the LINEPACK data structure. */
struct _LINEPACK *plpkNext; /* Pointer to next LINEPACK data structure. */
ULONG ulAbsDeltaX; /* Clipped Bresenham Delta X, absolute. */
ULONG ulAbsDeltaY; /* Clipped Bresenham Delta Y, absolute. */
POINTL ptlClipStart; /* Pointer to location for device to perform Bresenham algorithm. */
POINTL ptlClipEnd; /* Ending location for Bresenham algorithm (see ptlClipStart). */
POINTL ptlStart; /* Pointer to starting location for line. */
POINTL ptlEnd; /* Ending location for line. */
LONG lClipStartError;/* Standard Bresenham error at the clipped start point. */
} LINEPACK;
typedef LINEPACK *PLINEPACK;
typedef struct _LINEINFO {
ULONG ulLength; /* Length of LINEINFO data structure. */
ULONG ulType; /* Defines line type. */
ULONG ulStyleMask; /* A 32-bit style mask. */
ULONG cLines; /* Count of lines to be drawn. */
ULONG ulFGColor; /* Line Foreground color. */
ULONG ulBGColor; /* Line Background color. */
USHORT usForeROP; /* Line Foreground mix. */
USHORT usBackROP; /* Line Background mix. */
PBMAPINFO pDstBmapInfo; /* Pointer to destination surface bit map. */
PLINEPACK alpkLinePack; /* Pointer to LINEPACK data structure. */
PRECTL prclBounds; /* Pointer to bounding rect of a clipped line. */
} LINEINFO;
typedef LINEINFO *PLINEINFO;
#define LINE_DO_FIRST_PEL 0x02
#define LINE_DIR_Y_POSITIVE 0x04
#define LINE_HORIZONTAL 0x08
#define LINE_DIR_X_POSITIVE 0x20
#define LINE_VERTICAL 0x1000
#define LINE_DO_LAST_PEL 0x4000
#define LINE_SOLID 0x01
typedef struct _BLTRECT {
ULONG ulXOrg; /* X origin of the destination Blt. */
ULONG ulYOrg; /* Y origin of the destination Blt. */
ULONG ulXExt; /* X extent of the BitBlt. */
ULONG ulYExt; /* Y extent of the BitBlt. */
} BLTRECT;
typedef BLTRECT *PBLTRECT;
typedef struct _BITBLTINFO {
ULONG ulLength; /* Length of the BITBLTINFO data structure, in bytes. */
ULONG ulBltFlags; /* Flags for rendering of rasterized data. */
ULONG cBlits; /* Count of Blts to be performed. */
ULONG ulROP; /* Raster operation. */
ULONG ulMonoBackROP; /* Background mix if B_APPLY_BACK_ROP is set. */
ULONG ulSrcFGColor; /* Monochrome source Foreground color. */
ULONG ulSrcBGColor; /* Monochrome source Background color and transparent color. */
ULONG ulPatFGColor; /* Monochrome pattern Foreground color. */
ULONG ulPatBGColor; /* Monochrome pattern Background color. */
PBYTE abColors; /* Pointer to color translation table. */
PBMAPINFO pSrcBmapInfo; /* Pointer to source bit map (BMAPINFO) */
PBMAPINFO pDstBmapInfo; /* Pointer to destination bit map (BMAPINFO). */
PBMAPINFO pPatBmapInfo; /* Pointer to pattern bit map (BMAPINFO). */
PPOINTL aptlSrcOrg; /* Pointer to array of source origin POINTLs. */
PPOINTL aptlPatOrg; /* Pointer to array of pattern origin POINTLs. */
PBLTRECT abrDst; /* Pointer to array of Blt rects. */
PRECTL prclSrcBounds; /* Pointer to source bounding rect of source Blts. */
PRECTL prclDstBounds; /* Pointer to destination bounding rect of destination Blts. */
} BITBLTINFO;
typedef BITBLTINFO *PBITBLTINFO;
#define BF_DEFAULT_STATE 0x0
#define BF_ROP_INCL_SRC (0x01 << 2)
#define BF_PAT_HOLLOW (0x01 << 8)
typedef struct _GDDMODEINFO {
ULONG ulLength; /* Size of the GDDMODEINFO data structure, in bytes. */
ULONG ulModeId; /* ID used to make SETMODE request. */
ULONG ulBpp; /* Number of colors (bpp). */
ULONG ulHorizResolution;/* Number of horizontal pels. */
ULONG ulVertResolution; /* Number of vertical scan lines. */
ULONG ulRefreshRate; /* Refresh rate in Hz. */
PBYTE pbVRAMPhys; /* Physical address of VRAM. */
ULONG ulApertureSize; /* Size of VRAM, in bytes. */
ULONG ulScanLineSize; /* Size of one scan line, in bytes. */
ULONG fccColorEncoding, ulTotalVRAMSize, cColors;
} GDDMODEINFO;
typedef GDDMODEINFO *PGDDMODEINFO;
typedef struct _HWREQIN {
ULONG ulLength; /* Size of the HWREQIN data structure, in bytes. */
ULONG ulFlags; /* Request option flags. */
ULONG cScrChangeRects; /* Count of screen rectangles affected by HWREQIN. */
PRECTL arectlScreen; /* Array of screen rectangles affected by HWREQIN. */
} HWREQIN;
typedef HWREQIN *PHWREQIN;
#define REQUEST_HW 0x01
/*
BOOL GreDeath(HDC hdc, PVOID pInstance, LONG lFunction);
LONG GreResurrection(HDC hdc, LONG cbVmem, PULONG pReserved, PVOID pInstance, LONG lFunction);
*/
#define GreDeath(h) (BOOL)Gre32Entry3((ULONG)(h), 0, 0x40B7L)
#define GreResurrection(h,n,r) (LONG)Gre32Entry5((ULONG)(h), (ULONG)(n), (ULONG)(r), 0, 0x40B8L)
ULONG _System Gre32Entry3(ULONG, ULONG, ULONG);
ULONG _System Gre32Entry5(ULONG, ULONG, ULONG, ULONG, ULONG);
#endif /* SDL_gradd_h_ */

View File

@@ -1,331 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#include "../SDL_sysvideo.h"
#define INCL_WIN
#define INCL_GPI
#include <os2.h>
#define _MEERROR_H_
#include <mmioos2.h>
#include <os2me.h>
#define INCL_MM_OS2
#include <dive.h>
#include <fourcc.h>
#include "SDL_os2output.h"
typedef struct _VODATA {
HDIVE hDive;
PVOID pBuffer;
ULONG ulDIVEBufNum;
FOURCC fccColorEncoding;
ULONG ulWidth;
ULONG ulHeight;
BOOL fBlitterReady;
} VODATA;
static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo);
static PVODATA voOpen(void);
static VOID voClose(PVODATA pVOData);
static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd,
SDL_DisplayMode *pSDLDisplayMode,
HRGN hrgnShape, BOOL fVisible);
static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight,
ULONG ulBPP, ULONG fccColorEncoding,
PULONG pulScanLineSize);
static VOID voVideoBufFree(PVODATA pVOData);
static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects,
ULONG cSDLRects);
OS2VIDEOOUTPUT voDive = {
voQueryInfo,
voOpen,
voClose,
voSetVisibleRegion,
voVideoBufAlloc,
voVideoBufFree,
voUpdate
};
static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo)
{
DIVE_CAPS sDiveCaps;
FOURCC fccFormats[100];
/* Query information about display hardware from DIVE. */
SDL_zeroa(fccFormats);
SDL_zero(sDiveCaps);
sDiveCaps.pFormatData = fccFormats;
sDiveCaps.ulFormatLength = 100;
sDiveCaps.ulStructLen = sizeof(DIVE_CAPS);
if (DiveQueryCaps(&sDiveCaps, DIVE_BUFFER_SCREEN)) {
debug_os2("DiveQueryCaps() failed.");
return FALSE;
}
if (sDiveCaps.ulDepth < 8) {
debug_os2("Not enough screen colors to run DIVE. "
"Must be at least 256 colors.");
return FALSE;
}
pInfo->ulBPP = sDiveCaps.ulDepth;
pInfo->fccColorEncoding = sDiveCaps.fccColorEncoding;
pInfo->ulScanLineSize = sDiveCaps.ulScanLineBytes;
pInfo->ulHorizResolution = sDiveCaps.ulHorizontalResolution;
pInfo->ulVertResolution = sDiveCaps.ulVerticalResolution;
return TRUE;
}
PVODATA voOpen(void)
{
PVODATA pVOData = SDL_calloc(1, sizeof(VODATA));
if (pVOData == NULL) {
SDL_OutOfMemory();
return NULL;
}
if (DiveOpen(&pVOData->hDive, FALSE, NULL) != DIVE_SUCCESS) {
SDL_free(pVOData);
SDL_SetError("DIVE: A display engine instance open failed");
return NULL;
}
return pVOData;
}
static VOID voClose(PVODATA pVOData)
{
voVideoBufFree(pVOData);
DiveClose(pVOData->hDive);
SDL_free(pVOData);
}
static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd,
SDL_DisplayMode *pSDLDisplayMode,
HRGN hrgnShape, BOOL fVisible)
{
HPS hps;
HRGN hrgn;
RGNRECT rgnCtl;
PRECTL prectl = NULL;
ULONG ulRC;
if (!fVisible) {
if (pVOData->fBlitterReady) {
pVOData->fBlitterReady = FALSE;
DiveSetupBlitter(pVOData->hDive, 0);
debug_os2("DIVE blitter is tuned off");
}
return TRUE;
}
/* Query visible rectangles */
hps = WinGetPS(hwnd);
hrgn = GpiCreateRegion(hps, 0, NULL);
if (hrgn == NULLHANDLE) {
WinReleasePS(hps);
SDL_SetError("GpiCreateRegion() failed");
} else {
WinQueryVisibleRegion(hwnd, hrgn);
if (hrgnShape != NULLHANDLE)
GpiCombineRegion(hps, hrgn, hrgn, hrgnShape, CRGN_AND);
rgnCtl.ircStart = 1;
rgnCtl.crc = 0;
rgnCtl.ulDirection = 1;
GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, NULL);
if (rgnCtl.crcReturned != 0) {
prectl = SDL_malloc(rgnCtl.crcReturned * sizeof(RECTL));
if (prectl != NULL) {
rgnCtl.ircStart = 1;
rgnCtl.crc = rgnCtl.crcReturned;
rgnCtl.ulDirection = 1;
GpiQueryRegionRects(hps, hrgn, NULL, &rgnCtl, prectl);
} else {
SDL_OutOfMemory();
}
}
GpiDestroyRegion(hps, hrgn);
WinReleasePS(hps);
if (prectl != NULL) {
/* Setup DIVE blitter. */
SETUP_BLITTER sSetupBlitter;
SWP swp;
POINTL pointl = { 0,0 };
WinQueryWindowPos(hwnd, &swp);
WinMapWindowPoints(hwnd, HWND_DESKTOP, &pointl, 1);
sSetupBlitter.ulStructLen = sizeof(SETUP_BLITTER);
sSetupBlitter.fccSrcColorFormat = pVOData->fccColorEncoding;
sSetupBlitter.fInvert = FALSE;
sSetupBlitter.ulSrcWidth = pVOData->ulWidth;
sSetupBlitter.ulSrcHeight = pVOData->ulHeight;
sSetupBlitter.ulSrcPosX = 0;
sSetupBlitter.ulSrcPosY = 0;
sSetupBlitter.ulDitherType = 0;
sSetupBlitter.fccDstColorFormat = FOURCC_SCRN;
sSetupBlitter.ulDstWidth = swp.cx;
sSetupBlitter.ulDstHeight = swp.cy;
sSetupBlitter.lDstPosX = 0;
sSetupBlitter.lDstPosY = 0;
sSetupBlitter.lScreenPosX = pointl.x;
sSetupBlitter.lScreenPosY = pointl.y;
sSetupBlitter.ulNumDstRects = rgnCtl.crcReturned;
sSetupBlitter.pVisDstRects = prectl;
ulRC = DiveSetupBlitter(pVOData->hDive, &sSetupBlitter);
SDL_free(prectl);
if (ulRC == DIVE_SUCCESS) {
pVOData->fBlitterReady = TRUE;
WinInvalidateRect(hwnd, NULL, TRUE);
debug_os2("DIVE blitter is ready now.");
return TRUE;
}
SDL_SetError("DiveSetupBlitter(), rc = 0x%X", ulRC);
} /* if (prectl != NULL) */
} /* if (hrgn == NULLHANDLE) else */
pVOData->fBlitterReady = FALSE;
DiveSetupBlitter(pVOData->hDive, 0);
return FALSE;
}
static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight,
ULONG ulBPP, FOURCC fccColorEncoding,
PULONG pulScanLineSize)
{
ULONG ulRC;
ULONG ulScanLineSize = ulWidth * (ulBPP >> 3);
/* Destroy previous buffer. */
voVideoBufFree(pVOData);
if (ulWidth == 0 || ulHeight == 0 || ulBPP == 0)
return NULL;
/* Bytes per line. */
ulScanLineSize = (ulScanLineSize + 3) & ~3; /* 4-byte aligning */
*pulScanLineSize = ulScanLineSize;
ulRC = DosAllocMem(&pVOData->pBuffer,
(ulHeight * ulScanLineSize) + sizeof(ULONG),
PAG_COMMIT | PAG_EXECUTE | PAG_READ | PAG_WRITE);
if (ulRC != NO_ERROR) {
debug_os2("DosAllocMem(), rc = %u", ulRC);
return NULL;
}
ulRC = DiveAllocImageBuffer(pVOData->hDive, &pVOData->ulDIVEBufNum,
fccColorEncoding, ulWidth, ulHeight,
ulScanLineSize, pVOData->pBuffer);
if (ulRC != DIVE_SUCCESS) {
debug_os2("DiveAllocImageBuffer(), rc = 0x%X", ulRC);
DosFreeMem(pVOData->pBuffer);
pVOData->pBuffer = NULL;
pVOData->ulDIVEBufNum = 0;
return NULL;
}
pVOData->fccColorEncoding = fccColorEncoding;
pVOData->ulWidth = ulWidth;
pVOData->ulHeight = ulHeight;
debug_os2("buffer: 0x%P, DIVE buffer number: %u",
pVOData->pBuffer, pVOData->ulDIVEBufNum);
return pVOData->pBuffer;
}
static VOID voVideoBufFree(PVODATA pVOData)
{
ULONG ulRC;
if (pVOData->ulDIVEBufNum != 0) {
ulRC = DiveFreeImageBuffer(pVOData->hDive, pVOData->ulDIVEBufNum);
if (ulRC != DIVE_SUCCESS) {
debug_os2("DiveFreeImageBuffer(,%u), rc = %u", pVOData->ulDIVEBufNum, ulRC);
} else {
debug_os2("DIVE buffer %u destroyed", pVOData->ulDIVEBufNum);
}
pVOData->ulDIVEBufNum = 0;
}
if (pVOData->pBuffer != NULL) {
ulRC = DosFreeMem(pVOData->pBuffer);
if (ulRC != NO_ERROR) {
debug_os2("DosFreeMem(), rc = %u", ulRC);
}
pVOData->pBuffer = NULL;
}
}
static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects,
ULONG cSDLRects)
{
ULONG ulRC;
if (!pVOData->fBlitterReady || (pVOData->ulDIVEBufNum == 0)) {
debug_os2("DIVE blitter is not ready");
return FALSE;
}
if (pSDLRects != NULL) {
PBYTE pbLineMask;
pbLineMask = SDL_stack_alloc(BYTE, pVOData->ulHeight);
if (pbLineMask == NULL) {
debug_os2("Not enough stack size");
return FALSE;
}
SDL_memset(pbLineMask, 0, pVOData->ulHeight);
for ( ; ((LONG)cSDLRects) > 0; cSDLRects--, pSDLRects++) {
SDL_memset(&pbLineMask[pSDLRects->y], 1, pSDLRects->h);
}
ulRC = DiveBlitImageLines(pVOData->hDive, pVOData->ulDIVEBufNum,
DIVE_BUFFER_SCREEN, pbLineMask);
SDL_stack_free(pbLineMask);
if (ulRC != DIVE_SUCCESS) {
debug_os2("DiveBlitImageLines(), rc = 0x%X", ulRC);
}
} else {
ulRC = DiveBlitImage(pVOData->hDive, pVOData->ulDIVEBufNum,
DIVE_BUFFER_SCREEN);
if (ulRC != DIVE_SUCCESS) {
debug_os2("DiveBlitImage(), rc = 0x%X", ulRC);
}
}
return ulRC == DIVE_SUCCESS;
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,561 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_VIDEO_DRIVER_OS2
/* Display a OS/2 message box */
#include "SDL.h"
#include "../../core/os2/SDL_os2.h"
#include "SDL_os2video.h"
#define INCL_WIN
#include <os2.h>
#define IDD_TEXT_MESSAGE 1001
#define IDD_BITMAP 1002
#define IDD_PB_FIRST 1003
typedef struct _MSGBOXDLGDATA {
USHORT cb;
HWND hwndUnder;
} MSGBOXDLGDATA;
static VOID _wmInitDlg(HWND hwnd, MSGBOXDLGDATA *pDlgData)
{
HPS hps = WinGetPS(hwnd);
POINTL aptText[TXTBOX_COUNT];
HENUM hEnum;
HWND hWndNext;
CHAR acBuf[256];
ULONG cbBuf;
ULONG cButtons = 0;
ULONG ulButtonsCY = 0;
ULONG ulButtonsCX = 0;
RECTL rectl;
ULONG ulX;
ULONG ulIdx;
struct _BUTTON {
HWND hwnd; /* Button window handle. */
ULONG ulCX; /* Button width in dialog coordinates. */
} aButtons[32];
RECTL rectlItem;
HAB hab = WinQueryAnchorBlock(hwnd);
/* --- Align the buttons to the right/bottom. --- */
/* Collect window handles of all buttons in dialog. */
hEnum = WinBeginEnumWindows(hwnd);
while ((hWndNext = WinGetNextWindow(hEnum)) != NULLHANDLE) {
if (WinQueryClassName(hWndNext, sizeof(acBuf), acBuf) == 0) {
continue;
}
if (SDL_strcmp(acBuf, "#3") == 0) { /* Class name of button. */
if (cButtons < sizeof(aButtons) / sizeof(struct _BUTTON)) {
aButtons[cButtons].hwnd = hWndNext;
cButtons++;
}
}
}
WinEndEnumWindows(hEnum);
/* Query size of text for each button, get width of each button, total
* buttons width (ulButtonsCX) and max. height (ulButtonsCX) in _dialog
* coordinates_. */
hps = WinGetPS(hwnd);
for(ulIdx = 0; ulIdx < cButtons; ulIdx++) {
/* Query size of text in window coordinates. */
cbBuf = WinQueryWindowText(aButtons[ulIdx].hwnd, sizeof(acBuf), acBuf);
GpiQueryTextBox(hps, cbBuf, acBuf, TXTBOX_COUNT, aptText);
aptText[TXTBOX_TOPRIGHT].x -= aptText[TXTBOX_BOTTOMLEFT].x;
aptText[TXTBOX_TOPRIGHT].y -= aptText[TXTBOX_BOTTOMLEFT].y;
/* Convert text size to dialog coordinates. */
WinMapDlgPoints(hwnd, &aptText[TXTBOX_TOPRIGHT], 1, FALSE);
/* Add vertical and horizontal space for button's frame (dialog coord.). */
if (aptText[TXTBOX_TOPRIGHT].x < 30) { /* Minimal button width. */
aptText[TXTBOX_TOPRIGHT].x = 30;
} else {
aptText[TXTBOX_TOPRIGHT].x += 4;
}
aptText[TXTBOX_TOPRIGHT].y += 3;
aButtons[ulIdx].ulCX = aptText[TXTBOX_TOPRIGHT].x; /* Store button width */
ulButtonsCX += aptText[TXTBOX_TOPRIGHT].x + 2; /* Add total btn. width */
/* Get max. height for buttons. */
if (ulButtonsCY < aptText[TXTBOX_TOPRIGHT].y)
ulButtonsCY = aptText[TXTBOX_TOPRIGHT].y + 1;
}
WinReleasePS(hps);
/* Expand horizontal size of the window to fit all buttons and move window
* to the center of parent window. */
/* Convert total width of buttons to window coordinates. */
aptText[0].x = ulButtonsCX + 4;
WinMapDlgPoints(hwnd, &aptText[0], 1, TRUE);
/* Check width of the window and expand as needed. */
WinQueryWindowRect(hwnd, &rectlItem);
if (rectlItem.xRight <= aptText[0].x)
rectlItem.xRight = aptText[0].x;
/* Move window rectangle to the center of owner window. */
WinQueryWindowRect(pDlgData->hwndUnder, &rectl);
/* Left-bottom point of centered dialog on owner window. */
rectl.xLeft = (rectl.xRight - rectlItem.xRight) / 2;
rectl.yBottom = (rectl.yTop - rectlItem.yTop) / 2;
/* Map left-bottom point to desktop. */
WinMapWindowPoints(pDlgData->hwndUnder, HWND_DESKTOP, (PPOINTL)&rectl, 1);
WinOffsetRect(hab, &rectlItem, rectl.xLeft, rectl.yBottom);
/* Set new rectangle for the window. */
WinSetWindowPos(hwnd, HWND_TOP, rectlItem.xLeft, rectlItem.yBottom,
rectlItem.xRight - rectlItem.xLeft,
rectlItem.yTop - rectlItem.yBottom,
SWP_SIZE | SWP_MOVE);
/* Set buttons positions. */
/* Get horizontal position for the first button. */
WinMapDlgPoints(hwnd, (PPOINTL)&rectlItem, 2, FALSE); /* Win size to dlg coord. */
ulX = rectlItem.xRight - rectlItem.xLeft - ulButtonsCX - 2; /* First button position. */
/* Set positions and sizes for all buttons. */
for (ulIdx = 0; ulIdx < cButtons; ulIdx++) {
/* Get poisition and size for the button in dialog coordinates. */
aptText[0].x = ulX;
aptText[0].y = 2;
aptText[1].x = aButtons[ulIdx].ulCX;
aptText[1].y = ulButtonsCY;
/* Convert to window coordinates. */
WinMapDlgPoints(hwnd, aptText, 2, TRUE);
WinSetWindowPos(aButtons[ulIdx].hwnd, HWND_TOP,
aptText[0].x, aptText[0].y, aptText[1].x, aptText[1].y,
SWP_MOVE | SWP_SIZE);
/* Offset horizontal position for the next button. */
ulX += aButtons[ulIdx].ulCX + 2;
}
/* Set right bound of the text to right bound of the last button and
* bottom bound of the text just above the buttons. */
aptText[2].x = 25; /* Left bound of text in dlg coordinates. */
aptText[2].y = ulButtonsCY + 3; /* Bottom bound of the text in dlg coords. */
WinMapDlgPoints(hwnd, &aptText[2], 1, TRUE); /* Convert ^^^ to win. coords */
hWndNext = WinWindowFromID(hwnd, IDD_TEXT_MESSAGE);
WinQueryWindowRect(hWndNext, &rectlItem);
rectlItem.xLeft = aptText[2].x;
rectlItem.yBottom = aptText[2].y;
/* Right bound of the text equals right bound of the last button. */
rectlItem.xRight = aptText[0].x + aptText[1].x;
WinSetWindowPos(hWndNext, HWND_TOP, rectlItem.xLeft, rectlItem.yBottom,
rectlItem.xRight - rectlItem.xLeft,
rectlItem.yTop - rectlItem.yBottom,
SWP_MOVE | SWP_SIZE);
}
static MRESULT EXPENTRY DynDlgProc(HWND hwnd, USHORT message, MPARAM mp1, MPARAM mp2)
{
switch (message) {
case WM_INITDLG:
_wmInitDlg(hwnd, (MSGBOXDLGDATA*)mp2);
break;
case WM_COMMAND:
switch (SHORT1FROMMP(mp1)) {
case DID_OK:
WinDismissDlg(hwnd, FALSE);
break;
default:
break;
}
default:
return(WinDefDlgProc(hwnd, message, mp1, mp2));
}
return FALSE;
}
static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata)
{
SDL_MessageBoxButtonData*
pSDLBtnData = (SDL_MessageBoxButtonData *)messageboxdata->buttons;
ULONG cSDLBtnData = messageboxdata->numbuttons;
PSZ pszTitle = OS2_UTF8ToSys(messageboxdata->title);
ULONG cbTitle = (pszTitle == NULL)? 1 : (SDL_strlen(pszTitle) + 1);
PSZ pszText = OS2_UTF8ToSys(messageboxdata->message);
ULONG cbText = (pszText == NULL)? 1 : (SDL_strlen(pszText) + 1);
PDLGTEMPLATE pTemplate;
ULONG cbTemplate;
ULONG ulIdx;
PCHAR pcDlgData;
PDLGTITEM pDlgItem;
PSZ pszBtnText;
ULONG cbBtnText;
HWND hwnd;
const SDL_MessageBoxColor* pSDLColors = (messageboxdata->colorScheme == NULL)?
NULL : messageboxdata->colorScheme->colors;
const SDL_MessageBoxColor* pSDLColor;
MSGBOXDLGDATA stDlgData;
/* Build a dialog tamplate in memory */
/* Size of template */
cbTemplate = sizeof(DLGTEMPLATE) + ((2 + cSDLBtnData) * sizeof(DLGTITEM)) +
sizeof(ULONG) + /* First item data - frame control data. */
cbTitle + /* First item data - frame title + ZERO. */
cbText + /* Second item data - ststic text + ZERO.*/
3; /* Third item data - system icon Id. */
/* Button items datas - text for buttons. */
for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++) {
pszBtnText = (PSZ)pSDLBtnData[ulIdx].text;
cbTemplate += (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1);
}
/* Presentation parameter space. */
if (pSDLColors != NULL) {
cbTemplate += 26 /* PP for frame. */ +
26 /* PP for static text. */ +
(48 * cSDLBtnData); /* PP for buttons. */
}
/* Allocate memory for the dialog template. */
pTemplate = (PDLGTEMPLATE) SDL_malloc(cbTemplate);
/* Pointer on data for dialog items in allocated memory. */
pcDlgData = &((PCHAR)pTemplate)[sizeof(DLGTEMPLATE) +
((2 + cSDLBtnData) * sizeof(DLGTITEM))];
/* Header info */
pTemplate->cbTemplate = cbTemplate; /* size of dialog template to pass to WinCreateDlg() */
pTemplate->type = 0; /* Currently always 0. */
pTemplate->codepage = 0;
pTemplate->offadlgti = 14; /* Offset to array of DLGTITEMs. */
pTemplate->fsTemplateStatus = 0; /* Reserved field? */
/* Index in array of dlg items of item to get focus, */
/* if 0 then focus goes to first control that can have focus. */
pTemplate->iItemFocus = 0;
pTemplate->coffPresParams = 0;
/* First item info - frame */
pDlgItem = pTemplate->adlgti;
pDlgItem->fsItemStatus = 0; /* Reserved? */
/* Number of dialog item child windows owned by this item. */
pDlgItem->cChildren = 2 + cSDLBtnData; /* Ststic text + buttons. */
/* Length of class name, if 0 then offClassname contains a WC_ value. */
pDlgItem->cchClassName = 0;
pDlgItem->offClassName = (USHORT)WC_FRAME;
/* Length of text. */
pDlgItem->cchText = cbTitle;
pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to title text. */
/* Copy text for the title into the dialog template. */
if (pszTitle != NULL) {
SDL_memcpy(pcDlgData, pszTitle, cbTitle);
} else {
*pcDlgData = '\0';
}
pcDlgData += pDlgItem->cchText;
pDlgItem->flStyle = WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS |
FS_DLGBORDER | WS_SAVEBITS;
pDlgItem->x = 100;
pDlgItem->y = 100;
pDlgItem->cx = 175;
pDlgItem->cy = 65;
pDlgItem->id = DID_OK; /* An ID value? */
if (pSDLColors == NULL)
pDlgItem->offPresParams = 0;
else {
/* Presentation parameter for the frame - dialog colors. */
pDlgItem->offPresParams = pcDlgData - (PCHAR)pTemplate;
((PPRESPARAMS)pcDlgData)->cb = 22;
pcDlgData += 4;
((PPARAM)pcDlgData)->id = PP_FOREGROUNDCOLOR;
((PPARAM)pcDlgData)->cb = 3;
((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].b;
((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].g;
((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].r;
pcDlgData += 11;
((PPARAM)pcDlgData)->id = PP_BACKGROUNDCOLOR;
((PPARAM)pcDlgData)->cb = 3;
((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].b;
((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].g;
((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].r;
pcDlgData += 11;
}
/* Offset to ctl data. */
pDlgItem->offCtlData = pcDlgData - (PCHAR)pTemplate;
/* Put CtlData for the dialog in here */
*((PULONG)pcDlgData) = FCF_TITLEBAR | FCF_SYSMENU;
pcDlgData += sizeof(ULONG);
/* Second item info - static text (message). */
pDlgItem++;
pDlgItem->fsItemStatus = 0;
/* No children since its a control, it could have child control */
/* (ex. a group box). */
pDlgItem->cChildren = 0;
/* Length of class name, 0 - offClassname contains a WC_ constant. */
pDlgItem->cchClassName = 0;
pDlgItem->offClassName = (USHORT)WC_STATIC;
pDlgItem->cchText = cbText;
pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the text. */
/* Copy message text into the dialog template. */
if (pszText != NULL) {
SDL_memcpy(pcDlgData, pszText, cbText);
} else {
*pcDlgData = '\0';
}
pcDlgData += pDlgItem->cchText;
pDlgItem->flStyle = SS_TEXT | DT_TOP | DT_LEFT | DT_WORDBREAK | WS_VISIBLE;
/* It will be really set in _wmInitDlg(). */
pDlgItem->x = 25;
pDlgItem->y = 13;
pDlgItem->cx = 147;
pDlgItem->cy = 62; /* It will be used. */
pDlgItem->id = IDD_TEXT_MESSAGE; /* an ID value */
if (pSDLColors == NULL)
pDlgItem->offPresParams = 0;
else {
/* Presentation parameter for the static text - dialog colors. */
pDlgItem->offPresParams = pcDlgData - (PCHAR)pTemplate;
((PPRESPARAMS)pcDlgData)->cb = 22;
pcDlgData += 4;
((PPARAM)pcDlgData)->id = PP_FOREGROUNDCOLOR;
((PPARAM)pcDlgData)->cb = 3;
((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].b;
((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].g;
((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT].r;
pcDlgData += 11;
((PPARAM)pcDlgData)->id = PP_BACKGROUNDCOLOR;
((PPARAM)pcDlgData)->cb = 3;
((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].b;
((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].g;
((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BACKGROUND].r;
pcDlgData += 11;
}
pDlgItem->offCtlData = 0;
/* Third item info - static bitmap. */
pDlgItem++;
pDlgItem->fsItemStatus = 0;
pDlgItem->cChildren = 0;
pDlgItem->cchClassName = 0;
pDlgItem->offClassName = (USHORT)WC_STATIC;
pDlgItem->cchText = 3; /* 0xFF, low byte of the icon Id, high byte of icon Id. */
pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the Id. */
/* Write system icon ID into dialog template. */
*((PBYTE)pcDlgData) = 0xFF; /* First byte is 0xFF, next 2 are system pointer Id. */
pcDlgData++;
*((PUSHORT)pcDlgData) = ((messageboxdata->flags & SDL_MESSAGEBOX_ERROR) != 0)?
SPTR_ICONERROR :
((messageboxdata->flags & SDL_MESSAGEBOX_WARNING) != 0)?
SPTR_ICONWARNING : SPTR_ICONINFORMATION;
pcDlgData += 2;
pDlgItem->flStyle = SS_SYSICON | WS_VISIBLE;
pDlgItem->x = 4;
pDlgItem->y = 45; /* It will be really set in _wmInitDlg(). */
pDlgItem->cx = 0;
pDlgItem->cy = 0;
pDlgItem->id = IDD_BITMAP;
pDlgItem->offPresParams = 0;
pDlgItem->offCtlData = 0;
/* Next items - buttons. */
for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++) {
pDlgItem++;
pDlgItem->fsItemStatus = 0;
pDlgItem->cChildren = 0; /* No children. */
pDlgItem->cchClassName = 0; /* 0 - offClassname is WC_ constant. */
pDlgItem->offClassName = (USHORT)WC_BUTTON;
pszBtnText = OS2_UTF8ToSys(pSDLBtnData[ulIdx].text);
cbBtnText = (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1);
pDlgItem->cchText = cbBtnText;
pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the text. */
/* Copy text for the button into the dialog template. */
if (pszBtnText != NULL) {
SDL_memcpy(pcDlgData, pszBtnText, cbBtnText);
} else {
*pcDlgData = '\0';
}
pcDlgData += pDlgItem->cchText;
SDL_free(pszBtnText);
pDlgItem->flStyle = BS_PUSHBUTTON | WS_TABSTOP | WS_VISIBLE;
if (pSDLBtnData[ulIdx].flags == SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) {
pDlgItem->flStyle |= BS_DEFAULT;
pTemplate->iItemFocus = ulIdx + 3; /* +3 - frame, static text and icon. */
pSDLColor = &pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED];
} else {
pSDLColor = &pSDLColors[SDL_MESSAGEBOX_COLOR_TEXT];
}
/* It will be really set in _wmInitDlg() */
pDlgItem->x = 10;
pDlgItem->y = 10;
pDlgItem->cx = 70;
pDlgItem->cy = 15;
pDlgItem->id = IDD_PB_FIRST + ulIdx; /* an ID value */
if (pSDLColors == NULL)
pDlgItem->offPresParams = 0;
else {
/* Presentation parameter for the button - dialog colors. */
pDlgItem->offPresParams = pcDlgData - (PCHAR)pTemplate;
((PPRESPARAMS)pcDlgData)->cb = 44;
pcDlgData += 4;
((PPARAM)pcDlgData)->id = PP_FOREGROUNDCOLOR;
((PPARAM)pcDlgData)->cb = 3;
((PPARAM)pcDlgData)->ab[0] = pSDLColor->b;
((PPARAM)pcDlgData)->ab[1] = pSDLColor->g;
((PPARAM)pcDlgData)->ab[2] = pSDLColor->r;
pcDlgData += 11;
((PPARAM)pcDlgData)->id = PP_BACKGROUNDCOLOR;
((PPARAM)pcDlgData)->cb = 3;
((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND].b;
((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND].g;
((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND].r;
pcDlgData += 11;
((PPARAM)pcDlgData)->id = PP_BORDERLIGHTCOLOR;
((PPARAM)pcDlgData)->cb = 3;
((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].b;
((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].g;
((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].r;
pcDlgData += 11;
((PPARAM)pcDlgData)->id = PP_BORDERDARKCOLOR;
((PPARAM)pcDlgData)->cb = 3;
((PPARAM)pcDlgData)->ab[0] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].b;
((PPARAM)pcDlgData)->ab[1] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].g;
((PPARAM)pcDlgData)->ab[2] = pSDLColors[SDL_MESSAGEBOX_COLOR_BUTTON_BORDER].r;
pcDlgData += 11;
}
pDlgItem->offCtlData = 0;
}
/* Check, end of templ. data: &((PCHAR)pTemplate)[cbTemplate] == pcDlgData */
/* Create the dialog from template. */
stDlgData.cb = sizeof(MSGBOXDLGDATA);
stDlgData.hwndUnder = (messageboxdata->window != NULL && messageboxdata->window->driverdata != NULL)?
((WINDATA *)messageboxdata->window->driverdata)->hwnd : HWND_DESKTOP;
hwnd = WinCreateDlg(HWND_DESKTOP, /* Parent is desktop. */
stDlgData.hwndUnder,
(PFNWP)DynDlgProc, pTemplate, &stDlgData);
SDL_free(pTemplate);
SDL_free(pszTitle);
SDL_free(pszText);
return hwnd;
}
int OS2_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
{
HWND hwnd;
ULONG ulRC;
SDL_MessageBoxButtonData
*pSDLBtnData = (SDL_MessageBoxButtonData *)messageboxdata->buttons;
ULONG cSDLBtnData = messageboxdata->numbuttons;
BOOL fVideoInitialized = SDL_WasInit(SDL_INIT_VIDEO);
HAB hab;
HMQ hmq;
BOOL fSuccess = FALSE;
if (!fVideoInitialized) {
PTIB tib;
PPIB pib;
DosGetInfoBlocks(&tib, &pib);
if (pib->pib_ultype == 2 || pib->pib_ultype == 0) {
/* VIO windowable or fullscreen protect-mode session */
pib->pib_ultype = 3; /* Presentation Manager protect-mode session */
}
hab = WinInitialize(0);
if (hab == NULLHANDLE) {
debug_os2("WinInitialize() failed");
return -1;
}
hmq = WinCreateMsgQueue(hab, 0);
if (hmq == NULLHANDLE) {
debug_os2("WinCreateMsgQueue() failed");
return -1;
}
}
/* Create dynamic dialog. */
hwnd = _makeDlg(messageboxdata);
/* Show dialog and obtain button Id. */
ulRC = WinProcessDlg(hwnd);
/* Destroy dialog, */
WinDestroyWindow(hwnd);
if (ulRC == DID_CANCEL) {
/* Window closed by ESC, Alt+F4 or system menu. */
ULONG ulIdx;
for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++, pSDLBtnData++) {
if (pSDLBtnData->flags == SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
*buttonid = pSDLBtnData->buttonid;
fSuccess = TRUE;
break;
}
}
} else {
/* Button pressed. */
ulRC -= IDD_PB_FIRST;
if (ulRC < cSDLBtnData) {
*buttonid = pSDLBtnData[ulRC].buttonid;
fSuccess = TRUE;
}
}
if (!fVideoInitialized) {
WinDestroyMsgQueue(hmq);
WinTerminate(hab);
}
return (fSuccess)? 0 : -1;
}
#endif /* SDL_VIDEO_DRIVER_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,29 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_VIDEO_DRIVER_OS2
extern int OS2_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
#endif /* SDL_VIDEO_DRIVER_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,194 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_VIDEO_DRIVER_OS2
#include "SDL_os2video.h"
#include "../../events/SDL_mouse_c.h"
#include "SDL_os2util.h"
HPOINTER hptrCursor = NULLHANDLE;
static SDL_Cursor* OS2_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y)
{
ULONG ulMaxW = WinQuerySysValue(HWND_DESKTOP, SV_CXPOINTER);
ULONG ulMaxH = WinQuerySysValue(HWND_DESKTOP, SV_CYPOINTER);
HPOINTER hptr;
SDL_Cursor* pSDLCursor;
if (surface->w > ulMaxW || surface->h > ulMaxH) {
debug_os2("Given image size is %u x %u, maximum allowed size is %u x %u",
surface->w, surface->h, ulMaxW, ulMaxH);
return NULL;
}
hptr = utilCreatePointer(surface, hot_x, ulMaxH - hot_y - 1);
if (hptr == NULLHANDLE)
return NULL;
pSDLCursor = SDL_calloc(1, sizeof(SDL_Cursor));
if (pSDLCursor == NULL) {
WinDestroyPointer(hptr);
SDL_OutOfMemory();
return NULL;
}
pSDLCursor->driverdata = (void *)hptr;
return pSDLCursor;
}
static SDL_Cursor* OS2_CreateSystemCursor(SDL_SystemCursor id)
{
SDL_Cursor* pSDLCursor;
LONG lSysId;
HPOINTER hptr;
switch (id) {
case SDL_SYSTEM_CURSOR_ARROW: lSysId = SPTR_ARROW; break;
case SDL_SYSTEM_CURSOR_IBEAM: lSysId = SPTR_TEXT; break;
case SDL_SYSTEM_CURSOR_WAIT: lSysId = SPTR_WAIT; break;
case SDL_SYSTEM_CURSOR_CROSSHAIR: lSysId = SPTR_MOVE; break;
case SDL_SYSTEM_CURSOR_WAITARROW: lSysId = SPTR_WAIT; break;
case SDL_SYSTEM_CURSOR_SIZENWSE: lSysId = SPTR_SIZENWSE; break;
case SDL_SYSTEM_CURSOR_SIZENESW: lSysId = SPTR_SIZENESW; break;
case SDL_SYSTEM_CURSOR_SIZEWE: lSysId = SPTR_SIZEWE; break;
case SDL_SYSTEM_CURSOR_SIZENS: lSysId = SPTR_SIZENS; break;
case SDL_SYSTEM_CURSOR_SIZEALL: lSysId = SPTR_MOVE; break;
case SDL_SYSTEM_CURSOR_NO: lSysId = SPTR_ILLEGAL; break;
case SDL_SYSTEM_CURSOR_HAND: lSysId = SPTR_ARROW; break;
default:
debug_os2("Unknown cursor id: %u", id);
return NULL;
}
/* On eCS SPTR_WAIT for last paramether fCopy=TRUE/FALSE gives different
* "wait" icons. -=8( ) */
hptr = WinQuerySysPointer(HWND_DESKTOP, lSysId,
id == SDL_SYSTEM_CURSOR_WAIT);
if (hptr == NULLHANDLE) {
debug_os2("Cannot load OS/2 system pointer %u for SDL cursor id %u",
lSysId, id);
return NULL;
}
pSDLCursor = SDL_calloc(1, sizeof(SDL_Cursor));
if (pSDLCursor == NULL) {
WinDestroyPointer(hptr);
SDL_OutOfMemory();
return NULL;
}
pSDLCursor->driverdata = (void *)hptr;
return pSDLCursor;
}
static void OS2_FreeCursor(SDL_Cursor *cursor)
{
HPOINTER hptr = (HPOINTER)cursor->driverdata;
WinDestroyPointer(hptr);
SDL_free(cursor);
}
static int OS2_ShowCursor(SDL_Cursor *cursor)
{
hptrCursor = (cursor != NULL)? (HPOINTER)cursor->driverdata : NULLHANDLE;
return ((SDL_GetMouseFocus() == NULL) ||
WinSetPointer(HWND_DESKTOP, hptrCursor))? 0 : -1;
}
static void OS2_WarpMouse(SDL_Window * window, int x, int y)
{
WINDATA *pWinData = (WINDATA *)window->driverdata;
POINTL pointl;
pointl.x = x;
pointl.y = window->h - y;
WinMapWindowPoints(pWinData->hwnd, HWND_DESKTOP, &pointl, 1);
/* pWinData->lSkipWMMouseMove++; ???*/
WinSetPointerPos(HWND_DESKTOP, pointl.x, pointl.y);
}
static int OS2_WarpMouseGlobal(int x, int y)
{
WinSetPointerPos(HWND_DESKTOP, x,
WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - y);
return 0;
}
static int OS2_CaptureMouse(SDL_Window *window)
{
return WinSetCapture(HWND_DESKTOP, (window == NULL)? NULLHANDLE :
((WINDATA *)window->driverdata)->hwnd)? 0 : -1;
}
static Uint32 OS2_GetGlobalMouseState(int *x, int *y)
{
POINTL pointl;
ULONG ulRes;
WinQueryPointerPos(HWND_DESKTOP, &pointl);
*x = pointl.x;
*y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - pointl.y - 1;
ulRes = (WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) & 0x8000)? SDL_BUTTON_LMASK : 0;
if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000)
ulRes |= SDL_BUTTON_RMASK;
if (WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) & 0x8000)
ulRes |= SDL_BUTTON_MMASK;
return ulRes;
}
void OS2_InitMouse(_THIS, ULONG hab)
{
SDL_Mouse *pSDLMouse = SDL_GetMouse();
pSDLMouse->CreateCursor = OS2_CreateCursor;
pSDLMouse->CreateSystemCursor = OS2_CreateSystemCursor;
pSDLMouse->ShowCursor = OS2_ShowCursor;
pSDLMouse->FreeCursor = OS2_FreeCursor;
pSDLMouse->WarpMouse = OS2_WarpMouse;
pSDLMouse->WarpMouseGlobal = OS2_WarpMouseGlobal;
pSDLMouse->CaptureMouse = OS2_CaptureMouse;
pSDLMouse->GetGlobalMouseState = OS2_GetGlobalMouseState;
SDL_SetDefaultCursor(OS2_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW));
if (hptrCursor == NULLHANDLE)
hptrCursor = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, TRUE);
}
void OS2_QuitMouse(_THIS)
{
SDL_Mouse *pSDLMouse = SDL_GetMouse();
if (pSDLMouse->def_cursor != NULL) {
SDL_free(pSDLMouse->def_cursor);
pSDLMouse->def_cursor = NULL;
pSDLMouse->cur_cursor = NULL;
}
}
#endif /* SDL_VIDEO_DRIVER_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,33 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifndef SDL_os2mouse_h_
#define SDL_os2mouse_h_
extern HPOINTER hptrCursor;
extern void OS2_InitMouse(_THIS, ULONG hab);
extern void OS2_QuitMouse(_THIS);
#endif /* SDL_os2mouse_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,59 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_os2output_
#define SDL_os2output_
#include "../../core/os2/SDL_os2.h"
typedef struct _VODATA *PVODATA;
typedef struct _VIDEOOUTPUTINFO {
ULONG ulBPP;
ULONG fccColorEncoding;
ULONG ulScanLineSize;
ULONG ulHorizResolution;
ULONG ulVertResolution;
} VIDEOOUTPUTINFO;
typedef struct _OS2VIDEOOUTPUT {
BOOL (*QueryInfo)(VIDEOOUTPUTINFO *pInfo);
PVODATA (*Open)();
VOID (*Close)(PVODATA pVOData);
BOOL (*SetVisibleRegion)(PVODATA pVOData, HWND hwnd,
SDL_DisplayMode *pSDLDisplayMode, HRGN hrgnShape,
BOOL fVisible);
PVOID (*VideoBufAlloc)(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight,
ULONG ulBPP, ULONG fccColorEncoding,
PULONG pulScanLineSize);
VOID (*VideoBufFree)(PVODATA pVOData);
BOOL (*Update)(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects,
ULONG cSDLRects);
} OS2VIDEOOUTPUT;
extern OS2VIDEOOUTPUT voDive;
extern OS2VIDEOOUTPUT voVMan;
#endif /* SDL_os2output_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,114 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_VIDEO_DRIVER_OS2
#include "SDL_os2util.h"
HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY)
{
HBITMAP hbm;
BITMAPINFOHEADER2 bmih;
BITMAPINFO bmi;
HPS hps;
PULONG pulBitmap;
PULONG pulDst, pulSrc, pulDstMask;
ULONG ulY, ulX;
HPOINTER hptr = NULLHANDLE;
if (surface->format->format != SDL_PIXELFORMAT_ARGB8888) {
debug_os2("Image format should be SDL_PIXELFORMAT_ARGB8888");
return NULLHANDLE;
}
pulBitmap = (PULONG) SDL_malloc(surface->h * surface->w * 2 * sizeof(ULONG));
if (pulBitmap == NULL) {
SDL_OutOfMemory();
return NULLHANDLE;
}
/* pulDst - last line of surface (image) part of the result bitmap */
pulDst = &pulBitmap[ (surface->h - 1) * surface->w ];
/* pulDstMask - last line of mask part of the result bitmap */
pulDstMask = &pulBitmap[ (2 * surface->h - 1) * surface->w ];
/* pulSrc - first line of source image */
pulSrc = (PULONG)surface->pixels;
for (ulY = 0; ulY < surface->h; ulY++) {
for (ulX = 0; ulX < surface->w; ulX++) {
if ((pulSrc[ulX] & 0xFF000000) == 0) {
pulDst[ulX] = 0;
pulDstMask[ulX] = 0xFFFFFFFF;
} else {
pulDst[ulX] = pulSrc[ulX] & 0xFFFFFF;
pulDstMask[ulX] = 0;
}
}
/* Set image and mask pointers on one line up */
pulDst -= surface->w;
pulDstMask -= surface->w;
/* Set source image pointer to the next line */
pulSrc = (PULONG) (((PCHAR)pulSrc) + surface->pitch);
}
/* Create system bitmap object. */
SDL_zero(bmih);
SDL_zero(bmi);
bmih.cbFix = sizeof(BITMAPINFOHEADER2);
bmih.cx = surface->w;
bmih.cy = 2 * surface->h;
bmih.cPlanes = 1;
bmih.cBitCount = 32;
bmih.ulCompression = BCA_UNCOMP;
bmih.cbImage = bmih.cx * bmih.cy * 4;
bmi.cbFix = sizeof(BITMAPINFOHEADER);
bmi.cx = bmih.cx;
bmi.cy = bmih.cy;
bmi.cPlanes = 1;
bmi.cBitCount = 32;
hps = WinGetPS(HWND_DESKTOP);
hbm = GpiCreateBitmap(hps, (PBITMAPINFOHEADER2)&bmih, CBM_INIT,
(PBYTE)pulBitmap, (PBITMAPINFO2)&bmi);
if (hbm == GPI_ERROR) {
debug_os2("GpiCreateBitmap() failed");
} else {
/* Create a system pointer object. */
hptr = WinCreatePointer(HWND_DESKTOP, hbm, TRUE, ulHotX, ulHotY);
if (hptr == NULLHANDLE) {
debug_os2("WinCreatePointer() failed");
}
}
GpiDeleteBitmap(hbm);
WinReleasePS(hps);
SDL_free(pulBitmap);
return hptr;
}
#endif /* SDL_VIDEO_DRIVER_OS2 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,38 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_os2util_h_
#define SDL_os2util_h_
#include "SDL_log.h"
#include "../SDL_sysvideo.h"
#include "../../core/os2/SDL_os2.h"
#define INCL_WIN
#define INCL_GPI
#include <os2.h>
HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY);
#endif /* SDL_os2util_h_ */
/* vi: set ts=4 sw=4 expandtab: */

File diff suppressed because it is too large Load Diff

View File

@@ -1,82 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifndef SDL_os2video_h_
#define SDL_os2video_h_
#include "../SDL_sysvideo.h"
#include "../../core/os2/SDL_os2.h"
#define INCL_DOS
#define INCL_DOSERRORS
#define INCL_DOSPROCESS
#define INCL_WIN
#define INCL_GPI
#define INCL_OS2MM
#define INCL_DOSMEMMGR
#include <os2.h>
#include "SDL_os2mouse.h"
#include "SDL_os2output.h"
typedef struct SDL_VideoData {
HAB hab;
HMQ hmq;
OS2VIDEOOUTPUT *pOutput; /* Video output routines */
} SDL_VideoData;
typedef struct _WINDATA {
SDL_Window *window;
OS2VIDEOOUTPUT *pOutput; /* Video output routines */
HWND hwndFrame;
HWND hwnd;
PFNWP fnUserWndProc;
PFNWP fnWndFrameProc;
PVODATA pVOData; /* Video output data */
HRGN hrgnShape;
HPOINTER hptrIcon;
RECTL rectlBeforeFS;
LONG lSkipWMSize;
LONG lSkipWMMove;
LONG lSkipWMMouseMove;
LONG lSkipWMVRNEnabled;
LONG lSkipWMAdjustFramePos;
} WINDATA;
typedef struct _DISPLAYDATA {
ULONG ulDPIHor;
ULONG ulDPIVer;
ULONG ulDPIDiag;
} DISPLAYDATA;
typedef struct _MODEDATA {
ULONG ulDepth;
ULONG fccColorEncoding;
ULONG ulScanLineBytes;
} MODEDATA;
#endif /* SDL_os2video_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -1,483 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#include "../SDL_sysvideo.h"
#define INCL_DOSERRORS
#define INCL_DOSPROCESS
#define INCL_DOSMODULEMGR
#define INCL_WIN
#define INCL_GPI
#define INCL_GPIBITMAPS /* GPI bit map functions */
#include <os2.h>
#include "SDL_os2output.h"
#include "SDL_os2video.h"
#include "SDL_gradd.h"
typedef struct _VODATA {
PVOID pBuffer;
HRGN hrgnVisible;
ULONG ulBPP;
ULONG ulScanLineSize;
ULONG ulWidth;
ULONG ulHeight;
ULONG ulScreenHeight;
ULONG ulScreenBytesPerLine;
RECTL rectlWin;
PRECTL pRectl;
ULONG cRectl;
PBLTRECT pBltRect;
ULONG cBltRect;
} VODATA;
static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo);
static PVODATA voOpen();
static VOID voClose(PVODATA pVOData);
static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd,
SDL_DisplayMode *pSDLDisplayMode,
HRGN hrgnShape, BOOL fVisible);
static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight,
ULONG ulBPP, ULONG fccColorEncoding,
PULONG pulScanLineSize);
static VOID voVideoBufFree(PVODATA pVOData);
static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects,
ULONG cSDLRects);
OS2VIDEOOUTPUT voVMan = {
voQueryInfo,
voOpen,
voClose,
voSetVisibleRegion,
voVideoBufAlloc,
voVideoBufFree,
voUpdate
};
static HMODULE hmodVMan = NULLHANDLE;
static FNVMIENTRY *pfnVMIEntry = NULL;
static ULONG ulVRAMAddress = 0;
static VOID APIENTRY ExitVMan(VOID)
{
if (ulVRAMAddress != 0 && hmodVMan != NULLHANDLE) {
pfnVMIEntry(0, VMI_CMD_TERMPROC, NULL, NULL);
DosFreeModule(hmodVMan);
}
DosExitList(EXLST_EXIT, (PFNEXITLIST)NULL);
}
static BOOL _vmanInit(void)
{
ULONG ulRC;
CHAR acBuf[256];
INITPROCOUT stInitProcOut;
if (hmodVMan != NULLHANDLE) /* already initialized */
return TRUE;
/* Load vman.dll */
ulRC = DosLoadModule(acBuf, sizeof(acBuf), "VMAN", &hmodVMan);
if (ulRC != NO_ERROR) {
debug_os2("Could not load VMAN.DLL, rc = %u : %s", ulRC, acBuf);
hmodVMan = NULLHANDLE;
return FALSE;
}
/* Get VMIEntry */
ulRC = DosQueryProcAddr(hmodVMan, 0L, "VMIEntry", (PFN *)&pfnVMIEntry);
if (ulRC != NO_ERROR) {
debug_os2("Could not query address of VMIEntry from VMAN.DLL (Err: %lu)", ulRC);
DosFreeModule(hmodVMan);
hmodVMan = NULLHANDLE;
return FALSE;
}
/* VMAN initialization */
stInitProcOut.ulLength = sizeof(stInitProcOut);
ulRC = pfnVMIEntry(0, VMI_CMD_INITPROC, NULL, &stInitProcOut);
if (ulRC != RC_SUCCESS) {
debug_os2("Could not initialize VMAN for this process");
pfnVMIEntry = NULL;
DosFreeModule(hmodVMan);
hmodVMan = NULLHANDLE;
return FALSE;
}
/* Store video memory virtual address */
ulVRAMAddress = stInitProcOut.ulVRAMVirt;
/* We use exit list for VMI_CMD_TERMPROC */
if (DosExitList(EXLST_ADD | 0x00001000, (PFNEXITLIST)ExitVMan) != NO_ERROR) {
debug_os2("DosExitList() failed");
}
return TRUE;
}
static PRECTL _getRectlArray(PVODATA pVOData, ULONG cRects)
{
PRECTL pRectl;
if (pVOData->cRectl >= cRects)
return pVOData->pRectl;
pRectl = SDL_realloc(pVOData->pRectl, cRects * sizeof(RECTL));
if (pRectl == NULL)
return NULL;
pVOData->pRectl = pRectl;
pVOData->cRectl = cRects;
return pRectl;
}
static PBLTRECT _getBltRectArray(PVODATA pVOData, ULONG cRects)
{
PBLTRECT pBltRect;
if (pVOData->cBltRect >= cRects)
return pVOData->pBltRect;
pBltRect = SDL_realloc(pVOData->pBltRect, cRects * sizeof(BLTRECT));
if (pBltRect == NULL)
return NULL;
pVOData->pBltRect = pBltRect;
pVOData->cBltRect = cRects;
return pBltRect;
}
static BOOL voQueryInfo(VIDEOOUTPUTINFO *pInfo)
{
ULONG ulRC;
GDDMODEINFO sCurModeInfo;
if (!_vmanInit())
return FALSE;
/* Query current (desktop) mode */
ulRC = pfnVMIEntry(0, VMI_CMD_QUERYCURRENTMODE, NULL, &sCurModeInfo);
if (ulRC != RC_SUCCESS) {
debug_os2("Could not query desktop video mode.");
return FALSE;
}
pInfo->ulBPP = sCurModeInfo.ulBpp;
pInfo->ulHorizResolution = sCurModeInfo.ulHorizResolution;
pInfo->ulVertResolution = sCurModeInfo.ulVertResolution;
pInfo->ulScanLineSize = sCurModeInfo.ulScanLineSize;
pInfo->fccColorEncoding = sCurModeInfo.fccColorEncoding;
return TRUE;
}
static PVODATA voOpen(void)
{
PVODATA pVOData;
if (!_vmanInit())
return NULL;
pVOData = SDL_calloc(1, sizeof(VODATA));
if (pVOData == NULL) {
SDL_OutOfMemory();
return NULL;
}
return pVOData;
}
static VOID voClose(PVODATA pVOData)
{
if (pVOData->pRectl != NULL)
SDL_free(pVOData->pRectl);
if (pVOData->pBltRect != NULL)
SDL_free(pVOData->pBltRect);
voVideoBufFree(pVOData);
}
static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd,
SDL_DisplayMode *pSDLDisplayMode,
HRGN hrgnShape, BOOL fVisible)
{
HPS hps;
BOOL fSuccess = FALSE;
hps = WinGetPS(hwnd);
if (pVOData->hrgnVisible != NULLHANDLE) {
GpiDestroyRegion(hps, pVOData->hrgnVisible);
pVOData->hrgnVisible = NULLHANDLE;
}
if (fVisible) {
/* Query visible rectangles */
pVOData->hrgnVisible = GpiCreateRegion(hps, 0, NULL);
if (pVOData->hrgnVisible == NULLHANDLE) {
SDL_SetError("GpiCreateRegion() failed");
} else {
if (WinQueryVisibleRegion(hwnd, pVOData->hrgnVisible) == RGN_ERROR) {
GpiDestroyRegion(hps, pVOData->hrgnVisible);
pVOData->hrgnVisible = NULLHANDLE;
} else {
if (hrgnShape != NULLHANDLE)
GpiCombineRegion(hps, pVOData->hrgnVisible, pVOData->hrgnVisible,
hrgnShape, CRGN_AND);
fSuccess = TRUE;
}
}
WinQueryWindowRect(hwnd, &pVOData->rectlWin);
WinMapWindowPoints(hwnd, HWND_DESKTOP, (PPOINTL)&pVOData->rectlWin, 2);
if (pSDLDisplayMode != NULL) {
pVOData->ulScreenHeight = pSDLDisplayMode->h;
pVOData->ulScreenBytesPerLine =
((MODEDATA *)pSDLDisplayMode->driverdata)->ulScanLineBytes;
}
}
WinReleasePS(hps);
return fSuccess;
}
static PVOID voVideoBufAlloc(PVODATA pVOData, ULONG ulWidth, ULONG ulHeight,
ULONG ulBPP, ULONG fccColorEncoding,
PULONG pulScanLineSize)
{
ULONG ulRC;
ULONG ulScanLineSize = ulWidth * (ulBPP >> 3);
/* Destroy previous buffer */
voVideoBufFree(pVOData);
if (ulWidth == 0 || ulHeight == 0 || ulBPP == 0)
return NULL;
/* Bytes per line */
ulScanLineSize = (ulScanLineSize + 3) & ~3; /* 4-byte aligning */
*pulScanLineSize = ulScanLineSize;
ulRC = DosAllocMem(&pVOData->pBuffer,
(ulHeight * ulScanLineSize) + sizeof(ULONG),
PAG_COMMIT | PAG_EXECUTE | PAG_READ | PAG_WRITE);
if (ulRC != NO_ERROR) {
debug_os2("DosAllocMem(), rc = %u", ulRC);
return NULL;
}
pVOData->ulBPP = ulBPP;
pVOData->ulScanLineSize = ulScanLineSize;
pVOData->ulWidth = ulWidth;
pVOData->ulHeight = ulHeight;
return pVOData->pBuffer;
}
static VOID voVideoBufFree(PVODATA pVOData)
{
ULONG ulRC;
if (pVOData->pBuffer == NULL)
return;
ulRC = DosFreeMem(pVOData->pBuffer);
if (ulRC != NO_ERROR) {
debug_os2("DosFreeMem(), rc = %u", ulRC);
} else {
pVOData->pBuffer = NULL;
}
}
static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects,
ULONG cSDLRects)
{
PRECTL prectlDst, prectlScan;
HPS hps;
HRGN hrgnUpdate;
RGNRECT rgnCtl;
SDL_Rect stSDLRectDef;
BMAPINFO bmiSrc;
BMAPINFO bmiDst;
PPOINTL pptlSrcOrg;
PBLTRECT pbrDst;
HWREQIN sHWReqIn;
BITBLTINFO sBitbltInfo;
ULONG ulIdx;
if (pVOData->pBuffer == NULL)
return FALSE;
if (pVOData->hrgnVisible == NULLHANDLE)
return TRUE;
bmiSrc.ulLength = sizeof(BMAPINFO);
bmiSrc.ulType = BMAP_MEMORY;
bmiSrc.ulWidth = pVOData->ulWidth;
bmiSrc.ulHeight = pVOData->ulHeight;
bmiSrc.ulBpp = pVOData->ulBPP;
bmiSrc.ulBytesPerLine = pVOData->ulScanLineSize;
bmiSrc.pBits = (PBYTE)pVOData->pBuffer;
bmiDst.ulLength = sizeof(BMAPINFO);
bmiDst.ulType = BMAP_VRAM;
bmiDst.pBits = (PBYTE)ulVRAMAddress;
bmiDst.ulWidth = bmiSrc.ulWidth;
bmiDst.ulHeight = bmiSrc.ulHeight;
bmiDst.ulBpp = bmiSrc.ulBpp;
bmiDst.ulBytesPerLine = pVOData->ulScreenBytesPerLine;
/* List of update rectangles. This is the intersection of requested
* rectangles and visible rectangles. */
if (cSDLRects == 0) {
/* Full update requested */
stSDLRectDef.x = 0;
stSDLRectDef.y = 0;
stSDLRectDef.w = bmiSrc.ulWidth;
stSDLRectDef.h = bmiSrc.ulHeight;
pSDLRects = &stSDLRectDef;
cSDLRects = 1;
}
/* Make list of destination rectangles (prectlDst) list from the source
* list (prectl). */
prectlDst = _getRectlArray(pVOData, cSDLRects);
if (prectlDst == NULL) {
debug_os2("Not enough memory");
return FALSE;
}
prectlScan = prectlDst;
for (ulIdx = 0; ulIdx < cSDLRects; ulIdx++, pSDLRects++, prectlScan++) {
prectlScan->xLeft = pSDLRects->x;
prectlScan->yTop = pVOData->ulHeight - pSDLRects->y;
prectlScan->xRight = prectlScan->xLeft + pSDLRects->w;
prectlScan->yBottom = prectlScan->yTop - pSDLRects->h;
}
hps = WinGetPS(hwnd);
if (hps == NULLHANDLE)
return FALSE;
/* Make destination region to update */
hrgnUpdate = GpiCreateRegion(hps, cSDLRects, prectlDst);
/* "AND" on visible and destination regions, result is region to update */
GpiCombineRegion(hps, hrgnUpdate, hrgnUpdate, pVOData->hrgnVisible, CRGN_AND);
/* Get rectangles of the region to update */
rgnCtl.ircStart = 1;
rgnCtl.crc = 0;
rgnCtl.ulDirection = 1;
rgnCtl.crcReturned = 0;
GpiQueryRegionRects(hps, hrgnUpdate, NULL, &rgnCtl, NULL);
if (rgnCtl.crcReturned == 0) {
GpiDestroyRegion(hps, hrgnUpdate);
WinReleasePS(hps);
return TRUE;
}
/* We don't need prectlDst, use it again to store update regions */
prectlDst = _getRectlArray(pVOData, rgnCtl.crcReturned);
if (prectlDst == NULL) {
debug_os2("Not enough memory");
GpiDestroyRegion(hps, hrgnUpdate);
WinReleasePS(hps);
return FALSE;
}
rgnCtl.ircStart = 1;
rgnCtl.crc = rgnCtl.crcReturned;
rgnCtl.ulDirection = 1;
GpiQueryRegionRects(hps, hrgnUpdate, NULL, &rgnCtl, prectlDst);
GpiDestroyRegion(hps, hrgnUpdate);
WinReleasePS(hps);
cSDLRects = rgnCtl.crcReturned;
/* Now cRect/prectlDst is a list of regions in window (update && visible) */
/* Make lists for blitting from update regions */
pbrDst = _getBltRectArray(pVOData, cSDLRects);
if (pbrDst == NULL) {
debug_os2("Not enough memory");
return FALSE;
}
prectlScan = prectlDst;
pptlSrcOrg = (PPOINTL)prectlDst; /* Yes, this memory block will be used again */
for (ulIdx = 0; ulIdx < cSDLRects; ulIdx++, prectlScan++, pptlSrcOrg++) {
pbrDst[ulIdx].ulXOrg = pVOData->rectlWin.xLeft + prectlScan->xLeft;
pbrDst[ulIdx].ulYOrg = pVOData->ulScreenHeight -
(pVOData->rectlWin.yBottom + prectlScan->yTop);
pbrDst[ulIdx].ulXExt = prectlScan->xRight - prectlScan->xLeft;
pbrDst[ulIdx].ulYExt = prectlScan->yTop - prectlScan->yBottom;
pptlSrcOrg->x = prectlScan->xLeft;
pptlSrcOrg->y = bmiSrc.ulHeight - prectlScan->yTop;
}
pptlSrcOrg = (PPOINTL)prectlDst;
/* Request HW */
sHWReqIn.ulLength = sizeof(HWREQIN);
sHWReqIn.ulFlags = REQUEST_HW;
sHWReqIn.cScrChangeRects = 1;
sHWReqIn.arectlScreen = &pVOData->rectlWin;
if (pfnVMIEntry(0, VMI_CMD_REQUESTHW, &sHWReqIn, NULL) != RC_SUCCESS) {
debug_os2("pfnVMIEntry(,VMI_CMD_REQUESTHW,,) failed");
sHWReqIn.cScrChangeRects = 0; /* for fail signal only */
} else {
RECTL rclSrcBounds;
rclSrcBounds.xLeft = 0;
rclSrcBounds.yBottom = 0;
rclSrcBounds.xRight = bmiSrc.ulWidth;
rclSrcBounds.yTop = bmiSrc.ulHeight;
SDL_zero(sBitbltInfo);
sBitbltInfo.ulLength = sizeof(BITBLTINFO);
sBitbltInfo.ulBltFlags = BF_DEFAULT_STATE | BF_ROP_INCL_SRC | BF_PAT_HOLLOW;
sBitbltInfo.cBlits = cSDLRects;
sBitbltInfo.ulROP = ROP_SRCCOPY;
sBitbltInfo.pSrcBmapInfo = &bmiSrc;
sBitbltInfo.pDstBmapInfo = &bmiDst;
sBitbltInfo.prclSrcBounds = &rclSrcBounds;
sBitbltInfo.prclDstBounds = &pVOData->rectlWin;
sBitbltInfo.aptlSrcOrg = pptlSrcOrg;
sBitbltInfo.abrDst = pbrDst;
/* Screen update */
if (pfnVMIEntry(0, VMI_CMD_BITBLT, &sBitbltInfo, NULL) != RC_SUCCESS) {
debug_os2("pfnVMIEntry(,VMI_CMD_BITBLT,,) failed");
sHWReqIn.cScrChangeRects = 0; /* for fail signal only */
}
/* Release HW */
sHWReqIn.ulFlags = 0;
if (pfnVMIEntry(0, VMI_CMD_REQUESTHW, &sHWReqIn, NULL) != RC_SUCCESS) {
debug_os2("pfnVMIEntry(,VMI_CMD_REQUESTHW,,) failed");
}
}
return sHWReqIn.cScrChangeRects != 0;
}
/* vi: set ts=4 sw=4 expandtab: */