mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 00:39:53 +00:00
Style nits/cleanups
This commit is contained in:
parent
0f46d42c26
commit
c57995b3eb
@ -136,7 +136,8 @@ static int find_token(RFILE *fd, const char *token)
|
|||||||
#define MODETEST_VAL 0xffffff00
|
#define MODETEST_VAL 0xffffff00
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int detect_ps1_game_sub(const char *track_path, char *game_id, int sub_channel_mixed)
|
static int detect_ps1_game_sub(const char *track_path,
|
||||||
|
char *game_id, int sub_channel_mixed)
|
||||||
{
|
{
|
||||||
uint8_t* tmp;
|
uint8_t* tmp;
|
||||||
uint8_t buffer[2048 * 2];
|
uint8_t buffer[2048 * 2];
|
||||||
|
@ -40,17 +40,21 @@ typedef struct
|
|||||||
file_archive_transfer_t zlib;
|
file_archive_transfer_t zlib;
|
||||||
} decompress_state_t;
|
} decompress_state_t;
|
||||||
|
|
||||||
static int file_decompressed_target_file(const char *name, const char *valid_exts,
|
static int file_decompressed_target_file(const char *name,
|
||||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
const char *valid_exts,
|
||||||
uint32_t crc32, void *userdata)
|
const uint8_t *cdata,
|
||||||
|
unsigned cmode, uint32_t csize, uint32_t size,
|
||||||
|
uint32_t crc32, void *userdata)
|
||||||
{
|
{
|
||||||
/* TODO/FIXME */
|
/* TODO/FIXME */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int file_decompressed_subdir(const char *name, const char *valid_exts,
|
static int file_decompressed_subdir(const char *name,
|
||||||
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
|
const char *valid_exts,
|
||||||
uint32_t crc32, void *userdata)
|
const uint8_t *cdata,
|
||||||
|
unsigned cmode, uint32_t csize,uint32_t size,
|
||||||
|
uint32_t crc32, void *userdata)
|
||||||
{
|
{
|
||||||
char path[PATH_MAX_LENGTH];
|
char path[PATH_MAX_LENGTH];
|
||||||
char path_dir[PATH_MAX_LENGTH];
|
char path_dir[PATH_MAX_LENGTH];
|
||||||
@ -83,7 +87,8 @@ next_file:
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
dec->callback_error = (char*)malloc(PATH_MAX_LENGTH);
|
dec->callback_error = (char*)malloc(PATH_MAX_LENGTH);
|
||||||
snprintf(dec->callback_error, PATH_MAX_LENGTH, "Failed to deflate %s.\n", path);
|
snprintf(dec->callback_error,
|
||||||
|
PATH_MAX_LENGTH, "Failed to deflate %s.\n", path);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -119,7 +124,8 @@ next_file:
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
dec->callback_error = (char*)malloc(PATH_MAX_LENGTH);
|
dec->callback_error = (char*)malloc(PATH_MAX_LENGTH);
|
||||||
snprintf(dec->callback_error, PATH_MAX_LENGTH, "Failed to deflate %s.\n", path);
|
snprintf(dec->callback_error, PATH_MAX_LENGTH,
|
||||||
|
"Failed to deflate %s.\n", path);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -154,9 +160,10 @@ static void rarch_task_decompress_handler_finished(rarch_task_t *task,
|
|||||||
|
|
||||||
static void rarch_task_decompress_handler(rarch_task_t *task)
|
static void rarch_task_decompress_handler(rarch_task_t *task)
|
||||||
{
|
{
|
||||||
bool returnerr;
|
bool retdec = false;
|
||||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||||
int ret = file_archive_parse_file_iterate(&dec->zlib, &returnerr, dec->source_file,
|
int ret = file_archive_parse_file_iterate(&dec->zlib,
|
||||||
|
&retdec, dec->source_file,
|
||||||
dec->valid_ext, file_decompressed, dec);
|
dec->valid_ext, file_decompressed, dec);
|
||||||
|
|
||||||
task->progress = file_archive_parse_file_progress(&dec->zlib);
|
task->progress = file_archive_parse_file_progress(&dec->zlib);
|
||||||
@ -172,9 +179,10 @@ static void rarch_task_decompress_handler(rarch_task_t *task)
|
|||||||
|
|
||||||
static void rarch_task_decompress_handler_target_file(rarch_task_t *task)
|
static void rarch_task_decompress_handler_target_file(rarch_task_t *task)
|
||||||
{
|
{
|
||||||
bool returnerr;
|
bool retdec;
|
||||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||||
int ret = file_archive_parse_file_iterate(&dec->zlib, &returnerr, dec->source_file,
|
int ret = file_archive_parse_file_iterate(&dec->zlib,
|
||||||
|
&retdec, dec->source_file,
|
||||||
dec->valid_ext, file_decompressed_target_file, dec);
|
dec->valid_ext, file_decompressed_target_file, dec);
|
||||||
|
|
||||||
task->progress = file_archive_parse_file_progress(&dec->zlib);
|
task->progress = file_archive_parse_file_progress(&dec->zlib);
|
||||||
@ -190,9 +198,10 @@ static void rarch_task_decompress_handler_target_file(rarch_task_t *task)
|
|||||||
|
|
||||||
static void rarch_task_decompress_handler_subdir(rarch_task_t *task)
|
static void rarch_task_decompress_handler_subdir(rarch_task_t *task)
|
||||||
{
|
{
|
||||||
bool returnerr;
|
bool retdec;
|
||||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||||
int ret = file_archive_parse_file_iterate(&dec->zlib, &returnerr, dec->source_file,
|
int ret = file_archive_parse_file_iterate(&dec->zlib,
|
||||||
|
&retdec, dec->source_file,
|
||||||
dec->valid_ext, file_decompressed_subdir, dec);
|
dec->valid_ext, file_decompressed_subdir, dec);
|
||||||
|
|
||||||
task->progress = file_archive_parse_file_progress(&dec->zlib);
|
task->progress = file_archive_parse_file_progress(&dec->zlib);
|
||||||
@ -206,7 +215,8 @@ static void rarch_task_decompress_handler_subdir(rarch_task_t *task)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool rarch_task_decompress_finder(rarch_task_t *task, void *user_data)
|
static bool rarch_task_decompress_finder(
|
||||||
|
rarch_task_t *task, void *user_data)
|
||||||
{
|
{
|
||||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||||
|
|
||||||
@ -233,13 +243,15 @@ bool rarch_task_push_decompress(
|
|||||||
|
|
||||||
if (string_is_empty(target_dir) || string_is_empty(source_file))
|
if (string_is_empty(target_dir) || string_is_empty(source_file))
|
||||||
{
|
{
|
||||||
RARCH_WARN("[decompress] Empty or null source file or target directory arguments.\n");
|
RARCH_WARN("[decompress] Empty or null source file or"
|
||||||
|
" target directory arguments.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ZIP or APK only */
|
/* ZIP or APK only */
|
||||||
is_compressed = string_is_equal(path_get_extension(source_file), "zip");
|
is_compressed = string_is_equal(path_get_extension(source_file), "zip");
|
||||||
is_compressed = is_compressed || string_is_equal(path_get_extension(source_file), "apk");
|
is_compressed = is_compressed ||
|
||||||
|
string_is_equal(path_get_extension(source_file), "apk");
|
||||||
|
|
||||||
if (!path_file_exists(source_file) || !is_compressed)
|
if (!path_file_exists(source_file) || !is_compressed)
|
||||||
{
|
{
|
||||||
@ -256,7 +268,8 @@ bool rarch_task_push_decompress(
|
|||||||
|
|
||||||
if (task_ctl(TASK_CTL_FIND, &find_data))
|
if (task_ctl(TASK_CTL_FIND, &find_data))
|
||||||
{
|
{
|
||||||
RARCH_LOG("[decompress] File '%s' already being decompressed.\n", source_file);
|
RARCH_LOG("[decompress] File '%s' already being decompressed.\n",
|
||||||
|
source_file);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +308,9 @@ bool rarch_task_push_decompress(
|
|||||||
t->callback = cb;
|
t->callback = cb;
|
||||||
t->user_data = user_data;
|
t->user_data = user_data;
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "%s '%s'", msg_hash_to_str(MSG_EXTRACTING), path_basename(source_file));
|
snprintf(tmp, sizeof(tmp), "%s '%s'",
|
||||||
|
msg_hash_to_str(MSG_EXTRACTING), path_basename(source_file));
|
||||||
|
|
||||||
t->title = strdup(tmp);
|
t->title = strdup(tmp);
|
||||||
|
|
||||||
task_ctl(TASK_CTL_PUSH, t);
|
task_ctl(TASK_CTL_PUSH, t);
|
||||||
|
@ -209,7 +209,8 @@ static int rarch_main_data_image_iterate_process_transfer(nbio_handle_t *nbio)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_data_image_iterate_process_transfer_parse(nbio_handle_t *nbio)
|
static int rarch_main_data_image_iterate_process_transfer_parse(
|
||||||
|
nbio_handle_t *nbio)
|
||||||
{
|
{
|
||||||
if (nbio->image.handle && nbio->image.cb)
|
if (nbio->image.handle && nbio->image.cb)
|
||||||
{
|
{
|
||||||
@ -311,7 +312,8 @@ static int cb_nbio_image_menu_boxart(void *data, size_t len)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool rarch_task_push_image_load(const char *fullpath, const char *type, rarch_task_callback_t cb, void *user_data)
|
bool rarch_task_push_image_load(const char *fullpath,
|
||||||
|
const char *type, rarch_task_callback_t cb, void *user_data)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_RPNG) && defined(HAVE_MENU)
|
#if defined(HAVE_RPNG) && defined(HAVE_MENU)
|
||||||
rarch_task_t *t;
|
rarch_task_t *t;
|
||||||
@ -325,7 +327,8 @@ bool rarch_task_push_image_load(const char *fullpath, const char *type, rarch_ta
|
|||||||
|
|
||||||
if (!handle)
|
if (!handle)
|
||||||
{
|
{
|
||||||
RARCH_ERR("[image load] Failed to open '%s': %s.\n", fullpath, strerror(errno));
|
RARCH_ERR("[image load] Failed to open '%s': %s.\n",
|
||||||
|
fullpath, strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,8 @@ static int rarch_main_data_http_con_iterate_transfer(http_handle_t *http)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rarch_main_data_http_conn_iterate_transfer_parse(http_handle_t *http)
|
static int rarch_main_data_http_conn_iterate_transfer_parse(
|
||||||
|
http_handle_t *http)
|
||||||
{
|
{
|
||||||
if (net_http_connection_done(http->connection.handle))
|
if (net_http_connection_done(http->connection.handle))
|
||||||
{
|
{
|
||||||
@ -204,7 +205,8 @@ static bool rarch_task_http_finder(rarch_task_t *task, void *user_data)
|
|||||||
return string_is_equal(handle_url, (const char*)user_data);
|
return string_is_equal(handle_url, (const char*)user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rarch_task_push_http_transfer(const char *url, const char *type, rarch_task_callback_t cb, void *user_data)
|
bool rarch_task_push_http_transfer(const char *url, const char *type,
|
||||||
|
rarch_task_callback_t cb, void *user_data)
|
||||||
{
|
{
|
||||||
char tmp[PATH_MAX_LENGTH];
|
char tmp[PATH_MAX_LENGTH];
|
||||||
task_finder_data_t find_data;
|
task_finder_data_t find_data;
|
||||||
@ -253,7 +255,9 @@ bool rarch_task_push_http_transfer(const char *url, const char *type, rarch_task
|
|||||||
t->user_data = user_data;
|
t->user_data = user_data;
|
||||||
t->progress = -1;
|
t->progress = -1;
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "%s '%s'", msg_hash_to_str(MSG_DOWNLOADING), path_basename(url));
|
snprintf(tmp, sizeof(tmp), "%s '%s'",
|
||||||
|
msg_hash_to_str(MSG_DOWNLOADING), path_basename(url));
|
||||||
|
|
||||||
t->title = strdup(tmp);
|
t->title = strdup(tmp);
|
||||||
|
|
||||||
task_ctl(TASK_CTL_PUSH, t);
|
task_ctl(TASK_CTL_PUSH, t);
|
||||||
|
@ -87,7 +87,8 @@ static void rarch_task_overlay_load_desc_image(
|
|||||||
fill_pathname_resolve_relative(path, loader->overlay_path,
|
fill_pathname_resolve_relative(path, loader->overlay_path,
|
||||||
image_path, sizeof(path));
|
image_path, sizeof(path));
|
||||||
|
|
||||||
if (rarch_task_overlay_load_texture_image(input_overlay, &desc->image, path))
|
if (rarch_task_overlay_load_texture_image(input_overlay,
|
||||||
|
&desc->image, path))
|
||||||
desc->image_index = input_overlay->load_images_size - 1;
|
desc->image_index = input_overlay->load_images_size - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,15 +183,19 @@ static bool rarch_task_overlay_load_desc(
|
|||||||
const char *tmp = NULL;
|
const char *tmp = NULL;
|
||||||
|
|
||||||
desc->type = OVERLAY_TYPE_BUTTONS;
|
desc->type = OVERLAY_TYPE_BUTTONS;
|
||||||
for (tmp = strtok_r(key, "|", &save); tmp; tmp = strtok_r(NULL, "|", &save))
|
|
||||||
|
tmp = strtok_r(key, "|", &save);
|
||||||
|
|
||||||
|
for (; tmp; tmp = strtok_r(NULL, "|", &save))
|
||||||
{
|
{
|
||||||
if (!string_is_equal(tmp, "nul"))
|
if (!string_is_equal(tmp, "nul"))
|
||||||
desc->key_mask |= UINT64_C(1) << input_config_translate_str_to_bind_id(tmp);
|
desc->key_mask |= UINT64_C(1)
|
||||||
|
<< input_config_translate_str_to_bind_id(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc->key_mask & (UINT64_C(1) << RARCH_OVERLAY_NEXT))
|
if (desc->key_mask & (UINT64_C(1) << RARCH_OVERLAY_NEXT))
|
||||||
{
|
{
|
||||||
char overlay_target_key[64] = {0};
|
char overlay_target_key[64];
|
||||||
|
|
||||||
snprintf(overlay_target_key, sizeof(overlay_target_key),
|
snprintf(overlay_target_key, sizeof(overlay_target_key),
|
||||||
"overlay%u_desc%u_next_target", ol_idx, desc_idx);
|
"overlay%u_desc%u_next_target", ol_idx, desc_idx);
|
||||||
@ -241,7 +246,8 @@ static bool rarch_task_overlay_load_desc(
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(overlay_analog_saturate_key, sizeof(overlay_analog_saturate_key),
|
snprintf(overlay_analog_saturate_key,
|
||||||
|
sizeof(overlay_analog_saturate_key),
|
||||||
"overlay%u_desc%u_saturate_pct", ol_idx, desc_idx);
|
"overlay%u_desc%u_saturate_pct", ol_idx, desc_idx);
|
||||||
if (!config_get_float(conf, overlay_analog_saturate_key,
|
if (!config_get_float(conf, overlay_analog_saturate_key,
|
||||||
&desc->analog_saturate_pct))
|
&desc->analog_saturate_pct))
|
||||||
@ -412,7 +418,8 @@ static void rarch_task_overlay_deferred_load(overlay_loader_t *loader)
|
|||||||
snprintf(overlay->config.descs.key,
|
snprintf(overlay->config.descs.key,
|
||||||
sizeof(overlay->config.descs.key), "overlay%u_descs", loader->pos);
|
sizeof(overlay->config.descs.key), "overlay%u_descs", loader->pos);
|
||||||
|
|
||||||
if (!config_get_uint(conf, overlay->config.descs.key, &overlay->config.descs.size))
|
if (!config_get_uint(conf, overlay->config.descs.key,
|
||||||
|
&overlay->config.descs.size))
|
||||||
{
|
{
|
||||||
RARCH_ERR("[Overlay]: Failed to read number of descs from config key: %s.\n",
|
RARCH_ERR("[Overlay]: Failed to read number of descs from config key: %s.\n",
|
||||||
overlay->config.descs.key);
|
overlay->config.descs.key);
|
||||||
@ -469,10 +476,12 @@ static void rarch_task_overlay_deferred_load(overlay_loader_t *loader)
|
|||||||
{
|
{
|
||||||
char overlay_resolved_path[PATH_MAX_LENGTH] = {0};
|
char overlay_resolved_path[PATH_MAX_LENGTH] = {0};
|
||||||
|
|
||||||
fill_pathname_resolve_relative(overlay_resolved_path, loader->overlay_path,
|
fill_pathname_resolve_relative(overlay_resolved_path,
|
||||||
|
loader->overlay_path,
|
||||||
overlay->config.paths.path, sizeof(overlay_resolved_path));
|
overlay->config.paths.path, sizeof(overlay_resolved_path));
|
||||||
|
|
||||||
if (!rarch_task_overlay_load_texture_image(overlay, &overlay->image, overlay_resolved_path))
|
if (!rarch_task_overlay_load_texture_image(overlay,
|
||||||
|
&overlay->image, overlay_resolved_path))
|
||||||
{
|
{
|
||||||
RARCH_ERR("[Overlay]: Failed to load image: %s.\n",
|
RARCH_ERR("[Overlay]: Failed to load image: %s.\n",
|
||||||
overlay_resolved_path);
|
overlay_resolved_path);
|
||||||
@ -497,7 +506,8 @@ static void rarch_task_overlay_deferred_load(overlay_loader_t *loader)
|
|||||||
if (config_get_array(conf, overlay->config.rect.key,
|
if (config_get_array(conf, overlay->config.rect.key,
|
||||||
overlay->config.rect.array, sizeof(overlay->config.rect.array)))
|
overlay->config.rect.array, sizeof(overlay->config.rect.array)))
|
||||||
{
|
{
|
||||||
struct string_list *list = string_split(overlay->config.rect.array, ", ");
|
struct string_list *list =
|
||||||
|
string_split(overlay->config.rect.array, ", ");
|
||||||
|
|
||||||
if (!list || list->size < 4)
|
if (!list || list->size < 4)
|
||||||
{
|
{
|
||||||
@ -588,7 +598,8 @@ static void rarch_task_overlay_resolve_iterate(overlay_loader_t *loader)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rarch_task_overlay_resolve_targets(loader->overlays, loader->resolve_pos, loader->size))
|
if (!rarch_task_overlay_resolve_targets(loader->overlays,
|
||||||
|
loader->resolve_pos, loader->size))
|
||||||
{
|
{
|
||||||
RARCH_ERR("[Overlay]: Failed to resolve next targets.\n");
|
RARCH_ERR("[Overlay]: Failed to resolve next targets.\n");
|
||||||
goto error;
|
goto error;
|
||||||
@ -695,7 +706,9 @@ static bool rarch_task_push_overlay_load(const char *overlay_path,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
loader->overlays = (struct overlay*)calloc(loader->size, sizeof(*loader->overlays));
|
loader->overlays = (struct overlay*)
|
||||||
|
calloc(loader->size, sizeof(*loader->overlays));
|
||||||
|
|
||||||
if (!loader->overlays)
|
if (!loader->overlays)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -737,7 +750,8 @@ bool rarch_task_push_overlay_load_default(
|
|||||||
rarch_task_callback_t cb, void *user_data)
|
rarch_task_callback_t cb, void *user_data)
|
||||||
{
|
{
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool osk_enable = input_driver_ctl(RARCH_INPUT_CTL_IS_OSK_ENABLED, NULL);
|
bool osk_enable =
|
||||||
|
input_driver_ctl(RARCH_INPUT_CTL_IS_OSK_ENABLED, NULL);
|
||||||
|
|
||||||
if (osk_enable)
|
if (osk_enable)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user