Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
06477 Cheat System Critical (emulator) Always Jan 26, 2017, 20:20 Feb 13, 2017, 19:27
Tester EoceneMiacid View Status Public Platform MAME (Self-compiled)
Assigned To cuavas Resolution Fixed OS Linux (64-bit)
Status [?] Resolved Driver
Version 0.182 Fixed in Version 0.183 Build 64-bit
Summary 06477: All systems: MAME should ignore problematic cheats (or at least exit gracefully)
Description MAME crashes (returning code 5) whenever cheats are enabled but a problematic cheat is defined.
Here's an example with Midnight Run (midnrun) using Pugsy's last release (intended for version 0.174)

"MAME exception: midnrun.xml(5): error parsing cheat expression "" (invalid number)"
Steps To Reproduce Enable cheats, launch a game/system that has a problematic cheat defined (such as midnrun)
Additional Information Ideally MAME should send this warning to stderr, but not crash
Regression Version
Affected Sets / Systems All systems
Attached Files
related to 06361ResolvedPugsy Cartrdige memory accessed directly with cheats will crash MAME 
related to 06241Resolvedcuavas Most sets in neodriv.hxx: cheats enabled cause MAME to crash  
has duplicate 06497Closed ffight and others sets: CPS1 Final Fight ffight and others set not start 
User avatar
Jan 26, 2017, 21:10
edited on: Jan 26, 2017, 21:20
The crash is unintentional.
It used to work just fine up until about a year or so ago when some fiddling in debugger seems to have made non-functional cheats (those addressing cpu regions which don't exist, usually) to crash MAME out.
The current method to bypass is to use the internal CHEAT plugin instead of -cheat. For some reason, everything works as expected there and it will simply not load the offending cheats.
Previous attempts to fix it may not have worked as well as expected - 06241
User avatar
Jan 29, 2017, 22:24
It's caused by using exceptions for error propagation when loading cheats, but writing code in a way that's decidedly not exception-safe. The problem is entirely in the cheat code, not the debugger. It's on my TODO list to fix, but it's not my highest priority at the moment.
User avatar
Feb 2, 2017, 07:28
On failure to parse an individual cheat, an error message should be printed and the cheat manager should move on to the next cheat. On a problematic cheat file, the cheat manager should print an error message and clear out all cheats. I've also fixed memory leaks, made lots of things const, and generally cleaned up the code. Let me know about any regressions.
User avatar
Feb 13, 2017, 19:27
Thank you very much Vas!