updated devices/video devices to use device_add_mconfig insted of device_mconfig_additions (nw)

This commit is contained in:
Ivan Vangelista 2017-05-24 17:19:07 +02:00
parent a1e83106ad
commit 0832b6e2be
18 changed files with 79 additions and 142 deletions

View File

@ -1832,7 +1832,7 @@ void gba_lcd_device::device_reset()
m_hbl_timer->adjust(attotime::never);
}
static MACHINE_CONFIG_START(gba_lcd)
MACHINE_CONFIG_MEMBER(gba_lcd_device::device_add_mconfig)
MCFG_SCREEN_ADD("screen", LCD)
MCFG_SCREEN_RAW_PARAMS(XTAL_16_777216MHz / 4, 308, 0, 240, 228, 0, 160)
MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, gba_lcd_device, screen_update)
@ -1842,8 +1842,3 @@ static MACHINE_CONFIG_START(gba_lcd)
MCFG_PALETTE_ADD("palette", 32768)
MCFG_PALETTE_INIT_OWNER(gba_lcd_device, gba)
MACHINE_CONFIG_END
machine_config_constructor gba_lcd_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME(gba_lcd);
}

View File

@ -88,8 +88,6 @@ class gba_lcd_device
public:
gba_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ32_MEMBER(video_r);
DECLARE_WRITE32_MEMBER(video_w);
DECLARE_READ32_MEMBER(gba_pram_r);
@ -98,7 +96,6 @@ public:
DECLARE_WRITE32_MEMBER(gba_vram_w);
DECLARE_READ32_MEMBER(gba_oam_r);
DECLARE_WRITE32_MEMBER(gba_oam_w);
DECLARE_PALETTE_INIT(gba);
TIMER_CALLBACK_MEMBER(perform_hbl);
TIMER_CALLBACK_MEMBER(perform_scan);
@ -131,7 +128,7 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_add_mconfig(machine_config &config) override;
private:
struct internal_reg
@ -229,6 +226,10 @@ private:
uint32_t increase_brightness(uint32_t color);
uint32_t decrease_brightness(uint32_t color);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_PALETTE_INIT(gba);
devcb_write_line m_int_hblank_cb; /* H-Blank interrupt callback function */
devcb_write_line m_int_vblank_cb; /* V-Blank interrupt callback function */
devcb_write_line m_int_vcount_cb; /* V-Counter Match interrupt callback function */

View File

@ -274,17 +274,11 @@ PALETTE_INIT_MEMBER(hd66421_device, hd66421)
}
static MACHINE_CONFIG_START( hd66421 )
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_MEMBER( hd66421_device::device_add_mconfig )
MCFG_PALETTE_ADD("palette", 4)
MCFG_PALETTE_INIT_OWNER(hd66421_device, hd66421)
MACHINE_CONFIG_END
//-------------------------------------------------
// machine_config_additions - return a pointer to
// the device's machine fragment
//-------------------------------------------------
machine_config_constructor hd66421_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( hd66421 );
}

View File

@ -41,14 +41,13 @@ public:
DECLARE_WRITE8_MEMBER( reg_idx_w );
DECLARE_READ8_MEMBER( reg_dat_r );
DECLARE_WRITE8_MEMBER( reg_dat_w );
DECLARE_PALETTE_INIT(hd66421);
uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
// device-level overrides
virtual void device_start() override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_add_mconfig(machine_config &config) override;
// device_config_memory_interface overrides
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
@ -65,6 +64,8 @@ private:
uint8_t m_cmd, m_reg[32];
int m_x, m_y;
required_device<palette_device> m_palette;
DECLARE_PALETTE_INIT(hd66421);
};

View File

@ -303,17 +303,11 @@ void huc6260_device::device_reset()
m_timer->adjust( m_screen->time_until_pos( ( m_screen->vpos() + 1 ) % 263, 0 ) );
}
static MACHINE_CONFIG_START( huc6260 )
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_MEMBER( huc6260_device::device_add_mconfig )
MCFG_PALETTE_ADD("palette", huc6260_device::PALETTE_SIZE)
MCFG_PALETTE_INIT_OWNER(huc6260_device, huc6260)
MACHINE_CONFIG_END
//-------------------------------------------------
// machine_config_additions - return a pointer to
// the device's machine fragment
//-------------------------------------------------
machine_config_constructor huc6260_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( huc6260 );
}

View File

@ -47,7 +47,6 @@ public:
void video_update(bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
DECLARE_PALETTE_INIT(huc6260);
READ8_MEMBER(palette_direct_read);
WRITE8_MEMBER(palette_direct_write);
@ -57,14 +56,13 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_add_mconfig(machine_config &config) override;
private:
int m_last_h;
int m_last_v;
int m_height;
/* callbacks */
/* Callback function to retrieve pixel data */
devcb_read16 m_next_pixel_data_cb;
@ -88,6 +86,8 @@ private:
emu_timer *m_timer;
std::unique_ptr<bitmap_ind16> m_bmp;
DECLARE_PALETTE_INIT(huc6260);
};

View File

@ -379,7 +379,11 @@ WRITE32_MEMBER( huc6272_device::write )
}
}
static MACHINE_CONFIG_START( king_scsi_intf )
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_MEMBER( huc6272_device::device_add_mconfig )
MCFG_DEVICE_ADD("scsi", SCSI_PORT, 0)
MCFG_SCSI_RST_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit7))
MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("scsi_ctrl_in", input_buffer_device, write_bit6))
@ -397,13 +401,3 @@ static MACHINE_CONFIG_START( king_scsi_intf )
MCFG_SCSIDEV_ADD("scsi:" SCSI_PORT_DEVICE1, "cdrom", SCSICD, SCSI_ID_1)
MACHINE_CONFIG_END
//-------------------------------------------------
// machine_config_additions - return a pointer to
// the device's machine fragment
//-------------------------------------------------
machine_config_constructor huc6272_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( king_scsi_intf );
}

View File

@ -55,7 +55,7 @@ protected:
virtual void device_validity_check(validity_checker &valid) const override;
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const override;
private:

View File

@ -1521,16 +1521,11 @@ mos8568_device::mos8568_device(const machine_config &mconfig, const char *tag, d
}
static MACHINE_CONFIG_START(mos8563)
MACHINE_CONFIG_MEMBER(mos8563_device::device_add_mconfig)
MCFG_PALETTE_ADD("palette", 16)
MCFG_PALETTE_INIT_OWNER(mos8563_device, mos8563)
MACHINE_CONFIG_END
machine_config_constructor mos8563_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( mos8563 );
}
// VICE palette
PALETTE_INIT_MEMBER(mos8563_device, mos8563)

View File

@ -431,8 +431,6 @@ public:
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const override;
DECLARE_PALETTE_INIT(mos8563);
DECLARE_WRITE8_MEMBER( address_w );
DECLARE_READ8_MEMBER( status_r );
DECLARE_READ8_MEMBER( register_r );
@ -447,7 +445,7 @@ protected:
mos8563_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
@ -486,6 +484,8 @@ protected:
static const device_timer_id TIMER_BLOCK_COPY = 9;
emu_timer *m_block_copy_timer;
DECLARE_PALETTE_INIT(mos8563);
};
class mos8568_device : public mos8563_device

View File

@ -2228,30 +2228,19 @@ MACHINE_CONFIG_START( pcvideo_s3_vga )
MACHINE_CONFIG_END
static MACHINE_CONFIG_START( ati_vga )
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_MEMBER( ati_vga_device::device_add_mconfig )
MCFG_MACH8_ADD_OWNER("8514a")
MCFG_EEPROM_SERIAL_93C46_ADD("ati_eeprom")
MACHINE_CONFIG_END
static MACHINE_CONFIG_START( s3_764 )
MACHINE_CONFIG_MEMBER( s3_vga_device::device_add_mconfig )
MCFG_8514A_ADD_OWNER("8514a")
MACHINE_CONFIG_END
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
machine_config_constructor ati_vga_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( ati_vga );
}
machine_config_constructor s3_vga_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( s3_764 );
}
/******************************************
Tseng ET4000k implementation

View File

@ -531,13 +531,15 @@ public:
READ8_MEMBER(ati_port_ext_r);
WRITE8_MEMBER(ati_port_ext_w);
virtual machine_config_constructor device_mconfig_additions() const override;
virtual uint16_t offset() override;
mach8_device* get_8514() { return m_8514; }
protected:
ati_vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_start() override;
virtual void device_add_mconfig(machine_config &config) override;
private:
void ati_define_video_mode();
struct
@ -572,7 +574,6 @@ public:
virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual TIMER_CALLBACK_MEMBER(vblank_timer_cb) override;
ibm8514a_device* get_8514() { return m_8514; }
@ -583,6 +584,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
struct
{
uint8_t memory_config;

View File

@ -3799,7 +3799,12 @@ PALETTE_INIT_MEMBER( psxgpu_device, psx )
}
}
MACHINE_CONFIG_START( psxgpu )
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
MACHINE_CONFIG_MEMBER( psxgpu_device::device_add_mconfig )
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE( 60 )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
@ -3812,13 +3817,3 @@ MACHINE_CONFIG_START( psxgpu )
MCFG_PALETTE_ADD( "palette", 65536 )
MCFG_PALETTE_INIT_OWNER(psxgpu_device, psx)
MACHINE_CONFIG_END
//-------------------------------------------------
// machine_config_additions - device-specific
// machine configurations
//-------------------------------------------------
machine_config_constructor psxgpu_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( psxgpu );
}

View File

@ -51,20 +51,15 @@ DECLARE_DEVICE_TYPE(CXD8654Q, cxd8654q_device)
class psxgpu_device : public device_t
{
public:
virtual machine_config_constructor device_mconfig_additions() const override;
// static configuration helpers
template <class Object> static devcb_base &set_vblank_handler(device_t &device, Object &&cb) { return downcast<psxgpu_device &>(device).m_vblank_handler.set_callback(std::forward<Object>(cb)); }
static void set_vram_size(device_t &device, int size) { downcast<psxgpu_device &>(device).vramSize = size; }
uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE32_MEMBER( write );
DECLARE_READ32_MEMBER( read );
void dma_read( uint32_t *ram, uint32_t n_address, int32_t n_size );
void dma_write( uint32_t *ram, uint32_t n_address, int32_t n_size );
void lightgun_set( int, int );
void vblank(screen_device &screen, bool vblank_state);
DECLARE_PALETTE_INIT( psx );
protected:
static constexpr unsigned MAX_LEVEL = 32;
@ -77,6 +72,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
int vramSize;
@ -305,6 +301,10 @@ private:
devcb_write_line m_vblank_handler;
void vblank(screen_device &screen, bool vblank_state);
DECLARE_PALETTE_INIT( psx );
uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
#if defined(PSXGPU_DEBUG_VIEWER) && PSXGPU_DEBUG_VIEWER
required_device<screen_device> m_screen;
void DebugMeshInit();

View File

@ -2042,17 +2042,10 @@ uint32_t vic3_device::video_update( bitmap_ind16 &bitmap, const rectangle &clipr
return 0;
}
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
static MACHINE_CONFIG_START( vic3 )
MACHINE_CONFIG_MEMBER( vic3_device::device_add_mconfig )
MCFG_PALETTE_ADD_INIT_BLACK("palette", 0x100)
MACHINE_CONFIG_END
//-------------------------------------------------
// machine_config_additions - return a pointer to
// the device's machine fragment
//-------------------------------------------------
machine_config_constructor vic3_device::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( vic3 );
}

View File

@ -131,7 +131,7 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
virtual void device_add_mconfig(machine_config &config) override;
private:
static constexpr unsigned SPRITE_BASE_X_SIZE = 24;

View File

@ -8,50 +8,33 @@
int voodoo_pci_device::m_type = 0;
static MACHINE_CONFIG_START( voodoo_1_pci )
MCFG_DEVICE_ADD("voodoo", VOODOO_1, STD_VOODOO_1_CLOCK)
MCFG_VOODOO_FBMEM(4)
MCFG_VOODOO_TMUMEM(1, 0)
MCFG_VOODOO_SCREEN_TAG("screen")
MACHINE_CONFIG_END
static MACHINE_CONFIG_START( voodoo_2_pci )
MCFG_DEVICE_ADD("voodoo", VOODOO_2, STD_VOODOO_2_CLOCK)
MCFG_VOODOO_FBMEM(4)
MCFG_VOODOO_TMUMEM(1, 0)
MCFG_VOODOO_SCREEN_TAG("screen")
MACHINE_CONFIG_END
static MACHINE_CONFIG_START( voodoo_banshee_pci )
MCFG_DEVICE_ADD("voodoo", VOODOO_BANSHEE, STD_VOODOO_BANSHEE_CLOCK)
MCFG_VOODOO_FBMEM(16)
MCFG_VOODOO_SCREEN_TAG("screen")
MACHINE_CONFIG_END
static MACHINE_CONFIG_START( voodoo_3_pci )
MCFG_DEVICE_ADD("voodoo", VOODOO_3, STD_VOODOO_3_CLOCK)
MCFG_VOODOO_FBMEM(16)
MCFG_VOODOO_SCREEN_TAG("screen")
MACHINE_CONFIG_END
machine_config_constructor voodoo_pci_device::device_mconfig_additions() const
{
MACHINE_CONFIG_MEMBER(voodoo_pci_device::device_add_mconfig)
switch (m_type) {
case TYPE_VOODOO_1:
return MACHINE_CONFIG_NAME( voodoo_1_pci );
MCFG_DEVICE_ADD("voodoo", VOODOO_1, STD_VOODOO_1_CLOCK)
MCFG_VOODOO_FBMEM(4)
MCFG_VOODOO_TMUMEM(1, 0)
MCFG_VOODOO_SCREEN_TAG("screen")
break;
case TYPE_VOODOO_2:
return MACHINE_CONFIG_NAME( voodoo_2_pci );
MCFG_DEVICE_ADD("voodoo", VOODOO_2, STD_VOODOO_2_CLOCK)
MCFG_VOODOO_FBMEM(4)
MCFG_VOODOO_TMUMEM(1, 0)
MCFG_VOODOO_SCREEN_TAG("screen")
break;
case TYPE_VOODOO_BANSHEE:
return MACHINE_CONFIG_NAME( voodoo_banshee_pci );
MCFG_DEVICE_ADD("voodoo", VOODOO_BANSHEE, STD_VOODOO_BANSHEE_CLOCK)
MCFG_VOODOO_FBMEM(16)
MCFG_VOODOO_SCREEN_TAG("screen")
break;
//case TYPE_VOODOO_3
default:
return MACHINE_CONFIG_NAME( voodoo_3_pci );
break;
}
}
MCFG_DEVICE_ADD("voodoo", VOODOO_3, STD_VOODOO_3_CLOCK)
MCFG_VOODOO_FBMEM(16)
MCFG_VOODOO_SCREEN_TAG("screen")
break;}
MACHINE_CONFIG_END
DEFINE_DEVICE_TYPE(VOODOO_PCI, voodoo_pci_device, "voodoo_pci", "Voodoo PCI")

View File

@ -26,8 +26,7 @@ public:
voodoo_pci_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual void map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space,
uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space) override;
// optional information overrides
virtual machine_config_constructor device_mconfig_additions() const override;
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
virtual DECLARE_ADDRESS_MAP(config_map, 32) override;
@ -46,6 +45,7 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
private:
required_device<voodoo_device> m_voodoo;