Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
02981 Cheat System Minor Have not tried Feb 27, 2009, 03:08 Mar 16, 2009, 10:31
Tester Tafoid View Status Public Platform MAME (Self-compiled)
Assigned To Pugsy Resolution Fixed OS Windows 2000
Status [?] Resolved Driver
Version 0.129u5 Fixed in Version 0.130u1 Build Normal
Fixed in Git Commit Github Pull Request #
Summary 02981: CHEAT.C: MAX_ARGUMENTS doesn't seem to work.
Description In consulting Pugsy about testing his latest batch of XML's - I came across 2 sets in particular which cause MAME to crash. This was determined to happen because the number of arguments in the cheat were 50, and the "MAX_ARGUMENTS" is set to 32. MAME should have, instead of crashing with an access violation, should have printed an error to the console stating that there were too many arguments in that XML file.
Steps To Reproduce Start MAME choosing either FINDOUT or REELFUN with the -cheat trigger.
Additional Information
Github Commit
Flags
Regression Version
Affected Sets / Systems CHEAT.C
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
2
User avatar
No.03837
Pugsy
Developer
Feb 27, 2009, 14:11
edited on: Feb 27, 2009, 14:30
This is an easy fix , it's just a case of moving:-

			/* max out on arguments */
			if (totalargs > MAX_ARGUMENTS)
			{
				mame_printf_error("%s.xml(%d): too many arguments (found %d, max is %d)\n", filename, argnode->line, totalargs, MAX_ARGUMENTS);
				goto error;
			}

up a few lines to directly after:-

			/* first extract attributes */
			curarg->count = xml_get_attribute_int(argnode, "count", 1);
			totalargs += curarg->count;

Additionally it would be nice if the constant was changed,
from:
#define MAX_ARGUMENTS			32
to:
#define MAX_ARGUMENTS			50

This is not a major concern for right now as currently the cheat doesn't work as expected because as soon as hits an $0d character in the string it shows nothing else (cheat engine should trap the $0d and any other control characters and replace them with a $20 in any watch cheats).
User avatar
No.03973
Fujix
Administrator
Mar 16, 2009, 10:31
Fix submission confirmed.