I discovered Frozen Bubble and remembered that I had an unused
joystick (a USB clone of the legendary Competition Pro) sitting on
the shelf.  Unfortunately, in the Change Keys menu, I can only
configure joy-left and joy-up.  The joy-right and joy-down actions
are simply ignored.

Running testjoystick.c from SDL 1.2.15 and moving the stick around
shows this:

Joystick has 2 axes, 0 hats, 0 balls, and 4 buttons
Joystick 3 axis 0 value: -32768
Joystick 3 axis 0 value: 0
Joystick 3 axis 0 value: 32512
Joystick 3 axis 0 value: 0
Joystick 3 axis 1 value: -32768
Joystick 3 axis 1 value: 0
Joystick 3 axis 1 value: 32512
Joystick 3 axis 1 value: 0

This explains what's going on in frozen-bubble; translate_joystick_tokey()
has this check:

        if ($value <= -32767 || $value >= 32767) {  #- theoretically, it should 
work properly with analog joysticks this way
            return "joystick|axisvalue|$which|$axis|$value";
        } else {
            return "joystick|axisvalue|$which|$axis|0";
        }

Commenting out the if and always executing the first return allows
me to use my joystick with frozen-bubble.  Alas, I don't know
anything about joysticks or SDL's support for them.  I have no idea
how that change affects other joysticks... for all I know the values
mine generates are simply wrong.

Any ideas?


--- frozen-bubble.orig  Sat May 14 18:57:17 2016
+++ frozen-bubble       Sat May 14 18:57:36 2016
@@ -2925,11 +2925,11 @@
     if ($event->type == fb_c_stuff::JOYAXISMOTION()) {
         my $axis = SDL::JoyAxisEventAxis(evt($event));
         my $value = fb_c_stuff::JoyAxisEventValue(evt($event));
-        if ($value <= -32767 || $value >= 32767) {  #- theoretically, it 
should work properly with analog joysticks this way
+#        if ($value <= -32767 || $value >= 32767) {  #- theoretically, it 
should work properly with analog joysticks this way
             return "joystick|axisvalue|$which|$axis|$value";
-        } else {
-            return "joystick|axisvalue|$which|$axis|0";
-        }
+#        } else {
+#            return "joystick|axisvalue|$which|$axis|0";
+#        }
     } elsif ($event->type() == fb_c_stuff::JOYBUTTONDOWN()) {
         my $button = SDL::JoyButtonEventButton(evt($event)) + 1;
         return "joystick|buttondown|$which|$button";
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to