Updates the SDL library to the latest standard bugfix release

This commit is contained in:
JeffR 2023-07-13 15:20:29 -05:00
parent cb766f2878
commit 083d2175ea
1280 changed files with 343926 additions and 179615 deletions

View file

@ -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

View file

@ -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
@ -21,12 +21,9 @@
#include "SDL_sysurl.h"
extern int SDL_SYS_OpenURL(const char *url);
int
SDL_OpenURL(const char *url)
int SDL_OpenURL(const char *url)
{
if (!url) {
if (url == NULL) {
return SDL_InvalidParamError("url");
}
return SDL_SYS_OpenURL(url);

View file

@ -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
@ -22,11 +22,9 @@
#include "../SDL_sysurl.h"
#include "../../core/android/SDL_android.h"
int
SDL_SYS_OpenURL(const char *url)
int SDL_SYS_OpenURL(const char *url)
{
return Android_JNI_OpenURL(url);
}
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -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
@ -21,11 +21,9 @@
#include "../SDL_sysurl.h"
int
SDL_SYS_OpenURL(const char *url)
int SDL_SYS_OpenURL(const char *url)
{
return SDL_Unsupported();
}
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -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
@ -23,15 +23,14 @@
#include <emscripten/emscripten.h>
int
SDL_SYS_OpenURL(const char *url)
int SDL_SYS_OpenURL(const char *url)
{
EM_ASM({
window.open(UTF8ToString($0), "_blank");
}, url);
},
url);
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -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
@ -22,8 +22,7 @@
#include "../SDL_sysurl.h"
#include <Url.h>
int
SDL_SYS_OpenURL(const char *url)
int SDL_SYS_OpenURL(const char *url)
{
BUrl burl(url);
const status_t rc = burl.OpenWithPreferredApplication(false);

View file

@ -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
@ -23,14 +23,14 @@
#import <UIKit/UIKit.h>
int
SDL_SYS_OpenURL(const char *url)
{ @autoreleasepool {
int SDL_SYS_OpenURL(const char *url)
{
@autoreleasepool {
NSString *nsstr = [NSString stringWithUTF8String:url];
NSURL *nsurl = [NSURL URLWithString:nsstr];
return [[UIApplication sharedApplication] openURL:nsurl] ? 0 : -1;
}}
NSString *nsstr = [NSString stringWithUTF8String:url];
NSURL *nsurl = [NSURL URLWithString:nsstr];
return [[UIApplication sharedApplication] openURL:nsurl] ? 0 : -1;
}
}
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -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
@ -23,14 +23,14 @@
#import <Cocoa/Cocoa.h>
int
SDL_SYS_OpenURL(const char *url)
{ @autoreleasepool
int SDL_SYS_OpenURL(const char *url)
{
CFURLRef cfurl = CFURLCreateWithBytes(NULL, (const UInt8 *) url, SDL_strlen(url), kCFStringEncodingUTF8, NULL);
OSStatus status = LSOpenCFURLRef(cfurl, NULL);
CFRelease(cfurl);
return status == noErr ? 0 : -1;
}}
@autoreleasepool {
CFURLRef cfurl = CFURLCreateWithBytes(NULL, (const UInt8 *)url, SDL_strlen(url), kCFStringEncodingUTF8, NULL);
OSStatus status = LSOpenCFURLRef(cfurl, NULL);
CFRelease(cfurl);
return status == noErr ? 0 : -1;
}
}
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -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
@ -28,8 +28,7 @@
#define URI_Dispatch 0x4e381
#endif
int
SDL_SYS_OpenURL(const char *url)
int SDL_SYS_OpenURL(const char *url)
{
_kernel_swi_regs regs;
_kernel_oserror *error;
@ -46,4 +45,3 @@ SDL_SYS_OpenURL(const char *url)
}
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -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
@ -28,20 +28,19 @@
#include <sys/wait.h>
#include <errno.h>
int
SDL_SYS_OpenURL(const char *url)
int SDL_SYS_OpenURL(const char *url)
{
const pid_t pid1 = fork();
if (pid1 == 0) { /* child process */
if (pid1 == 0) { /* child process */
pid_t pid2;
/* Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam */
unsetenv("LD_PRELOAD");
/* Notice this is vfork and not fork! */
pid2 = vfork();
if (pid2 == 0) { /* Grandchild process will try to launch the url */
if (pid2 == 0) { /* Grandchild process will try to launch the url */
execlp("xdg-open", "xdg-open", url, NULL);
_exit(EXIT_FAILURE);
} else if (pid2 < 0) { /* There was an error forking */
} else if (pid2 < 0) { /* There was an error forking */
_exit(EXIT_FAILURE);
} else {
/* Child process doesn't wait for possibly-blocking grandchild. */
@ -53,14 +52,14 @@ SDL_SYS_OpenURL(const char *url)
int status;
if (waitpid(pid1, &status, 0) == pid1) {
if (WIFEXITED(status)) {
if (WEXITSTATUS(status) == 0) {
return 0; /* success! */
} else {
return SDL_SetError("xdg-open reported error or failed to launch: %d", WEXITSTATUS(status));
}
} else {
if (WEXITSTATUS(status) == 0) {
return 0; /* success! */
} else {
return SDL_SetError("xdg-open reported error or failed to launch: %d", WEXITSTATUS(status));
}
} else {
return SDL_SetError("xdg-open failed for some reason");
}
}
} else {
return SDL_SetError("Waiting on xdg-open failed: %s", strerror(errno));
}
@ -68,4 +67,3 @@ SDL_SYS_OpenURL(const char *url)
}
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -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
@ -24,8 +24,7 @@
#include <string.h>
#include <psp2/apputil.h>
int
SDL_SYS_OpenURL(const char *url)
int SDL_SYS_OpenURL(const char *url)
{
SceAppUtilInitParam init_param;
SceAppUtilBootParam boot_param;
@ -41,4 +40,3 @@ SDL_SYS_OpenURL(const char *url)
}
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -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
@ -24,11 +24,17 @@
#include <shellapi.h>
/* https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx */
int
SDL_SYS_OpenURL(const char *url)
#if defined(__XBOXONE__) || defined(__XBOXSERIES__)
int SDL_SYS_OpenURL(const char *url)
{
WCHAR* wurl;
/* Not supported */
return SDL_Unsupported();
}
#else
/* https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx */
int SDL_SYS_OpenURL(const char *url)
{
WCHAR *wurl;
HINSTANCE rc;
/* MSDN says for safety's sake, make sure COM is initialized. */
@ -47,8 +53,8 @@ SDL_SYS_OpenURL(const char *url)
rc = ShellExecuteW(NULL, L"open", wurl, NULL, NULL, SW_SHOWNORMAL);
SDL_free(wurl);
WIN_CoUninitialize();
return (rc > ((HINSTANCE) 32)) ? 0 : WIN_SetError("Couldn't open given URL.");
return (rc > ((HINSTANCE)32)) ? 0 : WIN_SetError("Couldn't open given URL.");
}
#endif
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -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
@ -22,8 +22,7 @@
#include "../SDL_sysurl.h"
#include "../../core/windows/SDL_windows.h"
int
SDL_SYS_OpenURL(const char *url)
int SDL_SYS_OpenURL(const char *url)
{
WCHAR *wurl = WIN_UTF8ToStringW(url);
if (!wurl) {
@ -34,8 +33,7 @@ SDL_SYS_OpenURL(const char *url)
auto uri = ref new Windows::Foundation::Uri(strurl);
Windows::System::Launcher::LaunchUriAsync(uri);
return 0; // oh well, we're not waiting on an async task here.
return 0; // oh well, we're not waiting on an async task here.
}
/* vi: set ts=4 sw=4 expandtab: */