From 4176a014ac0ed5e2859e5a880c88a44710fd2392 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Wed, 19 Aug 2009 16:45:49 +0000 Subject: [PATCH] From Pugsy: > > Currently MESS supports single system cheat xmls > > eg ALL cheats for any SNES game must be in snes.xml, this means that > there will be a lot of cheats > that are not applicable to the game being played. > > This change reverts MESS to a close approximation of how it used to > handle cheats. It will get the > crc32 of the image and load only the appropriate cheats to go with that > image/game by loading > crc32.xml (eg. DEADBEEF.xml). > > > These changes are within ifdef MESS structures so should have no > affect on MAME, and my testing has > not encountered any problems. > > Diff File attached --- src/emu/cheat.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/emu/cheat.c b/src/emu/cheat.c index 3e978661b5d..ac4c46932b2 100644 --- a/src/emu/cheat.c +++ b/src/emu/cheat.c @@ -82,6 +82,10 @@ #include +#ifdef MESS +#include "cheatms.h" +#endif + /*************************************************************************** @@ -374,8 +378,18 @@ void cheat_init(running_machine *machine) cheatinfo = auto_alloc_clear(machine, cheat_private); machine->cheat_data = cheatinfo; - /* load the cheat file */ + /* load the cheat file, MESS will load a crc32.xml ( eg. 01234567.xml ) + and MAME will load gamename.xml */ + #ifdef MESS + { + char mess_cheat_filename[9]; + cheat_mess_init(machine); + sprintf(mess_cheat_filename, "%08X", this_game_crc); + cheatinfo->cheatlist = cheat_list_load(machine, mess_cheat_filename); + } + #else cheatinfo->cheatlist = cheat_list_load(machine, machine->basename); + #endif /* temporary: save the file back out as output.xml for comparison */ if (cheatinfo->cheatlist != NULL)