k001005: use device_finder, nw

This commit is contained in:
Ryan Holtz 2018-05-26 17:22:16 +02:00
parent e08ff4118c
commit 451c3f2f48
4 changed files with 24 additions and 29 deletions

View File

@ -1001,8 +1001,7 @@ MACHINE_CONFIG_START(gticlub_state::gticlub)
MCFG_K001604_ROZ_OFFSET(0)
MCFG_K001604_PALETTE("palette")
MCFG_DEVICE_ADD("k001005", K001005, 0)
MCFG_K001005_TEXEL_CHIP("k001006_1")
MCFG_DEVICE_ADD("k001005", K001005, 0, "k001006_1")
MCFG_DEVICE_ADD("k001006_1", K001006, 0)
MCFG_K001006_GFX_REGION("gfx1")

View File

@ -809,8 +809,7 @@ MACHINE_CONFIG_START(zr107_state::zr107)
MCFG_K056832_CONFIG("gfx2", K056832_BPP_8, 1, 0, "none")
MCFG_K056832_PALETTE("palette")
MCFG_DEVICE_ADD("k001005", K001005, 0)
MCFG_K001005_TEXEL_CHIP("k001006_1")
MCFG_DEVICE_ADD("k001005", K001005, 0, "k001006_1")
MCFG_DEVICE_ADD("k001006_1", K001006, 0)
MCFG_K001006_GFX_REGION("gfx1")
@ -883,8 +882,7 @@ MACHINE_CONFIG_START(zr107_state::jetwave)
MCFG_K001604_ROZ_OFFSET(16384)
MCFG_K001604_PALETTE("palette")
MCFG_DEVICE_ADD("k001005", K001005, 0)
MCFG_K001005_TEXEL_CHIP("k001006_1")
MCFG_DEVICE_ADD("k001005", K001005, 0, "k001006_1")
MCFG_DEVICE_ADD("k001006_1", K001006, 0)
MCFG_K001006_GFX_REGION("gfx1")

View File

@ -3,9 +3,6 @@
#include "emu.h"
#include "k001005.h"
#include "video/k001006.h"
/*****************************************************************************/
/* Konami K001005 Polygon Renderer (KS10071) */
@ -1186,18 +1183,18 @@ void k001005_renderer::draw(bitmap_rgb32 &bitmap, const rectangle &cliprect)
DEFINE_DEVICE_TYPE(K001005, k001005_device, "k001005", "K001005 Polygon Renderer")
k001005_device::k001005_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, K001005, tag, owner, clock),
device_video_interface(mconfig, *this),
m_k001006(nullptr),
m_fifo(nullptr),
m_status(0),
m_ram_ptr(0),
m_fifo_read_ptr(0),
m_fifo_write_ptr(0),
m_reg_far_z(0)
: device_t(mconfig, K001005, tag, owner, clock)
, device_video_interface(mconfig, *this)
, m_k001006(*this, finder_base::DUMMY_TAG)
, m_fifo(nullptr)
, m_status(0)
, m_ram_ptr(0)
, m_fifo_read_ptr(0)
, m_fifo_write_ptr(0)
, m_reg_far_z(0)
{
m_ram[0] = nullptr;
m_ram[1] = nullptr;
m_ram[0] = nullptr;
m_ram[1] = nullptr;
}
//-------------------------------------------------
@ -1206,8 +1203,6 @@ k001005_device::k001005_device(const machine_config &mconfig, const char *tag, d
void k001005_device::device_start()
{
m_k001006 = machine().device(m_k001006_tag);
m_ram[0] = std::make_unique<uint16_t[]>(0x140000);
m_ram[1] = std::make_unique<uint16_t[]>(0x140000);

View File

@ -7,6 +7,7 @@
#include "video/poly.h"
#include "cpu/sharc/sharc.h"
#include "video/k001006.h"
#include <float.h>
@ -104,7 +105,14 @@ class k001005_device : public device_t, public device_video_interface
public:
k001005_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_texel_chip(const char *tag) { m_k001006_tag = tag; }
template <typename T> k001005_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&texel_tag)
: k001005_device(mconfig, tag, owner, clock)
{
set_texel_tag(std::forward<T>(texel_tag));
}
template <typename T> void set_texel_tag(T &&tag) { m_k001006.set_tag(std::forward<T>(tag)); }
void draw(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void swap_buffers();
@ -120,8 +128,7 @@ protected:
private:
// internal state
device_t *m_k001006;
const char *m_k001006_tag;
optional_device<k001006_device> m_k001006;
std::unique_ptr<uint16_t[]> m_ram[2];
std::unique_ptr<uint32_t[]> m_fifo;
@ -138,8 +145,4 @@ private:
DECLARE_DEVICE_TYPE(K001005, k001005_device)
#define MCFG_K001005_TEXEL_CHIP(_tag) \
downcast<k001005_device &>(*device).set_texel_chip(_tag);
#endif // MAME_VIDEO_K001005_H