MCPcopy Create free account
hub / github.com/TASEmulators/fceux / ModifyCheat

Function ModifyCheat

src/drivers/common/cheat.cpp:222–267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222static void ModifyCheat(int num)
223{
224 std::string name;
225 std::string *pName;
226 char buf[256];
227 uint32 A;
228 uint8 V;
229 int compare;
230 int type;
231
232 int s;
233 int t;
234
235 FCEUI_GetCheat(num, &name, &A, &V, &compare, &s, &type);
236
237 printf("Name [%s]: ",name.c_str());
238 GetString(buf,256);
239
240 /* This obviously doesn't allow for cheats with no names. Bah. Who wants
241 nameless cheats anyway...
242 */
243
244 if(buf[0])
245 pName=&name; // Change name when FCEUI_SetCheat() is called.
246 else
247 pName=nullptr; // Don't change name when FCEUI_SetCheat() is called.
248
249 printf("Address [$%04x]: ",(unsigned int)A);
250 A=GetH16(A);
251
252 printf("Value [%03u]: ",(unsigned int)V);
253 V=Get8(V);
254
255 printf("Compare [%3d]: ",compare);
256 compare=GetI(compare);
257
258 printf("Type(0=Old Style, 1=Read Substitute) [%1d]: ",type);
259 type=GetI(type)?1:0;
260
261 printf("Enable [%s]: ",s?"Y":"N");
262 t=getchar();
263 if(t=='Y' || t=='y') s=1;
264 else if(t=='N' || t=='n') s=0;
265
266 FCEUI_SetCheat(num,pName,A,V,compare,s,type);
267}
268
269
270static void AddCheatGGPAR(int which)

Callers 1

ListCheatsFunction · 0.85

Calls 6

FCEUI_GetCheatFunction · 0.85
GetStringFunction · 0.85
GetH16Function · 0.85
Get8Function · 0.85
GetIFunction · 0.85
FCEUI_SetCheatFunction · 0.85

Tested by

no test coverage detected