Fix for potential driver conflicts with same named machine states between MAME and MESS. [David Haywood]

This commit is contained in:
Scott Stone 2012-02-27 17:48:43 +00:00
parent d96955a9f8
commit 6f2af481a5
4 changed files with 45 additions and 43 deletions

View File

@ -42,11 +42,11 @@ A1 2101 2101
#define MASTER_CLOCK XTAL_18MHz
class ace_state : public driver_device
// ace_state was also defined in mess/drivers/ace.c
class aceal_state : public driver_device
{
public:
ace_state(const machine_config &mconfig, device_type type, const char *tag)
aceal_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) { }
/* video-related */
@ -61,21 +61,21 @@ public:
static WRITE8_HANDLER( ace_objpos_w )
{
ace_state *state = space->machine().driver_data<ace_state>();
aceal_state *state = space->machine().driver_data<aceal_state>();
state->m_objpos[offset] = data;
}
#if 0
static READ8_HANDLER( ace_objpos_r )
{
ace_state *state = space->machine().driver_data<ace_state>();
aceal_state *state = space->machine().driver_data<aceal_state>();
return state->m_objpos[offset];
}
#endif
static VIDEO_START( ace )
{
ace_state *state = machine.driver_data<ace_state>();
aceal_state *state = machine.driver_data<aceal_state>();
gfx_element_set_source(machine.gfx[1], state->m_characterram);
gfx_element_set_source(machine.gfx[2], state->m_characterram);
gfx_element_set_source(machine.gfx[3], state->m_characterram);
@ -84,7 +84,7 @@ static VIDEO_START( ace )
static SCREEN_UPDATE_IND16( ace )
{
ace_state *state = screen.machine().driver_data<ace_state>();
aceal_state *state = screen.machine().driver_data<aceal_state>();
int offs;
/* first of all, fill the screen with the background color */
@ -130,7 +130,7 @@ static PALETTE_INIT( ace )
static WRITE8_HANDLER( ace_characterram_w )
{
ace_state *state = space->machine().driver_data<ace_state>();
aceal_state *state = space->machine().driver_data<aceal_state>();
if (state->m_characterram[offset] != data)
{
if (data & ~0x07)
@ -147,7 +147,7 @@ static WRITE8_HANDLER( ace_characterram_w )
static WRITE8_HANDLER( ace_scoreram_w )
{
ace_state *state = space->machine().driver_data<ace_state>();
aceal_state *state = space->machine().driver_data<aceal_state>();
state->m_scoreram[offset] = data;
gfx_element_mark_dirty(space->machine().gfx[4], offset / 32);
}
@ -166,9 +166,9 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 )
AM_RANGE(0x0000, 0x09ff) AM_ROM
AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(ace_scoreram_w) AM_BASE_MEMBER(ace_state, m_scoreram) /* 2x2101 */
AM_RANGE(0x8300, 0x83ff) AM_RAM AM_BASE_MEMBER(ace_state, m_ram2) /* 2x2101 */
AM_RANGE(0x8000, 0x80ff) AM_RAM_WRITE(ace_characterram_w) AM_BASE_MEMBER(ace_state, m_characterram) /* 3x3101 (3bits: 0, 1, 2) */
AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(ace_scoreram_w) AM_BASE_MEMBER(aceal_state, m_scoreram) /* 2x2101 */
AM_RANGE(0x8300, 0x83ff) AM_RAM AM_BASE_MEMBER(aceal_state, m_ram2) /* 2x2101 */
AM_RANGE(0x8000, 0x80ff) AM_RAM_WRITE(ace_characterram_w) AM_BASE_MEMBER(aceal_state, m_characterram) /* 3x3101 (3bits: 0, 1, 2) */
AM_RANGE(0xc000, 0xc005) AM_WRITE(ace_objpos_w)
@ -327,21 +327,21 @@ static void ace_postload(running_machine &machine)
static MACHINE_START( ace )
{
ace_state *state = machine.driver_data<ace_state>();
aceal_state *state = machine.driver_data<aceal_state>();
state->save_item(NAME(state->m_objpos));
machine.save().register_postload(save_prepost_delegate(FUNC(ace_postload), &machine));
}
static MACHINE_RESET( ace )
{
ace_state *state = machine.driver_data<ace_state>();
aceal_state *state = machine.driver_data<aceal_state>();
int i;
for (i = 0; i < 8; i++)
state->m_objpos[i] = 0;
}
static MACHINE_CONFIG_START( ace, ace_state )
static MACHINE_CONFIG_START( ace, aceal_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", I8080, MASTER_CLOCK/9) /* 2 MHz ? */

View File

@ -55,11 +55,11 @@
#include "machine/amigafdc.h"
class arcadia_state : public amiga_state
// arcadia_state was also defined in mess/includes/arcadia.h
class arcadia_amiga_state : public amiga_state
{
public:
arcadia_state(const machine_config &mconfig, device_type type, const char *tag)
arcadia_amiga_state(const machine_config &mconfig, device_type type, const char *tag)
: amiga_state(mconfig, type, tag) { }
UINT8 coin_counter[2];
@ -138,7 +138,7 @@ static WRITE8_DEVICE_HANDLER( arcadia_cia_0_portb_w )
/* writing a 0 in the low bit clears one of the coins */
if ((data & 1) == 0)
{
UINT8 *coin_counter = device->machine().driver_data<arcadia_state>()->coin_counter;
UINT8 *coin_counter = device->machine().driver_data<arcadia_amiga_state>()->coin_counter;
if (coin_counter[0] > 0)
coin_counter[0]--;
@ -158,7 +158,7 @@ static WRITE8_DEVICE_HANDLER( arcadia_cia_0_portb_w )
static CUSTOM_INPUT( coin_counter_r )
{
int coin = (FPTR)param;
UINT8 *coin_counter = field.machine().driver_data<arcadia_state>()->coin_counter;
UINT8 *coin_counter = field.machine().driver_data<arcadia_amiga_state>()->coin_counter;
/* return coin counter values */
return coin_counter[coin] & 3;
@ -168,7 +168,7 @@ static CUSTOM_INPUT( coin_counter_r )
static INPUT_CHANGED( coin_changed_callback )
{
int coin = (FPTR)param;
UINT8 *coin_counter = field.machine().driver_data<arcadia_state>()->coin_counter;
UINT8 *coin_counter = field.machine().driver_data<arcadia_amiga_state>()->coin_counter;
/* check for a 0 -> 1 transition */
if (!oldval && newval && coin_counter[coin] < 3)
@ -178,7 +178,7 @@ static INPUT_CHANGED( coin_changed_callback )
static void arcadia_reset_coins(running_machine &machine)
{
UINT8 *coin_counter = machine.driver_data<arcadia_state>()->coin_counter;
UINT8 *coin_counter = machine.driver_data<arcadia_amiga_state>()->coin_counter;
/* reset coin counters */
coin_counter[0] = coin_counter[1] = 0;
@ -194,9 +194,9 @@ static void arcadia_reset_coins(running_machine &machine)
static ADDRESS_MAP_START( amiga_map, AS_PROGRAM, 16 )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_BASE_SIZE_MEMBER(arcadia_state, m_chip_ram, m_chip_ram_size)
AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_BASE_SIZE_MEMBER(arcadia_amiga_state, m_chip_ram, m_chip_ram_size)
AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE(amiga_cia_r, amiga_cia_w)
AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_BASE_MEMBER(arcadia_state, m_custom_regs)
AM_RANGE(0xc00000, 0xdfffff) AM_READWRITE(amiga_custom_r, amiga_custom_w) AM_BASE_MEMBER(arcadia_amiga_state, m_custom_regs)
AM_RANGE(0xe80000, 0xe8ffff) AM_READWRITE(amiga_autoconfig_r, amiga_autoconfig_w)
AM_RANGE(0xf80000, 0xffffff) AM_ROM AM_REGION("user1", 0) /* Kickstart BIOS */
@ -297,7 +297,7 @@ static const mos6526_interface cia_1_intf =
DEVCB_NULL
};
static MACHINE_CONFIG_START( arcadia, arcadia_state )
static MACHINE_CONFIG_START( arcadia, arcadia_amiga_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, AMIGA_68000_NTSC_CLOCK)
@ -791,7 +791,7 @@ INLINE void generic_decode(running_machine &machine, const char *tag, int bit7,
static void arcadia_init(running_machine &machine)
{
arcadia_state *state = machine.driver_data<arcadia_state>();
arcadia_amiga_state *state = machine.driver_data<arcadia_amiga_state>();
static const amiga_machine_interface arcadia_intf =
{
ANGUS_CHIP_RAM_MASK,

View File

@ -3,10 +3,11 @@
#include "emu.h"
#include "cpu/i86/i86.h"
class mephisto_state : public driver_device
// mephisto_state was also defined in mess/drivers/mephisto.c
class mephisto_pinball_state : public driver_device
{
public:
mephisto_state(const machine_config &mconfig, device_type type, const char *tag)
mephisto_pinball_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu")
{ }
@ -21,7 +22,7 @@ protected:
};
static ADDRESS_MAP_START( mephisto_map, AS_PROGRAM, 8, mephisto_state )
static ADDRESS_MAP_START( mephisto_map, AS_PROGRAM, 8, mephisto_pinball_state )
AM_RANGE(0x0000, 0xffff) AM_NOP
AM_RANGE(0x00000, 0x0ffff) AM_ROM
AM_RANGE(0x10000, 0x1ffff) AM_RAM
@ -31,7 +32,7 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( mephisto )
INPUT_PORTS_END
void mephisto_state::machine_reset()
void mephisto_pinball_state::machine_reset()
{
}
@ -39,7 +40,7 @@ static DRIVER_INIT( mephisto )
{
}
static MACHINE_CONFIG_START( mephisto, mephisto_state )
static MACHINE_CONFIG_START( mephisto, mephisto_pinball_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", I8088, 8000000)
MCFG_CPU_PROGRAM_MAP(mephisto_map)

View File

@ -40,10 +40,11 @@ MR_01-.3A [a0b758aa]
#include "sound/okim6295.h"
#include "video/decospr.h"
class mirage_state : public driver_device
// mirage_state was also defined in mess/drivers/mirage.c
class miragemi_state : public driver_device
{
public:
mirage_state(const machine_config &mconfig, device_type type, const char *tag)
miragemi_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_deco_tilegen1(*this, "tilegen1"),
@ -74,7 +75,7 @@ static VIDEO_START( mirage )
static SCREEN_UPDATE_RGB32( mirage )
{
mirage_state *state = screen.machine().driver_data<mirage_state>();
miragemi_state *state = screen.machine().driver_data<miragemi_state>();
UINT16 flip = deco16ic_pf_control_r(state->m_deco_tilegen1, 0, 0xffff);
flip_screen_set(screen.machine(), BIT(flip, 7));
@ -106,13 +107,13 @@ static SCREEN_VBLANK( mirage )
static WRITE16_HANDLER( mirage_mux_w )
{
mirage_state *state = space->machine().driver_data<mirage_state>();
miragemi_state *state = space->machine().driver_data<miragemi_state>();
state->m_mux_data = data & 0x1f;
}
static READ16_HANDLER( mirage_input_r )
{
mirage_state *state = space->machine().driver_data<mirage_state>();
miragemi_state *state = space->machine().driver_data<miragemi_state>();
switch (state->m_mux_data & 0x1f)
{
case 0x01: return input_port_read(space->machine(), "KEY0");
@ -127,13 +128,13 @@ static READ16_HANDLER( mirage_input_r )
static WRITE16_HANDLER( okim1_rombank_w )
{
mirage_state *state = space->machine().driver_data<mirage_state>();
miragemi_state *state = space->machine().driver_data<miragemi_state>();
state->m_oki_sfx->set_bank_base(0x40000 * (data & 0x3));
}
static WRITE16_HANDLER( okim0_rombank_w )
{
mirage_state *state = space->machine().driver_data<mirage_state>();
miragemi_state *state = space->machine().driver_data<miragemi_state>();
/*bits 4-6 used on POST? */
state->m_oki_bgm->set_bank_base(0x40000 * (data & 0x7));
@ -145,8 +146,8 @@ static ADDRESS_MAP_START( mirage_map, AS_PROGRAM, 16 )
AM_RANGE(0x100000, 0x101fff) AM_DEVREADWRITE("tilegen1", deco16ic_pf1_data_r, deco16ic_pf1_data_w) // 0x100000 - 0x101fff tested
AM_RANGE(0x102000, 0x103fff) AM_DEVREADWRITE("tilegen1", deco16ic_pf2_data_r, deco16ic_pf2_data_w) // 0x102000 - 0x102fff tested
/* linescroll */
AM_RANGE(0x110000, 0x110bff) AM_RAM AM_BASE_MEMBER(mirage_state, m_pf1_rowscroll)
AM_RANGE(0x112000, 0x112bff) AM_RAM AM_BASE_MEMBER(mirage_state, m_pf2_rowscroll)
AM_RANGE(0x110000, 0x110bff) AM_RAM AM_BASE_MEMBER(miragemi_state, m_pf1_rowscroll)
AM_RANGE(0x112000, 0x112bff) AM_RAM AM_BASE_MEMBER(miragemi_state, m_pf2_rowscroll)
AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x130000, 0x1307ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x140000, 0x14000f) AM_DEVREADWRITE8_MODERN("oki_sfx", okim6295_device, read, write, 0x00ff)
@ -306,19 +307,19 @@ static const deco16ic_interface mirage_deco16ic_tilegen1_intf =
static MACHINE_START( mirage )
{
mirage_state *state = machine.driver_data<mirage_state>();
miragemi_state *state = machine.driver_data<miragemi_state>();
state->save_item(NAME(state->m_mux_data));
}
static MACHINE_RESET( mirage )
{
mirage_state *state = machine.driver_data<mirage_state>();
miragemi_state *state = machine.driver_data<miragemi_state>();
state->m_mux_data = 0;
}
static MACHINE_CONFIG_START( mirage, mirage_state )
static MACHINE_CONFIG_START( mirage, miragemi_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 28000000/2)