summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/inputdev.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2021-11-06 13:52:48 +1100
committer Vas Crabb <vas@vastheman.com>2021-11-06 13:52:48 +1100
commit270276c4d30721dc397de6d8c92334469ce37243 (patch)
tree99e802773ecec08ade94f574fdca3d665d726901 /src/emu/inputdev.cpp
parent07e55935cf49c94a94dcc75d8240d0733d1ed5d7 (diff)
-Enabled complex combinations for analog axes:
* Made it possible to add digital controls to axis settings as enables. * Mix multiple analog controls assigned to an axis setting. * Added a "reverse" modifier for analog controls (useful with mixing). * Fixed an issue assigning mouse axes using multiple mouse-like devices with -nomultimouse. -frontend: More cleanup: * Got rid of some abuse of "special main menus". * Added a helper class for auto-pause menus that don't spawn submenus. * Got rid of the fake menu that schedules an exit on the first frame. * Turned the confirm quit prompt into a menu, eliminated one more special-cased event loop. * Fixed the confirm quit prompt resuming if you return to emulation if you weren't paused to begin with. -bus/centronics: Fixed conflicting DIP locations, reversed order and inverted polarity for Epson printers. * Also added the LX-810 (without L suffix) DIP switches for reference - we don't have a device for this printer yet.
Diffstat (limited to 'src/emu/inputdev.cpp')
-rw-r--r--src/emu/inputdev.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/emu/inputdev.cpp b/src/emu/inputdev.cpp
index e22549519e9..436f83cf0df 100644
--- a/src/emu/inputdev.cpp
+++ b/src/emu/inputdev.cpp
@@ -840,13 +840,20 @@ input_device_relative_item::input_device_relative_item(input_device &device, std
s32 input_device_relative_item::read_as_switch(input_item_modifier modifier)
{
// process according to modifiers
- if (modifier == ITEM_MODIFIER_POS || modifier == ITEM_MODIFIER_RIGHT || modifier == ITEM_MODIFIER_DOWN)
- return (update_value() > 0);
- else if (modifier == ITEM_MODIFIER_NEG || modifier == ITEM_MODIFIER_LEFT || modifier == ITEM_MODIFIER_UP)
- return (update_value() < 0);
-
+ switch (modifier)
+ {
+ case ITEM_MODIFIER_POS:
+ case ITEM_MODIFIER_RIGHT:
+ case ITEM_MODIFIER_DOWN:
+ return update_value() > 0;
+ case ITEM_MODIFIER_NEG:
+ case ITEM_MODIFIER_LEFT:
+ case ITEM_MODIFIER_UP:
+ return update_value() < 0;
// all other cases just return 0
- return 0;
+ default:
+ return 0;
+ }
}
@@ -858,7 +865,10 @@ s32 input_device_relative_item::read_as_switch(input_item_modifier modifier)
s32 input_device_relative_item::read_as_relative(input_item_modifier modifier)
{
// just return directly
- return update_value();
+ if (ITEM_MODIFIER_REVERSE == modifier)
+ return -update_value();
+ else
+ return update_value();
}
@@ -979,9 +989,11 @@ s32 input_device_absolute_item::read_as_absolute(input_item_modifier modifier)
}
// positive/negative: scale to full axis
- if (modifier == ITEM_MODIFIER_POS)
+ if (modifier == ITEM_MODIFIER_REVERSE)
+ result = -result;
+ else if (modifier == ITEM_MODIFIER_POS)
result = std::max(result, 0) * 2 + INPUT_ABSOLUTE_MIN;
- if (modifier == ITEM_MODIFIER_NEG)
+ else if (modifier == ITEM_MODIFIER_NEG)
result = std::max(-result, 0) * 2 + INPUT_ABSOLUTE_MIN;
return result;
}