mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 06:34:36 +00:00
Updates the SDL library to the latest standard bugfix release
This commit is contained in:
parent
cb766f2878
commit
083d2175ea
1280 changed files with 343926 additions and 179615 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2023 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
|
||||
|
|
@ -34,8 +34,7 @@
|
|||
#include "../../video/uikit/SDL_uikitvideo.h"
|
||||
#endif
|
||||
|
||||
void *
|
||||
SDL_LoadObject(const char *sofile)
|
||||
void *SDL_LoadObject(const char *sofile)
|
||||
{
|
||||
void *handle;
|
||||
const char *loaderror;
|
||||
|
|
@ -47,37 +46,35 @@ SDL_LoadObject(const char *sofile)
|
|||
}
|
||||
#endif
|
||||
|
||||
handle = dlopen(sofile, RTLD_NOW|RTLD_LOCAL);
|
||||
handle = dlopen(sofile, RTLD_NOW | RTLD_LOCAL);
|
||||
loaderror = dlerror();
|
||||
if (handle == NULL) {
|
||||
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
|
||||
}
|
||||
return (handle);
|
||||
return handle;
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_LoadFunction(void *handle, const char *name)
|
||||
void *SDL_LoadFunction(void *handle, const char *name)
|
||||
{
|
||||
void *symbol = dlsym(handle, name);
|
||||
if (symbol == NULL) {
|
||||
/* append an underscore for platforms that need that. */
|
||||
/* prepend an underscore for platforms that need that. */
|
||||
SDL_bool isstack;
|
||||
size_t len = 1 + SDL_strlen(name) + 1;
|
||||
char *_name = SDL_small_alloc(char, len, &isstack);
|
||||
size_t len = SDL_strlen(name) + 1;
|
||||
char *_name = SDL_small_alloc(char, len + 1, &isstack);
|
||||
_name[0] = '_';
|
||||
SDL_strlcpy(&_name[1], name, len);
|
||||
SDL_memcpy(&_name[1], name, len);
|
||||
symbol = dlsym(handle, _name);
|
||||
SDL_small_free(_name, isstack);
|
||||
if (symbol == NULL) {
|
||||
SDL_SetError("Failed loading %s: %s", name,
|
||||
(const char *) dlerror());
|
||||
(const char *)dlerror());
|
||||
}
|
||||
}
|
||||
return (symbol);
|
||||
return symbol;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_UnloadObject(void *handle)
|
||||
void SDL_UnloadObject(void *handle)
|
||||
{
|
||||
if (handle != NULL) {
|
||||
dlclose(handle);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2023 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
|
||||
|
|
@ -27,24 +27,21 @@
|
|||
|
||||
#include "SDL_loadso.h"
|
||||
|
||||
void *
|
||||
SDL_LoadObject(const char *sofile)
|
||||
void *SDL_LoadObject(const char *sofile)
|
||||
{
|
||||
const char *loaderror = "SDL_LoadObject() not implemented";
|
||||
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_LoadFunction(void *handle, const char *name)
|
||||
void *SDL_LoadFunction(void *handle, const char *name)
|
||||
{
|
||||
const char *loaderror = "SDL_LoadFunction() not implemented";
|
||||
SDL_SetError("Failed loading %s: %s", name, loaderror);
|
||||
return (NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_UnloadObject(void *handle)
|
||||
void SDL_UnloadObject(void *handle)
|
||||
{
|
||||
/* no-op. */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2023 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
|
||||
|
|
@ -32,8 +32,7 @@
|
|||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
|
||||
void *
|
||||
SDL_LoadObject(const char *sofile)
|
||||
void *SDL_LoadObject(const char *sofile)
|
||||
{
|
||||
ULONG ulRC;
|
||||
HMODULE hModule;
|
||||
|
|
@ -47,22 +46,40 @@ SDL_LoadObject(const char *sofile)
|
|||
|
||||
pszModName = OS2_UTF8ToSys(sofile);
|
||||
ulRC = DosLoadModule(acError, sizeof(acError), pszModName, &hModule);
|
||||
SDL_free(pszModName);
|
||||
if (ulRC != NO_ERROR) {
|
||||
SDL_SetError("Failed loading %s (E%u)", acError, ulRC);
|
||||
return NULL;
|
||||
|
||||
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)
|
||||
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;
|
||||
|
|
@ -71,8 +88,7 @@ SDL_LoadFunction(void *handle, const char *name)
|
|||
return (void *)pFN;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_UnloadObject(void *handle)
|
||||
void SDL_UnloadObject(void *handle)
|
||||
{
|
||||
if (handle != NULL) {
|
||||
DosFreeModule((HMODULE)handle);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2023 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
|
||||
|
|
@ -29,25 +29,24 @@
|
|||
|
||||
#include "SDL_loadso.h"
|
||||
|
||||
void *
|
||||
SDL_LoadObject(const char *sofile)
|
||||
void *SDL_LoadObject(const char *sofile)
|
||||
{
|
||||
void *handle;
|
||||
LPTSTR tstr;
|
||||
|
||||
if (!sofile) {
|
||||
if (sofile == NULL) {
|
||||
SDL_InvalidParamError("sofile");
|
||||
return NULL;
|
||||
}
|
||||
tstr = WIN_UTF8ToString(sofile);
|
||||
#ifdef __WINRT__
|
||||
/* WinRT only publically supports LoadPackagedLibrary() for loading .dll
|
||||
/* WinRT only publicly supports LoadPackagedLibrary() for loading .dll
|
||||
files. LoadLibrary() is a private API, and not available for apps
|
||||
(that can be published to MS' Windows Store.)
|
||||
*/
|
||||
handle = (void *) LoadPackagedLibrary(tstr, 0);
|
||||
handle = (void *)LoadPackagedLibrary(tstr, 0);
|
||||
#else
|
||||
handle = (void *) LoadLibrary(tstr);
|
||||
handle = (void *)LoadLibrary(tstr);
|
||||
#endif
|
||||
SDL_free(tstr);
|
||||
|
||||
|
|
@ -61,10 +60,9 @@ SDL_LoadObject(const char *sofile)
|
|||
return handle;
|
||||
}
|
||||
|
||||
void *
|
||||
SDL_LoadFunction(void *handle, const char *name)
|
||||
void *SDL_LoadFunction(void *handle, const char *name)
|
||||
{
|
||||
void *symbol = (void *) GetProcAddress((HMODULE) handle, name);
|
||||
void *symbol = (void *)GetProcAddress((HMODULE)handle, name);
|
||||
if (symbol == NULL) {
|
||||
char errbuf[512];
|
||||
SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf));
|
||||
|
|
@ -74,11 +72,10 @@ SDL_LoadFunction(void *handle, const char *name)
|
|||
return symbol;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_UnloadObject(void *handle)
|
||||
void SDL_UnloadObject(void *handle)
|
||||
{
|
||||
if (handle != NULL) {
|
||||
FreeLibrary((HMODULE) handle);
|
||||
FreeLibrary((HMODULE)handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue