diff --git a/modules/Gpx/Gpx.c b/modules/Gpx/Gpx.c index 3506518..f2dfd62 100644 --- a/modules/Gpx/Gpx.c +++ b/modules/Gpx/Gpx.c @@ -65,7 +65,7 @@ static int find_null_surface() { if (suf[i] == NULL) return i; } - SYSERROR("no free surface\n"); + SYSERROR("no free surface"); return 0; } diff --git a/src/cali.c b/src/cali.c index 500e999..6312ecb 100644 --- a/src/cali.c +++ b/src/cali.c @@ -68,7 +68,7 @@ static int *getVar(int c0) { } else if (c1 >= 0x40) { return v_ref(c1); // 0x40 - 0xff } - SYSERROR("Invalid variable reference at %d:0x%x\n", sl_getPage(), sl_getIndex() - 2); + SYSERROR("Invalid variable reference at %d:0x%x", sl_getPage(), sl_getIndex() - 2); return NULL; } @@ -76,7 +76,7 @@ static int *getVar(int c0) { int *getCaliVariable() { int *c0 = getVar(sl_getc()); if (sl_getc() != 0x7f) { - SYSERROR("Something is Wrong @ %03d:%05x\n", sl_getPage(), sl_getIndex()); + SYSERROR("Something is Wrong @ %03d:%05x", sl_getPage(), sl_getIndex()); } return c0; } @@ -125,7 +125,7 @@ int getCaliValue() { cali++; continue; } else if (c1 < 0x34) { - SYSERROR("Unknow Parameter @ %03d:%05x\n", sl_getPage(), sl_getIndex()); + SYSERROR("Unknow Parameter @ %03d:%05x", sl_getPage(), sl_getIndex()); } } l_var: @@ -216,7 +216,7 @@ int getCaliValue() { c1 = sl_getc(); if (c0 == 0) { /* 34h-ffh */ if (c1 <= 0x33) { - SYSERROR("Unknown Parameter @ %03d:%05x\n", sl_getPage(), sl_getIndex()); + SYSERROR("Unknown Parameter @ %03d:%05x", sl_getPage(), sl_getIndex()); } } else { /* 100h- 3fff */ c1 += ((c0 & 0x3f) * 256); diff --git a/src/cmd2F.c b/src/cmd2F.c index 1321937..8736a1c 100644 --- a/src/cmd2F.c +++ b/src/cmd2F.c @@ -1329,9 +1329,9 @@ void commands2F7B() { void commands2F7C() { if (!nact->files.ain) { if (nact->files.gr_fname) { - SYSERROR("System39.ain is needed to run this game. Make sure you have an \"Ain\" line in %s.\n", nact->files.gr_fname); + sys_error("System39.ain is needed to run this game. Make sure you have an \"Ain\" line in %s.", nact->files.gr_fname); } else { - SYSERROR("Ain file is needed to run this game. Make sure you have System39.ain file in the game directory.\n"); + sys_error("Ain file is needed to run this game. Make sure you have System39.ain file in the game directory."); } } diff --git a/src/cmd2F60.c b/src/cmd2F60.c index be366bb..85a7552 100644 --- a/src/cmd2F60.c +++ b/src/cmd2F60.c @@ -43,7 +43,7 @@ void commands2F60() { int fnum = sl_getdw(); /* function number */ if (dll == NULL) { - SYSERROR("No DLL initilized\n"); + SYSERROR("No DLL initilized"); } if (dll + type == NULL) goto eexit; @@ -56,5 +56,5 @@ void commands2F60() { return; eexit: - SYSERROR("Can't continue further scenario.(%d,%d)(%s,%s)\n", type, fnum, dll[type].name, dll[type].function[fnum].name); + SYSERROR("Can't continue further scenario.(%d,%d)(%s,%s)", type, fnum, dll[type].name, dll[type].function[fnum].name); } diff --git a/src/cmd_check.c b/src/cmd_check.c index 8dbb583..8a71749 100644 --- a/src/cmd_check.c +++ b/src/cmd_check.c @@ -145,7 +145,7 @@ static void loopStart() { } static void undeferr() { - SYSERROR("Undefined Command:@ %03d,%05x\n", sl_getPage(), sl_getIndex()); + SYSERROR("Undefined Command:@ %03d,%05x", sl_getPage(), sl_getIndex()); } static void message(int c0) { diff --git a/src/cmds.c b/src/cmds.c index 6007ad3..ac4637b 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -218,7 +218,7 @@ void commandSG() { break; } default: - SYSERROR("Unknown SG command %d\n", sw); + SYSERROR("Unknown SG command %d", sw); break; } } @@ -377,6 +377,6 @@ void commandSX() { break; } default: - SYSERROR("Unknown SX command\n"); + SYSERROR("Unknown SX command"); } } diff --git a/src/dri.c b/src/dri.c index 3818ea2..7c12421 100644 --- a/src/dri.c +++ b/src/dri.c @@ -174,11 +174,11 @@ drifiles *dri_init(const char **file, int cnt, boolean use_mmap) { if (file[i] == NULL) continue; /* open check */ if (NULL == (fp = fopen(file[i], "rb"))) { - SYSERROR("File %s is not found\n", file[i]); + SYSERROR("File %s is not found", file[i]); } /* check is drifile or noe */ if (!filecheck(fp)) { - SYSERROR("File %s is not dri file\n", file[i]); + SYSERROR("File %s is not dri file", file[i]); } /* get file map */ if (!gotmap) { diff --git a/src/font.c b/src/font.c index db9cc4f..6241f45 100644 --- a/src/font.c +++ b/src/font.c @@ -91,7 +91,7 @@ void font_select(int type, int size) { } #endif if (!fs) - SYSERROR("Cannot open font %s\n", this.name[type]); + SYSERROR("Cannot open font %s", this.name[type]); font_insert(size, type, fs); fontset = &fonttbl[fontcnt - 1]; @@ -202,7 +202,7 @@ void font_init(void) { this.antialiase_on = FALSE; if (TTF_Init() == -1) - SYSERROR("Failed to intialize SDL_ttf: %s\n", TTF_GetError()); + SYSERROR("Failed to intialize SDL_ttf: %s", TTF_GetError()); } void font_set_name_and_index(int type, const char *name, int index) { diff --git a/src/gameresource.c b/src/gameresource.c index da9e92f..b267f63 100644 --- a/src/gameresource.c +++ b/src/gameresource.c @@ -197,7 +197,7 @@ static boolean initGameResourceFromFile(GameResource *gr, FILE *fp, const char * return TRUE; errexit: - SYSERROR("Illigal resource at line(%d) file<%s>\n", linecnt, gr_fname); + SYSERROR("Illigal resource at line(%d) file<%s>", linecnt, gr_fname); return FALSE; } @@ -214,6 +214,6 @@ boolean initGameResource(GameResource *gr, const char *gr_fname) { closedir(dir); return result; } - SYSERROR("Game Resource File open failed\n"); + SYSERROR("Game Resource File open failed"); return FALSE; } diff --git a/src/scenario.c b/src/scenario.c index fa87bf6..805bcac 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -114,7 +114,7 @@ static int* sl_pop(void) { *tmp++ = *--stack_top; } if (stack_top < stack_buf) { - SYSERROR("Stack buffer is illegal\n"); + SYSERROR("Stack buffer is illegal"); } return _tmp; @@ -235,11 +235,11 @@ void sl_retNear(void) { while (*tmp != STACK_NEARJMP) { if (*tmp == STACK_FARJMP) { - SYSERROR("Stack buffer is illegal\n"); + SYSERROR("Stack buffer is illegal"); } else if (*tmp == STACK_VARIABLE) { popVars(tmp); } else { - SYSERROR("Stack buffer is illegal\n"); + SYSERROR("Stack buffer is illegal"); } free(tmp); tmp = sl_pop(); @@ -294,7 +294,7 @@ void sl_retFar(void) { } else if (*tmp == STACK_VARIABLE) { popVars(tmp); } else { - SYSERROR("Stack buffer is illegal\n"); + SYSERROR("Stack buffer is illegal"); } free(tmp); tmp = sl_pop(); @@ -321,7 +321,7 @@ void sl_retFar2(void) { } else if (*tmp == STACK_VARIABLE) { popVars(tmp); } else { - SYSERROR("Stack buffer is illegal\n"); + SYSERROR("Stack buffer is illegal"); } free(tmp); tmp = sl_pop(); @@ -358,7 +358,7 @@ void sl_stackClear_pageCall(int cnt) { } else if (*tmp == STACK_VARIABLE) { popVars(tmp); } else { - SYSERROR("Stack buffer is illegal\n"); + SYSERROR("Stack buffer is illegal"); } free(tmp); } @@ -379,7 +379,7 @@ void sl_stackClear_labelCall(int cnt) { } else if (*tmp == STACK_VARIABLE) { popVars(tmp); } else { - SYSERROR("Stack buffer is illegal\n"); + SYSERROR("Stack buffer is illegal"); } free(tmp); if (labelCallCnt_afterPageCall == 0) break; @@ -408,7 +408,7 @@ void sl_popVar(int *topvar, int cnt) { int *tmp = sl_pop(); if (*tmp != STACK_VARIABLE) { - SYSERROR("Stack buffer is illegal\n"); + SYSERROR("Stack buffer is illegal"); } if (*(tmp + 2) != preVarPage){ WARNING("Variable is not match with stacked variable\n"); @@ -476,7 +476,7 @@ void sl_popData(int *data, int cnt) { dataPushCnt--; if (*tmp != STACK_DATA) - SYSERROR("Stack buffer is illegal\n"); + SYSERROR("Stack buffer is illegal"); if (*(tmp + 1) != cnt) WARNING("Variable count is not match with stacked variable\n"); @@ -534,7 +534,7 @@ void sl_returnGoto(int address) { popVars(tmp); } else { fprintf(stderr, "%d \n", *tmp); - SYSERROR("Stack buffer is illegal\n"); + SYSERROR("Stack buffer is illegal"); } free(tmp); tmp = sl_pop(); diff --git a/src/xsystem35.c b/src/xsystem35.c index 535a5ee..bb7f211 100644 --- a/src/xsystem35.c +++ b/src/xsystem35.c @@ -191,15 +191,14 @@ void sys_message(int lv, char *format, ...) { } void sys_error(char *format, ...) { + char buf[512]; va_list args; va_start(args, format); -#ifdef __ANDROID__ - __android_log_vprint(ANDROID_LOG_FATAL, "xsystem35", format, args); -#else - vfprintf(stderr, format, args); -#endif + vsnprintf(buf, sizeof buf, format, args); va_end(args); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "xsystem35", buf, NULL); + sys35_remove(); exit(1); } @@ -459,7 +458,7 @@ static void init_signalhandler() { static void registerGameFiles(void) { if (nact->files.cnt[DRIFILE_SCO] == 0) - SYSERROR("No Scenario data available\n"); + SYSERROR("No Scenario data available"); for (int type = 0; type < DRIFILETYPEMAX; type++) { boolean use_mmap = true; if (debugger_mode != DEBUGGER_DISABLED && type == DRIFILE_SCO) {