mirror of
https://github.com/holub/mame
synced 2025-06-28 23:24:23 +03:00
core: link state entries to parent state interface
In device state, link a single device_state_entry to its parent device_state_interface and expose a parent_state() getter. Signed-off-by: Luca Bruno <lucab@debian.org>
This commit is contained in:
parent
d2ff267ac1
commit
c95ed9c31d
@ -49,8 +49,9 @@ const UINT64 device_state_entry::k_decimal_divisor[] =
|
|||||||
// device_state_entry - constructor
|
// device_state_entry - constructor
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size)
|
device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size, device_state_interface *dev)
|
||||||
: m_next(NULL),
|
: m_device_state(dev),
|
||||||
|
m_next(NULL),
|
||||||
m_index(index),
|
m_index(index),
|
||||||
m_dataptr(dataptr),
|
m_dataptr(dataptr),
|
||||||
m_datamask(0),
|
m_datamask(0),
|
||||||
@ -86,8 +87,9 @@ device_state_entry::device_state_entry(int index, const char *symbol, void *data
|
|||||||
m_symbol.cpy("CURFLAGS");
|
m_symbol.cpy("CURFLAGS");
|
||||||
}
|
}
|
||||||
|
|
||||||
device_state_entry::device_state_entry(int index)
|
device_state_entry::device_state_entry(int index, device_state_interface *dev)
|
||||||
: m_next(NULL),
|
: m_device_state(dev),
|
||||||
|
m_next(NULL),
|
||||||
m_index(index),
|
m_index(index),
|
||||||
m_dataptr(NULL),
|
m_dataptr(NULL),
|
||||||
m_datamask(0),
|
m_datamask(0),
|
||||||
@ -523,7 +525,7 @@ device_state_entry &device_state_interface::state_add(int index, const char *sym
|
|||||||
assert(symbol != NULL);
|
assert(symbol != NULL);
|
||||||
|
|
||||||
// allocate new entry
|
// allocate new entry
|
||||||
device_state_entry *entry = global_alloc(device_state_entry(index, symbol, data, size));
|
device_state_entry *entry = global_alloc(device_state_entry(index, symbol, data, size, this));
|
||||||
|
|
||||||
// append to the end of the list
|
// append to the end of the list
|
||||||
m_state_list.append(*entry);
|
m_state_list.append(*entry);
|
||||||
@ -543,7 +545,7 @@ device_state_entry &device_state_interface::state_add(int index, const char *sym
|
|||||||
device_state_entry &device_state_interface::state_add_divider(int index)
|
device_state_entry &device_state_interface::state_add_divider(int index)
|
||||||
{
|
{
|
||||||
// allocate new entry
|
// allocate new entry
|
||||||
device_state_entry *entry = global_alloc(device_state_entry(index));
|
device_state_entry *entry = global_alloc(device_state_entry(index, this));
|
||||||
|
|
||||||
// append to the end of the list
|
// append to the end of the list
|
||||||
m_state_list.append(*entry);
|
m_state_list.append(*entry);
|
||||||
|
@ -49,8 +49,8 @@ class device_state_entry
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// construction/destruction
|
// construction/destruction
|
||||||
device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size);
|
device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size, device_state_interface *dev);
|
||||||
device_state_entry(int index);
|
device_state_entry(int index, device_state_interface *dev);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// post-construction modifiers
|
// post-construction modifiers
|
||||||
@ -70,6 +70,7 @@ public:
|
|||||||
const char *symbol() const { return m_symbol; }
|
const char *symbol() const { return m_symbol; }
|
||||||
bool visible() const { return ((m_flags & DSF_NOSHOW) == 0); }
|
bool visible() const { return ((m_flags & DSF_NOSHOW) == 0); }
|
||||||
bool divider() const { return m_flags & DSF_DIVIDER; }
|
bool divider() const { return m_flags & DSF_DIVIDER; }
|
||||||
|
device_state_interface *parent_state() const {return m_device_state;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device state flags
|
// device state flags
|
||||||
@ -98,6 +99,7 @@ protected:
|
|||||||
static const UINT64 k_decimal_divisor[20]; // divisors for outputting decimal values
|
static const UINT64 k_decimal_divisor[20]; // divisors for outputting decimal values
|
||||||
|
|
||||||
// public state description
|
// public state description
|
||||||
|
device_state_interface *m_device_state; // link to parent device state
|
||||||
device_state_entry * m_next; // link to next item
|
device_state_entry * m_next; // link to next item
|
||||||
UINT32 m_index; // index by which this item is referred
|
UINT32 m_index; // index by which this item is referred
|
||||||
generic_ptr m_dataptr; // pointer to where the data lives
|
generic_ptr m_dataptr; // pointer to where the data lives
|
||||||
|
Loading…
Reference in New Issue
Block a user