mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-07 08:36:02 -10:00
Open files that are CRC'd whole with FREQUENT_ACCESS
ac368f4taught intfstream_crc_step() to fold the checksum straight out of the VFS's mapping when the file was opened with RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS, andbade0b7moved the content scanner onto it. The other places that open a file only to hash all of it were still HINT_NONE: the core updater's sliced CRC of the installed core, the core backup and restore CRCs of the backup file, and netplay's CRC of the content at session start. Same hint at all four; where the VFS cannot map (a URL scheme, a huge file on a 32-bit host) it is a hint and the read path is what it was. Compiled through the real build rule; core_crc_slice_test and core_backup_io_test pass under ASan.
This commit is contained in:
1 parent
bade0b73f0
commit
487726ae22
4 files changed
+10
-4
No files matched your search
+1
-1
@@ -269,7 +269,7 @@ bool core_backup_get_backup_crc(char *s, uint32_t *crc)
|
||||
/* Open backup file */
|
||||
backup_file = intfstream_open_file(
|
||||
s, RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS);
|
||||
|
||||
if (backup_file)
|
||||
{
|
||||
|
||||
@@ -285,8 +285,12 @@ uint32_t netplay_content_crc(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The whole content file, hashed once at session start:
|
||||
* FREQUENT_ACCESS so the VFS maps it where it can and the
|
||||
* CRC is folded from the mapping rather than read out. */
|
||||
intfstream_t *fd = intfstream_open_file(path,
|
||||
RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS);
|
||||
if (fd)
|
||||
{
|
||||
if (!intfstream_get_crc(fd, &crc))
|
||||
|
||||
@@ -938,7 +938,7 @@ static void task_core_restore_handler(retro_task_t *task)
|
||||
if (!(backup_handle->backup_file = intfstream_open_file(
|
||||
backup_handle->backup_path,
|
||||
RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE)))
|
||||
RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS)))
|
||||
{
|
||||
RARCH_ERR("[Core Restore] Failed to determine CRC of core backup file: \"%s\".\n",
|
||||
backup_handle->backup_path);
|
||||
|
||||
@@ -263,9 +263,11 @@ static bool task_core_updater_crc_step(core_crc_slice_t *slice,
|
||||
if (!slice->active)
|
||||
{
|
||||
slice->accumulator = 0;
|
||||
/* FREQUENT_ACCESS: mapped where the VFS can, and each
|
||||
* crc_step() then folds from the mapping without a read. */
|
||||
if (!(slice->file = intfstream_open_file(core_path,
|
||||
RETRO_VFS_FILE_ACCESS_READ,
|
||||
RETRO_VFS_FILE_ACCESS_HINT_NONE)))
|
||||
RETRO_VFS_FILE_ACCESS_HINT_FREQUENT_ACCESS)))
|
||||
{
|
||||
*crc = 0;
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user