XML Write Value to Address Range

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.
User avatar
Abystus
CheatFinder Staff Sergeant
CheatFinder Staff Sergeant
Posts: 305
Joined: Sun Jul 23, 2006 6:53 am

XML Write Value to Address Range

Postby Abystus » Wed Oct 01, 2014 7:58 am

Is there any way to write a value to a range of addresses similar to a for loop? Lets say I need to write a value of FF to addresses FFA10000 - FFA12000, but I don't wanna do it manually (a line per address that is). Is there any short hand way to write a single value to a block of memory in the new xml format? I find that cleaning up custom routines is very costly (having such large "off" sections to my codes is devouring the maximum allowed character count of my post), and I've considered just leaving the custom routines linger out there, and only restoring the hook locations to save space in the "off" section. Hopefully compact way of doing this (just a few lines) should remedy the situation if one exists. Any help is appreciated.
Bored? Watch some of my hacks here. Wanna hack like me? Use Branch Finder. Looking for hidden menus, characters, etc... in your games? Use The Peeper.

syndromtr
CheatFinder Staff Sergeant
CheatFinder Staff Sergeant
Posts: 217
Joined: Wed Sep 25, 2013 8:18 am

Re: XML Write Value to Address Range

Postby syndromtr » Wed Oct 01, 2014 9:29 pm

hi, i checked this method for that, but it seems it's not working.. Pugsy might know if there's an exact solution for that..
here, i checked existing cheats and mame debugger help source.

Code: Select all

       <script state="on">
         <action condition="temp0 LT 2000">maincpu.mb@(42000+temp0)=FF, temp0++</action>
      </script>


i assume this FF clear needed at "on" state of the cheat.. unfortunately this loop do not continue and only first byte is set to FF. i'm sure it would work in "run" state because there are two cheats using this method in database. you can check them:
knockout.xml and triplep.xml

btw. just an idea for your MKII WIP cheats, to shorten them in xml (less lines)
instead of maincpu.mw, maincpu.mq can be used? as hook routines are continual in memory..
maincpu.mw@c00000-2-4-6
replacing those 4 lines with
maincpu.mq@c00000

User avatar
Abystus
CheatFinder Staff Sergeant
CheatFinder Staff Sergeant
Posts: 305
Joined: Sun Jul 23, 2006 6:53 am

Re: XML Write Value to Address Range

Postby Abystus » Wed Oct 01, 2014 10:07 pm

syndromtr wrote:hi, i checked this method for that, but it seems it's not working.. Pugsy might know if there's an exact solution for that..
here, i checked existing cheats and mame debugger help source.

Code: Select all

       <script state="on">
         <action condition="temp0 LT 2000">maincpu.mb@(42000+temp0)=FF, temp0++</action>
      </script>


i assume this FF clear needed at "on" state of the cheat.. unfortunately this loop do not continue and only first byte is set to FF. i'm sure it would work in "run" state because there are two cheats using this method in database. you can check them:
knockout.xml and triplep.xml

btw. just an idea for your MKII WIP cheats, to shorten them in xml (less lines)
instead of maincpu.mw, maincpu.mq can be used? as hook routines are continual in memory..
maincpu.mw@c00000-2-4-6
replacing those 4 lines with
maincpu.mq@c00000


I will test this out and see if I can get something working. If Pugsy has a better answer, then we can try that as well. I don't really want to change the write size of my cheat as it would become unbalanced looking with varying sizes of writes (I try to keep things uniform looking if at all possible.) Since this assembly is not aligned (every instruction uses the same amount of space, ex: MIPS, ARM, etc...), it will vary in write sizes quite a bit unless a 8/16 bit write is used. I will either find something that can do it like your suggested code (the loop example), or neglect removing the custom routines entirely while only focusing on restoring just the hook locations in the "off" section. Either way, it shouldn't cause any real issues since that area of the ROM is normally not accessed outside of my routines. Thanks for the response.
Bored? Watch some of my hacks here. Wanna hack like me? Use Branch Finder. Looking for hidden menus, characters, etc... in your games? Use The Peeper.

User avatar
Pugsy
CheatFinder General
CheatFinder General
Posts: 3128
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Contact:

Re: XML Write Value to Address Range

Postby Pugsy » Wed Oct 01, 2014 10:24 pm

There are no actual loops in the action statements, the only way to perform a loop of sorts is in the "run" script and that's because it gets poked every frame. The "on", "off" and "change" scripts get run in a single frame so they won't lend themselves to that method.

I'm assuming you are talking about the mk2 cheat here. There's a few things to bear in mind, one is there any reason to restore the FF'd memory back to FF? If the game doesn't access it at all then I'd say just forget about restoring it to FF at all. As long as the jumps to the code are removed then there's nothing lost in losing them from the off script. The one time it might have an effect is if there's a ROM check that stops the game working/booting in which case this can be fixed by adding a ROM check bypass in the "on" script which is not turned off when the cheat is.

Like syndromtr mentioned, there are space savings to be had just by changing from .mw to .mq. Also FFFFFFFFFFFFFFFF == -1 so that could save some chars too. Link that with some commas and you can cut it right down. eg:-

Code: Select all

      <action>maincpu.mq@C0000=-1,maincpu.mq@C0008=-1,maincpu.mq@C0010=-1,maincpu.mq@C0018=-1,maincpu.mq@C0020=-1,maincpu.mq@C0028=-1,maincpu.mq@C0030=-1,maincpu.mq@C0038=-1</action>
      <action>maincpu.mq@C0040=-1,maincpu.mq@C0048=-1,maincpu.mq@C0050=-1,maincpu.mq@C0058=-1,maincpu.mq@C0060=-1,maincpu.mq@C0068=-1,maincpu.mq@C0070=-1,maincpu.mq@C0078=-1</action>
      <action>maincpu.mq@C0080=-1,maincpu.mq@C0088=-1,maincpu.mq@C0090=-1,maincpu.mq@C0098=-1,maincpu.mq@C00A0=-1,maincpu.mq@C00A8=-1,maincpu.mq@C00B0=-1,maincpu.mq@C00B8=-1</action>
      <action>maincpu.mq@C00C0=-1,maincpu.mq@C00C8=-1,maincpu.mq@C00D0=-1,maincpu.mq@C00D8=-1,maincpu.mq@C00E0=-1,maincpu.mq@C00E8=-1,maincpu.mq@C00F0=-1,maincpu.mq@C00F8=-1</action>
      <action>maincpu.mq@C0100=-1,maincpu.mq@C0108=-1,maincpu.mq@C0110=-1,maincpu.mq@C0118=-1,maincpu.mq@C0120=-1,maincpu.mq@C0128=-1,maincpu.mq@C0130=-1,maincpu.mq@C0138=-1</action>
      <action>maincpu.mq@C0140=-1,maincpu.mq@C0148=-1,maincpu.mq@C0150=-1,maincpu.mq@C0158=-1,maincpu.mq@C0160=-1,maincpu.mq@C0168=-1,maincpu.mq@C0170=-1,maincpu.mq@C0178=-1</action>
      <action>maincpu.mq@C0180=-1,maincpu.mq@C0188=-1,maincpu.mq@C0190=-1,maincpu.mq@C0198=-1,maincpu.mq@C01A0=-1,maincpu.mq@C01A8=-1,maincpu.mq@C01B0=-1,maincpu.mq@C01B8=-1</action>
      <action>maincpu.mq@C01C0=-1,maincpu.mq@C01C8=-1,maincpu.mq@C01D0=-1,maincpu.mq@C01D8=-1,maincpu.mq@C01E0=-1,maincpu.mq@C01E8=-1,maincpu.mq@C01F0=-1,maincpu.mq@C01F8=-1</action>
      <action>maincpu.mq@C0200=-1,maincpu.mq@C0208=-1,maincpu.mq@C0210=-1,maincpu.mq@C0218=-1,maincpu.mq@C0220=-1,maincpu.mq@C0228=-1,maincpu.mq@C0230=-1,maincpu.mq@C0238=-1</action>
      <action>maincpu.mq@C0240=-1,maincpu.mq@C0248=-1,maincpu.mq@C0250=-1,maincpu.mq@C0258=-1,maincpu.mq@C0260=-1,maincpu.mq@C0268=-1,maincpu.mq@C0270=-1,maincpu.mq@C0278=-1</action>
      <action>maincpu.mq@C0280=-1,maincpu.mq@C0288=-1,maincpu.mq@C0290=-1,maincpu.mq@C0298=-1,maincpu.mq@C02A0=-1,maincpu.mq@C02A8=-1,maincpu.mq@C02B0=-1,maincpu.mq@C02B8=-1</action>
      <action>maincpu.mq@C02C0=-1,maincpu.mq@C02C8=-1,maincpu.mq@C02D0=-1,maincpu.mq@C02D8=-1,maincpu.mq@C02E0=-1,maincpu.mq@C02E8=-1,maincpu.mq@C02F0=-1,maincpu.mq@C02F8=-1</action>
      <action>maincpu.mq@C0300=-1,maincpu.mq@C0308=-1,maincpu.mq@C0310=-1,maincpu.mq@C0318=-1,maincpu.mq@C0320=-1,maincpu.mq@C0328=-1,maincpu.mq@C0330=-1,maincpu.mq@C0338=-1</action>
      <action>maincpu.mq@C0340=-1,maincpu.mq@C0348=-1,maincpu.mq@C0350=-1,maincpu.mq@C0358=-1,maincpu.mq@C0360=-1,maincpu.mq@C0368=-1,maincpu.mq@C0370=-1,maincpu.mq@C0378=-1</action>
      <action>maincpu.mq@C0380=-1,maincpu.mq@C0388=-1,maincpu.mq@C0390=-1,maincpu.mq@C0398=-1,maincpu.mq@C03A0=-1,maincpu.mq@C03A8=-1,maincpu.mq@C03B0=-1,maincpu.mq@C03B8=-1</action>
      <action>maincpu.mq@C03C0=-1,maincpu.mq@C03C8=-1,maincpu.mq@C03D0=-1,maincpu.mq@C03D8=-1,maincpu.mq@C03E0=-1,maincpu.mq@C03E8=-1,maincpu.mq@C03F0=-1,maincpu.mq@C03F8=-1</action>
      <action>maincpu.mq@C0400=-1,maincpu.mq@C0408=-1,maincpu.mq@C0410=-1,maincpu.mq@C0418=-1,maincpu.mq@C0420=-1,maincpu.mq@C0428=-1,maincpu.mq@C0430=-1,maincpu.mq@C0438=-1</action>
      <action>maincpu.mq@C0440=-1,maincpu.mq@C0448=-1,maincpu.mq@C0450=-1,maincpu.mq@C0458=-1,maincpu.mq@C0460=-1,maincpu.mq@C0468=-1,maincpu.mq@C0470=-1,maincpu.mq@C0478=-1</action>
      <action>maincpu.mq@C0480=-1,maincpu.mq@C0488=-1,maincpu.mq@C0490=-1,maincpu.mq@C0498=-1,maincpu.mq@C04A0=-1,maincpu.mq@C04A8=-1,maincpu.mq@C04B0=-1,maincpu.mq@C04B8=-1</action>
      <action>maincpu.mq@C04C0=-1,maincpu.mq@C04C8=-1,maincpu.mq@C04D0=-1,maincpu.mq@C04D8=-1,maincpu.mq@C04E0=-1,maincpu.mq@C04E8=-1,maincpu.mq@C04F0=-1,maincpu.mq@C04F8=-1</action>
      <action>maincpu.mq@C0500=-1,maincpu.mq@C0508=-1,maincpu.mq@C0510=-1,maincpu.mq@C0518=-1,maincpu.mq@C0520=-1,maincpu.mq@C0528=-1,maincpu.mq@C0530=-1,maincpu.mq@C0538=-1</action>
      <action>maincpu.mq@C0540=-1,maincpu.mq@C0548=-1,maincpu.mq@C0550=-1,maincpu.mq@C0558=-1,maincpu.mq@C0560=-1,maincpu.mq@C0568=-1,maincpu.mq@C0570=-1,maincpu.mq@C0578=-1</action>
      <action>maincpu.mq@C0580=-1,maincpu.mq@C0588=-1,maincpu.mq@C0590=-1,maincpu.mq@C0598=-1,maincpu.mq@C05A0=-1,maincpu.mq@C05A8=-1,maincpu.mq@C05B0=-1,maincpu.mq@C05B8=-1</action>
      <action>maincpu.mq@C05C0=-1,maincpu.mq@C05C8=-1,maincpu.mq@C05D0=-1,maincpu.mq@C05D8=-1,maincpu.mq@C05E0=-1,maincpu.mq@C05E8=-1,maincpu.mq@C05F0=-1,maincpu.mq@C05F8=-1</action>
      <action>maincpu.mq@C0600=-1,maincpu.mq@C0608=-1,maincpu.mq@C0610=-1,maincpu.mq@C0618=-1,maincpu.mq@C0620=-1,maincpu.mq@C0628=-1,maincpu.mq@C0630=-1,maincpu.mq@C0638=-1</action>
      <action>maincpu.mq@C0640=-1,maincpu.mq@C0648=-1,maincpu.mq@C0650=-1,maincpu.mq@C0658=-1,maincpu.mq@C0660=-1,maincpu.mq@C0668=-1,maincpu.mq@C0670=-1,maincpu.mq@C0678=-1</action>
      <action>maincpu.mq@C0680=-1,maincpu.mq@C0688=-1,maincpu.mq@C0690=-1,maincpu.mq@C0698=-1,maincpu.mq@C06A0=-1,maincpu.mq@C06A8=-1,maincpu.mq@C06B0=-1,maincpu.mq@C06B8=-1</action>
      <action>maincpu.mq@C06C0=-1,maincpu.mq@C06C8=-1,maincpu.mq@C06D0=-1,maincpu.mq@C06D8=-1,maincpu.mq@C06E0=-1,maincpu.mq@C06E8=-1,maincpu.mq@C06F0=-1,maincpu.mq@C06F8=-1</action>
Pugsy

Servicing your cheating needs since 1985 ;-)

Grab the latest cheat collection:
MAME 0.187 XML cheat collection 7 JULY 2017) from http://www.mamecheat.co.uk or direct from:-
http://www.mediafire.com/file/0dvubha3b ... at0187.zip (ZIP Archive 1826 KB)

User avatar
Abystus
CheatFinder Staff Sergeant
CheatFinder Staff Sergeant
Posts: 305
Joined: Sun Jul 23, 2006 6:53 am

Re: XML Write Value to Address Range

Postby Abystus » Wed Oct 01, 2014 10:34 pm

I don't think there is really any reason to restore the default value of "FF" other than putting what was initially there back (which wasn't used to begin with). I will have to test it out and see if the game has any issues booting up (during the rom check), but I'd assume the game should restart just fine whether those values at at those addresses not. I will be changing that cheat from "run" to "on" when it is complete (getting close), so I think I'll just neglect to restore the custom routine default values as I don't find it necessary in the long run. Thanks for the comma chaining info as I didn't know you could even do that (will save even more space!) :).
Bored? Watch some of my hacks here. Wanna hack like me? Use Branch Finder. Looking for hidden menus, characters, etc... in your games? Use The Peeper.

User avatar
Pugsy
CheatFinder General
CheatFinder General
Posts: 3128
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Contact:

Re: XML Write Value to Address Range

Postby Pugsy » Wed Oct 01, 2014 11:09 pm

Of course it's also possible to use XML entities to reduce the size of the file drastically. Entities can be though of as a sort of FIND and REPLACE built into the XML format, this can of course be in multiple ways to really obscure the cheats. However, obscuring cheats is a very bad thing and the space savings aren't that great after you've factored in solid 7z archiving which will do a similar thing in a binary manner.

Here's a simple example for mk2....

Code: Select all

<?xml version="1.0"?>
<!DOCTYPE document [
<!ENTITY a "maincpu.mq@C0">
]>
<mamecheat version="1">
 
  <cheat desc="TRIAL">
    <script state="on">
      <action>&a;000=0,&a;008=0,&a;010=0,&a;018=0,&a;020=0,&a;028=0,&a;030=0,&a;038=0</action>
      <action>&a;040=0,&a;048=0,&a;050=0,&a;058=0,&a;060=0,&a;068=0,&a;070=0,&a;078=0</action>
      <action>&a;080=0,&a;088=0,&a;090=0,&a;098=0,&a;0A0=0,&a;0A8=0,&a;0B0=0,&a;0B8=0</action>
      <action>&a;0C0=0,&a;0C8=0,&a;0D0=0,&a;0D8=0,&a;0E0=0,&a;0E8=0,&a;0F0=0,&a;0F8=0</action>
      <action>&a;100=0,&a;108=0,&a;110=0,&a;118=0,&a;120=0,&a;128=0,&a;130=0,&a;138=0</action>
      <action>&a;140=0,&a;148=0,&a;150=0,&a;158=0,&a;160=0,&a;168=0,&a;170=0,&a;178=0</action>
      <action>&a;180=0,&a;188=0,&a;190=0,&a;198=0,&a;1A0=0,&a;1A8=0,&a;1B0=0,&a;1B8=0</action>
      <action>&a;1C0=0,&a;1C8=0,&a;1D0=0,&a;1D8=0,&a;1E0=0,&a;1E8=0,&a;1F0=0,&a;1F8=0</action>
      <action>&a;200=0,&a;208=0,&a;210=0,&a;218=0,&a;220=0,&a;228=0,&a;230=0,&a;238=0</action>
      <action>&a;240=0,&a;248=0,&a;250=0,&a;258=0,&a;260=0,&a;268=0,&a;270=0,&a;278=0</action>
      <action>&a;280=0,&a;288=0,&a;290=0,&a;298=0,&a;2A0=0,&a;2A8=0,&a;2B0=0,&a;2B8=0</action>
      <action>&a;2C0=0,&a;2C8=0,&a;2D0=0,&a;2D8=0,&a;2E0=0,&a;2E8=0,&a;2F0=0,&a;2F8=0</action>
      <action>&a;300=0,&a;308=0,&a;310=0,&a;318=0,&a;320=0,&a;328=0,&a;330=0,&a;338=0</action>
      <action>&a;340=0,&a;348=0,&a;350=0,&a;358=0,&a;360=0,&a;368=0,&a;370=0,&a;378=0</action>
      <action>&a;380=0,&a;388=0,&a;390=0,&a;398=0,&a;3A0=0,&a;3A8=0,&a;3B0=0,&a;3B8=0</action>
      <action>&a;3C0=0,&a;3C8=0,&a;3D0=0,&a;3D8=0,&a;3E0=0,&a;3E8=0,&a;3F0=0,&a;3F8=0</action>
      <action>&a;400=0,&a;408=0,&a;410=0,&a;418=0,&a;420=0,&a;428=0,&a;430=0,&a;438=0</action>
      <action>&a;440=0,&a;448=0,&a;450=0,&a;458=0,&a;460=0,&a;468=0,&a;470=0,&a;478=0</action>
      <action>&a;480=0,&a;488=0,&a;490=0,&a;498=0,&a;4A0=0,&a;4A8=0,&a;4B0=0,&a;4B8=0</action>
      <action>&a;4C0=0,&a;4C8=0,&a;4D0=0,&a;4D8=0,&a;4E0=0,&a;4E8=0,&a;4F0=0,&a;4F8=0</action>
      <action>&a;500=0,&a;508=0,&a;510=0,&a;518=0,&a;520=0,&a;528=0,&a;530=0,&a;538=0</action>
      <action>&a;540=0,&a;548=0,&a;550=0,&a;558=0,&a;560=0,&a;568=0,&a;570=0,&a;578=0</action>
      <action>&a;580=0,&a;588=0,&a;590=0,&a;598=0,&a;5A0=0,&a;5A8=0,&a;5B0=0,&a;5B8=0</action>
      <action>&a;5C0=0,&a;5C8=0,&a;5D0=0,&a;5D8=0,&a;5E0=0,&a;5E8=0,&a;5F0=0,&a;5F8=0</action>
      <action>&a;600=0,&a;608=0,&a;610=0,&a;618=0,&a;620=0,&a;628=0,&a;630=0,&a;638=0</action>
      <action>&a;640=0,&a;648=0,&a;650=0,&a;658=0,&a;660=0,&a;668=0,&a;670=0,&a;678=0</action>
      <action>&a;680=0,&a;688=0,&a;690=0,&a;698=0,&a;6A0=0,&a;6A8=0,&a;6B0=0,&a;6B8=0</action>
      <action>&a;6C0=0,&a;6C8=0,&a;6D0=0,&a;6D8=0,&a;6E0=0,&a;6E8=0,&a;6F0=0,&a;6F8=0</action>
    </script>
    <script state="off">
      <action>&a;000=-1,&a;008=-1,&a;010=-1,&a;018=-1,&a;020=-1,&a;028=-1,&a;030=-1,&a;038=-1</action>
      <action>&a;040=-1,&a;048=-1,&a;050=-1,&a;058=-1,&a;060=-1,&a;068=-1,&a;070=-1,&a;078=-1</action>
      <action>&a;080=-1,&a;088=-1,&a;090=-1,&a;098=-1,&a;0A0=-1,&a;0A8=-1,&a;0B0=-1,&a;0B8=-1</action>
      <action>&a;0C0=-1,&a;0C8=-1,&a;0D0=-1,&a;0D8=-1,&a;0E0=-1,&a;0E8=-1,&a;0F0=-1,&a;0F8=-1</action>
      <action>&a;100=-1,&a;108=-1,&a;110=-1,&a;118=-1,&a;120=-1,&a;128=-1,&a;130=-1,&a;138=-1</action>
      <action>&a;140=-1,&a;148=-1,&a;150=-1,&a;158=-1,&a;160=-1,&a;168=-1,&a;170=-1,&a;178=-1</action>
      <action>&a;180=-1,&a;188=-1,&a;190=-1,&a;198=-1,&a;1A0=-1,&a;1A8=-1,&a;1B0=-1,&a;1B8=-1</action>
      <action>&a;1C0=-1,&a;1C8=-1,&a;1D0=-1,&a;1D8=-1,&a;1E0=-1,&a;1E8=-1,&a;1F0=-1,&a;1F8=-1</action>
      <action>&a;200=-1,&a;208=-1,&a;210=-1,&a;218=-1,&a;220=-1,&a;228=-1,&a;230=-1,&a;238=-1</action>
      <action>&a;240=-1,&a;248=-1,&a;250=-1,&a;258=-1,&a;260=-1,&a;268=-1,&a;270=-1,&a;278=-1</action>
      <action>&a;280=-1,&a;288=-1,&a;290=-1,&a;298=-1,&a;2A0=-1,&a;2A8=-1,&a;2B0=-1,&a;2B8=-1</action>
      <action>&a;2C0=-1,&a;2C8=-1,&a;2D0=-1,&a;2D8=-1,&a;2E0=-1,&a;2E8=-1,&a;2F0=-1,&a;2F8=-1</action>
      <action>&a;300=-1,&a;308=-1,&a;310=-1,&a;318=-1,&a;320=-1,&a;328=-1,&a;330=-1,&a;338=-1</action>
      <action>&a;340=-1,&a;348=-1,&a;350=-1,&a;358=-1,&a;360=-1,&a;368=-1,&a;370=-1,&a;378=-1</action>
      <action>&a;380=-1,&a;388=-1,&a;390=-1,&a;398=-1,&a;3A0=-1,&a;3A8=-1,&a;3B0=-1,&a;3B8=-1</action>
      <action>&a;3C0=-1,&a;3C8=-1,&a;3D0=-1,&a;3D8=-1,&a;3E0=-1,&a;3E8=-1,&a;3F0=-1,&a;3F8=-1</action>
      <action>&a;400=-1,&a;408=-1,&a;410=-1,&a;418=-1,&a;420=-1,&a;428=-1,&a;430=-1,&a;438=-1</action>
      <action>&a;440=-1,&a;448=-1,&a;450=-1,&a;458=-1,&a;460=-1,&a;468=-1,&a;470=-1,&a;478=-1</action>
      <action>&a;480=-1,&a;488=-1,&a;490=-1,&a;498=-1,&a;4A0=-1,&a;4A8=-1,&a;4B0=-1,&a;4B8=-1</action>
      <action>&a;4C0=-1,&a;4C8=-1,&a;4D0=-1,&a;4D8=-1,&a;4E0=-1,&a;4E8=-1,&a;4F0=-1,&a;4F8=-1</action>
      <action>&a;500=-1,&a;508=-1,&a;510=-1,&a;518=-1,&a;520=-1,&a;528=-1,&a;530=-1,&a;538=-1</action>
      <action>&a;540=-1,&a;548=-1,&a;550=-1,&a;558=-1,&a;560=-1,&a;568=-1,&a;570=-1,&a;578=-1</action>
      <action>&a;580=-1,&a;588=-1,&a;590=-1,&a;598=-1,&a;5A0=-1,&a;5A8=-1,&a;5B0=-1,&a;5B8=-1</action>
      <action>&a;5C0=-1,&a;5C8=-1,&a;5D0=-1,&a;5D8=-1,&a;5E0=-1,&a;5E8=-1,&a;5F0=-1,&a;5F8=-1</action>
      <action>&a;600=-1,&a;608=-1,&a;610=-1,&a;618=-1,&a;620=-1,&a;628=-1,&a;630=-1,&a;638=-1</action>
      <action>&a;640=-1,&a;648=-1,&a;650=-1,&a;658=-1,&a;660=-1,&a;668=-1,&a;670=-1,&a;678=-1</action>
      <action>&a;680=-1,&a;688=-1,&a;690=-1,&a;698=-1,&a;6A0=-1,&a;6A8=-1,&a;6B0=-1,&a;6B8=-1</action>
      <action>&a;6C0=-1,&a;6C8=-1,&a;6D0=-1,&a;6D8=-1,&a;6E0=-1,&a;6E8=-1,&a;6F0=-1,&a;6F8=-1</action>
    </script>   
   
  </cheat>
 
</mamecheat>
<!-- Cheat file downloaded from http://www.mamecheat.co.uk, see cheat.txt for list of contributors. -->


If you load in this into MAME you can test it out - check out the output.xml in the cheats directory you will see it has done the find and replaces and outputted the result.

However, I would not recommend this method at all - I just mention it for info. People can find the cheat.xml confusing enough without having to deal with entities - I don't want to scare anybody off.
Pugsy

Servicing your cheating needs since 1985 ;-)

Grab the latest cheat collection:
MAME 0.187 XML cheat collection 7 JULY 2017) from http://www.mamecheat.co.uk or direct from:-
http://www.mediafire.com/file/0dvubha3b ... at0187.zip (ZIP Archive 1826 KB)

User avatar
Pugsy
CheatFinder General
CheatFinder General
Posts: 3128
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Contact:

Re: XML Write Value to Address Range

Postby Pugsy » Wed Oct 01, 2014 11:42 pm

Abystus wrote:Thanks for the comma chaining info as I didn't know you could even do that (will save even more space!) :).


Related to the comma info, you can replace "</action>" with a comma and delete the following "<action>" and repeat as long as you have a leading <action and a closing <\action> you will be good. Though the one thing to bear in mind is there is a limit on the number of chars in the action statement of about 1024 chars - so don't go silly. I'd keep it under 500 chars for safety and readability.
Pugsy

Servicing your cheating needs since 1985 ;-)

Grab the latest cheat collection:
MAME 0.187 XML cheat collection 7 JULY 2017) from http://www.mamecheat.co.uk or direct from:-
http://www.mediafire.com/file/0dvubha3b ... at0187.zip (ZIP Archive 1826 KB)

User avatar
Abystus
CheatFinder Staff Sergeant
CheatFinder Staff Sergeant
Posts: 305
Joined: Sun Jul 23, 2006 6:53 am

Re: XML Write Value to Address Range

Postby Abystus » Thu Oct 02, 2014 12:06 am

Nice to see all this extra hidden stuff I wasn't aware of. I did manage to convert the cheat, and I have to say that limit must be a bit larger than 1024 (if this is including the "maincpu.ow@" part). I verified this (far shorter than the original) working (even the long routines write just fine), but was wondering your thoughts on some of the larger routines, and if you would consider my actions safe on them (their size within the single action). You can view the newly formatted cheat here.
Bored? Watch some of my hacks here. Wanna hack like me? Use Branch Finder. Looking for hidden menus, characters, etc... in your games? Use The Peeper.

User avatar
Pugsy
CheatFinder General
CheatFinder General
Posts: 3128
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Contact:

Re: XML Write Value to Address Range

Postby Pugsy » Thu Oct 02, 2014 12:58 am

It won't parse properly - look at the pretty print output in output.xml. Check cheat\output.xml in notepad++ and you will see some STX char codes after about 1024 chars (excluding linebreaks). If you enable the cheat you will see a load of error messages in the console because of it.

I'd personally try to minimize the number of lines as much as possible without going overboard on the line length at the same time. Also I'd place the comment directly after the </action> statement.

eg

Code: Select all

<!-- Call to Routine 7 -->
      <action>
            maincpu.mw@000338A=0D5F,
            maincpu.mw@000338C=1500,
            maincpu.mw@000338E=FFE0
      </action>


into

Code: Select all

      <action>maincpu.mw@000338A=0D5F, maincpu.mw@000338C=1500, maincpu.mw@000338E=FFE0</action> <!-- Call to Routine 7 -->


and

Code: Select all

      <!-- Routine 13 - Player 1 Character Select Sprite -->     
      <action>
            maincpu.mw@00C0520=0B41,
            maincpu.mw@00C0522=FFFF,
            maincpu.mw@00C0524=C710,
            maincpu.mw@00C0526=05A0,
            maincpu.mw@00C0528=0280,
            maincpu.mw@00C052A=0106,
            maincpu.mw@00C052C=0B40,
            maincpu.mw@00C052E=FFF6,
            maincpu.mw@00C0530=CB01,
            maincpu.mw@00C0532=19C0,
            maincpu.mw@00C0534=0B40,
            maincpu.mw@00C0536=FFF7,
            maincpu.mw@00C0538=CB01,
            maincpu.mw@00C053A=19E0,
            maincpu.mw@00C053C=0B40,
            maincpu.mw@00C053E=FFFB,
            maincpu.mw@00C0540=CB01,
            maincpu.mw@00C0542=1A00,
            maincpu.mw@00C0544=0960,
            maincpu.mw@00C0546=05A0,
            maincpu.mw@00C0548=0280,
            maincpu.mw@00C054A=0106,
            maincpu.mw@00C054C=0960
      </action>


into:


Code: Select all

      <action>maincpu.mw@00C0520=0B41, maincpu.mw@00C0522=FFFF, maincpu.mw@00C0524=C710, maincpu.mw@00C0526=05A0,
              maincpu.mw@00C0528=0280, maincpu.mw@00C052A=0106, maincpu.mw@00C052C=0B40, maincpu.mw@00C052E=FFF6,
              maincpu.mw@00C0530=CB01, maincpu.mw@00C0532=19C0, maincpu.mw@00C0534=0B40, maincpu.mw@00C0536=FFF7,
              maincpu.mw@00C0538=CB01, maincpu.mw@00C053A=19E0, maincpu.mw@00C053C=0B40, maincpu.mw@00C053E=FFFB,
              maincpu.mw@00C0540=CB01, maincpu.mw@00C0542=1A00, maincpu.mw@00C0544=0960, maincpu.mw@00C0546=05A0,
              maincpu.mw@00C0548=0280, maincpu.mw@00C054A=0106, maincpu.mw@00C054C=0960</action> <!-- Routine 13 - Player 1 Character Select Sprite -->


I'd also likely list the Calls together and then the routines - that way you have all the calls in a single block that will relate closely to the "off" script.

Using mq instead of mw would obviously be better but you'd have to handle the endianness which is a bit of a pain as it would no longer relate directly to the values you see in the debugger memory window.
Pugsy

Servicing your cheating needs since 1985 ;-)

Grab the latest cheat collection:
MAME 0.187 XML cheat collection 7 JULY 2017) from http://www.mamecheat.co.uk or direct from:-
http://www.mediafire.com/file/0dvubha3b ... at0187.zip (ZIP Archive 1826 KB)

User avatar
Abystus
CheatFinder Staff Sergeant
CheatFinder Staff Sergeant
Posts: 305
Joined: Sun Jul 23, 2006 6:53 am

Re: XML Write Value to Address Range

Postby Abystus » Thu Oct 02, 2014 4:27 am

I see. Well for now I'll remove the custom routines from the "off" section, and that should make plenty of space. I will reconsider adjusting the writes/formatting if it becomes an issue again (removing the custom routines from that section seems to have opened up a lot of space that I may not even end up using. Thanks for all the advice, testing, and examples (seems I'm always learning new things on this site).
Bored? Watch some of my hacks here. Wanna hack like me? Use Branch Finder. Looking for hidden menus, characters, etc... in your games? Use The Peeper.


Return to “Cheat Engine Help”

Who is online

Users browsing this forum: No registered users and 3 guests