src/emu/inptport.c
| r3064 | r3065 | |
| 2385 | 2385 | input_field_config *curfield = NULL; |
| 2386 | 2386 | input_port_config *curport = NULL; |
| 2387 | 2387 | input_port_value maskbits = 0; |
| 2388 | UINT16 category; /* (MESS-specific) category */ |
| 2388 | 2389 | |
| 2389 | 2390 | /* loop over tokens until we hit the end */ |
| 2390 | 2391 | while (entrytype != INPUT_TOKEN_END) |
| r3064 | r3065 | |
| 2936 | 2937 | curfield->name = input_port_string_from_token(*ipt++); |
| 2937 | 2938 | break; |
| 2938 | 2939 | |
| 2939 | | /* configuration setting */ |
| 2940 | /* category setting */ |
| 2940 | 2941 | case INPUT_TOKEN_CATEGORY_SETTING: |
| 2941 | 2942 | TOKEN_UNGET_UINT32(ipt); |
| 2942 | 2943 | if (curfield == NULL) |
| r3064 | r3065 | |
| 2946 | 2947 | TOKEN_SKIP_STRING(ipt); |
| 2947 | 2948 | break; |
| 2948 | 2949 | } |
| 2949 | | TOKEN_GET_UINT64_UNPACK2(ipt, entrytype, 8, defval, 32); |
| 2950 | TOKEN_GET_UINT64_UNPACK3(ipt, entrytype, 8, defval, 32, category, 16); |
| 2950 | 2951 | cursetting = setting_config_alloc(curfield, defval & curfield->mask, input_port_string_from_token(*ipt++)); |
| 2952 | cursetting->category = category; |
| 2951 | 2953 | break; |
| 2952 | 2954 | |
| 2953 | 2955 | /* analog adjuster definition */ |
src/mess/inputx.c
| r3064 | r3065 | |
| 1470 | 1470 | |
| 1471 | 1471 | int input_category_active(running_machine *machine, int category) |
| 1472 | 1472 | { |
| 1473 | | int found; |
| 1474 | 1473 | const input_port_config *port; |
| 1475 | 1474 | const input_field_config *field = NULL; |
| 1476 | 1475 | const input_setting_config *setting; |
| 1476 | input_field_user_settings settings; |
| 1477 | 1477 | |
| 1478 | 1478 | assert(category >= 1); |
| 1479 | 1479 | |
| 1480 | | found = FALSE; |
| 1481 | | for (port = machine->portconfig; !found && (port != NULL); port = port->next) |
| 1480 | /* loop through the input ports */ |
| 1481 | for (port = machine->portconfig; port != NULL; port = port->next) |
| 1482 | 1482 | { |
| 1483 | | for (field = port->fieldlist; !found && (field != NULL); field = field->next) |
| 1484 | | found = (field->type == IPT_CATEGORY) && (field->defvalue == category); |
| 1485 | | } |
| 1483 | for (field = port->fieldlist; field != NULL; field = field->next) |
| 1484 | { |
| 1485 | /* is this field a category? */ |
| 1486 | if (field->type == IPT_CATEGORY) |
| 1487 | { |
| 1488 | /* get the settings value */ |
| 1489 | input_field_get_user_settings(field, &settings); |
| 1486 | 1490 | |
| 1487 | | if (field != NULL) |
| 1488 | | { |
| 1489 | | for (setting = field->settinglist; setting != NULL; setting = setting->next) |
| 1490 | | { |
| 1491 | | if (setting->value == field->defvalue) |
| 1492 | | return TRUE; |
| 1491 | for (setting = field->settinglist; setting != NULL; setting = setting->next) |
| 1492 | { |
| 1493 | /* is this the category we want? if so, is this settings value correct? */ |
| 1494 | if ((setting->category == category) && (settings.value == setting->value)) |
| 1495 | return TRUE; |
| 1496 | } |
| 1497 | } |
| 1493 | 1498 | } |
| 1494 | 1499 | } |
| 1495 | 1500 | return FALSE; |