Skip to content

Commit bbcc942

Browse files
ccawley2011slouken
authored andcommitted
3DS: Support simple message boxes
(cherry picked from commit 23d456e)
1 parent b58a1c7 commit bbcc942

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
@@ -57,6 +57,10 @@
5757
#include <emscripten.h>
5858
#endif
5959

60+
#ifdef __3DS__
61+
#include <3ds.h>
62+
#endif
63+
6064
#ifdef __LINUX__
6165
#include <sys/types.h>
6266
#include <sys/stat.h>
@@ -4542,6 +4546,23 @@ int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *messag
45424546
},
45434547
title, message);
45444548
return 0;
4549+
#elif defined(__3DS__)
4550+
errorConf errCnf;
4551+
bool hasGpuRight;
4552+
4553+
/* If the video subsystem has not been initialised, set up graphics temporarily */
4554+
hasGpuRight = gspHasGpuRight();
4555+
if (!hasGpuRight)
4556+
gfxInitDefault();
4557+
4558+
errorInit(&errCnf, ERROR_TEXT_WORD_WRAP, CFG_LANGUAGE_EN);
4559+
errorText(&errCnf, message);
4560+
errorDisp(&errCnf);
4561+
4562+
if (!hasGpuRight)
4563+
gfxExit();
4564+
4565+
return 0;
45454566
#else
45464567
SDL_MessageBoxData data;
45474568
SDL_MessageBoxButtonData button;

0 commit comments

Comments
 (0)