diff options
author | hap <happppp@users.noreply.github.com> | 2019-03-23 11:50:36 +0100 |
---|---|---|
committer | hap <happppp@users.noreply.github.com> | 2019-03-23 11:50:54 +0100 |
commit | 57cb0af3f0d51263a6c67859cf9961eb4d113a75 (patch) | |
tree | 91fa86534f374074be63400ee644f82b57bd73c9 | |
parent | 842aa09d6af73796a9f52e1dd64f82ddcdbb68de (diff) |
layout: added "inputraw" parameter, for use with inputtag and inputmask. It sets the element state directly to the raw input data & mask. Example uses: 8 way joystick state, multi-bitmask dipswitch state. If you don't want it to respond to layout mouse clicks, add a dummy inputtag rect under it. (nw)
-rw-r--r-- | src/emu/render.h | 1 | ||||
-rw-r--r-- | src/emu/rendlay.cpp | 15 |
2 files changed, 13 insertions, 3 deletions
diff --git a/src/emu/render.h b/src/emu/render.h index 9660b8fc71f..1500dafea73 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -852,6 +852,7 @@ public: std::string m_input_tag; // input tag of this item ioport_port * m_input_port; // input port of this item ioport_value m_input_mask; // input mask of this item + bool m_input_raw; // get raw data from input port screen_device * m_screen; // pointer to screen int m_orientation; // orientation of this item render_bounds m_bounds; // bounds of the item diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index b47d643e254..3f08b56ced4 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -3283,6 +3283,7 @@ layout_view::item::item( , m_input_tag(env.get_attribute_string(itemnode, "inputtag", "")) , m_input_port(nullptr) , m_input_mask(0) + , m_input_raw(false) , m_screen(nullptr) , m_orientation(orientation_add(env.parse_orientation(itemnode.get_child("orientation")), orientation)) , m_color(render_color_multiply(env.parse_color(itemnode.get_child("color")), color)) @@ -3308,6 +3309,7 @@ layout_view::item::item( if (index != -1) m_screen = screen_device_iterator(env.machine().root_device()).byindex(index); m_input_mask = env.get_attribute_int(itemnode, "inputmask", 0); + m_input_raw = env.get_attribute_int(itemnode, "inputraw", 0) == 1; if (m_have_output && m_element) m_output = m_element->default_state(); env.parse_bounds(itemnode.get_child("bounds"), m_rawbounds); @@ -3380,9 +3382,16 @@ int layout_view::item::state() const // if configured to an input, fetch the input value if (m_input_port) { - ioport_field const *const field = m_input_port->field(m_input_mask); - if (field) - return ((m_input_port->read() ^ field->defvalue()) & m_input_mask) ? 1 : 0; + if (m_input_raw) + { + return m_input_port->read() & m_input_mask; + } + else + { + ioport_field const *const field = m_input_port->field(m_input_mask); + if (field) + return ((m_input_port->read() ^ field->defvalue()) & m_input_mask) ? 1 : 0; + } } } |