Fixed bug in cheats system and a bit of code cleanup. The cheat code activation works properly now. Enjoy your cheating :P.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@850 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
omegadox 2008-10-13 18:25:09 +00:00
parent dec94518e7
commit 744efe72e5
4 changed files with 10 additions and 3 deletions

View File

@ -528,6 +528,7 @@ void Callback_VideoCopiedToXFB()
Timer.Update(); Timer.Update();
} }
PatchEngine_ApplyFramePatches(); PatchEngine_ApplyFramePatches();
PatchEngine_ApplyARPatches();
} }
// __________________________________________________________________________________________________ // __________________________________________________________________________________________________

View File

@ -127,6 +127,8 @@ void SICallback(u64 userdata, int cyclesLate)
{ {
// This is once per frame - good candidate for patching stuff // This is once per frame - good candidate for patching stuff
PatchEngine_ApplyFramePatches(); PatchEngine_ApplyFramePatches();
// Apply AR cheats
PatchEngine_ApplyARPatches();
// OK, do what we are here to do. // OK, do what we are here to do.
SerialInterface::UpdateDevices(); SerialInterface::UpdateDevices();
CoreTiming::ScheduleEvent(SI_PERIOD-cyclesLate, et_SI); CoreTiming::ScheduleEvent(SI_PERIOD-cyclesLate, et_SI);

View File

@ -155,6 +155,9 @@ void PatchEngine_ApplyLoadPatches()
void PatchEngine_ApplyFramePatches() void PatchEngine_ApplyFramePatches()
{ {
ApplyPatches(onFrame); ApplyPatches(onFrame);
}
void PatchEngine_ApplyARPatches()
{
for (std::vector<ARCode>::const_iterator iter = arCodes.begin(); iter != arCodes.end(); ++iter) { for (std::vector<ARCode>::const_iterator iter = arCodes.begin(); iter != arCodes.end(); ++iter) {
if (iter->active) if (iter->active)
RunActionReplayCode(*iter, false); RunActionReplayCode(*iter, false);
@ -166,6 +169,7 @@ void LoadActionReplayCodes(IniFile &ini)
std::vector<std::string> lines; std::vector<std::string> lines;
ARCode currentCode; ARCode currentCode;
arCodes.clear(); arCodes.clear();
if (!ini.GetLines("ActionReplay", lines)) if (!ini.GetLines("ActionReplay", lines))
return; return;
@ -197,7 +201,7 @@ void LoadActionReplayCodes(IniFile &ini)
currentCode.name = line; currentCode.name = line;
currentCode.active = true; currentCode.active = true;
} }
else { else if (line[0] != '+') {
currentCode.name = line; currentCode.name = line;
currentCode.active = false; currentCode.active = false;
} }
@ -208,8 +212,8 @@ void LoadActionReplayCodes(IniFile &ini)
currentCode.ops.clear(); currentCode.ops.clear();
} }
} }
arCodes.push_back(currentCode);
} }
arCodes.push_back(currentCode);
} }
// The mechanism is slightly different than what the real AR uses, so there may be compatibility problems. // The mechanism is slightly different than what the real AR uses, so there may be compatibility problems.

View File

@ -24,5 +24,5 @@
void PatchEngine_LoadPatches(const char *gameID); void PatchEngine_LoadPatches(const char *gameID);
void PatchEngine_ApplyLoadPatches(); void PatchEngine_ApplyLoadPatches();
void PatchEngine_ApplyFramePatches(); void PatchEngine_ApplyFramePatches();
void PatchEngine_ApplyARPatches();
#endif #endif