Skip to content

Commit

Permalink
3DS: Support simple message boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
ccawley2011 authored and slouken committed Oct 12, 2024
1 parent d7bb56f commit 23d456e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/SDL_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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 */
}

Expand Down
21 changes: 21 additions & 0 deletions src/video/SDL_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
#include <emscripten.h>
#endif

#ifdef __3DS__
#include <3ds.h>
#endif

#ifdef __LINUX__
#include <sys/types.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 23d456e

Please sign in to comment.