summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author therealmogminer@gmail.com <therealmogminer@gmail.com>2016-10-25 13:34:55 +0200
committer therealmogminer@gmail.com <therealmogminer@gmail.com>2016-10-25 13:35:25 +0200
commit5611934cf2768513f831ad991268711d6462de6d (patch)
treeb8655c9fec1dfb18e22296570fa940151910bbae /src/emu
parent9f7819cb3571751dbe4fd4b4188c84a2a5e8a3bd (diff)
Not for the release branch: remove all ioport and address map macros from tranz330 driver, just as a test to play around with, (nw)
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/ioport.cpp25
-rw-r--r--src/emu/ioport.h62
2 files changed, 47 insertions, 40 deletions
diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp
index 84710e23453..3eb8eb4040f 100644
--- a/src/emu/ioport.cpp
+++ b/src/emu/ioport.cpp
@@ -2997,7 +2997,7 @@ const char *ioport_configurer::string_from_token(const char *string)
// port_alloc - allocate a new port
//-------------------------------------------------
-void ioport_configurer::port_alloc(const char *tag)
+ioport_configurer& ioport_configurer::port_alloc(const char *tag)
{
// create the full tag
std::string fulltag = m_owner.subtag(tag);
@@ -3008,6 +3008,7 @@ void ioport_configurer::port_alloc(const char *tag)
m_curport = m_portlist.find(fulltag)->second.get();
m_curfield = nullptr;
m_cursetting = nullptr;
+ return *this;
}
@@ -3016,7 +3017,7 @@ void ioport_configurer::port_alloc(const char *tag)
// modify it
//-------------------------------------------------
-void ioport_configurer::port_modify(const char *tag)
+ioport_configurer& ioport_configurer::port_modify(const char *tag)
{
// create the full tag
std::string fulltag = m_owner.subtag(tag);
@@ -3030,6 +3031,7 @@ void ioport_configurer::port_modify(const char *tag)
m_curport->m_modcount++;
m_curfield = nullptr;
m_cursetting = nullptr;
+ return *this;
}
@@ -3037,7 +3039,7 @@ void ioport_configurer::port_modify(const char *tag)
// field_alloc - allocate a new field
//-------------------------------------------------
-void ioport_configurer::field_alloc(ioport_type type, ioport_value defval, ioport_value mask, const char *name)
+ioport_configurer& ioport_configurer::field_alloc(ioport_type type, ioport_value defval, ioport_value mask, const char *name)
{
// make sure we have a port
if (m_curport == nullptr)
@@ -3049,6 +3051,7 @@ void ioport_configurer::field_alloc(ioport_type type, ioport_value defval, iopor
// reset the current setting
m_cursetting = nullptr;
+ return *this;
}
@@ -3056,13 +3059,13 @@ void ioport_configurer::field_alloc(ioport_type type, ioport_value defval, iopor
// field_add_char - add a character to a field
//-------------------------------------------------
-void ioport_configurer::field_add_char(char32_t ch)
+ioport_configurer& ioport_configurer::field_add_char(char32_t ch)
{
for (int index = 0; index < ARRAY_LENGTH(m_curfield->m_chars); index++)
if (m_curfield->m_chars[index] == 0)
{
m_curfield->m_chars[index] = ch;
- return;
+ return *this;
}
throw emu_fatalerror("PORT_CHAR(%d) could not be added - maximum amount exceeded\n", ch);
@@ -3073,9 +3076,10 @@ void ioport_configurer::field_add_char(char32_t ch)
// field_add_code - add a character to a field
//-------------------------------------------------
-void ioport_configurer::field_add_code(input_seq_type which, input_code code)
+ioport_configurer& ioport_configurer::field_add_code(input_seq_type which, input_code code)
{
m_curfield->m_seq[which] |= code;
+ return *this;
}
@@ -3083,7 +3087,7 @@ void ioport_configurer::field_add_code(input_seq_type which, input_code code)
// setting_alloc - allocate a new setting
//-------------------------------------------------
-void ioport_configurer::setting_alloc(ioport_value value, const char *name)
+ioport_configurer& ioport_configurer::setting_alloc(ioport_value value, const char *name)
{
// make sure we have a field
if (m_curfield == nullptr)
@@ -3092,6 +3096,7 @@ void ioport_configurer::setting_alloc(ioport_value value, const char *name)
m_cursetting = global_alloc(ioport_setting(*m_curfield, value & m_curfield->mask(), string_from_token(name)));
// append a new setting
m_curfield->m_settinglist.append(*m_cursetting);
+ return *this;
}
@@ -3100,10 +3105,11 @@ void ioport_configurer::setting_alloc(ioport_value value, const char *name)
// the current setting or field
//-------------------------------------------------
-void ioport_configurer::set_condition(ioport_condition::condition_t condition, const char *tag, ioport_value mask, ioport_value value)
+ioport_configurer& ioport_configurer::set_condition(ioport_condition::condition_t condition, const char *tag, ioport_value mask, ioport_value value)
{
ioport_condition &target = (m_cursetting != nullptr) ? m_cursetting->condition() : m_curfield->condition();
target.set(condition, tag, mask, value);
+ return *this;
}
@@ -3111,7 +3117,7 @@ void ioport_configurer::set_condition(ioport_condition::condition_t condition, c
// onoff_alloc - allocate an on/off DIP switch
//-------------------------------------------------
-void ioport_configurer::onoff_alloc(const char *name, ioport_value defval, ioport_value mask, const char *diplocation)
+ioport_configurer& ioport_configurer::onoff_alloc(const char *name, ioport_value defval, ioport_value mask, const char *diplocation)
{
// allocate a field normally
field_alloc(IPT_DIPSWITCH, defval, mask, name);
@@ -3132,6 +3138,7 @@ void ioport_configurer::onoff_alloc(const char *name, ioport_value defval, iopor
setting_alloc(~defval & mask, DEF_STR(On));
// clear cursettings set by setting_alloc
m_cursetting = nullptr;
+ return *this;
}
diff --git a/src/emu/ioport.h b/src/emu/ioport.h
index cf5914afc8c..3b655abc006 100644
--- a/src/emu/ioport.h
+++ b/src/emu/ioport.h
@@ -1508,43 +1508,43 @@ public:
static const char *string_from_token(const char *string);
// port helpers
- void port_alloc(const char *tag);
- void port_modify(const char *tag);
+ ioport_configurer& port_alloc(const char *tag);
+ ioport_configurer& port_modify(const char *tag);
// field helpers
- void field_alloc(ioport_type type, ioport_value defval, ioport_value mask, const char *name = nullptr);
- void field_add_char(char32_t ch);
- void field_add_code(input_seq_type which, input_code code);
- void field_set_way(int way) const { m_curfield->m_way = way; }
- void field_set_rotated() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_ROTATED; }
- void field_set_name(const char *name) const { m_curfield->m_name = string_from_token(name); }
- void field_set_player(int player) const { m_curfield->m_player = player - 1; }
- void field_set_cocktail() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_COCKTAIL; field_set_player(2); }
- void field_set_toggle() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_TOGGLE; }
- void field_set_impulse(uint8_t impulse) const { m_curfield->m_impulse = impulse; }
- void field_set_analog_reverse() const { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_REVERSE; }
- void field_set_analog_reset() const { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_RESET; }
- void field_set_optional() const { m_curfield->m_flags |= ioport_field::FIELD_FLAG_OPTIONAL; }
- void field_set_min_max(ioport_value minval, ioport_value maxval) const { m_curfield->m_min = minval; m_curfield->m_max = maxval; }
- void field_set_sensitivity(int32_t sensitivity) const { m_curfield->m_sensitivity = sensitivity; }
- void field_set_delta(int32_t delta) const { m_curfield->m_centerdelta = m_curfield->m_delta = delta; }
- void field_set_centerdelta(int32_t delta) const { m_curfield->m_centerdelta = delta; }
- void field_set_crosshair(crosshair_axis_t axis, double altaxis, double scale, double offset) const { m_curfield->m_crosshair_axis = axis; m_curfield->m_crosshair_altaxis = altaxis; m_curfield->m_crosshair_scale = scale; m_curfield->m_crosshair_offset = offset; }
- void field_set_crossmapper(ioport_field_crossmap_delegate callback) const { m_curfield->m_crosshair_mapper = callback; }
- void field_set_full_turn_count(uint16_t count) const { m_curfield->m_full_turn_count = count; }
- void field_set_analog_wraps() const { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_WRAPS; }
- void field_set_remap_table(const ioport_value *table) { m_curfield->m_remap_table = table; }
- void field_set_analog_invert() const { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_INVERT; }
- void field_set_dynamic_read(ioport_field_read_delegate delegate, void *param = nullptr) const { m_curfield->m_read = delegate; m_curfield->m_read_param = param; }
- void field_set_dynamic_write(ioport_field_write_delegate delegate, void *param = nullptr) const { m_curfield->m_write = delegate; m_curfield->m_write_param = param; }
- void field_set_diplocation(const char *location) const { m_curfield->expand_diplocation(location, m_errorbuf); }
+ ioport_configurer& field_alloc(ioport_type type, ioport_value defval, ioport_value mask, const char *name = nullptr);
+ ioport_configurer& field_add_char(char32_t ch);
+ ioport_configurer& field_add_code(input_seq_type which, input_code code);
+ ioport_configurer& field_set_way(int way) { m_curfield->m_way = way; return *this; }
+ ioport_configurer& field_set_rotated() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_ROTATED; return *this; }
+ ioport_configurer& field_set_name(const char *name) { m_curfield->m_name = string_from_token(name); return *this; }
+ ioport_configurer& field_set_player(int player) { m_curfield->m_player = player - 1; return *this; }
+ ioport_configurer& field_set_cocktail() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_COCKTAIL; field_set_player(2); return *this; }
+ ioport_configurer& field_set_toggle() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_TOGGLE; return *this; }
+ ioport_configurer& field_set_impulse(uint8_t impulse) { m_curfield->m_impulse = impulse; return *this; }
+ ioport_configurer& field_set_analog_reverse() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_REVERSE; return *this; }
+ ioport_configurer& field_set_analog_reset() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_RESET; return *this; }
+ ioport_configurer& field_set_optional() { m_curfield->m_flags |= ioport_field::FIELD_FLAG_OPTIONAL; return *this; }
+ ioport_configurer& field_set_min_max(ioport_value minval, ioport_value maxval) { m_curfield->m_min = minval; m_curfield->m_max = maxval; return *this; }
+ ioport_configurer& field_set_sensitivity(int32_t sensitivity) { m_curfield->m_sensitivity = sensitivity; return *this; }
+ ioport_configurer& field_set_delta(int32_t delta) { m_curfield->m_centerdelta = m_curfield->m_delta = delta; return *this; }
+ ioport_configurer& field_set_centerdelta(int32_t delta) { m_curfield->m_centerdelta = delta; return *this; }
+ ioport_configurer& field_set_crosshair(crosshair_axis_t axis, double altaxis, double scale, double offset) { m_curfield->m_crosshair_axis = axis; m_curfield->m_crosshair_altaxis = altaxis; m_curfield->m_crosshair_scale = scale; m_curfield->m_crosshair_offset = offset; return *this; }
+ ioport_configurer& field_set_crossmapper(ioport_field_crossmap_delegate callback) { m_curfield->m_crosshair_mapper = callback; return *this; }
+ ioport_configurer& field_set_full_turn_count(uint16_t count) { m_curfield->m_full_turn_count = count; return *this; }
+ ioport_configurer& field_set_analog_wraps() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_WRAPS; return *this; }
+ ioport_configurer& field_set_remap_table(const ioport_value *table) { m_curfield->m_remap_table = table; return *this; }
+ ioport_configurer& field_set_analog_invert() { m_curfield->m_flags |= ioport_field::ANALOG_FLAG_INVERT; return *this; }
+ ioport_configurer& field_set_dynamic_read(ioport_field_read_delegate delegate, void *param = nullptr) { m_curfield->m_read = delegate; m_curfield->m_read_param = param; return *this; }
+ ioport_configurer& field_set_dynamic_write(ioport_field_write_delegate delegate, void *param = nullptr) { m_curfield->m_write = delegate; m_curfield->m_write_param = param; return *this; }
+ ioport_configurer& field_set_diplocation(const char *location) { m_curfield->expand_diplocation(location, m_errorbuf); return *this; }
// setting helpers
- void setting_alloc(ioport_value value, const char *name);
+ ioport_configurer& setting_alloc(ioport_value value, const char *name);
// misc helpers
- void set_condition(ioport_condition::condition_t condition, const char *tag, ioport_value mask, ioport_value value);
- void onoff_alloc(const char *name, ioport_value defval, ioport_value mask, const char *diplocation);
+ ioport_configurer& set_condition(ioport_condition::condition_t condition, const char *tag, ioport_value mask, ioport_value value);
+ ioport_configurer& onoff_alloc(const char *name, ioport_value defval, ioport_value mask, const char *diplocation);
private:
// internal state