diff --git a/Makefile b/Makefile
index 64c65ec5b2..61b678d38d 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@ OBJDIR := obj-unix
OBJ = frontend/frontend.o \
frontend/frontend_context.o \
+ frontend/platform/platform_null.o \
retroarch.o \
file.o \
file_path.o \
diff --git a/Makefile.emscripten b/Makefile.emscripten
index d12fe0a43b..3b38873fff 100644
--- a/Makefile.emscripten
+++ b/Makefile.emscripten
@@ -1,6 +1,7 @@
TARGET = retroarch.js
OBJ = frontend/platform/platform_emscripten.o \
+ frontend/platform/platform_null.o \
frontend/frontend.o \
retroarch.o \
file.o \
diff --git a/Makefile.win b/Makefile.win
index 1c07f211d8..ea50c31932 100644
--- a/Makefile.win
+++ b/Makefile.win
@@ -5,6 +5,7 @@ OBJDIR := obj-w32
OBJ = frontend/frontend.o \
frontend/frontend_context.o \
+ frontend/platform/platform_null.o \
retroarch.o \
file.o \
file_path.o \
diff --git a/frontend/frontend.c b/frontend/frontend.c
index 26a4813412..fbe9773be1 100644
--- a/frontend/frontend.c
+++ b/frontend/frontend.c
@@ -117,10 +117,6 @@ static void rarch_get_environment_console(void)
#define attempt_load_game_fails (1ULL << MODE_EXIT)
#endif
-#define frontend_init_enable true
-#define menu_init_enable true
-#define initial_lifecycle_state_preinit false
-
static retro_keyboard_event_t key_event;
#ifdef HAVE_MENU
@@ -345,14 +341,16 @@ returntype main_entry(signature())
declare_argv();
args_type() args = (args_type())args_initial_ptr();
- if (frontend_init_enable)
- {
- frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first();
+ frontend_ctx = (frontend_ctx_driver_t*)frontend_ctx_init_first();
- if (frontend_ctx && frontend_ctx->init)
- frontend_ctx->init(args);
+ if (!frontend_ctx)
+ {
+ RARCH_WARN("Frontend context could not be initialized.\n");
}
+ if (frontend_ctx && frontend_ctx->init)
+ frontend_ctx->init(args);
+
if (!ra_preinited)
{
rarch_main_clear_state();
@@ -372,14 +370,18 @@ returntype main_entry(signature())
}
#if defined(HAVE_MENU)
- if (menu_init_enable)
- driver.menu = (rgui_handle_t*)menu_init();
+ driver.menu = (rgui_handle_t*)menu_init();
+
+ if (!driver.menu)
+ {
+ RARCH_ERR("Couldn't initialize menu, exiting...\n");
+ returnfunc();
+ }
if (frontend_ctx && frontend_ctx->process_args)
frontend_ctx->process_args(argc, argv, args);
- if (!initial_lifecycle_state_preinit)
- g_extern.lifecycle_state |= initial_menu_lifecycle_state;
+ g_extern.lifecycle_state |= initial_menu_lifecycle_state;
if (attempt_load_game_push_history)
{
diff --git a/frontend/frontend_context.c b/frontend/frontend_context.c
index 7b7996f537..ab5c93314f 100644
--- a/frontend/frontend_context.c
+++ b/frontend/frontend_context.c
@@ -42,6 +42,7 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
#if defined(PSP)
&frontend_ctx_psp,
#endif
+ &frontend_ctx_null,
NULL // zero length array is not valid
};
diff --git a/frontend/frontend_context.h b/frontend/frontend_context.h
index f6074bd268..3cf88c0260 100644
--- a/frontend/frontend_context.h
+++ b/frontend/frontend_context.h
@@ -51,6 +51,7 @@ extern const frontend_ctx_driver_t frontend_ctx_qnx;
extern const frontend_ctx_driver_t frontend_ctx_apple;
extern const frontend_ctx_driver_t frontend_ctx_android;
extern const frontend_ctx_driver_t frontend_ctx_psp;
+extern const frontend_ctx_driver_t frontend_ctx_null;
const frontend_ctx_driver_t *frontend_ctx_find_driver(const char *ident); // Finds driver with ident. Does not initialize.
const frontend_ctx_driver_t *frontend_ctx_init_first(void); // Finds first suitable driver and initializes.
diff --git a/frontend/platform/platform_null.c b/frontend/platform/platform_null.c
new file mode 100644
index 0000000000..083ff917dc
--- /dev/null
+++ b/frontend/platform/platform_null.c
@@ -0,0 +1,34 @@
+/* RetroArch - A frontend for libretro.
+ * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
+ * Copyright (C) 2011-2014 - Daniel De Matteis
+ * Copyright (C) 2012-2014 - Jason Fetters
+ *
+ * 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 "../frontend_context.h"
+
+#include
+#include "../../boolean.h"
+#include
+#include
+
+const frontend_ctx_driver_t frontend_ctx_null = {
+ NULL, /* environment_get */
+ NULL, /* init */
+ NULL, /* deinit */
+ NULL, /* exitspawn */
+ NULL, /* process_args */
+ NULL, /* process_events */
+ NULL, /* exec */
+ NULL, /* shutdown */
+ "null",
+};
diff --git a/griffin/griffin.c b/griffin/griffin.c
index f2e58a768a..43e1ac7e07 100644
--- a/griffin/griffin.c
+++ b/griffin/griffin.c
@@ -560,6 +560,7 @@ FRONTEND
#elif defined(ANDROID)
#include "../frontend/platform/platform_android.c"
#endif
+#include "../frontend/platform/platform_null.c"
#include "../frontend/info/core_info.c"