Incomplete working Pre-Enable in the latest MAME

If you are having problems finding or using cheats for an Emulator (particularly MAME/MESS) or have found a trick that you wish to share this is the place to do it. But please read the Cheat FAQ first.
Post Reply
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Incomplete working Pre-Enable in the latest MAME

Post by ShimaPong »

In vulcan / gradius2, RAM/ROM check is done even if you set "Skip RAM/ROM Check" together with Pre-Enable. Off course, the game fails to boot due to the ROM error and CPU resets the game. Check the disassemble when the debugger wakes up at the beginning, you will confirm that Pre-Enable doesn't work in this time. But it passes "2nd" test and succeeds in booting because Pre-Enable works at last.

This problem doesn't happen in 0.101.
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

I have confirmed that the above problem has happened on 0.104u3 or later. Do you remember broken cheat system temporalily in this version ? I said about other potential problems at that time. Yes, it exactlly exists.

Anyway, I have added the comment "It's better to use together with Pre-Enable" to many "Skip RAM/ROM Check" codes. But the latest comment is "Don't use together with Pre-Enable". In athena, CPU never resets the game if the ROM error so that you need to reset the game by yourself (press F3).
User avatar
ianpatt
Posts: 336
Joined: Sat Sep 22, 2001 1:00 am
Location: San Francisco, CA

Post by ianpatt »

I could see something like this being caused when Aaron moved the cheat application timer. It doesn't look like it currently is called at the beginning of the first frame, and the CPU may pass the code you're patching before the game reaches the end of the frame and the cheat is applied.

Try changing:

Code: Select all

timer_adjust(periodic_timer, TIME_IN_HZ(Machine->refresh_rate), 0, TIME_IN_HZ(Machine->refresh_rate));
at line 1794 of cheat.c to

Code: Select all

timer_adjust(periodic_timer, 0, 0, TIME_IN_HZ(Machine->refresh_rate));
That should make it fire at the beginning of the first frame like it did before.
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

Thanks.
I confirmed that this problem went away with your modification.
User avatar
ianpatt
Posts: 336
Joined: Sat Sep 22, 2001 1:00 am
Location: San Francisco, CA

Post by ianpatt »

Cool, I'll add the change. Sorry I didn't think about that when I fixed the first issue.
Post Reply