cheat lua plugins

This forum is for making announcements about updated cheat files (for any emulator), updated web pages and of course about improvements to the MAME/MESS cheat engine.
Post Reply
invincibility
Posts: 41
Joined: Fri Dec 28, 2001 1:00 am

Re: cheat lua plugins

Post by invincibility »

Thank for the reply.

I found if a cheat file contain colons after <action>, it will not be displayed in the cheat column of the cheat plugin.

e.g.
<cheat desc="music">
<parameter min="0" max="255" step="1"/>
<script state="run">
<action>maincpu.ppb@818299=param</action>
</script>
</cheat>

That's ok.


<cheat desc="music">
<parameter min="0" max="255" step="1"/>
<script state="run">
<action>:maincpu.ppb@818299=param</action>
</script>
</cheat>

It will generate an error. When switch to cheat column, In the cmd line of mame, it says /plugins/cheat/init.lua:314: attempt to compare two nil values.

With another cheat file it says /plugins/cheat/init.lua:309: attempt to index a nil value (field '?').


The errors disappeared after I search and replace <action>: to <action> in the whole file.
Solstar
Posts: 52
Joined: Thu Aug 09, 2007 6:43 pm

Re: cheat lua plugins

Post by Solstar »

i'm new to this plugin thing...this means that finally the cheat for killer instinct that wanted you to assign a key to do an ultra combo works??

if yes how?like someone else posted above,(i'm using mameui64)if i go to the plugin voice in the tab menu,all i see is "go back to previous menu".i have cheat and cheat_wayder enabled
User avatar
Pugsy
Posts: 3638
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 12 times
Contact:

Re: cheat lua plugins

Post by Pugsy »

It's not yet possible to assign a activation key to cheats with the new plugin cheat engine.

On a related note I've just tried the inf time and inf energy cheats for kinst and they don't work in the "plugin" cheat engine they still work in the builtin cheat engine though.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.259 XML cheat collection (6 OCTOBER 2023) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/q4dHGZ6K#i-EUiqIjH ... KMz7hnbTfw (ZIP Archive 3.76MB)
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Kinst cheats point to logical rather than physical addresses which is a bit annoying. Should be able to have a fix soon though.

Edit: done, let me know if you see any more (or new) issues.

Edit: WRT colons, I'd rather not change that if it's not necessary but I can if it's common. One uncommon construction that would be very hard to convert reliably is the increment/decrement operator in an rvalue or lvalue such as in vii/10in1.xml: "maincpu.pb@04AF9=temp0++". This specific case could be handled but something even slightly more complex would require a much more complete parser.
User avatar
Pugsy
Posts: 3638
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 12 times
Contact:

Re: cheat lua plugins

Post by Pugsy »

crazyc wrote:Kinst cheats point to logical rather than physical addresses which is a bit annoying. Should be able to have a fix soon though.

Edit: done, let me know if you see any more (or new) issues.
That was quick, thanks.
crazyc wrote: Edit: WRT colons, I'd rather not change that if it's not necessary but I can if it's common.
The reason they are there is because someone decided to add them to the "cheatlist filename" command in the debugger so that it saves it to a file. I've always stripped them out as they are completely superfluous as far as cheats are concerned. There are no cheats with preceding colons in any of the cheat xmls here or on wayder's page. The number of people who probably have cheats in that format you could probably count on the fingers of one hand and they will definitely have the skills/knowledge necessary to do a find and replace I'm sure.

crazyc wrote:One uncommon construction that would be very hard to convert reliably is the increment/decrement operator in an rvalue or lvalue such as in vii/10in1.xml: "maincpu.pb@04AF9=temp0++". This specific case could be handled but something even slightly more complex would require a much more complete parser.
Fortunately there are not many cheats that make use of it, I think I'm the only one who has have done it. It's basically just used in that vii game and once in triplep+clones on the arcade side.
Thanks for pointing it out though as I'd commented out all the vii cheats as they had stopped working in the main cheat engine, didn't realise they worked in the new engine (had to fix the ROM cheats but would have to do that for the xml cheat engine anyway). So another +1 for the plugin cheat engine :)
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.259 XML cheat collection (6 OCTOBER 2023) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/q4dHGZ6K#i-EUiqIjH ... KMz7hnbTfw (ZIP Archive 3.76MB)
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Pugsy wrote:Thanks for pointing it out though as I'd commented out all the vii cheats as they had stopped working in the main cheat engine, didn't realise they worked in the new engine (had to fix the ROM cheats but would have to do that for the xml cheat engine anyway). So another +1 for the plugin cheat engine :)
The rom cheats don't work still though. A naive substitution of maincpu to cartslot:rom doesn't work but it ought to be something like that. I also fixed the parse errors so they're more specific and errors will show in the cheat list so you can use -verbose to get the more detailed message.
User avatar
Pugsy
Posts: 3638
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 12 times
Contact:

Re: cheat lua plugins

Post by Pugsy »

crazyc wrote:
Pugsy wrote: The rom cheats don't work still though. A naive substitution of maincpu to cartslot:rom doesn't work but it ought to be something like that. I also fixed the parse errors so they're more specific and errors will show in the cheat list so you can use -verbose to get the more detailed message.
Well that's annoying, I guess the collision detection was just a bit dodgy on the Surface To Air Missiles as I was playing the game in slow motion almost (tracing) and two missiles passed straight through the ship without blowing it up - and I figured that it was working...doh.

I never even knew about the -verbose option... Thanks, nice to see a solid line rather than --- too.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.259 XML cheat collection (6 OCTOBER 2023) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/q4dHGZ6K#i-EUiqIjH ... KMz7hnbTfw (ZIP Archive 3.76MB)
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

The ram cheats working was actually a bug in luaengine. To make them work properly the 8 bit writes need to be 16 bit and the address needs to be divided by 2.

Edit: Rom cheats can work now. The region needs to be ":cartslot:cart:rom" and the multibyte writes need to be byteswapped.
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Here it fixed up, https://gist.github.com/cracyc/388fccf2 ... 88ec0918c1 . The builtin cheat engine chokes on the memory region though, I'm not sure what the correct syntax is for that. BTW, you seemed (my impression, tell me if I'm wrong) to think that the XML cheats made things too complex and drove away newcomers. We could add a third simplified cheat format, maybe based on the cheat.dat but most features removed, for the most basic one line ram only cheats. Thoughts?
User avatar
Pugsy
Posts: 3638
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 12 times
Contact:

Re: cheat lua plugins

Post by Pugsy »

crazyc wrote:Here it fixed up, https://gist.github.com/cracyc/388fccf2 ... 88ec0918c1 . The builtin cheat engine chokes on the memory region though, I'm not sure what the correct syntax is for that. BTW, you seemed (my impression, tell me if I'm wrong) to think that the XML cheats made things too complex and drove away newcomers. We could add a third simplified cheat format, maybe based on the cheat.dat but most features removed, for the most basic one line ram only cheats. Thoughts?
Thanks for that.

It's not just the XML cheat format that scares them away, using the debugger for searching was the major "scary monster". I think a third simpler format could be good if it was a similar to the old cheat.dat way in that you can append all the simple cheats in a single file rather than separate files.

eg

cheat.simple containing any user created/saved cheats or simple cheats posted on the cheat forums

:vii/10in1:20B9:0003:Infinite Lives ( Lightning Plan )
:mslug:106E93:3C:Infinite Time
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.259 XML cheat collection (6 OCTOBER 2023) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/q4dHGZ6K#i-EUiqIjH ... KMz7hnbTfw (ZIP Archive 3.76MB)
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Pugsy wrote: :vii/10in1:20B9:0003:Infinite Lives ( Lightning Plan )
:mslug:106E93:3C:Infinite Time
This should be straightforward except the cpu tag should be included as there are a significant number of drivers with tags other than :maincpu and so the separator can't be a colon. Also the cheatfinder doesn't do address shifts because it would really complicate things so I'm going to match that. Maybe

vii/10in1,:maincpu,4173,03,Infinite Lives ( Lightning Plan )
mslug,:maincpu,106e93,3c,Infinite Time

The limitations would be ram, single byte, program space and run script only.

Edit: adding size (b,w,d,q as the debug expressions) param so:

vii/10in1,:maincpu,4173,w,0003,Infinite Lives ( Lightning Plan )
User avatar
Pugsy
Posts: 3638
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 12 times
Contact:

Re: cheat lua plugins

Post by Pugsy »

Thanks, that works a treat. Only one small thing, if you try to "Write" a cheat for a softwarelist game eg. a2600/asteroid it won't save to cheat.simple if the cheat\a2600 directory doesn't exist even although it should to save to cheat.simple in the cheat dir. Making the a2600 dir in cheat would obviously be the preferred solution in such cases but I know this might not be a good idea...

Also, is it possible to change the the cheat description before selecting "write" as if somebody finds a lot of cheats in one go and saves them with descriptions like "Test cheat at addr 0000028C" it will be confusing. The old cheat.dat engine used to have a list of the common cheat descriptions in use in the cheat file that the user could select and also a way of manually entering the description. I can knock up a list of the most common current cheat descriptions if needed. It would make a shorter list if there were two selections to set the preceding text like ALL="",P1="P1 ", P2 ="P2 ", P3="P3 " etc if needed so that a large list wouldn't be needed like:-

Infinite Credits
Infinite Time
Infinite Lives
Infinite Energy
Infinite Ammo
Infinite Bombs
Invincibility
P1 Infinite Credits
P1 Infinite Time
P1 Infinite Lives
P1 Infinite Energy
P1 Infinite Ammo
P1 Infinite Bombs
P1 Invincibility
P2 Infinite Credits
P2 Infinite Time
P2 Infinite Lives
P2 Infinite Energy
P2 Infinite Ammo
P2 Infinite Bombs
P2 Invincibility
P3 Infinite Credits
P3 Infinite Time
P3 Infinite Lives
P3 Infinite Energy
P3 Infinite Ammo
P3 Infinite Bombs
P3 Invincibility
P4 Infinite Credits
P4 Infinite Time
P4 Infinite Lives
P4 Infinite Energy
P4 Infinite Ammo
P4 Infinite Bombs
P4 Invincibility
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.259 XML cheat collection (6 OCTOBER 2023) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/q4dHGZ6K#i-EUiqIjH ... KMz7hnbTfw (ZIP Archive 3.76MB)
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

A text entry box is not currently doable but I did add a naming feature based on your list. Feel free to suggest more.
User avatar
Pugsy
Posts: 3638
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 12 times
Contact:

Re: cheat lua plugins

Post by Pugsy »

Thanks, works well. I'll have a think about what other cheat names could be added...though I think that will suffice for most things as other types of cheats will generally be one-shot or selection cheats and will need manual editing anyway.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.259 XML cheat collection (6 OCTOBER 2023) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/q4dHGZ6K#i-EUiqIjH ... KMz7hnbTfw (ZIP Archive 3.76MB)
User avatar
Pugsy
Posts: 3638
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 12 times
Contact:

Re: cheat lua plugins

Post by Pugsy »

Just noticed a slight problem with umk3 and the plugin cheat, if you enable some cheats (eg Inf Time) and then start the game it will cause the game to reset. If you enable it during play one of the characters disappears...very odd.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.259 XML cheat collection (6 OCTOBER 2023) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/q4dHGZ6K#i-EUiqIjH ... KMz7hnbTfw (ZIP Archive 3.76MB)
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Copy paste error, fixed now.
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

I've added support for cheat toggle keys. They can be set using the Set Hotkeys option from the plugin-cheat menu. The keys are saved in a json file in the cheat dir. The menu only allows setting a number plus a modifier for the hotkey but any combination can be added to the json file.
User avatar
Pugsy
Posts: 3638
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 12 times
Contact:

Re: cheat lua plugins

Post by Pugsy »

Thanks, that's been on a lot of people's wish list since it went AWOL from the cheat engine a few years back. Works a treat, a lot easier to setup the key now too.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.259 XML cheat collection (6 OCTOBER 2023) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/q4dHGZ6K#i-EUiqIjH ... KMz7hnbTfw (ZIP Archive 3.76MB)
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Added some game genie code support to the simple cheat file format.
User avatar
Pugsy
Posts: 3638
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 12 times
Contact:

Re: cheat lua plugins

Post by Pugsy »

Thanks that'll be ideal for the old schoolers. I converted a lot of the decent/useful NES GG codes to xml format a while back but there are a lot of GG codes out there for the various systems which I doubt we will ever be able to collate otherwise - far too many games and far too little time.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.259 XML cheat collection (6 OCTOBER 2023) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/q4dHGZ6K#i-EUiqIjH ... KMz7hnbTfw (ZIP Archive 3.76MB)
Post Reply