* Implement holds for PSP.
This commit is contained in:
jean.chalard
2008-11-28 14:33:51 +00:00
parent 3488d3a498
commit 46669050ee

View File

@@ -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;