mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2025-01-14 20:29:32 +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)
|
void retro_cheat_set(unsigned index, bool enabled, const char *code)
|
||||||
{
|
{
|
||||||
|
char codeCopy[256];
|
||||||
|
char *buff;
|
||||||
|
bool multiline=0;
|
||||||
|
|
||||||
/* clear existing ROM patches */
|
/* clear existing ROM patches */
|
||||||
clear_cheats();
|
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 */
|
/* 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;
|
int i;
|
||||||
|
|
||||||
@ -1917,6 +1932,10 @@ void retro_cheat_set(unsigned index, bool enabled, const char *code)
|
|||||||
/* increment cheat count */
|
/* increment cheat count */
|
||||||
maxcheats++;
|
maxcheats++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!multiline)
|
||||||
|
break;
|
||||||
|
buff = strtok(NULL,"+");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* apply ROM patches */
|
/* apply ROM patches */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user