mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Fix problem where the touch screen controls got reactivated by gamepad input
This commit is contained in:
+13
-9
@@ -177,7 +177,7 @@ void MultiTouchButton::Draw(UIContext &dc) {
|
||||
return;
|
||||
|
||||
float scale = scale_;
|
||||
if (IsDown()) {
|
||||
if (IsDownVisually()) {
|
||||
if (g_Config.iTouchButtonStyle == 2) {
|
||||
opacity *= 1.35f;
|
||||
} else {
|
||||
@@ -190,7 +190,7 @@ void MultiTouchButton::Draw(UIContext &dc) {
|
||||
uint32_t downBg = colorAlpha(0xFFFFFF, opacity * 0.5f);
|
||||
uint32_t color = colorAlpha(0xFFFFFF, opacity);
|
||||
|
||||
if (IsDown() && g_Config.iTouchButtonStyle == 2) {
|
||||
if (IsDownVisually() && g_Config.iTouchButtonStyle == 2) {
|
||||
if (bgImg_ != bgDownImg_)
|
||||
dc.Draw()->DrawImageRotated(bgDownImg_, bounds_.centerX(), bounds_.centerY(), scale, bgAngle_ * (M_PI * 2 / 360.0f), downBg, flipImageH_);
|
||||
}
|
||||
@@ -237,19 +237,23 @@ bool PSPButton::Touch(const TouchInput &input) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool CustomButton::IsDown() const {
|
||||
bool CustomButton::IsDownVisually() const {
|
||||
return (toggle_ && on_) || (!toggle_ && pointerDownMask_ != 0);
|
||||
}
|
||||
|
||||
bool CustomButton::IsDownForFadeoutCheck() const {
|
||||
bool CustomButton::IsDownByTouch() const {
|
||||
// This check is due to a stupid mistake, see the header.
|
||||
#ifdef MOBILE_DEVICE
|
||||
constexpr int bitNumber = 36;
|
||||
#else
|
||||
constexpr int bitNumber = 38;
|
||||
#endif
|
||||
const bool down = IsDown() && !(pspButtonBit_ & (1ULL << bitNumber)); // VIRTKEY_TOGGLE_TOUCH_CONTROLS from g_customKeyList
|
||||
return down;
|
||||
if (pspButtonBit_ & (1ULL << bitNumber)) {
|
||||
return false;
|
||||
}
|
||||
// VIRTKEY_TOGGLE_TOUCH_CONTROLS from g_customKeyList
|
||||
|
||||
return !toggle_ && pointerDownMask_ != 0;
|
||||
}
|
||||
|
||||
void CustomButton::GetContentDimensions(const UIContext &dc, float &w, float &h) const {
|
||||
@@ -322,7 +326,7 @@ void CustomButton::Update() {
|
||||
}
|
||||
}
|
||||
|
||||
bool PSPButton::IsDown() const {
|
||||
bool PSPButton::IsDownVisually() const {
|
||||
return (__CtrlPeekButtonsVisual() & pspButtonBit_) != 0;
|
||||
}
|
||||
|
||||
@@ -1110,8 +1114,8 @@ void GamepadEmuView::Update() {
|
||||
bool anyDown = false;
|
||||
for (auto view : views_) {
|
||||
GamepadComponent *component = dynamic_cast<GamepadComponent *>(view);
|
||||
if (component && component->IsDownForFadeoutCheck()) {
|
||||
// INFO_LOG(Log::System, "GamepadEmuView::Update: component is down for fadeout check: %s", component->DescribeText().c_str());
|
||||
if (component && component->IsDownByTouch()) {
|
||||
// INFO_LOG(Log::System, "GamepadEmuView::Update: component is down by touch: %s", component->DescribeText().c_str());
|
||||
anyDown = true;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -43,9 +43,8 @@ public:
|
||||
return false;
|
||||
}
|
||||
std::string DescribeText() const override;
|
||||
virtual bool IsDown() const = 0;
|
||||
virtual bool IsDownForFadeoutCheck() const {
|
||||
return IsDown();
|
||||
virtual bool IsDownByTouch() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -61,7 +60,8 @@ public:
|
||||
bool Touch(const TouchInput &input) override;
|
||||
void Draw(UIContext &dc) override;
|
||||
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override;
|
||||
bool IsDown() const override { return pointerDownMask_ != 0; }
|
||||
virtual bool IsDownVisually() const { return false; }
|
||||
bool IsDownByTouch() const override { return pointerDownMask_ != 0; }
|
||||
|
||||
// chainable
|
||||
MultiTouchButton *FlipImageH(bool flip) { flipImageH_ = flip; return this; }
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
: MultiTouchButton(key, bgImg, bgDownImg, img, scale, layoutParams), value_(value) {
|
||||
}
|
||||
bool Touch(const TouchInput &input) override;
|
||||
bool IsDown() const override { return *value_; }
|
||||
bool IsDownVisually() const override { return *value_; }
|
||||
|
||||
UI::Event OnChange;
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
: MultiTouchButton(key, bgImg, bgDownImg, img, scale, layoutParams), pspButtonBit_(pspButtonBit) {
|
||||
}
|
||||
bool Touch(const TouchInput &input) override;
|
||||
bool IsDown() const override;
|
||||
bool IsDownVisually() const override;
|
||||
|
||||
private:
|
||||
int pspButtonBit_;
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
bool Touch(const TouchInput &input) override;
|
||||
void Draw(UIContext &dc) override;
|
||||
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override;
|
||||
bool IsDown() const override { return down_ != 0; }
|
||||
bool IsDownByTouch() const override { return down_ != 0; }
|
||||
|
||||
private:
|
||||
void ProcessTouch(float x, float y, bool down, bool ignorePress);
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
bool Touch(const TouchInput &input) override;
|
||||
void Draw(UIContext &dc) override;
|
||||
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override;
|
||||
bool IsDown() const override { return dragPointerId_ != -1; }
|
||||
bool IsDownByTouch() const override { return dragPointerId_ != -1; }
|
||||
|
||||
protected:
|
||||
int dragPointerId_ = -1;
|
||||
@@ -191,8 +191,8 @@ public:
|
||||
bool Touch(const TouchInput &input) override;
|
||||
void Update() override;
|
||||
|
||||
bool IsDown() const override; // For visual purpose
|
||||
bool IsDownForFadeoutCheck() const override;
|
||||
bool IsDownVisually() const override; // For visual purpose
|
||||
bool IsDownByTouch() const override;
|
||||
|
||||
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override;
|
||||
private:
|
||||
|
||||
@@ -884,7 +884,7 @@ MemorySearchStatus ImMemView::search(bool continueSearch) {
|
||||
continue;
|
||||
|
||||
int index = memSearch_.searchAddress - memSearch_.segmentStart;
|
||||
int endIndex = memSearch_.segmentEnd - memSearch_.segmentStart - size;
|
||||
int endIndex = memSearch_.segmentEnd - memSearch_.segmentStart - (int)size;
|
||||
while (index < endIndex) {
|
||||
if (memcmp(&dataPointer[index], data, size) == 0) {
|
||||
memSearch_.matchAddress = index + memSearch_.segmentStart;
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
scale_ = theScale_;
|
||||
}
|
||||
|
||||
bool IsDown() const override {
|
||||
bool IsDownVisually() const override {
|
||||
// Don't want the button to enlarge and throw the user's perspective
|
||||
// of button size off whack. Also, the other purpose of IsDown is to prevent auto-hide,
|
||||
// but it's not relevant here.
|
||||
|
||||
Reference in New Issue
Block a user