Welcome!

General Emulation => MAME => Topic started by: James33 on July 18, 2005, 08:12:10 AM

Title: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 on July 18, 2005, 08:12:10 AM
Has anyone had any problems compiling 98u1 with newer games added like svcsplus  I can no longer compile with some of the newer games added :(
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: Ashura-X on July 19, 2005, 07:22:26 AM
Has anyone had any problems compiling 98u1 with newer games added like svcsplus  I can no longer compile with some of the newer games added :(

Im still not tried the regular MAME build coz Im waiting new mameplus source to be out. BTW ... I saw if that kof10th UNIQUE is out so does anyone saw any mame driver for it ? A NeoMAMEPlus exists for play the entire game as well !
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 on July 19, 2005, 12:18:26 PM
These are some of the errors I get now

Quote
Compiling src/drivers/neogeo.c...
src/drivers/neogeo.c: In function `init_matrimnd':
src/drivers/neogeo.c:7880: warning: ISO C90 forbids mixed declarations and code
src/drivers/neogeo.c: In function `svcchaos_gfx_decrypt':
src/drivers/neogeo.c:8098: warning: ISO C90 forbids mixed declarations and code
src/drivers/neogeo.c: In function `svcplus_sx_decrypt':
src/drivers/neogeo.c:8233: error: 'for' loop initial declaration used outside C9
9 mode
src/drivers/neogeo.c: In function `svcplusa_px_decrypt':
src/drivers/neogeo.c:8253: error: 'for' loop initial declaration used outside C9
9 mode
src/drivers/neogeo.c: In function `svcsplus_sx_decrypt':
src/drivers/neogeo.c:8294: error: 'for' loop initial declaration used outside C9
9 mode
src/drivers/neogeo.c: In function `init_kf2k4spe':
src/drivers/neogeo.c:8470: error: 'for' loop initial declaration used outside C9
9 mode
make: *** [obj/mame32pp/drivers/neogeo.o] Error 1
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: iq_132 on July 19, 2005, 01:30:18 PM
src/drivers/neogeo.c:8233: error: 'for' loop initial declaration used outside C9

Those lines probably have this

for (int i = 0...

Change it to

int i;
for (i = 0;
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 on July 19, 2005, 10:25:26 PM
Thanks IQ I will give that a go


Should it be like this now ?

Quote
static void svcplus_sx_decrypt( void )
{
   int size = memory_region_length( REGION_GFX1 );
   UINT8 *src = memory_region( REGION_GFX1 );
   UINT8 *dst = malloc( size );

   memcpy( dst, src, size );

   int i;
   for (i = 0; i < size; i += 0x10 ){
      memcpy( &src[ i        ], &dst[ i + 0x08 ], 0x08 );
      memcpy( &src[ i + 0x08 ], &dst[ i        ], 0x08 );
   }

   free(dst);
}
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: Ashura-X on July 20, 2005, 12:54:03 PM
ok now I have a problem on this function on my machine neogeo driver:
Compiling src/machine/neogeo.c...
src/machine/neogeo.c: In function `mslug5_bankswitch_w':
src/machine/neogeo.c:601: warning: implicit declaration of function `cpu_setbank

Any hint ?


DAmm found the problem ;)

Fully deprecated the use of cpu_setbank(), which was long ago replaced with
memory_set_bankptr(). [Aaron Giles]

Im still have same problem if James have :S
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: DsNo on July 20, 2005, 01:06:50 PM
ok now I have a problem on this function on my machine neogeo driver:
Compiling src/machine/neogeo.c...
src/machine/neogeo.c: In function `mslug5_bankswitch_w':
src/machine/neogeo.c:601: warning: implicit declaration of function `cpu_setbank

Any hint ?


DAmm found the problem ;)

Fully deprecated the use of cpu_setbank(), which was long ago replaced with
memory_set_bankptr(). [Aaron Giles]

all "cpu_setbank(" change to "memory_set_bankptr(" ... That's all...
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: Ashura-X on July 20, 2005, 01:26:16 PM
all "cpu_setbank(" change to "memory_set_bankptr(" ... That's all...

OK but now I have these ISO c90 and c99 errors :S
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 on July 20, 2005, 06:51:48 PM
The only error I have to fix is this " ISO C90 forbids mixed declarations and code "  Not sure how yet .
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: robber804 on July 20, 2005, 07:26:18 PM
The only error I have to fix is this " ISO C90 forbids mixed declarations and code "  Not sure how yet .

use the old make file from 0.98 but add these lines after

ifneq ($(USE_MASH_DATAFILE),)
    DEFS += -DMASH_DATAFILE
endif

add

ifneq ($(USE_STORY_DATAFILE),)
    DEFS += -DSTORY_DATAFILE
endif


that fixed it for me
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: Ashura-X on July 21, 2005, 06:48:30 AM
use the old make file from 0.98 but add these lines after

ifneq ($(USE_MASH_DATAFILE),)
    DEFS += -DMASH_DATAFILE
endif

add

ifneq ($(USE_STORY_DATAFILE),)
    DEFS += -DSTORY_DATAFILE
endif


that fixed it for me


It´s a trap then because those lines are already on mame32plus make file :S
So I dunno HOW solve that sh** problem !!!!!! :(
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: neo04 on July 21, 2005, 08:34:43 AM
download the new mingw for mameplus... maybe it will solve ur problem: http://mameplus.emu-france.com/download.htm
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 on July 21, 2005, 09:48:28 AM
use the old make file from 0.98 but add these lines after

ifneq ($(USE_MASH_DATAFILE),)
    DEFS += -DMASH_DATAFILE
endif

add

ifneq ($(USE_STORY_DATAFILE),)
    DEFS += -DSTORY_DATAFILE
endif


that fixed it for me


This works on the normal Mame build ?
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: Renegade on July 21, 2005, 11:02:15 PM


        Are you using decrypted or encryted sets?

       When you list the errors try showing the line before, the line itself and the line after in the file that is giving the errors.

    Renegade
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 on July 22, 2005, 03:36:59 AM
They Use bankswitch code etc .
In this case it complains on the line its self not before or after from I can tell .


Anyway Renegade do you want all my source or just the neogeo where the errors are ?
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: Ashura-X 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();
}
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: robber804 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?
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 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 .
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: robber804 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:
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: Cookie Monstruo 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
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 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 .
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: iq_132 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...
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 on August 09, 2005, 09:12:27 PM
EDIT Never mind  Its ok now

Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 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)];
}
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: iq_132 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 );
}
}
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 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:
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: robber804 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);
}
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: James33 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 .
Title: Re: Mame 0.98u1 , Compile problems newer neogeo games
Post by: robber804 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 .