comparison src/joystick/os2/SDL_sysjoystick.c @ 1442:e3242177fe4a

Updated OS/2 build, yay!
author Sam Lantinga <slouken@libsdl.org>
date Sun, 26 Feb 2006 19:30:21 +0000
parents d910939febfa
children 92947e3a18db
comparison
equal deleted inserted replaced
1441:b9f034536fa0 1442:e3242177fe4a
30 #define INCL_DOSMEMMGR 30 #define INCL_DOSMEMMGR
31 #include <os2.h> 31 #include <os2.h>
32 #include "joyos2.h" 32 #include "joyos2.h"
33 33
34 #include "SDL_joystick.h" 34 #include "SDL_joystick.h"
35 #include "SDL_events.h"
35 #include "../SDL_sysjoystick.h" 36 #include "../SDL_sysjoystick.h"
36 #include "../SDL_joystick_c.h" 37 #include "../SDL_joystick_c.h"
37 38
38 HFILE hJoyPort = NULL; /* Joystick GAME$ Port Address */ 39 HFILE hJoyPort = NULL; /* Joystick GAME$ Port Address */
39 #define MAX_JOYSTICKS 2 /* Maximum of two joysticks */ 40 #define MAX_JOYSTICKS 2 /* Maximum of two joysticks */
48 #define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/256) 49 #define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/256)
49 /* Calc Button Flag for buttons A to D */ 50 /* Calc Button Flag for buttons A to D */
50 #define JOY_BUTTON_FLAG(n) (1<<n) 51 #define JOY_BUTTON_FLAG(n) (1<<n)
51 52
52 /* Joystick data... hold information about detected devices */ 53 /* Joystick data... hold information about detected devices */
53 struct _SYS_JoyData 54 typedef struct SYS_JoyData_s
54 { 55 {
55 Sint8 id; // Device ID 56 Sint8 id; // Device ID
56 char szDeviceName[MAX_JOYNAME]; // Device Name 57 char szDeviceName[MAX_JOYNAME]; // Device Name
57 char axes; // Number of axes 58 char axes; // Number of axes
58 char buttons; // Number of buttons 59 char buttons; // Number of buttons
60 char balls; // Number of buttons 61 char balls; // Number of buttons
61 int axes_min[MAX_AXES]; // minimum callibration value for axes 62 int axes_min[MAX_AXES]; // minimum callibration value for axes
62 int axes_med[MAX_AXES]; // medium callibration value for axes 63 int axes_med[MAX_AXES]; // medium callibration value for axes
63 int axes_max[MAX_AXES]; // maximum callibration value for axes 64 int axes_max[MAX_AXES]; // maximum callibration value for axes
64 int buttoncalc[4]; // Used for buttons 5, 6, 7 and 8. 65 int buttoncalc[4]; // Used for buttons 5, 6, 7 and 8.
65 } SYS_JoyData[MAX_JOYSTICKS]; 66 } SYS_JoyData_t, *SYS_JoyData_p;
67
68 SYS_JoyData_t SYS_JoyData[MAX_JOYSTICKS];
66 69
67 70
68 /* Structure used to convert data from OS/2 driver format to SDL format */ 71 /* Structure used to convert data from OS/2 driver format to SDL format */
69 struct joystick_hwdata 72 struct joystick_hwdata
70 { 73 {
290 SYS_JoyData[0].axes_max[1] = stGameCalib.By.upper; 293 SYS_JoyData[0].axes_max[1] = stGameCalib.By.upper;
291 } 294 }
292 } 295 }
293 /* Hack to define Joystick Port Names */ 296 /* Hack to define Joystick Port Names */
294 if ( numdevs > maxdevs ) numdevs = maxdevs; 297 if ( numdevs > maxdevs ) numdevs = maxdevs;
295 for (i=0; i<numdevs; i++) { 298 for (i=0; i<numdevs; i++)
296 SDL_snprintf (SYS_JoyData[i].szDeviceName, SDL_arraysize(szDeviceName), "Default Joystick %c", 'A'+SYS_JoyData[i].id); 299 SDL_snprintf (SYS_JoyData[i].szDeviceName, SDL_arraysize(SYS_JoyData[i].szDeviceName), "Default Joystick %c", 'A'+SYS_JoyData[i].id);
297 } 300
301 }
298 } 302 }
299 /* Return the number of devices found */ 303 /* Return the number of devices found */
300 return(numdevs); 304 return(numdevs);
301 } 305 }
302
303 306
304 307
305 /***********************************************************/ 308 /***********************************************************/
306 /* Function to get the device-dependent name of a joystick */ 309 /* Function to get the device-dependent name of a joystick */
307 /***********************************************************/ 310 /***********************************************************/