mirror of
https://github.com/holub/mame
synced 2025-05-25 15:25:33 +03:00
just test code (nw)
This commit is contained in:
parent
4961e56d93
commit
09fa96295c
@ -1023,7 +1023,7 @@ static MACHINE_CONFIG_START( stv, stv_state )
|
|||||||
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
||||||
|
|
||||||
MCFG_DEVICE_ADD("315_5881", SEGA315_5881_CRYPT, 0)
|
MCFG_DEVICE_ADD("315_5881", SEGA315_5881_CRYPT, 0)
|
||||||
//MCFG_SET_READ_CALLBACK(stv_state, read_callback)
|
MCFG_SET_READ_CALLBACK(stv_state, crypt_read_callback)
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -35,8 +35,7 @@ public:
|
|||||||
m_cart3(*this, "stv_slot3"),
|
m_cart3(*this, "stv_slot3"),
|
||||||
m_cart4(*this, "stv_slot4"),
|
m_cart4(*this, "stv_slot4"),
|
||||||
m_gfxdecode(*this, "gfxdecode"),
|
m_gfxdecode(*this, "gfxdecode"),
|
||||||
m_palette(*this, "palette"),
|
m_palette(*this, "palette")
|
||||||
m_cryptdevice(*this, "315_5881")
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +169,6 @@ public:
|
|||||||
required_device<gfxdecode_device> m_gfxdecode;
|
required_device<gfxdecode_device> m_gfxdecode;
|
||||||
required_device<palette_device> m_palette;
|
required_device<palette_device> m_palette;
|
||||||
|
|
||||||
optional_device<sega_315_5881_crypt_device> m_cryptdevice;
|
|
||||||
|
|
||||||
|
|
||||||
bitmap_rgb32 m_tmpbitmap;
|
bitmap_rgb32 m_tmpbitmap;
|
||||||
@ -700,7 +698,8 @@ public:
|
|||||||
stv_state(const machine_config &mconfig, device_type type, const char *tag)
|
stv_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||||
: saturn_state(mconfig, type, tag),
|
: saturn_state(mconfig, type, tag),
|
||||||
m_adsp(*this, "adsp"),
|
m_adsp(*this, "adsp"),
|
||||||
m_adsp_pram(*this, "adsp_pram")
|
m_adsp_pram(*this, "adsp_pram"),
|
||||||
|
m_cryptdevice(*this, "315_5881")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -835,6 +834,9 @@ public:
|
|||||||
DECLARE_WRITE32_MEMBER( decathlt_prot2_w );
|
DECLARE_WRITE32_MEMBER( decathlt_prot2_w );
|
||||||
void write_prot_data(UINT32 data, UINT32 mem_mask, int offset, int which);
|
void write_prot_data(UINT32 data, UINT32 mem_mask, int offset, int which);
|
||||||
void install_decathlt_protection();
|
void install_decathlt_protection();
|
||||||
|
|
||||||
|
optional_device<sega_315_5881_crypt_device> m_cryptdevice;
|
||||||
|
UINT16 crypt_read_callback(UINT32 addr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ void sega_315_5881_crypt_device::device_reset()
|
|||||||
buffer_bit = 0;
|
buffer_bit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sega_315_5881_crypt_device::do_decrypt(UINT8 *&base)
|
UINT16 sega_315_5881_crypt_device::do_decrypt(UINT8 *&base)
|
||||||
{
|
{
|
||||||
if(!enc_ready)
|
if(!enc_ready)
|
||||||
enc_start();
|
enc_start();
|
||||||
@ -80,6 +80,8 @@ void sega_315_5881_crypt_device::do_decrypt(UINT8 *&base)
|
|||||||
base = buffer + buffer_pos;
|
base = buffer + buffer_pos;
|
||||||
buffer_pos += 2;
|
buffer_pos += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (base[0] << 8) | base[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void sega_315_5881_crypt_device::set_addr_low(UINT16 data)
|
void sega_315_5881_crypt_device::set_addr_low(UINT16 data)
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
sega_315_5881_crypt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
sega_315_5881_crypt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||||
|
|
||||||
|
|
||||||
void do_decrypt(UINT8 *&base);
|
UINT16 do_decrypt(UINT8 *&base);
|
||||||
void set_addr_low(UINT16 data);
|
void set_addr_low(UINT16 data);
|
||||||
void set_addr_high(UINT16 data);
|
void set_addr_high(UINT16 data);
|
||||||
void set_subkey(UINT16 data);
|
void set_subkey(UINT16 data);
|
||||||
|
@ -590,6 +590,8 @@ READ32_MEMBER( stv_state::common_prot_r )
|
|||||||
|
|
||||||
logerror("A-Bus control protection read at %06x with data = %08x Returning = %08x Would otherwise return = %08x\n",space.device().safe_pc(),m_abus_protkey, retdata, realret);
|
logerror("A-Bus control protection read at %06x with data = %08x Returning = %08x Would otherwise return = %08x\n",space.device().safe_pc(),m_abus_protkey, retdata, realret);
|
||||||
|
|
||||||
|
//UINT16 res = m_cryptdevice->do_decrypt(base);
|
||||||
|
|
||||||
m_ctrl_index += 4;
|
m_ctrl_index += 4;
|
||||||
return retdata;
|
return retdata;
|
||||||
|
|
||||||
@ -604,7 +606,11 @@ READ32_MEMBER( stv_state::common_prot_r )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UINT16 stv_state::crypt_read_callback(UINT32 addr)
|
||||||
|
{
|
||||||
|
const UINT8 *base = m_cart_reg[0]->base() + 2*addr;
|
||||||
|
return base[1] | (base[0] << 8);
|
||||||
|
}
|
||||||
|
|
||||||
WRITE32_MEMBER ( stv_state::common_prot_w )
|
WRITE32_MEMBER ( stv_state::common_prot_w )
|
||||||
{
|
{
|
||||||
@ -627,7 +633,7 @@ WRITE32_MEMBER ( stv_state::common_prot_w )
|
|||||||
{
|
{
|
||||||
COMBINE_DATA(&m_abus_protkey);
|
COMBINE_DATA(&m_abus_protkey);
|
||||||
|
|
||||||
m_cryptdevice->set_subkey(m_abus_protkey);
|
m_cryptdevice->set_subkey(m_abus_protkey>>16);
|
||||||
|
|
||||||
|
|
||||||
int a_bus_vector;
|
int a_bus_vector;
|
||||||
@ -665,6 +671,7 @@ void stv_state::install_astrass_protection()
|
|||||||
{
|
{
|
||||||
install_common_protection();
|
install_common_protection();
|
||||||
m_prot_readback = astrass_prot_read_callback;
|
m_prot_readback = astrass_prot_read_callback;
|
||||||
|
// m_cryptdevice->set_key(0x00000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stv_state::install_ffreveng_protection()
|
void stv_state::install_ffreveng_protection()
|
||||||
|
Loading…
Reference in New Issue
Block a user