diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index aa2e9616f9..9df8d51bfa 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -528,6 +528,7 @@ void Callback_VideoCopiedToXFB() Timer.Update(); } PatchEngine_ApplyFramePatches(); + PatchEngine_ApplyARPatches(); } // __________________________________________________________________________________________________ diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp index 0a561e8988..819537f3b8 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.cpp +++ b/Source/Core/Core/Src/HW/SystemTimers.cpp @@ -127,6 +127,8 @@ void SICallback(u64 userdata, int cyclesLate) { // This is once per frame - good candidate for patching stuff PatchEngine_ApplyFramePatches(); + // Apply AR cheats + PatchEngine_ApplyARPatches(); // OK, do what we are here to do. SerialInterface::UpdateDevices(); CoreTiming::ScheduleEvent(SI_PERIOD-cyclesLate, et_SI); diff --git a/Source/Core/Core/Src/PatchEngine.cpp b/Source/Core/Core/Src/PatchEngine.cpp index d325f14f0e..64544d67c3 100644 --- a/Source/Core/Core/Src/PatchEngine.cpp +++ b/Source/Core/Core/Src/PatchEngine.cpp @@ -155,6 +155,9 @@ void PatchEngine_ApplyLoadPatches() void PatchEngine_ApplyFramePatches() { ApplyPatches(onFrame); +} +void PatchEngine_ApplyARPatches() +{ for (std::vector::const_iterator iter = arCodes.begin(); iter != arCodes.end(); ++iter) { if (iter->active) RunActionReplayCode(*iter, false); @@ -166,6 +169,7 @@ void LoadActionReplayCodes(IniFile &ini) std::vector lines; ARCode currentCode; arCodes.clear(); + if (!ini.GetLines("ActionReplay", lines)) return; @@ -197,7 +201,7 @@ void LoadActionReplayCodes(IniFile &ini) currentCode.name = line; currentCode.active = true; } - else { + else if (line[0] != '+') { currentCode.name = line; currentCode.active = false; } @@ -208,8 +212,8 @@ void LoadActionReplayCodes(IniFile &ini) 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. diff --git a/Source/Core/Core/Src/PatchEngine.h b/Source/Core/Core/Src/PatchEngine.h index cb446f9d61..b128e95651 100644 --- a/Source/Core/Core/Src/PatchEngine.h +++ b/Source/Core/Core/Src/PatchEngine.h @@ -24,5 +24,5 @@ void PatchEngine_LoadPatches(const char *gameID); void PatchEngine_ApplyLoadPatches(); void PatchEngine_ApplyFramePatches(); - +void PatchEngine_ApplyARPatches(); #endif