mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
distate: don't try to read unused value() during formatstr
This commit is contained in:
parent
2bfe2358fb
commit
47a484001c
4 changed files with 15 additions and 18 deletions
|
@ -341,7 +341,7 @@ void tms99xx_device::state_import(const device_state_entry &entry)
|
|||
break;
|
||||
default:
|
||||
// Workspace registers
|
||||
if (index <= TMS9900_R15 && started())
|
||||
if (index <= TMS9900_R15)
|
||||
write_workspace_register_debug(index-TMS9900_R0, (uint16_t)m_state_any);
|
||||
break;
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ void tms99xx_device::state_export(const device_state_entry &entry)
|
|||
default:
|
||||
// Workspace registers
|
||||
if (index <= TMS9900_R15)
|
||||
m_state_any = started() ? read_workspace_register_debug(index-TMS9900_R0) : 0;
|
||||
m_state_any = read_workspace_register_debug(index-TMS9900_R0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,7 +339,7 @@ void tms9995_device::state_import(const device_state_entry &entry)
|
|||
break;
|
||||
default:
|
||||
// Workspace registers
|
||||
if (index <= TMS9995_R15 && started())
|
||||
if (index <= TMS9995_R15)
|
||||
write_workspace_register_debug(index-TMS9995_R0, (uint16_t)m_state_any);
|
||||
break;
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ void tms9995_device::state_export(const device_state_entry &entry)
|
|||
default:
|
||||
// Workspace registers
|
||||
if (index <= TMS9995_R15)
|
||||
m_state_any = started() ? read_workspace_register_debug(index-TMS9995_R0) : 0;
|
||||
m_state_any = read_workspace_register_debug(index-TMS9995_R0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ device_state_entry &device_state_entry::formatstr(const char *_format)
|
|||
|
||||
// set the DSF_CUSTOM_STRING flag by formatting with a nullptr string
|
||||
m_flags &= ~DSF_CUSTOM_STRING;
|
||||
format(nullptr);
|
||||
format(nullptr, 0);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -201,12 +201,10 @@ double device_state_entry::entry_dvalue() const
|
|||
// pieces of indexed state as a string
|
||||
//-------------------------------------------------
|
||||
|
||||
std::string device_state_entry::format(const char *string, bool maxout) const
|
||||
std::string device_state_entry::format(const char *string, u64 result, bool maxout) const
|
||||
{
|
||||
std::string dest;
|
||||
u64 result = value();
|
||||
|
||||
// parse the format
|
||||
std::string dest;
|
||||
bool leadzero = false;
|
||||
bool percent = false;
|
||||
bool explicitsign = false;
|
||||
|
@ -400,7 +398,7 @@ std::string device_state_entry::to_string() const
|
|||
custom = string_format("%-12G", entry_dvalue());
|
||||
|
||||
// ask the entry to format itself
|
||||
return format(custom.c_str());
|
||||
return format(custom.c_str(), value());
|
||||
}
|
||||
|
||||
|
||||
|
@ -412,7 +410,7 @@ std::string device_state_entry::to_string() const
|
|||
int device_state_entry::max_length() const
|
||||
{
|
||||
// ask the entry to format itself maximally
|
||||
return format("", true).length();
|
||||
return format("", value(), true).length();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -104,10 +104,10 @@ protected:
|
|||
private:
|
||||
// helpers
|
||||
void format_from_mask();
|
||||
std::string format(const char *string, bool maxout = false) const;
|
||||
std::string format(const char *string, u64 result, bool maxout = false) const;
|
||||
|
||||
// statics
|
||||
static const u64 k_decimal_divisor[20]; // divisors for outputting decimal values
|
||||
static const u64 k_decimal_divisor[20]; // divisors for outputting decimal values
|
||||
|
||||
// public state description
|
||||
device_state_interface *m_device_state; // link to parent device state
|
||||
|
@ -357,13 +357,12 @@ protected:
|
|||
virtual void interface_post_start() override;
|
||||
|
||||
// constants
|
||||
static constexpr int FAST_STATE_MIN = -4; // range for fast state
|
||||
static constexpr int FAST_STATE_MAX = 256; // lookups
|
||||
static constexpr int FAST_STATE_MIN = -4; // range for fast state
|
||||
static constexpr int FAST_STATE_MAX = 256; // lookups
|
||||
|
||||
// state
|
||||
std::vector<std::unique_ptr<device_state_entry>> m_state_list; // head of state list
|
||||
device_state_entry * m_fast_state[FAST_STATE_MAX + 1 - FAST_STATE_MIN];
|
||||
// fast access to common entries
|
||||
std::vector<std::unique_ptr<device_state_entry>> m_state_list; // head of state list
|
||||
device_state_entry *m_fast_state[FAST_STATE_MAX + 1 - FAST_STATE_MIN]; // fast access to common entries
|
||||
};
|
||||
|
||||
// iterator
|
||||
|
|
Loading…
Reference in a new issue