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.
This commit is contained in:
Vas Crabb 2019-11-20 03:55:28 +11:00
parent 593b3d9fe1
commit e87447e37d
2 changed files with 12 additions and 3 deletions

View File

@ -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;

View File

@ -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;