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
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:

cheat lua plugins

Post by Pugsy »

Just a quickie...

If you compile your own MAME on a regular basis you might have noticed there's now an alternative way of enabling and finding cheats thanks to crazyc...using a lua replacement for the cheat menus and a new cheat finder tool which is similar to the old cheat finder tool. Thankfully the cheat xml format is unaffected :)

To try it out, compile the latest MAME from git and make sure you set plugin.ini file:-

cheat 1
cheatfind 1

Then just skip the existing CHEAT option and go to the PLUGINS option on the menu to see the new menus, you should notice few differences when compared to the old menus for enabling cheats but for finding cheats you can now do it without having to use the debugger. This is still a WIP so if you spot any issues/suggestions please post them in this thread....


NOTE: plugin.ini should normally exist in the ini folder if you haven't changed the default address with the mame.ini 'inipath' variable.
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)
invincibility
Posts: 41
Joined: Fri Dec 28, 2001 1:00 am

Re: cheat lua plugins

Post by invincibility »

nice plugin!

but I need a manual... I can't understand it at all. What's bcd? How to compare?
rsarson
Posts: 0
Joined: Thu Apr 28, 2016 2:57 pm

Re: cheat lua plugins

Post by rsarson »

hi!

i can't seem to get this working. i'm using mame v0.173. i admit i'm a bit of a newbie here - i don't even know what a "cheat finder helper library" is... google brought me here when i looked for documentation.

does the cheat option in mame.ini still need to be set? does the cheat.7z still need to be present? i've tried with & without these and it doesn't work.

setting "cheat plugin" and "cheat finder helper library" to "on" in the plugins menu in the mame ui works, but after exiting mame and reloading, they are reset back to "off" (looking at plugin.ini, i see all 0 zeroes).

in a game (mspacman), there is a "plugin options", but selecting it gives an empty list, with only the "return to previous menu" option. the cheat menu (if cheat in mame.ini is on) still works as expected.

i've also noticed changing the pluginspath in mame.ini breaks things (ie, [LUA ERROR] ...boot.lua:7: module 'json' not found:, even though the files are in the directory i'm pointing to). (another frustrating aspect of mame is trying to set it up to run properly from any directory in linux, but that's another topic.)

please let me know what i'm missing
thanks,
ryan
User avatar
wayder
Posts: 15
Joined: Thu Jan 03, 2002 1:00 am
Location: Japan
Contact:

Re: cheat lua plugins

Post by wayder »

When more than one cheatpass are used (cheatpath cheat;cheat_wayder etc.),
cheat data isn't displayed by the cheat menu.
(use 4/29 ver.(git))

error log(run):
init.lua:480: attempt to index a nil value (local 'file')

error log(use cheat menu):
init.lua:309: attempt to index a nil value (field '?')
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

wayder wrote:error log(run):
init.lua:480: attempt to index a nil value (local 'file')

error log(use cheat menu):
init.lua:309: attempt to index a nil value (field '?')
Fixed this, you don't need to recompile you only have to get the plugin/cheat/init.lua file.
rsarson wrote:google brought me here when i looked for documentation.
This is pretty new so the documentation is a W(not quite yet)IP.
rsarson wrote:does the cheat option in mame.ini still need to be set? does the cheat.7z still need to be present?
No except you need the plugin enabled in the ini or the ui and yes you need the cheat.7z.
rsarson wrote:in a game (mspacman), there is a "plugin options", but selecting it gives an empty list, with only the "return to previous menu" option. the cheat menu (if cheat in mame.ini is on) still works as expected.
There'll be nothing in plugin options if there is no plugin that has a menu enabled. You can also use "-plugin cheat" on the command line to enable it.
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:Fixed this, you don't need to recompile you only have to get the plugin/cheat/init.lua file.
Thanks, for those and the earlier quick fixes. Sorry I'd not responded to the last email (all sounds ok to me)...RL stuff so only just done a 0.173 build.
wayder wrote:When more than one cheatpass are used (cheatpath cheat;cheat_wayder etc.),
cheat data isn't displayed by the cheat menu.
I know this was working before, but wayder is correct its broken now.

with

cheatpath cheat;cheat_wayder

if you run mame 19xx the plugin will display no cheats.
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)
rsarson
Posts: 0
Joined: Thu Apr 28, 2016 2:57 pm

Re: cheat lua plugins

Post by rsarson »

crazyc,

thanks for the reply! with a little trial and error, i was able to get it working :)

ryan
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 »

invincibility wrote:nice plugin!

but I need a manual... I can't understand it at all. What's bcd? How to compare?
It's not actually that difficult to use, I've knocked up a quick simple example...but remember that the cheat plugin is still in development so this is just an example using the current cheat finder script and may well change:-

Use the game "targ"

Start the game and pause it

Go to the the Cheat Finder plugin:

Select "Start new search"

unpause the game and lose a life, then pause the game again

Select "Save current #2"

Select "Left operand 2"
Select "Operator lt"
Select "Right operand 1"
Select "Value 1"
Hit Return on "Compare"
- Basically you are saying search for memory addresses where the current memory snapshot (2) is less than the first memory snapshot (1) by 1 (value 1)

on the Bottom of the screen you will notice "Match Block 1", if you press left and right on that you will notice that it cycles through some possibilities under each "Block"

By default it will have "Test" next to each one, just press Return on each and it will add that cheat to the plugins cheat selection menu

You can then just enable that cheat to see if you have found the lives location by enabling the cheats one by one and losing a life and seeing if the number of lives decreases.


BCD is Binary Coded Decimal, simple example from a cheating perspective:- if you have a TIMER that starts at "99" this can be represented by 0x63 (99 decimal, 63 hex) or it can be represented in BCD as 0x99 (99 hex, 153 decimal). BCD is actually really common for things like time and scores.
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 those and the earlier quick fixes. Sorry I'd not responded to the last email (all sounds ok to me)...RL stuff so only just done a 0.173 build.
Cool, should only take a few minutes to do those changes.
Pugsy wrote: I know this was working before, but wayder is correct its broken now.

with

cheatpath cheat;cheat_wayder

if you run mame 19xx the plugin will display no cheats.
It works for me now. Did you get the latest version? BTW, I've got a cheat for a board (Dungeons and Dragons Computer Labyrinth Game) game that doesn't fit in any of your forums and only works with the development tree. Should I post it here and if so should I wait until next release?
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:Cool, should only take a few minutes to do those changes.
Thanks, looking good. Being able to search by value will save a few iterations of cheat searching.

Couple of suggestions
1. If possible can you make it so that when you do a SAVE CURRENT it will update the Left Operand so if Left Operand was previously = Current it will stay as "Current"
2. In a similar manner if the Right Operand was previously "Current - 1" when you hit SAVE CURRENT can you make it so that it autopopulates with "Current - 1"
3. Can COMPARE and SAVE CURRENT be moved in the same text block as the comparison operations (will save some arrow presses)
4. Is it possible to do a pop-up when COMPARE is executed that will have text similar to "1789 Possibilities" so that you instantly know if you are ready to test some cheat possibilities.
5. Is it possible to change "Blocks match" selection at the bottom to just automatically show all possibilities or a larger number of possibilities?

crazyc wrote: It works for me now. Did you get the latest version?
Yes and thanks, it works now.
crazyc wrote:BTW, I've got a cheat for a board (Dungeons and Dragons Computer Labyrinth Game) game that doesn't fit in any of your forums and only works with the development tree. Should I post it here and if so should I wait until next release?
Ah, I see the problem it's neither an arcade game or a softwarelist game......I've changed the description for the softwarelist forum to cover any non-arcade game. It doesn't matter if the game is in MAME yet or will be added later...the earlier the better:)
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)
pmc
Posts: 4
Joined: Tue Oct 25, 2005 8:49 pm

Re: cheat lua plugins

Post by pmc »

when I run mame in command line, after leaving the game it tells me this message:

X:\Mame/plugins/cheat/init.lua:479: attempt to index a nil value (local 'file')

if
plugin.ini
#
# PLUGINS OPTIONS
#
cheat 1

is actived (and also actived in mame.ini).

Does he need to disable the option in one of the two files?
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 »

pmc wrote:Does he need to disable the option in one of the two files?
I can't replicate that problem - I have no problems enabling cheats in the either cheat menu system. Bear in mind this is WIP, are you using the latest version from git?
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
wayder
Posts: 15
Joined: Thu Jan 03, 2002 1:00 am
Location: Japan
Contact:

Re: cheat lua plugins

Post by wayder »

crazyc,
> Fixed this, you don't need to recompile you only have to get the
> plugin/cheat/init.lua file.

I'm thankful for plugin fixed.
All data was displayed right.
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

Pugsy wrote:1. If possible can you make it so that when you do a SAVE CURRENT it will update the Left Operand so if Left Operand was previously = Current it will stay as "Current"
2. In a similar manner if the Right Operand was previously "Current - 1" when you hit SAVE CURRENT can you make it so that it autopopulates with "Current - 1"
3. Can COMPARE and SAVE CURRENT be moved in the same text block as the comparison operations (will save some arrow presses)
They are, aren't they? If not I must be missing what you mean.
Pugsy wrote:4. Is it possible to do a pop-up when COMPARE is executed that will have text similar to "1789 Possibilities" so that you instantly know if you are ready to test some cheat possibilities.
5. Is it possible to change "Blocks match" selection at the bottom to just automatically show all possibilities or a larger number of possibilities?
It shows 50 currently. I'm not sure what the reasonable limit is and I can't currently do submenus so maybe a "Show next" option at the bottom?
pmc wrote:when I run mame in command line, after leaving the game it tells me this message:

X:\Mame/plugins/cheat/init.lua:479: attempt to index a nil value (local 'file')
Like Pugsy says, just replace the plugin/cheat/init.lua file with https://github.com/mamedev/mame/blob/ma ... t/init.lua
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:1. If possible can you make it so that when you do a SAVE CURRENT it will update the Left Operand so if Left Operand was previously = Current it will stay as "Current"
2. In a similar manner if the Right Operand was previously "Current - 1" when you hit SAVE CURRENT can you make it so that it autopopulates with "Current - 1"
3. Can COMPARE and SAVE CURRENT be moved in the same text block as the comparison operations (will save some arrow presses)
They are, aren't they? If not I must be missing what you mean.
This is what I mean (and currently see):-

Image




crazyc wrote:
Pugsy wrote:4. Is it possible to do a pop-up when COMPARE is executed that will have text similar to "1789 Possibilities" so that you instantly know if you are ready to test some cheat possibilities.
5. Is it possible to change "Blocks match" selection at the bottom to just automatically show all possibilities or a larger number of possibilities?
It shows 50 currently. I'm not sure what the reasonable limit is and I can't currently do submenus so maybe a "Show next" option at the bottom?
I think a Show next option would be better than having "Blocks match" as I've done some searches and there was nothing showing under Blocks match 1 but there where under Block match 2, which may confuse people enough just to give up. I think showing 100 results per page would more than suffice. 50 would probably be fine at a pinch.
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:This is what I mean (and currently see):-

Image
Okay, now it looks like that.
Pugsy wrote:I think a Show next option would be better than having "Blocks match" as I've done some searches and there was nothing showing under Blocks match 1 but there where under Block match 2, which may confuse people enough just to give up. I think showing 100 results per page would more than suffice. 50 would probably be fine at a pinch.
Oh, you want to show the matches from all the regions right? Now it defaults to "All" which does that. A specific region can still be chosen too.
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, looking good and yes show matches from all regions is ideal. A "show next" way of paging through all the results could be handy.


EDIT: Just noticed something has gone slightly skew whiff with LT/GT. If you do a search for the time address in mslug (106E93) by
doing Current LT Previous by 1 every time it reduces it won't find the address

It will find the address as the time decreases by one if you do a Current GT Previous by 1 which is the wrong way.
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 »

Okay, fixed the first, did a large refactor then added the second. The refactor will make further changes much easier, let me know if I broke anything in the process.
invincibility
Posts: 41
Joined: Fri Dec 28, 2001 1:00 am

Re: cheat lua plugins

Post by invincibility »

Very thanks and report a bug, I use mame 0.174 with cheat lua plugins, try to search some cheats with game kov2, but when I press the test botton, the address don't show in the cheat column. I think it's a bug?

And a little request, may the cheat lua plugins add an option to search the d00000-d0ffff address range of game kov2? This game use the address range to store some useful infomations, e.g. hp and invincibility of players and enemies, etc.
crazyc
Posts: 31
Joined: Sat Apr 30, 2016 4:49 pm

Re: cheat lua plugins

Post by crazyc »

It won't show in the builtin cheat engine only in the cheat plugin (and it does work, just tested it).

I added the ability to search shared ram regions of which that range is one (https://github.com/mamedev/mame/blob/59 ... 2.cpp#L110). It'll be called ":arm7_shareram". Note you can't currently use it directly with the cheat engine as the addresses are different, you'd have to add 0xd0000 if applied on the 68000 or 0x48000000 with the arm.
Post Reply