diff --git a/configuration.c b/configuration.c index 1962190715..71f92e3372 100644 --- a/configuration.c +++ b/configuration.c @@ -2537,31 +2537,29 @@ error: #if defined(HAVE_MENU) && defined(HAVE_RGUI) static bool check_menu_driver_compatibility(void) { - settings_t *settings = config_get_ptr(); - char *video_driver = settings->arrays.video_driver; - char *menu_driver = settings->arrays.menu_driver; - size_t menu_driver_len = strlen(menu_driver); - size_t video_driver_len = strlen(video_driver); + settings_t *settings = config_get_ptr(); + char *video_driver = settings->arrays.video_driver; + char *menu_driver = settings->arrays.menu_driver; - if ( string_is_equal_memcmp_fast(menu_driver, "rgui", menu_driver_len) || - string_is_equal_memcmp_fast(menu_driver, "null", menu_driver_len) || - string_is_equal_memcmp_fast(video_driver, "null", video_driver_len)) + if (string_is_equal (menu_driver, "rgui") || + string_is_equal(menu_driver, "null") || + string_is_equal(video_driver, "null")) return true; /* TODO/FIXME - maintenance hazard */ - if ( string_is_equal_memcmp_fast(video_driver, "d3d9", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "d3d10", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "d3d11", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "d3d12", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "gdi", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "gl", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "gl1", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "gx2", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "vulkan", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "glcore", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "metal", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "ctr", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "vita2d", video_driver_len)) + if (string_is_equal(video_driver, "d3d9") || + string_is_equal(video_driver, "d3d10") || + string_is_equal(video_driver, "d3d11") || + string_is_equal(video_driver, "d3d12") || + string_is_equal(video_driver, "gdi") || + string_is_equal(video_driver, "gl") || + string_is_equal(video_driver, "gl1") || + string_is_equal(video_driver, "gx2") || + string_is_equal(video_driver, "vulkan") || + string_is_equal(video_driver, "glcore") || + string_is_equal(video_driver, "metal") || + string_is_equal(video_driver, "ctr") || + string_is_equal(video_driver, "vita2d")) return true; return false; @@ -2571,24 +2569,22 @@ static bool check_menu_driver_compatibility(void) static bool check_shader_compatibility(enum file_path_enum enum_idx) { settings_t *settings = config_get_ptr(); - char *video_driver = settings->arrays.video_driver; - size_t video_driver_len = strlen(video_driver); - if (string_is_equal_memcmp_fast(video_driver, "vulkan", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "metal", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "glcore", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "d3d11", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "d3d12", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "gx2", video_driver_len)) + if (string_is_equal(settings->arrays.video_driver, "vulkan") || + string_is_equal(settings->arrays.video_driver, "metal") || + string_is_equal(settings->arrays.video_driver, "glcore") || + string_is_equal(settings->arrays.video_driver, "d3d11") || + string_is_equal(settings->arrays.video_driver, "d3d12") || + string_is_equal(settings->arrays.video_driver, "gx2")) { if (enum_idx != FILE_PATH_SLANGP_EXTENSION) return false; return true; } - if (string_is_equal_memcmp_fast(video_driver, "gl", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "d3d8", video_driver_len) || - string_is_equal_memcmp_fast(video_driver, "d3d9", video_driver_len) + if (string_is_equal(settings->arrays.video_driver, "gl") || + string_is_equal(settings->arrays.video_driver, "d3d8") || + string_is_equal(settings->arrays.video_driver, "d3d9") ) { if (enum_idx == FILE_PATH_SLANGP_EXTENSION) diff --git a/database_info.c b/database_info.c index 6cda69588c..b723b79283 100644 --- a/database_info.c +++ b/database_info.c @@ -170,7 +170,6 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur, for (i = 0; i < item.val.map.len; i++) { - size_t str_len; struct rmsgpack_dom_value *key = &item.val.map.items[i].key; struct rmsgpack_dom_value *val = &item.val.map.items[i].value; const char *val_string = NULL; @@ -180,117 +179,116 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur, val_string = val->val.string.buff; str = key->val.string.buff; - str_len = strlen(str); - if (string_is_equal_memcmp_fast(str, "publisher", str_len)) + if (string_is_equal(str, "publisher")) { if (!string_is_empty(val_string)) db_info->publisher = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "developer", str_len)) + else if (string_is_equal(str, "developer")) { if (!string_is_empty(val_string)) db_info->developer = string_split(val_string, "|"); } - else if (string_is_equal_memcmp_fast(str, "serial", str_len)) + else if (string_is_equal(str, "serial")) { if (!string_is_empty(val_string)) db_info->serial = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "rom_name", str_len)) + else if (string_is_equal(str, "rom_name")) { if (!string_is_empty(val_string)) db_info->rom_name = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "name", str_len)) + else if (string_is_equal(str, "name")) { if (!string_is_empty(val_string)) db_info->name = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "description", str_len)) + else if (string_is_equal(str, "description")) { if (!string_is_empty(val_string)) db_info->description = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "genre", str_len)) + else if (string_is_equal(str, "genre")) { if (!string_is_empty(val_string)) db_info->genre = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "origin", str_len)) + else if (string_is_equal(str, "origin")) { if (!string_is_empty(val_string)) db_info->origin = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "franchise", str_len)) + else if (string_is_equal(str, "franchise")) { if (!string_is_empty(val_string)) db_info->franchise = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "bbfc_rating", str_len)) + else if (string_is_equal(str, "bbfc_rating")) { if (!string_is_empty(val_string)) db_info->bbfc_rating = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "esrb_rating", str_len)) + else if (string_is_equal(str, "esrb_rating")) { if (!string_is_empty(val_string)) db_info->esrb_rating = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "elspa_rating", str_len)) + else if (string_is_equal(str, "elspa_rating")) { if (!string_is_empty(val_string)) db_info->elspa_rating = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "cero_rating", str_len)) + else if (string_is_equal(str, "cero_rating")) { if (!string_is_empty(val_string)) db_info->cero_rating = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "pegi_rating", str_len)) + else if (string_is_equal(str, "pegi_rating")) { if (!string_is_empty(val_string)) db_info->pegi_rating = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "enhancement_hw", str_len)) + else if (string_is_equal(str, "enhancement_hw")) { if (!string_is_empty(val_string)) db_info->enhancement_hw = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "edge_review", str_len)) + else if (string_is_equal(str, "edge_review")) { if (!string_is_empty(val_string)) db_info->edge_magazine_review = strdup(val_string); } - else if (string_is_equal_memcmp_fast(str, "edge_rating", str_len)) + else if (string_is_equal(str, "edge_rating")) db_info->edge_magazine_rating = (unsigned)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "edge_issue", str_len)) + else if (string_is_equal(str, "edge_issue")) db_info->edge_magazine_issue = (unsigned)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "famitsu_rating", str_len)) + else if (string_is_equal(str, "famitsu_rating")) db_info->famitsu_magazine_rating = (unsigned)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "tgdb_rating", str_len)) + else if (string_is_equal(str, "tgdb_rating")) db_info->tgdb_rating = (unsigned)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "users", str_len)) + else if (string_is_equal(str, "users")) db_info->max_users = (unsigned)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "releasemonth", str_len)) + else if (string_is_equal(str, "releasemonth")) db_info->releasemonth = (unsigned)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "releaseyear", str_len)) + else if (string_is_equal(str, "releaseyear")) db_info->releaseyear = (unsigned)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "rumble", str_len)) + else if (string_is_equal(str, "rumble")) db_info->rumble_supported = (int)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "coop", str_len)) + else if (string_is_equal(str, "coop")) db_info->coop_supported = (int)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "analog", str_len)) + else if (string_is_equal(str, "analog")) db_info->analog_supported = (int)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "size", str_len)) + else if (string_is_equal(str, "size")) db_info->size = (unsigned)val->val.uint_; - else if (string_is_equal_memcmp_fast(str, "crc", str_len)) + else if (string_is_equal(str, "crc")) db_info->crc32 = swap_if_little32( *(uint32_t*)val->val.binary.buff); - else if (string_is_equal_memcmp_fast(str, "sha1", str_len)) + else if (string_is_equal(str, "sha1")) db_info->sha1 = bin_to_hex_alloc( (uint8_t*)val->val.binary.buff, val->val.binary.len); - else if (string_is_equal_memcmp_fast(str, "md5", str_len)) + else if (string_is_equal(str, "md5")) db_info->md5 = bin_to_hex_alloc( (uint8_t*)val->val.binary.buff, val->val.binary.len); else diff --git a/gfx/drivers_shader/glslang_util.cpp b/gfx/drivers_shader/glslang_util.cpp index 8d818c8c64..9d5c7d046e 100644 --- a/gfx/drivers_shader/glslang_util.cpp +++ b/gfx/drivers_shader/glslang_util.cpp @@ -243,9 +243,8 @@ const char *glslang_format_to_string(enum glslang_format fmt) static glslang_format glslang_find_format(const char *fmt) { - size_t fmt_len = strlen(fmt); #undef FMT -#define FMT(x) if (string_is_equal_memcmp_fast(fmt, #x, fmt_len)) return SLANG_FORMAT_ ## x +#define FMT(x) if (string_is_equal(fmt, #x)) return SLANG_FORMAT_ ## x FMT(R8_UNORM); FMT(R8_UINT); FMT(R8_SINT); diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 58096c50ae..fd2069696f 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -3326,29 +3326,27 @@ enum gfx_ctx_api video_context_driver_get_api(void) if (ctx_api == GFX_CTX_NONE) { const char *video_driver = video_driver_get_ident(); - size_t video_driver_len = strlen(video_driver); - - if (string_is_equal_memcmp_fast(video_driver, "d3d9", video_driver_len)) + if (string_is_equal(video_driver, "d3d9")) return GFX_CTX_DIRECT3D9_API; - else if (string_is_equal_memcmp_fast(video_driver, "d3d10", video_driver_len)) + else if (string_is_equal(video_driver, "d3d10")) return GFX_CTX_DIRECT3D10_API; - else if (string_is_equal_memcmp_fast(video_driver, "d3d11", video_driver_len)) + else if (string_is_equal(video_driver, "d3d11")) return GFX_CTX_DIRECT3D11_API; - else if (string_is_equal_memcmp_fast(video_driver, "d3d12", video_driver_len)) + else if (string_is_equal(video_driver, "d3d12")) return GFX_CTX_DIRECT3D12_API; - else if (string_is_equal_memcmp_fast(video_driver, "gx2", video_driver_len)) + else if (string_is_equal(video_driver, "gx2")) return GFX_CTX_GX2_API; - else if (string_is_equal_memcmp_fast(video_driver, "gx", video_driver_len)) + else if (string_is_equal(video_driver, "gx")) return GFX_CTX_GX_API; - else if (string_is_equal_memcmp_fast(video_driver, "gl", video_driver_len)) + else if (string_is_equal(video_driver, "gl")) return GFX_CTX_OPENGL_API; - else if (string_is_equal_memcmp_fast(video_driver, "gl1", video_driver_len)) + else if (string_is_equal(video_driver, "gl1")) return GFX_CTX_OPENGL_API; - else if (string_is_equal_memcmp_fast(video_driver, "glcore", video_driver_len)) + else if (string_is_equal(video_driver, "glcore")) return GFX_CTX_OPENGL_API; - else if (string_is_equal_memcmp_fast(video_driver, "vulkan", video_driver_len)) + else if (string_is_equal(video_driver, "vulkan")) return GFX_CTX_VULKAN_API; - else if (string_is_equal_memcmp_fast(video_driver, "metal", video_driver_len)) + else if (string_is_equal(video_driver, "metal")) return GFX_CTX_METAL_API; return GFX_CTX_NONE; diff --git a/gfx/video_shader_parse.c b/gfx/video_shader_parse.c index f17a65b3c8..75c8d4276c 100644 --- a/gfx/video_shader_parse.c +++ b/gfx/video_shader_parse.c @@ -82,14 +82,13 @@ static const char *wrap_mode_to_str(enum gfx_wrap_type type) **/ static enum gfx_wrap_type wrap_str_to_mode(const char *wrap_mode) { - size_t wrap_mode_len = strlen(wrap_mode); - if (string_is_equal_memcmp_fast(wrap_mode, "clamp_to_border", wrap_mode_len)) + if (string_is_equal(wrap_mode, "clamp_to_border")) return RARCH_WRAP_BORDER; - else if (string_is_equal_memcmp_fast(wrap_mode, "clamp_to_edge", wrap_mode_len)) + else if (string_is_equal(wrap_mode, "clamp_to_edge")) return RARCH_WRAP_EDGE; - else if (string_is_equal_memcmp_fast(wrap_mode, "repeat", wrap_mode_len)) + else if (string_is_equal(wrap_mode, "repeat")) return RARCH_WRAP_REPEAT; - else if (string_is_equal_memcmp_fast(wrap_mode, "mirrored_repeat", wrap_mode_len)) + else if (string_is_equal(wrap_mode, "mirrored_repeat")) return RARCH_WRAP_MIRRORED_REPEAT; RARCH_WARN("Invalid wrapping type %s. Valid ones are: clamp_to_border" @@ -230,15 +229,11 @@ static bool video_shader_parse_pass(config_file_t *conf, if (*scale_type_x) { - size_t scale_type_x_len = strlen(scale_type_x); - if (string_is_equal_memcmp_fast( - scale_type_x, "source", scale_type_x_len)) + if (string_is_equal(scale_type_x, "source")) scale->type_x = RARCH_SCALE_INPUT; - else if (string_is_equal_memcmp_fast( - scale_type_x, "viewport", scale_type_x_len)) + else if (string_is_equal(scale_type_x, "viewport")) scale->type_x = RARCH_SCALE_VIEWPORT; - else if (string_is_equal_memcmp_fast( - scale_type_x, "absolute", scale_type_x_len)) + else if (string_is_equal(scale_type_x, "absolute")) scale->type_x = RARCH_SCALE_ABSOLUTE; else { @@ -249,12 +244,11 @@ static bool video_shader_parse_pass(config_file_t *conf, if (*scale_type_y) { - size_t scale_type_y_len = strlen(scale_type_y); - if (string_is_equal_memcmp_fast(scale_type_y, "source", scale_type_y_len)) + if (string_is_equal(scale_type_y, "source")) scale->type_y = RARCH_SCALE_INPUT; - else if (string_is_equal_memcmp_fast(scale_type_y, "viewport", scale_type_y_len)) + else if (string_is_equal(scale_type_y, "viewport")) scale->type_y = RARCH_SCALE_VIEWPORT; - else if (string_is_equal_memcmp_fast(scale_type_y, "absolute", scale_type_y_len)) + else if (string_is_equal(scale_type_y, "absolute")) scale->type_y = RARCH_SCALE_ABSOLUTE; else { @@ -618,7 +612,6 @@ static bool video_shader_parse_imports(config_file_t *conf, char mask_buf[64]; char equal_buf[64]; char semantic[64]; - size_t semantic_len = 0; unsigned addr = 0; unsigned mask = 0; unsigned equal = 0; @@ -643,19 +636,17 @@ static bool video_shader_parse_imports(config_file_t *conf, snprintf(mask_buf, sizeof(mask_buf), "%s_mask", id); snprintf(equal_buf, sizeof(equal_buf), "%s_equal", id); - semantic_len = strlen(semantic); - - if (string_is_equal_memcmp_fast(semantic, "capture", semantic_len)) + if (string_is_equal(semantic, "capture")) var->type = RARCH_STATE_CAPTURE; - else if (string_is_equal_memcmp_fast(semantic, "transition", semantic_len)) + else if (string_is_equal(semantic, "transition")) var->type = RARCH_STATE_TRANSITION; - else if (string_is_equal_memcmp_fast(semantic, "transition_count", semantic_len)) + else if (string_is_equal(semantic, "transition_count")) var->type = RARCH_STATE_TRANSITION_COUNT; - else if (string_is_equal_memcmp_fast(semantic, "capture_previous", semantic_len)) + else if (string_is_equal(semantic, "capture_previous")) var->type = RARCH_STATE_CAPTURE_PREV; - else if (string_is_equal_memcmp_fast(semantic, "transition_previous", semantic_len)) + else if (string_is_equal(semantic, "transition_previous")) var->type = RARCH_STATE_TRANSITION_PREV; - else if (string_is_equal_memcmp_fast(semantic, "python", semantic_len)) + else if (string_is_equal(semantic, "python")) var->type = RARCH_STATE_PYTHON; else { diff --git a/input/input_driver.c b/input/input_driver.c index a12c305d21..329d1a99d7 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -2428,17 +2428,14 @@ static void parse_hat(struct retro_keybind *bind, const char *str) return; } - { - size_t dir_size = strlen(dir); - if (string_is_equal_memcmp_fast(dir, "up", dir_size)) - hat_dir = HAT_UP_MASK; - else if (string_is_equal_memcmp_fast(dir, "down", dir_size)) - hat_dir = HAT_DOWN_MASK; - else if (string_is_equal_memcmp_fast(dir, "left", dir_size)) - hat_dir = HAT_LEFT_MASK; - else if (string_is_equal_memcmp_fast(dir, "right", dir_size)) - hat_dir = HAT_RIGHT_MASK; - } + if (string_is_equal(dir, "up")) + hat_dir = HAT_UP_MASK; + else if (string_is_equal(dir, "down")) + hat_dir = HAT_DOWN_MASK; + else if (string_is_equal(dir, "left")) + hat_dir = HAT_LEFT_MASK; + else if (string_is_equal(dir, "right")) + hat_dir = HAT_RIGHT_MASK; if (hat_dir) bind->joykey = HAT_MAP(hat, hat_dir); diff --git a/intl/msg_hash_us.c b/intl/msg_hash_us.c index 37c8b4dbb4..f0b6552d68 100644 --- a/intl/msg_hash_us.c +++ b/intl/msg_hash_us.c @@ -823,7 +823,7 @@ int menu_hash_get_help_us_enum(enum msg_hash_enums msg, char *s, size_t len) snprintf(s, len, "Current Video driver."); - if (string_is_equal_memcmp(settings->arrays.video_driver, "gl")) + if (string_is_equal(settings->arrays.video_driver, "gl")) { snprintf(s, len, "OpenGL Video driver. \n" diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 3781f98fd0..7aeaf2cb29 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -824,16 +824,13 @@ bool config_get_bool(config_file_t *conf, const char *key, bool *in) if (entry) { - size_t entry_len = strlen(entry->value); - const char *entry_val = entry->value; - - if (string_is_equal_memcmp_fast(entry_val, "true", entry_len)) + if (string_is_equal(entry->value, "true")) *in = true; - else if (string_is_equal_memcmp_fast(entry_val, "1", entry_len)) + else if (string_is_equal(entry->value, "1")) *in = true; - else if (string_is_equal_memcmp_fast(entry_val, "false", entry_len)) + else if (string_is_equal(entry->value, "false")) *in = false; - else if (string_is_equal_memcmp_fast(entry_val, "0", entry_len)) + else if (string_is_equal(entry->value, "0")) *in = false; else return false; diff --git a/libretro-common/include/string/stdstring.h b/libretro-common/include/string/stdstring.h index b8ca44bfcd..7ddaa1ac14 100644 --- a/libretro-common/include/string/stdstring.h +++ b/libretro-common/include/string/stdstring.h @@ -31,7 +31,6 @@ #include #include -#include #include RETRO_BEGIN_DECLS @@ -62,18 +61,6 @@ static INLINE bool string_is_equal(const char *a, const char *b) #define string_is_not_equal_fast(a, b, size) (memcmp(a, b, size) != 0) #define string_is_equal_fast(a, b, size) (memcmp(a, b, size) == 0) -#define string_is_equal_memcmp(a, b) (memcmp(a, b, MIN(strlen(a), (STRLEN_CONST(b)+1))) == 0) -/* Faster version of string_is_equal_memcmp - - * this version is intended to be used when you're - * going to be making repeated calls to this macro - * while a stays the same, thereby sparing you the - * overhead of the macro implicitly calling strlen - * per invocation - * - * Parameter explanation: - * c = size of a - */ -#define string_is_equal_memcmp_fast(a, b, c) (memcmp(a, b, MIN(c, (STRLEN_CONST(b)+1))) == 0) static INLINE void string_add_between_pairs(char *s, const char *str, size_t size) diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index 260ee3b30e..64fbc3091a 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -31,25 +31,24 @@ static enum action_iterate_type action_iterate_type(const char *label) { - size_t label_len = strlen(label); - if (string_is_equal_memcmp_fast(label, "info_screen", label_len)) + if (string_is_equal(label, "info_screen")) return ITERATE_TYPE_INFO; if ( - string_is_equal_memcmp_fast(label, "help", label_len) || - string_is_equal_memcmp_fast(label, "help_controls", label_len) || - string_is_equal_memcmp_fast(label, "help_what_is_a_core", label_len) || - string_is_equal_memcmp_fast(label, "help_loading_content", label_len) || - string_is_equal_memcmp_fast(label, "help_scanning_content", label_len) || - string_is_equal_memcmp_fast(label, "help_change_virtual_gamepad", label_len) || - string_is_equal_memcmp_fast(label, "help_audio_video_troubleshooting", label_len) || - string_is_equal_memcmp_fast(label, "help_send_debug_info", label_len) || - string_is_equal_memcmp_fast(label, "cheevos_description", label_len) + string_is_equal(label, "help") || + string_is_equal(label, "help_controls") || + string_is_equal(label, "help_what_is_a_core") || + string_is_equal(label, "help_loading_content") || + string_is_equal(label, "help_scanning_content") || + string_is_equal(label, "help_change_virtual_gamepad") || + string_is_equal(label, "help_audio_video_troubleshooting") || + string_is_equal(label, "help_send_debug_info") || + string_is_equal(label, "cheevos_description") ) return ITERATE_TYPE_HELP; if ( - string_is_equal_memcmp_fast(label, "custom_bind", label_len) || - string_is_equal_memcmp_fast(label, "custom_bind_all", label_len) || - string_is_equal_memcmp_fast(label, "custom_bind_defaults", label_len) + string_is_equal(label, "custom_bind") || + string_is_equal(label, "custom_bind_all") || + string_is_equal(label, "custom_bind_defaults") ) return ITERATE_TYPE_BIND; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index e7d0c44776..15d4b94afe 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -962,11 +962,10 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) if (!string_is_empty(entry.label)) { - size_t entry_label_len = strlen(entry.label); if ( (settings->bools.savestate_thumbnail_enable) - && ( (string_is_equal_memcmp_fast(entry.label, "state_slot", entry_label_len)) - || (string_is_equal_memcmp_fast(entry.label, "loadstate" , entry_label_len)) - || (string_is_equal_memcmp_fast(entry.label, "savestate" , entry_label_len)))) + && ((string_is_equal(entry.label, "state_slot")) + || (string_is_equal(entry.label, "loadstate")) + || (string_is_equal(entry.label, "savestate")))) { size_t path_size = 8204 * sizeof(char); char *path = (char*)malloc(path_size); @@ -2107,8 +2106,8 @@ static void xmb_populate_entries(void *data, const char *path, const char *label, unsigned k) { - unsigned xmb_system_tab; xmb_handle_t *xmb = (xmb_handle_t*)data; + unsigned xmb_system_tab; if (!xmb) return; @@ -2738,7 +2737,7 @@ static int xmb_draw_item( else if (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) || (string_is_equal(entry->value, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) { if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON]) texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON]; @@ -2749,22 +2748,23 @@ static int xmb_draw_item( { if (!string_is_empty(entry->value)) { - size_t entry_val_len = strlen(entry->value); if ( - string_is_equal_memcmp_fast(entry->value, "...", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(PRESET)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(SHADER)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(COMP)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(CORE)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(MOVIE)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(MUSIC)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(DIR)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(RDB)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(CURSOR)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(CFILE)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(FILE)", entry_val_len) || - string_is_equal_memcmp_fast(entry->value, "(IMAGE)", entry_val_len) - ) { } + string_is_equal(entry->value, "...") || + string_is_equal(entry->value, "(PRESET)") || + string_is_equal(entry->value, "(SHADER)") || + string_is_equal(entry->value, "(COMP)") || + string_is_equal(entry->value, "(CORE)") || + string_is_equal(entry->value, "(MOVIE)") || + string_is_equal(entry->value, "(MUSIC)") || + string_is_equal(entry->value, "(DIR)") || + string_is_equal(entry->value, "(RDB)") || + string_is_equal(entry->value, "(CURSOR)")|| + string_is_equal(entry->value, "(CFILE)") || + string_is_equal(entry->value, "(FILE)") || + string_is_equal(entry->value, "(IMAGE)") + ) + { + } else do_draw_text = true; } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index d757b0ea3e..8420fbc327 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1088,12 +1088,11 @@ static int create_string_list_rdb_entry_int( static enum msg_file_type extension_to_file_hash_type(const char *ext) { - size_t ext_len = strlen(ext); - if (string_is_equal_memcmp_fast(ext, "sha1", ext_len)) + if (string_is_equal(ext, "sha1")) return FILE_TYPE_SHA1; - else if (string_is_equal_memcmp_fast(ext, "crc", ext_len)) + else if (string_is_equal(ext, "crc")) return FILE_TYPE_CRC; - else if (string_is_equal_memcmp_fast(ext, "md5", ext_len)) + else if (string_is_equal(ext, "md5")) return FILE_TYPE_MD5; return FILE_TYPE_NONE; } @@ -1191,25 +1190,21 @@ static int menu_displaylist_parse_database_entry(menu_handle_t *menu, { if (tmp_str_list->size > 1) { - const char *elem0 = tmp_str_list->elems[0].data; - const char *elem1 = tmp_str_list->elems[1].data; - size_t crc_str_len = strlen(crc_str); + const char *elem0 = tmp_str_list->elems[0].data; + const char *elem1 = tmp_str_list->elems[1].data; switch (extension_to_file_hash_type(elem1)) { case FILE_TYPE_CRC: - if (string_is_equal_memcmp_fast(crc_str, elem0, - crc_str_len)) + if (string_is_equal(crc_str, elem0)) match_found = true; break; case FILE_TYPE_SHA1: - if (string_is_equal_memcmp_fast(db_info_entry->sha1, - elem0, crc_str_len)) + if (string_is_equal(db_info_entry->sha1, elem0)) match_found = true; break; case FILE_TYPE_MD5: - if (string_is_equal_memcmp_fast(db_info_entry->md5, - elem0, crc_str_len)) + if (string_is_equal(db_info_entry->md5, elem0)) match_found = true; break; default: @@ -2392,8 +2387,7 @@ static unsigned menu_displaylist_parse_cores( return items_found; } - if (string_is_equal(info->label, - msg_hash_to_str(MENU_ENUM_LABEL_CORE_LIST))) + if (string_is_equal(info->label, msg_hash_to_str(MENU_ENUM_LABEL_CORE_LIST))) info->download_core = true; dir_list_sort(str_list, true); @@ -2471,8 +2465,7 @@ static unsigned menu_displaylist_parse_cores( else { file_type = FILE_TYPE_CORE; - if (string_is_equal(info->label, - msg_hash_to_str(MENU_ENUM_LABEL_SIDELOAD_CORE_LIST))) + if (string_is_equal(info->label, msg_hash_to_str(MENU_ENUM_LABEL_SIDELOAD_CORE_LIST))) enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_SIDELOAD_CORE; else enum_idx = MENU_ENUM_LABEL_FILE_BROWSER_CORE; diff --git a/playlist.c b/playlist.c index b275cfc324..123aef2063 100644 --- a/playlist.c +++ b/playlist.c @@ -1299,7 +1299,9 @@ static JSON_Parser_HandlerResult JSONEndArrayHandler(JSON_Parser parser) else if (pCtx->object_depth == 2) { if (pCtx->in_subsystem_roms && string_is_equal(pCtx->current_items_string, "subsystem_roms") && pCtx->array_depth == 1) + { pCtx->in_subsystem_roms = false; + } } return JSON_Parser_Continue; @@ -1453,48 +1455,50 @@ static JSON_Parser_HandlerResult JSONObjectMemberHandler(JSON_Parser parser, cha return JSON_Parser_Abort; } - if (length && !string_is_empty(pValue)) + if (length) { - size_t pvalue_len = strlen(pValue); - if (!string_is_empty(pCtx->current_items_string)) - free(pCtx->current_items_string); - pCtx->current_items_string = strdup(pValue); + if (!string_is_empty(pValue)) + { + if (!string_is_empty(pCtx->current_items_string)) + free(pCtx->current_items_string); + pCtx->current_items_string = strdup(pValue); + } - if (string_is_equal_memcmp_fast(pValue, "path", pvalue_len)) + if (string_is_equal(pValue, "path")) pCtx->current_entry_val = &pCtx->current_entry->path; - else if (string_is_equal_memcmp_fast(pValue, "label", pvalue_len)) + else if (string_is_equal(pValue, "label")) pCtx->current_entry_val = &pCtx->current_entry->label; - else if (string_is_equal_memcmp_fast(pValue, "core_path", pvalue_len)) + else if (string_is_equal(pValue, "core_path")) pCtx->current_entry_val = &pCtx->current_entry->core_path; - else if (string_is_equal_memcmp_fast(pValue, "core_name", pvalue_len)) + else if (string_is_equal(pValue, "core_name")) pCtx->current_entry_val = &pCtx->current_entry->core_name; - else if (string_is_equal_memcmp_fast(pValue, "crc32", pvalue_len)) + else if (string_is_equal(pValue, "crc32")) pCtx->current_entry_val = &pCtx->current_entry->crc32; - else if (string_is_equal_memcmp_fast(pValue, "db_name", pvalue_len)) + else if (string_is_equal(pValue, "db_name")) pCtx->current_entry_val = &pCtx->current_entry->db_name; - else if (string_is_equal_memcmp_fast(pValue, "subsystem_ident", pvalue_len)) + else if (string_is_equal(pValue, "subsystem_ident")) pCtx->current_entry_val = &pCtx->current_entry->subsystem_ident; - else if (string_is_equal_memcmp_fast(pValue, "subsystem_name", pvalue_len)) + else if (string_is_equal(pValue, "subsystem_name")) pCtx->current_entry_val = &pCtx->current_entry->subsystem_name; - else if (string_is_equal_memcmp_fast(pValue, "subsystem_roms", pvalue_len)) + else if (string_is_equal(pValue, "subsystem_roms")) pCtx->current_entry_string_list_val = &pCtx->current_entry->subsystem_roms; - else if (string_is_equal_memcmp_fast(pValue, "runtime_hours", pvalue_len)) + else if (string_is_equal(pValue, "runtime_hours")) pCtx->current_entry_uint_val = &pCtx->current_entry->runtime_hours; - else if (string_is_equal_memcmp_fast(pValue, "runtime_minutes", pvalue_len)) + else if (string_is_equal(pValue, "runtime_minutes")) pCtx->current_entry_uint_val = &pCtx->current_entry->runtime_minutes; - else if (string_is_equal_memcmp_fast(pValue, "runtime_seconds", pvalue_len)) + else if (string_is_equal(pValue, "runtime_seconds")) pCtx->current_entry_uint_val = &pCtx->current_entry->runtime_seconds; - else if (string_is_equal_memcmp_fast(pValue, "last_played_year", pvalue_len)) + else if (string_is_equal(pValue, "last_played_year")) pCtx->current_entry_uint_val = &pCtx->current_entry->last_played_year; - else if (string_is_equal_memcmp_fast(pValue, "last_played_month", pvalue_len)) + else if (string_is_equal(pValue, "last_played_month")) pCtx->current_entry_uint_val = &pCtx->current_entry->last_played_month; - else if (string_is_equal_memcmp_fast(pValue, "last_played_day", pvalue_len)) + else if (string_is_equal(pValue, "last_played_day")) pCtx->current_entry_uint_val = &pCtx->current_entry->last_played_day; - else if (string_is_equal_memcmp_fast(pValue, "last_played_hour", pvalue_len)) + else if (string_is_equal(pValue, "last_played_hour")) pCtx->current_entry_uint_val = &pCtx->current_entry->last_played_hour; - else if (string_is_equal_memcmp_fast(pValue, "last_played_minute", pvalue_len)) + else if (string_is_equal(pValue, "last_played_minute")) pCtx->current_entry_uint_val = &pCtx->current_entry->last_played_minute; - else if (string_is_equal_memcmp_fast(pValue, "last_played_second", pvalue_len)) + else if (string_is_equal(pValue, "last_played_second")) pCtx->current_entry_uint_val = &pCtx->current_entry->last_played_second; else { diff --git a/retroarch.c b/retroarch.c index eac3798b71..39a0bbd372 100644 --- a/retroarch.c +++ b/retroarch.c @@ -316,72 +316,71 @@ static char launch_arguments[4096]; static const void *find_driver_nonempty(const char *label, int i, char *s, size_t len) { - const void *drv = NULL; - size_t label_len = strlen(label); + const void *drv = NULL; - if (string_is_equal_memcmp_fast(label, "camera_driver", label_len)) + if (string_is_equal(label, "camera_driver")) { drv = camera_driver_find_handle(i); if (drv) strlcpy(s, camera_driver_find_ident(i), len); } - else if (string_is_equal_memcmp_fast(label, "location_driver", label_len)) + else if (string_is_equal(label, "location_driver")) { drv = location_driver_find_handle(i); if (drv) strlcpy(s, location_driver_find_ident(i), len); } #ifdef HAVE_MENU - else if (string_is_equal_memcmp_fast(label, "menu_driver", label_len)) + else if (string_is_equal(label, "menu_driver")) { drv = menu_driver_find_handle(i); if (drv) strlcpy(s, menu_driver_find_ident(i), len); } #endif - else if (string_is_equal_memcmp_fast(label, "input_driver", label_len)) + else if (string_is_equal(label, "input_driver")) { drv = input_driver_find_handle(i); if (drv) strlcpy(s, input_driver_find_ident(i), len); } - else if (string_is_equal_memcmp_fast(label, "input_joypad_driver", label_len)) + else if (string_is_equal(label, "input_joypad_driver")) { drv = joypad_driver_find_handle(i); if (drv) strlcpy(s, joypad_driver_find_ident(i), len); } - else if (string_is_equal_memcmp_fast(label, "video_driver", label_len)) + else if (string_is_equal(label, "video_driver")) { drv = video_driver_find_handle(i); if (drv) strlcpy(s, video_driver_find_ident(i), len); } - else if (string_is_equal_memcmp_fast(label, "audio_driver", label_len)) + else if (string_is_equal(label, "audio_driver")) { drv = audio_driver_find_handle(i); if (drv) strlcpy(s, audio_driver_find_ident(i), len); } - else if (string_is_equal_memcmp_fast(label, "record_driver", label_len)) + else if (string_is_equal(label, "record_driver")) { drv = record_driver_find_handle(i); if (drv) strlcpy(s, record_driver_find_ident(i), len); } - else if (string_is_equal_memcmp_fast(label, "midi_driver", label_len)) + else if (string_is_equal(label, "midi_driver")) { drv = midi_driver_find_handle(i); if (drv) strlcpy(s, midi_driver_find_ident(i), len); } - else if (string_is_equal_memcmp_fast(label, "audio_resampler_driver", label_len)) + else if (string_is_equal(label, "audio_resampler_driver")) { drv = audio_resampler_driver_find_handle(i); if (drv) strlcpy(s, audio_resampler_driver_find_ident(i), len); } - else if (string_is_equal_memcmp_fast(label, "wifi_driver", label_len)) + else if (string_is_equal(label, "wifi_driver")) { drv = wifi_driver_find_handle(i); if (drv) @@ -3736,7 +3735,7 @@ static enum runloop_state runloop_check_state( char *menu_driver = settings->arrays.menu_driver; bool pressed = BIT256_GET( current_input, RARCH_MENU_TOGGLE) && - !string_is_equal_memcmp(menu_driver, "null"); + !string_is_equal(menu_driver, "null"); if (menu_event_kb_is_set(RETROK_F1) == 1) { diff --git a/setting_list.c b/setting_list.c index b193991cb1..836a76708a 100644 --- a/setting_list.c +++ b/setting_list.c @@ -203,21 +203,21 @@ static float recalc_step_based_on_length_of_action(rarch_setting_t *setting) float step = setting->step; #ifdef HAVE_MENU global_t *global = global_get_ptr(); - if (global) + if ( global ) { - if (global->menu.action_press_time > _21_SECONDS) + if ( global->menu.action_press_time > _21_SECONDS) step = setting->step*1000000.0f ; - else if (global->menu.action_press_time > _18_SECONDS) + else if ( global->menu.action_press_time > _18_SECONDS) step = setting->step*100000.0f ; - else if (global->menu.action_press_time > _15_SECONDS) + else if ( global->menu.action_press_time > _15_SECONDS) step = setting->step*10000.0f ; - else if (global->menu.action_press_time > _12_SECONDS) + else if ( global->menu.action_press_time > _12_SECONDS) step = setting->step*1000.0f ; - else if (global->menu.action_press_time > _9_SECONDS) + else if ( global->menu.action_press_time > _9_SECONDS) step = setting->step*100.0f ; - else if (global->menu.action_press_time > _6_SECONDS) + else if ( global->menu.action_press_time > _6_SECONDS) step = setting->step*10.0f ; - else if (global->menu.action_press_time > _3_SECONDS) + else if ( global->menu.action_press_time > _3_SECONDS) step = setting->step*5.0f ; else step = setting->step ; @@ -526,17 +526,14 @@ int setting_set_with_string_representation(rarch_setting_t* setting, case ST_STRING: case ST_STRING_OPTIONS: case ST_ACTION: - if (setting->value.target.string != NULL) + if ( setting->value.target.string != NULL) strlcpy(setting->value.target.string, value, setting->size); break; case ST_BOOL: - { - size_t value_len = strlen(value); - if (string_is_equal_memcmp_fast(value, "true", value_len)) - *setting->value.target.boolean = true; - else if (string_is_equal_memcmp_fast(value, "false", value_len)) - *setting->value.target.boolean = false; - } + if (string_is_equal(value, "true")) + *setting->value.target.boolean = true; + else if (string_is_equal(value, "false")) + *setting->value.target.boolean = false; break; default: break; diff --git a/tasks/task_database.c b/tasks/task_database.c index 46f6a1ce82..8ade0e6cd3 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -161,48 +161,46 @@ static int task_database_iterate_start(database_info_handle_t *db, static int intfstream_get_serial(intfstream_t *fd, char *serial) { - const char *system_name = NULL; - size_t system_name_len = 0; + const char *system_name = NULL; - /* Check if the system was not auto-detected. */ - if (detect_system(fd, &system_name) < 0) - { - /* Attempt to read an ASCII serial, like Wii. */ - if (detect_serial_ascii_game(fd, serial)) - { - /* ASCII serial (Wii) was detected. */ - RARCH_LOG("%s '%s'\n", msg_hash_to_str(MSG_FOUND_DISK_LABEL), serial); - return 0; - } - - /* Any other non-system specific detection methods? */ + /* Check if the system was not auto-detected. */ + if (detect_system(fd, &system_name) < 0) + { + /* Attempt to read an ASCII serial, like Wii. */ + if (detect_serial_ascii_game(fd, serial)) + { + /* ASCII serial (Wii) was detected. */ + RARCH_LOG("%s '%s'\n", msg_hash_to_str(MSG_FOUND_DISK_LABEL), serial); return 0; - } + } - system_name_len = strlen(system_name); + /* Any other non-system specific detection methods? */ + return 0; + } - if (string_is_equal_memcmp_fast(system_name, "psp", system_name_len)) - { - if (detect_psp_game(fd, serial) == 0) - return 0; - RARCH_LOG("%s '%s'\n", msg_hash_to_str(MSG_FOUND_DISK_LABEL), serial); - } - else if (string_is_equal_memcmp_fast(system_name, "ps1", system_name_len)) - { - if (detect_ps1_game(fd, serial) == 0) - return 0; - RARCH_LOG("%s '%s'\n", msg_hash_to_str(MSG_FOUND_DISK_LABEL), serial); - } - else if (string_is_equal_memcmp_fast(system_name, "gc", system_name_len)) - { - if (detect_gc_game(fd, serial) == 0) - return 0; - RARCH_LOG("%s '%s'\n", msg_hash_to_str(MSG_FOUND_DISK_LABEL), serial); - } - else + if (string_is_equal(system_name, "psp")) + { + if (detect_psp_game(fd, serial) == 0) return 0; + RARCH_LOG("%s '%s'\n", msg_hash_to_str(MSG_FOUND_DISK_LABEL), serial); + } + else if (string_is_equal(system_name, "ps1")) + { + if (detect_ps1_game(fd, serial) == 0) + return 0; + RARCH_LOG("%s '%s'\n", msg_hash_to_str(MSG_FOUND_DISK_LABEL), serial); + } + else if (string_is_equal(system_name, "gc")) + { + if (detect_gc_game(fd, serial) == 0) + return 0; + RARCH_LOG("%s '%s'\n", msg_hash_to_str(MSG_FOUND_DISK_LABEL), serial); + } + else { + return 0; + } - return 1; + return 1; } static bool intfstream_file_get_serial(const char *name, @@ -569,44 +567,43 @@ end: static enum msg_file_type extension_to_file_type(const char *ext) { - size_t ext_len = strlen(ext); if ( - string_is_equal_memcmp_fast(ext, "7z", ext_len) || - string_is_equal_memcmp_fast(ext, "7Z", ext_len) || - string_is_equal_memcmp_fast(ext, "zip", ext_len) || - string_is_equal_memcmp_fast(ext, "ZIP", ext_len) || - string_is_equal_memcmp_fast(ext, "apk", ext_len) || - string_is_equal_memcmp_fast(ext, "APK", ext_len) + string_is_equal(ext, "7z") || + string_is_equal(ext, "7Z") || + string_is_equal(ext, "zip") || + string_is_equal(ext, "ZIP") || + string_is_equal(ext, "apk") || + string_is_equal(ext, "APK") ) return FILE_TYPE_COMPRESSED; if ( - string_is_equal_memcmp_fast(ext, "cue", ext_len) || - string_is_equal_memcmp_fast(ext, "CUE", ext_len) + string_is_equal(ext, "cue") || + string_is_equal(ext, "CUE") ) return FILE_TYPE_CUE; if ( - string_is_equal_memcmp_fast(ext, "gdi", ext_len) || - string_is_equal_memcmp_fast(ext, "GDI", ext_len) + string_is_equal(ext, "gdi") || + string_is_equal(ext, "GDI") ) return FILE_TYPE_GDI; if ( - string_is_equal_memcmp_fast(ext, "iso", ext_len) || - string_is_equal_memcmp_fast(ext, "ISO", ext_len) + string_is_equal(ext, "iso") || + string_is_equal(ext, "ISO") ) return FILE_TYPE_ISO; if ( - string_is_equal_memcmp_fast(ext, "chd", ext_len) || - string_is_equal_memcmp_fast(ext, "CHD", ext_len) + string_is_equal(ext, "chd") || + string_is_equal(ext, "CHD") ) return FILE_TYPE_CHD; if ( - string_is_equal_memcmp_fast(ext, "wbfs", ext_len) || - string_is_equal_memcmp_fast(ext, "WBFS", ext_len) + string_is_equal(ext, "wbfs") || + string_is_equal(ext, "WBFS") ) return FILE_TYPE_WBFS; if ( - string_is_equal_memcmp_fast(ext, "lutro", ext_len) || - string_is_equal_memcmp_fast(ext, "LUTRO", ext_len) + string_is_equal(ext, "lutro") || + string_is_equal(ext, "LUTRO") ) return FILE_TYPE_LUTRO; return FILE_TYPE_NONE; diff --git a/tasks/task_database_cue.c b/tasks/task_database_cue.c index 430557b1d7..bcd19ec728 100644 --- a/tasks/task_database_cue.c +++ b/tasks/task_database_cue.c @@ -249,40 +249,44 @@ int detect_psp_game(intfstream_t *fd, char *game_id) if (intfstream_read(fd, game_id, 5) > 0) { - size_t game_id_size = strlen(game_id); - game_id[5] = '\0'; + game_id[5] = '\0'; if ( - ( string_is_equal_memcmp_fast(game_id, "ULES-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "ULUS-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "ULJS-", game_id_size)) + (string_is_equal(game_id, "ULES-")) + || (string_is_equal(game_id, "ULUS-")) + || (string_is_equal(game_id, "ULJS-")) - || (string_is_equal_memcmp_fast(game_id, "ULEM-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "ULUM-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "ULJM-", game_id_size)) + || (string_is_equal(game_id, "ULEM-")) + || (string_is_equal(game_id, "ULUM-")) + || (string_is_equal(game_id, "ULJM-")) - || (string_is_equal_memcmp_fast(game_id, "UCES-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "UCUS-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "UCJS-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "UCAS-", game_id_size)) + || (string_is_equal(game_id, "UCES-")) + || (string_is_equal(game_id, "UCUS-")) + || (string_is_equal(game_id, "UCJS-")) + || (string_is_equal(game_id, "UCAS-")) - || (string_is_equal_memcmp_fast(game_id, "NPEH-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "NPUH-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "NPJH-", game_id_size)) + || (string_is_equal(game_id, "NPEH-")) + || (string_is_equal(game_id, "NPUH-")) + || (string_is_equal(game_id, "NPJH-")) - || (string_is_equal_memcmp_fast(game_id, "NPEG-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "NPUG-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "NPJG-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "NPHG-", game_id_size)) + || (string_is_equal(game_id, "NPEG-")) + || (string_is_equal(game_id, "NPUG-")) + || (string_is_equal(game_id, "NPJG-")) + || (string_is_equal(game_id, "NPHG-")) - || (string_is_equal_memcmp_fast(game_id, "NPEZ-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "NPUZ-", game_id_size)) - || (string_is_equal_memcmp_fast(game_id, "NPJZ-", game_id_size)) + || (string_is_equal(game_id, "NPEZ-")) + || (string_is_equal(game_id, "NPUZ-")) + || (string_is_equal(game_id, "NPJZ-")) ) { intfstream_seek(fd, pos, SEEK_SET); if (intfstream_read(fd, game_id, 10) > 0) { +#if 0 + game_id[4] = '-'; + game_id[8] = game_id[9]; + game_id[9] = game_id[10]; +#endif game_id[10] = '\0'; rv = true; } @@ -329,10 +333,10 @@ int detect_serial_ascii_game(intfstream_t *fd, char *game_id) game_id[15] = '\0'; numberOfAscii = 0; - /* When scanning WBFS files, "WBFS" is - * discovered as the first serial. Ignore it. */ - if (string_is_equal_memcmp(game_id, "WBFS")) + /* When scanning WBFS files, "WBFS" is discovered as the first serial. Ignore it. */ + if (string_is_equal(game_id, "WBFS")) { continue; + } /* Loop through until we run out of ASCII characters. */ for (i = 0; i < 15; i++) @@ -395,7 +399,7 @@ int detect_system(intfstream_t *fd, const char **system_name) { magic[8] = '\0'; if (!string_is_empty(magic) && - string_is_equal_memcmp(magic, "PSP GAME")) + string_is_equal(magic, "PSP GAME")) { *system_name = "psp\0"; rv = 0;