From fbee74e1fe9b6012ff9e860b68cf41bb6b7052ba Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 4 Jun 2021 22:03:08 -0400 Subject: [PATCH] Avoids storing or printing a CRC if none is known. --- Machines/Utility/ROMCatalogue.hpp | 9 ++++-- .../xcschemes/Clock Signal Kiosk.xcscheme | 2 +- OSBindings/SDL/main.cpp | 29 ++++++++++++------- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Machines/Utility/ROMCatalogue.hpp b/Machines/Utility/ROMCatalogue.hpp index 01fc921d2..634ddc7a5 100644 --- a/Machines/Utility/ROMCatalogue.hpp +++ b/Machines/Utility/ROMCatalogue.hpp @@ -9,6 +9,7 @@ #ifndef ROMCatalogue_hpp #define ROMCatalogue_hpp +#include #include #include #include @@ -144,8 +145,12 @@ struct Description { private: template 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 { diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal Kiosk.xcscheme b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal Kiosk.xcscheme index e270b2f2b..2787530a5 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal Kiosk.xcscheme +++ b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal Kiosk.xcscheme @@ -58,7 +58,7 @@ + isEnabled = "NO"> 1) ? "usual crc32s: " : "usual crc32: "); + bool is_first = true; + for(const auto crc32: rom.crc32s) { + if(!is_first) std::cerr << ", "; + is_first = false; + std::cerr << std::hex << std::setfill('0') << std::setw(8) << crc32; + } + } + std::cerr << ")"; } - std::cerr << ((rom.crc32s.size() > 1) ? "usual crc32s: " : "usual crc32: "); - bool is_first = true; - for(const auto crc32: rom.crc32s) { - if(!is_first) std::cerr << ", "; - is_first = false; - std::cerr << std::hex << std::setfill('0') << std::setw(8) << crc32; - } - std::cerr << ")"; if(remaining) { std::cerr << ";";