From 0661918ed6c28d2a90bfa6e9ed197d255e3d8537 Mon Sep 17 00:00:00 2001 From: "wagic.the.homebrew" Date: Sun, 10 Jul 2011 06:52:07 +0000 Subject: [PATCH] - 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... --- JGE/src/JGE.cpp | 2 +- JGE/src/main.cpp | 73 ------------------------------------------------ 2 files changed, 1 insertion(+), 74 deletions(-) diff --git a/JGE/src/JGE.cpp b/JGE/src/JGE.cpp index 3f16856f6..5aabbaefe 100644 --- a/JGE/src/JGE.cpp +++ b/JGE/src/JGE.cpp @@ -394,7 +394,7 @@ void JGE::Run() sceRtcGetCurrentTick(&lastTime); oldButtons = veryOldButtons = 0; - JGECreateDefaultBindings(); + while (!mDone) { if (!mPaused) diff --git a/JGE/src/main.cpp b/JGE/src/main.cpp index 83aced279..abebd9c5a 100644 --- a/JGE/src/main.cpp +++ b/JGE/src/main.cpp @@ -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