Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3DS: Support simple message boxes (SDL2) #11182

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading