src/emu/uimenu.c
| r12023 | r12024 | |
| 1868 | 1868 | const char *name = input_field_name(field); |
| 1869 | 1869 | |
| 1870 | 1870 | /* add if we match the group and we have a valid name */ |
| 1871 | | if (name != NULL && input_condition_true(machine, &field->condition) && |
| 1871 | if (name != NULL && input_condition_true(machine, &field->condition, port->owner()) && |
| 1872 | 1872 | (field->category == 0 || input_category_active(machine, field->category)) && |
| 1873 | 1873 | ((field->type == IPT_OTHER && field->name != NULL) || input_type_group(machine, field->type, field->player) != IPG_INVALID)) |
| 1874 | 1874 | { |
| r12023 | r12024 | |
| 2216 | 2216 | /* loop over input ports and set up the current values */ |
| 2217 | 2217 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 2218 | 2218 | for (field = port->fieldlist().first(); field != NULL; field = field->next()) |
| 2219 | | if (field->type == type && input_condition_true(machine, &field->condition)) |
| 2219 | if (field->type == type && input_condition_true(machine, &field->condition, port->owner())) |
| 2220 | 2220 | { |
| 2221 | 2221 | UINT32 flags = 0; |
| 2222 | 2222 | |
| r12023 | r12024 | |
| 2470 | 2470 | /* loop over input ports and add the items */ |
| 2471 | 2471 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 2472 | 2472 | for (field = port->fieldlist().first(); field != NULL; field = field->next()) |
| 2473 | | if (input_type_is_analog(field->type) && input_condition_true(machine, &field->condition)) |
| 2473 | if (input_type_is_analog(field->type) && input_condition_true(machine, &field->condition, port->owner())) |
| 2474 | 2474 | { |
| 2475 | 2475 | input_field_user_settings settings; |
| 2476 | 2476 | int use_autocenter = FALSE; |
src/emu/inptport.c
| r12023 | r12024 | |
| 1115 | 1115 | |
| 1116 | 1116 | /* scan the list of settings looking for a match on the current value */ |
| 1117 | 1117 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) |
| 1118 | | if (input_condition_true(field->machine(), &setting->condition)) |
| 1118 | if (input_condition_true(field->machine(), &setting->condition, field->port().owner())) |
| 1119 | 1119 | if (setting->value == field->state->value) |
| 1120 | 1120 | return setting->name; |
| 1121 | 1121 | |
| r12023 | r12024 | |
| 1137 | 1137 | |
| 1138 | 1138 | /* scan the list of settings looking for a match on the current value */ |
| 1139 | 1139 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) |
| 1140 | | if (input_condition_true(field->machine(), &setting->condition)) |
| 1140 | if (input_condition_true(field->machine(), &setting->condition, field->port().owner())) |
| 1141 | 1141 | return (setting->value != field->state->value); |
| 1142 | 1142 | |
| 1143 | 1143 | return FALSE; |
| r12023 | r12024 | |
| 1161 | 1161 | /* scan the list of settings looking for a match on the current value */ |
| 1162 | 1162 | prevsetting = NULL; |
| 1163 | 1163 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) |
| 1164 | | if (input_condition_true(field->machine(), &setting->condition)) |
| 1164 | if (input_condition_true(field->machine(), &setting->condition, field->port().owner())) |
| 1165 | 1165 | { |
| 1166 | 1166 | if (setting->value == field->state->value) |
| 1167 | 1167 | { |
| r12023 | r12024 | |
| 1176 | 1176 | if (!found_match) |
| 1177 | 1177 | { |
| 1178 | 1178 | for (prevsetting = field->settinglist().first(); prevsetting != NULL; prevsetting = prevsetting->next()) |
| 1179 | | if (input_condition_true(field->machine(), &prevsetting->condition)) |
| 1179 | if (input_condition_true(field->machine(), &prevsetting->condition, field->port().owner())) |
| 1180 | 1180 | break; |
| 1181 | 1181 | } |
| 1182 | 1182 | |
| r12023 | r12024 | |
| 1201 | 1201 | |
| 1202 | 1202 | /* scan the list of settings looking for a match on the current value */ |
| 1203 | 1203 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) |
| 1204 | | if (input_condition_true(field->machine(), &setting->condition)) |
| 1204 | if (input_condition_true(field->machine(), &setting->condition, field->port().owner())) |
| 1205 | 1205 | { |
| 1206 | 1206 | if (found) |
| 1207 | 1207 | return TRUE; |
| r12023 | r12024 | |
| 1229 | 1229 | /* scan the list of settings looking for a match on the current value */ |
| 1230 | 1230 | nextsetting = NULL; |
| 1231 | 1231 | for (setting = field->settinglist().first(); setting != NULL; setting = setting->next()) |
| 1232 | | if (input_condition_true(field->machine(), &setting->condition)) |
| 1232 | if (input_condition_true(field->machine(), &setting->condition, field->port().owner())) |
| 1233 | 1233 | if (setting->value == field->state->value) |
| 1234 | 1234 | break; |
| 1235 | 1235 | |
| 1236 | 1236 | /* if we found one, scan forward for the next valid one */ |
| 1237 | 1237 | if (setting != NULL) |
| 1238 | 1238 | for (nextsetting = setting->next(); nextsetting != NULL; nextsetting = nextsetting->next()) |
| 1239 | | if (input_condition_true(field->machine(), &nextsetting->condition)) |
| 1239 | if (input_condition_true(field->machine(), &nextsetting->condition, field->port().owner())) |
| 1240 | 1240 | break; |
| 1241 | 1241 | |
| 1242 | 1242 | /* if we hit the end, search from the beginning */ |
| 1243 | 1243 | if (nextsetting == NULL) |
| 1244 | 1244 | for (nextsetting = field->settinglist().first(); nextsetting != NULL; nextsetting = nextsetting->next()) |
| 1245 | | if (input_condition_true(field->machine(), &nextsetting->condition)) |
| 1245 | if (input_condition_true(field->machine(), &nextsetting->condition, field->port().owner())) |
| 1246 | 1246 | break; |
| 1247 | 1247 | |
| 1248 | 1248 | /* update the value to the previous one */ |
| r12023 | r12024 | |
| 1430 | 1430 | |
| 1431 | 1431 | /* update read values */ |
| 1432 | 1432 | for (device_field = port->state->readdevicelist; device_field != NULL; device_field = device_field->next) |
| 1433 | | if (input_condition_true(port->machine(), &device_field->field->condition)) |
| 1433 | if (input_condition_true(port->machine(), &device_field->field->condition, port->owner())) |
| 1434 | 1434 | { |
| 1435 | 1435 | /* replace the bits with bits from the device */ |
| 1436 | 1436 | input_port_value newval = device_field->field->read(*device_field->field, device_field->field->read_param); |
| r12023 | r12024 | |
| 1452 | 1452 | |
| 1453 | 1453 | /* merge in analog portions */ |
| 1454 | 1454 | for (analog = port->state->analoglist; analog != NULL; analog = analog->next) |
| 1455 | | if (input_condition_true(port->machine(), &analog->field->condition)) |
| 1455 | if (input_condition_true(port->machine(), &analog->field->condition, port->owner())) |
| 1456 | 1456 | { |
| 1457 | 1457 | /* start with the raw value */ |
| 1458 | 1458 | INT32 value = analog->accum; |
| r12023 | r12024 | |
| 1541 | 1541 | for (port = machine.m_portlist.first(); port != NULL; port = port->next()) |
| 1542 | 1542 | for (field = port->first_field(); field != NULL; field = field->next()) |
| 1543 | 1543 | if (field->player == player && field->crossaxis != CROSSHAIR_AXIS_NONE) |
| 1544 | | if (input_condition_true(machine, &field->condition)) |
| 1544 | if (input_condition_true(machine, &field->condition, port->owner())) |
| 1545 | 1545 | { |
| 1546 | 1546 | analog_field_state *analog = field->state->analog; |
| 1547 | 1547 | INT32 rawvalue = apply_analog_settings(analog->accum, analog) & (analog->field->mask >> analog->shift); |
| r12023 | r12024 | |
| 1617 | 1617 | |
| 1618 | 1618 | /* first compute the default value for the entire port */ |
| 1619 | 1619 | for (field = port->first_field(); field != NULL; field = field->next()) |
| 1620 | | if (input_condition_true(machine, &field->condition)) |
| 1620 | if (input_condition_true(machine, &field->condition, port->owner())) |
| 1621 | 1621 | port->state->defvalue = (port->state->defvalue & ~field->mask) | (field->state->value & field->mask); |
| 1622 | 1622 | } |
| 1623 | 1623 | } |
| r12023 | r12024 | |
| 1672 | 1672 | COMBINE_DATA(&port->state->outputvalue); |
| 1673 | 1673 | |
| 1674 | 1674 | for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next) |
| 1675 | | if (device_field->field->type == IPT_OUTPUT && input_condition_true(port->machine(), &device_field->field->condition)) |
| 1675 | if (device_field->field->type == IPT_OUTPUT && input_condition_true(port->machine(), &device_field->field->condition, port->owner())) |
| 1676 | 1676 | { |
| 1677 | 1677 | input_port_value newval = ( (port->state->outputvalue ^ device_field->field->defvalue ) & device_field->field->mask) >> device_field->shift; |
| 1678 | 1678 | |
| r12023 | r12024 | |
| 1724 | 1724 | if the given condition attached is true |
| 1725 | 1725 | -------------------------------------------------*/ |
| 1726 | 1726 | |
| 1727 | | int input_condition_true(running_machine &machine, const input_condition *condition) |
| 1727 | int input_condition_true(running_machine &machine, const input_condition *condition,device_t &owner) |
| 1728 | 1728 | { |
| 1729 | 1729 | input_port_value condvalue; |
| 1730 | 1730 | |
| r12023 | r12024 | |
| 1733 | 1733 | return TRUE; |
| 1734 | 1734 | |
| 1735 | 1735 | /* otherwise, read the referenced port */ |
| 1736 | | condvalue = input_port_read(machine, condition->tag); |
| 1736 | astring conditiontag; |
| 1737 | owner.subtag(conditiontag, condition->tag); |
| 1738 | condvalue = input_port_read(machine, conditiontag.cstr()); |
| 1737 | 1739 | |
| 1738 | 1740 | /* based on the condition encoded, determine truth */ |
| 1739 | 1741 | switch (condition->condition) |
| r12023 | r12024 | |
| 2455 | 2457 | |
| 2456 | 2458 | /* now loop back and modify based on the inputs */ |
| 2457 | 2459 | for (field = port->first_field(); field != NULL; field = field->next()) |
| 2458 | | if (input_condition_true(port->machine(), &field->condition)) |
| 2460 | if (input_condition_true(port->machine(), &field->condition, port->owner())) |
| 2459 | 2461 | { |
| 2460 | 2462 | /* accumulate VBLANK bits */ |
| 2461 | 2463 | if (field->type == IPT_VBLANK) |
| r12023 | r12024 | |
| 2480 | 2482 | /* call device line write handlers */ |
| 2481 | 2483 | newvalue = input_port_read_direct(port); |
| 2482 | 2484 | for (device_field = port->state->writedevicelist; device_field; device_field = device_field->next) |
| 2483 | | if (device_field->field->type != IPT_OUTPUT && input_condition_true(port->machine(), &device_field->field->condition)) |
| 2485 | if (device_field->field->type != IPT_OUTPUT && input_condition_true(port->machine(), &device_field->field->condition, port->owner())) |
| 2484 | 2486 | { |
| 2485 | 2487 | input_port_value newval = (newvalue & device_field->field->mask) >> device_field->shift; |
| 2486 | 2488 | |