From 3b6ebfba72399ad6b5f16505910a1225ebbc90e4 Mon Sep 17 00:00:00 2001 From: davidhay Date: Sat, 20 Sep 2008 11:53:46 +0000 Subject: [PATCH] ms5pcb decryption is the same, rom was bad --- src/mame/drivers/neodrvr.c | 10 +++++-- src/mame/includes/neogeo.h | 1 - src/mame/machine/neocrypt.c | 59 ++++++++----------------------------- 3 files changed, 20 insertions(+), 50 deletions(-) diff --git a/src/mame/drivers/neodrvr.c b/src/mame/drivers/neodrvr.c index 44e20a1d877..26d9f62f19e 100644 --- a/src/mame/drivers/neodrvr.c +++ b/src/mame/drivers/neodrvr.c @@ -5672,11 +5672,15 @@ ROM_START( ms5pcb ) /* Encrypted Set */ /* this contains both an ASIA and JAPAN bios, HARDDIP3 on the PCB selects which to use */ ROM_LOAD16_WORD_SWAP( "268-bios.bin", 0x00000, 0x80000, CRC(b4590283) SHA1(47047ed5b6062babc0a0bebcc30e4b3f021e115a) ) - /* Encrypted (slightly different encryption on this single board PCB) */ + + /* Encrypted */ ROM_REGION( 0x80000, "audiocrypt", 0 ) - ROM_LOAD( "268-m1.bin", 0x00000, 0x10000, CRC(58b107d0) SHA1(cc7fe66ff4f9c026cde4df06f86c848eb21f7af8) ) + ROM_LOAD( "271-m1.bin", 0x00000, 0x80000, CRC(4a5a6e0e) SHA1(df0f660f2465e1db7be5adfcaf5e88ad61a74a42) ) ROM_REGION( 0x90000, "audio", ROMREGION_ERASEFF ) + + /* Encrypted */ + ROM_Y_ZOOM ROM_REGION( 0x1000000, "ym", 0 ) @@ -7036,7 +7040,7 @@ static DRIVER_INIT( ms5pcb ) mslug5_decrypt_68k(machine); svcpcb_gfx_decrypt(machine); kof2000_neogeo_gfx_decrypt(machine, 0x19); - neogeo_ms5pcb_m1_decrypt(machine); + neogeo_cmc50_m1_decrypt(machine, 0x1543); neogeo_fixed_layer_bank_type = 2; svcpcb_s1data_decrypt(machine); diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index 47bd68da90c..df674a005df 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -68,7 +68,6 @@ void neo_pcm2_snk_1999(running_machine *machine, int value); void neo_pcm2_swap(running_machine *machine, int value); void neogeo_cmc50_m1_decrypt(running_machine *machine, UINT16 key); -void neogeo_ms5pcb_m1_decrypt(running_machine *machine); /*----------- defined in machine/neoprot.c -----------*/ diff --git a/src/mame/machine/neocrypt.c b/src/mame/machine/neocrypt.c index 91e82970bef..751fcb92659 100644 --- a/src/mame/machine/neocrypt.c +++ b/src/mame/machine/neocrypt.c @@ -1514,54 +1514,21 @@ void neogeo_cmc50_m1_decrypt(running_machine *machine, UINT16 key) } #endif -} -/* the ms5pcb encryption is slightly different, there are 2 possible approachs - we can take */ - -#if 1 -// if using key 0x1543 (same as mslug5) we need a different bitswap here -int m1_alt_address_scramble(int address/*, UINT16 key*/) -{ - int aux; - UINT16 key = 0x1543; - - aux = address ^key; - aux = BITSWAP16(aux, 11,0,2,5,12,7,4,9,10,8,3,14,15,6,13,1); // only 1 64k block, so... - aux ^= m1_address_0_7_xor[(aux>>8)&0xff]; - aux ^= m1_address_8_15_xor[aux&0xff]<<8; - aux = BITSWAP16(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0); - return aux; -} -#else -// using key 0xa528, we can rearrange the rom first.. -int m1_alt_address_scramble(int address/*, UINT16 key */) -{ - UINT16 key = 0xa528; - address = BITSWAP16(address, 1,13,12,4,7,6,2,10,15,5,0,11,8,3,14,9); - return m1_address_scramble(address, key); -} -#endif - - -void neogeo_ms5pcb_m1_decrypt(running_machine *machine/*, UINT16 key*/) -{ - UINT8* rom = memory_region(machine, "audiocrypt"); - size_t rom_size = 0x80000; - UINT8* rom2 = memory_region(machine, "audio"); - - UINT8* buffer = malloc_or_die(rom_size); - - UINT32 i; - - for (i=0; igamedrv->name; + char filename[256]; + sprintf(filename, "%s_m1extra.dump", gamename); + + fp=fopen(filename, "w+b"); + if (fp) + { + fwrite(&rom[0xf800], 0x800, 1, fp); + fclose(fp); + } } + #endif - memcpy(rom,buffer,rom_size); - - memcpy(rom2,rom,0x10000); - memcpy(rom2+0x10000,rom,0x80000); } -