From f8823d6215696d8707de22b391184b1c054a8f43 Mon Sep 17 00:00:00 2001 From: dborth Date: Mon, 12 Apr 2010 22:39:41 +0000 Subject: [PATCH] fix cheats issue --- source/cheatmgr.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/source/cheatmgr.cpp b/source/cheatmgr.cpp index 074055b..738cb3c 100644 --- a/source/cheatmgr.cpp +++ b/source/cheatmgr.cpp @@ -8,6 +8,7 @@ * Cheat handling ***************************************************************************/ + #include "port.h" #include "cheats.h" @@ -26,8 +27,6 @@ extern SCheatData Cheat; static bool LoadCheatFile (int length) { - Cheat.num_cheats = 0; - uint8 data [28]; int offset = 0; @@ -39,7 +38,7 @@ static bool LoadCheatFile (int length) memcpy (data, savebuffer+offset, 28); offset += 28; - Cheat.c [Cheat.num_cheats].enabled = (data [0] & 4) == 0; + Cheat.c [Cheat.num_cheats].enabled = 0; // cheats always off Cheat.c [Cheat.num_cheats].byte = data [1]; Cheat.c [Cheat.num_cheats].address = data [2] | (data [3] << 8) | (data [4] << 16); Cheat.c [Cheat.num_cheats].saved_byte = data [5]; @@ -60,9 +59,11 @@ static bool LoadCheatFile (int length) void WiiSetupCheats() { + memset(Cheat.c, 0, sizeof(Cheat.c)); + Cheat.num_cheats = 0; + char filepath[1024]; int offset = 0; - uint16 i; if(!MakeFilePath(filepath, FILE_CHEAT)) return; @@ -73,14 +74,7 @@ WiiSetupCheats() // load cheat file if present if(offset > 0) - { - if(LoadCheatFile (offset)) - { - // disable all cheats loaded from the file - for (i = 0; i < Cheat.num_cheats; i++) - S9xDisableCheat(i); - } - } + LoadCheatFile (offset); FreeSaveBuffer (); }