diff --git a/hash/neogeo.xml b/hash/neogeo.xml index 06ed24faa76..0b7acc99c9a 100644 --- a/hash/neogeo.xml +++ b/hash/neogeo.xml @@ -8214,7 +8214,7 @@ - + @@ -8256,7 +8256,7 @@ - + @@ -8438,7 +8438,7 @@ - + @@ -8481,7 +8481,7 @@ - + @@ -8534,7 +8534,7 @@ - + @@ -8574,7 +8574,7 @@ - + @@ -8623,7 +8623,7 @@ - + @@ -8665,7 +8665,7 @@ - + @@ -8716,7 +8716,7 @@ - + @@ -8767,7 +8767,7 @@ - + @@ -8815,7 +8815,7 @@ - + @@ -8858,7 +8858,7 @@ - + @@ -8901,7 +8901,7 @@ - + @@ -8952,7 +8952,7 @@ - + @@ -9004,7 +9004,7 @@ - + @@ -9050,7 +9050,7 @@ - + @@ -9092,7 +9092,7 @@ - + @@ -9144,7 +9144,7 @@ - + @@ -9188,7 +9188,7 @@ - + @@ -9239,7 +9239,7 @@ - + @@ -9284,7 +9284,7 @@ - + @@ -9327,7 +9327,7 @@ - + @@ -9376,7 +9376,7 @@ - + @@ -9406,7 +9406,7 @@ - + @@ -9957,7 +9957,7 @@ - + @@ -9995,7 +9995,7 @@ - + @@ -10032,7 +10032,7 @@ - + @@ -10070,7 +10070,7 @@ - + @@ -10108,7 +10108,7 @@ - + @@ -10146,7 +10146,7 @@ - + @@ -10398,7 +10398,7 @@ - + diff --git a/src/devices/bus/neogeo/boot_kof10th.cpp b/src/devices/bus/neogeo/boot_kof10th.cpp index 1fa9aeb1d84..67d6217d12e 100644 --- a/src/devices/bus/neogeo/boot_kof10th.cpp +++ b/src/devices/bus/neogeo/boot_kof10th.cpp @@ -11,6 +11,7 @@ #include "emu.h" #include "boot_kof10th.h" +#include //------------------------------------------------- // neogeo_kof10th_cart_device - constructor @@ -31,16 +32,18 @@ neogeo_kof10th_cart_device::neogeo_kof10th_cart_device(const machine_config &mco void neogeo_kof10th_cart_device::device_start() { + m_cart_ram[0] = std::make_unique(0x2000/2); + m_cart_ram[1] = std::make_unique(0x2000/2); save_item(NAME(m_special_bank)); - save_item(NAME(m_cart_ram)); - save_item(NAME(m_cart_ram2)); + save_pointer(NAME(m_cart_ram[0].get()), 0x2000/2, 0); + save_pointer(NAME(m_cart_ram[1].get()), 0x2000/2, 1); } void neogeo_kof10th_cart_device::device_reset() { m_special_bank = 0; - memset(m_cart_ram, 0x00, 0x2000); - memset(m_cart_ram2, 0x00, 0x20000); + std::fill(&m_cart_ram[0][0], &m_cart_ram[0][0x2000/2], 0); + std::fill(&m_cart_ram[1][0], &m_cart_ram[1][0x2000/2], 0); } @@ -56,9 +59,9 @@ MACHINE_CONFIG_END void neogeo_kof10th_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_prot->kof10th_decrypt(cpuregion, cpuregion_size); - memcpy(m_cart_ram2, (uint8_t *)cpuregion + 0xe0000, 0x20000); + memcpy(m_cart_ram[1], (uint8_t *)cpuregion + 0xe0000, 0x20000); m_fixed = (get_fixed_size()) ? get_fixed_base() : get_region_fixed_base(); - save_pointer(NAME(m_fixed), 0x40000); + save_pointer(NAME(m_fixed), 0x40000/2); } @@ -76,7 +79,7 @@ uint32_t neogeo_kof10th_cart_device::get_bank_base(uint16_t sel) uint16_t neogeo_kof10th_cart_device::get_helper() { - return m_cart_ram[0xffc]; + return m_cart_ram[0][0xffc]; } uint32_t neogeo_kof10th_cart_device::get_special_bank() @@ -86,21 +89,21 @@ uint32_t neogeo_kof10th_cart_device::get_special_bank() READ16_MEMBER(neogeo_kof10th_cart_device::protection_r) { - return m_cart_ram[offset]; + return m_cart_ram[0][offset]; } READ16_MEMBER(neogeo_kof10th_cart_device::addon_r) { // printf("kof10th_RAM2_r\n"); - return m_cart_ram2[offset]; + return m_cart_ram[1][offset]; } WRITE16_MEMBER(neogeo_kof10th_cart_device::protection_w) { if (offset < 0x40000/2) { - if (!m_cart_ram[0xffe]) - COMBINE_DATA(&m_cart_ram2[(0x00000/2) + (offset & 0xffff)]); // Write to RAM bank A + if (!m_cart_ram[0][0xffe]) + COMBINE_DATA(&m_cart_ram[1][(0x00000/2) + (offset & 0xffff)]); // Write to RAM bank A else m_fixed[offset] = bitswap<8>(data, 7,6,0,4,3,2,1,5); // Write S data on-the-fly } @@ -111,11 +114,11 @@ WRITE16_MEMBER(neogeo_kof10th_cart_device::protection_w) // Standard bankswitch //m_bankdev->neogeo_set_main_cpu_bank_address(get_bank_base(data)); } - else if (offset == 0xffff8/2 && m_cart_ram[0xffc] != data) + else if (offset == 0xffff8/2 && m_cart_ram[0][0xffc] != data) { // Special bankswitch m_special_bank = (data & 1) ? 0x800000/2 : 0x700000/2; } - COMBINE_DATA(&m_cart_ram[offset & 0xfff]); + COMBINE_DATA(&m_cart_ram[0][offset & 0xfff]); } } diff --git a/src/devices/bus/neogeo/boot_kof10th.h b/src/devices/bus/neogeo/boot_kof10th.h index 9c5cf2a2e5d..1e0a73f5a23 100644 --- a/src/devices/bus/neogeo/boot_kof10th.h +++ b/src/devices/bus/neogeo/boot_kof10th.h @@ -38,8 +38,7 @@ protected: private: uint8_t* m_fixed; uint32_t m_special_bank; - uint16_t m_cart_ram[0x1000]; - uint16_t m_cart_ram2[0x10000]; + std::unique_ptr m_cart_ram[2]; }; // device type definition diff --git a/src/devices/bus/neogeo/boot_kof2k2.cpp b/src/devices/bus/neogeo/boot_kof2k2.cpp index 611ff47a382..97c28c36a42 100644 --- a/src/devices/bus/neogeo/boot_kof2k2.cpp +++ b/src/devices/bus/neogeo/boot_kof2k2.cpp @@ -50,7 +50,7 @@ void neogeo_kof2002b_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_kof2k2_prot->kof2002_decrypt_68k(cpuregion, cpuregion_size); m_pcm2_prot->swap(ym_region, ym_region_size, 0); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_prot->kof2002b_gfx_decrypt(spr_region, 0x4000000); m_prot->kof2002b_gfx_decrypt(fix_region, 0x20000); } @@ -73,7 +73,7 @@ void neogeo_kf2k2mp_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_prot->kf2k2mp_decrypt(cpuregion, cpuregion_size); m_pcm2_prot->swap(ym_region, ym_region_size, 0); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_prot->sx_decrypt(fix_region, fix_region_size, 2); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2002_GFX_KEY); } @@ -96,7 +96,7 @@ void neogeo_kf2k2mp2_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_prot->kf2k2mp2_px_decrypt(cpuregion, cpuregion_size); m_pcm2_prot->swap(ym_region, ym_region_size, 0); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_prot->sx_decrypt(fix_region, fix_region_size, 1); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2002_GFX_KEY); } diff --git a/src/devices/bus/neogeo/boot_misc.cpp b/src/devices/bus/neogeo/boot_misc.cpp index f22a0236ebf..cc05d9416d8 100644 --- a/src/devices/bus/neogeo/boot_misc.cpp +++ b/src/devices/bus/neogeo/boot_misc.cpp @@ -228,7 +228,7 @@ neogeo_ms5plus_cart_device::neogeo_ms5plus_cart_device(const machine_config &mco 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_m1_decrypt(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); diff --git a/src/devices/bus/neogeo/cmc.cpp b/src/devices/bus/neogeo/cmc.cpp index 841244c478e..06b1ac1aa0a 100644 --- a/src/devices/bus/neogeo/cmc.cpp +++ b/src/devices/bus/neogeo/cmc.cpp @@ -220,7 +220,7 @@ neogeo_cmc_kof2001_cart_device::neogeo_cmc_kof2001_cart_device(const machine_con void neogeo_cmc_kof2001_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { - m_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2001_GFX_KEY); m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); } @@ -238,7 +238,7 @@ neogeo_cmc_kof2000n_cart_device::neogeo_cmc_kof2000n_cart_device(const machine_c void neogeo_cmc_kof2000n_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { - m_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2000_GFX_KEY); m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); } @@ -268,7 +268,7 @@ void neogeo_cmc_jockeygp_cart_device::device_reset() void neogeo_cmc_jockeygp_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { - m_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, JOCKEYGP_GFX_KEY); m_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); } diff --git a/src/devices/bus/neogeo/kof2k2.cpp b/src/devices/bus/neogeo/kof2k2.cpp index e313c93034a..8cc7004f925 100644 --- a/src/devices/bus/neogeo/kof2k2.cpp +++ b/src/devices/bus/neogeo/kof2k2.cpp @@ -71,7 +71,7 @@ neogeo_kof2002_cart_device::neogeo_kof2002_cart_device(const machine_config &mco void neogeo_kof2002_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_kof2k2_prot->kof2002_decrypt_68k(cpuregion, cpuregion_size); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2002_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); m_pcm2_prot->swap(ym_region, ym_region_size, 0); @@ -91,7 +91,7 @@ neogeo_kf2k2pls_cart_device::neogeo_kf2k2pls_cart_device(const machine_config &m void neogeo_kf2k2pls_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_kof2k2_prot->kof2002_decrypt_68k(cpuregion, cpuregion_size); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2002_GFX_KEY); m_pcm2_prot->swap(ym_region, ym_region_size, 0); } @@ -111,7 +111,7 @@ neogeo_matrim_cart_device::neogeo_matrim_cart_device(const machine_config &mconf void neogeo_matrim_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_kof2k2_prot->matrim_decrypt_68k(cpuregion, cpuregion_size); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MATRIM_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); m_pcm2_prot->swap(ym_region, ym_region_size, 1); @@ -131,7 +131,7 @@ neogeo_samsho5_cart_device::neogeo_samsho5_cart_device(const machine_config &mco void neogeo_samsho5_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_kof2k2_prot->samsho5_decrypt_68k(cpuregion, cpuregion_size); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, SAMSHO5_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); m_pcm2_prot->swap(ym_region, ym_region_size, 4); @@ -151,7 +151,7 @@ neogeo_samsho5sp_cart_device::neogeo_samsho5sp_cart_device(const machine_config void neogeo_samsho5sp_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_kof2k2_prot->samsh5sp_decrypt_68k(cpuregion, cpuregion_size); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, SAMSHO5SP_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); m_pcm2_prot->swap(ym_region, ym_region_size, 6); diff --git a/src/devices/bus/neogeo/pcm2.cpp b/src/devices/bus/neogeo/pcm2.cpp index e098d796229..d7a3d82f6db 100644 --- a/src/devices/bus/neogeo/pcm2.cpp +++ b/src/devices/bus/neogeo/pcm2.cpp @@ -68,7 +68,7 @@ neogeo_pcm2_mslug4_cart_device::neogeo_pcm2_mslug4_cart_device(const machine_con void neogeo_pcm2_mslug4_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_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MSLUG4_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); m_pcm2_prot->decrypt(ym_region, ym_region_size, 8); @@ -88,7 +88,7 @@ neogeo_pcm2_ms4plus_cart_device::neogeo_pcm2_ms4plus_cart_device(const machine_c void neogeo_pcm2_ms4plus_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_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MSLUG4_GFX_KEY); m_pcm2_prot->decrypt(ym_region, ym_region_size, 8); } @@ -107,7 +107,7 @@ neogeo_pcm2_rotd_cart_device::neogeo_pcm2_rotd_cart_device(const machine_config void neogeo_pcm2_rotd_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_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, ROTD_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); m_pcm2_prot->decrypt(ym_region, ym_region_size, 16); @@ -126,7 +126,7 @@ neogeo_pcm2_pnyaa_cart_device::neogeo_pcm2_pnyaa_cart_device(const machine_confi void neogeo_pcm2_pnyaa_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_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, PNYAA_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); m_pcm2_prot->decrypt(ym_region, ym_region_size, 4); diff --git a/src/devices/bus/neogeo/prot_cmc.cpp b/src/devices/bus/neogeo/prot_cmc.cpp index 77591827f54..ffd86a1934e 100644 --- a/src/devices/bus/neogeo/prot_cmc.cpp +++ b/src/devices/bus/neogeo/prot_cmc.cpp @@ -4,6 +4,8 @@ #include "emu.h" #include "prot_cmc.h" +#include + DEFINE_DEVICE_TYPE(NG_CMC_PROT, cmc_prot_device, "ng_cmc_prot", "Neo Geo CMC42/CMC40 Protection") @@ -703,11 +705,10 @@ int cmc_prot_device::m1_address_scramble(int address, uint16_t key) } -void cmc_prot_device::cmc50_m1_decrypt(uint8_t* romcrypt, uint32_t romcrypt_size, uint8_t* romaudio, uint32_t romaudio_size) +void cmc_prot_device::cmc50_m1_decrypt(uint8_t* romaudio, uint32_t romaudio_size) { - uint8_t* rom = romcrypt; - size_t rom_size = 0x80000; - uint8_t* rom2 = romaudio; + uint8_t* rom = romaudio; + size_t rom_size = romaudio_size; std::vector buffer(rom_size); @@ -718,10 +719,7 @@ void cmc_prot_device::cmc50_m1_decrypt(uint8_t* romcrypt, uint32_t romcrypt_size for (uint32_t i = 0; i < rom_size; i++) buffer[i] = rom[m1_address_scramble(i,key)]; - memcpy(rom, &buffer[0], rom_size); - - memcpy(rom2,rom, 0x10000); - memcpy(rom2 + 0x10000, rom, 0x80000); + std::copy(buffer.begin(), buffer.end(), &rom[0]); #if 0 { diff --git a/src/devices/bus/neogeo/prot_cmc.h b/src/devices/bus/neogeo/prot_cmc.h index 46a6a6c6766..4c7c0685b07 100644 --- a/src/devices/bus/neogeo/prot_cmc.h +++ b/src/devices/bus/neogeo/prot_cmc.h @@ -64,7 +64,7 @@ public: uint16_t generate_cs16(uint8_t *rom, int size); int m1_address_scramble(int address, uint16_t key); - void cmc50_m1_decrypt(uint8_t* romcrypt, uint32_t romcrypt_size, uint8_t* romaudio, uint32_t romaudio_size); + void cmc50_m1_decrypt(uint8_t* romaudio, uint32_t romaudio_size); protected: virtual void device_start() override; diff --git a/src/devices/bus/neogeo/prot_cthd.cpp b/src/devices/bus/neogeo/prot_cthd.cpp index d2c427d6ac7..8b756c82361 100644 --- a/src/devices/bus/neogeo/prot_cthd.cpp +++ b/src/devices/bus/neogeo/prot_cthd.cpp @@ -4,6 +4,8 @@ #include "emu.h" #include "prot_cthd.h" +#include + DEFINE_DEVICE_TYPE(NG_CTHD_PROT, cthd_prot_device, "ng_cthd_prot", "Neo Geo CTHD Protection (bootleg)") @@ -47,10 +49,9 @@ void cthd_prot_device::fix_do(uint8_t* sprrom, uint32_t sprrom_size, int start, (BIT(j, 1) << bit1shift) + (BIT(j, 2) << bit2shift) + (BIT(j, 3) << bit3shift); - memcpy(&rom[j * tilesize], realrom + offset * tilesize, tilesize); + std::copy(&realrom[((i*16)+offset)*tilesize], &realrom[((i*16)+offset+1)*tilesize], &rom[j * tilesize]); } - memcpy(realrom, &rom[0], tilesize * 16); - realrom += 16 * tilesize; + std::copy(&rom[0], &rom[tilesize * 16], &realrom[i * 16]); } } @@ -95,22 +96,16 @@ void cthd_prot_device::cthd2003_c(uint8_t* sprrom, uint32_t sprrom_size, int pow void cthd_prot_device::decrypt_cthd2003(uint8_t* sprrom, uint32_t sprrom_size, uint8_t* audiorom, uint32_t audiorom_size, uint8_t* fixedrom, uint32_t fixedrom_size) { uint8_t *romdata = fixedrom; - std::vector tmp(8 * 128 * 128); + std::vector tmp(0x08000); + + std::copy(&romdata[0x08000], &romdata[0x10000], tmp.begin()); + std::copy(&romdata[0x10000], &romdata[0x08000], &romdata[0x08000]); + std::copy(tmp.begin() , tmp.end(), &romdata[0x10000]); - memcpy(&tmp[8 * 0 * 128], romdata + 8 * 0 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 32 * 128], romdata + 8 * 64 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 64 * 128], romdata + 8 * 32 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 96 * 128], romdata + 8 * 96 * 128, 8 * 32 * 128); - memcpy(romdata, &tmp[0], 8 * 128 * 128); - - romdata = audiorom + 0x10000; - memcpy(&tmp[8 * 0 * 128], romdata + 8 * 0 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 32 * 128], romdata + 8 * 64 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 64 * 128], romdata + 8 * 32 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 96 * 128], romdata + 8 * 96 * 128, 8 * 32 * 128); - memcpy(romdata, &tmp[0], 8 * 128 * 128); - - memcpy(romdata - 0x10000, romdata, 0x10000); + romdata = audiorom; + std::copy(&romdata[0x08000], &romdata[0x10000], tmp.begin()); + std::copy(&romdata[0x10000], &romdata[0x08000], &romdata[0x08000]); + std::copy(tmp.begin() , tmp.end(), &romdata[0x10000]); cthd2003_c(sprrom, sprrom_size, 0); } @@ -184,8 +179,8 @@ void cthd_prot_device::ct2k3sp_sx_decrypt( uint8_t* fixedrom, uint32_t fixedrom_ int rom_size = fixedrom_size; uint8_t *rom = fixedrom; std::vector buf(rom_size); - - memcpy(&buf[0], rom, rom_size); + + std::copy(&rom[0], &rom[rom_size], buf.begin()); for (int i = 0; i < rom_size; i++) { @@ -196,25 +191,22 @@ void cthd_prot_device::ct2k3sp_sx_decrypt( uint8_t* fixedrom, uint32_t fixedrom_ rom[i] = buf[ofst]; } - memcpy(&buf[0], rom, rom_size); + std::copy(&rom[0], &rom[rom_size], buf.begin()); - memcpy(&rom[0x08000], &buf[0x10000], 0x8000); - memcpy(&rom[0x10000], &buf[0x08000], 0x8000); - memcpy(&rom[0x28000], &buf[0x30000], 0x8000); - memcpy(&rom[0x30000], &buf[0x28000], 0x8000); + std::copy(&buf[0x10000], &buf[0x18000], &rom[0x08000]); + std::copy(&buf[0x08000], &buf[0x10000], &rom[0x10000]); + std::copy(&buf[0x30000], &buf[0x38000], &rom[0x28000]); + std::copy(&buf[0x28000], &buf[0x30000], &rom[0x30000]); } void cthd_prot_device::decrypt_ct2k3sp(uint8_t* sprrom, uint32_t sprrom_size, uint8_t* audiorom, uint32_t audiorom_size, uint8_t* fixedrom, uint32_t fixedrom_size) { - uint8_t *romdata = audiorom + 0x10000; - std::vector tmp(8 * 128 * 128); - memcpy(&tmp[8 * 0 * 128], romdata + 8 * 0 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 32 * 128], romdata + 8 * 64 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 64 * 128], romdata + 8 * 32 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 96 * 128], romdata + 8 * 96 * 128, 8 * 32 * 128); - memcpy(romdata, &tmp[0], 8 * 128 * 128); + uint8_t *romdata = audiorom; + std::vector tmp(0x08000); + std::copy(&romdata[0x08000], &romdata[0x10000], tmp.begin()); + std::copy(&romdata[0x10000], &romdata[0x08000], &romdata[0x08000]); + std::copy(tmp.begin() , tmp.end(), &romdata[0x10000]); - memcpy(romdata - 0x10000, romdata, 0x10000); ct2k3sp_sx_decrypt(fixedrom, fixedrom_size); cthd2003_c(sprrom, sprrom_size, 0); } @@ -225,15 +217,12 @@ void cthd_prot_device::decrypt_ct2k3sp(uint8_t* sprrom, uint32_t sprrom_size, ui void cthd_prot_device::decrypt_ct2k3sa(uint8_t* sprrom, uint32_t sprrom_size, uint8_t* audiorom, uint32_t audiorom_size ) { - uint8_t *romdata = audiorom + 0x10000; - std::vector tmp(8 * 128 * 128); - memcpy(&tmp[8 * 0 * 128], romdata + 8 * 0 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 32 * 128], romdata + 8 * 64 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 64 * 128], romdata + 8 * 32 * 128, 8 * 32 * 128); - memcpy(&tmp[8 * 96 * 128], romdata + 8 * 96 * 128, 8 * 32 * 128); - memcpy(romdata, &tmp[0], 8 * 128 * 128); + uint8_t *romdata = audiorom; + std::vector tmp(0x08000); + std::copy(&romdata[0x08000], &romdata[0x10000], tmp.begin()); + std::copy(&romdata[0x10000], &romdata[0x08000], &romdata[0x08000]); + std::copy(tmp.begin() , tmp.end(), &romdata[0x10000]); - memcpy(romdata - 0x10000, romdata, 0x10000); cthd2003_c(sprrom,sprrom_size, 0); } @@ -280,9 +269,9 @@ void cthd_prot_device::patch_ct2k3sa(uint8_t* cpurom, uint32_t cpurom_size) void cthd_prot_device::matrimbl_decrypt(uint8_t* sprrom, uint32_t sprrom_size, uint8_t* audiorom, uint32_t audiorom_size) { // decrypt Z80 - uint8_t *rom = audiorom + 0x10000; + uint8_t *rom = audiorom; std::vector buf(0x20000); - memcpy(&buf[0], rom, 0x20000); + std::copy(&rom[0], &rom[0x20000], buf.begin()); int j; for (int i = 0x00000; i < 0x20000; i++) @@ -313,7 +302,6 @@ void cthd_prot_device::matrimbl_decrypt(uint8_t* sprrom, uint32_t sprrom_size, u } rom[j] = buf[i]; } - memcpy(rom - 0x10000, rom, 0x10000); // decrypt gfx cthd2003_c(sprrom,sprrom_size, 0 ); diff --git a/src/devices/bus/neogeo/prot_kof2k2.cpp b/src/devices/bus/neogeo/prot_kof2k2.cpp index 75b79172d29..5e1acf05bd6 100644 --- a/src/devices/bus/neogeo/prot_kof2k2.cpp +++ b/src/devices/bus/neogeo/prot_kof2k2.cpp @@ -4,6 +4,8 @@ #include "emu.h" #include "prot_kof2k2.h" +#include + DEFINE_DEVICE_TYPE(NG_KOF2002_PROT, kof2002_prot_device, "ng_kof2002_prot", "Neo Geo KoF 2002 Protection") @@ -28,10 +30,11 @@ void kof2002_prot_device::kof2002_decrypt_68k(uint8_t* cpurom, uint32_t cpurom_s static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000}; uint8_t *src = cpurom + 0x100000; std::vector dst(0x400000); - memcpy(&dst[0], src, 0x400000); + + std::copy(&src[0], &src[0x400000], dst.begin()); for (int i = 0; i < 8; ++i) - memcpy(src + i * 0x80000, &dst[sec[i]], 0x80000); + std::copy(&dst[sec[i]], &dst[sec[i]+0x80000], src + i * 0x80000); } @@ -40,10 +43,11 @@ void kof2002_prot_device::matrim_decrypt_68k(uint8_t* cpurom, uint32_t cpurom_si static const int sec[]={0x100000,0x280000,0x300000,0x180000,0x000000,0x380000,0x200000,0x080000}; uint8_t *src = cpurom + 0x100000; std::vector dst(0x400000); - memcpy(&dst[0], src, 0x400000); + + std::copy(&src[0], &src[0x400000], dst.begin()); for (int i = 0; i < 8; ++i) - memcpy(src + i * 0x80000, &dst[sec[i]], 0x80000); + std::copy(&dst[sec[i]], &dst[sec[i]+0x80000], src + i * 0x80000); } @@ -52,9 +56,11 @@ void kof2002_prot_device::samsho5_decrypt_68k(uint8_t* cpurom, uint32_t cpurom_s static const int sec[]={0x000000,0x080000,0x700000,0x680000,0x500000,0x180000,0x200000,0x480000,0x300000,0x780000,0x600000,0x280000,0x100000,0x580000,0x400000,0x380000}; uint8_t *src = cpurom; std::vector dst(0x800000); - memcpy(&dst[0], src, 0x800000); + + std::copy(&src[0], &src[0x800000], dst.begin()); + for (int i = 0; i < 16; ++i) - memcpy(src + i * 0x80000, &dst[sec[i]], 0x80000); + std::copy(&dst[sec[i]], &dst[sec[i]+0x80000], src + i * 0x80000); } @@ -64,7 +70,8 @@ void kof2002_prot_device::samsh5sp_decrypt_68k(uint8_t* cpurom, uint32_t cpurom_ uint8_t *src = cpurom; std::vector dst(0x800000); - memcpy(&dst[0], src, 0x800000); + std::copy(&src[0], &src[0x800000], dst.begin()); + for (int i = 0; i < 16; ++i) - memcpy(src + i * 0x80000, &dst[sec[i]], 0x80000); + std::copy(&dst[sec[i]], &dst[sec[i]+0x80000], src + i * 0x80000); } diff --git a/src/devices/bus/neogeo/prot_kof2k3bl.cpp b/src/devices/bus/neogeo/prot_kof2k3bl.cpp index 456f164c042..606c09b7550 100644 --- a/src/devices/bus/neogeo/prot_kof2k3bl.cpp +++ b/src/devices/bus/neogeo/prot_kof2k3bl.cpp @@ -4,6 +4,8 @@ #include "emu.h" #include "prot_kof2k3bl.h" +#include + DEFINE_DEVICE_TYPE(NG_KOF2K3BL_PROT, kof2k3bl_prot_device, "ng_kof2k3bl_prot", "Neo Geo KoF 2003 Bootleg Protection") @@ -15,14 +17,15 @@ kof2k3bl_prot_device::kof2k3bl_prot_device(const machine_config &mconfig, const void kof2k3bl_prot_device::device_start() { - save_item(NAME(m_cartridge_ram)); + m_cartridge_ram = std::make_unique(0x2000/2); + save_pointer(NAME(m_cartridge_ram.get()), 0x2000/2); save_item(NAME(m_overlay)); save_item(NAME(m_bank_base)); } void kof2k3bl_prot_device::device_reset() { - memset(m_cartridge_ram, 0x00, 0x2000); + std::fill(&m_cartridge_ram[0], &m_cartridge_ram[0x2000/2], 0); m_overlay = 0; m_bank_base = 0; } @@ -46,7 +49,7 @@ WRITE16_MEMBER(kof2k3bl_prot_device::kof2003_w) data = COMBINE_DATA(&m_cartridge_ram[offset]); if (offset == 0x1ff0/2 || offset == 0x1ff2/2) { - uint8_t* cr = (uint8_t *)m_cartridge_ram; + uint8_t* cr = (uint8_t *)m_cartridge_ram.get(); uint8_t prt = cr[BYTE_XOR_LE(0x1ff2)]; m_bank_base = 0x100000 + ((cr[BYTE_XOR_LE(0x1ff3)] << 16) | (cr[BYTE_XOR_LE(0x1ff2)] << 8) | cr[BYTE_XOR_LE(0x1ff1)]); //uint32_t address = (cr[BYTE_XOR_LE(0x1ff3)] << 16) | (cr[BYTE_XOR_LE(0x1ff2)] << 8) | cr[BYTE_XOR_LE(0x1ff1)]; @@ -65,7 +68,7 @@ WRITE16_MEMBER(kof2k3bl_prot_device::kof2003p_w) data = COMBINE_DATA(&m_cartridge_ram[offset]); if (offset == 0x1ff0/2 || offset == 0x1ff2/2) { - uint8_t* cr = (uint8_t *)m_cartridge_ram; + uint8_t* cr = (uint8_t *)m_cartridge_ram.get(); uint8_t prt = cr[BYTE_XOR_LE(0x1ff2)]; m_bank_base = 0x100000 + ((cr[BYTE_XOR_LE(0x1ff3)] << 16) | (cr[BYTE_XOR_LE(0x1ff2)] << 8) | cr[BYTE_XOR_LE(0x1ff0)]); //uint32_t address = (cr[BYTE_XOR_LE(0x1ff3)] << 16) | (cr[BYTE_XOR_LE(0x1ff2)] << 8) | cr[BYTE_XOR_LE(0x1ff0)]; @@ -85,9 +88,9 @@ void kof2k3bl_prot_device::bl_px_decrypt(uint8_t* cpurom, uint32_t cpurom_size) uint8_t *rom = cpurom; std::vector buf(rom_size); - memcpy(&buf[0], rom, rom_size); + std::copy(&rom[0], &rom[rom_size], buf.begin()); for (int i = 0; i < rom_size / 0x100000; i++) - memcpy(&rom[i * 0x100000], &buf[sec[i] * 0x100000], 0x100000); + std::copy(&buf[sec[i] * 0x100000], &buf[(sec[i]+1) * 0x100000], &rom[i * 0x100000]); } @@ -100,7 +103,7 @@ void kof2k3bl_prot_device::pl_px_decrypt(uint8_t* cpurom, uint32_t cpurom_size) for (int i = 0; i < 0x700000/2; i += 0x100000/2) { - memcpy(&tmp[0], &rom16[i], 0x100000); + std::copy(&rom16[i], &rom16[i + 0x100000/2], tmp.begin()); for (int j = 0; j < 0x100000/2; j++) rom16[i+j] = tmp[bitswap<24>(j,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)]; } @@ -125,7 +128,7 @@ void kof2k3bl_prot_device::upl_px_decrypt(uint8_t* cpurom, uint32_t cpurom_size) for (int i = 0; i < 0x2000 / 2; i++) { int ofst = (i & 0xff00) + bitswap<8>((i & 0x00ff), 7, 6, 0, 4, 3, 2, 1, 5); - memcpy(&rom[i * 2], &buf[ofst * 2], 2); + std::copy(&buf[ofst * 2], &buf[(ofst+1) * 2], &rom[i * 2]); } uint16_t* rom16 = (uint16_t*)cpurom; diff --git a/src/devices/bus/neogeo/prot_kof2k3bl.h b/src/devices/bus/neogeo/prot_kof2k3bl.h index 8520bd90716..70adf84beb5 100644 --- a/src/devices/bus/neogeo/prot_kof2k3bl.h +++ b/src/devices/bus/neogeo/prot_kof2k3bl.h @@ -34,7 +34,7 @@ protected: private: uint16_t m_overlay; uint32_t m_bank_base; - uint16_t m_cartridge_ram[0x1000]; // bootlegs + std::unique_ptr m_cartridge_ram; // bootlegs }; #endif // MAME_BUS_NEOGEO_PROT_KOF2K3BL_H diff --git a/src/devices/bus/neogeo/prot_kof98.cpp b/src/devices/bus/neogeo/prot_kof98.cpp index 5f76d935e1a..86d1cde01bf 100644 --- a/src/devices/bus/neogeo/prot_kof98.cpp +++ b/src/devices/bus/neogeo/prot_kof98.cpp @@ -5,6 +5,8 @@ #include "emu.h" #include "prot_kof98.h" +#include + DEFINE_DEVICE_TYPE(NG_KOF98_PROT, kof98_prot_device, "ng_kof98_prot", "Neo Geo KoF 98 Protection") @@ -34,37 +36,37 @@ void kof98_prot_device::decrypt_68k(uint8_t* cpurom, uint32_t cpurom_size) static const uint32_t sec[]={ 0x000000, 0x100000, 0x000004, 0x100004, 0x10000a, 0x00000a, 0x10000e, 0x00000e }; static const uint32_t pos[]={ 0x000, 0x004, 0x00a, 0x00e }; - memcpy(&dst[0], src, 0x200000); + std::copy(&src[0], &src[0x200000], dst.begin()); for (i = 0x800; i < 0x100000; i += 0x200) { for (j = 0; j < 0x100; j += 0x10) { for (k = 0; k < 16; k += 2) { - memcpy(&src[i+j+k], &dst[i+j+sec[k/2]+0x100], 2); - memcpy(&src[i+j+k+0x100], &dst[i+j+sec[k/2]], 2); + std::copy(&dst[i+j+sec[k/2]+0x100], &dst[i+j+sec[k/2]+0x100+2], &src[i+j+k]); + std::copy(&dst[i+j+sec[k/2]], &dst[i+j+sec[k/2]+2], &src[i+j+k+0x100]); } if (i >= 0x080000 && i < 0x0c0000) { for (k = 0; k < 4; k++) { - memcpy(&src[i+j+pos[k]], &dst[i+j+pos[k]], 2); - memcpy(&src[i+j+pos[k]+0x100], &dst[i+j+pos[k]+0x100], 2); + std::copy(&dst[i+j+pos[k]], &dst[i+j+pos[k]+2], &src[i+j+pos[k]], ); + std::copy(&dst[i+j+pos[k]+0x100], &dst[i+j+pos[k]+0x100+2], &src[i+j+pos[k]+0x100]); } } else if (i >= 0x0c0000) { for (k = 0; k < 4; k++) { - memcpy(&src[i+j+pos[k]], &dst[i+j+pos[k]+0x100], 2); - memcpy(&src[i+j+pos[k]+0x100], &dst[i+j+pos[k]], 2); + std::copy(&dst[i+j+pos[k]+0x100], &dst[i+j+pos[k]+0x100+2], &src[i+j+pos[k]], ); + std::copy(&dst[i+j+pos[k]], &dst[i+j+pos[k]+2], &src[i+j+pos[k]+0x100]); } } } - memcpy(&src[i+0x000000], &dst[i+0x000000], 2); - memcpy(&src[i+0x000002], &dst[i+0x100000], 2); - memcpy(&src[i+0x000100], &dst[i+0x000100], 2); - memcpy(&src[i+0x000102], &dst[i+0x100100], 2); + std::copy(&dst[i+0x000000], &dst[i+0x000002], &src[i+0x000000]); + std::copy(&dst[i+0x100000], &dst[i+0x100002], &src[i+0x000002]); + std::copy(&dst[i+0x000100], &dst[i+0x000102], &src[i+0x000100]); + std::copy(&dst[i+0x100100], &dst[i+0x100102], &src[i+0x000102]); } memmove(&src[0x100000], &src[0x200000], 0x400000); diff --git a/src/devices/bus/neogeo/prot_misc.cpp b/src/devices/bus/neogeo/prot_misc.cpp index d145b78cdfb..35d92ecbcff 100644 --- a/src/devices/bus/neogeo/prot_misc.cpp +++ b/src/devices/bus/neogeo/prot_misc.cpp @@ -22,6 +22,8 @@ #include "emu.h" #include "prot_misc.h" +#include + DEFINE_DEVICE_TYPE(NEOBOOT_PROT, neoboot_prot_device, "ngboot_prot", "Neo Geo Bootleg Protection(s)") @@ -51,10 +53,10 @@ void neoboot_prot_device::cx_decrypt(uint8_t*sprrom, uint32_t sprrom_size) uint8_t *rom = sprrom; std::vector buf(cx_size); - memcpy(&buf[0], rom, cx_size); + std::copy(&rom[0], &rom[cx_size], buf.begin()); for (int i = 0; i < cx_size / 0x40; i++) - memcpy(&rom[i * 0x40], &buf[(i ^ 1) * 0x40], 0x40); + std::copy(&buf[(i ^ 1) * 0x40], &buf[(1+(i ^ 1)) * 0x40], &rom[i * 0x40]); } @@ -66,12 +68,12 @@ void neoboot_prot_device::sx_decrypt(uint8_t* fixed, uint32_t fixed_size, int va if (value == 1) { std::vector buf(sx_size); - memcpy(&buf[0], rom, sx_size); + std::copy(&rom, &rom[sx_size], buf.begin()); for (int i = 0; i < sx_size; i += 0x10) { - memcpy(&rom[i], &buf[i + 8], 8); - memcpy(&rom[i + 8], &buf[i], 8); + std::copy(&buf[i + 8], &buf[i + 16], &rom[i]); + std::copy(&buf[i], &buf[i + 8], &rom[i + 8]); } } else if (value == 2) @@ -93,7 +95,7 @@ void neoboot_prot_device::kof97oro_px_decode(uint8_t* cpurom, uint32_t cpurom_si for (int i = 0; i < 0x500000/2; i++) tmp[i] = src[i ^ 0x7ffef]; - memcpy(src, &tmp[0], 0x500000); + std::copy(tmp.begin(), tmp.end(), src); } @@ -105,17 +107,17 @@ void neoboot_prot_device::kf10thep_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s uint16_t *rom = (uint16_t*)cpurom; std::vector buf(0x100000/2); - memcpy(&buf[0x000000/2], &rom[0x060000/2], 0x20000); - memcpy(&buf[0x020000/2], &rom[0x100000/2], 0x20000); - memcpy(&buf[0x040000/2], &rom[0x0e0000/2], 0x20000); - memcpy(&buf[0x060000/2], &rom[0x180000/2], 0x20000); - memcpy(&buf[0x080000/2], &rom[0x020000/2], 0x20000); - memcpy(&buf[0x0a0000/2], &rom[0x140000/2], 0x20000); - memcpy(&buf[0x0c0000/2], &rom[0x0c0000/2], 0x20000); - memcpy(&buf[0x0e0000/2], &rom[0x1a0000/2], 0x20000); - memcpy(&buf[0x0002e0/2], &rom[0x0402e0/2], 0x6a); // copy banked code to a new memory region - memcpy(&buf[0x0f92bc/2], &rom[0x0492bc/2], 0xb9e); // copy banked code to a new memory region - memcpy(rom, &buf[0], 0x100000); + std::copy(&rom[0x060000/2], &rom[0x080000/2], &buf[0x000000/2]); + std::copy(&rom[0x100000/2], &rom[0x120000/2], &buf[0x020000/2]); + std::copy(&rom[0x0e0000/2], &rom[0x100000/2], &buf[0x040000/2]); + std::copy(&rom[0x180000/2], &rom[0x1a0000/2], &buf[0x060000/2]); + std::copy(&rom[0x020000/2], &rom[0x040000/2], &buf[0x080000/2]); + std::copy(&rom[0x140000/2], &rom[0x160000/2], &buf[0x0a0000/2]); + std::copy(&rom[0x0c0000/2], &rom[0x0e0000/2], &buf[0x0c0000/2]); + std::copy(&rom[0x1a0000/2], &rom[0x1c0000/2], &buf[0x0e0000/2]); + std::copy(&rom[0x0402e0/2], &rom[0x04034a/2], &buf[0x0002e0/2]); // copy banked code to a new memory region + std::copy(&rom[0x0492bc/2], &rom[0x049e5a/2], &buf[0x0f92bc/2]); // copy banked code to a new memory region + std::copy(buf.begin(), buf.end(), &rom[0]); for (int i = 0xf92bc/2; i < 0xf9e58/2; i++) { @@ -140,12 +142,12 @@ void neoboot_prot_device::kf2k5uni_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s for (int j = 0; j < 0x80; j += 2) { int ofst = bitswap<8>(j, 0, 3, 4, 5, 6, 1, 2, 7); - memcpy(&dst[j], src + i + ofst, 2); + std::copy(&src[i + ofst], &src[2 + i + ofst], &dst[j]); } - memcpy(src + i, &dst[0], 0x80); + std::copy(std::begin(dst), std::end(dst), &src[i]); } - memcpy(src, src + 0x600000, 0x100000); // Seems to be the same as kof10th + std::copy(&src[0x600000], &src[0x700000], &src[0]); // Seems to be the same as kof10th } @@ -161,7 +163,7 @@ void neoboot_prot_device::kf2k5uni_mx_decrypt(uint8_t* audiorom, uint32_t audior { uint8_t *mrom = audiorom; - for (int i = 0; i < 0x30000; i++) + for (int i = 0; i < audiorom_size; i++) mrom[i] = bitswap<8>(mrom[i], 4, 5, 6, 7, 0, 1, 2, 3); } @@ -174,10 +176,10 @@ void neoboot_prot_device::decrypt_kof2k4se_68k(uint8_t* cpurom, uint32_t cpurom_ uint8_t *src = cpurom + 0x100000; std::vector dst(0x400000); static const int sec[] = {0x300000,0x200000,0x100000,0x000000}; - memcpy(&dst[0], src, 0x400000); + std::copy(&src[0], &src[0x400000], dst.begin()); for (int i = 0; i < 4; ++i) - memcpy(src + i * 0x100000, &dst[sec[i]], 0x100000); + std::copy(&dst[sec[i]], &dst[sec[i] + 0x100000], src + i * 0x100000); } @@ -200,12 +202,12 @@ void neoboot_prot_device::lans2004_decrypt_68k(uint8_t* cpurom, uint32_t cpurom_ std::vector dst(0x600000); for (int i = 0; i < 8; i++) - memcpy (&dst[i * 0x20000], src + sec[i] * 0x20000, 0x20000); + std::copy(&src[sec[i] * 0x20000], &src[(sec[i]+1) * 0x20000], &dst[i * 0x20000]); - memcpy (&dst[0x0bbb00], src + 0x045b00, 0x001710); - memcpy (&dst[0x02fff0], src + 0x1a92be, 0x000010); - memcpy (&dst[0x100000], src + 0x200000, 0x400000); - memcpy (src, &dst[0], 0x600000); + std::copy(&src[0x045b00], &src[0x047210], &dst[0x0bbb00]); + std::copy(&src[0x1a92be], &src[0x1a92ce], &dst[0x02fff0]); + std::copy(&src[0x200000], &src[0x600000], &dst[0x100000]); + std::copy(dst.begin(), dst.end(), &src[0]); for (int i = 0xbbb00/2; i < 0xbe000/2; i++) { @@ -235,7 +237,7 @@ void neoboot_prot_device::samsho5b_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s uint8_t *rom = cpurom; std::vector buf(px_size); - memcpy(&buf[0], rom, px_size); + std::copy(&rom[0], &rom[px_size], buf.begin()); for (int i = 0; i < px_size / 2; i++) { @@ -243,13 +245,13 @@ void neoboot_prot_device::samsho5b_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s ofst += (i & 0xfffff00); ofst ^= 0x060005; - memcpy(&rom[i * 2], &buf[ofst * 2], 0x02); + std::copy(&buf[ofst * 2], &buf[(ofst+1) * 2], &rom[i * 2]); } - memcpy(&buf[0], rom, px_size); + std::copy(&rom[0], &rom[px_size], buf.begin()); - memcpy(&rom[0x000000], &buf[0x700000], 0x100000); - memcpy(&rom[0x100000], &buf[0x000000], 0x700000); + std::copy(&buf[0x700000], &buf[0x800000], &rom[0x000000]); + std::copy(&buf[0x000000], &buf[0x700000], &rom[0x100000]); } @@ -317,14 +319,14 @@ void neoboot_prot_device::kog_px_decrypt(uint8_t* cpurom, uint32_t cpurom_size) static const int sec[] = { 0x3, 0x8, 0x7, 0xc, 0x1, 0xa, 0x6, 0xd }; for (int i = 0; i < 8; i++) - memcpy (&dst[i * 0x20000], src + sec[i] * 0x20000, 0x20000); + std::copy(&src[sec[i] * 0x20000], &src[(sec[i]+1) * 0x20000], &dst[i * 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[0], 0x600000); + std::copy(&src[0x0407a6], &src[0x0407ac], &dst[0x0007a6]); + std::copy(&src[0x0407c6], &src[0x0407cc], &dst[0x0007c6]); + std::copy(&src[0x0407e6], &src[0x0407ec], &dst[0x0007e6]); + std::copy(&src[0x040000], &src[0x044000], &dst[0x090000]); + std::copy(&src[0x200000], &src[0x600000], &dst[0x100000]); + std::copy(dst.begin(), dst.end(), &src[0]); for (int i = 0x90000/2; i < 0x94000/2; i++) { @@ -377,13 +379,13 @@ void neoboot_prot_device::svcboot_px_decrypt(uint8_t* cpurom, uint32_t cpurom_si std::vector dst(size); for (int i = 0; i < size / 0x100000; i++) - memcpy(&dst[i * 0x100000], &src[sec[i] * 0x100000], 0x100000); + std::copy(&src[sec[i] * 0x100000], &src[(sec[i]+1) * 0x100000], &dst[i * 0x100000]); for (int i = 0; i < size / 2; i++) { int ofst = bitswap<8>((i & 0x0000ff), 7, 6, 1, 0, 3, 2, 5, 4); ofst += (i & 0xffff00); - memcpy(&src[i * 2], &dst[ofst * 2], 0x02); + std::copy(&dst[ofst * 2], &dst[(ofst+1) * 2], &src[i * 2]); } } @@ -402,7 +404,7 @@ void neoboot_prot_device::svcboot_cx_decrypt(uint8_t* sprrom, uint32_t sprrom_si uint8_t *src = sprrom; std::vector dst(size); - memcpy(&dst[0], src, size); + std::copy(&src[0], &src[size], &dst[0]); for (int i = 0; i < size / 0x80; i++) { int idx = idx_tbl[(i & 0xf00) >> 8]; @@ -412,7 +414,7 @@ void neoboot_prot_device::svcboot_cx_decrypt(uint8_t* sprrom, uint32_t sprrom_si int bit3 = bitswap4_tbl[idx][3]; int ofst = bitswap<8>((i & 0x0000ff), 7, 6, 5, 4, bit3, bit2, bit1, bit0); ofst += (i & 0xfffff00); - memcpy(&src[i * 0x80], &dst[ofst * 0x80], 0x80); + std::copy(&dst[ofst * 0x80], &dst[(ofst+1) * 0x80], &src[i * 0x80]); } } @@ -426,7 +428,7 @@ void neoboot_prot_device::svcplus_px_decrypt(uint8_t* cpurom, uint32_t cpurom_si uint8_t *src = cpurom; std::vector dst(size); - memcpy(&dst[0], src, size); + std::copy(&src[0], &src[size], dst.begin()); for (int i = 0; i < size / 2; i++) { int ofst = bitswap<24>((i & 0xfffff), 0x17, 0x16, 0x15, 0x14, 0x13, 0x00, 0x01, 0x02, @@ -434,12 +436,12 @@ void neoboot_prot_device::svcplus_px_decrypt(uint8_t* cpurom, uint32_t cpurom_si 0x07, 0x06, 0x05, 0x04, 0x03, 0x10, 0x11, 0x12); ofst ^= 0x0f0007; ofst += (i & 0xff00000); - memcpy(&src[i * 0x02], &dst[ofst * 0x02], 0x02); + std::copy(&dst[ofst * 0x02], &dst[(ofst+1) * 0x02], &src[i * 0x02]); } - memcpy(&dst[0], src, size); + std::copy(&src[0], &src[size], dst.begin()); for (int i = 0; i < 6; i++) - memcpy(&src[i * 0x100000], &dst[sec[i] * 0x100000], 0x100000); + std::copy(&dst[sec[i] * 0x100000], &dst[(sec[i]+1) * 0x100000], &src[i * 0x100000]); } @@ -460,9 +462,9 @@ void neoboot_prot_device::svcplusa_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s uint8_t *src = cpurom; std::vector dst(size); - memcpy(&dst[0], src, size); + std::copy(&src[0], &src[size], &dst[0]); for (int i = 0; i < 6; i++) - memcpy(&src[i * 0x100000], &dst[sec[i] * 0x100000], 0x100000); + std::copy(&dst[sec[i] * 0x100000], &dst[(sec[i]+1) * 0x100000], &src[i * 0x100000]); } @@ -474,8 +476,8 @@ void neoboot_prot_device::svcsplus_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s int size = cpurom_size; uint8_t *src = cpurom; std::vector dst(size); - - memcpy(&dst[0], src, size); + + std::copy(&src[0], &src[size], &dst[0]); for (int i = 0; i < size / 2; i++) { int ofst = bitswap<16>((i & 0x007fff), 0x0f, 0x00, 0x08, 0x09, 0x0b, 0x0a, 0x0c, 0x0d, @@ -483,7 +485,7 @@ void neoboot_prot_device::svcsplus_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s ofst += (i & 0x078000); ofst += sec[(i & 0xf80000) >> 19] << 19; - memcpy(&src[i * 2], &dst[ofst * 2], 0x02); + std::copy(&dst[ofst * 2], &dst[(ofst+1) * 2], &src[i * 2]); } } @@ -519,13 +521,13 @@ void neoboot_prot_device::kof2002b_gfx_decrypt(uint8_t *src, int size) for (int i = 0; i < size; i += 0x10000) { - memcpy(&dst[0], src + i, 0x10000); + std::copy(&src[i], &src[i+0x10000], dst.begin()); for (int j = 0; j < 0x200; j++) { int n = (j & 0x38) >> 3; int ofst = bitswap<16>(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2], 5, 4, 3, t[n][3], t[n][4], t[n][5]); - memcpy(src + i + ofst * 128, &dst[j * 128], 128); + std::copy(&dst[j * 128], &dst[(j+1) * 128], &src[i + (ofst * 128)]); } } } @@ -545,9 +547,9 @@ void neoboot_prot_device::kf2k2mp_decrypt(uint8_t* cpurom, uint32_t cpurom_size) for (int j = 0; j < 0x80 / 2; j++) { int ofst = bitswap<8>( j, 6, 7, 2, 3, 4, 5, 0, 1 ); - memcpy(dst + j * 2, src + i + ofst * 2, 2); + std::copy(&src[i + (ofst * 2)], &src[i + ((1+ofst) * 2)], &dst[j * 2]); } - memcpy(src + i, dst, 0x80); + std::copy(std::begin(dst), std::end(dst), &src[i]); } } @@ -559,11 +561,11 @@ void neoboot_prot_device::kf2k2mp2_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s uint8_t *src = cpurom; std::vector dst(0x600000); - memcpy(&dst[0x000000], &src[0x1C0000], 0x040000); - memcpy(&dst[0x040000], &src[0x140000], 0x080000); - memcpy(&dst[0x0C0000], &src[0x100000], 0x040000); - memcpy(&dst[0x100000], &src[0x200000], 0x400000); - memcpy(&src[0x000000], &dst[0x000000], 0x600000); + std::copy(&src[0x1c0000], &src[0x200000], &dst[0x000000]); + std::copy(&src[0x140000], &src[0x1c0000], &dst[0x040000]); + std::copy(&src[0x100000], &src[0x140000], &dst[0x0c0000]); + std::copy(&src[0x200000], &src[0x240000], &dst[0x100000]); + std::copy(dst.begin(), dst.end(), &src[0x000000]); } @@ -575,8 +577,8 @@ void neoboot_prot_device::kof10th_decrypt(uint8_t* cpurom, uint32_t cpurom_size) std::vector dst(0x900000); uint8_t *src = cpurom; - memcpy(&dst[0x000000], src + 0x700000, 0x100000); // Correct (Verified in Uni-bios) - memcpy(&dst[0x100000], src + 0x000000, 0x800000); + std::copy(&src[0x700000], &src[0x800000], &dst[0x000000]); // Correct (Verified in Uni-bios) + std::copy(&src[0x000000], &src[0x800000], &dst[0x100000]); for (int i = 0; i < 0x900000; i++) { diff --git a/src/devices/bus/neogeo/prot_pcm2.cpp b/src/devices/bus/neogeo/prot_pcm2.cpp index 82f3175eb8b..9e49b882eb9 100644 --- a/src/devices/bus/neogeo/prot_pcm2.cpp +++ b/src/devices/bus/neogeo/prot_pcm2.cpp @@ -5,6 +5,7 @@ #include "emu.h" #include "prot_pcm2.h" +#include DEFINE_DEVICE_TYPE(NG_PCM2_PROT, pcm2_prot_device, "ng_pcm2_prot", "Neo Geo NEOPCM2 Protection") @@ -45,7 +46,7 @@ void pcm2_prot_device::decrypt(uint8_t* ymrom, uint32_t ymsize, int value) for (int i = 0; i < size / 2; i += (value / 2)) { - memcpy(&buffer[0], &rom[i], value); + std::copy(&rom[i], &rom[i+(value / 2)], buffer.begin()); for (int j = 0; j < (value / 2); j++) { rom[i + j] = buffer[j ^ (value/4)]; @@ -78,7 +79,7 @@ void pcm2_prot_device::swap(uint8_t* ymrom, uint32_t ymsize, int value) std::vector buf(0x1000000); int j, d; uint8_t* src = ymrom; - memcpy(&buf[0], src, 0x1000000); + std::copy(&src[0], &src[0x1000000], buf.begin()); for (int i = 0; i < 0x1000000; i++) { diff --git a/src/devices/bus/neogeo/prot_pvc.cpp b/src/devices/bus/neogeo/prot_pvc.cpp index 8e290596576..75fbd09f31c 100644 --- a/src/devices/bus/neogeo/prot_pvc.cpp +++ b/src/devices/bus/neogeo/prot_pvc.cpp @@ -5,6 +5,8 @@ #include "emu.h" #include "prot_pvc.h" +#include + DEFINE_DEVICE_TYPE(NG_PVC_PROT, pvc_prot_device, "ng_pvc_prot", "Neo Geo PVC Protection") @@ -18,7 +20,8 @@ pvc_prot_device::pvc_prot_device(const machine_config &mconfig, const char *tag, void pvc_prot_device::device_start() { - save_item(NAME(m_cart_ram)); + m_cart_ram = make_unique_clear(0x2000/2); + save_item(NAME(m_cart_ram.get()), 0x2000/2); } void pvc_prot_device::device_reset() @@ -117,21 +120,21 @@ void pvc_prot_device::mslug5_decrypt_68k(uint8_t* rom, uint32_t size) rom[BYTE_XOR_LE(i+2)] = rom16 >> 8; } - memcpy(&buf[0], rom, rom_size); + std::copy(&rom[0], &rom[rom_size], buf.begin()); for (int i = 0; i < 0x0100000 / 0x10000; i++) { int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2); - memcpy(&rom[i * 0x10000], &buf[ofst * 0x10000], 0x10000); + std::copy(&buf[ofst * 0x10000], &buf[(ofst+1) * 0x10000], &rom[i * 0x10000]); } for (int i = 0x100000; i < 0x800000; i += 0x100) { int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00700) + (bitswap<8>(((i & 0x0ff000) >> 12), 5, 4, 7, 6, 1, 0, 3, 2) << 12); - memcpy(&rom[i], &buf[ofst], 0x100); + std::copy(&buf[ofst], &buf[(ofst+0x100)], &rom[i]); } - memcpy(&buf[0], rom, rom_size); - memcpy(&rom[0x100000], &buf[0x700000], 0x100000); - memcpy(&rom[0x200000], &buf[0x100000], 0x600000); + std::copy(&rom[0x000000], &rom[rom_size], buf.begin()); + std::copy(&buf[0x700000], &buf[0x800000], &rom[0x100000]); + std::copy(&buf[0x100000], &buf[0x700000], &rom[0x200000]); } @@ -156,21 +159,21 @@ void pvc_prot_device::svc_px_decrypt(uint8_t* rom, uint32_t size) rom[BYTE_XOR_LE(i+2)] = rom16 >> 8; } - memcpy(&buf[0], rom, rom_size); + std::copy(&rom[0], &rom[rom_size], buf.begin()); for (int i = 0; i < 0x0100000 / 0x10000; i++) { int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1); - memcpy(&rom[i * 0x10000], &buf[ofst * 0x10000], 0x10000); + std::copy(&buf[ofst * 0x10000], &buf[(ofst+1) * 0x10000], &rom[i * 0x10000]); } for (int i = 0x100000; i < 0x800000; i += 0x100) { int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00a00) + (bitswap<8>(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12); - memcpy(&rom[i], &buf[ofst], 0x100); + std::copy(&buf[ofst], &buf[(ofst+0x100)], &rom[i]); } - memcpy(&buf[0], rom, rom_size ); - memcpy(&rom[0x100000], &buf[0x700000], 0x100000); - memcpy(&rom[0x200000], &buf[0x100000], 0x600000); + std::copy(&rom[0x000000], &rom[rom_size], buf.begin()); + std::copy(&buf[0x700000], &buf[0x800000], &rom[0x100000]); + std::copy(&buf[0x100000], &buf[0x700000], &rom[0x200000]); } @@ -197,17 +200,17 @@ void pvc_prot_device::kf2k3pcb_decrypt_68k(uint8_t* rom, uint32_t size) for (int i = 0; i < 0x0100000 / 0x10000; i++) { int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2); - memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000); + std::copy(&buf[ofst * 0x10000], &buf[(ofst+1) * 0x10000], &rom[i * 0x10000]); } for (int i = 0x100000; i < 0x900000; i += 0x100) { int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00300) + (bitswap<8>(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12); - memcpy(&buf[i], &rom[ofst], 0x100); + std::copy(&buf[ofst], &buf[(ofst+0x100)], &rom[i]); } - memcpy(&rom[0x000000], &buf[0x000000], 0x100000); - memcpy(&rom[0x100000], &buf[0x800000], 0x100000); - memcpy(&rom[0x200000], &buf[0x100000], 0x700000); + std::copy(&buf[0x000000], &buf[0x100000], &rom[0x000000]); + std::copy(&buf[0x800000], &buf[0x900000], &rom[0x100000]); + std::copy(&buf[0x100000], &buf[0x800000], &rom[0x200000]); } @@ -238,17 +241,17 @@ void pvc_prot_device::kof2003_decrypt_68k(uint8_t* rom, uint32_t size) for (int i = 0; i < 0x0100000 / 0x10000; i++) { int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 0, 1, 2, 3); - memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000); + std::copy(&buf[ofst * 0x10000], &buf[(ofst+1) * 0x10000], &rom[i * 0x10000]); } for (int i = 0x100000; i < 0x900000; i += 0x100) { int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00800) + (bitswap<8>(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12); - memcpy(&buf[i], &rom[ofst], 0x100); + std::copy(&buf[ofst], &buf[(ofst+0x100)], &rom[i]); } - memcpy(&rom[0x000000], &buf[0x000000], 0x100000); - memcpy(&rom[0x100000], &buf[0x800000], 0x100000); - memcpy(&rom[0x200000], &buf[0x100000], 0x700000); + std::copy(&buf[0x000000], &buf[0x100000], &rom[0x000000]); + std::copy(&buf[0x800000], &buf[0x900000], &rom[0x100000]); + std::copy(&buf[0x100000], &buf[0x800000], &rom[0x200000]); } @@ -279,14 +282,14 @@ void pvc_prot_device::kof2003h_decrypt_68k(uint8_t* rom, uint32_t size) for (int i = 0; i < 0x0100000 / 0x10000; i++) { int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2); - memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000); + std::copy(&buf[ofst * 0x10000], &buf[(ofst+1) * 0x10000], &rom[i * 0x10000]); } for (int i = 0x100000; i < 0x900000; i += 0x100) { int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00400) + (bitswap<8>(((i & 0x0ff000) >> 12), 6, 7, 4, 5, 0, 1, 2, 3) << 12); - memcpy(&buf[i], &rom[ofst], 0x100); + std::copy(&buf[ofst], &buf[(ofst+0x100)], &rom[i]); } - memcpy(&rom[0x000000], &buf[0x000000], 0x100000); - memcpy(&rom[0x100000], &buf[0x800000], 0x100000); - memcpy(&rom[0x200000], &buf[0x100000], 0x700000); + std::copy(&buf[0x000000], &buf[0x100000], &rom[0x000000]); + std::copy(&buf[0x800000], &buf[0x900000], &rom[0x100000]); + std::copy(&buf[0x100000], &buf[0x800000], &rom[0x200000]); } diff --git a/src/devices/bus/neogeo/prot_pvc.h b/src/devices/bus/neogeo/prot_pvc.h index 4f7d73f4020..cf8f314f7c1 100644 --- a/src/devices/bus/neogeo/prot_pvc.h +++ b/src/devices/bus/neogeo/prot_pvc.h @@ -25,7 +25,7 @@ public: DECLARE_READ16_MEMBER(protection_r); DECLARE_WRITE16_MEMBER(protection_w); - uint16_t m_cart_ram[0x1000]; + std::unique_ptr m_cart_ram; void mslug5_decrypt_68k(uint8_t* rom, uint32_t size); void svc_px_decrypt(uint8_t* rom, uint32_t size); diff --git a/src/devices/bus/neogeo/prot_sma.cpp b/src/devices/bus/neogeo/prot_sma.cpp index bfd15ab208a..3f561e33336 100644 --- a/src/devices/bus/neogeo/prot_sma.cpp +++ b/src/devices/bus/neogeo/prot_sma.cpp @@ -4,6 +4,7 @@ #include "emu.h" #include "prot_sma.h" +#include DEFINE_DEVICE_TYPE(NG_SMA_PROT, sma_prot_device, "ng_sma_prot", "Neo Geo SMA Protection") @@ -403,8 +404,8 @@ void sma_prot_device::kof99_decrypt_68k(uint8_t* base) // swap address lines for the banked part for (int i = 0; i < 0x600000/2; i += 0x800/2) { - uint16_t buffer[0x800/2]; - memcpy(buffer, &rom[i], 0x800); + std::vector buffer(0x800/2); + std::copy(&rom[i], &rom[i+(0x800/2)], buffer.begin()); for (int j = 0; j < 0x800/2; j++) rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,6,2,4,9,8,3,1,7,0,5)]; } @@ -434,8 +435,8 @@ void sma_prot_device::garou_decrypt_68k(uint8_t* base) rom = (uint16_t *)(base + 0x100000); for (int i = 0; i < 0x800000/2; i += 0x8000/2) { - uint16_t buffer[0x8000/2]; - memcpy(buffer, &rom[i], 0x8000); + std::vector buffer(0x8000/2); + std::copy(&rom[i], &rom[i+(0x8000/2)], buffer.begin()); for (int j = 0; j < 0x8000/2; j++) rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,9,4,8,3,13,6,2,7,0,12,1,11,10,5)]; } @@ -460,8 +461,8 @@ void sma_prot_device::garouh_decrypt_68k(uint8_t* base) rom = (uint16_t *)(base + 0x100000); for (int i = 0; i < 0x800000/2; i += 0x8000/2) { - uint16_t buffer[0x8000/2]; - memcpy(buffer, &rom[i], 0x8000); + std::vector buffer(0x8000/2); + std::copy(&rom[i], &rom[i+(0x8000/2)], buffer.begin()); for (int j = 0; j < 0x8000/2; j++) rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,12,8,1,7,11,3,13,10,6,9,5,4,0,2)]; } @@ -486,8 +487,8 @@ void sma_prot_device::mslug3_decrypt_68k(uint8_t* base) rom = (uint16_t *)(base + 0x100000); for (int i = 0; i < 0x800000/2; i += 0x10000/2) { - uint16_t buffer[0x10000/2]; - memcpy(buffer, &rom[i], 0x10000); + std::vector buffer(0x10000/2); + std::copy(&rom[i], &rom[i+(0x10000/2)], buffer.begin()); for (int j = 0; j < 0x10000/2; j++) rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,2,11,0,14,6,4,13,8,9,3,10,7,5,12,1)]; } @@ -506,8 +507,8 @@ void sma_prot_device::kof2000_decrypt_68k(uint8_t* base) // swap address lines for the banked part for (int i = 0; i < 0x63a000/2; i += 0x800/2) { - uint16_t buffer[0x800/2]; - memcpy(buffer, &rom[i], 0x800); + std::vector buffer(0x800/2); + std::copy(&rom[i], &rom[i+(0x800/2)], buffer.begin()); for (int j = 0; j < 0x800/2; j++) rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,4,1,3,8,6,2,7,0,9,5)]; } diff --git a/src/devices/bus/neogeo/pvc.cpp b/src/devices/bus/neogeo/pvc.cpp index bb9d0098159..ac90379ee58 100644 --- a/src/devices/bus/neogeo/pvc.cpp +++ b/src/devices/bus/neogeo/pvc.cpp @@ -72,7 +72,7 @@ void neogeo_pvc_mslug5_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_pvc_prot->mslug5_decrypt_68k(cpuregion, cpuregion_size); m_pcm2_prot->swap(ym_region, ym_region_size, 2); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MSLUG5_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); } @@ -92,7 +92,7 @@ void neogeo_pvc_svc_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_pvc_prot->svc_px_decrypt(cpuregion, cpuregion_size); m_pcm2_prot->swap(ym_region, ym_region_size, 3); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, SVC_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); } @@ -113,7 +113,7 @@ void neogeo_pvc_kof2003_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_pvc_prot->kof2003_decrypt_68k(cpuregion, cpuregion_size); m_pcm2_prot->swap(ym_region, ym_region_size, 5); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2003_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); } @@ -133,7 +133,7 @@ void neogeo_pvc_kof2003h_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_pvc_prot->kof2003h_decrypt_68k(cpuregion, cpuregion_size); m_pcm2_prot->swap(ym_region, ym_region_size, 5); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2003_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); } diff --git a/src/devices/bus/neogeo/rom.cpp b/src/devices/bus/neogeo/rom.cpp index 10c61858386..69e5bd81ae5 100644 --- a/src/devices/bus/neogeo/rom.cpp +++ b/src/devices/bus/neogeo/rom.cpp @@ -80,10 +80,11 @@ neogeo_vliner_cart_device::neogeo_vliner_cart_device(const machine_config &mconf void neogeo_vliner_cart_device::device_start() { - save_item(NAME(m_cart_ram)); + m_cart_ram = std::make_unique(0x2000/2); + save_pointer(NAME(m_cart_ram.get()), 0x2000/2); } void neogeo_vliner_cart_device::device_reset() { - memset(m_cart_ram, 0, 0x2000); + std::fill(&m_cart_ram[0], &m_cart_ram[0x2000/2], 0); } diff --git a/src/devices/bus/neogeo/rom.h b/src/devices/bus/neogeo/rom.h index 17efc4da4a7..9c5ade7ed27 100644 --- a/src/devices/bus/neogeo/rom.h +++ b/src/devices/bus/neogeo/rom.h @@ -53,7 +53,7 @@ protected: virtual void device_reset() override; private: - uint16_t m_cart_ram[0x1000]; + std::unique_ptr m_cart_ram; }; DECLARE_DEVICE_TYPE(NEOGEO_VLINER_CART, neogeo_vliner_cart_device) diff --git a/src/devices/bus/neogeo/slot.cpp b/src/devices/bus/neogeo/slot.cpp index df57d410ea7..feb14aab79f 100644 --- a/src/devices/bus/neogeo/slot.cpp +++ b/src/devices/bus/neogeo/slot.cpp @@ -25,7 +25,6 @@ device_neogeo_cart_interface::device_neogeo_cart_interface(const machine_config m_region_rom(*this, "^maincpu"), m_region_fixed(*this, "^fixed"), m_region_audio(*this, "^audiocpu"), - m_region_audiocrypt(*this, "^audiocrypt"), m_region_spr(*this, "^sprites"), m_region_ym(*this, "^ymsnd"), m_region_ymd(*this, "^ymsnd.deltat") @@ -251,10 +250,9 @@ image_init_result neogeo_cart_slot_device::call_load() if (get_software_region("audiocpu") != nullptr) { len = get_software_region_length("audiocpu"); - m_cart->audio_alloc(len + 0x10000); + m_cart->audio_alloc(len); ROM8 = m_cart->get_audio_base(); memcpy(ROM8, get_software_region("audiocpu"), len); - memcpy(ROM8 + 0x10000, get_software_region("audiocpu"), len); // avoid reloading in XML, should just improve banking instead tho? } len = get_software_region_length("ymsnd"); @@ -280,24 +278,13 @@ image_init_result neogeo_cart_slot_device::call_load() ROM8 = m_cart->get_sprites_base(); memcpy(ROM8, get_software_region("sprites"), len); - if (get_software_region("audiocrypt") != nullptr) // encrypted Z80 code - { - len = get_software_region_length("audiocrypt"); - m_cart->audiocrypt_alloc(len); - ROM8 = m_cart->get_audiocrypt_base(); - memcpy(ROM8, get_software_region("audiocrypt"), len); - // allocate the audiocpu region to decrypt data into - m_cart->audio_alloc(len + 0x10000); - } - m_cart->decrypt_all( (uint8_t*)m_cart->get_rom_base(), m_cart->get_rom_size(), m_cart->get_sprites_base(), m_cart->get_sprites_size(), m_cart->get_fixed_base(), m_cart->get_fixed_size(), m_cart->get_ym_base(), m_cart->get_ym_size(), m_cart->get_ymdelta_base(), m_cart->get_ymdelta_size(), - m_cart->get_audio_base(), m_cart->get_audio_size(), - m_cart->get_audiocrypt_base(), m_cart->get_audiocrypt_size()); + m_cart->get_audio_base(), m_cart->get_audio_size()); // SPEED UP WORKAROUND: to speed up sprite drawing routine, let us store the sprite data in // a different format (we then always access such alt format for drawing) diff --git a/src/devices/bus/neogeo/slot.h b/src/devices/bus/neogeo/slot.h index a90c529eea9..98e6f3be85e 100644 --- a/src/devices/bus/neogeo/slot.h +++ b/src/devices/bus/neogeo/slot.h @@ -82,7 +82,7 @@ enum // ======================> device_neogeo_cart_interface #define DECRYPT_ALL_PARAMS \ - uint8_t* cpuregion, uint32_t cpuregion_size,uint8_t* spr_region, uint32_t spr_region_size,uint8_t* fix_region, uint32_t fix_region_size,uint8_t* ym_region, uint32_t ym_region_size,uint8_t* ymdelta_region, uint32_t ymdelta_region_size,uint8_t* audiocpu_region, uint32_t audio_region_size, uint8_t* audiocrypt_region, uint32_t audiocrypt_region_size + uint8_t* cpuregion, uint32_t cpuregion_size,uint8_t* spr_region, uint32_t spr_region_size,uint8_t* fix_region, uint32_t fix_region_size,uint8_t* ym_region, uint32_t ym_region_size,uint8_t* ymdelta_region, uint32_t ymdelta_region_size,uint8_t* audiocpu_region, uint32_t audio_region_size class device_neogeo_cart_interface : public device_slot_card_interface { @@ -123,12 +123,6 @@ public: uint8_t* get_region_audio_base() { if (m_region_audio.found()) return m_region_audio->base(); return nullptr; } uint32_t get_region_audio_size() { if (m_region_audio.found()) return m_region_audio->bytes(); return 0; } - void audiocrypt_alloc(uint32_t size) { m_audiocrypt.resize(size); } - uint8_t* get_audiocrypt_base() { return m_audiocrypt.size() > 0 ? &m_audiocrypt[0] : nullptr; } - uint32_t get_audiocrypt_size() { return m_audiocrypt.size(); } - uint8_t* get_region_audiocrypt_base() { if (m_region_audiocrypt.found()) return m_region_audiocrypt->base(); return nullptr; } - uint32_t get_region_audiocrypt_size() { if (m_region_audiocrypt.found()) return m_region_audiocrypt->bytes(); return 0; } - // TODO: review sprite code later!! void sprites_alloc(uint32_t size) { m_sprites.resize(size); } uint8_t* get_sprites_base() { return m_sprites.size() > 0 ? &m_sprites[0] : nullptr; } @@ -164,7 +158,6 @@ protected: std::vector m_sprites; std::vector m_ym; std::vector m_ymdelta; - std::vector m_audiocrypt; std::vector m_sprites_opt; @@ -172,7 +165,6 @@ protected: optional_memory_region m_region_rom; optional_memory_region m_region_fixed; optional_memory_region m_region_audio; - optional_memory_region m_region_audiocrypt; optional_memory_region m_region_spr; optional_memory_region m_region_ym; optional_memory_region m_region_ymd; @@ -269,18 +261,6 @@ public: } return 0; } - uint8_t* get_audiocrypt_base() { - if (m_cart) { - if (!user_loadable()) return m_cart->get_region_audiocrypt_base(); else return m_cart->get_audiocrypt_base(); - } - return nullptr; - } - uint32_t get_audiocrypt_size() { - if (m_cart) { - if (!user_loadable()) return m_cart->get_region_audiocrypt_size(); else return m_cart->get_audiocrypt_size(); - } - return 0; - } uint8_t* get_ym_base() { if (m_cart) { if (!user_loadable()) return m_cart->get_region_ym_base(); else return m_cart->get_ym_base(); @@ -320,8 +300,7 @@ public: get_fixed_base(), get_fixed_size(), get_ym_base(), get_ym_size(), get_ymdelta_base(), get_ymdelta_size(), - get_audio_base(), get_audio_size(), - get_audiocrypt_base(), get_audiocrypt_size()); } + get_audio_base(), get_audio_size()); } protected: diff --git a/src/devices/bus/neogeo/sma.cpp b/src/devices/bus/neogeo/sma.cpp index 500b88eb7a1..a07b1193a9d 100644 --- a/src/devices/bus/neogeo/sma.cpp +++ b/src/devices/bus/neogeo/sma.cpp @@ -140,7 +140,7 @@ neogeo_sma_kof2000_cart_device::neogeo_sma_kof2000_cart_device(const machine_con void neogeo_sma_kof2000_cart_device::decrypt_all(DECRYPT_ALL_PARAMS) { m_sma_prot->kof2000_decrypt_68k(cpuregion); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2000_GFX_KEY); m_cmc_prot->sfix_decrypt(spr_region, spr_region_size, fix_region, fix_region_size); } diff --git a/src/mame/drivers/neogeo.cpp b/src/mame/drivers/neogeo.cpp index 2beea494fd1..44cfaffacef 100644 --- a/src/mame/drivers/neogeo.cpp +++ b/src/mame/drivers/neogeo.cpp @@ -624,16 +624,10 @@ void neogeo_state::start_interrupt_timers() * *************************************/ -void neogeo_state::audio_cpu_check_nmi() -{ - m_audiocpu->set_input_line(INPUT_LINE_NMI, (m_audio_cpu_nmi_enabled && m_audio_cpu_nmi_pending) ? ASSERT_LINE : CLEAR_LINE); -} - WRITE8_MEMBER(neogeo_state::audio_cpu_enable_nmi_w) { // out ($08) enables the nmi, out ($18) disables it - m_audio_cpu_nmi_enabled = !(offset & 0x10); - audio_cpu_check_nmi(); + m_soundnmi->in_w<1>((offset & 0x10) ? 0 : 1); } @@ -646,12 +640,12 @@ WRITE8_MEMBER(neogeo_state::audio_cpu_enable_nmi_w) READ16_MEMBER(neogeo_state::in0_r) { - return ((m_edge->in0_r(space, offset) & m_ctrl1->ctrl_r(space, offset)) << 8) | m_dsw->read(); + return ((m_edge->in0_r(space, offset) & m_ctrl[0]->ctrl_r(space, offset)) << 8) | m_dsw->read(); } READ16_MEMBER(neogeo_state::in1_r) { - return ((m_edge->in1_r(space, offset) & m_ctrl2->ctrl_r(space, offset)) << 8) | 0xff; + return ((m_edge->in1_r(space, offset) & m_ctrl[1]->ctrl_r(space, offset)) << 8) | 0xff; } CUSTOM_INPUT_MEMBER(neogeo_state::kizuna4p_start_r) @@ -664,8 +658,8 @@ WRITE8_MEMBER(neogeo_state::io_control_w) switch (offset) { case 0x00: - if (m_ctrl1) m_ctrl1->write_ctrlsel(data); - if (m_ctrl2) m_ctrl2->write_ctrlsel(data); + if (m_ctrl[0]) m_ctrl[0]->write_ctrlsel(data); + if (m_ctrl[1]) m_ctrl[1]->write_ctrlsel(data); if (m_edge) m_edge->write_ctrlsel(data); break; @@ -800,30 +794,15 @@ WRITE16_MEMBER(neogeo_state::memcard_w) WRITE8_MEMBER(neogeo_state::audio_command_w) { - m_soundlatch->write(space, 0, data); - - m_audio_cpu_nmi_pending = true; - audio_cpu_check_nmi(); - + m_soundlatch[0]->write(space, 0, data); /* boost the interleave to let the audio CPU read the command */ machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); } -READ8_MEMBER(neogeo_state::audio_command_r) -{ - uint8_t ret = m_soundlatch->read(space, 0); - - m_audio_cpu_nmi_pending = false; - audio_cpu_check_nmi(); - - return ret; -} - - CUSTOM_INPUT_MEMBER(neogeo_state::get_audio_result) { - uint8_t ret = m_soundlatch2->read(m_audiocpu->space(AS_PROGRAM), 0); + uint8_t ret = m_soundlatch[1]->read(m_audiocpu->space(AS_PROGRAM), 0); return ret; } @@ -1013,10 +992,9 @@ WRITE16_MEMBER(neogeo_state::write_bankprot_kof10th) READ16_MEMBER(neogeo_state::read_lorom_kof10th) { - uint16_t* rom = (m_slots[m_curr_slot] && m_slots[m_curr_slot]->get_rom_size() > 0) ? m_slots[m_curr_slot]->get_rom_base() : (uint16_t*)m_region_maincpu->base(); if (offset + 0x80/2 >= 0x10000/2) offset += m_slots[m_curr_slot]->get_special_bank(); - return rom[offset + 0x80/2]; + return m_lorom[offset + 0x80/2]; } /************************************* @@ -1027,6 +1005,7 @@ READ16_MEMBER(neogeo_state::read_lorom_kof10th) void neogeo_state::init_cpu() { + m_lorom = (m_slots[m_curr_slot] && m_slots[m_curr_slot]->get_rom_size() > 0) ? m_slots[m_curr_slot]->get_rom_base() : (uint16_t*)m_region_maincpu->base(); uint8_t *ROM = (!m_slots[m_curr_slot] || m_slots[m_curr_slot]->get_rom_size() == 0) ? m_region_maincpu->base() : (uint8_t *)m_slots[m_curr_slot]->get_rom_base(); uint32_t len = (!m_slots[m_curr_slot] || m_slots[m_curr_slot]->get_rom_size() == 0) ? m_region_maincpu->bytes() : m_slots[m_curr_slot]->get_rom_size(); @@ -1055,13 +1034,16 @@ void neogeo_state::init_audio() m_bank_audio_cart[2] = membank("audio_c000"); m_bank_audio_cart[3] = membank("audio_8000"); - address_mask = (len - 0x10000 - 1) & 0x3ffff; for (int region = 0; region < 4; region++) { - for (int bank = 0xff; bank >= 0; bank--) + int bankind = 0; + int bankshift = 11 + region; + int max_bank = len >> bankshift; + int banksize = 1 << bankshift; + while (bankind < (0x100 >> region)) { - uint32_t bank_address = 0x10000 + ((bank << (11 + region)) & address_mask); - m_bank_audio_cart[region]->configure_entry(bank, &ROM[bank_address]); + m_bank_audio_cart[region]->configure_entries(bankind, max_bank, ROM, banksize); + bankind += max_bank; } } @@ -1299,8 +1281,6 @@ void neogeo_state::common_machine_start() save_item(NAME(m_vblank_interrupt_pending)); save_item(NAME(m_display_position_interrupt_pending)); save_item(NAME(m_irq3_pending)); - save_item(NAME(m_audio_cpu_nmi_enabled)); - save_item(NAME(m_audio_cpu_nmi_pending)); save_item(NAME(m_curr_slot)); save_item(NAME(m_bank_base)); save_item(NAME(m_use_cart_vectors)); @@ -1331,12 +1311,8 @@ void neogeo_state::machine_start() m_upd4990a->c1_w(1); m_upd4990a->c2_w(1); - if (m_slot1) { m_slots[0] = m_slot1; } else { m_slots[0] = nullptr; } - if (m_slot2) { m_slots[1] = m_slot2; } else { m_slots[1] = nullptr; } - if (m_slot3) { m_slots[2] = m_slot3; } else { m_slots[2] = nullptr; } - if (m_slot4) { m_slots[3] = m_slot4; } else { m_slots[3] = nullptr; } - if (m_slot5) { m_slots[4] = m_slot5; } else { m_slots[4] = nullptr; } - if (m_slot6) { m_slots[5] = m_slot6; } else { m_slots[5] = nullptr; } + for (int slot = 0; slot < 6; slot++) + if (m_slot[slot]) { m_slots[slot] = m_slot[slot]; } else { m_slots[slot] = nullptr; } m_sprgen->m_fixed_layer_bank_type = 0; m_sprgen->set_screen(m_screen); @@ -1368,9 +1344,7 @@ void neogeo_state::neogeo_postload() void neogeo_state::machine_reset() { // disable audiocpu nmi - m_audio_cpu_nmi_enabled = false; - m_audio_cpu_nmi_pending = false; - audio_cpu_check_nmi(); + m_soundnmi->in_w<1>(0); m_maincpu->reset(); @@ -1392,15 +1366,13 @@ void neogeo_state::machine_reset() READ16_MEMBER(neogeo_state::banked_vectors_r) { - if (!m_use_cart_vectors) + if ((!m_use_cart_vectors) && (m_biosrom.found())) { - uint16_t* bios = (uint16_t*)m_region_mainbios->base(); - return bios[offset]; + return m_biosrom[offset]; } else { - uint16_t* rom = (m_slots[m_curr_slot] && m_slots[m_curr_slot]->get_rom_size() > 0) ? m_slots[m_curr_slot]->get_rom_base() : (uint16_t*)m_region_maincpu->base(); - return rom[offset]; + return m_lorom[offset]; } } @@ -1443,8 +1415,8 @@ ADDRESS_MAP_END READ16_MEMBER(aes_state::aes_in2_r) { uint32_t ret = m_io_in2->read(); - ret = (ret & 0xfcff) | (m_ctrl1->read_start_sel() << 8); - ret = (ret & 0xf3ff) | (m_ctrl2->read_start_sel() << 10); + ret = (ret & 0xfcff) | (m_ctrl[0]->read_start_sel() << 8); + ret = (ret & 0xf3ff) | (m_ctrl[1]->read_start_sel() << 10); return ret; } @@ -1494,7 +1466,7 @@ ADDRESS_MAP_END *************************************/ ADDRESS_MAP_START(neogeo_state::audio_io_map) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READ(audio_command_r) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_DEVREADWRITE("soundlatch1", generic_latch_8_device, read, clear_w) AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write) AM_RANGE(0x08, 0x08) AM_MIRROR(0xff00) AM_SELECT(0x0010) AM_WRITE(audio_cpu_enable_nmi_w) AM_RANGE(0x08, 0x0b) AM_MIRROR(0x00f0) AM_SELECT(0xff00) AM_READ(audio_cpu_bank_select_r) @@ -1616,6 +1588,9 @@ MACHINE_CONFIG_START(neogeo_state::neogeo_base) MCFG_CPU_PROGRAM_MAP(audio_map) MCFG_CPU_IO_MAP(audio_io_map) + MCFG_INPUT_MERGER_ALL_HIGH("soundnmi") + MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) + MCFG_DEVICE_ADD("systemlatch", HC259, 0) MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(neogeo_state, set_screen_shadow)) MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(neogeo_state, set_use_cart_vectors)) @@ -1641,7 +1616,9 @@ MACHINE_CONFIG_START(neogeo_state::neogeo_base) /* audio hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") - MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch1") + MCFG_GENERIC_LATCH_DATA_PENDING_CB(DEVWRITELINE("soundnmi", input_merger_all_high_device, in_w<0>)) + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") MCFG_SOUND_ADD("ymsnd", YM2610, NEOGEO_YM2610_CLOCK) @@ -1736,7 +1713,7 @@ MACHINE_START_MEMBER(aes_state, aes) m_type = NEOGEO_AES; common_machine_start(); - m_slots[0] = m_slot1; + m_slots[0] = m_slot[0]; m_slots[1] = nullptr; m_slots[2] = nullptr; m_slots[3] = nullptr; @@ -1876,66 +1853,35 @@ MACHINE_CONFIG_END NEOGEO_BIOS \ ROM_REGION( 0x20000, "audiobios", 0 ) \ ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \ - ROM_REGION( 0x20000, "cslot1:audiocpu", 0 ) \ - ROM_LOAD( name, 0x00000, 0x10000, hash ) \ - ROM_RELOAD( 0x10000, 0x10000 ) \ + ROM_REGION( 0x10000, "cslot1:audiocpu", 0 ) \ + ROM_LOAD( name, 0x00000, 0x10000, hash ) ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF ) #define NEO_BIOS_AUDIO_128K(name, hash) \ NEOGEO_BIOS \ ROM_REGION( 0x20000, "audiobios", 0 ) \ ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \ - ROM_REGION( 0x30000, "cslot1:audiocpu", 0 ) \ - ROM_LOAD( name, 0x00000, 0x20000, hash ) \ - ROM_RELOAD( 0x10000, 0x20000 ) \ + ROM_REGION( 0x20000, "cslot1:audiocpu", 0 ) \ + ROM_LOAD( name, 0x00000, 0x20000, hash ) ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF ) #define NEO_BIOS_AUDIO_256K(name, hash) \ NEOGEO_BIOS \ ROM_REGION( 0x20000, "audiobios", 0 ) \ ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \ - ROM_REGION( 0x50000, "cslot1:audiocpu", 0 ) \ - ROM_LOAD( name, 0x00000, 0x40000, hash ) \ - ROM_RELOAD( 0x10000, 0x40000 ) \ + ROM_REGION( 0x40000, "cslot1:audiocpu", 0 ) \ + ROM_LOAD( name, 0x00000, 0x40000, hash ) ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF ) #define NEO_BIOS_AUDIO_512K(name, hash) \ NEOGEO_BIOS \ ROM_REGION( 0x20000, "audiobios", 0 ) \ ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \ - ROM_REGION( 0x90000, "cslot1:audiocpu", 0 ) \ - ROM_LOAD( name, 0x00000, 0x80000, hash ) \ - ROM_RELOAD( 0x10000, 0x80000 ) \ + ROM_REGION( 0x80000, "cslot1:audiocpu", 0 ) \ + ROM_LOAD( name, 0x00000, 0x80000, hash ) ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF ) -#define NEO_BIOS_AUDIO_ENCRYPTED_128K(name, hash) \ - NEOGEO_BIOS \ - ROM_REGION( 0x20000, "audiobios", 0 ) \ - ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \ - ROM_REGION( 0x90000, "cslot1:audiocpu", ROMREGION_ERASEFF ) \ - ROM_REGION( 0x80000, "cslot1:audiocrypt", 0 ) \ - ROM_LOAD( name, 0x00000, 0x20000, hash ) \ - ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF ) -#define NEO_BIOS_AUDIO_ENCRYPTED_256K(name, hash) \ - NEOGEO_BIOS \ - ROM_REGION( 0x20000, "audiobios", 0 ) \ - ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \ - ROM_REGION( 0x90000, "cslot1:audiocpu", ROMREGION_ERASEFF ) \ - ROM_REGION( 0x80000, "cslot1:audiocrypt", 0 ) \ - ROM_LOAD( name, 0x00000, 0x40000, hash ) \ - ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF ) -#define NEO_BIOS_AUDIO_ENCRYPTED_512K(name, hash) \ - NEOGEO_BIOS \ - ROM_REGION( 0x20000, "audiobios", 0 ) \ - ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) \ - ROM_REGION( 0x90000, "cslot1:audiocpu", ROMREGION_ERASEFF ) \ - ROM_REGION( 0x80000, "cslot1:audiocrypt", 0 ) \ - ROM_LOAD( name, 0x00000, 0x80000, hash ) \ - ROM_REGION( 0x10000, "ymsnd", ROMREGION_ERASEFF ) - - - #define NEO_SFIX_64K(name, hash) \ ROM_REGION( 0x20000, "cslot1:fixed", 0 ) \ ROM_LOAD( name, 0x000000, 0x10000, hash ) \ @@ -1965,7 +1911,7 @@ ROM_START( neogeo ) ROM_REGION( 0x20000, "audiobios", 0 ) ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) - ROM_REGION( 0x50000, "audiocpu", 0 ) + ROM_REGION( 0x20000, "audiocpu", 0 ) ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(94416d67) SHA1(42f9d7ddd6c0931fd64226a60dc73602b2819dcf) ) ROM_Y_ZOOM @@ -1993,7 +1939,7 @@ ROM_START( aes ) ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASEFF ) - ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x80000, "audiocpu", ROMREGION_ERASEFF ) ROM_REGION( 0x20000, "zoomy", 0 ) ROM_LOAD( "000-lo.lo", 0x00000, 0x20000, CRC(5a86cff2) SHA1(5992277debadeb64d1c1c64b0a92d9293eaf7e4a) ) @@ -2004,7 +1950,7 @@ ROM_START( aes ) ROM_REGION( 0x1000000, "ymsnd.deltat", ROMREGION_ERASEFF ) - ROM_REGION( 0x900000, "sprites", ROMREGION_ERASEFF ) + ROM_REGION( 0x800000, "sprites", ROMREGION_ERASEFF ) ROM_END @@ -2012,9 +1958,9 @@ ROM_END DRIVER_INIT_MEMBER(neogeo_state, neogeo) { // install controllers - if (m_ctrl1) + if (m_ctrl[0]) m_maincpu->space(AS_PROGRAM).install_read_handler(0x300000, 0x300001, 0, 0x01ff7e, 0, read16_delegate(FUNC(neogeo_state::in0_r), this)); - if (m_ctrl2) + if (m_ctrl[1]) m_maincpu->space(AS_PROGRAM).install_read_handler(0x340000, 0x340001, 0, 0x01fffe, 0, read16_delegate(FUNC(neogeo_state::in1_r), this)); } @@ -2386,7 +2332,6 @@ MACHINE_CONFIG_START(neogeo_state::sbp) MACHINE_CONFIG_END - /************************************* * * Official sets @@ -8415,7 +8360,7 @@ ROM_START( kof2000 ) /* Original Version, Encrypted Code + Sound + GFX Roms */ / ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_256K( "257-m1.m1", CRC(4b749113) SHA1(2af2361146edd0ce3966614d90165a5c1afb8de4) ) /* mask rom TC532000 */ + NEO_BIOS_AUDIO_256K( "257-m1.m1", CRC(4b749113) SHA1(2af2361146edd0ce3966614d90165a5c1afb8de4) ) /* mask rom TC532000 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) ROM_LOAD( "257-v1.v1", 0x000000, 0x400000, CRC(17cde847) SHA1(4bcc0205b70dc6d9216b29025450c9c5b08cb65d) ) /* TC5332204 */ @@ -8448,7 +8393,7 @@ ROM_START( kof2000n ) /* Original Version, Encrypted Sound + GFX Roms */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_256K( "257-m1.m1", CRC(4b749113) SHA1(2af2361146edd0ce3966614d90165a5c1afb8de4) ) /* mask rom TC532000 */ + NEO_BIOS_AUDIO_256K( "257-m1.m1", CRC(4b749113) SHA1(2af2361146edd0ce3966614d90165a5c1afb8de4) ) /* mask rom TC532000 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) ROM_LOAD( "257-v1.v1", 0x000000, 0x400000, CRC(17cde847) SHA1(4bcc0205b70dc6d9216b29025450c9c5b08cb65d) ) /* TC5332204 */ @@ -8593,7 +8538,7 @@ ROM_START( kof2001 ) /* MVS VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_256K( "265-262-m1.m1", CRC(a7f8119f) SHA1(71805b39b8b09c32425cf39f9de59b2f755976c2) ) /* mask rom TC532000 */ + NEO_BIOS_AUDIO_256K( "265-262-m1.m1", CRC(a7f8119f) SHA1(71805b39b8b09c32425cf39f9de59b2f755976c2) ) /* mask rom TC532000 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) ROM_LOAD( "262-v1-08-e0.v1", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) /* mask rom TC5332204 */ @@ -8627,7 +8572,7 @@ ROM_START( kof2001h ) /* AES VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_256K( "265-262-m1.m1", CRC(a7f8119f) SHA1(71805b39b8b09c32425cf39f9de59b2f755976c2) ) /* mask rom TC532000 */ + NEO_BIOS_AUDIO_256K( "265-262-m1.m1", CRC(a7f8119f) SHA1(71805b39b8b09c32425cf39f9de59b2f755976c2) ) /* mask rom TC532000 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) ROM_LOAD( "262-v1-08-e0.v1", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) /* mask rom TC5332204 */ @@ -8672,7 +8617,7 @@ ROM_START( mslug4 ) /* Original Version - Encrypted GFX */ /* MVS VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "263-m1.m1", CRC(46ac8228) SHA1(5aeea221050c98e4bb0f16489ce772bf1c80f787) ) /* mask rom TC531001 */ + NEO_BIOS_AUDIO_128K( "263-m1.m1", CRC(46ac8228) SHA1(5aeea221050c98e4bb0f16489ce772bf1c80f787) ) /* mask rom TC531001 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -8703,7 +8648,7 @@ ROM_START( mslug4h ) /* Original Version - Encrypted GFX */ /* AES VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "263-m1.m1", CRC(46ac8228) SHA1(5aeea221050c98e4bb0f16489ce772bf1c80f787) ) /* mask rom TC531001 */ + NEO_BIOS_AUDIO_128K( "263-m1.m1", CRC(46ac8228) SHA1(5aeea221050c98e4bb0f16489ce772bf1c80f787) ) /* mask rom TC531001 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -8742,7 +8687,7 @@ ROM_START( rotd ) /* Encrypted Set */ /* MVS VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "264-m1.m1", CRC(4dbd7b43) SHA1(6b63756b0d2d30bbf13fbd219833c81fd060ef96) ) /* mask rom 27c010 */ + NEO_BIOS_AUDIO_128K( "264-m1.m1", CRC(4dbd7b43) SHA1(6b63756b0d2d30bbf13fbd219833c81fd060ef96) ) /* mask rom 27c010 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -8776,7 +8721,7 @@ ROM_START( rotdh ) /* Encrypted Set */ /* AES VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "264-m1.m1", CRC(4dbd7b43) SHA1(6b63756b0d2d30bbf13fbd219833c81fd060ef96) ) /* mask rom 27c010 */ + NEO_BIOS_AUDIO_128K( "264-m1.m1", CRC(4dbd7b43) SHA1(6b63756b0d2d30bbf13fbd219833c81fd060ef96) ) /* mask rom 27c010 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -8817,7 +8762,7 @@ ROM_START( kof2002 ) /* Encrypted Set */ /* MVS AND AES VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ + NEO_BIOS_AUDIO_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -8858,7 +8803,7 @@ ROM_START( matrim ) /* Encrypted Set */ /* MVS AND AES VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "266-m1.m1", CRC(456c3e6c) SHA1(5a07d0186198a18d2dda1331093cf29b0b9b2984) ) /* mask rom TC531001 */ + NEO_BIOS_AUDIO_128K( "266-m1.m1", CRC(456c3e6c) SHA1(5a07d0186198a18d2dda1331093cf29b0b9b2984) ) /* mask rom TC531001 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -8897,7 +8842,7 @@ ROM_START( pnyaa ) /* Encrypted Set */ /* MVS ONLY RELEASE */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "267-m1.m1", CRC(c7853ccd) SHA1(1b7a4c5093cf0fe3861ce44fd1d3b30c71ad0abe) ) /* mask rom TC534000 */ + NEO_BIOS_AUDIO_512K( "267-m1.m1", CRC(c7853ccd) SHA1(1b7a4c5093cf0fe3861ce44fd1d3b30c71ad0abe) ) /* mask rom TC534000 */ ROM_REGION( 0x400000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -8931,7 +8876,7 @@ ROM_START( mslug5 ) /* Encrypted Set */ /* MVS VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "268-m1.m1", CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) /* mask rom TC534000 */ + NEO_BIOS_AUDIO_512K( "268-m1.m1", CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) /* mask rom TC534000 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -8965,7 +8910,7 @@ ROM_START( mslug5h ) /* Encrypted Set */ /* AES release of the game but is also ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "268-m1.m1", CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) /* mask rom TC534000 */ + NEO_BIOS_AUDIO_512K( "268-m1.m1", CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) /* mask rom TC534000 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9006,7 +8951,7 @@ ROM_START( svc ) /* Encrypted Set */ /* MVS AND AES VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "269-m1.m1", CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) ) /* mask rom TC534000 */ + NEO_BIOS_AUDIO_512K( "269-m1.m1", CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) ) /* mask rom TC534000 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9047,7 +8992,7 @@ ROM_START( samsho5 ) /* Encrypted Set */ /* MVS VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "270-m1.m1", CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) /* mask rom 27c040 */ + NEO_BIOS_AUDIO_512K( "270-m1.m1", CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) /* mask rom 27c040 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9084,7 +9029,7 @@ ROM_START( samsho5a ) /* Encrypted Set, Alternate Set */ /* MVS VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "270-m1.m1", CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) /* mask rom 27c040 */ + NEO_BIOS_AUDIO_512K( "270-m1.m1", CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) /* mask rom 27c040 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9117,7 +9062,7 @@ ROM_START( samsho5h ) /* Encrypted Set, Alternate Set */ /* AES VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "270-m1.m1", CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) /* mask rom 27c040 */ + NEO_BIOS_AUDIO_512K( "270-m1.m1", CRC(49c9901a) SHA1(2623e9765a0eba58fee2de72851e9dc502344a3d) ) /* mask rom 27c040 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9159,7 +9104,7 @@ ROM_START( kof2003 ) /* Encrypted Code + Sound + GFX Roms */ /* MVS VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "271-m1c.m1", CRC(f5515629) SHA1(7516bf1b0207a3c8d41dc30c478f8d8b1f71304b) ) /* mask rom TC534000 */ + NEO_BIOS_AUDIO_512K( "271-m1c.m1", CRC(f5515629) SHA1(7516bf1b0207a3c8d41dc30c478f8d8b1f71304b) ) /* mask rom TC534000 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9194,7 +9139,7 @@ ROM_START( kof2003h ) /* Encrypted Code + Sound + GFX Roms */ /* AES VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "271-m1k.m1", CRC(48d9affe) SHA1(68f01560b91bbada39001ce01bdeeed5c9bb29f2) ) /* mask rom TC534000 */ + NEO_BIOS_AUDIO_512K( "271-m1k.m1", CRC(48d9affe) SHA1(68f01560b91bbada39001ce01bdeeed5c9bb29f2) ) /* mask rom TC534000 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9236,7 +9181,7 @@ ROM_START( samsh5sp ) /* Encrypted Set */ /* MVS VERSION */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "272-m1.m1", CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) + NEO_BIOS_AUDIO_512K( "272-m1.m1", CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9282,7 +9227,7 @@ ROM_START( samsh5sph ) /* Encrypted Set */ /* AES VERSION, 2nd bugfix release */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "272-m1.m1", CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) + NEO_BIOS_AUDIO_512K( "272-m1.m1", CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9316,7 +9261,7 @@ ROM_START( samsh5spho ) /* Encrypted Set */ /* AES VERSION, 1st release */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "272-m1.m1", CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) + NEO_BIOS_AUDIO_512K( "272-m1.m1", CRC(adeebf40) SHA1(8cbd63dda3fff4de38060405bf70cd9308c9e66e) ) ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9364,7 +9309,7 @@ ROM_START( jockeygp ) /* MVS ONLY RELEASE */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "008-mg1.m1", CRC(d163c690) SHA1(1dfd04d20c5985037f07cd01000d0b04f3a8f4f4) ) /* M27C4001 */ + NEO_BIOS_AUDIO_512K( "008-mg1.m1", CRC(d163c690) SHA1(1dfd04d20c5985037f07cd01000d0b04f3a8f4f4) ) /* M27C4001 */ ROM_REGION( 0x0200000, "cslot1:ymsnd", 0 ) ROM_LOAD( "008-v1.v1", 0x000000, 0x200000, CRC(443eadba) SHA1(3def3c22f0e276bc4c2fc7ff70ce473c08b0d2df) ) /* mask rom TC5316200 */ @@ -9390,7 +9335,7 @@ ROM_START( jockeygpa ) /* MVS ONLY RELEASE */ ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "008-mg1.m1", CRC(d163c690) SHA1(1dfd04d20c5985037f07cd01000d0b04f3a8f4f4) ) /* M27C4001 */ + NEO_BIOS_AUDIO_512K( "008-mg1.m1", CRC(d163c690) SHA1(1dfd04d20c5985037f07cd01000d0b04f3a8f4f4) ) /* M27C4001 */ ROM_REGION( 0x0200000, "cslot1:ymsnd", 0 ) ROM_LOAD( "008-v1.v1", 0x000000, 0x200000, CRC(443eadba) SHA1(3def3c22f0e276bc4c2fc7ff70ce473c08b0d2df) ) /* mask rom TC5316200 */ @@ -9844,7 +9789,7 @@ ROM_START( ms4plus ) NEO_SFIX_128K( "ms4-s1p.bin", CRC(07ff87ce) SHA1(96ddb439de2a26bf9869015d7fb19129d40f3fd9) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "263-m1.m1", CRC(46ac8228) SHA1(5aeea221050c98e4bb0f16489ce772bf1c80f787) ) /* mask rom TC531001 */ + NEO_BIOS_AUDIO_128K( "263-m1.m1", CRC(46ac8228) SHA1(5aeea221050c98e4bb0f16489ce772bf1c80f787) ) /* mask rom TC531001 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9871,7 +9816,7 @@ ROM_START( kof2002b ) NEO_SFIX_128K( "2k2-s1.bin", CRC(2255f5bf) SHA1(8a82b3e9717df30b580b9d0bac0b403f8102a002) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ + NEO_BIOS_AUDIO_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9897,7 +9842,7 @@ ROM_START( kf2k2pls ) NEO_SFIX_128K( "2k2-s1p.bin", CRC(595e0006) SHA1(ff086bdaa6f40e9ad963e1100a27f44618d684ed) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ + NEO_BIOS_AUDIO_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9924,7 +9869,7 @@ ROM_START( kf2k2pla ) NEO_SFIX_128K( "2k2-s1pa.bin", CRC(1a3ed064) SHA1(9749bb55c750e6b65d651998c2649c5fb68db68e)) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ + NEO_BIOS_AUDIO_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9951,7 +9896,7 @@ ROM_START( kf2k2mp ) NEO_SFIX_128K( "kf02m-s1.bin", CRC(348d6f2c) SHA1(586da8a936ebbb71af324339a4b60ec91dfa0990) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ + NEO_BIOS_AUDIO_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -9978,7 +9923,7 @@ ROM_START( kf2k2mp2 ) NEO_SFIX_128K( "k2k2m2s1.bin", CRC(446e74c5) SHA1(efc2afb26578bad9eb21659c70eb0f827d6d1ef6) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ + NEO_BIOS_AUDIO_128K( "265-m1.m1", CRC(85aaa632) SHA1(744fba4ca3bc3a5873838af886efb97a8a316104) ) /* mask rom TC531001 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ @@ -10003,8 +9948,8 @@ ROM_START( kof10th ) ROM_Y_ZOOM - ROM_REGION( 0x40000, "cslot1:fixed", 0 ) // modified - ROM_FILL( 0x000000, 0x40000, 0x000000 ) // modified + ROM_REGION( 0x20000, "cslot1:fixed", 0 ) // modified + ROM_FILL( 0x000000, 0x20000, 0x000000 ) // modified ROM_REGION( 0x20000, "fixedbios", 0 ) ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) @@ -10173,7 +10118,7 @@ ROM_START( ms5plus ) ROM_LOAD( "sfix.sfix", 0x000000, 0x20000, CRC(c2ea0cfd) SHA1(fd4a618cdcdbf849374f0a50dd8efe9dbab706c3) ) /* Encrypted */ - NEO_BIOS_AUDIO_ENCRYPTED_512K( "268-m1.m1", CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) /* mask rom TC534000 */ + NEO_BIOS_AUDIO_512K( "268-m1.m1", CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) /* mask rom TC534000 */ ROM_REGION( 0x1000000, "cslot1:ymsnd", 0 ) /* Encrypted */ diff --git a/src/mame/drivers/neogeocd.cpp b/src/mame/drivers/neogeocd.cpp index 59a0f0e4a2d..2783b891b93 100644 --- a/src/mame/drivers/neogeocd.cpp +++ b/src/mame/drivers/neogeocd.cpp @@ -929,7 +929,7 @@ ADDRESS_MAP_END ADDRESS_MAP_START(ngcd_state::neocd_audio_io_map) - AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_READ(audio_command_r) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) + AM_RANGE(0x00, 0x00) AM_MIRROR(0xff00) AM_DEVREADWRITE("soundlatch1", generic_latch_8_device, read, clear_w) AM_RANGE(0x04, 0x07) AM_MIRROR(0xff00) AM_DEVREADWRITE("ymsnd", ym2610_device, read, write) AM_RANGE(0x08, 0x08) AM_MIRROR(0xff00) AM_SELECT(0x0010) AM_WRITE(audio_cpu_enable_nmi_w) // banking reads are actually NOP on NeoCD? but some games still access them @@ -1099,7 +1099,7 @@ ROM_START( neocd ) ROM_REGION( 0x100000, "ymsnd", ROMREGION_ERASEFF ) /* 1MB of Sound RAM */ - ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x10000, "audiocpu", ROMREGION_ERASEFF ) /* 64KB of Z80 RAM */ ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASE00 ) @@ -1125,7 +1125,7 @@ ROM_START( neocdz ) ROM_REGION( 0x100000, "ymsnd", ROMREGION_ERASEFF ) /* 1MB of Sound RAM */ - ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) + ROM_REGION( 0x10000, "audiocpu", ROMREGION_ERASEFF ) /* 64KB of Z80 RAM */ ROM_REGION( 0x200000, "maincpu", ROMREGION_ERASE00 ) diff --git a/src/mame/drivers/neopcb.cpp b/src/mame/drivers/neopcb.cpp index 7346757b6a9..af65d861fae 100644 --- a/src/mame/drivers/neopcb.cpp +++ b/src/mame/drivers/neopcb.cpp @@ -6,6 +6,8 @@ #include "emu.h" #include "includes/neogeo.h" +#include + void neopcb_state::machine_start() { @@ -90,9 +92,8 @@ ROM_START( ms5pcb ) /* Encrypted Set, JAMMA PCB */ ROM_LOAD16_WORD_SWAP( "sp-4x.sp1", 0x00000, 0x80000, CRC(b4590283) SHA1(47047ed5b6062babc0a0bebcc30e4b3f021e115a) ) /* Encrypted */ - ROM_REGION( 0x80000, "audiocrypt", 0 ) + ROM_REGION( 0x80000, "audiocpu", 0 ) ROM_LOAD( "268-m1.m1", 0x00000, 0x80000, CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) /* mask rom TC534000 */ - ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) /* Encrypted */ @@ -130,9 +131,8 @@ ROM_START( svcpcb ) /* Encrypted Set, JAMMA PCB */ ROM_LOAD16_WORD_SWAP( "sp-4x.sp1", 0x00000, 0x80000, CRC(b4590283) SHA1(47047ed5b6062babc0a0bebcc30e4b3f021e115a) ) /* Encrypted */ - ROM_REGION( 0x80000, "audiocrypt", 0 ) + ROM_REGION( 0x80000, "audiocpu", 0 ) ROM_LOAD( "269-m1.m1", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) ) /* mask rom TC534000 */ - ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) ROM_Y_ZOOM @@ -169,9 +169,8 @@ ROM_START( svcpcba ) /* Encrypted Set, JAMMA PCB */ ROM_LOAD16_WORD_SWAP( "sp-4x.sp1", 0x00000, 0x80000, CRC(b4590283) SHA1(47047ed5b6062babc0a0bebcc30e4b3f021e115a) ) /* Encrypted */ - ROM_REGION( 0x80000, "audiocrypt", 0 ) + ROM_REGION( 0x80000, "audiocpu", 0 ) ROM_LOAD( "269-m1.m1", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) ) - ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) ROM_Y_ZOOM @@ -208,9 +207,8 @@ ROM_START( kf2k3pcb ) /* Encrypted Set, JAMMA PCB */ ROM_LOAD16_WORD_SWAP( "spj.sp1", 0x00000, 0x080000, CRC(148dd727) SHA1(2cf592a16c7157de02a989675d47965f2b3a44dd) ) // encrypted /* Encrypted */ - ROM_REGION( 0x80000, "audiocrypt", 0 ) + ROM_REGION( 0x80000, "audiocpu", 0 ) ROM_LOAD( "271-m1.m1", 0x00000, 0x80000, CRC(d6bcf2bc) SHA1(df78bc95990eb8e8f3638dde6e1876354df7fe84) ) - ROM_REGION( 0x90000, "audiocpu", ROMREGION_ERASEFF ) ROM_Y_ZOOM @@ -263,7 +261,7 @@ void neopcb_state::svcpcb_gfx_decrypt() int ofst = bitswap<24>((i & 0x1fffff), 0x17, 0x16, 0x15, 0x04, 0x0b, 0x0e, 0x08, 0x0c, 0x10, 0x00, 0x0a, 0x13, 0x03, 0x06, 0x02, 0x07, 0x0d, 0x01, 0x11, 0x09, 0x14, 0x0f, 0x12, 0x05); ofst ^= 0x0c8923; ofst += (i & 0xffe00000); - memcpy(&rom[i * 4], &buf[ofst * 4], 0x04); + std::copy(&buf[ofst * 4], &buf[(ofst * 4) + 4], &rom[i * 4]); } } @@ -307,7 +305,7 @@ void neopcb_state::kf2k3pcb_gfx_decrypt() int ofst = bitswap<24>((i & 0x7fffff), 0x17, 0x15, 0x0a, 0x14, 0x13, 0x16, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00); ofst ^= 0x000000; ofst += (i & 0xff800000); - memcpy(&rom[ofst], &buf[i], 0x04); + std::copy(&buf[i], &buf[i+4], &rom[ofst]); } } @@ -375,7 +373,7 @@ void neopcb_state::kf2k3pcb_sp1_decrypt() if (buf[i] & 0x0020) buf[i] ^= 0x0008; } - memcpy(rom, &buf[0], 0x80000); + std::copy(buf.begin(), buf.end(), &rom[0]); } @@ -396,8 +394,6 @@ void neopcb_state::kf2k3pcb_sp1_decrypt() #define ym_region_size memregion("ymsnd")->bytes() #define audiocpu_region memregion("audiocpu")->base() #define audio_region_size memregion("audiocpu")->bytes() -#define audiocrypt_region memregion("audiocrypt")->base() -#define audiocrypt_region_size memregion("audiocrypt")->bytes() /*********************************************** non-carts */ @@ -453,7 +449,7 @@ DRIVER_INIT_MEMBER(neopcb_state, ms5pcb) m_pvc_prot->mslug5_decrypt_68k(cpuregion, cpuregion_size); m_pcm2_prot->swap(ym_region, ym_region_size, 2); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); svcpcb_gfx_decrypt(); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, MSLUG5_GFX_KEY); @@ -473,7 +469,7 @@ DRIVER_INIT_MEMBER(neopcb_state, svcpcb) m_pvc_prot->svc_px_decrypt(cpuregion, cpuregion_size); m_pcm2_prot->swap(ym_region, ym_region_size, 3); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); svcpcb_gfx_decrypt(); m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, SVC_GFX_KEY); @@ -493,12 +489,12 @@ DRIVER_INIT_MEMBER(neopcb_state, kf2k3pcb) m_pvc_prot->kf2k3pcb_decrypt_68k(cpuregion, cpuregion_size); m_pcm2_prot->swap(ym_region, ym_region_size, 5); kf2k3pcb_sp1_decrypt(); - m_cmc_prot->cmc50_m1_decrypt(audiocrypt_region, audiocrypt_region_size, audiocpu_region, audio_region_size); + m_cmc_prot->cmc50_m1_decrypt(audiocpu_region, audio_region_size); // extra little swap on the m1 - this must be performed AFTER the m1 decrypt // or the m1 checksum (used to generate the key) for decrypting the m1 is // incorrect uint8_t* rom = memregion("audiocpu")->base(); - for (int i = 0; i < 0x90000; i++) + for (int i = 0; i < 0x80000; i++) rom[i] = bitswap<8>(rom[i], 5, 6, 1, 4, 3, 0, 7, 2); kf2k3pcb_gfx_decrypt(); diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index 72bcfaf8d36..f7eacc0f652 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -15,6 +15,8 @@ #include "machine/ng_memcard.h" #include "video/neogeo_spr.h" +#include "machine/input_merger.h" + #include "bus/neogeo/slot.h" #include "bus/neogeo/carts.h" #include "bus/neogeo_ctrl/ctrl.h" @@ -41,8 +43,8 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_memcard(*this, "memcard"), - m_soundlatch(*this, "soundlatch"), - m_soundlatch2(*this, "soundlatch2"), + m_soundlatch(*this, "soundlatch%u", 1), + m_soundnmi(*this, "soundnmi"), m_region_maincpu(*this, "maincpu"), m_region_sprites(*this, "sprites"), m_region_fixed(*this, "fixed"), @@ -51,26 +53,20 @@ public: m_region_audiobios(*this, "audiobios"), m_region_audiocpu(*this, "audiocpu"), m_bank_audio_main(*this, "audio_main"), + m_biosrom(*this, "mainbios"), m_dsw(*this, "DSW"), m_trackx(*this, "TRACK_X"), m_tracky(*this, "TRACK_Y"), m_edge(*this, "edge"), - m_ctrl1(*this, "ctrl1"), - m_ctrl2(*this, "ctrl2"), + m_ctrl(*this, "ctrl%u", 1), m_use_cart_vectors(0), m_use_cart_audio(0), - m_slot1(*this, "cslot1"), - m_slot2(*this, "cslot2"), - m_slot3(*this, "cslot3"), - m_slot4(*this, "cslot4"), - m_slot5(*this, "cslot5"), - m_slot6(*this, "cslot6") + m_slot(*this, "cslot%u", 1), { } DECLARE_READ16_MEMBER(memcard_r); DECLARE_WRITE16_MEMBER(memcard_w); DECLARE_WRITE8_MEMBER(audio_command_w); - DECLARE_READ8_MEMBER(audio_command_r); DECLARE_READ8_MEMBER(audio_cpu_bank_select_r); DECLARE_WRITE8_MEMBER(audio_cpu_enable_nmi_w); DECLARE_READ16_MEMBER(unmapped_r); @@ -207,8 +203,8 @@ protected: required_device m_screen; optional_device m_palette; optional_device m_memcard; - required_device m_soundlatch; - required_device m_soundlatch2; + required_device_array m_soundlatch; + required_device m_soundnmi; // memory optional_memory_region m_region_maincpu; @@ -219,6 +215,8 @@ protected: optional_memory_region m_region_audiobios; optional_memory_region m_region_audiocpu; optional_memory_bank m_bank_audio_main; // optional because of neocd + optional_region_ptr m_biosrom; + region_ptr *m_lorom; memory_bank *m_bank_audio_cart[4]; memory_bank *m_bank_cartridge; @@ -229,8 +227,7 @@ protected: optional_ioport m_trackx; optional_ioport m_tracky; optional_device m_edge; - optional_device m_ctrl1; - optional_device m_ctrl2; + optional_device_array m_ctrl; // video hardware, including maincpu interrupts // TODO: make into a device @@ -254,12 +251,7 @@ protected: // temporary helper to restore memory banking while bankswitch is handled in the driver... uint32_t m_bank_base; - optional_device m_slot1; - optional_device m_slot2; - optional_device m_slot3; - optional_device m_slot4; - optional_device m_slot5; - optional_device m_slot6; + optional_device_array m_slot; int m_curr_slot; neogeo_cart_slot_device* m_slots[6]; @@ -279,14 +271,11 @@ private: void create_rgb_lookups(); void set_pens(); - void audio_cpu_check_nmi(); void set_output_latch(uint8_t data); void set_output_data(uint8_t data); // internal state bool m_recurse; - bool m_audio_cpu_nmi_enabled; - bool m_audio_cpu_nmi_pending; // MVS-specific state uint8_t m_save_ram_unlocked; diff --git a/src/mame/video/neogeo.cpp b/src/mame/video/neogeo.cpp index 79ff2235298..7865c46d1fc 100644 --- a/src/mame/video/neogeo.cpp +++ b/src/mame/video/neogeo.cpp @@ -127,8 +127,7 @@ void neogeo_state::video_start() { create_rgb_lookups(); - m_paletteram.resize(0x1000 * 2); - memset(&m_paletteram[0], 0, 0x1000 * 2 * sizeof(m_paletteram[0])); + m_paletteram.resize(0x1000 * 2, 0); m_screen_shadow = 0; m_palette_bank = 0;