added is_open flag to game for more graceful fails
This commit is contained in:
parent
2c5fe3fb1e
commit
127c31bcf4
1 changed files with 10 additions and 4 deletions
|
|
@ -138,6 +138,7 @@ static struct Game {
|
||||||
char m3u_path[MAX_PATH];
|
char m3u_path[MAX_PATH];
|
||||||
void* data;
|
void* data;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
int is_open;
|
||||||
} game;
|
} game;
|
||||||
static void Game_open(char* path) {
|
static void Game_open(char* path) {
|
||||||
memset(&game, 0, sizeof(game));
|
memset(&game, 0, sizeof(game));
|
||||||
|
|
@ -197,12 +198,12 @@ static void Game_open(char* path) {
|
||||||
strcpy(game.m3u_path, m3u_path);
|
strcpy(game.m3u_path, m3u_path);
|
||||||
strcpy((char*)game.name, strrchr(m3u_path, '/')+1);
|
strcpy((char*)game.name, strrchr(m3u_path, '/')+1);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
game.m3u_path[0] = '\0';
|
game.is_open = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
static void Game_close(void) {
|
static void Game_close(void) {
|
||||||
if (game.data) free(game.data);
|
if (game.data) free(game.data);
|
||||||
|
game.is_open = 0;
|
||||||
VIB_setStrength(0); // just in case
|
VIB_setStrength(0); // just in case
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4027,6 +4028,9 @@ int main(int argc , char* argv[]) {
|
||||||
|
|
||||||
Core_open(core_path, tag_name);
|
Core_open(core_path, tag_name);
|
||||||
Game_open(rom_path);
|
Game_open(rom_path);
|
||||||
|
if (!game.is_open) goto finish;
|
||||||
|
|
||||||
|
LOG_info("no way\n");
|
||||||
|
|
||||||
// restore configs
|
// restore configs
|
||||||
Config_read();
|
Config_read();
|
||||||
|
|
@ -4065,6 +4069,8 @@ int main(int argc , char* argv[]) {
|
||||||
|
|
||||||
Menu_quit();
|
Menu_quit();
|
||||||
|
|
||||||
|
finish:
|
||||||
|
|
||||||
Game_close();
|
Game_close();
|
||||||
Core_unload();
|
Core_unload();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue