Main > Software Forum
Cheat options (overclock) from command line (adding to derivative)
creatine28:
Found a way to over or under clock the CPU without having to press ~ and messing with the CPU speeds every time the game loads. I've tested it on Cruising usa and it seems to work. Edit the cheat.dat file for Cruising usa to look something like this:
; [ Cruis'n USA (rev L2.1) ]
:crusnu21:65004000:00000000:00004500:00000000
:crusnu21:65004000:00000001:00004500:00000000
:crusnu21:65004000:00000002:00004500:00000000
crusnu21:0:003DDA4:0F:000:Infinite Time
crusnu21:0:003DDA5:27:500:Infinite Time (2/4)
crusnu21:0:003DDA6:00:500:Infinite Time (3/4)
crusnu21:0:003DDA7:00:500:Infinite Time (4/4)
These Three lines refer to CPU1,CP2 and CPU3
:crusnu21:65004000:00000000:00004500:00000000
:crusnu21:65004000:00000001:00004500:00000000
:crusnu21:65004000:00000002:00004500:00000000
you can edit "00004500" to show "00020000"
00004500 = CPU clock % of around 27%
00020000 = CPU clock % of around 200%
you'll need to also enable the cheat option in your mame ini file. Also, you can test different values to see what % works best.
I've tested this with Crusing USA with a clock of around "00004500" or 27%. I still get a little slow down, but it does seem to make a difference and it loads the cheat everytime.
Steve
Tiger-Heli:
--- Quote from: creatine28 on May 09, 2004, 11:37:12 pm ---I've tested this with Crusing USA with a clock of around "00004500" or 27%. I still get a little slow down, but it does seem to make a difference and it loads the cheat everytime.
Steve
--- End quote ---
Thanks for the tip - I saw this in the cheat.c file in the source, but wasn't sure how to make it work.
Here's where I run into problems, though - Your method works at CPU0 and 1 of 27%, but that only gets me to 75% framerate on a P4 1.8 Ghz. CPU underclock of 10% gets me 100 percent framerate, but if I set this in cheat.dat, the game gets stuck in an infinite loop and never clears the game initialization screen.
What I need is an automatic method that will run with no overclock for xx frames, and then run at 10% underclock after the hardware check screens.
(or ideally, at 27% overclock for the hardware initialization and at 10% afterward).
BTW, the conversion is decimal % times 65536, then converted to hex.
so for a 10% underclock, the value is .10*65536=6.5536 converted to hex = 1999.
Tiger-Heli:
Did some more testing for anyone following this thread - the limiting value for avoiding a re-initialization is CPU0 at or above 20%. CPU 0 at 19 % causes a reboot. Unfortunately, this is only good for about 65-75% framerate (on the P4 1.8).
I was able to drop the CPU1 speed to 1% and start the game, but the framerates did not increase much.
FWIW.
ianpatt:
There isn't any built-in support for something like that, but it'd be pretty easy to add.
Change the kCustomLocation_Overclock handler (cheat.c line 8426) to this:
--- Code: --- case kCustomLocation_Overclock:
{
UINT8 cpu = address & 0xFF;
if(cpu < cpu_gettotalcpu())
{
UINT32 delay = address >> 8;
if(delay)
mame_timer_set(TIME_IN_MSEC(delay), (data & 0xFFFFFF00) | cpu, HandleOverclock);
else
HandleOverclock((data & 0xFFFFFF00) | cpu);
}
}
break;
--- End code ---
and add this before the HandleLocalCommandCheat function:
--- Code: ---static void HandleOverclock(int param)
{
UINT32 overclock = param & 0xFFFFFF00;
UINT8 cpu = param & 0xFF;
timer_set_overclock(cpu, ((double)overclock) / 65536.0);
}
--- End code ---
Then you can specify a delay (in milliseconds) for the overclock to be activated by putting it in the upper 24 bits of the address field. So, to make the crusnu21 cheats activate one second (of gametime) after startup, use these cheats:
:crusnu21:65004000:0003E800:00004500:00000000
:crusnu21:65004000:0003E801:00004500:00000000
:crusnu21:65004000:0003E802:00004500:00000000
Tiger-Heli:
--- Quote from: ianpatt on May 10, 2004, 01:50:25 pm ---There isn't any built-in support for something like that, but it'd be pretty easy to add.
<snipped>
Then you can specify a delay (in milliseconds) for the overclock to be activated by putting it in the upper 24 bits of the address field. So, to make the crusnu21 cheats activate one second (of gametime) after startup, use these cheats:
:crusnu21:65004000:0003E800:00004500:00000000
:crusnu21:65004000:0003E801:00004500:00000000
:crusnu21:65004000:0003E802:00004500:00000000
--- End quote ---
Thanks Ian.
I didn't follow all of that, but someone who understands C will.
Quick Questions - I was thinking of using frames rather than milliseconds, but I don't guess it matters - but - I need the cheat to happen after 720 frames so I assume 720/60 fps = 12 sec = 12,000 milliseconds = 2EE0 hex milliseconds so the cheat becomes
:crusnu21:65004000:002EE000:00004500:00000000
Also, would it be possible to use the following commands:
:crusnu21:65004000:00000000:00003333:00000000
:crusnu21:65004000:00000001:00001999:00000000
:crusnu21:65004000:002EE000:00001999:00000000
This would run CPU0 initially at 20%, CPU1 initially at 10% and then drop CPU0 to 10% after 12 seconds of gameplay?
Would the order that the entries are listed matter?
Finally, could you add this to a future MAME build, or do you mind if someone submits it or adds it to a derivative?
Thanks again for your assistance! Great job!