diff options
Diffstat (limited to 'src/mame/drivers/stv.cpp')
-rw-r--r-- | src/mame/drivers/stv.cpp | 85 |
1 files changed, 68 insertions, 17 deletions
diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp index 5821fbfddff..92f90dcfbd2 100644 --- a/src/mame/drivers/stv.cpp +++ b/src/mame/drivers/stv.cpp @@ -951,12 +951,67 @@ void stv_state::init_ffreveng() init_stv(); } +READ32_MEMBER(stv_state::decathlt_prot_higher_r) +{ + if (m_newprotection_element) + { + m_newprotection_element = false; + m_5838crypt->debug_helper(1); + } + + m_protbank->set_entry(1); // if the protection device is accessed at this address data is fetched from 0x03000000 + uint32 ret = 0; + if (mem_mask & 0xffff0000) ret |= (m_5838crypt->data_r(space, offset, mem_mask)<<16); + if (mem_mask & 0x0000ffff) ret |= m_5838crypt->data_r(space, offset, mem_mask); + return ret; +} + +READ32_MEMBER(stv_state::decathlt_prot_lower_r) +{ + if (m_newprotection_element) + { + m_newprotection_element = false; + m_5838crypt->debug_helper(0); + } + + m_protbank->set_entry(0); // if the protection device is accessed at this address data is fetched from 0x02000000 + uint32 ret = 0; + if (mem_mask & 0xffff0000) ret |= (m_5838crypt->data_r(space, offset, mem_mask)<<16); + if (mem_mask & 0x0000ffff) ret |= m_5838crypt->data_r(space, offset, mem_mask); + return ret; +} + +WRITE32_MEMBER(stv_state::decathlt_prot_srcaddr_w) +{ + m_newprotection_element = true; + m_5838crypt->srcaddr_w(space,offset,data,mem_mask); +} + void stv_state::init_decathlt() { - m_5838crypt->install_decathlt_protection(); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x37FFFF0, 0x37FFFF3, write32_delegate(FUNC(stv_state::decathlt_prot_srcaddr_w), this)); // set compressed data source address + m_maincpu->space(AS_PROGRAM).install_write_handler(0x37FFFF4, 0x37FFFF7, write32_delegate(FUNC(sega_315_5838_comp_device::data_w), (sega_315_5838_comp_device*)m_5838crypt)); // upload tables + m_maincpu->space(AS_PROGRAM).install_read_handler(0x37FFFF8, 0x37FFFFb, read32_delegate(FUNC(stv_state::decathlt_prot_higher_r), this)); // read decompressed data + + m_maincpu->space(AS_PROGRAM).install_write_handler(0x27FFFF0, 0x27FFFF3, write32_delegate(FUNC(stv_state::decathlt_prot_srcaddr_w), this)); // set compressed data source address + m_maincpu->space(AS_PROGRAM).install_write_handler(0x27FFFF4, 0x27FFFF7, write32_delegate(FUNC(sega_315_5838_comp_device::data_w), (sega_315_5838_comp_device*)m_5838crypt)); // upload tables + m_maincpu->space(AS_PROGRAM).install_read_handler(0x27FFFF8, 0x27FFFFb, read32_delegate(FUNC(stv_state::decathlt_prot_lower_r), this)); // read decompressed data + + m_protbank->configure_entry(0, memregion("cart")->base()); + m_protbank->configure_entry(1, memregion("cart")->base() + 0x1000000); + m_protbank->set_entry(0); + + m_newprotection_element = false; + init_stv(); } +void stv_state::init_decathlt_nokey() +{ + init_decathlt(); + m_5838crypt->set_hack_mode(sega_315_5838_comp_device::HACK_MODE_NO_KEY); +} + void stv_state::init_nameclv3() { m_maincpu->sh2drc_add_pcflush(0x601eb4c); @@ -1146,21 +1201,17 @@ MACHINE_CONFIG_START(stv_state::stvcd) MACHINE_CONFIG_END -uint16_t stv_state::crypt_read_callback_ch1(uint32_t addr) -{ - return m_maincpu->space().read_word(0x02000000 + 0x1000000 + (addr * 2)); -} - -uint16_t stv_state::crypt_read_callback_ch2(uint32_t addr) +void stv_state::sega5838_map(address_map &map) { - return m_maincpu->space().read_word(0x02000000 + 0x0000000 + (addr * 2)); + map(0x000000, 0xffffff).bankr("protbank"); } MACHINE_CONFIG_START(stv_state::stv_5838) stv(config); + MCFG_DEVICE_ADD("315_5838", SEGA315_5838_COMP, 0) - MCFG_SET_5838_READ_CALLBACK_CH1(stv_state, crypt_read_callback_ch1) - MCFG_SET_5838_READ_CALLBACK_CH2(stv_state, crypt_read_callback_ch2) + MCFG_DEVICE_ADDRESS_MAP(0, sega5838_map) + MACHINE_CONFIG_END @@ -3697,16 +3748,16 @@ GAME( 1997, pclub2kc, stvbios, stv, stv, stvpc_state, init_stv, GAME( 1997, pclubyo2, stvbios, stv, stv, stvpc_state, init_stv, ROT0, "Atlus", "Print Club Yoshimoto V2 (J 970422 V1.100)", MACHINE_NOT_WORKING ) -GAME( 1997, pclove, stvbios, stv_5838, stv, stvpc_state, init_decathlt, ROT0, "Atlus", "Print Club LoveLove (J 970421 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! -GAME( 1997, pclove2, stvbios, stv_5838, stv, stvpc_state, init_decathlt, ROT0, "Atlus", "Print Club LoveLove Ver 2 (J 970825 V1.000)", MACHINE_NOT_WORKING ) // ^ -GAME( 1997, pcpooh2, stvbios, stv_5838, stv, stvpc_state, init_decathlt, ROT0, "Atlus", "Print Club Winnie-the-Pooh Vol. 2 (J 971218 V1.000)", MACHINE_NOT_WORKING ) // ^ -GAME( 1998, pcpooh3, stvbios, stv_5838, stv, stvpc_state, init_decathlt, ROT0, "Atlus", "Print Club Winnie-the-Pooh Vol. 3 (J 980406 V1.000)", MACHINE_NOT_WORKING ) // ^ +GAME( 1997, pclove, stvbios, stv_5838, stv, stvpc_state, init_decathlt_nokey, ROT0, "Atlus", "Print Club LoveLove (J 970421 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! +GAME( 1997, pclove2, stvbios, stv_5838, stv, stvpc_state, init_decathlt_nokey, ROT0, "Atlus", "Print Club LoveLove Ver 2 (J 970825 V1.000)", MACHINE_NOT_WORKING ) // ^ +GAME( 1997, pcpooh2, stvbios, stv_5838, stv, stvpc_state, init_decathlt_nokey, ROT0, "Atlus", "Print Club Winnie-the-Pooh Vol. 2 (J 971218 V1.000)", MACHINE_NOT_WORKING ) // ^ +GAME( 1998, pcpooh3, stvbios, stv_5838, stv, stvpc_state, init_decathlt_nokey, ROT0, "Atlus", "Print Club Winnie-the-Pooh Vol. 3 (J 980406 V1.000)", MACHINE_NOT_WORKING ) // ^ GAME( 1998, stress, stvbios, stv, stv, stvpc_state, init_stv, ROT0, "Sega", "Stress Busters (J 981020 V1.000)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1996, nameclub, stvbios, stv_5838, stv, stvpc_state, init_decathlt, ROT0, "Sega", "Name Club (J 960315 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! -GAME( 1996, nclubv2, stvbios, stv_5838, stv, stvpc_state, init_decathlt, ROT0, "Sega", "Name Club Ver.2 (J 960315 V1.000)", MACHINE_NOT_WORKING ) // ^ (has the same datecode as nameclub, probably incorrect unless both were released today) -GAME( 1997, nclubv3, stvbios, stv, stv, stvpc_state, init_nameclv3, ROT0, "Sega", "Name Club Ver.3 (J 970723 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // no protection +GAME( 1996, nameclub, stvbios, stv_5838, stv, stvpc_state, init_decathlt_nokey, ROT0, "Sega", "Name Club (J 960315 V1.000)", MACHINE_NOT_WORKING ) // uses the same type of protection as decathlete!! +GAME( 1996, nclubv2, stvbios, stv_5838, stv, stvpc_state, init_decathlt_nokey, ROT0, "Sega", "Name Club Ver.2 (J 960315 V1.000)", MACHINE_NOT_WORKING ) // ^ (has the same datecode as nameclub, probably incorrect unless both were released today) +GAME( 1997, nclubv3, stvbios, stv, stv, stvpc_state, init_nameclv3, ROT0, "Sega", "Name Club Ver.3 (J 970723 V1.000)", MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // no protection |