mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Show message box on fatal error
Now sys_error() shows error message using a SDL message box, so that user can see the message on Windows / Android.
This commit is contained in:
+1
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -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);
|
||||
|
||||
+2
-2
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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) {
|
||||
|
||||
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
+10
-10
@@ -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();
|
||||
|
||||
+5
-6
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user