mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-29 12:50:28 +00:00
Avoids storing or printing a CRC if none is known.
This commit is contained in:
parent
ccd82591aa
commit
fbee74e1fe
@ -9,6 +9,7 @@
|
||||
#ifndef ROMCatalogue_hpp
|
||||
#define ROMCatalogue_hpp
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@ -144,8 +145,12 @@ struct Description {
|
||||
|
||||
private:
|
||||
template <typename FileNameT, typename CRC32T> Description(
|
||||
Name name, std::string machine_name, std::string descriptive_name, FileNameT file_names, size_t size, CRC32T crc32s
|
||||
) : name{name}, machine_name{machine_name}, descriptive_name{descriptive_name}, file_names{file_names}, size{size}, crc32s{crc32s} {}
|
||||
Name name, std::string machine_name, std::string descriptive_name, FileNameT file_names, size_t size, CRC32T crc32s = CRC32T(0)
|
||||
) : name{name}, machine_name{machine_name}, descriptive_name{descriptive_name}, file_names{file_names}, size{size}, crc32s{crc32s} {
|
||||
if(this->crc32s.size() == 1 && !this->crc32s[0]) {
|
||||
this->crc32s.clear();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct Request {
|
||||
|
@ -58,7 +58,7 @@
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "--rompath=~/ROMs"
|
||||
isEnabled = "YES">
|
||||
isEnabled = "NO">
|
||||
</CommandLineArgument>
|
||||
<CommandLineArgument
|
||||
argument = "--has-disk-drive"
|
||||
|
@ -799,10 +799,15 @@ int main(int argc, char *argv[]) {
|
||||
}, [&indentation_level, indent] (ROM::Request::ListType type, const ROM::Description &rom, bool is_optional, size_t remaining) {
|
||||
indent();
|
||||
if(is_optional) std::cerr << "optionally, ";
|
||||
std::cerr << rom.machine_name << '/' << rom.file_names[0] << " (";
|
||||
std::cerr << rom.machine_name << '/' << rom.file_names[0];
|
||||
|
||||
if(!rom.descriptive_name.empty() || !rom.crc32s.empty()) {
|
||||
std::cerr << " (";
|
||||
if(!rom.descriptive_name.empty()) {
|
||||
std::cerr << rom.descriptive_name << "; ";
|
||||
std::cerr << rom.descriptive_name;
|
||||
if(!rom.crc32s.empty()) std::cerr << "; ";
|
||||
}
|
||||
if(!rom.crc32s.empty()) {
|
||||
std::cerr << ((rom.crc32s.size() > 1) ? "usual crc32s: " : "usual crc32: ");
|
||||
bool is_first = true;
|
||||
for(const auto crc32: rom.crc32s) {
|
||||
@ -810,7 +815,9 @@ int main(int argc, char *argv[]) {
|
||||
is_first = false;
|
||||
std::cerr << std::hex << std::setfill('0') << std::setw(8) << crc32;
|
||||
}
|
||||
}
|
||||
std::cerr << ")";
|
||||
}
|
||||
|
||||
if(remaining) {
|
||||
std::cerr << ";";
|
||||
|
Loading…
Reference in New Issue
Block a user