diff --git a/src/emu/distate.c b/src/emu/distate.c index cee1f0a6c26..54e24b4d35a 100644 --- a/src/emu/distate.c +++ b/src/emu/distate.c @@ -49,8 +49,9 @@ const UINT64 device_state_entry::k_decimal_divisor[] = // device_state_entry - constructor //------------------------------------------------- -device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size) - : m_next(NULL), +device_state_entry::device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size, device_state_interface *dev) + : m_device_state(dev), + m_next(NULL), m_index(index), m_dataptr(dataptr), m_datamask(0), @@ -86,8 +87,9 @@ device_state_entry::device_state_entry(int index, const char *symbol, void *data m_symbol.cpy("CURFLAGS"); } -device_state_entry::device_state_entry(int index) - : m_next(NULL), +device_state_entry::device_state_entry(int index, device_state_interface *dev) + : m_device_state(dev), + m_next(NULL), m_index(index), m_dataptr(NULL), m_datamask(0), @@ -523,7 +525,7 @@ device_state_entry &device_state_interface::state_add(int index, const char *sym assert(symbol != NULL); // 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 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) { // 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 m_state_list.append(*entry); diff --git a/src/emu/distate.h b/src/emu/distate.h index 7b5117e19e2..d3679b755e6 100644 --- a/src/emu/distate.h +++ b/src/emu/distate.h @@ -49,8 +49,8 @@ class device_state_entry private: // construction/destruction - device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size); - device_state_entry(int index); + device_state_entry(int index, const char *symbol, void *dataptr, UINT8 size, device_state_interface *dev); + device_state_entry(int index, device_state_interface *dev); public: // post-construction modifiers @@ -70,6 +70,7 @@ public: const char *symbol() const { return m_symbol; } bool visible() const { return ((m_flags & DSF_NOSHOW) == 0); } bool divider() const { return m_flags & DSF_DIVIDER; } + device_state_interface *parent_state() const {return m_device_state;} protected: // device state flags @@ -98,6 +99,7 @@ protected: static const UINT64 k_decimal_divisor[20]; // divisors for outputting decimal values // public state description + device_state_interface *m_device_state; // link to parent device state device_state_entry * m_next; // link to next item UINT32 m_index; // index by which this item is referred generic_ptr m_dataptr; // pointer to where the data lives