mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-10 21:05:12 +01:00
Add support for multiline cheats delimited with "+" signs.
This commit is contained in:
parent
a8ac6adc59
commit
7093f1b7b2
@ -1892,11 +1892,26 @@ void retro_cheat_reset(void)
|
||||
|
||||
void retro_cheat_set(unsigned index, bool enabled, const char *code)
|
||||
{
|
||||
char codeCopy[256];
|
||||
char *buff;
|
||||
bool multiline=0;
|
||||
|
||||
/* clear existing ROM patches */
|
||||
clear_cheats();
|
||||
|
||||
/* Detect and split multiline cheats */
|
||||
strcpy(codeCopy,code);
|
||||
if (strstr(code,"+")){
|
||||
multiline=1;
|
||||
buff = strtok(codeCopy,"+");
|
||||
} else {
|
||||
buff=codeCopy;
|
||||
}
|
||||
|
||||
while (buff != NULL)
|
||||
{
|
||||
/* interpret code and check if this is a valid cheat code */
|
||||
if (decode_cheat((char *)code, maxcheats))
|
||||
if (decode_cheat((char *)buff, maxcheats))
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1917,6 +1932,10 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code)
|
||||
/* increment cheat count */
|
||||
maxcheats++;
|
||||
}
|
||||
}
|
||||
if (!multiline)
|
||||
break;
|
||||
buff = strtok(NULL,"+");
|
||||
}
|
||||
|
||||
/* apply ROM patches */
|
||||
|
Loading…
Reference in New Issue
Block a user