Skip to content

Commit

Permalink
Divorce g_system_menu from global state
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed Dec 6, 2015

Unverified

No user is associated with the committer email.
1 parent 883c2a1 commit c6359d6
Showing 20 changed files with 47 additions and 36 deletions.
1 change: 1 addition & 0 deletions camera/camera_driver.c
Original file line number Diff line number Diff line change
@@ -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[] = {
5 changes: 3 additions & 2 deletions command_event.c
Original file line number Diff line number Diff line change
@@ -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
}
6 changes: 3 additions & 3 deletions driver.c
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions dynamic.c
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions gfx/video_driver.c
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions input/drivers/linuxraw_input.c
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@

#include <boolean.h>

#include "../../configuration.h"
#include "../../general.h"
#include "../../verbosity.h"

4 changes: 3 additions & 1 deletion input/input_keyboard.c
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions location/location_driver.c
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
#include "location_driver.h"

#include "../general.h"
#include "../system.h"
#include "../string_list_special.h"
#include "../verbosity.h"

20 changes: 10 additions & 10 deletions menu/cbs/menu_cbs_deferred_push.c
Original file line number Diff line number Diff line change
@@ -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,21 +537,21 @@ 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
strlcpy(info->exts, system->valid_extensions, sizeof(info->exts));
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
1 change: 1 addition & 0 deletions menu/cbs/menu_cbs_left.c
Original file line number Diff line number Diff line change
@@ -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) \
1 change: 1 addition & 0 deletions menu/cbs/menu_cbs_right.c
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions menu/cbs/menu_cbs_start.c
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions menu/menu_displaylist.c
Original file line number Diff line number Diff line change
@@ -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"
6 changes: 3 additions & 3 deletions menu/menu_driver.c
Original file line number Diff line number Diff line change
@@ -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();
12 changes: 3 additions & 9 deletions menu/menu_entries.c
Original file line number Diff line number Diff line change
@@ -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')
1 change: 1 addition & 0 deletions menu/menu_setting.c
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions runloop.c
Original file line number Diff line number Diff line change
@@ -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"
11 changes: 3 additions & 8 deletions runloop.h
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 4 additions & 0 deletions system.c
Original file line number Diff line number Diff line change
@@ -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));
4 changes: 4 additions & 0 deletions system.h
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit c6359d6

Please sign in to comment.