Skip to content

Commit 23d456e

Browse files
ccawley2011slouken
authored andcommitted
3DS: Support simple message boxes
1 parent d7bb56f commit 23d456e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/SDL_assert.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data,
292292
break;
293293
}
294294
}
295-
#elif defined(HAVE_STDIO_H)
295+
#elif defined(HAVE_STDIO_H) && !defined(__3DS__)
296296
/* this is a little hacky. */
297297
for (;;) {
298298
char buf[32];
@@ -319,6 +319,8 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data,
319319
break;
320320
}
321321
}
322+
#else
323+
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Assertion Failed", message, window);
322324
#endif /* HAVE_STDIO_H */
323325
}
324326

src/video/SDL_video.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
#include <emscripten.h>
6060
#endif
6161

62+
#ifdef __3DS__
63+
#include <3ds.h>
64+
#endif
65+
6266
#ifdef __LINUX__
6367
#include <sys/types.h>
6468
#include <sys/stat.h>
@@ -4556,6 +4560,23 @@ int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *messag
45564560
},
45574561
title, message);
45584562
return 0;
4563+
#elif defined(__3DS__)
4564+
errorConf errCnf;
4565+
bool hasGpuRight;
4566+
4567+
/* If the video subsystem has not been initialised, set up graphics temporarily */
4568+
hasGpuRight = gspHasGpuRight();
4569+
if (!hasGpuRight)
4570+
gfxInitDefault();
4571+
4572+
errorInit(&errCnf, ERROR_TEXT_WORD_WRAP, CFG_LANGUAGE_EN);
4573+
errorText(&errCnf, message);
4574+
errorDisp(&errCnf);
4575+
4576+
if (!hasGpuRight)
4577+
gfxExit();
4578+
4579+
return 0;
45594580
#else
45604581
SDL_MessageBoxData data;
45614582
SDL_MessageBoxButtonData button;

0 commit comments

Comments
 (0)