mirror of
https://github.com/holub/mame
synced 2025-05-05 13:54:42 +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)
|
||||
{
|
||||
// invalid codes are never permitted
|
||||
|
||||
if (code == INPUT_CODE_INVALID)
|
||||
return false;
|
||||
|
||||
@ -1375,13 +1374,13 @@ void input_manager::seq_poll_start(input_item_class itemclass, const input_seq *
|
||||
|
||||
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];
|
||||
|
||||
// switch case: see if we have a new code to process
|
||||
input_code newcode;
|
||||
if (m_poll_seq_class == ITEM_CLASS_SWITCH)
|
||||
{
|
||||
// switch case: see if we have a new code to process
|
||||
newcode = poll_switches();
|
||||
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
|
||||
{
|
||||
// absolute/relative case: see if we have an analog change of sufficient amount
|
||||
bool has_or = false;
|
||||
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
|
||||
{
|
||||
// make a copy of our sequence, removing any invalid bits
|
||||
input_seq clean_codes;
|
||||
int clean_index = 0;
|
||||
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];
|
||||
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--;
|
||||
}
|
||||
}
|
||||
else if (clean_index > 0 || !code.internal())
|
||||
{
|
||||
clean_codes += code;
|
||||
clean_index++;
|
||||
}
|
||||
}
|
||||
|
||||
input_seq cleaned_seq;
|
||||
for (int i = 0; i < clean_index; i++)
|
||||
cleaned_seq += seq[i];
|
||||
return cleaned_seq;
|
||||
return clean_codes;
|
||||
}
|
||||
|
||||
|
||||
|
@ -291,18 +291,17 @@ void menu_input::handle()
|
||||
// if we are polling, handle as a special case
|
||||
input_item_data *item = pollingitem;
|
||||
|
||||
// if UI_CANCEL is pressed, abort
|
||||
if (machine().ui_input().pressed(IPT_UI_CANCEL))
|
||||
{
|
||||
// if UI_CANCEL is pressed, abort
|
||||
pollingitem = nullptr;
|
||||
record_next = false;
|
||||
toggle_none_default(item->seq, starting_seq, *item->defseq);
|
||||
seqchangeditem = item;
|
||||
}
|
||||
|
||||
// poll again; if finished, update the sequence
|
||||
if (machine().input().seq_poll())
|
||||
else if (machine().input().seq_poll())
|
||||
{
|
||||
// poll again; if finished, update the sequence
|
||||
pollingitem = nullptr;
|
||||
record_next = true;
|
||||
item->seq = machine().input().seq_poll_final();
|
||||
|
Loading…
Reference in New Issue
Block a user