Divorce g_system_menu from global state

This commit is contained in:
twinaphex 2015-12-06 19:31:47 +01:00
parent 883c2a172a
commit c6359d6dbc
20 changed files with 47 additions and 36 deletions

View File

@ -19,6 +19,7 @@
#include "camera_driver.h"
#include "../general.h"
#include "../string_list_special.h"
#include "../system.h"
#include "../verbosity.h"
static const camera_driver_t *camera_drivers[] = {

View File

@ -33,6 +33,7 @@
#include "msg_hash.h"
#include "retroarch.h"
#include "rewind.h"
#include "system.h"
#include "dir_list_special.h"
#ifdef HAVE_CHEEVOS
@ -972,7 +973,7 @@ bool event_command(enum event_command cmd)
case EVENT_CMD_LOAD_CORE_DEINIT:
#ifdef HAVE_DYNAMIC
#ifdef HAVE_MENU
libretro_free_system_info(&global->menu.info);
libretro_free_system_info(&g_system_menu);
#endif
#endif
break;
@ -982,7 +983,7 @@ bool event_command(enum event_command cmd)
#ifdef HAVE_MENU
menu_handle_t *menu = menu_driver_get_ptr();
if (menu)
event_update_system_info(&global->menu.info,
event_update_system_info(&g_system_menu,
&menu->load_no_content);
#endif
}

View File

@ -18,6 +18,7 @@
#include "general.h"
#include "msg_hash.h"
#include "system.h"
#include "audio/audio_driver.h"
#include "audio/audio_resampler_driver.h"
@ -325,10 +326,9 @@ bool driver_update_system_av_info(const void *data)
**/
static void menu_update_libretro_info(void)
{
global_t *global = global_get_ptr();
struct retro_system_info *info = global ? &global->menu.info : NULL;
struct retro_system_info *info = &g_system_menu;
if (!global || !info)
if (!info)
return;
#ifndef HAVE_DYNAMIC

View File

@ -33,6 +33,7 @@
#include "location/location_driver.h"
#include "record/record_driver.h"
#include "performance.h"
#include "system.h"
#include "libretro_private.h"
#include "cores/internal_cores.h"

View File

@ -31,6 +31,7 @@
#include "../performance.h"
#include "../string_list_special.h"
#include "../libretro_version_1.h"
#include "../system.h"
#ifdef HAVE_MENU
#include "../menu/menu_hash.h"

View File

@ -23,6 +23,7 @@
#include <boolean.h>
#include "../../configuration.h"
#include "../../general.h"
#include "../../verbosity.h"

View File

@ -18,9 +18,11 @@
#include <string.h>
#include <ctype.h>
#include "../general.h"
#include "input_keyboard.h"
#include "../general.h"
#include "../system.h"
struct input_keyboard_line
{
char *buffer;

View File

@ -19,6 +19,7 @@
#include "location_driver.h"
#include "../general.h"
#include "../system.h"
#include "../string_list_special.h"
#include "../verbosity.h"

View File

@ -26,6 +26,7 @@
#include "../../cores/internal_cores.h"
#include "../../general.h"
#include "../../system.h"
#include "../../verbosity.h"
#include "../../tasks/tasks.h"
@ -510,7 +511,6 @@ enum
static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned type)
{
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
const char *exts = core_info_list_get_all_extensions();
@ -537,10 +537,10 @@ static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned typ
if (exts)
strlcpy(info->exts, exts, sizeof(info->exts));
else if (global->menu.info.valid_extensions)
else if (g_system_menu.valid_extensions)
{
if (*global->menu.info.valid_extensions)
strlcpy(info->exts, global->menu.info.valid_extensions,
if (*g_system_menu.valid_extensions)
strlcpy(info->exts, g_system_menu.valid_extensions,
sizeof(info->exts));
}
else
@ -548,10 +548,10 @@ static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned typ
break;
case PUSH_ARCHIVE_OPEN:
info->setting = menu_setting_find(info->label);
if (global->menu.info.valid_extensions)
if (g_system_menu.valid_extensions)
{
if (*global->menu.info.valid_extensions)
strlcpy(info->exts, global->menu.info.valid_extensions,
if (*g_system_menu.valid_extensions)
strlcpy(info->exts, g_system_menu.valid_extensions,
sizeof(info->exts));
}
else
@ -562,10 +562,10 @@ static int general_push(menu_displaylist_info_t *info, unsigned id, unsigned typ
if (menu_setting_get_browser_selection_type(info->setting) == ST_DIR)
{
}
else if (global->menu.info.valid_extensions)
else if (g_system_menu.valid_extensions)
{
if (*global->menu.info.valid_extensions)
strlcpy(info->exts, global->menu.info.valid_extensions,
if (*g_system_menu.valid_extensions)
strlcpy(info->exts, g_system_menu.valid_extensions,
sizeof(info->exts));
}
else

View File

@ -26,6 +26,7 @@
#include "../../cheats.h"
#include "../../general.h"
#include "../../retroarch.h"
#include "../../system.h"
#ifndef BIND_ACTION_LEFT
#define BIND_ACTION_LEFT(cbs, name) \

View File

@ -26,6 +26,7 @@
#include "../../cheats.h"
#include "../../general.h"
#include "../../retroarch.h"
#include "../../system.h"
#include "../../ui/ui_companion_driver.h"
#ifndef BIND_ACTION_RIGHT

View File

@ -26,6 +26,7 @@
#include "../../cheats.h"
#include "../../general.h"
#include "../../retroarch.h"
#include "../../system.h"
#include "../../performance.h"
#include "../../gfx/video_shader_driver.h"

View File

@ -30,6 +30,7 @@
#include "../cheats.h"
#include "../general.h"
#include "../system.h"
#include "../frontend/frontend_driver.h"
#include "../ui/ui_companion_driver.h"
#include "../gfx/video_shader_driver.h"

View File

@ -25,6 +25,7 @@
#include "menu_shader.h"
#include "../general.h"
#include "../system.h"
#include "../frontend/frontend.h"
#include "../string_list_special.h"
#include "../tasks/tasks.h"
@ -392,7 +393,6 @@ static void menu_environment_get(int *argc, char *argv[],
static void menu_push_to_history_playlist(void)
{
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
char *fullpath = NULL;
if (!settings->history_list_enable)
@ -414,7 +414,7 @@ static void menu_push_to_history_playlist(void)
fullpath,
NULL,
settings->libretro,
global->menu.info.library_name,
g_system_menu.library_name,
NULL,
NULL);
}
@ -525,7 +525,7 @@ void menu_free(menu_handle_t *menu)
menu_driver_free(menu);
#ifdef HAVE_DYNAMIC
libretro_free_system_info(&global->menu.info);
libretro_free_system_info(&g_system_menu);
#endif
menu_display_free();

View File

@ -22,6 +22,7 @@
#include "menu_hash.h"
#include "../general.h"
#include "../system.h"
struct menu_list
{
@ -463,21 +464,14 @@ bool menu_entries_show_back(void)
* (shown at the top of the UI). */
int menu_entries_get_core_title(char *s, size_t len)
{
const char *core_name = NULL;
const char *core_version = NULL;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *info = rarch_system_info_get_ptr();
const char *core_name = g_system_menu.library_name;
const char *core_version = g_system_menu.library_version;
if (!settings->menu.core_enable)
return -1;
if (global)
{
core_name = global->menu.info.library_name;
core_version = global->menu.info.library_version;
}
if (!core_name || core_name[0] == '\0')
core_name = info->info.library_name;
if (!core_name || core_name[0] == '\0')

View File

@ -37,6 +37,7 @@
#include "../driver.h"
#include "../general.h"
#include "../system.h"
#include "../dynamic.h"
#include "../camera/camera_driver.h"
#include "../location/location_driver.h"

View File

@ -40,6 +40,7 @@
#include "retroarch.h"
#include "runloop.h"
#include "rewind.h"
#include "system.h"
#include "dir_list_special.h"
#include "audio/audio_driver.h"
#include "camera/camera_driver.h"

View File

@ -16,11 +16,13 @@
#ifndef __RETROARCH_RUNLOOP_H
#define __RETROARCH_RUNLOOP_H
#include <retro_miscellaneous.h>
#include "configuration.h"
#include "libretro.h"
#include "core_info.h"
#include "core_options.h"
#include "dynamic.h"
#include "system.h"
#ifdef __cplusplus
extern "C" {
@ -194,13 +196,6 @@ typedef struct global
bool ips_pref;
} patch;
#ifdef HAVE_MENU
struct
{
struct retro_system_info info;
} menu;
#endif
struct
{
bool load_disable;

View File

@ -27,6 +27,10 @@
static rarch_system_info_t *g_system;
#ifdef HAVE_MENU
struct retro_system_info g_system_menu;
#endif
static rarch_system_info_t *rarch_system_info_new(void)
{
return (rarch_system_info_t*)calloc(1, sizeof(rarch_system_info_t));

View File

@ -57,6 +57,10 @@ typedef struct rarch_system_info
unsigned num_ports;
} rarch_system_info_t;
#ifdef HAVE_MENU
extern struct retro_system_info g_system_menu;
#endif
rarch_system_info_t *rarch_system_info_get_ptr(void);
void rarch_system_info_free(void);