Previous 15994 Revisions Next

r2729 Saturday 24th May, 2008 at 16:15:45 UTC by Nathan Woods
Fixed natural keyboard input (broken in 0.125u2)
[src/emu]inptport.c
[src/mess]inputx.c inputx.h

src/emu/inptport.c
r2728r2729
18641864
18651865#ifdef MESS
18661866      /* hook for MESS's natural keyboard support */
1867      mess_input_port_update_hook(machine, port);
1867      mess_input_port_update_hook(machine, port, &port->state->digital);
18681868#endif /* MESS */
18691869
18701870      /* call changed handlers */
src/mess/inputx.c
r2728r2729
4444struct _mess_input_code
4545{
4646   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];
4948};
5049
5150typedef struct _key_buffer key_buffer;
r2728r2729
511510                  if (codes)
512511                  {
513512                     /* 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);
516514                     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;
519516                  }
520517
521518                  /* increment the count */
r2728r2729
543540{
544541   mess_input_code *codes = NULL;
545542   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];
547544   int code_count;
548545
549546   /* 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);
551548   if (code_count > 0)
552549   {
553550      /* allocate the codes */
r2728r2729
555552      memset(codes, 0, sizeof(*codes) * (code_count + 1));
556553
557554      /* and populate them */
558      scan_keys(portconfig, codes, ports, ipts, 0, 0);
555      scan_keys(portconfig, codes, ports, fields, 0, 0);
559556   }
560557   return codes;
561558}
r2728r2729
743740   {
744741      code = find_code(ch);
745742      if (code)
746         rc = code->ipt[0] != NULL;
743         rc = code->field[0] != NULL;
747744   }
748745   return rc;
749746}
r2728r2729
868865            if (LOG_INPUTX)
869866            {
870867               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>");
872869            }
873870
874871            if (can_post_key_directly(ch))
r2728r2729
948945   called from core to allow for natural keyboard   
949946-------------------------------------------------*/
950947
951void mess_input_port_update_hook(running_machine *machine, const input_port_config *port)
948void mess_input_port_update_hook(running_machine *machine, const input_port_config *port, input_port_value *digital)
952949{
953950   const key_buffer *keybuf;
954951   const mess_input_code *code;
r2728r2729
970967         /* loop through this character's component codes */
971968         if (code != NULL)
972969         {
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++)
974971            {
975               if (code->port[i] == port)
972               if (code->field[i]->port == port)
976973               {
977                  value = code->ipt[i]->mask;
978                  /* 24-May-2008 - FIXME */
979                  /* *digital |= value; */
974                  value = code->field[i]->mask;
975                  *digital |= value;
980976               }
981977            }
982978         }
r2728r2729
15731569         buffer[pos] = '\0';
15741570
15751571         /* 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++)
15771573         {
15781574            pos += snprintf(&buffer[pos], ARRAY_LENGTH(buffer) - pos, "%s'%s'",
15791575               (j > 0) ? ", " : "",
1580               code->ipt[j]->name);
1576               code->field[j]->name);
15811577         }
15821578
15831579         /* and output it as appropriate */
src/mess/inputx.h
r2728r2729
5151
5252/* these are called by the core; they should not be called from FEs */
5353void inputx_init(running_machine *machine);
54void mess_input_port_update_hook(running_machine *machine, const input_port_config *port);
54void mess_input_port_update_hook(running_machine *machine, const input_port_config *port, input_port_value *digital);
5555/*void inputx_handle_mess_extensions(input_port_entry *ipt);*/
5656
5757/* called by drivers to setup natural keyboard support */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team