summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/inptport.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-08-06 14:35:45 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-08-06 14:35:45 +0000
commitd3c7e67622de8fd5b0b4d4ba4030cfa1977f77aa (patch)
treed92c4384051edd027628bc9b993a0f82b34a0a65 /src/emu/inptport.c
parentc9063a74167e9f804ca424137e17190ed1becc82 (diff)
This also includes a fix for the bug reported at the bottom.
From: Fabio Priuli [mailto:doge.fabio@gmail.com] Subject: to simplify cischeat inputs Hi, the enclosed diff has a twofold effect on cischeat.c: on one side: it adds diplocations to bigrun, scudhamm, cischeat & f1gpstar on the other side: it removes the current hacky handling of f1gpstar coinage dips (check video/cischeat.c to see what I mean with hacky!) to use conditional ports instead. BUT in order to do this, I had to add more possible values for the PORTCOND in iptport.c. The problem is that f1gpstar has a set of coinage settings when you set the region to JPN or USA and another one when you set the region to EUR or FRA. To implement this I added the following self-explanatory new PORTCOND: ISLARGER (>), ISNOTLARGER (<=), ISSMALLER (<), ISNOTSMALLER (<=). Only two were really needed to implement f1gpstar dips, but the other two seemed costless to me while offering even more flexibility to the PORT_CONDITION macro. Also notice that the handling of conditional ports in 'TAB>Dip Switches' menu doesn't work well (in the current source, not affected by my patch) with contracted expressions like PORT_DIPUNKNOWN_DIPLOC: the wrong items remain listed in the UI menu even when you change the condition! If you leave the DEF_STR( Unknown ) with ON/OFF cases, everything is displayed correctly in the menu. However, I was not able to track down what part of code is responsible for this bug. Regards, Fabio Priuli
Diffstat (limited to 'src/emu/inptport.c')
-rw-r--r--src/emu/inptport.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/emu/inptport.c b/src/emu/inptport.c
index e83e0db2ed3..858d0e97f1c 100644
--- a/src/emu/inptport.c
+++ b/src/emu/inptport.c
@@ -1459,6 +1459,18 @@ int input_condition_true(running_machine *machine, const input_condition *condit
case PORTCOND_NOTEQUALS:
return ((condvalue & condition->mask) != condition->value);
+
+ case PORTCOND_GREATERTHAN:
+ return ((condvalue & condition->mask) > condition->value);
+
+ case PORTCOND_NOTGREATERTHAN:
+ return ((condvalue & condition->mask) <= condition->value);
+
+ case PORTCOND_LESSTHAN:
+ return ((condvalue & condition->mask) < condition->value);
+
+ case PORTCOND_NOTLESSTHAN:
+ return ((condvalue & condition->mask) >= condition->value);
}
return TRUE;
}
@@ -2857,6 +2869,9 @@ static input_port_config *port_config_detokenize(input_port_config *listhead, co
temptoken.i = INPUT_STRING_On;
cursetting = setting_config_alloc(curfield, ~defval & mask, input_port_string_from_token(temptoken));
+
+ /* reset cursetting to NULL to allow subsequent conditions to apply to the field */
+ cursetting = NULL;
break;
/* configuration definition */