Show error instead of SEGV when System39.ini is missing

See #18.
This commit is contained in:
kichikuou
2021-03-08 09:38:46 +09:00
parent 785f46be2a
commit a159e7cb24
3 changed files with 15 additions and 2 deletions
+13 -2
View File
@@ -1326,8 +1326,19 @@ 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);
} else {
SYSERROR("Ain file is needed to run this game. Make sure you have System39.ain file in the game directory.\n");
}
}
int index = sys_getdw();
if (index >= nact->ain.msgnum) {
WARNING("message id out of bounds (%d)\n", index);
return;
}
sys_addMsg(nact->ain.msg[index]);
msgskip_onAinMessage(index);
@@ -1359,7 +1370,7 @@ void commands2F7F() {
sys_addMsg(svar_get(p1));
msgskip_onAinMessage(index);
DEBUG_COMMAND("2F7F %d, %d(%s,%s):\n", index, p1, nact->ain.msg[index], svar_get(p1));
DEBUG_COMMAND("2F7F %d, %d(%s):\n", index, p1, svar_get(p1));
}
void commands2F80() {
+1
View File
@@ -193,6 +193,7 @@ static boolean initGameResourceFromFile(GameResource *gr, FILE *fp, const char *
goto errexit;
}
}
gr->gr_fname = strdup(gr_fname);
return TRUE;
errexit:
+1
View File
@@ -29,6 +29,7 @@
#include "savedata.h"
typedef struct {
const char *gr_fname;
const char *game_fname[DRIFILETYPEMAX][DRIFILEMAX];
int cnt[DRIFILETYPEMAX];
const char *save_path;