diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/misc | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/misc')
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/SDL_sysurl.h | 31 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/SDL_url.c | 31 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/android/SDL_sysurl.c | 29 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/dummy/SDL_sysurl.c | 28 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/emscripten/SDL_sysurl.c | 33 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/haiku/SDL_sysurl.cc | 34 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/ios/SDL_sysurl.m | 42 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/macos/SDL_sysurl.m | 42 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/riscos/SDL_sysurl.c | 49 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/unix/SDL_sysurl.c | 71 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/vita/SDL_sysurl.c | 41 | ||||
| -rw-r--r-- | contrib/SDL-3.2.8/src/misc/windows/SDL_sysurl.c | 62 |
12 files changed, 493 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/misc/SDL_sysurl.h b/contrib/SDL-3.2.8/src/misc/SDL_sysurl.h new file mode 100644 index 0000000..b5ee700 --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/SDL_sysurl.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef __cplusplus | ||
| 24 | extern "C" { | ||
| 25 | #endif | ||
| 26 | |||
| 27 | extern bool SDL_SYS_OpenURL(const char *url); | ||
| 28 | |||
| 29 | #ifdef __cplusplus | ||
| 30 | } | ||
| 31 | #endif | ||
diff --git a/contrib/SDL-3.2.8/src/misc/SDL_url.c b/contrib/SDL-3.2.8/src/misc/SDL_url.c new file mode 100644 index 0000000..b3163ab --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/SDL_url.c | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "SDL_sysurl.h" | ||
| 24 | |||
| 25 | bool SDL_OpenURL(const char *url) | ||
| 26 | { | ||
| 27 | if (!url) { | ||
| 28 | return SDL_InvalidParamError("url"); | ||
| 29 | } | ||
| 30 | return SDL_SYS_OpenURL(url); | ||
| 31 | } | ||
diff --git a/contrib/SDL-3.2.8/src/misc/android/SDL_sysurl.c b/contrib/SDL-3.2.8/src/misc/android/SDL_sysurl.c new file mode 100644 index 0000000..d79f1e0 --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/android/SDL_sysurl.c | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "../SDL_sysurl.h" | ||
| 24 | #include "../../core/android/SDL_android.h" | ||
| 25 | |||
| 26 | bool SDL_SYS_OpenURL(const char *url) | ||
| 27 | { | ||
| 28 | return Android_JNI_OpenURL(url); | ||
| 29 | } | ||
diff --git a/contrib/SDL-3.2.8/src/misc/dummy/SDL_sysurl.c b/contrib/SDL-3.2.8/src/misc/dummy/SDL_sysurl.c new file mode 100644 index 0000000..64dcfa9 --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/dummy/SDL_sysurl.c | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "../SDL_sysurl.h" | ||
| 24 | |||
| 25 | bool SDL_SYS_OpenURL(const char *url) | ||
| 26 | { | ||
| 27 | return SDL_Unsupported(); | ||
| 28 | } | ||
diff --git a/contrib/SDL-3.2.8/src/misc/emscripten/SDL_sysurl.c b/contrib/SDL-3.2.8/src/misc/emscripten/SDL_sysurl.c new file mode 100644 index 0000000..881de01 --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/emscripten/SDL_sysurl.c | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "../SDL_sysurl.h" | ||
| 24 | |||
| 25 | #include <emscripten/emscripten.h> | ||
| 26 | |||
| 27 | EM_JS_DEPS(sdlsysurl, "$UTF8ToString"); | ||
| 28 | |||
| 29 | bool SDL_SYS_OpenURL(const char *url) | ||
| 30 | { | ||
| 31 | EM_ASM(window.open(UTF8ToString($0), "_blank"), url); | ||
| 32 | return true; | ||
| 33 | } | ||
diff --git a/contrib/SDL-3.2.8/src/misc/haiku/SDL_sysurl.cc b/contrib/SDL-3.2.8/src/misc/haiku/SDL_sysurl.cc new file mode 100644 index 0000000..1ce5955 --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/haiku/SDL_sysurl.cc | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "../SDL_sysurl.h" | ||
| 24 | #include <Url.h> | ||
| 25 | |||
| 26 | bool SDL_SYS_OpenURL(const char *url) | ||
| 27 | { | ||
| 28 | BUrl burl(url); | ||
| 29 | const status_t rc = burl.OpenWithPreferredApplication(false); | ||
| 30 | if (rc != B_NO_ERROR) { | ||
| 31 | return SDL_SetError("URL open failed (err=%d)", (int)rc); | ||
| 32 | } | ||
| 33 | return true; | ||
| 34 | } | ||
diff --git a/contrib/SDL-3.2.8/src/misc/ios/SDL_sysurl.m b/contrib/SDL-3.2.8/src/misc/ios/SDL_sysurl.m new file mode 100644 index 0000000..1221eda --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/ios/SDL_sysurl.m | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #if defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) | ||
| 24 | |||
| 25 | #include "../SDL_sysurl.h" | ||
| 26 | |||
| 27 | #import <UIKit/UIKit.h> | ||
| 28 | |||
| 29 | bool SDL_SYS_OpenURL(const char *url) | ||
| 30 | { | ||
| 31 | @autoreleasepool { | ||
| 32 | NSString *nsstr = [NSString stringWithUTF8String:url]; | ||
| 33 | NSURL *nsurl = [NSURL URLWithString:nsstr]; | ||
| 34 | if (![[UIApplication sharedApplication] canOpenURL:nsurl]) { | ||
| 35 | return SDL_SetError("No handler registered for this type of URL"); | ||
| 36 | } | ||
| 37 | [[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:^(BOOL success) {}]; | ||
| 38 | return true; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | #endif // SDL_PLATFORM_IOS || SDL_PLATFORM_TVOS | ||
diff --git a/contrib/SDL-3.2.8/src/misc/macos/SDL_sysurl.m b/contrib/SDL-3.2.8/src/misc/macos/SDL_sysurl.m new file mode 100644 index 0000000..64d9c92 --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/macos/SDL_sysurl.m | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #if defined(SDL_PLATFORM_MACOS) | ||
| 24 | |||
| 25 | #include "../SDL_sysurl.h" | ||
| 26 | |||
| 27 | #import <Cocoa/Cocoa.h> | ||
| 28 | |||
| 29 | bool SDL_SYS_OpenURL(const char *url) | ||
| 30 | { | ||
| 31 | @autoreleasepool { | ||
| 32 | CFURLRef cfurl = CFURLCreateWithBytes(NULL, (const UInt8 *)url, SDL_strlen(url), kCFStringEncodingUTF8, NULL); | ||
| 33 | OSStatus status = LSOpenCFURLRef(cfurl, NULL); | ||
| 34 | CFRelease(cfurl); | ||
| 35 | if (status != noErr) { | ||
| 36 | return SDL_SetError("LSOpenCFURLRef() failed: %d", status); | ||
| 37 | } | ||
| 38 | return true; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | #endif // SDL_PLATFORM_MACOS | ||
diff --git a/contrib/SDL-3.2.8/src/misc/riscos/SDL_sysurl.c b/contrib/SDL-3.2.8/src/misc/riscos/SDL_sysurl.c new file mode 100644 index 0000000..f5a92b2 --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/riscos/SDL_sysurl.c | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "../SDL_sysurl.h" | ||
| 24 | |||
| 25 | #include <kernel.h> | ||
| 26 | #include <swis.h> | ||
| 27 | |||
| 28 | #ifndef URI_Dispatch | ||
| 29 | #define URI_Dispatch 0x4e381 | ||
| 30 | #endif | ||
| 31 | |||
| 32 | bool SDL_SYS_OpenURL(const char *url) | ||
| 33 | { | ||
| 34 | _kernel_swi_regs regs; | ||
| 35 | _kernel_oserror *error; | ||
| 36 | |||
| 37 | regs.r[0] = 0; | ||
| 38 | regs.r[1] = (int)url; | ||
| 39 | regs.r[2] = 0; | ||
| 40 | error = _kernel_swi(URI_Dispatch, ®s, ®s); | ||
| 41 | if (error) { | ||
| 42 | return SDL_SetError("Couldn't open given URL: %s", error->errmess); | ||
| 43 | } | ||
| 44 | |||
| 45 | if (regs.r[0] & 1) { | ||
| 46 | return SDL_SetError("Couldn't open given URL."); | ||
| 47 | } | ||
| 48 | return true; | ||
| 49 | } | ||
diff --git a/contrib/SDL-3.2.8/src/misc/unix/SDL_sysurl.c b/contrib/SDL-3.2.8/src/misc/unix/SDL_sysurl.c new file mode 100644 index 0000000..e72894b --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/unix/SDL_sysurl.c | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "../SDL_sysurl.h" | ||
| 24 | |||
| 25 | #include <stdio.h> | ||
| 26 | #include <stdlib.h> | ||
| 27 | #include <string.h> | ||
| 28 | #include <unistd.h> | ||
| 29 | #include <sys/wait.h> | ||
| 30 | #include <errno.h> | ||
| 31 | #ifdef USE_POSIX_SPAWN | ||
| 32 | #include <spawn.h> | ||
| 33 | extern char **environ; | ||
| 34 | #endif | ||
| 35 | |||
| 36 | bool SDL_SYS_OpenURL(const char *url) | ||
| 37 | { | ||
| 38 | const char *args[] = { "xdg-open", url, NULL }; | ||
| 39 | SDL_Environment *env = NULL; | ||
| 40 | SDL_Process *process = NULL; | ||
| 41 | bool result = false; | ||
| 42 | |||
| 43 | env = SDL_CreateEnvironment(true); | ||
| 44 | if (!env) { | ||
| 45 | goto done; | ||
| 46 | } | ||
| 47 | |||
| 48 | // Clear LD_PRELOAD so Chrome opens correctly when this application is launched by Steam | ||
| 49 | SDL_UnsetEnvironmentVariable(env, "LD_PRELOAD"); | ||
| 50 | |||
| 51 | SDL_PropertiesID props = SDL_CreateProperties(); | ||
| 52 | if (!props) { | ||
| 53 | goto done; | ||
| 54 | } | ||
| 55 | SDL_SetPointerProperty(props, SDL_PROP_PROCESS_CREATE_ARGS_POINTER, args); | ||
| 56 | SDL_SetPointerProperty(props, SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER, env); | ||
| 57 | SDL_SetBooleanProperty(props, SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN, true); | ||
| 58 | process = SDL_CreateProcessWithProperties(props); | ||
| 59 | SDL_DestroyProperties(props); | ||
| 60 | if (!process) { | ||
| 61 | goto done; | ||
| 62 | } | ||
| 63 | |||
| 64 | result = true; | ||
| 65 | |||
| 66 | done: | ||
| 67 | SDL_DestroyEnvironment(env); | ||
| 68 | SDL_DestroyProcess(process); | ||
| 69 | |||
| 70 | return result; | ||
| 71 | } | ||
diff --git a/contrib/SDL-3.2.8/src/misc/vita/SDL_sysurl.c b/contrib/SDL-3.2.8/src/misc/vita/SDL_sysurl.c new file mode 100644 index 0000000..fb901c3 --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/vita/SDL_sysurl.c | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "../SDL_sysurl.h" | ||
| 24 | |||
| 25 | #include <string.h> | ||
| 26 | #include <psp2/apputil.h> | ||
| 27 | |||
| 28 | bool SDL_SYS_OpenURL(const char *url) | ||
| 29 | { | ||
| 30 | SceAppUtilInitParam init_param; | ||
| 31 | SceAppUtilBootParam boot_param; | ||
| 32 | SceAppUtilWebBrowserParam browser_param; | ||
| 33 | SDL_zero(init_param); | ||
| 34 | SDL_zero(boot_param); | ||
| 35 | sceAppUtilInit(&init_param, &boot_param); | ||
| 36 | SDL_zero(browser_param); | ||
| 37 | browser_param.str = url; | ||
| 38 | browser_param.strlen = SDL_strlen(url); | ||
| 39 | sceAppUtilLaunchWebBrowser(&browser_param); | ||
| 40 | return true; | ||
| 41 | } | ||
diff --git a/contrib/SDL-3.2.8/src/misc/windows/SDL_sysurl.c b/contrib/SDL-3.2.8/src/misc/windows/SDL_sysurl.c new file mode 100644 index 0000000..8e7bf0b --- /dev/null +++ b/contrib/SDL-3.2.8/src/misc/windows/SDL_sysurl.c | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #include "../SDL_sysurl.h" | ||
| 24 | #include "../../core/windows/SDL_windows.h" | ||
| 25 | |||
| 26 | #include <shellapi.h> | ||
| 27 | |||
| 28 | #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) | ||
| 29 | bool SDL_SYS_OpenURL(const char *url) | ||
| 30 | { | ||
| 31 | // Not supported | ||
| 32 | return SDL_Unsupported(); | ||
| 33 | } | ||
| 34 | #else | ||
| 35 | // https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx | ||
| 36 | bool SDL_SYS_OpenURL(const char *url) | ||
| 37 | { | ||
| 38 | WCHAR *wurl; | ||
| 39 | HINSTANCE rc; | ||
| 40 | |||
| 41 | // MSDN says for safety's sake, make sure COM is initialized. | ||
| 42 | const HRESULT hr = WIN_CoInitialize(); | ||
| 43 | if (FAILED(hr)) { | ||
| 44 | return WIN_SetErrorFromHRESULT("CoInitialize failed", hr); | ||
| 45 | } | ||
| 46 | |||
| 47 | wurl = WIN_UTF8ToStringW(url); | ||
| 48 | if (!wurl) { | ||
| 49 | WIN_CoUninitialize(); | ||
| 50 | return false; | ||
| 51 | } | ||
| 52 | |||
| 53 | // Success returns value greater than 32. Less is an error. | ||
| 54 | rc = ShellExecuteW(NULL, L"open", wurl, NULL, NULL, SW_SHOWNORMAL); | ||
| 55 | SDL_free(wurl); | ||
| 56 | WIN_CoUninitialize(); | ||
| 57 | if (rc <= ((HINSTANCE)32)) { | ||
| 58 | return WIN_SetError("Couldn't open given URL."); | ||
| 59 | } | ||
| 60 | return true; | ||
| 61 | } | ||
| 62 | #endif | ||
