summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/neogeo/sma.cpp
blob: 83aea5c185cbc13094335ffb04196b335dbfcf66 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
// 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"


DEFINE_DEVICE_TYPE(NEOGEO_SMA_CART,         neogeo_sma_cart_device,         "neocart_sma",     "Neo Geo SMA Cart")
DEFINE_DEVICE_TYPE(NEOGEO_SMA_KOF99_CART,   neogeo_sma_kof99_cart_device,   "neocart_kof99",   "Neo Geo KoF 99 SMA Cart")
DEFINE_DEVICE_TYPE(NEOGEO_SMA_GAROU_CART,   neogeo_sma_garou_cart_device,   "neocart_garou",   "Neo Geo Garou SMA Cart")
DEFINE_DEVICE_TYPE(NEOGEO_SMA_GAROUH_CART,  neogeo_sma_garouh_cart_device,  "neocart_garouh",  "Neo Geo Garou AES SMA Cart")
DEFINE_DEVICE_TYPE(NEOGEO_SMA_MSLUG3_CART,  neogeo_sma_mslug3_cart_device,  "neocart_mslug3",  "Neo Geo Metal Slug 3 SMA Cart (green)")
DEFINE_DEVICE_TYPE(NEOGEO_SMA_MSLUG3A_CART, neogeo_sma_mslug3a_cart_device, "neocart_mslug3a", "Neo Geo Metal Slug 3 SMA Cart (white)")
DEFINE_DEVICE_TYPE(NEOGEO_SMA_KOF2000_CART, neogeo_sma_kof2000_cart_device, "neocart_kof2000", "Neo Geo KoF 2000 SMA Cart")


//-------------------------------------------------
//  neogeo_sma_cart_device - constructor
//-------------------------------------------------

neogeo_sma_cart_device::neogeo_sma_cart_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint16_t clock) :
	neogeo_rom_device(mconfig, type, tag, owner, clock),
	m_sma_prot(*this, "sma_prot"),
	m_cmc_prot(*this, "cmc_prot")
{
}

neogeo_sma_cart_device::neogeo_sma_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint16_t clock) :
	neogeo_sma_cart_device(mconfig, NEOGEO_SMA_CART, tag, owner, clock)
{
}


//-------------------------------------------------
//  mapper specific start/reset
//-------------------------------------------------

void neogeo_sma_cart_device::device_start()
{
}

void neogeo_sma_cart_device::device_reset()
{
}


/*-------------------------------------------------
 mapper specific handlers
 -------------------------------------------------*/

void neogeo_sma_cart_device::device_add_mconfig(machine_config &config)
{
	NG_SMA_PROT(config, m_sma_prot);
	NG_CMC_PROT(config, m_cmc_prot);
}


/*************************************************
 kof99
**************************************************/

neogeo_sma_kof99_cart_device::neogeo_sma_kof99_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	neogeo_sma_cart_device(mconfig, NEOGEO_SMA_KOF99_CART, tag, owner, clock)
{
}

void neogeo_sma_kof99_cart_device::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
**************************************************/

neogeo_sma_garou_cart_device::neogeo_sma_garou_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	neogeo_sma_cart_device(mconfig, NEOGEO_SMA_GAROU_CART, tag, owner, clock)
{
}

void neogeo_sma_garou_cart_device::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
 **************************************************/

neogeo_sma_garouh_cart_device::neogeo_sma_garouh_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	neogeo_sma_cart_device(mconfig, NEOGEO_SMA_GAROUH_CART, tag, owner, clock)
{
}

void neogeo_sma_garouh_cart_device::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
 **************************************************/

neogeo_sma_mslug3_cart_device::neogeo_sma_mslug3_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	neogeo_sma_cart_device(mconfig, NEOGEO_SMA_MSLUG3_CART, tag, owner, clock)
{
}

void neogeo_sma_mslug3_cart_device::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);
}

neogeo_sma_mslug3a_cart_device::neogeo_sma_mslug3a_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	neogeo_sma_cart_device(mconfig, NEOGEO_SMA_MSLUG3A_CART, tag, owner, clock)
{
}

void neogeo_sma_mslug3a_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
{
	m_sma_prot->mslug3a_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
**************************************************/

neogeo_sma_kof2000_cart_device::neogeo_sma_kof2000_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock) :
	neogeo_sma_cart_device(mconfig, NEOGEO_SMA_KOF2000_CART, tag, owner, clock)
{
}

void neogeo_sma_kof2000_cart_device::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);
}