void SetByte (u32 addr, u8 value)
{
u32 handle = 0;
svc_openProcess (& amp; handle, 0x25); // pid = 0x25
svc_writeProcessMemory (handle, & amp; value, addr, 1);
}
u8 CheatOn_HP = 0;
u32 CheatUi () {
u8 buf [200];
acquireVideo ();
while (1) {
blank (0, 0, 320, 240);
xsprintf (buf, "Cheat:% 02d", CheatOn_HP);
print (buf, 10, 10, 255, 0, 0);
updateScreen ();
u32 key = waitKey ();
if (key == BUTTON_DU)
{
CheatOn_HP = 1;
SetByte (0x168b5fa8, 99);
}
if (key == BUTTON_DD) {
CheatOn_HP = 0;
SetByte (0x168b5fa8, 10);
}
if (key == BUTTON_B) {
break;
}
}
releaseVideo ();
return 0;
}
void Run_Cheat (u32 addr, u8 value)
{
while (1)
{
if (CheatOn_HP)
SetByte (0x168b5fa8, 99);
}
}
u64 Stack_buf [0x200 / 8];
int main () {
u32 retv;
Handle thread;
initSharedFunc ();
nsDbgPrint ("initializing Cheat plugin \ n");
plgRegisterMenuEntry (1, "CheatContro", CheatUi);
plgGetSharedServiceHandle ("fs: USER", & amp; fsUserHandle);
nsDbgPrint ("fsUserHandle:% 08x \ n", fsUserHandle);
// Svc_createThread (& amp; thread, Run_Cheat, 0, (u32) Stack_buf, 0x18, 1);
}