From 6fb2f9b1610191f3347980efe12b0ab91e3d8267 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Fri, 13 Apr 2012 23:16:51 +0200 Subject: [PATCH] Move to HAVE_SSNES_MAIN_WRAP for Wii --- Makefile.wii | 2 +- console/console_ext.c | 1 + wii/main.c | 17 +++++++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile.wii b/Makefile.wii index f341de7f3d..7735a8c0b5 100644 --- a/Makefile.wii +++ b/Makefile.wii @@ -37,7 +37,7 @@ ifeq ($(HAVE_FILE_LOGGER), 1) CFLAGS += -DHAVE_FILE_LOGGER endif -CFLAGS += -std=gnu99 -DSSNES_CONSOLE -DHAVE_CONFIGFILE=1 -DGEKKO -DHW_RVL -DHAVE_ZLIB -DHAVE_GETOPT_LONG -DHAVE_FREETYPE -DPACKAGE_VERSION=\"0.9.5\" -Dmain=ssnes_main -Wno-char-subscripts -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) +CFLAGS += -std=gnu99 -DSSNES_CONSOLE -DHAVE_CONFIGFILE=1 -DGEKKO -DHW_RVL -DHAVE_ZLIB -DHAVE_SSNES_MAIN_WRAP -DHAVE_GETOPT_LONG -DHAVE_FREETYPE -DPACKAGE_VERSION=\"0.9.5\" -Dmain=ssnes_main -Wno-char-subscripts -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT) ifeq ($(DEBUG), 1) CFLAGS += -O0 -g diff --git a/console/console_ext.c b/console/console_ext.c index 122b0e7ce4..ca35905f3f 100644 --- a/console/console_ext.c +++ b/console/console_ext.c @@ -609,6 +609,7 @@ void ssnes_startup (const char * config_path) #endif int init_ret = ssnes_main_init_wrap(&args); + (void)init_ret; g_console.emulator_initialized = 1; g_console.initialize_ssnes_enable = 0; } diff --git a/wii/main.c b/wii/main.c index ce149f2b46..9daffb4500 100644 --- a/wii/main.c +++ b/wii/main.c @@ -145,12 +145,21 @@ int main(void) int ret = 0; while ((rom_path = get_rom_path(sgui)) && ret == 0) { - char *argv[] = { strdup("ssnes"), strdup(rom_path), NULL }; - ret = ssnes_main(sizeof(argv) / sizeof(argv[0]) - 1, argv); - free(argv[0]); - free(argv[1]); + g_console.initialize_ssnes_enable = true; + strlcpy(g_console.rom_path, rom_path, sizeof(g_console.rom_path)); + ssnes_startup(NULL); + bool repeat = false; + + input_wii.poll(NULL); + + do{ + repeat = ssnes_main_iterate(); + }while(repeat && !g_console.frame_advance_enable); } + if(g_console.emulator_initialized) + ssnes_main_deinit(); + wii_input_deinit(); wii_video_deinit();