From 534b9125a981b6ad281f9adb833d02d8f216144e Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 15 Jul 2019 00:55:06 -0400 Subject: [PATCH] cdrom: C89 fix, timeout calculation fix --- libretro-common/cdrom/cdrom.c | 2 +- libretro-common/media/media_detect_cd.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libretro-common/cdrom/cdrom.c b/libretro-common/cdrom/cdrom.c index b3fab7607a..3f824013ef 100644 --- a/libretro-common/cdrom/cdrom.c +++ b/libretro-common/cdrom/cdrom.c @@ -1097,7 +1097,7 @@ int cdrom_read(libretro_vfs_implementation_file *stream, cdrom_group_timeouts_t double frames = (len + skip) / 2352.0; unsigned frame_end = cdrom_msf_to_lba(min, sec, frame) + ceil(frames); - if (timeouts->g1_timeout && frames > timeouts->g1_timeout) + if (timeouts->g1_timeout && (frames / 75) > timeouts->g1_timeout) { printf("[CDROM] multi-frame read of %d seconds is longer than group 1 timeout of %d seconds\n", (int)frames, timeouts->g1_timeout); fflush(stdout); diff --git a/libretro-common/media/media_detect_cd.c b/libretro-common/media/media_detect_cd.c index 4577c88c86..ae9a36f673 100644 --- a/libretro-common/media/media_detect_cd.c +++ b/libretro-common/media/media_detect_cd.c @@ -69,11 +69,12 @@ bool media_detect_cd_info(const char *path, media_detect_cd_info_t *info) unsigned sector_size = 0; unsigned buf_size = 17 * 2352; char *buf = (char*)calloc(1, buf_size); + int64_t read_bytes = 0; if (!buf) return false; - int64_t read_bytes = filestream_read(file, buf, buf_size); + read_bytes = filestream_read(file, buf, buf_size); if (read_bytes != buf_size) {