mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-17 04:39:34 +00:00
Fix forgetting pressed keys
This commit is contained in:
parent
77acd083c8
commit
1c513c1bd0
@ -106,6 +106,7 @@ EmuScreen::EmuScreen(const std::string &filename) : invalid_(true) {
|
||||
osm.Show(s->T("PressESC", "Press ESC to open the pause menu"), 3.0f);
|
||||
}
|
||||
#endif
|
||||
pressedLastFrame = 0;
|
||||
}
|
||||
|
||||
EmuScreen::~EmuScreen() {
|
||||
@ -203,8 +204,6 @@ void EmuScreen::update(InputState &input) {
|
||||
#endif
|
||||
|
||||
// Set Keys ----
|
||||
__CtrlButtonUp(-1); // blanks all buttons
|
||||
uint32_t pressed = 0;
|
||||
|
||||
// Legacy key mapping
|
||||
// Then translate pad input into PSP pad input. Also, add in tilt.
|
||||
@ -223,11 +222,17 @@ void EmuScreen::update(InputState &input) {
|
||||
{PAD_BUTTON_SELECT, CTRL_SELECT},
|
||||
};
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
if (input.pad_buttons_down & mapping[i][0])
|
||||
pressed |= mapping[i][1];
|
||||
for (int i = 0; i < 12; i++) {
|
||||
if (input.pad_buttons_down & mapping[i][0]) {
|
||||
__CtrlButtonDown(mapping[i][1]);
|
||||
}
|
||||
if (input.pad_buttons_up & mapping[i][0]) {
|
||||
__CtrlButtonUp(mapping[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Modern key mapping
|
||||
uint32_t pressed = 0;
|
||||
for (int i = 0; i < MAX_KEYQUEUESIZE; i++) {
|
||||
int key = input.key_queue[i];
|
||||
if (key == 0)
|
||||
@ -237,6 +242,8 @@ void EmuScreen::update(InputState &input) {
|
||||
pressed |= KeyMap::KeyToPspButton(key);
|
||||
}
|
||||
__CtrlButtonDown(pressed);
|
||||
__CtrlButtonUp(pressedLastFrame & ~pressed);
|
||||
pressedLastFrame = pressed;
|
||||
// End Set Keys --
|
||||
|
||||
float stick_x = input.pad_lstick_x;
|
||||
|
@ -38,4 +38,5 @@ private:
|
||||
// Something invalid was loaded, don't try to emulate
|
||||
bool invalid_;
|
||||
std::string errorMessage_;
|
||||
};
|
||||
uint32_t pressedLastFrame;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user