cdrom: add CDROM tag to log prints

This commit is contained in:
Brad Parker 2019-07-10 20:56:23 -04:00
parent f6497e8012
commit cf12a10ba0
4 changed files with 112 additions and 107 deletions

View File

@ -105,7 +105,7 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
if (len < 16)
{
printf("CDROM sense data buffer length too small.\n");
printf("[CDROM] Sense data buffer length too small.\n");
fflush(stdout);
return;
}
@ -114,7 +114,7 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
asc = sense[12];
ascq = sense[13];
printf("Sense Data: ");
printf("[CDROM] Sense Data: ");
for (i = 0; i < MIN(len, 16); i++)
{
@ -124,9 +124,9 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
printf("\n");
if (sense[0] == 0x70)
printf("CURRENT ERROR:\n");
printf("[CDROM] CURRENT ERROR:\n");
if (sense[0] == 0x71)
printf("DEFERRED ERROR:\n");
printf("[CDROM] DEFERRED ERROR:\n");
switch (key)
{
@ -174,9 +174,9 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
break;
}
printf("Sense Key: %02X (%s)\n", key, sense_key_text);
printf("ASC: %02X\n", asc);
printf("ASCQ: %02X\n", ascq);
printf("[CDROM] Sense Key: %02X (%s)\n", key, sense_key_text);
printf("[CDROM] ASC: %02X\n", asc);
printf("[CDROM] ASCQ: %02X\n", ascq);
switch (key)
{
@ -189,7 +189,7 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
switch (ascq)
{
case 1:
printf("Description: LOGICAL UNIT IS IN PROCESS OF BECOMING READY\n");
printf("[CDROM] Description: LOGICAL UNIT IS IN PROCESS OF BECOMING READY\n");
break;
default:
break;
@ -202,16 +202,16 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
switch (ascq)
{
case 0:
printf("Description: MEDIUM NOT PRESENT\n");
printf("[CDROM] Description: MEDIUM NOT PRESENT\n");
break;
case 3:
printf("Description: MEDIUM NOT PRESENT - LOADABLE\n");
printf("[CDROM] Description: MEDIUM NOT PRESENT - LOADABLE\n");
break;
case 1:
printf("Description: MEDIUM NOT PRESENT - TRAY CLOSED\n");
printf("[CDROM] Description: MEDIUM NOT PRESENT - TRAY CLOSED\n");
break;
case 2:
printf("Description: MEDIUM NOT PRESENT - TRAY OPEN\n");
printf("[CDROM] Description: MEDIUM NOT PRESENT - TRAY OPEN\n");
break;
default:
break;
@ -226,23 +226,23 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
case 3:
{
if (asc == 0x11 && ascq == 0x5)
printf("Description: L-EC UNCORRECTABLE ERROR\n");
printf("[CDROM] Description: L-EC UNCORRECTABLE ERROR\n");
break;
}
case 5:
{
if (asc == 0x20 && ascq == 0)
printf("Description: INVALID COMMAND OPERATION CODE\n");
printf("[CDROM] Description: INVALID COMMAND OPERATION CODE\n");
else if (asc == 0x24 && ascq == 0)
printf("Description: INVALID FIELD IN CDB\n");
printf("[CDROM] Description: INVALID FIELD IN CDB\n");
else if (asc == 0x26 && ascq == 0)
printf("Description: INVALID FIELD IN PARAMETER LIST\n");
printf("[CDROM] Description: INVALID FIELD IN PARAMETER LIST\n");
break;
}
case 6:
{
if (asc == 0x28 && ascq == 0)
printf("Description: NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED\n");
printf("[CDROM] Description: NOT READY TO READY CHANGE, MEDIUM MAY HAVE CHANGED\n");
break;
}
default:
@ -363,7 +363,7 @@ static int cdrom_send_command(const libretro_vfs_implementation_file *stream, CD
{
unsigned i;
printf("CDROM Send Command: ");
printf("[CDROM] Send Command: ");
for (i = 0; i < cmd_len / sizeof(*cmd); i++)
{
@ -372,8 +372,9 @@ static int cdrom_send_command(const libretro_vfs_implementation_file *stream, CD
if (len)
printf("(buffer of size %" PRId64 " with skip bytes %" PRId64 " padded to %" PRId64 ")\n", len, skip, padded_req_bytes);
else
printf("\n");
printf("\n");
fflush(stdout);
}
#endif
@ -412,7 +413,7 @@ retry:
if (retries_left)
{
#ifdef CDROM_DEBUG
printf("CDROM Read Retry...\n");
printf("[CDROM] Read Retry...\n");
fflush(stdout);
#endif
retries_left--;
@ -423,7 +424,7 @@ retry:
{
rv = 1;
#ifdef CDROM_DEBUG
printf("CDROM Read Retries failed, giving up.\n");
printf("[CDROM] Read retries failed, giving up.\n");
fflush(stdout);
#endif
}
@ -539,7 +540,7 @@ int cdrom_get_sense(const libretro_vfs_implementation_file *stream, unsigned cha
int rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf), cdb, sizeof(cdb), 0);
#ifdef CDROM_DEBUG
printf("get sense data status code %d\n", rv);
printf("[CDROM] get sense data status code %d\n", rv);
fflush(stdout);
#endif
@ -558,12 +559,12 @@ void cdrom_get_current_config_random_readable(const libretro_vfs_implementation_
int rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf), cdb, sizeof(cdb), 0);
int i;
printf("get current config random readable status code %d\n", rv);
printf("[CDROM] get current config random readable status code %d\n", rv);
if (rv)
return;
printf("Feature Header: ");
printf("[CDROM] Feature Header: ");
for (i = 0; i < 8; i++)
{
@ -572,7 +573,7 @@ void cdrom_get_current_config_random_readable(const libretro_vfs_implementation_
printf("\n");
printf("Random Readable Feature Descriptor: ");
printf("[CDROM] Random Readable Feature Descriptor: ");
for (i = 0; i < 12; i++)
{
@ -581,7 +582,7 @@ void cdrom_get_current_config_random_readable(const libretro_vfs_implementation_
printf("\n");
printf("Supported commands: READ CAPACITY, READ (10)\n");
printf("[CDROM] Supported commands: READ CAPACITY, READ (10)\n");
}
void cdrom_get_current_config_multiread(const libretro_vfs_implementation_file *stream)
@ -591,12 +592,12 @@ void cdrom_get_current_config_multiread(const libretro_vfs_implementation_file *
int rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf), cdb, sizeof(cdb), 0);
int i;
printf("get current config multi-read status code %d\n", rv);
printf("[CDROM] get current config multi-read status code %d\n", rv);
if (rv)
return;
printf("Feature Header: ");
printf("[CDROM] Feature Header: ");
for (i = 0; i < 8; i++)
{
@ -605,7 +606,7 @@ void cdrom_get_current_config_multiread(const libretro_vfs_implementation_file *
printf("\n");
printf("Multi-Read Feature Descriptor: ");
printf("[CDROM] Multi-Read Feature Descriptor: ");
for (i = 0; i < 4; i++)
{
@ -614,7 +615,7 @@ void cdrom_get_current_config_multiread(const libretro_vfs_implementation_file *
printf("\n");
printf("Supported commands: READ (10), READ CD, READ DISC INFORMATION, READ TRACK INFORMATION\n");
printf("[CDROM] Supported commands: READ (10), READ CD, READ DISC INFORMATION, READ TRACK INFORMATION\n");
}
void cdrom_get_current_config_cdread(const libretro_vfs_implementation_file *stream)
@ -624,12 +625,12 @@ void cdrom_get_current_config_cdread(const libretro_vfs_implementation_file *str
int rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf), cdb, sizeof(cdb), 0);
int i;
printf("get current config cd read status code %d\n", rv);
printf("[CDROM] get current config cd read status code %d\n", rv);
if (rv)
return;
printf("Feature Header: ");
printf("[CDROM] Feature Header: ");
for (i = 0; i < 8; i++)
{
@ -638,7 +639,7 @@ void cdrom_get_current_config_cdread(const libretro_vfs_implementation_file *str
printf("\n");
printf("CD Read Feature Descriptor: ");
printf("[CDROM] CD Read Feature Descriptor: ");
for (i = 0; i < 8; i++)
{
@ -648,7 +649,7 @@ void cdrom_get_current_config_cdread(const libretro_vfs_implementation_file *str
if (buf[8 + 2] & 1)
printf("(current)\n");
printf("Supported commands: READ CD, READ CD MSF, READ TOC/PMA/ATIP\n");
printf("[CDROM] Supported commands: READ CD, READ CD MSF, READ TOC/PMA/ATIP\n");
}
void cdrom_get_current_config_profiles(const libretro_vfs_implementation_file *stream)
@ -658,12 +659,12 @@ void cdrom_get_current_config_profiles(const libretro_vfs_implementation_file *s
int rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf), cdb, sizeof(cdb), 0);
int i;
printf("get current config profiles status code %d\n", rv);
printf("[CDROM] get current config profiles status code %d\n", rv);
if (rv)
return;
printf("Feature Header: ");
printf("[CDROM] Feature Header: ");
for (i = 0; i < 8; i++)
{
@ -672,7 +673,7 @@ void cdrom_get_current_config_profiles(const libretro_vfs_implementation_file *s
printf("\n");
printf("Profile List Descriptor: ");
printf("[CDROM] Profile List Descriptor: ");
for (i = 0; i < 4; i++)
{
@ -681,13 +682,13 @@ void cdrom_get_current_config_profiles(const libretro_vfs_implementation_file *s
printf("\n");
printf("Number of profiles: %u\n", buf[8 + 3] / 4);
printf("[CDROM] Number of profiles: %u\n", buf[8 + 3] / 4);
for (i = 0; i < buf[8 + 3] / 4; i++)
{
unsigned short profile = (buf[8 + (4 * (i + 1))] << 8) | buf[8 + (4 * (i + 1)) + 1];
printf("Profile Number: %04X (%s) ", profile, get_profile(profile));
printf("[CDROM] Profile Number: %04X (%s) ", profile, get_profile(profile));
if (buf[8 + (4 * (i + 1)) + 2] & 1)
printf("(current)\n");
@ -705,12 +706,12 @@ void cdrom_get_current_config_core(const libretro_vfs_implementation_file *strea
int i;
const char *intf_std_name = "Unknown";
printf("get current config core status code %d\n", rv);
printf("[CDROM] get current config core status code %d\n", rv);
if (rv)
return;
printf("Feature Header: ");
printf("[CDROM] Feature Header: ");
for (i = 0; i < 8; i++)
{
@ -720,11 +721,11 @@ void cdrom_get_current_config_core(const libretro_vfs_implementation_file *strea
printf("\n");
if (buf[6] == 0 && buf[7] == 8)
printf("Current Profile: CD-ROM\n");
printf("[CDROM] Current Profile: CD-ROM\n");
else
printf("Current Profile: %02X%02X\n", buf[6], buf[7]);
printf("[CDROM] Current Profile: %02X%02X\n", buf[6], buf[7]);
printf("Core Feature Descriptor: ");
printf("[CDROM] Core Feature Descriptor: ");
for (i = 0; i < 12; i++)
{
@ -756,7 +757,7 @@ void cdrom_get_current_config_core(const libretro_vfs_implementation_file *strea
break;
}
printf("Physical Interface Standard: %u (%s)\n", intf_std, intf_std_name);
printf("[CDROM] Physical Interface Standard: %u (%s)\n", intf_std, intf_std_name);
}
int cdrom_read_subq(libretro_vfs_implementation_file *stream, unsigned char *buf, size_t len)
@ -784,9 +785,9 @@ int cdrom_read_subq(libretro_vfs_implementation_file *stream, unsigned char *buf
first_session = buf[2];
last_session = buf[3];
printf("Data Length: %d\n", data_len);
printf("First Session: %d\n", first_session);
printf("Last Session: %d\n", last_session);
printf("[CDROM] Data Length: %d\n", data_len);
printf("[CDROM] First Session: %d\n", first_session);
printf("[CDROM] Last Session: %d\n", last_session);
for (i = 0; i < (data_len - 2) / 11; i++)
{
@ -804,24 +805,24 @@ int cdrom_read_subq(libretro_vfs_implementation_file *stream, unsigned char *buf
if (/*(control == 4 || control == 6) && */adr == 1 && tno == 0 && point >= 1 && point <= 99)
{
printf("- Session#: %d TNO %d POINT %d ", session_num, tno, point);
printf("Track start time: (MSF %02u:%02u:%02u) ", (unsigned)pmin, (unsigned)psec, (unsigned)pframe);
printf("[CDROM] - Session#: %d TNO %d POINT %d ", session_num, tno, point);
printf("[CDROM] Track start time: (MSF %02u:%02u:%02u) ", (unsigned)pmin, (unsigned)psec, (unsigned)pframe);
}
else if (/*(control == 4 || control == 6) && */adr == 1 && tno == 0 && point == 0xA0)
{
printf("- Session#: %d TNO %d POINT %d ", session_num, tno, point);
printf("First Track Number: %d ", pmin);
printf("Disc Type: %d ", psec);
printf("[CDROM] - Session#: %d TNO %d POINT %d ", session_num, tno, point);
printf("[CDROM] First Track Number: %d ", pmin);
printf("[CDROM] Disc Type: %d ", psec);
}
else if (/*(control == 4 || control == 6) && */adr == 1 && tno == 0 && point == 0xA1)
{
printf("- Session#: %d TNO %d POINT %d ", session_num, tno, point);
printf("Last Track Number: %d ", pmin);
printf("[CDROM] - Session#: %d TNO %d POINT %d ", session_num, tno, point);
printf("[CDROM] Last Track Number: %d ", pmin);
}
else if (/*(control == 4 || control == 6) && */adr == 1 && tno == 0 && point == 0xA2)
{
printf("- Session#: %d TNO %d POINT %d ", session_num, tno, point);
printf("Lead-out runtime: (MSF %02u:%02u:%02u) ", (unsigned)pmin, (unsigned)psec, (unsigned)pframe);
printf("[CDROM] - Session#: %d TNO %d POINT %d ", session_num, tno, point);
printf("[CDROM] Lead-out runtime: (MSF %02u:%02u:%02u) ", (unsigned)pmin, (unsigned)psec, (unsigned)pframe);
}
printf("\n");
@ -866,11 +867,11 @@ static int cdrom_read_track_info(libretro_vfs_implementation_file *stream, unsig
toc->track[track - 1].mode = buf[6] & 0xF;
#ifdef CDROM_DEBUG
printf("Track %d Info: ", track);
printf("Copy: %d ", (buf[5] & 0x10) > 0);
printf("Data Mode: %d ", mode);
printf("LBA Start: %d (%d) ", lba, toc->track[track - 1].lba);
printf("Track Size: %d\n", track_size);
printf("[CDROM] Track %d Info: ", track);
printf("[CDROM] Copy: %d ", (buf[5] & 0x10) > 0);
printf("[CDROM] Data Mode: %d ", mode);
printf("[CDROM] LBA Start: %d (%d) ", lba, toc->track[track - 1].lba);
printf("[CDROM] Track Size: %d\n", track_size);
fflush(stdout);
#endif
@ -902,7 +903,7 @@ int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, si
if (!out_buf || !out_len || !num_tracks || !toc)
{
#ifdef CDROM_DEBUG
printf("Invalid buffer/length pointer for CDROM cue sheet\n");
printf("[CDROM] Invalid buffer/length pointer for CDROM cue sheet\n");
fflush(stdout);
#endif
return 1;
@ -928,7 +929,7 @@ int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, si
{
*num_tracks = pmin;
#ifdef CDROM_DEBUG
printf("Number of CDROM tracks: %d\n", *num_tracks);
printf("[CDROM] Number of CDROM tracks: %d\n", *num_tracks);
fflush(stdout);
#endif
break;
@ -938,7 +939,7 @@ int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, si
if (!*num_tracks || *num_tracks > 99)
{
#ifdef CDROM_DEBUG
printf("Invalid number of CDROM tracks: %d\n", *num_tracks);
printf("[CDROM] Invalid number of CDROM tracks: %d\n", *num_tracks);
fflush(stdout);
#endif
return 1;
@ -975,7 +976,7 @@ int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, si
audio = (!(control & 0x4) && !(control & 0x5));
#ifdef CDROM_DEBUG
printf("Track %02d CONTROL %01X ADR %01X AUDIO? %d\n", point, control, adr, audio);
printf("[CDROM] Track %02d CONTROL %01X ADR %01X AUDIO? %d\n", point, control, adr, audio);
fflush(stdout);
#endif
@ -1061,7 +1062,7 @@ int cdrom_get_inquiry(const libretro_vfs_implementation_file *stream, char *mode
*is_cdrom = true;
#ifdef CDROM_DEBUG
printf("Device Model: %s (is CD-ROM? %s)\n", model, (cdrom ? "yes" : "no"));
printf("[CDROM] Device Model: %s (is CD-ROM? %s)\n", model, (cdrom ? "yes" : "no"));
#endif
return 0;
}
@ -1087,7 +1088,7 @@ int cdrom_read(libretro_vfs_implementation_file *stream, cdrom_group_timeouts_t
cdb[8] = next_frame;
#ifdef CDROM_DEBUG
printf("single-frame read: from %d %d %d to %d %d %d skip %" PRId64 "\n", cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], skip);
printf("[CDROM] single-frame read: from %d %d %d to %d %d %d skip %" PRId64 "\n", cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], skip);
fflush(stdout);
#endif
}
@ -1098,7 +1099,7 @@ int cdrom_read(libretro_vfs_implementation_file *stream, cdrom_group_timeouts_t
if (timeouts->g1_timeout && frames > timeouts->g1_timeout)
{
printf("multi-frame read of %d seconds is longer than group 1 timeout of %d seconds\n", (int)frames, 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);
return 1;
}
@ -1106,7 +1107,7 @@ int cdrom_read(libretro_vfs_implementation_file *stream, cdrom_group_timeouts_t
cdrom_lba_to_msf(frame_end, &cdb[6], &cdb[7], &cdb[8]);
#ifdef CDROM_DEBUG
printf("multi-frame read: from %d %d %d to %d %d %d skip %" PRId64 "\n", cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], skip);
printf("[CDROM] multi-frame read: from %d %d %d to %d %d %d skip %" PRId64 "\n", cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], skip);
fflush(stdout);
#endif
}
@ -1114,7 +1115,7 @@ int cdrom_read(libretro_vfs_implementation_file *stream, cdrom_group_timeouts_t
rv = cdrom_send_command(stream, DIRECTION_IN, s, len, cdb, sizeof(cdb), skip);
#ifdef CDROM_DEBUG
printf("read msf status code %d\n", rv);
printf("[CDROM] read msf status code %d\n", rv);
fflush(stdout);
#endif
@ -1141,7 +1142,7 @@ int cdrom_read_lba(libretro_vfs_implementation_file *stream, unsigned lba, void
cdb[8] = 1;
#ifdef CDROM_DEBUG
printf("single-frame read: from %d count %d skip %" PRId64 "\n", lba_orig, 1, skip);
printf("[CDROM] single-frame read: from %d count %d skip %" PRId64 "\n", lba_orig, 1, skip);
fflush(stdout);
#endif
}
@ -1155,7 +1156,7 @@ int cdrom_read_lba(libretro_vfs_implementation_file *stream, unsigned lba, void
cdb[8] = (lba_count >> 0) & 0xFF;
#ifdef CDROM_DEBUG
printf("multi-frame read: from %d to %d len %d skip %" PRId64 "\n", lba_orig, frames, frames - lba_orig, skip);
printf("[CDROM] multi-frame read: from %d to %d len %d skip %" PRId64 "\n", lba_orig, frames, frames - lba_orig, skip);
fflush(stdout);
#endif
}
@ -1163,7 +1164,7 @@ int cdrom_read_lba(libretro_vfs_implementation_file *stream, unsigned lba, void
rv = cdrom_send_command(stream, DIRECTION_IN, s, len, cdb, sizeof(cdb), skip);
#ifdef CDROM_DEBUG
printf("read status code %d\n", rv);
printf("[CDROM] read status code %d\n", rv);
fflush(stdout);
#endif
@ -1180,7 +1181,7 @@ int cdrom_stop(const libretro_vfs_implementation_file *stream)
int rv = cdrom_send_command(stream, DIRECTION_NONE, NULL, 0, cdb, sizeof(cdb), 0);
#ifdef CDROM_DEBUG
printf("stop status code %d\n", rv);
printf("[CDROM] stop status code %d\n", rv);
fflush(stdout);
#endif
@ -1197,7 +1198,7 @@ int cdrom_unlock(const libretro_vfs_implementation_file *stream)
int rv = cdrom_send_command(stream, DIRECTION_NONE, NULL, 0, cdb, sizeof(cdb), 0);
#ifdef CDROM_DEBUG
printf("persistent prevent clear status code %d\n", rv);
printf("[CDROM] persistent prevent clear status code %d\n", rv);
fflush(stdout);
#endif
@ -1209,7 +1210,7 @@ int cdrom_unlock(const libretro_vfs_implementation_file *stream)
rv = cdrom_send_command(stream, DIRECTION_NONE, NULL, 0, cdb, sizeof(cdb), 0);
#ifdef CDROM_DEBUG
printf("prevent clear status code %d\n", rv);
printf("[CDROM] prevent clear status code %d\n", rv);
fflush(stdout);
#endif
@ -1231,7 +1232,7 @@ int cdrom_open_tray(const libretro_vfs_implementation_file *stream)
rv = cdrom_send_command(stream, DIRECTION_NONE, NULL, 0, cdb, sizeof(cdb), 0);
#ifdef CDROM_DEBUG
printf("open tray status code %d\n", rv);
printf("[CDROM] open tray status code %d\n", rv);
fflush(stdout);
#endif
@ -1248,7 +1249,7 @@ int cdrom_close_tray(const libretro_vfs_implementation_file *stream)
int rv = cdrom_send_command(stream, DIRECTION_NONE, NULL, 0, cdb, sizeof(cdb), 0);
#ifdef CDROM_DEBUG
printf("close tray status code %d\n", rv);
printf("[CDROM] close tray status code %d\n", rv);
fflush(stdout);
#endif
@ -1365,7 +1366,7 @@ bool cdrom_is_media_inserted(const libretro_vfs_implementation_file *stream)
int rv = cdrom_send_command(stream, DIRECTION_NONE, NULL, 0, cdb, sizeof(cdb), 0);
#ifdef CDROM_DEBUG
printf("media inserted status code %d\n", rv);
printf("[CDROM] media inserted status code %d\n", rv);
fflush(stdout);
#endif
@ -1415,7 +1416,7 @@ bool cdrom_set_read_cache(const libretro_vfs_implementation_file *stream, bool e
rv = cdrom_send_command(stream, DIRECTION_IN, buf, sizeof(buf), cdb_sense_changeable, sizeof(cdb_sense_changeable), 0);
#ifdef CDROM_DEBUG
printf("mode sense changeable status code %d\n", rv);
printf("[CDROM] mode sense changeable status code %d\n", rv);
fflush(stdout);
#endif
@ -1426,7 +1427,7 @@ bool cdrom_set_read_cache(const libretro_vfs_implementation_file *stream, bool e
{
/* RCD (read cache disable) bit is not changeable */
#ifdef CDROM_DEBUG
printf("RCD (read cache disable) bit is not changeable.\n");
printf("[CDROM] RCD (read cache disable) bit is not changeable.\n");
fflush(stdout);
#endif
return false;

View File

@ -57,7 +57,7 @@ int64_t retro_vfs_file_seek_cdrom(libretro_vfs_implementation_file *stream, int6
}
#ifdef CDROM_DEBUG
printf("CDROM Seek: Path %s Offset %" PRIu64 " is now at %" PRIu64 "\n", stream->orig_path, offset, stream->cdrom.byte_pos);
printf("[CDROM] Seek: Path %s Offset %" PRIu64 " is now at %" PRIu64 "\n", stream->orig_path, offset, stream->cdrom.byte_pos);
fflush(stdout);
#endif
}
@ -113,7 +113,7 @@ int64_t retro_vfs_file_seek_cdrom(libretro_vfs_implementation_file *stream, int6
stream->cdrom.cur_lba = cdrom_msf_to_lba(min, sec, frame);
#ifdef CDROM_DEBUG
printf("CDROM Seek %s: Path %s Offset %" PRIu64 " is now at %" PRIu64 " (MSF %02u:%02u:%02u) (LBA %u)...\n", seek_type, stream->orig_path, offset, stream->cdrom.byte_pos, (unsigned)stream->cdrom.cur_min, (unsigned)stream->cdrom.cur_sec, (unsigned)stream->cdrom.cur_frame, stream->cdrom.cur_lba);
printf("[CDROM] Seek %s: Path %s Offset %" PRIu64 " is now at %" PRIu64 " (MSF %02u:%02u:%02u) (LBA %u)...\n", seek_type, stream->orig_path, offset, stream->cdrom.byte_pos, (unsigned)stream->cdrom.cur_min, (unsigned)stream->cdrom.cur_sec, (unsigned)stream->cdrom.cur_frame, stream->cdrom.cur_lba);
fflush(stdout);
#endif
}
@ -146,7 +146,7 @@ void retro_vfs_file_open_cdrom(
if (sscanf(path + 12, "%02u", (unsigned*)&stream->cdrom.cur_track))
{
#ifdef CDROM_DEBUG
printf("CDROM: Opening track %d\n", stream->cdrom.cur_track);
printf("[CDROM] Opening track %d\n", stream->cdrom.cur_track);
fflush(stdout);
#endif
}
@ -168,7 +168,7 @@ void retro_vfs_file_open_cdrom(
}
#ifdef CDROM_DEBUG
printf("CDROM Open: Path %s URI %s\n", cdrom_path, path);
printf("[CDROM] Open: Path %s URI %s\n", cdrom_path, path);
fflush(stdout);
#endif
stream->fp = (FILE*)fopen_utf8(cdrom_path, "r+b");
@ -190,12 +190,12 @@ void retro_vfs_file_open_cdrom(
#ifdef CDROM_DEBUG
if (string_is_empty(stream->cdrom.cue_buf))
{
printf("Error writing cue sheet.\n");
printf("[CDROM] Error writing cue sheet.\n");
fflush(stdout);
}
else
{
printf("CDROM CUE Sheet:\n%s\n", stream->cdrom.cue_buf);
printf("[CDROM] CUE Sheet:\n%s\n", stream->cdrom.cue_buf);
fflush(stdout);
}
#endif
@ -216,7 +216,7 @@ void retro_vfs_file_open_cdrom(
if (sscanf(path + 14, "%02u", (unsigned*)&stream->cdrom.cur_track))
{
#ifdef CDROM_DEBUG
printf("CDROM: Opening track %d\n", stream->cdrom.cur_track);
printf("[CDROM] Opening track %d\n", stream->cdrom.cur_track);
fflush(stdout);
#endif
}
@ -237,7 +237,7 @@ void retro_vfs_file_open_cdrom(
}
#ifdef CDROM_DEBUG
printf("CDROM Open: Path %s URI %s\n", cdrom_path, path);
printf("[CDROM] Open: Path %s URI %s\n", cdrom_path, path);
fflush(stdout);
#endif
stream->fh = CreateFile(cdrom_path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@ -259,12 +259,12 @@ void retro_vfs_file_open_cdrom(
#ifdef CDROM_DEBUG
if (string_is_empty(stream->cdrom.cue_buf))
{
printf("Error writing cue sheet.\n");
printf("[CDROM] Error writing cue sheet.\n");
fflush(stdout);
}
else
{
printf("CDROM CUE Sheet:\n%s\n", stream->cdrom.cue_buf);
printf("[CDROM] CUE Sheet:\n%s\n", stream->cdrom.cue_buf);
fflush(stdout);
}
#endif
@ -289,7 +289,7 @@ void retro_vfs_file_open_cdrom(
int retro_vfs_file_close_cdrom(libretro_vfs_implementation_file *stream)
{
#ifdef CDROM_DEBUG
printf("CDROM Close: Path %s\n", stream->orig_path);
printf("[CDROM] Close: Path %s\n", stream->orig_path);
fflush(stdout);
#endif
@ -315,7 +315,7 @@ int64_t retro_vfs_file_tell_cdrom(libretro_vfs_implementation_file *stream)
if (string_is_equal_noncase(ext, "cue"))
{
#ifdef CDROM_DEBUG
printf("CDROM (cue) Tell: Path %s Position %" PRIu64 "\n", stream->orig_path, stream->cdrom.byte_pos);
printf("[CDROM] (cue) Tell: Path %s Position %" PRIu64 "\n", stream->orig_path, stream->cdrom.byte_pos);
fflush(stdout);
#endif
return stream->cdrom.byte_pos;
@ -323,7 +323,7 @@ int64_t retro_vfs_file_tell_cdrom(libretro_vfs_implementation_file *stream)
else if (string_is_equal_noncase(ext, "bin"))
{
#ifdef CDROM_DEBUG
printf("CDROM (bin) Tell: Path %s Position %" PRId64 "\n", stream->orig_path, stream->cdrom.byte_pos);
printf("[CDROM] (bin) Tell: Path %s Position %" PRId64 "\n", stream->orig_path, stream->cdrom.byte_pos);
fflush(stdout);
#endif
return stream->cdrom.byte_pos;
@ -343,7 +343,7 @@ int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream,
if (len < stream->cdrom.cue_len - stream->cdrom.byte_pos)
{
#ifdef CDROM_DEBUG
printf("CDROM Read: Reading %" PRIu64 " bytes from cuesheet starting at %" PRIu64 "...\n", len, stream->cdrom.byte_pos);
printf("[CDROM] Read: Reading %" PRIu64 " bytes from cuesheet starting at %" PRIu64 "...\n", len, stream->cdrom.byte_pos);
fflush(stdout);
#endif
memcpy(s, stream->cdrom.cue_buf + stream->cdrom.byte_pos, len);
@ -354,7 +354,7 @@ int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream,
else
{
#ifdef CDROM_DEBUG
printf("CDROM Read: Reading %" PRIu64 " bytes from cuesheet starting at %" PRIu64 " failed.\n", len, stream->cdrom.byte_pos);
printf("[CDROM] Read: Reading %" PRIu64 " bytes from cuesheet starting at %" PRIu64 " failed.\n", len, stream->cdrom.byte_pos);
fflush(stdout);
#endif
return 0;
@ -380,7 +380,7 @@ int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream,
cdrom_lba_to_msf(stream->cdrom.cur_lba - vfs_cdrom_toc.track[stream->cdrom.cur_track - 1].lba, &rmin, &rsec, &rframe);
#ifdef CDROM_DEBUG
printf("CDROM Read: Reading %" PRIu64 " bytes from %s starting at byte offset %" PRIu64 " (rMSF %02u:%02u:%02u aMSF %02u:%02u:%02u) (LBA %u) skip %" PRIu64 "...\n", len, stream->orig_path, stream->cdrom.byte_pos, (unsigned)rmin, (unsigned)rsec, (unsigned)rframe, (unsigned)min, (unsigned)sec, (unsigned)frame, stream->cdrom.cur_lba, skip);
printf("[CDROM] Read: Reading %" PRIu64 " bytes from %s starting at byte offset %" PRIu64 " (rMSF %02u:%02u:%02u aMSF %02u:%02u:%02u) (LBA %u) skip %" PRIu64 "...\n", len, stream->orig_path, stream->cdrom.byte_pos, (unsigned)rmin, (unsigned)rsec, (unsigned)rframe, (unsigned)min, (unsigned)sec, (unsigned)frame, stream->cdrom.cur_lba, skip);
fflush(stdout);
#endif
@ -390,7 +390,7 @@ int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream,
if (rv)
{
#ifdef CDROM_DEBUG
printf("Failed to read %" PRIu64 " bytes from CD.\n", len);
printf("[CDROM] Failed to read %" PRIu64 " bytes from CD.\n", len);
fflush(stdout);
#endif
return 0;
@ -402,7 +402,7 @@ int64_t retro_vfs_file_read_cdrom(libretro_vfs_implementation_file *stream,
cdrom_lba_to_msf(stream->cdrom.cur_lba, &stream->cdrom.cur_min, &stream->cdrom.cur_sec, &stream->cdrom.cur_frame);
#ifdef CDROM_DEBUG
printf("CDROM read %" PRIu64 " bytes, position is now: %" PRIu64 " (MSF %02u:%02u:%02u) (LBA %u)\n", len, stream->cdrom.byte_pos, (unsigned)stream->cdrom.cur_min, (unsigned)stream->cdrom.cur_sec, (unsigned)stream->cdrom.cur_frame, cdrom_msf_to_lba(stream->cdrom.cur_min, stream->cdrom.cur_sec, stream->cdrom.cur_frame));
printf("[CDROM] read %" PRIu64 " bytes, position is now: %" PRIu64 " (MSF %02u:%02u:%02u) (LBA %u)\n", len, stream->cdrom.byte_pos, (unsigned)stream->cdrom.cur_min, (unsigned)stream->cdrom.cur_sec, (unsigned)stream->cdrom.cur_frame, cdrom_msf_to_lba(stream->cdrom.cur_min, stream->cdrom.cur_sec, stream->cdrom.cur_frame));
fflush(stdout);
#endif

View File

@ -2144,6 +2144,8 @@ static int action_ok_load_cdrom(const char *path,
if (!cdrom_drive_has_media(label[0]))
{
RARCH_LOG("[CDROM]: No media is inserted or drive is not ready.\n");
runloop_msg_queue_push(
msg_hash_to_str(MSG_NO_DISC_INSERTED),
1, 100, true,
@ -2162,7 +2164,7 @@ static int action_ok_load_cdrom(const char *path,
cdrom_device_fillpath(cdrom_path, sizeof(cdrom_path), label[0], 0, true);
RARCH_LOG("[CDROM] Loading disc from path: %s\n", cdrom_path);
RARCH_LOG("[CDROM]: Loading disc from path: %s\n", cdrom_path);
path_clear(RARCH_PATH_CONTENT);
path_set(RARCH_PATH_CONTENT, cdrom_path);
@ -2184,7 +2186,7 @@ static int action_ok_load_cdrom(const char *path,
}
else
{
RARCH_LOG("[CDROM] Cannot load disc without a core.\n");
RARCH_LOG("[CDROM]: Cannot load disc without a core.\n");
runloop_msg_queue_push(
msg_hash_to_str(MSG_LOAD_CORE_FIRST),
@ -2205,6 +2207,8 @@ static int action_ok_dump_cdrom(const char *path,
#ifdef HAVE_CDROM
if (!cdrom_drive_has_media(label[0]))
{
RARCH_LOG("[CDROM]: No media is inserted or drive is not ready.\n");
runloop_msg_queue_push(
msg_hash_to_str(MSG_NO_DISC_INSERTED),
1, 100, true,

View File

@ -222,7 +222,7 @@ static void task_cdrom_dump_handler(retro_task_t *task)
task_set_finished(task, true);
RARCH_LOG("[CDROM] Dump finished.\n");
RARCH_LOG("[CDROM]: Dump finished.\n");
return;
}
@ -270,7 +270,7 @@ static void task_cdrom_dump_handler(retro_task_t *task)
state->toc = retro_vfs_file_get_cdrom_toc();
if (cdrom_has_atip(state->stream))
RARCH_LOG("[CDROM] This disc is not genuine.\n");
RARCH_LOG("[CDROM]: This disc is not genuine.\n");
filestream_close(state->file);
@ -356,7 +356,7 @@ static void task_cdrom_dump_handler(retro_task_t *task)
return;
}
RARCH_LOG("[CDROM] Dumping track %d...\n", state->cur_track);
RARCH_LOG("[CDROM]: Dumping track %d...\n", state->cur_track);
memset(state->cdrom_path, 0, sizeof(state->cdrom_path));
@ -426,7 +426,7 @@ static void task_cdrom_dump_handler(retro_task_t *task)
progress = (state->disc_read_bytes / (double)state->disc_total_bytes) * 100.0;
#ifdef CDROM_DEBUG
RARCH_LOG("[CDROM] Read %" PRId64 " bytes, totalling %" PRId64 " of %" PRId64 " bytes. Progress: %d%%\n", read_bytes, state->track_written_bytes, state->cur_track_bytes, progress);
RARCH_LOG("[CDROM]: Read %" PRId64 " bytes, totalling %" PRId64 " of %" PRId64 " bytes. Progress: %d%%\n", read_bytes, state->track_written_bytes, state->cur_track_bytes, progress);
#endif
if (filestream_write(state->output_file, data, read_bytes) <= 0)
@ -491,7 +491,7 @@ void task_push_cdrom_dump(const char *drive)
task->callback = task_cdrom_dump_callback;
task->title = strdup(msg_hash_to_str(MSG_DUMPING_DISC));
RARCH_LOG("[CDROM] Starting disc dump...\n");
RARCH_LOG("[CDROM]: Starting disc dump...\n");
task_queue_push(task);
}