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

@@ -17,44 +17,9 @@
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.
Nothing to do here, the code moved into SDL_main_impl.h
TODO: remove this file
*/
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h> /* until this SDL_main impl is converted to header-only.. */
#ifdef __3DS__
#include <3ds.h>
#ifdef main
#undef main
#endif
SDL_FORCE_INLINE void N3DS_Init(void);
SDL_FORCE_INLINE void N3DS_Quit(void);
int main(int argc, char *argv[])
{
int result;
N3DS_Init();
SDL_SetMainReady();
result = SDL_main(argc, argv);
N3DS_Quit();
return result;
}
SDL_FORCE_INLINE void
N3DS_Init(void)
{
osSetSpeedupEnable(true);
romfsInit();
}
SDL_FORCE_INLINE void
N3DS_Quit(void)
{
romfsExit();
}
#endif /* __3DS__ */
/* vi: set sts=4 ts=4 sw=4 expandtab: */