diff options
author | 2014-10-18 18:04:24 +0000 | |
---|---|---|
committer | 2014-10-18 18:04:24 +0000 | |
commit | 641a322ac0b8c56f255945d5ce84c0d12d9e416e (patch) | |
tree | 6f8bc701687f1061642c2193e71479ca3a863163 | |
parent | 8b906aa0ec3b0e2e8f69f3c9d862027286173272 (diff) |
make 'kog' dipswitch part of the protection device / cartridge (nw)
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | src/emu/bus/bus.mak | 1 | ||||
-rw-r--r-- | src/emu/bus/neogeo/bootleg_cart.c | 23 | ||||
-rw-r--r-- | src/emu/bus/neogeo/bootleg_cart.h | 5 | ||||
-rw-r--r-- | src/emu/bus/neogeo/bootleg_prot.c | 66 | ||||
-rw-r--r-- | src/emu/bus/neogeo/bootleg_prot.h | 1 | ||||
-rw-r--r-- | src/emu/bus/neogeo/kog_prot.c | 116 | ||||
-rw-r--r-- | src/emu/bus/neogeo/kog_prot.h | 38 | ||||
-rw-r--r-- | src/mame/drivers/neogeo_noslot.c | 29 | ||||
-rw-r--r-- | src/mame/includes/neogeo.h | 17 |
10 files changed, 207 insertions, 91 deletions
diff --git a/.gitattributes b/.gitattributes index 27c879c52dc..657337331b8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1190,6 +1190,8 @@ src/emu/bus/neogeo/kof98_cart.c svneol=native#text/plain src/emu/bus/neogeo/kof98_cart.h svneol=native#text/plain src/emu/bus/neogeo/kof98_prot.c svneol=native#text/plain src/emu/bus/neogeo/kof98_prot.h svneol=native#text/plain +src/emu/bus/neogeo/kog_prot.c svneol=native#text/plain +src/emu/bus/neogeo/kog_prot.h svneol=native#text/plain src/emu/bus/neogeo/mslugx_cart.c svneol=native#text/plain src/emu/bus/neogeo/mslugx_cart.h svneol=native#text/plain src/emu/bus/neogeo/mslugx_prot.c svneol=native#text/plain diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index bd71134db31..0c8b3332c43 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -1118,6 +1118,7 @@ BUSOBJS += $(BUSOBJ)/neogeo/bootleg_prot.o BUSOBJS += $(BUSOBJ)/neogeo/bootleg_cart.o BUSOBJS += $(BUSOBJ)/neogeo/bootleg_hybrid_cart.o BUSOBJS += $(BUSOBJ)/neogeo/sbp_prot.o +BUSOBJS += $(BUSOBJ)/neogeo/kog_prot.o BUSOBJS += $(BUSOBJ)/neogeo/rom.o endif diff --git a/src/emu/bus/neogeo/bootleg_cart.c b/src/emu/bus/neogeo/bootleg_cart.c index c1bdb055543..57cc59990b8 100644 --- a/src/emu/bus/neogeo/bootleg_cart.c +++ b/src/emu/bus/neogeo/bootleg_cart.c @@ -26,7 +26,7 @@ neogeo_bootleg_cart::neogeo_bootleg_cart(const machine_config &mconfig, device_t } 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 SMA Cart", tag, owner, clock, "neogeo_rom", __FILE__), + : 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") @@ -346,18 +346,31 @@ void neogeo_bootleg_kof10th_cart::decrypt_all(DECRYPT_ALL_PARAMS) 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__) {} +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); - /* overlay cartridge ROM */ // this should be part of the device - //m_maincpu->space(AS_PROGRAM).install_read_port(0x0ffffe, 0x0fffff, "JUMPER"); + m_kog_prot->kog_install_protection(maincpu); } void neogeo_bootleg_kog_cart::decrypt_all(DECRYPT_ALL_PARAMS) { - m_bootleg_prot->kog_px_decrypt(cpuregion, cpuregion_size); + 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); } diff --git a/src/emu/bus/neogeo/bootleg_cart.h b/src/emu/bus/neogeo/bootleg_cart.h index a81b55bb90b..87d78afa227 100644 --- a/src/emu/bus/neogeo/bootleg_cart.h +++ b/src/emu/bus/neogeo/bootleg_cart.h @@ -5,6 +5,7 @@ #include "banked_cart.h" #include "sma_prot.h" #include "bootleg_prot.h" +#include "kog_prot.h" // ======================> neogeo_bootleg_cart @@ -231,6 +232,10 @@ public: void activate_cart(ACTIVATE_CART_PARAMS); virtual void decrypt_all(DECRYPT_ALL_PARAMS); virtual int get_fixed_bank_type(void) { return 0; } + + virtual machine_config_constructor device_mconfig_additions() const; + + required_device<kog_prot_device> m_kog_prot; }; extern const device_type NEOGEO_BOOTLEG_KOG_CART; diff --git a/src/emu/bus/neogeo/bootleg_prot.c b/src/emu/bus/neogeo/bootleg_prot.c index 648d0f9acbc..9bd9fed1efb 100644 --- a/src/emu/bus/neogeo/bootleg_prot.c +++ b/src/emu/bus/neogeo/bootleg_prot.c @@ -87,72 +87,6 @@ void ngbootleg_prot_device::neogeo_bootleg_sx_decrypt(UINT8* fixed, UINT32 fixed } -/* The King of Gladiator (The King of Fighters '97 bootleg) */ - - -/* The protection patching here may be incomplete - Thanks to Razoola for the info */ - -void ngbootleg_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, 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; - -} - /* The King of Fighters '97 Oroshi Plus 2003 (bootleg) */ diff --git a/src/emu/bus/neogeo/bootleg_prot.h b/src/emu/bus/neogeo/bootleg_prot.h index 685c315dc33..b16024a7ffb 100644 --- a/src/emu/bus/neogeo/bootleg_prot.h +++ b/src/emu/bus/neogeo/bootleg_prot.h @@ -20,7 +20,6 @@ public: void neogeo_bootleg_cx_decrypt(UINT8*sprrom, UINT32 sprrom_size); void neogeo_bootleg_sx_decrypt(UINT8* fixed, UINT32 fixed_size, int value); - void kog_px_decrypt(UINT8* cpurom, UINT32 cpurom_size); void kof97oro_px_decode(UINT8* cpurom, UINT32 cpurom_size); void kof10thBankswitch(address_space &space, UINT16 nBank); DECLARE_READ16_MEMBER(kof10th_RAM2_r); diff --git a/src/emu/bus/neogeo/kog_prot.c b/src/emu/bus/neogeo/kog_prot.c new file mode 100644 index 00000000000..4e895068edd --- /dev/null +++ b/src/emu/bus/neogeo/kog_prot.c @@ -0,0 +1,116 @@ +#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 King of Gladiator Protection Device", 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, 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 ); +} diff --git a/src/emu/bus/neogeo/kog_prot.h b/src/emu/bus/neogeo/kog_prot.h new file mode 100644 index 00000000000..65eb7133ee9 --- /dev/null +++ b/src/emu/bus/neogeo/kog_prot.h @@ -0,0 +1,38 @@ + + +#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(); + virtual void device_reset(); + virtual ioport_constructor device_input_ports() const; + + + +private: + + +}; + +#endif diff --git a/src/mame/drivers/neogeo_noslot.c b/src/mame/drivers/neogeo_noslot.c index 077b958ef73..67795344d3b 100644 --- a/src/mame/drivers/neogeo_noslot.c +++ b/src/mame/drivers/neogeo_noslot.c @@ -32,6 +32,13 @@ static MACHINE_CONFIG_DERIVED_CLASS( neogeo_noslot, neogeo_arcade, neogeo_noslot MCFG_SBP_PROT_ADD("sbp_prot") MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED_CLASS( neogeo_noslot_kog, neogeo_arcade, neogeo_noslot_kog_state ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(main_map_noslot) + + MCFG_NGBOOTLEG_PROT_ADD("bootleg_prot") + MCFG_KOG_PROT_ADD("kog_prot") +MACHINE_CONFIG_END /************************************* @@ -152,19 +159,6 @@ static INPUT_PORTS_START( dualbios ) INPUT_PORTS_END -static INPUT_PORTS_START( kog ) - PORT_INCLUDE( neogeo ) - - /* 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 - - static INPUT_PORTS_START( mjneogeo ) PORT_INCLUDE( neogeo ) @@ -8908,15 +8902,14 @@ DRIVER_INIT_MEMBER(neogeo_noslot_state,kof10th) // copied to slot } -DRIVER_INIT_MEMBER(neogeo_noslot_state,kog) // copied to slot +DRIVER_INIT_MEMBER(neogeo_noslot_kog_state,kog) // copied to slot { DRIVER_INIT_CALL(neogeo); - /* overlay cartridge ROM */ - m_maincpu->space(AS_PROGRAM).install_read_port(0x0ffffe, 0x0fffff, "JUMPER"); - m_bootleg_prot->kog_px_decrypt(cpuregion, cpuregion_size); + 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); + m_kog_prot->kog_install_protection(m_maincpu); } @@ -9591,7 +9584,7 @@ GAME( 1997, kof97h, kof97, neogeo_noslot, neogeo, neogeo_state, neoge GAME( 1997, kof97k, kof97, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The King of Fighters '97 (Korean release)", GAME_SUPPORTS_SAVE ) GAME( 1997, kof97pls, kof97, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "bootleg", "The King of Fighters '97 Plus (bootleg)", GAME_SUPPORTS_SAVE ) 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 ) -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 +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 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 ) 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 ) GAME( 1997, lastsold, lastblad, neogeo_noslot, neogeo, neogeo_state, neogeo, ROT0, "SNK", "The Last Soldier (Korean release of The Last Blade)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index 5bce7595893..a119c0ead55 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -17,6 +17,7 @@ #include "bus/neogeo/fatfury2_prot.h" #include "bus/neogeo/kof98_prot.h" #include "bus/neogeo/sbp_prot.h" +#include "bus/neogeo/kog_prot.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. @@ -299,7 +300,6 @@ class neogeo_noslot_state : public neogeo_state DECLARE_DRIVER_INIT(samsh5sp); DECLARE_DRIVER_INIT(jockeygp); DECLARE_DRIVER_INIT(vliner); - DECLARE_DRIVER_INIT(kog); DECLARE_DRIVER_INIT(kof97oro); DECLARE_DRIVER_INIT(lans2004); DECLARE_DRIVER_INIT(sbp); @@ -326,8 +326,23 @@ class neogeo_noslot_state : public neogeo_state optional_device<sbp_prot_device> m_sbp_prot; }; +class neogeo_noslot_kog_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; +}; + /*----------- defined in drivers/neogeo.c -----------*/ MACHINE_CONFIG_EXTERN( neogeo_base ); |