Author Topic: Mame 0.98u1 , Compile problems newer neogeo games  (Read 18843 times)

Offline Ashura-X

  • Member
  • ***
  • Posts: 138
  • Karma: +0/-0
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #15 on: July 22, 2005, 09:58:13 AM »
These codes works for me now, if you are using mame32plus please disable the check warning errors on the file config.def uncommenting tha line W_ERROR=1


src/drivers/neogeo.c: In function `init_matrimnd':
src/drivers/neogeo.c:7880: warning: ISO C90 forbids mixed declarations and code
-------------------
DRIVER_INIT( matrimd )
{
neogeo_fix_bank_type = 2;

/* the S data comes from the end fo the C data */
{
   int rom_size;
     int i;
   int tx_size = memory_region_length(REGION_GFX1);
   UINT8 *src = memory_region(REGION_GFX3)+rom_size-tx_size;
   UINT8 *dst = memory_region(REGION_GFX1);
     rom_size = memory_region_length(REGION_GFX3);
   
   for (i = 0;i < tx_size;i++)
   dst = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
}

init_neogeo();
}

DRIVER_INIT (matrimbl)
{
   int i;int j=0;
   UINT8 *src2 = memory_region(REGION_CPU2)+0x10000;
        UINT8 *dst2 = malloc(0x20000);
          memcpy(dst2,src2,0x20000);
          matrimbl_c(0);
        for(i=0x00000;i<0x20000;i++)
        {
           if (i&0x10000)
           {
                 if (i&0x800)
                 {
                   j=MATRIMBL_M_FIX(i);
                   j=j^0x10000;
                 }
                 else
                 {
                   j=MATRIMBL_M_FIX((i^0x01));
                 }
           }
           else
           {
                 if (i&0x800)
                 {
                   j=MATRIMBL_M_FIX((i^0x01));
                   j=j^0x10000;
                 }
                 else
                 {
                   j=MATRIMBL_M_FIX(i);
                 }
           }
          src2[j]=dst2;
        }
     
   free(dst2);
   memcpy(src2-0x10000,src2,0x10000);
   matrim_vx_decrypt();

    init_neogeo();
}

src/drivers/neogeo.c: In function `svcchaos_gfx_decrypt':
src/drivers/neogeo.c:8098: warning: ISO C90 forbids mixed declarations and code
-------------------
static void svcchaos_gfx_decrypt( void )
{
   const unsigned char xor1[ 4 ] = {
      0x34, 0x21, 0xc4, 0xe9,
   };

   int i;
   int ofst;
   UINT8 *src = memory_region( REGION_GFX3 );
   int len = memory_region_length( REGION_GFX3 );
   UINT8 *dst = malloc( len );
   UINT8 *s1 = memory_region( REGION_GFX1 );
   size_t s1_size = memory_region_length( REGION_GFX1 );

   for( i = 0; i < len; i++ ){
      src[ i ] ^= xor1[ (i % 4) ];
   }

   for( i = 0; i < len; i += 4 ){
      UINT32 *src32 = (UINT32*)&src[ i ];
      *src32 = BITSWAP32( *src32, 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( dst, src, len );

   for( i = 0; i < len / 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( &src[ i * 4 ], &dst[ ofst * 4 ], 0x04 );
   }

   free( dst );

   kof2000_neogeo_gfx_decrypt(0x57);
   
   for( i = 0; i < s1_size; i++ ){
      s1[ i ] = BITSWAP8( s1[ i ] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3 );

   }
}

src/drivers/neogeo.c: In function `svcplus_sx_decrypt':
src/drivers/neogeo.c:8233: error: 'for' loop initial declaration used outside C99 mode
-------------------
static void svcsplus_sx_decrypt( void )
{
   UINT8 *rom = memory_region( REGION_GFX1 );
   int size = memory_region_length( REGION_GFX1 );

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

src/drivers/neogeo.c: In function `svcplusa_px_decrypt':
src/drivers/neogeo.c:8253: error: 'for' loop initial declaration used outside C99 mode
-------------------
static void svcplusa_px_decrypt( void )
{
   int sec[] = {
      0x01, 0x02, 0x03, 0x04, 0x05, 0x00
   };

   int size = memory_region_length( REGION_CPU1 );
   UINT8 *src = memory_region( REGION_CPU1 );
   UINT8 *dst = malloc( size );

   int i;
   memcpy( dst, src, size );

   for( i = 0; i < 6; i++ ){
      memcpy( &src[ i * 0x100000 ], &dst[ sec[ i ] * 0x100000 ], 0x100000 );
   }

   free( dst );
}

src/drivers/neogeo.c: In function `svcsplus_sx_decrypt':
src/drivers/neogeo.c:8294: error: 'for' loop initial declaration used outside C99 mode
-------------------
static void svcsplus_sx_decrypt( void )
{
   UINT8 *rom = memory_region( REGION_GFX1 );
   int size = memory_region_length( REGION_GFX1 );

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

src/drivers/neogeo.c: In function `init_kf2k4spe':
src/drivers/neogeo.c:8470: error: 'for' loop initial declaration used outside C99 mode
-------------------
DRIVER_INIT( kof2k4se )
{
   UINT8 *src = memory_region(REGION_CPU1)+0x100000;
   UINT8 *dst = malloc(0x400000);
   unsigned int sec[] = {0x300000,0x200000,0x100000,0x000000};
   if (dst)
   {
   int i;
      memcpy(dst,src,0x400000);
      for(i = 0; i < 4; ++i)
      {
         memcpy(src+i*0x100000,dst+sec,0x100000);
      }
      free(dst);
   }
   init_neogeo();
}

Offline robber804

  • Newbies
  • *
  • Posts: 40
  • Karma: +0/-0
  • Relentless Bastard
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #16 on: July 22, 2005, 03:55:38 PM »
This works on the normal Mame build ?

Nope, sorry forgot you use the normal mame build, I just use the mameplus 0.98 make file and added the lines i mentioned above and it works fine.  Did you try using an older makefile?
-robber804

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #17 on: July 23, 2005, 09:34:40 AM »
Yeah it works with the old make file . But I am trying make the code work with the make file changes .

They are same codes I am getting problems with .
Maybe IQ might know what needs to be changed hehe .

Thanks robbert for your help .
« Last Edit: July 23, 2005, 09:37:30 AM by James33 »
IQ Forum Member

Offline robber804

  • Newbies
  • *
  • Posts: 40
  • Karma: +0/-0
  • Relentless Bastard
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #18 on: July 23, 2005, 11:21:45 PM »
Yeah it works with the old make file . But I am trying make the code work with the make file changes .

They are same codes I am getting problems with .
Maybe IQ might know what needs to be changed hehe .

Thanks robbert for your help .

I just wanted to get it compiling again then I will work out the problems, eventually  :rolleyes:
-robber804

Offline Cookie Monstruo

  • Newbies
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #19 on: July 25, 2005, 03:30:59 AM »
as soon as I looked in the common.h file and seen that it had not been the same, I just commented out all the code having to do with svc. As for the old makefile trick, I think I'll try that later

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #20 on: July 25, 2005, 03:56:57 AM »
as soon as I looked in the common.h file and seen that it had not been the same, I just commented out all the code having to do with svc. As for the old makefile trick, I think I'll try that later

If you use the v98 makerfile it will compile with no problems .
IQ Forum Member

Offline iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #21 on: August 09, 2005, 02:35:48 AM »
Well, here's a few bits of code that gave me trouble when adding them to mame and have "fixed"

First, the bootleg bankswitch:
Code: [Select]
static UINT16 mv0_bank_ram[ 0x10/2 ];

static READ16_HANDLER( mv0_bankswitch_r )
{
return mv0_bank_ram[ offset ];
}

static WRITE16_HANDLER( mv0_bankswitch_w )
{
UINT32 bankaddress = 0x100000; // This was causing trouble being defined after COMBINE_DATA
COMBINE_DATA( &mv0_bank_ram[ offset ] );
bankaddress += (mv0_bank_ram[ 0 ] >> 8) + (mv0_bank_ram[ 1 ] << 8);
neogeo_set_cpu1_second_bank( bankaddress );
}

svcplus's Sx decrypt code

Code: [Select]
static void svcplus_sx_decrypt( void )
{
int i; // move this outside of the "for" loop
int rom_size = memory_region_length( REGION_GFX1 );
UINT8 *rom = memory_region( REGION_GFX1 );
UINT8 *buf = malloc( rom_size );

memcpy( buf, rom, rom_size );

for( i = 0; i < rom_size; i += 0x10 ){ // notice removal of "int i =0"
memcpy( &rom[ i        ], &buf[ i + 0x08 ], 0x08 );
memcpy( &rom[ i + 0x08 ], &buf[ i        ], 0x08 );
}

free( buf );
}

svcplusa px decrypt

Code: [Select]
static void svcplusa_px_decrypt( void )
{
int sec[] = {
0x01, 0x02, 0x03, 0x04, 0x05, 0x00
};

int i; // move this outside of the "for" loop
int rom_size = memory_region_length( REGION_CPU1 );
UINT8 *rom = memory_region( REGION_CPU1 );
UINT8 *buf = malloc( rom_size );

memcpy( buf, rom, rom_size );

for( i = 0; i < 6; i++ ){ // notice removal of "int i = 0"
memcpy( &rom[ i * 0x100000 ], &buf[ sec[ i ] * 0x100000 ], 0x100000 );
}

free( buf );
}

svcsplus sx decrypt code

Code: [Select]
static void svcsplus_sx_decrypt( void )
{
int i; // move this outside of the "for" loop
UINT8 *rom = memory_region( REGION_GFX1 );
int rom_size = memory_region_length( REGION_GFX1 );

for( i = 0; i < rom_size; i++ ){// notice removal of "int i = 0"
rom[ i ] = BITSWAP8( rom[ i ], 7, 6, 0, 4, 3, 2, 1, 5 );
}
}

If there's any more code conflicts, let me know...
« Last Edit: August 09, 2005, 02:37:01 AM by iq_132 »


Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #22 on: August 09, 2005, 09:12:27 PM »
EDIT Never mind  Its ok now

« Last Edit: August 10, 2005, 08:36:00 AM by James33 »
IQ Forum Member

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #23 on: August 09, 2005, 10:12:30 PM »
This is what I did for DRIVER_INIT( matrimd )

Code: [Select]
        /* the S data comes from the end of the C data */
{

int i;
int tx_size = memory_region_length(REGION_GFX1);
int rom_size = memory_region_length(REGION_GFX3);
UINT8 *src = memory_region(REGION_GFX3)+rom_size-tx_size;
UINT8 *dst = memory_region(REGION_GFX1);

for (i = 0;i < tx_size;i++)
dst[i] = src[(i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
}
« Last Edit: August 09, 2005, 10:13:39 PM by James33 »
IQ Forum Member

Offline iq_132

  • Administrator
  • *****
  • Posts: 3728
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #24 on: August 09, 2005, 11:59:04 PM »
Try this James:

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

int i;
int ofst;
UINT8 *s1 = memory_region( REGION_GFX1 ); // Moved this to the top
size_t s1_size = memory_region_length( REGION_GFX1 ); // Moved
UINT8 *src = memory_region( REGION_GFX3 );
int len = memory_region_length( REGION_GFX3 );
UINT8 *dst = malloc( len );

for( i = 0; i < len; i++ ){
src[ i ] ^= xor1[ (i % 4) ];
}

for( i = 0; i < len; i += 4 ){
UINT32 *src32 = (UINT32*)&src[ i ];
*src32 = BITSWAP32( *src32, 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( dst, src, len );

for( i = 0; i < len / 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( &src[ i * 4 ], &dst[ ofst * 4 ], 0x04 );
}

free( dst );

kof2000_neogeo_gfx_decrypt(0x57);

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


Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #25 on: August 10, 2005, 08:38:26 AM »
Yeah I found that out from robber804 post  I am starting to work it out now . As I have fixed a few other drivers that had the same problems .

Thanks IQ and all others who have helped :)

I can now compile Mame and Mame Plus without need to use the old make file yippie  :biggrin:
« Last Edit: August 10, 2005, 08:39:57 AM by James33 »
IQ Forum Member

Offline robber804

  • Newbies
  • *
  • Posts: 40
  • Karma: +0/-0
  • Relentless Bastard
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #26 on: August 12, 2005, 01:52:16 PM »
Yeah I found that out from robber804 post  I am starting to work it out now . As I have fixed a few other drivers that had the same problems .

Thanks IQ and all others who have helped :)

I can now compile Mame and Mame Plus without need to use the old make file yippie  :biggrin:

The only other issues you should  have to fix are the some like these

Code: [Select]
WRITE16_HANDLER ( mv0_bankswitch_w )
{
COMBINE_DATA (&mv0_bank_ram [ offset ]);

//UINT32 bankaddress = (mv0_bank_ram [ 0 ] >> 8) + (mv0_bank_ram [ 1 ] << 8) + 0x100000;

neogeo_set_cpu1_second_bank ((mv0_bank_ram [ 0 ] >> 8) + (mv0_bank_ram [ 1 ] << 8) + 0x100000);
}
-robber804

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #27 on: August 12, 2005, 09:55:08 PM »
Which roms is that code for ? Becuase I do not have that code anywhere .

The closest one I have is this .

Code: [Select]
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 );
}

And there is no problem with it .
IQ Forum Member

Offline robber804

  • Newbies
  • *
  • Posts: 40
  • Karma: +0/-0
  • Relentless Bastard
Re: Mame 0.98u1 , Compile problems newer neogeo games
« Reply #28 on: August 17, 2005, 06:43:09 PM »
Well if you have no errors then dont touch it, but yes it is the same write handler just coded differently.

Which roms is that code for ? Becuase I do not have that code anywhere .

The closest one I have is this .

Code: [Select]
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 );
}

And there is no problem with it .
-robber804