Author Topic: Bankswitch code for kof2003, svcchaos, mslug5, etc  (Read 23102 times)

Offline KingHanco

  • Sr. Member
  • ****
  • Posts: 401
  • Karma: +0/-4
  • "Special " Member
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #15 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
« Last Edit: December 01, 2005, 01:04:27 AM by KingHanco »

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #16 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 ?
IQ Forum Member

Offline iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #17 on: December 01, 2005, 02:03:10 AM »
Yup, I sure did.  Somebody doesn't like to search lol


Offline KingHanco

  • Sr. Member
  • ****
  • Posts: 401
  • Karma: +0/-4
  • "Special " Member
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #18 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:
« Last Edit: December 01, 2005, 04:54:25 AM by KingHanco »

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #19 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 .
« Last Edit: December 01, 2005, 05:37:30 AM by James33 »
IQ Forum Member

Offline KingHanco

  • Sr. Member
  • ****
  • Posts: 401
  • Karma: +0/-4
  • "Special " Member
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #20 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);
}
« Last Edit: December 01, 2005, 07:17:39 AM by KingHanco »

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #21 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;
}
« Last Edit: December 01, 2005, 07:56:15 AM by James33 »
IQ Forum Member

Offline KingHanco

  • Sr. Member
  • ****
  • Posts: 401
  • Karma: +0/-4
  • "Special " Member
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #22 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:

Offline KingHanco

  • Sr. Member
  • ****
  • Posts: 401
  • Karma: +0/-4
  • "Special " Member
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #23 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.
« Last Edit: December 01, 2005, 04:42:30 PM by KingHanco »

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #24 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 .
« Last Edit: December 01, 2005, 06:31:09 PM by James33 »
IQ Forum Member

Offline KingHanco

  • Sr. Member
  • ****
  • Posts: 401
  • Karma: +0/-4
  • "Special " Member
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #25 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.

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #26 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
« Last Edit: December 02, 2005, 05:52:32 AM by James33 »
IQ Forum Member

Offline KingHanco

  • Sr. Member
  • ****
  • Posts: 401
  • Karma: +0/-4
  • "Special " Member
Re: Bankswitch code for kof2003, svcchaos, mslug5, etc
« Reply #27 on: December 02, 2005, 11:49:48 AM »
Weard, My srceen doesn't look like that all at.

It normal on my screen.  :biggrin: