diff --git a/src/frontend/qt_sdl/Input.cpp b/src/frontend/qt_sdl/Input.cpp index e0701087..c7c1d853 100644 --- a/src/frontend/qt_sdl/Input.cpp +++ b/src/frontend/qt_sdl/Input.cpp @@ -36,6 +36,9 @@ u32 HotkeyPress, HotkeyRelease; u32 InputMask; +bool Touching; +int TouchX, TouchY; + void Init() { @@ -48,6 +51,10 @@ void Init() ExtHotkeyMask = 0; HotkeyMask = 0; LastHotkeyMask = 0; + + Touching = false; + TouchX = 0; + TouchY = 0; } @@ -190,6 +197,18 @@ void ExtHotkeyPress(int id) ExtHotkeyMask |= (1< InputQueue; @@ -471,6 +473,9 @@ void StartLocal() InputFrame frame; frame.FrameNum = i; frame.KeyMask = 0xFFF; + frame.Touching = 0; + frame.TouchX = 0; + frame.TouchY = 0; InputQueue.push(frame); } @@ -843,7 +848,10 @@ void ProcessInput() InputFrame frame; frame.FrameNum = NDS::NumFrames + lag; frame.KeyMask = Input::InputMask; - // TODO: touchscreen input and other shit! + frame.Touching = Input::Touching ? 1:0; + frame.TouchX = Input::TouchX; + frame.TouchY = Input::TouchY; + // TODO: other shit! (some hotkeys for example?) InputQueue.push(frame); @@ -884,6 +892,9 @@ void ProcessInput() // apply this input frame if (frame.KeyMask != 0xFFF) printf("[%08d] INPUT=%08X (%08d) (backlog=%d)\n", NDS::NumFrames, frame.KeyMask, frame.FrameNum, InputQueue.size()); NDS::SetKeyMask(frame.KeyMask); + if (frame.Touching) NDS::TouchScreen(frame.TouchX, frame.TouchY); + else NDS::ReleaseScreen(); + InputQueue.pop(); } diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp index 8a0d0013..32911cb8 100644 --- a/src/frontend/qt_sdl/main.cpp +++ b/src/frontend/qt_sdl/main.cpp @@ -479,6 +479,8 @@ void EmuThread::run() else { NDS::SetKeyMask(Input::InputMask); + if (Input::Touching) NDS::TouchScreen(Input::TouchX, Input::TouchY); + else NDS::ReleaseScreen(); } if (Input::HotkeyPressed(HK_Lid)) @@ -923,7 +925,7 @@ void ScreenHandler::screenOnMousePress(QMouseEvent* event) if (Frontend::GetTouchCoords(x, y, false)) { touching = true; - NDS::TouchScreen(x, y); + Input::TouchScreen(x, y); } } @@ -935,7 +937,7 @@ void ScreenHandler::screenOnMouseRelease(QMouseEvent* event) if (touching) { touching = false; - NDS::ReleaseScreen(); + Input::ReleaseScreen(); } } @@ -952,7 +954,7 @@ void ScreenHandler::screenOnMouseMove(QMouseEvent* event) int y = event->pos().y(); if (Frontend::GetTouchCoords(x, y, true)) - NDS::TouchScreen(x, y); + Input::TouchScreen(x, y); } void ScreenHandler::screenHandleTablet(QTabletEvent* event) @@ -970,14 +972,14 @@ void ScreenHandler::screenHandleTablet(QTabletEvent* event) if (Frontend::GetTouchCoords(x, y, event->type()==QEvent::TabletMove)) { touching = true; - NDS::TouchScreen(x, y); + Input::TouchScreen(x, y); } } break; case QEvent::TabletRelease: if (touching) { - NDS::ReleaseScreen(); + Input::ReleaseScreen(); touching = false; } break; @@ -1003,14 +1005,14 @@ void ScreenHandler::screenHandleTouch(QTouchEvent* event) if (Frontend::GetTouchCoords(x, y, event->type()==QEvent::TouchUpdate)) { touching = true; - NDS::TouchScreen(x, y); + Input::TouchScreen(x, y); } } break; case QEvent::TouchEnd: if (touching) { - NDS::ReleaseScreen(); + Input::ReleaseScreen(); touching = false; } break;