Previous 15994 Revisions Next

r15465 Friday 15th June, 2012 at 06:44:34 UTC by Miodrag Milanović
ioport change enabling renumbering of player numbers on controller ports (nw)
[src/emu]ioport.c ioport.h
[src/mess/machine]c64_4cga.c

src/emu/ioport.c
r15464r15465
26522652         mame_printf_error("Input port errors:\n%s", errors.cstr());
26532653   }
26542654
2655   // renumber player numbers for controller ports
2656   int player_offset = 0;
2657   for (device_t *device = iter.first(); device != NULL; device = iter.next())
2658   {
2659      int players = 0;     
2660      for (ioport_port *port = first_port(); port != NULL; port = port->next())
2661      {
2662         if (&port->device()==device)
2663         {
2664            for (ioport_field *field = port->first_field(); field != NULL; field = field->next())
2665               if (field->type_class()==INPUT_CLASS_CONTROLLER)
2666               {
2667                  if (players < field->player() + 1) players = field->player() + 1;
2668                  field->set_player(field->player() + player_offset);
2669               }
2670         }
2671      }
2672      player_offset += players;
2673   }
2674
26552675   // allocate live structures to mirror the configuration
26562676   for (ioport_port *port = first_port(); port != NULL; port = port->next())
26572677      port->init_live_state();
src/emu/ioport.h
r15464r15465
10771077   // setters
10781078   void set_crosshair_scale(double scale) { m_crosshair_scale = scale; }
10791079   void set_crosshair_offset(double offset) { m_crosshair_offset = offset; }
1080   void set_player(UINT8 player) { m_player = player; }
10801081
10811082   // derived getters
10821083   ioport_type_class type_class() const;
src/mess/machine/c64_4cga.c
r15464r15465
2323 
2424static INPUT_PORTS_START( c64_4player )
2525   PORT_START("JOY3")
26   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
27   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
28   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
29   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
26   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
27   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
28   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
29   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
3030   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
3131 
3232   PORT_START("JOY4")
33   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
34   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
35   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
36   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
33   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
34   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
35   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
36   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
3737   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
3838 
3939   PORT_START("FIRE")
40   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
41   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
40   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
41   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
4242   PORT_BIT( 0xcf, IP_ACTIVE_LOW, IPT_UNUSED )
4343INPUT_PORTS_END
4444 

Previous 15994 Revisions Next


© 1998-2018 The MESS Team