mirror of
https://github.com/holub/mame
synced 2025-05-07 06:44:51 +03:00
restore code cleaning behaviour prior to ae2cc6853d
- it's broken in some corner cases but the regressions are fixed
This commit is contained in:
parent
bdaaa0a558
commit
228540e279
@ -444,7 +444,6 @@ bool input_seq::is_valid() const
|
|||||||
for (auto code : m_code)
|
for (auto code : m_code)
|
||||||
{
|
{
|
||||||
// invalid codes are never permitted
|
// invalid codes are never permitted
|
||||||
|
|
||||||
if (code == INPUT_CODE_INVALID)
|
if (code == INPUT_CODE_INVALID)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1375,13 +1374,13 @@ void input_manager::seq_poll_start(input_item_class itemclass, const input_seq *
|
|||||||
|
|
||||||
bool input_manager::seq_poll()
|
bool input_manager::seq_poll()
|
||||||
{
|
{
|
||||||
int curlen = m_poll_seq.length();
|
const int curlen = m_poll_seq.length();
|
||||||
input_code lastcode = m_poll_seq[curlen - 1];
|
input_code lastcode = m_poll_seq[curlen - 1];
|
||||||
|
|
||||||
// switch case: see if we have a new code to process
|
|
||||||
input_code newcode;
|
input_code newcode;
|
||||||
if (m_poll_seq_class == ITEM_CLASS_SWITCH)
|
if (m_poll_seq_class == ITEM_CLASS_SWITCH)
|
||||||
{
|
{
|
||||||
|
// switch case: see if we have a new code to process
|
||||||
newcode = poll_switches();
|
newcode = poll_switches();
|
||||||
if (newcode != INPUT_CODE_INVALID)
|
if (newcode != INPUT_CODE_INVALID)
|
||||||
{
|
{
|
||||||
@ -1399,10 +1398,9 @@ bool input_manager::seq_poll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// absolute/relative case: see if we have an analog change of sufficient amount
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// absolute/relative case: see if we have an analog change of sufficient amount
|
||||||
bool has_or = false;
|
bool has_or = false;
|
||||||
if (lastcode == input_seq::or_code)
|
if (lastcode == input_seq::or_code)
|
||||||
{
|
{
|
||||||
@ -1470,6 +1468,8 @@ bool input_manager::seq_poll()
|
|||||||
|
|
||||||
input_seq input_manager::seq_clean(const input_seq &seq) const
|
input_seq input_manager::seq_clean(const input_seq &seq) const
|
||||||
{
|
{
|
||||||
|
// make a copy of our sequence, removing any invalid bits
|
||||||
|
input_seq clean_codes;
|
||||||
int clean_index = 0;
|
int clean_index = 0;
|
||||||
for (int codenum = 0; seq[codenum] != input_seq::end_code; codenum++)
|
for (int codenum = 0; seq[codenum] != input_seq::end_code; codenum++)
|
||||||
{
|
{
|
||||||
@ -1477,17 +1477,19 @@ input_seq input_manager::seq_clean(const input_seq &seq) const
|
|||||||
input_code code = seq[codenum];
|
input_code code = seq[codenum];
|
||||||
if (!code.internal() && code_name(code).empty())
|
if (!code.internal() && code_name(code).empty())
|
||||||
{
|
{
|
||||||
while (clean_index > 0 && seq[clean_index - 1].internal())
|
while (clean_index > 0 && clean_codes[clean_index - 1].internal())
|
||||||
|
{
|
||||||
|
clean_codes.backspace();
|
||||||
clean_index--;
|
clean_index--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (clean_index > 0 || !code.internal())
|
else if (clean_index > 0 || !code.internal())
|
||||||
|
{
|
||||||
|
clean_codes += code;
|
||||||
clean_index++;
|
clean_index++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
input_seq cleaned_seq;
|
return clean_codes;
|
||||||
for (int i = 0; i < clean_index; i++)
|
|
||||||
cleaned_seq += seq[i];
|
|
||||||
return cleaned_seq;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -291,18 +291,17 @@ void menu_input::handle()
|
|||||||
// if we are polling, handle as a special case
|
// if we are polling, handle as a special case
|
||||||
input_item_data *item = pollingitem;
|
input_item_data *item = pollingitem;
|
||||||
|
|
||||||
// if UI_CANCEL is pressed, abort
|
|
||||||
if (machine().ui_input().pressed(IPT_UI_CANCEL))
|
if (machine().ui_input().pressed(IPT_UI_CANCEL))
|
||||||
{
|
{
|
||||||
|
// if UI_CANCEL is pressed, abort
|
||||||
pollingitem = nullptr;
|
pollingitem = nullptr;
|
||||||
record_next = false;
|
record_next = false;
|
||||||
toggle_none_default(item->seq, starting_seq, *item->defseq);
|
toggle_none_default(item->seq, starting_seq, *item->defseq);
|
||||||
seqchangeditem = item;
|
seqchangeditem = item;
|
||||||
}
|
}
|
||||||
|
else if (machine().input().seq_poll())
|
||||||
// poll again; if finished, update the sequence
|
|
||||||
if (machine().input().seq_poll())
|
|
||||||
{
|
{
|
||||||
|
// poll again; if finished, update the sequence
|
||||||
pollingitem = nullptr;
|
pollingitem = nullptr;
|
||||||
record_next = true;
|
record_next = true;
|
||||||
item->seq = machine().input().seq_poll_final();
|
item->seq = machine().input().seq_poll_final();
|
||||||
|
Loading…
Reference in New Issue
Block a user