Fix issue 2468

This commit is contained in:
Olivier Galibert 2017-07-13 12:54:46 +02:00
parent e8c63bc373
commit 9f614cdf44
2 changed files with 14 additions and 8 deletions

View File

@ -106,6 +106,8 @@ public:
virtual bool must_be_loaded() const override { return false; }
virtual bool is_reset_on_load() const override { return false; }
virtual char const *file_extensions() const override { return "rom,bin"; }
virtual char const *custom_instance_name() const override { return "promimage"; }
virtual char const *custom_brief_instance_name() const override { return "prom"; }
protected:
virtual void device_start() override;

View File

@ -1287,6 +1287,13 @@ const util::option_guide &device_image_interface::create_option_guide() const
void device_image_interface::update_names()
{
const char *inst_name = custom_instance_name();
const char *brief_name = custom_brief_instance_name();
if (inst_name == nullptr)
inst_name = device_typename(image_type());
if (brief_name == nullptr)
brief_name = device_brieftypename(image_type());
// count instances of the general image type, or device type if custom
int count = 0;
int index = -1;
@ -1294,17 +1301,14 @@ void device_image_interface::update_names()
{
if (this == &image)
index = count;
if ((image.image_type() == image_type() && custom_instance_name() == nullptr) || (device().type() == image.device().type()))
const char *other_name = image.custom_instance_name();
if (!other_name)
other_name = device_typename(image.image_type());
if (other_name == inst_name || !strcmp(other_name, inst_name))
count++;
}
const char *inst_name = custom_instance_name();
const char *brief_name = custom_brief_instance_name();
if (inst_name == nullptr)
inst_name = device_typename(image_type());
if (brief_name == nullptr)
brief_name = device_brieftypename(image_type());
m_canonical_instance_name = string_format("%s%d", inst_name, index + 1);
if (count > 1)
{