diff --git a/cd/cd_dump.ixx b/cd/cd_dump.ixx index af22ab17..755f873a 100644 --- a/cd/cd_dump.ixx +++ b/cd/cd_dump.ixx @@ -139,7 +139,7 @@ bool check_subcode_shift(int32_t &subcode_shift, int32_t lba, std::span(t), SPTD::StatusMessage(status)); + LOGC("[LBA: {:6}] SCSI error ({})", std::get<1>(t), SPTD::StatusMessage(status)); } else { @@ -118,7 +118,7 @@ export int redumper_drive_test(Context &ctx, Options &options) if(std::all_of(sector_c2_sub.begin(), sector_c2_sub.end(), [](uint8_t value) { return value == 0; })) { if(options.verbose) - LOG("warning: subcode is zeroed, skipping (sector type: {}, error field: {}, sub channel: {})", std::get<0>(t), ef.second, sc.second); + LOGC("warning: subcode is zeroed, skipping (sector type: {}, error field: {}, sub channel: {})", std::get<0>(t), ef.second, sc.second); continue; } } @@ -161,7 +161,7 @@ export int redumper_drive_test(Context &ctx, Options &options) if(status.status_code) { if(options.verbose) - LOG("[LBA: {:6}] SCSI error ({})", std::get<1>(t), SPTD::StatusMessage(status)); + LOGC("[LBA: {:6}] SCSI error ({})", std::get<1>(t), SPTD::StatusMessage(status)); } else { @@ -172,7 +172,7 @@ export int redumper_drive_test(Context &ctx, Options &options) if(std::all_of(sector_c2_sub.begin(), sector_c2_sub.end(), [](uint8_t value) { return value == 0; })) { if(options.verbose) - LOG("warning: subcode is zeroed, skipping (sector type: {}, error field: {}, sub channel: {})", std::get<0>(t), ef.second, sc.second); + LOGC("warning: subcode is zeroed, skipping (sector type: {}, error field: {}, sub channel: {})", std::get<0>(t), ef.second, sc.second); continue; } } @@ -215,7 +215,7 @@ export int redumper_drive_test(Context &ctx, Options &options) if(status.status_code) { if(options.verbose) - LOG("[LBA: {:6}] SCSI error ({})", std::get<1>(t), SPTD::StatusMessage(status)); + LOGC("[LBA: {:6}] SCSI error ({})", std::get<1>(t), SPTD::StatusMessage(status)); } else { @@ -226,7 +226,7 @@ export int redumper_drive_test(Context &ctx, Options &options) if(std::all_of(sector_c2_sub.begin(), sector_c2_sub.end(), [](uint8_t value) { return value == 0; })) { if(options.verbose) - LOG("warning: subcode is zeroed, skipping (sector type: {}, error field: {}, sub channel: {})", std::get<0>(t), ef.second, sc.second); + LOGC("warning: subcode is zeroed, skipping (sector type: {}, error field: {}, sub channel: {})", std::get<0>(t), ef.second, sc.second); continue; } } @@ -273,7 +273,7 @@ export int redumper_drive_test(Context &ctx, Options &options) if(status.status_code) { if(options.verbose) - LOG("[LBA: {:6}] SCSI error ({})", std::get<1>(t), SPTD::StatusMessage(status)); + LOGC("[LBA: {:6}] SCSI error ({})", std::get<1>(t), SPTD::StatusMessage(status)); } else { @@ -310,7 +310,7 @@ export int redumper_drive_test(Context &ctx, Options &options) if(status.status_code) { if(options.verbose) - LOG("[LBA: {:6}] SCSI error ({})", lba, SPTD::StatusMessage(status)); + LOGC("[LBA: {:6}] SCSI error ({})", lba, SPTD::StatusMessage(status)); } else { @@ -332,7 +332,7 @@ export int redumper_drive_test(Context &ctx, Options &options) if(status.status_code) { if(options.verbose) - LOG("[LBA: {:6}] SCSI error ({})", lba, SPTD::StatusMessage(status)); + LOGC("[LBA: {:6}] SCSI error ({})", lba, SPTD::StatusMessage(status)); break; } else @@ -353,7 +353,7 @@ export int redumper_drive_test(Context &ctx, Options &options) if(status.status_code) { if(options.verbose) - LOG("read cache failed, SCSI ({})", SPTD::StatusMessage(status)); + LOGC("read cache failed, SCSI ({})", SPTD::StatusMessage(status)); } else { diff --git a/dvd/dvd_dump.ixx b/dvd/dvd_dump.ixx index 23608f07..9e34ac36 100644 --- a/dvd/dvd_dump.ixx +++ b/dvd/dvd_dump.ixx @@ -695,7 +695,7 @@ bool sectors_data_state_update(std::span sectors_state, std::span sectors_state, std::spanprintInfo(ss, reader.get(), t.first, options.verbose); + system->printInfo(ss, reader.get(), t.first); if(ss.rdbuf()->in_avail()) { diff --git a/systems/dc.ixx b/systems/dc.ixx index 4e5973ae..28f9ddea 100644 --- a/systems/dc.ixx +++ b/systems/dc.ixx @@ -40,7 +40,7 @@ public: return Type::ISO; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { auto system_area = iso9660::Browser::readSystemArea(data_reader); if(system_area.size() < _ROM_HEADER_OFFSET + sizeof(ROMHeader) || memcmp(system_area.data(), dreamcast::SYSTEM_AREA_MAGIC.data(), dreamcast::SYSTEM_AREA_MAGIC.size())) diff --git a/systems/gc.ixx b/systems/gc.ixx index cab72091..ee6b61d9 100644 --- a/systems/gc.ixx +++ b/systems/gc.ixx @@ -31,7 +31,7 @@ public: return Type::ISO; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &track_path, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &track_path) const override { std::vector header_data(FORM1_DATA_SIZE); data_reader->read((uint8_t *)header_data.data(), 0, 1); diff --git a/systems/mcd.ixx b/systems/mcd.ixx index 3367edf7..2a37ec33 100644 --- a/systems/mcd.ixx +++ b/systems/mcd.ixx @@ -39,7 +39,7 @@ public: return Type::ISO; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { auto system_area = iso9660::Browser::readSystemArea(data_reader); if(system_area.size() < _ROM_HEADER_OFFSET + sizeof(ROMHeader) || memcmp(system_area.data(), _SYSTEM_MAGIC.data(), _SYSTEM_MAGIC.size())) diff --git a/systems/ps2.ixx b/systems/ps2.ixx index 2d53a7f9..d6cec52a 100644 --- a/systems/ps2.ixx +++ b/systems/ps2.ixx @@ -37,7 +37,7 @@ public: } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { iso9660::PrimaryVolumeDescriptor pvd; if(!iso9660::Browser::findDescriptor((iso9660::VolumeDescriptor &)pvd, data_reader, iso9660::VolumeDescriptorType::PRIMARY)) diff --git a/systems/ps3.ixx b/systems/ps3.ixx index 9cab02c4..21df1aa8 100644 --- a/systems/ps3.ixx +++ b/systems/ps3.ixx @@ -37,7 +37,7 @@ public: } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { iso9660::PrimaryVolumeDescriptor pvd; if(!iso9660::Browser::findDescriptor((iso9660::VolumeDescriptor &)pvd, data_reader, iso9660::VolumeDescriptorType::PRIMARY)) diff --git a/systems/ps4.ixx b/systems/ps4.ixx index 78038d40..b75e1606 100644 --- a/systems/ps4.ixx +++ b/systems/ps4.ixx @@ -27,7 +27,7 @@ public: } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { iso9660::PrimaryVolumeDescriptor pvd; if(!iso9660::Browser::findDescriptor((iso9660::VolumeDescriptor &)pvd, data_reader, iso9660::VolumeDescriptorType::PRIMARY)) diff --git a/systems/ps5.ixx b/systems/ps5.ixx index aa3520ea..32f6a937 100644 --- a/systems/ps5.ixx +++ b/systems/ps5.ixx @@ -34,7 +34,7 @@ public: } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { iso9660::PrimaryVolumeDescriptor pvd; if(!iso9660::Browser::findDescriptor((iso9660::VolumeDescriptor &)pvd, data_reader, iso9660::VolumeDescriptorType::PRIMARY)) diff --git a/systems/psx.ixx b/systems/psx.ixx index 4032000c..5f6f016d 100644 --- a/systems/psx.ixx +++ b/systems/psx.ixx @@ -39,7 +39,7 @@ public: return Type::ISO; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &track_path, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &track_path) const override { iso9660::PrimaryVolumeDescriptor pvd; if(!iso9660::Browser::findDescriptor((iso9660::VolumeDescriptor &)pvd, data_reader, iso9660::VolumeDescriptorType::PRIMARY)) diff --git a/systems/s_cdrom.ixx b/systems/s_cdrom.ixx index 41b42e66..3cf6dacb 100644 --- a/systems/s_cdrom.ixx +++ b/systems/s_cdrom.ixx @@ -40,7 +40,7 @@ public: return Type::RAW_DATA; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool verbose) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { std::vector> invalid_sync; uint32_t mode2_form1 = 0; @@ -203,23 +203,23 @@ public: os << std::format(" mode2 (form 2) EDC: {}", mode2_form2_edc ? "yes" : "no") << std::endl; } if(auto count = ranges_count(invalid_sync); count) - os << std::format(" invalid sync sectors: {}{}", count, verbose ? std::format(" (LBA: {})", ranges_to_string(invalid_sync)) : "") << std::endl; + os << std::format(" invalid sync sectors: {} (LBA: {})", count, ranges_to_string(invalid_sync)) << std::endl; if(auto count = ranges_count(invalid_modes); count) - os << std::format(" invalid mode sectors: {}{}", count, verbose ? std::format(" (LBA: {})", ranges_to_string(invalid_modes)) : "") << std::endl; + os << std::format(" invalid mode sectors: {} (LBA: {})", count, ranges_to_string(invalid_modes)) << std::endl; if(auto count = ranges_count(generated); count) - os << std::format(" generated sectors (0x55): {}{}", count, verbose ? std::format(" (LBA: {})", ranges_to_string(generated)) : "") << std::endl; + os << std::format(" generated sectors (0x55): {} (LBA: {})", count, ranges_to_string(generated)) << std::endl; if(auto count = ranges_count(msf_errors); count) - os << std::format(" MSF errors: {}{}", count, verbose ? std::format(" (LBA: {})", ranges_to_string(msf_errors)) : "") << std::endl; + os << std::format(" MSF errors: {} (LBA: {})", count, ranges_to_string(msf_errors)) << std::endl; if(auto count = ranges_count(ecc_nc_errors); count) - os << std::format(" ECC errors (non-compliant): {}{}", count, verbose ? std::format(" (LBA: {})", ranges_to_string(ecc_nc_errors)) : "") << std::endl; + os << std::format(" ECC errors (non-compliant): {} (LBA: {})", count, ranges_to_string(ecc_nc_errors)) << std::endl; if(auto count = ranges_count(ecc_errors); count) - os << std::format(" ECC errors: {}{}", count, verbose ? std::format(" (LBA: {})", ranges_to_string(ecc_errors)) : "") << std::endl; + os << std::format(" ECC errors: {} (LBA: {})", count, ranges_to_string(ecc_errors)) << std::endl; if(auto count = ranges_count(edc_errors); count) - os << std::format(" EDC errors: {}{}", count, verbose ? std::format(" (LBA: {})", ranges_to_string(edc_errors)) : "") << std::endl; + os << std::format(" EDC errors: {} (LBA: {})", count, ranges_to_string(edc_errors)) << std::endl; if(auto count = ranges_count(subheader_mismatches); count) - os << std::format(" CD-XA subheader mismatches: {}{}", count, verbose ? std::format(" (LBA: {})", ranges_to_string(subheader_mismatches)) : "") << std::endl; + os << std::format(" CD-XA subheader mismatches: {} (LBA: {})", count, ranges_to_string(subheader_mismatches)) << std::endl; os << std::endl; - os << std::format(" REDUMP.ORG errors: {}", redump_errors) << std::endl; + os << std::format(" REDUMP.INFO errors: {}", redump_errors) << std::endl; } private: diff --git a/systems/s_hfs.ixx b/systems/s_hfs.ixx index 97b0c015..8d0b343f 100644 --- a/systems/s_hfs.ixx +++ b/systems/s_hfs.ixx @@ -32,7 +32,7 @@ public: return Type::DISK; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { auto hfs_partitions = apm::Browser::getPartitions(data_reader) | std::views::filter([](const apm::PartitionMapEntry &v) { return v.partition_type == apm::PARTITION_TYPE_APPLE_HFS; }); for(const auto &partition_map_entry : hfs_partitions) diff --git a/systems/s_high_sierra.ixx b/systems/s_high_sierra.ixx index 1add67cb..18983523 100644 --- a/systems/s_high_sierra.ixx +++ b/systems/s_high_sierra.ixx @@ -32,7 +32,7 @@ public: return Type::ISO; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { auto vd = high_sierra::Browser::findDescriptor(data_reader, high_sierra::VolumeDescriptorType::STANDARD_FS); if(vd) diff --git a/systems/s_iso.ixx b/systems/s_iso.ixx index a1aa61d4..67e9efdf 100644 --- a/systems/s_iso.ixx +++ b/systems/s_iso.ixx @@ -33,7 +33,7 @@ public: return Type::ISO; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { iso9660::PrimaryVolumeDescriptor pvd; if(iso9660::Browser::findDescriptor((iso9660::VolumeDescriptor &)pvd, data_reader, iso9660::VolumeDescriptorType::PRIMARY)) diff --git a/systems/s_xbox.ixx b/systems/s_xbox.ixx index 48ec9463..f08840ee 100644 --- a/systems/s_xbox.ixx +++ b/systems/s_xbox.ixx @@ -39,7 +39,7 @@ public: return Type::ISO; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &track_path, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &track_path) const override { std::filesystem::path security_path = track_extract_basename(track_path.string()) + ".security"; if(!std::filesystem::exists(security_path)) diff --git a/systems/sat.ixx b/systems/sat.ixx index f539e5dc..16d45585 100644 --- a/systems/sat.ixx +++ b/systems/sat.ixx @@ -41,7 +41,7 @@ public: return Type::ISO; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &) const override { auto system_area = iso9660::Browser::readSystemArea(data_reader); if(system_area.size() < _SYSTEM_MAGIC.size() || memcmp(system_area.data(), _SYSTEM_MAGIC.data(), _SYSTEM_MAGIC.size())) diff --git a/systems/securom.ixx b/systems/securom.ixx index c3f90339..8b7c7786 100644 --- a/systems/securom.ixx +++ b/systems/securom.ixx @@ -41,7 +41,7 @@ public: } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &track_path, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &track_path) const override { // SecuROM data track has one sector with flipped mode static constexpr uint32_t flip_offset = 4; diff --git a/systems/system.hh b/systems/system.hh index f124ca00..2ccfb092 100644 --- a/systems/system.hh +++ b/systems/system.hh @@ -27,7 +27,7 @@ public: virtual std::string getName() = 0; virtual Type getType() = 0; - virtual void printInfo(std::ostream &os, DataReader *sector_reader, const std::filesystem::path &track_path, bool verbose) const = 0; + virtual void printInfo(std::ostream &os, DataReader *sector_reader, const std::filesystem::path &track_path) const = 0; }; } diff --git a/systems/wii.ixx b/systems/wii.ixx index e9c8e336..8da028a4 100644 --- a/systems/wii.ixx +++ b/systems/wii.ixx @@ -32,7 +32,7 @@ public: return Type::ISO; } - void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &track_path, bool) const override + void printInfo(std::ostream &os, DataReader *data_reader, const std::filesystem::path &track_path) const override { std::vector header_data(FORM1_DATA_SIZE); data_reader->read((uint8_t *)header_data.data(), 0, 1); diff --git a/utils/logger.ixx b/utils/logger.ixx index 36aa62d7..1e94df42 100644 --- a/utils/logger.ixx +++ b/utils/logger.ixx @@ -164,6 +164,14 @@ constexpr void LOG_R(std::format_string fmt, Args &&...args) } +// erase current line and log message followed by a new line (console) +export template +constexpr void LOGC_R(std::format_string fmt, Args &&...args) +{ + Logger::get().carriageReturn().log(false, fmt, std::forward(args)...).lineFeed(false); +} + + // erase current line, log message and flush, no new line (console) // used for progress update export template