diff options
| author | 2024-11-09 01:23:07 +0900 | |
|---|---|---|
| committer | 2024-11-09 03:23:07 +1100 | |
| commit | 2c8de2ee29788764415c87250164f4a4bb223eac (patch) | |
| tree | 69082d996b323de6557b312714c34bb72b5c2f4d /src/tools | |
| parent | e9dcdb5200d93f888d0102a618327e064b07aea2 (diff) | |
-util/cdrom.cpp: Fixed issues with CUE, TOC and GDI parsers. (#12948)
* Rewrote GDI parser to be more robust and identify more kinds of invalid input.
* Don't ignore the last line in CUE and TOC files if there is no terminating newline.
* Use osd_printf_ family functions for output.
-tools/chdman.cpp: Added a sink for osd_printf_ family function output.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/chdman.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/tools/chdman.cpp b/src/tools/chdman.cpp index e7aca251dd7..353ac88ce6b 100644 --- a/src/tools/chdman.cpp +++ b/src/tools/chdman.cpp @@ -17,6 +17,7 @@ #include "hashing.h" #include "md5.h" #include "multibyte.h" +#include "osdcore.h" #include "path.h" #include "strformat.h" #include "vbiparse.h" @@ -71,6 +72,9 @@ constexpr int MODE_NORMAL = 0; constexpr int MODE_CUEBIN = 1; constexpr int MODE_GDI = 2; +// osd printf verbosity +constexpr bool OSD_PRINTF_VERBOSE = false; + // command modifier #define REQUIRED "~" @@ -157,6 +161,46 @@ static void do_list_templates(parameters_map ¶ms); // TYPE DEFINITIONS //************************************************************************** +// Allow chdman to show osd_printf_X messages +class chdman_osd_output : public osd_output +{ +public: + chdman_osd_output() { + osd_output::push(this); + } + + ~chdman_osd_output() { + osd_output::pop(this); + } + + void output_callback(osd_output_channel channel, const util::format_argument_pack<char> &args); +}; + +void chdman_osd_output::output_callback(osd_output_channel channel, const util::format_argument_pack<char> &args) +{ + switch (channel) + { + case OSD_OUTPUT_CHANNEL_ERROR: + case OSD_OUTPUT_CHANNEL_WARNING: + util::stream_format(std::cerr, args); + break; + case OSD_OUTPUT_CHANNEL_INFO: + case OSD_OUTPUT_CHANNEL_LOG: + util::stream_format(std::cout, args); + break; + case OSD_OUTPUT_CHANNEL_VERBOSE: + if (OSD_PRINTF_VERBOSE) util::stream_format(std::cout, args); + break; + case OSD_OUTPUT_CHANNEL_DEBUG: +#ifdef MAME_DEBUG + util::stream_format(std::cout, args); +#endif + break; + default: + break; + } +} + // ======================> option_description struct option_description @@ -3354,6 +3398,7 @@ static void do_list_templates(parameters_map ¶ms) int CLIB_DECL main(int argc, char *argv[]) { const std::vector<std::string> args = osd_get_command_line(argc, argv); + chdman_osd_output osdoutput; // print the header extern const char build_version[]; |
