mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-30 14:34:22 +01:00
commit
5563a91abf
@ -4,11 +4,24 @@
|
||||
For further information, consult the LICENSE file in the root directory.
|
||||
\*****************************************************************************/
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "memmap.h"
|
||||
#include "cheats.h"
|
||||
#include "bml.h"
|
||||
|
||||
static inline char *trim (char *string)
|
||||
{
|
||||
int start;
|
||||
int end;
|
||||
|
||||
for (start = 0; string[start] && isspace (string[start]); start++) {}
|
||||
for (end = start; string[end] && !isspace (string[end]); end++) {}
|
||||
string[end] = '\0';
|
||||
return &string[start];
|
||||
}
|
||||
|
||||
static inline uint8 S9xGetByteFree (uint32 Address)
|
||||
{
|
||||
int block = (Address & 0xffffff) >> MEMMAP_SHIFT;
|
||||
@ -394,21 +407,24 @@ SCheat S9xTextToCheat (char *text)
|
||||
SCheatGroup S9xCreateCheatGroup (const char *name, const char *cheat)
|
||||
{
|
||||
SCheatGroup g;
|
||||
char *code;
|
||||
char *code_string = strdup (cheat);
|
||||
char *code_ptr = code_string;
|
||||
int len;
|
||||
|
||||
g.name = strdup (name);
|
||||
g.enabled = false;
|
||||
|
||||
for (code = strtok (code_string, "+"); code; code = strtok (NULL, "+"))
|
||||
{
|
||||
if (code)
|
||||
for (len = strcspn (code_ptr, "+"); len; len = strcspn (code_ptr, "+"))
|
||||
{
|
||||
char *code = code_ptr;
|
||||
code_ptr += len + (code_ptr[len] == '\0' ? 0 : 1);
|
||||
code[len] = '\0';
|
||||
code = trim (code);
|
||||
|
||||
SCheat c = S9xTextToCheat (code);
|
||||
if (c.address)
|
||||
g.c.push_back (c);
|
||||
}
|
||||
}
|
||||
|
||||
delete[] code_string;
|
||||
|
||||
|
@ -54,7 +54,7 @@ enum
|
||||
S9X_NOT_A_MOVIE_SNAPSHOT,
|
||||
S9X_SNAPSHOT_INCONSISTENT,
|
||||
S9X_AVI_INFO,
|
||||
S9X_PRESSED_KEYS_INFO,
|
||||
S9X_PRESSED_KEYS_INFO
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user