From bd25c14cfd9f629a632555a698771bf1f3c7e6b7 Mon Sep 17 00:00:00 2001 From: Flyinghead Date: Wed, 29 Nov 2023 12:31:30 +0100 Subject: [PATCH] libretro: fix manic panic touchscreen buttons --- core/hw/naomi/touchscreen.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/hw/naomi/touchscreen.cpp b/core/hw/naomi/touchscreen.cpp index 53de119281..a43d004a36 100644 --- a/core/hw/naomi/touchscreen.cpp +++ b/core/hw/naomi/touchscreen.cpp @@ -20,6 +20,7 @@ #include "hw/sh4/sh4_sched.h" #include "hw/sh4/modules/modules.h" #include "hw/maple/maple_cfg.h" +#include "hw/maple/maple_devs.h" #include "input/gamepad.h" #include "serialize.h" @@ -120,8 +121,13 @@ class TouchscreenPipe final : public SerialPort::Pipe { int x = std::clamp(mapleInputState[i].absPos.x, 0, 1023); int y = std::clamp(mapleInputState[i].absPos.y, 0, 1023); +#ifdef LIBRETRO + int hit = (mapleInputState[i].kcode & NAOMI_BTN0_KEY) == 0; + int charge = (mapleInputState[i].kcode & NAOMI_BTN1_KEY) == 0; +#else int hit = (mapleInputState[i].kcode & DC_BTN_A) == 0; int charge = (mapleInputState[i].kcode & DC_BTN_B) == 0; +#endif // touches require bits 20, 21 and 22 // drag needs bit 22 off // bit 23 is charge