Hi.
I'm still in the process of adding a new game to Mame : "Space Ship", which is a Sega clone of Cinematronics Space War. Choosen name is currently "spaceshp".
I just need to deal with the dip switches stuff and I need advices to finish this task.
spaceshp has 99.9% of the spacewar input ports. Difference is in the dip-switches. spacewar has an unknown dip switch, while spaceshp hasn't (this switch doesn't exist).
When I declare spaceshp input port, I'd like to use : PORT_INCLUDE( spacewar ) PORT_MODIFY("SWITCHES") ...
But by doing this, spaceshp gets the spacewar's unknown switch (which I don't want). I can't delete it from spaceshp declaration !
I found a proper way to do it, but I'd like advices from people who have more Mame development experience than me.
Here is it :
1. move all spacewar input port declaration to a new declaration, and remove dip-switch info 2. include this new declaration from spacewar, and use PORT_MODIFY to add spacewar's dip-switches 3. include this new declaration from spaceship, and use PORT_MODIFY to add spaceship's dip-switch
Here is how it looks like :
Quote:
Code:
static INPUT_PORTS_START( glop ) PORT_START("INPUTS") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Option 3") PORT_CODE(KEYCODE_3_PAD) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Option 8") PORT_CODE(KEYCODE_8_PAD) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Option 4") PORT_CODE(KEYCODE_4_PAD) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Option 9") PORT_CODE(KEYCODE_9_PAD) PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Option 1") PORT_CODE(KEYCODE_1_PAD) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Option 6") PORT_CODE(KEYCODE_6_PAD) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Option 2") PORT_CODE(KEYCODE_2_PAD) PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Option 7") PORT_CODE(KEYCODE_7_PAD) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1) PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Option 5") PORT_CODE(KEYCODE_5_PAD) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Option 0") PORT_CODE(KEYCODE_0_PAD) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(2) PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1) PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(2) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_START("SWITCHES") PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0) INPUT_PORTS_END
static INPUT_PORTS_START( spacewar ) PORT_INCLUDE( glop )
PORT_MODIFY("SWITCHES") PORT_DIPNAME( 0x03, 0x00, "Time" ) PORT_DIPSETTING( 0x03, "0:45/coin" ) PORT_DIPSETTING( 0x00, "1:00/coin" ) PORT_DIPSETTING( 0x01, "1:30/coin" ) PORT_DIPSETTING( 0x02, "2:00/coin" ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END
static INPUT_PORTS_START( spaceshp ) PORT_INCLUDE( glop )
PORT_MODIFY("SWITCHES") PORT_DIPNAME( 0x03, 0x00, "Time" ) PORT_DIPLOCATION("SW1:!3,!4") PORT_DIPSETTING( 0x00, "1:00/coin" ) PORT_DIPSETTING( 0x01, "1:30/coin" ) PORT_DIPSETTING( 0x02, "2:00/coin" ) PORT_DIPSETTING( 0x03, "2:30/coin" ) PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW1:!1" ) PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW1:!2" ) INPUT_PORTS_END
green is the new input port declaration red is spacewar's new declaration blue is spaceshp declaration
I tested it and : - spacewar works exactly as previously - spaceshp has the exact expect dip switch settings !
My question to developers : 1. can I add such a input port declaration which is not directly refered by a game ? 2. if "yes", what internal name should I use ? (in my example, I used "glop" which really means nothing) ? 3. is it OK to change the way an existing game has its input port declared (with no change on the emulation, of course) ?
Sorry for such a long post, and thanks for your help.
Regards,
Fab
|