summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2019-11-20 03:55:28 +1100
committer Vas Crabb <vas@vastheman.com>2019-11-20 03:55:28 +1100
commite87447e37d80a26df102a85dcc5e46bdafd5571d (patch)
treed307738d5d751442549684f28b7bc6c43c462997 /src
parent593b3d9fe1d8fe301b55463f1d7f1d1521f88199 (diff)
UI: when modifying an input mapping, only cycle default/none if UI_CANCEL is the first thing pressed
(nw) It's annoying that if you accidentally start to change an input, there's no way to back out at all. You need to press something before it will do anything. Also, if you go to add an additional "or" combination and press the wrong thing, you can't back out just the change - hitting UI_CANCEL takes you back to the default. This at least partially addresses it: if you hit UI_SELECT to modify an input then hit UI_CANCEL immediately, it will cycle default/none; however if you press any other input first and then hit UI_CANCEL, it will just back out the change. The implementation is a bit whacky at the moment, but doing better would require another emu.h change which I don't want to do right now.
Diffstat (limited to 'src')
-rw-r--r--src/frontend/mame/ui/inputmap.cpp14
-rw-r--r--src/frontend/mame/ui/inputmap.h1
2 files changed, 12 insertions, 3 deletions
diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp
index 16c91c5cb89..a740fcfc720 100644
--- a/src/frontend/mame/ui/inputmap.cpp
+++ b/src/frontend/mame/ui/inputmap.cpp
@@ -295,9 +295,16 @@ void menu_input::handle()
{
// if UI_CANCEL is pressed, abort
pollingitem = nullptr;
- record_next = false;
- toggle_none_default(item->seq, starting_seq, *item->defseq);
- seqchangeditem = item;
+ if (machine().input().seq_poll_final() == init_poll_seq)
+ {
+ record_next = false;
+ toggle_none_default(item->seq, starting_seq, *item->defseq);
+ seqchangeditem = item;
+ }
+ else
+ {
+ invalidate = true;
+ }
}
else if (machine().input().seq_poll())
{
@@ -319,6 +326,7 @@ void menu_input::handle()
lastitem = item;
starting_seq = item->seq;
machine().input().seq_poll_start((item->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, record_next ? &item->seq : nullptr);
+ init_poll_seq = machine().input().seq_poll_final();
invalidate = true;
break;
diff --git a/src/frontend/mame/ui/inputmap.h b/src/frontend/mame/ui/inputmap.h
index 4c6064f037b..bd96bbe7edc 100644
--- a/src/frontend/mame/ui/inputmap.h
+++ b/src/frontend/mame/ui/inputmap.h
@@ -70,6 +70,7 @@ private:
input_item_data * lastitem;
bool record_next;
input_seq starting_seq;
+ input_seq init_poll_seq;
virtual void custom_render(void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2) override;
virtual void handle() override;