diff options
Diffstat (limited to 'contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmessagebox.c')
| -rw-r--r-- | contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmessagebox.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmessagebox.c b/contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmessagebox.c new file mode 100644 index 0000000..a4b358c --- /dev/null +++ b/contrib/SDL-3.2.8/src/video/riscos/SDL_riscosmessagebox.c | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | /* | ||
| 2 | Simple DirectMedia Layer | ||
| 3 | Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> | ||
| 4 | |||
| 5 | This software is provided 'as-is', without any express or implied | ||
| 6 | warranty. In no event will the authors be held liable for any damages | ||
| 7 | arising from the use of this software. | ||
| 8 | |||
| 9 | Permission is granted to anyone to use this software for any purpose, | ||
| 10 | including commercial applications, and to alter it and redistribute it | ||
| 11 | freely, subject to the following restrictions: | ||
| 12 | |||
| 13 | 1. The origin of this software must not be misrepresented; you must not | ||
| 14 | claim that you wrote the original software. If you use this software | ||
| 15 | in a product, an acknowledgment in the product documentation would be | ||
| 16 | appreciated but is not required. | ||
| 17 | 2. Altered source versions must be plainly marked as such, and must not be | ||
| 18 | misrepresented as being the original software. | ||
| 19 | 3. This notice may not be removed or altered from any source distribution. | ||
| 20 | */ | ||
| 21 | #include "SDL_internal.h" | ||
| 22 | |||
| 23 | #ifdef SDL_VIDEO_DRIVER_RISCOS | ||
| 24 | |||
| 25 | #include "SDL_riscosmessagebox.h" | ||
| 26 | |||
| 27 | #include <kernel.h> | ||
| 28 | #include <swis.h> | ||
| 29 | |||
| 30 | bool RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID) | ||
| 31 | { | ||
| 32 | _kernel_swi_regs regs; | ||
| 33 | _kernel_oserror error; | ||
| 34 | char buttonstring[1024]; | ||
| 35 | int i; | ||
| 36 | |||
| 37 | error.errnum = 0; | ||
| 38 | SDL_strlcpy(error.errmess, messageboxdata->message, 252); | ||
| 39 | regs.r[0] = (unsigned int)&error; | ||
| 40 | |||
| 41 | regs.r[1] = (1 << 8) | (1 << 4); | ||
| 42 | if (messageboxdata->flags & SDL_MESSAGEBOX_INFORMATION) { | ||
| 43 | regs.r[1] |= (1 << 9); | ||
| 44 | } else if (messageboxdata->flags & SDL_MESSAGEBOX_WARNING) { | ||
| 45 | regs.r[1] |= (2 << 9); | ||
| 46 | } | ||
| 47 | |||
| 48 | regs.r[2] = (unsigned int)messageboxdata->title; | ||
| 49 | regs.r[3] = 0; | ||
| 50 | regs.r[4] = 0; | ||
| 51 | |||
| 52 | SDL_strlcpy(buttonstring, "", 1024); | ||
| 53 | for (i = 0; i < messageboxdata->numbuttons; i++) { | ||
| 54 | SDL_strlcat(buttonstring, messageboxdata->buttons[i].text, 1024); | ||
| 55 | if (i + 1 < messageboxdata->numbuttons) { | ||
| 56 | SDL_strlcat(buttonstring, ",", 1024); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | regs.r[5] = (unsigned int)buttonstring; | ||
| 60 | |||
| 61 | _kernel_swi(Wimp_ReportError, ®s, ®s); | ||
| 62 | |||
| 63 | *buttonID = (regs.r[1] == 0) ? -1 : messageboxdata->buttons[regs.r[1] - 3].buttonID; | ||
| 64 | return true; | ||
| 65 | } | ||
| 66 | |||
| 67 | #endif // SDL_VIDEO_DRIVER_RISCOS | ||
