Delayed CRC calculation for need_fullpath ROM loading (unpatched) -
we can get rid of the GEKKO ifdef for Gamecube/Wii since CRC calculation for these kind of games will now be delayed until content_get_rom_crc is called the first time, which typically only happens during netplay
This commit is contained in:
parent
240f0a578c
commit
717c5c1e2f
|
@ -157,6 +157,9 @@ static int pending_subsystem_rom_num = 0;
|
|||
static int pending_subsystem_id = 0;
|
||||
static unsigned pending_subsystem_rom_id = 0;
|
||||
|
||||
static bool pending_content_rom_crc = false;
|
||||
static char pending_content_rom_crc_path[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
static char pending_subsystem_ident[255];
|
||||
#if 0
|
||||
static char pending_subsystem_extensions[PATH_MAX_LENGTH];
|
||||
|
@ -349,12 +352,14 @@ static bool load_content_into_memory(
|
|||
/* If we have a media type, ignore CRC32 calculation. */
|
||||
if (type == RARCH_CONTENT_NONE)
|
||||
{
|
||||
bool has_patch = false;
|
||||
|
||||
/* First content file is significant, attempt to do patching,
|
||||
* CRC checking, etc. */
|
||||
|
||||
/* Attempt to apply a patch. */
|
||||
if (!content_ctx->patch_is_blocked)
|
||||
patch_content(
|
||||
has_patch = patch_content(
|
||||
content_ctx->is_ips_pref,
|
||||
content_ctx->is_bps_pref,
|
||||
content_ctx->is_ups_pref,
|
||||
|
@ -364,10 +369,18 @@ static bool load_content_into_memory(
|
|||
(uint8_t**)&ret_buf,
|
||||
(void*)length);
|
||||
|
||||
if (has_patch)
|
||||
{
|
||||
content_rom_crc = encoding_crc32(0, ret_buf, (size_t)*length);
|
||||
|
||||
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)content_rom_crc);
|
||||
}
|
||||
else
|
||||
{
|
||||
pending_content_rom_crc = true;
|
||||
strlcpy(pending_content_rom_crc_path,
|
||||
path, sizeof(pending_content_rom_crc_path));
|
||||
}
|
||||
}
|
||||
else
|
||||
content_rom_crc = 0;
|
||||
}
|
||||
|
@ -702,14 +715,11 @@ static bool content_file_load(
|
|||
}
|
||||
#endif
|
||||
|
||||
/* It adds up to 10 seconds when loading large roms.
|
||||
* It's mainly used for network play which isn't available for these platforms. */
|
||||
#if !defined(GEKKO)
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(
|
||||
MSG_CONTENT_LOADING_SKIPPED_IMPLEMENTATION_WILL_DO_IT));
|
||||
content_rom_crc = file_crc32(0, path);
|
||||
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)content_rom_crc);
|
||||
#endif
|
||||
pending_content_rom_crc = true;
|
||||
strlcpy(pending_content_rom_crc_path,
|
||||
path, sizeof(pending_content_rom_crc_path));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2032,6 +2042,13 @@ void content_unset_does_not_need_content(void)
|
|||
|
||||
uint32_t content_get_crc(void)
|
||||
{
|
||||
if (pending_content_rom_crc)
|
||||
{
|
||||
pending_content_rom_crc = false;
|
||||
content_rom_crc = file_crc32(0,
|
||||
(const char*)pending_content_rom_crc_path);
|
||||
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)content_rom_crc);
|
||||
}
|
||||
return content_rom_crc;
|
||||
}
|
||||
|
||||
|
@ -2069,6 +2086,7 @@ void content_deinit(void)
|
|||
content_rom_crc = 0;
|
||||
_content_is_inited = false;
|
||||
core_does_not_need_content = false;
|
||||
pending_content_rom_crc = false;
|
||||
}
|
||||
|
||||
/* Set environment variables before a subsystem load */
|
||||
|
|
|
@ -630,7 +630,7 @@ static bool try_ips_patch(bool allow_ips,
|
|||
* Apply patch to the content file in-memory.
|
||||
*
|
||||
**/
|
||||
static void patch_content(
|
||||
static bool patch_content(
|
||||
bool is_ips_pref,
|
||||
bool is_bps_pref,
|
||||
bool is_ups_pref,
|
||||
|
@ -651,7 +651,7 @@ static void patch_content(
|
|||
{
|
||||
RARCH_WARN("%s\n",
|
||||
msg_hash_to_str(MSG_SEVERAL_PATCHES_ARE_EXPLICITLY_DEFINED));
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !try_ips_patch(allow_ips, name_ips, buf, size)
|
||||
|
@ -660,5 +660,8 @@ static void patch_content(
|
|||
{
|
||||
RARCH_LOG("%s\n",
|
||||
msg_hash_to_str(MSG_DID_NOT_FIND_A_VALID_CONTENT_PATCH));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue