void retro_cheat_set(unsigned index, bool enabled, const char *code) { uint32 address; uint8 val; bool8 sram; uint8 bytes[3];//used only by GoldFinger, ignored for now if (S9xGameGenieToRaw(code, &address, &val)!=NULL && S9xProActionReplayToRaw(code, &address, &val)!=NULL && S9xGoldFingerToRaw(code, &address, &sram, &val, bytes)!=NULL) { // bad code, ignore return; } if (index>Cheat.num_cheats) return; // cheat added in weird order, ignore if (index==Cheat.num_cheats) Cheat.num_cheats++; Cheat.c[index].address = address; Cheat.c[index].byte = val; Cheat.c[index].enabled = enabled; Cheat.c[index].saved = FALSE; // it'll be saved next time cheats run anyways Settings.ApplyCheats=true; S9xApplyCheats(); }
static void DetachCheatItems (void) { S9xDeleteCheats(); // Cheat.num_cheats = 0 for (unsigned int i = 0; i < MAX_CHEATS; i++) { if (citem[i].valid) { strcpy(Cheat.c[Cheat.num_cheats].name, citem[i].description); S9xAddCheat(citem[i].enabled, false, citem[i].address, citem[i].value); // Cheat.num_cheats++ } } S9xApplyCheats(); }
//extern uint8 *C4Ram; END_EXTERN_C #endif void S9xReset (void) { if (Settings.SuperFX) S9xResetSuperFX (); #ifdef ZSNES_FX WinterGold = Settings.WinterGold; #endif ZeroMemory (Memory.FillRAM, 0x8000); memset (Memory.VRAM, 0x00, 0x10000); memset (Memory.RAM, 0x55, 0x20000); S9xResetCPU (); S9xResetPPU (); //S9xResetSRTC (); if (Settings.SDD1) S9xResetSDD1 (); S9xResetDMA (); S9xResetAPU (); S9xResetDSP1 (); S9xSA1Init (); if (Settings.C4) S9xInitC4 (); #ifdef CHEATS S9xInitCheatData (); S9xApplyCheats (); #endif if(Settings.OBC1) ResetOBC1(); Settings.Paused = FALSE; }
static void S9xEndScreenRefresh (void) { FLUSH_REDRAW(); PPU.GunVLatch = 1000; /* i.e., never latch */ PPU.GunHLatch = 0; if (!Settings.NormalControls && pad_read) S9xControlEOF(); pad_read = FALSE; if(Settings.SpeedhackGameID > SPEEDHACK_NONE) speedhacks_manager(); if (!(GFX.DoInterlace && GFX.InterlaceFrame == 0)) S9xDeinitUpdate(IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight); S9xApplyCheats(); }
void retro_cheat_reset(void) { S9xDeleteCheats(); S9xApplyCheats(); }