From 09495b1d933f3e0fc86f8eb77c53b3724020f186 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 6 Dec 2020 15:50:58 +1000 Subject: [PATCH] Cheats: Implement C1 command --- src/core/cheats.cpp | 12 ++++++++++++ src/core/cheats.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/core/cheats.cpp b/src/core/cheats.cpp index 34fe08dfc..b7f2c3796 100644 --- a/src/core/cheats.cpp +++ b/src/core/cheats.cpp @@ -1014,6 +1014,18 @@ void CheatCode::Apply() const } break; + case InstructionCode::DelayActivation: // C1 + { + // A value of around 4000 or 5000 will usually give you a good 20-30 second delay before codes are activated. + // Frame number * 0.3 -> (20 * 60) * 10 / 3 => 4000 + const u32 comp_value = (System::GetFrameNumber() * 10) / 3; + if (comp_value < inst.value16) + index = count; + else + index++; + } + break; + case InstructionCode::Slide: { if ((index + 1) >= instructions.size()) diff --git a/src/core/cheats.h b/src/core/cheats.h index f8eb64edb..ac731e3a3 100644 --- a/src/core/cheats.h +++ b/src/core/cheats.h @@ -30,6 +30,7 @@ struct CheatCode Decrement16 = 0x11, Increment8 = 0x20, Decrement8 = 0x21, + DelayActivation = 0xC1, SkipIfNotEqual16 = 0xC0, SkipIfButtonsNotEqual = 0xD5, SkipIfButtonsEqual = 0xD6,