James Posted November 18, 2005 Share Posted November 18, 2005 I find it very funny to be useing fully decrypted sets in Mame. My kf2k2pls uses a decrypted S rom NEO_SFIX_128K( "265-s1p.bin", CRC(595e0006) SHA1(ff086bdaa6f40e9ad963e1100a27f44618d684ed) )I never knew it used a encrypted one ( or did I ? ) ROM_START( ct2k3sp ) ROM_REGION( 0x500000, REGION_CPU1, 0 ) ROM_LOAD16_WORD_SWAP( "5003-p1sp.bin", 0x000000, 0x100000, CRC(ab5c4de0) SHA1(ca9a6bfd4c32d791ecabb34ccbf2cbf0e84f97d5) ) ROM_LOAD16_WORD_SWAP( "5003-p2.bin", 0x100000, 0x400000, CRC(adc1c22b) SHA1(271e0629989257a0d21d280c05df53df259414b1) ) ROM_REGION( 0x40000, REGION_GFX1, 0 ) ROM_LOAD( "5003-s1sp.bin", 0x00000, 0x40000, CRC(6c355ab4) SHA1(71ac2bcd3dbda8402baecc56dabc2297b148a900) ) ROM_REGION( 0x20000, REGION_GFX2, 0 ) ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) NEO_BIOS_SOUND_128K( "5003-m1.bin", CRC(23772b2a) SHA1(96cda2551bd45c6df90c5f6899606e8c044ccc65) ) /* sound roms are identical to kof2001 */ ROM_REGION( 0x1000000, REGION_SOUND1, ROMREGION_SOUNDONLY ) ROM_LOAD( "262-v1.bin", 0x000000, 0x400000, CRC(83d49ecf) SHA1(2f2c116e45397652e77fcf5d951fa5f71b639572) ) ROM_LOAD( "262-v2.bin", 0x400000, 0x400000, CRC(003f1843) SHA1(bdd58837ad542548bd4053c262f558af88e3b989) ) ROM_LOAD( "262-v3.bin", 0x800000, 0x400000, CRC(2ae38dbe) SHA1(4e82b7dd3b899d61907620517a5a27bdaba0725d) ) ROM_LOAD( "262-v4.bin", 0xc00000, 0x400000, CRC(26ec4dd9) SHA1(8bd68d95a2d913be41a51f51e48dbe3bff5924fb) ) NO_DELTAT_REGION ROM_REGION( 0x4000000, REGION_GFX3, 0 ) /* Encrypted */ ROM_LOAD16_BYTE( "5003-c1.bin", 0x0000000, 0x800000, CRC(68f54b67) SHA1(e2869709b11ea2846799fe431211c83e928e103e) ) /* Plane 0,1 */ ROM_LOAD16_BYTE( "5003-c2.bin", 0x0000001, 0x800000, CRC(2f8849d5) SHA1(7ef74981aa056f5acab4ddabffd3e98b4cb970be) ) /* Plane 2,3 */ ROM_LOAD16_BYTE( "5003-c3.bin", 0x1000000, 0x800000, CRC(ac4aff71) SHA1(c983f642e68deaa40fee3e208f2dd55f3bacbdc1) ) /* Plane 0,1 */ ROM_LOAD16_BYTE( "5003-c4.bin", 0x1000001, 0x800000, CRC(afef5d66) SHA1(39fe785563fbea54bba88de60dcc62e2458bd74a) ) /* Plane 2,3 */ ROM_LOAD16_BYTE( "5003-c5.bin", 0x2000000, 0x800000, CRC(c7c1ae50) SHA1(f54f5be7513a5ce2f01ab107a2b26f6a9ee1f2a9) ) /* Plane 0,1 */ ROM_LOAD16_BYTE( "5003-c6.bin", 0x2000001, 0x800000, CRC(613197f9) SHA1(6d1fefa1be81b79e251e55a1352544c0298e4674) ) /* Plane 2,3 */ ROM_LOAD16_BYTE( "5003-c7.bin", 0x3000000, 0x800000, CRC(64ddfe0f) SHA1(361f3f4618009bf6419961266eb9ab5002bef53c) ) /* Plane 0,1 */ ROM_LOAD16_BYTE( "5003-c8.bin", 0x3000001, 0x800000, CRC(917a1439) SHA1(6f28d1d7c6edee1283f25e632c69204dbebe40af) ) /* Plane 2,3 */ ROM_END /* descrambling information from razoola */ /* descrambling S rom for cthd2003 Super Plus */ static void ct2k3sp_sx_decrypt( void ) { int rom_size = memory_region_length( REGION_GFX1 ); UINT8 *rom = memory_region( REGION_GFX1 ); UINT8 *buf = malloc( rom_size ); int i; int ofst; memcpy( buf, rom, rom_size ); for( i = 0; i < rom_size; i++ ){ ofst = BITSWAP24( (i & 0x1ffff), 23, 22, 21, 20, 19, 18, 17, 3, 0, 1, 4, 2, 13, 14, 16, 15, 5, 6, 11, 10, 9, 8, 7, 12 ); ofst += (i >> 17) << 17; rom[ i ] = buf[ ofst ]; } memcpy( buf, rom, rom_size ); memcpy( &rom[ 0x08000 ], &buf[ 0x10000 ], 0x8000 ); memcpy( &rom[ 0x10000 ], &buf[ 0x08000 ], 0x8000 ); memcpy( &rom[ 0x28000 ], &buf[ 0x30000 ], 0x8000 ); memcpy( &rom[ 0x30000 ], &buf[ 0x28000 ], 0x8000 ); free( buf ); } static void cthd2003_neogeo_gfx_address_fix_do(int start, int end, int bit3shift, int bit2shift, int bit1shift, int bit0shift) { int i,j; int tilesize=128; UINT8* rom = (UINT8*)malloc(16*tilesize); // 16 tiles buffer UINT8* realrom = memory_region(REGION_GFX3) + start*tilesize; for (i = 0; i < (end-start)/16; i++) { for (j = 0; j < 16; j++) { int offset = (((j&1)>>0)<<bit0shift) +(((j&2)>>1)<<bit1shift) +(((j&4)>>2)<<bit2shift) +(((j&8)>>3)<<bit3shift); memcpy(rom+j*tilesize, realrom+offset*tilesize, tilesize); } memcpy(realrom,rom,tilesize*16); realrom+=16*tilesize; } free(rom); } static void cthd2003_neogeo_gfx_address_fix(int start, int end) { cthd2003_neogeo_gfx_address_fix_do(start+512*0, end+512*0, 0,3,2,1); cthd2003_neogeo_gfx_address_fix_do(start+512*1, end+512*1, 1,0,3,2); cthd2003_neogeo_gfx_address_fix_do(start+512*2, end+512*2, 2,1,0,3); // skip 3 & 4 cthd2003_neogeo_gfx_address_fix_do(start+512*5, end+512*5, 0,1,2,3); cthd2003_neogeo_gfx_address_fix_do(start+512*6, end+512*6, 0,1,2,3); cthd2003_neogeo_gfx_address_fix_do(start+512*7, end+512*7, 0,2,3,1); } static void cthd2003_c(int pow) { int i; for (i=0; i<=192; i+=8) cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); for (i=200; i<=392; i+=8) cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); for (i=400; i<=592; i+=8) cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); for (i=600; i<=792; i+=8) cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); for (i=800; i<=992; i+=8) cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); for (i=1000; i<=1016; i+=8) cthd2003_neogeo_gfx_address_fix(i*512,i*512+512); } DRIVER_INIT (cthd2003) { UINT8 *romdata = memory_region(REGION_GFX1); UINT8*tmp = (UINT8*)malloc(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, 8*128*128); romdata = memory_region(REGION_CPU2)+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, 8*128*128); free(tmp); memcpy(romdata-0x10000,romdata,0x10000);; cthd2003_c(0); init_neogeo(); } DRIVER_INIT (ct2k3sp) { UINT8 *romdata = memory_region(REGION_CPU2)+0x10000; UINT8*tmp = (UINT8*)malloc(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, 8*128*128); free(tmp); memcpy(romdata-0x10000,romdata,0x10000); ct2k3sp_sx_decrypt(); cthd2003_c(0); init_neogeo(); } GAMEB( 2003, ct2k3sp, kof2001, neogeo, raster, neogeo, ct2k3sp, ROT0, "Phenixsoft Corporation", "Crouching Tiger Hidden Dragon 2003 Super Plus", 0 ) machine\neogeo.c/* thanks to razoola */ static WRITE16_HANDLER ( cthd2003_bankswitch_w ) { int bankaddress; static int cthd2003_banks[8] = { 1,0,1,0,1,0,3,2, }; if (offset == 0) { bankaddress = 0x100000 + cthd2003_banks[data&7]*0x100000; neogeo_set_cpu1_second_bank(bankaddress); } } if (!strcmp(Machine->gamedrv->name,"cthd2003") || !strcmp(Machine->gamedrv->name,"ct2k3sp")) { /* patches thanks to razoola */ int i; UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1); /* special ROM banking handler */ memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, cthd2003_bankswitch_w); // theres still a problem on the character select screen but it seems to be related to cpu core timing issues, // overclocking the 68k prevents it. // fix garbage on s1 layer over everything mem16[0xf415a/2] = 0x4ef9; mem16[0xf415c/2] = 0x000f; mem16[0xf415e/2] = 0x4cf2; // Fix corruption in attract mode before title screen for (i=0x1ae290/2;i < 0x1ae8d0/2; i=i+1) { mem16[i] = 0x0000; } // Fix for title page for (i=0x1f8ef0/2;i < 0x1fa1f0/2; i=i+2) { mem16[i] -= 0x7000; mem16[i+1] -= 0x0010; } // Fix for green dots on title page for (i=0xac500/2;i < 0xac520/2; i=i+1) { mem16[i] = 0xFFFF; } // Fix for blanks as screen change level end clear mem16[0x991d0/2] = 0xdd03; mem16[0x99306/2] = 0xdd03; mem16[0x99354/2] = 0xdd03; mem16[0x9943e/2] = 0xdd03; } Link to comment Share on other sites More sharing options...
Robert Posted November 19, 2005 Author Share Posted November 19, 2005 (edited) I'm not impressed with myself after that. I already had all that code - except for the line that mattered.if (!strcmp(Machine->gamedrv->name,"cthd2003") || !strcmp(Machine->gamedrv->name,"ct2k3sp"))I only had cthd2003 there, don't know how I could have overlooked it. Thanks James, it works fine now. Metal Slug 5 Plus- does anyone have the driver? Lastly I've been looking at the kof96m_ep1.rom, it's either corrupt or encrypted?? Any answers? EDIT: never mind, I got the kof96m_ep1.rom encryption sorted out, and it works. Still need a working ms5plus driver though !! Edited November 19, 2005 by robbbert Link to comment Share on other sites More sharing options...
tiger1020x Posted November 19, 2005 Share Posted November 19, 2005 I'm not impressed with myself after that. I already had all that code - except for the line that mattered.if (!strcmp(Machine->gamedrv->name,"cthd2003") || !strcmp(Machine->gamedrv->name,"ct2k3sp"))I only had cthd2003 there, don't know how I could have overlooked it. Thanks James, it works fine now. Metal Slug 5 Plus- does anyone have the driver? Lastly I've been looking at the kof96m_ep1.rom, it's either corrupt or encrypted?? Any answers? EDIT: never mind, I got the kof96m_ep1.rom encryption sorted out, and it works. Still need a working ms5plus driver though !!<{POST_SNAPBACK}>back at you bro..src/drivers/neogeo.cROM_START( ms5plus )ROM_REGION( 0x500000, REGION_CPU1, 0 )ROM_LOAD16_WORD_SWAP( "p1.bin", 0x000000, 0x100000, CRC(106b276f) )ROM_LOAD16_WORD_SWAP( "p2.bin", 0x100000, 0x200000, CRC(d6a458e8) )ROM_LOAD16_WORD_SWAP( "p3.bin", 0x300000, 0x200000, CRC(439ec031) ) ROM_REGION( 0x20000, REGION_GFX1, 0 )ROM_LOAD("268-s1p.bin", 0x000000, 0x20000, CRC(c82e57ad) )ROM_REGION( 0x20000, REGION_GFX2, 0 )ROM_LOAD( "sfix.sfx", 0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) ) ROM_REGION( 0x20000, REGION_USER4, 0 )NEO_BIOS_SOUND_128K( "268-m1d.bin", CRC(6fa01c9a) )ROM_REGION( 0x1000000, REGION_SOUND1, ROMREGION_SOUNDONLY )ROM_LOAD( "268-v1d.bin", 0x000000, 0x800000, CRC(0ab43275) )ROM_LOAD( "268-v2d.bin", 0x800000, 0x800000, CRC(358b1419) ) NO_DELTAT_REGION ROM_REGION( 0x4000000, REGION_GFX3, 0 )ROM_LOAD16_BYTE( "ms5n_c1.rom", 0x0000000, 0x800000, CRC(969c0d62) )ROM_LOAD16_BYTE( "ms5n_c2.rom", 0x0000001, 0x800000, CRC(c69ae867) )ROM_LOAD16_BYTE( "ms5n_c3.rom", 0x1000000, 0x800000, CRC(d7beaeaf) )ROM_LOAD16_BYTE( "ms5n_c4.rom", 0x1000001, 0x800000, CRC(e1b1131b) )ROM_LOAD16_BYTE( "ms5n_c5.rom", 0x2000000, 0x800000, CRC(2fa1a5ad) )ROM_LOAD16_BYTE( "ms5n_c6.rom", 0x2000001, 0x800000, CRC(6de89589) )ROM_LOAD16_BYTE( "ms5n_c7.rom", 0x3000000, 0x800000, CRC(97bd0c0a) )ROM_LOAD16_BYTE( "ms5n_c8.rom.", 0x3000001, 0x800000, CRC(c0d5bc20) )ROM_END DRIVER_INIT ( ms5plus ){UINT8 *dst = malloc(0x20000);UINT8 *roms1 = (memory_region(REGION_GFX1));int j;if ( dst ){memcpy(dst,roms1,0x20000);// descrambling the S1 by dorriGafor (j=0;j<0x20000 ; j+=0x000010){memcpy( roms1+j, dst+j+0x000008,;memcpy( roms1+j+0x000008, dst+j,; }}free( dst );neogeo_fix_bank_type = 1;init_neogeo();} GAMEB( 2003, ms5plus, mslug5, neogeo, neogeo, neogeo, ms5plus, ROT0, "SNK Playmore", "Metal Slug 5 Plus! (bootleg)" ) src/machine/neogeo.c static WRITE16_HANDLER ( ms5plus_bankswitch_w ){/* thanks to fataku for the info */unsigned char *RAM = memory_region(REGION_CPU1);int bankaddress;logerror("offset: %06x PC %06x: set banking %04x\n",offset,activecpu_get_pc(),data);if ((offset == 0)&&(data == 0xa0)){bankaddress=0xa0;cpu_setbank(4,&RAM[bankaddress]);//neogeo_set_cpu1_second_bank(bankaddress);logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,activecpu_get_pc(),bankaddress);}else if(offset == 2){ data=data>>4;//data=data&7;bankaddress=data*0x100000;cpu_setbank(4,&RAM[bankaddress]);//neogeo_set_cpu1_second_bank(bankaddress);logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,activecpu_get_pc(),bankaddress);}} put it individual games can go here (before kludges) if (!strcmp(Machine->gamedrv->name,"ms5plus") ){// special ROM banking handlermemory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff,0,0, ms5plus_bankswitch_w); hope that works for you.. cheers Link to comment Share on other sites More sharing options...
iq_132 Posted November 20, 2005 Share Posted November 20, 2005 static WRITE16_HANDLER ( ms5plus_bankswitch_w ){/* thanks to fataku for the info */unsigned char *RAM = memory_region(REGION_CPU1);int bankaddress;logerror("offset: %06x PC %06x: set banking %04x\n",offset,activecpu_get_pc(),data);if ((offset == 0)&&(data == 0xa0)){bankaddress=0xa0;cpu_setbank(4,&RAM[bankaddress]);//neogeo_set_cpu1_second_bank(bankaddress);logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,activecpu_get_pc(),bankaddress);}else if(offset == 2){ data=data>>4;//data=data&7;bankaddress=data*0x100000;cpu_setbank(4,&RAM[bankaddress]);//neogeo_set_cpu1_second_bank(bankaddress);logerror("offset: %06x PC %06x: set banking %04x\n\n",offset,activecpu_get_pc(),bankaddress);}} put it individual games can go here (before kludges) if (!strcmp(Machine->gamedrv->name,"ms5plus") ){// special ROM banking handlermemory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff,0,0, ms5plus_bankswitch_w); hope that works for you.. cheers static WRITE16_HANDLER ( mslug5p_bankswitch_w ) /* Bootleg, Plus */ { if(offset == 2) { neogeo_set_cpu1_second_bank(data<<16); } } This is a bit shorter... Link to comment Share on other sites More sharing options...
Robert Posted November 20, 2005 Author Share Posted November 20, 2005 kf2k2pls: I found I had the decrypted roms, and it ran straight away. problem solved. ms5plus: That's a really old driver, and I don't have the v roms. I've tried mixing/matching, but no luck yet. What I've got is the set for kawaks 1.48/dev, so I'd like to get it working with that one if possible. Link to comment Share on other sites More sharing options...
James Posted November 21, 2005 Share Posted November 21, 2005 What I've got is the set for kawaks 1.48/dev, so I'd like to get it working with that one if possible.<{POST_SNAPBACK}>Why that one ? They were known to be bad rom sets and the emu is just as old as the driver posted here. Link to comment Share on other sites More sharing options...
iq_132 Posted November 21, 2005 Share Posted November 21, 2005 Yeah... If you're going to go off of any reference, you should definitely go off of Johnboy's dats. Link to comment Share on other sites More sharing options...
Robert Posted November 21, 2005 Author Share Posted November 21, 2005 I can only make use of what i've got. There's no point making a driver if it can't be tested. Link to comment Share on other sites More sharing options...
James Posted November 21, 2005 Share Posted November 21, 2005 I can only make use of what i've got. There's no point making a driver if it can't be tested.<{POST_SNAPBACK}> Well maybe you can get patches to get the right roms. I am sure there will be people eager to help. Link to comment Share on other sites More sharing options...
Robert Posted November 21, 2005 Author Share Posted November 21, 2005 Upgraded to 0.102, and found that mamedev had changed a few things. All fixed and working. ms5plus: ok, the rom problem is settled, and I've progressed to getting the red screen, but that's it. I give up on this one. Link to comment Share on other sites More sharing options...
Robert Posted November 22, 2005 Author Share Posted November 22, 2005 Never say die! ms5plus: Found a very embarrasing mistake, once this was fixed the game started, with corrupt graphics. Since the graphics roms were the same as mslug5, I added the kof2000_neogeo line. Now the graphics were fixed, but the flashing PLUS was gone. Hmmm. Decided to investigate neocrypt.c and made a modification which fixed the problem. This mod allows a s1 rom to overrule the inbuilt text on any game of this type in the future. The final code for ms5plus:ROM_START( ms5plus ) ROM_REGION( 0x800000, REGION_CPU1, 0 ) ROM_LOAD16_WORD_SWAP( "268-p1p.bin", 0x000000, 0x100000, CRC(106b276f) ) ROM_LOAD16_WORD_SWAP( "268-p2p.bin", 0x100000, 0x200000, CRC(d6a458e8) ) ROM_LOAD16_WORD_SWAP( "268-p3p.bin", 0x300000, 0x200000, CRC(439ec031) ) NEO_SFIX_128K( "268-s1p.bin", CRC(21e04432) ) NEO_BIOS_SOUND_256K( "268-m1d.bin", CRC(6866d696) SHA1(3638b072e44277a6bffea5a78a915a14c6afcba0) ) ROM_REGION( 0x1000000, REGION_SOUND1, 0 ) ROM_LOAD( "268-v1d.bin", 0x000000, 0x800000, CRC(14848c5c) ) ROM_LOAD( "268-v2d.bin", 0x800000, 0x800000, CRC(696cce3b) ) ROM_REGION( 0x4000000, REGION_GFX3, 0 ) ROM_LOAD16_BYTE( "268-c1.bin", 0x0000000, 0x800000, CRC(27d59de8) SHA1(0447a675d885721cedc079788cf41ae3f797834b) ) ROM_LOAD16_BYTE( "268-c2.bin", 0x0000001, 0x800000, CRC(e600dee1) SHA1(e55e5a25616c4daf09692d1b53a92d6f31e842ac) ) ROM_LOAD16_BYTE( "268-c3.bin", 0x1000000, 0x800000, CRC(b650f098) SHA1(4cd729153bd5b2054fbe10c96d2bb370084d1d24) ) ROM_LOAD16_BYTE( "268-c4.bin", 0x1000001, 0x800000, CRC(10499589) SHA1(24542a3b70080e5a61fdab04ab314450a1d821ef) ) ROM_LOAD16_BYTE( "268-c5.bin", 0x2000000, 0x800000, CRC(19352405) SHA1(5ee255403739c11a65608dcff0984480f067d824) ) ROM_LOAD16_BYTE( "268-c6.bin", 0x2000001, 0x800000, CRC(b1531523) SHA1(786f342dbb7fea50139d6421e5b82e551772bf0a) ) ROM_LOAD16_BYTE( "268-c7.bin", 0x3000000, 0x800000, CRC(fe2c1338) SHA1(de9d257574881dd1684956f60011a20c1dd5a0d9) ) ROM_LOAD16_BYTE( "268-c8.bin", 0x3000001, 0x800000, CRC(ecce3141) SHA1(103247b57f8ea5746dd1cf92dda95a6dc9268c78) ) ROM_END //-------------------------------------------------------ms5plus DRIVER_INIT ( ms5plus ) { kof2000_neogeo_gfx_decrypt(0x19); sx_decrypt(1); neogeo_fix_bank_type = 1; init_neogeo(); } Link to comment Share on other sites More sharing options...
Recommended Posts