--- src-stormbaancoureur/controllerpad.cxx.orig Mon Jul 17 00:26:08 2006 +++ src-stormbaancoureur/controllerpad.cxx Mon Jul 17 00:28:23 2006 @@ -14,7 +14,6 @@ #include #include #else -#include #include // for ioctl() #include // for close() #include // for perror() @@ -81,100 +80,7 @@ accel_axis(-1), accel_button(-1) { -#ifdef WIN32 - JOYINFOEX joyinfo; - JOYCAPS joycaps; - MMRESULT result; - int axisCounter; - - id = 0; - - joyinfo.dwSize = sizeof(joyinfo); - joyinfo.dwFlags = JOY_RETURNALL; - - result = joyGetPosEx(id, &joyinfo); - if(result != JOYERR_NOERROR) { - fprintf(stderr, "No input devices found\n"); - return; - } - else { - result = joyGetDevCaps(id, &joycaps, sizeof(joycaps)); - if(result != JOYERR_NOERROR) { - fprintf(stderr, "No input devices found\n"); - return; - } - } - - opened = true; - - fprintf(stderr, "x min %d max %d\n", joycaps.wXmin, joycaps.wXmax); - buttoncount = joycaps.wNumButtons; - axiscount = joycaps.wNumAxes; -#else - fd = open(devfile.c_str(), O_RDONLY | O_NONBLOCK); - if (fd==-1) - { - if (errno != ENODEV) - perror("open() on joystick device failed"); - return; - } - opened = true; - - int retval; - - int version; - retval = ioctl(fd, JSIOCGVERSION, &version); - if (retval == -1) - perror("ioctl JSIOCGVERSION failed"); - - unsigned char lo = version; - unsigned char md = (version>>8); - unsigned char hi = (version>>16); - - retval = ioctl(fd, JSIOCGAXES, &axiscount); - if (retval == -1) - perror("ioctl JSIOCGAXES failed"); - - retval = ioctl(fd, JSIOCGBUTTONS, &buttoncount); - if (retval == -1) - perror("ioctl JSIOCGBUTTONS failed"); - - char n[128]; - retval = ioctl(fd, JSIOCGNAME(128), n); - if (retval == -1) - perror("ioctl JSIOCGNAME failed"); - - name = n; - fprintf(stderr,"joystick name: %s\n", name.c_str()); - fprintf(stderr,"driver version: %d.%d.%d\n", hi,md,lo); - fprintf(stderr,"button count: %d, axiscount: %d\n", buttoncount, axiscount); -#endif - - // search db - assert(sizeof(joydb_names) == sizeof(joydb_descs)); - int cnt = sizeof(joydb_names) / sizeof(void *) - 1; - for (int i=0; i0); -#endif }