[citycon] Increase Km only when coloring

This forum is for posting M.A.M.E. arcade cheats. Requests will be fulfilled here....but please keep the requests to the requests forum.
Post Reply
Kalalu
Posts: 2
Joined: Thu Jan 23, 2025 12:50 am
Has thanked: 1 time

[citycon] Increase Km only when coloring

Post by Kalalu »

Hi, in City Connection the KM counter always increases, even when the car is passing above an already colored piece of platform.
This hack increases the KM counter only when the car is coloring the platform.

Code: Select all

<cheat desc="Increase Km Only When Coloring">
    <script state="on">
      <action>maincpu.md@8E36=BD7A0012</action>
      <action>maincpu.mq@7A00=A6A49A1C811F2708</action>
      <action>maincpu.mq@7A08=9741860197409641</action>
      <action>maincpu.mb@7A10=39</action>
      <action>maincpu.mw@BD2F=BD7A</action>
      <action>maincpu.mb@BD31=12</action>
      <action>maincpu.mw@7A12=9B40</action>
      <action>maincpu.mb@7A14=19</action>
      <action>maincpu.mq@7A15=9742860097409741</action>
      <action>maincpu.mw@7A1D=9642</action>
      <action>maincpu.mb@7A1F=39</action>
    </script>
  </cheat>
jman
Posts: 1254
Joined: Tue Dec 01, 2020 1:24 pm
Been thanked: 9 times

Re: [citycon] Increase Km only when coloring

Post by jman »

Question.
  1. Why is it "one-shot" code instead of standard "on/off"?
  2. You use address $40 - $42 but these addresses are guaranteed? Other routines don't use these addresses?
  3. Missing citycona.xml and cruisin.xml
I rewrite your code because too hard to read and analyze.

citycon.xml

Code: Select all

<!-- City Connection (set 1) -->
<mamecheat version="1">

    <cheat desc="Increase KM Only When Coloring">
        <script state="on">
            <action>temp0 = maincpu.md@8E36</action>
            <action>temp1 = maincpu.mq@79C0</action>
            <action>temp2 = maincpu.mq@79C8</action>
            <action>temp3 = maincpu.mw@BD2F</action>
        </script>
        <script state="run">
            <action>maincpu.md@8E36 = BD79C012</action>
            <action>maincpu.mq@79C0 = A6A49A1CC601811F</action> <!-- check road state -->
            <action>maincpu.mq@79C8 = 26015FD74039FFFF</action>
            <!--
            79C0 | A6 A4 : LDA    ,Y
            79C2 | 9A 1C : ORA    $1C
            79C4 | C6 01 : LDB    #$01
            79C6 | 81 1F : CMPA   #$1F
            79C8 | 26 01 : BNE    $79CB
            79CA | 5F    : CLRB
            79CB | D7 40 : STB    $40
            79CD | 39    : RTS
            -->
            <action>maincpu.mw@BD2F = 9B40</action> <!-- calculate distance -->
        </script>
        <script state="off">
            <action>maincpu.md@8E36 = temp0</action>
            <action>maincpu.mq@79C0 = temp1</action>
            <action>maincpu.mq@79C8 = temp2</action>
            <action>maincpu.mw@BD2F = temp3</action>
        </script>
    </cheat>

</mamecheat>
  • Changed "one-shot" code to standard "on/off".
  • Reduced size of custom routine after trace program code.
jman

my wip cheat database back-up (2024/12/01 ver.)
https://u3.getuploader.com/...../download/47
downloadpass : jman2020
Kalalu
Posts: 2
Joined: Thu Jan 23, 2025 12:50 am
Has thanked: 1 time

Re: [citycon] Increase Km only when coloring

Post by Kalalu »

Hi, thank you for your question.
  1. Well, you are right, I assumed it was simply a Set Now approach (to my discharge, it was well over 1 AM :) )
  2. I've run the game with watchpoints at $40 - $42, playing every main game mechanic (car crash, cat crash, cans combo, spikes, warp).
  3. Do you mean I have to add this cheat to the clones? Sorry, I'm new to cheat codes, I could miss the good practices.
Thank you for your refactor, I can learn from it. But now I have a question for you.
The whole cheat code is merely an if statement, "if the value at 0x1C is equal to 1F, then set 0xBD30 to 00".
My first attempt was to simply add a condition to the action, something like this:

Code: Select all

<cheat desc="Increase Km Only When Coloring">
  <script state="run">
    <action condition="(maincpu.pb@1C==1F)">
    maincpu.mb@BD30=00</action>
  </script>
</cheat>
Now, it was just a test, had it worked the value would have always been 0, but it didn't. Can you explain me what's the issue and if this approach is feasible? Thank you for your patience.
jman
Posts: 1254
Joined: Tue Dec 01, 2020 1:24 pm
Been thanked: 9 times

Re: [citycon] Increase Km only when coloring

Post by jman »

Because "run" state is executed per frame-update, not routine.
$1c is often rewritten between frames so that value in $1c is unstable when "run" is executed.
I think it's impossible to get 0x1f on $1c at frame-update in "run" state without hacking program code.
These users thanked the author jman for the post:
Kalalu
Rating: 33.33%
 
jman

my wip cheat database back-up (2024/12/01 ver.)
https://u3.getuploader.com/...../download/47
downloadpass : jman2020
Post Reply