Added a 'changed by' search to the cheat engine [Pugsy]

---------- Forwarded message ----------
From: Pugsy <pugsy@gmx.net>
Date: Tue, Dec 14, 2010 at 3:13 PM
Subject: Minor patch to improve cheat finding functionality
To: submit@mamedev.org
Cc: "stephh U.P." <upstephh_wip@yahoo.com>


Hi

Here is a simple patch that will add a "changed by" search - it's effectively a increased and decreased search rolled into one. It is useful when you are uncertain if the value has increased by x or decreased by x so it saves having to guess which search method to try first.


-- 
Martin 'Pugsy' Pugh


MAME Cheat File Maintainer http://mamecheat.co.uk
Gamebase64 Team Member http://www.gamebase64.com
This commit is contained in:
Phil Bennett 2010-12-19 17:41:56 +00:00
parent 673f5bef0f
commit 31d554dc17
2 changed files with 16 additions and 1 deletions

View File

@ -1834,7 +1834,8 @@ static void execute_cheatnext(running_machine *machine, int ref, int params, con
CHEAT_DECREASEOF, CHEAT_DECREASEOF,
CHEAT_INCREASEOF, CHEAT_INCREASEOF,
CHEAT_SMALLEROF, CHEAT_SMALLEROF,
CHEAT_GREATEROF CHEAT_GREATEROF,
CHEAT_CHANGEDBY
}; };
if (cheat.cpu == 0) if (cheat.cpu == 0)
@ -1869,6 +1870,8 @@ static void execute_cheatnext(running_machine *machine, int ref, int params, con
condition = CHEAT_SMALLEROF; condition = CHEAT_SMALLEROF;
else if (!strcmp(param[0], "greaterof") || !strcmp(param[0], "gt") || !strcmp(param[0], ">")) else if (!strcmp(param[0], "greaterof") || !strcmp(param[0], "gt") || !strcmp(param[0], ">"))
condition = CHEAT_GREATEROF; condition = CHEAT_GREATEROF;
else if (!strcmp(param[0], "changedby") || !strcmp(param[0], "ch") || !strcmp(param[0], "~"))
condition = CHEAT_CHANGEDBY;
else else
{ {
debug_console_printf(machine, "Invalid condition type\n"); debug_console_printf(machine, "Invalid condition type\n");
@ -1955,6 +1958,12 @@ static void execute_cheatnext(running_machine *machine, int ref, int params, con
else else
disable_byte = ((UINT64)cheat_value <= (UINT64)comp_value); disable_byte = ((UINT64)cheat_value <= (UINT64)comp_value);
break; break;
case CHEAT_CHANGEDBY:
if (cheat_value > comp_byte)
disable_byte = (cheat_value != comp_byte + comp_value);
else
disable_byte = (cheat_value != comp_byte - comp_value);
break;
} }
if (disable_byte) if (disable_byte)

View File

@ -1113,6 +1113,9 @@ static const help_item static_help_list[] =
" greaterof [gt]\n" " greaterof [gt]\n"
" without <comparisonvalue> this condition is invalid\n" " without <comparisonvalue> this condition is invalid\n"
" with <comparisonvalue> search for all bytes that are larger than the <comparisonvalue>.\n" " with <comparisonvalue> search for all bytes that are larger than the <comparisonvalue>.\n"
" changedby [ch, ~]\n"
" without <comparisonvalue> this condition is invalid\n"
" with <comparisonvalue> search for all bytes that have changed by the <comparisonvalue> since the last search.\n"
"\n" "\n"
"Examples:\n" "Examples:\n"
"\n" "\n"
@ -1156,6 +1159,9 @@ static const help_item static_help_list[] =
" greaterof [gt]\n" " greaterof [gt]\n"
" without <comparisonvalue> this condition is invalid.\n" " without <comparisonvalue> this condition is invalid.\n"
" with <comparisonvalue> search for all bytes that are larger than the <comparisonvalue>.\n" " with <comparisonvalue> search for all bytes that are larger than the <comparisonvalue>.\n"
" changedby [ch, ~]\n"
" without <comparisonvalue> this condition is invalid\n"
" with <comparisonvalue> search for all bytes that have changed by the <comparisonvalue> since the initial search.\n"
"\n" "\n"
"Examples:\n" "Examples:\n"
"\n" "\n"