mirror of
https://github.com/holub/mame
synced 2025-04-22 00:11:58 +03:00
removed psx_machine structure
This commit is contained in:
parent
f8fbbefc96
commit
7afd54e86a
@ -127,8 +127,8 @@ void psxdma_device::dma_interrupt_update()
|
||||
|
||||
void psxdma_device::dma_finished( int index )
|
||||
{
|
||||
psx_machine *p_psx = machine().driver_data<psx_state>()->m_p_psx;
|
||||
UINT32 *p_n_psxram = p_psx->p_n_psxram;
|
||||
psx_state *p_psx = machine().driver_data<psx_state>();
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
|
||||
psx_dma_channel *dma = &channel[ index ];
|
||||
|
||||
@ -137,7 +137,7 @@ void psxdma_device::dma_finished( int index )
|
||||
UINT32 n_size;
|
||||
UINT32 n_total;
|
||||
UINT32 n_address = ( dma->n_base & 0xffffff );
|
||||
UINT32 n_adrmask = p_psx->n_psxramsize - 1;
|
||||
UINT32 n_adrmask = p_psx->m_n_psxramsize - 1;
|
||||
UINT32 n_nextaddress;
|
||||
|
||||
if( n_address != 0xffffff )
|
||||
@ -207,9 +207,9 @@ void psxdma_device::install_write_handler( int index, psx_dma_read_delegate p_fn
|
||||
|
||||
WRITE32_MEMBER( psxdma_device::write )
|
||||
{
|
||||
psx_machine *p_psx = machine().driver_data<psx_state>()->m_p_psx;
|
||||
psx_state *p_psx = machine().driver_data<psx_state>();
|
||||
|
||||
UINT32 *p_n_psxram = p_psx->p_n_psxram;
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
int index = offset / 4;
|
||||
psx_dma_channel *dma = &channel[ index ];
|
||||
|
||||
@ -235,7 +235,7 @@ WRITE32_MEMBER( psxdma_device::write )
|
||||
UINT32 n_nextaddress;
|
||||
UINT32 n_adrmask;
|
||||
|
||||
n_adrmask = p_psx->n_psxramsize - 1;
|
||||
n_adrmask = p_psx->m_n_psxramsize - 1;
|
||||
|
||||
n_address = ( dma->n_base & n_adrmask );
|
||||
n_size = dma->n_blockcontrol;
|
||||
|
@ -172,8 +172,8 @@ INLINE INT32 mdec_unpack_val( UINT16 n_packed )
|
||||
|
||||
UINT32 psxmdec_device::mdec_unpack( UINT32 n_address )
|
||||
{
|
||||
psx_machine *p_psx = machine().driver_data<psx_state>()->m_p_psx;
|
||||
UINT32 *p_n_psxram = p_psx->p_n_psxram;
|
||||
psx_state *p_psx = machine().driver_data<psx_state>();
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
|
||||
UINT8 n_z;
|
||||
INT32 n_qscale;
|
||||
@ -424,8 +424,8 @@ void psxmdec_device::mdec_yuv2_to_rgb24( void )
|
||||
|
||||
void psxmdec_device::dma_write( UINT32 n_address, INT32 n_size )
|
||||
{
|
||||
psx_machine *p_psx = machine().driver_data<psx_state>()->m_p_psx;
|
||||
UINT32 *p_n_psxram = p_psx->p_n_psxram;
|
||||
psx_state *p_psx = machine().driver_data<psx_state>();
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
int n_index;
|
||||
|
||||
verboselog( machine(), 2, "mdec0_write( %08x, %08x )\n", n_address, n_size );
|
||||
@ -483,8 +483,8 @@ void psxmdec_device::dma_write( UINT32 n_address, INT32 n_size )
|
||||
|
||||
void psxmdec_device::dma_read( UINT32 n_address, INT32 n_size )
|
||||
{
|
||||
psx_machine *p_psx = machine().driver_data<psx_state>()->m_p_psx;
|
||||
UINT32 *p_n_psxram = p_psx->p_n_psxram;
|
||||
psx_state *p_psx = machine().driver_data<psx_state>();
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
UINT32 n_this;
|
||||
UINT32 n_nextaddress;
|
||||
|
||||
|
@ -10,29 +10,17 @@
|
||||
#include "cpu/psx/irq.h"
|
||||
#include "cpu/psx/sio.h"
|
||||
|
||||
typedef struct _psx_machine psx_machine;
|
||||
struct _psx_machine
|
||||
{
|
||||
running_machine &machine() const { assert(m_machine != NULL); return *m_machine; }
|
||||
|
||||
running_machine *m_machine;
|
||||
UINT32 *p_n_psxram;
|
||||
size_t n_psxramsize;
|
||||
|
||||
UINT32 n_com_delay;
|
||||
int b_need_sianniv_vblank_hack;
|
||||
};
|
||||
|
||||
class psx_state : public driver_device
|
||||
{
|
||||
public:
|
||||
psx_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag) { }
|
||||
|
||||
psx_machine *m_p_psx;
|
||||
|
||||
UINT32 *m_p_n_psxram;
|
||||
size_t m_n_psxramsize;
|
||||
|
||||
UINT32 n_com_delay;
|
||||
int b_need_sianniv_vblank_hack;
|
||||
};
|
||||
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#define VERBOSE_LEVEL ( 0 )
|
||||
|
||||
INLINE void ATTR_PRINTF(3,4) verboselog( psx_machine *p_psx, int n_level, const char *s_fmt, ... )
|
||||
INLINE void ATTR_PRINTF(3,4) verboselog( psx_state *p_psx, int n_level, const char *s_fmt, ... )
|
||||
{
|
||||
if( VERBOSE_LEVEL >= n_level )
|
||||
{
|
||||
@ -26,7 +26,7 @@ INLINE void ATTR_PRINTF(3,4) verboselog( psx_machine *p_psx, int n_level, const
|
||||
|
||||
WRITE32_HANDLER( psx_com_delay_w )
|
||||
{
|
||||
psx_machine *p_psx = space->machine().driver_data<psx_state>()->m_p_psx;
|
||||
psx_state *p_psx = space->machine().driver_data<psx_state>();
|
||||
|
||||
COMBINE_DATA( &p_psx->n_com_delay );
|
||||
verboselog( p_psx, 1, "psx_com_delay_w( %08x %08x )\n", data, mem_mask );
|
||||
@ -34,7 +34,7 @@ WRITE32_HANDLER( psx_com_delay_w )
|
||||
|
||||
READ32_HANDLER( psx_com_delay_r )
|
||||
{
|
||||
psx_machine *p_psx = space->machine().driver_data<psx_state>()->m_p_psx;
|
||||
psx_state *p_psx = space->machine().driver_data<psx_state>();
|
||||
|
||||
verboselog( p_psx, 1, "psx_com_delay_r( %08x )\n", mem_mask );
|
||||
return p_psx->n_com_delay;
|
||||
@ -43,7 +43,7 @@ READ32_HANDLER( psx_com_delay_r )
|
||||
INTERRUPT_GEN( psx_vblank )
|
||||
{
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( device->machine().device("gpu") );
|
||||
psx_machine *p_psx = device->machine().driver_data<psx_state>()->m_p_psx;
|
||||
psx_state *p_psx = device->machine().driver_data<psx_state>();
|
||||
|
||||
if(p_psx->b_need_sianniv_vblank_hack)
|
||||
{
|
||||
@ -84,40 +84,32 @@ void psx_sio_input( running_machine &machine, int n_port, int n_mask, int n_data
|
||||
psxcpu_device::sio_input( *machine.device("maincpu"), "maincpu", n_port, n_mask, n_data );
|
||||
}
|
||||
|
||||
static void gpu_read( psx_state *state, UINT32 n_address, INT32 n_size )
|
||||
static void gpu_read( psx_state *p_psx, UINT32 n_address, INT32 n_size )
|
||||
{
|
||||
psx_machine *p_psx = state->m_p_psx;
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( p_psx->machine().device("gpu") );
|
||||
UINT32 *p_n_psxram = p_psx->p_n_psxram;
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
|
||||
gpu->dma_read( &p_n_psxram[ n_address / 4 ], n_size );
|
||||
}
|
||||
|
||||
static void gpu_write( psx_state *state, UINT32 n_address, INT32 n_size )
|
||||
static void gpu_write( psx_state *p_psx, UINT32 n_address, INT32 n_size )
|
||||
{
|
||||
psx_machine *p_psx = state->m_p_psx;
|
||||
psxgpu_device *gpu = downcast<psxgpu_device *>( p_psx->machine().device("gpu") );
|
||||
UINT32 *p_n_psxram = p_psx->p_n_psxram;
|
||||
UINT32 *p_n_psxram = p_psx->m_p_n_psxram;
|
||||
|
||||
gpu->dma_write( &p_n_psxram[ n_address / 4 ], n_size );
|
||||
}
|
||||
|
||||
void psx_driver_init( running_machine &machine )
|
||||
{
|
||||
psx_state *state = machine.driver_data<psx_state>();
|
||||
psx_machine *p_psx = auto_alloc_clear(machine, psx_machine);
|
||||
psx_state *p_psx = machine.driver_data<psx_state>();
|
||||
|
||||
p_psx->b_need_sianniv_vblank_hack = !strcmp(machine.system().name, "sianniv");
|
||||
|
||||
state->m_p_psx = p_psx;
|
||||
state->m_p_n_psxram = (UINT32 *)memory_get_shared(machine, "share1", state->m_n_psxramsize);
|
||||
p_psx->m_p_n_psxram = (UINT32 *)memory_get_shared(machine, "share1", p_psx->m_n_psxramsize);
|
||||
|
||||
p_psx->m_machine = &machine;
|
||||
p_psx->p_n_psxram = state->m_p_n_psxram;
|
||||
p_psx->n_psxramsize = state->m_n_psxramsize;
|
||||
|
||||
psx_dma_install_read_handler( machine, 2, psx_dma_read_delegate( FUNC( gpu_read ), state ) );
|
||||
psx_dma_install_write_handler( machine, 2, psx_dma_write_delegate( FUNC( gpu_write ), state ) );
|
||||
psx_dma_install_read_handler( machine, 2, psx_dma_read_delegate( FUNC( gpu_read ), p_psx ) );
|
||||
psx_dma_install_write_handler( machine, 2, psx_dma_write_delegate( FUNC( gpu_write ), p_psx ) );
|
||||
}
|
||||
|
||||
SCREEN_UPDATE( psx )
|
||||
|
Loading…
Reference in New Issue
Block a user