A few key fixes. Also changed error reporting to list all missing

objects prior to fatalerror'ing.
This commit is contained in:
Aaron Giles 2012-04-15 22:00:24 +00:00
parent 58b7de2e33
commit 1dd1388ed8
10 changed files with 61 additions and 70 deletions

View File

@ -383,8 +383,11 @@ void device_t::start()
m_region = machine().region(tag());
// find all the registered devices
bool allfound = true;
for (finder_base *autodev = m_auto_finder_list; autodev != NULL; autodev = autodev->m_next)
autodev->findit();
allfound &= autodev->findit();
if (!allfound)
throw emu_fatalerror("Missing some required objects, unable to proceed");
// let the interfaces do their pre-work
for (device_interface *intf = m_interface_list; intf != NULL; intf = intf->interface_next())
@ -871,7 +874,7 @@ void *device_t::finder_base::find_memory(UINT8 width, size_t &bytes, bool requir
if (share == NULL)
{
if (required)
throw emu_fatalerror("Shared ptr '%s' not found", m_tag);
mame_printf_error("Shared ptr '%s' not found\n", m_tag);
return NULL;
}
if (share->width() != width)

View File

@ -331,7 +331,7 @@ public:
virtual ~finder_base();
// getters
virtual void findit() = 0;
virtual bool findit() = 0;
protected:
// helpers
@ -365,15 +365,19 @@ public:
_DeviceClass *target() const { return m_target; }
// setter for setting the object
void set_target(_DeviceClass *target)
{
m_target = target;
if (target == 0 && _Required)
throw emu_fatalerror("Unable to find required device '%s'", this->m_tag);
}
void set_target(_DeviceClass *target) { m_target = target; }
// finder
virtual void findit() { set_target(m_base.subdevice<_DeviceClass>(m_tag)); }
virtual bool findit()
{
device_t *device = m_base.subdevice(m_tag);
if (_Required && device == NULL)
mame_printf_error("Unable to find required device '%s'\n", this->m_tag);
m_target = downcast<_DeviceClass *>(device);
if (device != NULL && m_target == NULL)
mame_printf_warning("Device '%s' found but is of the incorrect type\n", m_tag);
return (!_Required || m_target != NULL);
}
protected:
// internal state
@ -425,13 +429,7 @@ public:
UINT32 bytes() const { return m_bytes; }
// setter for setting the object
void set_target(_PointerType *target, size_t bytes)
{
m_target = target;
m_bytes = bytes;
if (target == 0 && _Required)
throw emu_fatalerror("Unable to find required shared pointer '%s'", this->m_tag);
}
void set_target(_PointerType *target, size_t bytes) { m_target = target; m_bytes = bytes; }
// dynamic allocation of a shared pointer
void allocate(UINT32 entries)
@ -444,7 +442,7 @@ public:
}
// finder
virtual void findit() { m_target = reinterpret_cast<_PointerType *>(find_memory(m_width, m_bytes, _Required)); }
virtual bool findit() { m_target = reinterpret_cast<_PointerType *>(find_memory(m_width, m_bytes, _Required)); return (!_Required || m_target != NULL); }
protected:
// internal state

View File

@ -131,11 +131,11 @@ static INPUT_PORTS_START( cdi )
PORT_BIT(0x3ff, 0x000, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0x3ff) PORT_KEYDELTA(2) PORT_CHANGED_MEMBER("slave", cdislave_device, mouse_update, 0)
PORT_START("MOUSEY")
PORT_BIT(0x3ff, 0x000, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0x3ff) PORT_KEYDELTA(2) PORT_CHANGED_MEMBER("slave", cdislave_device, cdislave_device::mouse_update, 0)
PORT_BIT(0x3ff, 0x000, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_MINMAX(0x000, 0x3ff) PORT_KEYDELTA(2) PORT_CHANGED_MEMBER("slave", cdislave_device, mouse_update, 0)
PORT_START("MOUSEBTN")
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CHANGED_MEMBER("slave", cdislave_device, cdislave_device::mouse_update, 0)
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Button 2") PORT_CHANGED_MEMBER("slave", cdislave_device, cdislave_device::mouse_update, 0)
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_CODE(MOUSECODE_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CHANGED_MEMBER("slave", cdislave_device, mouse_update, 0)
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_CODE(MOUSECODE_BUTTON2) PORT_NAME("Mouse Button 2") PORT_CHANGED_MEMBER("slave", cdislave_device, mouse_update, 0)
PORT_BIT(0xfc, IP_ACTIVE_HIGH, IPT_UNUSED)
PORT_START("DEBUG")

View File

@ -812,7 +812,7 @@ static READ16_HANDLER( joy_or_paddle_r )
static ADDRESS_MAP_START( cps2_map, AS_PROGRAM, 16, cps_state )
AM_RANGE(0x000000, 0x3fffff) AM_ROM /* 68000 ROM */
AM_RANGE(0x400000, 0x40000b) AM_RAM AM_BASE_SIZE(m_output, m_output_size) /* CPS2 object output */
AM_RANGE(0x400000, 0x40000b) AM_RAM AM_SHARE("output") /* CPS2 object output */
AM_RANGE(0x618000, 0x619fff) AM_READWRITE(qsound_sharedram1_r, qsound_sharedram1_w) /* Q RAM */
AM_RANGE(0x662000, 0x662001) AM_RAM /* Network adapter related, accessed in SSF2TB */
AM_RANGE(0x662008, 0x662009) AM_RAM /* Network adapter related, accessed in SSF2TB */
@ -820,10 +820,7 @@ static ADDRESS_MAP_START( cps2_map, AS_PROGRAM, 16, cps_state )
AM_RANGE(0x660000, 0x663fff) AM_RAM /* When bit 14 of 0x804030 equals 0 this space is available. Many games store highscores and other info here if available. */
AM_RANGE(0x664000, 0x664001) AM_RAM /* Unknown - Only used if 0x660000-0x663fff available (could be RAM enable?) */
AM_RANGE(0x700000, 0x701fff) AM_WRITE(cps2_objram1_w) AM_SHARE("objram1") /* Object RAM, no game seems to use it directly */
AM_RANGE(0x708000, 0x709fff) AM_READWRITE(cps2_objram2_r, cps2_objram2_w) AM_SHARE("objram2") /* Object RAM */
AM_RANGE(0x70a000, 0x70bfff) AM_READWRITE(cps2_objram2_r, cps2_objram2_w) AM_SHARE("objram2") /* mirror */
AM_RANGE(0x70c000, 0x70dfff) AM_READWRITE(cps2_objram2_r, cps2_objram2_w) AM_SHARE("objram2") /* mirror */
AM_RANGE(0x70e000, 0x70ffff) AM_READWRITE(cps2_objram2_r, cps2_objram2_w) AM_SHARE("objram2") /* mirror */
AM_RANGE(0x708000, 0x709fff) AM_MIRROR(0x006000) AM_READWRITE(cps2_objram2_r, cps2_objram2_w) AM_SHARE("objram2") /* Object RAM */
AM_RANGE(0x800100, 0x80013f) AM_WRITE(cps1_cps_a_w) AM_SHARE("cps_a_regs") /* mirror (sfa) */
AM_RANGE(0x800140, 0x80017f) AM_READWRITE(cps1_cps_b_r, cps1_cps_b_w) AM_SHARE("cps_b_regs") /* mirror (sfa) */
AM_RANGE(0x804000, 0x804001) AM_READ_PORT("IN0") /* IN0 */
@ -843,7 +840,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( dead_cps2_map, AS_PROGRAM, 16, cps_state )
AM_RANGE(0x000000, 0x3fffff) AM_ROM /* 68000 ROM */
AM_RANGE(0x400000, 0x40000b) AM_RAM AM_BASE_SIZE(m_output, m_output_size) /* CPS2 object output */
AM_RANGE(0x400000, 0x40000b) AM_RAM AM_SHARE("output") /* CPS2 object output */
AM_RANGE(0x618000, 0x619fff) AM_READWRITE(qsound_sharedram1_r, qsound_sharedram1_w) /* Q RAM */
AM_RANGE(0x662000, 0x662001) AM_RAM /* Network adapter related, accessed in SSF2TB */
AM_RANGE(0x662008, 0x662009) AM_RAM /* Network adapter related, accessed in SSF2TB */
@ -851,10 +848,7 @@ static ADDRESS_MAP_START( dead_cps2_map, AS_PROGRAM, 16, cps_state )
AM_RANGE(0x660000, 0x663fff) AM_RAM /* When bit 14 of 0x804030 equals 0 this space is available. Many games store highscores and other info here if available. */
AM_RANGE(0x664000, 0x664001) AM_RAM /* Unknown - Only used if 0x660000-0x663fff available (could be RAM enable?) */
AM_RANGE(0x700000, 0x701fff) AM_WRITE(cps2_objram1_w) AM_SHARE("objram1") /* Object RAM, no game seems to use it directly */
AM_RANGE(0x708000, 0x709fff) AM_READWRITE(cps2_objram2_r, cps2_objram2_w) AM_SHARE("objram2") /* Object RAM */
AM_RANGE(0x70a000, 0x70bfff) AM_READWRITE(cps2_objram2_r, cps2_objram2_w) AM_SHARE("objram2") /* mirror */
AM_RANGE(0x70c000, 0x70dfff) AM_READWRITE(cps2_objram2_r, cps2_objram2_w) AM_SHARE("objram2") /* mirror */
AM_RANGE(0x70e000, 0x70ffff) AM_READWRITE(cps2_objram2_r, cps2_objram2_w) AM_SHARE("objram2") /* mirror */
AM_RANGE(0x708000, 0x709fff) AM_MIRROR(0x006000) AM_READWRITE(cps2_objram2_r, cps2_objram2_w) AM_SHARE("objram2") /* Object RAM */
AM_RANGE(0x800100, 0x80013f) AM_WRITE(cps1_cps_a_w) AM_SHARE("cps_a_regs") /* mirror (sfa) */
AM_RANGE(0x800140, 0x80017f) AM_READWRITE(cps1_cps_b_r, cps1_cps_b_w) AM_SHARE("cps_b_regs") /* mirror (sfa) */
AM_RANGE(0x804000, 0x804001) AM_READ_PORT("IN0") /* IN0 */
@ -869,7 +863,7 @@ static ADDRESS_MAP_START( dead_cps2_map, AS_PROGRAM, 16, cps_state )
AM_RANGE(0x804140, 0x80417f) AM_READWRITE(cps1_cps_b_r, cps1_cps_b_w) /* CPS-B custom */
AM_RANGE(0x900000, 0x92ffff) AM_RAM_WRITE(cps1_gfxram_w) AM_SHARE("gfxram") /* Video RAM */
AM_RANGE(0xff0000, 0xffffef) AM_RAM /* RAM */
AM_RANGE(0xfffff0, 0xfffffb) AM_RAM AM_BASE_SIZE(m_output, m_output_size) /* CPS2 output */
AM_RANGE(0xfffff0, 0xfffffb) AM_RAM AM_SHARE("output") /* CPS2 output */
ADDRESS_MAP_END

View File

@ -5964,23 +5964,16 @@ static DRIVER_INIT( metro )
static DRIVER_INIT( karatour )
{
//metro_state *state = machine.driver_data<metro_state>();
UINT16 *RAM = auto_alloc_array(machine, UINT16, 0x20000*3/2);
int i;
//TODO:FIX
//state->m_vram_0 = RAM + (0x20000/2) * 0;
//state->m_vram_1 = RAM + (0x20000/2) * 1;
//state->m_vram_2 = RAM + (0x20000/2) * 2;
for (i = 0; i < (0x20000 * 3) / 2; i++)
RAM[i] = machine.rand();
DRIVER_INIT_CALL(metro);
//state->save_pointer(NAME(state->m_vram_0), 0x20000/2);
//state->save_pointer(NAME(state->m_vram_1), 0x20000/2);
//state->save_pointer(NAME(state->m_vram_2), 0x20000/2);
metro_state *state = machine.driver_data<metro_state>();
state->m_vram_0.allocate(0x20000/2);
state->m_vram_1.allocate(0x20000/2);
state->m_vram_2.allocate(0x20000/2);
for (int i = 0; i < 0x20000 / 2; i++)
{
state->m_vram_0[i] = machine.rand();
state->m_vram_1[i] = machine.rand();
state->m_vram_2[i] = machine.rand();
}
}
static DRIVER_INIT( daitorid )

View File

@ -68,7 +68,10 @@ public:
m_cps_a_regs(*this, "cps_a_regs"),
m_cps_b_regs(*this, "cps_b_regs"),
m_qsound_sharedram1(*this, "qsound_ram1"),
m_qsound_sharedram2(*this, "qsound_ram2") { }
m_qsound_sharedram2(*this, "qsound_ram2"),
m_objram1(*this, "objram1"),
m_objram2(*this, "objram2"),
m_output(*this, "output") { }
/* memory pointers */
// cps1
@ -81,14 +84,13 @@ public:
UINT16 * m_obj;
UINT16 * m_other;
UINT16 * m_buffered_obj;
required_shared_ptr<UINT8> m_qsound_sharedram1;
required_shared_ptr<UINT8> m_qsound_sharedram2;
optional_shared_ptr<UINT8> m_qsound_sharedram1;
optional_shared_ptr<UINT8> m_qsound_sharedram2;
// cps2
UINT16 * m_objram1;
UINT16 * m_objram2;
UINT16 * m_output;
optional_shared_ptr<UINT16> m_objram1;
optional_shared_ptr<UINT16> m_objram2;
optional_shared_ptr<UINT16> m_output;
UINT16 * m_cps2_buffered_obj;
size_t m_output_size;
// game-specific
UINT16 * m_gigaman2_dummyqsound_ram;

View File

@ -42,9 +42,9 @@ public:
optional_device<device_t> m_ymsnd;
optional_device<k053936_device> m_k053936;
/* memory pointers */
required_shared_ptr<UINT16> m_vram_0;
required_shared_ptr<UINT16> m_vram_1;
required_shared_ptr<UINT16> m_vram_2;
optional_shared_ptr<UINT16> m_vram_0;
optional_shared_ptr<UINT16> m_vram_1;
optional_shared_ptr<UINT16> m_vram_2;
required_shared_ptr<UINT16> m_spriteram;
required_shared_ptr<UINT16> m_tiletable;
UINT16 * m_tiletable_old;
@ -52,13 +52,13 @@ public:
required_shared_ptr<UINT16> m_scroll;
required_shared_ptr<UINT16> m_window;
required_shared_ptr<UINT16> m_irq_enable;
required_shared_ptr<UINT16> m_irq_levels;
required_shared_ptr<UINT16> m_irq_vectors;
optional_shared_ptr<UINT16> m_irq_levels;
optional_shared_ptr<UINT16> m_irq_vectors;
required_shared_ptr<UINT16> m_rombank;
required_shared_ptr<UINT16> m_videoregs;
required_shared_ptr<UINT16> m_screenctrl;
required_shared_ptr<UINT16> m_input_sel;
required_shared_ptr<UINT16> m_k053936_ram;
optional_shared_ptr<UINT16> m_input_sel;
optional_shared_ptr<UINT16> m_k053936_ram;
int m_flip_screen;

View File

@ -36,11 +36,12 @@ class mw8080bw_state : public driver_device
public:
mw8080bw_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) ,
m_main_ram(*this, "main_ram"){ }
m_main_ram(*this, "main_ram"),
m_colorram(*this, "colorram"){ }
/* memory pointers */
required_shared_ptr<UINT8> m_main_ram;
UINT8 * m_colorram;
optional_shared_ptr<UINT8> m_colorram;
/* sound-related */
UINT8 m_port_1_last;

View File

@ -22,8 +22,8 @@ public:
optional_shared_ptr<UINT8> m_s2650_spriteram;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_colorram;
required_shared_ptr<UINT8> m_s2650games_tileram;
required_shared_ptr<UINT8> m_rocktrv2_prot_data;
optional_shared_ptr<UINT8> m_s2650games_tileram;
optional_shared_ptr<UINT8> m_rocktrv2_prot_data;
UINT8 m_cannonb_bit_to_read;
int m_mystery;

View File

@ -16,10 +16,10 @@ public:
required_shared_ptr<UINT16> m_spriteram;
required_shared_ptr<UINT16> m_vregs;
required_shared_ptr<UINT32> m_coldfire_regs;
optional_shared_ptr<UINT32> m_coldfire_regs;
required_shared_ptr<UINT8> m_funcube_outputs;
required_shared_ptr<UINT8> m_funcube_leds;
optional_shared_ptr<UINT8> m_funcube_outputs;
optional_shared_ptr<UINT8> m_funcube_leds;
int m_xoffset;
int m_yoffset;
int m_keyboard_row;