Page 1 of 1

[sf2ce] Training Mode

Posted: Sun Nov 24, 2019 3:21 am
by yacsha
Here is a cheat I was working on, it is a Training Mode - Player Actions for SF2CE based on the POF Training Mode for ssf2.

The Player Action Padlock, makes the player move with predetermined actions, such as jumping or covering, so that you can practice and train.

Thanks to the excellent documentation that I found in this forum, and to the guide of our friend POF that he left written in his blog, I was able to complete this contribution, since searching on the Internet I did not find any training mode for SF2CE. This Cheat XML has been tested without problems in Mame 0.215. Although the script still has some errors in the "fierce throw", since the player is not yet able to grab, so if someone found a solution I would be very grateful. A big SF2CE fan says goodbye.

Best regards

Code: Select all

<cheat desc="SF2CE Training Mode"/> <comment>Based in POF SSF2 training mode and adapted for sf2ce by yacsha</comment>  </cheat> 

<cheat desc="Padlock P1 (Action)">
    <parameter>
      <item value="0x00">Neutral (Stand)</item>
      <item value="0xfd">Block Everything</item>
      <item value="0xfc">Block Ground Attacks</item>
      <item value="0x08">Up (Jump)</item>
      <item value="0x09">Up-Right</item>
      <item value="0x0A">Up-Left</item>
      <item value="0x04">Down (Crouch)</item>
      <item value="0x05">Down-Right</item>
      <item value="0x06">Down-Left</item>
      <item value="0x01">Right</item>
      <item value="0x02">Left</item>
      <item value="0xff">Throw-Right (fierce throw)</item>
      <item value="0xfe">Throw-Left (fierce throw)</item>
    </parameter>
    <script state="on">
        <action>maincpu.mw@379F4=4E71</action>
        <action>maincpu.mw@20EA=4E71,maincpu.mw@20EC=4E71,maincpu.mw@20EE=4E71</action>
    </script>
    <script state="run">
        <action>maincpu.mw@379F4=4E71</action>
        <action condition="param == 0xff and frame % 2 == 0">maincpu.pw@FF8650=0001</action>
        <action condition="param == 0xff and frame % 2 != 0">maincpu.pw@FF8650=0041</action>
        <action condition="param == 0xfe and frame % 2 == 0">maincpu.pw@FF8650=0002</action>
        <action condition="param == 0xfe and frame % 2 != 0">maincpu.pw@FF8650=0042</action>
        <action condition="param lt 0x0f">maincpu.pb@FF8651=param</action>

        <!-- block ground attacks -->
        <action condition="param == 0xfc and maincpu.pb@FF86C1==0">maincpu.pw@FF8650=0000</action> <!-- neutral when opponent is neutral -->
        <action condition="param == 0xfc and (maincpu.pb@FF86C1==A or maincpu.pb@FF86C1==C) and (maincpu.pb@FF8951 band 4) == 4 and maincpu.pb@FF857C==0">maincpu.pw@FF8650=0005</action> <!-- if opponent attacking and pressing down, block low (on P1 side) -->
        <action condition="param == 0xfc and (maincpu.pb@FF86C1==A or maincpu.pb@FF86C1==C) and (maincpu.pb@FF8951 band 4) == 4 and maincpu.pb@FF857C==1">maincpu.pw@FF8650=0006</action> <!-- if opponent attacking and pressing down, block low (on P2 side) -->
        <action condition="param == 0xfc and (maincpu.pb@FF86C1==A or maincpu.pb@FF86C1==C) and (maincpu.pb@FF8951 band 4) != 4 and maincpu.pb@FF857C==0">maincpu.pw@FF8650=0001</action> <!-- if opponent attacking and not pressing down, block high (on P1 side) -->
        <action condition="param == 0xfc and (maincpu.pb@FF86C1==A or maincpu.pb@FF86C1==C) and (maincpu.pb@FF8951 band 4) != 4 and maincpu.pb@FF857C==1">maincpu.pw@FF8650=0002</action> <!-- if opponent attacking and not pressing down, block high (on P2 side) -->

        <!-- block everything: -->
        <action condition="param == 0xfd and maincpu.pb@FF86C1==0">maincpu.pw@FF8650=0000</action> <!-- neutral when opponent is neutral -->
        <action condition="param == 0xfd and (maincpu.pb@FF86C1==A or maincpu.pb@FF86C1==C) and (maincpu.pb@FF8951 band 4) == 4 and maincpu.pb@FF857C==0">maincpu.pw@FF8650=0005</action> <!-- if opponent attacking and pressing down, block low (on P1 side) -->
        <action condition="param == 0xfd and (maincpu.pb@FF86C1==A or maincpu.pb@FF86C1==C) and (maincpu.pb@FF8951 band 4) == 4 and maincpu.pb@FF857C==1">maincpu.pw@FF8650=0006</action> <!-- if opponent attacking and pressing down, block low (on P2 side) -->
        <action condition="param == 0xfd and (maincpu.pb@FF86C1==A or maincpu.pb@FF86C1==C) and (maincpu.pb@FF8951 band 4) != 4 and maincpu.pb@FF857C==0">maincpu.pw@FF8650=0001</action> <!-- if opponent attacking and not pressing down, block high (on P1 side) -->
        <action condition="param == 0xfd and (maincpu.pb@FF86C1==A or maincpu.pb@FF86C1==C) and (maincpu.pb@FF8951 band 4) != 4 and maincpu.pb@FF857C==1">maincpu.pw@FF8650=0002</action> <!-- if opponent attacking and not pressing down, block high (on P2 side) -->

	<!-- jump attacks (FF86C1==4) -->
        <action condition="param == 0xfd and maincpu.pb@FF86C1==4 and (maincpu.pw@FF83C4-maincpu.pw@FF86C4 lt F) and maincpu.pb@FF857C==0">maincpu.pw@FF8650=0001</action> <!-- block high if the opponent is at close range (<0xF) on P1 side -->
        <action condition="param == 0xfd and maincpu.pb@FF86C1==4 and (maincpu.pw@FF86C4-maincpu.pw@FF83C4 lt F) and maincpu.pb@FF857C==1">maincpu.pw@FF8650=0002</action> <!-- block high if the opponent is at close range (<0xF) on P2 side -->
        <action condition="param == 0xfd and maincpu.pb@FF86C1==4 and (maincpu.pw@FF83C4-maincpu.pw@FF86C4 > 20) and maincpu.pb@FF857C==0">maincpu.pw@FF8650=0000</action> <!-- stop blocking if the opponent is farther than 0x20 on P1 side -->
        <action condition="param == 0xfd and maincpu.pb@FF86C1==4 and (maincpu.pw@FF86C4-maincpu.pw@FF83C4 > 20) and maincpu.pb@FF857C==1">maincpu.pw@FF8650=0000</action> <!-- stop blocking if the opponent is farther than 0x20 on P2 side -->

	<!-- ... except if: the opponent hits any kick or punch button -->
        <action condition="param == 0xfd and maincpu.pb@FF86C1==4 and (maincpu.pw@FF8950 band ~000F) != 0 and maincpu.pb@FF857C==0">maincpu.pw@FF8650=0001</action>
        <action condition="param == 0xfd and maincpu.pb@FF86C1==4 and (maincpu.pw@FF8950 band ~000F) != 0 and maincpu.pb@FF857C==1">maincpu.pw@FF8650=0002</action>

	<!-- ... and do not block when the opponent is so far that he can't reach us with a jumping normal attack -->
        <action condition="param == 0xfd and maincpu.pb@FF86C1==4 and (maincpu.pw@FF83C4-maincpu.pw@FF86C4 > 70) and maincpu.pb@FF857C==0">maincpu.pw@FF8650=0000</action>
        <action condition="param == 0xfd and maincpu.pb@FF86C1==4 and (maincpu.pw@FF86C4-maincpu.pw@FF83C4 > 70) and maincpu.pb@FF857C==1">maincpu.pw@FF8650=0000</action>

    </script>
    <script state="off">
        <action>maincpu.pw@FF8650=0</action>
        <action>maincpu.mw@379F4=6710</action>
        <action>maincpu.mw@20EA=3BD6,maincpu.mw@20EC=007A,maincpu.mw@20EE=0650</action>
    </script>
  </cheat>

 <cheat desc="Padlock P2 (Action)">
    <parameter>
      <item value="0x00">Neutral (Stand)</item>
      <item value="0xfd">Block everything</item>
      <item value="0xfc">Block ground normals</item>
      <item value="0x08">Up (Jump)</item>
      <item value="0x09">Up-Right</item>
      <item value="0x0A">Up-Left</item>
      <item value="0x04">Down (Crouch)</item>
      <item value="0x05">Down-Right</item>
      <item value="0x06">Down-Left</item>
      <item value="0x01">Right</item>
      <item value="0x02">Left</item>
      <item value="0xff">Throw-Right (fierce throw)</item>
      <item value="0xfe">Throw-Left (fierce throw)</item>
    </parameter>
    <script state="on">
        <action>maincpu.mw@379F4=4E71</action>
        <action>maincpu.mw@20F0=4E71,maincpu.mw@20F2=4E71,maincpu.mw@20F4=4E71</action>
    </script>
    <script state="run">
        <action>maincpu.mw@379F4=4E71</action>
        <action condition="param == 0xff and frame % 2 == 0">maincpu.pw@FF8950=0001</action>
        <action condition="param == 0xff and frame % 2 != 0">maincpu.pw@FF8950=0041</action>
        <action condition="param == 0xfe and frame % 2 == 0">maincpu.pw@FF8950=0002</action>
        <action condition="param == 0xfe and frame % 2 != 0">maincpu.pw@FF8950=0042</action>
        <action condition="param lt 0x0f">maincpu.pb@FF8951=param</action>

        <!-- block ground attacks -->
        <action condition="param == 0xfc and maincpu.pb@FF83C1==0">maincpu.pw@FF8950=0000</action> <!-- neutral when opponent is neutral -->
        <action condition="param == 0xfc and (maincpu.pb@FF83C1==A or maincpu.pb@FF83C1==C) and (maincpu.pb@FF8651 band 4) == 4 and maincpu.pb@FF887C==0">maincpu.pw@FF8950=0005</action> <!-- if opponent attacking and pressing down, block low (on P1 side) -->
        <action condition="param == 0xfc and (maincpu.pb@FF83C1==A or maincpu.pb@FF83C1==C) and (maincpu.pb@FF8651 band 4) == 4 and maincpu.pb@FF887C==1">maincpu.pw@FF8950=0006</action> <!-- if opponent attacking and pressing down, block low (on P2 side) -->
        <action condition="param == 0xfc and (maincpu.pb@FF83C1==A or maincpu.pb@FF83C1==C) and (maincpu.pb@FF8651 band 4) != 4 and maincpu.pb@FF887C==0">maincpu.pw@FF8950=0001</action> <!-- if opponent attacking and not pressing down, block high (on P1 side) -->
        <action condition="param == 0xfc and (maincpu.pb@FF83C1==A or maincpu.pb@FF83C1==C) and (maincpu.pb@FF8651 band 4) != 4 and maincpu.pb@FF887C==1">maincpu.pw@FF8950=0002</action> <!-- if opponent attacking and not pressing down, block high (on P2 side) -->

        <!-- block everything: -->
        <action condition="param == 0xfd and maincpu.pb@FF83C1==0">maincpu.pw@FF8950=0000</action> <!-- neutral when opponent is neutral -->
        <action condition="param == 0xfd and (maincpu.pb@FF83C1==A or maincpu.pb@FF83C1==C) and (maincpu.pb@FF8651 band 4) == 4 and maincpu.pb@FF887C==0">maincpu.pw@FF8950=0005</action> <!-- if opponent attacking and pressing down, block low (on P1 side) -->
        <action condition="param == 0xfd and (maincpu.pb@FF83C1==A or maincpu.pb@FF83C1==C) and (maincpu.pb@FF8651 band 4) == 4 and maincpu.pb@FF887C==1">maincpu.pw@FF8950=0006</action> <!-- if opponent attacking and pressing down, block low (on P2 side) -->
        <action condition="param == 0xfd and (maincpu.pb@FF83C1==A or maincpu.pb@FF83C1==C) and (maincpu.pb@FF8651 band 4) != 4 and maincpu.pb@FF887C==0">maincpu.pw@FF8950=0001</action> <!-- if opponent attacking and not pressing down, block high (on P1 side) -->
        <action condition="param == 0xfd and (maincpu.pb@FF83C1==A or maincpu.pb@FF83C1==C) and (maincpu.pb@FF8651 band 4) != 4 and maincpu.pb@FF887C==1">maincpu.pw@FF8950=0002</action> <!-- if opponent attacking and not pressing down, block high (on P2 side) -->

	<!-- jump attacks (FF83C1==4) -->
        <action condition="param == 0xfd and maincpu.pb@FF83C1==4 and (maincpu.pw@FF86C4-maincpu.pw@FF83C4 lt F) and maincpu.pb@FF887C==0">maincpu.pw@FF8950=0001</action> <!-- block high if the opponent is at close range (<0xF) on P1 side -->
        <action condition="param == 0xfd and maincpu.pb@FF83C1==4 and (maincpu.pw@FF83C4-maincpu.pw@FF86C4 lt F) and maincpu.pb@FF887C==1">maincpu.pw@FF8950=0002</action> <!-- block high if the opponent is at close range (<0xF) on P2 side -->
        <action condition="param == 0xfd and maincpu.pb@FF83C1==4 and (maincpu.pw@FF86C4-maincpu.pw@FF83C4 > 20) and maincpu.pb@FF887C==0">maincpu.pw@FF8950=0000</action> <!-- stop blocking if the opponent is farther than 0x20 on P1 side -->
        <action condition="param == 0xfd and maincpu.pb@FF83C1==4 and (maincpu.pw@FF83C4-maincpu.pw@FF86C4 > 20) and maincpu.pb@FF887C==1">maincpu.pw@FF8950=0000</action> <!-- stop blocking if the opponent is farther than 0x20 on P2 side -->

	<!-- ... except if: the opponent hits any kick or punch button -->
        <action condition="param == 0xfd and maincpu.pb@FF83C1==4 and (maincpu.pw@FF8650 band ~000F) != 0 and maincpu.pb@FF887C==0">maincpu.pw@FF8950=0001</action>
        <action condition="param == 0xfd and maincpu.pb@FF83C1==4 and (maincpu.pw@FF8650 band ~000F) != 0 and maincpu.pb@FF887C==1">maincpu.pw@FF8950=0002</action>

	<!-- ... and do not block when the opponent is so far that he can't reach us with a jumping normal attack -->
        <action condition="param == 0xfd and maincpu.pb@FF83C1==4 and (maincpu.pw@FF86C4-maincpu.pw@FF83C4 > 70) and maincpu.pb@FF887C==0">maincpu.pw@FF8950=0000</action>
        <action condition="param == 0xfd and maincpu.pb@FF83C1==4 and (maincpu.pw@FF83C4-maincpu.pw@FF86C4 > 70) and maincpu.pb@FF887C==1">maincpu.pw@FF8950=0000</action>

    </script>
    <script state="off">
        <action>maincpu.pw@FF8950=0</action>
        <action>maincpu.mw@379F4=6710</action>
        <action>maincpu.mw@20F0=3BD6,maincpu.mw@20F2=007E,maincpu.mw@20F4=0950</action>
    </script>
  </cheat>


Re: [sf2ce] Training Mode

Posted: Sun Nov 24, 2019 1:30 pm
by fernanpower77
...

Re: [sf2ce] Training Mode

Posted: Sun Dec 01, 2019 7:24 pm
by fernanpower77
...

Re: [sf2ce] Training Mode

Posted: Sun Dec 01, 2019 7:31 pm
by yacsha
Hi Fernando, thanks you!, the cheat you put is very interesting. The truth is that I am still a newbie in the unpacking of a rom, but when I have time I will try to look for victory poses, what I can think of is to look at the end of each game, just when they are activated.

Best regards
fernanpower77 wrote: Sun Nov 24, 2019 1:30 pm Good morning friend Yacsha, congratulations on your work! I'm also a big fan of SF2CE and I'm always looking for new codes! I need your help: could you figure out how to activate victory poses during the fight without interrupting it? Thanks a lot if you can find out and if you have any new code post here please! I will leave a code below as a thank you! God bless you! Fernando M. Hack

Re: [sf2ce] Training Mode

Posted: Sun Dec 01, 2019 7:54 pm
by yacsha
Thank you for the excellent cheat, if you had downloaded some cheats that have similar functionalities from http://cheat.retrogames.com/mame_downloads.htm, in the sf2ce.xml file that is included. What difference is there from your cheat, with respect to the cheats included in sf2ce.xml?

Best Regards
fernanpower77 wrote: Sun Dec 01, 2019 7:24 pm Good afternoon! Here's a complement to your code, HUD Recharge, where your opponent's blood is restored as in SSF2T. If you find out how to activate victory poses please return me! Appreciate! Fernando M. Hack

Re: [sf2ce] Training Mode

Posted: Sun Dec 01, 2019 9:06 pm
by fernanpower77
...

Re: [sf2ce] Training Mode

Posted: Tue Dec 31, 2019 10:32 pm
by chunli_fm_hack
...

Re: [sf2ce] Training Mode

Posted: Sun Jan 05, 2020 7:42 pm
by yacsha
Hi chunli_fm_hack, thanks for reminding me that I had this doubt pending, currently what I have managed to find in the MAME debugger by debugging the FF8650 address, in the first 2 bytes (FF8650-FF8651)

The scheme would be as follows:

Code: Select all

A is left nibble value from FF8650 address memory
B is right nibble value from FF8650 address memory
C -> left nibble from FF8651
D -> right nibble from FF8651

D value:
Right = 1
Left = 2
Down = 4
Up = 8

C value:
Small punch = 1
Middle punch = 2
Strong punch = 4

B value:
Small kick = 1
Middle kick = 2
Strong kick = 4

Example:

1) It is a movement to the left and strong punch
A B C D
0 0 4 2

2) It's a movement to the right and middle kick
A B C D
0 2 0 1
Let's see if we can solve the problem because the automatic grip does not work.

Just in case the memory address for player 2 is: FF8950

Best Regards

Re: [sf2ce] Training Mode

Posted: Sun Jan 05, 2020 7:50 pm
by chunli_fm_hack
...

Re: [sf2ce] Training Mode

Posted: Sun Jan 05, 2020 8:04 pm
by yacsha
Thanks chunli_fm_hack, it is just my next challenge to make macros for sf2 players, to see if we are doing it together. I have corrected my previous post, where I responded, a minor error corrected.

Re: [sf2ce] Training Mode

Posted: Sun Jan 05, 2020 9:15 pm
by chunli_fm_hack
...

Re: [sf2ce] Training Mode

Posted: Mon Jan 06, 2020 3:11 am
by yacsha
Excellent chunli_fm_hack, in theory it should work, but I could not, it has the same bug that has the first code I put, which I still don't know what it is. That is, the player only moves, but does not simulate pressing the button. Have you testing the code? in which version of MAME, I am testing it in MAME 0.215.

Best regards.