diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c index f183273..3def0d6 100644 --- a/src/sdl-instead/game.c +++ b/src/sdl-instead/game.c @@ -740,21 +740,13 @@ int game_init(const char *name) if (name) game_err_msg(NULL); -#ifndef ANDROID - if (gfx_video_init() || input_init()) - return -1; -#endif + snd_init(opt_hz); game_change_vol(0, opt_vol); if (game_select(name)) return -1; - if (gfx_set_mode(game_theme.w, game_theme.h, opt_fs)) { - opt_mode[0] = opt_mode[1] = -1; opt_fs = 0; /* safe options */ - return -1; - } - if (game_theme_optimize()) return -1; @@ -846,9 +838,9 @@ void game_done(int err) input_clear(); snd_done(); instead_done(); -#ifndef ANDROID - gfx_video_done(); -#endif +//#ifndef ANDROID +// gfx_video_done(); +//#endif curgame_dir = NULL; game_own_theme = 0; // SDL_Quit(); diff --git a/src/sdl-instead/main.c b/src/sdl-instead/main.c index d6f5749..9675c9a 100644 --- a/src/sdl-instead/main.c +++ b/src/sdl-instead/main.c @@ -288,10 +288,10 @@ int main(int argc, char *argv[]) // Initialize SDL if (gfx_init() < 0) return -1; -#ifdef ANDROID + if (gfx_video_init() || input_init()) - return -1; -#endif + return -1; + if (game_init(opt_game)) { game_error(opt_game); } @@ -300,11 +300,12 @@ int main(int argc, char *argv[]) cfg_save(); game_done(0); + gfx_video_done(); + #ifndef ANDROID gfx_done(); -#else - gfx_video_done(); #endif + out: if (debug_sw) debug_done(); diff --git a/src/sdl-instead/themes.c b/src/sdl-instead/themes.c index ce2e06c..83ec3be 100644 --- a/src/sdl-instead/themes.c +++ b/src/sdl-instead/themes.c @@ -704,6 +704,12 @@ int game_theme_init(void) } game_theme_scale(w, h); + + if (gfx_set_mode(game_theme.w, game_theme.h, opt_fs)) { + opt_mode[0] = opt_mode[1] = -1; opt_fs = 0; /* safe options */ + return -1; + } + if (game_theme_update_data()) { fprintf(stderr, "Can not init theme!\n"); game_theme_free();