neogeo.cpp: huge clean up of the cartslot code in order to better

exploit slot devices: [Fabio Priuli]
- moved cart-specific components to the carts itself removing
  the fake protection devices from the main system, since they
  never belonged there
- removed hacky rom region destruction/construction when a
  new cart is inserted, replacing it with proper bank pointers to
  the carts (except for ymsnd and ymsnd.deltat region which
  will require modernization of the ym devices)
- started re-organization of bootleg boards emulation, so to
  reduce the need of collapsing everything into a single cart
  type with multiple protection devices, more work is needed

neopcb.cpp: moved to a separate source file the emulation for
JAMMA PCB versions of a few neogeo games, since they don't
have a cartslot. [Fabio Priuli]

neogeo.xml: added information about Japanese titles and
release dates to the software list and aligned the list to the
driver. [Fabio Priuli]
This commit is contained in:
etabeta78 2016-04-28 07:16:35 +02:00
parent d1f9f7d0dd
commit 508c19abf1
96 changed files with 12715 additions and 13984 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1886,65 +1886,71 @@ end
---------------------------------------------------
--
--@src/devices/bus/neogeo/neogeo_slot.h,BUSES["NEOGEO"] = true
--@src/devices/bus/neogeo/slot.h,BUSES["NEOGEO"] = true
---------------------------------------------------
if (BUSES["NEOGEO"]~=null) then
files {
MAME_DIR .. "src/devices/bus/neogeo/neogeo_slot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/neogeo_slot.h",
MAME_DIR .. "src/devices/bus/neogeo/neogeo_intf.cpp",
MAME_DIR .. "src/devices/bus/neogeo/neogeo_intf.h",
MAME_DIR .. "src/devices/bus/neogeo/neogeo_carts.cpp",
MAME_DIR .. "src/devices/bus/neogeo/neogeo_carts.h",
MAME_DIR .. "src/devices/bus/neogeo/slot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/slot.h",
MAME_DIR .. "src/devices/bus/neogeo/carts.cpp",
MAME_DIR .. "src/devices/bus/neogeo/carts.h",
MAME_DIR .. "src/devices/bus/neogeo/neogeo_helper.cpp",
MAME_DIR .. "src/devices/bus/neogeo/neogeo_helper.h",
MAME_DIR .. "src/devices/bus/neogeo/banked_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/banked_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/mslugx_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/mslugx_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/mslugx_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/mslugx_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/sma_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/sma_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/sma_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/sma_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/cmc_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/cmc_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/cmc_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/cmc_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/pcm2_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/pcm2_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/pcm2_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/pcm2_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/kof2002_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/kof2002_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/kof2002_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/kof2002_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/pvc_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/pvc_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/pvc_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/pvc_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/fatfury2_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/fatfury2_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/fatfury2_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/fatfury2_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/kof98_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/kof98_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/kof98_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/kof98_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/bootleg_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/bootleg_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/bootleg_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/bootleg_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/bootleg_hybrid_cart.cpp",
MAME_DIR .. "src/devices/bus/neogeo/bootleg_hybrid_cart.h",
MAME_DIR .. "src/devices/bus/neogeo/sbp_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/sbp_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/kog_prot.cpp",
MAME_DIR .. "src/devices/bus/neogeo/kog_prot.h",
MAME_DIR .. "src/devices/bus/neogeo/rom.cpp",
MAME_DIR .. "src/devices/bus/neogeo/rom.h",
MAME_DIR .. "src/devices/bus/neogeo/fatfury2.cpp",
MAME_DIR .. "src/devices/bus/neogeo/fatfury2.h",
MAME_DIR .. "src/devices/bus/neogeo/kof98.cpp",
MAME_DIR .. "src/devices/bus/neogeo/kof98.h",
MAME_DIR .. "src/devices/bus/neogeo/mslugx.cpp",
MAME_DIR .. "src/devices/bus/neogeo/mslugx.h",
MAME_DIR .. "src/devices/bus/neogeo/cmc.cpp",
MAME_DIR .. "src/devices/bus/neogeo/cmc.h",
MAME_DIR .. "src/devices/bus/neogeo/sma.cpp",
MAME_DIR .. "src/devices/bus/neogeo/sma.h",
MAME_DIR .. "src/devices/bus/neogeo/pcm2.cpp",
MAME_DIR .. "src/devices/bus/neogeo/pcm2.h",
MAME_DIR .. "src/devices/bus/neogeo/kof2k2.cpp",
MAME_DIR .. "src/devices/bus/neogeo/kof2k2.h",
MAME_DIR .. "src/devices/bus/neogeo/pvc.cpp",
MAME_DIR .. "src/devices/bus/neogeo/pvc.h",
MAME_DIR .. "src/devices/bus/neogeo/boot_cthd.cpp",
MAME_DIR .. "src/devices/bus/neogeo/boot_cthd.h",
MAME_DIR .. "src/devices/bus/neogeo/boot_misc.cpp",
MAME_DIR .. "src/devices/bus/neogeo/boot_misc.h",
MAME_DIR .. "src/devices/bus/neogeo/boot_svc.cpp",
MAME_DIR .. "src/devices/bus/neogeo/boot_svc.h",
MAME_DIR .. "src/devices/bus/neogeo/boot_kof2k2.cpp",
MAME_DIR .. "src/devices/bus/neogeo/boot_kof2k2.h",
MAME_DIR .. "src/devices/bus/neogeo/boot_kof2k3.cpp",
MAME_DIR .. "src/devices/bus/neogeo/boot_kof2k3.h",
MAME_DIR .. "src/devices/bus/neogeo/sbp.cpp",
MAME_DIR .. "src/devices/bus/neogeo/sbp.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_fatfury2.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_fatfury2.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_kof98.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_kof98.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_mslugx.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_mslugx.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_cmc.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_cmc.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_sma.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_sma.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_pcm2.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_pcm2.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_kof2k2.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_kof2k2.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_pvc.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_pvc.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_cthd.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_cthd.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_kof2k3bl.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_kof2k3bl.h",
MAME_DIR .. "src/devices/bus/neogeo/boot_kof10th.cpp",
MAME_DIR .. "src/devices/bus/neogeo/boot_kof10th.h",
MAME_DIR .. "src/devices/bus/neogeo/prot_misc.cpp",
MAME_DIR .. "src/devices/bus/neogeo/prot_misc.h",
}
end

View File

@ -2653,9 +2653,9 @@ files {
MAME_DIR .. "src/mame/includes/neogeo.h",
MAME_DIR .. "src/mame/video/neogeo.cpp",
MAME_DIR .. "src/mame/drivers/neogeo_noslot.cpp",
MAME_DIR .. "src/mame/drivers/neopcb.cpp",
MAME_DIR .. "src/mame/video/neogeo_spr.cpp",
MAME_DIR .. "src/mame/video/neogeo_spr.h",
MAME_DIR .. "src/mame/machine/neocrypt.cpp",
MAME_DIR .. "src/mame/machine/ng_memcard.cpp",
MAME_DIR .. "src/mame/machine/ng_memcard.h",
}

View File

@ -1,109 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#include "emu.h"
#include "banked_cart.h"
extern const device_type NEOGEO_BANKED_CART = &device_creator<neogeo_banked_cart_device>;
neogeo_banked_cart_device::neogeo_banked_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, NEOGEO_BANKED_CART, "NeoGeo Banked Cartridge", tag, owner, clock, "neogeo_banked_cart", __FILE__),
m_bank_cartridge(nullptr),
m_main_cpu_bank_address(0),
m_region(nullptr),
m_region_size(0)
{
}
void neogeo_banked_cart_device::postload()
{
_set_main_cpu_bank_address();
}
void neogeo_banked_cart_device::device_start()
{
save_item(NAME(m_main_cpu_bank_address));
machine().save().register_postload(save_prepost_delegate(FUNC(neogeo_banked_cart_device::postload), this));
}
void neogeo_banked_cart_device::device_reset()
{
}
/*************************************
*
* Main CPU banking
*
*************************************/
void neogeo_banked_cart_device::_set_main_cpu_bank_address(void)
{
if (!m_region)
printf("region is null\n");
if (!m_bank_cartridge)
printf("bank_cartridge is null\n");
if (m_region && m_bank_cartridge) m_bank_cartridge->set_base(m_region + m_main_cpu_bank_address);
}
void neogeo_banked_cart_device::neogeo_set_main_cpu_bank_address( UINT32 bank_address )
{
// if (LOG_MAIN_CPU_BANKING) logerror("MAIN CPU PC %06x: neogeo_set_main_cpu_bank_address %06x\n", m_maincpu->pc(), bank_address);
m_main_cpu_bank_address = bank_address;
_set_main_cpu_bank_address();
}
WRITE16_MEMBER(neogeo_banked_cart_device::main_cpu_bank_select_w)
{
UINT32 bank_address;
UINT32 len = m_region_size;
if ((len <= 0x100000) && (data & 0x07))
logerror("PC %06x: warning: bankswitch to %02x but no banks available\n", space.device().safe_pc(), data);
else
{
bank_address = ((data & 0x07) + 1) * 0x100000;
if (bank_address >= len)
{
logerror("PC %06x: warning: bankswitch to empty bank %02x\n", space.device().safe_pc(), data);
bank_address = 0x100000;
}
neogeo_set_main_cpu_bank_address(bank_address);
}
}
void neogeo_banked_cart_device::init_banks(void)
{
/* set initial main CPU bank */
if (m_region_size > 0x100000)
neogeo_set_main_cpu_bank_address(0x100000);
else
neogeo_set_main_cpu_bank_address(0x000000);
}
void neogeo_banked_cart_device::install_banks(running_machine& machine, cpu_device* maincpu, UINT8* region, UINT32 region_size)
{
maincpu->space(AS_PROGRAM).install_read_bank(0x200000, 0x2fffff, 0, 0, "cartridge");
maincpu->space(AS_PROGRAM).install_write_handler(0x2ffff0, 0x2fffff, write16_delegate(FUNC(neogeo_banked_cart_device::main_cpu_bank_select_w),this));
m_bank_cartridge = machine.root_device().membank("cartridge");
m_region = region;
m_region_size = region_size;
init_banks();
}

View File

@ -1,40 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#pragma once
#ifndef __NEOGEO_BANKED_CART__
#define __NEOGEO_BANKED_CART__
extern const device_type NEOGEO_BANKED_CART;
#define MCFG_NEOGEO_BANKED_CART_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, NEOGEO_BANKED_CART, 0)
class neogeo_banked_cart_device : public device_t
{
public:
// construction/destruction
neogeo_banked_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
memory_bank* m_bank_cartridge;
UINT32 m_main_cpu_bank_address;
UINT8* m_region;
UINT32 m_region_size;
void install_banks(running_machine& machine, cpu_device* maincpu, UINT8* region, UINT32 region_size);
WRITE16_MEMBER(main_cpu_bank_select_w);
void neogeo_set_main_cpu_bank_address(UINT32 bank_address);
void _set_main_cpu_bank_address();
void init_banks(void);
protected:
virtual void device_start() override;
virtual void device_reset() override;
void postload();
};
#endif

View File

@ -0,0 +1,136 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
Crouching Tiger Hidden Dragon Bootleg cart type
***********************************************************************************************************/
#include "emu.h"
#include "boot_cthd.h"
//-------------------------------------------------
// neogeo_cthd2k3_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_CTHD2K3_CART = &device_creator<neogeo_cthd2k3_cart>;
neogeo_cthd2k3_cart::neogeo_cthd2k3_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source) :
neogeo_rom_device(mconfig, type, name, tag, owner, clock, shortname, source),
m_prot(*this, "cthd_prot")
{}
neogeo_cthd2k3_cart::neogeo_cthd2k3_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_rom_device(mconfig, NEOGEO_CTHD2K3_CART, "Neo Geo CTHD 2003 Cart", tag, owner, clock, "neocart_ct2k3", __FILE__),
m_prot(*this, "cthd_prot")
{}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_cthd2k3_cart::device_start()
{
}
void neogeo_cthd2k3_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
static MACHINE_CONFIG_FRAGMENT( cthd_cart )
MCFG_CTHD_PROT_ADD("cthd_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_cthd2k3_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( cthd_cart );
}
/*************************************************
cthd2k3
**************************************************/
void neogeo_cthd2k3_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->decrypt_cthd2003(spr_region, spr_region_size, audiocpu_region, audio_region_size, fix_region, fix_region_size);
m_prot->patch_cthd2003(cpuregion, cpuregion_size);
}
/*************************************************
ct2k3sp
**************************************************/
const device_type NEOGEO_CT2K3SP_CART = &device_creator<neogeo_ct2k3sp_cart>;
neogeo_ct2k3sp_cart::neogeo_ct2k3sp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cthd2k3_cart(mconfig, NEOGEO_CT2K3SP_CART, "Neo Geo CTHD 2003 Sp Cart", tag, owner, clock, "neocart_ct2k3sp", __FILE__)
{}
void neogeo_ct2k3sp_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->decrypt_ct2k3sp(spr_region, spr_region_size, audiocpu_region, audio_region_size, fix_region, fix_region_size);
m_prot->patch_cthd2003(cpuregion, cpuregion_size);
}
/*************************************************
ct2k3sa
**************************************************/
const device_type NEOGEO_CT2K3SA_CART = &device_creator<neogeo_ct2k3sa_cart>;
neogeo_ct2k3sa_cart::neogeo_ct2k3sa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cthd2k3_cart(mconfig, NEOGEO_CT2K3SA_CART, "Neo Geo CTHD 2003 Sp Alt Cart", tag, owner, clock, "neocart_ct2k3sa", __FILE__)
{}
void neogeo_ct2k3sa_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->decrypt_ct2k3sa(spr_region, spr_region_size, audiocpu_region, audio_region_size);
m_prot->patch_ct2k3sa(cpuregion, cpuregion_size);
}
/*************************************************
matrimbl
**************************************************/
const device_type NEOGEO_MATRIMBL_CART = &device_creator<neogeo_matrimbl_cart>;
neogeo_matrimbl_cart::neogeo_matrimbl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cthd2k3_cart(mconfig, NEOGEO_MATRIMBL_CART, "Neo Geo Matrimelee Bootleg Cart", tag, owner, clock, "neocart_matrimbl", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_kof2k2_prot(*this, "kof2k2_prot")
{}
void neogeo_matrimbl_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2k2_prot->matrim_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); // required for text layer
m_prot->matrimbl_decrypt(spr_region, spr_region_size, audiocpu_region, audio_region_size);
}
static MACHINE_CONFIG_FRAGMENT( matrimbl_cart )
MCFG_KOF2002_PROT_ADD("kof2k2_prot")
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_CTHD_PROT_ADD("cthd_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_matrimbl_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( matrimbl_cart );
}

View File

@ -0,0 +1,92 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_BOOTCTHD_H
#define __NEOGEO_BOOTCTHD_H
#include "slot.h"
#include "rom.h"
#include "prot_cthd.h"
// ======================> neogeo_cthd2k3_cart
class neogeo_cthd2k3_cart : public neogeo_rom_device
{
public:
// construction/destruction
neogeo_cthd2k3_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source);
neogeo_cthd2k3_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual UINT32 get_bank_base(UINT16 sel) override { return m_prot->get_bank_base(sel); }
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
protected:
required_device<cthd_prot_device> m_prot;
};
// device type definition
extern const device_type NEOGEO_CTHD2K3_CART;
/*************************************************
ct2k3sp
**************************************************/
class neogeo_ct2k3sp_cart : public neogeo_cthd2k3_cart
{
public:
neogeo_ct2k3sp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_CT2K3SP_CART;
/*************************************************
ct2k3sa
**************************************************/
class neogeo_ct2k3sa_cart : public neogeo_cthd2k3_cart
{
public:
neogeo_ct2k3sa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_CT2K3SA_CART;
/*************************************************
matrimbl
**************************************************/
#include "prot_cmc.h"
#include "prot_kof2k2.h"
class neogeo_matrimbl_cart : public neogeo_cthd2k3_cart
{
public:
neogeo_matrimbl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 2; }
virtual machine_config_constructor device_mconfig_additions() const override;
private:
required_device<cmc_prot_device> m_cmc_prot;
required_device<kof2002_prot_device> m_kof2k2_prot;
};
extern const device_type NEOGEO_MATRIMBL_CART;
#endif

View File

@ -0,0 +1,124 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
The King of Fighters 10th Anniversary Bootleg cart type
***********************************************************************************************************/
#include "emu.h"
#include "boot_kof10th.h"
//-------------------------------------------------
// neogeo_kof10th_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_KOF10TH_CART = &device_creator<neogeo_kof10th_cart>;
neogeo_kof10th_cart::neogeo_kof10th_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KOF10TH_CART, "Neo Geo KOF 10th Ann Bootleg Cart", tag, owner, clock, "neocart_kof10th", __FILE__)
{}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_kof10th_cart::device_start()
{
save_pointer(NAME(m_fixed), 0x40000);
save_item(NAME(m_cart_ram));
save_item(NAME(m_cart_ram2));
}
void neogeo_kof10th_cart::device_reset()
{
m_special_bank = 0;
memset(m_cart_ram, 0x00, 0x2000);
memset(m_cart_ram2, 0x00, 0x20000);
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
static MACHINE_CONFIG_FRAGMENT( kof10th_cart )
MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_kof10th_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( kof10th_cart );
}
void neogeo_kof10th_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->kof10th_decrypt(cpuregion, cpuregion_size);
memcpy(m_cart_ram2, (UINT8 *)cpuregion + 0xe0000, 0x20000);
m_fixed = (get_fixed_size()) ? get_fixed_base() : get_region_fixed_base();
}
/* this uses RAM based tiles for the text layer, however the implementation
is incomplete, at the moment the S data is copied from the program rom on
start-up instead */
UINT32 neogeo_kof10th_cart::get_bank_base(UINT16 sel)
{
UINT32 bank = 0x100000 + ((sel & 7) << 20);
if (bank >= 0x700000)
bank = 0x100000;
return bank;
}
UINT16 neogeo_kof10th_cart::get_helper()
{
return m_cart_ram[0xffc];
}
UINT32 neogeo_kof10th_cart::get_special_bank()
{
return m_special_bank;
}
READ16_MEMBER(neogeo_kof10th_cart::protection_r)
{
return m_cart_ram[offset];
}
READ16_MEMBER(neogeo_kof10th_cart::addon_r)
{
// printf("kof10th_RAM2_r\n");
return m_cart_ram2[offset];
}
WRITE16_MEMBER(neogeo_kof10th_cart::protection_w)
{
if (offset < 0x40000/2)
{
if (!m_cart_ram[0xffe])
COMBINE_DATA(&m_cart_ram2[(0x00000/2) + (offset & 0xffff)]); // Write to RAM bank A
else
m_fixed[offset] = BITSWAP8(data, 7,6,0,4,3,2,1,5); // Write S data on-the-fly
}
else if (offset >= 0xfe000/2)
{
if (offset == 0xffff0/2)
{
// Standard bankswitch
//m_bankdev->neogeo_set_main_cpu_bank_address(get_bank_base(data));
}
else if (offset == 0xffff8/2 && m_cart_ram[0xffc] != data)
{
// Special bankswitch
m_special_bank = (data & 1) ? 0x800000/2 : 0x700000/2;
}
COMBINE_DATA(&m_cart_ram[offset & 0xfff]);
}
}

View File

@ -0,0 +1,46 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_KOF10TH_H
#define __NEOGEO_KOF10TH_H
#include "slot.h"
#include "boot_misc.h"
#include "prot_misc.h"
// ======================> neogeo_kof10th_cart
class neogeo_kof10th_cart : public neogeo_bootleg_cart
{
public:
// construction/destruction
neogeo_kof10th_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual UINT16 get_helper() override;
virtual UINT32 get_bank_base(UINT16 sel) override;
virtual UINT32 get_special_bank() override;
virtual DECLARE_READ16_MEMBER(addon_r) override;
virtual DECLARE_READ16_MEMBER(protection_r) override;
virtual DECLARE_WRITE16_MEMBER(protection_w) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
private:
UINT8* m_fixed;
UINT32 m_special_bank;
UINT16 m_cart_ram[0x1000];
UINT16 m_cart_ram2[0x10000];
};
// device type definition
extern const device_type NEOGEO_KOF10TH_CART;
#endif

View File

@ -0,0 +1,110 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
The King of Fighers 2002 Bootleg cart type
***********************************************************************************************************/
#include "emu.h"
#include "boot_kof2k2.h"
static MACHINE_CONFIG_FRAGMENT( kof2k2bl_cart )
MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_PCM2_PROT_ADD("pcm2_prot")
MCFG_KOF2002_PROT_ADD("kof2k2_prot")
MACHINE_CONFIG_END
static MACHINE_CONFIG_FRAGMENT( kof2k2mp_cart )
MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_PCM2_PROT_ADD("pcm2_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_kof2002b_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( kof2k2bl_cart );
}
machine_config_constructor neogeo_kf2k2mp_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( kof2k2mp_cart );
}
machine_config_constructor neogeo_kf2k2mp2_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( kof2k2mp_cart );
}
/*************************************************
kof2002b
**************************************************/
const device_type NEOGEO_KOF2002B_CART = &device_creator<neogeo_kof2002b_cart>;
neogeo_kof2002b_cart::neogeo_kof2002b_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KOF2002B_CART, "Neo Geo KOF 2002 Bootleg Cart", tag, owner, clock, "neocart_kof2002b", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_kof2k2_prot(*this, "kof2k2_prot")
{}
void neogeo_kof2002b_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2k2_prot->kof2002_decrypt_68k(cpuregion, cpuregion_size);
m_pcm2_prot->swap(ym_region, ym_region_size, 0);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_prot->kof2002b_gfx_decrypt(spr_region, 0x4000000);
m_prot->kof2002b_gfx_decrypt(fix_region, 0x20000);
}
/*************************************************
kf2k2mp
**************************************************/
const device_type NEOGEO_KF2K2MP_CART = &device_creator<neogeo_kf2k2mp_cart>;
neogeo_kf2k2mp_cart::neogeo_kf2k2mp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KF2K2MP_CART, "Neo Geo KOF 2002 MP Cart", tag, owner, clock, "neocart_kf2k2mp", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot")
{}
void neogeo_kf2k2mp_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->kf2k2mp_decrypt(cpuregion, cpuregion_size);
m_pcm2_prot->swap(ym_region, ym_region_size, 0);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_prot->sx_decrypt(fix_region, fix_region_size, 2);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2002_GFX_KEY);
}
/*************************************************
kf2k2mp2
**************************************************/
const device_type NEOGEO_KF2K2MP2_CART = &device_creator<neogeo_kf2k2mp2_cart>;
neogeo_kf2k2mp2_cart::neogeo_kf2k2mp2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KF2K2MP2_CART, "Neo Geo KOF 2002 MP2 Cart", tag, owner, clock, "neocart_kf2k2mp2", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot")
{}
void neogeo_kf2k2mp2_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->kf2k2mp2_px_decrypt(cpuregion, cpuregion_size);
m_pcm2_prot->swap(ym_region, ym_region_size, 0);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_prot->sx_decrypt(fix_region, fix_region_size, 1);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2002_GFX_KEY);
}

View File

@ -0,0 +1,79 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_BOOTKOF2K2_H
#define __NEOGEO_BOOTKOF2K2_H
#include "slot.h"
#include "boot_misc.h"
#include "prot_misc.h"
#include "prot_cmc.h"
#include "prot_pcm2.h"
#include "prot_kof2k2.h"
/*************************************************
kof2002b
**************************************************/
class neogeo_kof2002b_cart : public neogeo_bootleg_cart
{
public:
neogeo_kof2002b_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
virtual machine_config_constructor device_mconfig_additions() const override;
private:
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<kof2002_prot_device> m_kof2k2_prot;
};
extern const device_type NEOGEO_KOF2002B_CART;
/*************************************************
kf2k2mp
**************************************************/
class neogeo_kf2k2mp_cart : public neogeo_bootleg_cart
{
public:
neogeo_kf2k2mp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
virtual machine_config_constructor device_mconfig_additions() const override;
private:
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
};
extern const device_type NEOGEO_KF2K2MP_CART;
/*************************************************
kf2k2mp2
**************************************************/
class neogeo_kf2k2mp2_cart : public neogeo_bootleg_cart
{
public:
neogeo_kf2k2mp2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
virtual machine_config_constructor device_mconfig_additions() const override;
private:
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
};
extern const device_type NEOGEO_KF2K2MP2_CART;
#endif

View File

@ -0,0 +1,99 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
The King of Fighters 2003 Bootleg cart type
***********************************************************************************************************/
#include "emu.h"
#include "boot_kof2k3.h"
static MACHINE_CONFIG_FRAGMENT( kof2k3bl_cart )
MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_PCM2_PROT_ADD("pcm2_prot")
MCFG_KOF2K3BL_PROT_ADD("kof2k3bl_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_kf2k3bl_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( kof2k3bl_cart );
}
machine_config_constructor neogeo_kf2k3pl_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( kof2k3bl_cart );
}
machine_config_constructor neogeo_kf2k3upl_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( kof2k3bl_cart );
}
/*************************************************
kf2k3bl
**************************************************/
const device_type NEOGEO_KF2K3BL_CART = &device_creator<neogeo_kf2k3bl_cart>;
neogeo_kf2k3bl_cart::neogeo_kf2k3bl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KF2K3BL_CART, "Neo Geo KOF 2003 Bootleg Cart", tag, owner, clock, "neocart_kf2k3bl", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_kof2k3bl_prot(*this, "kof2k3bl_prot")
{}
void neogeo_kf2k3bl_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2003_GFX_KEY);
m_pcm2_prot->swap(ym_region, ym_region_size, 5);
m_prot->sx_decrypt(fix_region, fix_region_size, 1);
}
/*************************************************
kf2k3pl
**************************************************/
const device_type NEOGEO_KF2K3PL_CART = &device_creator<neogeo_kf2k3pl_cart>;
neogeo_kf2k3pl_cart::neogeo_kf2k3pl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KF2K3PL_CART, "Neo Geo KOF 2003 PL Cart", tag, owner, clock, "neocart_kf2k3pl", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_kof2k3bl_prot(*this, "kof2k3bl_prot")
{}
void neogeo_kf2k3pl_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2003_GFX_KEY);
m_pcm2_prot->swap(ym_region, ym_region_size, 5);
m_kof2k3bl_prot->pl_px_decrypt(cpuregion, cpuregion_size);
m_prot->sx_decrypt(fix_region, fix_region_size, 1);
}
/*************************************************
kf2k3upl
**************************************************/
const device_type NEOGEO_KF2K3UPL_CART = &device_creator<neogeo_kf2k3upl_cart>;
neogeo_kf2k3upl_cart::neogeo_kf2k3upl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KF2K3UPL_CART, "Neo Geo KOF 2003 UPL Cart", tag, owner, clock, "neocart_kf2k3upl", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_kof2k3bl_prot(*this, "kof2k3bl_prot")
{}
void neogeo_kf2k3upl_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2003_GFX_KEY);
m_pcm2_prot->swap(ym_region, ym_region_size, 5);
m_kof2k3bl_prot->upl_px_decrypt(cpuregion, cpuregion_size);
m_prot->sx_decrypt(fix_region, fix_region_size, 2);
}

View File

@ -0,0 +1,92 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_BOOTKOF2K3_H
#define __NEOGEO_BOOTKOF2K3_H
#include "slot.h"
#include "boot_misc.h"
#include "prot_kof2k3bl.h"
/*************************************************
kf2k3bl
**************************************************/
class neogeo_kf2k3bl_cart : public neogeo_bootleg_cart
{
public:
neogeo_kf2k3bl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
virtual machine_config_constructor device_mconfig_additions() const override;
virtual UINT32 get_bank_base(UINT16 sel) override { return m_kof2k3bl_prot->get_bank_base(); }
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_kof2k3bl_prot->protection_r(space, offset, mem_mask); }
virtual DECLARE_WRITE16_MEMBER(protection_w) override { m_kof2k3bl_prot->kof2003_w(space, offset, data, mem_mask); }
virtual DECLARE_READ16_MEMBER(addon_r) override { return m_kof2k3bl_prot->overlay_r(space, offset, mem_mask); }
private:
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<kof2k3bl_prot_device> m_kof2k3bl_prot;
};
extern const device_type NEOGEO_KF2K3BL_CART;
/*************************************************
kf2k3pl
**************************************************/
class neogeo_kf2k3pl_cart : public neogeo_bootleg_cart
{
public:
neogeo_kf2k3pl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
virtual machine_config_constructor device_mconfig_additions() const override;
virtual UINT32 get_bank_base(UINT16 sel) override { return m_kof2k3bl_prot->get_bank_base(); }
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_kof2k3bl_prot->protection_r(space, offset, mem_mask); }
virtual DECLARE_WRITE16_MEMBER(protection_w) override { m_kof2k3bl_prot->kof2003p_w(space, offset, data, mem_mask); }
private:
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<kof2k3bl_prot_device> m_kof2k3bl_prot;
};
extern const device_type NEOGEO_KF2K3PL_CART;
/*************************************************
kf2k3upl
**************************************************/
class neogeo_kf2k3upl_cart : public neogeo_bootleg_cart
{
public:
neogeo_kf2k3upl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
virtual machine_config_constructor device_mconfig_additions() const override;
virtual UINT32 get_bank_base(UINT16 sel) override { return m_kof2k3bl_prot->get_bank_base(); }
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_kof2k3bl_prot->protection_r(space, offset, mem_mask); }
virtual DECLARE_WRITE16_MEMBER(protection_w) override { m_kof2k3bl_prot->kof2003_w(space, offset, data, mem_mask); }
virtual DECLARE_READ16_MEMBER(addon_r) override { return m_kof2k3bl_prot->overlay_r(space, offset, mem_mask); }
private:
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<kof2k3bl_prot_device> m_kof2k3bl_prot;
};
extern const device_type NEOGEO_KF2K3UPL_CART;
#endif

View File

@ -0,0 +1,289 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
Misc. bootleg cart types (possibly to be split further at a later stage)
***********************************************************************************************************/
#include "emu.h"
#include "boot_misc.h"
//-------------------------------------------------
// neogeo_bootleg_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_BOOTLEG_CART = &device_creator<neogeo_bootleg_cart>;
neogeo_bootleg_cart::neogeo_bootleg_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source) :
neogeo_rom_device(mconfig, type, name, tag, owner, clock, shortname, source),
m_prot(*this, "bootleg_prot")
{}
neogeo_bootleg_cart::neogeo_bootleg_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_rom_device(mconfig, NEOGEO_BOOTLEG_CART, "Neo Geo Bootleg Protected Cart", tag, owner, clock, "neocart_boot", __FILE__),
m_prot(*this, "bootleg_prot")
{}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_bootleg_cart::device_start()
{
}
void neogeo_bootleg_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
static MACHINE_CONFIG_FRAGMENT( bootleg_cart )
MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_bootleg_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( bootleg_cart );
}
/*************************************************
garoubl
**************************************************/
const device_type NEOGEO_GAROUBL_CART = &device_creator<neogeo_garoubl_cart>;
neogeo_garoubl_cart::neogeo_garoubl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_GAROUBL_CART, "Neo Geo Garou Bootleg Cart", tag, owner, clock, "neocart_garoubl", __FILE__)
{}
void neogeo_garoubl_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->sx_decrypt(fix_region, fix_region_size, 2);
m_prot->cx_decrypt(spr_region, spr_region_size);
}
/*************************************************
kof97oro
**************************************************/
const device_type NEOGEO_KOF97ORO_CART = &device_creator<neogeo_kof97oro_cart>;
neogeo_kof97oro_cart::neogeo_kof97oro_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KOF97ORO_CART, "Neo Geo KOF 97 Orochi Bootleg Cart", tag, owner, clock, "neocart_kof97oro", __FILE__)
{}
void neogeo_kof97oro_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->kof97oro_px_decode(cpuregion, cpuregion_size);
m_prot->sx_decrypt(fix_region, fix_region_size,1);
m_prot->cx_decrypt(spr_region, spr_region_size);
}
/*************************************************
kf10thep
**************************************************/
const device_type NEOGEO_KF10THEP_CART = &device_creator<neogeo_kf10thep_cart>;
neogeo_kf10thep_cart::neogeo_kf10thep_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KF10THEP_CART, "Neo Geo KOF 10th Ann. EP Bootleg Cart", tag, owner, clock, "neocart_kf10thep", __FILE__)
{}
void neogeo_kf10thep_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->kf10thep_px_decrypt(cpuregion, cpuregion_size);
m_prot->sx_decrypt(fix_region, fix_region_size, 1);
}
/*************************************************
kf2k5uni
**************************************************/
const device_type NEOGEO_KF2K5UNI_CART = &device_creator<neogeo_kf2k5uni_cart>;
neogeo_kf2k5uni_cart::neogeo_kf2k5uni_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KF2K5UNI_CART, "Neo Geo KOF 2005 Unique Bootleg Cart", tag, owner, clock, "neocart_kf2k5uni", __FILE__)
{}
void neogeo_kf2k5uni_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->kf2k5uni_px_decrypt(cpuregion, cpuregion_size);
m_prot->kf2k5uni_sx_decrypt(fix_region, fix_region_size);
m_prot->kf2k5uni_mx_decrypt(audiocpu_region, audio_region_size);
}
/*************************************************
kf2k4se
**************************************************/
const device_type NEOGEO_KF2K4SE_CART = &device_creator<neogeo_kf2k4se_cart>;
neogeo_kf2k4se_cart::neogeo_kf2k4se_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KF2K4SE_CART, "Neo Geo KOF 2004 SE Bootleg Cart", tag, owner, clock, "neocart_kf2k4se", __FILE__)
{}
void neogeo_kf2k4se_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->decrypt_kof2k4se_68k(cpuregion, cpuregion_size);
}
/*************************************************
lans2004
**************************************************/
const device_type NEOGEO_LANS2004_CART = &device_creator<neogeo_lans2004_cart>;
neogeo_lans2004_cart::neogeo_lans2004_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_LANS2004_CART, "Neo Geo Lansquenet 2004 Bootleg Cart", tag, owner, clock, "neocart_lans2004", __FILE__)
{}
void neogeo_lans2004_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->lans2004_decrypt_68k(cpuregion, cpuregion_size);
m_prot->lans2004_vx_decrypt(ym_region, ym_region_size);
m_prot->sx_decrypt(fix_region, fix_region_size,1);
m_prot->cx_decrypt(spr_region, spr_region_size);
}
/*************************************************
samsho5b
**************************************************/
const device_type NEOGEO_SAMSHO5B_CART = &device_creator<neogeo_samsho5b_cart>;
neogeo_samsho5b_cart::neogeo_samsho5b_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_SAMSHO5B_CART, "Neo Geo Samurai Shodown 5 Bootleg Cart", tag, owner, clock, "neocart_samsho5b", __FILE__)
{}
void neogeo_samsho5b_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->samsho5b_px_decrypt(cpuregion, cpuregion_size);
m_prot->samsho5b_vx_decrypt(ym_region, ym_region_size);
m_prot->sx_decrypt(fix_region, fix_region_size, 1);
m_prot->cx_decrypt(spr_region, spr_region_size);
}
/*************************************************
mslug3b6
**************************************************/
const device_type NEOGEO_MSLUG3B6_CART = &device_creator<neogeo_mslug3b6_cart>;
neogeo_mslug3b6_cart::neogeo_mslug3b6_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_MSLUG3B6_CART, "Neo Geo Metal Slug 6 Bootleg Cart", tag, owner, clock, "neocart_mslug3b6", __FILE__),
m_cmc_prot(*this, "cmc_prot")
{}
void neogeo_mslug3b6_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->sx_decrypt(fix_region, fix_region_size, 2);
m_cmc_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, MSLUG3_GFX_KEY);
}
static MACHINE_CONFIG_FRAGMENT( mslug3b6_cart )
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_mslug3b6_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( mslug3b6_cart );
}
/*************************************************
ms5plus
**************************************************/
const device_type NEOGEO_MS5PLUS_CART = &device_creator<neogeo_ms5plus_cart>;
neogeo_ms5plus_cart::neogeo_ms5plus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_MS5PLUS_CART, "Neo Geo Metal Slug 5 Plus Bootleg Cart", tag, owner, clock, "neocart_ms5plus", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot")
{}
void neogeo_ms5plus_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region,audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MSLUG5_GFX_KEY);
m_pcm2_prot->swap(ym_region, ym_region_size, 2);
m_prot->sx_decrypt(fix_region, fix_region_size, 1);
}
static MACHINE_CONFIG_FRAGMENT( ms5plus_cart )
MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_PCM2_PROT_ADD("pcm2_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_ms5plus_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( ms5plus_cart );
}
/*************************************************
kog
**************************************************/
const device_type NEOGEO_KOG_CART = &device_creator<neogeo_kog_cart>;
neogeo_kog_cart::neogeo_kog_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_KOG_CART, "Neo Geo King of Gladiators Bootleg Cart", tag, owner, clock, "neocart_kog", __FILE__),
m_jumper(*this, "JUMPER")
{}
static INPUT_PORTS_START( kog )
// a jumper on the pcb overlays a ROM address, very strange but that's how it works.
PORT_START("JUMPER")
PORT_DIPNAME( 0x0001, 0x0001, "Title Language" ) PORT_DIPLOCATION("CART-JUMPER:1")
PORT_DIPSETTING( 0x0001, DEF_STR( English ) )
PORT_DIPSETTING( 0x0000, "Non-English" )
PORT_BIT( 0x00fe, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
ioport_constructor neogeo_kog_cart::device_input_ports() const
{
return INPUT_PORTS_NAME( kog );
}
READ16_MEMBER(neogeo_kog_cart::protection_r)
{
return m_jumper->read();
}
void neogeo_kog_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->kog_px_decrypt(cpuregion, cpuregion_size);
m_prot->sx_decrypt(fix_region, fix_region_size, 1);
m_prot->cx_decrypt(spr_region, spr_region_size);
}

View File

@ -0,0 +1,207 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_BOOTCART_H
#define __NEOGEO_BOOTCART_H
#include "slot.h"
#include "rom.h"
#include "prot_misc.h"
#include "prot_cmc.h"
#include "prot_pcm2.h"
// ======================> neogeo_bootleg_cart
class neogeo_bootleg_cart : public neogeo_rom_device
{
public:
// construction/destruction
neogeo_bootleg_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source);
neogeo_bootleg_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override {}
virtual int get_fixed_bank_type(void) override { return 0; }
required_device<neoboot_prot_device> m_prot;
};
// device type definition
extern const device_type NEOGEO_BOOTLEG_CART;
/*************************************************
garoubl
**************************************************/
class neogeo_garoubl_cart : public neogeo_bootleg_cart
{
public:
neogeo_garoubl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_GAROUBL_CART;
/*************************************************
kof97oro
**************************************************/
class neogeo_kof97oro_cart : public neogeo_bootleg_cart
{
public:
neogeo_kof97oro_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_KOF97ORO_CART;
/*************************************************
kf10thep
**************************************************/
class neogeo_kf10thep_cart : public neogeo_bootleg_cart
{
public:
neogeo_kf10thep_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_KF10THEP_CART;
/*************************************************
kf2k5uni
**************************************************/
class neogeo_kf2k5uni_cart : public neogeo_bootleg_cart
{
public:
neogeo_kf2k5uni_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_KF2K5UNI_CART;
/*************************************************
kf2k4se
**************************************************/
class neogeo_kf2k4se_cart : public neogeo_bootleg_cart
{
public:
neogeo_kf2k4se_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_KF2K4SE_CART;
/*************************************************
lans2004
**************************************************/
class neogeo_lans2004_cart : public neogeo_bootleg_cart
{
public:
neogeo_lans2004_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_LANS2004_CART;
/*************************************************
samsho5b
**************************************************/
class neogeo_samsho5b_cart : public neogeo_bootleg_cart
{
public:
neogeo_samsho5b_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_SAMSHO5B_CART;
/*************************************************
mslug3b6
**************************************************/
class neogeo_mslug3b6_cart : public neogeo_bootleg_cart
{
public:
neogeo_mslug3b6_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
virtual machine_config_constructor device_mconfig_additions() const override;
private:
required_device<cmc_prot_device> m_cmc_prot;
};
extern const device_type NEOGEO_MSLUG3B6_CART;
/*************************************************
ms5plus
**************************************************/
class neogeo_ms5plus_cart : public neogeo_bootleg_cart
{
public:
neogeo_ms5plus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
virtual machine_config_constructor device_mconfig_additions() const override;
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_prot->mslug5p_prot_r(space, offset, mem_mask); }
virtual UINT32 get_bank_base(UINT16 sel) override { return m_prot->mslug5p_bank_base(sel); }
private:
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
};
extern const device_type NEOGEO_MS5PLUS_CART;
/*************************************************
kog
**************************************************/
class neogeo_kog_cart : public neogeo_bootleg_cart
{
public:
neogeo_kog_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ioport_constructor device_input_ports() const override;
virtual DECLARE_READ16_MEMBER(protection_r) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
private:
required_ioport m_jumper;
};
extern const device_type NEOGEO_KOG_CART;
#endif

View File

@ -0,0 +1,107 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
SNK Vs Capcom Bootleg cart type
***********************************************************************************************************/
#include "emu.h"
#include "boot_svc.h"
/*************************************************
svcboot
**************************************************/
const device_type NEOGEO_SVCBOOT_CART = &device_creator<neogeo_svcboot_cart>;
neogeo_svcboot_cart::neogeo_svcboot_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_SVCBOOT_CART, "Neo Geo SVC Bootleg Cart", tag, owner, clock, "neocart_svcboot", __FILE__),
m_pvc_prot(*this, "pvc_prot")
{}
void neogeo_svcboot_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->svcboot_px_decrypt(cpuregion, cpuregion_size);
m_prot->svcboot_cx_decrypt(spr_region, spr_region_size);
}
static MACHINE_CONFIG_FRAGMENT( svcboot_cart )
MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
MCFG_PVC_PROT_ADD("pvc_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_svcboot_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( svcboot_cart );
}
/*************************************************
svcplus
**************************************************/
const device_type NEOGEO_SVCPLUS_CART = &device_creator<neogeo_svcplus_cart>;
neogeo_svcplus_cart::neogeo_svcplus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_SVCPLUS_CART, "Neo Geo SVC Plus Bootleg Cart", tag, owner, clock, "neocart_svcplus", __FILE__)
{}
void neogeo_svcplus_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->svcplus_px_decrypt(cpuregion, cpuregion_size);
m_prot->svcboot_cx_decrypt(spr_region, spr_region_size);
m_prot->sx_decrypt(fix_region, fix_region_size, 1);
m_prot->svcplus_px_hack(cpuregion, cpuregion_size);
}
/*************************************************
svcplusa
**************************************************/
const device_type NEOGEO_SVCPLUSA_CART = &device_creator<neogeo_svcplusa_cart>;
neogeo_svcplusa_cart::neogeo_svcplusa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_SVCPLUSA_CART, "Neo Geo SVC Plus Alt Bootleg Cart", tag, owner, clock, "neocart_svcplusa", __FILE__)
{}
void neogeo_svcplusa_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->svcplusa_px_decrypt(cpuregion, cpuregion_size);
m_prot->svcboot_cx_decrypt(spr_region, spr_region_size);
m_prot->svcplus_px_hack(cpuregion, cpuregion_size);
}
/*************************************************
svcsplus
**************************************************/
const device_type NEOGEO_SVCSPLUS_CART = &device_creator<neogeo_svcsplus_cart>;
neogeo_svcsplus_cart::neogeo_svcsplus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_bootleg_cart(mconfig, NEOGEO_SVCSPLUS_CART, "Neo Geo SVC S.Plus Bootleg Cart", tag, owner, clock, "neocart_svcsplus", __FILE__),
m_pvc_prot(*this, "pvc_prot")
{}
void neogeo_svcsplus_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->svcsplus_px_decrypt(cpuregion, cpuregion_size);
m_prot->sx_decrypt(fix_region, fix_region_size, 2);
m_prot->svcboot_cx_decrypt(spr_region, spr_region_size);
m_prot->svcsplus_px_hack(cpuregion, cpuregion_size);
}
static MACHINE_CONFIG_FRAGMENT( svcsplus_cart )
MCFG_NEOBOOT_PROT_ADD("bootleg_prot")
MCFG_PVC_PROT_ADD("pvc_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_svcsplus_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( svcsplus_cart );
}

View File

@ -0,0 +1,90 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_BOOTSVC_H
#define __NEOGEO_BOOTSVC_H
#include "slot.h"
#include "boot_misc.h"
#include "prot_misc.h"
#include "prot_pvc.h"
/*************************************************
svcboot
**************************************************/
class neogeo_svcboot_cart : public neogeo_bootleg_cart
{
public:
neogeo_svcboot_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual machine_config_constructor device_mconfig_additions() const override;
virtual UINT32 get_bank_base(UINT16 sel) override { return m_pvc_prot->get_bank_base(); }
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_pvc_prot->protection_r(space, offset, mem_mask); }
virtual DECLARE_WRITE16_MEMBER(protection_w) override { m_pvc_prot->protection_w(space, offset, data, mem_mask); }
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
private:
required_device<pvc_prot_device> m_pvc_prot;
};
extern const device_type NEOGEO_SVCBOOT_CART;
/*************************************************
svcplus
**************************************************/
class neogeo_svcplus_cart : public neogeo_bootleg_cart
{
public:
neogeo_svcplus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_SVCPLUS_CART;
/*************************************************
svcplusa
**************************************************/
class neogeo_svcplusa_cart : public neogeo_bootleg_cart
{
public:
neogeo_svcplusa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_SVCPLUSA_CART;
/*************************************************
svcsplus
**************************************************/
class neogeo_svcsplus_cart : public neogeo_bootleg_cart
{
public:
neogeo_svcsplus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual machine_config_constructor device_mconfig_additions() const override;
virtual UINT32 get_bank_base(UINT16 sel) override { return m_pvc_prot->get_bank_base(); }
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_pvc_prot->protection_r(space, offset, mem_mask); }
virtual DECLARE_WRITE16_MEMBER(protection_w) override { m_pvc_prot->protection_w(space, offset, data, mem_mask); }
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
private:
required_device<pvc_prot_device> m_pvc_prot;
};
extern const device_type NEOGEO_SVCSPLUS_CART;
#endif

View File

@ -1,378 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
/***********************************************************************************************************
NEOGEO ROM cart emulation
***********************************************************************************************************/
#include "emu.h"
#include "bootleg_cart.h"
//-------------------------------------------------
// neogeo_bootleg_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_BOOTLEG_CART = &device_creator<neogeo_bootleg_cart>;
neogeo_bootleg_cart::neogeo_bootleg_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
m_bootleg_prot(*this, "bootleg_prot")
{
}
neogeo_bootleg_cart::neogeo_bootleg_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_BOOTLEG_CART, "NEOGEO Bootleg Cart", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
m_bootleg_prot(*this, "bootleg_prot")
{
}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_bootleg_cart::device_start()
{
}
void neogeo_bootleg_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_bootleg_cart::read_rom)
{
return m_rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( bootleg_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_NGBOOTLEG_PROT_ADD("bootleg_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_bootleg_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( bootleg_cart );
}
/* Individual cartridge types (mirror DRIVER_INIT functionality) */
/*************************************************
garoubl
**************************************************/
const device_type NEOGEO_BOOTLEG_GAROUBL_CART = &device_creator<neogeo_bootleg_garoubl_cart>;
neogeo_bootleg_garoubl_cart::neogeo_bootleg_garoubl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_GAROUBL_CART, "NEOGEO BOOT garoubl Cart", tag, owner, clock, "boot_garoubl_cart", __FILE__) {}
void neogeo_bootleg_garoubl_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_garoubl_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,2);
m_bootleg_prot->neogeo_bootleg_cx_decrypt(spr_region, spr_region_size);
}
/*************************************************
cthd2003
**************************************************/
const device_type NEOGEO_BOOTLEG_CTHD2003_CART = &device_creator<neogeo_bootleg_cthd2003_cart>;
neogeo_bootleg_cthd2003_cart::neogeo_bootleg_cthd2003_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_CTHD2003_CART, "NEOGEO BOOT cthd2003 Cart", tag, owner, clock, "boot_cthd2003_cart", __FILE__) {}
void neogeo_bootleg_cthd2003_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_bootleg_prot->patch_cthd2003(maincpu,m_banked_cart, cpuregion, cpuregion_size);
}
void neogeo_bootleg_cthd2003_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->decrypt_cthd2003(spr_region, spr_region_size, audiocpu_region, audio_region_size, fix_region, fix_region_size);
}
/******/
const device_type NEOGEO_BOOTLEG_CT2K3SP_CART = &device_creator<neogeo_bootleg_ct2k3sp_cart>;
neogeo_bootleg_ct2k3sp_cart::neogeo_bootleg_ct2k3sp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_CT2K3SP_CART, "NEOGEO BOOT ct2k3sp Cart", tag, owner, clock, "boot_ct2k3sp_cart", __FILE__) {}
void neogeo_bootleg_ct2k3sp_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_bootleg_prot->patch_cthd2003(maincpu,m_banked_cart, cpuregion, cpuregion_size);
}
void neogeo_bootleg_ct2k3sp_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->decrypt_ct2k3sp(spr_region, spr_region_size, audiocpu_region, audio_region_size, fix_region, fix_region_size);
}
/******/
const device_type NEOGEO_BOOTLEG_CT2K3SA_CART = &device_creator<neogeo_bootleg_ct2k3sa_cart>;
neogeo_bootleg_ct2k3sa_cart::neogeo_bootleg_ct2k3sa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_CT2K3SA_CART, "NEOGEO BOOT ct2k3sa Cart", tag, owner, clock, "boot_ct2k3sa_cart", __FILE__) {}
void neogeo_bootleg_ct2k3sa_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_ct2k3sa_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->decrypt_ct2k3sa(spr_region, spr_region_size, audiocpu_region, audio_region_size);
m_bootleg_prot->patch_ct2k3sa(cpuregion, cpuregion_size);
}
/*************************************************
kf10thep
**************************************************/
const device_type NEOGEO_BOOTLEG_KF10THEP_CART = &device_creator<neogeo_bootleg_kf10thep_cart>;
neogeo_bootleg_kf10thep_cart::neogeo_bootleg_kf10thep_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_KF10THEP_CART, "NEOGEO BOOT kf10thep Cart", tag, owner, clock, "boot_kf10thep_cart", __FILE__) {}
void neogeo_bootleg_kf10thep_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_kf10thep_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->kf10thep_px_decrypt(cpuregion, cpuregion_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region,fix_region_size,1);
}
/*************************************************
kf2k5uni
**************************************************/
const device_type NEOGEO_BOOTLEG_KF2K5UNI_CART = &device_creator<neogeo_bootleg_kf2k5uni_cart>;
neogeo_bootleg_kf2k5uni_cart::neogeo_bootleg_kf2k5uni_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_KF2K5UNI_CART, "NEOGEO BOOT kf2k5uni Cart", tag, owner, clock, "boot_kf2k5uni_cart", __FILE__) {}
void neogeo_bootleg_kf2k5uni_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_kf2k5uni_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->decrypt_kf2k5uni(cpuregion,cpuregion_size, audiocpu_region, audio_region_size, fix_region, fix_region_size);
}
/*************************************************
kf2k4se
**************************************************/
const device_type NEOGEO_BOOTLEG_KF2K4SE_CART = &device_creator<neogeo_bootleg_kf2k4se_cart>;
neogeo_bootleg_kf2k4se_cart::neogeo_bootleg_kf2k4se_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_KF2K4SE_CART, "NEOGEO BOOT kf2k4se Cart", tag, owner, clock, "boot_kf2k4se_cart", __FILE__) {}
void neogeo_bootleg_kf2k4se_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_kf2k4se_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->decrypt_kof2k4se_68k(cpuregion, cpuregion_size);
}
/*************************************************
svcplus
**************************************************/
const device_type NEOGEO_BOOTLEG_SVCPLUS_CART = &device_creator<neogeo_bootleg_svcplus_cart>;
neogeo_bootleg_svcplus_cart::neogeo_bootleg_svcplus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_SVCPLUS_CART, "NEOGEO BOOT svcplus Cart", tag, owner, clock, "boot_svcplus_cart", __FILE__) {}
void neogeo_bootleg_svcplus_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_svcplus_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->svcplus_px_decrypt(cpuregion, cpuregion_size);
m_bootleg_prot->svcboot_cx_decrypt(spr_region, spr_region_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size, 1);
m_bootleg_prot->svcplus_px_hack(cpuregion, cpuregion_size);
}
/*************************************************
svcplusaa
**************************************************/
const device_type NEOGEO_BOOTLEG_SVCPLUSA_CART = &device_creator<neogeo_bootleg_svcplusa_cart>;
neogeo_bootleg_svcplusa_cart::neogeo_bootleg_svcplusa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_SVCPLUSA_CART, "NEOGEO BOOT svcplusa Cart", tag, owner, clock, "boot_svcplusa_cart", __FILE__) {}
void neogeo_bootleg_svcplusa_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_svcplusa_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->svcplusa_px_decrypt(cpuregion, cpuregion_size);
m_bootleg_prot->svcboot_cx_decrypt(spr_region, spr_region_size);
m_bootleg_prot->svcplus_px_hack(cpuregion, cpuregion_size);
}
/*************************************************
samsho5b
**************************************************/
const device_type NEOGEO_BOOTLEG_SAMSHO5B_CART = &device_creator<neogeo_bootleg_samsho5b_cart>;
neogeo_bootleg_samsho5b_cart::neogeo_bootleg_samsho5b_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_SAMSHO5B_CART, "NEOGEO BOOT samsho5b Cart", tag, owner, clock, "boot_samsho5b_cart", __FILE__) {}
void neogeo_bootleg_samsho5b_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_samsho5b_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->samsho5b_px_decrypt(cpuregion, cpuregion_size);
m_bootleg_prot->samsho5b_vx_decrypt(ym_region, ym_region_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
m_bootleg_prot->neogeo_bootleg_cx_decrypt(spr_region, spr_region_size);
}
/*************************************************
kof97oro
**************************************************/
const device_type NEOGEO_BOOTLEG_KOF97ORO_CART = &device_creator<neogeo_bootleg_kof97oro_cart>;
neogeo_bootleg_kof97oro_cart::neogeo_bootleg_kof97oro_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_KOF97ORO_CART, "NEOGEO BOOT kof97oro Cart", tag, owner, clock, "boot_kof97oro_cart", __FILE__) {}
void neogeo_bootleg_kof97oro_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_kof97oro_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->kof97oro_px_decode(cpuregion, cpuregion_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
m_bootleg_prot->neogeo_bootleg_cx_decrypt(spr_region, spr_region_size);
}
/*************************************************
lans2004
**************************************************/
const device_type NEOGEO_BOOTLEG_LANS2004_CART = &device_creator<neogeo_bootleg_lans2004_cart>;
neogeo_bootleg_lans2004_cart::neogeo_bootleg_lans2004_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_LANS2004_CART, "NEOGEO BOOT lans2004 Cart", tag, owner, clock, "boot_lans2004_cart", __FILE__) {}
void neogeo_bootleg_lans2004_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_lans2004_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->lans2004_decrypt_68k(cpuregion, cpuregion_size);
m_bootleg_prot->lans2004_vx_decrypt(ym_region, ym_region_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
m_bootleg_prot->neogeo_bootleg_cx_decrypt(spr_region, spr_region_size);
}
/*************************************************
kof10th
**************************************************/
const device_type NEOGEO_BOOTLEG_KOF10TH_CART = &device_creator<neogeo_bootleg_kof10th_cart>;
neogeo_bootleg_kof10th_cart::neogeo_bootleg_kof10th_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_KOF10TH_CART, "NEOGEO BOOT kof10th Cart", tag, owner, clock, "boot_kof10th_cart", __FILE__) {}
void neogeo_bootleg_kof10th_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_bootleg_prot->install_kof10th_protection(maincpu,m_banked_cart, cpuregion, cpuregion_size, fixedregion, fixedregion_size);
}
void neogeo_bootleg_kof10th_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->decrypt_kof10th(cpuregion, cpuregion_size);
}
/*************************************************
kog
**************************************************/
const device_type NEOGEO_BOOTLEG_KOG_CART = &device_creator<neogeo_bootleg_kog_cart>;
neogeo_bootleg_kog_cart::neogeo_bootleg_kog_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_cart(mconfig, NEOGEO_BOOTLEG_KOG_CART, "NEOGEO BOOT kog Cart", tag, owner, clock, "boot_kog_cart", __FILE__),
m_kog_prot(*this, "kog_prot")
{}
static MACHINE_CONFIG_FRAGMENT( kog_bootleg_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_NGBOOTLEG_PROT_ADD("bootleg_prot")
MCFG_KOG_PROT_ADD("kog_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_bootleg_kog_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( kog_bootleg_cart );
}
void neogeo_bootleg_kog_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_kog_prot->kog_install_protection(maincpu);
}
void neogeo_bootleg_kog_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kog_prot->kog_px_decrypt(cpuregion, cpuregion_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
m_bootleg_prot->neogeo_bootleg_cx_decrypt(spr_region, spr_region_size);
}

View File

@ -1,250 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_BOOTLEG_CART_H
#define __NEOGEO_BOOTLEG_CART_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "sma_prot.h"
#include "bootleg_prot.h"
#include "kog_prot.h"
// ======================> neogeo_bootleg_cart
class neogeo_bootleg_cart : public device_t,
public device_neogeo_cart_interface
{
public:
// construction/destruction
neogeo_bootleg_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source);
neogeo_bootleg_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual void activate_cart(ACTIVATE_CART_PARAMS) override {}
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override {}
virtual int get_fixed_bank_type(void) override { return 0; }
required_device<neogeo_banked_cart_device> m_banked_cart;
required_device<ngbootleg_prot_device> m_bootleg_prot;
};
// device type definition
extern const device_type NEOGEO_BOOTLEG_CART;
/*************************************************
GAROUBL
**************************************************/
class neogeo_bootleg_garoubl_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_garoubl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_GAROUBL_CART;
/*************************************************
CTHD2003
**************************************************/
class neogeo_bootleg_cthd2003_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_cthd2003_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_CTHD2003_CART;
class neogeo_bootleg_ct2k3sp_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_ct2k3sp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_CT2K3SP_CART;
class neogeo_bootleg_ct2k3sa_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_ct2k3sa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_CT2K3SA_CART;
/*************************************************
KF10THEP
**************************************************/
class neogeo_bootleg_kf10thep_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_kf10thep_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_KF10THEP_CART;
/*************************************************
KF2K5UNI
**************************************************/
class neogeo_bootleg_kf2k5uni_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_kf2k5uni_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_KF2K5UNI_CART;
/*************************************************
KF2K4SE
**************************************************/
class neogeo_bootleg_kf2k4se_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_kf2k4se_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_KF2K4SE_CART;
/*************************************************
SVCPLUS
**************************************************/
class neogeo_bootleg_svcplus_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_svcplus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_SVCPLUS_CART;
/*************************************************
SVCPLUSA
**************************************************/
class neogeo_bootleg_svcplusa_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_svcplusa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_SVCPLUSA_CART;
/*************************************************
SAMSHO5B
**************************************************/
class neogeo_bootleg_samsho5b_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_samsho5b_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_SAMSHO5B_CART;
/*************************************************
KOF97ORO
**************************************************/
class neogeo_bootleg_kof97oro_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_kof97oro_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_KOF97ORO_CART;
/*************************************************
LANS2004
**************************************************/
class neogeo_bootleg_lans2004_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_lans2004_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_LANS2004_CART;
/*************************************************
KOF10TH
**************************************************/
class neogeo_bootleg_kof10th_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_kof10th_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_KOF10TH_CART;
/*************************************************
KOG
**************************************************/
class neogeo_bootleg_kog_cart : public neogeo_bootleg_cart
{
public:
neogeo_bootleg_kog_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
virtual machine_config_constructor device_mconfig_additions() const override;
required_device<kog_prot_device> m_kog_prot;
};
extern const device_type NEOGEO_BOOTLEG_KOG_CART;
#endif

View File

@ -1,319 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
/***********************************************************************************************************
NEOGEO ROM cart emulation
these are bootlegs using a mix of reimplemented original features, could be further sorted
***********************************************************************************************************/
#include "emu.h"
#include "bootleg_hybrid_cart.h"
//-------------------------------------------------
// neogeo_bootleg_hybrid_hybrid_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_BOOTLEG_HYBRID_HYBRID_CART = &device_creator<neogeo_bootleg_hybrid_hybrid_cart>;
neogeo_bootleg_hybrid_hybrid_cart::neogeo_bootleg_hybrid_hybrid_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
m_bootleg_prot(*this, "bootleg_prot"),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_kof2002_prot(*this, "kof2002_prot"),
m_pvc_prot(*this, "pvc_prot")
{
}
neogeo_bootleg_hybrid_hybrid_cart::neogeo_bootleg_hybrid_hybrid_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_BOOTLEG_HYBRID_HYBRID_CART, "NEOGEO SMA Cart", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
m_bootleg_prot(*this, "bootleg_prot"),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_kof2002_prot(*this, "kof2002_prot"),
m_pvc_prot(*this, "pvc_prot")
{
}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_bootleg_hybrid_hybrid_cart::device_start()
{
}
void neogeo_bootleg_hybrid_hybrid_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_bootleg_hybrid_hybrid_cart::read_rom)
{
return m_rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( bootleg_hybrid_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_NGBOOTLEG_PROT_ADD("bootleg_prot")
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_PCM2_PROT_ADD("pcm2_prot")
MCFG_KOF2002_PROT_ADD("kof2002_prot")
MCFG_PVC_PROT_ADD("pvc_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_bootleg_hybrid_hybrid_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( bootleg_hybrid_cart );
}
/* Individual cartridge types (mirror DRIVER_INIT functionality) */
/*************************************************
mslug3b6
**************************************************/
const device_type NEOGEO_BOOTLEG_HYBRID_MSLUG3B6_CART = &device_creator<neogeo_bootleg_hybrid_mslug3b6_cart>;
neogeo_bootleg_hybrid_mslug3b6_cart::neogeo_bootleg_hybrid_mslug3b6_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_MSLUG3B6_CART, "NEOGEO BOOT mslug3b6 Cart", tag, owner, clock, "boot_mslug3b6_cart", __FILE__) {}
void neogeo_bootleg_hybrid_mslug3b6_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_hybrid_mslug3b6_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,2);
m_cmc_prot->cmc42_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, MSLUG3_GFX_KEY);
}
/*************************************************
kof2002b
**************************************************/
const device_type NEOGEO_BOOTLEG_HYBRID_KOF2002B_CART = &device_creator<neogeo_bootleg_hybrid_kof2002b_cart>;
neogeo_bootleg_hybrid_kof2002b_cart::neogeo_bootleg_hybrid_kof2002b_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_KOF2002B_CART, "NEOGEO BOOT kof2002b Cart", tag, owner, clock, "boot_kof2002b_cart", __FILE__) {}
void neogeo_bootleg_hybrid_kof2002b_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_hybrid_kof2002b_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2002_prot->kof2002_decrypt_68k(cpuregion, cpuregion_size);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 0);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_bootleg_prot->kof2002b_gfx_decrypt(spr_region,0x4000000);
m_bootleg_prot->kof2002b_gfx_decrypt(fix_region,0x20000);
}
/***/
const device_type NEOGEO_BOOTLEG_HYBRID_KF2K2MP_CART = &device_creator<neogeo_bootleg_hybrid_kf2k2mp_cart>;
neogeo_bootleg_hybrid_kf2k2mp_cart::neogeo_bootleg_hybrid_kf2k2mp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_KF2K2MP_CART, "NEOGEO BOOT kf2k2mp Cart", tag, owner, clock, "boot_kf2k2mp_cart", __FILE__) {}
void neogeo_bootleg_hybrid_kf2k2mp_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_hybrid_kf2k2mp_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->kf2k2mp_decrypt(cpuregion, cpuregion_size);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 0);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,2);
m_cmc_prot->cmc50_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2002_GFX_KEY);
}
/***/
const device_type NEOGEO_BOOTLEG_HYBRID_KF2K2MP2_CART = &device_creator<neogeo_bootleg_hybrid_kf2k2mp2_cart>;
neogeo_bootleg_hybrid_kf2k2mp2_cart::neogeo_bootleg_hybrid_kf2k2mp2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_KF2K2MP2_CART, "NEOGEO BOOT kf2k2mp2 Cart", tag, owner, clock, "boot_kf2k2mp2_cart", __FILE__) {}
void neogeo_bootleg_hybrid_kf2k2mp2_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_hybrid_kf2k2mp2_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->kf2k2mp2_px_decrypt(cpuregion, cpuregion_size);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 0);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
m_cmc_prot->cmc50_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2002_GFX_KEY);
}
/*************************************************
matrimbl
**************************************************/
const device_type NEOGEO_BOOTLEG_HYBRID_MATRIMBL_CART = &device_creator<neogeo_bootleg_hybrid_matrimbl_cart>;
neogeo_bootleg_hybrid_matrimbl_cart::neogeo_bootleg_hybrid_matrimbl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_MATRIMBL_CART, "NEOGEO BOOT matrimbl Cart", tag, owner, clock, "boot_matrimbl_cart", __FILE__) {}
void neogeo_bootleg_hybrid_matrimbl_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
}
void neogeo_bootleg_hybrid_matrimbl_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2002_prot->matrim_decrypt_68k(cpuregion, cpuregion_size);
m_bootleg_prot->matrimbl_decrypt(spr_region, spr_region_size, audiocpu_region,audio_region_size);
m_cmc_prot->neogeo_sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); /* required for text layer */
}
/*************************************************
ms5plus
**************************************************/
const device_type NEOGEO_BOOTLEG_HYBRID_MS5PLUS_CART = &device_creator<neogeo_bootleg_hybrid_ms5plus_cart>;
neogeo_bootleg_hybrid_ms5plus_cart::neogeo_bootleg_hybrid_ms5plus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_MS5PLUS_CART, "NEOGEO BOOT ms5plus Cart", tag, owner, clock, "boot_ms5plus_cart", __FILE__) {}
void neogeo_bootleg_hybrid_ms5plus_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_bootleg_prot->install_ms5plus_protection(maincpu,m_banked_cart);
}
void neogeo_bootleg_hybrid_ms5plus_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->cmc50_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, MSLUG5_GFX_KEY);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 2);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region,audio_region_size);
}
/*************************************************
svcboot
**************************************************/
const device_type NEOGEO_BOOTLEG_HYBRID_SVCBOOT_CART = &device_creator<neogeo_bootleg_hybrid_svcboot_cart>;
neogeo_bootleg_hybrid_svcboot_cart::neogeo_bootleg_hybrid_svcboot_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_SVCBOOT_CART, "NEOGEO BOOT svcboot Cart", tag, owner, clock, "boot_svcboot_cart", __FILE__) {}
void neogeo_bootleg_hybrid_svcboot_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_pvc_prot->install_pvc_protection(maincpu,m_banked_cart);
}
void neogeo_bootleg_hybrid_svcboot_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->svcboot_px_decrypt(cpuregion, cpuregion_size);
m_bootleg_prot->svcboot_cx_decrypt(spr_region, spr_region_size);
}
/***/
const device_type NEOGEO_BOOTLEG_HYBRID_SVCSPLUS_CART = &device_creator<neogeo_bootleg_hybrid_svcsplus_cart>;
neogeo_bootleg_hybrid_svcsplus_cart::neogeo_bootleg_hybrid_svcsplus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_SVCSPLUS_CART, "NEOGEO BOOT svcsplus Cart", tag, owner, clock, "boot_svcsplus_cart", __FILE__) {}
void neogeo_bootleg_hybrid_svcsplus_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_pvc_prot->install_pvc_protection(maincpu,m_banked_cart);
}
void neogeo_bootleg_hybrid_svcsplus_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_bootleg_prot->svcsplus_px_decrypt(cpuregion, cpuregion_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,2);
m_bootleg_prot->svcboot_cx_decrypt(spr_region, spr_region_size);
m_bootleg_prot->svcsplus_px_hack(cpuregion, cpuregion_size);
}
/*************************************************
kf2k3bl
**************************************************/
const device_type NEOGEO_BOOTLEG_HYBRID_KF2K3BL_CART = &device_creator<neogeo_bootleg_hybrid_kf2k3bl_cart>;
neogeo_bootleg_hybrid_kf2k3bl_cart::neogeo_bootleg_hybrid_kf2k3bl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_KF2K3BL_CART, "NEOGEO BOOT kf2k3bl Cart", tag, owner, clock, "boot_kf2k3bl_cart", __FILE__) {}
void neogeo_bootleg_hybrid_kf2k3bl_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_bootleg_prot->kf2k3bl_install_protection(maincpu,m_banked_cart, cpuregion, cpuregion_size);
}
void neogeo_bootleg_hybrid_kf2k3bl_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->cmc50_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2003_GFX_KEY);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 5);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
}
const device_type NEOGEO_BOOTLEG_HYBRID_KF2K3PL_CART = &device_creator<neogeo_bootleg_hybrid_kf2k3pl_cart>;
neogeo_bootleg_hybrid_kf2k3pl_cart::neogeo_bootleg_hybrid_kf2k3pl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_KF2K3PL_CART, "NEOGEO BOOT kf2k3pl Cart", tag, owner, clock, "boot_kf2k3pl_cart", __FILE__) {}
void neogeo_bootleg_hybrid_kf2k3pl_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_bootleg_prot->kf2k3pl_install_protection(maincpu,m_banked_cart, cpuregion, cpuregion_size);
}
void neogeo_bootleg_hybrid_kf2k3pl_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->cmc50_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2003_GFX_KEY);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 5);
m_bootleg_prot->kf2k3pl_px_decrypt(cpuregion, cpuregion_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
}
const device_type NEOGEO_BOOTLEG_HYBRID_KF2K3UPL_CART = &device_creator<neogeo_bootleg_hybrid_kf2k3upl_cart>;
neogeo_bootleg_hybrid_kf2k3upl_cart::neogeo_bootleg_hybrid_kf2k3upl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_bootleg_hybrid_hybrid_cart(mconfig, NEOGEO_BOOTLEG_HYBRID_KF2K3UPL_CART, "NEOGEO BOOT kf2k3upl Cart", tag, owner, clock, "boot_kf2k3upl_cart", __FILE__) {}
void neogeo_bootleg_hybrid_kf2k3upl_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_bootleg_prot->kf2k3bl_install_protection(maincpu,m_banked_cart, cpuregion, cpuregion_size);
}
void neogeo_bootleg_hybrid_kf2k3upl_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->cmc50_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2003_GFX_KEY);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 5);
m_bootleg_prot->kf2k3upl_px_decrypt(cpuregion, cpuregion_size);
m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,2);
}

View File

@ -1,192 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_BOOTLEG_HYBRID_HYBRID_CART_H
#define __NEOGEO_BOOTLEG_HYBRID_HYBRID_CART_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "bootleg_prot.h"
#include "pcm2_prot.h"
#include "cmc_prot.h"
#include "kof2002_prot.h"
#include "pvc_prot.h"
// ======================> neogeo_bootleg_hybrid_hybrid_cart
class neogeo_bootleg_hybrid_hybrid_cart : public device_t,
public device_neogeo_cart_interface
{
public:
// construction/destruction
neogeo_bootleg_hybrid_hybrid_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source);
neogeo_bootleg_hybrid_hybrid_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual void activate_cart(ACTIVATE_CART_PARAMS) override {}
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override {}
virtual int get_fixed_bank_type(void) override { return 0; }
required_device<neogeo_banked_cart_device> m_banked_cart;
required_device<ngbootleg_prot_device> m_bootleg_prot;
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<kof2002_prot_device> m_kof2002_prot;
required_device<pvc_prot_device> m_pvc_prot;
};
// device type definition
extern const device_type NEOGEO_BOOTLEG_HYBRID_HYBRID_CART;
/*************************************************
MSLUG3B6
**************************************************/
class neogeo_bootleg_hybrid_mslug3b6_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_mslug3b6_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_MSLUG3B6_CART;
/*************************************************
KOF2002B
**************************************************/
class neogeo_bootleg_hybrid_kof2002b_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_kof2002b_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_KOF2002B_CART;
class neogeo_bootleg_hybrid_kf2k2mp_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_kf2k2mp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_KF2K2MP_CART;
class neogeo_bootleg_hybrid_kf2k2mp2_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_kf2k2mp2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_KF2K2MP2_CART;
/*************************************************
MATRIMBL
**************************************************/
class neogeo_bootleg_hybrid_matrimbl_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_matrimbl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 2; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_MATRIMBL_CART;
/*************************************************
MS5PLUS
**************************************************/
class neogeo_bootleg_hybrid_ms5plus_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_ms5plus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_MS5PLUS_CART;
/*************************************************
SVCBOOT
**************************************************/
class neogeo_bootleg_hybrid_svcboot_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_svcboot_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_SVCBOOT_CART;
class neogeo_bootleg_hybrid_svcsplus_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_svcsplus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_SVCSPLUS_CART;
/*************************************************
KF2K3BL
**************************************************/
class neogeo_bootleg_hybrid_kf2k3bl_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_kf2k3bl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_KF2K3BL_CART;
class neogeo_bootleg_hybrid_kf2k3pl_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_kf2k3pl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_KF2K3PL_CART;
class neogeo_bootleg_hybrid_kf2k3upl_cart : public neogeo_bootleg_hybrid_hybrid_cart
{
public:
neogeo_bootleg_hybrid_kf2k3upl_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_BOOTLEG_HYBRID_KF2K3UPL_CART;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,92 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#pragma once
#include "banked_cart.h"
#ifndef __NGBOOTLEG_PROT__
#define __NGBOOTLEG_PROT__
extern const device_type NGBOOTLEG_PROT;
#define MCFG_NGBOOTLEG_PROT_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, NGBOOTLEG_PROT, 0)
class ngbootleg_prot_device : public device_t
{
public:
// construction/destruction
ngbootleg_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void neogeo_bootleg_cx_decrypt(UINT8*sprrom, UINT32 sprrom_size);
void neogeo_bootleg_sx_decrypt(UINT8* fixed, UINT32 fixed_size, int value);
void kof97oro_px_decode(UINT8* cpurom, UINT32 cpurom_size);
void kof10thBankswitch(address_space &space, UINT16 nBank);
DECLARE_READ16_MEMBER(kof10th_RAM2_r);
DECLARE_READ16_MEMBER(kof10th_RAMB_r);
DECLARE_WRITE16_MEMBER(kof10th_custom_w);
DECLARE_WRITE16_MEMBER(kof10th_bankswitch_w);
void install_kof10th_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev, UINT8* cpurom, UINT32 cpurom_size, UINT8* fixedrom, UINT32 fixedrom_size);
void decrypt_kof10th(UINT8* cpurom, UINT32 cpurom_size);
void kf10thep_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void kf2k5uni_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void kf2k5uni_sx_decrypt(UINT8* fixedrom, UINT32 fixedrom_size);
void kf2k5uni_mx_decrypt(UINT8* audiorom, UINT32 audiorom_size);
void decrypt_kf2k5uni(UINT8* cpurom, UINT32 cpurom_size, UINT8* audiorom, UINT32 audiorom_size, UINT8* fixedrom, UINT32 fixedrom_size);
void kof2002b_gfx_decrypt(UINT8 *src, int size);
void kf2k2mp_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void kf2k2mp2_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void cthd2003_neogeo_gfx_address_fix_do(UINT8* sprrom, UINT32 sprrom_size, int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift);
void cthd2003_neogeo_gfx_address_fix(UINT8* sprrom, UINT32 sprrom_size, int start, int end);
void cthd2003_c(UINT8* sprrom, UINT32 sprrom_size, int pow);
void decrypt_cthd2003(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size, UINT8* fixedrom, UINT32 fixedrom_size);
DECLARE_WRITE16_MEMBER(cthd2003_bankswitch_w);
void patch_cthd2003(cpu_device* maincpu, neogeo_banked_cart_device* bankdev, UINT8* cpurom, UINT32 cpurom_size);
void ct2k3sp_sx_decrypt(UINT8* fixedrom, UINT32 fixedrom_size);
void decrypt_ct2k3sp(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size, UINT8* fixedrom, UINT32 fixedrom_size);
void decrypt_ct2k3sa(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size);
void patch_ct2k3sa(UINT8* cpurom, UINT32 cpurom_size);
void decrypt_kof2k4se_68k(UINT8* cpurom, UINT32 cpurom_size);
void lans2004_vx_decrypt(UINT8* ymsndrom, UINT32 ymsndrom_size);
void lans2004_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size);
DECLARE_READ16_MEMBER(mslug5_prot_r);
DECLARE_WRITE16_MEMBER(ms5plus_bankswitch_w);
void install_ms5plus_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev);
void svcboot_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void svcboot_cx_decrypt(UINT8*sprrom, UINT32 sprrom_size);
void svcplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void svcplus_px_hack(UINT8* cpurom, UINT32 cpurom_size);
void svcplusa_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void svcsplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void svcsplus_px_hack(UINT8* cpurom, UINT32 cpurom_size);
DECLARE_READ16_MEMBER(kof2003_r);
DECLARE_WRITE16_MEMBER(kof2003_w);
DECLARE_WRITE16_MEMBER(kof2003p_w);
DECLARE_READ16_MEMBER(kof2003_overlay_r);
void kf2k3bl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void kf2k3bl_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev, UINT8* cpurom, UINT32 cpurom_size);
void kf2k3pl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void kf2k3pl_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev, UINT8* cpurom, UINT32 cpurom_size);
UINT16 kof2k3_overlay;
void kf2k3upl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void samsho5b_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void samsho5b_vx_decrypt(UINT8* ymsndrom, UINT32 ymsndrom_size);
void matrimbl_decrypt(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size);
UINT16 m_cartridge_ram[0x1000]; // bootlegs
// for kof10th
UINT8* m_mainrom;
UINT8* m_fixedrom;
neogeo_banked_cart_device* m_bankdev;
UINT16 m_cartridge_ram2[0x10000];
protected:
virtual void device_start() override;
virtual void device_reset() override;
};
#endif

View File

@ -0,0 +1,113 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/**********************************************************************
**********************************************************************/
#include "bus/neogeo/carts.h"
#include "bus/neogeo/rom.h"
#include "bus/neogeo/fatfury2.h"
#include "bus/neogeo/kof98.h"
#include "bus/neogeo/mslugx.h"
#include "bus/neogeo/cmc.h"
#include "bus/neogeo/sma.h"
#include "bus/neogeo/pcm2.h"
#include "bus/neogeo/kof2k2.h"
#include "bus/neogeo/pvc.h"
#include "bus/neogeo/boot_cthd.h"
#include "bus/neogeo/boot_misc.h"
#include "bus/neogeo/boot_svc.h"
#include "bus/neogeo/boot_kof2k2.h"
#include "bus/neogeo/boot_kof2k3.h"
#include "bus/neogeo/boot_kof10th.h"
#include "bus/neogeo/sbp.h"
SLOT_INTERFACE_START(neogeo_cart)
SLOT_INTERFACE_INTERNAL("rom", NEOGEO_ROM) // Standard cart with banking
SLOT_INTERFACE_INTERNAL("rom_vliner", NEOGEO_VLINER_CART) // Standard cart + RAM
SLOT_INTERFACE_INTERNAL("rom_fatfur2", NEOGEO_FATFURY2_CART) // Custom Fatal Fury 2 protection
SLOT_INTERFACE_INTERNAL("rom_kof98", NEOGEO_KOF98_CART) // Custom King of Fighters 98 protection
SLOT_INTERFACE_INTERNAL("rom_mslugx", NEOGEO_MSLUGX_CART) // Custom Metal Slug X protection
// only CMC42 for gfx
SLOT_INTERFACE_INTERNAL("cmc42_zupapa", NEOGEO_CMC_ZUPAPA_CART)
SLOT_INTERFACE_INTERNAL("cmc42_mslug3h", NEOGEO_CMC_MSLUG3H_CART)
SLOT_INTERFACE_INTERNAL("cmc42_ganryu", NEOGEO_CMC_GANRYU_CART)
SLOT_INTERFACE_INTERNAL("cmc42_s1945p", NEOGEO_CMC_S1945P_CART)
SLOT_INTERFACE_INTERNAL("cmc42_preisle2", NEOGEO_CMC_PREISLE2_CART)
SLOT_INTERFACE_INTERNAL("cmc42_bangbead", NEOGEO_CMC_BANGBEAD_CART)
SLOT_INTERFACE_INTERNAL("cmc42_nitd", NEOGEO_CMC_NITD_CART)
SLOT_INTERFACE_INTERNAL("cmc42_sengoku3", NEOGEO_CMC_SENGOKU3_CART)
SLOT_INTERFACE_INTERNAL("cmc42_kof99k", NEOGEO_CMC_KOF99K_CART)
// only CMC50 for gfx + audiocpu
SLOT_INTERFACE_INTERNAL("cmc50_kof2001", NEOGEO_CMC_KOF2001_CART)
SLOT_INTERFACE_INTERNAL("cmc50_kof2000n", NEOGEO_CMC_KOF2000N_CART)
SLOT_INTERFACE_INTERNAL("cmc50_jockeygp", NEOGEO_CMC_JOCKEYGP_CART) // CMC50 + RAM
// These use SMA for prg & CMC42 for gfx
SLOT_INTERFACE_INTERNAL("sma_kof99", NEOGEO_SMA_KOF99_CART)
SLOT_INTERFACE_INTERNAL("sma_garou", NEOGEO_SMA_GAROU_CART)
SLOT_INTERFACE_INTERNAL("sma_garouh", NEOGEO_SMA_GAROUH_CART)
SLOT_INTERFACE_INTERNAL("sma_mslug3", NEOGEO_SMA_MSLUG3_CART)
// These use SMA for prg & CMC50 for gfx + audiocpu
SLOT_INTERFACE_INTERNAL("sma_kof2k", NEOGEO_SMA_KOF2000_CART)
// CMC50 for gfx + audiocpu & NEOPCM2 for YM scramble
SLOT_INTERFACE_INTERNAL("pcm2_mslug4", NEOGEO_PCM2_MSLUG4_CART)
SLOT_INTERFACE_INTERNAL("pcm2_rotd", NEOGEO_PCM2_ROTD_CART)
SLOT_INTERFACE_INTERNAL("pcm2_pnyaa", NEOGEO_PCM2_PNYAA_CART)
SLOT_INTERFACE_INTERNAL("pcm2_ms4p", NEOGEO_PCM2_MS4PLUS_CART) // regular encryption but external S1 rom = no audiocpu encryption from CMC
// CMC50 for gfx + audiocpu & NEOPCM2 for YM scramble & additonal prg scramble
SLOT_INTERFACE_INTERNAL("k2k2_kof2k2", NEOGEO_K2K2_KOF2002_CART)
SLOT_INTERFACE_INTERNAL("k2k2_matrim", NEOGEO_K2K2_MATRIM_CART)
SLOT_INTERFACE_INTERNAL("k2k2_samsh5", NEOGEO_K2K2_SAMSHO5_CART)
SLOT_INTERFACE_INTERNAL("k2k2_sams5s", NEOGEO_K2K2_SAMSHO5SP_CART)
SLOT_INTERFACE_INTERNAL("k2k2_kf2k2p", NEOGEO_K2K2_KF2K2PLS_CART) // regular encryption but external S1 rom = no audiocpu encryption from CMC
// CMC50 for gfx + audiocpu & NEOPCM2 for YM scramble & PVC protection/encryption
SLOT_INTERFACE_INTERNAL("pvc_mslug5", NEOGEO_PVC_MSLUG5_CART)
SLOT_INTERFACE_INTERNAL("pvc_svc", NEOGEO_PVC_SVC_CART)
SLOT_INTERFACE_INTERNAL("pvc_kf2k3", NEOGEO_PVC_KOF2003_CART)
SLOT_INTERFACE_INTERNAL("pvc_kf2k3h", NEOGEO_PVC_KOF2003H_CART)
// Bootleg logic for CTHD2K3 and clones
SLOT_INTERFACE_INTERNAL("boot_cthd2k3", NEOGEO_CTHD2K3_CART)
SLOT_INTERFACE_INTERNAL("boot_ct2k3sp", NEOGEO_CT2K3SP_CART)
SLOT_INTERFACE_INTERNAL("boot_ct2k3sa", NEOGEO_CT2K3SA_CART)
SLOT_INTERFACE_INTERNAL("boot_matrimbl", NEOGEO_MATRIMBL_CART) // this also uses a CMC for SFIX & addditional prg scramble from kof2002
// Bootleg logic for SVC clones
SLOT_INTERFACE_INTERNAL("boot_svcboot", NEOGEO_SVCBOOT_CART) // this also uses a PVC protection/encryption
SLOT_INTERFACE_INTERNAL("boot_svcplus", NEOGEO_SVCPLUS_CART)
SLOT_INTERFACE_INTERNAL("boot_svcplusa", NEOGEO_SVCPLUSA_CART)
SLOT_INTERFACE_INTERNAL("boot_svcsplus", NEOGEO_SVCSPLUS_CART) // this also uses a PVC protection/encryption
// Bootleg logic for KOF2002 clones
SLOT_INTERFACE_INTERNAL("boot_kf2k2b", NEOGEO_KOF2002B_CART)
SLOT_INTERFACE_INTERNAL("boot_kf2k2mp", NEOGEO_KF2K2MP_CART)
SLOT_INTERFACE_INTERNAL("boot_kf2k2mp2", NEOGEO_KF2K2MP2_CART)
// Bootleg logic for KOF2003 clones
SLOT_INTERFACE_INTERNAL("boot_kf2k3bl", NEOGEO_KF2K3BL_CART)
SLOT_INTERFACE_INTERNAL("boot_kf2k3pl", NEOGEO_KF2K3PL_CART)
SLOT_INTERFACE_INTERNAL("boot_kf2k3upl", NEOGEO_KF2K3UPL_CART)
// Misc carts with bootleg logic
SLOT_INTERFACE_INTERNAL("boot_garoubl", NEOGEO_GAROUBL_CART)
SLOT_INTERFACE_INTERNAL("boot_kof97oro", NEOGEO_KOF97ORO_CART)
SLOT_INTERFACE_INTERNAL("boot_kf10thep", NEOGEO_KF10THEP_CART)
SLOT_INTERFACE_INTERNAL("boot_kf2k5uni", NEOGEO_KF2K5UNI_CART)
SLOT_INTERFACE_INTERNAL("boot_kf2k4se", NEOGEO_KF2K4SE_CART)
SLOT_INTERFACE_INTERNAL("boot_lans2004", NEOGEO_LANS2004_CART)
SLOT_INTERFACE_INTERNAL("boot_samsho5b", NEOGEO_SAMSHO5B_CART)
SLOT_INTERFACE_INTERNAL("boot_mslug3b6", NEOGEO_MSLUG3B6_CART) // this also uses a CMC42 for gfx
SLOT_INTERFACE_INTERNAL("boot_ms5plus", NEOGEO_MS5PLUS_CART) // this also uses a CMC50 for gfx + audiocpu & NEOPCM2 for YM scramble
SLOT_INTERFACE_INTERNAL("boot_kog", NEOGEO_KOG_CART)
SLOT_INTERFACE_INTERNAL("boot_kf10th", NEOGEO_KOF10TH_CART)
SLOT_INTERFACE_INTERNAL("boot_sbp", NEOGEO_SBP_CART)
SLOT_INTERFACE_END

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/**********************************************************************
**********************************************************************/
@ -11,18 +11,6 @@
#include "emu.h"
#include "rom.h"
#include "banked_cart.h"
#include "mslugx_cart.h"
#include "sma_cart.h"
#include "cmc_cart.h"
#include "pcm2_cart.h"
#include "kof2002_cart.h"
#include "pvc_cart.h"
#include "fatfury2_cart.h"
#include "kof98_cart.h"
#include "bootleg_cart.h"
#include "bootleg_hybrid_cart.h"
// supported devices
SLOT_INTERFACE_EXTERN(neogeo_cart);

View File

@ -0,0 +1,267 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
CMC42 & CMC50 encrypted cart type
***********************************************************************************************************/
#include "emu.h"
#include "cmc.h"
//-------------------------------------------------
// neogeo_cmc_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_CMC_CART = &device_creator<neogeo_cmc_cart>;
neogeo_cmc_cart::neogeo_cmc_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source) :
neogeo_rom_device(mconfig, type, name, tag, owner, clock, shortname, source),
m_prot(*this, "cmc_prot")
{}
neogeo_cmc_cart::neogeo_cmc_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_rom_device(mconfig, NEOGEO_CMC_CART, "Neo Geo CMC Cart", tag, owner, clock, "neocart_cmc", __FILE__),
m_prot(*this, "cmc_prot")
{}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_cmc_cart::device_start()
{
}
void neogeo_cmc_cart::device_reset()
{
}
static MACHINE_CONFIG_FRAGMENT( cmc_cart )
MCFG_CMC_PROT_ADD("cmc_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_cmc_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( cmc_cart );
}
/*************************************************
zupapa
**************************************************/
const device_type NEOGEO_CMC_ZUPAPA_CART = &device_creator<neogeo_cmc_zupapa_cart>;
neogeo_cmc_zupapa_cart::neogeo_cmc_zupapa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_ZUPAPA_CART, "Neo Geo Zupapa CMC42 Cart", tag, owner, clock, "neocart_zupapa", __FILE__)
{}
void neogeo_cmc_zupapa_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, ZUPAPA_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
mslug3h
**************************************************/
const device_type NEOGEO_CMC_MSLUG3H_CART = &device_creator<neogeo_cmc_mslug3h_cart>;
neogeo_cmc_mslug3h_cart::neogeo_cmc_mslug3h_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_MSLUG3H_CART, "Neo Geo Metal Slug 3 AES CMC42 Cart", tag, owner, clock, "neocart_mslug3h", __FILE__)
{}
void neogeo_cmc_mslug3h_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, MSLUG3_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
ganryu
**************************************************/
const device_type NEOGEO_CMC_GANRYU_CART = &device_creator<neogeo_cmc_ganryu_cart>;
neogeo_cmc_ganryu_cart::neogeo_cmc_ganryu_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_GANRYU_CART, "Neo Geo Ganryu CMC42 Cart", tag, owner, clock, "neocart_ganryu", __FILE__)
{}
void neogeo_cmc_ganryu_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, GANRYU_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
s1945p
**************************************************/
const device_type NEOGEO_CMC_S1945P_CART = &device_creator<neogeo_cmc_s1945p_cart>;
neogeo_cmc_s1945p_cart::neogeo_cmc_s1945p_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_S1945P_CART, "Neo Geo Strikers 1945 Plus CMC42 Cart", tag, owner, clock, "neocart_s1945p", __FILE__)
{}
void neogeo_cmc_s1945p_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, S1945P_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
preisle2
**************************************************/
const device_type NEOGEO_CMC_PREISLE2_CART = &device_creator<neogeo_cmc_preisle2_cart>;
neogeo_cmc_preisle2_cart::neogeo_cmc_preisle2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_PREISLE2_CART, "Neo Geo Prehistorik Isle 2 CMC42 Cart", tag, owner, clock, "neocart_preisle2", __FILE__)
{}
void neogeo_cmc_preisle2_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, PREISLE2_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
bangbead
**************************************************/
const device_type NEOGEO_CMC_BANGBEAD_CART = &device_creator<neogeo_cmc_bangbead_cart>;
neogeo_cmc_bangbead_cart::neogeo_cmc_bangbead_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_BANGBEAD_CART, "Neo Geo Bangbead CMC42 Cart", tag, owner, clock, "neocart_bangbead", __FILE__)
{}
void neogeo_cmc_bangbead_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, BANGBEAD_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
ntd
**************************************************/
const device_type NEOGEO_CMC_NITD_CART = &device_creator<neogeo_cmc_nitd_cart>;
neogeo_cmc_nitd_cart::neogeo_cmc_nitd_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_NITD_CART, "Neo Geo NITD CMC42 Cart", tag, owner, clock, "neocart_nitd", __FILE__)
{}
void neogeo_cmc_nitd_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, NITD_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
sengoku3
**************************************************/
const device_type NEOGEO_CMC_SENGOKU3_CART = &device_creator<neogeo_cmc_sengoku3_cart>;
neogeo_cmc_sengoku3_cart::neogeo_cmc_sengoku3_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_SENGOKU3_CART, "Neo Geo Sengoku 3 CMC42 Cart", tag, owner, clock, "neocart_sengoku3", __FILE__)
{}
void neogeo_cmc_sengoku3_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, SENGOKU3_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
kof99k
**************************************************/
const device_type NEOGEO_CMC_KOF99K_CART = &device_creator<neogeo_cmc_kof99k_cart>;
neogeo_cmc_kof99k_cart::neogeo_cmc_kof99k_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_KOF99K_CART, "Neo Geo KOF 99 Korea CMC42 Cart", tag, owner, clock, "neocart_kof99k", __FILE__)
{}
void neogeo_cmc_kof99k_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, KOF99_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
kof2001
**************************************************/
const device_type NEOGEO_CMC_KOF2001_CART = &device_creator<neogeo_cmc_kof2001_cart>;
neogeo_cmc_kof2001_cart::neogeo_cmc_kof2001_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_KOF2001_CART, "Neo Geo KOF 2001 CMC50 Cart", tag, owner, clock, "neocart_kof2001", __FILE__)
{}
void neogeo_cmc_kof2001_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2001_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
kof2000n
**************************************************/
const device_type NEOGEO_CMC_KOF2000N_CART = &device_creator<neogeo_cmc_kof2000n_cart>;
neogeo_cmc_kof2000n_cart::neogeo_cmc_kof2000n_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_KOF2000N_CART, "Neo Geo KOF 2000 CMC50 Cart", tag, owner, clock, "neocart_kof2000n", __FILE__)
{}
void neogeo_cmc_kof2000n_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2000_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
jockeygp
**************************************************/
const device_type NEOGEO_CMC_JOCKEYGP_CART = &device_creator<neogeo_cmc_jockeygp_cart>;
neogeo_cmc_jockeygp_cart::neogeo_cmc_jockeygp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_cmc_cart(mconfig, NEOGEO_CMC_JOCKEYGP_CART, "Neo Geo Jockey GP CMC50 Cart", tag, owner, clock, "neocart_jockeygp", __FILE__)
{}
void neogeo_cmc_jockeygp_cart::device_start()
{
save_item(NAME(m_ram));
}
void neogeo_cmc_jockeygp_cart::device_reset()
{
memset(m_ram, 0, 0x2000);
}
void neogeo_cmc_jockeygp_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, JOCKEYGP_GFX_KEY);
m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}

View File

@ -1,17 +1,15 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_CMC_CART_H
#define __NEOGEO_CMC_CART_H
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_CMC_H
#define __NEOGEO_CMC_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "sma_prot.h"
#include "cmc_prot.h"
#include "slot.h"
#include "rom.h"
#include "prot_cmc.h"
// ======================> neogeo_cmc_cart
class neogeo_cmc_cart : public device_t,
public device_neogeo_cart_interface
class neogeo_cmc_cart : public neogeo_rom_device
{
public:
// construction/destruction
@ -24,14 +22,10 @@ public:
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual void activate_cart(ACTIVATE_CART_PARAMS) override { m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size); }
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override {}
virtual int get_fixed_bank_type(void) override { return 0; }
required_device<neogeo_banked_cart_device> m_banked_cart;
required_device<cmc_prot_device> m_cmc_prot;
required_device<cmc_prot_device> m_prot;
};
@ -41,7 +35,7 @@ extern const device_type NEOGEO_CMC_CART;
/*************************************************
ZUPAPA
zupapa
**************************************************/
class neogeo_cmc_zupapa_cart : public neogeo_cmc_cart
@ -54,7 +48,7 @@ public:
extern const device_type NEOGEO_CMC_ZUPAPA_CART;
/*************************************************
MSLUG3H
mslug3h
**************************************************/
class neogeo_cmc_mslug3h_cart : public neogeo_cmc_cart
@ -68,7 +62,7 @@ extern const device_type NEOGEO_CMC_MSLUG3H_CART;
/*************************************************
GANRYU
ganryu
**************************************************/
class neogeo_cmc_ganryu_cart : public neogeo_cmc_cart
@ -81,7 +75,7 @@ public:
extern const device_type NEOGEO_CMC_GANRYU_CART;
/*************************************************
S1945P
s1945p
**************************************************/
class neogeo_cmc_s1945p_cart : public neogeo_cmc_cart
@ -95,7 +89,7 @@ extern const device_type NEOGEO_CMC_S1945P_CART;
/*************************************************
PREISLE2
preisle2
**************************************************/
class neogeo_cmc_preisle2_cart : public neogeo_cmc_cart
@ -108,7 +102,7 @@ public:
extern const device_type NEOGEO_CMC_PREISLE2_CART;
/*************************************************
BANGBEAD
bangbead
**************************************************/
class neogeo_cmc_bangbead_cart : public neogeo_cmc_cart
@ -122,7 +116,7 @@ extern const device_type NEOGEO_CMC_BANGBEAD_CART;
/*************************************************
NITD
nitd
**************************************************/
class neogeo_cmc_nitd_cart : public neogeo_cmc_cart
@ -135,7 +129,7 @@ public:
extern const device_type NEOGEO_CMC_NITD_CART;
/*************************************************
SENGOKU3
sengoku3
**************************************************/
class neogeo_cmc_sengoku3_cart : public neogeo_cmc_cart
@ -148,7 +142,7 @@ public:
extern const device_type NEOGEO_CMC_SENGOKU3_CART;
/*************************************************
KOF99K
kof99k
**************************************************/
class neogeo_cmc_kof99k_cart : public neogeo_cmc_cart
@ -161,7 +155,7 @@ public:
extern const device_type NEOGEO_CMC_KOF99K_CART;
/*************************************************
KOF2001
kof2001
**************************************************/
class neogeo_cmc_kof2001_cart : public neogeo_cmc_cart
@ -174,7 +168,7 @@ public:
extern const device_type NEOGEO_CMC_KOF2001_CART;
/*************************************************
KOF2000N
kof2000n
**************************************************/
class neogeo_cmc_kof2000n_cart : public neogeo_cmc_cart
@ -187,5 +181,27 @@ public:
extern const device_type NEOGEO_CMC_KOF2000N_CART;
/*************************************************
jockeygp
**************************************************/
class neogeo_cmc_jockeygp_cart : public neogeo_cmc_cart
{
public:
neogeo_cmc_jockeygp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
virtual DECLARE_READ16_MEMBER(ram_r) override { return m_ram[offset]; }
virtual DECLARE_WRITE16_MEMBER(ram_w) override { COMBINE_DATA(&m_ram[offset]); }
virtual void device_start() override;
virtual void device_reset() override;
private:
UINT16 m_ram[0x1000];
};
extern const device_type NEOGEO_CMC_JOCKEYGP_CART;
#endif

View File

@ -1,223 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
/***********************************************************************************************************
NEOGEO ROM cart emulation
***********************************************************************************************************/
#include "emu.h"
#include "cmc_cart.h"
//-------------------------------------------------
// neogeo_cmc_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_CMC_CART = &device_creator<neogeo_cmc_cart>;
neogeo_cmc_cart::neogeo_cmc_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
m_cmc_prot(*this, "cmc_prot")
{
}
neogeo_cmc_cart::neogeo_cmc_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_CMC_CART, "NEOGEO SMA Cart", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
m_cmc_prot(*this, "cmc_prot")
{
}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_cmc_cart::device_start()
{
}
void neogeo_cmc_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_cmc_cart::read_rom)
{
return m_rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( cmc_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_CMC_PROT_ADD("cmc_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_cmc_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( cmc_cart );
}
/* Individual cartridge types (mirror DRIVER_INIT functionality) */
/*************************************************
Zupapa
**************************************************/
const device_type NEOGEO_CMC_ZUPAPA_CART = &device_creator<neogeo_cmc_zupapa_cart>;
neogeo_cmc_zupapa_cart::neogeo_cmc_zupapa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_ZUPAPA_CART, "NEOGEO CMC zupapa Cart", tag, owner, clock, "cmc_zupapa_cart", __FILE__) {}
void neogeo_cmc_zupapa_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, ZUPAPA_GFX_KEY);
}
/*************************************************
Zupapa
**************************************************/
const device_type NEOGEO_CMC_MSLUG3H_CART = &device_creator<neogeo_cmc_mslug3h_cart>;
neogeo_cmc_mslug3h_cart::neogeo_cmc_mslug3h_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_MSLUG3H_CART, "NEOGEO CMC mslug3h Cart", tag, owner, clock, "cmc_mslug3h_cart", __FILE__) {}
void neogeo_cmc_mslug3h_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, MSLUG3_GFX_KEY);
}
/*************************************************
Ganryu
**************************************************/
const device_type NEOGEO_CMC_GANRYU_CART = &device_creator<neogeo_cmc_ganryu_cart>;
neogeo_cmc_ganryu_cart::neogeo_cmc_ganryu_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_GANRYU_CART, "NEOGEO CMC ganryu Cart", tag, owner, clock, "cmc_ganryu_cart", __FILE__) {}
void neogeo_cmc_ganryu_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, GANRYU_GFX_KEY);
}
/*************************************************
S1945P
**************************************************/
const device_type NEOGEO_CMC_S1945P_CART = &device_creator<neogeo_cmc_s1945p_cart>;
neogeo_cmc_s1945p_cart::neogeo_cmc_s1945p_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_S1945P_CART, "NEOGEO CMC s1945p Cart", tag, owner, clock, "cmc_s1945p_cart", __FILE__) {}
void neogeo_cmc_s1945p_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, S1945P_GFX_KEY);
}
/*************************************************
PREISLE2
**************************************************/
const device_type NEOGEO_CMC_PREISLE2_CART = &device_creator<neogeo_cmc_preisle2_cart>;
neogeo_cmc_preisle2_cart::neogeo_cmc_preisle2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_PREISLE2_CART, "NEOGEO CMC preisle2 Cart", tag, owner, clock, "cmc_preisle2_cart", __FILE__) {}
void neogeo_cmc_preisle2_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, PREISLE2_GFX_KEY);
}
/*************************************************
BANGBEAD
**************************************************/
const device_type NEOGEO_CMC_BANGBEAD_CART = &device_creator<neogeo_cmc_bangbead_cart>;
neogeo_cmc_bangbead_cart::neogeo_cmc_bangbead_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_BANGBEAD_CART, "NEOGEO CMC bangbead Cart", tag, owner, clock, "cmc_bangbead_cart", __FILE__) {}
void neogeo_cmc_bangbead_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, BANGBEAD_GFX_KEY);
}
/*************************************************
NITD
**************************************************/
const device_type NEOGEO_CMC_NITD_CART = &device_creator<neogeo_cmc_nitd_cart>;
neogeo_cmc_nitd_cart::neogeo_cmc_nitd_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_NITD_CART, "NEOGEO CMC nitd Cart", tag, owner, clock, "cmc_nitd_cart", __FILE__) {}
void neogeo_cmc_nitd_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, NITD_GFX_KEY);
}
/*************************************************
SENGOKU3
**************************************************/
const device_type NEOGEO_CMC_SENGOKU3_CART = &device_creator<neogeo_cmc_sengoku3_cart>;
neogeo_cmc_sengoku3_cart::neogeo_cmc_sengoku3_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_SENGOKU3_CART, "NEOGEO CMC sengoku3 Cart", tag, owner, clock, "cmc_sengoku3_cart", __FILE__) {}
void neogeo_cmc_sengoku3_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, SENGOKU3_GFX_KEY);
}
/*************************************************
KOF99K
**************************************************/
const device_type NEOGEO_CMC_KOF99K_CART = &device_creator<neogeo_cmc_kof99k_cart>;
neogeo_cmc_kof99k_cart::neogeo_cmc_kof99k_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_KOF99K_CART, "NEOGEO CMC kof99k Cart", tag, owner, clock, "cmc_kof99k_cart", __FILE__) {}
void neogeo_cmc_kof99k_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF99_GFX_KEY);
}
/*************************************************
KOF2001
**************************************************/
const device_type NEOGEO_CMC_KOF2001_CART = &device_creator<neogeo_cmc_kof2001_cart>;
neogeo_cmc_kof2001_cart::neogeo_cmc_kof2001_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_KOF2001_CART, "NEOGEO CMC kof2001 Cart", tag, owner, clock, "cmc_kof2001_cart", __FILE__) {}
void neogeo_cmc_kof2001_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2001_GFX_KEY);
}
/*************************************************
KOF2000N
**************************************************/
const device_type NEOGEO_CMC_KOF2000N_CART = &device_creator<neogeo_cmc_kof2000n_cart>;
neogeo_cmc_kof2000n_cart::neogeo_cmc_kof2000n_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_cmc_cart(mconfig, NEOGEO_CMC_KOF2000N_CART, "NEOGEO CMC kof2000n Cart", tag, owner, clock, "cmc_kof2000n_cart", __FILE__) {}
void neogeo_cmc_kof2000n_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2000_GFX_KEY);
}

View File

@ -0,0 +1,53 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
Fatal Fury 2 cart type
***********************************************************************************************************/
#include "emu.h"
#include "fatfury2.h"
//-------------------------------------------------
// neogeo_fatfury2_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_FATFURY2_CART = &device_creator<neogeo_fatfury2_cart>;
neogeo_fatfury2_cart::neogeo_fatfury2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_rom_device(mconfig, NEOGEO_FATFURY2_CART, "Neo Geo Fatal Fury 2 Cart", tag, owner, clock, "neocart_fatfury2", __FILE__),
m_prot(*this, "fatfury2_prot")
{}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_fatfury2_cart::device_start()
{
}
void neogeo_fatfury2_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
static MACHINE_CONFIG_FRAGMENT( fatfury2_cart )
MCFG_FATFURY2_PROT_ADD("fatfury2_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_fatfury2_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( fatfury2_cart );
}

View File

@ -0,0 +1,37 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_FATFURY2_H
#define __NEOGEO_FATFURY2_H
#include "slot.h"
#include "rom.h"
#include "prot_fatfury2.h"
// ======================> neogeo_fatfury2_cart
class neogeo_fatfury2_cart : public neogeo_rom_device
{
public:
// construction/destruction
neogeo_fatfury2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_prot->protection_r(space, offset, mem_mask); }
virtual DECLARE_WRITE16_MEMBER(protection_w) override { m_prot->protection_w(space, offset, data, mem_mask); }
required_device<fatfury2_prot_device> m_prot;
};
// device type definition
extern const device_type NEOGEO_FATFURY2_CART;
#endif

View File

@ -1,75 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
/***********************************************************************************************************
NEOGEO ROM cart emulation
***********************************************************************************************************/
#include "emu.h"
#include "fatfury2_cart.h"
//-------------------------------------------------
// neogeo_fatfury2_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_FATFURY2_CART = &device_creator<neogeo_fatfury2_cart>;
neogeo_fatfury2_cart::neogeo_fatfury2_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface( mconfig, *this ),
m_banked_cart(*this, "banked_cart"),
m_fatfury2_prot(*this, "fatfury2_prot")
{
}
neogeo_fatfury2_cart::neogeo_fatfury2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_FATFURY2_CART, "NEOGEO Fatal Fury 2 Cart", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface( mconfig, *this ),
m_banked_cart(*this, "banked_cart"),
m_fatfury2_prot(*this, "fatfury2_prot")
{
}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_fatfury2_cart::device_start()
{
}
void neogeo_fatfury2_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_fatfury2_cart::read_rom)
{
return m_rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( fatfury2_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_FATFURY2_PROT_ADD("fatfury2_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_fatfury2_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( fatfury2_cart );
}
void neogeo_fatfury2_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_fatfury2_prot->fatfury2_install_protection(maincpu, m_banked_cart);
}

View File

@ -1,41 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_FATFURY2_CART_H
#define __NEOGEO_FATFURY2_CART_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "fatfury2_prot.h"
// ======================> neogeo_fatfury2_cart
class neogeo_fatfury2_cart : public device_t,
public device_neogeo_cart_interface
{
public:
// construction/destruction
neogeo_fatfury2_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source);
neogeo_fatfury2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual void activate_cart(ACTIVATE_CART_PARAMS) override;
required_device<neogeo_banked_cart_device> m_banked_cart;
required_device<fatfury2_prot_device> m_fatfury2_prot;
};
// device type definition
extern const device_type NEOGEO_FATFURY2_CART;
#endif

View File

@ -1,157 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
/***********************************************************************************************************
NEOGEO ROM cart emulation
***********************************************************************************************************/
#include "emu.h"
#include "kof2002_cart.h"
//-------------------------------------------------
// neogeo_kof2002_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_KOF2002_CART = &device_creator<neogeo_kof2002_cart>;
neogeo_kof2002_cart::neogeo_kof2002_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_kof2002_prot(*this, "kof2002_prot")
{
}
neogeo_kof2002_cart::neogeo_kof2002_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_KOF2002_CART, "NEOGEO KOF2002 Cart", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_kof2002_prot(*this, "kof2002_prot")
{
}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_kof2002_cart::device_start()
{
}
void neogeo_kof2002_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_kof2002_cart::read_rom)
{
return m_rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( kof2002_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_PCM2_PROT_ADD("pcm2_prot")
MCFG_KOF2002_PROT_ADD("kof2002_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_kof2002_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( kof2002_cart );
}
/* Individual cartridge types (mirror DRIVER_INIT functionality) */
/*************************************************
KOF2002
**************************************************/
const device_type NEOGEO_KOF2002_KOF2002_CART = &device_creator<neogeo_kof2002_kof2002_cart>;
neogeo_kof2002_kof2002_cart::neogeo_kof2002_kof2002_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_kof2002_cart(mconfig, NEOGEO_KOF2002_KOF2002_CART, "NEOGEO Kof2002-type kof2002 Cart", tag, owner, clock, "k2k_k2k_cart", __FILE__) {}
void neogeo_kof2002_kof2002_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2002_prot->kof2002_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2002_GFX_KEY);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 0);
}
const device_type NEOGEO_KOF2002_KF2K2PLS_CART = &device_creator<neogeo_kof2002_kf2k2pls_cart>;
neogeo_kof2002_kf2k2pls_cart::neogeo_kof2002_kf2k2pls_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_kof2002_cart(mconfig, NEOGEO_KOF2002_KF2K2PLS_CART, "NEOGEO Kof2002-type kof2002plus Cart", tag, owner, clock, "k2k_k2kpls_cart", __FILE__) {}
void neogeo_kof2002_kf2k2pls_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2002_prot->kof2002_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->cmc50_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2002_GFX_KEY);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region,audio_region_size);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 0);
}
/*************************************************
MATRIM
**************************************************/
const device_type NEOGEO_KOF2002_MATRIM_CART = &device_creator<neogeo_kof2002_matrim_cart>;
neogeo_kof2002_matrim_cart::neogeo_kof2002_matrim_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_kof2002_cart(mconfig, NEOGEO_KOF2002_MATRIM_CART, "NEOGEO Kof2002-type matrim Cart", tag, owner, clock, "k2k_matrim_cart", __FILE__) {}
void neogeo_kof2002_matrim_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2002_prot->matrim_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, MATRIM_GFX_KEY);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 1);
}
/*************************************************
SAMSHO5
**************************************************/
const device_type NEOGEO_KOF2002_SAMSHO5_CART = &device_creator<neogeo_kof2002_samsho5_cart>;
neogeo_kof2002_samsho5_cart::neogeo_kof2002_samsho5_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_kof2002_cart(mconfig, NEOGEO_KOF2002_SAMSHO5_CART, "NEOGEO Kof2002-type Samsho5 Cart", tag, owner, clock, "k2k_ss5_cart", __FILE__) {}
void neogeo_kof2002_samsho5_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2002_prot->samsho5_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, SAMSHO5_GFX_KEY);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 4);
}
/*************************************************
SAMSHO5SP
**************************************************/
const device_type NEOGEO_KOF2002_SAMSHO5SP_CART = &device_creator<neogeo_kof2002_samsho5sp_cart>;
neogeo_kof2002_samsho5sp_cart::neogeo_kof2002_samsho5sp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_kof2002_cart(mconfig, NEOGEO_KOF2002_SAMSHO5SP_CART, "NEOGEO Kof2002-type Samsho5sp Cart", tag, owner, clock, "k2k_ss5s_cart", __FILE__) {}
void neogeo_kof2002_samsho5sp_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2002_prot->samsh5sp_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, SAMSHO5SP_GFX_KEY);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 6);
}

View File

@ -1,111 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_KOF2002_CART_H
#define __NEOGEO_KOF2002_CART_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "pcm2_prot.h"
#include "cmc_prot.h"
#include "kof2002_prot.h"
// ======================> neogeo_kof2002_cart
class neogeo_kof2002_cart : public device_t,
public device_neogeo_cart_interface
{
public:
// construction/destruction
neogeo_kof2002_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source);
neogeo_kof2002_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual void activate_cart(ACTIVATE_CART_PARAMS) override { m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size); }
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override {}
virtual int get_fixed_bank_type(void) override { return 0; }
required_device<neogeo_banked_cart_device> m_banked_cart;
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<kof2002_prot_device> m_kof2002_prot;
};
// device type definition
extern const device_type NEOGEO_KOF2002_CART;
/*************************************************
KOF2002
**************************************************/
class neogeo_kof2002_kof2002_cart : public neogeo_kof2002_cart
{
public:
neogeo_kof2002_kof2002_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_KOF2002_KOF2002_CART;
class neogeo_kof2002_kf2k2pls_cart : public neogeo_kof2002_cart
{
public:
neogeo_kof2002_kf2k2pls_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_KOF2002_KF2K2PLS_CART;
/*************************************************
MATRIM
**************************************************/
class neogeo_kof2002_matrim_cart : public neogeo_kof2002_cart
{
public:
neogeo_kof2002_matrim_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 2; }
};
extern const device_type NEOGEO_KOF2002_MATRIM_CART;
/*************************************************
SAMSHO5
**************************************************/
class neogeo_kof2002_samsho5_cart : public neogeo_kof2002_cart
{
public:
neogeo_kof2002_samsho5_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
};
extern const device_type NEOGEO_KOF2002_SAMSHO5_CART;
/*************************************************
SAMSHO5SP
**************************************************/
class neogeo_kof2002_samsho5sp_cart : public neogeo_kof2002_cart
{
public:
neogeo_kof2002_samsho5sp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
};
extern const device_type NEOGEO_KOF2002_SAMSHO5SP_CART;
#endif

View File

@ -0,0 +1,160 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
The King of Fighers 2002 cart type (CMC + PCM2 + Additional CPU encryption)
***********************************************************************************************************/
#include "emu.h"
#include "kof2k2.h"
//-------------------------------------------------
// neogeo_kof2002_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_K2K2_CART = &device_creator<neogeo_kof2k2type_cart>;
neogeo_kof2k2type_cart::neogeo_kof2k2type_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source) :
neogeo_rom_device(mconfig, type, name, tag, owner, clock, shortname, source),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_kof2k2_prot(*this, "kof2002_prot")
{}
neogeo_kof2k2type_cart::neogeo_kof2k2type_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_rom_device(mconfig, NEOGEO_K2K2_CART, "Neo Geo KOF2002-Type Cart", tag, owner, clock, "neocart_k2k2", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_kof2k2_prot(*this, "kof2002_prot")
{}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_kof2k2type_cart::device_start()
{
}
void neogeo_kof2k2type_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
static MACHINE_CONFIG_FRAGMENT( kof2002_cart )
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_PCM2_PROT_ADD("pcm2_prot")
MCFG_KOF2002_PROT_ADD("kof2002_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_kof2k2type_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( kof2002_cart );
}
/*************************************************
kof2002
**************************************************/
const device_type NEOGEO_K2K2_KOF2002_CART = &device_creator<neogeo_kof2002_cart>;
neogeo_kof2002_cart::neogeo_kof2002_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_kof2k2type_cart(mconfig, NEOGEO_K2K2_KOF2002_CART, "Neo Geo KOF2002 Cart", tag, owner, clock, "neocart_kof2002", __FILE__)
{}
void neogeo_kof2002_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2k2_prot->kof2002_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2002_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
m_pcm2_prot->swap(ym_region, ym_region_size, 0);
}
const device_type NEOGEO_K2K2_KF2K2PLS_CART = &device_creator<neogeo_kf2k2pls_cart>;
/*************************************************
kf2k2pls
**************************************************/
neogeo_kf2k2pls_cart::neogeo_kf2k2pls_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_kof2k2type_cart(mconfig, NEOGEO_K2K2_KF2K2PLS_CART, "Neo Geo KOF2002 Plus Cart", tag, owner, clock, "neocart_kf2k2pls", __FILE__)
{}
void neogeo_kf2k2pls_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2k2_prot->kof2002_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2002_GFX_KEY);
m_pcm2_prot->swap(ym_region, ym_region_size, 0);
}
/*************************************************
matrim
**************************************************/
const device_type NEOGEO_K2K2_MATRIM_CART = &device_creator<neogeo_matrim_cart>;
neogeo_matrim_cart::neogeo_matrim_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_kof2k2type_cart(mconfig, NEOGEO_K2K2_MATRIM_CART, "Neo Geo Matrimelee Cart", tag, owner, clock, "neocart_matrim", __FILE__)
{}
void neogeo_matrim_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2k2_prot->matrim_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MATRIM_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
m_pcm2_prot->swap(ym_region, ym_region_size, 1);
}
/*************************************************
samsho5
**************************************************/
const device_type NEOGEO_K2K2_SAMSHO5_CART = &device_creator<neogeo_samsho5_cart>;
neogeo_samsho5_cart::neogeo_samsho5_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_kof2k2type_cart(mconfig, NEOGEO_K2K2_SAMSHO5_CART, "Neo Geo Samurai Shodown 5 Cart", tag, owner, clock, "neocart_samsho5", __FILE__)
{}
void neogeo_samsho5_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2k2_prot->samsho5_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, SAMSHO5_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
m_pcm2_prot->swap(ym_region, ym_region_size, 4);
}
/*************************************************
samsh5sp
**************************************************/
const device_type NEOGEO_K2K2_SAMSHO5SP_CART = &device_creator<neogeo_samsho5sp_cart>;
neogeo_samsho5sp_cart::neogeo_samsho5sp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_kof2k2type_cart(mconfig, NEOGEO_K2K2_SAMSHO5SP_CART, "Neo Geo Samurai Shodown 5 Special Cart", tag, owner, clock, "neocart_samsh5sp", __FILE__)
{}
void neogeo_samsho5sp_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof2k2_prot->samsh5sp_decrypt_68k(cpuregion, cpuregion_size);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, SAMSHO5SP_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
m_pcm2_prot->swap(ym_region, ym_region_size, 6);
}

View File

@ -0,0 +1,114 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_KOF2002_H
#define __NEOGEO_KOF2002_H
#include "slot.h"
#include "rom.h"
#include "prot_pcm2.h"
#include "prot_cmc.h"
#include "prot_kof2k2.h"
// ======================> neogeo_kof2002_cart
class neogeo_kof2k2type_cart : public neogeo_rom_device
{
public:
// construction/destruction
neogeo_kof2k2type_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source);
neogeo_kof2k2type_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override {}
virtual int get_fixed_bank_type(void) override { return 0; }
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<kof2002_prot_device> m_kof2k2_prot;
};
// device type definition
extern const device_type NEOGEO_K2K2_CART;
/*************************************************
kof2002
**************************************************/
class neogeo_kof2002_cart : public neogeo_kof2k2type_cart
{
public:
neogeo_kof2002_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_K2K2_KOF2002_CART;
class neogeo_kf2k2pls_cart : public neogeo_kof2k2type_cart
{
public:
neogeo_kf2k2pls_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_K2K2_KF2K2PLS_CART;
/*************************************************
matrim
**************************************************/
class neogeo_matrim_cart : public neogeo_kof2k2type_cart
{
public:
neogeo_matrim_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 2; }
};
extern const device_type NEOGEO_K2K2_MATRIM_CART;
/*************************************************
samsho5
**************************************************/
class neogeo_samsho5_cart : public neogeo_kof2k2type_cart
{
public:
neogeo_samsho5_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
};
extern const device_type NEOGEO_K2K2_SAMSHO5_CART;
/*************************************************
samsho5sp
**************************************************/
class neogeo_samsho5sp_cart : public neogeo_kof2k2type_cart
{
public:
neogeo_samsho5sp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
};
extern const device_type NEOGEO_K2K2_SAMSHO5SP_CART;
#endif

View File

@ -1,14 +1,15 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
NEOGEO ROM cart emulation
Neo Geo cart emulation
The King of Fighers '98 cart type
***********************************************************************************************************/
#include "emu.h"
#include "kof98_cart.h"
#include "kof98.h"
//-------------------------------------------------
@ -18,21 +19,10 @@
const device_type NEOGEO_KOF98_CART = &device_creator<neogeo_kof98_cart>;
neogeo_kof98_cart::neogeo_kof98_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface( mconfig, *this ),
m_banked_cart(*this, "banked_cart"),
m_kof98_prot(*this, "kof98_prot")
{
}
neogeo_kof98_cart::neogeo_kof98_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_KOF98_CART, "NEOGEO KOF98 Cart", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface( mconfig, *this ),
m_banked_cart(*this, "banked_cart"),
m_kof98_prot(*this, "kof98_prot")
{
}
neogeo_kof98_cart::neogeo_kof98_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_rom_device(mconfig, NEOGEO_KOF98_CART, "Neo Geo KOF 98 Cart", tag, owner, clock, "neocart_kof98", __FILE__),
m_prot(*this, "kof98_prot")
{}
//-------------------------------------------------
@ -52,15 +42,8 @@ void neogeo_kof98_cart::device_reset()
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_kof98_cart::read_rom)
{
return m_rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( kof98_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_KOF98_PROT_ADD("kof98_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_kof98_cart::device_mconfig_additions() const
@ -70,11 +53,5 @@ machine_config_constructor neogeo_kof98_cart::device_mconfig_additions() const
void neogeo_kof98_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_kof98_prot->kof98_decrypt_68k(cpuregion, cpuregion_size);
}
void neogeo_kof98_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_kof98_prot->install_kof98_protection(maincpu);
m_prot->decrypt_68k(cpuregion, cpuregion_size);
}

View File

@ -0,0 +1,39 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_KOF98_H
#define __NEOGEO_KOF98_H
#include "slot.h"
#include "rom.h"
#include "prot_kof98.h"
// ======================> neogeo_kof98_cart
class neogeo_kof98_cart : public neogeo_rom_device
{
public:
// construction/destruction
neogeo_kof98_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_prot->protection_r(space, offset, mem_mask); }
virtual DECLARE_WRITE16_MEMBER(protection_w) override { m_prot->protection_w(space, offset, data, mem_mask); }
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
required_device<kof98_prot_device> m_prot;
};
// device type definition
extern const device_type NEOGEO_KOF98_CART;
#endif

View File

@ -1,41 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_KOF98_CART_H
#define __NEOGEO_KOF98_CART_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "kof98_prot.h"
// ======================> neogeo_kof98_cart
class neogeo_kof98_cart : public device_t,
public device_neogeo_cart_interface
{
public:
// construction/destruction
neogeo_kof98_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source);
neogeo_kof98_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual void activate_cart(ACTIVATE_CART_PARAMS) override;
required_device<neogeo_banked_cart_device> m_banked_cart;
required_device<kof98_prot_device> m_kof98_prot;
};
// device type definition
extern const device_type NEOGEO_KOF98_CART;
#endif

View File

@ -1,142 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#include "emu.h"
#include "kof98_prot.h"
extern const device_type KOF98_PROT = &device_creator<kof98_prot_device>;
kof98_prot_device::kof98_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, KOF98_PROT, "NeoGeo Protection (KOF98)", tag, owner, clock, "kof98_prot", __FILE__),
kof98_prot_state(0)
{
}
void kof98_prot_device::device_start()
{
}
void kof98_prot_device::device_reset()
{
kof98_prot_state = 0;
}
/* Kof98 uses an early encryption, quite different from the others */
void kof98_prot_device::kof98_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
{
UINT8 *src = cpurom;
dynamic_buffer dst(0x200000);
int i, j, k;
static const UINT32 sec[]={0x000000,0x100000,0x000004,0x100004,0x10000a,0x00000a,0x10000e,0x00000e};
static const UINT32 pos[]={0x000,0x004,0x00a,0x00e};
memcpy( &dst[0], src, 0x200000);
for( i=0x800; i<0x100000; i+=0x200 )
{
for( j=0; j<0x100; j+=0x10 )
{
for( k=0; k<16; k+=2)
{
memcpy( &src[i+j+k], &dst[ i+j+sec[k/2]+0x100 ], 2 );
memcpy( &src[i+j+k+0x100], &dst[ i+j+sec[k/2] ], 2 );
}
if( i >= 0x080000 && i < 0x0c0000)
{
for( k=0; k<4; k++ )
{
memcpy( &src[i+j+pos[k]], &dst[i+j+pos[k]], 2 );
memcpy( &src[i+j+pos[k]+0x100], &dst[i+j+pos[k]+0x100], 2 );
}
}
else if( i >= 0x0c0000 )
{
for( k=0; k<4; k++ )
{
memcpy( &src[i+j+pos[k]], &dst[i+j+pos[k]+0x100], 2 );
memcpy( &src[i+j+pos[k]+0x100], &dst[i+j+pos[k]], 2 );
}
}
}
memcpy( &src[i+0x000000], &dst[i+0x000000], 2 );
memcpy( &src[i+0x000002], &dst[i+0x100000], 2 );
memcpy( &src[i+0x000100], &dst[i+0x000100], 2 );
memcpy( &src[i+0x000102], &dst[i+0x100100], 2 );
}
memmove( &src[0x100000], &src[0x200000], 0x400000 );
UINT16* mem16 = (UINT16*)cpurom;
m_default_rom[0] = mem16[0x100 / 2];
m_default_rom[1] = mem16[0x102 / 2];
}
/************************ King of Fighters 98*******************
The encrypted set has a rom overlay feature, checked at
various points in the game.
Boards used: NEO-MVS PROGSF1 (1998.6.17) / NEO-MVS PROGSF1E (1998.6.18)
The boards have an ALTERA chip (EPM7128SQC100-15) which is tied to 242-P1
***************************************************************/
READ16_MEMBER(kof98_prot_device::kof98_prot_r)
{
if (kof98_prot_state == 1)
{
if (!offset)
return 0x00c2;
else
return 0x00fd;
}
if (kof98_prot_state == 2)
{
if (!offset)
return 0x4e45;
else
return 0x4f2d;
}
if (!offset)
return m_default_rom[0];
else
return m_default_rom[1];
// never executed
//return 0xffff;
}
WRITE16_MEMBER( kof98_prot_device::kof98_prot_w )
{
/* info from razoola */
switch (data)
{
case 0x0090:
logerror ("%06x kof98 - protection 0x0090x\n", space.device().safe_pc());
kof98_prot_state = 1;
break;
case 0x00f0:
logerror ("%06x kof98 - protection 0x00f0x\n", space.device().safe_pc());
kof98_prot_state = 2;
break;
default: // 00aa is written, but not needed?
logerror ("%06x kof98 - unknown protection write %04x\n", space.device().safe_pc(), data);
break;
}
}
void kof98_prot_device::install_kof98_protection(cpu_device* maincpu)
{
/* when 0x20aaaa contains 0x0090 (word) then 0x100 (normally the neogeo header) should return 0x00c200fd worked out using real hw */
maincpu->space(AS_PROGRAM).install_read_handler(0x00100, 0x00103, read16_delegate(FUNC(kof98_prot_device::kof98_prot_r),this));
maincpu->space(AS_PROGRAM).install_write_handler(0x20aaaa, 0x20aaab, write16_delegate(FUNC(kof98_prot_device::kof98_prot_w),this));
}

View File

@ -1,118 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#include "emu.h"
#include "kog_prot.h"
extern const device_type KOG_PROT = &device_creator<kog_prot_device>;
kog_prot_device::kog_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, KOG_PROT, "NeoGeo Protection (King of Gladiator)", tag, owner, clock, "kog_prot", __FILE__),
m_jumper(*this, "JUMPER")
{
}
void kog_prot_device::device_start()
{
}
void kog_prot_device::device_reset()
{
}
READ16_MEMBER(kog_prot_device::read_jumper)
{
return ioport("JUMPER")->read();
}
void kog_prot_device::kog_install_protection(cpu_device* maincpu)
{
/* overlay cartridge ROM */
maincpu->space(AS_PROGRAM).install_read_handler(0x0ffffe, 0x0fffff, read16_delegate(FUNC(kog_prot_device::read_jumper), this));
}
/* The King of Gladiator (The King of Fighters '97 bootleg) */
/* The protection patching here may be incomplete
Thanks to Razoola for the info */
void kog_prot_device::kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
/* the protection chip does some *very* strange things to the rom */
UINT8 *src = cpurom;
dynamic_buffer dst( 0x600000 );
UINT16 *rom = (UINT16 *)cpurom;
int i;
static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD };
for (i = 0; i < 8; i++){
memcpy (&dst[i * 0x20000], src + sec[i] * 0x20000, 0x20000);
}
memcpy (&dst[0x0007A6], src + 0x0407A6, 0x000006);
memcpy (&dst[0x0007C6], src + 0x0407C6, 0x000006);
memcpy (&dst[0x0007E6], src + 0x0407E6, 0x000006);
memcpy (&dst[0x090000], src + 0x040000, 0x004000);
memcpy (&dst[0x100000], src + 0x200000, 0x400000);
memcpy (src, &dst[0], 0x600000);
for (i = 0x90000/2; i < 0x94000/2; i++){
if (((rom[i]&0xFFBF) == 0x4EB9 || rom[i] == 0x43F9) && !rom[i + 1])
rom[i + 1] = 0x0009;
if (rom[i] == 0x4EB8)
rom[i] = 0x6100;
}
rom[0x007A8/2] = 0x0009;
rom[0x007C8/2] = 0x0009;
rom[0x007E8/2] = 0x0009;
rom[0x93408/2] = 0xF168;
rom[0x9340C/2] = 0xFB7A;
rom[0x924AC/2] = 0x0009;
rom[0x9251C/2] = 0x0009;
rom[0x93966/2] = 0xFFDA;
rom[0x93974/2] = 0xFFCC;
rom[0x93982/2] = 0xFFBE;
rom[0x93990/2] = 0xFFB0;
rom[0x9399E/2] = 0xFFA2;
rom[0x939AC/2] = 0xFF94;
rom[0x939BA/2] = 0xFF86;
rom[0x939C8/2] = 0xFF78;
rom[0x939D4/2] = 0xFA5C;
rom[0x939E0/2] = 0xFA50;
rom[0x939EC/2] = 0xFA44;
rom[0x939F8/2] = 0xFA38;
rom[0x93A04/2] = 0xFA2C;
rom[0x93A10/2] = 0xFA20;
rom[0x93A1C/2] = 0xFA14;
rom[0x93A28/2] = 0xFA08;
rom[0x93A34/2] = 0xF9FC;
rom[0x93A40/2] = 0xF9F0;
rom[0x93A4C/2] = 0xFD14;
rom[0x93A58/2] = 0xFD08;
rom[0x93A66/2] = 0xF9CA;
rom[0x93A72/2] = 0xF9BE;
}
static INPUT_PORTS_START( kog )
/* a jumper on the pcb overlays a ROM address, very strange but that's how it works. */
PORT_START("JUMPER")
PORT_DIPNAME( 0x0001, 0x0001, "Title Language" ) PORT_DIPLOCATION("CART-JUMPER:1")
PORT_DIPSETTING( 0x0001, DEF_STR( English ) )
PORT_DIPSETTING( 0x0000, "Non-English" )
PORT_BIT( 0x00fe, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
ioport_constructor kog_prot_device::device_input_ports() const
{
return INPUT_PORTS_NAME( kog );
}

View File

@ -1,34 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#pragma once
#ifndef __KOG_PROT__
#define __KOG_PROT__
extern const device_type KOG_PROT;
#define MCFG_KOG_PROT_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, KOG_PROT, 0)
class kog_prot_device : public device_t
{
public:
// construction/destruction
kog_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void kog_install_protection(cpu_device* maincpu);
void kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
READ16_MEMBER(read_jumper);
required_ioport m_jumper;
protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual ioport_constructor device_input_ports() const override;
};
#endif

View File

@ -1,14 +1,15 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
NEOGEO ROM cart emulation
Neo Geo cart emulation
Metal Slug X cart type
***********************************************************************************************************/
#include "emu.h"
#include "mslugx_cart.h"
#include "mslugx.h"
//-------------------------------------------------
@ -18,21 +19,10 @@
const device_type NEOGEO_MSLUGX_CART = &device_creator<neogeo_mslugx_cart>;
neogeo_mslugx_cart::neogeo_mslugx_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface( mconfig, *this ),
m_banked_cart(*this, "banked_cart"),
m_mslugx_prot(*this, "mslugx_prot")
{
}
neogeo_mslugx_cart::neogeo_mslugx_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_MSLUGX_CART, "NEOGEO Metal Slug X Cart", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface( mconfig, *this ),
m_banked_cart(*this, "banked_cart"),
m_mslugx_prot(*this, "mslugx_prot")
{
}
neogeo_mslugx_cart::neogeo_mslugx_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_rom_device(mconfig, NEOGEO_MSLUGX_CART, "Neo Geo Metal Slug X Cart", tag, owner, clock, "neocart_mslugx", __FILE__),
m_prot(*this, "mslugx_prot")
{}
//-------------------------------------------------
@ -52,15 +42,8 @@ void neogeo_mslugx_cart::device_reset()
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_mslugx_cart::read_rom)
{
return m_rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( mslugx_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_MSLUGX_PROT_ADD("mslugx_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_mslugx_cart::device_mconfig_additions() const
@ -68,8 +51,3 @@ machine_config_constructor neogeo_mslugx_cart::device_mconfig_additions() const
return MACHINE_CONFIG_NAME( mslugx_cart );
}
void neogeo_mslugx_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_mslugx_prot->mslugx_install_protection(maincpu);
}

View File

@ -0,0 +1,37 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_MSLUGX_CART_H
#define __NEOGEO_MSLUGX_CART_H
#include "slot.h"
#include "rom.h"
#include "prot_mslugx.h"
// ======================> neogeo_mslugx_cart
class neogeo_mslugx_cart : public neogeo_rom_device
{
public:
// construction/destruction
neogeo_mslugx_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_prot->protection_r(space, offset, mem_mask); }
virtual DECLARE_WRITE16_MEMBER(protection_w) override { m_prot->protection_w(space, offset, data, mem_mask); }
required_device<mslugx_prot_device> m_prot;
};
// device type definition
extern const device_type NEOGEO_MSLUGX_CART;
#endif

View File

@ -1,41 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_MSLUGX_CART_H
#define __NEOGEO_MSLUGX_CART_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "mslugx_prot.h"
// ======================> neogeo_mslugx_cart
class neogeo_mslugx_cart : public device_t,
public device_neogeo_cart_interface
{
public:
// construction/destruction
neogeo_mslugx_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source);
neogeo_mslugx_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual void activate_cart(ACTIVATE_CART_PARAMS) override;
required_device<neogeo_banked_cart_device> m_banked_cart;
required_device<mslugx_prot_device> m_mslugx_prot;
};
// device type definition
extern const device_type NEOGEO_MSLUGX_CART;
#endif

View File

@ -1,97 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
/**********************************************************************
**********************************************************************/
#include "neogeo_carts.h"
SLOT_INTERFACE_START(neogeo_cart)
/* Standard cart with banking */
SLOT_INTERFACE_INTERNAL("rom", NEOGEO_ROM)
/* Custom MslugX protection*/
SLOT_INTERFACE_INTERNAL("rom_mslugx", NEOGEO_MSLUGX_CART)
/* Custom Fatal Fury 2 protection */
SLOT_INTERFACE_INTERNAL("rom_fatfur2", NEOGEO_FATFURY2_CART)
/* Custom KOF98 protection */
SLOT_INTERFACE_INTERNAL("rom_kof98", NEOGEO_KOF98_CART)
/* These use SMA for prg + CMC42 for gfx */
SLOT_INTERFACE_INTERNAL("rom_sma", NEOGEO_SMA_CART)
SLOT_INTERFACE_INTERNAL("rom_sma_kof99", NEOGEO_SMA_KOF99_CART)
SLOT_INTERFACE_INTERNAL("rom_sma_garou", NEOGEO_SMA_GAROU_CART)
SLOT_INTERFACE_INTERNAL("rom_sma_garouh", NEOGEO_SMA_GAROUH_CART)
SLOT_INTERFACE_INTERNAL("rom_sma_mslug3", NEOGEO_SMA_MSLUG3_CART)
/* These use SMA for prg + CMC50 for gfx (& audiocpu) */
SLOT_INTERFACE_INTERNAL("rom_sma_kof2000", NEOGEO_SMA_KOF2000_CART)
/* only CMC42 for gfx */
SLOT_INTERFACE_INTERNAL("rom_cmc_zupapa", NEOGEO_CMC_ZUPAPA_CART)
SLOT_INTERFACE_INTERNAL("rom_cmc_mslug3h", NEOGEO_CMC_MSLUG3H_CART)
SLOT_INTERFACE_INTERNAL("rom_cmc_ganryu", NEOGEO_CMC_GANRYU_CART)
SLOT_INTERFACE_INTERNAL("rom_cmc_s1945p", NEOGEO_CMC_S1945P_CART)
SLOT_INTERFACE_INTERNAL("r_cmc_preisle2", NEOGEO_CMC_PREISLE2_CART)
SLOT_INTERFACE_INTERNAL("r_cmc_bangbead", NEOGEO_CMC_BANGBEAD_CART)
SLOT_INTERFACE_INTERNAL("rom_cmc_nitd", NEOGEO_CMC_NITD_CART)
SLOT_INTERFACE_INTERNAL("r_cmc_sengoku3", NEOGEO_CMC_SENGOKU3_CART)
SLOT_INTERFACE_INTERNAL("r_cmc_kof99k", NEOGEO_CMC_KOF99K_CART)
/* only CMC50 for gfx (& audiocpu) */
SLOT_INTERFACE_INTERNAL("r_cmc_kof2001", NEOGEO_CMC_KOF2001_CART)
SLOT_INTERFACE_INTERNAL("r_cmc_kof2000n", NEOGEO_CMC_KOF2000N_CART)
/* CMC50 for gfx (& audiocpu) + NEOPCM2 for YM scramble */
SLOT_INTERFACE_INTERNAL("r_pc2_mslug4", NEOGEO_PCM2_MSLUG4_CART)
SLOT_INTERFACE_INTERNAL("r_pc2_rotd", NEOGEO_PCM2_ROTD_CART)
SLOT_INTERFACE_INTERNAL("r_pc2_pnyaa", NEOGEO_PCM2_PNYAA_CART)
SLOT_INTERFACE_INTERNAL("r_ms4plus", NEOGEO_PCM2_MS4PLUS_CART) // regular encryption but external S1 rom
/* CMC50 for gfx (& audiocpu) + NEOPCM2 for YM scramble + additonal prg scramble */
SLOT_INTERFACE_INTERNAL("r_k2_kof2002", NEOGEO_KOF2002_KOF2002_CART)
SLOT_INTERFACE_INTERNAL("r_k2_matrim", NEOGEO_KOF2002_MATRIM_CART)
SLOT_INTERFACE_INTERNAL("r_k2_samsh5", NEOGEO_KOF2002_SAMSHO5_CART)
SLOT_INTERFACE_INTERNAL("r_k2_sams5s", NEOGEO_KOF2002_SAMSHO5SP_CART)
SLOT_INTERFACE_INTERNAL("r_kf2k2pls", NEOGEO_KOF2002_KF2K2PLS_CART) // regular encryption but external S1 rom
/* CMC50 for gfx (& audiocpu) + NEOPCM2 for YM scramble + PVC protection/encryption */
SLOT_INTERFACE_INTERNAL("r_pv_mslug5", NEOGEO_PVC_MSLUG5_CART)
SLOT_INTERFACE_INTERNAL("r_pv_svc", NEOGEO_PVC_SVC_CART)
SLOT_INTERFACE_INTERNAL("r_pv_kf2k3", NEOGEO_PVC_KOF2003_CART)
SLOT_INTERFACE_INTERNAL("r_pv_kf2k3h", NEOGEO_PVC_KOF2003H_CART)
/* 100% bootleg logic */
SLOT_INTERFACE_INTERNAL("r_garoubl", NEOGEO_BOOTLEG_GAROUBL_CART)
SLOT_INTERFACE_INTERNAL("r_cthd2003", NEOGEO_BOOTLEG_CTHD2003_CART)
SLOT_INTERFACE_INTERNAL("r_cthd2003sp", NEOGEO_BOOTLEG_CT2K3SP_CART)
SLOT_INTERFACE_INTERNAL("r_cthd2003sa", NEOGEO_BOOTLEG_CT2K3SA_CART)
SLOT_INTERFACE_INTERNAL("r_kf10thep", NEOGEO_BOOTLEG_KF10THEP_CART)
SLOT_INTERFACE_INTERNAL("r_kf2k5uni", NEOGEO_BOOTLEG_KF2K5UNI_CART)
SLOT_INTERFACE_INTERNAL("r_kf2k4se", NEOGEO_BOOTLEG_KF2K4SE_CART)
SLOT_INTERFACE_INTERNAL("r_svcplus", NEOGEO_BOOTLEG_SVCPLUS_CART)
SLOT_INTERFACE_INTERNAL("r_svcplusa", NEOGEO_BOOTLEG_SVCPLUSA_CART)
SLOT_INTERFACE_INTERNAL("r_samsho5b", NEOGEO_BOOTLEG_SAMSHO5B_CART)
SLOT_INTERFACE_INTERNAL("r_kof97oro", NEOGEO_BOOTLEG_KOF97ORO_CART) // missing from softlist?
SLOT_INTERFACE_INTERNAL("r_lans2004", NEOGEO_BOOTLEG_LANS2004_CART)
SLOT_INTERFACE_INTERNAL("r_kof10th", NEOGEO_BOOTLEG_KOF10TH_CART)
SLOT_INTERFACE_INTERNAL("r_kog", NEOGEO_BOOTLEG_KOG_CART)
/* mixed original and bootleg logic */
SLOT_INTERFACE_INTERNAL("r_mslug3b6", NEOGEO_BOOTLEG_HYBRID_MSLUG3B6_CART)
SLOT_INTERFACE_INTERNAL("r_kof2002b", NEOGEO_BOOTLEG_HYBRID_KOF2002B_CART)
SLOT_INTERFACE_INTERNAL("r_kf2k2mp", NEOGEO_BOOTLEG_HYBRID_KF2K2MP_CART)
SLOT_INTERFACE_INTERNAL("r_kf2k2mp2", NEOGEO_BOOTLEG_HYBRID_KF2K2MP2_CART)
SLOT_INTERFACE_INTERNAL("r_matrimbl", NEOGEO_BOOTLEG_HYBRID_MATRIMBL_CART)
SLOT_INTERFACE_INTERNAL("r_ms5plus", NEOGEO_BOOTLEG_HYBRID_MS5PLUS_CART)
SLOT_INTERFACE_INTERNAL("r_svcboot", NEOGEO_BOOTLEG_HYBRID_SVCBOOT_CART)
SLOT_INTERFACE_INTERNAL("r_svcsplus", NEOGEO_BOOTLEG_HYBRID_SVCSPLUS_CART)
SLOT_INTERFACE_INTERNAL("r_kf2k3bl", NEOGEO_BOOTLEG_HYBRID_KF2K3BL_CART)
SLOT_INTERFACE_INTERNAL("r_kf2k3pl", NEOGEO_BOOTLEG_HYBRID_KF2K3PL_CART)
SLOT_INTERFACE_INTERNAL("r_kf2k3upl", NEOGEO_BOOTLEG_HYBRID_KF2K3UPL_CART)
SLOT_INTERFACE_END

View File

@ -1,34 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#include "emu.h"
#include "neogeo_intf.h"
//-------------------------------------------------
// device_neogeo_cart_interface - constructor
//-------------------------------------------------
device_neogeo_cart_interface::device_neogeo_cart_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device),
m_sprite_gfx_address_mask(0)
/*
m_rom(nullptr),
m_fixed(nullptr),
m_sprites(nullptr),
m_sprites_optimized(nullptr),
m_audio(nullptr),
m_ym(nullptr),
m_ymdelta(nullptr),
m_audiocrypt(nullptr)
*/
{
}
//-------------------------------------------------
// ~device_neogeo_cart_interface - destructor
//-------------------------------------------------
device_neogeo_cart_interface::~device_neogeo_cart_interface()
{
}

View File

@ -1,78 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_INTF_H
#define __NEOGEO_INTF_H
// ======================> device_neogeo_cart_interface
#define DECRYPT_ALL_PARAMS \
UINT8* cpuregion, UINT32 cpuregion_size,UINT8* spr_region, UINT32 spr_region_size,UINT8* fix_region, UINT32 fix_region_size,UINT8* ym_region, UINT32 ym_region_size,UINT8* ymdelta_region, UINT32 ymdelta_region_size,UINT8* audiocpu_region, UINT32 audio_region_size, UINT8* audiocrypt_region, UINT32 audiocrypt_region_size
#define ACTIVATE_CART_PARAMS \
running_machine& machine, cpu_device* maincpu, UINT8* cpuregion, UINT32 cpuregion_size, UINT8* fixedregion, UINT32 fixedregion_size
class device_neogeo_cart_interface : public device_slot_card_interface
{
public:
// construction/destruction
device_neogeo_cart_interface(const machine_config &mconfig, device_t &device);
virtual ~device_neogeo_cart_interface();
// reading from ROM
virtual DECLARE_READ16_MEMBER(read_rom) { return 0xffff; }
virtual void activate_cart(ACTIVATE_CART_PARAMS) { };
virtual void decrypt_all(DECRYPT_ALL_PARAMS) { };
virtual int get_fixed_bank_type(void) { return 0; }
void rom_alloc(UINT32 size) { m_rom.resize(size/sizeof(UINT16)); }
UINT16* get_rom_base() { return &m_rom[0]; }
UINT32 get_rom_size() { return m_rom.size()*sizeof(UINT16); }
void fixed_alloc(UINT32 size) { m_fixed.resize(size); }
UINT8* get_fixed_base() { return &m_fixed[0]; }
UINT32 get_fixed_size() { return m_fixed.size(); }
void audio_alloc(UINT32 size) { m_audio.resize(size); }
UINT8* get_audio_base() { return &m_audio[0]; }
UINT32 get_audio_size() { return m_audio.size(); }
void audiocrypt_alloc(UINT32 size) { m_audiocrypt.resize(size); }
UINT8* get_audiocrypt_base() { if (m_audiocrypt.size() == 0) return nullptr; else return &m_audiocrypt[0]; }
UINT32 get_audiocrypt_size() { return m_audiocrypt.size(); }
void sprites_alloc(UINT32 size) { m_sprites.resize(size); }
UINT8* get_sprites_base() { return &m_sprites[0]; }
UINT32 get_sprites_size() { return m_sprites.size(); }
UINT8* get_sprites_optimized() { return &m_sprites_optimized[0]; }
UINT32 get_sprites_addrmask() { return m_sprite_gfx_address_mask; }
std::vector<UINT8>& get_sprites_optimized_arr() { return m_sprites_optimized; }
void ym_alloc(UINT32 size) { m_ym.resize(size); }
UINT8* get_ym_base() { return &m_ym[0]; }
UINT32 get_ym_size() { return m_ym.size(); }
void ymdelta_alloc(UINT32 size) { m_ymdelta.resize(size); }
UINT8* get_ymdelta_base() { return &m_ymdelta[0]; }
UINT32 get_ymdelta_size() { return m_ymdelta.size(); }
std::vector<UINT16> m_rom;
std::vector<UINT8> m_fixed;
std::vector<UINT8> m_sprites;
std::vector<UINT8> m_sprites_optimized;
std::vector<UINT8> m_audio;
std::vector<UINT8> m_ym;
std::vector<UINT8> m_ymdelta;
UINT32 m_sprite_gfx_address_mask;
protected:
// internal state
std::vector<UINT8> m_audiocrypt;
};
#endif

View File

@ -1,222 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
/***********************************************************************************************************
***********************************************************************************************************/
#include "emu.h"
#include "neogeo_slot.h"
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type NEOGEO_CART_SLOT = &device_creator<neogeo_cart_slot_device>;
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// neogeo_cart_slot_device - constructor
//-------------------------------------------------
neogeo_cart_slot_device::neogeo_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
device_t(mconfig, NEOGEO_CART_SLOT, "NeoGeo Cartridge Slot", tag, owner, clock, "neogeo_cart_slot", __FILE__),
device_image_interface(mconfig, *this),
device_slot_interface(mconfig, *this),
m_cart(nullptr)
{
}
//-------------------------------------------------
// neogeo_cart_slot_device - destructor
//-------------------------------------------------
neogeo_cart_slot_device::~neogeo_cart_slot_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void neogeo_cart_slot_device::device_start()
{
m_cart = dynamic_cast<device_neogeo_cart_interface *>(get_card_device());
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void neogeo_cart_slot_device::device_config_complete()
{
// set brief and instance name
update_names();
}
/*-------------------------------------------------
call load
-------------------------------------------------*/
bool neogeo_cart_slot_device::call_load()
{
if (m_cart)
{
UINT16 *ROM;
UINT8* ROM8;
UINT32 len;
if (software_entry() != nullptr)
{
// create memory regions
len = get_software_region_length("maincpu");
m_cart->rom_alloc(len); ROM = m_cart->get_rom_base();
memcpy(ROM, get_software_region("maincpu"), len);
len = get_software_region_length("fixed");
m_cart->fixed_alloc(len); ROM8 = m_cart->get_fixed_base();
memcpy(ROM8, get_software_region("fixed"), len);
if (get_software_region("audiocpu") != nullptr)
{
len = get_software_region_length("audiocpu");
m_cart->audio_alloc(len + 0x10000); ROM8 = m_cart->get_audio_base();
memcpy(ROM8, get_software_region("audiocpu"), len);
memcpy(ROM8 + 0x10000, get_software_region("audiocpu"), len); // avoid reloading in XML, should just improve banking instead tho?
}
len = get_software_region_length("ymsnd");
m_cart->ym_alloc(len); ROM8 = m_cart->get_ym_base();
memcpy(ROM8, get_software_region("ymsnd"), len);
if (get_software_region("ymsnd.deltat") != nullptr)
{
len = get_software_region_length("ymsnd.deltat");
m_cart->ymdelta_alloc(len); ROM8 = m_cart->get_ymdelta_base();
memcpy(ROM8, get_software_region("ymsnd.deltat"), len);
}
else
{
// ensure there is no delta-t region
}
len = get_software_region_length("sprites");
m_cart->sprites_alloc(len); ROM8 = m_cart->get_sprites_base();
memcpy(ROM8, get_software_region("sprites"), len);
if (get_software_region("audiocrypt") != nullptr) // encrypted Z80 code
{
len = get_software_region_length("audiocrypt");
m_cart->audiocrypt_alloc(len); ROM8 = m_cart->get_audiocrypt_base();
memcpy(ROM8, get_software_region("audiocrypt"), len);
// allocate the audiocpu region to decrypt data into
m_cart->audio_alloc(len + 0x10000);
}
m_cart->decrypt_all(
(UINT8*)m_cart->get_rom_base(), m_cart->get_rom_size(),
m_cart->get_sprites_base(), m_cart->get_sprites_size(),
m_cart->get_fixed_base(), m_cart->get_fixed_size(),
m_cart->get_ym_base(), m_cart->get_ym_size(),
m_cart->get_ymdelta_base(), m_cart->get_ymdelta_size(),
m_cart->get_audio_base(), m_cart->get_audio_size(),
m_cart->get_audiocrypt_base(), m_cart->get_audiocrypt_size());
// create optimized sprite cache
m_cart->m_sprite_gfx_address_mask = neogeohelper_optimize_sprite_data(m_cart->get_sprites_optimized_arr(), m_cart->get_sprites_base(), m_cart->get_sprites_size());
return IMAGE_INIT_PASS;
}
}
return IMAGE_INIT_PASS;
}
void neogeo_cart_slot_device::setup_memory_banks(running_machine &machine)
{
UINT16* base16 = get_rom_base();
UINT32 size = get_rom_size();
machine.memory().region_free(":maincpu");
machine.memory().region_alloc(":maincpu",size,2, ENDIANNESS_BIG);
memcpy(memregion(":maincpu")->base(),(UINT8*)base16,size);
UINT8* base = get_audio_base();
size = get_audio_size();
machine.memory().region_free(":audiocpu");
machine.memory().region_alloc(":audiocpu",size,1, ENDIANNESS_LITTLE);
memcpy(memregion(":audiocpu")->base(),base,size);
base = get_ym_base();
size = get_ym_size();
machine.memory().region_free(":ymsnd");
machine.memory().region_alloc(":ymsnd",size,1, ENDIANNESS_LITTLE);
memcpy(memregion(":ymsnd")->base(),base,size);
base = get_ymdelta_base();
size = get_ymdelta_size();
machine.memory().region_free(":ymsnd.deltat");
if(base)
{
machine.memory().region_alloc(":ymsnd.deltat",size,1, ENDIANNESS_LITTLE);
memcpy(memregion(":ymsnd.deltat")->base(),base,size);
}
}
/*-------------------------------------------------
call_unload
-------------------------------------------------*/
void neogeo_cart_slot_device::call_unload()
{
}
/*-------------------------------------------------
call softlist load
-------------------------------------------------*/
bool neogeo_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
{
machine().rom_load().load_software_part_region(*this, swlist, swname, start_entry );
return TRUE;
}
/*-------------------------------------------------
get default card software
-------------------------------------------------*/
std::string neogeo_cart_slot_device::get_default_card_software()
{
return software_get_default_slot("rom");
}
/*-------------------------------------------------
read
-------------------------------------------------*/
READ16_MEMBER(neogeo_cart_slot_device::read_rom)
{
if (m_cart)
return m_cart->read_rom(space, offset, mem_mask);
else
return 0xffff;
}

View File

@ -1,87 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_SLOT_H
#define __NEOGEO_SLOT_H
#include "neogeo_intf.h"
#include "neogeo_helper.h"
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// ======================> neogeo_cart_slot_device
class neogeo_cart_slot_device : public device_t,
public device_image_interface,
public device_slot_interface
{
public:
// construction/destruction
neogeo_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
virtual ~neogeo_cart_slot_device();
// device-level overrides
virtual void device_start() override;
virtual void device_config_complete() override;
// image-level overrides
virtual bool call_load() override;
virtual void call_unload() override;
virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) override;
virtual iodevice_t image_type() const override { return IO_CARTSLOT; }
virtual bool is_readable() const override { return 1; }
virtual bool is_writeable() const override { return 0; }
virtual bool is_creatable() const override { return 0; }
virtual bool must_be_loaded() const override { return 0; }
virtual bool is_reset_on_load() const override { return 1; }
virtual const option_guide *create_option_guide() const override { return nullptr; }
virtual const char *image_interface() const override { return "neo_cart"; }
virtual const char *file_extensions() const override { return "bin"; }
// slot interface overrides
virtual std::string get_default_card_software() override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom);
UINT16* get_rom_base() { if (m_cart) { return m_cart->get_rom_base(); } else { return nullptr; } }
UINT32 get_rom_size() { if (m_cart) { return m_cart->get_rom_size(); } else { return 0; } }
UINT8* get_fixed_base() { if (m_cart) { return m_cart->get_fixed_base(); } else { return nullptr; } }
UINT32 get_fixed_size() { if (m_cart) { return m_cart->get_fixed_size(); } else { return 0; } }
UINT8* get_sprites_base() { if (m_cart) { return m_cart->get_sprites_base(); } else { return nullptr; } }
UINT32 get_sprites_size() { if (m_cart) { return m_cart->get_sprites_size(); } else { return 0; } }
UINT8* get_sprites_optimized() { if (m_cart) { return m_cart->get_sprites_optimized(); } else { return nullptr; } }
UINT32 get_sprites_addrmask() { if (m_cart) { return m_cart->get_sprites_addrmask(); } else { return 0; } }
UINT8* get_audio_base() { if (m_cart) { return m_cart->get_audio_base(); } else { return nullptr; } }
UINT32 get_audio_size() { if (m_cart) { return m_cart->get_audio_size(); } else { return 0; } }
UINT8* get_ym_base() { if (m_cart) { return m_cart->get_ym_base(); } else { return nullptr; } }
UINT32 get_ym_size() { if (m_cart) { return m_cart->get_ym_size(); } else { return 0; } }
UINT8* get_ymdelta_base() { if (m_cart) { return m_cart->get_ymdelta_base(); } else { return nullptr; } }
UINT32 get_ymdelta_size() { if (m_cart) { return m_cart->get_ymdelta_size(); } else { return 0; } }
int get_fixed_bank_type(void) { if (m_cart) { return m_cart->get_fixed_bank_type(); } else { return 0; } }
void activate_cart(ACTIVATE_CART_PARAMS) { if (m_cart) m_cart->activate_cart(machine, maincpu, cpuregion, cpuregion_size, fixedregion, fixedregion_size); }
void setup_memory_banks(running_machine &machine);
private:
device_neogeo_cart_interface* m_cart;
};
// device type definition
extern const device_type NEOGEO_CART_SLOT;
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_NEOGEO_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
MCFG_DEVICE_ADD(_tag, NEOGEO_CART_SLOT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
#endif

View File

@ -1,14 +1,15 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
NEOGEO ROM cart emulation
Neo Geo cart emulation
PCM2 encrypted cart type
***********************************************************************************************************/
#include "emu.h"
#include "pcm2_cart.h"
#include "pcm2.h"
//-------------------------------------------------
@ -18,23 +19,17 @@
const device_type NEOGEO_PCM2_CART = &device_creator<neogeo_pcm2_cart>;
neogeo_pcm2_cart::neogeo_pcm2_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
neogeo_pcm2_cart::neogeo_pcm2_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source) :
neogeo_rom_device(mconfig, type, name, tag, owner, clock, shortname, source),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot")
{
}
{}
neogeo_pcm2_cart::neogeo_pcm2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_PCM2_CART, "NEOGEO PCM2 Cart", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
neogeo_pcm2_cart::neogeo_pcm2_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_rom_device(mconfig, NEOGEO_PCM2_CART, "Neo Geo PCM2 Cart", tag, owner, clock, "neocart_pcm2", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot")
{
}
{}
//-------------------------------------------------
@ -54,13 +49,7 @@ void neogeo_pcm2_cart::device_reset()
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_pcm2_cart::read_rom)
{
return m_rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( pcm2_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_PCM2_PROT_ADD("pcm2_prot")
MACHINE_CONFIG_END
@ -71,65 +60,76 @@ machine_config_constructor neogeo_pcm2_cart::device_mconfig_additions() const
}
/* Individual cartridge types (mirror DRIVER_INIT functionality) */
/*************************************************
MSLUG4
mslug4
**************************************************/
const device_type NEOGEO_PCM2_MSLUG4_CART = &device_creator<neogeo_pcm2_mslug4_cart>;
neogeo_pcm2_mslug4_cart::neogeo_pcm2_mslug4_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_pcm2_cart(mconfig, NEOGEO_PCM2_MSLUG4_CART, "NEOGEO PCM2 mslug4 Cart", tag, owner, clock, "p2_mslug4_cart", __FILE__) {}
neogeo_pcm2_mslug4_cart::neogeo_pcm2_mslug4_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_pcm2_cart(mconfig, NEOGEO_PCM2_MSLUG4_CART, "Neo Geo Metal Slug 4 PCM2 Cart", tag, owner, clock, "neocart_mslug4", __FILE__)
{}
void neogeo_pcm2_mslug4_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, MSLUG4_GFX_KEY);
m_pcm2_prot->neo_pcm2_snk_1999(ym_region, ym_region_size, 8);
}
const device_type NEOGEO_PCM2_MS4PLUS_CART = &device_creator<neogeo_pcm2_ms4plus_cart>;
neogeo_pcm2_ms4plus_cart::neogeo_pcm2_ms4plus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_pcm2_cart(mconfig, NEOGEO_PCM2_MS4PLUS_CART, "NEOGEO PCM2 ms4plus Cart", tag, owner, clock, "p2_ms4plus_cart", __FILE__) {}
void neogeo_pcm2_ms4plus_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->cmc50_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, MSLUG4_GFX_KEY);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region,audio_region_size);
m_pcm2_prot->neo_pcm2_snk_1999(ym_region, ym_region_size, 8);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MSLUG4_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
m_pcm2_prot->decrypt(ym_region, ym_region_size, 8);
}
/*************************************************
ROTD
ms4plus
**************************************************/
const device_type NEOGEO_PCM2_MS4PLUS_CART = &device_creator<neogeo_pcm2_ms4plus_cart>;
neogeo_pcm2_ms4plus_cart::neogeo_pcm2_ms4plus_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_pcm2_cart(mconfig, NEOGEO_PCM2_MS4PLUS_CART, "Neo Geo Metal Slug 4 Plus PCM2 Cart", tag, owner, clock, "neocart_ms4plus", __FILE__)
{}
void neogeo_pcm2_ms4plus_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MSLUG4_GFX_KEY);
m_pcm2_prot->decrypt(ym_region, ym_region_size, 8);
}
/*************************************************
rotd
**************************************************/
const device_type NEOGEO_PCM2_ROTD_CART = &device_creator<neogeo_pcm2_rotd_cart>;
neogeo_pcm2_rotd_cart::neogeo_pcm2_rotd_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_pcm2_cart(mconfig, NEOGEO_PCM2_ROTD_CART, "NEOGEO PCM2 rotd Cart", tag, owner, clock, "p2_rotd_cart", __FILE__) {}
neogeo_pcm2_rotd_cart::neogeo_pcm2_rotd_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_pcm2_cart(mconfig, NEOGEO_PCM2_ROTD_CART, "Neo Geo Rage of the Dragon PCM2 Cart", tag, owner, clock, "neocart_rotd", __FILE__)
{}
void neogeo_pcm2_rotd_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, ROTD_GFX_KEY);
m_pcm2_prot->neo_pcm2_snk_1999(ym_region, ym_region_size, 16);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, ROTD_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
m_pcm2_prot->decrypt(ym_region, ym_region_size, 16);
}
/*************************************************
PNYAA
pnyaa
**************************************************/
const device_type NEOGEO_PCM2_PNYAA_CART = &device_creator<neogeo_pcm2_pnyaa_cart>;
neogeo_pcm2_pnyaa_cart::neogeo_pcm2_pnyaa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_pcm2_cart(mconfig, NEOGEO_PCM2_PNYAA_CART, "NEOGEO PCM2 pnyaa Cart", tag, owner, clock, "p2_pnyaa_cart", __FILE__) {}
neogeo_pcm2_pnyaa_cart::neogeo_pcm2_pnyaa_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_pcm2_cart(mconfig, NEOGEO_PCM2_PNYAA_CART, "Neo Geo Pnyaa PCM2 Cart", tag, owner, clock, "neocart_pnyaa", __FILE__)
{}
void neogeo_pcm2_pnyaa_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, PNYAA_GFX_KEY);
m_pcm2_prot->neo_pcm2_snk_1999(ym_region, ym_region_size, 4);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, PNYAA_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
m_pcm2_prot->decrypt(ym_region, ym_region_size, 4);
}

View File

@ -1,17 +1,16 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_PCM2_CART_H
#define __NEOGEO_PCM2_CART_H
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_PCM2_H
#define __NEOGEO_PCM2_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "pcm2_prot.h"
#include "cmc_prot.h"
#include "slot.h"
#include "rom.h"
#include "prot_cmc.h"
#include "prot_pcm2.h"
// ======================> neogeo_pcm2_cart
class neogeo_pcm2_cart : public device_t,
public device_neogeo_cart_interface
class neogeo_pcm2_cart : public neogeo_rom_device
{
public:
// construction/destruction
@ -24,25 +23,22 @@ public:
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
// virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual void activate_cart(ACTIVATE_CART_PARAMS) override { m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size); }
// virtual void activate_cart(ACTIVATE_CART_PARAMS) override { m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size); }
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override {}
virtual int get_fixed_bank_type(void) override { return 0; }
required_device<neogeo_banked_cart_device> m_banked_cart;
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
};
// device type definition
extern const device_type NEOGEO_PCM2_CART;
/*************************************************
MSLUG4
mslug4
**************************************************/
class neogeo_pcm2_mslug4_cart : public neogeo_pcm2_cart
@ -52,8 +48,14 @@ public:
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
};
extern const device_type NEOGEO_PCM2_MSLUG4_CART;
/*************************************************
ms4plus
**************************************************/
class neogeo_pcm2_ms4plus_cart : public neogeo_pcm2_cart
{
public:
@ -61,12 +63,12 @@ public:
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
};
extern const device_type NEOGEO_PCM2_MS4PLUS_CART;
/*************************************************
ROTD
rotd
**************************************************/
class neogeo_pcm2_rotd_cart : public neogeo_pcm2_cart
@ -76,11 +78,12 @@ public:
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
};
extern const device_type NEOGEO_PCM2_ROTD_CART;
/*************************************************
PNYAA
pnyaa
**************************************************/
class neogeo_pcm2_pnyaa_cart : public neogeo_pcm2_cart
@ -90,9 +93,8 @@ public:
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
};
extern const device_type NEOGEO_PCM2_PNYAA_CART;
#endif

View File

@ -1,16 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#include "emu.h"
#include "cmc_prot.h"
#include "prot_cmc.h"
extern const device_type CMC_PROT = &device_creator<cmc_prot_device>;
cmc_prot_device::cmc_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, CMC_PROT, "NeoGeo Protection (CMC)", tag, owner, clock, "cmc_prot", __FILE__),
cmc_prot_device::cmc_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, CMC_PROT, "Neo Geo CMC42 & CMC50 Protection", tag, owner, clock, "cmc_prot", __FILE__),
type0_t03(nullptr),
type0_t12(nullptr),
type1_t03(nullptr),
@ -33,11 +31,6 @@ void cmc_prot_device::device_reset()
}
/***************************************************************************
NeoGeo 'C' ROM encryption
@ -486,7 +479,7 @@ void cmc_prot_device::decrypt(UINT8 *r0, UINT8 *r1,
int base,
int invert)
{
UINT8 tmp,xor0,xor1;
UINT8 tmp, xor0, xor1;
tmp = table1[(base & 0xff) ^ address_0_7_xor[(base >> 8) & 0xff]];
xor0 = (table0hi[(base >> 8) & 0xff] & 0xfe) | (tmp & 0x01);
@ -505,22 +498,20 @@ void cmc_prot_device::decrypt(UINT8 *r0, UINT8 *r1,
}
void cmc_prot_device::neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, int extra_xor)
void cmc_prot_device::gfx_decrypt(UINT8* rom, UINT32 rom_size, int extra_xor)
{
int rpos;
dynamic_buffer buf(rom_size);
// Data xor
for (rpos = 0;rpos < rom_size/4;rpos++)
for (rpos = 0; rpos < rom_size/4; rpos++)
{
decrypt(&buf[4*rpos+0], &buf[4*rpos+3], rom[4*rpos+0], rom[4*rpos+3], type0_t03, type0_t12, type1_t03, rpos, (rpos>>8) & 1);
decrypt(&buf[4*rpos+1], &buf[4*rpos+2], rom[4*rpos+1], rom[4*rpos+2], type0_t12, type0_t03, type1_t12, rpos, ((rpos>>16) ^ address_16_23_xor2[(rpos>>8) & 0xff]) & 1);
}
// Address xor
for (rpos = 0;rpos < rom_size/4;rpos++)
for (rpos = 0; rpos < rom_size/4; rpos++)
{
int baser;
@ -560,86 +551,67 @@ void cmc_prot_device::neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, int extra_
}
/* the S data comes from the end of the C data */
void cmc_prot_device::neogeo_sfix_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size)
/* CMC42 protection chip */
void cmc_prot_device::cmc42_gfx_decrypt(UINT8* rom, UINT32 rom_size, int extra_xor)
{
int i;
int tx_size = fixed_size;
UINT8 *src = rom+rom_size-tx_size;
UINT8 *dst = fixed;
for (i = 0;i < tx_size;i++)
dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
type0_t03 = kof99_type0_t03;
type0_t12 = kof99_type0_t12;
type1_t03 = kof99_type1_t03;
type1_t12 = kof99_type1_t12;
address_8_15_xor1 = kof99_address_8_15_xor1;
address_8_15_xor2 = kof99_address_8_15_xor2;
address_16_23_xor1 = kof99_address_16_23_xor1;
address_16_23_xor2 = kof99_address_16_23_xor2;
address_0_7_xor = kof99_address_0_7_xor;
gfx_decrypt(rom, rom_size, extra_xor);
}
/* CMC42 protection chip */
// REMOVE ME!!!!
void cmc_prot_device::kof99_neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size, int extra_xor)
{
type0_t03 = kof99_type0_t03;
type0_t12 = kof99_type0_t12;
type1_t03 = kof99_type1_t03;
type1_t12 = kof99_type1_t12;
address_8_15_xor1 = kof99_address_8_15_xor1;
address_8_15_xor2 = kof99_address_8_15_xor2;
address_16_23_xor1 = kof99_address_16_23_xor1;
address_16_23_xor2 = kof99_address_16_23_xor2;
address_0_7_xor = kof99_address_0_7_xor;
neogeo_gfx_decrypt(rom, rom_size, extra_xor);
neogeo_sfix_decrypt(rom, rom_size, fixed, fixed_size);
cmc42_gfx_decrypt(rom, rom_size, extra_xor);
sfix_decrypt(rom, rom_size, fixed, fixed_size);
}
/* CMC50 protection chip */
void cmc_prot_device::cmc50_gfx_decrypt(UINT8* rom, UINT32 rom_size, int extra_xor)
{
type0_t03 = kof2000_type0_t03;
type0_t12 = kof2000_type0_t12;
type1_t03 = kof2000_type1_t03;
type1_t12 = kof2000_type1_t12;
address_8_15_xor1 = kof2000_address_8_15_xor1;
address_8_15_xor2 = kof2000_address_8_15_xor2;
address_16_23_xor1 = kof2000_address_16_23_xor1;
address_16_23_xor2 = kof2000_address_16_23_xor2;
address_0_7_xor = kof2000_address_0_7_xor;
gfx_decrypt(rom, rom_size, extra_xor);
}
// REMOVE ME!!!!
void cmc_prot_device::kof2000_neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size, int extra_xor)
{
type0_t03 = kof2000_type0_t03;
type0_t12 = kof2000_type0_t12;
type1_t03 = kof2000_type1_t03;
type1_t12 = kof2000_type1_t12;
address_8_15_xor1 = kof2000_address_8_15_xor1;
address_8_15_xor2 = kof2000_address_8_15_xor2;
address_16_23_xor1 = kof2000_address_16_23_xor1;
address_16_23_xor2 = kof2000_address_16_23_xor2;
address_0_7_xor = kof2000_address_0_7_xor;
neogeo_gfx_decrypt(rom, rom_size, extra_xor);
neogeo_sfix_decrypt(rom, rom_size, fixed, fixed_size);
cmc50_gfx_decrypt(rom, rom_size, extra_xor);
sfix_decrypt(rom, rom_size, fixed, fixed_size);
}
/* CMC42 protection chip */
void cmc_prot_device::cmc42_neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size, int extra_xor)
/* the S data comes from the end of the C data */
void cmc_prot_device::sfix_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size)
{
type0_t03 = kof99_type0_t03;
type0_t12 = kof99_type0_t12;
type1_t03 = kof99_type1_t03;
type1_t12 = kof99_type1_t12;
address_8_15_xor1 = kof99_address_8_15_xor1;
address_8_15_xor2 = kof99_address_8_15_xor2;
address_16_23_xor1 = kof99_address_16_23_xor1;
address_16_23_xor2 = kof99_address_16_23_xor2;
address_0_7_xor = kof99_address_0_7_xor;
neogeo_gfx_decrypt(rom, rom_size, extra_xor);
int tx_size = fixed_size;
UINT8 *src = rom + rom_size - tx_size;
UINT8 *dst = fixed;
for (int i = 0; i < tx_size; i++)
dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
}
/* CMC50 protection chip */
void cmc_prot_device::cmc50_neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size, int extra_xor)
{
type0_t03 = kof2000_type0_t03;
type0_t12 = kof2000_type0_t12;
type1_t03 = kof2000_type1_t03;
type1_t12 = kof2000_type1_t12;
address_8_15_xor1 = kof2000_address_8_15_xor1;
address_8_15_xor2 = kof2000_address_8_15_xor2;
address_16_23_xor1 = kof2000_address_16_23_xor1;
address_16_23_xor2 = kof2000_address_16_23_xor2;
address_0_7_xor = kof2000_address_0_7_xor;
neogeo_gfx_decrypt(rom, rom_size, extra_xor);
}
/***************************************************************************
NeoGeo 'M' ROM encryption
@ -689,28 +661,20 @@ static const UINT8 m1_address_0_7_xor[256] =
};
/* The CMC50 hardware does a checksum of the first 64kb of the M1 rom,
,and uses this checksum as the basis of the key with which to decrypt
the rom */
/* The CMC50 hardware does a checksum of the first 64kb of the M1 rom, and
uses this checksum as the basis of the key with which to decrypt the rom */
UINT16 cmc_prot_device::generate_cs16(UINT8 *rom, int size)
{
UINT16 cs16;
int i;
cs16 = 0x0000;
for (i=0;i<size;i++ )
{
UINT16 cs16 = 0x0000;
for (int i = 0; i < size; i++)
cs16 += rom[i];
}
return cs16&0xFFFF;
return cs16 & 0xffff;
}
int cmc_prot_device::m1_address_scramble(int address, UINT16 key)
{
int block;
int aux;
const int p1[8][16] = {
{15,14,10,7,1,2,3,8,0,12,11,13,6,9,5,4},
{7,1,8,11,15,9,2,3,5,13,4,14,10,0,6,12},
@ -722,24 +686,24 @@ int cmc_prot_device::m1_address_scramble(int address, UINT16 key)
{9,3,7,0,2,12,4,11,14,10,5,8,15,13,1,6},
};
block = (address>>16)&7;
aux = address&0xffff;
int block = (address >> 16) & 7;
int aux = address & 0xffff;
aux ^= BITSWAP16(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5);
aux ^= BITSWAP16(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5);
aux = BITSWAP16(aux,
p1[block][15],p1[block][14],p1[block][13],p1[block][12],
p1[block][11],p1[block][10],p1[block][9],p1[block][8],
p1[block][7],p1[block][6],p1[block][5],p1[block][4],
p1[block][3],p1[block][2],p1[block][1],p1[block][0]);
aux ^= m1_address_0_7_xor[(aux>>8)&0xff];
aux ^= m1_address_8_15_xor[aux&0xff]<<8;
p1[block][15], p1[block][14], p1[block][13], p1[block][12],
p1[block][11], p1[block][10], p1[block][9], p1[block][8],
p1[block][7], p1[block][6], p1[block][5], p1[block][4],
p1[block][3], p1[block][2], p1[block][1], p1[block][0]);
aux ^= m1_address_0_7_xor[(aux >> 8) & 0xff];
aux ^= m1_address_8_15_xor[aux & 0xff] << 8;
aux = BITSWAP16(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0);
return (block<<16)|aux;
return (block << 16) | aux;
}
void cmc_prot_device::neogeo_cmc50_m1_decrypt(UINT8* romcrypt, UINT32 romcrypt_size, UINT8* romaudio, UINT32 romaudio_size)
void cmc_prot_device::cmc50_m1_decrypt(UINT8* romcrypt, UINT32 romcrypt_size, UINT8* romaudio, UINT32 romaudio_size)
{
UINT8* rom = romcrypt;
size_t rom_size = 0x80000;
@ -747,21 +711,17 @@ void cmc_prot_device::neogeo_cmc50_m1_decrypt(UINT8* romcrypt, UINT32 romcrypt_s
dynamic_buffer buffer(rom_size);
UINT32 i;
UINT16 key=generate_cs16(rom,0x10000);
UINT16 key = generate_cs16(rom, 0x10000);
//printf("key %04x\n",key);
for (i=0; i<rom_size; i++)
{
for (UINT32 i = 0; i < rom_size; i++)
buffer[i] = rom[m1_address_scramble(i,key)];
}
memcpy(rom,&buffer[0],rom_size);
memcpy(rom, &buffer[0], rom_size);
memcpy(rom2,rom,0x10000);
memcpy(rom2+0x10000,rom,0x80000);
memcpy(rom2,rom, 0x10000);
memcpy(rom2 + 0x10000, rom, 0x80000);
#if 0
{

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
@ -13,7 +13,7 @@ extern const device_type CMC_PROT;
MCFG_DEVICE_ADD(_tag, CMC_PROT, 0)
// cmc42
#define KOF99_GFX_KEY (0x00)
#define KOF99_GFX_KEY (0x00)
#define GAROU_GFX_KEY (0x06)
#define MSLUG3_GFX_KEY (0xad)
#define ZUPAPA_GFX_KEY (0xbd)
@ -54,16 +54,17 @@ public:
int base,
int invert);
void neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, int extra_xor);
void neogeo_sfix_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size);
void gfx_decrypt(UINT8* rom, UINT32 rom_size, int extra_xor);
void kof99_neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size, int extra_xor);
void kof2000_neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size, int extra_xor);
void cmc42_neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size, int extra_xor);
void cmc50_neogeo_gfx_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size, int extra_xor);
void cmc42_gfx_decrypt(UINT8* rom, UINT32 rom_size, int extra_xor);
void cmc50_gfx_decrypt(UINT8* rom, UINT32 rom_size, int extra_xor);
void sfix_decrypt(UINT8* rom, UINT32 rom_size, UINT8* fixed, UINT32 fixed_size);
UINT16 generate_cs16(UINT8 *rom, int size);
int m1_address_scramble(int address, UINT16 key);
void neogeo_cmc50_m1_decrypt(UINT8* romcrypt, UINT32 romcrypt_size, UINT8* romaudio, UINT32 romaudio_size);
void cmc50_m1_decrypt(UINT8* romcrypt, UINT32 romcrypt_size, UINT8* romaudio, UINT32 romaudio_size);
protected:
virtual void device_start() override;

View File

@ -0,0 +1,319 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#include "emu.h"
#include "prot_cthd.h"
extern const device_type CTHD_PROT = &device_creator<cthd_prot_device>;
cthd_prot_device::cthd_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, CTHD_PROT, "Neo Geo CTHD Protection (Bootleg)", tag, owner, clock, "cthd_prot", __FILE__)
{}
void cthd_prot_device::device_start()
{
}
void cthd_prot_device::device_reset()
{
}
/* Crouching Tiger Hidden Dragon 2003 (bootleg of King of Fighters 2001) */
/**************************
decryption helpers
**************************/
// descrambling information from razoola
void cthd_prot_device::fix_do(UINT8* sprrom, UINT32 sprrom_size, int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift)
{
int tilesize = 128;
dynamic_buffer rom(16 * tilesize); // 16 tiles buffer
UINT8* realrom = sprrom + start * tilesize;
for (int i = 0; i < (end-start)/16; i++)
{
for (int j = 0; j < 16; j++)
{
int offset = (BIT(j, 0) << bit0shift) +
(BIT(j, 1) << bit1shift) +
(BIT(j, 2) << bit2shift) +
(BIT(j, 3) << bit3shift);
memcpy(&rom[j * tilesize], realrom + offset * tilesize, tilesize);
}
memcpy(realrom, &rom[0], tilesize * 16);
realrom += 16 * tilesize;
}
}
void cthd_prot_device::gfx_address_fix(UINT8* sprrom, UINT32 sprrom_size, int start, int end)
{
fix_do(sprrom, sprrom_size, start + 512 * 0, end + 512 * 0, 0,3,2,1);
fix_do(sprrom, sprrom_size, start + 512 * 1, end + 512 * 1, 1,0,3,2);
fix_do(sprrom, sprrom_size, start + 512 * 2, end + 512 * 2, 2,1,0,3);
// skip 3 & 4
fix_do(sprrom, sprrom_size, start + 512 * 5, end + 512 * 5, 0,1,2,3);
fix_do(sprrom, sprrom_size, start + 512 * 6, end + 512 * 6, 0,1,2,3);
fix_do(sprrom, sprrom_size, start + 512 * 7, end + 512 * 7, 0,2,3,1);
}
void cthd_prot_device::cthd2003_c(UINT8* sprrom, UINT32 sprrom_size, int pow)
{
for (int i = 0; i <= 192; i += 8)
gfx_address_fix(sprrom, sprrom_size, i * 512, i * 512 + 512);
for (int i = 200; i <= 392; i += 8)
gfx_address_fix(sprrom, sprrom_size, i * 512, i * 512 + 512);
for (int i = 400; i <= 592; i += 8)
gfx_address_fix(sprrom, sprrom_size, i * 512, i * 512 + 512);
for (int i = 600; i <= 792; i += 8)
gfx_address_fix(sprrom, sprrom_size, i * 512, i * 512 + 512);
for (int i = 800; i <= 992; i += 8)
gfx_address_fix(sprrom, sprrom_size, i * 512, i * 512 + 512);
for (int i = 1000; i <= 1016; i += 8)
gfx_address_fix(sprrom, sprrom_size, i * 512, i * 512 + 512);
}
/**************************
protection / encryption
**************************/
void cthd_prot_device::decrypt_cthd2003(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size, UINT8* fixedrom, UINT32 fixedrom_size)
{
UINT8 *romdata = fixedrom;
dynamic_buffer tmp(8 * 128 * 128);
memcpy(&tmp[8 * 0 * 128], romdata + 8 * 0 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 32 * 128], romdata + 8 * 64 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 64 * 128], romdata + 8 * 32 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 96 * 128], romdata + 8 * 96 * 128, 8 * 32 * 128);
memcpy(romdata, &tmp[0], 8 * 128 * 128);
romdata = audiorom + 0x10000;
memcpy(&tmp[8 * 0 * 128], romdata + 8 * 0 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 32 * 128], romdata + 8 * 64 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 64 * 128], romdata + 8 * 32 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 96 * 128], romdata + 8 * 96 * 128, 8 * 32 * 128);
memcpy(romdata, &tmp[0], 8 * 128 * 128);
memcpy(romdata - 0x10000, romdata, 0x10000);
cthd2003_c(sprrom, sprrom_size, 0);
}
// temporarily replaced by the get_bank_base functions below, until we clean up bankswitch implementation
/*
WRITE16_MEMBER( ngbootleg_prot_device::cthd2003_bankswitch_w )
{
int bankaddress;
static const int cthd2003_banks[8] =
{
1,0,1,0,1,0,3,2,
};
if (offset == 0)
{
bankaddress = 0x100000 + cthd2003_banks[data&7]*0x100000;
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
}
*/
UINT32 cthd_prot_device::get_bank_base(UINT16 sel)
{
static const int cthd2003_banks[8] = { 1, 0, 1, 0, 1, 0, 3, 2 };
return (cthd2003_banks[sel & 7] + 1) * 0x100000;
}
void cthd_prot_device::patch_cthd2003(UINT8* cpurom, UINT32 cpurom_size)
{
// patches thanks to razoola
UINT16 *mem16 = (UINT16 *)cpurom;
// theres still a problem on the character select screen but it seems to be related to cpu core timing issues,
// overclocking the 68k prevents it.
// fix garbage on s1 layer over everything
mem16[0xf415a/2] = 0x4ef9;
mem16[0xf415c/2] = 0x000f;
mem16[0xf415e/2] = 0x4cf2;
// Fix corruption in attract mode before title screen
for (int i = 0x1ae290/2; i < 0x1ae8d0/2; i++)
mem16[i] = 0x0000;
// Fix for title page
for (int i = 0x1f8ef0/2; i < 0x1fa1f0/2; i += 2)
{
mem16[i] -= 0x7000;
mem16[i+1] -= 0x0010;
}
// Fix for green dots on title page
for (int i = 0xac500/2; i < 0xac520/2; i++)
mem16[i] = 0xffff;
// Fix for blanks as screen change level end clear
mem16[0x991d0/2] = 0xdd03;
mem16[0x99306/2] = 0xdd03;
mem16[0x99354/2] = 0xdd03;
mem16[0x9943e/2] = 0xdd03;
}
/* Crouching Tiger Hidden Dragon 2003 Super Plus (bootleg of King of Fighters 2001) */
void cthd_prot_device::ct2k3sp_sx_decrypt( UINT8* fixedrom, UINT32 fixedrom_size )
{
int rom_size = fixedrom_size;
UINT8 *rom = fixedrom;
dynamic_buffer buf(rom_size);
memcpy(&buf[0], rom, rom_size);
for (int i = 0; i < rom_size; i++)
{
int ofst = BITSWAP24((i & 0x1ffff), 23, 22, 21, 20, 19, 18, 17, 3,
0, 1, 4, 2, 13, 14, 16, 15,
5, 6, 11, 10, 9, 8, 7, 12 );
ofst += (i >> 17) << 17;
rom[i] = buf[ofst];
}
memcpy(&buf[0], rom, rom_size);
memcpy(&rom[0x08000], &buf[0x10000], 0x8000);
memcpy(&rom[0x10000], &buf[0x08000], 0x8000);
memcpy(&rom[0x28000], &buf[0x30000], 0x8000);
memcpy(&rom[0x30000], &buf[0x28000], 0x8000);
}
void cthd_prot_device::decrypt_ct2k3sp(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size, UINT8* fixedrom, UINT32 fixedrom_size)
{
UINT8 *romdata = audiorom + 0x10000;
dynamic_buffer tmp(8 * 128 * 128);
memcpy(&tmp[8 * 0 * 128], romdata + 8 * 0 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 32 * 128], romdata + 8 * 64 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 64 * 128], romdata + 8 * 32 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 96 * 128], romdata + 8 * 96 * 128, 8 * 32 * 128);
memcpy(romdata, &tmp[0], 8 * 128 * 128);
memcpy(romdata - 0x10000, romdata, 0x10000);
ct2k3sp_sx_decrypt(fixedrom, fixedrom_size);
cthd2003_c(sprrom, sprrom_size, 0);
}
/* Crouching Tiger Hidden Dragon 2003 Super Plus alternate (bootleg of King of Fighters 2001) */
void cthd_prot_device::decrypt_ct2k3sa(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size )
{
UINT8 *romdata = audiorom + 0x10000;
dynamic_buffer tmp(8 * 128 * 128);
memcpy(&tmp[8 * 0 * 128], romdata + 8 * 0 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 32 * 128], romdata + 8 * 64 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 64 * 128], romdata + 8 * 32 * 128, 8 * 32 * 128);
memcpy(&tmp[8 * 96 * 128], romdata + 8 * 96 * 128, 8 * 32 * 128);
memcpy(romdata, &tmp[0], 8 * 128 * 128);
memcpy(romdata - 0x10000, romdata, 0x10000);
cthd2003_c(sprrom,sprrom_size, 0);
}
void cthd_prot_device::patch_ct2k3sa(UINT8* cpurom, UINT32 cpurom_size)
{
/* patches thanks to razoola - same as for cthd2003*/
UINT16 *mem16 = (UINT16 *)cpurom;
// theres still a problem on the character select screen but it seems to be related to cpu core timing issues,
// overclocking the 68k prevents it.
// fix garbage on s1 layer over everything
mem16[0xf415a/2] = 0x4ef9;
mem16[0xf415c/2] = 0x000f;
mem16[0xf415e/2] = 0x4cf2;
// Fix corruption in attract mode before title screen
for (int i = 0x1ae290/2; i < 0x1ae8d0/2; i += 1)
mem16[i] = 0x0000;
// Fix for title page
for (int i = 0x1f8ef0/2; i < 0x1fa1f0/2; i += 2)
{
mem16[i] -= 0x7000;
mem16[i+1] -= 0x0010;
}
// Fix for green dots on title page
for (int i = 0xac500/2; i < 0xac520/2; i += 1)
mem16[i] = 0xffff;
// Fix for blanks as screen change level end clear
mem16[0x991d0/2] = 0xdd03;
mem16[0x99306/2] = 0xdd03;
mem16[0x99354/2] = 0xdd03;
mem16[0x9943e/2] = 0xdd03;
}
/* Matrimelee / Shin Gouketsuji Ichizoku Toukon (bootleg) */
#define MATRIMBLZ80(i) (i ^ (BITSWAP8(i & 0x3,4,3,1,2,0,7,6,5) << 8))
void cthd_prot_device::matrimbl_decrypt(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size)
{
// decrypt Z80
UINT8 *rom = audiorom + 0x10000;
dynamic_buffer buf(0x20000);
memcpy(&buf[0], rom, 0x20000);
int j;
for (int i = 0x00000; i < 0x20000; i++)
{
if (i & 0x10000)
{
if (i & 0x800)
{
j = MATRIMBLZ80(i);
j ^= 0x10000;
}
else
{
j = MATRIMBLZ80((i ^ 0x01));
}
}
else
{
if (i & 0x800)
{
j = MATRIMBLZ80((i ^ 0x01));
j ^= 0x10000;
}
else
{
j = MATRIMBLZ80(i);
}
}
rom[j] = buf[i];
}
memcpy(rom - 0x10000, rom, 0x10000);
// decrypt gfx
cthd2003_c(sprrom,sprrom_size, 0 );
}

View File

@ -0,0 +1,43 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
#ifndef __CTHD_PROT__
#define __CTHD_PROT__
extern const device_type CTHD_PROT;
#define MCFG_CTHD_PROT_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, CTHD_PROT, 0)
class cthd_prot_device : public device_t
{
public:
// construction/destruction
cthd_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void fix_do(UINT8* sprrom, UINT32 sprrom_size, int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift);
void gfx_address_fix(UINT8* sprrom, UINT32 sprrom_size, int start, int end);
void cthd2003_c(UINT8* sprrom, UINT32 sprrom_size, int pow);
void decrypt_cthd2003(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size, UINT8* fixedrom, UINT32 fixedrom_size);
void patch_cthd2003(UINT8* cpurom, UINT32 cpurom_size);
//DECLARE_WRITE16_MEMBER(cthd2003_bankswitch_w);
UINT32 get_bank_base(UINT16 sel);
void ct2k3sp_sx_decrypt(UINT8* fixedrom, UINT32 fixedrom_size);
void decrypt_ct2k3sp(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size, UINT8* fixedrom, UINT32 fixedrom_size);
void patch_ct2k3sa(UINT8* cpurom, UINT32 cpurom_size);
void decrypt_ct2k3sa(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size);
void matrimbl_decrypt(UINT8* sprrom, UINT32 sprrom_size, UINT8* audiorom, UINT32 audiorom_size);
protected:
virtual void device_start() override;
virtual void device_reset() override;
};
#endif

View File

@ -1,25 +1,24 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#include "emu.h"
#include "fatfury2_prot.h"
#include "prot_fatfury2.h"
extern const device_type FATFURY2_PROT = &device_creator<fatfury2_prot_device>;
fatfury2_prot_device::fatfury2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, FATFURY2_PROT, "NeoGeo Protection (Fatal Fury 2)", tag, owner, clock, "fatfury2_prot", __FILE__),
m_bankdev(nullptr),
m_fatfury2_prot_data(0)
fatfury2_prot_device::fatfury2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, FATFURY2_PROT, "Neo Geo Fatal Fury 2 Protection", tag, owner, clock, "fatfury2_prot", __FILE__),
m_prot_data(0)
{
}
void fatfury2_prot_device::device_start()
{
save_item(NAME(m_fatfury2_prot_data));
save_item(NAME(m_prot_data));
}
void fatfury2_prot_device::device_reset()
@ -30,9 +29,11 @@ void fatfury2_prot_device::device_reset()
/************************ Fatal Fury 2 *************************/
READ16_MEMBER( fatfury2_prot_device::fatfury2_protection_16_r )
/* the protection involves reading and writing addresses in the */
/* 0x2xxxxx range. There are several checks all around the code. */
READ16_MEMBER( fatfury2_prot_device::protection_r )
{
UINT16 res = m_fatfury2_prot_data >> 24;
UINT16 res = m_prot_data >> 24;
switch (offset)
{
@ -55,32 +56,32 @@ READ16_MEMBER( fatfury2_prot_device::fatfury2_protection_16_r )
}
WRITE16_MEMBER( fatfury2_prot_device::fatfury2_protection_16_w )
WRITE16_MEMBER( fatfury2_prot_device::protection_w )
{
switch (offset)
{
case 0x11112/2: /* data == 0x1111; expects 0xff000000 back */
m_fatfury2_prot_data = 0xff000000;
m_prot_data = 0xff000000;
break;
case 0x33332/2: /* data == 0x3333; expects 0x0000ffff back */
m_fatfury2_prot_data = 0x0000ffff;
m_prot_data = 0x0000ffff;
break;
case 0x44442/2: /* data == 0x4444; expects 0x00ff0000 back */
m_fatfury2_prot_data = 0x00ff0000;
m_prot_data = 0x00ff0000;
break;
case 0x55552/2: /* data == 0x5555; read back from 55550, ffff0, 00000, ff000 */
m_fatfury2_prot_data = 0xff00ff00;
m_prot_data = 0xff00ff00;
break;
case 0x56782/2: /* data == 0x1234; read back from 36000 *or* 36004 */
m_fatfury2_prot_data = 0xf05a3601;
m_prot_data = 0xf05a3601;
break;
case 0x42812/2: /* data == 0x1824; read back from 36008 *or* 3600c */
m_fatfury2_prot_data = 0x81422418;
m_prot_data = 0x81422418;
break;
case 0x55550/2:
@ -90,7 +91,7 @@ WRITE16_MEMBER( fatfury2_prot_device::fatfury2_protection_16_w )
case 0x36004/2:
case 0x36008/2:
case 0x3600c/2:
m_fatfury2_prot_data <<= 8;
m_prot_data <<= 8;
break;
default:
@ -99,14 +100,3 @@ WRITE16_MEMBER( fatfury2_prot_device::fatfury2_protection_16_w )
}
}
void fatfury2_prot_device::fatfury2_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev)
{
/* the protection involves reading and writing addresses in the */
/* 0x2xxxxx range. There are several checks all around the code. */
maincpu->space(AS_PROGRAM).install_readwrite_handler(0x200000, 0x2fffff, read16_delegate(FUNC(fatfury2_prot_device::fatfury2_protection_16_r),this), write16_delegate(FUNC(fatfury2_prot_device::fatfury2_protection_16_w),this));
m_bankdev = bankdev;
m_fatfury2_prot_data = 0;
}

View File

@ -1,13 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
#ifndef __FATFURY2_PROT__
#define __FATFURY2_PROT__
#include "banked_cart.h"
extern const device_type FATFURY2_PROT;
#define MCFG_FATFURY2_PROT_ADD(_tag) \
@ -20,13 +18,10 @@ public:
// construction/destruction
fatfury2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ16_MEMBER( fatfury2_protection_16_r );
DECLARE_WRITE16_MEMBER( fatfury2_protection_16_w );
void fatfury2_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev);
DECLARE_READ16_MEMBER( protection_r );
DECLARE_WRITE16_MEMBER( protection_w );
neogeo_banked_cart_device* m_bankdev;
UINT32 m_fatfury2_prot_data;
UINT32 m_prot_data;
protected:
virtual void device_start() override;

View File

@ -1,16 +1,14 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#include "emu.h"
#include "kof2002_prot.h"
#include "prot_kof2k2.h"
extern const device_type KOF2002_PROT = &device_creator<kof2002_prot_device>;
kof2002_prot_device::kof2002_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, KOF2002_PROT, "NeoGeo Protection (KOF2002)", tag, owner, clock, "kof2002_prot", __FILE__)
: device_t(mconfig, KOF2002_PROT, "Neo Geo KOF 2002 Protection", tag, owner, clock, "kof2002_prot", __FILE__)
{
}
@ -27,57 +25,46 @@ void kof2002_prot_device::device_reset()
/* kof2002, matrim, samsho5, samsh5sp have some simple block swapping */
void kof2002_prot_device::kof2002_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
{
int i;
static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000};
UINT8 *src = cpurom+0x100000;
UINT8 *src = cpurom + 0x100000;
dynamic_buffer dst(0x400000);
memcpy( &dst[0], src, 0x400000 );
for( i=0; i<8; ++i )
{
memcpy( src+i*0x80000, &dst[sec[i]], 0x80000 );
}
memcpy(&dst[0], src, 0x400000);
for (int i = 0; i < 8; ++i)
memcpy(src + i * 0x80000, &dst[sec[i]], 0x80000);
}
void kof2002_prot_device::matrim_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
{
int i;
static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000};
UINT8 *src = cpurom+0x100000;
UINT8 *src = cpurom + 0x100000;
dynamic_buffer dst(0x400000);
memcpy( &dst[0], src, 0x400000);
for( i=0; i<8; ++i )
{
memcpy( src+i*0x80000, &dst[sec[i]], 0x80000 );
}
memcpy(&dst[0], src, 0x400000);
for (int i = 0; i < 8; ++i)
memcpy(src + i * 0x80000, &dst[sec[i]], 0x80000);
}
void kof2002_prot_device::samsho5_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
{
int i;
static const int sec[]={0x000000,0x080000,0x700000,0x680000,0x500000,0x180000,0x200000,0x480000,0x300000,0x780000,0x600000,0x280000,0x100000,0x580000,0x400000,0x380000};
UINT8 *src = cpurom;
dynamic_buffer dst(0x800000);
memcpy( &dst[0], src, 0x800000 );
for( i=0; i<16; ++i )
{
memcpy( src+i*0x80000, &dst[sec[i]], 0x80000 );
}
memcpy(&dst[0], src, 0x800000);
for (int i = 0; i < 16; ++i)
memcpy(src + i * 0x80000, &dst[sec[i]], 0x80000);
}
void kof2002_prot_device::samsh5sp_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
{
int i;
static const int sec[]={0x000000,0x080000,0x500000,0x480000,0x600000,0x580000,0x700000,0x280000,0x100000,0x680000,0x400000,0x780000,0x200000,0x380000,0x300000,0x180000};
UINT8 *src = cpurom;
dynamic_buffer dst(0x800000);
memcpy( &dst[0], src, 0x800000 );
for( i=0; i<16; ++i )
{
memcpy( src+i*0x80000, &dst[sec[i]], 0x80000 );
}
memcpy(&dst[0], src, 0x800000);
for (int i = 0; i < 16; ++i)
memcpy(src + i * 0x80000, &dst[sec[i]], 0x80000);
}

View File

@ -1,11 +1,11 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
#ifndef __KOF2002_PROT__
#define __KOF2002_PROT__
#ifndef __KOF2K2_PROT__
#define __KOF2K2_PROT__
extern const device_type KOF2002_PROT;

View File

@ -0,0 +1,133 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#include "emu.h"
#include "prot_kof2k3bl.h"
extern const device_type KOF2K3BL_PROT = &device_creator<kof2k3bl_prot_device>;
kof2k3bl_prot_device::kof2k3bl_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, KOF2K3BL_PROT, "Neo Geo KOF 2003 Bootleg Protection", tag, owner, clock, "kof2k3bl_prot", __FILE__)
{}
void kof2k3bl_prot_device::device_start()
{
save_item(NAME(m_cartridge_ram));
save_item(NAME(m_overlay));
save_item(NAME(m_bank_base));
}
void kof2k3bl_prot_device::device_reset()
{
memset(m_cartridge_ram, 0x00, 0x2000);
m_overlay = 0;
m_bank_base = 0;
}
/* The King of Fighters 2003 (bootleg set 1) */
READ16_MEMBER( kof2k3bl_prot_device::protection_r)
{
return m_cartridge_ram[offset];
}
READ16_MEMBER(kof2k3bl_prot_device::overlay_r) // hack?
{
return m_overlay;
}
WRITE16_MEMBER(kof2k3bl_prot_device::kof2003_w)
{
data = COMBINE_DATA(&m_cartridge_ram[offset]);
if (offset == 0x1ff0/2 || offset == 0x1ff2/2)
{
UINT8* cr = (UINT8 *)m_cartridge_ram;
UINT8 prt = cr[BYTE_XOR_LE(0x1ff2)];
m_bank_base = 0x100000 + ((cr[BYTE_XOR_LE(0x1ff3)] << 16) | (cr[BYTE_XOR_LE(0x1ff2)] << 8) | cr[BYTE_XOR_LE(0x1ff1)]);
//UINT32 address = (cr[BYTE_XOR_LE(0x1ff3)] << 16) | (cr[BYTE_XOR_LE(0x1ff2)] << 8) | cr[BYTE_XOR_LE(0x1ff1)];
//m_bankdev->neogeo_set_main_cpu_bank_address(address+0x100000);
cr[BYTE_XOR_LE(0x1ff0)] = 0xa0;
cr[BYTE_XOR_LE(0x1ff1)] &= 0xfe;
cr[BYTE_XOR_LE(0x1ff3)] &= 0x7f;
m_overlay = (prt & 0x00ff) | (m_overlay & 0xff00);
}
}
WRITE16_MEMBER(kof2k3bl_prot_device::kof2003p_w)
{
data = COMBINE_DATA(&m_cartridge_ram[offset]);
if (offset == 0x1ff0/2 || offset == 0x1ff2/2)
{
UINT8* cr = (UINT8 *)m_cartridge_ram;
UINT8 prt = cr[BYTE_XOR_LE(0x1ff2)];
m_bank_base = 0x100000 + ((cr[BYTE_XOR_LE(0x1ff3)] << 16) | (cr[BYTE_XOR_LE(0x1ff2)] << 8) | cr[BYTE_XOR_LE(0x1ff0)]);
//UINT32 address = (cr[BYTE_XOR_LE(0x1ff3)] << 16) | (cr[BYTE_XOR_LE(0x1ff2)] << 8) | cr[BYTE_XOR_LE(0x1ff0)];
//m_bankdev->neogeo_set_main_cpu_bank_address(address+0x100000);
cr[BYTE_XOR_LE(0x1ff0)] &= 0xfe;
cr[BYTE_XOR_LE(0x1ff3)] &= 0x7f;
m_overlay = (prt & 0x00ff) | (m_overlay & 0xff00);
}
}
void kof2k3bl_prot_device::bl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
static const UINT8 sec[] = { 0x07, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
int rom_size = 0x800000;
UINT8 *rom = cpurom;
dynamic_buffer buf(rom_size);
memcpy(&buf[0], rom, rom_size);
for (int i = 0; i < rom_size / 0x100000; i++)
memcpy(&rom[i * 0x100000], &buf[sec[i] * 0x100000], 0x100000);
}
/* The King of Fighters 2004 Plus / Hero (The King of Fighters 2003 bootleg) */
void kof2k3bl_prot_device::pl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
std::vector<UINT16> tmp(0x100000/2);
UINT16*rom16 = (UINT16*)cpurom;
for (int i = 0; i < 0x700000/2; i += 0x100000/2)
{
memcpy(&tmp[0], &rom16[i], 0x100000);
for (int j = 0; j < 0x100000/2; j++)
rom16[i+j] = tmp[BITSWAP24(j,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)];
}
/* patched by Altera protection chip on PCB */
rom16[0xf38ac/2] = 0x4e75;
m_overlay = rom16[0x58196 / 2];
}
/* The King of Fighters 2004 Ultra Plus (The King of Fighters 2003 bootleg) */
void kof2k3bl_prot_device::upl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
UINT8 *src = cpurom;
memmove(src + 0x100000, src, 0x600000);
memmove(src, src + 0x700000, 0x100000);
UINT8 *rom = cpurom + 0xfe000;
UINT8 *buf = cpurom + 0xd0610;
for (int i = 0; i < 0x2000 / 2; i++)
{
int ofst = (i & 0xff00) + BITSWAP8((i & 0x00ff), 7, 6, 0, 4, 3, 2, 1, 5);
memcpy(&rom[i * 2], &buf[ofst * 2], 2);
}
UINT16* rom16 = (UINT16*)cpurom;
m_overlay = rom16[0x58196 / 2];
}

View File

@ -0,0 +1,40 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
#ifndef __KOF2K3BL_PROT__
#define __KOF2K3BL_PROT__
extern const device_type KOF2K3BL_PROT;
#define MCFG_KOF2K3BL_PROT_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, KOF2K3BL_PROT, 0)
class kof2k3bl_prot_device : public device_t
{
public:
// construction/destruction
kof2k3bl_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_READ16_MEMBER(protection_r);
DECLARE_WRITE16_MEMBER(kof2003_w);
DECLARE_WRITE16_MEMBER(kof2003p_w);
DECLARE_READ16_MEMBER(overlay_r);
void bl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void pl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void upl_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
UINT32 get_bank_base() {return m_bank_base; }
protected:
virtual void device_start() override;
virtual void device_reset() override;
private:
UINT16 m_overlay;
UINT32 m_bank_base;
UINT16 m_cartridge_ram[0x1000]; // bootlegs
};
#endif

View File

@ -0,0 +1,128 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#include "emu.h"
#include "prot_kof98.h"
extern const device_type KOF98_PROT = &device_creator<kof98_prot_device>;
kof98_prot_device::kof98_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, KOF98_PROT, "Neo Geo KOF 98 Protection", tag, owner, clock, "kof98_prot", __FILE__),
m_prot_state(0)
{}
void kof98_prot_device::device_start()
{
save_item(NAME(m_prot_state));
}
void kof98_prot_device::device_reset()
{
}
/* Kof98 uses an early encryption, quite different from the others */
void kof98_prot_device::decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
{
UINT8 *src = cpurom;
dynamic_buffer dst(0x200000);
int i, j, k;
static const UINT32 sec[]={ 0x000000, 0x100000, 0x000004, 0x100004, 0x10000a, 0x00000a, 0x10000e, 0x00000e };
static const UINT32 pos[]={ 0x000, 0x004, 0x00a, 0x00e };
memcpy(&dst[0], src, 0x200000);
for (i = 0x800; i < 0x100000; i += 0x200)
{
for (j = 0; j < 0x100; j += 0x10)
{
for (k = 0; k < 16; k += 2)
{
memcpy(&src[i+j+k], &dst[i+j+sec[k/2]+0x100], 2);
memcpy(&src[i+j+k+0x100], &dst[i+j+sec[k/2]], 2);
}
if (i >= 0x080000 && i < 0x0c0000)
{
for (k = 0; k < 4; k++)
{
memcpy(&src[i+j+pos[k]], &dst[i+j+pos[k]], 2);
memcpy(&src[i+j+pos[k]+0x100], &dst[i+j+pos[k]+0x100], 2);
}
}
else if (i >= 0x0c0000)
{
for (k = 0; k < 4; k++)
{
memcpy(&src[i+j+pos[k]], &dst[i+j+pos[k]+0x100], 2);
memcpy(&src[i+j+pos[k]+0x100], &dst[i+j+pos[k]], 2);
}
}
}
memcpy(&src[i+0x000000], &dst[i+0x000000], 2);
memcpy(&src[i+0x000002], &dst[i+0x100000], 2);
memcpy(&src[i+0x000100], &dst[i+0x000100], 2);
memcpy(&src[i+0x000102], &dst[i+0x100100], 2);
}
memmove(&src[0x100000], &src[0x200000], 0x400000);
UINT16* mem16 = (UINT16*)cpurom;
m_default_rom[0] = mem16[0x100/2];
m_default_rom[1] = mem16[0x102/2];
}
/************************ King of Fighters 98*******************
The encrypted set has a rom overlay feature, checked at
various points in the game.
Boards used: NEO-MVS PROGSF1 (1998.6.17) / NEO-MVS PROGSF1E (1998.6.18)
The boards have an ALTERA chip (EPM7128SQC100-15) which is tied to 242-P1
***************************************************************/
READ16_MEMBER(kof98_prot_device::protection_r)
{
if (m_prot_state == 1)
{
if (!offset)
return 0x00c2;
else
return 0x00fd;
}
if (m_prot_state == 2)
{
if (!offset)
return 0x4e45;
else
return 0x4f2d;
}
if (!offset)
return m_default_rom[0];
else
return m_default_rom[1];
}
/* when 0x20aaaa contains 0x0090 (word) then 0x100 (normally the neogeo header) should return 0x00c200fd worked out using real hw */
WRITE16_MEMBER( kof98_prot_device::protection_w )
{
/* info from razoola */
switch (data)
{
case 0x0090:
logerror ("%06x kof98 - protection 0x0090x\n", space.device().safe_pc());
m_prot_state = 1;
break;
case 0x00f0:
logerror ("%06x kof98 - protection 0x00f0x\n", space.device().safe_pc());
m_prot_state = 2;
break;
default: // 00aa is written, but not needed?
logerror ("%06x kof98 - unknown protection write %04x\n", space.device().safe_pc(), data);
break;
}
}

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
@ -19,11 +19,10 @@ public:
// construction/destruction
kof98_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void kof98_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size);
void install_kof98_protection(cpu_device* maincpu);
DECLARE_WRITE16_MEMBER(kof98_prot_w);
DECLARE_READ16_MEMBER(kof98_prot_r);
int kof98_prot_state;
void decrypt_68k(UINT8* cpurom, UINT32 cpurom_size);
DECLARE_WRITE16_MEMBER(protection_w);
DECLARE_READ16_MEMBER(protection_r);
int m_prot_state;
UINT16 m_default_rom[2];
protected:

View File

@ -0,0 +1,594 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***************************************************************************
Neo-Geo hardware encryption and protection used on bootleg cartridges
Many of the NeoGeo bootlegs use their own form of encryption and
protection, presumably to make them harder for other bootleggers to
copy. This encryption often involves non-trivial scrambling of the
program roms and the games are protected using an Altera chip which
provides some kind of rom overlay, patching parts of the code.
The graphics roms are usually scrambled in a different way to the
official SNK cartridges too.
Here we collect functions to emulate some of the protection devices used.
TODO: split different devices according to the chip responsible for them!
***************************************************************************/
#include "emu.h"
#include "prot_misc.h"
extern const device_type NEOBOOT_PROT = &device_creator<neoboot_prot_device>;
neoboot_prot_device::neoboot_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, NEOBOOT_PROT, "Neo Geo Bootleg Protection(s)", tag, owner, clock, "ngboot_prot", __FILE__)
{}
void neoboot_prot_device::device_start()
{
}
void neoboot_prot_device::device_reset()
{
}
/* General Bootleg Functions - used by more than 1 game */
void neoboot_prot_device::cx_decrypt(UINT8*sprrom, UINT32 sprrom_size)
{
int cx_size = sprrom_size;
UINT8 *rom = sprrom;
dynamic_buffer buf(cx_size);
memcpy(&buf[0], rom, cx_size);
for (int i = 0; i < cx_size / 0x40; i++)
memcpy(&rom[i * 0x40], &buf[(i ^ 1) * 0x40], 0x40);
}
void neoboot_prot_device::sx_decrypt(UINT8* fixed, UINT32 fixed_size, int value)
{
int sx_size = fixed_size;
UINT8 *rom = fixed;
if (value == 1)
{
dynamic_buffer buf(sx_size);
memcpy(&buf[0], rom, sx_size);
for (int i = 0; i < sx_size; i += 0x10)
{
memcpy(&rom[i], &buf[i + 8], 8);
memcpy(&rom[i + 8], &buf[i], 8);
}
}
else if (value == 2)
{
for (int i = 0; i < sx_size; i++)
rom[i] = BITSWAP8(rom[i], 7, 6, 0, 4, 3, 2, 1, 5);
}
}
/* The King of Fighters '97 Oroshi Plus 2003 (bootleg) */
void neoboot_prot_device::kof97oro_px_decode(UINT8* cpurom, UINT32 cpurom_size)
{
std::vector<UINT16> tmp(0x500000);
UINT16 *src = (UINT16*)cpurom;
for (int i = 0; i < 0x500000/2; i++)
tmp[i] = src[i ^ 0x7ffef];
memcpy(src, &tmp[0], 0x500000);
}
/* The King of Fighters 10th Anniversary Extra Plus (The King of Fighters 2002 bootleg) */
void neoboot_prot_device::kf10thep_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
UINT16 *rom = (UINT16*)cpurom;
std::vector<UINT16> buf(0x100000/2);
memcpy(&buf[0x000000/2], &rom[0x060000/2], 0x20000);
memcpy(&buf[0x020000/2], &rom[0x100000/2], 0x20000);
memcpy(&buf[0x040000/2], &rom[0x0e0000/2], 0x20000);
memcpy(&buf[0x060000/2], &rom[0x180000/2], 0x20000);
memcpy(&buf[0x080000/2], &rom[0x020000/2], 0x20000);
memcpy(&buf[0x0a0000/2], &rom[0x140000/2], 0x20000);
memcpy(&buf[0x0c0000/2], &rom[0x0c0000/2], 0x20000);
memcpy(&buf[0x0e0000/2], &rom[0x1a0000/2], 0x20000);
memcpy(&buf[0x0002e0/2], &rom[0x0402e0/2], 0x6a); // copy banked code to a new memory region
memcpy(&buf[0x0f92bc/2], &rom[0x0492bc/2], 0xb9e); // copy banked code to a new memory region
memcpy(rom, &buf[0], 0x100000);
for (int i = 0xf92bc/2; i < 0xf9e58/2; i++)
{
if (rom[i+0] == 0x4eb9 && rom[i+1] == 0x0000) rom[i+1] = 0x000F; // correct JSR in moved code
if (rom[i+0] == 0x4ef9 && rom[i+1] == 0x0000) rom[i+1] = 0x000F; // correct JMP in moved code
}
rom[0x00342/2] = 0x000f;
memmove(&rom[0x100000/2], &rom[0x200000/2], 0x600000);
}
/* The King of Fighters 10th Anniversary 2005 Unique (The King of Fighters 2002 bootleg) */
void neoboot_prot_device::kf2k5uni_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
UINT8 *src = cpurom;
UINT8 dst[0x80];
for (int i = 0; i < 0x800000; i += 0x80)
{
for (int j = 0; j < 0x80; j += 2)
{
int ofst = BITSWAP8(j, 0, 3, 4, 5, 6, 1, 2, 7);
memcpy(&dst[j], src + i + ofst, 2);
}
memcpy(src + i, &dst[0], 0x80);
}
memcpy(src, src + 0x600000, 0x100000); // Seems to be the same as kof10th
}
void neoboot_prot_device::kf2k5uni_sx_decrypt(UINT8* fixedrom, UINT32 fixedrom_size)
{
UINT8 *srom = fixedrom;
for (int i = 0; i < 0x20000; i++)
srom[i] = BITSWAP8(srom[i], 4, 5, 6, 7, 0, 1, 2, 3);
}
void neoboot_prot_device::kf2k5uni_mx_decrypt(UINT8* audiorom, UINT32 audiorom_size)
{
UINT8 *mrom = audiorom;
for (int i = 0; i < 0x30000; i++)
mrom[i] = BITSWAP8(mrom[i], 4, 5, 6, 7, 0, 1, 2, 3);
}
/* King of Fighters Special Edition 2004 (bootleg of King of Fighters 2002) */
void neoboot_prot_device::decrypt_kof2k4se_68k(UINT8* cpurom, UINT32 cpurom_size)
{
UINT8 *src = cpurom + 0x100000;
dynamic_buffer dst(0x400000);
static const int sec[] = {0x300000,0x200000,0x100000,0x000000};
memcpy(&dst[0], src, 0x400000);
for (int i = 0; i < 4; ++i)
memcpy(src + i * 0x100000, &dst[sec[i]], 0x100000);
}
/* Lansquenet 2004 (Shock Troopers - 2nd Squad bootleg) */
void neoboot_prot_device::lans2004_vx_decrypt(UINT8* ymsndrom, UINT32 ymsndrom_size)
{
UINT8 *rom = ymsndrom;
for (int i = 0; i < 0xA00000; i++)
rom[i] = BITSWAP8(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
}
void neoboot_prot_device::lans2004_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size)
{
// Descrambling P ROMs - Thanks to Razoola for the info
UINT8 *src = cpurom;
UINT16 *rom = (UINT16*)cpurom;
static const int sec[] = { 0x3, 0x8, 0x7, 0xc, 0x1, 0xa, 0x6, 0xd };
dynamic_buffer dst(0x600000);
for (int i = 0; i < 8; i++)
memcpy (&dst[i * 0x20000], src + sec[i] * 0x20000, 0x20000);
memcpy (&dst[0x0bbb00], src + 0x045b00, 0x001710);
memcpy (&dst[0x02fff0], src + 0x1a92be, 0x000010);
memcpy (&dst[0x100000], src + 0x200000, 0x400000);
memcpy (src, &dst[0], 0x600000);
for (int i = 0xbbb00/2; i < 0xbe000/2; i++)
{
if ((((rom[i] & 0xffbf)==0x4eb9) || ((rom[i] & 0xffbf)==0x43b9)) && (rom[i+1]==0x0000))
{
rom[i + 1] = 0x000b;
rom[i + 2] += 0x6000;
}
}
/* Patched by protection chip (Altera) ? */
rom[0x2d15c/2] = 0x000b;
rom[0x2d15e/2] = 0xbb00;
rom[0x2d1e4/2] = 0x6002;
rom[0x2ea7e/2] = 0x6002;
rom[0xbbcd0/2] = 0x6002;
rom[0xbbdf2/2] = 0x6002;
rom[0xbbe42/2] = 0x6002;
}
/* Samurai Shodown V / Samurai Spirits Zero (bootleg) */
void neoboot_prot_device::samsho5b_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
int px_size = cpurom_size;
UINT8 *rom = cpurom;
dynamic_buffer buf(px_size);
memcpy(&buf[0], rom, px_size);
for (int i = 0; i < px_size / 2; i++)
{
int ofst = BITSWAP8((i & 0x000ff), 7, 6, 5, 4, 3, 0, 1, 2);
ofst += (i & 0xfffff00);
ofst ^= 0x060005;
memcpy(&rom[i * 2], &buf[ofst * 2], 0x02);
}
memcpy(&buf[0], rom, px_size);
memcpy(&rom[0x000000], &buf[0x700000], 0x100000);
memcpy(&rom[0x100000], &buf[0x000000], 0x700000);
}
void neoboot_prot_device::samsho5b_vx_decrypt(UINT8* ymsndrom, UINT32 ymsndrom_size)
{
int vx_size = ymsndrom_size;
UINT8 *rom = ymsndrom;
for (int i = 0; i < vx_size; i++)
rom[i] = BITSWAP8(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
}
/* Metal Slug 5 Plus (bootleg) */
READ16_MEMBER( neoboot_prot_device::mslug5p_prot_r )
{
logerror("PC %06x: access protected\n", space.device().safe_pc());
return 0xa0;
}
// FIXME: temporarily moved to the driver, through mslug5p_bank_base() below
/*
WRITE16_MEMBER( neoboot_prot_device::ms5plus_bankswitch_w )
{
int bankaddress;
logerror("offset: %06x PC %06x: set banking %04x\n",offset,space.device().safe_pc(),data);
if ((offset == 0) && (data == 0xa0))
{
bankaddress = 0xa0;
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,space.device().safe_pc(),bankaddress);
}
else if(offset == 2)
{
data = data >> 4;
//data = data & 7;
bankaddress = data * 0x100000;
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,space.device().safe_pc(),bankaddress);
}
}
*/
UINT32 neoboot_prot_device::mslug5p_bank_base(UINT16 sel)
{
sel = sel >> 4;
//sel = sel & 7;
return sel * 0x100000;
}
/* The King of Gladiator (The King of Fighters '97 bootleg) */
// The protection patching here may be incomplete - Thanks to Razoola for the info
void neoboot_prot_device::kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
// the protection chip does some *very* strange things to the rom
UINT8 *src = cpurom;
dynamic_buffer dst(0x600000);
UINT16 *rom = (UINT16 *)cpurom;
static const int sec[] = { 0x3, 0x8, 0x7, 0xc, 0x1, 0xa, 0x6, 0xd };
for (int i = 0; i < 8; i++)
memcpy (&dst[i * 0x20000], src + sec[i] * 0x20000, 0x20000);
memcpy (&dst[0x0007a6], src + 0x0407a6, 0x000006);
memcpy (&dst[0x0007c6], src + 0x0407c6, 0x000006);
memcpy (&dst[0x0007e6], src + 0x0407e6, 0x000006);
memcpy (&dst[0x090000], src + 0x040000, 0x004000);
memcpy (&dst[0x100000], src + 0x200000, 0x400000);
memcpy (src, &dst[0], 0x600000);
for (int i = 0x90000/2; i < 0x94000/2; i++)
{
if (((rom[i] & 0xffbf) == 0x4eb9 || rom[i] == 0x43f9) && !rom[i + 1])
rom[i + 1] = 0x0009;
if (rom[i] == 0x4eb8)
rom[i] = 0x6100;
}
rom[0x007a8/2] = 0x0009;
rom[0x007c8/2] = 0x0009;
rom[0x007e8/2] = 0x0009;
rom[0x93408/2] = 0xf168;
rom[0x9340c/2] = 0xfb7a;
rom[0x924ac/2] = 0x0009;
rom[0x9251c/2] = 0x0009;
rom[0x93966/2] = 0xffda;
rom[0x93974/2] = 0xffcc;
rom[0x93982/2] = 0xffbe;
rom[0x93990/2] = 0xffb0;
rom[0x9399e/2] = 0xffa2;
rom[0x939ac/2] = 0xff94;
rom[0x939ba/2] = 0xff86;
rom[0x939c8/2] = 0xff78;
rom[0x939d4/2] = 0xfa5c;
rom[0x939e0/2] = 0xfa50;
rom[0x939ec/2] = 0xfa44;
rom[0x939f8/2] = 0xfa38;
rom[0x93a04/2] = 0xfa2c;
rom[0x93a10/2] = 0xfa20;
rom[0x93a1c/2] = 0xfa14;
rom[0x93a28/2] = 0xfa08;
rom[0x93a34/2] = 0xf9fc;
rom[0x93a40/2] = 0xf9f0;
rom[0x93a4c/2] = 0xfd14;
rom[0x93a58/2] = 0xfd08;
rom[0x93a66/2] = 0xf9ca;
rom[0x93a72/2] = 0xf9be;
}
/* SNK vs. CAPCOM SVC CHAOS (bootleg) */
void neoboot_prot_device::svcboot_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
static const UINT8 sec[] = { 0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00 };
int size = cpurom_size;
UINT8 *src = cpurom;
dynamic_buffer dst(size);
for (int i = 0; i < size / 0x100000; i++)
memcpy(&dst[i * 0x100000], &src[sec[i] * 0x100000], 0x100000);
for (int i = 0; i < size / 2; i++)
{
int ofst = BITSWAP8((i & 0x0000ff), 7, 6, 1, 0, 3, 2, 5, 4);
ofst += (i & 0xffff00);
memcpy(&src[i * 2], &dst[ofst * 2], 0x02);
}
}
void neoboot_prot_device::svcboot_cx_decrypt(UINT8* sprrom, UINT32 sprrom_size)
{
static const UINT8 idx_tbl[ 0x10 ] = { 0, 1, 0, 1, 2, 3, 2, 3, 3, 4, 3, 4, 4, 5, 4, 5, };
static const UINT8 bitswap4_tbl[ 6 ][ 4 ] = {
{ 3, 0, 1, 2 },
{ 2, 3, 0, 1 },
{ 1, 2, 3, 0 },
{ 0, 1, 2, 3 },
{ 3, 2, 1, 0 },
{ 3, 0, 2, 1 },
};
int size = sprrom_size;
UINT8 *src = sprrom;
dynamic_buffer dst(size);
memcpy(&dst[0], src, size);
for (int i = 0; i < size / 0x80; i++)
{
int idx = idx_tbl[(i & 0xf00) >> 8];
int bit0 = bitswap4_tbl[idx][0];
int bit1 = bitswap4_tbl[idx][1];
int bit2 = bitswap4_tbl[idx][2];
int bit3 = bitswap4_tbl[idx][3];
int ofst = BITSWAP8((i & 0x0000ff), 7, 6, 5, 4, bit3, bit2, bit1, bit0);
ofst += (i & 0xfffff00);
memcpy(&src[i * 0x80], &dst[ofst * 0x80], 0x80);
}
}
/* SNK vs. CAPCOM SVC CHAOS Plus (bootleg set 1) */
void neoboot_prot_device::svcplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
static const int sec[] = { 0x00, 0x03, 0x02, 0x05, 0x04, 0x01 };
int size = cpurom_size;
UINT8 *src = cpurom;
dynamic_buffer dst(size);
memcpy(&dst[0], src, size);
for (int i = 0; i < size / 2; i++)
{
int ofst = BITSWAP24((i & 0xfffff), 0x17, 0x16, 0x15, 0x14, 0x13, 0x00, 0x01, 0x02,
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
0x07, 0x06, 0x05, 0x04, 0x03, 0x10, 0x11, 0x12);
ofst ^= 0x0f0007;
ofst += (i & 0xff00000);
memcpy(&src[i * 0x02], &dst[ofst * 0x02], 0x02);
}
memcpy(&dst[0], src, size);
for (int i = 0; i < 6; i++)
memcpy(&src[i * 0x100000], &dst[sec[i] * 0x100000], 0x100000);
}
void neoboot_prot_device::svcplus_px_hack(UINT8* cpurom, UINT32 cpurom_size)
{
/* patched by the protection chip? */
UINT16 *mem16 = (UINT16 *)cpurom;
mem16[0x0f8016/2] = 0x33c1;
}
/* SNK vs. CAPCOM SVC CHAOS Plus (bootleg set 2) */
void neoboot_prot_device::svcplusa_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
static const int sec[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x00 };
int size = cpurom_size;
UINT8 *src = cpurom;
dynamic_buffer dst(size);
memcpy(&dst[0], src, size);
for (int i = 0; i < 6; i++)
memcpy(&src[i * 0x100000], &dst[sec[i] * 0x100000], 0x100000);
}
/* SNK vs. CAPCOM SVC CHAOS Super Plus (bootleg) */
void neoboot_prot_device::svcsplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
static const int sec[] = { 0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00 };
int size = cpurom_size;
UINT8 *src = cpurom;
dynamic_buffer dst(size);
memcpy(&dst[0], src, size);
for (int i = 0; i < size / 2; i++)
{
int ofst = BITSWAP16((i & 0x007fff), 0x0f, 0x00, 0x08, 0x09, 0x0b, 0x0a, 0x0c, 0x0d,
0x04, 0x03, 0x01, 0x07, 0x06, 0x02, 0x05, 0x0e);
ofst += (i & 0x078000);
ofst += sec[(i & 0xf80000) >> 19] << 19;
memcpy(&src[i * 2], &dst[ofst * 2], 0x02);
}
}
void neoboot_prot_device::svcsplus_px_hack(UINT8* cpurom, UINT32 cpurom_size)
{
/* patched by the protection chip? */
UINT16 *mem16 = (UINT16 *)cpurom;
mem16[0x9e90/2] = 0x000f;
mem16[0x9e92/2] = 0xc9c0;
mem16[0xa10c/2] = 0x4eb9;
mem16[0xa10e/2] = 0x000e;
mem16[0xa110/2] = 0x9750;
}
/* The King of Fighters 2002 (bootleg) */
void neoboot_prot_device::kof2002b_gfx_decrypt(UINT8 *src, int size)
{
static const UINT8 t[8][6] =
{
{ 0, 8, 7, 6, 2, 1 },
{ 1, 0, 8, 7, 6, 2 },
{ 2, 1, 0, 8, 7, 6 },
{ 6, 2, 1, 0, 8, 7 },
{ 7, 6, 2, 1, 0, 8 },
{ 0, 1, 2, 6, 7, 8 },
{ 2, 1, 0, 6, 7, 8 },
{ 8, 0, 7, 6, 2, 1 },
};
dynamic_buffer dst(0x10000);
for (int i = 0; i < size; i += 0x10000)
{
memcpy(&dst[0], src + i, 0x10000);
for (int j = 0; j < 0x200; j++)
{
int n = (j & 0x38) >> 3;
int ofst = BITSWAP16(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2], 5, 4, 3, t[n][3], t[n][4], t[n][5]);
memcpy(src + i + ofst * 128, &dst[j * 128], 128);
}
}
}
/* The King of Fighters 2002 Magic Plus (bootleg) */
void neoboot_prot_device::kf2k2mp_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
UINT8 *src = cpurom;
UINT8 dst[0x80];
memmove(src, src + 0x300000, 0x500000);
for (int i = 0; i < 0x800000; i+=0x80)
{
for (int j = 0; j < 0x80 / 2; j++)
{
int ofst = BITSWAP8( j, 6, 7, 2, 3, 4, 5, 0, 1 );
memcpy(dst + j * 2, src + i + ofst * 2, 2);
}
memcpy(src + i, dst, 0x80);
}
}
/* The King of Fighters 2002 Magic Plus II (bootleg) */
void neoboot_prot_device::kf2k2mp2_px_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
UINT8 *src = cpurom;
dynamic_buffer dst(0x600000);
memcpy(&dst[0x000000], &src[0x1C0000], 0x040000);
memcpy(&dst[0x040000], &src[0x140000], 0x080000);
memcpy(&dst[0x0C0000], &src[0x100000], 0x040000);
memcpy(&dst[0x100000], &src[0x200000], 0x400000);
memcpy(&src[0x000000], &dst[0x000000], 0x600000);
}
/* The King of Fighters 10th Anniversary (The King of Fighters 2002 bootleg) */
void neoboot_prot_device::kof10th_decrypt(UINT8* cpurom, UINT32 cpurom_size)
{
dynamic_buffer dst(0x900000);
UINT8 *src = cpurom;
memcpy(&dst[0x000000], src + 0x700000, 0x100000); // Correct (Verified in Uni-bios)
memcpy(&dst[0x100000], src + 0x000000, 0x800000);
for (int i = 0; i < 0x900000; i++)
{
int j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,2,9,8,7,1,5,4,3,10,6,0);
src[j] = dst[i];
}
// Altera protection chip patches these over P ROM
((UINT16*)src)[0x0124/2] = 0x000d; // Enables XOR for RAM moves, forces SoftDIPs, and USA region
((UINT16*)src)[0x0126/2] = 0xf7a8;
((UINT16*)src)[0x8bf4/2] = 0x4ef9; // Run code to change "S" data
((UINT16*)src)[0x8bf6/2] = 0x000d;
((UINT16*)src)[0x8bf8/2] = 0xf980;
}

View File

@ -0,0 +1,65 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
#ifndef __NEOBOOT_PROT__
#define __NEOBOOT_PROT__
extern const device_type NEOBOOT_PROT;
#define MCFG_NEOBOOT_PROT_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, NEOBOOT_PROT, 0)
class neoboot_prot_device : public device_t
{
public:
// construction/destruction
neoboot_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void cx_decrypt(UINT8* sprrom, UINT32 sprrom_size);
void sx_decrypt(UINT8* fixed, UINT32 fixed_size, int value);
void kof97oro_px_decode(UINT8* cpurom, UINT32 cpurom_size);
void kf10thep_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void kf2k5uni_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void kf2k5uni_sx_decrypt(UINT8* fixedrom, UINT32 fixedrom_size);
void kf2k5uni_mx_decrypt(UINT8* audiorom, UINT32 audiorom_size);
void decrypt_kof2k4se_68k(UINT8* cpurom, UINT32 cpurom_size);
void lans2004_vx_decrypt(UINT8* ymsndrom, UINT32 ymsndrom_size);
void lans2004_decrypt_68k(UINT8* cpurom, UINT32 cpurom_size);
void samsho5b_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void samsho5b_vx_decrypt(UINT8* ymsndrom, UINT32 ymsndrom_size);
DECLARE_READ16_MEMBER(mslug5p_prot_r);
//DECLARE_WRITE16_MEMBER(ms5plus_bankswitch_w);
UINT32 mslug5p_bank_base(UINT16 sel);
void kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void svcboot_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void svcboot_cx_decrypt(UINT8*sprrom, UINT32 sprrom_size);
void svcplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void svcplus_px_hack(UINT8* cpurom, UINT32 cpurom_size);
void svcplusa_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void svcsplus_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void svcsplus_px_hack(UINT8* cpurom, UINT32 cpurom_size);
void kof2002b_gfx_decrypt(UINT8 *src, int size);
void kf2k2mp_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void kf2k2mp2_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
void kof10th_decrypt(UINT8* cpurom, UINT32 cpurom_size);
protected:
virtual void device_start() override;
virtual void device_reset() override;
};
#endif

View File

@ -1,25 +1,23 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#include "emu.h"
#include "mslugx_prot.h"
#include "prot_mslugx.h"
extern const device_type MSLUGX_PROT = &device_creator<mslugx_prot_device>;
mslugx_prot_device::mslugx_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MSLUGX_PROT, "NeoGeo Protection (Metal Slug X)", tag, owner, clock, "mslugx_prot", __FILE__),
m_mslugx_counter(0),
m_mslugx_command(0)
{
}
mslugx_prot_device::mslugx_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, MSLUGX_PROT, "Neo Geo Metal Slug X Protection", tag, owner, clock, "mslugx_prot", __FILE__),
m_counter(0),
m_command(0)
{}
void mslugx_prot_device::device_start()
{
save_item(NAME(m_mslugx_command));
save_item(NAME(m_mslugx_counter));
save_item(NAME(m_command));
save_item(NAME(m_counter));
}
void mslugx_prot_device::device_reset()
@ -27,33 +25,31 @@ void mslugx_prot_device::device_reset()
}
/************************ Metal Slug X *************************
Board used: NEO-MVS PROGEOP (1999.2.2)
The board has an ALTERA chip (EPM7128SQC100-15) which is tied to 250-P1
Also found is a QFP144 chip labeled with 0103 - function unknown
***************************************************************/
WRITE16_MEMBER( mslugx_prot_device::mslugx_protection_16_w )
WRITE16_MEMBER( mslugx_prot_device::protection_w )
{
switch (offset)
{
case 0x0/2: // start new read?
m_mslugx_command = 0;
m_command = 0;
break;
case 0x2/2: // command? These are pulsed with data and then 0
case 0x4/2:
m_mslugx_command |= data;
m_command |= data;
break;
case 0x6/2: // finished?
break;
case 0xa/2: // init?
m_mslugx_counter = 0;
m_mslugx_command = 0;
m_counter = 0;
m_command = 0;
break;
default:
@ -63,15 +59,15 @@ WRITE16_MEMBER( mslugx_prot_device::mslugx_protection_16_w )
}
READ16_MEMBER( mslugx_prot_device::mslugx_protection_16_r )
READ16_MEMBER( mslugx_prot_device::protection_r )
{
UINT16 res = 0;
switch (m_mslugx_command)
switch (m_command)
{
case 0x0001: { // $3bdc(?) and $3c30 (Register D7)
res = (space.read_byte(0xdedd2 + ((m_mslugx_counter >> 3) & 0xfff)) >> (~m_mslugx_counter & 0x07)) & 1;
m_mslugx_counter++;
res = (space.read_byte(0xdedd2 + ((m_counter >> 3) & 0xfff)) >> (~m_counter & 0x07)) & 1;
m_counter++;
}
break;
@ -89,9 +85,3 @@ READ16_MEMBER( mslugx_prot_device::mslugx_protection_16_r )
return res;
}
void mslugx_prot_device::mslugx_install_protection(cpu_device* maincpu)
{
maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2fffe0, 0x2fffef, read16_delegate(FUNC(mslugx_prot_device::mslugx_protection_16_r),this), write16_delegate(FUNC(mslugx_prot_device::mslugx_protection_16_w),this));
}

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
@ -19,17 +19,16 @@ public:
// construction/destruction
mslugx_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_WRITE16_MEMBER( mslugx_protection_16_w );
DECLARE_READ16_MEMBER( mslugx_protection_16_r );
void mslugx_install_protection(cpu_device* maincpu);
UINT16 m_mslugx_counter;
UINT16 m_mslugx_command;
DECLARE_WRITE16_MEMBER( protection_w );
DECLARE_READ16_MEMBER( protection_r );
protected:
virtual void device_start() override;
virtual void device_reset() override;
private:
UINT16 m_counter;
UINT16 m_command;
};
#endif

View File

@ -1,17 +1,16 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#include "emu.h"
#include "pcm2_prot.h"
#include "prot_pcm2.h"
extern const device_type PCM2_PROT = &device_creator<pcm2_prot_device>;
pcm2_prot_device::pcm2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, PCM2_PROT, "NeoGeo Protection (NEOPCM2)", tag, owner, clock, "pcm2_prot", __FILE__)
: device_t(mconfig, PCM2_PROT, "Neo Geo NEOPCM2 Protection", tag, owner, clock, "pcm2_prot", __FILE__)
{
}
@ -24,6 +23,7 @@ void pcm2_prot_device::device_reset()
{
}
/***************************************************************************
NeoGeo 'V' (PCM) ROM encryption
@ -31,31 +31,32 @@ NeoGeo 'V' (PCM) ROM encryption
***************************************************************************/
/* Neo-Pcm2 Drivers for Encrypted V Roms */
void pcm2_prot_device::neo_pcm2_snk_1999(UINT8* ymrom, UINT32 ymsize, int value)
{ /* thanks to Elsemi for the NEO-PCM2 info */
// Neo-Pcm2 Drivers for Encrypted V Roms
void pcm2_prot_device::decrypt(UINT8* ymrom, UINT32 ymsize, int value)
{
// thanks to Elsemi for the NEO-PCM2 info
UINT16 *rom = (UINT16 *)ymrom;
int size = ymsize;
int i, j;
if( rom != nullptr )
{ /* swap address lines on the whole ROMs */
if (rom != nullptr)
{
// swap address lines on the whole ROMs
std::vector<UINT16> buffer(value / 2);
for( i = 0; i < size / 2; i += ( value / 2 ) )
for (int i = 0; i < size / 2; i += (value / 2))
{
memcpy( &buffer[0], &rom[ i ], value );
for( j = 0; j < (value / 2); j++ )
memcpy(&buffer[0], &rom[i], value);
for (int j = 0; j < (value / 2); j++)
{
rom[ i + j ] = buffer[ j ^ (value/4) ];
rom[i + j] = buffer[j ^ (value/4)];
}
}
}
}
/* the later PCM2 games have additional scrambling */
void pcm2_prot_device::neo_pcm2_swap(UINT8* ymrom, UINT32 ymsize, int value)
// the later PCM2 games have additional scrambling
void pcm2_prot_device::swap(UINT8* ymrom, UINT32 ymsize, int value)
{
static const UINT32 addrs[7][2]={
{0x000000,0xa5000},
@ -75,14 +76,15 @@ void pcm2_prot_device::neo_pcm2_swap(UINT8* ymrom, UINT32 ymsize, int value)
{0x4b,0xa4,0x63,0x46,0xf0,0x91,0xea,0x62}};
dynamic_buffer buf(0x1000000);
int i, j, d;
int j, d;
UINT8* src = ymrom;
memcpy(&buf[0],src,0x1000000);
for (i=0;i<0x1000000;i++)
memcpy(&buf[0], src, 0x1000000);
for (int i = 0; i < 0x1000000; i++)
{
j=BITSWAP24(i,23,22,21,20,19,18,17,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,16);
j=j^addrs[value][1];
d=((i+addrs[value][0])&0xffffff);
src[j]=buf[d]^xordata[value][j&0x7];
j = BITSWAP24(i,23,22,21,20,19,18,17,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,16);
j ^= addrs[value][1];
d = ((i + addrs[value][0]) & 0xffffff);
src[j] = buf[d] ^ xordata[value][j & 0x7];
}
}

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
@ -19,8 +19,8 @@ public:
// construction/destruction
pcm2_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
void neo_pcm2_snk_1999(UINT8* ymrom, UINT32 ymsize, int value);
void neo_pcm2_swap(UINT8* ymrom, UINT32 ymsize, int value);
void decrypt(UINT8* ymrom, UINT32 ymsize, int value);
void swap(UINT8* ymrom, UINT32 ymsize, int value);
protected:
virtual void device_start() override;

View File

@ -0,0 +1,292 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#include "emu.h"
#include "prot_pvc.h"
extern const device_type PVC_PROT = &device_creator<pvc_prot_device>;
pvc_prot_device::pvc_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, PVC_PROT, "Neo Geo PVC Protection", tag, owner, clock, "pvc_prot", __FILE__)
{}
void pvc_prot_device::device_start()
{
save_item(NAME(m_cart_ram));
}
void pvc_prot_device::device_reset()
{
}
/************************ PVC Protection ***********************
mslug5, svcchaos, kof2003
***************************************************************/
void pvc_prot_device::pvc_write_unpack_color()
{
UINT16 pen = m_cart_ram[0xff0];
UINT8 b = ((pen & 0x000f) << 1) | ((pen & 0x1000) >> 12);
UINT8 g = ((pen & 0x00f0) >> 3) | ((pen & 0x2000) >> 13);
UINT8 r = ((pen & 0x0f00) >> 7) | ((pen & 0x4000) >> 14);
UINT8 s = (pen & 0x8000) >> 15;
m_cart_ram[0xff1] = (g << 8) | b;
m_cart_ram[0xff2] = (s << 8) | r;
}
void pvc_prot_device::pvc_write_pack_color()
{
UINT16 gb = m_cart_ram[0xff4];
UINT16 sr = m_cart_ram[0xff5];
m_cart_ram[0xff6] = ((gb & 0x001e) >> 1) |
((gb & 0x1e00) >> 5) |
((sr & 0x001e) << 7) |
((gb & 0x0001) << 12) |
((gb & 0x0100) << 5) |
((sr & 0x0001) << 14) |
((sr & 0x0100) << 7);
}
/*void pvc_prot_device::pvc_write_bankswitch()
{
UINT32 bankaddress = ((m_cart_ram[0xff8] >> 8)|(m_cart_ram[0xff9] << 8));
m_cart_ram[0xff8] = (m_cart_ram[0xff8] & 0xfe00) | 0x00a0;
m_cart_ram[0xff9] &= 0x7fff;
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress + 0x100000);
}
*/
UINT32 pvc_prot_device::get_bank_base()
{
UINT32 bankaddress = ((m_cart_ram[0xff8] >> 8)|(m_cart_ram[0xff9] << 8));
m_cart_ram[0xff8] = (m_cart_ram[0xff8] & 0xfe00) | 0x00a0;
m_cart_ram[0xff9] &= 0x7fff;
return bankaddress + 0x100000;
}
READ16_MEMBER( pvc_prot_device::protection_r )
{
return m_cart_ram[offset];
}
WRITE16_MEMBER( pvc_prot_device::protection_w )
{
COMBINE_DATA(&m_cart_ram[offset]);
if (offset == 0xff0)
pvc_write_unpack_color();
else if (offset >= 0xff4 && offset <= 0xff5)
pvc_write_pack_color();
// FIXME: temporarily moved to the driver, through get_bank_base() above
// else if(offset >= 0xff8)
// pvc_write_bankswitch(space);
}
/* kf2k3pcb, kof2003, kof2003h, mslug5 and svc have updated P rom scramble */
void pvc_prot_device::mslug5_decrypt_68k(UINT8* rom, UINT32 size)
{
static const UINT8 xor1[0x20] = { 0xc2, 0x4b, 0x74, 0xfd, 0x0b, 0x34, 0xeb, 0xd7, 0x10, 0x6d, 0xf9, 0xce, 0x5d, 0xd5, 0x61, 0x29, 0xf5, 0xbe, 0x0d, 0x82, 0x72, 0x45, 0x0f, 0x24, 0xb3, 0x34, 0x1b, 0x99, 0xea, 0x09, 0xf3, 0x03 };
static const UINT8 xor2[0x20] = { 0x36, 0x09, 0xb0, 0x64, 0x95, 0x0f, 0x90, 0x42, 0x6e, 0x0f, 0x30, 0xf6, 0xe5, 0x08, 0x30, 0x64, 0x08, 0x04, 0x00, 0x2f, 0x72, 0x09, 0xa0, 0x13, 0xc9, 0x0b, 0xa0, 0x3e, 0xc2, 0x00, 0x40, 0x2b };
int rom_size = 0x800000;
dynamic_buffer buf(rom_size);
for (int i = 0; i < 0x100000; i++)
rom[i] ^= xor1[(BYTE_XOR_LE(i) % 0x20)];
for (int i = 0x100000; i < 0x800000; i++)
rom[i] ^= xor2[(BYTE_XOR_LE(i) % 0x20)];
for (int i = 0x100000; i < 0x0800000; i += 4)
{
UINT16 rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
memcpy(&buf[0], rom, rom_size);
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
memcpy(&rom[i * 0x10000], &buf[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x800000; i += 0x100)
{
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00700) + (BITSWAP8(((i & 0x0ff000) >> 12), 5, 4, 7, 6, 1, 0, 3, 2) << 12);
memcpy(&rom[i], &buf[ofst], 0x100);
}
memcpy(&buf[0], rom, rom_size);
memcpy(&rom[0x100000], &buf[0x700000], 0x100000);
memcpy(&rom[0x200000], &buf[0x100000], 0x600000);
}
void pvc_prot_device::svc_px_decrypt(UINT8* rom, UINT32 size)
{
static const UINT8 xor1[0x20] = { 0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8, 0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f };
static const UINT8 xor2[0x20] = { 0x69, 0x0b, 0x60, 0xd6, 0x4f, 0x01, 0x40, 0x1a, 0x9f, 0x0b, 0xf0, 0x75, 0x58, 0x0e, 0x60, 0xb4, 0x14, 0x04, 0x20, 0xe4, 0xb9, 0x0d, 0x10, 0x89, 0xeb, 0x07, 0x30, 0x90, 0x50, 0x0e, 0x20, 0x26 };
int rom_size = 0x800000;
dynamic_buffer buf(rom_size);
for (int i = 0; i < 0x100000; i++)
rom[i] ^= xor1[(BYTE_XOR_LE(i) % 0x20)];
for (int i = 0x100000; i < 0x800000; i++)
rom[i] ^= xor2[(BYTE_XOR_LE(i) % 0x20)];
for (int i = 0x100000; i < 0x0800000; i += 4)
{
UINT16 rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
memcpy(&buf[0], rom, rom_size);
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1);
memcpy(&rom[i * 0x10000], &buf[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x800000; i += 0x100)
{
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00a00) + (BITSWAP8(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
memcpy(&rom[i], &buf[ofst], 0x100);
}
memcpy(&buf[0], rom, rom_size );
memcpy(&rom[0x100000], &buf[0x700000], 0x100000);
memcpy(&rom[0x200000], &buf[0x100000], 0x600000);
}
void pvc_prot_device::kf2k3pcb_decrypt_68k(UINT8* rom, UINT32 size)
{
static const UINT8 xor2[ 0x20 ] = { 0xb4, 0x0f, 0x40, 0x6c, 0x38, 0x07, 0xd0, 0x3f, 0x53, 0x08, 0x80, 0xaa, 0xbe, 0x07, 0xc0, 0xfa, 0xd0, 0x08, 0x10, 0xd2, 0xf1, 0x03, 0x70, 0x7e, 0x87, 0x0b, 0x40, 0xf6, 0x2a, 0x0a, 0xe0, 0xf9 };
int rom_size = 0x900000;
dynamic_buffer buf(rom_size);
for (int i = 0; i < 0x100000; i++)
rom[0x800000 + i] ^= rom[0x100002 | i];
for (int i = 0x100000; i < 0x800000; i++)
rom[i] ^= xor2[(BYTE_XOR_LE(i) % 0x20)];
for (int i = 0x100000; i < 0x800000; i += 4)
{
UINT16 rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 4, 5, 6, 7, 8, 9, 10, 11, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x900000; i += 0x100)
{
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00300) + (BITSWAP8(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
memcpy(&buf[i], &rom[ofst], 0x100);
}
memcpy(&rom[0x000000], &buf[0x000000], 0x100000);
memcpy(&rom[0x100000], &buf[0x800000], 0x100000);
memcpy(&rom[0x200000], &buf[0x100000], 0x700000);
}
void pvc_prot_device::kof2003_decrypt_68k(UINT8* rom, UINT32 size)
{
static const UINT8 xor1[0x20] = { 0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8, 0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f };
static const UINT8 xor2[0x20] = { 0x2f, 0x02, 0x60, 0xbb, 0x77, 0x01, 0x30, 0x08, 0xd8, 0x01, 0xa0, 0xdf, 0x37, 0x0a, 0xf0, 0x65, 0x28, 0x03, 0xd0, 0x23, 0xd3, 0x03, 0x70, 0x42, 0xbb, 0x06, 0xf0, 0x28, 0xba, 0x0f, 0xf0, 0x7a };
int rom_size = 0x900000;
dynamic_buffer buf(rom_size);
for (int i = 0; i < 0x100000; i++)
rom[0x800000 + i] ^= rom[0x100002 | i];
for (int i = 0; i < 0x100000; i++)
rom[i] ^= xor1[(BYTE_XOR_LE(i) % 0x20)];
for (int i = 0x100000; i < 0x800000; i++)
rom[i] ^= xor2[(BYTE_XOR_LE(i) % 0x20)];
for (int i = 0x100000; i < 0x800000; i += 4)
{
UINT16 rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 5, 4, 7, 6, 9, 8, 11, 10, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 0, 1, 2, 3);
memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x900000; i += 0x100)
{
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00800) + (BITSWAP8(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
memcpy(&buf[i], &rom[ofst], 0x100);
}
memcpy(&rom[0x000000], &buf[0x000000], 0x100000);
memcpy(&rom[0x100000], &buf[0x800000], 0x100000);
memcpy(&rom[0x200000], &buf[0x100000], 0x700000);
}
void pvc_prot_device::kof2003h_decrypt_68k(UINT8* rom, UINT32 size)
{
static const UINT8 xor1[0x20] = { 0xc2, 0x4b, 0x74, 0xfd, 0x0b, 0x34, 0xeb, 0xd7, 0x10, 0x6d, 0xf9, 0xce, 0x5d, 0xd5, 0x61, 0x29, 0xf5, 0xbe, 0x0d, 0x82, 0x72, 0x45, 0x0f, 0x24, 0xb3, 0x34, 0x1b, 0x99, 0xea, 0x09, 0xf3, 0x03 };
static const UINT8 xor2[0x20] = { 0x2b, 0x09, 0xd0, 0x7f, 0x51, 0x0b, 0x10, 0x4c, 0x5b, 0x07, 0x70, 0x9d, 0x3e, 0x0b, 0xb0, 0xb6, 0x54, 0x09, 0xe0, 0xcc, 0x3d, 0x0d, 0x80, 0x99, 0x87, 0x03, 0x90, 0x82, 0xfe, 0x04, 0x20, 0x18 };
int rom_size = 0x900000;
dynamic_buffer buf(rom_size);
for (int i = 0; i < 0x100000; i++)
rom[0x800000 + i] ^= rom[0x100002 | i];
for (int i = 0; i < 0x100000; i++)
rom[i] ^= xor1[(BYTE_XOR_LE(i) % 0x20)];
for (int i = 0x100000; i < 0x800000; i++)
rom[i] ^= xor2[(BYTE_XOR_LE(i) % 0x20)];
for (int i = 0x100000; i < 0x800000; i += 4)
{
UINT16 rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x900000; i += 0x100)
{
int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00400) + (BITSWAP8(((i & 0x0ff000) >> 12), 6, 7, 4, 5, 0, 1, 2, 3) << 12);
memcpy(&buf[i], &rom[ofst], 0x100);
}
memcpy(&rom[0x000000], &buf[0x000000], 0x100000);
memcpy(&rom[0x100000], &buf[0x800000], 0x100000);
memcpy(&rom[0x200000], &buf[0x100000], 0x700000);
}

View File

@ -1,10 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
#include "banked_cart.h"
#ifndef __PVC_PROT__
#define __PVC_PROT__
@ -22,13 +20,12 @@ public:
void pvc_write_unpack_color();
void pvc_write_pack_color();
void pvc_write_bankswitch(address_space &space);
DECLARE_READ16_MEMBER(pvc_prot_r);
DECLARE_WRITE16_MEMBER(pvc_prot_w);
void install_pvc_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev);
neogeo_banked_cart_device* m_bankdev;
// void pvc_write_bankswitch(address_space &space);
UINT32 get_bank_base();
DECLARE_READ16_MEMBER(protection_r);
DECLARE_WRITE16_MEMBER(protection_w);
UINT16 m_cartridge_ram[0x1000];
UINT16 m_cart_ram[0x1000];
void mslug5_decrypt_68k(UINT8* rom, UINT32 size);
void svc_px_decrypt(UINT8* rom, UINT32 size);

View File

@ -0,0 +1,520 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#include "emu.h"
#include "prot_sma.h"
extern const device_type SMA_PROT = &device_creator<sma_prot_device>;
sma_prot_device::sma_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, SMA_PROT, "Neo Geo SMA Protection", tag, owner, clock, "sma_prot", __FILE__),
m_sma_rng(0)
{}
void sma_prot_device::device_start()
{
save_item(NAME(m_sma_rng));
}
void sma_prot_device::device_reset()
{
m_sma_rng = 0x2345;
}
/************************ SMA Protection************************
thanks to Razoola
***************************************************************/
// temporarily replaced by the get_bank_base functions below, until we clean up bankswitch implementation
#if 0
WRITE16_MEMBER( sma_prot_device::kof99_bankswitch_w )
{
int bankaddress;
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000,
0x3cc000, 0x4cc000, 0x3f2000, 0x4f2000,
0x407800, 0x507800, 0x40d000, 0x50d000,
0x417800, 0x517800, 0x420800, 0x520800,
0x424800, 0x524800, 0x429000, 0x529000,
0x42e800, 0x52e800, 0x431800, 0x531800,
0x54d000, 0x551000, 0x567000, 0x592800,
0x588800, 0x581800, 0x599800, 0x594800,
0x598000, /* rest not used? */
};
// unscramble bank number
data =
(BIT(data, 14) << 0)+
(BIT(data, 6) << 1)+
(BIT(data, 8) << 2)+
(BIT(data, 10) << 3)+
(BIT(data, 12) << 4)+
(BIT(data, 5) << 5);
bankaddress = 0x100000 + bankoffset[data];
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
WRITE16_MEMBER( sma_prot_device::garou_bankswitch_w )
{
// thanks to Razoola and Mr K for the info
int bankaddress;
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000, // 00
0x280000, 0x380000, 0x2d0000, 0x3d0000, // 04
0x2f0000, 0x3f0000, 0x400000, 0x500000, // 08
0x420000, 0x520000, 0x440000, 0x540000, // 12
0x498000, 0x598000, 0x4a0000, 0x5a0000, // 16
0x4a8000, 0x5a8000, 0x4b0000, 0x5b0000, // 20
0x4b8000, 0x5b8000, 0x4c0000, 0x5c0000, // 24
0x4c8000, 0x5c8000, 0x4d0000, 0x5d0000, // 28
0x458000, 0x558000, 0x460000, 0x560000, // 32
0x468000, 0x568000, 0x470000, 0x570000, // 36
0x478000, 0x578000, 0x480000, 0x580000, // 40
0x488000, 0x588000, 0x490000, 0x590000, // 44
0x5d0000, 0x5d8000, 0x5e0000, 0x5e8000, // 48
0x5f0000, 0x5f8000, 0x600000, // rest not used?
};
// unscramble bank number
data =
(BIT(data, 5) << 0)+
(BIT(data, 9) << 1)+
(BIT(data, 7) << 2)+
(BIT(data, 6) << 3)+
(BIT(data, 14) << 4)+
(BIT(data, 12) << 5);
bankaddress = 0x100000 + bankoffset[data];
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
WRITE16_MEMBER( sma_prot_device::garouh_bankswitch_w )
{
// thanks to Razoola and Mr K for the info
int bankaddress;
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000, // 00
0x280000, 0x380000, 0x2d0000, 0x3d0000, // 04
0x2c8000, 0x3c8000, 0x400000, 0x500000, // 08
0x420000, 0x520000, 0x440000, 0x540000, // 12
0x598000, 0x698000, 0x5a0000, 0x6a0000, // 16
0x5a8000, 0x6a8000, 0x5b0000, 0x6b0000, // 20
0x5b8000, 0x6b8000, 0x5c0000, 0x6c0000, // 24
0x5c8000, 0x6c8000, 0x5d0000, 0x6d0000, // 28
0x458000, 0x558000, 0x460000, 0x560000, // 32
0x468000, 0x568000, 0x470000, 0x570000, // 36
0x478000, 0x578000, 0x480000, 0x580000, // 40
0x488000, 0x588000, 0x490000, 0x590000, // 44
0x5d8000, 0x6d8000, 0x5e0000, 0x6e0000, // 48
0x5e8000, 0x6e8000, 0x6e8000, 0x000000, // 52
0x000000, 0x000000, 0x000000, 0x000000, // 56
0x000000, 0x000000, 0x000000, 0x000000, // 60
};
// unscramble bank number
data =
(BIT(data, 4) << 0)+
(BIT(data, 8) << 1)+
(BIT(data, 14) << 2)+
(BIT(data, 2) << 3)+
(BIT(data, 11) << 4)+
(BIT(data, 13) << 5);
bankaddress = 0x100000 + bankoffset[data];
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
WRITE16_MEMBER( sma_prot_device::mslug3_bankswitch_w )
{
// thanks to Razoola and Mr K for the info
int bankaddress;
static const int bankoffset[64] =
{
0x000000, 0x020000, 0x040000, 0x060000, // 00
0x070000, 0x090000, 0x0b0000, 0x0d0000, // 04
0x0e0000, 0x0f0000, 0x120000, 0x130000, // 08
0x140000, 0x150000, 0x180000, 0x190000, // 12
0x1a0000, 0x1b0000, 0x1e0000, 0x1f0000, // 16
0x200000, 0x210000, 0x240000, 0x250000, // 20
0x260000, 0x270000, 0x2a0000, 0x2b0000, // 24
0x2c0000, 0x2d0000, 0x300000, 0x310000, // 28
0x320000, 0x330000, 0x360000, 0x370000, // 32
0x380000, 0x390000, 0x3c0000, 0x3d0000, // 36
0x400000, 0x410000, 0x440000, 0x450000, // 40
0x460000, 0x470000, 0x4a0000, 0x4b0000, // 44
0x4c0000, // rest not used?
};
// unscramble bank number
data =
(BIT(data, 14) << 0)+
(BIT(data, 12) << 1)+
(BIT(data, 15) << 2)+
(BIT(data, 6) << 3)+
(BIT(data, 3) << 4)+
(BIT(data, 9) << 5);
bankaddress = 0x100000 + bankoffset[data];
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
WRITE16_MEMBER( sma_prot_device::kof2000_bankswitch_w )
{
// thanks to Razoola and Mr K for the info
int bankaddress;
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000, // 00
0x3f7800, 0x4f7800, 0x3ff800, 0x4ff800, // 04
0x407800, 0x507800, 0x40f800, 0x50f800, // 08
0x416800, 0x516800, 0x41d800, 0x51d800, // 12
0x424000, 0x524000, 0x523800, 0x623800, // 16
0x526000, 0x626000, 0x528000, 0x628000, // 20
0x52a000, 0x62a000, 0x52b800, 0x62b800, // 24
0x52d000, 0x62d000, 0x52e800, 0x62e800, // 28
0x618000, 0x619000, 0x61a000, 0x61a800, // 32
};
// unscramble bank number
data =
(BIT(data, 15) << 0)+
(BIT(data, 14) << 1)+
(BIT(data, 7) << 2)+
(BIT(data, 3) << 3)+
(BIT(data, 10) << 4)+
(BIT(data, 5) << 5);
bankaddress = 0x100000 + bankoffset[data];
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
#endif
UINT32 sma_prot_device::kof99_bank_base(UINT16 sel)
{
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000,
0x3cc000, 0x4cc000, 0x3f2000, 0x4f2000,
0x407800, 0x507800, 0x40d000, 0x50d000,
0x417800, 0x517800, 0x420800, 0x520800,
0x424800, 0x524800, 0x429000, 0x529000,
0x42e800, 0x52e800, 0x431800, 0x531800,
0x54d000, 0x551000, 0x567000, 0x592800,
0x588800, 0x581800, 0x599800, 0x594800,
0x598000, /* rest not used? */
};
/* unscramble bank number */
int data =
(BIT(sel, 14) << 0)+
(BIT(sel, 6) << 1)+
(BIT(sel, 8) << 2)+
(BIT(sel, 10) << 3)+
(BIT(sel, 12) << 4)+
(BIT(sel, 5) << 5);
int bankaddress = 0x100000 + bankoffset[data];
return bankaddress;
}
UINT32 sma_prot_device::garou_bank_base(UINT16 sel)
{
// thanks to Razoola and Mr K for the info
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000, // 00
0x280000, 0x380000, 0x2d0000, 0x3d0000, // 04
0x2f0000, 0x3f0000, 0x400000, 0x500000, // 08
0x420000, 0x520000, 0x440000, 0x540000, // 12
0x498000, 0x598000, 0x4a0000, 0x5a0000, // 16
0x4a8000, 0x5a8000, 0x4b0000, 0x5b0000, // 20
0x4b8000, 0x5b8000, 0x4c0000, 0x5c0000, // 24
0x4c8000, 0x5c8000, 0x4d0000, 0x5d0000, // 28
0x458000, 0x558000, 0x460000, 0x560000, // 32
0x468000, 0x568000, 0x470000, 0x570000, // 36
0x478000, 0x578000, 0x480000, 0x580000, // 40
0x488000, 0x588000, 0x490000, 0x590000, // 44
0x5d0000, 0x5d8000, 0x5e0000, 0x5e8000, // 48
0x5f0000, 0x5f8000, 0x600000, // rest not used?
};
// unscramble bank number
int data =
(BIT(sel, 5) << 0)+
(BIT(sel, 9) << 1)+
(BIT(sel, 7) << 2)+
(BIT(sel, 6) << 3)+
(BIT(sel, 14) << 4)+
(BIT(sel, 12) << 5);
int bankaddress = 0x100000 + bankoffset[data];
return bankaddress;
}
UINT32 sma_prot_device::garouh_bank_base(UINT16 sel)
{
// thanks to Razoola and Mr K for the info
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000, // 00
0x280000, 0x380000, 0x2d0000, 0x3d0000, // 04
0x2c8000, 0x3c8000, 0x400000, 0x500000, // 08
0x420000, 0x520000, 0x440000, 0x540000, // 12
0x598000, 0x698000, 0x5a0000, 0x6a0000, // 16
0x5a8000, 0x6a8000, 0x5b0000, 0x6b0000, // 20
0x5b8000, 0x6b8000, 0x5c0000, 0x6c0000, // 24
0x5c8000, 0x6c8000, 0x5d0000, 0x6d0000, // 28
0x458000, 0x558000, 0x460000, 0x560000, // 32
0x468000, 0x568000, 0x470000, 0x570000, // 36
0x478000, 0x578000, 0x480000, 0x580000, // 40
0x488000, 0x588000, 0x490000, 0x590000, // 44
0x5d8000, 0x6d8000, 0x5e0000, 0x6e0000, // 48
0x5e8000, 0x6e8000, 0x6e8000, 0x000000, // 52
0x000000, 0x000000, 0x000000, 0x000000, // 56
0x000000, 0x000000, 0x000000, 0x000000, // 60
};
// unscramble bank number
int data =
(BIT(sel, 4) << 0)+
(BIT(sel, 8) << 1)+
(BIT(sel, 14) << 2)+
(BIT(sel, 2) << 3)+
(BIT(sel, 11) << 4)+
(BIT(sel, 13) << 5);
int bankaddress = 0x100000 + bankoffset[data];
return bankaddress;
}
UINT32 sma_prot_device::mslug3_bank_base(UINT16 sel)
{
// thanks to Razoola and Mr K for the info
static const int bankoffset[64] =
{
0x000000, 0x020000, 0x040000, 0x060000, // 00
0x070000, 0x090000, 0x0b0000, 0x0d0000, // 04
0x0e0000, 0x0f0000, 0x120000, 0x130000, // 08
0x140000, 0x150000, 0x180000, 0x190000, // 12
0x1a0000, 0x1b0000, 0x1e0000, 0x1f0000, // 16
0x200000, 0x210000, 0x240000, 0x250000, // 20
0x260000, 0x270000, 0x2a0000, 0x2b0000, // 24
0x2c0000, 0x2d0000, 0x300000, 0x310000, // 28
0x320000, 0x330000, 0x360000, 0x370000, // 32
0x380000, 0x390000, 0x3c0000, 0x3d0000, // 36
0x400000, 0x410000, 0x440000, 0x450000, // 40
0x460000, 0x470000, 0x4a0000, 0x4b0000, // 44
0x4c0000, // rest not used?
};
// unscramble bank number
int data =
(BIT(sel, 14) << 0)+
(BIT(sel, 12) << 1)+
(BIT(sel, 15) << 2)+
(BIT(sel, 6) << 3)+
(BIT(sel, 3) << 4)+
(BIT(sel, 9) << 5);
int bankaddress = 0x100000 + bankoffset[data];
return bankaddress;
}
UINT32 sma_prot_device::kof2000_bank_base(UINT16 sel)
{
// thanks to Razoola and Mr K for the info
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000, // 00
0x3f7800, 0x4f7800, 0x3ff800, 0x4ff800, // 04
0x407800, 0x507800, 0x40f800, 0x50f800, // 08
0x416800, 0x516800, 0x41d800, 0x51d800, // 12
0x424000, 0x524000, 0x523800, 0x623800, // 16
0x526000, 0x626000, 0x528000, 0x628000, // 20
0x52a000, 0x62a000, 0x52b800, 0x62b800, // 24
0x52d000, 0x62d000, 0x52e800, 0x62e800, // 28
0x618000, 0x619000, 0x61a000, 0x61a800, // 32
};
// unscramble bank number
int data =
(BIT(sel, 15) << 0)+
(BIT(sel, 14) << 1)+
(BIT(sel, 7) << 2)+
(BIT(sel, 3) << 3)+
(BIT(sel, 10) << 4)+
(BIT(sel, 5) << 5);
int bankaddress = 0x100000 + bankoffset[data];
return bankaddress;
}
READ16_MEMBER( sma_prot_device::prot_9a37_r )
{
return 0x9a37;
}
/* information about the sma random number generator provided by razoola */
/* this RNG is correct for KOF99, other games might be different */
READ16_MEMBER( sma_prot_device::random_r )
{
UINT16 old = m_sma_rng;
UINT16 newbit = ((m_sma_rng >> 2) ^
(m_sma_rng >> 3) ^
(m_sma_rng >> 5) ^
(m_sma_rng >> 6) ^
(m_sma_rng >> 7) ^
(m_sma_rng >>11) ^
(m_sma_rng >>12) ^
(m_sma_rng >>15)) & 1;
m_sma_rng = (m_sma_rng << 1) | newbit;
return old;
}
// kof99, garou, garouh, mslug3 and kof2000 have an SMA chip which contains program code and decrypts the 68k roms
void sma_prot_device::kof99_decrypt_68k(UINT8* base)
{
UINT16 *rom = (UINT16 *)(base + 0x100000);
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
rom[i] = BITSWAP16(rom[i],13,7,3,0,9,4,5,6,1,12,8,14,10,11,2,15);
// swap address lines for the banked part
for (int i = 0; i < 0x600000/2; i += 0x800/2)
{
UINT16 buffer[0x800/2];
memcpy(buffer, &rom[i], 0x800);
for (int j = 0; j < 0x800/2; j++)
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,6,2,4,9,8,3,1,7,0,5)];
}
// swap address lines & relocate fixed part
rom = (UINT16 *)base;
for (int i = 0; i < 0x0c0000/2; i++)
rom[i] = rom[0x700000/2 + BITSWAP24(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)];
}
void sma_prot_device::garou_decrypt_68k(UINT8* base)
{
// thanks to Razoola and Mr K for the info
UINT16 *rom = (UINT16 *)(base + 0x100000);
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
rom[i] = BITSWAP16(rom[i],13,12,14,10,8,2,3,1,5,9,11,4,15,0,6,7);
// swap address lines & relocate fixed part
rom = (UINT16 *)base;
for (int i = 0; i < 0x0c0000/2; i++)
rom[i] = rom[0x710000/2 + BITSWAP24(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)];
// swap address lines for the banked part
rom = (UINT16 *)(base + 0x100000);
for (int i = 0; i < 0x800000/2; i += 0x8000/2)
{
UINT16 buffer[0x8000/2];
memcpy(buffer, &rom[i], 0x8000);
for (int j = 0; j < 0x8000/2; j++)
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,9,4,8,3,13,6,2,7,0,12,1,11,10,5)];
}
}
void sma_prot_device::garouh_decrypt_68k(UINT8* base)
{
// thanks to Razoola and Mr K for the info
UINT16 *rom = (UINT16 *)(base + 0x100000);
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
rom[i] = BITSWAP16(rom[i],14,5,1,11,7,4,10,15,3,12,8,13,0,2,9,6);
// swap address lines & relocate fixed part
rom = (UINT16 *)base;
for (int i = 0; i < 0x0c0000/2; i++)
rom[i] = rom[0x7f8000/2 + BITSWAP24(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)];
// swap address lines for the banked part
rom = (UINT16 *)(base + 0x100000);
for (int i = 0; i < 0x800000/2; i += 0x8000/2)
{
UINT16 buffer[0x8000/2];
memcpy(buffer, &rom[i], 0x8000);
for (int j = 0; j < 0x8000/2; j++)
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,12,8,1,7,11,3,13,10,6,9,5,4,0,2)];
}
}
void sma_prot_device::mslug3_decrypt_68k(UINT8* base)
{
// thanks to Razoola and Mr K for the info
UINT16 *rom = (UINT16 *)(base + 0x100000);
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
rom[i] = BITSWAP16(rom[i],4,11,14,3,1,13,0,7,2,8,12,15,10,9,5,6);
// swap address lines & relocate fixed part
rom = (UINT16 *)base;
for (int i = 0; i < 0x0c0000/2; i++)
rom[i] = rom[0x5d0000/2 + BITSWAP24(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)];
// swap address lines for the banked part
rom = (UINT16 *)(base + 0x100000);
for (int i = 0; i < 0x800000/2; i += 0x10000/2)
{
UINT16 buffer[0x10000/2];
memcpy(buffer, &rom[i], 0x10000);
for (int j = 0; j < 0x10000/2; j++)
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,2,11,0,14,6,4,13,8,9,3,10,7,5,12,1)];
}
}
void sma_prot_device::kof2000_decrypt_68k(UINT8* base)
{
// thanks to Razoola and Mr K for the info
UINT16 *rom = (UINT16 *)(base + 0x100000);
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
rom[i] = BITSWAP16(rom[i],12,8,11,3,15,14,7,0,10,13,6,5,9,2,1,4);
// swap address lines for the banked part
for (int i = 0; i < 0x63a000/2; i += 0x800/2)
{
UINT16 buffer[0x800/2];
memcpy(buffer, &rom[i], 0x800);
for (int j = 0; j < 0x800/2; j++)
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,4,1,3,8,6,2,7,0,9,5)];
}
// swap address lines & relocate fixed part
rom = (UINT16 *)base;
for (int i = 0; i < 0x0c0000/2; i++)
rom[i] = rom[0x73a000/2 + BITSWAP24(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)];
}

View File

@ -0,0 +1,49 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
#ifndef __SMA_PROT__
#define __SMA_PROT__
extern const device_type SMA_PROT;
#define MCFG_SMA_PROT_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, SMA_PROT, 0)
class sma_prot_device : public device_t
{
public:
// construction/destruction
sma_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
//DECLARE_WRITE16_MEMBER( kof99_bankswitch_w );
//DECLARE_WRITE16_MEMBER( garou_bankswitch_w );
//DECLARE_WRITE16_MEMBER( garouh_bankswitch_w );
//DECLARE_WRITE16_MEMBER( mslug3_bankswitch_w );
//DECLARE_WRITE16_MEMBER( kof2000_bankswitch_w );
DECLARE_READ16_MEMBER( prot_9a37_r );
DECLARE_READ16_MEMBER( random_r );
UINT32 kof99_bank_base(UINT16 sel);
UINT32 garou_bank_base(UINT16 sel);
UINT32 garouh_bank_base(UINT16 sel);
UINT32 mslug3_bank_base(UINT16 sel);
UINT32 kof2000_bank_base(UINT16 sel);
void sma_install_random_read_handler(cpu_device* maincpu, int addr1, int addr2 );
void kof99_decrypt_68k(UINT8* base);
void garou_decrypt_68k(UINT8* base);
void garouh_decrypt_68k(UINT8* base);
void mslug3_decrypt_68k(UINT8* base);
void kof2000_decrypt_68k(UINT8* base);
protected:
virtual void device_start() override;
virtual void device_reset() override;
private:
UINT16 m_sma_rng;
};
#endif

View File

@ -1,14 +1,15 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
NEOGEO ROM cart emulation
Neo Geo cart emulation
PVC encrypted cart type (+ CMC + PCM2)
***********************************************************************************************************/
#include "emu.h"
#include "pvc_cart.h"
#include "pvc.h"
//-------------------------------------------------
@ -18,25 +19,19 @@
const device_type NEOGEO_PVC_CART = &device_creator<neogeo_pvc_cart>;
neogeo_pvc_cart::neogeo_pvc_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
neogeo_pvc_cart::neogeo_pvc_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source) :
neogeo_rom_device(mconfig, type, name, tag, owner, clock, shortname, source),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_pvc_prot(*this, "pvc_prot")
{
}
{}
neogeo_pvc_cart::neogeo_pvc_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_PVC_CART, "NEOGEO PCM2 Cart", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
neogeo_pvc_cart::neogeo_pvc_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_rom_device(mconfig, NEOGEO_PVC_CART, "Neo Geo PVC Cart", tag, owner, clock, "neocart_pvc", __FILE__),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_pvc_prot(*this, "pvc_prot")
{
}
{}
//-------------------------------------------------
@ -56,13 +51,7 @@ void neogeo_pvc_cart::device_reset()
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_pvc_cart::read_rom)
{
return m_rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( pvc_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_CMC_PROT_ADD("cmc_prot")
MCFG_PCM2_PROT_ADD("pcm2_prot")
MCFG_PVC_PROT_ADD("pvc_prot")
@ -75,65 +64,79 @@ machine_config_constructor neogeo_pvc_cart::device_mconfig_additions() const
/* Individual cartridge types (mirror DRIVER_INIT functionality) */
/*************************************************
MSLUG5
mslug5
**************************************************/
const device_type NEOGEO_PVC_MSLUG5_CART = &device_creator<neogeo_pvc_mslug5_cart>;
neogeo_pvc_mslug5_cart::neogeo_pvc_mslug5_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_pvc_cart(mconfig, NEOGEO_PVC_MSLUG5_CART, "NEOGEO PCM2 mslug5 Cart", tag, owner, clock, "p2_mslug5_cart", __FILE__) {}
neogeo_pvc_mslug5_cart::neogeo_pvc_mslug5_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_pvc_cart(mconfig, NEOGEO_PVC_MSLUG5_CART, "Neo Geo Metal Slug 5 PVC Cart", tag, owner, clock, "neocart_mslug5", __FILE__) {}
void neogeo_pvc_mslug5_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_pvc_prot->mslug5_decrypt_68k(cpuregion, cpuregion_size);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 2);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, MSLUG5_GFX_KEY);
m_pcm2_prot->swap(ym_region, ym_region_size, 2);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MSLUG5_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
SVC
svc
**************************************************/
const device_type NEOGEO_PVC_SVC_CART = &device_creator<neogeo_pvc_svc_cart>;
neogeo_pvc_svc_cart::neogeo_pvc_svc_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_pvc_cart(mconfig, NEOGEO_PVC_SVC_CART, "NEOGEO PCM2 svc Cart", tag, owner, clock, "p2_svc_cart", __FILE__) {}
neogeo_pvc_svc_cart::neogeo_pvc_svc_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_pvc_cart(mconfig, NEOGEO_PVC_SVC_CART, "Neo Geo SNK vs Capcom PVC Cart", tag, owner, clock, "neocart_svc", __FILE__)
{}
void neogeo_pvc_svc_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_pvc_prot->svc_px_decrypt(cpuregion, cpuregion_size);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 3);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, SVC_GFX_KEY);
m_pcm2_prot->swap(ym_region, ym_region_size, 3);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, SVC_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
KOF2003
kof2003
**************************************************/
const device_type NEOGEO_PVC_KOF2003_CART = &device_creator<neogeo_pvc_kof2003_cart>;
neogeo_pvc_kof2003_cart::neogeo_pvc_kof2003_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_pvc_cart(mconfig, NEOGEO_PVC_KOF2003_CART, "NEOGEO PCM2 kof2003 Cart", tag, owner, clock, "p2_kof2003_cart", __FILE__) {}
neogeo_pvc_kof2003_cart::neogeo_pvc_kof2003_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_pvc_cart(mconfig, NEOGEO_PVC_KOF2003_CART, "Neo Geo KOF 2003 PVC Cart", tag, owner, clock, "neocart_kof2003", __FILE__)
{}
void neogeo_pvc_kof2003_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_pvc_prot->kof2003_decrypt_68k(cpuregion, cpuregion_size);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 5);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2003_GFX_KEY);
m_pcm2_prot->swap(ym_region, ym_region_size, 5);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2003_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
kof2003h
**************************************************/
const device_type NEOGEO_PVC_KOF2003H_CART = &device_creator<neogeo_pvc_kof2003h_cart>;
neogeo_pvc_kof2003h_cart::neogeo_pvc_kof2003h_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_pvc_cart(mconfig, NEOGEO_PVC_KOF2003H_CART, "NEOGEO PCM2 kof2003h Cart", tag, owner, clock, "p2_kof2003h_cart", __FILE__) {}
neogeo_pvc_kof2003h_cart::neogeo_pvc_kof2003h_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_pvc_cart(mconfig, NEOGEO_PVC_KOF2003H_CART, "Neo Geo KOF 2003 AES PVC Cart", tag, owner, clock, "neocart_kof2003h", __FILE__)
{}
void neogeo_pvc_kof2003h_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_pvc_prot->kof2003h_decrypt_68k(cpuregion, cpuregion_size);
m_pcm2_prot->neo_pcm2_swap(ym_region, ym_region_size, 5);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2003_GFX_KEY);
m_pcm2_prot->swap(ym_region, ym_region_size, 5);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2003_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}

View File

@ -1,18 +1,17 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_PVC_CART_H
#define __NEOGEO_PVC_CART_H
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_PVC_H
#define __NEOGEO_PVC_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "pcm2_prot.h"
#include "cmc_prot.h"
#include "pvc_prot.h"
#include "slot.h"
#include "rom.h"
#include "prot_pcm2.h"
#include "prot_cmc.h"
#include "prot_pvc.h"
// ======================> neogeo_pvc_cart
class neogeo_pvc_cart : public device_t,
public device_neogeo_cart_interface
class neogeo_pvc_cart : public neogeo_rom_device
{
public:
// construction/destruction
@ -25,32 +24,25 @@ public:
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual void activate_cart(ACTIVATE_CART_PARAMS) override
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_pvc_prot->install_pvc_protection(maincpu,m_banked_cart);
}
virtual UINT32 get_bank_base(UINT16 sel) override { return m_pvc_prot->get_bank_base(); }
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_pvc_prot->protection_r(space, offset, mem_mask); }
virtual DECLARE_WRITE16_MEMBER(protection_w) override { m_pvc_prot->protection_w(space, offset, data, mem_mask); }
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override {}
virtual int get_fixed_bank_type(void) override { return 0; }
required_device<neogeo_banked_cart_device> m_banked_cart;
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<pvc_prot_device> m_pvc_prot;
};
// device type definition
extern const device_type NEOGEO_PVC_CART;
/*************************************************
MSLUG5
mslug5
**************************************************/
class neogeo_pvc_mslug5_cart : public neogeo_pvc_cart
@ -60,10 +52,12 @@ public:
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
};
extern const device_type NEOGEO_PVC_MSLUG5_CART;
/*************************************************
SVC
svc
**************************************************/
class neogeo_pvc_svc_cart : public neogeo_pvc_cart
@ -73,11 +67,12 @@ public:
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 2; }
};
extern const device_type NEOGEO_PVC_SVC_CART;
/*************************************************
KOF2003
kof2003
**************************************************/
class neogeo_pvc_kof2003_cart : public neogeo_pvc_cart
@ -87,11 +82,12 @@ public:
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 2; }
};
extern const device_type NEOGEO_PVC_KOF2003_CART;
/*************************************************
KOF2003H
kof2003h
**************************************************/
class neogeo_pvc_kof2003h_cart : public neogeo_pvc_cart

View File

@ -1,317 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#include "emu.h"
#include "pvc_prot.h"
extern const device_type PVC_PROT = &device_creator<pvc_prot_device>;
pvc_prot_device::pvc_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, PVC_PROT, "NeoGeo Protection (PVC)", tag, owner, clock, "pvc_prot", __FILE__),
m_bankdev(nullptr)
{
}
void pvc_prot_device::device_start()
{
save_item(NAME(m_cartridge_ram));
}
void pvc_prot_device::device_reset()
{
}
/************************ PVC Protection ***********************
mslug5, svcchaos, kof2003
***************************************************************/
void pvc_prot_device::pvc_write_unpack_color()
{
UINT16 pen = m_cartridge_ram[0xff0];
UINT8 b = ((pen & 0x000f) << 1) | ((pen & 0x1000) >> 12);
UINT8 g = ((pen & 0x00f0) >> 3) | ((pen & 0x2000) >> 13);
UINT8 r = ((pen & 0x0f00) >> 7) | ((pen & 0x4000) >> 14);
UINT8 s = (pen & 0x8000) >> 15;
m_cartridge_ram[0xff1] = (g << 8) | b;
m_cartridge_ram[0xff2] = (s << 8) | r;
}
void pvc_prot_device::pvc_write_pack_color()
{
UINT16 gb = m_cartridge_ram[0xff4];
UINT16 sr = m_cartridge_ram[0xff5];
m_cartridge_ram[0xff6] = ((gb & 0x001e) >> 1) |
((gb & 0x1e00) >> 5) |
((sr & 0x001e) << 7) |
((gb & 0x0001) << 12) |
((gb & 0x0100) << 5) |
((sr & 0x0001) << 14) |
((sr & 0x0100) << 7);
}
void pvc_prot_device::pvc_write_bankswitch( address_space &space )
{
UINT32 bankaddress;
bankaddress = ((m_cartridge_ram[0xff8] >> 8)|(m_cartridge_ram[0xff9] << 8));
m_cartridge_ram[0xff8] = (m_cartridge_ram[0xff8] & 0xfe00) | 0x00a0;
m_cartridge_ram[0xff9] &= 0x7fff;
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress + 0x100000);
}
READ16_MEMBER( pvc_prot_device::pvc_prot_r )
{
return m_cartridge_ram[offset];
}
WRITE16_MEMBER( pvc_prot_device::pvc_prot_w )
{
COMBINE_DATA(&m_cartridge_ram[offset] );
if (offset == 0xff0)
pvc_write_unpack_color();
else if(offset >= 0xff4 && offset <= 0xff5)
pvc_write_pack_color();
else if(offset >= 0xff8)
pvc_write_bankswitch(space);
}
void pvc_prot_device::install_pvc_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev)
{
m_bankdev = bankdev;
maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2fe000, 0x2fffff, read16_delegate(FUNC(pvc_prot_device::pvc_prot_r),this), write16_delegate(FUNC(pvc_prot_device::pvc_prot_w),this));
}
/* kf2k3pcb, kof2003, kof2003h, mslug5 and svc have updated P rom scramble */
void pvc_prot_device::mslug5_decrypt_68k(UINT8* rom, UINT32 size)
{
static const UINT8 xor1[ 0x20 ] = { 0xc2, 0x4b, 0x74, 0xfd, 0x0b, 0x34, 0xeb, 0xd7, 0x10, 0x6d, 0xf9, 0xce, 0x5d, 0xd5, 0x61, 0x29, 0xf5, 0xbe, 0x0d, 0x82, 0x72, 0x45, 0x0f, 0x24, 0xb3, 0x34, 0x1b, 0x99, 0xea, 0x09, 0xf3, 0x03 };
static const UINT8 xor2[ 0x20 ] = { 0x36, 0x09, 0xb0, 0x64, 0x95, 0x0f, 0x90, 0x42, 0x6e, 0x0f, 0x30, 0xf6, 0xe5, 0x08, 0x30, 0x64, 0x08, 0x04, 0x00, 0x2f, 0x72, 0x09, 0xa0, 0x13, 0xc9, 0x0b, 0xa0, 0x3e, 0xc2, 0x00, 0x40, 0x2b };
int i;
int ofst;
int rom_size = 0x800000;
dynamic_buffer buf( rom_size );
for( i = 0; i < 0x100000; i++ )
{
rom[ i ] ^= xor1[ (BYTE_XOR_LE(i) % 0x20) ];
}
for( i = 0x100000; i < 0x800000; i++ )
{
rom[ i ] ^= xor2[ (BYTE_XOR_LE(i) % 0x20) ];
}
for( i = 0x100000; i < 0x0800000; i += 4 )
{
UINT16 rom16;
rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)]<<8;
rom16 = BITSWAP16( rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0 );
rom[BYTE_XOR_LE(i+1)] = rom16&0xff;
rom[BYTE_XOR_LE(i+2)] = rom16>>8;
}
memcpy( &buf[0], rom, rom_size );
for( i = 0; i < 0x0100000 / 0x10000; i++ )
{
ofst = (i & 0xf0) + BITSWAP8( (i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2 );
memcpy( &rom[ i * 0x10000 ], &buf[ ofst * 0x10000 ], 0x10000 );
}
for( i = 0x100000; i < 0x800000; i += 0x100 )
{
ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00700) + (BITSWAP8( ((i & 0x0ff000) >> 12), 5, 4, 7, 6, 1, 0, 3, 2 ) << 12);
memcpy( &rom[ i ], &buf[ ofst ], 0x100 );
}
memcpy( &buf[0], rom, rom_size );
memcpy( &rom[ 0x100000 ], &buf[ 0x700000 ], 0x100000 );
memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x600000 );
}
void pvc_prot_device::svc_px_decrypt(UINT8* rom, UINT32 size)
{
static const UINT8 xor1[ 0x20 ] = { 0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8, 0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f };
static const UINT8 xor2[ 0x20 ] = { 0x69, 0x0b, 0x60, 0xd6, 0x4f, 0x01, 0x40, 0x1a, 0x9f, 0x0b, 0xf0, 0x75, 0x58, 0x0e, 0x60, 0xb4, 0x14, 0x04, 0x20, 0xe4, 0xb9, 0x0d, 0x10, 0x89, 0xeb, 0x07, 0x30, 0x90, 0x50, 0x0e, 0x20, 0x26 };
int i;
int ofst;
int rom_size = 0x800000;
dynamic_buffer buf( rom_size );
for( i = 0; i < 0x100000; i++ )
{
rom[ i ] ^= xor1[ (BYTE_XOR_LE(i) % 0x20) ];
}
for( i = 0x100000; i < 0x800000; i++ )
{
rom[ i ] ^= xor2[ (BYTE_XOR_LE(i) % 0x20) ];
}
for( i = 0x100000; i < 0x0800000; i += 4 )
{
UINT16 rom16;
rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)]<<8;
rom16 = BITSWAP16( rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0 );
rom[BYTE_XOR_LE(i+1)] = rom16&0xff;
rom[BYTE_XOR_LE(i+2)] = rom16>>8;
}
memcpy( &buf[0], rom, rom_size );
for( i = 0; i < 0x0100000 / 0x10000; i++ )
{
ofst = (i & 0xf0) + BITSWAP8( (i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1 );
memcpy( &rom[ i * 0x10000 ], &buf[ ofst * 0x10000 ], 0x10000 );
}
for( i = 0x100000; i < 0x800000; i += 0x100 )
{
ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00a00) + (BITSWAP8( ((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2 ) << 12);
memcpy( &rom[ i ], &buf[ ofst ], 0x100 );
}
memcpy( &buf[0], rom, rom_size );
memcpy( &rom[ 0x100000 ], &buf[ 0x700000 ], 0x100000 );
memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x600000 );
}
void pvc_prot_device::kf2k3pcb_decrypt_68k(UINT8* rom, UINT32 size)
{
static const UINT8 xor2[ 0x20 ] = { 0xb4, 0x0f, 0x40, 0x6c, 0x38, 0x07, 0xd0, 0x3f, 0x53, 0x08, 0x80, 0xaa, 0xbe, 0x07, 0xc0, 0xfa, 0xd0, 0x08, 0x10, 0xd2, 0xf1, 0x03, 0x70, 0x7e, 0x87, 0x0b, 0x40, 0xf6, 0x2a, 0x0a, 0xe0, 0xf9 };
int i;
int ofst;
int rom_size = 0x900000;
dynamic_buffer buf( rom_size );
for (i = 0; i < 0x100000; i++)
{
rom[ 0x800000 + i ] ^= rom[ 0x100002 | i ];
}
for( i = 0x100000; i < 0x800000; i++ )
{
rom[ i ] ^= xor2[ (BYTE_XOR_LE(i) % 0x20) ];
}
for( i = 0x100000; i < 0x800000; i += 4 )
{
UINT16 rom16;
rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)]<<8;
rom16 = BITSWAP16( rom16, 15, 14, 13, 12, 4, 5, 6, 7, 8, 9, 10, 11, 3, 2, 1, 0 );
rom[BYTE_XOR_LE(i+1)] = rom16&0xff;
rom[BYTE_XOR_LE(i+2)] = rom16>>8;
}
for( i = 0; i < 0x0100000 / 0x10000; i++ )
{
ofst = (i & 0xf0) + BITSWAP8( (i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2 );
memcpy( &buf[ i * 0x10000 ], &rom[ ofst * 0x10000 ], 0x10000 );
}
for( i = 0x100000; i < 0x900000; i += 0x100 )
{
ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00300) + (BITSWAP8( ((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2 ) << 12);
memcpy( &buf[ i ], &rom[ ofst ], 0x100 );
}
memcpy (&rom[0x000000], &buf[0x000000], 0x100000);
memcpy (&rom[0x100000], &buf[0x800000], 0x100000);
memcpy (&rom[0x200000], &buf[0x100000], 0x700000);
}
void pvc_prot_device::kof2003_decrypt_68k(UINT8* rom, UINT32 size)
{
static const UINT8 xor1[0x20] = { 0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8, 0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f };
static const UINT8 xor2[0x20] = { 0x2f, 0x02, 0x60, 0xbb, 0x77, 0x01, 0x30, 0x08, 0xd8, 0x01, 0xa0, 0xdf, 0x37, 0x0a, 0xf0, 0x65, 0x28, 0x03, 0xd0, 0x23, 0xd3, 0x03, 0x70, 0x42, 0xbb, 0x06, 0xf0, 0x28, 0xba, 0x0f, 0xf0, 0x7a };
int i;
int ofst;
int rom_size = 0x900000;
dynamic_buffer buf( rom_size );
for (i = 0; i < 0x100000; i++)
{
rom[ 0x800000 + i ] ^= rom[ 0x100002 | i ];
}
for( i = 0; i < 0x100000; i++)
{
rom[ i ] ^= xor1[ (BYTE_XOR_LE(i) % 0x20) ];
}
for( i = 0x100000; i < 0x800000; i++)
{
rom[ i ] ^= xor2[ (BYTE_XOR_LE(i) % 0x20) ];
}
for( i = 0x100000; i < 0x800000; i += 4)
{
UINT16 rom16;
rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)]<<8;
rom16 = BITSWAP16( rom16, 15, 14, 13, 12, 5, 4, 7, 6, 9, 8, 11, 10, 3, 2, 1, 0 );
rom[BYTE_XOR_LE(i+1)] = rom16&0xff;
rom[BYTE_XOR_LE(i+2)] = rom16>>8;
}
for( i = 0; i < 0x0100000 / 0x10000; i++ )
{
ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 0, 1, 2, 3);
memcpy( &buf[ i * 0x10000 ], &rom[ ofst * 0x10000 ], 0x10000 );
}
for( i = 0x100000; i < 0x900000; i += 0x100)
{
ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00800) + (BITSWAP8( ((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2 ) << 12);
memcpy( &buf[ i ], &rom[ ofst ], 0x100 );
}
memcpy (&rom[0x000000], &buf[0x000000], 0x100000);
memcpy (&rom[0x100000], &buf[0x800000], 0x100000);
memcpy (&rom[0x200000], &buf[0x100000], 0x700000);
}
void pvc_prot_device::kof2003h_decrypt_68k(UINT8* rom, UINT32 size)
{
static const UINT8 xor1[0x20] = { 0xc2, 0x4b, 0x74, 0xfd, 0x0b, 0x34, 0xeb, 0xd7, 0x10, 0x6d, 0xf9, 0xce, 0x5d, 0xd5, 0x61, 0x29, 0xf5, 0xbe, 0x0d, 0x82, 0x72, 0x45, 0x0f, 0x24, 0xb3, 0x34, 0x1b, 0x99, 0xea, 0x09, 0xf3, 0x03 };
static const UINT8 xor2[0x20] = { 0x2b, 0x09, 0xd0, 0x7f, 0x51, 0x0b, 0x10, 0x4c, 0x5b, 0x07, 0x70, 0x9d, 0x3e, 0x0b, 0xb0, 0xb6, 0x54, 0x09, 0xe0, 0xcc, 0x3d, 0x0d, 0x80, 0x99, 0x87, 0x03, 0x90, 0x82, 0xfe, 0x04, 0x20, 0x18 };
int i;
int ofst;
int rom_size = 0x900000;
dynamic_buffer buf( rom_size );
for (i = 0; i < 0x100000; i++)
{
rom[ 0x800000 + i ] ^= rom[ 0x100002 | i ];
}
for( i = 0; i < 0x100000; i++)
{
rom[ i ] ^= xor1[ (BYTE_XOR_LE(i) % 0x20) ];
}
for( i = 0x100000; i < 0x800000; i++)
{
rom[ i ] ^= xor2[ (BYTE_XOR_LE(i) % 0x20) ];
}
for( i = 0x100000; i < 0x800000; i += 4)
{
UINT16 rom16;
rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)]<<8;
rom16 = BITSWAP16( rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0 );
rom[BYTE_XOR_LE(i+1)] = rom16&0xff;
rom[BYTE_XOR_LE(i+2)] = rom16>>8;
}
for( i = 0; i < 0x0100000 / 0x10000; i++ )
{
ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
memcpy( &buf[ i * 0x10000 ], &rom[ ofst * 0x10000 ], 0x10000 );
}
for( i = 0x100000; i < 0x900000; i += 0x100)
{
ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00400) + (BITSWAP8( ((i & 0x0ff000) >> 12), 6, 7, 4, 5, 0, 1, 2, 3 ) << 12);
memcpy( &buf[ i ], &rom[ ofst ], 0x100 );
}
memcpy (&rom[0x000000], &buf[0x000000], 0x100000);
memcpy (&rom[0x100000], &buf[0x800000], 0x100000);
memcpy (&rom[0x200000], &buf[0x100000], 0x700000);
}

View File

@ -1,8 +1,10 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
NEOGEO ROM cart emulation
Neo Geo cart emulation
Standard cart type, possibly with bankswitch in the area beyond 0x100000
(We also include here V-Liner, which uses a standard cart + RAM + some custom input)
***********************************************************************************************************/
@ -18,19 +20,15 @@
const device_type NEOGEO_ROM = &device_creator<neogeo_rom_device>;
neogeo_rom_device::neogeo_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface( mconfig, *this ),
m_banked_cart(*this, "banked_cart")
{
}
neogeo_rom_device::neogeo_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface(mconfig, *this)
{}
neogeo_rom_device::neogeo_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_ROM, "NEOGEO ROM Carts", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface( mconfig, *this ),
m_banked_cart(*this, "banked_cart")
{
}
neogeo_rom_device::neogeo_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
device_t(mconfig, NEOGEO_ROM, "Neo Geo Standard Carts", tag, owner, clock, "neocart_rom", __FILE__),
device_neogeo_cart_interface(mconfig, *this)
{}
//-------------------------------------------------
@ -50,21 +48,41 @@ void neogeo_rom_device::device_reset()
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_rom_device::read_rom)
READ16_MEMBER(neogeo_rom_device::rom_r)
{
return m_rom[offset];
// to speed up access to ROM, the access to ROM are actually replaced in the driver
// by accesses to the maincpu rom region, where we have anyway copied the rom content
UINT16* rom = (get_rom_size()) ? get_rom_base() : get_region_rom_base();
return rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( banked_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MACHINE_CONFIG_END
machine_config_constructor neogeo_rom_device::device_mconfig_additions() const
WRITE16_MEMBER(neogeo_rom_device::banksel_w)
{
return MACHINE_CONFIG_NAME( banked_cart );
// to speed up access to ROM, the banking is taken care of at driver level
// by mapping higher banks to the corresponding offset in maincpu rom region
}
void neogeo_rom_device::activate_cart(ACTIVATE_CART_PARAMS)
/*************************************************
V-Liner : this is plain NeoGeo cart + RAM
**************************************************/
const device_type NEOGEO_VLINER_CART = &device_creator<neogeo_vliner_cart>;
neogeo_vliner_cart::neogeo_vliner_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_rom_device(mconfig, NEOGEO_VLINER_CART, "Neo Geo V-Liner Cart", tag, owner, clock, "neocart_vliner", __FILE__)
{}
void neogeo_vliner_cart::device_start()
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
save_item(NAME(m_cart_ram));
}
void neogeo_vliner_cart::device_reset()
{
memset(m_cart_ram, 0, 0x2000);
}

View File

@ -1,10 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_ROM_H
#define __NEOGEO_ROM_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "slot.h"
// ======================> neogeo_rom_device
@ -19,14 +18,10 @@ public:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual void activate_cart(ACTIVATE_CART_PARAMS) override;
required_device<neogeo_banked_cart_device> m_banked_cart;
virtual DECLARE_READ16_MEMBER(rom_r) override;
virtual DECLARE_WRITE16_MEMBER(banksel_w) override;
};
@ -35,4 +30,29 @@ public:
extern const device_type NEOGEO_ROM;
/*************************************************
vliner
**************************************************/
class neogeo_vliner_cart : public neogeo_rom_device
{
public:
neogeo_vliner_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual DECLARE_READ16_MEMBER(ram_r) override { return m_cart_ram[offset]; }
virtual DECLARE_WRITE16_MEMBER(ram_w) override { COMBINE_DATA(&m_cart_ram[offset]); }
virtual int get_fixed_bank_type(void) override { return 0; }
virtual void device_start() override;
virtual void device_reset() override;
private:
UINT16 m_cart_ram[0x1000];
};
extern const device_type NEOGEO_VLINER_CART;
#endif

View File

@ -0,0 +1,87 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
Super Bubble Pop cart type
Note: since protection here involves accesses to ROM, we include the scrambling in this
file rather than in a separate prot_* source
***********************************************************************************************************/
#include "emu.h"
#include "sbp.h"
extern const device_type NEOGEO_SBP_CART = &device_creator<neogeo_sbp_cart>;
neogeo_sbp_cart::neogeo_sbp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_rom_device(mconfig, NEOGEO_SBP_CART, "Neo Geo Super Bubble Pop Cart", tag, owner, clock, "neocart_sbp", __FILE__)
{}
void neogeo_sbp_cart::device_start()
{
}
void neogeo_sbp_cart::device_reset()
{
}
READ16_MEMBER( neogeo_sbp_cart::protection_r )
{
UINT16* rom = (get_rom_size()) ? get_rom_base() : get_region_rom_base();
UINT16 origdata = rom[offset + (0x200/2)];
UINT16 data = BITSWAP16(origdata, 11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,4);
int realoffset = 0x200 + (offset * 2);
logerror("sbp_lowerrom_r offset %08x data %04x\n", realoffset, data);
// there is actually data in the rom here already, maybe we should just return it 'as is'
if (realoffset == 0xd5e)
return origdata;
return data;
}
WRITE16_MEMBER( neogeo_sbp_cart::protection_w )
{
int realoffset = 0x200 + (offset * 2);
// the actual data written is just pulled from the end of the rom, and unused space
// maybe this is just some kind of watchdog for the protection device and it doesn't
// matter?
if (realoffset == 0x1080)
{
if (data == 0x4e75)
{
return;
}
else if (data == 0xffff)
{
return;
}
}
printf("sbp_lowerrom_w offset %08x data %04x\n", realoffset, data);
}
void neogeo_sbp_cart::patch(UINT8* cpurom, UINT32 cpurom_size)
{
/* the game code clears the text overlay used ingame immediately after writing it.. why? protection? sloppy code that the hw ignores? imperfect emulation? */
UINT16* rom = (UINT16*)cpurom;
rom[0x2a6f8/2] = 0x4e71;
rom[0x2a6fa/2] = 0x4e71;
rom[0x2a6fc/2] = 0x4e71;
}
void neogeo_sbp_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
patch(cpuregion, cpuregion_size);
}

View File

@ -0,0 +1,35 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#pragma once
#ifndef __NEOGEO_BOOTSBP_H
#define __NEOGEO_BOOTSBP_H
#include "slot.h"
#include "rom.h"
/*************************************************
sbp
**************************************************/
class neogeo_sbp_cart : public neogeo_rom_device
{
public:
neogeo_sbp_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void device_start() override;
virtual void device_reset() override;
virtual DECLARE_WRITE16_MEMBER(protection_w) override;
virtual DECLARE_READ16_MEMBER(protection_r) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 0; }
void patch(UINT8* cpurom, UINT32 cpurom_size);
};
extern const device_type NEOGEO_SBP_CART;
#endif

View File

@ -1,87 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#include "emu.h"
#include "sbp_prot.h"
extern const device_type SBP_PROT = &device_creator<sbp_prot_device>;
sbp_prot_device::sbp_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SBP_PROT, "NeoGeo Protection (Super Bubble Pop)", tag, owner, clock, "sbp_prot", __FILE__),
m_mainrom(nullptr)
{
}
void sbp_prot_device::device_start()
{
}
void sbp_prot_device::device_reset()
{
}
READ16_MEMBER( sbp_prot_device::sbp_lowerrom_r )
{
UINT16* rom = (UINT16*)m_mainrom;
UINT16 origdata = rom[(offset+(0x200/2))];
UINT16 data = BITSWAP16(origdata, 11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,4);
int realoffset = 0x200+(offset*2);
logerror("sbp_lowerrom_r offset %08x data %04x\n", realoffset, data );
// there is actually data in the rom here already, maybe we should just return it 'as is'
if (realoffset==0xd5e) return origdata;
return data;
}
WRITE16_MEMBER( sbp_prot_device::sbp_lowerrom_w )
{
int realoffset = 0x200+(offset*2);
// the actual data written is just pulled from the end of the rom, and unused space
// maybe this is just some kind of watchdog for the protection device and it doesn't
// matter?
if (realoffset == 0x1080)
{
if (data==0x4e75)
{
return;
}
else if (data==0xffff)
{
return;
}
}
printf("sbp_lowerrom_w offset %08x data %04x\n", realoffset, data );
}
void sbp_prot_device::sbp_install_protection(cpu_device* maincpu, UINT8* cpurom, UINT32 cpurom_size)
{
m_mainrom = cpurom;
// there seems to be a protection device living around here..
// if you nibble swap the data in the rom the game will boot
// there are also writes to 0x1080..
//
// other stuff going on as well tho, the main overlay is still missing, and p1 inputs don't work
maincpu->space(AS_PROGRAM).install_read_handler(0x00200, 0x001fff, read16_delegate(FUNC(sbp_prot_device::sbp_lowerrom_r), this));
maincpu->space(AS_PROGRAM).install_write_handler(0x00200, 0x001fff, write16_delegate(FUNC(sbp_prot_device::sbp_lowerrom_w), this));
/* the game code clears the text overlay used ingame immediately after writing it.. why? protection? sloppy code that the hw ignores? imperfect emulation? */
{
UINT16* rom = (UINT16*)cpurom;
rom[0x2a6f8 / 2] = 0x4e71;
rom[0x2a6fa / 2] = 0x4e71;
rom[0x2a6fc / 2] = 0x4e71;
}
}

View File

@ -1,34 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#pragma once
#ifndef __SBP_PROT__
#define __SBP_PROT__
extern const device_type SBP_PROT;
#define MCFG_SBP_PROT_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, SBP_PROT, 0)
class sbp_prot_device : public device_t
{
public:
// construction/destruction
sbp_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
UINT8* m_mainrom;
void sbp_install_protection(cpu_device* maincpu, UINT8* cpurom, UINT32 cpurom_size);
DECLARE_WRITE16_MEMBER(sbp_lowerrom_w);
DECLARE_READ16_MEMBER(sbp_lowerrom_r);
protected:
virtual void device_start() override;
virtual void device_reset() override;
};
#endif

View File

@ -0,0 +1,381 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
SNK Neo Geo cartslot emulation
***********************************************************************************************************/
#include "slot.h"
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type NEOGEO_CART_SLOT = &device_creator<neogeo_cart_slot_device>;
//-------------------------------------------------
// device_neogeo_cart_interface - constructor
//-------------------------------------------------
device_neogeo_cart_interface::device_neogeo_cart_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device),
m_sprite_gfx_address_mask(0),
m_region_rom(*this, "^maincpu"),
m_region_fixed(*this, "^fixed"),
m_region_audio(*this, "^audiocpu"),
m_region_audiocrypt(*this, "^audiocrypt"),
m_region_spr(*this, "^sprites"),
m_region_spr_opt(*this, "^spr_opt"),
m_region_ym(*this, "^ymsnd"),
m_region_ymd(*this, "^ymsnd.deltat")
{
}
//-------------------------------------------------
// ~device_neogeo_cart_interface - destructor
//-------------------------------------------------
device_neogeo_cart_interface::~device_neogeo_cart_interface()
{
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// neogeo_cart_slot_device - constructor
//-------------------------------------------------
neogeo_cart_slot_device::neogeo_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
device_t(mconfig, NEOGEO_CART_SLOT, "Neo Geo Cartridge Slot", tag, owner, clock, "neogeo_cart_slot", __FILE__),
device_image_interface(mconfig, *this),
device_slot_interface(mconfig, *this),
m_cart(nullptr)
{
}
//-------------------------------------------------
// neogeo_cart_slot_device - destructor
//-------------------------------------------------
neogeo_cart_slot_device::~neogeo_cart_slot_device()
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void neogeo_cart_slot_device::device_start()
{
m_cart = dynamic_cast<device_neogeo_cart_interface *>(get_card_device());
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
// complete
//-------------------------------------------------
void neogeo_cart_slot_device::device_config_complete()
{
// set brief and instance name
update_names();
}
//-------------------------------------------------
// NEOGEO PCB
//-------------------------------------------------
struct neogeo_slot
{
int pcb_id;
const char *slot_option;
};
// Here, we take the feature attribute from .xml (i.e. the PCB name) and we assign a unique ID to it
static const neogeo_slot slot_list[] =
{
{ NEOGEO_STD, "rom" },
{ NEOGEO_VLINER, "rom_vliner" },
{ NEOGEO_FATFURY2, "rom_fatfur2" },
{ NEOGEO_KOF98, "rom_kof98" },
{ NEOGEO_MSLUGX, "rom_mslugx" },
{ NEOGEO_ZUPAPA, "cmc42_zupapa" },
{ NEOGEO_MSLUG3H, "cmc42_mslug3h" },
{ NEOGEO_GANRYU, "cmc42_ganryu" },
{ NEOGEO_S1945P, "cmc42_s1945p" },
{ NEOGEO_PREIS2, "cmc42_preisle2" },
{ NEOGEO_BANGBD, "cmc42_bangbead" },
{ NEOGEO_NITD, "cmc42_nitd" },
{ NEOGEO_SENGOK3, "cmc42_sengoku3" },
{ NEOGEO_KOF99K, "cmc42_kof99k" },
{ NEOGEO_KOF2K1, "cmc50_kof2001" },
{ NEOGEO_KOF2KN, "cmc50_kof2000n" },
{ NEOGEO_JOCKEYGP, "cmc50_jockeygp" },
{ NEOGEO_KOF99, "sma_kof99" },
{ NEOGEO_GAROU, "sma_garou" },
{ NEOGEO_GAROUH, "sma_garouh" },
{ NEOGEO_MSLUG3, "sma_mslug3" },
{ NEOGEO_KOF2K, "sma_kof2k" },
{ NEOGEO_MSLUG4, "pcm2_mslug4" },
{ NEOGEO_MSLUG4P, "pcm2_ms4p" },
{ NEOGEO_ROTD, "pcm2_rotd" },
{ NEOGEO_PNYAA, "pcm2_pnyaa" },
{ NEOGEO_KOF2K2, "k2k2_kof2k2" },
{ NEOGEO_MATRIM, "k2k2_matrim" },
{ NEOGEO_SAMSHO5, "k2k2_samsh5" },
{ NEOGEO_SAMSHO5S, "k2k2_sams5s" },
{ NEOGEO_KOF2K2P, "k2k2_kf2k2p" },
{ NEOGEO_MSLUG5, "pvc_mslug5" },
{ NEOGEO_SVC, "pvc_svc" },
{ NEOGEO_KOF2K3, "pvc_kf2k3" },
{ NEOGEO_KOF2K3H, "pvc_kf2k3h" },
{ NEOGEO_CTHD2K3, "boot_cthd2k3" },
{ NEOGEO_CT2K3SP, "boot_ct2k3sp" },
{ NEOGEO_CT2K3SA, "boot_ct2k3sa" },
{ NEOGEO_MATRIMBL, "boot_matrimbl" },
{ NEOGEO_SVCBOOT, "boot_svcboot" },
{ NEOGEO_SVCPLUS, "boot_svcplus" },
{ NEOGEO_SVCPLUSA, "boot_svcplusa" },
{ NEOGEO_SVCSPLUS, "boot_svcsplus" },
{ NEOGEO_KOF2K2B, "boot_kf2k2b" },
{ NEOGEO_KOF2K2MP, "boot_kf2k2mp" },
{ NEOGEO_KOF2K2MP2, "boot_kf2k2mp2" },
{ NEOGEO_KOF2K3B, "boot_kf2k3bl" },
{ NEOGEO_KOF2K3P, "boot_kf2k3pl" },
{ NEOGEO_KOF2K3UP, "boot_kf2k3upl" },
{ NEOGEO_GAROUBL, "boot_garoubl" },
{ NEOGEO_KOF97ORO, "boot_kof97oro" },
{ NEOGEO_KF10THEP, "boot_kf10thep" },
{ NEOGEO_KF2K5UNI, "boot_kf2k5uni" },
{ NEOGEO_KF2K4SE, "boot_kf2k4se" },
{ NEOGEO_LANS2K4, "boot_lans2004" },
{ NEOGEO_SAMSHO5B, "boot_samsho5b" },
{ NEOGEO_MSLUG3B6, "boot_mslug3b6" },
{ NEOGEO_MSLUG5P, "boot_ms5plus" },
{ NEOGEO_KOG, "boot_kog" },
{ NEOGEO_SBP, "boot_sbp" },
{ NEOGEO_KOF10TH, "boot_kf10th" },
};
static int neogeo_get_pcb_id(const char *slot)
{
for (auto & elem : slot_list)
{
if (!core_stricmp(elem.slot_option, slot))
return elem.pcb_id;
}
return 0;
}
void neogeo_cart_slot_device::set_cart_type(const char *slot)
{
m_type = neogeo_get_pcb_id(slot);
}
/*-------------------------------------------------
call load
-------------------------------------------------*/
bool neogeo_cart_slot_device::call_load()
{
if (m_cart)
{
if (software_entry() != nullptr)
{
UINT16 *ROM16;
UINT8 *ROM8;
UINT32 len;
const char *pcb_name = get_feature("slot");
if (pcb_name)
set_cart_type(pcb_name);
// create memory regions
len = get_software_region_length("maincpu");
m_cart->rom_alloc(len);
ROM16 = m_cart->get_rom_base();
memcpy(ROM16, get_software_region("maincpu"), len);
len = get_software_region_length("fixed");
m_cart->fixed_alloc(len);
ROM8 = m_cart->get_fixed_base();
memcpy(ROM8, get_software_region("fixed"), len);
if (get_software_region("audiocpu") != nullptr)
{
len = get_software_region_length("audiocpu");
m_cart->audio_alloc(len + 0x10000);
ROM8 = m_cart->get_audio_base();
memcpy(ROM8, get_software_region("audiocpu"), len);
memcpy(ROM8 + 0x10000, get_software_region("audiocpu"), len); // avoid reloading in XML, should just improve banking instead tho?
}
len = get_software_region_length("ymsnd");
m_cart->ym_alloc(len);
ROM8 = m_cart->get_ym_base();
memcpy(ROM8, get_software_region("ymsnd"), len);
if (get_software_region("ymsnd.deltat") != nullptr)
{
len = get_software_region_length("ymsnd.deltat");
m_cart->ymdelta_alloc(len);
ROM8 = m_cart->get_ymdelta_base();
memcpy(ROM8, get_software_region("ymsnd.deltat"), len);
}
else
{
// ensure there is no delta-t region
}
len = get_software_region_length("sprites");
m_cart->sprites_alloc(len);
ROM8 = m_cart->get_sprites_base();
memcpy(ROM8, get_software_region("sprites"), len);
if (get_software_region("audiocrypt") != nullptr) // encrypted Z80 code
{
len = get_software_region_length("audiocrypt");
m_cart->audiocrypt_alloc(len);
ROM8 = m_cart->get_audiocrypt_base();
memcpy(ROM8, get_software_region("audiocrypt"), len);
// allocate the audiocpu region to decrypt data into
m_cart->audio_alloc(len + 0x10000);
}
m_cart->decrypt_all(
(UINT8*)m_cart->get_rom_base(), m_cart->get_rom_size(),
m_cart->get_sprites_base(), m_cart->get_sprites_size(),
m_cart->get_fixed_base(), m_cart->get_fixed_size(),
m_cart->get_ym_base(), m_cart->get_ym_size(),
m_cart->get_ymdelta_base(), m_cart->get_ymdelta_size(),
m_cart->get_audio_base(), m_cart->get_audio_size(),
m_cart->get_audiocrypt_base(), m_cart->get_audiocrypt_size());
// create optimized sprite cache [NOT GOOD FOR NOSLOT!!!!]
m_cart->m_sprite_gfx_address_mask = neogeohelper_optimize_sprite_data(m_cart->get_sprites_optimized_arr(), m_cart->get_sprites_base(), m_cart->get_sprites_size());
return IMAGE_INIT_PASS;
}
}
return IMAGE_INIT_PASS;
}
/*-------------------------------------------------
call_unload
-------------------------------------------------*/
void neogeo_cart_slot_device::call_unload()
{
}
/*-------------------------------------------------
call softlist load
-------------------------------------------------*/
bool neogeo_cart_slot_device::call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry)
{
machine().rom_load().load_software_part_region(*this, swlist, swname, start_entry );
return TRUE;
}
/*-------------------------------------------------
get default card software
-------------------------------------------------*/
std::string neogeo_cart_slot_device::get_default_card_software()
{
return software_get_default_slot("rom");
}
/*-------------------------------------------------
rom_r
-------------------------------------------------*/
READ16_MEMBER(neogeo_cart_slot_device::rom_r)
{
if (m_cart)
return m_cart->rom_r(space, offset, mem_mask);
else
return 0xffff;
}
/*-------------------------------------------------
write_banksel
-------------------------------------------------*/
WRITE16_MEMBER(neogeo_cart_slot_device::banksel_w)
{
if (m_cart)
m_cart->banksel_w(space, offset, data, mem_mask);
}
/*-------------------------------------------------
ram_r
-------------------------------------------------*/
READ16_MEMBER(neogeo_cart_slot_device::ram_r)
{
if (m_cart)
return m_cart->ram_r(space, offset, mem_mask);
else
return 0xffff;
}
/*-------------------------------------------------
ram_w
-------------------------------------------------*/
WRITE16_MEMBER(neogeo_cart_slot_device::ram_w)
{
if (m_cart)
m_cart->ram_w(space, offset, data, mem_mask);
}
/*-------------------------------------------------
addon_r
-------------------------------------------------*/
READ16_MEMBER(neogeo_cart_slot_device::addon_r)
{
if (m_cart)
return m_cart->addon_r(space, offset, mem_mask);
else
return 0xffff;
}
/*-------------------------------------------------
protection_r
-------------------------------------------------*/
READ16_MEMBER(neogeo_cart_slot_device::protection_r)
{
if (m_cart)
return m_cart->protection_r(space, offset, mem_mask);
else
return 0xffff;
}
/*-------------------------------------------------
protection_w
-------------------------------------------------*/
WRITE16_MEMBER(neogeo_cart_slot_device::protection_w)
{
if (m_cart)
m_cart->protection_w(space, offset, data, mem_mask);
}

View File

@ -0,0 +1,368 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_SLOT_H
#define __NEOGEO_SLOT_H
#include "emu.h"
#include "bus/neogeo/neogeo_helper.h"
/* PCB */
enum
{
NEOGEO_STD = 0,
NEOGEO_FATFURY2,
NEOGEO_KOF98,
NEOGEO_MSLUGX,
NEOGEO_ZUPAPA,
NEOGEO_MSLUG3H,
NEOGEO_GANRYU,
NEOGEO_S1945P,
NEOGEO_PREIS2,
NEOGEO_BANGBD,
NEOGEO_NITD,
NEOGEO_SENGOK3,
NEOGEO_KOF99K,
NEOGEO_KOF2K1,
NEOGEO_KOF2KN,
NEOGEO_KOF99,
NEOGEO_GAROU,
NEOGEO_GAROUH,
NEOGEO_MSLUG3,
NEOGEO_KOF2K,
NEOGEO_MSLUG4,
NEOGEO_MSLUG4P,
NEOGEO_ROTD,
NEOGEO_PNYAA,
NEOGEO_KOF2K2,
NEOGEO_MATRIM,
NEOGEO_SAMSHO5,
NEOGEO_SAMSHO5S,
NEOGEO_KOF2K2P,
NEOGEO_MSLUG5,
NEOGEO_SVC,
NEOGEO_KOF2K3,
NEOGEO_KOF2K3H,
NEOGEO_CTHD2K3,
NEOGEO_CT2K3SP,
NEOGEO_CT2K3SA,
NEOGEO_MATRIMBL,
NEOGEO_SVCBOOT,
NEOGEO_SVCPLUS,
NEOGEO_SVCPLUSA,
NEOGEO_SVCSPLUS,
NEOGEO_KOF2K2B,
NEOGEO_KOF2K2MP,
NEOGEO_KOF2K2MP2,
NEOGEO_KOF2K3B,
NEOGEO_KOF2K3P,
NEOGEO_KOF2K3UP,
NEOGEO_GAROUBL,
NEOGEO_KOF97ORO,
NEOGEO_KF10THEP,
NEOGEO_KF2K5UNI,
NEOGEO_KF2K4SE,
NEOGEO_LANS2K4,
NEOGEO_SAMSHO5B,
NEOGEO_MSLUG3B6,
NEOGEO_MSLUG5P,
NEOGEO_KOG,
NEOGEO_SBP,
NEOGEO_KOF10TH,
NEOGEO_VLINER,
NEOGEO_JOCKEYGP,
};
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// ======================> device_neogeo_cart_interface
#define DECRYPT_ALL_PARAMS \
UINT8* cpuregion, UINT32 cpuregion_size,UINT8* spr_region, UINT32 spr_region_size,UINT8* fix_region, UINT32 fix_region_size,UINT8* ym_region, UINT32 ym_region_size,UINT8* ymdelta_region, UINT32 ymdelta_region_size,UINT8* audiocpu_region, UINT32 audio_region_size, UINT8* audiocrypt_region, UINT32 audiocrypt_region_size
class device_neogeo_cart_interface : public device_slot_card_interface
{
public:
// construction/destruction
device_neogeo_cart_interface(const machine_config &mconfig, device_t &device);
virtual ~device_neogeo_cart_interface();
// reading from ROM
virtual DECLARE_READ16_MEMBER(rom_r) { return 0xffff; }
virtual DECLARE_WRITE16_MEMBER(banksel_w) { };
virtual DECLARE_READ16_MEMBER(ram_r) { return 0xffff; }
virtual DECLARE_WRITE16_MEMBER(ram_w) { };
virtual DECLARE_READ16_MEMBER(protection_r) { return 0xffff; }
virtual DECLARE_WRITE16_MEMBER(protection_w) { };
virtual DECLARE_READ16_MEMBER(addon_r) { return 0xffff; }
virtual UINT32 get_bank_base(UINT16 sel) { return 0; }
virtual UINT32 get_special_bank() { return 0; }
virtual UINT16 get_helper() { return 0; }
virtual void decrypt_all(DECRYPT_ALL_PARAMS) { };
virtual int get_fixed_bank_type(void) { return 0; }
void rom_alloc(UINT32 size) { m_rom.resize(size/sizeof(UINT16)); }
UINT16* get_rom_base() { return &m_rom[0]; }
UINT32 get_rom_size() { return m_rom.size() * sizeof(UINT16); }
UINT16* get_region_rom_base() { if (m_region_rom.found()) return &m_region_rom->u16(0); return nullptr; }
UINT32 get_region_rom_size() { if (m_region_rom.found()) return m_region_rom->bytes(); return 0; }
void fixed_alloc(UINT32 size) { m_fixed.resize(size); }
UINT8* get_fixed_base() { return &m_fixed[0]; }
UINT32 get_fixed_size() { return m_fixed.size(); }
UINT8* get_region_fixed_base() { if (m_region_fixed.found()) return m_region_fixed->base(); return nullptr; }
UINT32 get_region_fixed_size() { if (m_region_fixed.found()) return m_region_fixed->bytes(); return 0; }
void audio_alloc(UINT32 size) { m_audio.resize(size); }
UINT8* get_audio_base() { return &m_audio[0]; }
UINT32 get_audio_size() { return m_audio.size(); }
UINT8* get_region_audio_base() { if (m_region_audio.found()) return m_region_audio->base(); return nullptr; }
UINT32 get_region_audio_size() { if (m_region_audio.found()) return m_region_audio->bytes(); return 0; }
void audiocrypt_alloc(UINT32 size) { m_audiocrypt.resize(size); }
UINT8* get_audiocrypt_base() { if (m_audiocrypt.size() == 0) return nullptr; else return &m_audiocrypt[0]; }
UINT32 get_audiocrypt_size() { return m_audiocrypt.size(); }
UINT8* get_region_audiocrypt_base() { if (m_region_audiocrypt.found()) return m_region_audiocrypt->base(); return nullptr; }
UINT32 get_region_audiocrypt_size() { if (m_region_audiocrypt.found()) return m_region_audiocrypt->bytes(); return 0; }
// TODO: review sprite code later!!
void sprites_alloc(UINT32 size) { m_sprites.resize(size); }
UINT8* get_sprites_base() { return &m_sprites[0]; }
UINT32 get_sprites_size() { return m_sprites.size(); }
UINT8* get_region_sprites_base() { if (m_region_spr.found()) return m_region_spr->base(); return nullptr; }
UINT32 get_region_sprites_size() { if (m_region_spr.found()) return m_region_spr->bytes(); return 0; }
UINT8* get_sprites_optimized() { return &m_sprites_optimized[0]; }
std::vector<UINT8>& get_sprites_optimized_arr() { return m_sprites_optimized; }
UINT32 get_sprites_addrmask() { return m_sprite_gfx_address_mask; }
void init_sprites_addrmask(UINT8 *spr_base, UINT32 spr_size) {
m_sprite_gfx_address_mask = neogeohelper_optimize_sprite_data(get_sprites_optimized_arr(), &spr_base[0], spr_size);
printf("gfx mask: %x\n", m_sprite_gfx_address_mask);
}
void ym_alloc(UINT32 size) { m_ym.resize(size); }
UINT8* get_ym_base() { return &m_ym[0]; }
UINT32 get_ym_size() { return m_ym.size(); }
UINT8* get_region_ym_base() { if (m_region_ym.found()) return m_region_ym->base(); return nullptr; }
UINT32 get_region_ym_size() { if (m_region_ym.found()) return m_region_ym->bytes(); return 0; }
void ymdelta_alloc(UINT32 size) { m_ymdelta.resize(size); }
UINT8* get_ymdelta_base() { return &m_ymdelta[0]; }
UINT32 get_ymdelta_size() { return m_ymdelta.size(); }
UINT8* get_region_ymdelta_base() { if (m_region_ymd.found()) return m_region_ymd->base(); return nullptr; }
UINT32 get_region_ymdelta_size() { if (m_region_ymd.found()) return m_region_ymd->bytes(); return 0; }
UINT32 m_sprite_gfx_address_mask;
protected:
// these are allocated when loading from softlist
std::vector<UINT16> m_rom;
std::vector<UINT8> m_fixed;
std::vector<UINT8> m_audio;
std::vector<UINT8> m_sprites;
std::vector<UINT8> m_sprites_optimized;
std::vector<UINT8> m_ym;
std::vector<UINT8> m_ymdelta;
std::vector<UINT8> m_audiocrypt;
// these replace m_rom, etc. above for non-user configurable carts!
optional_memory_region m_region_rom;
optional_memory_region m_region_fixed;
optional_memory_region m_region_audio;
optional_memory_region m_region_audiocrypt;
optional_memory_region m_region_spr;
optional_memory_region m_region_spr_opt;
optional_memory_region m_region_ym;
optional_memory_region m_region_ymd;
};
// ======================> neogeo_cart_slot_device
class neogeo_cart_slot_device : public device_t,
public device_image_interface,
public device_slot_interface
{
public:
// construction/destruction
neogeo_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock);
virtual ~neogeo_cart_slot_device();
// device-level overrides
virtual void device_start() override;
virtual void device_config_complete() override;
// image-level overrides
virtual bool call_load() override;
virtual void call_unload() override;
virtual bool call_softlist_load(software_list_device &swlist, const char *swname, const rom_entry *start_entry) override;
virtual iodevice_t image_type() const override { return IO_CARTSLOT; }
virtual bool is_readable() const override { return 1; }
virtual bool is_writeable() const override { return 0; }
virtual bool is_creatable() const override { return 0; }
virtual bool must_be_loaded() const override { return 0; }
virtual bool is_reset_on_load() const override { return 1; }
virtual const option_guide *create_option_guide() const override { return nullptr; }
virtual const char *image_interface() const override { return "neo_cart"; }
virtual const char *file_extensions() const override { return "bin"; }
// slot interface overrides
virtual std::string get_default_card_software() override;
// reading and writing
DECLARE_READ16_MEMBER(rom_r);
DECLARE_WRITE16_MEMBER(banksel_w);
DECLARE_READ16_MEMBER(ram_r);
DECLARE_WRITE16_MEMBER(ram_w);
DECLARE_READ16_MEMBER(protection_r);
DECLARE_WRITE16_MEMBER(protection_w);
DECLARE_READ16_MEMBER(addon_r);
void set_cart_type(const char *slot);
int get_type() { return m_type; }
UINT16* get_rom_base() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_rom_base(); else return m_cart->get_rom_base();
}
return nullptr;
}
UINT32 get_rom_size() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_rom_size(); else return m_cart->get_rom_size();
}
return 0;
}
UINT8* get_fixed_base() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_fixed_base(); else return m_cart->get_fixed_base();
}
return nullptr;
}
UINT32 get_fixed_size() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_fixed_size(); else return m_cart->get_fixed_size();
}
return 0;
}
UINT8* get_sprites_base() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_sprites_base(); else return m_cart->get_sprites_base();
}
return nullptr;
}
UINT32 get_sprites_size() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_sprites_size(); else return m_cart->get_sprites_size();
}
return 0;
}
UINT8* get_audio_base() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_audio_base(); else return m_cart->get_audio_base();
}
return nullptr;
}
UINT32 get_audio_size() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_audio_size(); else return m_cart->get_audio_size();
}
return 0;
}
UINT8* get_audiocrypt_base() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_audiocrypt_base(); else return m_cart->get_audiocrypt_base();
}
return nullptr;
}
UINT32 get_audiocrypt_size() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_audiocrypt_size(); else return m_cart->get_audiocrypt_size();
}
return 0;
}
UINT8* get_ym_base() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_ym_base(); else return m_cart->get_ym_base();
}
return nullptr;
}
UINT32 get_ym_size() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_ym_size(); else return m_cart->get_ym_size();
}
return 0;
}
UINT8* get_ymdelta_base() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_ymdelta_base(); else return m_cart->get_ymdelta_base();
}
return nullptr;
}
UINT32 get_ymdelta_size() {
if (m_cart) {
if (!user_loadable()) return m_cart->get_region_ymdelta_size(); else return m_cart->get_ymdelta_size();
}
return 0;
}
UINT8* get_sprites_opt_base() {
if (m_cart)
return m_cart->get_sprites_optimized();
return nullptr;
}
void init_sprites_addrmask() {
if (m_cart)
{
if (!user_loadable())
m_cart->init_sprites_addrmask(m_cart->get_region_sprites_base(), m_cart->get_region_sprites_size());
else
m_cart->init_sprites_addrmask(m_cart->get_sprites_base(), m_cart->get_sprites_size());
}
}
UINT32 get_sprites_addrmask() { if (m_cart) return m_cart->get_sprites_addrmask(); return 0; }
int get_fixed_bank_type(void) { if (m_cart) return m_cart->get_fixed_bank_type(); return 0; }
UINT32 get_bank_base(UINT16 sel) { if (m_cart) return m_cart->get_bank_base(sel); return 0; }
UINT32 get_special_bank() { if (m_cart) return m_cart->get_special_bank(); return 0; }
UINT16 get_helper() { if (m_cart) return m_cart->get_helper(); return 0; }
void late_decrypt_all() { if (m_cart) m_cart->decrypt_all(
(UINT8*)get_rom_base(), get_rom_size(),
get_sprites_base(), get_sprites_size(),
get_fixed_base(), get_fixed_size(),
get_ym_base(), get_ym_size(),
get_ymdelta_base(), get_ymdelta_size(),
get_audio_base(), get_audio_size(),
get_audiocrypt_base(), get_audiocrypt_size()); }
private:
int m_type;
device_neogeo_cart_interface* m_cart;
};
// device type definition
extern const device_type NEOGEO_CART_SLOT;
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_NEOGEO_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \
MCFG_DEVICE_ADD(_tag, NEOGEO_CART_SLOT, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
#endif

View File

@ -0,0 +1,152 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
/***********************************************************************************************************
Neo Geo cart emulation
SMA encrypted cart type (+ CMC42 or CMC50)
***********************************************************************************************************/
#include "emu.h"
#include "sma.h"
//-------------------------------------------------
// neogeo_sma_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_SMA_CART = &device_creator<neogeo_sma_cart>;
neogeo_sma_cart::neogeo_sma_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source) :
neogeo_rom_device(mconfig, type, name, tag, owner, clock, shortname, source),
m_sma_prot(*this, "sma_prot"),
m_cmc_prot(*this, "cmc_prot")
{}
neogeo_sma_cart::neogeo_sma_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) :
neogeo_rom_device(mconfig, NEOGEO_SMA_CART, "Neo Geo SMA Cart", tag, owner, clock, "neocart_sma", __FILE__),
m_sma_prot(*this, "sma_prot"),
m_cmc_prot(*this, "cmc_prot")
{}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_sma_cart::device_start()
{
}
void neogeo_sma_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
static MACHINE_CONFIG_FRAGMENT( sma_cart )
MCFG_SMA_PROT_ADD("sma_prot")
MCFG_CMC_PROT_ADD("cmc_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_sma_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( sma_cart );
}
/*************************************************
kof99
**************************************************/
const device_type NEOGEO_SMA_KOF99_CART = &device_creator<neogeo_sma_kof99_cart>;
neogeo_sma_kof99_cart::neogeo_sma_kof99_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_sma_cart(mconfig, NEOGEO_SMA_KOF99_CART, "Neo Geo KOF 99 SMA Cart", tag, owner, clock, "neocart_kof99", __FILE__)
{}
void neogeo_sma_kof99_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_sma_prot->kof99_decrypt_68k(cpuregion);
m_cmc_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, KOF99_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
garou
**************************************************/
const device_type NEOGEO_SMA_GAROU_CART = &device_creator<neogeo_sma_garou_cart>;
neogeo_sma_garou_cart::neogeo_sma_garou_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_sma_cart(mconfig, NEOGEO_SMA_GAROU_CART, "Neo Geo Garou SMA Cart", tag, owner, clock, "neocart_garou", __FILE__)
{}
void neogeo_sma_garou_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_sma_prot->garou_decrypt_68k(cpuregion);
m_cmc_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, GAROU_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
garouh
**************************************************/
const device_type NEOGEO_SMA_GAROUH_CART = &device_creator<neogeo_sma_garouh_cart>;
neogeo_sma_garouh_cart::neogeo_sma_garouh_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_sma_cart(mconfig, NEOGEO_SMA_GAROUH_CART, "Neo Geo Garou AES SMA Cart", tag, owner, clock, "neocart_garouh", __FILE__)
{}
void neogeo_sma_garouh_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_sma_prot->garouh_decrypt_68k(cpuregion);
m_cmc_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, GAROU_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
mslug3
**************************************************/
const device_type NEOGEO_SMA_MSLUG3_CART = &device_creator<neogeo_sma_mslug3_cart>;
neogeo_sma_mslug3_cart::neogeo_sma_mslug3_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_sma_cart(mconfig, NEOGEO_SMA_MSLUG3_CART, "Neo Geo Metal Slug 3 SMA Cart", tag, owner, clock, "neocart_mslug3", __FILE__)
{}
void neogeo_sma_mslug3_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_sma_prot->mslug3_decrypt_68k(cpuregion);
m_cmc_prot->cmc42_gfx_decrypt(spr_region, spr_region_size, MSLUG3_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}
/*************************************************
kof2000
**************************************************/
const device_type NEOGEO_SMA_KOF2000_CART = &device_creator<neogeo_sma_kof2000_cart>;
neogeo_sma_kof2000_cart::neogeo_sma_kof2000_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
neogeo_sma_cart(mconfig, NEOGEO_SMA_KOF2000_CART, "Neo Geo KOF 2000 SMA Cart", tag, owner, clock, "neocart_kof2000", __FILE__)
{}
void neogeo_sma_kof2000_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_sma_prot->kof2000_decrypt_68k(cpuregion);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2000_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
}

View File

@ -1,17 +1,16 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#ifndef __NEOGEO_SMA_CART_H
#define __NEOGEO_SMA_CART_H
// copyright-holders:S. Smith,David Haywood,Fabio Priuli
#ifndef __NEOGEO_SMA_H
#define __NEOGEO_SMA_H
#include "neogeo_slot.h"
#include "banked_cart.h"
#include "sma_prot.h"
#include "cmc_prot.h"
#include "slot.h"
#include "rom.h"
#include "prot_sma.h"
#include "prot_cmc.h"
// ======================> neogeo_sma_cart
class neogeo_sma_cart : public device_t,
public device_neogeo_cart_interface
class neogeo_sma_cart : public neogeo_rom_device
{
public:
// construction/destruction
@ -24,13 +23,13 @@ public:
virtual machine_config_constructor device_mconfig_additions() const override;
// reading and writing
virtual DECLARE_READ16_MEMBER(read_rom) override;
virtual DECLARE_READ16_MEMBER(protection_r) override { return m_sma_prot->prot_9a37_r(space, offset, mem_mask); }
virtual DECLARE_READ16_MEMBER(addon_r) override { return m_sma_prot->random_r(space, offset, mem_mask); }
virtual UINT32 get_bank_base(UINT16 sel) override { return 0; }
virtual void activate_cart(ACTIVATE_CART_PARAMS) override {}
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override {}
virtual int get_fixed_bank_type(void) override { return 0; }
required_device<neogeo_banked_cart_device> m_banked_cart;
required_device<sma_prot_device> m_sma_prot;
required_device<cmc_prot_device> m_cmc_prot;
};
@ -42,70 +41,82 @@ extern const device_type NEOGEO_SMA_CART;
/*************************************************
KOF 99
kof99
**************************************************/
class neogeo_sma_kof99_cart : public neogeo_sma_cart
{
public:
neogeo_sma_kof99_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
virtual UINT32 get_bank_base(UINT16 sel) override { return m_sma_prot->kof99_bank_base(sel); }
};
extern const device_type NEOGEO_SMA_KOF99_CART;
/*************************************************
Garou
garou
**************************************************/
class neogeo_sma_garou_cart : public neogeo_sma_cart
{
public:
neogeo_sma_garou_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
virtual UINT32 get_bank_base(UINT16 sel) override { return m_sma_prot->garou_bank_base(sel); }
};
extern const device_type NEOGEO_SMA_GAROU_CART;
/*************************************************
garouh
**************************************************/
class neogeo_sma_garouh_cart : public neogeo_sma_cart
{
public:
neogeo_sma_garouh_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
virtual UINT32 get_bank_base(UINT16 sel) override { return m_sma_prot->garouh_bank_base(sel); }
};
extern const device_type NEOGEO_SMA_GAROUH_CART;
/*************************************************
Metal Slug 3
**************************************************/
mslug3
**************************************************/
class neogeo_sma_mslug3_cart : public neogeo_sma_cart
{
public:
neogeo_sma_mslug3_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 1; }
virtual UINT32 get_bank_base(UINT16 sel) override { return m_sma_prot->mslug3_bank_base(sel); }
};
extern const device_type NEOGEO_SMA_MSLUG3_CART;
/*************************************************
KOF2000
kof2000
**************************************************/
class neogeo_sma_kof2000_cart : public neogeo_sma_cart
{
public:
neogeo_sma_kof2000_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual void activate_cart(ACTIVATE_CART_PARAMS) override;
virtual void decrypt_all(DECRYPT_ALL_PARAMS) override;
virtual int get_fixed_bank_type(void) override { return 2; }
virtual UINT32 get_bank_base(UINT16 sel) override { return m_sma_prot->kof2000_bank_base(sel); }
};
extern const device_type NEOGEO_SMA_KOF2000_CART;

View File

@ -1,177 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
/***********************************************************************************************************
NEOGEO ROM cart emulation
***********************************************************************************************************/
#include "emu.h"
#include "sma_cart.h"
//-------------------------------------------------
// neogeo_sma_cart - constructor
//-------------------------------------------------
const device_type NEOGEO_SMA_CART = &device_creator<neogeo_sma_cart>;
neogeo_sma_cart::neogeo_sma_cart(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT16 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
m_sma_prot(*this, "sma_prot"),
m_cmc_prot(*this, "cmc_prot")
{
}
neogeo_sma_cart::neogeo_sma_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock)
: device_t(mconfig, NEOGEO_SMA_CART, "NEOGEO SMA Cart", tag, owner, clock, "neogeo_rom", __FILE__),
device_neogeo_cart_interface(mconfig, *this),
m_banked_cart(*this, "banked_cart"),
m_sma_prot(*this, "sma_prot"),
m_cmc_prot(*this, "cmc_prot")
{
}
//-------------------------------------------------
// mapper specific start/reset
//-------------------------------------------------
void neogeo_sma_cart::device_start()
{
}
void neogeo_sma_cart::device_reset()
{
}
/*-------------------------------------------------
mapper specific handlers
-------------------------------------------------*/
READ16_MEMBER(neogeo_sma_cart::read_rom)
{
return m_rom[offset];
}
static MACHINE_CONFIG_FRAGMENT( sma_cart )
MCFG_NEOGEO_BANKED_CART_ADD("banked_cart")
MCFG_SMA_PROT_ADD("sma_prot")
MCFG_CMC_PROT_ADD("cmc_prot")
MACHINE_CONFIG_END
machine_config_constructor neogeo_sma_cart::device_mconfig_additions() const
{
return MACHINE_CONFIG_NAME( sma_cart );
}
/* Individual cartridge types (mirror DRIVER_INIT functionality) */
/*************************************************
KOF 99
**************************************************/
const device_type NEOGEO_SMA_KOF99_CART = &device_creator<neogeo_sma_kof99_cart>;
neogeo_sma_kof99_cart::neogeo_sma_kof99_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_sma_cart(mconfig, NEOGEO_SMA_KOF99_CART, "NEOGEO SMA Kof99 Cart", tag, owner, clock, "sma_kof99_cart", __FILE__) {}
void neogeo_sma_kof99_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_sma_prot->kof99_decrypt_68k(cpuregion);
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF99_GFX_KEY);
}
void neogeo_sma_kof99_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_sma_prot->kof99_install_protection(maincpu, m_banked_cart);
}
/*************************************************
Garou
**************************************************/
const device_type NEOGEO_SMA_GAROU_CART = &device_creator<neogeo_sma_garou_cart>;
neogeo_sma_garou_cart::neogeo_sma_garou_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_sma_cart(mconfig, NEOGEO_SMA_GAROU_CART, "NEOGEO SMA Garou Cart", tag, owner, clock, "sma_garou_cart", __FILE__) {}
void neogeo_sma_garou_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_sma_prot->garou_decrypt_68k(cpuregion);
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, GAROU_GFX_KEY);
}
void neogeo_sma_garou_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_sma_prot->garou_install_protection(maincpu, m_banked_cart);
}
const device_type NEOGEO_SMA_GAROUH_CART = &device_creator<neogeo_sma_garouh_cart>;
neogeo_sma_garouh_cart::neogeo_sma_garouh_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_sma_cart(mconfig, NEOGEO_SMA_GAROU_CART, "NEOGEO SMA Garou (alt) Cart", tag, owner, clock, "sma_garouh_cart", __FILE__) {}
void neogeo_sma_garouh_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_sma_prot->garouh_decrypt_68k(cpuregion);
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, GAROU_GFX_KEY);
}
void neogeo_sma_garouh_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_sma_prot->garouh_install_protection(maincpu, m_banked_cart);
}
/*************************************************
Metal Slug 3
**************************************************/
const device_type NEOGEO_SMA_MSLUG3_CART = &device_creator<neogeo_sma_mslug3_cart>;
neogeo_sma_mslug3_cart::neogeo_sma_mslug3_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_sma_cart(mconfig, NEOGEO_SMA_MSLUG3_CART, "NEOGEO SMA Mslug3 Cart", tag, owner, clock, "sma_mslug3_cart", __FILE__) {}
void neogeo_sma_mslug3_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_sma_prot->mslug3_decrypt_68k(cpuregion);
m_cmc_prot->kof99_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, MSLUG3_GFX_KEY);
}
void neogeo_sma_mslug3_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_sma_prot->mslug3_install_protection(maincpu, m_banked_cart);
}
/*************************************************
KOF2000
**************************************************/
const device_type NEOGEO_SMA_KOF2000_CART = &device_creator<neogeo_sma_kof2000_cart>;
neogeo_sma_kof2000_cart::neogeo_sma_kof2000_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : neogeo_sma_cart(mconfig, NEOGEO_SMA_KOF2000_CART, "NEOGEO SMA KOF2000 Cart", tag, owner, clock, "sma_kof2000_cart", __FILE__) {}
void neogeo_sma_kof2000_cart::decrypt_all(DECRYPT_ALL_PARAMS)
{
m_sma_prot->kof2000_decrypt_68k(cpuregion);
m_cmc_prot->neogeo_cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
m_cmc_prot->kof2000_neogeo_gfx_decrypt(spr_region, spr_region_size, fix_region, fix_region_size, KOF2000_GFX_KEY);
}
void neogeo_sma_kof2000_cart::activate_cart(ACTIVATE_CART_PARAMS)
{
m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size);
m_sma_prot->kof2000_install_protection(maincpu, m_banked_cart);
}

View File

@ -1,464 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#include "emu.h"
#include "sma_prot.h"
extern const device_type SMA_PROT = &device_creator<sma_prot_device>;
sma_prot_device::sma_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, SMA_PROT, "NeoGeo SMA Cartridge", tag, owner, clock, "sma_prot", __FILE__),
m_bankdev(nullptr),
m_sma_rng(0)
{
}
void sma_prot_device::device_start()
{
save_item(NAME(m_sma_rng));
}
void sma_prot_device::device_reset()
{
reset_sma_rng();
}
/************************ SMA Protection************************
thanks to Razoola
***************************************************************/
WRITE16_MEMBER( sma_prot_device::kof99_bankswitch_w )
{
int bankaddress;
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000,
0x3cc000, 0x4cc000, 0x3f2000, 0x4f2000,
0x407800, 0x507800, 0x40d000, 0x50d000,
0x417800, 0x517800, 0x420800, 0x520800,
0x424800, 0x524800, 0x429000, 0x529000,
0x42e800, 0x52e800, 0x431800, 0x531800,
0x54d000, 0x551000, 0x567000, 0x592800,
0x588800, 0x581800, 0x599800, 0x594800,
0x598000, /* rest not used? */
};
/* unscramble bank number */
data =
(((data>>14)&1)<<0)+
(((data>> 6)&1)<<1)+
(((data>> 8)&1)<<2)+
(((data>>10)&1)<<3)+
(((data>>12)&1)<<4)+
(((data>> 5)&1)<<5);
bankaddress = 0x100000 + bankoffset[data];
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
WRITE16_MEMBER( sma_prot_device::garou_bankswitch_w )
{
/* thanks to Razoola and Mr K for the info */
int bankaddress;
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000, // 00
0x280000, 0x380000, 0x2d0000, 0x3d0000, // 04
0x2f0000, 0x3f0000, 0x400000, 0x500000, // 08
0x420000, 0x520000, 0x440000, 0x540000, // 12
0x498000, 0x598000, 0x4a0000, 0x5a0000, // 16
0x4a8000, 0x5a8000, 0x4b0000, 0x5b0000, // 20
0x4b8000, 0x5b8000, 0x4c0000, 0x5c0000, // 24
0x4c8000, 0x5c8000, 0x4d0000, 0x5d0000, // 28
0x458000, 0x558000, 0x460000, 0x560000, // 32
0x468000, 0x568000, 0x470000, 0x570000, // 36
0x478000, 0x578000, 0x480000, 0x580000, // 40
0x488000, 0x588000, 0x490000, 0x590000, // 44
0x5d0000, 0x5d8000, 0x5e0000, 0x5e8000, // 48
0x5f0000, 0x5f8000, 0x600000, /* rest not used? */
};
/* unscramble bank number */
data =
(((data>> 5)&1)<<0)+
(((data>> 9)&1)<<1)+
(((data>> 7)&1)<<2)+
(((data>> 6)&1)<<3)+
(((data>>14)&1)<<4)+
(((data>>12)&1)<<5);
bankaddress = 0x100000 + bankoffset[data];
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
WRITE16_MEMBER( sma_prot_device::garouh_bankswitch_w )
{
/* thanks to Razoola and Mr K for the info */
int bankaddress;
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000, // 00
0x280000, 0x380000, 0x2d0000, 0x3d0000, // 04
0x2c8000, 0x3c8000, 0x400000, 0x500000, // 08
0x420000, 0x520000, 0x440000, 0x540000, // 12
0x598000, 0x698000, 0x5a0000, 0x6a0000, // 16
0x5a8000, 0x6a8000, 0x5b0000, 0x6b0000, // 20
0x5b8000, 0x6b8000, 0x5c0000, 0x6c0000, // 24
0x5c8000, 0x6c8000, 0x5d0000, 0x6d0000, // 28
0x458000, 0x558000, 0x460000, 0x560000, // 32
0x468000, 0x568000, 0x470000, 0x570000, // 36
0x478000, 0x578000, 0x480000, 0x580000, // 40
0x488000, 0x588000, 0x490000, 0x590000, // 44
0x5d8000, 0x6d8000, 0x5e0000, 0x6e0000, // 48
0x5e8000, 0x6e8000, 0x6e8000, 0x000000, // 52
0x000000, 0x000000, 0x000000, 0x000000, // 56
0x000000, 0x000000, 0x000000, 0x000000, // 60
};
/* unscramble bank number */
data =
(((data>> 4)&1)<<0)+
(((data>> 8)&1)<<1)+
(((data>>14)&1)<<2)+
(((data>> 2)&1)<<3)+
(((data>>11)&1)<<4)+
(((data>>13)&1)<<5);
bankaddress = 0x100000 + bankoffset[data];
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
WRITE16_MEMBER( sma_prot_device::mslug3_bankswitch_w )
{
/* thanks to Razoola and Mr K for the info */
int bankaddress;
static const int bankoffset[64] =
{
0x000000, 0x020000, 0x040000, 0x060000, // 00
0x070000, 0x090000, 0x0b0000, 0x0d0000, // 04
0x0e0000, 0x0f0000, 0x120000, 0x130000, // 08
0x140000, 0x150000, 0x180000, 0x190000, // 12
0x1a0000, 0x1b0000, 0x1e0000, 0x1f0000, // 16
0x200000, 0x210000, 0x240000, 0x250000, // 20
0x260000, 0x270000, 0x2a0000, 0x2b0000, // 24
0x2c0000, 0x2d0000, 0x300000, 0x310000, // 28
0x320000, 0x330000, 0x360000, 0x370000, // 32
0x380000, 0x390000, 0x3c0000, 0x3d0000, // 36
0x400000, 0x410000, 0x440000, 0x450000, // 40
0x460000, 0x470000, 0x4a0000, 0x4b0000, // 44
0x4c0000, /* rest not used? */
};
/* unscramble bank number */
data =
(((data>>14)&1)<<0)+
(((data>>12)&1)<<1)+
(((data>>15)&1)<<2)+
(((data>> 6)&1)<<3)+
(((data>> 3)&1)<<4)+
(((data>> 9)&1)<<5);
bankaddress = 0x100000 + bankoffset[data];
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
WRITE16_MEMBER( sma_prot_device::kof2000_bankswitch_w )
{
/* thanks to Razoola and Mr K for the info */
int bankaddress;
static const int bankoffset[64] =
{
0x000000, 0x100000, 0x200000, 0x300000, // 00
0x3f7800, 0x4f7800, 0x3ff800, 0x4ff800, // 04
0x407800, 0x507800, 0x40f800, 0x50f800, // 08
0x416800, 0x516800, 0x41d800, 0x51d800, // 12
0x424000, 0x524000, 0x523800, 0x623800, // 16
0x526000, 0x626000, 0x528000, 0x628000, // 20
0x52a000, 0x62a000, 0x52b800, 0x62b800, // 24
0x52d000, 0x62d000, 0x52e800, 0x62e800, // 28
0x618000, 0x619000, 0x61a000, 0x61a800, // 32
};
/* unscramble bank number */
data =
(((data>>15)&1)<<0)+
(((data>>14)&1)<<1)+
(((data>> 7)&1)<<2)+
(((data>> 3)&1)<<3)+
(((data>>10)&1)<<4)+
(((data>> 5)&1)<<5);
bankaddress = 0x100000 + bankoffset[data];
m_bankdev->neogeo_set_main_cpu_bank_address(bankaddress);
}
READ16_MEMBER( sma_prot_device::prot_9a37_r )
{
return 0x9a37;
}
/* information about the sma random number generator provided by razoola */
/* this RNG is correct for KOF99, other games might be different */
READ16_MEMBER( sma_prot_device::sma_random_r )
{
UINT16 old = m_sma_rng;
UINT16 newbit = ((m_sma_rng >> 2) ^
(m_sma_rng >> 3) ^
(m_sma_rng >> 5) ^
(m_sma_rng >> 6) ^
(m_sma_rng >> 7) ^
(m_sma_rng >>11) ^
(m_sma_rng >>12) ^
(m_sma_rng >>15)) & 1;
m_sma_rng = (m_sma_rng << 1) | newbit;
return old;
}
void sma_prot_device::reset_sma_rng()
{
m_sma_rng = 0x2345;
}
void sma_prot_device::sma_install_random_read_handler(cpu_device* maincpu, int addr1, int addr2 )
{
maincpu->space(AS_PROGRAM).install_read_handler(addr1, addr1 + 1, read16_delegate(FUNC(sma_prot_device::sma_random_r),this));
maincpu->space(AS_PROGRAM).install_read_handler(addr2, addr2 + 1, read16_delegate(FUNC(sma_prot_device::sma_random_r),this));
}
void sma_prot_device::kof99_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev)
{
maincpu->space(AS_PROGRAM).install_write_handler(0x2ffff0, 0x2ffff1, write16_delegate(FUNC(sma_prot_device::kof99_bankswitch_w),this));
maincpu->space(AS_PROGRAM).install_read_handler(0x2fe446, 0x2fe447, read16_delegate(FUNC(sma_prot_device::prot_9a37_r),this));
m_bankdev = bankdev;
sma_install_random_read_handler(maincpu, 0x2ffff8, 0x2ffffa);
}
void sma_prot_device::garou_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev)
{
maincpu->space(AS_PROGRAM).install_write_handler(0x2fffc0, 0x2fffc1, write16_delegate(FUNC(sma_prot_device::garou_bankswitch_w),this));
maincpu->space(AS_PROGRAM).install_read_handler(0x2fe446, 0x2fe447, read16_delegate(FUNC(sma_prot_device::prot_9a37_r),this));
m_bankdev = bankdev;
sma_install_random_read_handler(maincpu, 0x2fffcc, 0x2ffff0);
}
void sma_prot_device::garouh_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev)
{
maincpu->space(AS_PROGRAM).install_write_handler(0x2fffc0, 0x2fffc1, write16_delegate(FUNC(sma_prot_device::garouh_bankswitch_w),this));
maincpu->space(AS_PROGRAM).install_read_handler(0x2fe446, 0x2fe447, read16_delegate(FUNC(sma_prot_device::prot_9a37_r),this));
m_bankdev = bankdev;
sma_install_random_read_handler(maincpu, 0x2fffcc, 0x2ffff0);
}
void sma_prot_device::mslug3_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev)
{
maincpu->space(AS_PROGRAM).install_write_handler(0x2fffe4, 0x2fffe5, write16_delegate(FUNC(sma_prot_device::mslug3_bankswitch_w),this));
maincpu->space(AS_PROGRAM).install_read_handler(0x2fe446, 0x2fe447, read16_delegate(FUNC(sma_prot_device::prot_9a37_r),this));
m_bankdev = bankdev;
// sma_install_random_read_handler(maincpu, 0x2ffff8, 0x2ffffa);
}
void sma_prot_device::kof2000_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev)
{
maincpu->space(AS_PROGRAM).install_write_handler(0x2fffec, 0x2fffed, write16_delegate(FUNC(sma_prot_device::kof2000_bankswitch_w),this));
maincpu->space(AS_PROGRAM).install_read_handler(0x2fe446, 0x2fe447, read16_delegate(FUNC(sma_prot_device::prot_9a37_r),this));
m_bankdev = bankdev;
sma_install_random_read_handler(maincpu, 0x2fffd8, 0x2fffda);
}
/* kof99, garou, garouh, mslug3 and kof2000 have and SMA chip which contains program code and decrypts the 68k roms */
void sma_prot_device::kof99_decrypt_68k(UINT8* base)
{
UINT16 *rom;
int i,j;
rom = (UINT16 *)(base + 0x100000);
/* swap data lines on the whole ROMs */
for (i = 0;i < 0x800000/2;i++)
{
rom[i] = BITSWAP16(rom[i],13,7,3,0,9,4,5,6,1,12,8,14,10,11,2,15);
}
/* swap address lines for the banked part */
for (i = 0;i < 0x600000/2;i+=0x800/2)
{
UINT16 buffer[0x800/2];
memcpy(buffer,&rom[i],0x800);
for (j = 0;j < 0x800/2;j++)
{
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,6,2,4,9,8,3,1,7,0,5)];
}
}
/* swap address lines & relocate fixed part */
rom = (UINT16 *)base;
for (i = 0;i < 0x0c0000/2;i++)
{
rom[i] = rom[0x700000/2 + BITSWAP24(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)];
}
}
void sma_prot_device::garou_decrypt_68k(UINT8* base)
{
UINT16 *rom;
int i,j;
/* thanks to Razoola and Mr K for the info */
rom = (UINT16 *)(base + 0x100000);
/* swap data lines on the whole ROMs */
for (i = 0;i < 0x800000/2;i++)
{
rom[i] = BITSWAP16(rom[i],13,12,14,10,8,2,3,1,5,9,11,4,15,0,6,7);
}
/* swap address lines & relocate fixed part */
rom = (UINT16 *)base;
for (i = 0;i < 0x0c0000/2;i++)
{
rom[i] = rom[0x710000/2 + BITSWAP24(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)];
}
/* swap address lines for the banked part */
rom = (UINT16 *)(base + 0x100000);
for (i = 0;i < 0x800000/2;i+=0x8000/2)
{
UINT16 buffer[0x8000/2];
memcpy(buffer,&rom[i],0x8000);
for (j = 0;j < 0x8000/2;j++)
{
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,9,4,8,3,13,6,2,7,0,12,1,11,10,5)];
}
}
}
void sma_prot_device::garouh_decrypt_68k(UINT8* base)
{
UINT16 *rom;
int i,j;
/* thanks to Razoola and Mr K for the info */
rom = (UINT16 *)(base + 0x100000);
/* swap data lines on the whole ROMs */
for (i = 0;i < 0x800000/2;i++)
{
rom[i] = BITSWAP16(rom[i],14,5,1,11,7,4,10,15,3,12,8,13,0,2,9,6);
}
/* swap address lines & relocate fixed part */
rom = (UINT16 *)base;
for (i = 0;i < 0x0c0000/2;i++)
{
rom[i] = rom[0x7f8000/2 + BITSWAP24(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)];
}
/* swap address lines for the banked part */
rom = (UINT16 *)(base + 0x100000);
for (i = 0;i < 0x800000/2;i+=0x8000/2)
{
UINT16 buffer[0x8000/2];
memcpy(buffer,&rom[i],0x8000);
for (j = 0;j < 0x8000/2;j++)
{
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,12,8,1,7,11,3,13,10,6,9,5,4,0,2)];
}
}
}
void sma_prot_device::mslug3_decrypt_68k(UINT8* base)
{
UINT16 *rom;
int i,j;
/* thanks to Razoola and Mr K for the info */
rom = (UINT16 *)(base + 0x100000);
/* swap data lines on the whole ROMs */
for (i = 0;i < 0x800000/2;i++)
{
rom[i] = BITSWAP16(rom[i],4,11,14,3,1,13,0,7,2,8,12,15,10,9,5,6);
}
/* swap address lines & relocate fixed part */
rom = (UINT16 *)base;
for (i = 0;i < 0x0c0000/2;i++)
{
rom[i] = rom[0x5d0000/2 + BITSWAP24(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)];
}
/* swap address lines for the banked part */
rom = (UINT16 *)(base + 0x100000);
for (i = 0;i < 0x800000/2;i+=0x10000/2)
{
UINT16 buffer[0x10000/2];
memcpy(buffer,&rom[i],0x10000);
for (j = 0;j < 0x10000/2;j++)
{
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,2,11,0,14,6,4,13,8,9,3,10,7,5,12,1)];
}
}
}
void sma_prot_device::kof2000_decrypt_68k(UINT8* base)
{
UINT16 *rom;
int i,j;
/* thanks to Razoola and Mr K for the info */
rom = (UINT16 *)(base + 0x100000);
/* swap data lines on the whole ROMs */
for (i = 0;i < 0x800000/2;i++)
{
rom[i] = BITSWAP16(rom[i],12,8,11,3,15,14,7,0,10,13,6,5,9,2,1,4);
}
/* swap address lines for the banked part */
for (i = 0;i < 0x63a000/2;i+=0x800/2)
{
UINT16 buffer[0x800/2];
memcpy(buffer,&rom[i],0x800);
for (j = 0;j < 0x800/2;j++)
{
rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,4,1,3,8,6,2,7,0,9,5)];
}
}
/* swap address lines & relocate fixed part */
rom = (UINT16 *)base;
for (i = 0;i < 0x0c0000/2;i++)
{
rom[i] = rom[0x73a000/2 + BITSWAP24(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)];
}
}

View File

@ -1,52 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:S. Smith,David Haywood
#pragma once
#include "banked_cart.h"
#ifndef __SMA_PROT__
#define __SMA_PROT__
extern const device_type SMA_PROT;
#define MCFG_SMA_PROT_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, SMA_PROT, 0)
class sma_prot_device : public device_t
{
public:
// construction/destruction
sma_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
DECLARE_WRITE16_MEMBER( kof99_bankswitch_w );
DECLARE_WRITE16_MEMBER( garou_bankswitch_w );
DECLARE_WRITE16_MEMBER( garouh_bankswitch_w );
DECLARE_WRITE16_MEMBER( mslug3_bankswitch_w );
DECLARE_WRITE16_MEMBER( kof2000_bankswitch_w );
DECLARE_READ16_MEMBER( prot_9a37_r );
DECLARE_READ16_MEMBER( sma_random_r );
void reset_sma_rng();
void sma_install_random_read_handler(cpu_device* maincpu, int addr1, int addr2 );
void kof99_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev);
void garou_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev);
void garouh_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev);
void mslug3_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev);
void kof2000_install_protection(cpu_device* maincpu, neogeo_banked_cart_device* bankdev);
neogeo_banked_cart_device* m_bankdev;
void kof99_decrypt_68k(UINT8* base);
void garou_decrypt_68k(UINT8* base);
void garouh_decrypt_68k(UINT8* base);
void mslug3_decrypt_68k(UINT8* base);
void kof2000_decrypt_68k(UINT8* base);
UINT16 m_sma_rng;
protected:
virtual void device_start() override;
virtual void device_reset() override;
};
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

511
src/mame/drivers/neopcb.cpp Normal file
View File

@ -0,0 +1,511 @@
// license:BSD-3-Clause
// copyright-holders:Bryan McPhail,Ernesto Corvi,Andrew Prime,Zsolt Vasvari
// thanks-to:Fuzz
#include "emu.h"
#include "includes/neogeo.h"
void neopcb_state::machine_start()
{
m_type = NEOGEO_MVS;
common_machine_start();
// enable rtc and serial mode
m_upd4990a->cs_w(1);
m_upd4990a->oe_w(1);
m_upd4990a->c0_w(1);
m_upd4990a->c1_w(1);
m_upd4990a->c2_w(1);
m_sprgen->set_screen(m_screen);
}
void neopcb_state::neopcb_postload()
{
m_bank_audio_main->set_entry(m_use_cart_audio);
membank("cpu_bank")->set_base(m_region_maincpu->base() + m_bank_base);
set_outputs();
}
static MACHINE_CONFIG_DERIVED_CLASS( neopcb, neogeo_arcade, neopcb_state )
MCFG_CMC_PROT_ADD("cmc50")
MCFG_PCM2_PROT_ADD("pcm2")
MCFG_PVC_PROT_ADD("pvc")
MACHINE_CONFIG_END
// Game specific input definitions
INPUT_CHANGED_MEMBER(neopcb_state::select_bios)
{
membank("bios_bank")->set_entry(newval ? 0 : 1);
}
static INPUT_PORTS_START( dualbios )
PORT_INCLUDE( neogeo )
/* the rom banking seems to be tied directly to the dipswitch */
PORT_MODIFY("DSW")
PORT_DIPNAME( 0x04, 0x00, DEF_STR( Region ) ) PORT_DIPLOCATION("SW:3") PORT_CHANGED_MEMBER(DEVICE_SELF, neopcb_state, select_bios, 0)
PORT_DIPSETTING( 0x00, DEF_STR( Asia ) )
PORT_DIPSETTING( 0x04, DEF_STR( Japan ) )
INPUT_PORTS_END
/*************************************
*
* Jamma PCB sets of NeoGeo games
*
*************************************/
/****************************************
ID-2680
. MV-0 ????
NEO-MVH MVOBR 2003.8.4
****************************************/
ROM_START( ms5pcb ) /* Encrypted Set, JAMMA PCB */
ROM_REGION( 0x800000, "maincpu", 0 )
ROM_LOAD32_WORD_SWAP( "268-p1r.p1", 0x000000, 0x400000, CRC(d0466792) SHA1(880819933d997fab398f91061e9dbccb959ae8a1) )
ROM_LOAD32_WORD_SWAP( "268-p2r.p2", 0x000002, 0x400000, CRC(fbf6b61e) SHA1(9ec743d5988b5e3183f37f8edf45c72a8c0c893e) )
ROM_REGION( 0x20000, "fixed", 0 )
ROM_FILL( 0x000000, 0x20000, 0x000000 )
ROM_REGION( 0x20000, "fixedbios", 0 )
ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) )
ROM_REGION16_BE( 0x80000, "mainbios", 0 )
/* this contains both an ASIA and JAPAN bios, HARDDIP3 on the PCB selects which to use */
ROM_LOAD16_WORD_SWAP( "sp-4x.sp1", 0x00000, 0x80000, CRC(b4590283) SHA1(47047ed5b6062babc0a0bebcc30e4b3f021e115a) )
/* Encrypted */
ROM_REGION( 0x80000, "audiocrypt", 0 )
ROM_LOAD( "268-m1.m1", 0x00000, 0x80000, CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) /* mask rom TC534000 */
ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF )
/* Encrypted */
ROM_Y_ZOOM
ROM_REGION( 0x1000000, "ymsnd", 0 )
/* Encrypted */
ROM_LOAD( "268-v1.v1", 0x000000, 0x1000000, CRC(8458afe5) SHA1(62b4c6e7db763e9ff2697bbcdb43dc5a56b48c68) )
NO_DELTAT_REGION
ROM_REGION( 0x4000000, "sprites", 0 )
/* Encrypted */
ROM_LOAD32_WORD( "268-c1.c1", 0x0000000, 0x1000000, BAD_DUMP CRC(802042e8) SHA1(ff028b65f60f0b51b255a380cc47ec19fdc0c0cf) ) /* Plane 0,1 */
ROM_LOAD32_WORD( "268-c2.c2", 0x0000002, 0x1000000, BAD_DUMP CRC(3b89fb9f) SHA1(cbc0729aae961f683b105ec3e1cda58b3f985abc) ) /* Plane 2,3 */
ROM_LOAD32_WORD( "268-c3.c3", 0x2000000, 0x1000000, BAD_DUMP CRC(0f3f59e3) SHA1(8cc751dc7d4e94864a9ce3346f23b8f011082fcc) ) /* Plane 0,1 */
ROM_LOAD32_WORD( "268-c4.c4", 0x2000002, 0x1000000, BAD_DUMP CRC(3ad8435a) SHA1(b333c8993c9b4c4ea59450ad0a3560e0b28056bc) ) /* Plane 2,3 */
ROM_END
/****************************************
ID-2690
. MV-0 ????
NEO-MVH MVO 2003.6.5
****************************************/
ROM_START( svcpcb ) /* Encrypted Set, JAMMA PCB */
ROM_REGION( 0x2000000, "maincpu", 0 )
ROM_LOAD16_WORD_SWAP( "269-p1.p1", 0x000000, 0x2000000, CRC(432cfdfc) SHA1(19b40d32188a8bace6d2d570c6cf3d2f1e31e379) )
ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */
ROM_FILL( 0x000000, 0x80000, 0x000000 )
ROM_REGION( 0x20000, "fixedbios", 0 )
ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) )
ROM_REGION16_BE( 0x80000, "mainbios", 0 )
/* this contains both an ASIA and JAPAN bios, HARDDIP3 on the PCB selects which to use */
ROM_LOAD16_WORD_SWAP( "sp-4x.sp1", 0x00000, 0x80000, CRC(b4590283) SHA1(47047ed5b6062babc0a0bebcc30e4b3f021e115a) )
/* Encrypted */
ROM_REGION( 0x80000, "audiocrypt", 0 )
ROM_LOAD( "269-m1.m1", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) ) /* mask rom TC534000 */
ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF )
ROM_Y_ZOOM
ROM_REGION( 0x1000000, "ymsnd", 0 )
/* Encrypted */
ROM_LOAD( "269-v1.v1", 0x000000, 0x800000, CRC(c659b34c) SHA1(1931e8111ef43946f68699f8707334c96f753a1e) )
ROM_LOAD( "269-v2.v1", 0x800000, 0x800000, CRC(dd903835) SHA1(e58d38950a7a8697bb22a1cc7a371ae6664ae8f9) )
ROM_REGION( 0x4000000, "sprites", 0 )
/* Encrypted */
ROM_LOAD( "269-c1.c1", 0x0000000, 0x2000000, CRC(1b608f9c) SHA1(4e70ad182da2ca18815bd3936efb04a06ebce01e) ) /* Plane 0,1 */
ROM_LOAD( "269-c2.c1", 0x2000000, 0x2000000, CRC(5a95f294) SHA1(6123cc7b20b494076185d27c2ffea910e124b195) ) /* Plane 0,1 */
ROM_END
/****************************************
ID-2690
. MV-0 ????
NEO-MVH MVOB 2003.7.9
****************************************/
ROM_START( svcpcba ) /* Encrypted Set, JAMMA PCB */
/* alt PCB version, this one has the same program roms as the MVS set, and different GFX / Sound rom arrangements */
ROM_REGION( 0x800000, "maincpu", 0 )
ROM_LOAD32_WORD_SWAP( "269-p1a.p1", 0x000000, 0x400000, CRC(38e2005e) SHA1(1b902905916a30969282f1399a756e32ff069097) )
ROM_LOAD32_WORD_SWAP( "269-p2a.p1", 0x000002, 0x400000, CRC(6d13797c) SHA1(3cb71a95cea6b006b44cac0f547df88aec0007b7) )
ROM_REGION( 0x80000, "fixed", 0 ) /* larger char set */
ROM_FILL( 0x000000, 0x80000, 0x000000 )
ROM_REGION( 0x20000, "fixedbios", 0 )
ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) )
ROM_REGION16_BE( 0x80000, "mainbios", 0 )
/* this contains both an ASIA and JAPAN bios, HARDDIP3 on the PCB selects which to use */
ROM_LOAD16_WORD_SWAP( "sp-4x.sp1", 0x00000, 0x80000, CRC(b4590283) SHA1(47047ed5b6062babc0a0bebcc30e4b3f021e115a) )
/* Encrypted */
ROM_REGION( 0x80000, "audiocrypt", 0 )
ROM_LOAD( "269-m1.m1", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) )
ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF )
ROM_Y_ZOOM
ROM_REGION( 0x1000000, "ymsnd", 0 )
/* Encrypted */
ROM_LOAD( "269-v1a.v1", 0x000000, 0x1000000, CRC(a6af4753) SHA1(ec4f61a526b707a7faec4653b773beb3bf3a17ba) )
ROM_REGION( 0x4000000, "sprites", 0 )
/* Encrypted */
ROM_LOAD32_WORD( "269-c1a.c1", 0x0000000, 0x1000000, CRC(e64d2b0c) SHA1(0714198c400e5c273181e4c6f906b49e35fef75d) ) /* Plane 0,1 */
ROM_LOAD32_WORD( "269-c2a.c2", 0x0000002, 0x1000000, CRC(249089c2) SHA1(1c0ca19e330efe1a74b2d35a1a9a8d61481e16a9) ) /* Plane 2,3 */
ROM_LOAD32_WORD( "269-c3a.c3", 0x2000000, 0x1000000, CRC(d32f2fab) SHA1(273d58cb3c9075075b1ca39a3b247a2cd545fbe7) ) /* Plane 0,1 */
ROM_LOAD32_WORD( "269-c4a.c4", 0x2000002, 0x1000000, CRC(bf77e878) SHA1(e6e76f8eed0d04ee9ad39bf38ce305930b10e2c1) ) /* Plane 2,3 */
ROM_END
/****************************************
ID-2710
. MV-0 ????
NEO-MVH MVOC 2003.11.3
****************************************/
ROM_START( kf2k3pcb ) /* Encrypted Set, JAMMA PCB */
ROM_REGION( 0x900000, "maincpu", 0 )
ROM_LOAD32_WORD_SWAP( "271-p1.p1", 0x000000, 0x400000, CRC(b9da070c) SHA1(1a26325af142a4dd221c336061761468598c4634) )
ROM_LOAD32_WORD_SWAP( "271-p2.p2", 0x000002, 0x400000, CRC(da3118c4) SHA1(582e4f44f03276adecb7b2848d3b96bf6da57f1e) )
ROM_LOAD16_WORD_SWAP( "271-p3.p3", 0x800000, 0x100000, CRC(5cefd0d2) SHA1(cddc3164629fed4b6f715e12b109ad35d1009355) )
ROM_REGION( 0x100000, "fixed", 0 ) /* larger char set */
ROM_FILL( 0x000000, 0x100000, 0x000000 )
ROM_REGION( 0x20000, "fixedbios", 0 )
ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) )
ROM_REGION16_BE( 0x80000, "mainbios", 0 )
ROM_LOAD16_WORD_SWAP( "spj.sp1", 0x00000, 0x080000, CRC(148dd727) SHA1(2cf592a16c7157de02a989675d47965f2b3a44dd) ) // encrypted
/* Encrypted */
ROM_REGION( 0x80000, "audiocrypt", 0 )
ROM_LOAD( "271-m1.m1", 0x00000, 0x80000, CRC(d6bcf2bc) SHA1(df78bc95990eb8e8f3638dde6e1876354df7fe84) )
ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF )
ROM_Y_ZOOM
ROM_REGION( 0x1000000, "ymsnd", 0 )
/* Encrypted */
ROM_LOAD( "271-v1.v1", 0x000000, 0x1000000, CRC(1d96154b) SHA1(1d4e262b0d30cee79a4edc83bb9706023c736668) )
NO_DELTAT_REGION
ROM_REGION( 0x6000000, "sprites", 0 )
/* Encrypted */
ROM_LOAD32_WORD( "271-c1.c1", 0x0000000, 0x1000000, CRC(f5ebb327) SHA1(e4f799a54b09adcca13b1b0cf95971a1f4291b61) ) /* Plane 0,1 */
ROM_LOAD32_WORD( "271-c2.c2", 0x0000002, 0x1000000, CRC(2be21620) SHA1(872c658f53bbc558e90f18d5db9cbaa82e748a6a) ) /* Plane 2,3 */
ROM_LOAD32_WORD( "271-c3.c3", 0x2000000, 0x1000000, CRC(ddded4ff) SHA1(ff7b356125bc9e6637b164f5e81b13eabeb8d804) ) /* Plane 0,1 */
ROM_LOAD32_WORD( "271-c4.c4", 0x2000002, 0x1000000, CRC(d85521e6) SHA1(62278fa8690972ed32aca07a4f7f97e7203d9f3a) ) /* Plane 2,3 */
ROM_LOAD32_WORD( "271-c5.c5", 0x4000000, 0x1000000, CRC(18aa3540) SHA1(15e0a8c4e0927b1f7eb9bee8f532acea6818d5eb) ) /* Plane 0,1 */
ROM_LOAD32_WORD( "271-c6.c6", 0x4000002, 0x1000000, CRC(1c40de87) SHA1(8d6425aed43ff6a96c88194e203df6a783286373) ) /* Plane 2,3 */
ROM_END
/*************************************
*
* Additional encryption
*
*************************************/
/* ms5pcb and svcpcb have an additional scramble on top of the standard CMC scrambling */
void neopcb_state::svcpcb_gfx_decrypt()
{
static const UINT8 xorval[4] = { 0x34, 0x21, 0xc4, 0xe9 };
int rom_size = memregion("sprites")->bytes();
UINT8 *rom = memregion("sprites")->base();
dynamic_buffer buf(rom_size);
for (int i = 0; i < rom_size; i++)
rom[i] ^= xorval[(i % 4)];
for (int i = 0; i < rom_size; i += 4)
{
UINT32 rom32 = rom[i] | rom[i+1]<<8 | rom[i+2]<<16 | rom[i+3]<<24;
rom32 = BITSWAP32(rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05, 0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06, 0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d, 0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16);
buf[i] = rom32 & 0xff;
buf[i+1] = (rom32>>8) & 0xff;
buf[i+2] = (rom32>>16) & 0xff;
buf[i+3] = (rom32>>24) & 0xff;
}
for (int i = 0; i < rom_size / 4; i++)
{
int ofst = BITSWAP24((i & 0x1fffff), 0x17, 0x16, 0x15, 0x04, 0x0b, 0x0e, 0x08, 0x0c, 0x10, 0x00, 0x0a, 0x13, 0x03, 0x06, 0x02, 0x07, 0x0d, 0x01, 0x11, 0x09, 0x14, 0x0f, 0x12, 0x05);
ofst ^= 0x0c8923;
ofst += (i & 0xffe00000);
memcpy(&rom[i * 4], &buf[ofst * 4], 0x04);
}
}
/* and a further swap on the s1 data */
void neopcb_state::svcpcb_s1data_decrypt()
{
UINT8 *s1 = memregion("fixed")->base();
size_t s1_size = memregion("fixed")->bytes();
for (int i = 0; i < s1_size; i++) // Decrypt S
s1[i] = BITSWAP8(s1[i] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3);
}
/* kf2k3pcb has an additional scramble on top of the standard CMC scrambling */
/* Thanks to Razoola & Halrin for the info */
void neopcb_state::kf2k3pcb_gfx_decrypt()
{
static const UINT8 xorval[4] = { 0x34, 0x21, 0xc4, 0xe9 };
int rom_size = memregion("sprites")->bytes();
UINT8 *rom = memregion("sprites")->base();
dynamic_buffer buf(rom_size);
for (int i = 0; i < rom_size; i++)
rom[ i ] ^= xorval[ (i % 4) ];
for (int i = 0; i < rom_size; i +=4)
{
UINT32 rom32 = rom[i] | rom[i+1]<<8 | rom[i+2]<<16 | rom[i+3]<<24;
rom32 = BITSWAP32(rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05, 0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06, 0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d, 0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16);
buf[i] = rom32 & 0xff;
buf[i+1] = (rom32>>8) & 0xff;
buf[i+2] = (rom32>>16) & 0xff;
buf[i+3] = (rom32>>24) & 0xff;
}
for (int i = 0; i < rom_size; i+=4)
{
int ofst = BITSWAP24((i & 0x7fffff), 0x17, 0x15, 0x0a, 0x14, 0x13, 0x16, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00);
ofst ^= 0x000000;
ofst += (i & 0xff800000);
memcpy(&rom[ofst], &buf[i], 0x04);
}
}
/* and a further swap on the s1 data */
void neopcb_state::kf2k3pcb_decrypt_s1data()
{
UINT8 *src;
UINT8 *dst;
int tx_size = memregion("fixed")->bytes();
int srom_size = memregion("sprites")->bytes();
src = memregion("sprites")->base() + srom_size - 0x1000000 - 0x80000; // Decrypt S
dst = memregion("fixed")->base();
for (int i = 0; i < tx_size / 2; i++)
dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
src = memregion("sprites")->base() + srom_size - 0x80000;
dst = memregion("fixed")->base() + 0x80000;
for (int i = 0; i < tx_size / 2; i++)
dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
dst = memregion("fixed")->base();
for (int i = 0; i < tx_size; i++)
dst[i] = BITSWAP8(dst[i] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3);
}
/* only found on kf2k3pcb */
void neopcb_state::kf2k3pcb_sp1_decrypt()
{
static const UINT8 address[0x40] = {
0x04,0x0a,0x04,0x0a,0x04,0x0a,0x04,0x0a,
0x0a,0x04,0x0a,0x04,0x0a,0x04,0x0a,0x04,
0x09,0x07,0x09,0x07,0x09,0x07,0x09,0x07,
0x09,0x09,0x04,0x04,0x09,0x09,0x04,0x04,
0x0b,0x0d,0x0b,0x0d,0x03,0x05,0x03,0x05,
0x0e,0x0e,0x03,0x03,0x0e,0x0e,0x03,0x03,
0x03,0x05,0x0b,0x0d,0x03,0x05,0x0b,0x0d,
0x04,0x00,0x04,0x00,0x0e,0x0a,0x0e,0x0a
};
UINT16 *rom = (UINT16 *)memregion("mainbios")->base();
std::vector<UINT16> buf(0x80000/2);
for (int i = 0; i < 0x80000/2; i++)
{
// address xor
int addr = i ^ 0x0020;
if ( i & 0x00020) addr ^= 0x0010;
if (~i & 0x00010) addr ^= 0x0040;
if (~i & 0x00004) addr ^= 0x0080;
if ( i & 0x00200) addr ^= 0x0100;
if (~i & 0x02000) addr ^= 0x0400;
if (~i & 0x10000) addr ^= 0x1000;
if ( i & 0x02000) addr ^= 0x8000;
addr ^= address[((i >> 1) & 0x38) | (i & 7)];
buf[i] = rom[addr];
// data xor
if (buf[i] & 0x0004) buf[i] ^= 0x0001;
if (buf[i] & 0x0010) buf[i] ^= 0x0002;
if (buf[i] & 0x0020) buf[i] ^= 0x0008;
}
memcpy(rom, &buf[0], 0x80000);
}
/*************************************
*
* Game-specific inits
*
*************************************/
// macros allow code below to be copy+pasted into slot devices more easily
#define cpuregion memregion("maincpu")->base()
#define cpuregion_size memregion("maincpu")->bytes()
#define spr_region memregion("sprites")->base()
#define spr_region_size memregion("sprites")->bytes()
#define fix_region memregion("fixed")->base()
#define fix_region_size memregion("fixed")->bytes()
#define ym_region memregion("ymsnd")->base()
#define ym_region_size memregion("ymsnd")->bytes()
#define audiocpu_region memregion("audiocpu")->base()
#define audio_region_size memregion("audiocpu")->bytes()
#define audiocrypt_region memregion("audiocrypt")->base()
#define audiocrypt_region_size memregion("audiocrypt")->bytes()
/*********************************************** non-carts */
WRITE16_MEMBER(neopcb_state::write_bankpvc)
{
// write to cart ram
m_pvc_prot->protection_w(space, offset, data, mem_mask);
// actual bankswitch
if (offset >= 0xff8)
{
m_bank_base = m_pvc_prot->get_bank_base();
membank("cpu_bank")->set_base(m_region_maincpu->base() + m_bank_base);
}
}
void neopcb_state::install_common()
{
// install memory bank
m_maincpu->space(AS_PROGRAM).install_read_bank(0x200000, 0x2fffff, 0, 0, "cpu_bank");
membank("cpu_bank")->set_base(m_region_maincpu->base() + 0x100000);
// install protection handlers + bankswitch handler
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x2fe000, 0x2fffff, read16_delegate(FUNC(pvc_prot_device::protection_r),(pvc_prot_device*)m_pvc_prot), write16_delegate(FUNC(neopcb_state::write_bankpvc),this));
// perform basic memory initialization that are usually done on-cart
m_curr_slot = 0;
m_bank_base = 0;
init_audio();
m_audiocpu->reset();
init_ym();
init_sprites();
}
void neopcb_state::install_banked_bios()
{
m_maincpu->space(AS_PROGRAM).install_read_bank(0xc00000, 0xc1ffff, 0, 0x0e0000, "bios_bank");
membank("bios_bank")->configure_entries(0, 2, memregion("mainbios")->base(), 0x20000);
membank("bios_bank")->set_entry(1);
}
DRIVER_INIT_MEMBER(neopcb_state, ms5pcb)
{
DRIVER_INIT_CALL(neogeo);
install_common();
install_banked_bios();
m_sprgen->m_fixed_layer_bank_type = 2;
m_pvc_prot->mslug5_decrypt_68k(cpuregion, cpuregion_size);
m_pcm2_prot->swap(ym_region, ym_region_size, 2);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
svcpcb_gfx_decrypt();
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MSLUG5_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
svcpcb_s1data_decrypt();
}
DRIVER_INIT_MEMBER(neopcb_state, svcpcb)
{
DRIVER_INIT_CALL(neogeo);
install_common();
install_banked_bios();
m_sprgen->m_fixed_layer_bank_type = 2;
m_pvc_prot->svc_px_decrypt(cpuregion, cpuregion_size);
m_pcm2_prot->swap(ym_region, ym_region_size, 3);
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
svcpcb_gfx_decrypt();
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, SVC_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
svcpcb_s1data_decrypt();
}
DRIVER_INIT_MEMBER(neopcb_state, kf2k3pcb)
{
DRIVER_INIT_CALL(neogeo);
install_common();
m_sprgen->m_fixed_layer_bank_type = 2;
m_pvc_prot->kf2k3pcb_decrypt_68k(cpuregion, cpuregion_size);
m_pcm2_prot->swap(ym_region, ym_region_size, 5);
kf2k3pcb_sp1_decrypt();
m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size);
// extra little swap on the m1 - this must be performed AFTER the m1 decrypt
// or the m1 checksum (used to generate the key) for decrypting the m1 is
// incorrect
UINT8* rom = memregion("audiocpu")->base();
for (int i = 0; i < 0x90000; i++)
rom[i] = BITSWAP8(rom[i], 5, 6, 1, 4, 3, 0, 7, 2);
kf2k3pcb_gfx_decrypt();
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2003_GFX_KEY);
m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size);
kf2k3pcb_decrypt_s1data();
m_maincpu->space(AS_PROGRAM).install_rom(0xc00000, 0xc7ffff, 0, 0x080000, memregion("mainbios")->base()); // 512k bios
}
GAME( 2003, ms5pcb, 0, neopcb, dualbios, neopcb_state, ms5pcb, ROT0, "SNK Playmore", "Metal Slug 5 (JAMMA PCB)", MACHINE_SUPPORTS_SAVE )
GAME( 2003, svcpcb, 0, neopcb, dualbios, neopcb_state, svcpcb, ROT0, "SNK Playmore", "SNK vs. Capcom - SVC Chaos (JAMMA PCB, set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 2003, svcpcba, svcpcb, neopcb, dualbios, neopcb_state, svcpcb, ROT0, "SNK Playmore", "SNK vs. Capcom - SVC Chaos (JAMMA PCB, set 2)" , MACHINE_SUPPORTS_SAVE ) /* Encrypted Code */
GAME( 2003, kf2k3pcb, 0, neopcb, neogeo, neopcb_state, kf2k3pcb, ROT0, "SNK Playmore", "The King of Fighters 2003 (Japan, JAMMA PCB)", MACHINE_SUPPORTS_SAVE )

View File

@ -3,32 +3,6 @@
// thanks-to:Fuzz
/***************************************************************************
Neo-Geo AES hardware
Credits (from MAME neogeo.c, since this is just a minor edit of that driver):
* This driver was made possible by the research done by
Charles MacDonald. For a detailed description of the Neo-Geo
hardware, please visit his page at:
http://cgfm2.emuviews.com/temp/mvstech.txt
* Presented to you by the Shin Emu Keikaku team.
* The following people have all spent probably far
too much time on this:
AVDB
Bryan McPhail
Fuzz
Ernesto Corvi
Andrew Prime
Zsolt Vasvari
MESS cartridge support by R. Belmont based on work by Michael Zapf
Current status:
- Cartridges run.
- Riding Hero runs in slow-mo due to the unemulated comm link MCU in the cartridge.
In MAME if dip SW6 is set to ON to enable link play, it runs the same way!
On AES there are no dipswitches, and so it always tries to talk to the MCU.
Neo-Geo CD hardware
Thanks to:
@ -51,308 +25,13 @@
****************************************************************************/
#include "emu.h"
#include "cpu/m68000/m68000.h"
#include "includes/neogeo.h"
#include "machine/nvram.h"
#include "cpu/z80/z80.h"
#include "sound/2610intf.h"
#include "imagedev/chd_cd.h"
#include "sound/cdda.h"
#include "machine/megacdcd.h"
#include "softlist.h"
extern const char layout_neogeo[];
/*************************************
*
* AES
*
*************************************/
class ng_aes_state : public neogeo_state
{
public:
ng_aes_state(const machine_config &mconfig, device_type type, const char *tag)
: neogeo_state(mconfig, type, tag)
, m_io_in2(*this, "IN2")
{ }
DECLARE_READ16_MEMBER(aes_in2_r);
DECLARE_INPUT_CHANGED_MEMBER(aes_jp1);
DECLARE_MACHINE_START(neogeo);
DECLARE_MACHINE_RESET(neogeo);
DECLARE_DRIVER_INIT(neogeo);
protected:
required_ioport m_io_in2;
void common_machine_start();
};
/*************************************
*
* Input read handlers
*
*************************************/
READ16_MEMBER(ng_aes_state::aes_in2_r)
{
UINT32 ret = m_io_in2->read();
ret = (ret & 0xfcff) | (m_ctrl1->read_start_sel() << 8);
ret = (ret & 0xf3ff) | (m_ctrl2->read_start_sel() << 10);
return ret;
}
/*************************************
*
* Machine initialization
*
*************************************/
void ng_aes_state::common_machine_start()
{
/* set the initial main CPU bank */
neogeo_main_cpu_banking_init();
/* set the initial audio CPU ROM banks */
neogeo_audio_cpu_banking_init(1);
create_interrupt_timers();
/* irq levels for MVS / AES */
m_vblank_level = 1;
m_raster_level = 2;
/* start with an IRQ3 - but NOT on a reset */
m_irq3_pending = 1;
/* register state save */
save_item(NAME(m_display_position_interrupt_control));
save_item(NAME(m_display_counter));
save_item(NAME(m_vblank_interrupt_pending));
save_item(NAME(m_display_position_interrupt_pending));
save_item(NAME(m_irq3_pending));
save_item(NAME(m_audio_cpu_nmi_enabled));
save_item(NAME(m_audio_cpu_nmi_pending));
save_item(NAME(m_use_cart_vectors));
save_item(NAME(m_use_cart_audio));
//save_item(NAME(m_main_cpu_bank_address));
machine().save().register_postload(save_prepost_delegate(FUNC(ng_aes_state::neogeo_postload), this));
m_cartslots[0] = m_cartslot1;
m_cartslots[1] = m_cartslot2;
m_cartslots[2] = m_cartslot3;
m_cartslots[3] = m_cartslot4;
m_cartslots[4] = m_cartslot5;
m_cartslots[5] = m_cartslot6;
m_sprgen->set_screen(m_screen);
m_sprgen->set_sprite_region(m_region_sprites->base(), m_region_sprites->bytes());
m_sprgen->set_fixed_regions(m_region_fixed->base(), m_region_fixed->bytes(), m_region_fixedbios);
}
MACHINE_START_MEMBER(ng_aes_state,neogeo)
{
m_type = NEOGEO_AES;
common_machine_start();
}
/*************************************
*
* Machine reset
*
*************************************/
MACHINE_RESET_MEMBER(ng_aes_state,neogeo)
{
offs_t offs;
address_space &space = m_maincpu->space(AS_PROGRAM);
/* reset system control registers */
for (offs = 0; offs < 8; offs++)
system_control_w(space, offs, 0);
// disable audiocpu nmi
m_audio_cpu_nmi_enabled = false;
m_audio_cpu_nmi_pending = false;
audio_cpu_check_nmi();
m_maincpu->reset();
start_interrupt_timers();
/* trigger the IRQ3 that was set by MACHINE_START */
update_interrupts();
m_recurse = false;
/* AES has no SFIX ROM and always uses the cartridge's */
m_sprgen->neogeo_set_fixed_layer_source(1);
if (m_cartslots[0]) // if thie system has cart slots then do some extra initialization
{
set_slot_number(0);
}
}
/*************************************
*
* Main CPU memory handlers
*
*************************************/
static ADDRESS_MAP_START( aes_main_map, AS_PROGRAM, 16, ng_aes_state )
// AM_RANGE(0x000000, 0x00007f) AM_ROMBANK("vectors")
AM_RANGE(0x000000, 0x00007f) AM_READ(neogeo_slot_rom_low_bectors_r)
AM_RANGE(0x000080, 0x0fffff) AM_ROM
AM_RANGE(0x100000, 0x10ffff) AM_MIRROR(0x0f0000) AM_RAM
/* some games have protection devices in the 0x200000 region, it appears to map to cart space, not surprising, the ROM is read here too */
//AM_RANGE(0x200000, 0x2fffff) AM_ROMBANK("cartridge")
//AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE(main_cpu_bank_select_w)
AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01fffe) AM_DEVREAD8("ctrl1", neogeo_control_port_device, ctrl_r, 0xff00)
AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("AUDIO") AM_WRITE8(audio_command_w, 0xff00)
AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_DEVREAD8("ctrl2", neogeo_control_port_device, ctrl_r, 0xff00)
AM_RANGE(0x360000, 0x37ffff) AM_READ(neogeo_unmapped_r)
AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ(aes_in2_r)
AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE8(io_control_w, 0x00ff)
AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(neogeo_unmapped_r) AM_WRITE8(system_control_w, 0x00ff)
AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ(neogeo_video_register_r)
AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE(neogeo_video_register_w)
AM_RANGE(0x3e0000, 0x3fffff) AM_READ(neogeo_unmapped_r)
AM_RANGE(0x400000, 0x401fff) AM_MIRROR(0x3fe000) AM_READWRITE(neogeo_paletteram_r, neogeo_paletteram_w)
AM_RANGE(0x800000, 0x800fff) AM_READWRITE(memcard_r, memcard_w)
AM_RANGE(0xc00000, 0xc1ffff) AM_MIRROR(0x0e0000) AM_ROM AM_REGION("mainbios", 0)
AM_RANGE(0xd00000, 0xffffff) AM_READ(neogeo_unmapped_r)
ADDRESS_MAP_END
/*************************************
*
* Input port definitions
*
*************************************/
static INPUT_PORTS_START( aes )
PORT_START("IN2")
PORT_BIT( 0x0fff, IP_ACTIVE_LOW, IPT_UNUSED )
// Start & Select are read from controller slot device
PORT_BIT( 0x7000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state, get_memcard_status, nullptr)
PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* Hardware type (AES=0, MVS=1) Some games check this and show a piracy warning screen if the hardware and BIOS don't match */
PORT_START("AUDIO")
PORT_BIT( 0x0007, IP_ACTIVE_HIGH, IPT_UNUSED ) /* AES has no coin slots, it's a console */
PORT_BIT( 0x0018, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* what is this? Universe BIOS uses these bits to detect MVS or AES hardware */
PORT_BIT( 0x00e0, IP_ACTIVE_HIGH, IPT_UNUSED ) /* AES has no upd4990a */
PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(DEVICE_SELF, neogeo_state, get_audio_result, nullptr)
PORT_START("JP") // JP1 and JP2 are jumpers or solderpads depending on AES board revision, intended for use on the Development BIOS
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Short JP1 (Debug Monitor)") PORT_CODE(KEYCODE_F1) PORT_CHANGED_MEMBER(DEVICE_SELF, ng_aes_state, aes_jp1, 0)
// PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) // what is JP2 for? somehow related to system reset, disable watchdog?
INPUT_PORTS_END
INPUT_CHANGED_MEMBER(ng_aes_state::aes_jp1)
{
// Shorting JP1 causes a 68000 /BERR (Bus Error). On Dev Bios, this pops up the debug monitor.
if (newval)
m_maincpu->set_input_line(M68K_LINE_BUSERROR, HOLD_LINE);
}
/*************************************
*
* Machine driver
*
*************************************/
static MACHINE_CONFIG_DERIVED_CLASS( aes, neogeo_base, ng_aes_state )
MCFG_CPU_MODIFY("maincpu")
MCFG_CPU_PROGRAM_MAP(aes_main_map)
MCFG_NEOGEO_MEMCARD_ADD("memcard")
MCFG_MACHINE_START_OVERRIDE(ng_aes_state, neogeo)
MCFG_MACHINE_RESET_OVERRIDE(ng_aes_state, neogeo)
MCFG_NEOGEO_CARTRIDGE_ADD("cartslot1", neogeo_cart, nullptr)
MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_controls, "joy", false)
MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_controls, "joy", false)
MCFG_SOFTWARE_LIST_ADD("cart_list","neogeo")
MCFG_SOFTWARE_LIST_FILTER("cart_list","AES")
MACHINE_CONFIG_END
/*************************************
*
* Driver initalization
*
*************************************/
#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \
ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(bios+1)) /* Note '+1' */
ROM_START( aes )
ROM_REGION16_BE( 0x20000, "mainbios", 0 )
ROM_SYSTEM_BIOS( 0, "asia", "Asia AES" )
ROM_LOAD16_WORD_SWAP_BIOS( 0, "neo-epo.bin", 0x00000, 0x020000, CRC(d27a71f1) SHA1(1b3b22092f30c4d1b2c15f04d1670eb1e9fbea07) ) /* AES Console (Asia?) Bios */
ROM_SYSTEM_BIOS( 1, "japan", "Japan AES" )
ROM_LOAD16_WORD_SWAP_BIOS( 1, "neo-po.bin", 0x00000, 0x020000, CRC(16d0c132) SHA1(4e4a440cae46f3889d20234aebd7f8d5f522e22c) ) /* AES Console (Japan) Bios */
ROM_SYSTEM_BIOS( 2, "devel", "Development System ROM" )
ROM_LOAD16_WORD_SWAP_BIOS( 2, "neodebug.rom", 0x00000, 0x020000, CRC(698ebb7d) SHA1(081c49aa8cc7dad5939833dc1b18338321ea0a07) ) /* Official debug (development) ROM, for home-use base board */
NEOGEO_UNIBIOS(3)
ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASEFF )
ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF )
ROM_REGION( 0x20000, "zoomy", 0 )
ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) )
ROM_REGION( 0x20000, "fixed", ROMREGION_ERASEFF )
ROM_REGION( 0x1000000, "ymsnd", ROMREGION_ERASEFF )
ROM_REGION( 0x1000000, "ymsnd.deltat", ROMREGION_ERASEFF )
ROM_REGION( 0x900000, "sprites", ROMREGION_ERASEFF )
ROM_END
DRIVER_INIT_MEMBER(ng_aes_state,neogeo)
{
if (!m_cartslots[0]) m_banked_cart->install_banks(machine(), m_maincpu, m_region_maincpu->base(), m_region_maincpu->bytes());
}
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */
CONS( 1990, aes, 0, 0, aes, aes, ng_aes_state, neogeo, "SNK", "Neo-Geo AES", MACHINE_SUPPORTS_SAVE )
/*************************************
*
* NEOCD
*
*************************************/
/* Stubs for various functions called by the FBA code, replace with MAME specifics later */
@ -372,12 +51,11 @@ UINT8* NeoZ80ROMActive;
UINT8 NeoSystem = NEOCD_REGION_JAPAN;
class ngcd_state : public ng_aes_state
class ngcd_state : public aes_state
{
public:
ngcd_state(const machine_config &mconfig, device_type type, const char *tag)
: ng_aes_state(mconfig, type, tag)
: aes_state(mconfig, type, tag)
, m_tempcdc(*this,"tempcdc")
{
NeoCDDMAAddress1 = 0;
@ -462,9 +140,6 @@ protected:
/*************************************
*
* Memory card
@ -1154,17 +829,26 @@ MACHINE_START_MEMBER(ngcd_state,neocd)
m_type = NEOGEO_CD;
common_machine_start();
/* irq levels for NEOCD (swapped compared to MVS / AES) */
// set curr_slot to 0, so to allow checking m_slots[m_curr_slot] != nullptr
m_curr_slot = 0;
// initialize sprite to point to memory regions
m_sprgen->m_fixed_layer_bank_type = 0;
m_sprgen->set_screen(m_screen);
m_sprgen->set_sprite_region(m_region_sprites->base(), m_region_sprites->bytes());
m_sprgen->set_fixed_regions(m_region_fixed->base(), m_region_fixed->bytes(), m_region_fixedbios);
m_sprgen->neogeo_set_fixed_layer_source(1);
// irq levels for NEOCD (swapped compared to MVS / AES)
m_vblank_level = 2;
m_raster_level = 1;
/* initialize the memcard data structure */
/* NeoCD doesn't have memcard slots, rather, it has a larger internal memory which works the same */
// initialize the memcard data structure
// NeoCD doesn't have memcard slots, rather, it has a larger internal memory which works the same
m_meminternal_data = make_unique_clear<UINT8[]>(0x2000);
machine().device<nvram_device>("saveram")->set_base(m_meminternal_data.get(), 0x2000);
save_pointer(NAME(m_meminternal_data.get()), 0x2000);
//m_bank_vectors->set_entry(0); // default to the BIOS vectors
m_use_cart_vectors = 0;
m_tempcdc->reset_cd();
@ -1179,7 +863,7 @@ MACHINE_START_MEMBER(ngcd_state,neocd)
MACHINE_RESET_MEMBER(ngcd_state,neocd)
{
MACHINE_RESET_CALL_MEMBER( neogeo );
neogeo_state::machine_reset();
NeoSpriteRAM = memregion("sprites")->base();
YM2610ADPCMAROM = memregion("ymsnd")->base();
@ -1227,9 +911,6 @@ static ADDRESS_MAP_START( neocd_main_map, AS_PROGRAM, 16, ngcd_state )
ADDRESS_MAP_END
/*************************************
*
* Audio CPU port handlers
@ -1464,4 +1145,4 @@ CONS( 1996, neocdz, 0, 0, neocd, neocd, ngcd_state, neocdz, "SNK", "Ne
CONS( 1996, neocdzj, neocdz, 0, neocd, neocd, ngcd_state, neocdzj, "SNK", "Neo-Geo CDZ (Japan)", 0 )
CONS( 1994, neocd, neocdz, 0, neocd, neocd, ng_aes_state, neogeo, "SNK", "Neo-Geo CD", MACHINE_NOT_WORKING ) // older model, ignores disc protections?
CONS( 1994, neocd, neocdz, 0, neocd, neocd, driver_device, 0, "SNK", "Neo-Geo CD", MACHINE_NOT_WORKING ) // older model, ignores disc protections?

View File

@ -7,23 +7,18 @@
*************************************************************************/
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
#include "sound/2610intf.h"
#include "machine/upd1990a.h"
#include "machine/ng_memcard.h"
#include "video/neogeo_spr.h"
#include "bus/neogeo/neogeo_slot.h"
#include "bus/neogeo/neogeo_carts.h"
#include "bus/neogeo/cmc_prot.h"
#include "bus/neogeo/pcm2_prot.h"
#include "bus/neogeo/pvc_prot.h"
#include "bus/neogeo/bootleg_prot.h"
#include "bus/neogeo/kof2002_prot.h"
#include "bus/neogeo/fatfury2_prot.h"
#include "bus/neogeo/kof98_prot.h"
#include "bus/neogeo/sbp_prot.h"
#include "bus/neogeo/kog_prot.h"
#include "bus/neogeo/slot.h"
#include "bus/neogeo/carts.h"
#include "bus/neogeo_ctrl/ctrl.h"
// On scanline 224, /VBLANK goes low 56 mclks (14 pixels) from the rising edge of /HSYNC.
// Two mclks after /VBLANK goes low, the hardware sets a pending IRQ1 flip-flop.
#define NEOGEO_VBLANK_IRQ_HTIM (attotime::from_ticks(56+2, NEOGEO_MASTER_CLOCK))
@ -34,7 +29,6 @@ class neogeo_state : public driver_device
public:
neogeo_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_banked_cart(*this, "banked_cart"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_region_maincpu(*this, "maincpu"),
@ -45,6 +39,7 @@ public:
//m_bank_cartridge(*this, "cartridge"),
m_bank_audio_main(*this, "audio_main"),
m_upd4990a(*this, "upd4990a"),
m_ym(*this, "ymsnd"),
m_save_ram(*this, "saveram"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
@ -58,34 +53,28 @@ public:
m_sprgen(*this, "spritegen"),
m_use_cart_vectors(0),
m_use_cart_audio(0),
m_cartslot1(*this, "cartslot1"),
m_cartslot2(*this, "cartslot2"),
m_cartslot3(*this, "cartslot3"),
m_cartslot4(*this, "cartslot4"),
m_cartslot5(*this, "cartslot5"),
m_cartslot6(*this, "cartslot6"),
m_currentslot(-1)
m_slot1(*this, "cslot1"),
m_slot2(*this, "cslot2"),
m_slot3(*this, "cslot3"),
m_slot4(*this, "cslot4"),
m_slot5(*this, "cslot5"),
m_slot6(*this, "cslot6")
{ }
DECLARE_WRITE8_MEMBER(io_control_w);
DECLARE_READ16_MEMBER(memcard_r);
DECLARE_WRITE16_MEMBER(memcard_w);
DECLARE_WRITE8_MEMBER(audio_command_w);
DECLARE_READ8_MEMBER(audio_command_r);
DECLARE_READ8_MEMBER(audio_cpu_bank_select_r);
DECLARE_WRITE8_MEMBER(audio_cpu_enable_nmi_w);
DECLARE_WRITE8_MEMBER(system_control_w);
DECLARE_READ16_MEMBER(neogeo_unmapped_r);
DECLARE_READ16_MEMBER(neogeo_paletteram_r);
DECLARE_WRITE16_MEMBER(neogeo_paletteram_w);
DECLARE_READ16_MEMBER(neogeo_video_register_r);
DECLARE_WRITE16_MEMBER(neogeo_video_register_w);
READ16_MEMBER(banked_vectors_r);
DECLARE_READ16_MEMBER(in0_r);
DECLARE_READ16_MEMBER(in1_r);
void set_slot_number(int slot);
DECLARE_CUSTOM_INPUT_MEMBER(get_memcard_status);
DECLARE_CUSTOM_INPUT_MEMBER(get_audio_result);
@ -96,17 +85,32 @@ public:
// MVS-specific
DECLARE_WRITE16_MEMBER(save_ram_w);
DECLARE_CUSTOM_INPUT_MEMBER(kizuna4p_start_r);
DECLARE_INPUT_CHANGED_MEMBER(select_bios);
UINT32 screen_update_neogeo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_DRIVER_INIT(neogeo);
DECLARE_DRIVER_INIT(mvs);
optional_device<neogeo_banked_cart_device> m_banked_cart;
// NEW IMPLEMENTATION!!!
void set_slot_idx(int slot);
void neogeo_postload();
DECLARE_WRITE8_MEMBER(io_control_w);
DECLARE_WRITE8_MEMBER(system_control_w);
DECLARE_READ16_MEMBER(banked_vectors_r);
DECLARE_READ16_MEMBER(low_rom);
DECLARE_WRITE16_MEMBER(write_banksel);
DECLARE_WRITE16_MEMBER(write_bankprot);
DECLARE_WRITE16_MEMBER(write_bankprot_pvc);
DECLARE_WRITE16_MEMBER(write_bankprot_ms5p);
DECLARE_WRITE16_MEMBER(write_bankprot_kf2k3bl);
DECLARE_WRITE16_MEMBER(write_bankprot_kof10th);
DECLARE_READ16_MEMBER(read_lorom_kof10th);
DECLARE_DRIVER_INIT(neogeo);
protected:
void neogeo_postload();
void common_machine_start();
void update_interrupts();
void create_interrupt_timers();
void start_interrupt_timers();
@ -131,7 +135,6 @@ protected:
void set_output_latch( UINT8 data );
void set_output_data( UINT8 data );
// device overrides
virtual void machine_start() override;
virtual void machine_reset() override;
@ -141,9 +144,9 @@ protected:
required_device<cpu_device> m_audiocpu;
// memory
required_memory_region m_region_maincpu;
required_memory_region m_region_sprites;
required_memory_region m_region_fixed;
optional_memory_region m_region_maincpu;
optional_memory_region m_region_sprites;
optional_memory_region m_region_fixed;
optional_memory_region m_region_fixedbios;
//required_memory_bank m_bank_vectors;
//optional_memory_bank m_bank_cartridge; // optional because of neocd
@ -152,6 +155,7 @@ protected:
// MVS-specific devices
optional_device<upd4990a_device> m_upd4990a;
optional_device<ym2610_device> m_ym;
optional_shared_ptr<UINT16> m_save_ram;
required_device<screen_device> m_screen;
@ -212,142 +216,82 @@ protected:
int m_use_cart_audio;
// cart slots
optional_device<neogeo_cart_slot_device> m_cartslot1;
optional_device<neogeo_cart_slot_device> m_cartslot2;
optional_device<neogeo_cart_slot_device> m_cartslot3;
optional_device<neogeo_cart_slot_device> m_cartslot4;
optional_device<neogeo_cart_slot_device> m_cartslot5;
optional_device<neogeo_cart_slot_device> m_cartslot6;
neogeo_cart_slot_device* m_cartslots[6];
int m_currentslot;
public:
DECLARE_READ16_MEMBER(neogeo_slot_rom_low_r);
DECLARE_READ16_MEMBER(neogeo_slot_rom_low_bectors_r);
void init_cpu();
void init_audio();
void init_ym();
void init_sprites();
// temporary helper to restore memory banking while bankswitch is handled in the driver...
UINT32 m_bank_base;
optional_device<neogeo_cart_slot_device> m_slot1;
optional_device<neogeo_cart_slot_device> m_slot2;
optional_device<neogeo_cart_slot_device> m_slot3;
optional_device<neogeo_cart_slot_device> m_slot4;
optional_device<neogeo_cart_slot_device> m_slot5;
optional_device<neogeo_cart_slot_device> m_slot6;
int m_curr_slot;
neogeo_cart_slot_device* m_slots[6];
};
#include "bus/neogeo/prot_pcm2.h"
#include "bus/neogeo/prot_cmc.h"
#include "bus/neogeo/prot_pvc.h"
class neogeo_noslot_state : public neogeo_state
class neopcb_state : public neogeo_state
{
public:
neogeo_noslot_state(const machine_config &mconfig, device_type type, const char *tag)
: neogeo_state(mconfig, type, tag),
/* legacy cartridge specifics */
m_mslugx_prot(*this, "mslugx_prot"),
m_sma_prot(*this, "sma_prot"),
m_cmc_prot(*this, "cmc_prot"),
m_pcm2_prot(*this, "pcm2_prot"),
m_pvc_prot(*this, "pvc_prot"),
m_bootleg_prot(*this, "bootleg_prot"),
m_kof2002_prot(*this, "kof2002_prot"),
m_fatfury2_prot(*this, "fatfury2_prot"),
m_kof98_prot(*this, "kof98_prot"),
m_sbp_prot(*this, "sbp_prot") {}
neopcb_state(const machine_config &mconfig, device_type type, const char *tag)
: neogeo_state(mconfig, type, tag)
, m_cmc_prot(*this, "cmc50")
, m_pcm2_prot(*this, "pcm2")
, m_pvc_prot(*this, "pvc")
{}
// device overrides
virtual void machine_start() override;
DECLARE_WRITE16_MEMBER(write_bankpvc);
DECLARE_INPUT_CHANGED_MEMBER(select_bios);
DECLARE_DRIVER_INIT(fatfury2);
DECLARE_DRIVER_INIT(zupapa);
DECLARE_DRIVER_INIT(kof98);
DECLARE_DRIVER_INIT(mslugx);
DECLARE_DRIVER_INIT(kof99);
DECLARE_DRIVER_INIT(kof99k);
DECLARE_DRIVER_INIT(garou);
DECLARE_DRIVER_INIT(garouh);
DECLARE_DRIVER_INIT(garoubl);
DECLARE_DRIVER_INIT(mslug3);
DECLARE_DRIVER_INIT(mslug3h);
DECLARE_DRIVER_INIT(mslug3b6);
DECLARE_DRIVER_INIT(kof2000);
DECLARE_DRIVER_INIT(kof2000n);
DECLARE_DRIVER_INIT(kof2001);
DECLARE_DRIVER_INIT(cthd2003);
DECLARE_DRIVER_INIT(ct2k3sp);
DECLARE_DRIVER_INIT(ct2k3sa);
DECLARE_DRIVER_INIT(mslug4);
DECLARE_DRIVER_INIT(ms4plus);
DECLARE_DRIVER_INIT(ganryu);
DECLARE_DRIVER_INIT(s1945p);
DECLARE_DRIVER_INIT(preisle2);
DECLARE_DRIVER_INIT(bangbead);
DECLARE_DRIVER_INIT(nitd);
DECLARE_DRIVER_INIT(sengoku3);
DECLARE_DRIVER_INIT(rotd);
DECLARE_DRIVER_INIT(kof2002);
DECLARE_DRIVER_INIT(kof2002b);
DECLARE_DRIVER_INIT(kf2k2pls);
DECLARE_DRIVER_INIT(kf2k2mp);
DECLARE_DRIVER_INIT(kf2k2mp2);
DECLARE_DRIVER_INIT(kof10th);
DECLARE_DRIVER_INIT(kf10thep);
DECLARE_DRIVER_INIT(kf2k5uni);
DECLARE_DRIVER_INIT(kof2k4se);
DECLARE_DRIVER_INIT(matrim);
DECLARE_DRIVER_INIT(matrimbl);
DECLARE_DRIVER_INIT(pnyaa);
DECLARE_DRIVER_INIT(mslug5);
DECLARE_DRIVER_INIT(ms5pcb);
DECLARE_DRIVER_INIT(ms5plus);
DECLARE_DRIVER_INIT(svcpcb);
DECLARE_DRIVER_INIT(svc);
DECLARE_DRIVER_INIT(svcboot);
DECLARE_DRIVER_INIT(svcplus);
DECLARE_DRIVER_INIT(svcplusa);
DECLARE_DRIVER_INIT(svcsplus);
DECLARE_DRIVER_INIT(samsho5);
DECLARE_DRIVER_INIT(samsho5b);
DECLARE_DRIVER_INIT(kf2k3pcb);
DECLARE_DRIVER_INIT(kof2003);
DECLARE_DRIVER_INIT(kof2003h);
DECLARE_DRIVER_INIT(kf2k3bl);
DECLARE_DRIVER_INIT(kf2k3pl);
DECLARE_DRIVER_INIT(kf2k3upl);
DECLARE_DRIVER_INIT(samsh5sp);
DECLARE_DRIVER_INIT(jockeygp);
DECLARE_DRIVER_INIT(vliner);
DECLARE_DRIVER_INIT(kof97oro);
DECLARE_DRIVER_INIT(lans2004);
DECLARE_DRIVER_INIT(sbp);
DECLARE_DRIVER_INIT(irrmaze);
void install_common();
void install_banked_bios();
void neopcb_postload();
// non-carts
void svcpcb_gfx_decrypt();
void svcpcb_s1data_decrypt();
void kf2k3pcb_gfx_decrypt();
void kf2k3pcb_decrypt_s1data();
void kf2k3pcb_sp1_decrypt();
// legacy
optional_device<mslugx_prot_device> m_mslugx_prot;
optional_device<sma_prot_device> m_sma_prot;
optional_device<cmc_prot_device> m_cmc_prot;
optional_device<pcm2_prot_device> m_pcm2_prot;
optional_device<pvc_prot_device> m_pvc_prot;
optional_device<ngbootleg_prot_device> m_bootleg_prot;
optional_device<kof2002_prot_device> m_kof2002_prot;
optional_device<fatfury2_prot_device> m_fatfury2_prot;
optional_device<kof98_prot_device> m_kof98_prot;
optional_device<sbp_prot_device> m_sbp_prot;
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<pvc_prot_device> m_pvc_prot;
};
class neogeo_noslot_kog_state : public neogeo_state
class aes_state : public neogeo_state
{
public:
neogeo_noslot_kog_state(const machine_config &mconfig, device_type type, const char *tag)
: neogeo_state(mconfig, type, tag),
/* legacy cartridge specifics */
m_bootleg_prot(*this, "bootleg_prot"),
m_kog_prot(*this, "kog_prot") {}
DECLARE_DRIVER_INIT(kog);
// legacy
optional_device<ngbootleg_prot_device> m_bootleg_prot;
optional_device<kog_prot_device> m_kog_prot;
aes_state(const machine_config &mconfig, device_type type, const char *tag)
: neogeo_state(mconfig, type, tag)
, m_io_in2(*this, "IN2")
{ }
DECLARE_READ16_MEMBER(aes_in2_r);
DECLARE_INPUT_CHANGED_MEMBER(aes_jp1);
DECLARE_MACHINE_START(aes);
protected:
required_ioport m_io_in2;
};
/*----------- defined in drivers/neogeo.c -----------*/
@ -355,6 +299,7 @@ public:
MACHINE_CONFIG_EXTERN( neogeo_base );
MACHINE_CONFIG_EXTERN( neogeo_arcade );
INPUT_PORTS_EXTERN(neogeo);
INPUT_PORTS_EXTERN(aes);
ADDRESS_MAP_EXTERN(neogeo_main_map,16);
/*************************************
@ -459,69 +404,76 @@ ADDRESS_MAP_EXTERN(neogeo_main_map,16);
NEOGEO_BIOS \
ROM_REGION( 0x20000, "audiobios", 0 ) \
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \
ROM_REGION( 0x20000, "audiocpu", 0 ) \
ROM_REGION( 0x20000, "cslot1:audiocpu", 0 ) \
ROM_LOAD( name, 0x00000, 0x10000, hash ) \
ROM_RELOAD( 0x10000, 0x10000 )
ROM_RELOAD( 0x10000, 0x10000 ) \
ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF )
#define NEO_BIOS_AUDIO_128K(name, hash) \
NEOGEO_BIOS \
ROM_REGION( 0x20000, "audiobios", 0 ) \
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \
ROM_REGION( 0x30000, "audiocpu", 0 ) \
ROM_REGION( 0x30000, "cslot1:audiocpu", 0 ) \
ROM_LOAD( name, 0x00000, 0x20000, hash ) \
ROM_RELOAD( 0x10000, 0x20000 )
ROM_RELOAD( 0x10000, 0x20000 ) \
ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF )
#define NEO_BIOS_AUDIO_256K(name, hash) \
NEOGEO_BIOS \
ROM_REGION( 0x20000, "audiobios", 0 ) \
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \
ROM_REGION( 0x50000, "audiocpu", 0 ) \
ROM_REGION( 0x50000, "cslot1:audiocpu", 0 ) \
ROM_LOAD( name, 0x00000, 0x40000, hash ) \
ROM_RELOAD( 0x10000, 0x40000 )
ROM_RELOAD( 0x10000, 0x40000 ) \
ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF )
#define NEO_BIOS_AUDIO_512K(name, hash) \
NEOGEO_BIOS \
ROM_REGION( 0x20000, "audiobios", 0 ) \
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \
ROM_REGION( 0x90000, "audiocpu", 0 ) \
ROM_REGION( 0x90000, "cslot1:audiocpu", 0 ) \
ROM_LOAD( name, 0x00000, 0x80000, hash ) \
ROM_RELOAD( 0x10000, 0x80000 )
ROM_RELOAD( 0x10000, 0x80000 ) \
ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF )
#define NEO_BIOS_AUDIO_ENCRYPTED_128K(name, hash) \
NEOGEO_BIOS \
ROM_REGION( 0x20000, "audiobios", 0 ) \
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \
ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) \
ROM_REGION( 0x80000, "audiocrypt", 0 ) \
ROM_LOAD( name, 0x00000, 0x20000, hash )
ROM_REGION( 0x90000, "cslot1:audiocpu", ROMREGION_ERASEFF ) \
ROM_REGION( 0x80000, "cslot1:audiocrypt", 0 ) \
ROM_LOAD( name, 0x00000, 0x20000, hash ) \
ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF )
#define NEO_BIOS_AUDIO_ENCRYPTED_256K(name, hash) \
NEOGEO_BIOS \
ROM_REGION( 0x20000, "audiobios", 0 ) \
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \
ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) \
ROM_REGION( 0x80000, "audiocrypt", 0 ) \
ROM_LOAD( name, 0x00000, 0x40000, hash )
ROM_REGION( 0x90000, "cslot1:audiocpu", ROMREGION_ERASEFF ) \
ROM_REGION( 0x80000, "cslot1:audiocrypt", 0 ) \
ROM_LOAD( name, 0x00000, 0x40000, hash ) \
ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF )
#define NEO_BIOS_AUDIO_ENCRYPTED_512K(name, hash) \
NEOGEO_BIOS \
ROM_REGION( 0x20000, "audiobios", 0 ) \
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \
ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) \
ROM_REGION( 0x80000, "audiocrypt", 0 ) \
ROM_LOAD( name, 0x00000, 0x80000, hash )
ROM_REGION( 0x90000, "cslot1:audiocpu", ROMREGION_ERASEFF ) \
ROM_REGION( 0x80000, "cslot1:audiocrypt", 0 ) \
ROM_LOAD( name, 0x00000, 0x80000, hash ) \
ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF )
#define NO_DELTAT_REGION
#define NEO_SFIX_64K(name, hash) \
ROM_REGION( 0x20000, "fixed", 0 ) \
ROM_REGION( 0x20000, "cslot1:fixed", 0 ) \
ROM_LOAD( name, 0x000000, 0x10000, hash ) \
ROM_REGION( 0x20000, "fixedbios", 0 ) \
ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) \
ROM_Y_ZOOM
#define NEO_SFIX_128K(name, hash) \
ROM_REGION( 0x20000, "fixed", 0 ) \
ROM_REGION( 0x20000, "cslot1:fixed", 0 ) \
ROM_LOAD( name, 0x000000, 0x20000, hash ) \
ROM_REGION( 0x20000, "fixedbios", 0 ) \
ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) \

View File

@ -28290,7 +28290,8 @@ salamandj // GX587 (c) 1986
twinbee // GX412 (c) 1985
@source:neogeo.cpp
neogeo //
neogeo // NeoGeo MVS
aes // NeoGeo AES
@source:neogeo_noslot.cpp
2020bb // 0030 (c) 1991 SNK / Pallas
@ -28367,7 +28368,6 @@ kf2k2pla // bootleg
kf2k2pls // bootleg
kf2k3bl // bootleg
kf2k3bla // bootleg
kf2k3pcb // 0271 (c) 2003 Playmore - JAMMA PCB
kf2k3pl // bootleg
kf2k3upl // bootleg
kf2k5uni // bootleg of kof2002
@ -28428,9 +28428,8 @@ matrim // 0266 (c) 2002 Atlus
matrimbl // bootleg
miexchng // 0231 (c) 1997 Face
minasan // 0027 (c) 1990 Monolith Corp.
mosyougi // 0203 (c) 1995 ADK / SNK
moshougi // 0203 (c) 1995 ADK / SNK
ms4plus // bootleg
ms5pcb // 0268 (c) 2003 Playmore
ms5plus // bootleg
mslug // 0201 (c) 1996 Nazca
mslug2 // 0241 (c) 1998 SNK
@ -28524,8 +28523,6 @@ strhoop // 0079 (c) 1994 Data East Corporation
superspy // 0011 (c) 1990 SNK
svc // 0269 (c) 2003 Playmore / Capcom
svcboot // bootleg
svcpcb // 0269 (c) 2003 Playmore / Capcom - JAMMA PCB
svcpcba // 0269 (c) 2003 Playmore / Capcom - JAMMA PCB
svcplus // bootleg
svcplusa // bootleg
svcsplus // bootleg
@ -28552,6 +28549,12 @@ zintrckb // 0211 hack - this is not a genuine MVS proto,
zupapa // 0070 Zupapa - released in 2001, 1994 prototype probably exists
lasthope
@source:neopcb.cpp
kf2k3pcb // 0271 (c) 2003 Playmore - JAMMA PCB
ms5pcb // 0268 (c) 2003 Playmore - JAMMA PCB
svcpcb // 0269 (c) 2003 Playmore / Capcom - JAMMA PCB
svcpcba // 0269 (c) 2003 Playmore / Capcom - JAMMA PCB
@source:neoprint.cpp
98best44 //
neoprint //
@ -28596,7 +28599,6 @@ acheart //
acheartf // (c) 2006 Examu
@source:ng_aes.cpp
aes // NeoGeo AES
neocd // NeoGeo CD
neocdz // NeoGeo CDZ
neocdzj //