mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
Merge pull request #6437 from quasiscroto/debugfix
Fix two cases where debugger can crash mame ("cheatlist" command befo…
This commit is contained in:
commit
9d428b4dc1
@ -2535,6 +2535,12 @@ void debugger_commands::execute_cheatlist(int ref, const std::vector<std::string
|
||||
u64 sizemask;
|
||||
FILE *f = nullptr;
|
||||
|
||||
if (m_cheat.cpu[0] == 0)
|
||||
{
|
||||
m_console.printf("Use cheatinit before cheatlist\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!validate_cpu_space_parameter(m_cheat.cpu, AS_PROGRAM, space))
|
||||
return;
|
||||
|
||||
|
@ -1561,16 +1561,11 @@ const char *debug_get_help(const char *tag)
|
||||
static char ambig_message[1024];
|
||||
const help_item *found = nullptr;
|
||||
int i, msglen, foundcount = 0;
|
||||
int taglen = (int)strlen(tag);
|
||||
char tagcopy[256];
|
||||
|
||||
/* make a lowercase copy of the tag */
|
||||
for (i = 0; i <= taglen; i++)
|
||||
tagcopy[i] = tolower(u8(tag[i]));
|
||||
size_t taglen = strlen(tag);
|
||||
|
||||
/* find a match */
|
||||
for (i = 0; i < ARRAY_LENGTH(static_help_list); i++)
|
||||
if (!strncmp(static_help_list[i].tag, tagcopy, taglen))
|
||||
if (!core_strnicmp(static_help_list[i].tag, tag, taglen))
|
||||
{
|
||||
foundcount++;
|
||||
found = &static_help_list[i];
|
||||
@ -1592,7 +1587,7 @@ const char *debug_get_help(const char *tag)
|
||||
/* otherwise, indicate ambiguous help */
|
||||
msglen = sprintf(ambig_message, "Ambiguous help request, did you mean:\n");
|
||||
for (i = 0; i < ARRAY_LENGTH(static_help_list); i++)
|
||||
if (!strncmp(static_help_list[i].tag, tagcopy, taglen))
|
||||
if (!core_strnicmp(static_help_list[i].tag, tag, taglen))
|
||||
msglen += sprintf(&ambig_message[msglen], " help %s?\n", static_help_list[i].tag);
|
||||
return ambig_message;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user