Page 1 of 1

cheat.dat documentation missing

Posted: Thu Apr 06, 2017 6:29 pm
by megaman_exe
Hi, I'm trying to convert some cheats I made some time ago from the cheat.dat format (32 bit words) to the xml format.

The problem is that the documentation that was supposed to be here doesn't exist anymore.

I need to know what does the last byte of the first word do. IIRC the third from last bit was used to make the cheat a ROM cheat, but IDK what does the last bit is used for.

for instance:

Code: Select all

:1943:20800000:6E50:00000018:FFFFFFFF:Always Enable Secret Code PL1:Get the weapon at the start of every stage
the "2" is the third from last bit and I remember it was used for ROM cheats

but this:

Code: Select all

:sonicbom:A0800000:00361A:00000060:FFFFFFFF:Invincibility - Player
It has the last bit and the third to last but enabled. I need to know what does the last bit enabled mean. I suspect it has to do the encrypted opcodes (write the encrupted form of the opcode or byte)

Of course those aren't the cheats I'm interested in. The cheat I'm trying to convert is this (custom) one:

Code: Select all

:bosco:A0800000:394F:00000000:000000FF:disable checksum
:bosco:A0810000:36D6:00000028:000000FF:disable checksum
:bosco:A0810000:37EF:000000C9:000000FF:disable checksum
:bosco:A0810000:3F21:000000C9:000000FF:disable checksum
Which I converted to this cheat (ignore the delay="0" attribute, is a custom attribute I programmed within the mame src to make a cheat start pre-enabled)

Code: Select all

  <cheat desc="Skip RAM/ROM Checks" delay="0">
    <script state="on">
      <action>temp0 =maincpu.ob@394F</action>
      <action>temp1 =maincpu.ob@36D6</action>
      <action>temp2 =maincpu.ob@37EF</action>
      <action>temp3 =maincpu.ob@3F21</action>
    </script>
    <script state="run">
      <action>maincpu.ob@394F=00</action> 
      <action>maincpu.ob@36D6=28</action> 
      <action>maincpu.ob@37EF=C9</action> 
      <action>maincpu.ob@3F21=C9</action> 
    </script>
    <script state="off">
      <action>maincpu.ob@394F=temp0 </action>
      <action>maincpu.ob@36D6=temp1 </action>
      <action>maincpu.ob@37EF=temp2 </action>
      <action>maincpu.ob@3F21=temp3 </action>
    </script>
  </cheat>
The weird thing is that it worked perfectly in sdlmame 0.123 (also a custom one to enable pre-enabled cheats before the main boot process of the machine starts). Anyways, it should work after making a soft reset but it doesn't behave the same way as before.

I know that it's weird to have a skip checksum cheat in a cheat engine that doesn't support pre-enabled cheats but some have survived despite of this, like the Skip RAM/ROM check from kof2002 (maybe after making a soft reset)

I hope someone can lend me a hand on this.
Thanks in advance.
Greets!

Re: cheat.dat documentation missing

Posted: Sun Apr 09, 2017 1:12 am
by Pugsy
The romset bosco doesn't use encrypted opcodes so it should be either maincpu.m first and if that doesn't work try maincpu.r - using maincpu.o is wrong and it will tell you that in 0.185 (prior to 0.185 maincpu.o was being treated the same as maincpu.r)

20800000 = maincpu.mb
A0800000 = maincpu.rb

The reason it doesn't work might be because the roms for bosco in MAME 0.123 != MAME 0.184.
MAME 0.128 was released in feb 2008, so the romset might have changed in that time and the driver has also probably changed.

Re: cheat.dat documentation missing

Posted: Sun Apr 09, 2017 1:52 am
by Pugsy
Just traced through the game code, and this will force the RAM+ROM checks to pass even if you have Invincibility and Infinite Lives enabled in bosco.

Code: Select all

  <cheat desc="Pass RAM/ROM Checks">
    <script state="on">
      <action>temp0 =maincpu.mb@3F31</action>
      <action>temp1 =maincpu.mw@3822</action>
    </script>
    <script state="run">
      <action>maincpu.mb@3F31=C9</action> <!-- ROM -->
      <action>maincpu.mw@3822=0118</action> <!-- RAM -->
    </script>
    <script state="off">
      <action>maincpu.mb@3F31=temp0 </action>
      <action>maincpu.mw@3822=temp1 </action>
    </script>
  </cheat>

Re: cheat.dat documentation missing

Posted: Sun Apr 09, 2017 8:00 pm
by megaman_exe
Thanks a lot, I've tested it and it works, however, I was trying to skip all those screens with garbled graphics and start right on the grid pattern or even better, the title screen to make a fast boot cheat since the rom takes somewhat long to boot up.

I see you added a ret and a jr *. I'll see if I can execute this opcodes earlier or execute them again to skip that long boot up time.

I'll keep investigating how to reach the title screen or the pattern screen directly. I've tried to reach a point where the ram/rom checks are finished and write into HL, SP, A, BC, DE the same values when the PC reaches that point but I only get a starfield horizontal scrolling background.

This was the cheat I was using (that results in the scrolling background)

Code: Select all

  <cheat desc="Skip RAM/ROM Checks" tempvariables="11">
    <script state="on">
		<action>temp0 =maincpu.mb@0003</action>
		<action>temp1 =maincpu.mb@0004</action>
		<action>temp2 =maincpu.mw@0005</action>
		<action>temp3 =maincpu.mb@0007</action>
		<action>temp4 =maincpu.mw@0008</action>
		<action>temp5 =maincpu.mb@000a</action>
		<action>temp6 =maincpu.mw@000b</action>
		<action>temp7 =maincpu.mb@000d</action>
		<action>temp8 =maincpu.mw@000e</action>
		<action>temp9 =maincpu.mb@0010</action>
		<action>temp10 =maincpu.mw@0011</action>
    </script>
    <script state="run">
		<action>maincpu.mb@0003=3C</action> 
		<action>maincpu.mb@0004=01</action> 
		<action>maincpu.mw@0005=002F</action> 
		<action>maincpu.mb@0007=11</action> 
		<action>maincpu.mw@0008=8BC0</action> 
		<action>maincpu.mb@000a=21</action> 
		<action>maincpu.mw@000b=8B80</action> 
		<action>maincpu.mb@000d=31</action> 
		<action>maincpu.mw@000e=7B00</action> 
		<action>maincpu.mb@0010=C3</action> 
		<action>maincpu.mw@0010=3950</action> 
    </script>
    <script state="off">
		<action>maincpu.mb@0003=temp0</action>
		<action>maincpu.mb@0004=temp1</action>
		<action>maincpu.mw@0005=temp2</action>
		<action>maincpu.mb@0007=temp3</action>
		<action>maincpu.mw@0008=temp4</action>
		<action>maincpu.mb@000a=temp5</action>
		<action>maincpu.mw@000b=temp6</action>
		<action>maincpu.mb@000d=temp7</action>
		<action>maincpu.mw@000e=temp8</action>
		<action>maincpu.mb@0010=temp9</action>
		<action>maincpu.mw@0011=temp10</action>
    </script>
  </cheat>
Thanks anyway!
I hope you're doing well! Greets!

EDIT: I somehow managed to reduce boot times a lot with these code:

Code: Select all

  <cheat desc="Pass RAM/ROM Checks">
    <script state="on">
      <action>temp0 =maincpu.mb@3F31</action>
      <action>temp1 =maincpu.mw@3822</action>
		<!--new-->
		<action>temp2 =maincpu.mb@3819</action>
		<action>temp3 =maincpu.mw@37F8</action>
    </script>
    <script state="run">
      <action>maincpu.mb@3F31=C9</action> <!-- ROM -->
      <action>maincpu.mw@3822=0118</action> <!-- RAM -->
		<!--new-->
		<action>maincpu.mb@3819=C9</action>
		<action>maincpu.mw@37F8=C9C9</action>
    </script>
    <script state="off">
      <action>maincpu.mb@3F31=temp0 </action>
      <action>maincpu.mw@3822=temp1 </action>
		<!--new-->
		<action>maincpu.mb@3819=temp2</action>
		<action>maincpu.mw@37F8=temp3</action>
    </script>
  </cheat>
I'm gonna test the game to see if something else is wrecked. Greets!