diff options
| author | 2020-08-30 23:39:18 -0400 | |
|---|---|---|
| committer | 2020-08-31 00:00:03 -0400 | |
| commit | 46071c487e97cf1faa014a853b032be91fd4b1e2 (patch) | |
| tree | 36d0fdd8a93da1f1897a5c6341d2eab019a7dac4 /src/devices/machine/netlist.cpp | |
| parent | 71bcb539fec9d90572e3170f751746465fd976b4 (diff) | |
device_state_interface overhaul
- device_state_entry::value and device_state_entry::set_value now do everything except the register lookup, allowing them to be made public. The debugger expression engine now uses these.
- device_state_entry::dvalue and device_state_entry::set_dvalue have also been made public, theoretically permitting outside code layers to inspect and modify floating-point registers.
- The double specialization of device_pseudo_state_register (now renamed device_functional_state_register) has been added to the core.
- state_add now has an additional specialization that takes both a reference and a write function, using the former for reads only.
- state_max_length has been eliminated in favor of obtaining the relevant info through device_state_entry::max_length.
- The debugger state view no longer adds "flags" as "???" if none have been registered.
- set_state_string has been removed. It was never properly implemented, and it is difficult to see how it could have been done in a useful and consistent way.
- state_find_entry and its typical callers state_int and set_state_int have been inlined for some hopeful efficiency gains.
Diffstat (limited to 'src/devices/machine/netlist.cpp')
| -rw-r--r-- | src/devices/machine/netlist.cpp | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/src/devices/machine/netlist.cpp b/src/devices/machine/netlist.cpp index f4692a29547..0744b67d87d 100644 --- a/src/devices/machine/netlist.cpp +++ b/src/devices/machine/netlist.cpp @@ -1238,35 +1238,6 @@ netlist_mame_cpu_device::netlist_mame_cpu_device(const machine_config &mconfig, } -// Fixes overflow error in device_pseudo_state_register -template<> -class device_pseudo_state_register<double> : public device_state_entry -{ -public: - typedef typename std::function<double ()> getter_func; - typedef typename std::function<void (double)> setter_func; - - // construction/destruction - device_pseudo_state_register(int index, const char *symbol, getter_func &&getter, setter_func &&setter, device_state_interface *dev) - : device_state_entry(index, symbol, sizeof(double), ~u64(0), DSF_FLOATING_POINT, dev), - m_getter(std::move(getter)), - m_setter(std::move(setter)) - { - } - -protected: - // device_state_entry overrides - virtual u64 entry_value() const override { return u64(m_getter()); } - virtual void entry_set_value(u64 value) const override { m_setter(double(value)); } - virtual double entry_dvalue() const override { return m_getter(); } - virtual void entry_set_dvalue(double value) const override { m_setter(value); } - -private: - getter_func m_getter; // function to retrieve the data - setter_func m_setter; // function to store the data -}; - - void netlist_mame_cpu_device::device_start() { LOGDEVCALLS("device_start entry\n"); @@ -1299,12 +1270,11 @@ void netlist_mame_cpu_device::device_start() else { auto nl = downcast<netlist::analog_net_t *>(n.get()); - state_add(std::make_unique<device_pseudo_state_register<double>>( + state_add<double>( index++, name.c_str(), [nl]() { return nl->Q_Analog(); }, - [nl](double data) { nl->set_Q_Analog(data); }, - this)); + [nl](double data) { nl->set_Q_Analog(data); }); } } |
