video/psx.cpp: Add device_video_interface and eliminate first_screen (nw)

This commit is contained in:
AJR 2018-03-03 15:38:46 -05:00
parent 121e61ff94
commit 3fd745c2a7
2 changed files with 11 additions and 14 deletions

View File

@ -27,10 +27,8 @@ DEFINE_DEVICE_TYPE(CXD8654Q, cxd8654q_device, "cxd8654q", "CXD8654Q GPU")
psxgpu_device::psxgpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) psxgpu_device::psxgpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock) : device_t(mconfig, type, tag, owner, clock)
, device_video_interface(mconfig, *this)
, m_vblank_handler(*this) , m_vblank_handler(*this)
#if PSXGPU_DEBUG_VIEWER
, m_screen(*this, "screen")
#endif
{ {
} }
@ -38,7 +36,7 @@ void psxgpu_device::device_start()
{ {
m_vblank_handler.resolve_safe(); m_vblank_handler.resolve_safe();
if( m_type == CXD8538Q ) if (type() == CXD8538Q)
{ {
psx_gpu_init( 1 ); psx_gpu_init( 1 );
} }
@ -120,8 +118,8 @@ static inline void ATTR_PRINTF(3,4) verboselog( device_t& device, int n_level, c
void psxgpu_device::DebugMeshInit() void psxgpu_device::DebugMeshInit()
{ {
int width = m_screen->width(); int width = screen().width();
int height = m_screen->height(); int height = screen().height();
m_debug.b_mesh = 0; m_debug.b_mesh = 0;
m_debug.b_texture = 0; m_debug.b_texture = 0;
@ -136,8 +134,8 @@ void psxgpu_device::DebugMesh( int n_coordx, int n_coordy )
{ {
int n_coord; int n_coord;
int n_colour; int n_colour;
int width = m_screen->width(); int width = screen().width();
int height = m_screen->height(); int height = screen().height();
n_coordx += m_n_displaystartx; n_coordx += m_n_displaystartx;
n_coordy += n_displaystarty; n_coordy += n_displaystarty;
@ -334,8 +332,8 @@ int psxgpu_device::DebugTextureDisplay( bitmap_ind16 &bitmap )
if( m_debug.b_texture ) if( m_debug.b_texture )
{ {
int width = m_screen->width(); int width = screen().width();
int height = m_screen->height(); int height = screen().height();
for( n_y = 0; n_y < height; n_y++ ) for( n_y = 0; n_y < height; n_y++ )
{ {
@ -363,7 +361,7 @@ int psxgpu_device::DebugTextureDisplay( bitmap_ind16 &bitmap )
} }
p_n_interleave[ n_x ] = p_p_vram[ n_yi ][ n_xi ]; p_n_interleave[ n_x ] = p_p_vram[ n_yi ][ n_xi ];
} }
draw_scanline16( bitmap, 0, n_y, width, p_n_interleave, m_screen->palette().pens() ); draw_scanline16( bitmap, 0, n_y, width, p_n_interleave, screen().palette().pens() );
} }
} }
return m_debug.b_texture; return m_debug.b_texture;
@ -445,7 +443,7 @@ void psxgpu_device::updatevisiblearea()
#endif #endif
visarea.set(0, n_screenwidth - 1, 0, n_screenheight - 1); visarea.set(0, n_screenwidth - 1, 0, n_screenheight - 1);
machine().first_screen()->configure(n_screenwidth, n_screenheight, visarea, HZ_TO_ATTOSECONDS(refresh)); screen().configure(n_screenwidth, n_screenheight, visarea, HZ_TO_ATTOSECONDS(refresh));
} }
void psxgpu_device::psx_gpu_init( int n_gputype ) void psxgpu_device::psx_gpu_init( int n_gputype )

View File

@ -48,7 +48,7 @@ DECLARE_DEVICE_TYPE(CXD8561BQ, cxd8561bq_device)
DECLARE_DEVICE_TYPE(CXD8561CQ, cxd8561cq_device) DECLARE_DEVICE_TYPE(CXD8561CQ, cxd8561cq_device)
DECLARE_DEVICE_TYPE(CXD8654Q, cxd8654q_device) DECLARE_DEVICE_TYPE(CXD8654Q, cxd8654q_device)
class psxgpu_device : public device_t class psxgpu_device : public device_t, public device_video_interface
{ {
public: public:
// configuration helpers // configuration helpers
@ -306,7 +306,6 @@ private:
uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
#if defined(PSXGPU_DEBUG_VIEWER) && PSXGPU_DEBUG_VIEWER #if defined(PSXGPU_DEBUG_VIEWER) && PSXGPU_DEBUG_VIEWER
required_device<screen_device> m_screen;
void DebugMeshInit(); void DebugMeshInit();
void DebugMesh( int n_coordx, int n_coordy ); void DebugMesh( int n_coordx, int n_coordy );
void DebugMeshEnd(); void DebugMeshEnd();