Welcome!

General Emulation => MAME => Topic started by: iq_132 on January 04, 2006, 11:51:15 PM

Title: Fatfury2 - code update
Post by: iq_132 on January 04, 2006, 11:51:15 PM
Here's an update to the fatfury2 code in mame:

Just replace your old fatfury2_protection_16_w with this one:

Code: [Select]
static WRITE16_HANDLER( fatfury2_protection_16_w )
{
switch (offset)
{
case 0x11112/2: /* data == 0x1111; expects 0xFF000000 back */
neogeo_prot_data = 0xFF000000;
break;

case 0x33332/2: /* data == 0x3333; expects 0x0000FFFF back */
neogeo_prot_data = 0x0000FFFF;
break;

case 0x44442/2: /* data == 0x4444; expects 0x00FF0000 back */
neogeo_prot_data = 0x00FF0000;
break;

case 0x55552/2: /* data == 0x5555; read back from 55550, ffff0, 00000, ff000 */
neogeo_prot_data = 0xff00ff00;
break;

case 0x56782/2: /* data == 0x1234; read back from 36000 *or* 36004 */
neogeo_prot_data = 0xf05a3601;
break;

case 0x42812/2: /* data == 0x1824; read back from 36008 *or* 3600c */
neogeo_prot_data = 0x81422418;
break;

case 0x55550/2:
case 0xffff0/2:
case 0xff000/2:
case 0x36000/2:
case 0x36004/2:
case 0x36008/2:
case 0x3600c/2:
neogeo_prot_data <<= 8;
break;

default:
logerror("unknown protection write at pc %06x, offset %08x, data %02x\n",activecpu_get_pc(),offset,data);
break;
}
}


These are no longer needed (they are hacks and should be removed)

Code: [Select]
UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1);
mem16[0xb820/2] = 0x4e71;
mem16[0xb822/2] = 0x4e71;



Thanks to the FBA team for the code. :)  I just ported it over.
Title: Re: Fatfury2 - code update
Post by: James33 on January 05, 2006, 12:44:12 AM
This code works great :) Thanks IQ .
Title: Re: Fatfury2 - code update
Post by: mamesick on January 05, 2006, 03:33:53 AM
Looks very good to me, but which are the benefits?  :confused:
JUst curious...
Title: Re: Fatfury2 - code update
Post by: iq_132 on January 05, 2006, 04:54:02 AM
There's really only one benefit.  More accurate emulation.  Those patches that this allows you to
remove are hacks to work around the protection in the program roms.  This code emulates the protection.
Title: Re: Fatfury2 - code update
Post by: neo04 on January 05, 2006, 05:49:20 AM
from iq's code:
Code: [Select]
case 0x11112/2: /* data == 0x1111; expects 0xFF000000 back */
prot_data = 0xFF000000;
break;

change prot_data to neogeo_prot_data

:)
Title: Re: Fatfury2 - code update
Post by: James33 on January 05, 2006, 06:42:58 AM
from iq's code:
Code: [Select]
case 0x11112/2: /* data == 0x1111; expects 0xFF000000 back */
prot_data = 0xFF000000;
break;

change prot_data to neogeo_prot_data

:)


And why is this needed ? 
Um never mind its already like that on the code I have here :)
Title: Re: Fatfury2 - code update
Post by: Ashura-X on January 05, 2006, 05:17:38 PM
Very nice !!! Much thx !!!! :biggrin:
Title: Re: Fatfury2 - code update
Post by: KingHanco on January 06, 2006, 07:14:19 PM
Thanks. Replace and done.

Code: [Select]
/************************ Fatal Fury 2 *************************
  todo: emulate, not patch!
***************************************************************/
int neogeo_prot_data;

static READ16_HANDLER( fatfury2_protection_16_r )
{
UINT16 res = (neogeo_prot_data >> 24) & 0xff;

switch (offset)
{
case 0x55550/2:
case 0xffff0/2:
case 0x00000/2:
case 0xff000/2:
case 0x36000/2:
case 0x36008/2:
return res;

case 0x36004/2:
case 0x3600c/2:
return ((res & 0xf0) >> 4) | ((res & 0x0f) << 4);

default:
logerror("unknown protection read at pc %06x, offset %08x\n",activecpu_get_pc(),offset<<1);
return 0;
}
}

static WRITE16_HANDLER( fatfury2_protection_16_w )
{
        switch (offset)
        {
               case 0x11112/2: /* data == 0x1111; expects 0xFF000000 back */
                       neogeo_prot_data = 0xFF000000;
                       break;

               case 0x33332/2: /* data == 0x3333; expects 0x0000FFFF back */
                       neogeo_prot_data = 0x0000FFFF;
                       break;

               case 0x44442/2: /* data == 0x4444; expects 0x00FF0000 back */
                       neogeo_prot_data = 0x00FF0000;
                       break;

               case 0x55552/2: /* data == 0x5555; read back from 55550, ffff0, 00000, ff000 */
                       neogeo_prot_data = 0xff00ff00;
                       break;

               case 0x56782/2: /* data == 0x1234; read back from 36000 *or* 36004 */
                       neogeo_prot_data = 0xf05a3601;
                       break;

               case 0x42812/2: /* data == 0x1824; read back from 36008 *or* 3600c */
                       neogeo_prot_data = 0x81422418;
                       break;

               case 0x55550/2:
               case 0xffff0/2:
               case 0xff000/2:
               case 0x36000/2:
               case 0x36004/2:
               case 0x36008/2:
               case 0x3600c/2:
                       neogeo_prot_data <<= 8;
                       break;

               default:

logerror("unknown protection write at pc %06x, offset %08x, data %02x\n",activecpu_get_pc(),offset,data);
                       break;
        }
}

void fatfury2_install_protection(void)
{
/* Hacks the program rom of Fatal Fury 2, needed either in arcade or console mode */
/* otherwise at level 2 you cannot hit the opponent and other problems */

/* there seems to also be another protection check like the countless ones */
/* patched above by protecting a SRAM location, but that trick doesn't work */
/* here (or maybe the SRAM location to protect is different), so I patch out */
/* the routine which trashes memory. Without this, the game goes nuts after */
/* the first bonus stage. */
// UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1);
// mem16[0xb820/2] = 0x4e71;
// mem16[0xb822/2] = 0x4e71;

/* again, the protection involves reading and writing addresses in the */
/* 0x2xxxxx range. There are several checks all around the code. */
memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x2fffff, 0, 0, fatfury2_protection_16_r);
memory_install_write16_handler(0, ADDRESS_SPACE_PROGRAM, 0x200000, 0x2fffff, 0, 0, fatfury2_protection_16_w);
}

/************************ Fatal Fury 3 *************************
  is this still needed? -- some people report other lockups
  in this.
***************************************************************/

void fatfury3_install_protection(void)
{
/* patch the first word, it must be 0x0010 not 0x0000 (initial stack pointer) */
UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1);
mem16[0x0000/2] = 0x0010;
}
Title: Re: Fatfury2 - code update
Post by: iq_132 on January 12, 2006, 12:33:13 PM
I just noticed that this also works for ssideki (again, thanks fba team :))

in machine/neoprot.c delete this:
Code: [Select]
void ssideki_install_protection(void)
{
/* patch out protection check */
/* the protection routines are at 0x25dcc and involve reading and writing */
/* addresses in the 0x2xxxxx range */
UINT16 *mem16 = (UINT16 *)memory_region(REGION_CPU1);
mem16[0x2240/2] = 0x4e71;
}

in includes/neogeo.h delete this:
Code: [Select]
void ssideki_install_protection(void);


in drivers/neogeo.c replace this:

Code: [Select]
DRIVER_INIT( ssideki )
{
init_neogeo();
ssideki_install_protection();
}

With this:

Code: [Select]
DRIVER_INIT( ssideki )
{
init_neogeo();
fatfury2_install_protection();
}
Title: Re: Fatfury2 - code update
Post by: KingHanco on January 13, 2006, 05:02:07 PM
Thanks iq_132 and fba team.
Title: Re: Fatfury2 - code update
Post by: Ashura-X on January 14, 2006, 05:53:02 PM
Thx again guys  :eek:
Title: Re: Fatfury2 - code update
Post by: Ashura-X on January 27, 2006, 04:37:14 PM
Well like I see on mame bug report forum this code must be incomplete or something like that.
See this topic guys:
http://www.mameworld.info/ubbthreads/showthreaded.php?Cat=&Number=62842&page=0&view=expanded&sb=5&o=&fpart=1&vc=1
I have tried here on the official build and really the games glitches on that stage ....  :p
Dunno about super side kicks , this game isnt updated on official code with these changes.

Finished ssideki using cheats and I didn´t found any problem on this game.
Title: Re: Fatfury2 - code update
Post by: James33 on January 27, 2006, 08:22:03 PM
Well like I see on mame bug report forum this code must be incomplete or something like that.
See this topic guys:
http://www.mameworld.info/ubbthreads/showthreaded.php?Cat=&Number=62842&page=0&view=expanded&sb=5&o=&fpart=1&vc=1
I have tried here on the official build and really the games glitches on that stage ....  :p


Strange I tested that code awhile back and there was no GFX problem with that game . I played the game right to the last stage .
Title: Re: Fatfury2 - code update
Post by: KingHanco on January 28, 2006, 12:52:53 AM
Well. There are 3 problems on this as far I seen tested on 0.103u4.

http://www.mameworld.info/ubbthreads/showthreaded.php?Cat=&Number=62944&page=0&view=expanded&sb=5&o=&fpart=1&vc=1

I didn't get a snapshot on after the bonus stage. Weard messy screen. I gotting the other 2 snapshots though.
Title: Re: Fatfury2 - code update
Post by: James33 on January 28, 2006, 01:36:15 AM
Well. There are 3 problems on this as far I seen tested on 0.103u4.

http://www.mameworld.info/ubbthreads/showthreaded.php?Cat=&Number=62944&page=0&view=expanded&sb=5&o=&fpart=1&vc=1

I didn't get a snapshot on after the bonus stage. Weard messy screen. I gotting the other 2 snapshots though.

Not broken here , I feel there is only a tiny problem with the code . Which is not really a bug in the code just a new line needs to be put inbetween each handler .
Title: Re: Fatfury2 - code update
Post by: mamesick on January 28, 2006, 02:02:19 AM
It's broken for me too... Every time I reach and pass the first bonus stage, the next level has the sprites floating in the air, just like it has been reported at MAMETesters.
Moron fix: simply re-add the lines that iq_132 told us to remove. :idiot:
Title: Re: Fatfury2 - code update
Post by: robber804 on January 28, 2006, 02:46:11 AM
Not broken here , I feel there is only a tiny problem with the code . Which is not really a bug in the code just a new line needs to be put inbetween each handler .

How far into the game did you play?  It only happens on level 5.  With or without the empty lines (doesnt matter since it is only for looks) the game has the graphics on level 5 in the wrong area.  I had seen someone mention that case 0x42812/2:  was a typo and should have been case 0x24812/2: that causes a timer problem on level 3, so that isnt correct either.
Title: Re: Fatfury2 - code update
Post by: James33 on January 28, 2006, 03:23:55 AM
How far into the game did you play?  It only happens on level 5.  With or without the empty lines (doesnt matter since it is only for looks) the game has the graphics on level 5 in the wrong area.  I had seen someone mention that case 0x42812/2:  was a typo and should have been case 0x24812/2: that causes a timer problem on level 3, so that isnt correct either.

I play the game to stage 5 right after the bonus game :)
Title: Re: Fatfury2 - code update
Post by: KingHanco on January 28, 2006, 05:07:27 AM
Not broken here , I feel there is only a tiny problem with the code . Which is not really a bug in the code just a new line needs to be put inbetween each handler .

I try that and didn't fixs it in the 0.103u4.

Here what Mamesick said. -> Add a new empty line between the two handlers is just cosmetic, otherwise the compiler should report a syntax error if something is wrong. Sincerely I cannot believe that the bug is fixed for you simply adding an empty line.. it's too strange...
Title: Re: Fatfury2 - code update
Post by: KingHanco on January 28, 2006, 05:09:06 AM
It's broken for me too... Every time I reach and pass the first bonus stage, the next level has the sprites floating in the air, just like it has been reported at MAMETesters.
Moron fix: simply re-add the lines that iq_132 told us to remove. :idiot:

Well. I will paste the fixs over that then that been post here at this forum.
Title: Re: Fatfury2 - code update
Post by: James33 on January 28, 2006, 05:37:30 AM
Well. I will paste the fixs over that then that been post here at this forum.

No you do not need to do that since the code is already known .  Its the old patch that was in the code before .
And another thing please do not repeat what mamesick  said , I already read what he said so there is no need for you to repeat it .
Title: Re: Fatfury2 - code update
Post by: KingHanco on January 28, 2006, 06:04:17 AM
No you do not need to do that since the code is already known .  Its the old patch that was in the code before .
And another thing please do not repeat what mamesick  said , I already read what he said so there is no need for you to repeat it .

Ok. I just replying on what you said and gave you the answer.

This is a mess that they did. They screw it up... Dammit...

I'm leaving it alone now until the fixs are done. :rolleyes:
Title: Re: Fatfury2 - code update
Post by: robber804 on January 28, 2006, 06:49:34 PM
I play the game to stage 5 right after the bonus game :)

I have no idea then, I think I read on MAME Testers that you were using 0.103u3? Or are you using 0.103u4?  If it works on u3 and not on u4 then we may have a place to start.
Title: Re: Fatfury2 - code update
Post by: James33 on January 29, 2006, 02:18:41 AM
I have no idea then, I think I read on MAME Testers that you were using 0.103u3? Or are you using 0.103u4?  If it works on u3 and not on u4 then we may have a place to start.
Yeah its broken for some reason I deleted the wrong nvram file when I tested it the first time .

I need to clean out my nvram folder to prevent future problems .