* Implement holds for PSP.
This commit is contained in:
jean.chalard
2008-11-28 14:33:51 +00:00
parent 3488d3a498
commit 46669050ee
+6 -2
View File
@@ -219,6 +219,8 @@ static const int gKeyCodeList[] = {
PSP_CTRL_MS // Memory stick present. PSP_CTRL_MS // Memory stick present.
*/ */
}; };
static u32 gHolds = 0;
JGE::JGE() JGE::JGE()
{ {
@@ -341,6 +343,7 @@ u32 JGE::ReadButton()
{ {
if (gKeyBuffer.empty()) return 0; if (gKeyBuffer.empty()) return 0;
u32 val = gKeyBuffer.front(); u32 val = gKeyBuffer.front();
gHolds &= val;
gKeyBuffer.pop(); gKeyBuffer.pop();
return val; return val;
} }
@@ -386,14 +389,15 @@ void JGE::Run()
{ {
if (!(gKeyCodeList[i] & mOldButtons)) if (!(gKeyCodeList[i] & mOldButtons))
{ {
gKeyBuffer.push(gKeyCodeList[i]); if (!(gHolds & gKeyCodeList[i])) gKeyBuffer.push(gKeyCodeList[i]);
nextInput = repeatDelay; nextInput = repeatDelay;
} }
else if (nextInput < 0) else if (nextInput < 0)
{ {
gKeyBuffer.push(gKeyCodeList[i]); if (!(gHolds & gKeyCodeList[i])) gKeyBuffer.push(gKeyCodeList[i]);
nextInput = repeatPeriod; nextInput = repeatPeriod;
} }
gHolds |= gKeyCodeList[i];
} }
mOldButtons = mCtrlPad.Buttons; mOldButtons = mCtrlPad.Buttons;