From f45ce45603a00e92332f925132547fa53cf82650 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Tue, 10 Dec 2024 19:13:24 -0500
Subject: [PATCH] ngage: Remove Nokia N-Gage support.
This can be reverted if a toolchain arrives that can handle C99 features like
variables declared in the middle of a scope, but for now we literally can't
compile SDL3 for this platform.
Fixes #11243.
---
build-scripts/rename_macros.py | 1 -
docs/README-migration.md | 1 -
docs/README-ngage.md | 45 +--
include/SDL3/SDL_main.h | 7 -
include/SDL3/SDL_main_impl.h | 12 -
include/SDL3/SDL_platform_defines.h | 10 -
include/build_config/SDL_build_config.h | 2 -
include/build_config/SDL_build_config_ngage.h | 99 -----
src/SDL.c | 2 -
src/dynapi/SDL_dynapi.h | 2 -
src/main/ngage/SDL_sysmain_runapp.cpp | 77 ----
src/stdlib/SDL_vacopy.h | 6 +-
src/thread/SDL_thread_c.h | 2 -
src/thread/ngage/SDL_sysmutex.cpp | 100 -----
src/thread/ngage/SDL_syssem.cpp | 157 --------
src/thread/ngage/SDL_systhread.cpp | 112 ------
src/thread/ngage/SDL_systhread_c.h | 23 --
src/timer/ngage/SDL_systimer.cpp | 59 ---
src/video/SDL_sysvideo.h | 1 -
src/video/SDL_video.c | 3 -
src/video/ngage/SDL_ngageevents.cpp | 192 ---------
src/video/ngage/SDL_ngageevents_c.h | 26 --
src/video/ngage/SDL_ngageframebuffer.cpp | 380 ------------------
src/video/ngage/SDL_ngageframebuffer_c.h | 36 --
src/video/ngage/SDL_ngagevideo.cpp | 164 --------
src/video/ngage/SDL_ngagevideo.h | 65 ---
src/video/ngage/SDL_ngagewindow.cpp | 125 ------
src/video/ngage/SDL_ngagewindow.h | 38 --
28 files changed, 4 insertions(+), 1743 deletions(-)
delete mode 100644 include/build_config/SDL_build_config_ngage.h
delete mode 100644 src/main/ngage/SDL_sysmain_runapp.cpp
delete mode 100644 src/thread/ngage/SDL_sysmutex.cpp
delete mode 100644 src/thread/ngage/SDL_syssem.cpp
delete mode 100644 src/thread/ngage/SDL_systhread.cpp
delete mode 100644 src/thread/ngage/SDL_systhread_c.h
delete mode 100644 src/timer/ngage/SDL_systimer.cpp
delete mode 100644 src/video/ngage/SDL_ngageevents.cpp
delete mode 100644 src/video/ngage/SDL_ngageevents_c.h
delete mode 100644 src/video/ngage/SDL_ngageframebuffer.cpp
delete mode 100644 src/video/ngage/SDL_ngageframebuffer_c.h
delete mode 100644 src/video/ngage/SDL_ngagevideo.cpp
delete mode 100644 src/video/ngage/SDL_ngagevideo.h
delete mode 100644 src/video/ngage/SDL_ngagewindow.cpp
delete mode 100644 src/video/ngage/SDL_ngagewindow.h
diff --git a/build-scripts/rename_macros.py b/build-scripts/rename_macros.py
index ba386cd41f5f0..978120ccf7db4 100755
--- a/build-scripts/rename_macros.py
+++ b/build-scripts/rename_macros.py
@@ -113,7 +113,6 @@ def main():
"__LINUX__": "SDL_PLATFORM_LINUX",
"__OS2__": "SDL_PLATFORM_OS2",
# "__ANDROID__": "SDL_PLATFORM_ANDROID,
- "__NGAGE__": "SDL_PLATFORM_NGAGE",
"__APPLE__": "SDL_PLATFORM_APPLE",
"__TVOS__": "SDL_PLATFORM_TVOS",
"__IPHONEOS__": "SDL_PLATFORM_IOS",
diff --git a/docs/README-migration.md b/docs/README-migration.md
index a6f9a64acbc76..d1693faa4dfd8 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -1290,7 +1290,6 @@ The following platform preprocessor macros have been renamed:
| `__LINUX__` | `SDL_PLATFORM_LINUX` |
| `__MACOSX__` | `SDL_PLATFORM_MACOS` |
| `__NETBSD__` | `SDL_PLATFORM_NETBSD` |
-| `__NGAGE__` | `SDL_PLATFORM_NGAGE` |
| `__OPENBSD__` | `SDL_PLATFORM_OPENBSD` |
| `__OS2__` | `SDL_PLATFORM_OS2` |
| `__OSF__` | `SDL_PLATFORM_OSF` |
diff --git a/docs/README-ngage.md b/docs/README-ngage.md
index 363760b992aec..84192b01abaee 100644
--- a/docs/README-ngage.md
+++ b/docs/README-ngage.md
@@ -1,44 +1,5 @@
-Nokia N-Gage
-============
+Support for the Nokia N-Gage has been removed from SDL3 (but will make a
+comeback when newer compilers are available for the platform).
-SDL port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage
-(Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev).
+SDL2 still supports this platform.
-Compiling
----------
-
-SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project.
-The library is included in the
-[toolchain](https://github.com/ngagesdk/ngage-toolchain) as a
-sub-module.
-
-A complete example project based on SDL can be found in the GitHub
-account of the SDK: [Wordle](https://github.com/ngagesdk/wordle).
-
-Current level of implementation
--------------------------------
-
-The video driver currently provides full screen video support with
-keyboard input.
-
-At the moment only the software renderer works.
-
-Audio is not yet implemented.
-
-Acknowledgements
-----------------
-
-Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the
-valuable insight into Symbian programming. Without the SDL 1.2 port
-which was specially developed for CDoom (Doom for the Nokia 9210), this
-adaptation would not have been possible.
-
-I would like to thank my friends
-[Razvan](https://twitter.com/bewarerazvan) and [Dan
-Whelan](https://danwhelan.ie/), for their continuous support. Without
-you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would
-have lost my patience long ago.
-
-Last but not least, I would like to thank the development team of
-[EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your
-patience and support in troubleshooting helped me a lot.
diff --git a/include/SDL3/SDL_main.h b/include/SDL3/SDL_main.h
index 9b97abda6d3d8..047c6be94b575 100644
--- a/include/SDL3/SDL_main.h
+++ b/include/SDL3/SDL_main.h
@@ -134,13 +134,6 @@
*/
#define SDL_MAIN_AVAILABLE
- #elif defined(SDL_PLATFORM_NGAGE)
- /*
- TODO: not sure if it should be SDL_MAIN_NEEDED, in SDL2 ngage had a
- main implementation, but wasn't mentioned in SDL_main.h
- */
- #define SDL_MAIN_AVAILABLE
-
#endif
#endif /* SDL_MAIN_HANDLED */
diff --git a/include/SDL3/SDL_main_impl.h b/include/SDL3/SDL_main_impl.h
index e5560e388aa7c..761e6b887cbf9 100644
--- a/include/SDL3/SDL_main_impl.h
+++ b/include/SDL3/SDL_main_impl.h
@@ -131,18 +131,6 @@
/* end of SDL_PLATFORM_WINDOWS impls */
- #elif defined(SDL_PLATFORM_NGAGE)
- /* same typedef as in ngage SDKs e32def.h */
- typedef signed int TInt;
- /* TODO: if it turns out that this only works when built as C++,
- move SDL_PLATFORM_NGAGE into the C++ section in SDL_main.h */
- TInt E32Main()
- {
- return SDL_RunApp(0, NULL, SDL_main, NULL);
- }
-
- /* end of SDL_PLATFORM_NGAGE impl */
-
#else /* platforms that use a standard main() and just call SDL_RunApp(), like iOS and 3DS */
int main(int argc, char *argv[])
{
diff --git a/include/SDL3/SDL_platform_defines.h b/include/SDL3/SDL_platform_defines.h
index 89ce02d4525e1..0030a15fecda7 100644
--- a/include/SDL3/SDL_platform_defines.h
+++ b/include/SDL3/SDL_platform_defines.h
@@ -112,16 +112,6 @@
#undef SDL_PLATFORM_LINUX
#endif
-#ifdef __NGAGE__
-
-/**
- * A preprocessor macro that is only defined if compiling for Nokia N-Gage.
- *
- * \since This macro is available since SDL 3.1.3.
- */
-#define SDL_PLATFORM_NGAGE 1
-#endif
-
#if defined(__unix__) || defined(__unix) || defined(unix)
/**
diff --git a/include/build_config/SDL_build_config.h b/include/build_config/SDL_build_config.h
index b712b1e3e4062..afd1dbd58b309 100644
--- a/include/build_config/SDL_build_config.h
+++ b/include/build_config/SDL_build_config.h
@@ -45,8 +45,6 @@
#include "SDL_build_config_ios.h"
#elif defined(SDL_PLATFORM_ANDROID)
#include "SDL_build_config_android.h"
-#elif defined(SDL_PLATFORM_NGAGE)
-#include "SDL_build_config_ngage.h"
#else
/* This is a minimal configuration just to get SDL running on new platforms. */
#include "SDL_build_config_minimal.h"
diff --git a/include/build_config/SDL_build_config_ngage.h b/include/build_config/SDL_build_config_ngage.h
deleted file mode 100644
index 9ccf75a89c47a..0000000000000
--- a/include/build_config/SDL_build_config_ngage.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2024 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_build_config_ngage_h_
-#define SDL_build_config_ngage_h_
-#define SDL_build_config_h_
-
-#include <SDL3/SDL_platform_defines.h>
-
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-typedef unsigned long uintptr_t;
-
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-#define HAVE_STDIO_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_MATH_H 1
-#define HAVE_CEIL 1
-#define HAVE_COPYSIGN 1
-#define HAVE_COS 1
-#define HAVE_EXP 1
-#define HAVE_FABS 1
-#define HAVE_FLOOR 1
-#define HAVE_LOG 1
-#define HAVE_LOG10 1
-#define HAVE_SCALBN 1
-#define HAVE_SIN 1
-#define HAVE_SQRT 1
-#define HAVE_TAN 1
-#define HAVE_MALLOC 1
-#define SDL_MAIN_NEEDED 1
-#define LACKS_SYS_MMAN_H 1
-
-/* Enable the N-Gage thread support (src/thread/ngage/\*.c) */
-#define SDL_THREAD_NGAGE 1
-
-/* Enable the N-Gage timer support (src/timer/ngage/\*.c) */
-#define SDL_TIMER_NGAGE 1
-
-/* Enable the N-Gage video driver (src/video/ngage/\*.c) */
-#define SDL_VIDEO_DRIVER_NGAGE 1
-
-/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
-#define SDL_JOYSTICK_DISABLED 1
-
-/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
-#define SDL_HAPTIC_DISABLED 1
-
-/* Enable the stub HIDAPI */
-#define SDL_HIDAPI_DISABLED 1
-
-/* Enable the stub process support */
-#define SDL_PROCESS_DUMMY 1
-
-/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */
-#define SDL_SENSOR_DISABLED 1
-
-/* Enable the dummy shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DUMMY 1
-
-/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
-#define SDL_FILESYSTEM_DUMMY 1
-#define SDL_FSOPS_DUMMY 1
-
-/* Enable the camera driver (src/camera/dummy/\*.c) */
-#define SDL_CAMERA_DRIVER_DUMMY 1
-
-/* Enable dialog subsystem */
-#define SDL_DIALOG_DUMMY 1
-
-#endif /* SDL_build_config_ngage_h_ */
diff --git a/src/SDL.c b/src/SDL.c
index 5eb9c616a85ae..c99ee401382a4 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -742,8 +742,6 @@ const char *SDL_GetPlatform(void)
return "PlayStation Portable";
#elif defined(SDL_PLATFORM_VITA)
return "PlayStation Vita";
-#elif defined(SDL_PLATFORM_NGAGE)
- return "Nokia N-Gage";
#elif defined(SDL_PLATFORM_3DS)
return "Nintendo 3DS";
#elif defined(__managarm__)
diff --git a/src/dynapi/SDL_dynapi.h b/src/dynapi/SDL_dynapi.h
index fd2e3b06abd99..e03882e76c88f 100644
--- a/src/dynapi/SDL_dynapi.h
+++ b/src/dynapi/SDL_dynapi.h
@@ -61,8 +61,6 @@
#define SDL_DYNAMIC_API 0 // Turn off for static analysis, so reports are more clear.
#elif defined(SDL_PLATFORM_VITA)
#define SDL_DYNAMIC_API 0 // vitasdk doesn't support dynamic linking
-#elif defined(SDL_PLATFORM_NGAGE)
-#define SDL_DYNAMIC_API 0 // The N-Gage doesn't support dynamic linking either
#elif defined(SDL_PLATFORM_3DS)
#define SDL_DYNAMIC_API 0 // devkitARM doesn't support dynamic linking
#elif defined(DYNAPI_NEEDS_DLOPEN) && !defined(HAVE_DLOPEN)
diff --git a/src/main/ngage/SDL_sysmain_runapp.cpp b/src/main/ngage/SDL_sysmain_runapp.cpp
deleted file mode 100644
index c675b13039cd3..0000000000000
--- a/src/main/ngage/SDL_sysmain_runapp.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- based on SDL_ngage_main.c, originally for SDL 1.2 by Hannu Viitala
-*/
-
-#include "SDL_internal.h"
-
-#ifdef SDL_PLATFORM_NGAGE
-
-#include <e32std.h>
-#include <e32def.h>
-#include <e32svr.h>
-#include <e32base.h>
-#include <estlib.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <w32std.h>
-#include <apgtask.h>
-
-
-int SDL_RunApp(int argc_, char* argv_[], SDL_main_func mainFunction, void * reserved)
-{
- (void)argc_; (void)argv_; (void)reserved;
- // Get the clean-up stack
- CTrapCleanup *cleanup = CTrapCleanup::New();
-
- // Arrange for multi-threaded operation
- SpawnPosixServerThread();
-
- // Get args and environment
- int argc = 0;
- char **argv = 0;
- char **envp = 0;
-
- __crt0(argc, argv, envp);
-
- // Start the application!
-
- // Create stdlib
- _REENT;
-
- // Set process and thread priority and name
-
- RThread currentThread;
- RProcess thisProcess;
- TParse exeName;
- exeName.Set(thisProcess.FileName(), NULL, NULL);
- currentThread.Rename(exeName.Name());
- currentThread.SetProcessPriority(EPriorityLow);
- currentThread.SetPriority(EPriorityMuchLess);
-
- // Increase heap size
- RHeap *newHeap = NULL;
- RHeap *oldHeap = NULL;
- TInt heapSize = 7500000;
- int ret;
-
- newHeap = User::ChunkHeap(NULL, heapSize, heapSize, KMinHeapGrowBy);
-
- if (!newHeap) {
- ret = 3;
- goto cleanup;
- } else {
- oldHeap = User::SwitchHeap(newHeap);
- // Call stdlib main
- SDL_SetMainReady();
- ret = mainFunction(argc, argv);
- }
-
-cleanup:
- _cleanup();
-
- CloseSTDLIB();
- delete cleanup;
- return ret;
-}
-
-#endif // SDL_PLATFORM_NGAGE
diff --git a/src/stdlib/SDL_vacopy.h b/src/stdlib/SDL_vacopy.h
index c50c17f0f1078..ef4d17dc11ba2 100644
--- a/src/stdlib/SDL_vacopy.h
+++ b/src/stdlib/SDL_vacopy.h
@@ -20,11 +20,7 @@
*/
// Do our best to make sure va_copy is working
-#ifdef SDL_PLATFORM_NGAGE
-#undef va_copy
-#define va_copy(dst, src) dst = src
-
-#elif defined(_MSC_VER) && _MSC_VER <= 1800
+#if defined(_MSC_VER) && _MSC_VER <= 1800
// Visual Studio 2013 tries to link with _vacopy in the C runtime. Newer versions do an inline assignment
#undef va_copy
#define va_copy(dst, src) dst = src
diff --git a/src/thread/SDL_thread_c.h b/src/thread/SDL_thread_c.h
index ec6107bb2b7ba..c703e526212c8 100644
--- a/src/thread/SDL_thread_c.h
+++ b/src/thread/SDL_thread_c.h
@@ -38,8 +38,6 @@
#include "vita/SDL_systhread_c.h"
#elif defined(SDL_THREAD_N3DS)
#include "n3ds/SDL_systhread_c.h"
-#elif defined(SDL_THREAD_NGAGE)
-#include "ngage/SDL_systhread_c.h"
#else
#error Need thread implementation for this platform
#include "generic/SDL_systhread_c.h"
diff --git a/src/thread/ngage/SDL_sysmutex.cpp b/src/thread/ngage/SDL_sysmutex.cpp
deleted file mode 100644
index 307896e9475a2..0000000000000
--- a/src/thread/ngage/SDL_sysmutex.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2024 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"
-
-// An implementation of mutexes using the Symbian API.
-
-#include <e32std.h>
-
-#include "SDL_systhread_c.h"
-
-struct SDL_Mutex
-{
- TInt handle;
-};
-
-extern TInt CreateUnique(TInt (*aFunc)(const TDesC &aName, TAny *, TAny *), TAny *, TAny *);
-
-static TInt NewMutex(const TDesC &aName, TAny *aPtr1, TAny *)
-{
- return ((RMutex *)aPtr1)->CreateGlobal(aName);
-}
-
-// Create a mutex
-SDL_Mutex *SDL_CreateMutex(void)
-{
- RMutex rmutex;
-
- TInt status = CreateUnique(NewMutex, &rmutex, NULL);
- if (status != KErrNone) {
- SDL_SetError("Couldn't create mutex.");
- return NULL;
- }
- SDL_Mutex *mutex = new /*(ELeave)*/ SDL_Mutex;
- mutex->handle = rmutex.Handle();
- return mutex;
-}
-
-// Free the mutex
-void SDL_DestroyMutex(SDL_Mutex *mutex)
-{
- if (mutex) {
- RMutex rmutex;
- rmutex.SetHandle(mutex->handle);
- rmutex.Signal();
- rmutex.Close();
- delete (mutex);
- mutex = NULL;
- }
-}
-
-// Lock the mutex
-void SDL_LockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang doesn't know about NULL mutexes
-{
- if (mutex) {
- RMutex rmutex;
- rmutex.SetHandle(mutex->handle);
- rmutex.Wait();
- }
-}
-
-// Try to lock the mutex
-#if 0
-bool SDL_TryLockMutex(SDL_Mutex *mutex)
-{
- if (mutex) {
- // Not yet implemented.
- return true;
- }
- return true;
-}
-#endif
-
-// Unlock the mutex
-void SDL_UnlockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang doesn't know about NULL mutexes
-{
- if (mutex) {
- RMutex rmutex;
- rmutex.SetHandle(mutex->handle);
- rmutex.Signal();
- }
-}
-
diff --git a/src/thread/ngage/SDL_syssem.cpp b/src/thread/ngage/SDL_syssem.cpp
deleted file mode 100644
index 01de3845f4d80..0000000000000
--- a/src/thread/ngage/SDL_syssem.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2024 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"
-
-// An implementation of semaphores using the Symbian API.
-
-#include <e32std.h>
-
-struct SDL_Semaphore
-{
- TInt handle;
- TInt count;
-};
-
-struct TInfo
-{
- TInfo(TInt aTime, TInt aHandle) : iTime(aTime), iHandle(aHandle), iVal(true) {}
- TInt iTime;
- TInt iHandle;
- bool iVal;
-};
-
-extern TInt CreateUnique(TInt (*aFunc)(const TDesC &aName, TAny *, TAny *), TAny *, TAny *);
-
-static TBool RunThread(TAny *aInfo)
-{
- TInfo *info = STATIC_CAST(TInfo *, aInfo);
- User::After(info->iTime);
- RSemaphore sema;
- sema.SetHandle(info->iHandle);
- sema.Signal();
- info->iVal = false;
- return 0;
-}
-
-static TInt NewThread(const TDesC &aName, TAny *aPtr1, TAny *aPtr2)
-{
- return ((RThread *)(aPtr1))->Create(aName, RunThread, KDefaultStackSize, NULL, aPtr2);
-}
-
-static TInt NewSema(const TDesC &aName, TAny *aPtr1, TAny *aPtr2)
-{
- TInt value = *((TInt *)aPtr2);
- return ((RSemaphore *)aPtr1)->CreateGlobal(aName, value);
-}
-
-static void WaitAll(SDL_Semaphore *sem)
-{
- RSemaphore sema;
- sema.SetHandle(sem->handle);
- sema.Wait();
- while (sem->count < 0) {
- sema.Wait();
- }
-}
-
-SDL_Semaphore *SDL_CreateSemaphore(Uint32 initial_value)
-{
- RSemaphore s;
- TInt status = CreateUnique(NewSema, &s, &initial_value);
- if (status != KErrNone) {
- SDL_SetError("Couldn't create semaphore");
- }
- SDL_Semaphore *sem = new /*(ELeave)*/ SDL_Semaphore;
- sem->handle = s.Handle();
- sem->count = initial_value;
- return sem;
-}
-
-void SDL_DestroySemaphore(SDL_Semaphore *sem)
-{
- if (sem) {
- RSemaphore sema;
- sema.SetHandle(sem->handle);
- sema.Signal(sema.Count());
- sema.Close();
- delete sem;
- sem = NULL;
- }
-}
-
-bool SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS)
-{
- if (!sem) {
- return true;
- }
-
- if (timeoutNS == 0) {
- if (sem->count > 0) {
- --sem->count;
- return true;
- }
- return false;
- }
-
- if (timeoutNS == -1) { // -1 == wait indefinitely.
- WaitAll(sem);
- return true;
- }
-
- RThread thread;
- TInfo *info = new (ELeave) TInfo((TInt)SDL_NS_TO_MS(timeoutNS), sem->handle);
- TInt status = CreateUnique(NewThread, &thread, info);
-
- if (status != KErrNone) {
- return false;
- }
-
- thread.Resume();
- WaitAll(sem);
-
- if (thread.ExitType() == EExitPending) {
- thread.Kill(false);
- }
-
- thread.Close();
- return info->iVal;
-}
-
-Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
-{
- if (!sem) {
- SDL_InvalidParamError("sem");
- return 0;
- }
- return sem->count;
-}
-
-int SDL_SignalSemaphore(SDL_Semaphore *sem)
-{
- if (!sem) {
- return SDL_InvalidParamError("sem");
- }
- sem->count++;
- RSemaphore sema;
- sema.SetHandle(sem->handle);
- sema.Signal();
- return 0;
-}
diff --git a/src/thread/ngage/SDL_systhread.cpp b/src/thread/ngage/SDL_systhread.cpp
deleted file mode 100644
index ff3e3e2f44506..0000000000000
--- a/src/thread/ngage/SDL_systhread.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2024 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_THREAD_NGAGE
-
-// N-Gage thread management routines for SDL
-
-#include <e32std.h>
-
-extern "C" {
-#undef NULL
-#include "../SDL_systhread.h"
-#include "../SDL_thread_c.h"
-};
-
-static int object_count;
-
-static int RunThread(TAny *data)
-{
- SDL_RunThread((SDL_Thread *)data);
- return 0;
-}
-
-static TInt NewThread(const TDesC &aName, TAny *aPtr1, TAny *aPtr2)
-{
- return ((RThread *)(aPtr1))->Create(aName, RunThread, KDefaultStackSize, NULL, aPtr2);
-}
-
-int CreateUnique(TInt (*aFunc)(const TDesC &aName, TAny *, TAny *), TAny *aPtr1, TAny *aPtr2)
-{
- TBuf<16> name;
- TInt status = KErrNone;
- do {
- object_count++;
- name.Format(_L("SDL_%x"), object_count);
- status = aFunc(name, aPtr1, aPtr2);
- } while (status == KErrAlreadyExists);
- return status;
-}
-
-bool SDL_SYS_CreateThread(SDL_Thread *thread,
- SDL_FunctionPointer pfnBeginThread,
- SDL_FunctionPointer pfnEndThread)
-{
- RThread rthread;
-
- TInt status = CreateUnique(NewThread, &rthread, thread);
- if (status != KErrNone) {
- delete (RThread *)thread->handle;
- thread->handle = NULL;
- return SDL_SetError("Not enough resources to create thread");
- }
-
- rthread.Resume();
- thread->handle = rthread.Handle();
- return true;
-}
-
-void SDL_SYS_SetupThread(const char *name)
-{
- return;
-}
-
-SDL_ThreadID SDL_GetCurrentThreadID(void)
-{
- RThread current;
- TThreadId id = current.Id();
- return id;
-}
-
-bool SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
-{
- return true;
-}
-
-void SDL_SYS_WaitThread(SDL_Thread *thread)
-{
- RThread t;
- t.Open(thread->threadid);
- if (t.ExitReason() == EExitPending) {
- TRequestStatus status;
- t.Logon(status);
- User::WaitForRequest(status);
- }
- t.Close();
-}
-
-void SDL_SYS_DetachThread(SDL_Thread *thread)
-{
- return;
-}
-
-#endif // SDL_THREAD_NGAGE
diff --git a/src/thread/ngage/SDL_systhread_c.h b/src/thread/ngage/SDL_systhread_c.h
deleted file mode 100644
index c0b697282df36..0000000000000
--- a/src/thread/ngage/SDL_systhread_c.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2024 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;
diff --git a/src/timer/ngage/SDL_systimer.cpp b/src/timer/ngage/SDL_systimer.cpp
deleted file mode 100644
index bfcacc630d9b7..0000000000000
--- a/src/timer/ngage/SDL_systimer.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2024 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_TIMER_NGAGE
-
-#include <e32std.h>
-#include <e32hal.h>
-
-static TUint start_tick = 0;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-Uint64 SDL_GetPerformanceCounter(void)
-{
- // FIXME: Need to account for 32-bit wrapping
- return (Uint64)User::TickCount();
-}
-
-Uint64 SDL_GetPerformanceFrequency(void)
-{
- return SDL_US_PER_SECOND;
-}
-
-void SDL_SYS_DelayNS(Uint64 ns)
-{
- const Uint64 max_delay = 0x7fffffffLL * SDL_NS_PER_US;
- if (ns > max_delay) {
- ns = max_delay;
- }
- User::After(TTimeIntervalMicroSeconds32((TInt)SDL_NS_TO_US(ns)));
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // SDL_TIMER_NGAGE
diff --git a/src/video/SDL_sysvideo.h b/src/video/SDL_sysvideo.h
index 8649c7b500408..cd63a18d2e90d 100644
--- a/src/video/SDL_sysvideo.h
+++ b/src/video/SDL_sysvideo.h
@@ -521,7 +521,6 @@ extern VideoBootStrap Wayland_bootstrap;
extern VideoBootStrap VIVANTE_bootstrap;
extern VideoBootStrap Emscripten_bootstrap;
extern VideoBootStrap OFFSCREEN_bootstrap;
-extern VideoBootStrap NGAGE_bootstrap;
extern VideoBootStrap QNX_bootstrap;
extern VideoBootStrap OPENVR_bootstrap;
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 6f47520edab2d..b62d5c53a091b 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -128,9 +128,6 @@ static VideoBootStrap *bootstrap[] = {
#ifdef SDL_VIDEO_DRIVER_QNX
&QNX_bootstrap,
#endif
-#ifdef SDL_VIDEO_DRIVER_NGAGE
- &NGAGE_bootstrap,
-#endif
#ifdef SDL_VIDEO_DRIVER_OFFSCREEN
&OFFSCREEN_bootstrap,
#endif
diff --git a/src/video/ngage/SDL_ngageevents.cpp b/src/video/ngage/SDL_ngageevents.cpp
deleted file mode 100644
index bfe3b7fc85fca..0000000000000
--- a/src/video/ngage/SDL_ngageevents.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2024 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_VIDEO_DRIVER_NGAGE
-
-/* Being a ngage driver, there's no event stream. We just define stubs for
- most of the API. */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "../../events/SDL_events_c.h"
-#include "../../events/SDL_keyboard_c.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#include "SDL_ngagevideo.
(Patch may be truncated, please check the link at the top of this post.)