diff options
author | David Haywood <hazemamewip@hotmail.com> | 2018-05-28 01:15:53 +0100 |
---|---|---|
committer | ajrhacker <ajrhacker@users.noreply.github.com> | 2018-05-27 20:15:53 -0400 |
commit | da7ae02b43b1d455b1a633b72fe4db5a05e971b8 (patch) | |
tree | 3ee489a47af3e7d00343ef781366edf0c7e77563 /src/devices/bus | |
parent | c412f39ec8714be3eff20ece0e109f665607a738 (diff) |
new WORKING clones (#3616)
* new WORKING clones
Metal Slug 3 (NGM-2560, earlier) [Razoola]
* consistency (nw)
* date note
Diffstat (limited to 'src/devices/bus')
-rw-r--r-- | src/devices/bus/neogeo/carts.cpp | 1 | ||||
-rw-r--r-- | src/devices/bus/neogeo/prot_sma.cpp | 73 | ||||
-rw-r--r-- | src/devices/bus/neogeo/prot_sma.h | 2 | ||||
-rw-r--r-- | src/devices/bus/neogeo/slot.cpp | 1 | ||||
-rw-r--r-- | src/devices/bus/neogeo/slot.h | 1 | ||||
-rw-r--r-- | src/devices/bus/neogeo/sma.cpp | 15 | ||||
-rw-r--r-- | src/devices/bus/neogeo/sma.h | 11 |
7 files changed, 89 insertions, 15 deletions
diff --git a/src/devices/bus/neogeo/carts.cpp b/src/devices/bus/neogeo/carts.cpp index 356ddf60340..94fbb70c34e 100644 --- a/src/devices/bus/neogeo/carts.cpp +++ b/src/devices/bus/neogeo/carts.cpp @@ -54,6 +54,7 @@ void neogeo_cart(device_slot_interface &device) device.option_add_internal("sma_garou", NEOGEO_SMA_GAROU_CART); device.option_add_internal("sma_garouh", NEOGEO_SMA_GAROUH_CART); device.option_add_internal("sma_mslug3", NEOGEO_SMA_MSLUG3_CART); + device.option_add_internal("sma_mslug3a", NEOGEO_SMA_MSLUG3A_CART); // These use SMA for prg & CMC50 for gfx + audiocpu device.option_add_internal("sma_kof2k", NEOGEO_SMA_KOF2000_CART); diff --git a/src/devices/bus/neogeo/prot_sma.cpp b/src/devices/bus/neogeo/prot_sma.cpp index bfd15ab208a..0b81939d957 100644 --- a/src/devices/bus/neogeo/prot_sma.cpp +++ b/src/devices/bus/neogeo/prot_sma.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:S. Smith,David Haywood,Fabio Priuli +// copyright-holders:S. Smith,David Haywood,Fabio Priuli, Razoola, Mr.K +// thanks to Razoola and Mr K for the decode and banking information #include "emu.h" #include "prot_sma.h" @@ -64,7 +65,6 @@ WRITE16_MEMBER( sma_prot_device::kof99_bankswitch_w ) WRITE16_MEMBER( sma_prot_device::garou_bankswitch_w ) { - // thanks to Razoola and Mr K for the info int bankaddress; static const int bankoffset[64] = { @@ -100,7 +100,6 @@ WRITE16_MEMBER( sma_prot_device::garou_bankswitch_w ) WRITE16_MEMBER( sma_prot_device::garouh_bankswitch_w ) { - // thanks to Razoola and Mr K for the info int bankaddress; static const int bankoffset[64] = { @@ -138,7 +137,6 @@ WRITE16_MEMBER( sma_prot_device::garouh_bankswitch_w ) WRITE16_MEMBER( sma_prot_device::mslug3_bankswitch_w ) { - // thanks to Razoola and Mr K for the info int bankaddress; static const int bankoffset[64] = { @@ -173,7 +171,6 @@ WRITE16_MEMBER( sma_prot_device::mslug3_bankswitch_w ) WRITE16_MEMBER( sma_prot_device::kof2000_bankswitch_w ) { - // thanks to Razoola and Mr K for the info int bankaddress; static const int bankoffset[64] = { @@ -232,7 +229,6 @@ uint32_t sma_prot_device::kof99_bank_base(uint16_t sel) uint32_t sma_prot_device::garou_bank_base(uint16_t sel) { - // thanks to Razoola and Mr K for the info static const int bankoffset[64] = { 0x000000, 0x100000, 0x200000, 0x300000, // 00 @@ -266,7 +262,6 @@ uint32_t sma_prot_device::garou_bank_base(uint16_t sel) uint32_t sma_prot_device::garouh_bank_base(uint16_t sel) { - // thanks to Razoola and Mr K for the info static const int bankoffset[64] = { 0x000000, 0x100000, 0x200000, 0x300000, // 00 @@ -302,7 +297,6 @@ uint32_t sma_prot_device::garouh_bank_base(uint16_t sel) uint32_t sma_prot_device::mslug3_bank_base(uint16_t sel) { - // thanks to Razoola and Mr K for the info static const int bankoffset[64] = { 0x000000, 0x020000, 0x040000, 0x060000, // 00 @@ -333,9 +327,40 @@ uint32_t sma_prot_device::mslug3_bank_base(uint16_t sel) return bankaddress; } +uint32_t sma_prot_device::mslug3a_bank_base(uint16_t sel) +{ + static const int bankoffset[64] = + { + 0x000000, 0x030000, 0x040000, 0x070000, // 00 + 0x080000, 0x0a0000, 0x0c0000, 0x0e0000, // 04 + 0x0f0000, 0x100000, 0x130000, 0x140000, // 08 + 0x150000, 0x160000, 0x190000, 0x1a0000, // 12 + 0x1B0000, 0x1C0000, 0x1F0000, 0x200000, // 16 + 0x210000, 0x220000, 0x250000, 0x260000, // 20 + 0x270000, 0x280000, 0x2B0000, 0x2C0000, // 24 + 0x2D0000, 0x2E0000, 0x310000, 0x320000, // 28 + 0x330000, 0x340000, 0x370000, 0x380000, // 32 + 0x390000, 0x3A0000, 0x3D0000, 0x3E0000, // 36 + 0x400000, 0x410000, 0x440000, 0x450000, // 40 + 0x460000, 0x470000, 0x4A0000, 0x4B0000, // 44 + 0x4C0000, /* rest not used? */ + }; + + // unscramble bank number + int data = + (BIT(sel, 15) << 0)+ + (BIT(sel, 3) << 1)+ + (BIT(sel, 1) << 2)+ + (BIT(sel, 6) << 3)+ + (BIT(sel, 12) << 4)+ + (BIT(sel, 11) << 5); + + int bankaddress = 0x100000 + bankoffset[data]; + return bankaddress; +} + uint32_t sma_prot_device::kof2000_bank_base(uint16_t sel) { - // thanks to Razoola and Mr K for the info static const int bankoffset[64] = { 0x000000, 0x100000, 0x200000, 0x300000, // 00 @@ -391,7 +416,7 @@ READ16_MEMBER( sma_prot_device::random_r ) -// kof99, garou, garouh, mslug3 and kof2000 have an SMA chip which contains program code and decrypts the 68k roms +// kof99, garou, garouh, mslug3, mslug3a and kof2000 have an SMA chip which contains program code and decrypts the 68k roms void sma_prot_device::kof99_decrypt_68k(uint8_t* base) { uint16_t *rom = (uint16_t *)(base + 0x100000); @@ -418,7 +443,6 @@ void sma_prot_device::kof99_decrypt_68k(uint8_t* base) void sma_prot_device::garou_decrypt_68k(uint8_t* base) { - // thanks to Razoola and Mr K for the info uint16_t *rom = (uint16_t *)(base + 0x100000); // swap data lines on the whole ROMs @@ -444,7 +468,6 @@ void sma_prot_device::garou_decrypt_68k(uint8_t* base) void sma_prot_device::garouh_decrypt_68k(uint8_t* base) { - // thanks to Razoola and Mr K for the info uint16_t *rom = (uint16_t *)(base + 0x100000); // swap data lines on the whole ROMs @@ -470,7 +493,6 @@ void sma_prot_device::garouh_decrypt_68k(uint8_t* base) void sma_prot_device::mslug3_decrypt_68k(uint8_t* base) { - // thanks to Razoola and Mr K for the info uint16_t *rom = (uint16_t *)(base + 0x100000); // swap data lines on the whole ROMs @@ -493,10 +515,33 @@ void sma_prot_device::mslug3_decrypt_68k(uint8_t* base) } } +void sma_prot_device::mslug3a_decrypt_68k(uint8_t* base) +{ + uint16_t *rom = (uint16_t *)(base + 0x100000); + + /* swap data lines on the whole ROMs */ + for (int i = 0;i < 0x800000/2;i++) + rom[i] = bitswap<16>(rom[i],2,11,12,14,9,3,1,4,13,7,6,8,10,15,0,5); + + /* swap address lines & relocate fixed part */ + rom = (uint16_t *)base; + for (int i = 0; i < 0x0c0000/2; i++) + rom[i] = rom[0x5d0000/2 + bitswap<24>(i,23,22,21,20,19,18,1,16,14,7,17,5,8,4,15,6,3,2,0,13,10,12,9,11)]; + + rom = (uint16_t *)(base + 0x100000); + /* swap address lines for the banked part */ + for (int i = 0;i < 0x800000/2; i += 0x10000/2) + { + uint16_t buffer[0x10000/2]; + memcpy(buffer,&rom[i],0x10000); + for (int j = 0;j < 0x10000/2;j++) + rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,12,0,11,3,4,13,6,8,14,7,5,2,10,9,1)]; + } +} + void sma_prot_device::kof2000_decrypt_68k(uint8_t* base) { - // thanks to Razoola and Mr K for the info uint16_t *rom = (uint16_t *)(base + 0x100000); // swap data lines on the whole ROMs diff --git a/src/devices/bus/neogeo/prot_sma.h b/src/devices/bus/neogeo/prot_sma.h index 040d03a08d9..f0ee9733bd0 100644 --- a/src/devices/bus/neogeo/prot_sma.h +++ b/src/devices/bus/neogeo/prot_sma.h @@ -30,11 +30,13 @@ public: uint32_t garou_bank_base(uint16_t sel); uint32_t garouh_bank_base(uint16_t sel); uint32_t mslug3_bank_base(uint16_t sel); + uint32_t mslug3a_bank_base(uint16_t sel); uint32_t kof2000_bank_base(uint16_t sel); void kof99_decrypt_68k(uint8_t* base); void garou_decrypt_68k(uint8_t* base); void garouh_decrypt_68k(uint8_t* base); void mslug3_decrypt_68k(uint8_t* base); + void mslug3a_decrypt_68k(uint8_t* base); void kof2000_decrypt_68k(uint8_t* base); protected: diff --git a/src/devices/bus/neogeo/slot.cpp b/src/devices/bus/neogeo/slot.cpp index df57d410ea7..9a01c1b1196 100644 --- a/src/devices/bus/neogeo/slot.cpp +++ b/src/devices/bus/neogeo/slot.cpp @@ -158,6 +158,7 @@ static const neogeo_slot slot_list[] = { NEOGEO_GAROU, "sma_garou" }, { NEOGEO_GAROUH, "sma_garouh" }, { NEOGEO_MSLUG3, "sma_mslug3" }, + { NEOGEO_MSLUG3A, "sma_mslug3a" }, { NEOGEO_KOF2K, "sma_kof2k" }, { NEOGEO_MSLUG4, "pcm2_mslug4" }, { NEOGEO_MSLUG4P, "pcm2_ms4p" }, diff --git a/src/devices/bus/neogeo/slot.h b/src/devices/bus/neogeo/slot.h index a90c529eea9..edeb2452a1d 100644 --- a/src/devices/bus/neogeo/slot.h +++ b/src/devices/bus/neogeo/slot.h @@ -30,6 +30,7 @@ enum NEOGEO_GAROU, NEOGEO_GAROUH, NEOGEO_MSLUG3, + NEOGEO_MSLUG3A, NEOGEO_KOF2K, NEOGEO_MSLUG4, NEOGEO_MSLUG4P, diff --git a/src/devices/bus/neogeo/sma.cpp b/src/devices/bus/neogeo/sma.cpp index 500b88eb7a1..70b03aa0a28 100644 --- a/src/devices/bus/neogeo/sma.cpp +++ b/src/devices/bus/neogeo/sma.cpp @@ -16,7 +16,8 @@ DEFINE_DEVICE_TYPE(NEOGEO_SMA_CART, neogeo_sma_cart_device, "neo 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") +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") @@ -127,6 +128,18 @@ void neogeo_sma_mslug3_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) 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, uint32_t 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 diff --git a/src/devices/bus/neogeo/sma.h b/src/devices/bus/neogeo/sma.h index 60b003f4c56..b4b72b3b5b5 100644 --- a/src/devices/bus/neogeo/sma.h +++ b/src/devices/bus/neogeo/sma.h @@ -104,6 +104,17 @@ public: DECLARE_DEVICE_TYPE(NEOGEO_SMA_MSLUG3_CART, neogeo_sma_mslug3_cart_device) +class neogeo_sma_mslug3a_cart_device : public neogeo_sma_cart_device +{ +public: + neogeo_sma_mslug3a_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + virtual void decrypt_all(DECRYPT_ALL_PARAMS) override; + virtual int get_fixed_bank_type() override { return 1; } + virtual uint32_t get_bank_base(uint16_t sel) override { return m_sma_prot->mslug3a_bank_base(sel); } +}; + +DECLARE_DEVICE_TYPE(NEOGEO_SMA_MSLUG3A_CART, neogeo_sma_mslug3a_cart_device) + /************************************************* kof2000 |