mirror of
https://github.com/holub/mame
synced 2025-07-04 09:28:51 +03:00
Revert "Allow mame -validate -verbose to display more messages (and make erro…"
This commit is contained in:
parent
4454a0db70
commit
f8eb29b9bd
@ -30,8 +30,6 @@
|
|||||||
#include <new>
|
#include <new>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
extern bool g_print_verbose;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// media_identifier class identifies media by hash via a search in
|
// media_identifier class identifies media by hash via a search in
|
||||||
@ -1613,10 +1611,6 @@ void cli_frontend::execute_commands(const char *exename)
|
|||||||
// validate?
|
// validate?
|
||||||
if (strcmp(m_options.command(), CLICOMMAND_VALIDATE) == 0)
|
if (strcmp(m_options.command(), CLICOMMAND_VALIDATE) == 0)
|
||||||
{
|
{
|
||||||
// hack: enable verbose output if requested
|
|
||||||
if (m_options.verbose())
|
|
||||||
g_print_verbose = true;
|
|
||||||
|
|
||||||
validity_checker valid(m_options);
|
validity_checker valid(m_options);
|
||||||
bool result = valid.check_all();
|
bool result = valid.check_all();
|
||||||
if (!result)
|
if (!result)
|
||||||
|
@ -125,7 +125,6 @@ validity_checker::validity_checker(emu_options &options)
|
|||||||
: m_drivlist(options),
|
: m_drivlist(options),
|
||||||
m_errors(0),
|
m_errors(0),
|
||||||
m_warnings(0),
|
m_warnings(0),
|
||||||
m_verbose(false),
|
|
||||||
m_current_driver(nullptr),
|
m_current_driver(nullptr),
|
||||||
m_current_config(nullptr),
|
m_current_config(nullptr),
|
||||||
m_current_device(nullptr),
|
m_current_device(nullptr),
|
||||||
@ -195,15 +194,19 @@ bool validity_checker::check_all()
|
|||||||
validate_inlines();
|
validate_inlines();
|
||||||
|
|
||||||
// if we had warnings or errors, output
|
// if we had warnings or errors, output
|
||||||
if (m_errors > 0 || m_warnings > 0 || m_verbose)
|
if (m_errors > 0 || m_warnings > 0)
|
||||||
{
|
{
|
||||||
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Core: %d errors, %d warnings\n", m_errors, m_warnings);
|
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Core: %d errors, %d warnings\n", m_errors, m_warnings);
|
||||||
if (m_errors > 0)
|
if (m_errors > 0)
|
||||||
output_indented_errors(m_error_text, "Errors");
|
{
|
||||||
|
strreplace(m_error_text, "\n", "\n ");
|
||||||
|
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Errors:\n %s", m_error_text.c_str());
|
||||||
|
}
|
||||||
if (m_warnings > 0)
|
if (m_warnings > 0)
|
||||||
output_indented_errors(m_warning_text, "Warnings");
|
{
|
||||||
else if (m_verbose)
|
strreplace(m_warning_text, "\n", "\n ");
|
||||||
output_indented_errors(m_warning_text, "Messages");
|
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Warnings:\n %s", m_warning_text.c_str());
|
||||||
|
}
|
||||||
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "\n");
|
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +243,6 @@ void validity_checker::validate_begin()
|
|||||||
// reset internal state
|
// reset internal state
|
||||||
m_errors = 0;
|
m_errors = 0;
|
||||||
m_warnings = 0;
|
m_warnings = 0;
|
||||||
m_verbose = false;
|
|
||||||
m_already_checked.clear();
|
m_already_checked.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +277,6 @@ void validity_checker::validate_one(const game_driver &driver)
|
|||||||
int start_warnings = m_warnings;
|
int start_warnings = m_warnings;
|
||||||
m_error_text.clear();
|
m_error_text.clear();
|
||||||
m_warning_text.clear();
|
m_warning_text.clear();
|
||||||
m_verbose = false;
|
|
||||||
|
|
||||||
// wrap in try/except to catch fatalerrors
|
// wrap in try/except to catch fatalerrors
|
||||||
try
|
try
|
||||||
@ -294,16 +295,20 @@ void validity_checker::validate_one(const game_driver &driver)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we had warnings or errors, output
|
// if we had warnings or errors, output
|
||||||
if (m_errors > start_errors || m_warnings > start_warnings || m_verbose)
|
if (m_errors > start_errors || m_warnings > start_warnings)
|
||||||
{
|
{
|
||||||
std::string tempstr;
|
std::string tempstr;
|
||||||
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): %d errors, %d warnings\n", driver.name, core_filename_extract_base(tempstr, driver.source_file).c_str(), m_errors - start_errors, m_warnings - start_warnings);
|
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Driver %s (file %s): %d errors, %d warnings\n", driver.name, core_filename_extract_base(tempstr, driver.source_file).c_str(), m_errors - start_errors, m_warnings - start_warnings);
|
||||||
if (m_errors > start_errors)
|
if (m_errors > start_errors)
|
||||||
output_indented_errors(m_error_text, "Errors");
|
{
|
||||||
|
strreplace(m_error_text, "\n", "\n ");
|
||||||
|
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Errors:\n %s", m_error_text.c_str());
|
||||||
|
}
|
||||||
if (m_warnings > start_warnings)
|
if (m_warnings > start_warnings)
|
||||||
output_indented_errors(m_warning_text, "Warnings");
|
{
|
||||||
else if (m_verbose)
|
strreplace(m_warning_text, "\n", "\n ");
|
||||||
output_indented_errors(m_warning_text, "Messages");
|
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "Warnings:\n %s", m_warning_text.c_str());
|
||||||
|
}
|
||||||
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "\n");
|
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -610,8 +615,8 @@ void validity_checker::validate_roms()
|
|||||||
device_iterator deviter(m_current_config->root_device());
|
device_iterator deviter(m_current_config->root_device());
|
||||||
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
|
for (device_t *device = deviter.first(); device != nullptr; device = deviter.next())
|
||||||
{
|
{
|
||||||
// track the current device
|
// for non-root devices, track the current device
|
||||||
m_current_device = device;
|
m_current_device = (device->owner() == nullptr) ? nullptr : device;
|
||||||
|
|
||||||
// scan the ROM entries for this device
|
// scan the ROM entries for this device
|
||||||
const char *last_region_name = "???";
|
const char *last_region_name = "???";
|
||||||
@ -875,8 +880,8 @@ void validity_checker::validate_inputs()
|
|||||||
if (device->input_ports() == nullptr)
|
if (device->input_ports() == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// track the current device
|
// for non-root devices, track the current device
|
||||||
m_current_device = device;
|
m_current_device = (device == &m_current_config->root_device()) ? nullptr : device;
|
||||||
|
|
||||||
// allocate the input ports
|
// allocate the input ports
|
||||||
ioport_list portlist;
|
ioport_list portlist;
|
||||||
@ -971,10 +976,6 @@ void validity_checker::validate_devices()
|
|||||||
device_iterator iter_find(m_current_config->root_device());
|
device_iterator iter_find(m_current_config->root_device());
|
||||||
for (const device_t *device = iter_find.first(); device != nullptr; device = iter_find.next())
|
for (const device_t *device = iter_find.first(); device != nullptr; device = iter_find.next())
|
||||||
{
|
{
|
||||||
// track the current device
|
|
||||||
m_current_device = device;
|
|
||||||
|
|
||||||
// try to find some objects
|
|
||||||
device->findit(true);
|
device->findit(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -982,8 +983,8 @@ void validity_checker::validate_devices()
|
|||||||
device_iterator iter(m_current_config->root_device());
|
device_iterator iter(m_current_config->root_device());
|
||||||
for (const device_t *device = iter.first(); device != nullptr; device = iter.next())
|
for (const device_t *device = iter.first(); device != nullptr; device = iter.next())
|
||||||
{
|
{
|
||||||
// track the current device
|
// for non-root devices, track the current device
|
||||||
m_current_device = device;
|
m_current_device = (device == &m_current_config->root_device()) ? nullptr : device;
|
||||||
|
|
||||||
// validate the device tag
|
// validate the device tag
|
||||||
validate_tag(device->basetag());
|
validate_tag(device->basetag());
|
||||||
@ -1047,9 +1048,9 @@ void validity_checker::build_output_prefix(std::string &str)
|
|||||||
// start empty
|
// start empty
|
||||||
str.clear();
|
str.clear();
|
||||||
|
|
||||||
// if we have a current (non-root) device, indicate that
|
// if we have a current device, indicate that
|
||||||
if (m_current_device != nullptr && m_current_device->owner() != nullptr)
|
if (m_current_device != nullptr)
|
||||||
str.append(m_current_device->name()).append(" device '").append(m_current_device->tag()+1).append("': ");
|
str.append(m_current_device->name()).append(" device '").append(m_current_device->tag()).append("': ");
|
||||||
|
|
||||||
// if we have a current port, indicate that as well
|
// if we have a current port, indicate that as well
|
||||||
if (m_current_ioport != nullptr)
|
if (m_current_ioport != nullptr)
|
||||||
@ -1084,17 +1085,6 @@ void validity_checker::output_callback(osd_output_channel channel, const char *m
|
|||||||
// output the source(driver) device 'tag'
|
// output the source(driver) device 'tag'
|
||||||
build_output_prefix(output);
|
build_output_prefix(output);
|
||||||
|
|
||||||
// generate the string and output to the original target
|
|
||||||
strcatvprintf(output, msg, args);
|
|
||||||
m_warning_text.append(output);
|
|
||||||
break;
|
|
||||||
case OSD_OUTPUT_CHANNEL_VERBOSE:
|
|
||||||
// note verbose messages
|
|
||||||
m_verbose = true;
|
|
||||||
|
|
||||||
// output the source(driver) device 'tag'
|
|
||||||
build_output_prefix(output);
|
|
||||||
|
|
||||||
// generate the string and output to the original target
|
// generate the string and output to the original target
|
||||||
strcatvprintf(output, msg, args);
|
strcatvprintf(output, msg, args);
|
||||||
m_warning_text.append(output);
|
m_warning_text.append(output);
|
||||||
@ -1120,16 +1110,3 @@ void validity_checker::output_via_delegate(osd_output_channel channel, const cha
|
|||||||
this->chain_output(channel, format, argptr);
|
this->chain_output(channel, format, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
|
||||||
// output_indented_errors - helper to output error
|
|
||||||
// and warning messages with header and indents
|
|
||||||
//-------------------------------------------------
|
|
||||||
void validity_checker::output_indented_errors(std::string &text, const char *header)
|
|
||||||
{
|
|
||||||
// remove trailing newline
|
|
||||||
if (text[text.size()-1] == '\n')
|
|
||||||
text.erase(text.size()-1, 1);
|
|
||||||
strreplace(text, "\n", "\n ");
|
|
||||||
output_via_delegate(OSD_OUTPUT_CHANNEL_ERROR, "%s:\n %s\n", header, text.c_str());
|
|
||||||
}
|
|
||||||
|
@ -81,7 +81,6 @@ private:
|
|||||||
// output helpers
|
// output helpers
|
||||||
void build_output_prefix(std::string &str);
|
void build_output_prefix(std::string &str);
|
||||||
void output_via_delegate(osd_output_channel channel, const char *format, ...) ATTR_PRINTF(3,4);
|
void output_via_delegate(osd_output_channel channel, const char *format, ...) ATTR_PRINTF(3,4);
|
||||||
void output_indented_errors(std::string &text, const char *header);
|
|
||||||
|
|
||||||
// internal driver list
|
// internal driver list
|
||||||
driver_enumerator m_drivlist;
|
driver_enumerator m_drivlist;
|
||||||
@ -89,7 +88,6 @@ private:
|
|||||||
// error tracking
|
// error tracking
|
||||||
int m_errors;
|
int m_errors;
|
||||||
int m_warnings;
|
int m_warnings;
|
||||||
bool m_verbose;
|
|
||||||
std::string m_error_text;
|
std::string m_error_text;
|
||||||
std::string m_warning_text;
|
std::string m_warning_text;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user