mirror of
https://github.com/libretro/RetroArch
synced 2025-03-31 10:20:41 +00:00
rarch_system_info_t local vars should be renamed from 'system'
to 'sys_info' to avoid false positive code analysis errors
This commit is contained in:
parent
2acaa1f888
commit
cf0d0e93a6
@ -188,8 +188,8 @@ static int rcheevos_init_memory(rcheevos_locals_t* locals)
|
||||
unsigned i;
|
||||
int result;
|
||||
struct retro_memory_map mmap;
|
||||
rarch_system_info_t* system = &runloop_state_get_ptr()->system;
|
||||
rarch_memory_map_t* mmaps = &system->mmaps;
|
||||
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
||||
rarch_memory_map_t *mmaps = &sys_info->mmaps;
|
||||
struct retro_memory_descriptor *descriptors = (struct retro_memory_descriptor*)malloc(mmaps->num_descriptors * sizeof(*descriptors));
|
||||
if (!descriptors)
|
||||
return 0;
|
||||
@ -2045,11 +2045,10 @@ static void rcheevos_identify_game_callback(void* userdata)
|
||||
|
||||
static int rcheevos_get_image_path(unsigned index, char* buffer, size_t buffer_size)
|
||||
{
|
||||
rarch_system_info_t* system = &runloop_state_get_ptr()->system;
|
||||
if (!system->disk_control.cb.get_image_path)
|
||||
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
||||
if (!sys_info->disk_control.cb.get_image_path)
|
||||
return 0;
|
||||
|
||||
return system->disk_control.cb.get_image_path(index, buffer, buffer_size);
|
||||
return sys_info->disk_control.cb.get_image_path(index, buffer, buffer_size);
|
||||
}
|
||||
|
||||
static bool rcheevos_identify_game(const struct retro_game_info* info)
|
||||
|
@ -155,39 +155,37 @@ bool init_location(
|
||||
{
|
||||
location_driver_state_t
|
||||
*location_st = &location_driver_st;
|
||||
rarch_system_info_t *system = (rarch_system_info_t*)data;
|
||||
|
||||
/* Resource leaks will follow if location
|
||||
interface is initialized twice. */
|
||||
if (location_st->data)
|
||||
return true;
|
||||
|
||||
if (!location_st->data)
|
||||
{
|
||||
rarch_system_info_t *sys_info = (rarch_system_info_t*)data;
|
||||
location_driver_find_driver(settings,
|
||||
"location driver", verbosity_enabled);
|
||||
|
||||
location_st->data = location_st->driver->init();
|
||||
|
||||
if (!location_st->data)
|
||||
if (!(location_st->data = location_st->driver->init()))
|
||||
{
|
||||
RARCH_ERR("Failed to initialize location driver. Will continue without location.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (system->location_cb.initialized)
|
||||
system->location_cb.initialized();
|
||||
if (sys_info->location_cb.initialized)
|
||||
sys_info->location_cb.initialized();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void uninit_location(void *data)
|
||||
{
|
||||
location_driver_state_t
|
||||
*location_st = &location_driver_st;
|
||||
rarch_system_info_t *system = (rarch_system_info_t*)data;
|
||||
location_driver_state_t *location_st = &location_driver_st;
|
||||
|
||||
if (location_st->data && location_st->driver)
|
||||
{
|
||||
if (system->location_cb.deinitialized)
|
||||
system->location_cb.deinitialized();
|
||||
rarch_system_info_t *sys_info = (rarch_system_info_t*)data;
|
||||
if (sys_info->location_cb.deinitialized)
|
||||
sys_info->location_cb.deinitialized();
|
||||
|
||||
if (location_st->driver->free)
|
||||
location_st->driver->free(location_st->data);
|
||||
|
@ -72,12 +72,8 @@ static int action_start_audio_mixer_stream_volume(
|
||||
unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
unsigned offset = (type - MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_VOLUME_BEGIN);
|
||||
|
||||
if (offset >= AUDIO_MIXER_MAX_STREAMS)
|
||||
return 0;
|
||||
|
||||
if (offset < AUDIO_MIXER_MAX_STREAMS)
|
||||
audio_driver_mixer_set_stream_volume(offset, 1.0f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@ -90,11 +86,11 @@ static int action_start_remap_file_info(
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *directory_input_remapping = settings ?
|
||||
settings->paths.directory_input_remapping : NULL;
|
||||
rarch_system_info_t *system = &runloop_state_get_ptr()->system;
|
||||
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
||||
|
||||
input_remapping_deinit(false);
|
||||
input_remapping_set_defaults(false);
|
||||
config_load_remap(directory_input_remapping, system);
|
||||
config_load_remap(directory_input_remapping, sys_info);
|
||||
|
||||
/* Refresh menu */
|
||||
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
|
||||
@ -108,8 +104,8 @@ static int action_start_override_file_info(
|
||||
unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
struct menu_state *menu_st = menu_state_get_ptr();
|
||||
rarch_system_info_t *system = &runloop_state_get_ptr()->system;
|
||||
config_load_override(system);
|
||||
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
||||
config_load_override(sys_info);
|
||||
/* Refresh menu */
|
||||
menu_st->flags |= MENU_ST_FLAG_ENTRIES_NEED_REFRESH
|
||||
| MENU_ST_FLAG_PREVENT_POPULATE;
|
||||
@ -244,32 +240,29 @@ static int action_start_input_desc(
|
||||
const char *path, const char *label,
|
||||
unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
unsigned user_idx;
|
||||
unsigned btn_idx;
|
||||
unsigned mapped_port;
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = &runloop_state_get_ptr()->system;
|
||||
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
||||
|
||||
if (!settings || !system)
|
||||
return 0;
|
||||
if (settings && sys_info)
|
||||
{
|
||||
unsigned user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8);
|
||||
unsigned btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) - (RARCH_FIRST_CUSTOM_BIND + 8) * user_idx;
|
||||
unsigned mapped_port = settings->uints.input_remap_ports[user_idx];
|
||||
|
||||
user_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) / (RARCH_FIRST_CUSTOM_BIND + 8);
|
||||
btn_idx = (type - MENU_SETTINGS_INPUT_DESC_BEGIN) - (RARCH_FIRST_CUSTOM_BIND + 8) * user_idx;
|
||||
mapped_port = settings->uints.input_remap_ports[user_idx];
|
||||
|
||||
if ((user_idx >= MAX_USERS) ||
|
||||
(mapped_port >= MAX_USERS) ||
|
||||
(btn_idx >= RARCH_CUSTOM_BIND_LIST_END))
|
||||
if ( (user_idx >= MAX_USERS)
|
||||
|| (mapped_port >= MAX_USERS)
|
||||
|| (btn_idx >= RARCH_CUSTOM_BIND_LIST_END))
|
||||
return 0;
|
||||
|
||||
/* Check whether core has defined this input */
|
||||
if (!string_is_empty(system->input_desc_btn[mapped_port][btn_idx]))
|
||||
if (!string_is_empty(sys_info->input_desc_btn[mapped_port][btn_idx]))
|
||||
{
|
||||
const struct retro_keybind *keyptr = &input_config_binds[user_idx][btn_idx];
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx] = keyptr->id;
|
||||
}
|
||||
else
|
||||
settings->uints.input_remap_ids[user_idx][btn_idx] = RARCH_UNMAPPED;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -279,22 +272,18 @@ static int action_start_input_desc_kbd(
|
||||
unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned user_idx;
|
||||
unsigned btn_idx;
|
||||
|
||||
(void)label;
|
||||
|
||||
if (!settings)
|
||||
return 0;
|
||||
|
||||
user_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) / RARCH_ANALOG_BIND_LIST_END;
|
||||
btn_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) - RARCH_ANALOG_BIND_LIST_END * user_idx;
|
||||
if (settings)
|
||||
{
|
||||
unsigned user_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) / RARCH_ANALOG_BIND_LIST_END;
|
||||
unsigned btn_idx = (type - MENU_SETTINGS_INPUT_DESC_KBD_BEGIN) - RARCH_ANALOG_BIND_LIST_END * user_idx;
|
||||
|
||||
if ((user_idx >= MAX_USERS) || (btn_idx >= RARCH_CUSTOM_BIND_LIST_END))
|
||||
return 0;
|
||||
|
||||
/* By default, inputs are unmapped */
|
||||
settings->uints.input_keymapper_ids[user_idx][btn_idx] = RETROK_FIRST;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -674,10 +663,10 @@ static int action_start_core_updater_entry(
|
||||
|
||||
/* If specified core is installed, go to core
|
||||
* information menu */
|
||||
if (core_list &&
|
||||
core_updater_list_get_filename(core_list, path, &entry) &&
|
||||
!string_is_empty(entry->local_core_path) &&
|
||||
path_is_valid(entry->local_core_path))
|
||||
if ( core_list
|
||||
&& core_updater_list_get_filename(core_list, path, &entry)
|
||||
&& !string_is_empty(entry->local_core_path)
|
||||
&& path_is_valid(entry->local_core_path))
|
||||
return action_ok_push_core_information_list(
|
||||
entry->local_core_path, label, type, idx, entry_idx);
|
||||
|
||||
@ -752,16 +741,14 @@ static int action_start_core_set_standalone_exempt(
|
||||
unsigned type, size_t idx, size_t entry_idx)
|
||||
{
|
||||
const char *core_path = path;
|
||||
int ret = 0;
|
||||
|
||||
if (string_is_empty(core_path))
|
||||
return -1;
|
||||
|
||||
/* Core should not be exempt by default
|
||||
* > If it is currently 'not exempt', do nothing */
|
||||
if (!core_info_get_core_standalone_exempt(core_path))
|
||||
return ret;
|
||||
|
||||
if (core_info_get_core_standalone_exempt(core_path))
|
||||
{
|
||||
/* ...Otherwise, attempt to unset the exempt flag */
|
||||
if (!core_info_set_core_standalone_exempt(core_path, false))
|
||||
{
|
||||
@ -796,10 +783,11 @@ static int action_start_core_set_standalone_exempt(
|
||||
1, 100, true,
|
||||
NULL, MESSAGE_QUEUE_ICON_DEFAULT, MESSAGE_QUEUE_CATEGORY_INFO);
|
||||
|
||||
ret = -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int action_start_lookup_setting(
|
||||
@ -939,8 +927,8 @@ static int menu_cbs_init_bind_start_compare_type(menu_file_list_cbs_t *cbs,
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN &&
|
||||
type <= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END)
|
||||
if ( type >= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_BEGIN
|
||||
&& type <= MENU_SETTINGS_LIBRETRO_PERF_COUNTERS_END)
|
||||
{
|
||||
BIND_ACTION_START(cbs, action_start_performance_counters_core);
|
||||
}
|
||||
@ -954,13 +942,13 @@ static int menu_cbs_init_bind_start_compare_type(menu_file_list_cbs_t *cbs,
|
||||
{
|
||||
BIND_ACTION_START(cbs, action_start_input_desc_kbd);
|
||||
}
|
||||
else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN &&
|
||||
type <= MENU_SETTINGS_PERF_COUNTERS_END)
|
||||
else if (type >= MENU_SETTINGS_PERF_COUNTERS_BEGIN
|
||||
&& type <= MENU_SETTINGS_PERF_COUNTERS_END)
|
||||
{
|
||||
BIND_ACTION_START(cbs, action_start_performance_counters_frontend);
|
||||
}
|
||||
else if ((type >= MENU_SETTINGS_CORE_OPTION_START) &&
|
||||
(type < MENU_SETTINGS_CHEEVOS_START))
|
||||
else if ( (type >= MENU_SETTINGS_CORE_OPTION_START)
|
||||
&& (type < MENU_SETTINGS_CHEEVOS_START))
|
||||
{
|
||||
BIND_ACTION_START(cbs, action_start_core_setting);
|
||||
}
|
||||
|
@ -1401,11 +1401,11 @@ static int action_bind_sublabel_subsystem_add(
|
||||
{
|
||||
const struct retro_subsystem_info *subsystem = NULL;
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
rarch_system_info_t *system = &runloop_st->system;
|
||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||
|
||||
/* Core fully loaded, use the subsystem data */
|
||||
if (system->subsystem.data)
|
||||
subsystem = system->subsystem.data + (type - MENU_SETTINGS_SUBSYSTEM_ADD);
|
||||
if (sys_info->subsystem.data)
|
||||
subsystem = sys_info->subsystem.data + (type - MENU_SETTINGS_SUBSYSTEM_ADD);
|
||||
/* Core not loaded completely, use the data we peeked on load core */
|
||||
else
|
||||
subsystem = runloop_st->subsystem_data + (type - MENU_SETTINGS_SUBSYSTEM_ADD);
|
||||
@ -1542,22 +1542,19 @@ static int action_bind_sublabel_remap_sublabel(
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
size_t _len;
|
||||
settings_t *settings = config_get_ptr();
|
||||
unsigned port = (type - MENU_SETTINGS_INPUT_DESC_BEGIN)
|
||||
/ (RARCH_FIRST_CUSTOM_BIND + 8);
|
||||
|
||||
if (!settings || (port >= MAX_USERS))
|
||||
return 0;
|
||||
|
||||
if (settings && (port < MAX_USERS))
|
||||
{
|
||||
/* Device name is set per-port
|
||||
* If the user changes the device index for
|
||||
* a port, then we are effectively changing
|
||||
* the port to which the corresponding
|
||||
* controller is connected... */
|
||||
size_t _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PORT), len);
|
||||
port = settings->uints.input_joypad_index[port];
|
||||
_len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PORT), len);
|
||||
|
||||
snprintf(s + _len, len - _len, " %u: %s",
|
||||
port + 1,
|
||||
input_config_get_device_display_name(port)
|
||||
@ -1565,6 +1562,7 @@ static int action_bind_sublabel_remap_sublabel(
|
||||
: (input_config_get_device_name(port)
|
||||
? input_config_get_device_name(port)
|
||||
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE)));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1587,11 +1585,11 @@ static int action_bind_sublabel_input_remap_port(
|
||||
* This is difficult to obtain here - the only
|
||||
* way to get it is to parse the entry label
|
||||
* (input_remap_port_p<port_index+1>) */
|
||||
if (string_is_empty(entry.label) ||
|
||||
(sscanf(entry.label,
|
||||
if ( string_is_empty(entry.label)
|
||||
|| (sscanf(entry.label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_INPUT_REMAP_PORT),
|
||||
&display_port) != 1) ||
|
||||
(display_port >= MAX_USERS + 1))
|
||||
&display_port) != 1)
|
||||
|| (display_port >= MAX_USERS + 1))
|
||||
return 0;
|
||||
|
||||
snprintf(s, len,
|
||||
@ -1980,15 +1978,15 @@ static int action_bind_sublabel_core_updater_entry(
|
||||
const char *label, const char *path,
|
||||
char *s, size_t len)
|
||||
{
|
||||
size_t _len;
|
||||
core_updater_list_t *core_list = core_updater_list_get_cached();
|
||||
const core_updater_list_entry_t *entry = NULL;
|
||||
|
||||
/* Search for specified core */
|
||||
if (core_list &&
|
||||
core_updater_list_get_filename(core_list, path, &entry) &&
|
||||
entry->licenses_list)
|
||||
if ( core_list
|
||||
&& core_updater_list_get_filename(core_list, path, &entry)
|
||||
&& entry->licenses_list)
|
||||
{
|
||||
size_t _len;
|
||||
char tmp[MENU_SUBLABEL_MAX_LENGTH];
|
||||
tmp[0] = '\0';
|
||||
/* Add license text */
|
||||
@ -2004,7 +2002,7 @@ static int action_bind_sublabel_core_updater_entry(
|
||||
else
|
||||
{
|
||||
/* No license found - set to N/A */
|
||||
_len = strlcpy(s,
|
||||
size_t _len = strlcpy(s,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_INFO_LICENSES), len);
|
||||
s[ _len] = ':';
|
||||
s[++_len] = ' ';
|
||||
@ -2028,7 +2026,7 @@ static int action_bind_sublabel_core_backup_entry(
|
||||
/* Set sublabel prefix */
|
||||
size_t _len = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_BACKUP_CRC), len);
|
||||
|
||||
/* Add crc string */
|
||||
/* Add CRC string */
|
||||
if (string_is_empty(crc))
|
||||
{
|
||||
s[ _len] = '0';
|
||||
|
@ -7916,7 +7916,6 @@ static int xmb_list_push(void *data, void *userdata,
|
||||
break;
|
||||
case DISPLAYLIST_MAIN_MENU:
|
||||
{
|
||||
rarch_system_info_t *system = &runloop_state_get_ptr()->system;
|
||||
uint32_t flags = runloop_get_flags();
|
||||
|
||||
menu_entries_clear(info->list);
|
||||
@ -7934,7 +7933,8 @@ static int xmb_list_push(void *data, void *userdata,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (system && system->load_no_content)
|
||||
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
||||
if (sys_info && sys_info->load_no_content)
|
||||
{
|
||||
MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(
|
||||
info->list,
|
||||
|
@ -6467,14 +6467,14 @@ unsigned menu_displaylist_build_list(
|
||||
{
|
||||
case DISPLAYLIST_OPTIONS_OVERRIDES:
|
||||
{
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
rarch_system_info_t *system = &runloop_st->system;
|
||||
|
||||
const char *rarch_path_basename = path_get(RARCH_PATH_BASENAME);
|
||||
const char *core_name = system ? system->info.library_name : NULL;
|
||||
char config_directory[PATH_MAX_LENGTH];
|
||||
char content_dir_name[PATH_MAX_LENGTH];
|
||||
char override_path[PATH_MAX_LENGTH];
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||
|
||||
const char *rarch_path_basename = path_get(RARCH_PATH_BASENAME);
|
||||
const char *core_name = sys_info ? sys_info->info.library_name : NULL;
|
||||
bool has_content = !string_is_empty(path_get(RARCH_PATH_CONTENT));
|
||||
bool core_override_remove = false;
|
||||
bool content_dir_override_remove = false;
|
||||
|
@ -422,7 +422,7 @@ static bool secondary_core_create(runloop_state_t *runloop_st,
|
||||
{
|
||||
const enum rarch_core_type
|
||||
last_core_type = runloop_st->last_core_type;
|
||||
rarch_system_info_t *info = &runloop_st->system;
|
||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||
unsigned num_active_users = settings->uints.input_max_users;
|
||||
uint8_t flags = content_get_flags();
|
||||
|
||||
@ -504,12 +504,12 @@ static bool secondary_core_create(runloop_state_t *runloop_st,
|
||||
runloop_st->secondary_core.retro_set_input_poll(
|
||||
runloop_st->secondary_callbacks.poll_cb);
|
||||
|
||||
if (info)
|
||||
if (sys_info)
|
||||
{
|
||||
int port;
|
||||
ssize_t port;
|
||||
for (port = 0; port < MAX_USERS; port++)
|
||||
{
|
||||
if (port < (int)info->ports.size)
|
||||
if (port < sys_info->ports.size)
|
||||
{
|
||||
unsigned device = (port < (int)num_active_users) ?
|
||||
runloop_st->port_map[port] : RETRO_DEVICE_NONE;
|
||||
|
134
runloop.c
134
runloop.c
@ -1418,7 +1418,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
runloop_state_t *runloop_st = &runloop_state;
|
||||
recording_state_t *recording_st = recording_state_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
rarch_system_info_t *system = &runloop_st->system;
|
||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||
bool ignore_environment_cb = runloop_st->flags &
|
||||
RUNLOOP_FLAG_IGNORE_ENVIRONMENT_CB;
|
||||
|
||||
@ -1914,14 +1914,14 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
bool video_allow_rotate = settings->bools.video_allow_rotate;
|
||||
|
||||
RARCH_LOG("[Environ]: SET_ROTATION: %u\n", rotation);
|
||||
if (system)
|
||||
system->core_requested_rotation = rotation;
|
||||
if (sys_info)
|
||||
sys_info->core_requested_rotation = rotation;
|
||||
|
||||
if (!video_allow_rotate)
|
||||
return false;
|
||||
|
||||
if (system)
|
||||
system->rotation = rotation;
|
||||
if (sys_info)
|
||||
sys_info->rotation = rotation;
|
||||
|
||||
if (!video_driver_set_rotation(rotation))
|
||||
return false;
|
||||
@ -1961,11 +1961,11 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
}
|
||||
|
||||
case RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL:
|
||||
if (system)
|
||||
if (sys_info)
|
||||
{
|
||||
system->performance_level = *(const unsigned*)data;
|
||||
sys_info->performance_level = *(const unsigned*)data;
|
||||
RARCH_LOG("[Environ]: PERFORMANCE_LEVEL: %u.\n",
|
||||
system->performance_level);
|
||||
sys_info->performance_level);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2062,12 +2062,12 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
"L", "R", "L2", "R2", "L3", "R3",
|
||||
};
|
||||
|
||||
if (system)
|
||||
if (sys_info)
|
||||
{
|
||||
unsigned retro_id;
|
||||
const struct retro_input_descriptor *desc = NULL;
|
||||
memset((void*)&system->input_desc_btn, 0,
|
||||
sizeof(system->input_desc_btn));
|
||||
memset((void*)&sys_info->input_desc_btn, 0,
|
||||
sizeof(sys_info->input_desc_btn));
|
||||
|
||||
desc = (const struct retro_input_descriptor*)data;
|
||||
|
||||
@ -2086,7 +2086,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
switch (desc->device)
|
||||
{
|
||||
case RETRO_DEVICE_JOYPAD:
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[retro_id] = desc->description;
|
||||
break;
|
||||
case RETRO_DEVICE_ANALOG:
|
||||
@ -2096,15 +2096,15 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
switch (desc->index)
|
||||
{
|
||||
case RETRO_DEVICE_INDEX_ANALOG_LEFT:
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[RARCH_ANALOG_LEFT_X_PLUS] = desc->description;
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[RARCH_ANALOG_LEFT_X_MINUS] = desc->description;
|
||||
break;
|
||||
case RETRO_DEVICE_INDEX_ANALOG_RIGHT:
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[RARCH_ANALOG_RIGHT_X_PLUS] = desc->description;
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[RARCH_ANALOG_RIGHT_X_MINUS] = desc->description;
|
||||
break;
|
||||
}
|
||||
@ -2113,15 +2113,15 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
switch (desc->index)
|
||||
{
|
||||
case RETRO_DEVICE_INDEX_ANALOG_LEFT:
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[RARCH_ANALOG_LEFT_Y_PLUS] = desc->description;
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[RARCH_ANALOG_LEFT_Y_MINUS] = desc->description;
|
||||
break;
|
||||
case RETRO_DEVICE_INDEX_ANALOG_RIGHT:
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[RARCH_ANALOG_RIGHT_Y_PLUS] = desc->description;
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[RARCH_ANALOG_RIGHT_Y_MINUS] = desc->description;
|
||||
break;
|
||||
}
|
||||
@ -2130,7 +2130,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
switch (desc->index)
|
||||
{
|
||||
case RETRO_DEVICE_INDEX_ANALOG_BUTTON:
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[retro_id] = desc->description;
|
||||
break;
|
||||
}
|
||||
@ -2139,7 +2139,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
switch (desc->index)
|
||||
{
|
||||
case RETRO_DEVICE_INDEX_ANALOG_BUTTON:
|
||||
system->input_desc_btn[retro_port]
|
||||
sys_info->input_desc_btn[retro_port]
|
||||
[retro_id] = desc->description;
|
||||
break;
|
||||
}
|
||||
@ -2164,7 +2164,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
|
||||
for (retro_id = 0; retro_id < RARCH_FIRST_CUSTOM_BIND; retro_id++)
|
||||
{
|
||||
const char *description = system->input_desc_btn[mapped_port][retro_id];
|
||||
const char *description = sys_info->input_desc_btn[mapped_port][retro_id];
|
||||
|
||||
if (!description)
|
||||
continue;
|
||||
@ -2217,10 +2217,10 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
const struct retro_disk_control_callback *control_cb =
|
||||
(const struct retro_disk_control_callback*)data;
|
||||
|
||||
if (system)
|
||||
if (sys_info)
|
||||
{
|
||||
RARCH_LOG("[Environ]: SET_DISK_CONTROL_INTERFACE.\n");
|
||||
disk_control_set_callback(&system->disk_control, control_cb);
|
||||
disk_control_set_callback(&sys_info->disk_control, control_cb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2230,10 +2230,10 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
const struct retro_disk_control_ext_callback *control_cb =
|
||||
(const struct retro_disk_control_ext_callback*)data;
|
||||
|
||||
if (system)
|
||||
if (sys_info)
|
||||
{
|
||||
RARCH_LOG("[Environ]: SET_DISK_CONTROL_EXT_INTERFACE.\n");
|
||||
disk_control_set_ext_callback(&system->disk_control, control_cb);
|
||||
disk_control_set_ext_callback(&sys_info->disk_control, control_cb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2578,8 +2578,8 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
cb->get_position = driver_location_get_position;
|
||||
cb->set_interval = driver_location_set_interval;
|
||||
|
||||
if (system)
|
||||
system->location_cb = *cb;
|
||||
if (sys_info)
|
||||
sys_info->location_cb = *cb;
|
||||
|
||||
location_st->active = false;
|
||||
break;
|
||||
@ -2753,12 +2753,12 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
if (system)
|
||||
if (sys_info)
|
||||
{
|
||||
struct retro_subsystem_info *info_ptr = NULL;
|
||||
free(system->subsystem.data);
|
||||
system->subsystem.data = NULL;
|
||||
system->subsystem.size = 0;
|
||||
free(sys_info->subsystem.data);
|
||||
sys_info->subsystem.data = NULL;
|
||||
sys_info->subsystem.size = 0;
|
||||
|
||||
info_ptr = (struct retro_subsystem_info*)
|
||||
malloc(i * sizeof(*info_ptr));
|
||||
@ -2766,11 +2766,11 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
if (!info_ptr)
|
||||
return false;
|
||||
|
||||
system->subsystem.data = info_ptr;
|
||||
sys_info->subsystem.data = info_ptr;
|
||||
|
||||
memcpy(system->subsystem.data, info,
|
||||
i * sizeof(*system->subsystem.data));
|
||||
system->subsystem.size = i;
|
||||
memcpy(sys_info->subsystem.data, info,
|
||||
i * sizeof(*sys_info->subsystem.data));
|
||||
sys_info->subsystem.size = i;
|
||||
runloop_st->current_core.flags |=
|
||||
RETRO_CORE_FLAG_HAS_SET_SUBSYSTEMS;
|
||||
}
|
||||
@ -2798,29 +2798,29 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
info[i].types[j].id);
|
||||
}
|
||||
|
||||
if (system)
|
||||
if (sys_info)
|
||||
{
|
||||
struct retro_controller_info *info_ptr = NULL;
|
||||
|
||||
free(system->ports.data);
|
||||
system->ports.data = NULL;
|
||||
system->ports.size = 0;
|
||||
free(sys_info->ports.data);
|
||||
sys_info->ports.data = NULL;
|
||||
sys_info->ports.size = 0;
|
||||
|
||||
info_ptr = (struct retro_controller_info*)calloc(i, sizeof(*info_ptr));
|
||||
if (!info_ptr)
|
||||
if (!(info_ptr = (struct retro_controller_info*)
|
||||
calloc(i, sizeof(*info_ptr))))
|
||||
return false;
|
||||
|
||||
system->ports.data = info_ptr;
|
||||
memcpy(system->ports.data, info,
|
||||
i * sizeof(*system->ports.data));
|
||||
system->ports.size = i;
|
||||
sys_info->ports.data = info_ptr;
|
||||
memcpy(sys_info->ports.data, info,
|
||||
i * sizeof(*sys_info->ports.data));
|
||||
sys_info->ports.size = i;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case RETRO_ENVIRONMENT_SET_MEMORY_MAPS:
|
||||
{
|
||||
if (system)
|
||||
if (sys_info)
|
||||
{
|
||||
unsigned i;
|
||||
const struct retro_memory_map *mmaps =
|
||||
@ -2830,20 +2830,19 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
|
||||
RARCH_LOG("[Environ]: SET_MEMORY_MAPS.\n");
|
||||
|
||||
free((void*)system->mmaps.descriptors);
|
||||
system->mmaps.descriptors = 0;
|
||||
system->mmaps.num_descriptors = 0;
|
||||
descriptors = (rarch_memory_descriptor_t*)calloc(mmaps->num_descriptors,
|
||||
sizeof(*descriptors));
|
||||
free((void*)sys_info->mmaps.descriptors);
|
||||
sys_info->mmaps.descriptors = 0;
|
||||
sys_info->mmaps.num_descriptors = 0;
|
||||
|
||||
if (!descriptors)
|
||||
if (!(descriptors = (rarch_memory_descriptor_t*)calloc(mmaps->num_descriptors,
|
||||
sizeof(*descriptors))))
|
||||
return false;
|
||||
|
||||
system->mmaps.descriptors = descriptors;
|
||||
system->mmaps.num_descriptors = mmaps->num_descriptors;
|
||||
sys_info->mmaps.descriptors = descriptors;
|
||||
sys_info->mmaps.num_descriptors = mmaps->num_descriptors;
|
||||
|
||||
for (i = 0; i < mmaps->num_descriptors; i++)
|
||||
system->mmaps.descriptors[i].core = mmaps->descriptors[i];
|
||||
sys_info->mmaps.descriptors[i].core = mmaps->descriptors[i];
|
||||
|
||||
mmap_preprocess_descriptors(descriptors, mmaps->num_descriptors);
|
||||
|
||||
@ -2866,11 +2865,11 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
else
|
||||
RARCH_DBG(" ndx flags ptr offset start select disconn len addrspace\n");
|
||||
|
||||
for (i = 0; i < system->mmaps.num_descriptors; i++)
|
||||
for (i = 0; i < sys_info->mmaps.num_descriptors; i++)
|
||||
{
|
||||
const rarch_memory_descriptor_t *desc =
|
||||
&system->mmaps.descriptors[i];
|
||||
char flags[7];
|
||||
const rarch_memory_descriptor_t *desc =
|
||||
&sys_info->mmaps.descriptors[i];
|
||||
|
||||
flags[0] = 'M';
|
||||
if ( (desc->core.flags & RETRO_MEMDESC_MINSIZE_8) == RETRO_MEMDESC_MINSIZE_8)
|
||||
@ -3060,7 +3059,7 @@ bool runloop_environment_cb(unsigned cmd, void *data)
|
||||
|
||||
vfs_iface_info->required_interface_version = supported_vfs_version;
|
||||
vfs_iface_info->iface = &vfs_iface;
|
||||
system->supports_vfs = true;
|
||||
sys_info->supports_vfs = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4054,23 +4053,24 @@ static bool runloop_path_init_subsystem(runloop_state_t *runloop_st)
|
||||
{
|
||||
unsigned i, j;
|
||||
const struct retro_subsystem_info *info = NULL;
|
||||
rarch_system_info_t *system = &runloop_st->system;
|
||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||
bool subsystem_path_empty = path_is_empty(RARCH_PATH_SUBSYSTEM);
|
||||
const char *savefile_dir = runloop_st->savefile_dir;
|
||||
|
||||
if (!system || subsystem_path_empty)
|
||||
if (!sys_info || subsystem_path_empty)
|
||||
return false;
|
||||
|
||||
/* For subsystems, we know exactly which RAM types are supported. */
|
||||
/* We'll handle this error gracefully later. */
|
||||
if ((info = libretro_find_subsystem_info(
|
||||
system->subsystem.data,
|
||||
system->subsystem.size,
|
||||
sys_info->subsystem.data,
|
||||
sys_info->subsystem.size,
|
||||
path_get(RARCH_PATH_SUBSYSTEM))))
|
||||
{
|
||||
unsigned num_content = MIN(info->num_roms,
|
||||
subsystem_path_empty ?
|
||||
0 : (unsigned)runloop_st->subsystem_fullpaths->size);
|
||||
subsystem_path_empty
|
||||
? 0
|
||||
: (unsigned)runloop_st->subsystem_fullpaths->size);
|
||||
|
||||
for (i = 0; i < num_content; i++)
|
||||
{
|
||||
|
@ -2768,11 +2768,11 @@ void content_set_subsystem(unsigned idx)
|
||||
const struct retro_subsystem_info *subsystem = NULL;
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
content_state_t *p_content = content_state_get_ptr();
|
||||
rarch_system_info_t *system = &runloop_st->system;
|
||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||
|
||||
/* Core fully loaded, use the subsystem data */
|
||||
if (system->subsystem.data)
|
||||
subsystem = system->subsystem.data + idx;
|
||||
if (sys_info->subsystem.data)
|
||||
subsystem = sys_info->subsystem.data + idx;
|
||||
/* Core not loaded completely, use the data we peeked on load core */
|
||||
else
|
||||
subsystem = runloop_st->subsystem_data + idx;
|
||||
@ -2798,15 +2798,15 @@ void content_set_subsystem(unsigned idx)
|
||||
bool content_set_subsystem_by_name(const char* subsystem_name)
|
||||
{
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
rarch_system_info_t *system = &runloop_st->system;
|
||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||
unsigned i = 0;
|
||||
/* Core not loaded completely, use the data we peeked on load core */
|
||||
const struct retro_subsystem_info
|
||||
*subsystem = runloop_st->subsystem_data;
|
||||
|
||||
/* Core fully loaded, use the subsystem data */
|
||||
if (system->subsystem.data)
|
||||
subsystem = system->subsystem.data;
|
||||
if (sys_info->subsystem.data)
|
||||
subsystem = sys_info->subsystem.data;
|
||||
|
||||
for (i = 0; i < runloop_st->subsystem_current_count; i++, subsystem++)
|
||||
{
|
||||
@ -2824,13 +2824,13 @@ void content_get_subsystem_friendly_name(const char* subsystem_name, char* subsy
|
||||
{
|
||||
unsigned i = 0;
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
rarch_system_info_t *system = &runloop_st->system;
|
||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||
/* Core not loaded completely, use the data we peeked on load core */
|
||||
const struct retro_subsystem_info *subsystem = runloop_st->subsystem_data;
|
||||
|
||||
/* Core fully loaded, use the subsystem data */
|
||||
if (system->subsystem.data)
|
||||
subsystem = system->subsystem.data;
|
||||
if (sys_info->subsystem.data)
|
||||
subsystem = sys_info->subsystem.data;
|
||||
|
||||
for (i = 0; i < runloop_st->subsystem_current_count; i++, subsystem++)
|
||||
{
|
||||
|
@ -134,8 +134,6 @@ static void handle_translation_cb(
|
||||
retro_task_t *task, void *task_data,
|
||||
void *user_data, const char *error)
|
||||
{
|
||||
unsigned width, height;
|
||||
unsigned image_width, image_height;
|
||||
uint8_t* raw_output_data = NULL;
|
||||
char* raw_image_file_data = NULL;
|
||||
struct scaler_ctx* scaler = NULL;
|
||||
@ -144,23 +142,20 @@ static void handle_translation_cb(
|
||||
#ifdef HAVE_AUDIOMIXER
|
||||
int new_sound_size = 0;
|
||||
#endif
|
||||
const void* dummy_data = NULL;
|
||||
void* raw_image_data = NULL;
|
||||
void* raw_image_data_alpha = NULL;
|
||||
void* raw_sound_data = NULL;
|
||||
int retval = 0;
|
||||
rjson_t *json = NULL;
|
||||
int json_current_key = 0;
|
||||
char* err_string = NULL;
|
||||
char* text_string = NULL;
|
||||
char* auto_string = NULL;
|
||||
char* key_string = NULL;
|
||||
char* err_str = NULL;
|
||||
char* txt_str = NULL;
|
||||
char* auto_str = NULL;
|
||||
char* key_str = NULL;
|
||||
settings_t* settings = config_get_ptr();
|
||||
uint32_t runloop_flags = runloop_get_flags();
|
||||
#ifdef HAVE_ACCESSIBILITY
|
||||
input_driver_state_t *input_st = input_state_get_ptr();
|
||||
#endif
|
||||
bool was_paused = runloop_flags & RUNLOOP_FLAG_PAUSED;
|
||||
video_driver_state_t
|
||||
*video_st = video_state_get_ptr();
|
||||
const enum retro_pixel_format
|
||||
@ -191,8 +186,7 @@ static void handle_translation_cb(
|
||||
if (!data || error || !data->data)
|
||||
goto finish;
|
||||
|
||||
json = rjson_open_buffer(data->data, data->len);
|
||||
if (!json)
|
||||
if (!(json = rjson_open_buffer(data->data, data->len)))
|
||||
goto finish;
|
||||
|
||||
/* Parse JSON body for the image and sound data */
|
||||
@ -241,36 +235,35 @@ static void handle_translation_cb(
|
||||
break;
|
||||
#endif
|
||||
case 2: /* text */
|
||||
text_string = strdup(str);
|
||||
txt_str = strdup(str);
|
||||
break;
|
||||
case 3: /* error */
|
||||
err_string = strdup(str);
|
||||
err_str = strdup(str);
|
||||
break;
|
||||
case 4: /* auto */
|
||||
auto_string = strdup(str);
|
||||
auto_str = strdup(str);
|
||||
break;
|
||||
case 5: /* press */
|
||||
key_string = strdup(str);
|
||||
key_str = strdup(str);
|
||||
break;
|
||||
}
|
||||
json_current_key = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (string_is_equal(err_string, "No text found."))
|
||||
if (string_is_equal(err_str, "No text found."))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
RARCH_LOG("No text found...\n");
|
||||
#endif
|
||||
if (text_string)
|
||||
if (txt_str)
|
||||
{
|
||||
free(text_string);
|
||||
text_string = NULL;
|
||||
free(txt_str);
|
||||
txt_str = NULL;
|
||||
}
|
||||
|
||||
text_string = (char*)malloc(15);
|
||||
|
||||
strlcpy(text_string, err_string, 15);
|
||||
txt_str = (char*)malloc(15);
|
||||
strlcpy(txt_str, err_str, 15);
|
||||
#ifdef HAVE_GFX_WIDGETS
|
||||
if (gfx_widgets_paused)
|
||||
{
|
||||
@ -283,9 +276,9 @@ static void handle_translation_cb(
|
||||
|
||||
if ( !raw_image_file_data
|
||||
&& !raw_sound_data
|
||||
&& !text_string
|
||||
&& (access_st->ai_service_auto != 2)
|
||||
&& !key_string)
|
||||
&& !txt_str
|
||||
&& !key_str
|
||||
&& (access_st->ai_service_auto != 2))
|
||||
{
|
||||
error = "Invalid JSON body.";
|
||||
goto finish;
|
||||
@ -293,10 +286,11 @@ static void handle_translation_cb(
|
||||
|
||||
if (raw_image_file_data)
|
||||
{
|
||||
unsigned image_width, image_height;
|
||||
/* Get the video frame dimensions reference */
|
||||
dummy_data = video_st->frame_cache_data;
|
||||
width = video_st->frame_cache_width;
|
||||
height = video_st->frame_cache_height;
|
||||
const void *dummy_data = video_st->frame_cache_data;
|
||||
unsigned width = video_st->frame_cache_width;
|
||||
unsigned height = video_st->frame_cache_height;
|
||||
|
||||
/* try two different modes for text display *
|
||||
* In the first mode, we use display widget overlays, but they require
|
||||
@ -309,7 +303,6 @@ static void handle_translation_cb(
|
||||
&& video_st->poke->load_texture
|
||||
&& video_st->poke->unload_texture)
|
||||
{
|
||||
bool ai_res;
|
||||
enum image_type_enum image_type;
|
||||
/* Write to overlay */
|
||||
if ( raw_image_file_data[0] == 'B'
|
||||
@ -325,11 +318,9 @@ static void handle_translation_cb(
|
||||
goto finish;
|
||||
}
|
||||
|
||||
ai_res = gfx_widgets_ai_service_overlay_load(
|
||||
if (!gfx_widgets_ai_service_overlay_load(
|
||||
raw_image_file_data, (unsigned)new_image_size,
|
||||
image_type);
|
||||
|
||||
if (!ai_res)
|
||||
image_type))
|
||||
{
|
||||
RARCH_LOG("Video driver not supported for AI Service.");
|
||||
runloop_msg_queue_push(
|
||||
@ -352,9 +343,11 @@ static void handle_translation_cb(
|
||||
{
|
||||
size_t pitch;
|
||||
/* Write to video buffer directly (software cores only) */
|
||||
if (raw_image_file_data[0] == 'B' && raw_image_file_data[1] == 'M')
|
||||
{
|
||||
|
||||
/* This is a BMP file coming back. */
|
||||
if ( raw_image_file_data[0] == 'B'
|
||||
&& raw_image_file_data[1] == 'M')
|
||||
{
|
||||
/* Get image data (24 bit), and convert to the emulated pixel format */
|
||||
image_width =
|
||||
((uint32_t) ((uint8_t)raw_image_file_data[21]) << 24) +
|
||||
@ -372,11 +365,13 @@ static void handle_translation_cb(
|
||||
raw_image_file_data + 54 * sizeof(uint8_t),
|
||||
image_width * image_height * 3 * sizeof(uint8_t));
|
||||
}
|
||||
else if (raw_image_file_data[1] == 'P' && raw_image_file_data[2] == 'N' &&
|
||||
raw_image_file_data[3] == 'G')
|
||||
{
|
||||
rpng_t *rpng = NULL;
|
||||
/* PNG coming back from the url */
|
||||
else if (raw_image_file_data[1] == 'P'
|
||||
&& raw_image_file_data[2] == 'N'
|
||||
&& raw_image_file_data[3] == 'G')
|
||||
{
|
||||
int retval = 0;
|
||||
rpng_t *rpng = NULL;
|
||||
image_width =
|
||||
((uint32_t) ((uint8_t)raw_image_file_data[16]) << 24)+
|
||||
((uint32_t) ((uint8_t)raw_image_file_data[17]) << 16)+
|
||||
@ -387,9 +382,8 @@ static void handle_translation_cb(
|
||||
((uint32_t) ((uint8_t)raw_image_file_data[21]) << 16)+
|
||||
((uint32_t) ((uint8_t)raw_image_file_data[22]) << 8)+
|
||||
((uint32_t) ((uint8_t)raw_image_file_data[23]) << 0);
|
||||
rpng = rpng_alloc();
|
||||
|
||||
if (!rpng)
|
||||
if (!(rpng = rpng_alloc()))
|
||||
{
|
||||
error = "Can't allocate memory.";
|
||||
goto finish;
|
||||
@ -410,15 +404,15 @@ static void handle_translation_cb(
|
||||
* probably be replaced with a scaler call.*/
|
||||
{
|
||||
unsigned ui;
|
||||
int d,tw,th,tc;
|
||||
d=0;
|
||||
int tw, th, tc;
|
||||
int d = 0;
|
||||
raw_image_data = (void*)malloc(image_width*image_height*3*sizeof(uint8_t));
|
||||
for (ui = 0; ui < image_width * image_height * 4; ui++)
|
||||
{
|
||||
if (ui % 4 != 3)
|
||||
{
|
||||
tc = d % 3;
|
||||
th = image_height-d / (3*image_width)-1;
|
||||
th = image_height-d / (image_width * 3) - 1;
|
||||
tw = (d % (image_width * 3)) / 3;
|
||||
((uint8_t*) raw_image_data)[tw * 3 + th * 3 * image_width + tc] = ((uint8_t *)raw_image_data_alpha)[ui];
|
||||
d += 1;
|
||||
@ -512,17 +506,16 @@ static void handle_translation_cb(
|
||||
}
|
||||
#endif
|
||||
|
||||
if (key_string)
|
||||
if (key_str)
|
||||
{
|
||||
size_t i;
|
||||
char key[8];
|
||||
int length = (int)strlen(key_string);
|
||||
int i = 0;
|
||||
size_t length = strlen(key_str);
|
||||
int start = 0;
|
||||
char t = ' ';
|
||||
|
||||
for (i = 1; i < length; i++)
|
||||
{
|
||||
t = key_string[i];
|
||||
char t = key_str[i];
|
||||
if (i == length - 1 || t == ' ' || t == ',')
|
||||
{
|
||||
if (i == length - 1 && t != ' ' && t!= ',')
|
||||
@ -534,7 +527,7 @@ static void handle_translation_cb(
|
||||
continue;
|
||||
}
|
||||
|
||||
strncpy(key, key_string+start, i-start);
|
||||
strncpy(key, key_str + start, i-start);
|
||||
key[i-start] = '\0';
|
||||
|
||||
#ifdef HAVE_ACCESSIBILITY
|
||||
@ -586,14 +579,14 @@ static void handle_translation_cb(
|
||||
}
|
||||
|
||||
#ifdef HAVE_ACCESSIBILITY
|
||||
if ( text_string
|
||||
if ( txt_str
|
||||
&& is_accessibility_enabled(
|
||||
accessibility_enable,
|
||||
access_st->enabled))
|
||||
accessibility_speak_priority(
|
||||
accessibility_enable,
|
||||
accessibility_narrator_speech_speed,
|
||||
text_string, 10);
|
||||
txt_str, 10);
|
||||
#endif
|
||||
|
||||
finish:
|
||||
@ -613,23 +606,26 @@ finish:
|
||||
free(raw_image_data);
|
||||
if (scaler)
|
||||
free(scaler);
|
||||
if (err_string)
|
||||
free(err_string);
|
||||
if (text_string)
|
||||
free(text_string);
|
||||
if (err_str)
|
||||
free(err_str);
|
||||
if (txt_str)
|
||||
free(txt_str);
|
||||
if (raw_output_data)
|
||||
free(raw_output_data);
|
||||
|
||||
if (string_is_equal(auto_string, "auto"))
|
||||
if (auto_str)
|
||||
{
|
||||
if (string_is_equal(auto_str, "auto"))
|
||||
{
|
||||
bool was_paused = runloop_flags & RUNLOOP_FLAG_PAUSED;
|
||||
if ( (access_st->ai_service_auto != 0)
|
||||
&& !settings->bools.ai_service_pause)
|
||||
call_auto_translate_task(settings, &was_paused);
|
||||
}
|
||||
if (auto_string)
|
||||
free(auto_string);
|
||||
if (key_string)
|
||||
free(key_string);
|
||||
free(auto_str);
|
||||
}
|
||||
if (key_str)
|
||||
free(key_str);
|
||||
}
|
||||
|
||||
static const char *ai_service_get_str(enum translation_lang id)
|
||||
@ -790,21 +786,15 @@ bool run_translation_service(settings_t *settings, bool paused)
|
||||
char *bmp64_buffer = NULL;
|
||||
rjsonwriter_t *jsonwriter = NULL;
|
||||
const char *json_buffer = NULL;
|
||||
|
||||
int bmp64_length = 0;
|
||||
bool TRANSLATE_USE_BMP = false;
|
||||
|
||||
const char *label = NULL;
|
||||
char* system_label = NULL;
|
||||
char *sys_lbl = NULL;
|
||||
core_info_t *core_info = NULL;
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
const enum retro_pixel_format
|
||||
video_driver_pix_fmt = video_st->pix_fmt;
|
||||
access_state_t *access_st = access_state_get_ptr();
|
||||
#ifdef HAVE_ACCESSIBILITY
|
||||
input_driver_state_t *input_st = input_state_get_ptr();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GFX_WIDGETS
|
||||
dispgfx_widget_t *p_dispwidget = dispwidget_get_ptr();
|
||||
/* For the case when ai service pause is disabled. */
|
||||
@ -822,10 +812,11 @@ bool run_translation_service(settings_t *settings, bool paused)
|
||||
|
||||
if (core_info)
|
||||
{
|
||||
size_t label_len;
|
||||
const char *system_id = core_info->system_id
|
||||
size_t lbl_len;
|
||||
const char *lbl = NULL;
|
||||
const char *sys_id = core_info->system_id
|
||||
? core_info->system_id : "core";
|
||||
size_t system_id_len = strlen(system_id);
|
||||
size_t sys_id_len = strlen(sys_id);
|
||||
const struct playlist_entry *entry = NULL;
|
||||
playlist_t *current_playlist = playlist_get_cached();
|
||||
|
||||
@ -835,17 +826,17 @@ bool run_translation_service(settings_t *settings, bool paused)
|
||||
current_playlist, path_get(RARCH_PATH_CONTENT), &entry);
|
||||
|
||||
if (entry && !string_is_empty(entry->label))
|
||||
label = entry->label;
|
||||
lbl = entry->label;
|
||||
}
|
||||
|
||||
if (!label)
|
||||
label = path_basename(path_get(RARCH_PATH_BASENAME));
|
||||
label_len = strlen(label);
|
||||
system_label = (char*)malloc(label_len + system_id_len + 3);
|
||||
memcpy(system_label, system_id, system_id_len);
|
||||
memcpy(system_label + system_id_len, "__", 2);
|
||||
memcpy(system_label + 2 + system_id_len, label, label_len);
|
||||
system_label[system_id_len + 2 + label_len] = '\0';
|
||||
if (!lbl)
|
||||
lbl = path_basename(path_get(RARCH_PATH_BASENAME));
|
||||
lbl_len = strlen(lbl);
|
||||
sys_lbl = (char*)malloc(lbl_len + sys_id_len + 3);
|
||||
memcpy(sys_lbl, sys_id, sys_id_len);
|
||||
memcpy(sys_lbl + sys_id_len, "__", 2);
|
||||
memcpy(sys_lbl + 2 + sys_id_len, lbl, lbl_len);
|
||||
sys_lbl[sys_id_len + 2 + lbl_len] = '\0';
|
||||
}
|
||||
|
||||
if (!scaler)
|
||||
@ -910,6 +901,8 @@ bool run_translation_service(settings_t *settings, bool paused)
|
||||
}
|
||||
else
|
||||
{
|
||||
const enum retro_pixel_format
|
||||
video_driver_pix_fmt = video_st->pix_fmt;
|
||||
/* This is a software core, so just change the pixel format to 24-bit. */
|
||||
if (!(bit24_image = (uint8_t*)malloc(width * height * 3)))
|
||||
goto finish;
|
||||
@ -975,14 +968,14 @@ bool run_translation_service(settings_t *settings, bool paused)
|
||||
rjsonwriter_add_string_len(jsonwriter, bmp64_buffer, bmp64_length);
|
||||
|
||||
/* Form request... */
|
||||
if (system_label)
|
||||
if (sys_lbl)
|
||||
{
|
||||
rjsonwriter_raw(jsonwriter, ",", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_add_string(jsonwriter, "label");
|
||||
rjsonwriter_raw(jsonwriter, ":", 1);
|
||||
rjsonwriter_raw(jsonwriter, " ", 1);
|
||||
rjsonwriter_add_string(jsonwriter, system_label);
|
||||
rjsonwriter_add_string(jsonwriter, sys_lbl);
|
||||
}
|
||||
|
||||
rjsonwriter_raw(jsonwriter, ",", 1);
|
||||
@ -1147,8 +1140,8 @@ finish:
|
||||
|
||||
if (bmp64_buffer)
|
||||
free(bmp64_buffer);
|
||||
if (system_label)
|
||||
free(system_label);
|
||||
if (sys_lbl)
|
||||
free(sys_lbl);
|
||||
if (jsonwriter)
|
||||
rjsonwriter_free(jsonwriter);
|
||||
return !error;
|
||||
|
@ -1103,10 +1103,10 @@ void CoreOptionsDialog::buildLayout()
|
||||
{
|
||||
QString contentLabel;
|
||||
QString label;
|
||||
rarch_system_info_t *system = &runloop_st->system;
|
||||
rarch_system_info_t *sys_info = &runloop_st->system;
|
||||
|
||||
/* TODO/FIXME - why have this check here? system is not used */
|
||||
if (system)
|
||||
/* TODO/FIXME - why have this check here? sys_info is not used */
|
||||
if (sys_info)
|
||||
contentLabel = QFileInfo(path_get(RARCH_PATH_BASENAME)).completeBaseName();
|
||||
|
||||
if (!contentLabel.isEmpty())
|
||||
|
@ -878,7 +878,7 @@ static ui_application_t ui_application_cocoa = {
|
||||
|
||||
static void open_core_handler(ui_browser_window_state_t *state, bool result)
|
||||
{
|
||||
rarch_system_info_t *info = &runloop_state_get_ptr()->system;
|
||||
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool set_supports_no_game_enable =
|
||||
settings->bools.set_supports_no_game_enable;
|
||||
@ -890,8 +890,8 @@ static void open_core_handler(ui_browser_window_state_t *state, bool result)
|
||||
path_set(RARCH_PATH_CORE, state->result);
|
||||
ui_companion_event_command(CMD_EVENT_LOAD_CORE);
|
||||
|
||||
if ( info
|
||||
&& info->load_no_content
|
||||
if ( sys_info
|
||||
&& sys_info->load_no_content
|
||||
&& set_supports_no_game_enable)
|
||||
{
|
||||
content_ctx_info_t content_info = {0};
|
||||
|
@ -2913,11 +2913,11 @@ void MainWindow::setCoreActions()
|
||||
ViewType viewType = getCurrentViewType();
|
||||
QHash<QString, QString> hash = getCurrentContentHash();
|
||||
QString currentPlaylistFileName = QString();
|
||||
rarch_system_info_t *system = &runloop_state_get_ptr()->system;
|
||||
rarch_system_info_t *sys_info = &runloop_state_get_ptr()->system;
|
||||
|
||||
m_launchWithComboBox->clear();
|
||||
|
||||
if (system->load_no_content) /* Is contentless core? */
|
||||
if (sys_info->load_no_content) /* Is contentless core? */
|
||||
m_startCorePushButton->show();
|
||||
else
|
||||
m_startCorePushButton->hide();
|
||||
|
Loading…
x
Reference in New Issue
Block a user