- Additional fix for issue 465

-- The problem was that the previous fix for keybindings actually fixed dead code for the PSP version... the real call to Defaultbindings was still happening in JGE's code...so the fix made the call twice.
-- Note: shouldn't we use ResetBindings instead of JGECreateDefaultBindings? The former resets the bindings before assigning the default ones...
This commit is contained in:
wagic.the.homebrew
2011-07-10 06:52:07 +00:00
parent f28638f12e
commit 0661918ed6
2 changed files with 1 additions and 74 deletions

View File

@@ -394,7 +394,7 @@ void JGE::Run()
sceRtcGetCurrentTick(&lastTime);
oldButtons = veryOldButtons = 0;
JGECreateDefaultBindings();
while (!mDone)
{
if (!mPaused)

View File

@@ -285,79 +285,6 @@ static SceCtrlData gCtrlPad;
u8 JGEGetAnalogX() { return gCtrlPad.Lx; }
u8 JGEGetAnalogY() { return gCtrlPad.Ly; }
void Run()
{
static const int keyCodeList[] =
{
PSP_CTRL_SELECT, // Select button.
PSP_CTRL_START, // Start button.
PSP_CTRL_UP, // Up D-Pad button.
PSP_CTRL_RIGHT, // Right D-Pad button.
PSP_CTRL_DOWN, // Down D-Pad button.
PSP_CTRL_LEFT, // Left D-Pad button.
PSP_CTRL_LTRIGGER, // Left trigger.
PSP_CTRL_RTRIGGER, // Right trigger.
PSP_CTRL_TRIANGLE, // Triangle button.
PSP_CTRL_CIRCLE, // Circle button.
PSP_CTRL_CROSS, // Cross button.
PSP_CTRL_SQUARE, // Square button.
PSP_CTRL_HOLD, // Hold button.
/* Do not test keys we cannot get anyway, that's just wasted proc time
PSP_CTRL_HOME, // Home button.
PSP_CTRL_NOTE, // Music Note button.
PSP_CTRL_SCREEN, // Screen button.
PSP_CTRL_VOLUP, // Volume up button.
PSP_CTRL_VOLDOWN, // Volume down button.
PSP_CTRL_WLAN, // _UP Wlan switch up.
PSP_CTRL_REMOTE, // Remote hold position.
PSP_CTRL_DISC, // Disc present.
PSP_CTRL_MS // Memory stick present.
*/
};
u64 curr;
long long int nextInput = 0;
u64 lastTime;
u32 oldButtons;
u32 veryOldButtons;
sceRtcGetCurrentTick(&lastTime);
oldButtons = veryOldButtons = 0;
while (!g_engine->mDone)
{
sceRtcGetCurrentTick(&curr);
float dt = (curr - lastTime) / (float)gTickFrequency;
g_engine->mDeltaTime = dt;
if (!g_engine->mPaused)
{
sceCtrlPeekBufferPositive(&gCtrlPad, 1);
for (signed int i = sizeof(keyCodeList)/sizeof(keyCodeList[0]) - 1; i >= 0; --i)
if (keyCodeList[i] & gCtrlPad.Buttons)
{
if (!(keyCodeList[i] & oldButtons))
g_engine->HoldKey(keyCodeList[i]);
}
else
if (keyCodeList[i] & oldButtons)
g_engine->ReleaseKey(keyCodeList[i]);
oldButtons = gCtrlPad.Buttons;
g_engine->Update(dt);
g_engine->Render();
if (g_engine->mDebug && strlen(g_engine->mDebuggingMsg) > 0)
{
pspDebugScreenSetXY(0, 0);
pspDebugScreenPrintf(g_engine->mDebuggingMsg);
}
veryOldButtons = gCtrlPad.Buttons;
}
else
sceKernelDelayThread(1);
lastTime = curr;
}
}
//------------------------------------------------------------------------------------------------
// The main loop