From e4681e0013344b0bb73877ff3f0dc0773da282bd Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 5 Sep 2014 18:14:00 +0200 Subject: [PATCH] Make it possible to compile without HAVE_MENU defined --- file_list.c | 8 ++++++++ frontend/frontend.c | 23 +++++++++++++---------- frontend/frontend_context.h | 8 ++++---- settings.c | 4 ++++ 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/file_list.c b/file_list.c index f4d5f9e007..f28a075a18 100644 --- a/file_list.c +++ b/file_list.c @@ -34,8 +34,10 @@ void file_list_push(file_list_t *list, list->capacity * sizeof(struct item_file)); } +#ifdef HAVE_MENU if (driver.menu_ctx && driver.menu_ctx->list_insert) driver.menu_ctx->list_insert(list, path, label, list->size); +#endif list->list[list->size].label = strdup(label); list->list[list->size].path = strdup(path); @@ -60,8 +62,10 @@ void file_list_pop(file_list_t *list, size_t *directory_ptr) { if (!(list->size == 0)) { +#ifdef HAVE_MENU if (driver.menu_ctx && driver.menu_ctx->list_delete) driver.menu_ctx->list_delete(list, list->size); +#endif --list->size; free(list->list[list->size].path); free(list->list[list->size].label); @@ -70,8 +74,10 @@ void file_list_pop(file_list_t *list, size_t *directory_ptr) if (directory_ptr) *directory_ptr = list->list[list->size].directory_ptr; +#ifdef HAVE_MENU if (driver.menu_ctx && driver.menu_ctx->list_set_selection) driver.menu_ctx->list_set_selection(list); +#endif } void file_list_free(file_list_t *list) @@ -98,8 +104,10 @@ void file_list_clear(file_list_t *list) free(list->list[i].alt); } +#ifdef HAVE_MENU if (driver.menu_ctx && driver.menu_ctx->list_clear) driver.menu_ctx->list_clear(list); +#endif list->size = 0; } diff --git a/frontend/frontend.c b/frontend/frontend.c index 70daf4419c..4a2a22d029 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -19,6 +19,7 @@ #include "../general.h" #include "../conf/config_file.h" #include "../file.h" +#include "../performance.h" #include "frontend_context.h" @@ -113,7 +114,6 @@ static int main_entry_iterate_content_nomenu(signature(), args_type() args) } #endif -#ifdef HAVE_MENU int main_entry_iterate_clear_input(signature(), args_type() args) { (void)args; @@ -122,25 +122,24 @@ int main_entry_iterate_clear_input(signature(), args_type() args) return main_entry_iterate_shutdown(signature_expand(), args); rarch_input_poll(); - if (!menu_input()) - { - /* Restore libretro keyboard callback. */ - g_extern.system.key_event = key_event; +#ifdef HAVE_MENU + if (menu_input()) + return 0; +#endif - - rarch_main_set_state(RARCH_ACTION_STATE_FLUSH_INPUT_FINISHED); - } + /* Restore libretro keyboard callback. */ + g_extern.system.key_event = key_event; + rarch_main_set_state(RARCH_ACTION_STATE_FLUSH_INPUT_FINISHED); return 0; } - - int main_entry_iterate_load_content(signature(), args_type() args) { if (g_extern.system.shutdown) return main_entry_iterate_shutdown(signature_expand(), args); +#ifdef HAVE_MENU if (!load_menu_content()) { /* If content loading fails, we go back to menu. */ @@ -148,12 +147,14 @@ int main_entry_iterate_load_content(signature(), args_type() args) if (driver.menu) rarch_main_set_state(RARCH_ACTION_STATE_MENU_PREINIT); } +#endif rarch_main_set_state(RARCH_ACTION_STATE_LOAD_CONTENT_FINISHED); return 0; } +#ifdef HAVE_MENU int main_entry_iterate_menu_preinit(signature(), args_type() args) { int i; @@ -237,8 +238,10 @@ void main_exit(args_type() args) if (g_extern.main_is_init) { +#ifdef HAVE_MENU /* Do not want menu context to live any more. */ driver.menu_data_own = false; +#endif rarch_main_deinit(); } diff --git a/frontend/frontend_context.h b/frontend/frontend_context.h index 293175ced3..1d7678eff6 100644 --- a/frontend/frontend_context.h +++ b/frontend/frontend_context.h @@ -73,12 +73,12 @@ 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. -#ifdef HAVE_MENU -int main_entry_iterate_content(signature(), args_type() args); -int main_entry_iterate_menu_preinit(signature(), args_type() args); -int main_entry_iterate_menu(signature(), args_type() args); int main_entry_iterate_clear_input(signature(), args_type() args); int main_entry_iterate_load_content(signature(), args_type() args); +int main_entry_iterate_content(signature(), args_type() args); +#ifdef HAVE_MENU +int main_entry_iterate_menu_preinit(signature(), args_type() args); +int main_entry_iterate_menu(signature(), args_type() args); #endif extern int (*frontend_loop)(signature(), args_type() args); diff --git a/settings.c b/settings.c index d60c2e07fd..473648558d 100644 --- a/settings.c +++ b/settings.c @@ -1019,7 +1019,9 @@ bool config_load_file(const char *path, bool set_defaults) CONFIG_GET_BOOL(location.allow, "location_allow"); CONFIG_GET_STRING(video.driver, "video_driver"); +#ifdef HAVE_MENU CONFIG_GET_STRING(menu.driver, "menu_driver"); +#endif CONFIG_GET_STRING(video.gl_context, "video_gl_context"); CONFIG_GET_STRING(audio.driver, "audio_driver"); CONFIG_GET_PATH(video.softfilter_plugin, "video_filter"); @@ -1440,7 +1442,9 @@ bool config_save_file(const char *path) config_set_int(conf, "video_fullscreen_x", g_settings.video.fullscreen_x); config_set_int(conf, "video_fullscreen_y", g_settings.video.fullscreen_y); config_set_string(conf,"video_driver", g_settings.video.driver); +#ifdef HAVE_MENU config_set_string(conf,"menu_driver", g_settings.menu.driver); +#endif config_set_bool(conf, "video_vsync", g_settings.video.vsync); config_set_bool(conf, "video_hard_sync", g_settings.video.hard_sync); config_set_int(conf, "video_hard_sync_frames",