trunk/src/emu/bus/neogeo/kog_prot.c
r0 | r32805 | |
| 1 | #include "emu.h" |
| 2 | #include "kog_prot.h" |
| 3 | |
| 4 | |
| 5 | |
| 6 | extern const device_type KOG_PROT = &device_creator<kog_prot_device>; |
| 7 | |
| 8 | |
| 9 | kog_prot_device::kog_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 10 | : device_t(mconfig, KOG_PROT, "NeoGeo King of Gladiator Protection Device", tag, owner, clock, "kog_prot", __FILE__), |
| 11 | m_jumper(*this, "JUMPER") |
| 12 | { |
| 13 | } |
| 14 | |
| 15 | |
| 16 | void kog_prot_device::device_start() |
| 17 | { |
| 18 | } |
| 19 | |
| 20 | void kog_prot_device::device_reset() |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | READ16_MEMBER(kog_prot_device::read_jumper) |
| 25 | { |
| 26 | return ioport("JUMPER")->read(); |
| 27 | } |
| 28 | |
| 29 | void kog_prot_device::kog_install_protection(cpu_device* maincpu) |
| 30 | { |
| 31 | /* overlay cartridge ROM */ |
| 32 | maincpu->space(AS_PROGRAM).install_read_handler(0x0ffffe, 0x0fffff, read16_delegate(FUNC(kog_prot_device::read_jumper), this)); |
| 33 | } |
| 34 | |
| 35 | |
| 36 | /* The King of Gladiator (The King of Fighters '97 bootleg) */ |
| 37 | |
| 38 | |
| 39 | /* The protection patching here may be incomplete |
| 40 | Thanks to Razoola for the info */ |
| 41 | |
| 42 | void kog_prot_device::kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size) |
| 43 | { |
| 44 | /* the protection chip does some *very* strange things to the rom */ |
| 45 | UINT8 *src = cpurom; |
| 46 | dynamic_buffer dst( 0x600000 ); |
| 47 | UINT16 *rom = (UINT16 *)cpurom; |
| 48 | int i; |
| 49 | static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD }; |
| 50 | |
| 51 | for (i = 0; i < 8; i++){ |
| 52 | memcpy (dst + i * 0x20000, src + sec[i] * 0x20000, 0x20000); |
| 53 | } |
| 54 | |
| 55 | memcpy (dst + 0x0007A6, src + 0x0407A6, 0x000006); |
| 56 | memcpy (dst + 0x0007C6, src + 0x0407C6, 0x000006); |
| 57 | memcpy (dst + 0x0007E6, src + 0x0407E6, 0x000006); |
| 58 | memcpy (dst + 0x090000, src + 0x040000, 0x004000); |
| 59 | memcpy (dst + 0x100000, src + 0x200000, 0x400000); |
| 60 | memcpy (src, dst, 0x600000); |
| 61 | |
| 62 | for (i = 0x90000/2; i < 0x94000/2; i++){ |
| 63 | if (((rom[i]&0xFFBF) == 0x4EB9 || rom[i] == 0x43F9) && !rom[i + 1]) |
| 64 | rom[i + 1] = 0x0009; |
| 65 | |
| 66 | if (rom[i] == 0x4EB8) |
| 67 | rom[i] = 0x6100; |
| 68 | } |
| 69 | |
| 70 | rom[0x007A8/2] = 0x0009; |
| 71 | rom[0x007C8/2] = 0x0009; |
| 72 | rom[0x007E8/2] = 0x0009; |
| 73 | rom[0x93408/2] = 0xF168; |
| 74 | rom[0x9340C/2] = 0xFB7A; |
| 75 | rom[0x924AC/2] = 0x0009; |
| 76 | rom[0x9251C/2] = 0x0009; |
| 77 | rom[0x93966/2] = 0xFFDA; |
| 78 | rom[0x93974/2] = 0xFFCC; |
| 79 | rom[0x93982/2] = 0xFFBE; |
| 80 | rom[0x93990/2] = 0xFFB0; |
| 81 | rom[0x9399E/2] = 0xFFA2; |
| 82 | rom[0x939AC/2] = 0xFF94; |
| 83 | rom[0x939BA/2] = 0xFF86; |
| 84 | rom[0x939C8/2] = 0xFF78; |
| 85 | rom[0x939D4/2] = 0xFA5C; |
| 86 | rom[0x939E0/2] = 0xFA50; |
| 87 | rom[0x939EC/2] = 0xFA44; |
| 88 | rom[0x939F8/2] = 0xFA38; |
| 89 | rom[0x93A04/2] = 0xFA2C; |
| 90 | rom[0x93A10/2] = 0xFA20; |
| 91 | rom[0x93A1C/2] = 0xFA14; |
| 92 | rom[0x93A28/2] = 0xFA08; |
| 93 | rom[0x93A34/2] = 0xF9FC; |
| 94 | rom[0x93A40/2] = 0xF9F0; |
| 95 | rom[0x93A4C/2] = 0xFD14; |
| 96 | rom[0x93A58/2] = 0xFD08; |
| 97 | rom[0x93A66/2] = 0xF9CA; |
| 98 | rom[0x93A72/2] = 0xF9BE; |
| 99 | |
| 100 | } |
| 101 | |
| 102 | |
| 103 | static INPUT_PORTS_START( kog ) |
| 104 | /* a jumper on the pcb overlays a ROM address, very strange but that's how it works. */ |
| 105 | PORT_START("JUMPER") |
| 106 | PORT_DIPNAME( 0x0001, 0x0001, "Title Language" ) PORT_DIPLOCATION("CART-JUMPER:1") |
| 107 | PORT_DIPSETTING( 0x0001, DEF_STR( English ) ) |
| 108 | PORT_DIPSETTING( 0x0000, "Non-English" ) |
| 109 | PORT_BIT( 0x00fe, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 110 | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 111 | INPUT_PORTS_END |
| 112 | |
| 113 | ioport_constructor kog_prot_device::device_input_ports() const |
| 114 | { |
| 115 | return INPUT_PORTS_NAME( kog ); |
| 116 | } |
trunk/src/emu/bus/neogeo/bootleg_cart.c
r32804 | r32805 | |
26 | 26 | } |
27 | 27 | |
28 | 28 | neogeo_bootleg_cart::neogeo_bootleg_cart(const machine_config &mconfig, const char *tag, device_t *owner, UINT16 clock) |
29 | | : device_t(mconfig, NEOGEO_BOOTLEG_CART, "NEOGEO SMA Cart", tag, owner, clock, "neogeo_rom", __FILE__), |
| 29 | : device_t(mconfig, NEOGEO_BOOTLEG_CART, "NEOGEO Bootleg Cart", tag, owner, clock, "neogeo_rom", __FILE__), |
30 | 30 | device_neogeo_cart_interface(mconfig, *this), |
31 | 31 | m_banked_cart(*this, "banked_cart"), |
32 | 32 | m_bootleg_prot(*this, "bootleg_prot") |
r32804 | r32805 | |
346 | 346 | |
347 | 347 | const device_type NEOGEO_BOOTLEG_KOG_CART = &device_creator<neogeo_bootleg_kog_cart>; |
348 | 348 | |
349 | | 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__) {} |
| 349 | 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__), |
| 350 | m_kog_prot(*this, "kog_prot") |
| 351 | {} |
350 | 352 | |
| 353 | static MACHINE_CONFIG_FRAGMENT( kog_bootleg_cart ) |
| 354 | MCFG_NEOGEO_BANKED_CART_ADD("banked_cart") |
| 355 | MCFG_NGBOOTLEG_PROT_ADD("bootleg_prot") |
| 356 | MCFG_KOG_PROT_ADD("kog_prot") |
| 357 | MACHINE_CONFIG_END |
| 358 | |
| 359 | machine_config_constructor neogeo_bootleg_kog_cart::device_mconfig_additions() const |
| 360 | { |
| 361 | return MACHINE_CONFIG_NAME( kog_bootleg_cart ); |
| 362 | } |
| 363 | |
| 364 | |
351 | 365 | void neogeo_bootleg_kog_cart::activate_cart(ACTIVATE_CART_PARAMS) |
352 | 366 | { |
353 | 367 | m_banked_cart->install_banks(machine, maincpu, cpuregion, cpuregion_size); |
354 | | /* overlay cartridge ROM */ // this should be part of the device |
355 | | //m_maincpu->space(AS_PROGRAM).install_read_port(0x0ffffe, 0x0fffff, "JUMPER"); |
| 368 | m_kog_prot->kog_install_protection(maincpu); |
356 | 369 | } |
357 | 370 | |
358 | 371 | void neogeo_bootleg_kog_cart::decrypt_all(DECRYPT_ALL_PARAMS) |
359 | 372 | { |
360 | | m_bootleg_prot->kog_px_decrypt(cpuregion, cpuregion_size); |
| 373 | m_kog_prot->kog_px_decrypt(cpuregion, cpuregion_size); |
361 | 374 | m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1); |
362 | 375 | m_bootleg_prot->neogeo_bootleg_cx_decrypt(spr_region, spr_region_size); |
363 | 376 | } |
trunk/src/emu/bus/neogeo/bootleg_prot.c
r32804 | r32805 | |
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | | /* The King of Gladiator (The King of Fighters '97 bootleg) */ |
91 | 90 | |
92 | | |
93 | | /* The protection patching here may be incomplete |
94 | | Thanks to Razoola for the info */ |
95 | | |
96 | | void ngbootleg_prot_device::kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size) |
97 | | { |
98 | | /* the protection chip does some *very* strange things to the rom */ |
99 | | UINT8 *src = cpurom; |
100 | | dynamic_buffer dst( 0x600000 ); |
101 | | UINT16 *rom = (UINT16 *)cpurom; |
102 | | int i; |
103 | | static const int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD }; |
104 | | |
105 | | for (i = 0; i < 8; i++){ |
106 | | memcpy (dst + i * 0x20000, src + sec[i] * 0x20000, 0x20000); |
107 | | } |
108 | | |
109 | | memcpy (dst + 0x0007A6, src + 0x0407A6, 0x000006); |
110 | | memcpy (dst + 0x0007C6, src + 0x0407C6, 0x000006); |
111 | | memcpy (dst + 0x0007E6, src + 0x0407E6, 0x000006); |
112 | | memcpy (dst + 0x090000, src + 0x040000, 0x004000); |
113 | | memcpy (dst + 0x100000, src + 0x200000, 0x400000); |
114 | | memcpy (src, dst, 0x600000); |
115 | | |
116 | | for (i = 0x90000/2; i < 0x94000/2; i++){ |
117 | | if (((rom[i]&0xFFBF) == 0x4EB9 || rom[i] == 0x43F9) && !rom[i + 1]) |
118 | | rom[i + 1] = 0x0009; |
119 | | |
120 | | if (rom[i] == 0x4EB8) |
121 | | rom[i] = 0x6100; |
122 | | } |
123 | | |
124 | | rom[0x007A8/2] = 0x0009; |
125 | | rom[0x007C8/2] = 0x0009; |
126 | | rom[0x007E8/2] = 0x0009; |
127 | | rom[0x93408/2] = 0xF168; |
128 | | rom[0x9340C/2] = 0xFB7A; |
129 | | rom[0x924AC/2] = 0x0009; |
130 | | rom[0x9251C/2] = 0x0009; |
131 | | rom[0x93966/2] = 0xFFDA; |
132 | | rom[0x93974/2] = 0xFFCC; |
133 | | rom[0x93982/2] = 0xFFBE; |
134 | | rom[0x93990/2] = 0xFFB0; |
135 | | rom[0x9399E/2] = 0xFFA2; |
136 | | rom[0x939AC/2] = 0xFF94; |
137 | | rom[0x939BA/2] = 0xFF86; |
138 | | rom[0x939C8/2] = 0xFF78; |
139 | | rom[0x939D4/2] = 0xFA5C; |
140 | | rom[0x939E0/2] = 0xFA50; |
141 | | rom[0x939EC/2] = 0xFA44; |
142 | | rom[0x939F8/2] = 0xFA38; |
143 | | rom[0x93A04/2] = 0xFA2C; |
144 | | rom[0x93A10/2] = 0xFA20; |
145 | | rom[0x93A1C/2] = 0xFA14; |
146 | | rom[0x93A28/2] = 0xFA08; |
147 | | rom[0x93A34/2] = 0xF9FC; |
148 | | rom[0x93A40/2] = 0xF9F0; |
149 | | rom[0x93A4C/2] = 0xFD14; |
150 | | rom[0x93A58/2] = 0xFD08; |
151 | | rom[0x93A66/2] = 0xF9CA; |
152 | | rom[0x93A72/2] = 0xF9BE; |
153 | | |
154 | | } |
155 | | |
156 | | |
157 | 91 | /* The King of Fighters '97 Oroshi Plus 2003 (bootleg) */ |
158 | 92 | |
159 | 93 | void ngbootleg_prot_device::kof97oro_px_decode(UINT8* cpurom, UINT32 cpurom_size) |
trunk/src/mame/includes/neogeo.h
r32804 | r32805 | |
17 | 17 | #include "bus/neogeo/fatfury2_prot.h" |
18 | 18 | #include "bus/neogeo/kof98_prot.h" |
19 | 19 | #include "bus/neogeo/sbp_prot.h" |
| 20 | #include "bus/neogeo/kog_prot.h" |
20 | 21 | |
21 | 22 | // On scanline 224, /VBLANK goes low 56 mclks (14 pixels) from the rising edge of /HSYNC. |
22 | 23 | // Two mclks after /VBLANK goes low, the hardware sets a pending IRQ1 flip-flop. |
r32804 | r32805 | |
299 | 300 | DECLARE_DRIVER_INIT(samsh5sp); |
300 | 301 | DECLARE_DRIVER_INIT(jockeygp); |
301 | 302 | DECLARE_DRIVER_INIT(vliner); |
302 | | DECLARE_DRIVER_INIT(kog); |
303 | 303 | DECLARE_DRIVER_INIT(kof97oro); |
304 | 304 | DECLARE_DRIVER_INIT(lans2004); |
305 | 305 | DECLARE_DRIVER_INIT(sbp); |
r32804 | r32805 | |
326 | 326 | optional_device<sbp_prot_device> m_sbp_prot; |
327 | 327 | }; |
328 | 328 | |
| 329 | class neogeo_noslot_kog_state : public neogeo_state |
| 330 | { |
| 331 | public: |
| 332 | neogeo_noslot_kog_state(const machine_config &mconfig, device_type type, const char *tag) |
| 333 | : neogeo_state(mconfig, type, tag), |
| 334 | /* legacy cartridge specifics */ |
| 335 | m_bootleg_prot(*this, "bootleg_prot"), |
| 336 | m_kog_prot(*this, "kog_prot") {} |
329 | 337 | |
330 | 338 | |
| 339 | DECLARE_DRIVER_INIT(kog); |
| 340 | |
| 341 | // legacy |
| 342 | optional_device<ngbootleg_prot_device> m_bootleg_prot; |
| 343 | optional_device<kog_prot_device> m_kog_prot; |
| 344 | }; |
| 345 | |
331 | 346 | /*----------- defined in drivers/neogeo.c -----------*/ |
332 | 347 | |
333 | 348 | MACHINE_CONFIG_EXTERN( neogeo_base ); |
trunk/src/mame/drivers/neogeo_noslot.c
r32804 | r32805 | |
32 | 32 | MCFG_SBP_PROT_ADD("sbp_prot") |
33 | 33 | MACHINE_CONFIG_END |
34 | 34 | |
| 35 | static MACHINE_CONFIG_DERIVED_CLASS( neogeo_noslot_kog, neogeo_arcade, neogeo_noslot_kog_state ) |
| 36 | MCFG_CPU_MODIFY("maincpu") |
| 37 | MCFG_CPU_PROGRAM_MAP(main_map_noslot) |
35 | 38 | |
| 39 | MCFG_NGBOOTLEG_PROT_ADD("bootleg_prot") |
| 40 | MCFG_KOG_PROT_ADD("kog_prot") |
| 41 | MACHINE_CONFIG_END |
36 | 42 | |
| 43 | |
37 | 44 | /************************************* |
38 | 45 | * |
39 | 46 | * Official sets |
r32804 | r32805 | |
152 | 159 | INPUT_PORTS_END |
153 | 160 | |
154 | 161 | |
155 | | static INPUT_PORTS_START( kog ) |
156 | | PORT_INCLUDE( neogeo ) |
157 | | |
158 | | /* a jumper on the pcb overlays a ROM address, very strange but that's how it works. */ |
159 | | PORT_START("JUMPER") |
160 | | PORT_DIPNAME( 0x0001, 0x0001, "Title Language" ) PORT_DIPLOCATION("CART-JUMPER:1") |
161 | | PORT_DIPSETTING( 0x0001, DEF_STR( English ) ) |
162 | | PORT_DIPSETTING( 0x0000, "Non-English" ) |
163 | | PORT_BIT( 0x00fe, IP_ACTIVE_HIGH, IPT_UNUSED ) |
164 | | PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) |
165 | | INPUT_PORTS_END |
166 | | |
167 | | |
168 | 162 | static INPUT_PORTS_START( mjneogeo ) |
169 | 163 | PORT_INCLUDE( neogeo ) |
170 | 164 | |
r32804 | r32805 | |
8908 | 8902 | } |
8909 | 8903 | |
8910 | 8904 | |
8911 | | DRIVER_INIT_MEMBER(neogeo_noslot_state,kog) // copied to slot |
| 8905 | DRIVER_INIT_MEMBER(neogeo_noslot_kog_state,kog) // copied to slot |
8912 | 8906 | { |
8913 | 8907 | DRIVER_INIT_CALL(neogeo); |
8914 | | /* overlay cartridge ROM */ |
8915 | | m_maincpu->space(AS_PROGRAM).install_read_port(0x0ffffe, 0x0fffff, "JUMPER"); |
8916 | 8908 | |
8917 | | m_bootleg_prot->kog_px_decrypt(cpuregion, cpuregion_size); |
| 8909 | m_kog_prot->kog_px_decrypt(cpuregion, cpuregion_size); |
8918 | 8910 | m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1); |
8919 | 8911 | m_bootleg_prot->neogeo_bootleg_cx_decrypt(spr_region, spr_region_size); |
| 8912 | m_kog_prot->kog_install_protection(m_maincpu); |
8920 | 8913 | } |
8921 | 8914 | |
8922 | 8915 | |
r32804 | r32805 | |
9591 | 9584 | GAME( 1997, kof97k, kof97, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '97 (Korean release)", GAME_SUPPORTS_SAVE ) |
9592 | 9585 | GAME( 1997, kof97pls, kof97, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "bootleg", "The King of Fighters '97 Plus (bootleg)", GAME_SUPPORTS_SAVE ) |
9593 | 9586 | GAME( 1997, kof97oro, kof97, neogeo_noslot, neogeo, neogeo_noslot_state, kof97oro, ROT0, "bootleg", "The King of Fighters '97 Oroshi Plus 2003 (bootleg)", GAME_SUPPORTS_SAVE ) |
9594 | | GAME( 1997, kog, kof97, neogeo_noslot, kog, neogeo_noslot_state, kog, ROT0, "bootleg", "King of Gladiator (The King of Fighters '97 bootleg)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // protected bootleg |
| 9587 | GAME( 1997, kog, kof97, neogeo_noslot_kog, neogeo, neogeo_noslot_kog_state, kog, ROT0, "bootleg", "King of Gladiator (The King of Fighters '97 bootleg)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // protected bootleg |
9595 | 9588 | GAME( 1997, lastblad, neogeo, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Blade / Bakumatsu Roman - Gekka no Kenshi (NGM-2340)", GAME_SUPPORTS_SAVE ) |
9596 | 9589 | GAME( 1997, lastbladh, lastblad, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Blade / Bakumatsu Roman - Gekka no Kenshi (NGH-2340)", GAME_SUPPORTS_SAVE ) |
9597 | 9590 | GAME( 1997, lastsold, lastblad, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Soldier (Korean release of The Last Blade)", GAME_SUPPORTS_SAVE ) |