PortNintendo 3DS SDL_main to header-only + SDL_N3DSRunApp()

and move the #undef main and #define main SDL_main to the start/end of
SDL_main_impl.h instead of repeating it in every platform implementation

Thanks to SDL_N3DSRunApp we don't need the #include <3ds.h> in
SDL_main_impl.h - that caused conflicts with testthread.c, because both
have (different) ThreadFunc typedefs.
This commit is contained in:
Daniel Gibson
2022-12-12 04:38:06 +01:00
committed by Sam Lantinga
parent 2aee3e654d
commit 1de559248e
7 changed files with 106 additions and 53 deletions

View File

@@ -278,6 +278,22 @@ extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#endif /* __GDK__ */
#ifdef __3DS__
/**
* Initializes and launches an SDL application.
*
* \param argc The argc parameter from the application's main() function
* \param argv The argv parameter from the application's main() function
* \param mainFunction The SDL app's C-style main(), an SDL_main_func
* \return the return value from mainFunction
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC int SDLCALL SDL_N3DSRunApp(int argc, char *argv[], SDL_main_func mainFunction);
#endif /* __3DS__ */
#ifdef __cplusplus
}
#endif
@@ -286,7 +302,8 @@ extern DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void);
#if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL)
/* include header-only SDL_main implementations */
#if defined(__WIN32__) || defined(__GDK__) || defined(__IOS__) || defined(__TVOS__) /* TODO: other platforms */
#if defined(__WIN32__) || defined(__GDK__) || defined(__IOS__) || defined(__TVOS__) \
|| defined(__3DS__) /* TODO: other platforms */
#include <SDL3/SDL_main_impl.h>
#elif defined(__WINRT__) /* TODO: other C++ platforms */