cdrom: C89 fix, timeout calculation fix

This commit is contained in:
Brad Parker 2019-07-15 00:55:06 -04:00
parent 28c40ffab6
commit 534b9125a9
2 changed files with 3 additions and 2 deletions

View File

@ -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);

View File

@ -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)
{