Welcome!

General Emulation => MAME => Topic started by: iq_132 on September 16, 2005, 01:34:12 AM

Title: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: iq_132 on September 16, 2005, 01:34:12 AM
Here's a port of BMS888's fantastic pvc bankswitch code.

Code: [Select]
// thanks to BMS888 and Halrin for much of this code
// MAME port by IQ_132 - neosource.1emu.net
static unsigned short CartRAM[0x1000];

void pvc_w8(unsigned int offset, unsigned char data)
{
*(((unsigned char*)CartRAM)+offset)=data;
}

unsigned char pvc_r8(unsigned int offset)
{
return *(((unsigned char*)CartRAM)+offset);
}

// These perform some palette calculations
// Unpack palette word to RGB dword
void pvc_prot1( void ) // on writes to e0/e1
{
unsigned char b1, b2;
b1 = pvc_r8(0x1fe1);
b2 = pvc_r8(0x1fe0);

pvc_w8(0x1fe2,(((b2>>0)&0xf)<<1)|((b1>>4)&1));
pvc_w8(0x1fe3,(((b2>>4)&0xf)<<1)|((b1>>5)&1));
pvc_w8(0x1fe4,(((b1>>0)&0xf)<<1)|((b1>>6)&1));
pvc_w8(0x1fe5, (b1>>7));
}

// Pack RGB dword to palette word
void pvc_prot2( void ) // on writes to e8/e9/ea/eb
{
unsigned char b1, b2, b3, b4;
b1 = pvc_r8(0x1fe9);
b2 = pvc_r8(0x1fe8);
b3 = pvc_r8(0x1feb);
b4 = pvc_r8(0x1fea);

pvc_w8(0x1fec,(b2>>1)|((b1>>1)<<4));
pvc_w8(0x1fed,(b4>>1)|((b2&1)<<4)|((b1&1)<<5)|((b4&1)<<6)|((b3&1)<<7));
}

void pvc_write_bankswitch( void )
{
UINT32 bankaddress;
bankaddress = ((CartRAM[0xff8]>>8)|(CartRAM[0xff9]<<8));
*(((unsigned char *)CartRAM) + 0x1ff0) = 0xA0;
*(((unsigned char *)CartRAM) + 0x1ff1) &= 0xFE;
*(((unsigned char *)CartRAM) + 0x1ff3) &= 0x7F;
neogeo_set_cpu1_second_bank(bankaddress+0x100000);
}

static READ16_HANDLER( pvc_prot_r )
{
return CartRAM[ offset ];
}

static WRITE16_HANDLER( pvc_prot_w )
{
COMBINE_DATA( &CartRAM[ offset ] );

if (offset == 0xFF0)pvc_prot1();
else if(offset >= 0xFF4 && offset <= 0xFF5)pvc_prot2();
else if(offset >= 0xFF8)pvc_write_bankswitch();
}

for kof2003, use this init:

Code: [Select]
DRIVER_INIT( kof2003 )
{
kof2003_px_decrypt();
kof2003_sx_decrypt();
kof2003_vx_decrypt();

neogeo_fix_bank_type = 2;
init_neogeo();

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);

memory_install_read16_handler( 0, ADDRESS_SPACE_PROGRAM, 0xc00000, 0xc3ffff, 0, 0, MRA16_BANK3 );  // 256k bios
}


for kof2003b:

Code: [Select]
static READ16_HANDLER( kof2003b_prot_r )
{
return CartRAM[0xff9];
}

DRIVER_INIT( kof2003b )
{
kof2003b_px_decrypt();
kof2003b_sx_decrypt();

init_neogeo();

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x058196, 0x058197, 0, 0, kof2003b_prot_r);
}


Code: [Select]
DRIVER_INIT( kof2k3up )
{
kof2003b_px_decrypt();
kof2k3up_px_decrypt();
kof2k3up_sx_decrypt();

init_neogeo();

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x058196, 0x058197, 0, 0, kof2003b_prot_r);
}


Code: [Select]
DRIVER_INIT( svcchaos )
{
svcchaos_px_decrypt();
svcchaos_gfx_decrypt();
svcchaos_vx_decrypt();

neogeo_fix_bank_type = 2;
init_neogeo();

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
}

Code: [Select]
DRIVER_INIT( svchaosa )
{
svcchaos_px_decrypt();
kof2000_neogeo_gfx_decrypt(0x57);
svcchaos_vx_decrypt();

neogeo_fix_bank_type = 2;
init_neogeo();

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
}

Code: [Select]
DRIVER_INIT( svcboot )
{
svcboot_px_decrypt();
svcboot_cx_decrypt();

init_neogeo();

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
}

Code: [Select]
DRIVER_INIT( svcsplus )
{
svcsplus_px_decrypt();
svcsplus_sx_decrypt();
svcboot_cx_decrypt();

svcsplus_px_hack();

init_neogeo();

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
}

Code: [Select]
DRIVER_INIT( mslug5 )
{
mslug5_px_decrypt();
mslug5_vx_decrypt();

neogeo_fix_bank_type = 1;
kof2000_neogeo_gfx_decrypt(0x19);

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);

init_neogeo();
}
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: neo04 on September 16, 2005, 03:30:42 AM
thx for all the help :)
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: James33 on September 17, 2005, 05:49:21 AM
Thanks IQ :)
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: MAXCHAOBISA on September 17, 2005, 12:08:07 PM
Thanks IQ
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: iq_132 on September 19, 2005, 10:38:53 PM
Had a question about kf2k4ex, ms5plus, and mslug5b

ms5plus bankswitch

Code: [Select]
// Credits to neoaethyr
static WRITE16_HANDLER ( mslug5p_bankswitch_w ) /* Bootleg, Plus */
{
if (offset == 2)
{
neogeo_set_cpu1_second_bank(data<<16);
}
}

// put this in the ms5plus init

Code: [Select]

memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, mslug5p_bankswitch_w);



for mslug5b, just swap the second and third meg of the P rom

Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: neo04 on September 20, 2005, 12:59:23 AM
nice! thx neoaethyr & iq :)
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: Ashura-X on September 21, 2005, 08:34:09 AM
Hmmm any mslug5b driver for mame please ???? :P
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: iq_132 on September 21, 2005, 10:15:05 AM
Not tested (I'm not at my pc right now) but it should work...

Code: [Select]
DRIVER_INIT( mslug5b )
{
UINT8 *src = memory_region(REGION_CPU1);
UINT8 *dst = malloc(0x100000);
if (dst)
{
// Just swap parts 2 and 3 of the P data
memcpy (dst + 0x000000, src + 0x300000, 0x100000);
memcpy (src + 0x300000, src + 0x200000, 0x100000);
memcpy (src + 0x200000, dst + 0x000000, 0x100000);

free (dst);
}

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);

init_neogeo();
}
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: Ashura-X on September 21, 2005, 01:01:06 PM
Not tested (I'm not at my pc right now) but it should work...

Code: [Select]
DRIVER_INIT( mslug5b )
{
UINT8 *src = memory_region(REGION_CPU1);
UINT8 *dst = malloc(0x100000);
if (dst)
{
// Just swap parts 2 and 3 of the P data
memcpy (dst + 0x000000, src + 0x300000, 0x100000);
memcpy (src + 0x300000, src + 0x200000, 0x100000);
memcpy (src + 0x200000, dst + 0x000000, 0x100000);

free (dst);
}

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);

init_neogeo();
}


Thx iq but I want to know about the load rom driver data too :P
Which roms I do need to added that game to mame...
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: iq_132 on September 21, 2005, 01:46:19 PM
Look in the old mslug5 emulation infos thread at romshare.  The bootleg is the original rom released.  The romdata should be there.
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: James33 on November 05, 2005, 07:55:27 AM
Had a question about kf2k4ex, ms5plus, and mslug5b

ms5plus bankswitch

Code: [Select]
// Credits to neoaethyr
static WRITE16_HANDLER ( mslug5p_bankswitch_w ) /* Bootleg, Plus */
{
if (offset == 2)
{
neogeo_set_cpu1_second_bank(data<<16);
}
}

// put this in the ms5plus init

Code: [Select]

memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, mslug5p_bankswitch_w);



for mslug5b, just swap the second and third meg of the P rom




Do you have driver for The King of Fighters 2004 - EX - Hero ?
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: iq_132 on November 06, 2005, 01:51:47 AM
This might work (If it doesn't let me know ;))

Code: [Select]
static WRITE16_HANDLER( kf2k4ex_prot_w )
{
UINT32 bankaddress;
COMBINE_DATA( &CartRAM[ offset ] );
bankaddress = CartRAM[0]|(CartRAM[1]<<8);
neogeo_set_cpu1_second_bank(bankaddress+0x100000);
}

Code: [Select]
memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, kf2k4ex_prot_w);
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: James33 on November 06, 2005, 04:52:00 AM
Ok thanks IQ I will let you know :D
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: James33 on November 07, 2005, 05:43:06 AM
Yep the code works thanks IQ .   :biggrin:
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: iq_132 on November 12, 2005, 10:47:24 AM
I haven't been able to port that quite yet, there's something that keeps glitching up, and I can't quite track it down ^^
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: KingHanco on December 01, 2005, 01:00:36 AM
I getting a problem with the svcchaos and svchaosa. Heh...

It complanning about this.

Code: [Select]
/* svcchaos / svchaosa Init Start */
static UINT16 mv0_prot_offset[ 0x08 ];
static UINT16 mv0_bankswitch_offset[ 2 ];
static int mv0_bankswitch_flg;

static void svcchaos_px_decrypt( void )
{
const unsigned char xor1[ 0x20 ] = {
0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8,
0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f,
};

const unsigned char xor2[ 0x20 ] = {
0x69, 0x0b, 0x60, 0xd6, 0x4f, 0x01, 0x40, 0x1a, 0x9f, 0x0b, 0xf0, 0x75, 0x58, 0x0e, 0x60, 0xb4,
0x14, 0x04, 0x20, 0xe4, 0xb9, 0x0d, 0x10, 0x89, 0xeb, 0x07, 0x30, 0x90, 0x50, 0x0e, 0x20, 0x26,
};

int i;
int ofst;
UINT8 *rom, *buf;

rom = memory_region( REGION_CPU1 );

for( i = 0; i < 0x100000; i++ ){
rom[ i ] ^= xor1[ (i % 0x20) ];
}

for( i = 0x100000; i < 0x800000; i++ ){
rom[ i ] ^= xor2[ (i % 0x20) ];
}

for( i = 0x100000; i < 0x800000; i += 4 ){
UINT16 *rom16 = (UINT16*)&rom[ i + 1 ];
*rom16 = BITSWAP16( *rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0 );
}

buf = malloc( 0x800000 );
memcpy( buf, rom, 0x800000 );

for( i = 0; i < 0x0100000 / 0x10000; i++ ){
ofst = (i & 0xf0) + BITSWAP8( (i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1 );
memcpy( &rom[ i * 0x10000 ], &buf[ ofst * 0x10000 ], 0x10000 );
}

for( i = 0x100000; i < 0x800000; i += 0x100 ){
ofst = (i & 0xf000ff) +
   ((i & 0x000f00) ^ 0x00a00) +
   (BITSWAP8( ((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2 ) << 12);

memcpy( &rom[ i ], &buf[ ofst ], 0x100 );
}

free( buf );

buf = malloc( 0x800000 );
memcpy( buf, rom, 0x800000 );
memcpy( &rom[ 0x100000 ], &buf[ 0x700000 ], 0x100000 );
memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x600000 );
free( buf );
}

static void svcchaos_gfx_decrypt( void )
{
const unsigned char xor[ 4 ] = {
0x34, 0x21, 0xc4, 0xe9,
};

int i;
int ofst;

int rom_size = memory_region_length( REGION_GFX3 );
UINT8 *rom = memory_region( REGION_GFX3 );
UINT8 *buf = malloc( rom_size );

for( i = 0; i < rom_size; i++ ){
rom[ i ] ^= xor[ (i % 4) ];
}

for( i = 0; i < rom_size; i += 4 ){
UINT32 *rom32 = (UINT32*)&rom[ i ];
*rom32 = BITSWAP32( *rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05,
0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06,
0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d,
0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16 );
}

memcpy( buf, rom, rom_size );

for( i = 0; i < rom_size / 4; i++ ){
ofst =  BITSWAP24( (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 );
}

free( buf );

kof2000_neogeo_gfx_decrypt(0x57);

rom = memory_region( REGION_GFX1 );
rom_size = memory_region_length( REGION_GFX1 );

for( i = 0; i < rom_size; i++ ){
rom[ i ] = BITSWAP8( rom[ i ] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3 );
}
}

static void svcchaos_vx_decrypt( void )
{
const unsigned char xor[ 0x08 ] = {
0xc3, 0xfd, 0x81, 0xac, 0x6d, 0xe7, 0xbf, 0x9e
};

int ofst;

int rom_size = memory_region_length( REGION_SOUND1 );
UINT8 *rom = memory_region( REGION_SOUND1 );
UINT8 *buf = malloc( rom_size );
int i;

memcpy( buf, rom, rom_size );

for( i=0;i<rom_size;i++ ){
ofst = (i & 0xfefffe) |
   ((i & 0x010000) >> 16) |
   ((i & 0x000001) << 16);

ofst ^= 0xc2000;

rom[ ofst ] = buf[ ((i + 0xffac28) & 0xffffff) ] ^ xor[ (ofst & 0x07) ];
}

free( buf );
}

DRIVER_INIT( svcchaos )
{
svcchaos_px_decrypt();
svcchaos_gfx_decrypt();
svcchaos_vx_decrypt();

neogeo_fix_bank_type = 2;
init_neogeo();
memory_install_read16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffdf, 0, 0, MRA16_RAM );
memory_install_write16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffdf, 0, 0, MWA16_RAM );
memory_install_read16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2fffe0, 0x2fffef, 0, 0, mv0_prot_r );
memory_install_write16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2fffe0, 0x2fffef, 0, 0, mv0_prot_w );
memory_install_read16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, mv0_bankswitch_r );
memory_install_write16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, mv0_bankswitch_w );
}

DRIVER_INIT( svchaosa )
{
svcchaos_px_decrypt();
svcchaos_vx_decrypt();
kof2000_neogeo_gfx_decrypt(0x57);

neogeo_fix_bank_type = 2;
init_neogeo();
memory_install_read16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffdf, 0, 0, MRA16_RAM );
memory_install_write16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffdf, 0, 0, MWA16_RAM );
memory_install_read16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2fffe0, 0x2fffef, 0, 0, mv0_prot_r );
memory_install_write16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2fffe0, 0x2fffef, 0, 0, mv0_prot_w );
memory_install_read16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, mv0_bankswitch_r );
memory_install_write16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2fffff, 0, 0, mv0_bankswitch_w );
}
/* svcchaos / svchaosa Init End */

Here the other part.

Code: [Select]
ROM_START( svcchaos )
ROM_REGION( 0x2000000, REGION_CPU1, 0 )
ROM_LOAD16_WORD_SWAP( "269-p1.bin", 0x000000, 0x2000000, CRC(432cfdfc) SHA1(19b40d32188a8bace6d2d570c6cf3d2f1e31e379) )

ROM_REGION( 0x80000, REGION_GFX1, 0 )
ROM_FILL( 0x000000, 0x80000, 0 )
ROM_REGION( 0x20000, REGION_GFX2, 0 )
ROM_LOAD( "sfix.sfx",  0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) )

ROM_REGION( 0x80000, REGION_USER4, 0 )
ROM_LOAD( "269-m1.bin", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) )
NEO_BIOS_SOUND_128K( "269-m1d.bin", CRC(fd4f0ff9) SHA1(e97e864aaa4789d854363512986e80c0606da996) )

ROM_REGION( 0x1000000, REGION_SOUND1, 0)
ROM_LOAD( "269-v1.bin", 0x000000, 0x800000, CRC(c659b34c) SHA1(1931e8111ef43946f68699f8707334c96f753a1e) )
ROM_LOAD( "269-v2.bin", 0x800000, 0x800000, CRC(dd903835) SHA1(e58d38950a7a8697bb22a1cc7a371ae6664ae8f9) )

NO_DELTAT_REGION

ROM_REGION( 0x4000000, REGION_GFX3, 0 )
ROM_LOAD( "269-c1.bin", 0x0000000, 0x2000000, CRC(1b608f9c) SHA1(4e70ad182da2ca18815bd3936efb04a06ebce01e) )
ROM_LOAD( "269-c2.bin", 0x2000000, 0x2000000, CRC(5a95f294) SHA1(6123cc7b20b494076185d27c2ffea910e124b195) )
ROM_END

ROM_START( svchaosa )
ROM_REGION( 0x800000, REGION_CPU1, 0 )
ROM_LOAD32_WORD_SWAP( "269-p1a.bin", 0x000000, 0x400000, CRC(38e2005e) SHA1(1b902905916a30969282f1399a756e32ff069097) )
ROM_LOAD32_WORD_SWAP( "269-p2a.bin", 0x000002, 0x400000, CRC(6d13797c) SHA1(3cb71a95cea6b006b44cac0f547df88aec0007b7) )

ROM_REGION( 0x80000, REGION_GFX1, 0 )
ROM_FILL( 0x000000, 0x80000, 0 )
ROM_REGION( 0x20000, REGION_GFX2, 0 )
ROM_LOAD( "sfix.sfx",  0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) )

ROM_REGION( 0x80000, REGION_USER4, 0 )
ROM_LOAD( "269-m1.bin", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) )
NEO_BIOS_SOUND_128K( "269-m1d.bin", CRC(fd4f0ff9) SHA1(e97e864aaa4789d854363512986e80c0606da996) )

ROM_REGION( 0x1000000, REGION_SOUND1, 0)
ROM_LOAD( "269-v1.bin", 0x000000, 0x800000, CRC(c659b34c) SHA1(1931e8111ef43946f68699f8707334c96f753a1e) )
ROM_LOAD( "269-v2.bin", 0x800000, 0x800000, CRC(dd903835) SHA1(e58d38950a7a8697bb22a1cc7a371ae6664ae8f9) )

NO_DELTAT_REGION

ROM_REGION( 0x4000000, REGION_GFX3, 0 )
ROM_LOAD16_BYTE( "269-c1e.bin", 0x0000000, 0x800000, CRC(887b4068) SHA1(227cdcf7a10a415f1e3afe7ae97acc9afc2cc8e1) )
ROM_LOAD16_BYTE( "269-c2e.bin", 0x0000001, 0x800000, CRC(4e8903e4) SHA1(31daaa4fd6c23e8f0a8428931c513d97d2eee1bd) )
ROM_LOAD16_BYTE( "269-c3e.bin", 0x1000000, 0x800000, CRC(7d9c55b0) SHA1(1f94a948b3e3c31b3ff05518ef525031a3cb2c62) )
ROM_LOAD16_BYTE( "269-c4e.bin", 0x1000001, 0x800000, CRC(8acb5bb6) SHA1(2c27d6e309646d7b84da85f78c06e4aaa74e844b) )
ROM_LOAD16_BYTE( "269-c5e.bin", 0x2000000, 0x800000, CRC(097a4157) SHA1(54d839f55d27f68c704a94ea3c63c644ffc22ca4) )
ROM_LOAD16_BYTE( "269-c6e.bin", 0x2000001, 0x800000, CRC(e19df344) SHA1(20448add53ab25dd3a8f0b681131ad3b9c68acc9) )
ROM_LOAD16_BYTE( "269-c7e.bin", 0x3000000, 0x800000, CRC(d8f0340b) SHA1(43114af7557361a8903bb8cf8553f602946a9220) )
ROM_LOAD16_BYTE( "269-c8e.bin", 0x3000001, 0x800000, CRC(2570b71b) SHA1(99266e1c2ffcf324793fb5c55325fbc7e6265ac0) )
ROM_END

This is the last drivers that I'm adding today. 12 games included these 2. :D
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: James33 on December 01, 2005, 01:56:21 AM
Oh btw, do you have code for kof10th bankswitch?

I thought IQ has posted this somewhere already ?
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: iq_132 on December 01, 2005, 02:03:10 AM
Yup, I sure did.  Somebody doesn't like to search lol
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: KingHanco on December 01, 2005, 02:54:33 AM
Hmmm... I gotting a lots of errors Robert.

I redone this.

Code: [Select]
if (!strcmp(Machine->gamedrv->name,"svcchaos") || !strcmp(Machine->gamedrv->name,"svchaosa"))
/*  Not in use yet and save. -  !strcmp(Machine->gamedrv->name,"svcboot") || !strcmp(Machine->gamedrv->name,"svcsplus")) */
        {
                memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
                memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
        }

My fixs works.  :biggrin:
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: James33 on December 01, 2005, 05:36:19 AM
Hmmm... I gotting a lots of errors Robert.

I redone this.

Code: [Select]
if (!strcmp(Machine->gamedrv->name,"svcchaos") || !strcmp(Machine->gamedrv->name,"svchaosa"))
/*  Not in use yet and save. -  !strcmp(Machine->gamedrv->name,"svcboot") || !strcmp(Machine->gamedrv->name,"svcsplus")) */
        {
                memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
                memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
        }



My fixs works.  :biggrin:

It does not matter if they were there or not . It will still compile and mame will work . So in other words what you call a fix is a waste of time :)  > sorry if that offends but I was tuaght to be honest with my thoughts .
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: KingHanco on December 01, 2005, 07:04:12 AM
It does not matter if they were there or not . It will still compile and mame will work . So in other words what you call a fix is a waste of time :)  > sorry if that offends but I was tuaght to be honest with my thoughts .

How come I get errors on using this then?

Code: [Select]
//-------------------------------------------------------------------------most svc versions
if (!strcmp(Machine->gamedrv->name,"svcchaos") ||
!strcmp(Machine->gamedrv->name,"svchaosa") ||
!strcmp(Machine->gamedrv->name,"svcboot") ||
!strcmp(Machine->gamedrv->name,"svcsplus"))
{
memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
}

After that I fixs it then the errors went away. It so weard.

It should be this bellow.

Code: [Select]
//-------------------------------------------------------------------------most svc versions
if (!strcmp(Machine->gamedrv->name,"svcchaos") || !strcmp(Machine->gamedrv->name,"svchaosa") || !strcmp(Machine->gamedrv->name,"svcboot") || !strcmp(Machine->gamedrv->name,"svcsplus"))
{
memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
}

Other wise it looking for the missing extra ) that cause over 10 errors showing.

Have another look here for exsample. This is correct bellow.

   
Code: [Select]
if (!strcmp(Machine->gamedrv->name,"kof99") || !strcmp(Machine->gamedrv->name,"kof99a") || !strcmp(Machine->gamedrv->name,"kof99e"))
{
/* special ROM banking handler */
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2ffff1, 0, 0, kof99_bankswitch_w);

/* additional protection */
memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
}

See the )) at the end? If those aren't on the same line then everyone of those need a )) at the end.

Like this one bellow.

   
Code: [Select]
if (!strcmp(Machine->gamedrv->name,"garou"))
{
/* special ROM banking handler */
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fffc0, 0x2fffc1, 0, 0, garou_bankswitch_w);

/* additional protection */
memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe446, 0x2fe447, 0, 0, prot_9a37_r);
}

You saying that it doesn't matter then take a look in the machine/neogeo.c. You not find anything look like this bellow. Because this is wrong and will get the errors just like I did earlyer.

Code: [Select]
//-------------------------------------------------------------------------most svc versions
if (!strcmp(Machine->gamedrv->name,"svcchaos") ||
!strcmp(Machine->gamedrv->name,"svchaosa") ||
!strcmp(Machine->gamedrv->name,"svcboot") ||
!strcmp(Machine->gamedrv->name,"svcsplus"))
{
memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
}
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: James33 on December 01, 2005, 07:37:51 AM
I have mine like this  and is sort of like how robbert has it and it works fine .  Even the offical mame code is like that in machine\neogeo.c
Mame Plus has it different both work though :)
By the way this is how I have it in Mame and Mame Plus . 


Code: [Select]
           if (!strcmp(Machine->gamedrv->name,"svcchaos") ||
!strcmp(Machine->gamedrv->name,"svchaosa") ||
!strcmp(Machine->gamedrv->name,"svcboot"))
{
memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, MRA16_RAM );
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, MWA16_RAM );

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
}

if (!strcmp(Machine->gamedrv->name,"svcsplus"))
{
UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1);
mem16[0x9e90/2] = 0x000f;
mem16[0x9e92/2] = 0xc9c0;
mem16[0xa10c/2] = 0x4eb9;
mem16[0xa10e/2] = 0x000e;
mem16[0xa110/2] = 0x9750;

memory_install_read16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, MRA16_RAM );
memory_install_write16_handler( 0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, MWA16_RAM );

memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);

}

if (!strcmp(Machine->gamedrv->name,"svcplusa") ||
!strcmp(Machine->gamedrv->name,"svcplus"))
{
UINT8 *src = memory_region( REGION_CPU1 );
src[ 0x0f8010 ] = 0x40;
src[ 0x0f8011 ] = 0x04;
src[ 0x0f8012 ] = 0x00;
src[ 0x0f8013 ] = 0x10;
src[ 0x0f8014 ] = 0x40;
src[ 0x0f8015 ] = 0x46;
src[ 0x0f8016 ] = 0xc1;
src[ 0x0f802c ] = 0x16;
}
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: KingHanco on December 01, 2005, 08:12:35 AM
RE: Even the offical mame code is like that in machine\neogeo.c

No it not. I check on Mame Plus NeoGeo source and the Mame NeoGeo source.

Only in the Mame Plus does that the way. The way you and Robert does it.

Download the offical Mame source. You will see the differents between the Mame Plus NeoGeo source and the Mame NeoGeo source.

Mame Plus over writes the Mame NeoGeo source. A little different coding Mame Plus uses. Beside it got hacks coding which the Mame NeoGeo source doesn't have which are not on the same page.

Anyway I don't make Mame Plus and don't uses the Mame Plus source.

Why do you think that I have so many problems? Because I don't use the Mame Plus and source.  :biggrin:
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: KingHanco on December 01, 2005, 04:40:36 PM
Hanco - if you think my code causes errors maybe I shouldn't provide any more help to you! The code works fine for me.

Well I fixs some other places other than the one that I post fixs. Just minder fixes and not a whole thing which you guys been helping me on. For exsample bellow.

Code: [Select]
ROMREGION_SOUNDONLY doesn't work.

GAMEB( 1992, androdun, neogeo,   neogeo, neogeo, neogeo,  neogeo,   ROT0, "Visco", "Andro Dunos" ) doesn't work.

osd_malloc doesn't work.

Even the one bellow doesn't work.

if (!strcmp(Machine->gamedrv->name,"svcchaos") ||
!strcmp(Machine->gamedrv->name,"svchaosa") ||
!strcmp(Machine->gamedrv->name,"svcboot") ||
!strcmp(Machine->gamedrv->name,"svcsplus"))

data16_t doesn't work.

You guys seem that don't know what all the errors because I can't post the snapshots anymore. iq_132 have me disabled where I can't post any. I had to do alot of fixing. Without the snapshot then it pointless to tell you. I'm  using the Mame 0.102 source only.
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: James33 on December 01, 2005, 06:23:19 PM
RE: Even the offical mame code is like that in machine\neogeo.c

No it not. I check on Mame Plus NeoGeo source and the Mame NeoGeo source.

Only in the Mame Plus does that the way. The way you and Robert does it.

Download the offical Mame source. You will see the differents between the Mame Plus NeoGeo source and the Mame NeoGeo source.

Mame Plus over writes the Mame NeoGeo source. A little different coding Mame Plus uses. Beside it got hacks coding which the Mame NeoGeo source doesn't have which are not on the same page.

Anyway I don't make Mame Plus and don't uses the Mame Plus source.

Why do you think that I have so many problems? Because I don't use the Mame Plus and source.  :biggrin:

The code format I posted is more or less the same as the offical source . I am talking about the offical mame not mame plus or any other non offical build

I suggest you check the original Mame source  Not Mame Plus or any other source

When you get errors on your compile you should always post the errors here so then we should be able to help you .
Do not go telling us that the code is wrong when we know its not .  The codes we have posted here work in our builds so the problem is with what you doing when you add the code to your source .


James, your code for svcplusa - I didn't have this at all - not sure of its importance, but I've taken a note of it should it be needed later.

Since that code does not have a bankswitch you are able to get a decrypted P rom .
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: KingHanco on December 01, 2005, 07:25:42 PM
Since that code does not have a bankswitch you are able to get a decrypted P rom .

Yes.

Ok maybe I did something wrong then. Sorry.

I will post the whole driver though.

Code: [Select]
DRIVER( svcchaos ) /* 0269 (c) 2003 SNK Playmore */
DRIVER( svchaosa ) /* 0269 (c) 2003 SNK Playmore */

ROM_START( svcchaos )
ROM_REGION( 0x2000000, REGION_CPU1, 0 )
ROM_LOAD16_WORD_SWAP( "269-p1.bin", 0x000000, 0x2000000, CRC(432cfdfc) SHA1(19b40d32188a8bace6d2d570c6cf3d2f1e31e379) )

ROM_REGION( 0x80000, REGION_GFX1, 0 )
ROM_FILL( 0x000000, 0x80000, 0 )
ROM_REGION( 0x20000, REGION_GFX2, 0 )
ROM_LOAD( "sfix.sfx",  0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) )

ROM_REGION( 0x80000, REGION_USER4, 0 )
ROM_LOAD( "269-m1.bin", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) )
NEO_BIOS_SOUND_128K( "269-m1d.bin", CRC(fd4f0ff9) SHA1(e97e864aaa4789d854363512986e80c0606da996) )

ROM_REGION( 0x1000000, REGION_SOUND1, 0)
ROM_LOAD( "269-v1.bin", 0x000000, 0x800000, CRC(c659b34c) SHA1(1931e8111ef43946f68699f8707334c96f753a1e) )
ROM_LOAD( "269-v2.bin", 0x800000, 0x800000, CRC(dd903835) SHA1(e58d38950a7a8697bb22a1cc7a371ae6664ae8f9) )

NO_DELTAT_REGION

ROM_REGION( 0x4000000, REGION_GFX3, 0 )
ROM_LOAD( "269-c1.bin", 0x0000000, 0x2000000, CRC(1b608f9c) SHA1(4e70ad182da2ca18815bd3936efb04a06ebce01e) )
ROM_LOAD( "269-c2.bin", 0x2000000, 0x2000000, CRC(5a95f294) SHA1(6123cc7b20b494076185d27c2ffea910e124b195) )
ROM_END

ROM_START( svchaosa )
ROM_REGION( 0x800000, REGION_CPU1, 0 )
ROM_LOAD32_WORD_SWAP( "269-p1a.bin", 0x000000, 0x400000, CRC(38e2005e) SHA1(1b902905916a30969282f1399a756e32ff069097) )
ROM_LOAD32_WORD_SWAP( "269-p2a.bin", 0x000002, 0x400000, CRC(6d13797c) SHA1(3cb71a95cea6b006b44cac0f547df88aec0007b7) )

ROM_REGION( 0x80000, REGION_GFX1, 0 )
ROM_FILL( 0x000000, 0x80000, 0 )
ROM_REGION( 0x20000, REGION_GFX2, 0 )
ROM_LOAD( "sfix.sfx",  0x000000, 0x20000, CRC(354029fc) SHA1(4ae4bf23b4c2acff875775d4cbff5583893ce2a1) )

ROM_REGION( 0x80000, REGION_USER4, 0 )
ROM_LOAD( "269-m1.bin", 0x00000, 0x80000, CRC(f6819d00) SHA1(d3bbe09df502464f104e53501708ac6e2c1832c6) )
NEO_BIOS_SOUND_128K( "269-m1d.bin", CRC(fd4f0ff9) SHA1(e97e864aaa4789d854363512986e80c0606da996) )

ROM_REGION( 0x1000000, REGION_SOUND1, 0)
ROM_LOAD( "269-v1.bin", 0x000000, 0x800000, CRC(c659b34c) SHA1(1931e8111ef43946f68699f8707334c96f753a1e) )
ROM_LOAD( "269-v2.bin", 0x800000, 0x800000, CRC(dd903835) SHA1(e58d38950a7a8697bb22a1cc7a371ae6664ae8f9) )

NO_DELTAT_REGION

ROM_REGION( 0x4000000, REGION_GFX3, 0 )
ROM_LOAD16_BYTE( "269-c1e.bin", 0x0000000, 0x800000, CRC(887b4068) SHA1(227cdcf7a10a415f1e3afe7ae97acc9afc2cc8e1) )
ROM_LOAD16_BYTE( "269-c2e.bin", 0x0000001, 0x800000, CRC(4e8903e4) SHA1(31daaa4fd6c23e8f0a8428931c513d97d2eee1bd) )
ROM_LOAD16_BYTE( "269-c3e.bin", 0x1000000, 0x800000, CRC(7d9c55b0) SHA1(1f94a948b3e3c31b3ff05518ef525031a3cb2c62) )
ROM_LOAD16_BYTE( "269-c4e.bin", 0x1000001, 0x800000, CRC(8acb5bb6) SHA1(2c27d6e309646d7b84da85f78c06e4aaa74e844b) )
ROM_LOAD16_BYTE( "269-c5e.bin", 0x2000000, 0x800000, CRC(097a4157) SHA1(54d839f55d27f68c704a94ea3c63c644ffc22ca4) )
ROM_LOAD16_BYTE( "269-c6e.bin", 0x2000001, 0x800000, CRC(e19df344) SHA1(20448add53ab25dd3a8f0b681131ad3b9c68acc9) )
ROM_LOAD16_BYTE( "269-c7e.bin", 0x3000000, 0x800000, CRC(d8f0340b) SHA1(43114af7557361a8903bb8cf8553f602946a9220) )
ROM_LOAD16_BYTE( "269-c8e.bin", 0x3000001, 0x800000, CRC(2570b71b) SHA1(99266e1c2ffcf324793fb5c55325fbc7e6265ac0) )
ROM_END

static void svcchaos_px_decrypt( void )
{
const unsigned char xor1[ 0x20 ] = {
0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8,
0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f,
};

const unsigned char xor2[ 0x20 ] = {
0x69, 0x0b, 0x60, 0xd6, 0x4f, 0x01, 0x40, 0x1a, 0x9f, 0x0b, 0xf0, 0x75, 0x58, 0x0e, 0x60, 0xb4,
0x14, 0x04, 0x20, 0xe4, 0xb9, 0x0d, 0x10, 0x89, 0xeb, 0x07, 0x30, 0x90, 0x50, 0x0e, 0x20, 0x26,
};

int i;
int ofst;
UINT8 *rom, *buf;

rom = memory_region( REGION_CPU1 );

for( i = 0; i < 0x100000; i++ ){
rom[ i ] ^= xor1[ (i % 0x20) ];
}

for( i = 0x100000; i < 0x800000; i++ ){
rom[ i ] ^= xor2[ (i % 0x20) ];
}

for( i = 0x100000; i < 0x800000; i += 4 ){
UINT16 *rom16 = (UINT16*)&rom[ i + 1 ];
*rom16 = BITSWAP16( *rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0 );
}

buf = malloc( 0x800000 );
memcpy( buf, rom, 0x800000 );

for( i = 0; i < 0x0100000 / 0x10000; i++ ){
ofst = (i & 0xf0) + BITSWAP8( (i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1 );
memcpy( &rom[ i * 0x10000 ], &buf[ ofst * 0x10000 ], 0x10000 );
}

for( i = 0x100000; i < 0x800000; i += 0x100 ){
ofst = (i & 0xf000ff) +
   ((i & 0x000f00) ^ 0x00a00) +
   (BITSWAP8( ((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2 ) << 12);

memcpy( &rom[ i ], &buf[ ofst ], 0x100 );
}

free( buf );

buf = malloc( 0x800000 );
memcpy( buf, rom, 0x800000 );
memcpy( &rom[ 0x100000 ], &buf[ 0x700000 ], 0x100000 );
memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x600000 );
free( buf );
}

static void svcchaos_gfx_decrypt( void )
{
const unsigned char xor[ 4 ] = {
0x34, 0x21, 0xc4, 0xe9,
};

int i;
int ofst;

int rom_size = memory_region_length( REGION_GFX3 );
UINT8 *rom = memory_region( REGION_GFX3 );
UINT8 *buf = malloc( rom_size );

for( i = 0; i < rom_size; i++ ){
rom[ i ] ^= xor[ (i % 4) ];
}

for( i = 0; i < rom_size; i += 4 ){
UINT32 *rom32 = (UINT32*)&rom[ i ];
*rom32 = BITSWAP32( *rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05,
0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06,
0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d,
0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16 );
}

memcpy( buf, rom, rom_size );

for( i = 0; i < rom_size / 4; i++ ){
ofst =  BITSWAP24( (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 );
}

free( buf );

kof2000_neogeo_gfx_decrypt(0x57);

rom = memory_region( REGION_GFX1 );
rom_size = memory_region_length( REGION_GFX1 );

for( i = 0; i < rom_size; i++ ){
rom[ i ] = BITSWAP8( rom[ i ] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3 );
}
}

static void svcchaos_vx_decrypt( void )
{
const unsigned char xor[ 0x08 ] = {
0xc3, 0xfd, 0x81, 0xac, 0x6d, 0xe7, 0xbf, 0x9e
};

int ofst;

int rom_size = memory_region_length( REGION_SOUND1 );
UINT8 *rom = memory_region( REGION_SOUND1 );
UINT8 *buf = malloc( rom_size );
int i;

memcpy( buf, rom, rom_size );

for( i=0;i<rom_size;i++ ){
ofst = (i & 0xfefffe) |
   ((i & 0x010000) >> 16) |
   ((i & 0x000001) << 16);

ofst ^= 0xc2000;

rom[ ofst ] = buf[ ((i + 0xffac28) & 0xffffff) ] ^ xor[ (ofst & 0x07) ];
}

free( buf );
}

DRIVER_INIT( svcchaos )
{
svcchaos_px_decrypt();
svcchaos_gfx_decrypt();
svcchaos_vx_decrypt();
neogeo_fix_bank_type = 2;
init_neogeo();
}

DRIVER_INIT( svchaosa )
{
svcchaos_px_decrypt();
svcchaos_vx_decrypt();
kof2000_neogeo_gfx_decrypt(0x57);
neogeo_fix_bank_type = 2;
init_neogeo();
}

GAMEB( 2003, svcchaos, neogeo,   neogeo, neogeo, neogeo,   svcchaos,  ROT0, "Snk Playmore", "Snk Vs Capcom : Svc Chaos (Set 1)", 0 )
GAMEB( 2003, svchaosa, svcchaos, neogeo, neogeo, neogeo,   svchaosa,  ROT0, "Snk Playmore", "Snk Vs Capcom : Svc Chaos (Set 2)", 0 )

if (!strcmp(Machine->gamedrv->name,"svcchaos") || !strcmp(Machine->gamedrv->name,"svchaosa"))
/* Backup */
/* if (!strcmp(Machine->gamedrv->name,"svcchaos") || !strcmp(Machine->gamedrv->name,"svchaosa" || !strcmp(Machine->gamedrv->name,"svcboot") || !strcmp(Machine->gamedrv->name,"svcsplus")) */
        {
                memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_r);
                memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2fe000, 0x2fffff, 0, 0, pvc_prot_w);
        }

Both works fine here. The graphics, musics and sounds.
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: James33 on December 02, 2005, 05:37:50 AM
Yes.

Ok maybe I did something wrong then. Sorry.

That reply was not for you !



After looking around, I do have that code, but it's a patch routine in source\neogeo.c... just another way of getting the same result.

Yes I know that .  But like I said it allows you to decrypt the P rom where the other code does not .


Oh yes does your player select screen look like this for svcsplus ?
http://img360.imageshack.us/my.php?image=svcsplus8ny.jpg
Title: Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
Post by: KingHanco on December 02, 2005, 11:49:48 AM
Weard, My srceen doesn't look like that all at.

It normal on my screen.  :biggrin: