From 23d456e146881d62312750ad262ad977ab119480 Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Sat, 12 Oct 2024 21:54:16 +0100 Subject: [PATCH] 3DS: Support simple message boxes --- src/SDL_assert.c | 4 +++- src/video/SDL_video.c | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/SDL_assert.c b/src/SDL_assert.c index 1ca41e76f38f8..b067bd80a223a 100644 --- a/src/SDL_assert.c +++ b/src/SDL_assert.c @@ -292,7 +292,7 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, break; } } -#elif defined(HAVE_STDIO_H) +#elif defined(HAVE_STDIO_H) && !defined(__3DS__) /* this is a little hacky. */ for (;;) { char buf[32]; @@ -319,6 +319,8 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, break; } } +#else + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Assertion Failed", message, window); #endif /* HAVE_STDIO_H */ } diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index a43b82833b747..91db5ebb78814 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -59,6 +59,10 @@ #include #endif +#ifdef __3DS__ +#include <3ds.h> +#endif + #ifdef __LINUX__ #include #include @@ -4556,6 +4560,23 @@ int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *messag }, title, message); return 0; +#elif defined(__3DS__) + errorConf errCnf; + bool hasGpuRight; + + /* If the video subsystem has not been initialised, set up graphics temporarily */ + hasGpuRight = gspHasGpuRight(); + if (!hasGpuRight) + gfxInitDefault(); + + errorInit(&errCnf, ERROR_TEXT_WORD_WRAP, CFG_LANGUAGE_EN); + errorText(&errCnf, message); + errorDisp(&errCnf); + + if (!hasGpuRight) + gfxExit(); + + return 0; #else SDL_MessageBoxData data; SDL_MessageBoxButtonData button;