start making this a little more modern c++y with classes, member functions etc. rather than legacy structs, tokens etc.

(with a view to eventually ditching polylgcy)
This commit is contained in:
David Haywood 2016-02-01 23:32:24 +00:00
parent 88413be866
commit 51ffee344f
15 changed files with 3292 additions and 3305 deletions

View File

@ -33,7 +33,7 @@ k033906_device::k033906_device(const machine_config &mconfig, const char *tag, d
void k033906_device::device_start()
{
m_voodoo = machine().device(m_voodoo_tag);
m_voodoo = (voodoo_device*)machine().device(m_voodoo_tag);
m_reg_set = 0;
@ -95,7 +95,7 @@ void k033906_device::reg_w(int reg, UINT32 data)
case 0x10: // initEnable
{
voodoo_set_init_enable(m_voodoo, data);
m_voodoo->voodoo_set_init_enable(data);
break;
}

View File

@ -12,7 +12,7 @@
#define __K033906_H__
#include "emu.h"
#include "video/voodoo.h"
/***************************************************************************
@ -58,7 +58,7 @@ private:
int m_reg_set; // 1 = access reg / 0 = access ram
const char *m_voodoo_tag;
device_t *m_voodoo;
voodoo_device *m_voodoo;
UINT32 m_reg[256];
UINT32 m_ram[32768];

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -153,7 +153,7 @@ void voodoo_pci_device::map_extra(UINT64 memory_window_start, UINT64 memory_wind
UINT32 voodoo_pci_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return voodoo_update(m_voodoo, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
return m_voodoo->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
}
// PCI bus control
@ -170,7 +170,7 @@ WRITE32_MEMBER (voodoo_pci_device::pcictrl_w)
switch (offset) {
case 0x0/4: // The address map starts at 0x40
// HW initEnable
voodoo_set_init_enable(m_voodoo, data);
m_voodoo->voodoo_set_init_enable(data);
logerror("%06X:voodoo_pci_device pcictrl_w to offset %02X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask);
break;
default:

View File

@ -142,7 +142,7 @@ void funkball_state::video_start()
UINT32 funkball_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
{
return voodoo_update(m_voodoo, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
return m_voodoo->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
}
static UINT32 voodoo_0_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
@ -186,7 +186,7 @@ static void voodoo_0_pci_w(device_t *busdevice, device_t *device, int function,
break;
case 0x40:
state->m_voodoo_pci_regs.init_enable = data;
voodoo_set_init_enable(state->m_voodoo, data);
state->m_voodoo->voodoo_set_init_enable(data);
break;
}
}

View File

@ -910,21 +910,21 @@ UINT32 gticlub_state::screen_update_hangplt(screen_device &screen, bitmap_rgb32
if (strcmp(screen.tag(), ":lscreen") == 0)
{
device_t *voodoo = machine().device("voodoo0");
voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo0");
// m_k001604_1->draw_back_layer(bitmap, cliprect);
voodoo_update(voodoo, bitmap, cliprect);
voodoo->voodoo_update(bitmap, cliprect);
m_k001604_1->draw_front_layer(screen, bitmap, cliprect);
}
else if (strcmp(screen.tag(), ":rscreen") == 0)
{
device_t *voodoo = machine().device("voodoo1");
voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo1");
// m_k001604_2->draw_back_layer(bitmap, cliprect);
voodoo_update(voodoo, bitmap, cliprect);
voodoo->voodoo_update(bitmap, cliprect);
m_k001604_2->draw_front_layer(screen, bitmap, cliprect);
}

View File

@ -478,9 +478,9 @@ WRITE_LINE_MEMBER(hornet_state::voodoo_vblank_1)
UINT32 hornet_state::screen_update_hornet(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
device_t *voodoo = machine().device("voodoo0");
voodoo_device* voodoo = (voodoo_device*)machine().device("voodoo0");
voodoo_update(voodoo, bitmap, cliprect);
voodoo->voodoo_update(bitmap, cliprect);
m_k037122_1->tile_draw(screen, bitmap, cliprect);
@ -493,16 +493,16 @@ UINT32 hornet_state::screen_update_hornet_2board(screen_device &screen, bitmap_r
{
if (strcmp(screen.tag(), ":lscreen") == 0)
{
device_t *voodoo = machine().device("voodoo0");
voodoo_update(voodoo, bitmap, cliprect);
voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo0");
voodoo->voodoo_update(bitmap, cliprect);
/* TODO: tilemaps per screen */
m_k037122_1->tile_draw(screen, bitmap, cliprect);
}
else if (strcmp(screen.tag(), ":rscreen") == 0)
{
device_t *voodoo = machine().device("voodoo1");
voodoo_update(voodoo, bitmap, cliprect);
voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo1");
voodoo->voodoo_update(bitmap, cliprect);
/* TODO: tilemaps per screen */
m_k037122_2->tile_draw(screen, bitmap, cliprect);

View File

@ -180,7 +180,7 @@ public:
/* 3Dfx Voodoo */
device_t* m_voodoo[2];
voodoo_device* m_voodoo[2];
struct
{
@ -241,8 +241,8 @@ public:
void magictg_state::machine_start()
{
m_voodoo[0] = machine().device("voodoo_0");
m_voodoo[1] = machine().device("voodoo_1");
m_voodoo[0] = (voodoo_device*)machine().device("voodoo_0");
m_voodoo[1] = (voodoo_device*)machine().device("voodoo_1");
}
@ -278,7 +278,7 @@ void magictg_state::video_start()
UINT32 magictg_state::screen_update_magictg(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return voodoo_update(m_voodoo[0], bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
return m_voodoo[0]->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
}
@ -338,7 +338,7 @@ static void voodoo_0_pci_w(device_t *busdevice, device_t *device, int function,
break;
case 0x40:
state->m_voodoo_pci_regs[0].init_enable = data;
voodoo_set_init_enable(state->m_voodoo[0], data);
state->m_voodoo[0]->voodoo_set_init_enable(data);
break;
default:
@ -601,8 +601,8 @@ WRITE32_MEMBER( magictg_state::f0_w )
UINT32 dst_addr = m_dma_ch[ch].dst_addr;
//device_t *voodoo = dst_addr > 0xa000000 voodoo0 : voodoo1;
assert(DWORD_ALIGNED(src_addr));
assert(DWORD_ALIGNED(dst_addr));
assert((src_addr & 3) == 0);
assert((dst_addr & 3) == 0);
while (m_dma_ch[ch].count > 3)
{

View File

@ -346,11 +346,11 @@ WRITE_LINE_MEMBER(nwktr_state::voodoo_vblank_0)
UINT32 nwktr_state::screen_update_nwktr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
device_t *voodoo = machine().device("voodoo0");
voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo0");
bitmap.fill(m_palette->pen(0), cliprect);
voodoo_update(voodoo, bitmap, cliprect);
voodoo->voodoo_update(bitmap, cliprect);
const rectangle &visarea = screen.visible_area();
const rectangle tilemap_rect(visarea.min_x, visarea.max_x, visarea.min_y+16, visarea.max_y);

View File

@ -336,7 +336,7 @@ void savquest_state::vid_3dfx_init()
m_pci_3dfx_regs[0x08 / 4] = 2; // revision ID
m_pci_3dfx_regs[0x10 / 4] = 0xff000000;
m_pci_3dfx_regs[0x40 / 4] = 0x4000; //INITEN_SECONDARY_REV_ID
voodoo_set_init_enable(m_voodoo, 0x4000); //INITEN_SECONDARY_REV_ID
m_voodoo->voodoo_set_init_enable(0x4000); //INITEN_SECONDARY_REV_ID
}
static UINT32 pci_3dfx_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
@ -358,7 +358,7 @@ osd_printf_warning("PCI write: %x %x\n", reg, data);
}
else if (reg == 0x40)
{
voodoo_set_init_enable(state->m_voodoo, data);
state->m_voodoo->voodoo_set_init_enable(data);
}
else if (reg == 0x54)
{

View File

@ -540,7 +540,7 @@ public:
UINT32 seattle_state::screen_update_seattle(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return voodoo_update(m_voodoo, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
return m_voodoo->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
}
@ -876,7 +876,7 @@ void seattle_state::pci_3dfx_w(address_space &space, UINT8 reg, UINT8 type, UINT
break;
case 0x10: /* initEnable register */
voodoo_set_init_enable(m_voodoo, data);
m_voodoo->voodoo_set_init_enable(data);
break;
}
if (LOG_PCI)

View File

@ -493,7 +493,7 @@ public:
UINT8 m_sio_led_state;
UINT8 m_pending_analog_read;
UINT8 m_cmos_unlocked;
device_t *m_voodoo;
voodoo_device *m_voodoo;
UINT8 m_dcs_idma_cs;
int m_count;
int m_dynamic_count;
@ -567,7 +567,7 @@ public:
UINT32 vegas_state::screen_update_vegas(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
return voodoo_update(m_voodoo, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
return m_voodoo->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
}
@ -579,7 +579,7 @@ UINT32 vegas_state::screen_update_vegas(screen_device &screen, bitmap_rgb32 &bit
void vegas_state::machine_start()
{
m_voodoo = machine().device("voodoo");
m_voodoo = (voodoo_device*)machine().device("voodoo");
/* allocate timers for the NILE */
m_timer[0] = machine().scheduler().timer_alloc(FUNC_NULL);
@ -797,7 +797,7 @@ WRITE32_MEMBER( vegas_state::pci_ide_w )
READ32_MEMBER( vegas_state::pci_3dfx_r )
{
int voodoo_type = voodoo_get_type(m_voodoo);
int voodoo_type = m_voodoo->voodoo_get_type();
UINT32 result = m_pci_3dfx_regs[offset];
switch (offset)
@ -830,7 +830,7 @@ READ32_MEMBER( vegas_state::pci_3dfx_r )
WRITE32_MEMBER( vegas_state::pci_3dfx_w )
{
int voodoo_type = voodoo_get_type(m_voodoo);
int voodoo_type = m_voodoo->voodoo_get_type();
m_pci_3dfx_regs[offset] = data;
@ -869,7 +869,7 @@ WRITE32_MEMBER( vegas_state::pci_3dfx_w )
break;
case 0x10: /* initEnable register */
voodoo_set_init_enable(m_voodoo, data);
m_voodoo->voodoo_set_init_enable(data);
break;
}
@ -1555,7 +1555,7 @@ inline void vegas_state::_add_dynamic_address(offs_t start, offs_t end, read32_d
void vegas_state::remap_dynamic_addresses()
{
dynamic_address *dynamic = m_dynamic;
int voodoo_type = voodoo_get_type(m_voodoo);
int voodoo_type = m_voodoo->voodoo_get_type();
offs_t base;
int addr;

View File

@ -435,8 +435,8 @@ public:
UINT32 viper_state::screen_update_viper(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
device_t *device = machine().device("voodoo");
return voodoo_update(device, bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo");
return voodoo->voodoo_update(bitmap, cliprect) ? 0 : UPDATE_HAS_NOT_CHANGED;
}
UINT32 m_mpc8240_regs[256/4];