Customized cheat.c

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.
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

OK, I have finished checking for 3rd update.
http://zetubou.mine.nu/timer/file/bomber31853_d5.zip
stephh
Posts: 601
Joined: Fri Aug 17, 2001 1:00 am
Location: Paris, France

Post by stephh »

ShimaPong wrote:OK, I have finished checking for 3rd update.
http://zetubou.mine.nu/timer/file/bomber31853_d5.zip
I've got the file and the password, thanks :) Here are now my comments ...

First, I'm not sure that cheat.txt will be added to official documentation files ... IMO, it should be best distributed with Pugsy's cheat.dat file ... What do you think about that ?

Second, I read that in your cheatnew.txt file :
* code loading:
- Ignored to load old format code by default. If you need to
load, choose "Load Old Format" item in Options menu.
But in the future, it should be merged into new format.
How does it work ? Which bit of the option field is it ? I have serious doubt with this code :

Code: Select all

				/* ----- convert the old code to the new format ----- */
				if(TEST_FIELD(cheatOptions, LoadOldFormat))
					//type = ConvertOldCode(oldCode, oldCPU, &data, &extendData);
					continue;
BTW, in cheat.txt, the comments seem wrong :
Cheat Engine Commands:

These special cheat lines are used to set global preferences for the cheat engine. They follow this format:

:_command:[ data ]

The lower byte of the data field stores the command, and the remaining bytes store data for the command. Here is a list of the commands:

0x00 disable help boxes (once I add them)
0x01 use old-style cheat search box (now redundant)
0x02 use new-style cheat search box
0x03 don't print labels in new-style search menu
0x04 auto-save cheats on exit

So, if you wanted to use the old-style cheat box, you would add this line to your cheat.dat:

:_command:00000001
Last thing : please NEVER remove the possibility to still use the old format as I REALLY need it !

Image Steph from The Ultimate Patchers Image
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

Stephh wrote:I'm not sure that cheat.txt will be added to official documentation files ... IMO, it should be best distributed with Pugsy's cheat.dat file ... What do you think about that ?
As you choose. If I can divide source file, I don't hope others.
Stephh wrote:How does it work ? Which bit of the option field is it ? I have serious doubt with this code
Sorry, the dust has remained. It's hard for me to figure out many modification completely in "BIG" file.
Remove "//" to work old format loading. Other fix will be unneeded.
Stephh wrote:BTW, in cheat.txt, the comments seem wrong
Yes, I don't fix divided information right now.
Rewriting cheat.txt is harder than customizing cheat.c.
Because I'm Japanese and English is not first language.
Stephh wrote:Last thing : please NEVER remove the possibility to still use the old format as I REALLY need it !
Please give me an idea to manage current "BIG" cheat source file !
stephh
Posts: 601
Joined: Fri Aug 17, 2001 1:00 am
Location: Paris, France

Post by stephh »

ShimaPong wrote:
Stephh wrote:How does it work ? Which bit of the option field is it ? I have serious doubt with this code
Sorry, the dust has remained. It's hard for me to figure out many modification completely in "BIG" file.
Remove "//" to work old format loading. Other fix will be unneeded.
Now that MAME 0.111 is out, could you please send me an update cheat.c file that fixes the bug and which is up-to-date ? IMO, it hasn't changed, so you shall only need to fix what's wrong ... And if you've made some new changes, don't forget to include an updated cheatnew.txt file ... TIA ...

As for cheat.txt, the file will be distributed by Pugsy, so send a PM with a copy of it to him ...
Stephh wrote:Last thing : please NEVER remove the possibility to still use the old format as I REALLY need it !
Please give me an idea to manage current "BIG" cheat source file !
I know the file is big, but cheats are only tolerated (because some of them - even if we spend time in checking them - are still buggy and cause bugs that shall not be reported on MAME Testers board) ... So, I'm not sure that some Devs would be happy to split cheat.c in multiple files ...

Anyway, how many parts do you need ? Here is what I think about :

. cheat.c : primary functions used by multiple modules (such as DecimalTOBCD, BCDToDecimal, Do*Edit*, *KeyPressed)
. cheatdef.c : definitions (enums, structs, global static vars/consts)
. cheatdo.c : activate cheat stuff
. cheatdsk.c : load/save/edit stuff (includes the ConvertOldCode function)
. cheatsch.c : search stuff
. cheatwtc.c : watches stuff
. cheatmsc.c : other stuff (to be determinated)

Any comments are welcome about this, so I can try to speak about it to MAME Team ...

Image Steph from The Ultimate Patchers Image
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

I have confirmed that Program Space accesor works fine in afighter and regulus.

But also I have found the problems...
  • Can't access in finalizr, roadf.
  • Restore Previous Value doesn't work or even causes the game crash in rachero, goldnaxj.
It's too hard...

And added new functions/operations.
http://zetubou.mine.nu/timer/file/bomber32242_d5.png
  • Added 3rd search menu, called "Minimum Search Mode".
  • Added new operation, called "Write if Match".
could you please send me an update cheat.c file that fixes the bug and which is up-to-date ?
After arrangements are finalized.

But I don't use and understand old format so that if the cheat engine has a trouble, I may be unable to resolve an issue.
As for cheat.txt, the file will be distributed by Pugsy
Current database has the same material as cheat.txt. I think divide it from the database too because also the database is big.
Anyway, how many parts do you need ?
Main problem is that I don't know how to divide source file because it needs to fix other files which is not associated with cheat core directly.
So I hope you to do if you will.
stephh
Posts: 601
Joined: Fri Aug 17, 2001 1:00 am
Location: Paris, France

Post by stephh »

ShimaPong wrote:
could you please send me an update cheat.c file that fixes the bug and which is up-to-date ?
After arrangements are finalized.
OK, I will wait ... I'm going on holidays in about 10 days, so I'd be very happy if you could send me something before (remember that I need to make some preliminary tests before I submit the file(s) to MAME Team) ...
But I don't use and understand old format so that if the cheat engine has a trouble, I may be unable to resolve an issue.
Don't remove the ConvertOldCode function, tell me the way you want to use it (use an option or try old format if cheat line doesn't match the new one), and I'll fix that if you have troubles with it ...
As for cheat.txt, the file will be distributed by Pugsy
Current database has the same material as cheat.txt. I think divide it from the database too because also the database is big.
IIRC, most of the blahblah at the begining of Pugsy's cheat.dat file is a copy of what is at the begining of cheat.c ... So if you have sort of "header" named cheat.txt, I think you could remove the text in it from both cheat.dat and cheat.c (wait for Pugsy's confirm though) ...
Anyway, how many parts do you need ?
Main problem is that I don't know how to divide source file because it needs to fix other files which is not associated with cheat core directly.
So I hope you to do if you will.
I agree that cheat.c as dependencies, but not that much ... I'll try to compile a version without the cheat engine and see which files need to be changed ... Then I'll post a list here as fast as possible, and we'll see what needs to be done when I come back in mid-January ...

Image Steph from The Ultimate Patchers Image
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

Now stop updating and checking the cheat engine due to ReyVGM.

But I have succeeded to access program code via the cheat engine in finalizr and roadf.
stephh
Posts: 601
Joined: Fri Aug 17, 2001 1:00 am
Location: Paris, France

Post by stephh »

ShimaPong wrote:Now stop updating and checking the cheat engine ...
PLEASE send me what you have then, so I can have a look before I go on holidays ...

Image Steph from The Ultimate Patchers Image
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

Stephh wrote:so I can have a look before I go on holidays ...
Sorry... I make an effort before you go on holidays though I don't know when you go.
stephh
Posts: 601
Joined: Fri Aug 17, 2001 1:00 am
Location: Paris, France

Post by stephh »

ShimaPong wrote:
Stephh wrote:so I can have a look before I go on holidays ...
Sorry... I make an effort before you go on holidays though I don't know when you go.
I leave on next Thursday (21st of December) ...

Image Steph from The Ultimate Patchers Image
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

3rd Update Plus.
http://zetubou.mine.nu/timer/file/bomber32453_d5.zip

I have already updated the cheat engine for HazeMD too but the above archive doesn't include.
stephh
Posts: 601
Joined: Fri Aug 17, 2001 1:00 am
Location: Paris, France

Post by stephh »

I've only had a quick look at your changes and there seems to be a little error with the LoadOldFormat and Debug options in SelectOptions function :

Code: Select all

			case kMenu_LoadOldFormat:
				if(TEST_FIELD(cheatOptions, Debug))
					TOGGLE_MASK_FIELD(cheatOptions, LoadOldFormat);
				break;
The TEST_FIELD "macro" for LoadOldFormat option is related to Debug, and there is nothing to change the Debug option ... This bug is there twice, with both IPT_UI_RIGHT and IPT_UI_LEFT statements ...

Here is IMO what you sould have :

Code: Select all

			case kMenu_LoadOldFormat:
				if(TEST_FIELD(cheatOptions, LoadOldFormat))
					TOGGLE_MASK_FIELD(cheatOptions, LoadOldFormat);
				break;
			case kMenu_Debug:
				if(TEST_FIELD(cheatOptions, Debug))
					TOGGLE_MASK_FIELD(cheatOptions, Debug);
				break;
If you agree with this, I change the cheat.c file, then I submit it to MAME Team ...

Thanks a lot for your hard work on this file which is, I admit, big to maintain ...

Image Steph from The Ultimate Patchers Image
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

Stephh wrote:If you agree with this, I change the cheat.c file, then I submit it to MAME Team
Sorry, it's not bug. I have forgotten to explain it.
Debug option is for cheat engine developer so that I intend to forbid changing by end-user easily.
Developer needs to edit command code directly on the text editor and can confirm debug ON/OFF on the Options menu.
I made that point before, and I can't manage old format so that "Load Old Format" is one of Debug items.
But if you feel troublesome, fix with your idea and send.
stephh
Posts: 601
Joined: Fri Aug 17, 2001 1:00 am
Location: Paris, France

Post by stephh »

ShimaPong wrote:Sorry, it's not bug. I have forgotten to explain it.
Debug option is for cheat engine developer so that I intend to forbid changing by end-user easily.
Developer needs to edit command code directly on the text editor and can confirm debug ON/OFF on the Options menu.
I made that point before, and I can't manage old format so that "Load Old Format" is one of Debug items.
But if you feel troublesome, fix with your idea and send.
I understand your point of view, but I don't have time at the moment to allow such thing, so I submitted your file with these changes :

Code: Select all

			case kMenu_LoadOldFormat:
					TOGGLE_MASK_FIELD(cheatOptions, LoadOldFormat);
				break;
			case kMenu_Debug:
					TOGGLE_MASK_FIELD(cheatOptions, Debug);
				break;
I hope that this won't cause troubles for you (you don't use MY cheat databases, do you ?)

I've also asked to the Team about the multiple source files and the "externalisation" of the cheat engine with "CHEAT = " line in the makefile ... We'll see if there is some feedback when I'm back from holidays ...


Now, I've noticed a trick which was needed in very old versions of MAME for games with a TMS34010 or a TMS34020, but which is IMO a complete non-sense now with the memory mapping rewrite : in function BuildCPUInfoList (last function of cheat.c), we use info->addressShift = 3 and this causes problems (see the memory ranges and the results) ... I know this would cause many cheats to be redone, but I think this must be done to be "accurate" ... Any comments are welcome ...

Image Steph from The Ultimate Patchers Image
stephh
Posts: 601
Joined: Fri Aug 17, 2001 1:00 am
Location: Paris, France

Post by stephh »

Shimapong, I don't know exactly what you changed, but there are now MANY bugs in the cheat engine :(

The most important thing is that the (classic ?) search function seems to be broken somewhere : I can't even not find lives for a game such as 'bonzeadv' as the result is always 0 when I "continue" search ! Isn't there a problem with the "backup" data ?

The "load old format" option doesn't seem to work correctly as the old cheats now seem to be always loaded ... It's a good news that old format is still supported, but the option should do something ...

Now that the memory mapping is accurate in the TMS340x0 games, we should get rid of the AddressShift hack (see the end of the file) as it isn't used when searching for something (look at the addresses in the cheat database and the ones proposed for CPU0 and you'll notice that they don't match) ... Of course, many cheats will have to be changed, but Pugsy is aware of this ...

Other thing which also relies on Pugsy : when you save the cheat.dat file to UTF8 format, the size of the file doubles (while it shouldn't according to MAME Devs) and then you can't load cheats anymore ... First, there shouldn't be semi-graphical chars (code > 0x7f) in the text file and/or we shall also convert the cheat line to true UTF8 ...

Once all this is fixed, I'll ask you to stop further development on this file (what else do you need anyway ?) as the cheat.c file needs special work and a huge rewrite, not to add new stuff, but to have a source file which is "compatible" with all the other ones in MAME ...

Image Steph from The Ultimate Patchers Image
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

Don't believe Pugsy !
Stephh wrote:The most important thing is that the (classic ?) search function seems to be broken somewhere : I can't even not find lives for a game such as 'bonzeadv' as the result is always 0 when I "continue" search ! Isn't there a problem with the "backup" data ?
I don't understand why you say, "search function seems to be broken".
Because the search function works on my MAME 0.111u2.
Please more report.
Stephh wrote:The "load old format" option doesn't seem to work correctly as the old cheats now seem to be always loaded ... It's a good news that old format is still supported, but the option should do something ...
Also I don't know why the cheat engine doesn't load old format.
Over and over again I say, I don't use and can't understand old format so that I don't know the cause.
Stephh wrote:Once all this is fixed, I'll ask you to stop further development on this file (what else do you need anyway ?) as the cheat.c file needs special work and a huge rewrite, not to add new stuff, but to have a source file which is "compatible" with all the other ones in MAME ...
...? Please more easy English.
User avatar
Pugsy
Posts: 3675
Joined: Fri Aug 17, 2001 12:59 am
Location: North Wales, UK.
Has thanked: 1 time
Been thanked: 15 times
Contact:

Post by Pugsy »

ShimaPong wrote:
Stephh wrote:The most important thing is that the (classic ?) search function seems to be broken somewhere : I can't even not find lives for a game such as 'bonzeadv' as the result is always 0 when I "continue" search ! Isn't there a problem with the "backup" data ?
I don't understand why you say, "search function seems to be broken".
Because the search function works on my MAME 0.111u2.
Please more report.
I also get 0 results for advanced and classic mode in 0.111u2, I tried it on a few games including asterix. There's also no option to select which memory areas to search.
Pugsy

Servicing your cheating needs since 1985 8)

Grab the latest cheat collection:
MAME 0.264 XML cheat collection (3 APRIL 2024) from http://www.mamecheat.co.uk or direct from:-
https://mega.nz/file/SxsQUJoT#jBdz6GLm_ ... QzFGSMms2c (ZIP Archive 3.8 MB)
stephh
Posts: 601
Joined: Fri Aug 17, 2001 1:00 am
Location: Paris, France

Post by stephh »

ShimaPong wrote:
Stephh wrote:The most important thing is that the (classic ?) search function seems to be broken somewhere : I can't even not find lives for a game such as 'bonzeadv' as the result is always 0 when I "continue" search ! Isn't there a problem with the "backup" data ?
I don't understand why you say, "search function seems to be broken".
Because the search function works on my MAME 0.111u2.
Please more report.
I found the bug that affects the "classic" and "advanced" search ("minimum" was working correctly) : you ALWAYS initialised the search, thus the 0 results ...

Here is a copy of the diff file (posted here : http://www.mameworld.info/ubbthreads/sh ... art=1&vc=1 ) :

Code: Select all

diff -Nru old/cheat.c src/cheat.c
--- old/cheat.c	2007-01-06 12:06:56.000000000 +0100
+++ src/cheat.c	2007-01-09 17:58:12.000000000 +0100
@@ -5668,8 +5668,9 @@
 
 	if(doSearch)
 	{
-		/* ----- initialize search ----- */
-		InitializeNewSearch(search);
+		if(!doneSaveMemory)
+			/* ----- initialize search ----- */
+			InitializeNewSearch(search);
 
 		if( (sel == kMenu_ValueEqual) || (sel == kMenu_ValueNearTo) || doneSaveMemory)
 		{
@@ -6117,8 +6118,9 @@
 					break;
 
 				case kMenu_DoSearch:
-					/* ----- initialize search ----- */
-					InitializeNewSearch(search);
+					if(!doneMemorySave)
+						/* ----- initialize search ----- */
+						InitializeNewSearch(search);
 
 					if((!kSearchOperandNeedsInit[search->lhs] && !kSearchOperandNeedsInit[search->rhs]) || doneMemorySave)
 					{
The fix has been submitted to the team to be sure to be included in MAME 0.111u3 ...

Stephh wrote:The "load old format" option doesn't seem to work correctly as the old cheats now seem to be always loaded ... It's a good news that old format is still supported, but the option should do something ...
Also I don't know why the cheat engine doesn't load old format.
Over and over again I say, I don't use and can't understand old format so that I don't know the cause.
You don't get it : now the cheat engine ALWAYS loads the old format ... More investigation is needed before I submit anything ...

Stephh wrote:Once all this is fixed, I'll ask you to stop further development on this file (what else do you need anyway ?) as the cheat.c file needs special work and a huge rewrite, not to add new stuff, but to have a source file which is "compatible" with all the other ones in MAME ...
...? Please more easy English.
The cheat.c file has to be rewritten to use the same "conventions" as the other files and move out of it what shoudn't really be there ... So I won't accept any new source file once MAME 0.111u3 is out ... This will give you time to work on the cheats and fix Pugsy's "mistakes" ...

Image Steph from The Ultimate Patchers Image
ShimaPong
Posts: 1063
Joined: Wed May 21, 2003 4:19 pm
Location: Japan

Post by ShimaPong »

Don't believe Pugsy !
Stephh wrote: found the bug that affects the "classic" and "advanced" search ("minimum" was working correctly) : you ALWAYS initialised the search, thus the 0 results ...
OK and sorry.
I have made the shift to "minimum" search mode completely so that I don't know other modes.
Stephh wrote:The cheat.c file has to be rewritten to use the same "conventions" as the other files
"convention" ?
I can't understand it.

Anyway, I have started fourth update to re-check current difficult cheat source file.
stephh
Posts: 601
Joined: Fri Aug 17, 2001 1:00 am
Location: Paris, France

Post by stephh »

ATTN ShimaPong

If you've made new changes to the cheat engine, please send them to me after you've included them in MAME 0.111u3 ...

Then, PLEASE do NOT update cheat.c ANYMORE until I've made the changes requested by the other Devs !

Image Steph from The Ultimate Patchers Image
Post Reply