src/mess/inputx.c
| r2728 | r2729 | |
| 44 | 44 | struct _mess_input_code |
| 45 | 45 | { |
| 46 | 46 | unicode_char ch; |
| 47 | | input_port_config_c port[NUM_SIMUL_KEYS]; |
| 48 | | input_field_config_c ipt[NUM_SIMUL_KEYS]; |
| 47 | input_field_config_c field[NUM_SIMUL_KEYS]; |
| 49 | 48 | }; |
| 50 | 49 | |
| 51 | 50 | typedef struct _key_buffer key_buffer; |
| r2728 | r2729 | |
| 511 | 510 | if (codes) |
| 512 | 511 | { |
| 513 | 512 | /* if we have a destination, record the codes used here */ |
| 514 | | memcpy(codes[code_count].port, ports, sizeof(ports[0]) * keys); |
| 515 | | memcpy((void *) codes[code_count].ipt, shift_ports, sizeof(shift_ports[0]) * keys); |
| 513 | memcpy((void *) codes[code_count].field, shift_ports, sizeof(shift_ports[0]) * keys); |
| 516 | 514 | codes[code_count].ch = code; |
| 517 | | codes[code_count].port[keys] = port; |
| 518 | | codes[code_count].ipt[keys] = field; |
| 515 | codes[code_count].field[keys] = field; |
| 519 | 516 | } |
| 520 | 517 | |
| 521 | 518 | /* increment the count */ |
| r2728 | r2729 | |
| 543 | 540 | { |
| 544 | 541 | mess_input_code *codes = NULL; |
| 545 | 542 | const input_port_config *ports[NUM_SIMUL_KEYS]; |
| 546 | | const input_field_config *ipts[NUM_SIMUL_KEYS]; |
| 543 | const input_field_config *fields[NUM_SIMUL_KEYS]; |
| 547 | 544 | int code_count; |
| 548 | 545 | |
| 549 | 546 | /* first count the number of codes */ |
| 550 | | code_count = scan_keys(portconfig, NULL, ports, ipts, 0, 0); |
| 547 | code_count = scan_keys(portconfig, NULL, ports, fields, 0, 0); |
| 551 | 548 | if (code_count > 0) |
| 552 | 549 | { |
| 553 | 550 | /* allocate the codes */ |
| r2728 | r2729 | |
| 555 | 552 | memset(codes, 0, sizeof(*codes) * (code_count + 1)); |
| 556 | 553 | |
| 557 | 554 | /* and populate them */ |
| 558 | | scan_keys(portconfig, codes, ports, ipts, 0, 0); |
| 555 | scan_keys(portconfig, codes, ports, fields, 0, 0); |
| 559 | 556 | } |
| 560 | 557 | return codes; |
| 561 | 558 | } |
| r2728 | r2729 | |
| 743 | 740 | { |
| 744 | 741 | code = find_code(ch); |
| 745 | 742 | if (code) |
| 746 | | rc = code->ipt[0] != NULL; |
| 743 | rc = code->field[0] != NULL; |
| 747 | 744 | } |
| 748 | 745 | return rc; |
| 749 | 746 | } |
| r2728 | r2729 | |
| 868 | 865 | if (LOG_INPUTX) |
| 869 | 866 | { |
| 870 | 867 | code = find_code(ch); |
| 871 | | logerror("inputx_postn(): code=%i (%s) port=%p field->name='%s'\n", (int) ch, code_point_string(ch), code ? code->port[0] : NULL, (code && code->ipt[0]) ? code->ipt[0]->name : "<null>"); |
| 868 | logerror("inputx_postn(): code=%i (%s) field->name='%s'\n", (int) ch, code_point_string(ch), (code && code->field[0]) ? code->field[0]->name : "<null>"); |
| 872 | 869 | } |
| 873 | 870 | |
| 874 | 871 | if (can_post_key_directly(ch)) |
| r2728 | r2729 | |
| 948 | 945 | called from core to allow for natural keyboard |
| 949 | 946 | -------------------------------------------------*/ |
| 950 | 947 | |
| 951 | | void mess_input_port_update_hook(running_machine *machine, const input_port_config *port) |
| 948 | void mess_input_port_update_hook(running_machine *machine, const input_port_config *port, input_port_value *digital) |
| 952 | 949 | { |
| 953 | 950 | const key_buffer *keybuf; |
| 954 | 951 | const mess_input_code *code; |
| r2728 | r2729 | |
| 970 | 967 | /* loop through this character's component codes */ |
| 971 | 968 | if (code != NULL) |
| 972 | 969 | { |
| 973 | | for (i = 0; i < ARRAY_LENGTH(code->ipt) && (code->ipt[i] != NULL); i++) |
| 970 | for (i = 0; i < ARRAY_LENGTH(code->field) && (code->field[i] != NULL); i++) |
| 974 | 971 | { |
| 975 | | if (code->port[i] == port) |
| 972 | if (code->field[i]->port == port) |
| 976 | 973 | { |
| 977 | | value = code->ipt[i]->mask; |
| 978 | | /* 24-May-2008 - FIXME */ |
| 979 | | /* *digital |= value; */ |
| 974 | value = code->field[i]->mask; |
| 975 | *digital |= value; |
| 980 | 976 | } |
| 981 | 977 | } |
| 982 | 978 | } |
| r2728 | r2729 | |
| 1573 | 1569 | buffer[pos] = '\0'; |
| 1574 | 1570 | |
| 1575 | 1571 | /* identify the keys used */ |
| 1576 | | for (j = 0; j < ARRAY_LENGTH(code->ipt) && (code->ipt[j] != NULL); j++) |
| 1572 | for (j = 0; j < ARRAY_LENGTH(code->field) && (code->field[j] != NULL); j++) |
| 1577 | 1573 | { |
| 1578 | 1574 | pos += snprintf(&buffer[pos], ARRAY_LENGTH(buffer) - pos, "%s'%s'", |
| 1579 | 1575 | (j > 0) ? ", " : "", |
| 1580 | | code->ipt[j]->name); |
| 1576 | code->field[j]->name); |
| 1581 | 1577 | } |
| 1582 | 1578 | |
| 1583 | 1579 | /* and output it as appropriate */ |