From 46669050eeac242054e3100224fbffa012274671 Mon Sep 17 00:00:00 2001 From: "jean.chalard" Date: Fri, 28 Nov 2008 14:33:51 +0000 Subject: [PATCH] J : * Implement holds for PSP. --- JGE/src/JGE.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/JGE/src/JGE.cpp b/JGE/src/JGE.cpp index be17b405e..d68cb8490 100644 --- a/JGE/src/JGE.cpp +++ b/JGE/src/JGE.cpp @@ -219,6 +219,8 @@ static const int gKeyCodeList[] = { PSP_CTRL_MS // Memory stick present. */ }; +static u32 gHolds = 0; + JGE::JGE() { @@ -341,6 +343,7 @@ u32 JGE::ReadButton() { if (gKeyBuffer.empty()) return 0; u32 val = gKeyBuffer.front(); + gHolds &= val; gKeyBuffer.pop(); return val; } @@ -386,14 +389,15 @@ void JGE::Run() { if (!(gKeyCodeList[i] & mOldButtons)) { - gKeyBuffer.push(gKeyCodeList[i]); + if (!(gHolds & gKeyCodeList[i])) gKeyBuffer.push(gKeyCodeList[i]); nextInput = repeatDelay; } else if (nextInput < 0) { - gKeyBuffer.push(gKeyCodeList[i]); + if (!(gHolds & gKeyCodeList[i])) gKeyBuffer.push(gKeyCodeList[i]); nextInput = repeatPeriod; } + gHolds |= gKeyCodeList[i]; } mOldButtons = mCtrlPad.Buttons;