mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Release PSP buttons when losing gameplay focus, fixes part 1 of #7758, and part 2 of #7758 on Windows only.
This commit is contained in:
parent
83182a0469
commit
18655d14a4
6 changed files with 38 additions and 2 deletions
|
@ -40,6 +40,8 @@ const int CTRL_STICK_RIGHT = 1;
|
|||
#define CTRL_LTRIGGER 0x0100
|
||||
#define CTRL_RTRIGGER 0x0200
|
||||
|
||||
#define CTRL_ALL_BUTTONS 0xF3F9
|
||||
|
||||
void __CtrlInit();
|
||||
void __CtrlDoState(PointerWrap &p);
|
||||
void __CtrlShutdown();
|
||||
|
|
|
@ -189,7 +189,10 @@ static void AfterStateLoad(bool success, void *ignored) {
|
|||
void EmuScreen::sendMessage(const char *message, const char *value) {
|
||||
// External commands, like from the Windows UI.
|
||||
if (!strcmp(message, "pause")) {
|
||||
releaseButtons();
|
||||
screenManager()->push(new GamePauseScreen(gamePath_));
|
||||
} else if (!strcmp(message, "lost_focus")) {
|
||||
releaseButtons();
|
||||
} else if (!strcmp(message, "stop")) {
|
||||
// We will push MainScreen in update().
|
||||
PSP_Shutdown();
|
||||
|
@ -220,9 +223,11 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
|
|||
}
|
||||
} else if (!strcmp(message, "control mapping")) {
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
releaseButtons();
|
||||
screenManager()->push(new ControlMappingScreen());
|
||||
} else if (!strcmp(message, "settings")) {
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
releaseButtons();
|
||||
screenManager()->push(new GameSettingsScreen(gamePath_));
|
||||
} else if (!strcmp(message, "gpu resized") || !strcmp(message, "gpu clear cache")) {
|
||||
if (gpu) {
|
||||
|
@ -232,7 +237,8 @@ void EmuScreen::sendMessage(const char *message, const char *value) {
|
|||
Reporting::UpdateConfig();
|
||||
RecreateViews();
|
||||
} else if (!strcmp(message, "gpu dump next frame")) {
|
||||
if (gpu) gpu->DumpNextFrame();
|
||||
if (gpu)
|
||||
gpu->DumpNextFrame();
|
||||
} else if (!strcmp(message, "clear jit")) {
|
||||
currentMIPS->ClearJitCache();
|
||||
if (PSP_IsInited()) {
|
||||
|
@ -657,6 +663,7 @@ void EmuScreen::CreateViews() {
|
|||
}
|
||||
|
||||
UI::EventReturn EmuScreen::OnDevTools(UI::EventParams ¶ms) {
|
||||
releaseButtons();
|
||||
screenManager()->push(new DevMenu());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
@ -752,6 +759,7 @@ void EmuScreen::update(InputState &input) {
|
|||
// This is here to support the iOS on screen back button.
|
||||
if (pauseTrigger_) {
|
||||
pauseTrigger_ = false;
|
||||
releaseButtons();
|
||||
screenManager()->push(new GamePauseScreen(gamePath_));
|
||||
}
|
||||
|
||||
|
@ -935,3 +943,12 @@ void EmuScreen::autoLoad() {
|
|||
g_Config.iCurrentStateSlot = lastSlot;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add generic loss-of-focus handling for Screens, use this.
|
||||
void EmuScreen::releaseButtons() {
|
||||
TouchInput input;
|
||||
input.flags = TOUCH_RELEASE_ALL;
|
||||
input.timestamp = time_now_d();
|
||||
input.id = 0;
|
||||
touch(input);
|
||||
}
|
|
@ -60,6 +60,8 @@ private:
|
|||
void setVKeyAnalogX(int stick, int virtualKeyMin, int virtualKeyMax);
|
||||
void setVKeyAnalogY(int stick, int virtualKeyMin, int virtualKeyMax);
|
||||
|
||||
void releaseButtons();
|
||||
|
||||
void autoLoad();
|
||||
void checkPowerDown();
|
||||
|
||||
|
|
|
@ -52,6 +52,9 @@ void MultiTouchButton::Touch(const TouchInput &input) {
|
|||
if (input.flags & TOUCH_UP) {
|
||||
pointerDownMask_ &= ~(1 << input.id);
|
||||
}
|
||||
if (input.flags & TOUCH_RELEASE_ALL) {
|
||||
pointerDownMask_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void MultiTouchButton::Draw(UIContext &dc) {
|
||||
|
@ -250,6 +253,14 @@ void PSPStick::Draw(UIContext &dc) {
|
|||
}
|
||||
|
||||
void PSPStick::Touch(const TouchInput &input) {
|
||||
if (input.flags & TOUCH_RELEASE_ALL) {
|
||||
dragPointerId_ = -1;
|
||||
centerX_ = bounds_.centerX();
|
||||
centerY_ = bounds_.centerY();
|
||||
__CtrlSetAnalogX(0.0f, stick_);
|
||||
__CtrlSetAnalogY(0.0f, stick_);
|
||||
return;
|
||||
}
|
||||
if (input.flags & TOUCH_DOWN) {
|
||||
if (dragPointerId_ == -1 && bounds_.Contains(input.x, input.y)) {
|
||||
if (g_Config.bAutoCenterTouchAnalog) {
|
||||
|
|
|
@ -1119,7 +1119,11 @@ namespace MainWindow
|
|||
}
|
||||
}
|
||||
|
||||
if (wParam == WA_ACTIVE) {
|
||||
NativeMessageReceived("got_focus", "");
|
||||
}
|
||||
if (wParam == WA_INACTIVE) {
|
||||
NativeMessageReceived("lost_focus", "");
|
||||
WindowsRawInput::LoseFocus();
|
||||
InputDevice::LoseFocus();
|
||||
}
|
||||
|
|
2
native
2
native
|
@ -1 +1 @@
|
|||
Subproject commit e9a007621503894330c427ef27957f07300b6151
|
||||
Subproject commit 6ae73b8919acf504aa61c9100d28b650ce53742d
|
Loading…
Add table
Reference in a new issue