fix pissfucking touchscreen (again)

This commit is contained in:
Arisotura 2021-08-08 14:45:16 +02:00
parent 2df6b4fdc3
commit bba14b2bb0
4 changed files with 21 additions and 21 deletions

View File

@ -342,7 +342,7 @@ void SetupDirectBoot()
if (ConsoleType == 1)
{
// With the BIOS select in SCFG_BIOS and the initialization od
// SCFG_BIOS depending on the Header->UnitType, we can now boot
// SCFG_BIOS depending on the Header->UnitType, we can now boot
// directly in the roms.
// There are some more SCFG Settings that change depending on
// the unit type, so this is experimental

View File

@ -156,7 +156,7 @@ int GetScreenTransforms(float* out, int* kind);
// de-transform the provided host display coordinates to get coordinates
// on the bottom screen
bool GetTouchCoords(int& x, int& y);
bool GetTouchCoords(int& x, int& y, bool clamp);
// initialize the audio utility

View File

@ -467,31 +467,31 @@ int GetScreenTransforms(float* out, int* kind)
return num;
}
bool GetTouchCoords(int& x, int& y)
bool GetTouchCoords(int& x, int& y, bool clamp)
{
float vx = x;
float vy = y;
if (BotEnable)
{
float vx = x;
float vy = y;
M23_Transform(TouchMtx, vx, vy);
x = (int)vx;
y = (int)vy;
if (vx >= 0 && vx < 256 && vy >= 0 && vy < 192)
return true;
}
else if (HybEnable && HybScreen == 1)
{
float vx = x;
float vy = y;
M23_Transform(HybTouchMtx, vx, vy);
}
x = (int)vx;
y = (int)vy;
x = (int)vx;
y = (int)vy;
if (clamp)
{
x = std::clamp(x, 0, 255);
y = std::clamp(y, 0, 191);
return true;
}
else
{
if (x >= 0 && x < 256 && y >= 0 && y < 192)
return true;
}

View File

@ -783,7 +783,7 @@ void ScreenHandler::screenOnMousePress(QMouseEvent* event)
int x = event->pos().x();
int y = event->pos().y();
if (Frontend::GetTouchCoords(x, y))
if (Frontend::GetTouchCoords(x, y, false))
{
touching = true;
NDS::TouchScreen(x, y);
@ -814,7 +814,7 @@ void ScreenHandler::screenOnMouseMove(QMouseEvent* event)
int x = event->pos().x();
int y = event->pos().y();
if (Frontend::GetTouchCoords(x, y))
if (Frontend::GetTouchCoords(x, y, true))
NDS::TouchScreen(x, y);
}
@ -830,7 +830,7 @@ void ScreenHandler::screenHandleTablet(QTabletEvent* event)
int x = event->x();
int y = event->y();
if (Frontend::GetTouchCoords(x, y))
if (Frontend::GetTouchCoords(x, y, event->type()==QEvent::TabletMove))
{
touching = true;
NDS::TouchScreen(x, y);
@ -861,7 +861,7 @@ void ScreenHandler::screenHandleTouch(QTouchEvent* event)
int x = (int)lastPosition.x();
int y = (int)lastPosition.y();
if (Frontend::GetTouchCoords(x, y))
if (Frontend::GetTouchCoords(x, y, event->type()==QEvent::TouchUpdate))
{
touching = true;
NDS::TouchScreen(x, y);