Android: Report ERROR() with a message box

This commit is contained in:
kichikuou
2024-03-16 12:45:07 +09:00
parent 3e9f975213
commit bc522b27e0
2 changed files with 16 additions and 0 deletions
+5
View File
@@ -129,8 +129,13 @@ void vm_stack_trace(void);
_Noreturn void _vm_error(const char *fmt, ...);
_Noreturn void vm_exit(int code);
#ifdef __ANDROID__
// Report the error with a message box and exit.
#define VM_ERROR ERROR
#else
#define VM_ERROR(fmt, ...) \
_vm_error("*ERROR*(%s:%s:%d): " fmt "\n", __FILE__, __func__, __LINE__, ##__VA_ARGS__)
#endif
#ifdef VM_PRIVATE
#include "little_endian.h"
+11
View File
@@ -401,11 +401,22 @@ static void windows_error_handler(const char *msg)
}
#endif
#ifdef __ANDROID__
static void android_error_handler(const char *msg)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "xsystem4", msg, NULL);
}
#endif
int main(int argc, char *argv[])
{
#ifdef _WIN32
sys_error_handler = windows_error_handler;
#endif
#ifdef __ANDROID__
sys_error_handler = android_error_handler;
#endif
initialize_instructions();
char *ainfile;
int err = AIN_SUCCESS;