mirror of
https://github.com/libretro/RetroArch
synced 2025-02-09 09:39:56 +00:00
Cleanups
This commit is contained in:
parent
05ce32efe4
commit
2d158b809c
@ -340,9 +340,9 @@ static void event_init_controllers(void)
|
|||||||
const struct retro_controller_description *desc = NULL;
|
const struct retro_controller_description *desc = NULL;
|
||||||
unsigned device = settings->input.libretro_device[i];
|
unsigned device = settings->input.libretro_device[i];
|
||||||
|
|
||||||
if (i < info->num_ports)
|
if (i < info->ports.size)
|
||||||
desc = libretro_find_controller_description(
|
desc = libretro_find_controller_description(
|
||||||
&info->ports[i], device);
|
&info->ports.data[i], device);
|
||||||
|
|
||||||
if (desc)
|
if (desc)
|
||||||
ident = desc->desc;
|
ident = desc->desc;
|
||||||
|
@ -1444,8 +1444,8 @@ static const struct retro_subsystem_info *init_content_file_subsystem(
|
|||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
global_t *global = global_get_ptr();
|
||||||
const struct retro_subsystem_info *special =
|
const struct retro_subsystem_info *special =
|
||||||
libretro_find_subsystem_info(system->special,
|
libretro_find_subsystem_info(system->subsystem.data,
|
||||||
system->num_special, global->subsystem);
|
system->subsystem.size, global->subsystem);
|
||||||
|
|
||||||
if (!special)
|
if (!special)
|
||||||
{
|
{
|
||||||
|
28
dynamic.c
28
dynamic.c
@ -1133,16 +1133,16 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(system->special);
|
free(system->subsystem.data);
|
||||||
system->special = (struct retro_subsystem_info*)
|
system->subsystem.data = (struct retro_subsystem_info*)
|
||||||
calloc(i, sizeof(*system->special));
|
calloc(i, sizeof(*system->subsystem.data));
|
||||||
|
|
||||||
if (!system->special)
|
if (!system->subsystem.data)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
memcpy(system->special, info,
|
memcpy(system->subsystem.data, info,
|
||||||
i * sizeof(*system->special));
|
i * sizeof(*system->subsystem.data));
|
||||||
system->num_special = i;
|
system->subsystem.size = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1162,15 +1162,15 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||||||
info[i].types[j].id);
|
info[i].types[j].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(system->ports);
|
free(system->ports.data);
|
||||||
system->ports = (struct retro_controller_info*)
|
system->ports.data = (struct retro_controller_info*)
|
||||||
calloc(i, sizeof(*system->ports));
|
calloc(i, sizeof(*system->ports.data));
|
||||||
if (!system->ports)
|
if (!system->ports.data)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
memcpy(system->ports, info,
|
memcpy(system->ports.data, info,
|
||||||
i * sizeof(*system->ports));
|
i * sizeof(*system->ports.data));
|
||||||
system->num_ports = i;
|
system->ports.size = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1003,9 +1003,9 @@ static void setting_get_string_representation_uint_libretro_device(void *data,
|
|||||||
|
|
||||||
index_offset = menu_setting_get_index_offset(setting);
|
index_offset = menu_setting_get_index_offset(setting);
|
||||||
|
|
||||||
if (index_offset < system->num_ports)
|
if (index_offset < system->ports.size)
|
||||||
desc = libretro_find_controller_description(
|
desc = libretro_find_controller_description(
|
||||||
&system->ports[index_offset],
|
&system->ports.data[index_offset],
|
||||||
settings->input.libretro_device
|
settings->input.libretro_device
|
||||||
[index_offset]);
|
[index_offset]);
|
||||||
|
|
||||||
@ -2235,11 +2235,11 @@ static int setting_action_start_libretro_device_type(void *data)
|
|||||||
|
|
||||||
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
||||||
* older core which doesn't use SET_CONTROLLER_INFO. */
|
* older core which doesn't use SET_CONTROLLER_INFO. */
|
||||||
if (!system->num_ports)
|
if (!system->ports.size)
|
||||||
devices[types++] = RETRO_DEVICE_ANALOG;
|
devices[types++] = RETRO_DEVICE_ANALOG;
|
||||||
|
|
||||||
desc = port < system->num_ports ?
|
desc = port < system->ports.size ?
|
||||||
&system->ports[port] : NULL;
|
&system->ports.data[port] : NULL;
|
||||||
|
|
||||||
if (desc)
|
if (desc)
|
||||||
{
|
{
|
||||||
@ -2385,11 +2385,11 @@ static int setting_action_left_libretro_device_type(
|
|||||||
|
|
||||||
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
||||||
* older core which doesn't use SET_CONTROLLER_INFO. */
|
* older core which doesn't use SET_CONTROLLER_INFO. */
|
||||||
if (!system->num_ports)
|
if (!system->ports.size)
|
||||||
devices[types++] = RETRO_DEVICE_ANALOG;
|
devices[types++] = RETRO_DEVICE_ANALOG;
|
||||||
|
|
||||||
if (port < system->num_ports)
|
if (port < system->ports.size)
|
||||||
desc = &system->ports[port];
|
desc = &system->ports.data[port];
|
||||||
|
|
||||||
if (desc)
|
if (desc)
|
||||||
{
|
{
|
||||||
@ -2450,11 +2450,11 @@ static int setting_action_right_libretro_device_type(
|
|||||||
|
|
||||||
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
/* Only push RETRO_DEVICE_ANALOG as default if we use an
|
||||||
* older core which doesn't use SET_CONTROLLER_INFO. */
|
* older core which doesn't use SET_CONTROLLER_INFO. */
|
||||||
if (!system->num_ports)
|
if (!system->ports.size)
|
||||||
devices[types++] = RETRO_DEVICE_ANALOG;
|
devices[types++] = RETRO_DEVICE_ANALOG;
|
||||||
|
|
||||||
if (port < system->num_ports)
|
if (port < system->ports.size)
|
||||||
desc = &system->ports[port];
|
desc = &system->ports.data[port];
|
||||||
|
|
||||||
if (desc)
|
if (desc)
|
||||||
{
|
{
|
||||||
|
@ -1033,8 +1033,8 @@ static void rarch_init_savefile_paths(void)
|
|||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
const struct retro_subsystem_info *info =
|
const struct retro_subsystem_info *info =
|
||||||
libretro_find_subsystem_info(
|
libretro_find_subsystem_info(
|
||||||
system->special,
|
system->subsystem.data,
|
||||||
system->num_special,
|
system->subsystem.size,
|
||||||
global->subsystem);
|
global->subsystem);
|
||||||
|
|
||||||
/* We'll handle this error gracefully later. */
|
/* We'll handle this error gracefully later. */
|
||||||
|
14
runloop.c
14
runloop.c
@ -499,12 +499,14 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
|||||||
runloop_system.core_options = NULL;
|
runloop_system.core_options = NULL;
|
||||||
|
|
||||||
/* No longer valid. */
|
/* No longer valid. */
|
||||||
if (runloop_system.special)
|
if (runloop_system.subsystem.data)
|
||||||
free(runloop_system.special);
|
free(runloop_system.subsystem.data);
|
||||||
runloop_system.special = NULL;
|
runloop_system.subsystem.data = NULL;
|
||||||
if (runloop_system.ports)
|
if (runloop_system.ports.data)
|
||||||
free(runloop_system.ports);
|
free(runloop_system.ports.data);
|
||||||
runloop_system.ports = NULL;
|
runloop_system.subsystem.size = 0;
|
||||||
|
runloop_system.ports.data = NULL;
|
||||||
|
runloop_system.ports.size = 0;
|
||||||
runloop_key_event = NULL;
|
runloop_key_event = NULL;
|
||||||
runloop_frontend_key_event = NULL;
|
runloop_frontend_key_event = NULL;
|
||||||
|
|
||||||
|
14
system.h
14
system.h
@ -47,11 +47,17 @@ typedef struct rarch_system_info
|
|||||||
|
|
||||||
core_option_manager_t *core_options;
|
core_option_manager_t *core_options;
|
||||||
|
|
||||||
struct retro_subsystem_info *special;
|
struct
|
||||||
unsigned num_special;
|
{
|
||||||
|
struct retro_subsystem_info *data;
|
||||||
|
unsigned size;
|
||||||
|
} subsystem;
|
||||||
|
|
||||||
struct retro_controller_info *ports;
|
struct
|
||||||
unsigned num_ports;
|
{
|
||||||
|
struct retro_controller_info *data;
|
||||||
|
unsigned size;
|
||||||
|
} ports;
|
||||||
} rarch_system_info_t;
|
} rarch_system_info_t;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user