Jump to content

NeoGeo games drivers - I need help.


Recommended Posts

Ok I'm using the lates source Mame/Mame32 0.102.

 

I having some problems.

 

I starting off on kof2003 driver.

 

        DRIVER( kof2003 )       /* 271 (c) 2003 SNK Playmore */

ROM_START( kof2003 )
ROM_REGION( 0x900000, REGION_CPU1, 0 )
ROM_LOAD32_WORD_SWAP( "271-p1.bin", 0x000000, 0x400000, CRC(b9da070c) SHA1(1a26325af142a4dd221c336061761468598c4634) )
ROM_LOAD32_WORD_SWAP( "271-p2.bin", 0x000002, 0x400000, CRC(da3118c4) SHA1(582e4f44f03276adecb7b2848d3b96bf6da57f1e) )
ROM_LOAD16_WORD_SWAP( "271-p3.bin", 0x800000, 0x100000, CRC(5cefd0d2) SHA1(cddc3164629fed4b6f715e12b109ad35d1009355) )
ROM_LOAD16_WORD_SWAP( "271-p3d.bin", 0x800000, 0x100000, CRC(59d376da) SHA1(3c3ad0b79e8b37e838893a8f7b87e11d7eeee8f2) )

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

ROM_REGION16_BE( 0x40000, REGION_USER1, 0 )
ROM_LOAD16_WORD_SWAP( "271-bios.bin", 0x00000, 0x040000, CRC(c521b5bc) SHA1(c9a5db63523191dedd1b39baab8772f64f09b77f) )
NEOGEO_BIOS

ROM_REGION( 0x90000, REGION_CPU2, 0 )
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(97cf998b) SHA1(977387a7c76ef9b21d0b01fa69830e949a9a9626) )
ROM_LOAD( "271-m1d.bin", 0x00000, 0x80000, CRC(0e86af8f) SHA1(769102b67bb1a699cfa5674d66cdb46ae633cb65) )
ROM_RELOAD( 0x10000, 0x80000 )
ROM_REGION( 0x10000, REGION_GFX4, 0 )
ROM_LOAD( "000-lo.lo", 0x00000, 0x10000, CRC(e09e253c) SHA1(2b1c719531dac9bb503f22644e6e4236b91e7cfc) )

ROM_REGION( 0x1000000, REGION_SOUND1, 0 )
ROM_LOAD( "271-v1.bin", 0x000000, 0x1000000, CRC(1d96154b) SHA1(1d4e262b0d30cee79a4edc83bb9706023c736668) )


NO_DELTAT_REGION

ROM_REGION( 0x6000000, REGION_GFX3, 0 )
ROM_LOAD16_BYTE( "271-c1d.bin", 0x0000000, 0x1000000, CRC(c29acd28) SHA1(8a10409c5a9ad95fa9b56e94c14f1b96101fb179) )
ROM_LOAD16_BYTE( "271-c2d.bin", 0x0000001, 0x1000000, CRC(328e80b1) SHA1(c7f8069488be1a88a2ea03718b6a131f5c96bd3f) )
ROM_LOAD16_BYTE( "271-c3d.bin", 0x2000000, 0x1000000, CRC(020a11f1) SHA1(85cfae76234f72b0039ebc02f931bb2a9c10b1af) )
ROM_LOAD16_BYTE( "271-c4d.bin", 0x2000001, 0x1000000, CRC(991b5ed2) SHA1(99c4c470bc9cb388773e27de6df4a16803fc7b45) )
ROM_LOAD16_BYTE( "271-c5d.bin", 0x4000000, 0x1000000, CRC(c2de8b66) SHA1(40c2ea48fc20d470163a9dbb40c0276fc4cfceb9) )
ROM_LOAD16_BYTE( "271-c6d.bin", 0x4000001, 0x1000000, CRC(3ff750db) SHA1(714f14a2eb2df6f25d10a6b6aff4b3adfbc7a5dc) )
ROM_END

static void kof2003_px_decrypt( void )
{
       const unsigned char xor2[ 0x20 ] = {
       0xb4, 0x0f, 0x40, 0x6c, 0x38, 0x07, 0xd0, 0x3f, 0x53, 0x08, 0x80, 0xaa, 0xbe, 0x07, 0xc0, 0xfa,
       0xd0, 0x08, 0x10, 0xd2, 0xf1, 0x03, 0x70, 0x7e, 0x87, 0x0B, 0x40, 0xf6, 0x2a, 0x0a, 0xe0, 0xf9
       };

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

       rom = memory_region( REGION_CPU1 );

       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, 4, 5, 6, 7, 8, 9, 10, 11, 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, 1, 0, 3, 2 );
       memcpy( &rom[ i * 0x10000 ], &buf[ ofst * 0x10000 ], 0x10000 );
       }

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

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

       free( buf );

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

       memcpy( &rom[0x100000], &buf[0x800000], 0x100000 );
       memcpy( &rom[0x200000], &buf[0x100000], 0x700000 );

   free(buf);
}

static void kof2003_sx_decrypt( void )
{
       int i;
       int tx_size = memory_region_length( REGION_GFX1 );
       int rom_size = memory_region_length( REGION_GFX3 );
       UINT8 *src;
       UINT8 *dst;

       src = memory_region( REGION_GFX3 ) + rom_size - 0x1000000 - 0x80000;
       dst = memory_region( REGION_GFX1 );

       for( i = 0; i < tx_size / 2; i++ ){
       dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ];
       }

       src = memory_region( REGION_GFX3 ) + rom_size - 0x80000;
       dst = memory_region( REGION_GFX1 ) + 0x80000;

       for( i = 0; i < tx_size / 2; i++ ){
       dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ];
       }

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

DRIVER_INIT( kof2003 )
{
       kof2003_px_decrypt();
       kof2003_sx_decrypt();
       // save_decrypted_ps();
       neogeo_fix_bank_type = 2;
   init_neogeo();
}

/* SNK Playmore */
GAMEB( 2003, kof2003, neogeo, neogeo, neogeo, neogeo,  kof2003,   ROT0, "SNK Playmore", "The King of Fighters 2003", 0 )

/* PCB init info */
static UINT16 mv0_prot_offset[ 0x08 ];
static UINT16 mv0_bankswitch_offset[ 2 ];
static int mv0_bankswitch_flg;

static READ16_HANDLER( mv0_prot_r )
{
       return mv0_prot_offset[ offset ];
       }

       static WRITE16_HANDLER( mv0_prot_w )
       {
       mv0_prot_offset[ offset ] = (mv0_prot_offset[ offset ] & mem_mask) | ((~mem_mask) & data);

       if( offset == 0 ){
       UINT8 *ofst8 = (UINT8*)mv0_prot_offset;

       ofst8[ 0x02 ] = ((ofst8[ 0x01 ] >> 4) & 0x01) + ((ofst8[ 0x00 ] & 0x0f) << 1);
       ofst8[ 0x03 ] = ((ofst8[ 0x01 ] >> 5) & 0x01) + (((ofst8[ 0x00 ] >> 4) & 0x0f) << 1);
       ofst8[ 0x04 ] = ((ofst8[ 0x01 ] >> 6) & 0x01) + ((ofst8[ 0x01 ] & 0x0f) << 1);
       ofst8[ 0x05 ] = (ofst8[ 0x01 ] >> 7);
       }else if( offset == 5 ){
       UINT8 *ofst8 = (UINT8*)mv0_prot_offset;

       ofst8[ 0x0c ] = (ofst8[ 0x08 ] >> 1) | ((ofst8[ 0x09 ] >> 1) << 4);
       ofst8[ 0x0d ] = (ofst8[ 0x0a ] >> 1) |
       ((ofst8[ 0x08 ] & 0x01) << 4) |
       ((ofst8[ 0x09 ] & 0x01) << 5) |
       ((ofst8[ 0x0a ] & 0x01) << 6) |
       (ofst8[ 0x0b ] << 7);
   }
}

static READ16_HANDLER( mv0_bankswitch_r )
{
       if( mv0_bankswitch_offset[ 0 ] == 0xffff && mv0_bankswitch_offset[ 1 ] == 0xffff ){

       mv0_bankswitch_flg = 1;
       if( offset == 0 ){
       return 0xfea0;
       }else if( offset == 1 ){
       return 0x7fff;
       }else{
       return mv0_bankswitch_offset[ offset ];
       }
       }else if( mv0_bankswitch_offset[ 0 ] == 0x0000 && mv0_bankswitch_offset[ 1 ] == 0x0000 && mv0_bankswitch_flg == 1 ){

       if( offset == 0 ){
       return 0x00a0;
       }else if( offset == 1 ){
       mv0_bankswitch_flg = 0;
       return 0x0000;
       }else{
       return mv0_bankswitch_offset[ offset ];
       }
       }else{
       return mv0_bankswitch_offset[ offset ];
   }
}

static WRITE16_HANDLER( mv0_bankswitch_w )
{
       UINT32 bank_addr;

       mv0_bankswitch_offset[ offset ] = (mv0_bankswitch_offset[ offset ] & mem_mask) | ((~mem_mask) & data);

       bank_addr = (mv0_bankswitch_offset[ 0 ] >> 8) +(mv0_bankswitch_offset[ 1 ] << 8) +0x100000;

   neogeo_set_cpu1_second_bank( bank_addr );
}

if (!strcmp(Machine->gamedrv->name,"kof2003"))
{
      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, 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, 0x2ffff3, 0, 0, mv0_bankswitch_r );
      memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x2ffff0, 0x2ffff3, 0, 0, mv0_bankswitch_w );

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

 

The game crashes after loading about 2 or 3 seconds and return back to the Mame32 screen.

Link to comment
Share on other sites

  • Replies 51
  • Created
  • Last Reply

Top Posters In This Topic

Yes that driver is a bit old now. This is what I have, it's a rather complex driver. Firstly delete all the stuff you've put in from drivers\neogeo.c and machine\neogeo.c

 

Now, this goes in drivers\neogeo.c

ROM_START( kof2003 )
ROM_REGION( 0x900000, REGION_CPU1, 0 )
ROM_LOAD32_WORD_SWAP( "271-p1.bin", 0x000000, 0x400000, CRC(b9da070c) SHA1(1a26325af142a4dd221c336061761468598c4634) )
ROM_LOAD32_WORD_SWAP( "271-p2.bin", 0x000002, 0x400000, CRC(da3118c4) SHA1(582e4f44f03276adecb7b2848d3b96bf6da57f1e) )
ROM_LOAD16_WORD_SWAP( "271-p3.bin", 0x800000, 0x100000, CRC(5cefd0d2) SHA1(cddc3164629fed4b6f715e12b109ad35d1009355) )
ROM_LOAD16_WORD_SWAP( "271-p3d.bin", 0x800000, 0x100000, CRC(59d376da) SHA1(3c3ad0b79e8b37e838893a8f7b87e11d7eeee8f2) )

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

ROM_REGION16_BE( 0x40000, REGION_USER1, 0 )
ROM_LOAD16_WORD_SWAP( "271-bios.bin", 0x00000, 0x040000, CRC(c521b5bc) SHA1(c9a5db63523191dedd1b39baab8772f64f09b77f) )

ROM_REGION( 0x90000, REGION_CPU2, 0 )
ROM_LOAD( "sm1.sm1", 0x00000, 0x20000, CRC(97cf998b) SHA1(977387a7c76ef9b21d0b01fa69830e949a9a9626) )
ROM_LOAD( "271-m1d.bin",   0x00000, 0x80000, CRC(0e86af8f) SHA1(769102b67bb1a699cfa5674d66cdb46ae633cb65) )
ROM_RELOAD(             0x10000, 0x80000 )
ROM_REGION( 0x10000, REGION_GFX4, 0 )
ROM_LOAD( "000-lo.lo", 0x00000, 0x10000, CRC(e09e253c) SHA1(2b1c719531dac9bb503f22644e6e4236b91e7cfc) )

ROM_REGION( 0x1000000, REGION_SOUND1, 0 )
ROM_LOAD( "271-v1d.bin", 0x000000, 0x1000000, CRC(2058ec5e) SHA1(567fdf328f87551a949dc601f4e71c55368debf0) )
//	ROM_LOAD( "271-v1.bin", 0x000000, 0x1000000, CRC(1d96154b) SHA1(1d4e262b0d30cee79a4edc83bb9706023c736668) )

ROM_REGION( 0x6000000, REGION_GFX3, 0 )
ROM_LOAD16_BYTE( "271-c1d.bin", 0x0000000, 0x1000000, CRC(c29acd28) SHA1(8a10409c5a9ad95fa9b56e94c14f1b96101fb179) )
ROM_LOAD16_BYTE( "271-c2d.bin", 0x0000001, 0x1000000, CRC(328e80b1) SHA1(c7f8069488be1a88a2ea03718b6a131f5c96bd3f) )
ROM_LOAD16_BYTE( "271-c3d.bin", 0x2000000, 0x1000000, CRC(020a11f1) SHA1(85cfae76234f72b0039ebc02f931bb2a9c10b1af) )
ROM_LOAD16_BYTE( "271-c4d.bin", 0x2000001, 0x1000000, CRC(991b5ed2) SHA1(99c4c470bc9cb388773e27de6df4a16803fc7b45) )
ROM_LOAD16_BYTE( "271-c5d.bin", 0x4000000, 0x1000000, CRC(c2de8b66) SHA1(40c2ea48fc20d470163a9dbb40c0276fc4cfceb9) )
ROM_LOAD16_BYTE( "271-c6d.bin", 0x4000001, 0x1000000, CRC(3ff750db) SHA1(714f14a2eb2df6f25d10a6b6aff4b3adfbc7a5dc) )
ROM_END

//--------------------------------------------------------kof2003
static void kof2003_px_decrypt( void )
{
const unsigned char xor2[ 0x20 ] = {
 0xb4, 0x0f, 0x40, 0x6c, 0x38, 0x07, 0xd0, 0x3f, 0x53, 0x08, 0x80, 0xaa, 0xbe, 0x07, 0xc0, 0xfa,
 0xd0, 0x08, 0x10, 0xd2, 0xf1, 0x03, 0x70, 0x7e, 0x87, 0x0B, 0x40, 0xf6, 0x2a, 0x0a, 0xe0, 0xf9
};

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

rom = memory_region( REGION_CPU1 );

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, 4, 5, 6, 7, 8, 9, 10, 11, 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, 1, 0, 3, 2 );
 memcpy( &rom[ i * 0x10000 ], &buf[ ofst * 0x10000 ], 0x10000 );
}

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

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

free( buf );

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

memcpy( &rom[0x100000], &buf[0x800000], 0x100000 );
memcpy( &rom[0x200000], &buf[0x100000], 0x700000 );

free(buf);
}

static void kof2003_sx_decrypt( void )
{
int i;
int tx_size = memory_region_length( REGION_GFX1 );
int rom_size = memory_region_length( REGION_GFX3 );
UINT8 *src,*dst;

src = memory_region( REGION_GFX3 ) + rom_size - 0x1000000 - 0x80000;
dst = memory_region( REGION_GFX1 );

for( i = 0; i < tx_size / 2; i++ )
 dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ];

src = memory_region( REGION_GFX3 ) + rom_size - 0x80000;
dst = memory_region( REGION_GFX1 ) + 0x80000;

for( i = 0; i < tx_size / 2; i++ )
 dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ];

dst = memory_region( REGION_GFX1 );
for( i = 0; i < tx_size; i++ )
 dst[ i ] = BITSWAP8( dst[ i ] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3 );
}

DRIVER_INIT( kof2003 )
{
kof2003_px_decrypt();
kof2003_sx_decrypt();
neogeo_fix_bank_type = 2;
init_neogeo();
}


GAMEB( 2003, kof2003,  neogeo,   neogeo, neogeo, neogeo,  kof2003,  ROT0, "SNK Playmore", "The King of Fighters 2003 (PCB, decrypted C)", 0 )

 

 

In machine\neogeo.c

look for neogeo_custom_memory and put this just before it

//----------------------------------------new bankswitch code from neosource
// thanks to BMS888 and Halrin for much of this code
// MAME port by IQ_132 - neosource.1emulation.com
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();
}

 

still machine\neogeo.c, look in the neogeo_custom_memory routine,

you will see code for various games. Add this:

//-------------------------------------------------------------------------kof2003
if (!strcmp(Machine->gamedrv->name,"kof2003"))
{
 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
}

 

Now, do a clean compile and it "should" work. Good luck.

Link to comment
Share on other sites

I'm getting an error on static.

 

syntax error before 'static'

 

Something isn't right there.

 

/***************** MEMCARD GLOBAL VARIABLES ******************/
UINT8 *neogeo_memcard;  /* Pointer to 2kb RAM zone */

UINT8 *neogeo_game_vectors;

/*----------------------------------------------------------------*/kof2003

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();
}

/*----------------------------------------------------------------*/

int memcard_status;
static int memcard_number;

static void neogeo_custom_memory(void);
static void neogeo_register_sub_savestate(void);

Link to comment
Share on other sites

/*----------------------------------------------------------------*/kof2003

 

That line

 

change it to:

 

/*----------------------------------------------------------------*/ //kof2003

Link to comment
Share on other sites

/*----------------------------------------------------------------*/kof2003

 

That line

 

change it to:

 

/*----------------------------------------------------------------*/ //kof2003

 

 

lol they do not need to be there anyway.

 

I have it like this myself /* kof2003 */

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...