summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/neogeo/boot_misc.cpp
blob: 7adc89519e4897c147efd4e6b2e916995386ccaf (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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
// 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_device - constructor
//-------------------------------------------------

DEFINE_DEVICE_TYPE(NEOGEO_BOOTLEG_CART, neogeo_bootleg_cart_device, "neocart_boot", "Neo Geo Bootleg Protected Cart")


neogeo_bootleg_cart_device::neogeo_bootleg_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_prot(*this, "bootleg_prot")
{
}

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


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

void neogeo_bootleg_cart_device::device_start()
{
}

void neogeo_bootleg_cart_device::device_reset()
{
}


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

void neogeo_bootleg_cart_device::device_add_mconfig(machine_config &config)
{
	NEOBOOT_PROT(config, m_prot);
}


/*************************************************
 garoubl
**************************************************/

DEFINE_DEVICE_TYPE(NEOGEO_GAROUBL_CART, neogeo_garoubl_cart_device, "neocart_garoubl", "Neo Geo Garou Bootleg Cart")

neogeo_garoubl_cart_device::neogeo_garoubl_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_GAROUBL_CART, tag, owner, clock)
{
}


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

DEFINE_DEVICE_TYPE(NEOGEO_KOF97ORO_CART, neogeo_kof97oro_cart_device, "neocart_kof97oro", "Neo Geo KoF 97 Orochi Bootleg Cart")

neogeo_kof97oro_cart_device::neogeo_kof97oro_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_KOF97ORO_CART, tag, owner, clock)
{
}


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

DEFINE_DEVICE_TYPE(NEOGEO_KF10THEP_CART, neogeo_kf10thep_cart_device, "neocart_kf10thep", "Neo Geo KoF 10th Ann. EP Bootleg Cart")

neogeo_kf10thep_cart_device::neogeo_kf10thep_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_KF10THEP_CART, tag, owner, clock)
{
}


void neogeo_kf10thep_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
{
	m_prot->kf10thep_px_decrypt(cpuregion, cpuregion_size);
	m_prot->sx_decrypt(fix_region, fix_region_size, 1);
}


/*************************************************
 kf2k5uni
**************************************************/

DEFINE_DEVICE_TYPE(NEOGEO_KF2K5UNI_CART, neogeo_kf2k5uni_cart_device, "neocart_kf2k5uni", "Neo Geo KoF 2005 Unique Bootleg Cart")

neogeo_kf2k5uni_cart_device::neogeo_kf2k5uni_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_KF2K5UNI_CART, tag, owner, clock)
{
}


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

DEFINE_DEVICE_TYPE(NEOGEO_KF2K4SE_CART, neogeo_kf2k4se_cart_device, "neocart_kf2k4se", "Neo Geo KoF 2004 SE Bootleg Cart")

neogeo_kf2k4se_cart_device::neogeo_kf2k4se_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_KF2K4SE_CART, tag, owner, clock)
{
}


void neogeo_kf2k4se_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
{
	m_prot->decrypt_kof2k4se_68k(cpuregion, cpuregion_size);
}


/*************************************************
 lans2004
 **************************************************/

DEFINE_DEVICE_TYPE(NEOGEO_LANS2004_CART, neogeo_lans2004_cart_device, "neocart_lans2004", "Neo Geo Lansquenet 2004 Bootleg Cart")

neogeo_lans2004_cart_device::neogeo_lans2004_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_LANS2004_CART, tag, owner, clock)
{
}

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

DEFINE_DEVICE_TYPE(NEOGEO_SAMSHO5B_CART, neogeo_samsho5b_cart_device, "neocart_samsho5b", "Neo Geo Samurai Shodown 5 Bootleg Cart")

neogeo_samsho5b_cart_device::neogeo_samsho5b_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_SAMSHO5B_CART, tag, owner, clock)
{
}

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

DEFINE_DEVICE_TYPE(NEOGEO_MSLUG3B6_CART, neogeo_mslug3b6_cart_device, "neocart_mslug3b6", "Neo Geo Metal Slug 6 Bootleg Cart")

neogeo_mslug3b6_cart_device::neogeo_mslug3b6_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_MSLUG3B6_CART, tag, owner, clock),
	m_cmc_prot(*this, "cmc_prot")
{
}

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

void neogeo_mslug3b6_cart_device::device_add_mconfig(machine_config &config)
{
	NG_CMC_PROT(config, m_cmc_prot);
	NEOBOOT_PROT(config, m_prot);
}


/*************************************************
 ms5plus
 **************************************************/

DEFINE_DEVICE_TYPE(NEOGEO_MS5PLUS_CART, neogeo_ms5plus_cart_device, "neocart_ms5plus", "Neo Geo Metal Slug 5 Plus Bootleg Cart")

neogeo_ms5plus_cart_device::neogeo_ms5plus_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_MS5PLUS_CART, tag, owner, clock),
	m_cmc_prot(*this, "cmc_prot"),
	m_pcm2_prot(*this, "pcm2_prot")
{
}

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

void neogeo_ms5plus_cart_device::device_add_mconfig(machine_config &config)
{
	NEOBOOT_PROT(config, m_prot);
	NG_CMC_PROT(config, m_cmc_prot);
	NG_PCM2_PROT(config, m_pcm2_prot);
}


/*************************************************
 mslug5b
 **************************************************/

DEFINE_DEVICE_TYPE(NEOGEO_MSLUG5B_CART, neogeo_mslug5b_cart_device, "neocart_mslug5b", "Neo Geo Metal Slug 5 Bootleg Cart")

neogeo_mslug5b_cart_device::neogeo_mslug5b_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_MSLUG5B_CART, tag, owner, clock)
{
}

void neogeo_mslug5b_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
{
	m_prot->mslug5b_vx_decrypt(ym_region, ym_region_size);
	m_prot->sx_decrypt(fix_region, fix_region_size, 2);
	m_prot->mslug5b_cx_decrypt(spr_region, spr_region_size);
}


/*************************************************
 kog
**************************************************/

DEFINE_DEVICE_TYPE(NEOGEO_KOG_CART, neogeo_kog_cart_device, "neocart_kog", "Neo Geo King of Gladiators Bootleg Cart")

neogeo_kog_cart_device::neogeo_kog_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
	neogeo_bootleg_cart_device(mconfig, NEOGEO_KOG_CART, tag, owner, clock),
	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::device_input_ports() const
{
	return INPUT_PORTS_NAME( kog );
}


READ16_MEMBER(neogeo_kog_cart_device::protection_r)
{
	return m_jumper->read();
}

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