diff --git a/console/rarch_console_main_wrap.c b/console/rarch_console_main_wrap.c
index 04b54be1ce..e69de29bb2 100644
--- a/console/rarch_console_main_wrap.c
+++ b/console/rarch_console_main_wrap.c
@@ -1,49 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2010-2013 - Hans-Kristian Arntzen
- * Copyright (C) 2011-2013 - Daniel De Matteis
- *
- * RetroArch is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with RetroArch.
- * If not, see .
- */
-
-#include
-#include
-
-#include "rarch_console_main_wrap.h"
-
-bool rarch_startup (const char * config_file)
-{
- const char *config_path = g_extern.config_path;
-
- if(g_extern.main_is_init)
- rarch_main_deinit();
-
- struct rarch_main_wrap args = {0};
-
- args.verbose = g_extern.verbose;
- args.config_path = config_file;
- args.sram_path = g_extern.console.main_wrap.state.default_sram_dir.enable ? g_extern.console.main_wrap.paths.default_sram_dir : NULL,
- args.state_path = g_extern.console.main_wrap.state.default_savestate_dir.enable ? g_extern.console.main_wrap.paths.default_savestate_dir : NULL,
- args.rom_path = g_extern.file_state.rom_path;
- args.libretro_path = g_settings.libretro;
-
- int init_ret = rarch_main_init_wrap(&args);
-
- if (init_ret == 0)
- RARCH_LOG("rarch_main_init succeeded.\n");
- else
- {
- RARCH_ERR("rarch_main_init failed.\n");
- return false;
- }
-
- return true;
-}
diff --git a/console/rarch_console_main_wrap.h b/console/rarch_console_main_wrap.h
deleted file mode 100644
index de8d3f28f2..0000000000
--- a/console/rarch_console_main_wrap.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* RetroArch - A frontend for libretro.
- * Copyright (C) 2010-2013 - Hans-Kristian Arntzen
- * Copyright (C) 2011-2013 - Daniel De Matteis
- *
- * RetroArch is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Found-
- * ation, either version 3 of the License, or (at your option) any later version.
- *
- * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with RetroArch.
- * If not, see .
- */
-
-#ifndef RARCH_CONSOLE_MAIN_WRAP_H__
-#define RARCH_CONSOLE_MAIN_WRAP_H__
-
-struct rarch_main_wrap
-{
- const char *rom_path;
- const char *sram_path;
- const char *state_path;
- const char *config_path;
- const char *libretro_path;
- bool verbose;
-};
-
-bool rarch_startup (void);
-
-#endif
diff --git a/gx/frontend/main.c b/gx/frontend/main.c
index bd3dd9a459..2a0becff94 100644
--- a/gx/frontend/main.c
+++ b/gx/frontend/main.c
@@ -27,7 +27,6 @@
#include "../../console/rarch_console_exec.h"
#include "../../console/rarch_console_input.h"
-#include "../../console/rarch_console_main_wrap.h"
#include "../../console/rarch_console_settings.h"
#ifdef HW_RVL
@@ -560,7 +559,7 @@ int main(int argc, char *argv[])
rarch_render_cached_frame();
g_extern.draw_menu = false;
- rarch_startup();
+ g_extern.console.rmenu.mode = MODE_INIT;
}
else
g_extern.console.external_launch.support = EXTERN_LAUNCHER_SALAMANDER;
@@ -578,13 +577,29 @@ begin_loop:
audio_stop_func();
}
- else if(g_extern.console.rmenu.mode == MODE_MENU)
+ else if (g_extern.console.rmenu.mode == MODE_INIT)
{
- rmenu_iterate();
+ if(g_extern.main_is_init)
+ rarch_main_deinit();
- if (g_extern.console.rmenu.mode != MODE_EXIT)
- rarch_startup();
+ struct rarch_main_wrap args = {0};
+
+ args.verbose = g_extern.verbose;
+ args.config_path = g_extern.config_path;
+ args.sram_path = g_extern.console.main_wrap.state.default_sram_dir.enable ? g_extern.console.main_wrap.paths.default_sram_dir : NULL,
+ args.state_path = g_extern.console.main_wrap.state.default_savestate_dir.enable ? g_extern.console.main_wrap.paths.default_savestate_dir : NULL,
+ args.rom_path = g_extern.file_state.rom_path;
+ args.libretro_path = g_settings.libretro;
+
+ int init_ret = rarch_main_init_wrap(&args);
+
+ if (init_ret == 0)
+ RARCH_LOG("rarch_main_init succeeded.\n");
+ else
+ RARCH_ERR("rarch_main_init failed.\n");
}
+ else if(g_extern.console.rmenu.mode == MODE_MENU)
+ rmenu_iterate();
else
goto begin_shutdown;
goto begin_loop;
diff --git a/gx/salamander/main.c b/gx/salamander/main.c
index c184d1b8fc..aad40d33dd 100644
--- a/gx/salamander/main.c
+++ b/gx/salamander/main.c
@@ -31,7 +31,6 @@
#include "../../console/rarch_console_input.h"
#include "../../console/rarch_console_config.h"
#include "../../console/rarch_console_settings.h"
-#include "../../console/rarch_console_main_wrap.h"
#include "../../conf/config_file.h"
#include "../../conf/config_file_macros.h"
#include "../../general.h"
diff --git a/ps3/frontend/main.c b/ps3/frontend/main.c
index ef03fbed20..ba192ff0d7 100644
--- a/ps3/frontend/main.c
+++ b/ps3/frontend/main.c
@@ -38,7 +38,6 @@
#include "../../console/rarch_console_input.h"
#include "../../console/rarch_console_config.h"
#include "../../console/rarch_console_settings.h"
-#include "../../console/rarch_console_main_wrap.h"
#include "../../console/rarch_console_video.h"
#include "../../conf/config_file.h"
#include "../../conf/config_file_macros.h"
@@ -350,7 +349,26 @@ begin_loop:
while(rarch_main_iterate());
}
else if (g_extern.console.rmenu.mode == MODE_INIT)
- rarch_startup();
+ {
+ if(g_extern.main_is_init)
+ rarch_main_deinit();
+
+ struct rarch_main_wrap args = {0};
+
+ args.verbose = g_extern.verbose;
+ args.config_path = g_extern.config_path;
+ args.sram_path = g_extern.console.main_wrap.state.default_sram_dir.enable ? g_extern.console.main_wrap.paths.default_sram_dir : NULL,
+ args.state_path = g_extern.console.main_wrap.state.default_savestate_dir.enable ? g_extern.console.main_wrap.paths.default_savestate_dir : NULL,
+ args.rom_path = g_extern.file_state.rom_path;
+ args.libretro_path = g_settings.libretro;
+
+ int init_ret = rarch_main_init_wrap(&args);
+
+ if (init_ret == 0)
+ RARCH_LOG("rarch_main_init succeeded.\n");
+ else
+ RARCH_ERR("rarch_main_init failed.\n");
+ }
else if(g_extern.console.rmenu.mode == MODE_MENU)
while(rmenu_iterate());
else
diff --git a/psp/frontend/main.c b/psp/frontend/main.c
index 669eacbe9f..3521445f41 100644
--- a/psp/frontend/main.c
+++ b/psp/frontend/main.c
@@ -158,33 +158,36 @@ int main(int argc, char *argv[])
menu_init();
begin_loop:
- if(g_extern.console.rmenu.mode == MODE_EMULATION)
+ if (g_extern.console.rmenu.mode == MODE_EMULATION)
{
-
- RARCH_LOG("Gets to: #2.0\n");
-
input_psp.poll(NULL);
-
- RARCH_LOG("Gets to: #2.1\n");
-
driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
- RARCH_LOG("Gets to: #2.2\n");
+ while(rarch_main_iterate());
+ }
+ else if (g_extern.console.rmenu.mode == MODE_INIT)
+ {
+ if(g_extern.main_is_init)
+ rarch_main_deinit();
- int count = 0;
+ struct rarch_main_wrap args = {0};
- while(rarch_main_iterate())
- {
- RARCH_LOG("Iterate: %d\n", count++);
- }
+ args.verbose = g_extern.verbose;
+ args.config_path = g_extern.config_path;
+ args.sram_path = g_extern.console.main_wrap.state.default_sram_dir.enable ? g_extern.console.main_wrap.paths.default_sram_dir : NULL,
+ args.state_path = g_extern.console.main_wrap.state.default_savestate_dir.enable ? g_extern.console.main_wrap.paths.default_savestate_dir : NULL,
+ args.rom_path = g_extern.file_state.rom_path;
+ args.libretro_path = g_settings.libretro;
+
+ int init_ret = rarch_main_init_wrap(&args);
+
+ if (init_ret == 0)
+ RARCH_LOG("rarch_main_init succeeded.\n");
+ else
+ RARCH_ERR("rarch_main_init failed.\n");
}
else if(g_extern.console.rmenu.mode == MODE_MENU)
- {
while(rmenu_iterate());
-
- if (g_extern.console.rmenu.mode != MODE_EXIT)
- rarch_startup();
- }
else
goto begin_shutdown;
diff --git a/retroarch.c b/retroarch.c
index aeeba0ea55..e5ccc6b948 100644
--- a/retroarch.c
+++ b/retroarch.c
@@ -2890,25 +2890,6 @@ void rarch_main_deinit(void)
g_extern.main_is_init = false;
}
-#ifndef HAVE_RARCH_MAIN_WRAP
-static bool rarch_main_idle_iterate(void)
-{
-#ifdef HAVE_COMMAND
- if (driver.command)
- rarch_cmd_pre_frame(driver.command);
-#endif
-
- if (input_key_pressed_func(RARCH_QUIT_KEY) ||
- !video_alive_func())
- return false;
-
- do_state_checks();
-
- input_poll();
- rarch_sleep(10);
- return true;
-}
-
#define MAX_ARGS 32
int rarch_main_init_wrap(const struct rarch_main_wrap *args)
{
@@ -2978,6 +2959,26 @@ int rarch_main_init_wrap(const struct rarch_main_wrap *args)
return ret;
}
+#ifndef HAVE_RARCH_MAIN_WRAP
+static bool rarch_main_idle_iterate(void)
+{
+#ifdef HAVE_COMMAND
+ if (driver.command)
+ rarch_cmd_pre_frame(driver.command);
+#endif
+
+ if (input_key_pressed_func(RARCH_QUIT_KEY) ||
+ !video_alive_func())
+ return false;
+
+ do_state_checks();
+
+ input_poll();
+ rarch_sleep(10);
+ return true;
+}
+
+
int rarch_main(int argc, char *argv[])
{
int init_ret;
diff --git a/xdk/frontend/main.c b/xdk/frontend/main.c
index 0b24564705..c9d9f906be 100644
--- a/xdk/frontend/main.c
+++ b/xdk/frontend/main.c
@@ -39,7 +39,6 @@
#include "../../console/rarch_console_exec.h"
#include "../../console/rarch_console_libretro_mgmt.h"
#include "../../console/rarch_console_config.h"
-#include "../../console/rarch_console_main_wrap.h"
#include "../../conf/config_file.h"
#include "../../conf/config_file_macros.h"
#include "../../file.h"
@@ -191,13 +190,29 @@ begin_loop:
while(rarch_main_iterate());
}
- else if(g_extern.console.rmenu.mode == MODE_MENU)
+ else if (g_extern.console.rmenu.mode == MODE_INIT)
{
- while(rmenu_iterate());
+ if(g_extern.main_is_init)
+ rarch_main_deinit();
- if (g_extern.console.rmenu.mode != MODE_EXIT)
- rarch_startup();
+ struct rarch_main_wrap args = {0};
+
+ args.verbose = g_extern.verbose;
+ args.config_path = g_extern.config_path;
+ args.sram_path = g_extern.console.main_wrap.state.default_sram_dir.enable ? g_extern.console.main_wrap.paths.default_sram_dir : NULL,
+ args.state_path = g_extern.console.main_wrap.state.default_savestate_dir.enable ? g_extern.console.main_wrap.paths.default_savestate_dir : NULL,
+ args.rom_path = g_extern.file_state.rom_path;
+ args.libretro_path = g_settings.libretro;
+
+ int init_ret = rarch_main_init_wrap(&args);
+
+ if (init_ret == 0)
+ RARCH_LOG("rarch_main_init succeeded.\n");
+ else
+ RARCH_ERR("rarch_main_init failed.\n");
}
+ else if(g_extern.console.rmenu.mode == MODE_MENU)
+ while(rmenu_iterate());
else
goto begin_shutdown;