From c1652c34b0acd551850936b82ff42f3ab2db5367 Mon Sep 17 00:00:00 2001 From: jn Date: Thu, 26 Jan 2023 22:21:35 +0100 Subject: [PATCH] Initialize VM state and scan arguments before initializing SDL --- src/main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index 68878e2..ad74fe9 100644 --- a/src/main.c +++ b/src/main.c @@ -40,13 +40,6 @@ void main_loop(void); void load_rom(const char *filename); int main(int argc, char *argv[]) { - if (SDL_Init(SDL_INIT_VIDEO) != 0) { - fprintf(stderr, "unable to initialize SDL: %s", SDL_GetError()); - return 1; - } - - SDL_ShowCursor(SDL_DISABLE); - fox32_init(&vm); vm.io_read = bus_io_read; vm.io_write = bus_io_write; @@ -90,6 +83,12 @@ int main(int argc, char *argv[]) { return 1; } } + if (SDL_Init(SDL_INIT_VIDEO) != 0) { + fprintf(stderr, "unable to initialize SDL: %s", SDL_GetError()); + return 1; + } + + SDL_ShowCursor(SDL_DISABLE); ScreenCreate( FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,