summaryrefslogtreecommitdiffstats
path: root/src/frontend/mame/ui/inputmap.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-10-11 02:58:46 +1100
committer Vas Crabb <vas@vastheman.com>2020-10-11 02:58:46 +1100
commitc751a5348a89f2cd9d6b84938551e341ec7f8450 (patch)
tree6de05430e61f273376943b79ee61a5b83de3552d /src/frontend/mame/ui/inputmap.cpp
parent9e971ab36e2752d554239f9eb92397f87679deb5 (diff)
-emu/natkeyboard.cpp: Allow keyboard devices to be enabled/disabled.
This fixes the "typing on all keyboards at once" issue. You can now enable and disable keyboard/keypad inputs per device in the Keyboard Mode menu. Default is to enable the first device with keyboard inputs, and all device with keypad inputs but no keyboard inputs. The settings are saved in the CFG file for the machine. Typing in natural keyboard mode only ever types on one keyboard at a time, but now you can control which keyboard it types on, as it will be the first enabled keyboard. You can easily try this out with something like: mame64d zorba -rs232 terminal cpm -ui/inputmap.cpp: Show device descriptions as well as tag paths. -mac128.cpp: Fixed mouse axis wrap compensation, cleaned up mouse code, eliminated static variables for mouse input state. You could see the issue with wrap detection easily enough just by running mac128k/mac512k/macplus and tapping the arrow keys to move the mouse one pixel at a time. As you moved past the point where the axis count wrapped, it would move one pixel in the opposite direction. There were two function static variables related to mouse input state, probably still lurking from when the code was initially made to use a driver state class. This obviously messes with save states and prevents multiple instances. - bus/a2bus/mouse.cpp: Fixed mouse axis wrap compensation. This device had the same bug with wrap compensation as mac128k.cpp.
Diffstat (limited to 'src/frontend/mame/ui/inputmap.cpp')
-rw-r--r--src/frontend/mame/ui/inputmap.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp
index 33cbd9223e0..bfb68e40da0 100644
--- a/src/frontend/mame/ui/inputmap.cpp
+++ b/src/frontend/mame/ui/inputmap.cpp
@@ -93,7 +93,7 @@ void menu_input_general::populate(float &customtop, float &custombottom)
item.type = ioport_manager::type_is_analog(entry.type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
item.is_optional = false;
item.name = entry.name();
- item.owner_name = nullptr;
+ item.owner = nullptr;
// stop after one, unless we're analog
if (item.type == INPUT_TYPE_DIGITAL)
@@ -164,7 +164,7 @@ void menu_input_specific::populate(float &customtop, float &custombottom)
item.type = field.is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
item.is_optional = field.optional();
item.name = field.name();
- item.owner_name = field.device().tag();
+ item.owner = &field.device();
// stop after one, unless we're analog
if (item.type == INPUT_TYPE_DIGITAL)
@@ -180,7 +180,7 @@ void menu_input_specific::populate(float &customtop, float &custombottom)
data.end(),
[] (const input_item_data &i1, const input_item_data &i2)
{
- int cmp = strcmp(i1.owner_name, i2.owner_name);
+ int cmp = strcmp(i1.owner->tag(), i2.owner->tag());
if (cmp < 0)
return true;
if (cmp > 0)
@@ -431,21 +431,24 @@ void menu_input::populate_sorted(float &customtop, float &custombottom)
// build the menu
std::string text, subtext;
- std::string prev_owner;
+ const device_t *prev_owner = nullptr;
bool first_entry = true;
for (input_item_data &item : data)
{
// generate the name of the item itself, based off the base name and the type
assert(nameformat[item.type] != nullptr);
- if (item.owner_name && strcmp(item.owner_name, prev_owner.c_str()) != 0)
+ if (item.owner && (item.owner != prev_owner))
{
if (first_entry)
first_entry = false;
else
item_append(menu_item_type::SEPARATOR);
- item_append(string_format("[root%s]", item.owner_name), "", 0, nullptr);
- prev_owner.assign(item.owner_name);
+ if (item.owner->owner())
+ item_append(string_format(_("%1$s [root%2$s]"), item.owner->type().fullname(), item.owner->tag()), "", 0, nullptr);
+ else
+ item_append(string_format(_("[root%1$s]"), item.owner->tag()), "", 0, nullptr);
+ prev_owner = item.owner;
}
text = string_format(nameformat[item.type], item.name);