mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
Fix cheat crash and comment display.
This commit is contained in:
parent
6605a2e3e5
commit
d51551f303
@ -193,7 +193,7 @@ struct _cheat_entry
|
|||||||
script_state state; /* current cheat state */
|
script_state state; /* current cheat state */
|
||||||
UINT32 numtemp; /* number of temporary variables */
|
UINT32 numtemp; /* number of temporary variables */
|
||||||
UINT64 argindex; /* argument index variable */
|
UINT64 argindex; /* argument index variable */
|
||||||
UINT64 tempvar[1]; /* value of the temporary variables */
|
UINT64 * tempvar; /* value of the temporary variables */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1177,7 +1177,8 @@ static cheat_entry *cheat_entry_load(running_machine *machine, const char *filen
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate memory for the cheat */
|
/* allocate memory for the cheat */
|
||||||
cheat = (cheat_entry *)auto_alloc_array_clear(machine, UINT8, sizeof(*cheat) + (tempcount - 1) * sizeof(cheat->tempvar));
|
cheat = auto_alloc_clear(machine, cheat_entry);
|
||||||
|
cheat->tempvar = auto_alloc_array_clear(machine, UINT64, tempcount);
|
||||||
cheat->numtemp = tempcount;
|
cheat->numtemp = tempcount;
|
||||||
|
|
||||||
/* get the description */
|
/* get the description */
|
||||||
@ -1324,6 +1325,7 @@ static void cheat_entry_free(running_machine *machine, cheat_entry *cheat)
|
|||||||
if (cheat->symbols != NULL)
|
if (cheat->symbols != NULL)
|
||||||
symtable_free(cheat->symbols);
|
symtable_free(cheat->symbols);
|
||||||
|
|
||||||
|
auto_free(machine, cheat->tempvar);
|
||||||
auto_free(machine, cheat);
|
auto_free(machine, cheat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2533,7 +2533,7 @@ static void menu_cheat(running_machine *machine, ui_menu *menu, void *parameter,
|
|||||||
case IPT_UI_DISPLAY_COMMENT:
|
case IPT_UI_DISPLAY_COMMENT:
|
||||||
case IPT_UI_UP:
|
case IPT_UI_UP:
|
||||||
case IPT_UI_DOWN:
|
case IPT_UI_DOWN:
|
||||||
if (cheat_get_comment(event->itemref) != NULL)
|
if (cheat_get_comment(event->itemref).len() != 0)
|
||||||
popmessage("Cheat Comment:\n%s", cheat_get_comment(event->itemref).cstr());
|
popmessage("Cheat Comment:\n%s", cheat_get_comment(event->itemref).cstr());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user