Previous 15994 Revisions Next

r9142 Thursday 16th September, 2010 at 07:21:54 UTC by Angelo Salese
[PCE]: Changed input port structure, in order to make 3 buttons and mouse devices easier to support
[src/mess/drivers]pce.c
[src/mess/machine]pce.c

src/mess/machine/pce.c
r9141r9142
388388
389389      for (joy_i = 0; joy_i < 5; joy_i++)
390390      {
391         if (BIT(joy_type, joy_i))
391         if (((joy_type >> (joy_i*2)) & 3) == 2)
392392              joy_6b_packet[joy_i] ^= 1;
393393      }
394394    }
r9141r9142
396396
397397READ8_HANDLER ( pce_joystick_r )
398398{
399   static const char *const joyname[2][5] = {
399   static const char *const joyname[4][5] = {
400400      { "JOY_P1", "JOY_P2", "JOY_P3", "JOY_P4", "JOY_P5" },
401      { "JOY6B_P1", "JOY6B_P2", "JOY6B_P3", "JOY6B_P4", "JOY6B_P5" }
401      { },
402      { "JOY6B_P1", "JOY6B_P2", "JOY6B_P3", "JOY6B_P4", "JOY6B_P5" },
403      { }
402404   };
403405   UINT8 joy_type = input_port_read(space->machine, "JOY_TYPE");
404406   UINT8 ret, data;
r9141r9142
407409   {
408410      /* Note: six buttons pad just doesn't work with (almost?) every single 2-button-only games, it's really just an after-thought and it is like this on real HW. */
409411      if (joy_6b_packet[joystick_port_select])   // 6 buttons "header" (high 4 bits active low) + III, IV, V, VI
410         data = ((input_port_read(space->machine, joyname[BIT(joy_type, joystick_port_select)][joystick_port_select]) >> 8) & 0x0f);
412         data = ((input_port_read(space->machine, joyname[(joy_type >> (joystick_port_select*2)) & 3][joystick_port_select]) >> 8) & 0x0f);
411413      else   // directions + I, II, Run, Select
412         data = input_port_read(space->machine, joyname[BIT(joy_type, joystick_port_select)][joystick_port_select]);
414         data = input_port_read(space->machine, joyname[(joy_type >> (joystick_port_select*2)) & 3][joystick_port_select]);
413415   }
414416   else
415417      data = 0xff;
r9141r9142
13091311      pce_cd_set_adpcm_ram_byte(space->machine, data);
13101312      break;
13111313   case 0x0B:   /* ADPCM DMA control */
1312      if ( ! ( pce_cd.regs[0x0B] & 0x02 ) && ( data & 0x02 ) )
1314      if ( ! ( pce_cd.regs[0x0B] & 0x03 ) && ( data & 0x03 ) )
13131315      {
13141316         /* Start CD to ADPCM transfer */
13151317         timer_adjust_periodic(pce_cd.adpcm_dma_timer, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ), 0, ATTOTIME_IN_HZ( PCE_CD_DATA_FRAMES_PER_SECOND * 2048 ) );
13161318         pce_cd.regs[0x0c] |= 4;
13171319      }
1318      if ( ( pce_cd.regs[0x0B] & 0x02 ) && ! ( data & 0x02 ) )
1320      if ( ( pce_cd.regs[0x0B] & 0x03 ) && ! ( data & 0x03 ) )
13191321      {
13201322         /* Stop CD to ADPCM transfer (?) */
13211323         timer_adjust_oneshot(pce_cd.adpcm_dma_timer, attotime_never, 0);
src/mess/drivers/pce.c
r9141r9142
252252   PORT_BIT( 0x800, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("P5 Button VI") PORT_PLAYER(5) PORT_CATEGORY(51)
253253
254254   PORT_START("JOY_TYPE")
255   PORT_CATEGORY_CLASS(0x01,0x00,"Joystick Type Player 1")
256   PORT_CATEGORY_ITEM(0x00,"2-buttons", 10)
257   PORT_CATEGORY_ITEM(0x01,"6-buttons", 11)
258   PORT_CATEGORY_CLASS(0x02,0x00,"Joystick Type Player 2")
259   PORT_CATEGORY_ITEM(0x00,"2-buttons", 20)
260   PORT_CATEGORY_ITEM(0x02,"6-buttons", 21)
261   PORT_CATEGORY_CLASS(0x04,0x00,"Joystick Type Player 3")
262   PORT_CATEGORY_ITEM(0x00,"2-buttons", 30)
263   PORT_CATEGORY_ITEM(0x04,"6-buttons", 31)
264   PORT_CATEGORY_CLASS(0x08,0x00,"Joystick Type Player 4")
265   PORT_CATEGORY_ITEM(0x00,"2-buttons", 40)
266   PORT_CATEGORY_ITEM(0x08,"6-buttons", 41)
267   PORT_CATEGORY_CLASS(0x10,0x00,"Joystick Type Player 5")
268   PORT_CATEGORY_ITEM(0x00,"2-buttons", 50)
269   PORT_CATEGORY_ITEM(0x10,"6-buttons", 51)
255   PORT_CATEGORY_CLASS(0x0003,0x0000,"Joystick Type Player 1")
256   PORT_CATEGORY_ITEM( 0x0000,"2-buttons", 10)
257//   PORT_CATEGORY_ITEM( 0x0001,"3-buttons", xx)
258   PORT_CATEGORY_ITEM( 0x0002,"6-buttons", 11)
259//   PORT_CATEGORY_ITEM( 0x0003,"Mouse",     xx)
260   PORT_CATEGORY_CLASS(0x000c,0x0000,"Joystick Type Player 2")
261   PORT_CATEGORY_ITEM( 0x0000,"2-buttons", 20)
262//   PORT_CATEGORY_ITEM( 0x0004,"3-buttons", xx)
263   PORT_CATEGORY_ITEM( 0x0008,"6-buttons", 21)
264//   PORT_CATEGORY_ITEM( 0x000c,"Mouse",     xx)
265   PORT_CATEGORY_CLASS(0x0030,0x0000,"Joystick Type Player 3")
266   PORT_CATEGORY_ITEM( 0x0000,"2-buttons", 30)
267//   PORT_CATEGORY_ITEM( 0x0010,"3-buttons", xx)
268   PORT_CATEGORY_ITEM( 0x0020,"6-buttons", 31)
269//   PORT_CATEGORY_ITEM( 0x0030,"Mouse",     xx)
270   PORT_CATEGORY_CLASS(0x00c0,0x0000,"Joystick Type Player 4")
271   PORT_CATEGORY_ITEM( 0x0000,"2-buttons", 40)
272//   PORT_CATEGORY_ITEM( 0x0040,"3-buttons", xx)
273   PORT_CATEGORY_ITEM( 0x0080,"6-buttons", 41)
274//   PORT_CATEGORY_ITEM( 0x00c0,"Mouse",     xx)
275   PORT_CATEGORY_CLASS(0x0300,0x0000,"Joystick Type Player 5")
276   PORT_CATEGORY_ITEM( 0x0000,"2-buttons", 50)
277//   PORT_CATEGORY_ITEM( 0x0100,"3-buttons", xx)
278   PORT_CATEGORY_ITEM( 0x0200,"6-buttons", 51)
279//   PORT_CATEGORY_ITEM( 0x0300,"Mouse",     xx)
270280
271281   PORT_START("A_CARD")
272282   PORT_CONFNAME( 0x01, 0x01, "Arcade Card" )
273283   PORT_CONFSETTING(    0x00, DEF_STR( Off ) )
274284   PORT_CONFSETTING(    0x01, DEF_STR( On ) )
275
276#if 0
277   PORT_START  /* Fake dipswitches for system config */
278   PORT_DIPNAME( 0x01, 0x01, "Console type")
279   PORT_DIPSETTING(    0x00, "Turbo-Grafx 16")
280   PORT_DIPSETTING(    0x01, "PC-Engine")
281
282   PORT_DIPNAME( 0x01, 0x01, "Joystick type")
283   PORT_DIPSETTING(    0x00, "2 Button")
284   PORT_DIPSETTING(    0x01, "6 Button")
285#endif
286285INPUT_PORTS_END
287286
288287

Previous 15994 Revisions Next


© 1998-2018 The MESS Team