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
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Based on some lists I could easily convert, here's the giant game genie code list, https://gist.github.com/cracyc/8d29ec0a ... 1ac5206d3a. There are probably some errors but they should mostly work. Just put it in your mame cheat dir and enable the lua cheat plugin.
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 made some game genie codes for the NES game Elevator Action, but they all fail to load with "rom cheat compare value not found" . I know the compare value is good...

Code: Select all

nes/elevator,gg,SXOIYNGK,Bullet Invincibility 1/7
nes/elevator,gg,SZNSNOGK,Bullet Invincibility 2/7
nes/elevator,gg,SZVISXGK,Bullet Invincibility 3/7
nes/elevator,gg,SXNSNXGK,Bullet Invincibility 4/7
nes/elevator,gg,SXSSVKGK,Bullet Invincibility 5/7
nes/elevator,gg,SZSSXSGK,Bullet Invincibility 6/7
nes/elevator,gg,SXOTZEGK,Bullet Invincibility 7/7
nes/elevator,gg,AAKIUILA,Don't Fall down elevator shafts
which equate to these XML cheats (I've simplified the == expression to just use the part 1 expression)

Code: Select all

  <cheat desc="Invincibility">
    <script state="run">
      <action condition="(maincpu.rb@D797==4C)">
        maincpu.rb@D797=AD,
        maincpu.rb@D97F=AD,
        maincpu.rb@DA65=AD,
        maincpu.rb@DAFF=AD,
        maincpu.rb@DCDE=AD,
        maincpu.rb@DD5A=AD,
        maincpu.rb@E092=AD
      </action>
    </script>
    <script state="off">
      <action condition="(maincpu.rb@D797==AD)">
        maincpu.rb@D797=4C,
        maincpu.rb@D97F=4C,
        maincpu.rb@DA65=4C,
        maincpu.rb@DAFF=4C,
        maincpu.rb@DCDE=4C,
        maincpu.rb@DD5A=4C,
        maincpu.rb@E092=4C
      </action>
    </script>
  </cheat>

  <cheat desc="Don't Fall down elevator shafts">
    <script state="run">
      <action condition="(maincpu.rb@DD43==03)">maincpu.rb@DD43=00</action>
    </script>
    <script state="off">
      <action condition="(maincpu.rb@DD43==00)">maincpu.rb@DD43=03</action>
    </script>
  </cheat>
Some of the other GG codes for elevator action in the cheat.simple file also fail.
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 »

Made a one bit error, fixed now. Also added the ability to link cheats by replacing the description with a ^.
TheCimmerian
Posts: 2
Joined: Sat Jul 08, 2017 8:57 am

Re: cheat lua plugins

Post by TheCimmerian »

crazyc wrote: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.
Hi there. Newbie here.

I am using MameUI 64 0.187 and I don't see where to set the keys in the cheat menu option (when you pres TAB while the game is running) and the plugin options menu is empty.
You can only press the "set" option as always in the cheat menu, but there is no option to assign a key like in the controls menu.

What am I missing?
Do you have to use the plugin options menu; and if so? Why is it empty for me?

Any help would be greatly appreciated.
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 looked at MAMEUI (I use standard MAME commandline here). I can spot the problem, if you run "mameui64.exe -cc" from the commandline it will create the plugin.ini file in the same directory but it only looks for it in the ini dir. You can create the ini file manually, just make a plugin.ini file in the ini folder (eg. C:\MAMEUI64\ini\plugin.ini ) and put this text in it:-

Code: Select all

#
# PLUGINS OPTIONS
#
cheat                     1
cheatfind                 1
console                   0
data                      1
dummy                     0
hiscore                   0
layout                    0
timer                     0
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)
TheCimmerian
Posts: 2
Joined: Sat Jul 08, 2017 8:57 am

Re: cheat lua plugins

Post by TheCimmerian »

[quote="Pugsy"]Just looked at MAMEUI (I use standard MAME commandline here). I can spot the problem, if you run "mameui64.exe -cc" from the commandline it will create the plugin.ini file in the same directory but it only looks for it in the ini dir. You can create the ini file manually, just make a plugin.ini file in the ini folder (eg. C:\MAMEUI64\ini\plugin.ini ) and put this text in it:-

[code]#
# PLUGINS OPTIONS
#
cheat 1
cheatfind 1
console 0
data 1
dummy 0
hiscore 0
layout 0
timer 0[/code][/quote]

That did the trick.
Thank you very much!
I can't believe that after so many years using MAME, I can now set the hotkeys for the cheats... It's like a dream come true.
P.S. sorry for the double post, I'm not a spammer or anything, I just wasn't sure where tu post.
TheCimmerian
Posts: 2
Joined: Sat Jul 08, 2017 8:57 am

Re: cheat lua plugins

Post by TheCimmerian »

The new cheat plugin is great, but is missing the ability to set the hotkeys to the controller buttons or stick.
I hope that in the future MAME would let you assign any button, just like when you are setting the controller for the games.
This is specially needed in games like Killer Instinct where an automatic combo breaker could be asigned to R3 for example, because you need it in the moment, no time to change to the keyboard to perform the two button combination.
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

You can set it to a stick by editing the hotkey json file directly. JOYCODE_1_BUTTON1 is the first stick first button, I'll think about how to work that into the UI but it'll currently not be possible to set a key or button by pressing it like the input config.
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Added to the ui joystick hotkey binding.
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Now you can set hotkeys similarly to how the input menu works. It doesn't let you set multiple mappings for one cheat (which wouldn't make much sense IMO) [strike]and doesn't currently give feedback when polling except the game freezes for a second[/strike]. Added a popmessage when to press the hotkey to set.
TheCimmerian
Posts: 2
Joined: Sat Jul 08, 2017 8:57 am

Re: cheat lua plugins

Post by TheCimmerian »

[quote="crazyc"]Now you can set hotkeys similarly to how the input menu works. It doesn't let you set multiple mappings for one cheat (which wouldn't make much sense IMO) [strike]and doesn't currently give feedback when polling except the game freezes for a second[/strike]. Added a popmessage when to press the hotkey to set.[/quote]
WOW That was crazy fast. I thought It won't be available that soon.
Where can I download the new cheat.zip with this upgrade?
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

There are changes to cheat/init.lua and luaengine.cpp so unless you can build mame yourself or get a recent build from someone you'll have to wait until the next release.
TheCimmerian
Posts: 2
Joined: Sat Jul 08, 2017 8:57 am

Re: cheat lua plugins

Post by TheCimmerian »

[quote="crazyc"]There are changes to cheat/init.lua and luaengine.cpp so unless you can build mame yourself or get a recent build from someone you'll have to wait until the next release.[/quote]
Ok gotcha.
Thanks.
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Added very untested break/watchpoint support (in head right now but won't be part of .188 but .189 instead). If anyone actually uses it, be sure to let me know about problems.
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:Added very untested break/watchpoint support (in head right now but won't be part of .188 but .189 instead). If anyone actually uses it, be sure to let me know about problems.

What sort of wp/bp support? Currently the cheat engine is based on the fact that it pokes every frame, if there was a way of poking RAM and diverting the PC address on an instruction basis it would certainly make various cheats a lot easier to implement - definitely a nice capability to have...

Eg instead of changing

1234 BEQ 1280
to
1234 BRA 1280

you go do something like
bp 1234,1,{pc=1280;g}

or
wp deadbeef,1,w,(A==90||A=00)&&pc=1234,{pc=1280;g}


Have you got any examples...
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 »

You want to be able to access registers too? That's doable, I'll get to it when I have a chance. Edit: added as cpu.regs[reg].value

Anyway, bp 1234,1,{pc=1280;g} would be like

cpu:bpset(0x1234, function() --[[do something here]] end)

and wp deadbeef,1,w,(A==90||A=00)&&pc=1234,{pc=1280;g} would be like

cpu:wpset(cpu_program_space, "w", 0xdeadbeef, 1, function() --[[do something here]] end)

The conditional and action would be part of the function parameter.
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Added input sequence cheats that sequenced button presses. Limitations, only works from a key binding (not from menu), any button presses will work as normal so may interfere with the sequence and analog inputs can only be full off or on. Here's an example that does a Hadouken to the right in sf2. Start and stop are the frames after the start that the press should begin and end at.

[{
"desc":"P1 Ryu Hadouken Right",
"comment":"This cheat only works when bound to a key, not from the menu",
"script":{"on":"if not xlate then\n xlate = input_trans( {\n { port = \"IN1\", field = \"P1 Down\", start = 0, stop = 2 },\n { port = \"IN1\", field = \"P1 Right\", start = 1, stop = 3 },\n { port = \"IN1\", field = \"P1 Jab Punch\", start = 3, stop = 5 }})\nend\ninput_run(xlate)\n"}
}]
DjDiabolik
Posts: 4
Joined: Sun Oct 15, 2017 6:18 pm

Re: cheat lua plugins

Post by DjDiabolik »

Hi boys... i have a setup whit mameui64 latest 0.190.... usually i like to find search manually and i can use the internal debug but today i know i can use this fantastic plugins... very great.... but i can't understand.. how it's works ?

I have read some old reply...... i have created a new plugin.ini inside "Ini" folder and now i can see the plugins loaded.... i have tryed whit one example game:
tumblep (it's an example)....

I have activated the cheat from game option and execute it.... from TAB i can see the Cheat and both plugins.
I have start a game.. pause and make a new start. I have lose a life.... and now ?? How it's works the next search ?

How i can know if my init.lua it's the latest ? I have tryed to read the Help inside mameui but i click on "Contets" inside "Help" tab and nothigs appends....... someone can help me ?


*EDIT*
I have tryed one/two times.... i have make a new search.... try to compare and obtain two value:
When i select "TEST" "WRITE" or "WATCH" how i need to do... if i click enter i obtain an errors says "[LUA ERROR] in menu call back etc etc init.lua 683 etc etc keyname of not exist".
How i need to do ? Every new value i need to save the ? And every next compare how i need to set on "Left Operand" ? The Default it's "Current".... how i can read a usefull documentation how it's works this newest cheatfind plugins ? I can use instead internal debuggers ?
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

When you start a new search, the contents of the selected cpu ram or ram region are saved. Then you can compare the current or a selected past save (use save current to store another ram state) use the operators. The left and right operand numbers are a list of the states that have been saved and the operator is less then, greater than and so on (like state current < state 1 would show all the ram addresses where the current ram value is less than state 1 ram value). You can compare ram contents to a constant value (ltv,gtv, etc.) like say you know you have 2 lives left then compare current to value 2 with the equal to value operator (eqv) then all the possible addresses where lives might be stored (of course this won't always work but will most of the time) will be listed. If there are too many possibilities then you can lose a life then compare again with value 1. This will take the last list of addresses and show which of those are now 1 which should narrow the possibilities down significantly. If something goes wrong you can use undo last to cancel the last search and revert to the state before it and start new search will clear everything. Test will insert a cheat into the lua cheat engine which will set that address to the last value, write will write that cheat to disk and watch will display the contents of that address on the screen so you can monitor the value (they seem to be bugged in .190 though, I'll have to check that).
DjDiabolik
Posts: 4
Joined: Sun Oct 15, 2017 6:18 pm

Re: cheat lua plugins

Post by DjDiabolik »

[quote="crazyc"]CUT CUT ^^ Related to last reply... BBCODE It's OFF ?? Because ?[/quote]
mmmmmm... i thinks need to make an example:
Using mameui64 0.190... i start game i have two live.
Put in pause... Open TAB.... Open CheatFind and make new search.
Leave Pause and Lost a live... put in pause again right ?
At this time, like i ever do using the debugger whit "cn de" or "cn in" etc etc, i need to make the compare from start search right ? Whit game in pause i re-open the TAB menu and configure all to:
-Left Operatand "Current" -Operator "Lt" (left left than right, value it's different) -Right operand 1 (if it's correct this is the first search... it's the value use by compare right ?) -Value "Any"
On Bottom i don't have touch anythigs.... if i understand it's for advanced search.... for now leave untoched........
At this time... i lost a life and make a compare whit this settings........... and i obtain some result... it's the value change in RAM (like append when use debuggers).....

Suppose we obtain only a result............ on result i can select... i have pick a screenshot:
https://i.imgur.com/Ugzaahh.png

On result i can select "Test" "Write" or "Watch"..... how i need to do now ? If i select for example "TEST" and press ok i obtain this error:
https://i.imgur.com/kt67Wkw.png

I can't do anythigs.... it's a BUG in current supports ?
Or wait... for mamedev gitgub i need to download all files from "cheat" and "cheatfind" or i can pick only the .lua files ?

*EDIT*
I don't know but BBCODE it's off........ i can only post image right this.......
Post Reply