* Add 'null' frontend context driver (will come into use later on in

more important ways)
* RetroArch when compiled with menu support will now cleanly exit if
menu driver cannot be initialized properly
This commit is contained in:
twinaphex 2014-05-09 06:12:53 +02:00
parent 4d46c36917
commit cf669f21ca
8 changed files with 55 additions and 13 deletions

View File

@ -6,6 +6,7 @@ OBJDIR := obj-unix
OBJ = frontend/frontend.o \ OBJ = frontend/frontend.o \
frontend/frontend_context.o \ frontend/frontend_context.o \
frontend/platform/platform_null.o \
retroarch.o \ retroarch.o \
file.o \ file.o \
file_path.o \ file_path.o \

View File

@ -1,6 +1,7 @@
TARGET = retroarch.js TARGET = retroarch.js
OBJ = frontend/platform/platform_emscripten.o \ OBJ = frontend/platform/platform_emscripten.o \
frontend/platform/platform_null.o \
frontend/frontend.o \ frontend/frontend.o \
retroarch.o \ retroarch.o \
file.o \ file.o \

View File

@ -5,6 +5,7 @@ OBJDIR := obj-w32
OBJ = frontend/frontend.o \ OBJ = frontend/frontend.o \
frontend/frontend_context.o \ frontend/frontend_context.o \
frontend/platform/platform_null.o \
retroarch.o \ retroarch.o \
file.o \ file.o \
file_path.o \ file_path.o \

View File

@ -117,10 +117,6 @@ static void rarch_get_environment_console(void)
#define attempt_load_game_fails (1ULL << MODE_EXIT) #define attempt_load_game_fails (1ULL << MODE_EXIT)
#endif #endif
#define frontend_init_enable true
#define menu_init_enable true
#define initial_lifecycle_state_preinit false
static retro_keyboard_event_t key_event; static retro_keyboard_event_t key_event;
#ifdef HAVE_MENU #ifdef HAVE_MENU
@ -345,14 +341,16 @@ returntype main_entry(signature())
declare_argv(); declare_argv();
args_type() args = (args_type())args_initial_ptr(); 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) if (!frontend_ctx)
frontend_ctx->init(args); {
RARCH_WARN("Frontend context could not be initialized.\n");
} }
if (frontend_ctx && frontend_ctx->init)
frontend_ctx->init(args);
if (!ra_preinited) if (!ra_preinited)
{ {
rarch_main_clear_state(); rarch_main_clear_state();
@ -372,14 +370,18 @@ returntype main_entry(signature())
} }
#if defined(HAVE_MENU) #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) if (frontend_ctx && frontend_ctx->process_args)
frontend_ctx->process_args(argc, argv, 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) if (attempt_load_game_push_history)
{ {

View File

@ -42,6 +42,7 @@ static const frontend_ctx_driver_t *frontend_ctx_drivers[] = {
#if defined(PSP) #if defined(PSP)
&frontend_ctx_psp, &frontend_ctx_psp,
#endif #endif
&frontend_ctx_null,
NULL // zero length array is not valid NULL // zero length array is not valid
}; };

View File

@ -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_apple;
extern const frontend_ctx_driver_t frontend_ctx_android; 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_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_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. const frontend_ctx_driver_t *frontend_ctx_init_first(void); // Finds first suitable driver and initializes.

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "../frontend_context.h"
#include <stdint.h>
#include "../../boolean.h"
#include <stddef.h>
#include <string.h>
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",
};

View File

@ -560,6 +560,7 @@ FRONTEND
#elif defined(ANDROID) #elif defined(ANDROID)
#include "../frontend/platform/platform_android.c" #include "../frontend/platform/platform_android.c"
#endif #endif
#include "../frontend/platform/platform_null.c"
#include "../frontend/info/core_info.c" #include "../frontend/info/core_info.c"