Skip to content

Commit

Permalink
Revert "Refactor core_system_info_* functions"
Browse files Browse the repository at this point in the history
This reverts commit f637805.
  • Loading branch information
inactive123 committed Sep 6, 2016
1 parent 2ecd9f3 commit c3ba0ba
Show file tree
Hide file tree
Showing 21 changed files with 590 additions and 506 deletions.
6 changes: 4 additions & 2 deletions cheevos.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,8 @@ static unsigned cheevos_parse_operator(const char **memaddr)

void cheevos_parse_guest_addr(cheevos_var_t *var, unsigned value)
{
rarch_system_info_t *system = core_system_info_get();
rarch_system_info_t *system;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);

var->bank_id = -1;
var->value = value;
Expand Down Expand Up @@ -1088,7 +1089,8 @@ uint8_t *cheevos_get_memory(const cheevos_var_t *var)
{
if (var->bank_id >= 0)
{
rarch_system_info_t *system = core_system_info_get();
rarch_system_info_t *system;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);

if (system->mmaps.num_descriptors != 0)
return (uint8_t *)system->mmaps.descriptors[var->bank_id].ptr + var->value;
Expand Down
20 changes: 15 additions & 5 deletions command.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,8 +834,10 @@ static void command_event_disk_control_set_eject(bool new_state, bool print_log)
{
char msg[128] = {0};
bool error = false;
rarch_system_info_t *info = NULL;
const struct retro_disk_control_callback *control = NULL;
rarch_system_info_t *info = core_system_info_get();

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);

if (info)
control = (const struct retro_disk_control_callback*)&info->disk_control_cb;
Expand Down Expand Up @@ -882,8 +884,10 @@ static void command_event_disk_control_set_index(unsigned idx)
unsigned num_disks;
bool error = false;
char msg[128] = {0};
rarch_system_info_t *info = NULL;
const struct retro_disk_control_callback *control = NULL;
rarch_system_info_t *info = core_system_info_get();

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);

if (info)
control = (const struct retro_disk_control_callback*)&info->disk_control_cb;
Expand Down Expand Up @@ -938,7 +942,9 @@ static bool command_event_disk_control_append_image(const char *path)
struct retro_game_info info = {0};
global_t *global = global_get_ptr();
const struct retro_disk_control_callback *control = NULL;
rarch_system_info_t *sysinfo = core_system_info_get();
rarch_system_info_t *sysinfo = NULL;

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &sysinfo);

if (sysinfo)
control = (const struct retro_disk_control_callback*)
Expand Down Expand Up @@ -1081,7 +1087,9 @@ static void command_event_init_controllers(void)
{
unsigned i;
settings_t *settings = config_get_ptr();
rarch_system_info_t *info = core_system_info_get();
rarch_system_info_t *info = NULL;

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);

for (i = 0; i < MAX_USERS; i++)
{
Expand Down Expand Up @@ -1806,7 +1814,9 @@ bool command_event(enum event_command cmd, void *data)
unsigned i = 0;
bool boolean = false;
settings_t *settings = config_get_ptr();
rarch_system_info_t *info = core_system_info_get();
rarch_system_info_t *info = NULL;

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);

(void)i;

Expand Down
20 changes: 14 additions & 6 deletions configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -2132,8 +2132,10 @@ bool config_load_override(void)
const char *core_name = NULL;
const char *game_name = NULL;
bool should_append = false;
rarch_system_info_t *system = NULL;
global_t *global = global_get_ptr();
rarch_system_info_t *system = core_system_info_get();

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);

if (system)
core_name = system->info.library_name;
Expand Down Expand Up @@ -2290,7 +2292,9 @@ bool config_load_remap(void)
const char *game_name = NULL;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = core_system_info_get();
rarch_system_info_t *system = NULL;

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);

if (system)
core_name = system->info.library_name;
Expand Down Expand Up @@ -2411,7 +2415,9 @@ bool config_load_shader_preset(void)
const char *game_name = NULL;
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = core_system_info_get();
rarch_system_info_t *system = NULL;

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);

if (system)
core_name = system->info.library_name;
Expand Down Expand Up @@ -3001,6 +3007,9 @@ bool config_save_overrides(int override_type)
const char *game_name = NULL;
config_file_t *conf = NULL;
settings_t *settings = NULL;
global_t *global = global_get_ptr();
settings_t *overrides = config_get_ptr();
rarch_system_info_t *system = NULL;
struct config_bool_setting *bool_settings = NULL;
struct config_bool_setting *bool_overrides = NULL;
struct config_int_setting *int_settings = NULL;
Expand All @@ -3011,9 +3020,8 @@ bool config_save_overrides(int override_type)
struct config_array_setting *array_overrides= NULL;
struct config_path_setting *path_settings = NULL;
struct config_path_setting *path_overrides = NULL;
global_t *global = global_get_ptr();
settings_t *overrides = config_get_ptr();
rarch_system_info_t *system = core_system_info_get();

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);

if (system)
core_name = system->info.library_name;
Expand Down
6 changes: 0 additions & 6 deletions core.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,6 @@ bool core_is_inited(void);

bool core_is_game_loaded(void);

rarch_system_info_t *core_system_info_get(void);

void core_system_info_init(void);

void core_system_info_free(void);

RETRO_END_DECLS

#endif
50 changes: 0 additions & 50 deletions core_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include <retro_inline.h>
#include <boolean.h>
#include <compat/strl.h>
#include <lists/string_list.h>
#include <libretro.h>

Expand All @@ -41,12 +40,6 @@
#include "network/netplay/netplay.h"
#endif

#ifdef HAVE_ZLIB
#define DEFAULT_EXT "zip"
#else
#define DEFAULT_EXT ""
#endif

static struct retro_core_t core;
static bool core_inited;
static bool core_symbols_inited;
Expand All @@ -55,7 +48,6 @@ static unsigned core_poll_type;
static bool core_input_polled;
static bool core_has_set_input_descriptors = false;
static struct retro_callbacks retro_ctx;
static rarch_system_info_t core_system_info;

static void core_input_state_poll_maybe(void)
{
Expand Down Expand Up @@ -456,45 +448,3 @@ bool core_is_game_loaded(void)
{
return core_game_loaded;
}

rarch_system_info_t *core_system_info_get(void)
{
return &core_system_info;
}

void core_system_info_init(void)
{
memset(&core_system_info, 0, sizeof(rarch_system_info_t));
core_get_system_info(&core_system_info.info);

if (!core_system_info.info.library_name)
core_system_info.info.library_name = msg_hash_to_str(MSG_UNKNOWN);
if (!core_system_info.info.library_version)
core_system_info.info.library_version = "v0";

strlcpy(core_system_info.valid_extensions,
core_system_info.info.valid_extensions ?
core_system_info.info.valid_extensions : DEFAULT_EXT,
sizeof(core_system_info.valid_extensions));
}

void core_system_info_free(void)
{
/* No longer valid. */
if (core_system_info.subsystem.data)
free(core_system_info.subsystem.data);
core_system_info.subsystem.data = NULL;
core_system_info.subsystem.size = 0;

if (core_system_info.ports.data)
free(core_system_info.ports.data);
core_system_info.ports.data = NULL;
core_system_info.ports.size = 0;

if (core_system_info.mmaps.descriptors)
free((void *)core_system_info.mmaps.descriptors);
core_system_info.mmaps.descriptors = NULL;
core_system_info.mmaps.num_descriptors = 0;

memset(&core_system_info, 0, sizeof(rarch_system_info_t));
}
4 changes: 3 additions & 1 deletion dynamic.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,10 @@ bool rarch_environment_cb(unsigned cmd, void *data)
unsigned p;
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
rarch_system_info_t *system = core_system_info_get();
rarch_system_info_t *system = NULL;

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);

if (ignore_environment_cb)
return false;

Expand Down
4 changes: 3 additions & 1 deletion gfx/video_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,12 +590,14 @@ static bool init_video(void)
video_viewport_t *custom_vp = NULL;
const input_driver_t *tmp = NULL;
const struct retro_game_geometry *geom = NULL;
rarch_system_info_t *system = NULL;
video_info_t video = {0};
static uint16_t dummy_pixels[32] = {0};
settings_t *settings = config_get_ptr();
struct retro_system_av_info *av_info =
video_viewport_get_system_av_info();
rarch_system_info_t *system = core_system_info_get();

runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);

init_video_filter(video_driver_state.pix_fmt);
command_event(CMD_EVENT_SHADER_DIR_INIT, NULL);
Expand Down
Loading

0 comments on commit c3ba0ba

Please sign in to comment.