You are not logged in.

Read the FAQ and Knowledge Base before posting.
We won't make a 3DS/2DS emulator.



#1 2013-10-27 22:17:44

rmartins
Member
Registered: 2013-10-20
Posts: 5

[GTK] Patch for "Dual touch" (touching two things at the same time)

Hello! I was stuck on Hotel Dusk because of the whole "touching two things at once" problem since the GTK frontend has no "Frame Advance" button, and decided to try to fix this. The solution mentioned on the wiki is kinda ugly but thankfully it explains how it *should* work, so I managed to make a patch that makes things a little better. Just hold SHIFT to move the first switch (the pointer should stay there after you release) and then move the second switch WITHOUT shift. The system will think you are actually touching the middle between the two points and it will work. The patch is below. Please keep in mind I only tested it with the electric switches on Hotel Dusk. In case anyone else wants to try, I'm also linking a save state for that. As a revenge for the fact that the GTK version is always lagging behind in features, I will not provide a windows solution (bullshit; I never programmed for windows in my life and hopefully never will, so I have no idea how to do it).
Hope it helps!

Save state: http://www.sendspace.com/file/qamyby

Index: src/gtk/main.cpp
===================================================================
--- src/gtk/main.cpp	(revision 4811)
+++ src/gtk/main.cpp	(working copy)
@@ -1331,6 +1331,8 @@
 
 /////////////////////////////// KEYS AND STYLUS UPDATE ///////////////////////////////////////
 
+gint held_x = -1, held_y = -1;
+
 static gboolean rotoscaled_touchpos(gint x, gint y, gboolean start)
 {
     u16 EmuX, EmuY;
@@ -1358,6 +1360,14 @@
 
     LOG("X=%d, Y=%d\n",x,y);
 
+    if (gdk_shift_pressed) {
+        held_x = X;
+        held_y = Y;
+    } else if (held_x > -1 && held_y > -1) {
+        X = (abs(X - held_x) / 2) + std::min(X, held_x);
+        Y = (abs(Y - held_y) / 2) + std::min(Y, held_y);
+    }
+
     if (!start || (X >= 0 && Y >= 0 && X < 256 && Y < 192)) {
         EmuX = CLAMP(X, 0, 255);
         EmuY = CLAMP(Y, 0, 191);
@@ -1416,6 +1426,9 @@
 }
 static gboolean Stylus_Release(GtkWidget *w, GdkEventButton *e, gpointer data)
 {
+    if (gdk_shift_pressed) return FALSE;
+    held_x = -1;
+    held_y = -1;
     if(click) NDS_releaseTouch();
     click = FALSE;
     return TRUE;

Dell System Vostro 3450 / Linux 3.10-2-amd64 Debian 3.10.7-1 x86_64
Intel(R) Core(TM) i7-2640M CPU @ 2.80GHz (4 cores)
MemTotal: 6022396 kB

Offline

Board footer

Powered by FluxBB