static void AddCheatParam(uint32 A, uint8 V) { char name[256]; printf("Name: "); GetString(name, 256); printf("Address [$%04x]: ", (unsigned int)A); A = GetH16(A); printf("Value [%03d]: ", (unsigned int)V); V = Get8(V); printf("Add cheat \"%s\" for address $%04x with value %03d?", name, (unsigned int)A, (unsigned int)V); if (GetYN(0)) { if (FCEUI_AddCheat(name, A, V, -1, 0)) puts("Cheat added."); else puts("Error adding cheat."); } }
static void ModifyCheat(int num) { char *name; char buf[256]; uint32 A; uint8 V; int compare; int type; int s; int t; FCEUI_GetCheat(num, &name, &A, &V, &compare, &s, &type); printf("Name [%s]: ",name); GetString(buf,256); /* This obviously doesn't allow for cheats with no names. Bah. Who wants nameless cheats anyway... */ if(buf[0]) name=buf; // Change name when FCEUI_SetCheat() is called. else name=0; // Don't change name when FCEUI_SetCheat() is called. printf("Address [$%04x]: ",(unsigned int)A); A=GetH16(A); printf("Value [%03d]: ",(unsigned int)V); V=Get8(V); printf("Compare [%3d]: ",compare); compare=GetI(compare); printf("Type(0=Old Style, 1=Read Substitute) [%1d]: ",type); type=GetI(type)?1:0; printf("Enable [%s]: ",s?"Y":"N"); t=getchar(); if(t=='Y' || t=='y') s=1; else if(t=='N' || t=='n') s=0; FCEUI_SetCheat(num,name,A,V,compare,s,type); }