Previous 199869 Revisions Next

r32805 Saturday 18th October, 2014 at 18:04:24 UTC by David Haywood
make 'kog' dipswitch part of the protection device / cartridge (nw)
[src/emu/bus]bus.mak
[src/emu/bus/neogeo]bootleg_cart.c bootleg_cart.h bootleg_prot.c bootleg_prot.h kog_prot.c* kog_prot.h*
[src/mame/drivers]neogeo_noslot.c
[src/mame/includes]neogeo.h

trunk/src/emu/bus/neogeo/bootleg_prot.h
r32804r32805
2020
2121   void neogeo_bootleg_cx_decrypt(UINT8*sprrom, UINT32 sprrom_size);
2222   void neogeo_bootleg_sx_decrypt(UINT8* fixed, UINT32 fixed_size, int value);
23   void kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
2423   void kof97oro_px_decode(UINT8* cpurom, UINT32 cpurom_size);
2524   void kof10thBankswitch(address_space &space, UINT16 nBank);
2625   DECLARE_READ16_MEMBER(kof10th_RAM2_r);
trunk/src/emu/bus/neogeo/kog_prot.c
r0r32805
1#include "emu.h"
2#include "kog_prot.h"
3
4
5
6extern const device_type KOG_PROT = &device_creator<kog_prot_device>;
7
8
9kog_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
16void kog_prot_device::device_start()
17{
18}
19
20void kog_prot_device::device_reset()
21{
22}
23
24READ16_MEMBER(kog_prot_device::read_jumper)
25{
26   return ioport("JUMPER")->read();
27}
28
29void 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
42void 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
103static 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 )
111INPUT_PORTS_END
112
113ioport_constructor kog_prot_device::device_input_ports() const
114{
115   return INPUT_PORTS_NAME( kog );
116}
Property changes on: trunk/src/emu/bus/neogeo/kog_prot.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/neogeo/kog_prot.h
r0r32805
1
2
3#pragma once
4
5#ifndef __KOG_PROT__
6#define __KOG_PROT__
7
8extern const device_type KOG_PROT;
9
10#define MCFG_KOG_PROT_ADD(_tag) \
11   MCFG_DEVICE_ADD(_tag, KOG_PROT, 0)
12
13
14class kog_prot_device :  public device_t
15{
16public:
17   // construction/destruction
18   kog_prot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
19
20   void kog_install_protection(cpu_device* maincpu);
21   void kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size);
22   READ16_MEMBER(read_jumper);
23
24   required_ioport m_jumper;
25
26protected:
27   virtual void device_start();
28   virtual void device_reset();
29   virtual ioport_constructor device_input_ports() const;
30
31
32
33private:
34
35
36};
37
38#endif
Property changes on: trunk/src/emu/bus/neogeo/kog_prot.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/neogeo/bootleg_cart.c
r32804r32805
2626}
2727
2828neogeo_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__),
3030   device_neogeo_cart_interface(mconfig, *this),
3131   m_banked_cart(*this, "banked_cart"),
3232   m_bootleg_prot(*this, "bootleg_prot")
r32804r32805
346346
347347const device_type NEOGEO_BOOTLEG_KOG_CART = &device_creator<neogeo_bootleg_kog_cart>;
348348
349neogeo_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__) {}
349neogeo_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{}
350352
353static 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")
357MACHINE_CONFIG_END
358
359machine_config_constructor neogeo_bootleg_kog_cart::device_mconfig_additions() const
360{
361   return MACHINE_CONFIG_NAME( kog_bootleg_cart );
362}
363
364
351365void neogeo_bootleg_kog_cart::activate_cart(ACTIVATE_CART_PARAMS)
352366{
353367   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);
356369}
357370
358371void neogeo_bootleg_kog_cart::decrypt_all(DECRYPT_ALL_PARAMS)
359372{
360   m_bootleg_prot->kog_px_decrypt(cpuregion, cpuregion_size);
373   m_kog_prot->kog_px_decrypt(cpuregion, cpuregion_size);
361374   m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
362375   m_bootleg_prot->neogeo_bootleg_cx_decrypt(spr_region, spr_region_size);
363376}
trunk/src/emu/bus/neogeo/bootleg_cart.h
r32804r32805
55#include "banked_cart.h"
66#include "sma_prot.h"
77#include "bootleg_prot.h"
8#include "kog_prot.h"
89
910// ======================> neogeo_bootleg_cart
1011
r32804r32805
231232   void activate_cart(ACTIVATE_CART_PARAMS);
232233   virtual void decrypt_all(DECRYPT_ALL_PARAMS);
233234   virtual int get_fixed_bank_type(void) { return 0; }
235
236   virtual machine_config_constructor device_mconfig_additions() const;
237
238   required_device<kog_prot_device> m_kog_prot;
234239};
235240extern const device_type NEOGEO_BOOTLEG_KOG_CART;
236241
trunk/src/emu/bus/neogeo/bootleg_prot.c
r32804r32805
8787}
8888
8989
90/* The King of Gladiator (The King of Fighters '97 bootleg) */
9190
92
93/* The protection patching here may be incomplete
94   Thanks to Razoola for the info */
95
96void 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
15791/* The King of Fighters '97 Oroshi Plus 2003 (bootleg) */
15892
15993void ngbootleg_prot_device::kof97oro_px_decode(UINT8* cpurom, UINT32 cpurom_size)
trunk/src/emu/bus/bus.mak
r32804r32805
11181118BUSOBJS += $(BUSOBJ)/neogeo/bootleg_cart.o
11191119BUSOBJS += $(BUSOBJ)/neogeo/bootleg_hybrid_cart.o
11201120BUSOBJS += $(BUSOBJ)/neogeo/sbp_prot.o
1121BUSOBJS += $(BUSOBJ)/neogeo/kog_prot.o
11211122BUSOBJS += $(BUSOBJ)/neogeo/rom.o
11221123endif
11231124
trunk/src/mame/includes/neogeo.h
r32804r32805
1717#include "bus/neogeo/fatfury2_prot.h"
1818#include "bus/neogeo/kof98_prot.h"
1919#include "bus/neogeo/sbp_prot.h"
20#include "bus/neogeo/kog_prot.h"
2021
2122// On scanline 224, /VBLANK goes low 56 mclks (14 pixels) from the rising edge of /HSYNC.
2223// Two mclks after /VBLANK goes low, the hardware sets a pending IRQ1 flip-flop.
r32804r32805
299300   DECLARE_DRIVER_INIT(samsh5sp);
300301   DECLARE_DRIVER_INIT(jockeygp);
301302   DECLARE_DRIVER_INIT(vliner);
302   DECLARE_DRIVER_INIT(kog);
303303   DECLARE_DRIVER_INIT(kof97oro);
304304   DECLARE_DRIVER_INIT(lans2004);
305305   DECLARE_DRIVER_INIT(sbp);
r32804r32805
326326   optional_device<sbp_prot_device> m_sbp_prot;
327327};
328328
329class neogeo_noslot_kog_state : public neogeo_state
330{
331public:
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") {}
329337
330338
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
331346/*----------- defined in drivers/neogeo.c -----------*/
332347
333348MACHINE_CONFIG_EXTERN( neogeo_base );
trunk/src/mame/drivers/neogeo_noslot.c
r32804r32805
3232   MCFG_SBP_PROT_ADD("sbp_prot")
3333MACHINE_CONFIG_END
3434
35static 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)
3538
39   MCFG_NGBOOTLEG_PROT_ADD("bootleg_prot")
40   MCFG_KOG_PROT_ADD("kog_prot")
41MACHINE_CONFIG_END
3642
43
3744/*************************************
3845 *
3946 *  Official sets
r32804r32805
152159INPUT_PORTS_END
153160
154161
155static 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 )
165INPUT_PORTS_END
166
167
168162static INPUT_PORTS_START( mjneogeo )
169163   PORT_INCLUDE( neogeo )
170164
r32804r32805
89088902}
89098903
89108904
8911DRIVER_INIT_MEMBER(neogeo_noslot_state,kog) // copied to slot
8905DRIVER_INIT_MEMBER(neogeo_noslot_kog_state,kog) // copied to slot
89128906{
89138907   DRIVER_INIT_CALL(neogeo);
8914   /* overlay cartridge ROM */
8915   m_maincpu->space(AS_PROGRAM).install_read_port(0x0ffffe, 0x0fffff, "JUMPER");
89168908
8917   m_bootleg_prot->kog_px_decrypt(cpuregion, cpuregion_size);
8909   m_kog_prot->kog_px_decrypt(cpuregion, cpuregion_size);
89188910   m_bootleg_prot->neogeo_bootleg_sx_decrypt(fix_region, fix_region_size,1);
89198911   m_bootleg_prot->neogeo_bootleg_cx_decrypt(spr_region, spr_region_size);
8912   m_kog_prot->kog_install_protection(m_maincpu);
89208913}
89218914
89228915
r32804r32805
95919584GAME( 1997, kof97k,     kof97,    neogeo_noslot,   neogeo, neogeo_state,   neogeo,   ROT0, "SNK", "The King of Fighters '97 (Korean release)", GAME_SUPPORTS_SAVE )
95929585GAME( 1997, kof97pls,   kof97,    neogeo_noslot,   neogeo, neogeo_state,   neogeo,   ROT0, "bootleg", "The King of Fighters '97 Plus (bootleg)", GAME_SUPPORTS_SAVE )
95939586GAME( 1997, kof97oro,   kof97,    neogeo_noslot,   neogeo, neogeo_noslot_state,   kof97oro, ROT0, "bootleg", "The King of Fighters '97 Oroshi Plus 2003 (bootleg)", GAME_SUPPORTS_SAVE )
9594GAME( 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
9587GAME( 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
95959588GAME( 1997, lastblad,   neogeo,   neogeo_noslot,   neogeo, neogeo_state,   neogeo,   ROT0, "SNK", "The Last Blade / Bakumatsu Roman - Gekka no Kenshi (NGM-2340)", GAME_SUPPORTS_SAVE )
95969589GAME( 1997, lastbladh,  lastblad, neogeo_noslot,   neogeo, neogeo_state,   neogeo,   ROT0, "SNK", "The Last Blade / Bakumatsu Roman - Gekka no Kenshi (NGH-2340)", GAME_SUPPORTS_SAVE )
95979590GAME( 1997, lastsold,   lastblad, neogeo_noslot,   neogeo, neogeo_state,   neogeo,   ROT0, "SNK", "The Last Soldier (Korean release of The Last Blade)", GAME_SUPPORTS_SAVE )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team