vrender0: converted to use inline config. nw.

This commit is contained in:
Fabio Priuli 2014-04-08 10:31:03 +00:00
parent 41029a5a4d
commit 7e785d075e
3 changed files with 11 additions and 46 deletions

View File

@ -900,18 +900,12 @@ static const vr0_interface vr0_config =
0x04800000
};
static const vr0video_interface vr0video_config =
{
"maincpu"
};
static MACHINE_CONFIG_START( crystal, crystal_state )
MCFG_CPU_ADD("maincpu", SE3208, 43000000)
MCFG_CPU_PROGRAM_MAP(crystal_mem)
MCFG_CPU_VBLANK_INT_DRIVER("screen", crystal_state, crystal_interrupt)
MCFG_NVRAM_ADD_0FILL("nvram")
MCFG_SCREEN_ADD("screen", RASTER)
@ -923,7 +917,8 @@ static MACHINE_CONFIG_START( crystal, crystal_state )
MCFG_SCREEN_VBLANK_DRIVER(crystal_state, screen_eof_crystal)
MCFG_SCREEN_PALETTE("palette")
MCFG_VIDEO_VRENDER0_ADD("vr0", vr0video_config)
MCFG_DEVICE_ADD("vr0", VIDEO_VRENDER0, 0)
MCFG_VIDEO_VRENDER0_CPU("maincpu")
MCFG_PALETTE_ADD_RRRRRGGGGGGBBBBB("palette")
@ -1144,8 +1139,6 @@ DRIVER_INIT_MEMBER(crystal_state, donghaer)
}
GAME( 2001, crysbios, 0, crystal, crystal, driver_device, 0, ROT0, "BrezzaSoft", "Crystal System BIOS", GAME_IS_BIOS_ROOT )
GAME( 2001, crysking, crysbios, crystal, crystal, crystal_state, crysking, ROT0, "BrezzaSoft", "The Crystal of Kings", 0 )
GAME( 2001, evosocc, crysbios, crystal, crystal, crystal_state, evosocc, ROT0, "Evoga", "Evolution Soccer", 0 )

View File

@ -24,38 +24,17 @@
const device_type VIDEO_VRENDER0 = &device_creator<vr0video_device>;
vr0video_device::vr0video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, VIDEO_VRENDER0, "VRender0 Video", tag, owner, clock, "vr0video", __FILE__)
: device_t(mconfig, VIDEO_VRENDER0, "VRender0 Video", tag, owner, clock, "vr0video", __FILE__),
m_cpu(*this)
{
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void vr0video_device::device_config_complete()
{
// inherit a copy of the static data
const vr0video_interface *intf = reinterpret_cast<const vr0video_interface *>(static_config());
if (intf != NULL)
*static_cast<vr0video_interface *>(this) = *intf;
// or initialize to defaults if none provided
else
{
m_cpu_tag = "";
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void vr0video_device::device_start()
{
m_cpu = machine().device(m_cpu_tag);
save_item(NAME(m_InternalPalette));
save_item(NAME(m_LastPalUpdate));
@ -418,7 +397,7 @@ static const _DrawTemplate DrawTile[]=
//Returns TRUE if the operation was a flip (sync or async)
int vr0video_device::vrender0_ProcessPacket(UINT32 PacketPtr, UINT16 *Dest, UINT8 *TEXTURE)
{
address_space &space = m_cpu->memory().space(AS_PROGRAM);
address_space &space = m_cpu->space(AS_PROGRAM);
UINT32 Dx = Packet(1) & 0x3ff;
UINT32 Dy = Packet(2) & 0x1ff;
UINT32 Endx = Packet(3) & 0x3ff;

View File

@ -6,11 +6,6 @@
TYPE DEFINITIONS
***************************************************************************/
struct vr0video_interface
{
const char *m_cpu_tag;
};
struct RenderStateInfo
{
UINT32 Tx;
@ -35,9 +30,7 @@ struct RenderStateInfo
UINT32 Height;
};
class vr0video_device : public device_t,
vr0video_interface
class vr0video_device : public device_t
{
public:
vr0video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
@ -45,15 +38,16 @@ public:
int vrender0_ProcessPacket(UINT32 PacketPtr, UINT16 *Dest, UINT8 *TEXTURE);
static void set_cpu_tag(device_t &device, const char *tag) { downcast<vr0video_device &>(device).m_cpu.set_tag(tag); }
protected:
// device-level overrides
virtual void device_config_complete();
virtual void device_start();
virtual void device_reset();
private:
// internal state
device_t *m_cpu;
required_device<cpu_device> m_cpu;
UINT16 m_InternalPalette[256];
UINT32 m_LastPalUpdate;
@ -66,8 +60,7 @@ private:
extern const device_type VIDEO_VRENDER0;
#define MCFG_VIDEO_VRENDER0_ADD(_tag, _interface) \
MCFG_DEVICE_ADD(_tag, VIDEO_VRENDER0, 0) \
MCFG_DEVICE_CONFIG(_interface)
#define MCFG_VIDEO_VRENDER0_CPU(_tag) \
vr0video_device::set_cpu_tag(*device, "^"_tag);
#endif /* __VR0VIDEO_H__ */