/* VMSJOYSTICK.H - VMS-specific GLUT routines to handle the joystick Copyright (c); Hewlett-Packard Corporation 2002 */ #ifndef __vmsjoystick_h #define __vmsjoystick_h 1 /*****************************************************************/ /* /* The following lines are included from [USB]AGDEF.H (X-6) since /* it doesn't ship on the VMS disk (should put it in examples). /* /* Note that our GLUT stuff is included at the end of this file /* /* /*****************************************************************/ #ifndef __AGDEF_LOADED #define __AGDEF_LOADED 1 #pragma __nostandard /* This file uses non-ANSI-Standard features */ #pragma __member_alignment __save #pragma __nomember_alignment #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __save /* Save the previously-defined required ptr size */ #pragma __required_pointer_size __short /* And set ptr size default to 32-bit pointers */ #endif #ifdef __cplusplus extern "C" { #define __unknown_params ... #define __optional_params ... #else #define __unknown_params #define __optional_params ... #endif #ifndef __struct #if !defined(__VAXC) #define __struct struct #else #define __struct variant_struct #endif #endif #ifndef __union #if !defined(__VAXC) #define __union union #else #define __union variant_union #endif #endif /* */ /* AGDRIVER supports the following function codes: */ /* */ /* IO$_READVBLK Read virtual block */ /* IO$_READLBLK Read logical block */ /* IO$_READPBLK Read physical block */ /* */ /* p1 Address of data buffer */ /* p2 Size of buffer in bytes */ /* */ /* Read formated data from the device driver makes no distinction */ /* between Virtual, Logical and physical I/O requests. The */ /* data structure JOYSTICK_INPUT_FRAME defines the size and */ /* format of the data. Applications should check the type and */ /* version number to make sure they are reading and decoding the */ /* data correctly. */ /* */ /* IO$_WRITEVBLK Write virtual block */ /* IO$_WRITELBLK Write logical block */ /* IO$_WRITEPBLCK Write physical block */ /* */ /* p1 Address of data buffer to write */ /* p2 Size in bytes */ /* */ /* This command will support writing a block of bytes to the joystick it */ /* the device supports it. If the driver does not support it you will get */ /* an error of SS$_UNSPPORTED. The user should assume that the data has */ /* been sent when control is returned. The actual write may be in transit */ /* and repeated attempts to write data without allowing time for the */ /* device to respond will result in the last write being honored. The */ /* driver supports message in flight to the device and one pending. */ /* */ /* IO$_SETMODE IO FUNCTION CODES (in P1) */ /* */ /* p1 Function code */ /* */ /* JOYSTICK_IO_SET_EFN_NOTIFY = 1 */ /* - P2 = EFN number */ /* */ /* JOYSTICK_IO_SET_AST_NOTIFY = 2 */ /* - P3 = AST routine address */ /* */ /* JOYSTICK_IO_SET_ASTEFN_NOTIFY = 3 */ /* - P2 = EFN number */ /* - P3 = AST routine address */ /* */ /* JOYSTICK_IO_CLEAR_EFN_NOTIFY = 16 */ /* JOYSTICK_IO_CLEAR_AST_NOTIFY = 32 */ /* JOYSTICK_IO_CLEAR_ALL_NOTIFY = 48 */ /* */ /* JOYSTICK_IO_SET_CALIBRATION_DATA = 256 */ /* - P2 = Limit data structure */ /* - P3 = Structure length */ /* */ /* p2 EFN number */ /* LIMIT Data address */ /* */ /* p3 AST routine address */ /* LIMIT Data length */ /* */ /* p4 ast parameter */ /* */ /* p5 mode, default = PSL$C_USER */ /* */ /* p6 Not used */ /* */ /* P1 determines the type of operation. Motion/Button state change */ /* notification can be done via AST or by EFN. These can be set and */ /* cleared individually, or at the same time (you can't clear one and */ /* set the other in the same IO function call). */ /* */ /* SET_CALIBRATION_DATA takes a JOYSTICK_LIMIT_DATA structure address */ /* as input in P2 and the length in P3. The calibration fields in */ /* the per-axis structures are copied if the valid bit is set. This */ /* will be returned to the user in the SENSEMODE IO call. */ /* */ #define JOYSTICK_IO_NOOP 0 #define JOYSTICK_IO_SET_EFN_NOTIFY 1 #define JOYSTICK_IO_SET_AST_NOTIFY 2 #define JOYSTICK_IO_SET_ASTEFN_NOTIFY 3 #define JOYSTICK_IO_CLEAR_EFN_NOTIFY 16 #define JOYSTICK_IO_CLEAR_AST_NOTIFY 32 #define JOYSTICK_IO_CLEAR_ALL_NOTIFY 48 #define JOYSTICK_IO_SET_CALIBRATION_DATA 256 /* */ /* Currently we will only sense limit data */ /* */ #define JOYSTICK_IO_SENSE_LIMIT_DATA 1 #define MAX_JOYSTICK_BUTTONS 64 #define MAX_JOYSTICK_XYZH 32 #define JOYSTICK_INPUT_FRAME_TYPE 5 #define JOYSTICK_INPUT_FRAME_VERSION 4 #define JOYSTICK_INPUT_FRAME_MINOR_REV 1 /* */ /* This structure provides input data from the device */ /* */ /* Buttons are aggregated into a longword */ /* */ /* Axis and Hat switches are returned in integer arrays, */ /* since there can potentially be multiple instances of */ /* an Axis type. */ /* */ /* A timestamp is provided by storing the value of */ /* EXE$GQ_SYSTIME when the event is being generated. */ /* This allows the user to do motion calculations */ /* and acelleration if they want. */ /* */ /* To interpret the data, you first should do a sensemode */ /* to get the limit data (see below) which will then provide */ /* a way to interpret the data. */ /* */ /* No attempt is made to normalize or massage the data in */ /* the driver, except for the aggregation of individual */ /* button reports into a single field. Nothing that the */ /* driver might do would be the "right" thing for all apps, */ /* and by doing anything, some apps might not be able to */ /* do what they need. Nor is any time wasted in providing */ /* both normalized and raw data - since the application will */ /* have all it needs to simply normalize the data itself. */ /* */ /* NOTE: Signed values in all the fields will be sign */ /* extended to 32-bits for convenience. This doesn't */ /* change the data (the original data can still be masked */ /* out of the reported data) - but makes library code */ /* conversions slighly simpler. */ /* */ /* A version value is included for checking for incompatable */ /* changes, and a minor ident handles compatable changes */ /* */ /* */ typedef struct _joystick_input_frame { int size; int type; int version; int minor; int vendor_id; /* USB vendor ID */ int product_id; /* USB product ID */ unsigned __int64 timestamp; /* VMS time for event */ unsigned __int64 button_state; /* Button State Aggregate */ int hat [32]; /* Hat switch */ int x [32]; /* X */ int y [32]; /* Y */ int z [32]; /* Z */ int rx [32]; /* Rotational X */ int ry [32]; /* Rotational Y */ int rz [32]; /* Rotational Z */ int vx [32]; /* Vector X */ int vy [32]; /* Vector Y */ int vz [32]; /* Vector Z */ int vbrx [32]; /* Vector Base Relative X */ int vbry [32]; /* Vector Base Relative Y */ int vbrz [32]; /* Vector Base Relative Z */ int vno [32]; /* Non Directional Vector */ int slider [32]; /* Slider Control */ int dial [32]; /* Dial Control */ int wheel [32]; /* Wheel Control */ int extras [64]; /* Some extra space for expansion later */ } JOYSTICK_INPUT_FRAME; #define JOYSTICK_BASE_FRAME_SIZE 2472 #define JOYSTICK_MAX_FRAME_SIZE 4944 /* */ /* This structure describes an Axis or Hat switch. */ /* */ /* A count describe how many instances of the Axis type */ /* exist. The rest of the data each is an array to allow */ /* each instance to be described. */ /* */ /* The flag word provides fine grain detail about which */ /* fields in the axis data are valid. A field that is */ /* not reported returns a -1. But since some of the */ /* fields are user-settable, or might be ambiguous (like */ /* a sign extended logical/physical value) - applications */ /* or library code can use this to determine which fields */ /* it can rely on. */ /* */ /* The values returned are desribed by the min/max/size */ /* fields which provide the logical min, logical max, and */ /* size in bits of the field. So a 10 bit axis would have */ /* min = 0, max = 1023, size = 10 - for data thaat responds */ /* with unsigned data. It also could have -511, 511, 10 for */ /* signed return values. This descibes the data that will */ /* actually be returned in the frame data report (above). */ /* */ /* Calibration data is provided here. Normally the data is */ /* zero in the driver, and is set by a SETMODE by an */ /* application to provide the end application/library the */ /* information to compensate for devices (typically analog */ /* inputs) which are "off" at their center points and at */ /* their full range of travel. The input data (logical */ /* value) can then be adjusted. The driver makes no attempt */ /* to do this, and leaves this to application/library code */ /* to handle. */ /* */ /* Physical min/max and unit/unit exponent: */ /* */ /* See 6.2.2.7 of the HID 1.11 spec for specifics on physical */ /* logical, and unit calculations. */ /* */ /* Resolution = (Logical_Max - Logical_Min) / */ /* (Physical_Max - Physical_Min) * (10 ** Unit_Exponent) */ /* */ /* If I read the table correctly (and it is far from clearly */ /* stated) the UNIT is determined by viewing the low order */ /* 4 bits as the SYSTEM and the upper 4 bits to derive a */ /* description of the physical units. With the system codes */ /* 0x5 - 0xE having special meanings, and 0xF being vendor */ /* defined. */ /* */ /* Note that PHYSICAL and UNIT/UNIT_E values are optional */ /* and may be zero. */ /* */ /* */ typedef struct _joystick_axis_instance { unsigned int flags; /* Axis flags */ int min; /* Logical minimum */ int max; /* Logical maximum */ int size; /* Bit field size */ int pmin; /* Physical minimum */ int pmax; /* Physical maximum */ int unit; /* Units code */ int unit_e; /* Unit exponent */ int center_off; /* Calibration center offset */ int cmin; /* Calibration min */ int cmax; /* Calibration max */ } JOYSTICK_AXIS_INSTANCE; /* */ /* Flag bits */ /* */ /* Note that min/max/size are always valid for a valid axis */ /* Axes are always populated from 0 to MAX_JOYSTICK_XYZH so */ /* there is no need to explicitly indicate an axis is valid */ /* A non-zero count makes axes 0 through (count-1) valid. */ /* */ #define JOYSTICK_AXIS_SIGNED 1 /* Axis returns signed data */ #define JOYSTICK_AXIS_PMIN_VALID 16 /* PHYSICAL MIN Valid */ #define JOYSTICK_AXIS_PMAX_VALID 32 /* PHYSICAL MAX Valid */ #define JOYSTICK_AXIS_UNIT_VALID 64 /* UNIT Valid */ #define JOYSTICK_AXIS_UNIT_E_VALID 128 /* UNIT EXPONENT Valid */ #define JOYSTICK_AXIS_CENTER_OFF_VALID 256 /* CENTER OFFSET Valid */ #define JOYSTICK_AXIS_CMIN_VALID 512 /* CALIBRATION MIN Valid */ #define JOYSTICK_AXIS_CMAX_VALID 1024 /* CALIBRATION MAX Valid */ /* */ /* The complete structure is an array of axes and */ /* the count */ /* */ typedef struct _joystick_axis_info { int count; /* Number of valid axes */ JOYSTICK_AXIS_INSTANCE axis [32]; } JOYSTICK_AXIS_INFO; #define JOYSTICK_LIMIT_DATA_TYPE 6 #define JOYSTICK_LIMIT_DATA_VERSION 4 #define JOYSTICK_LIMIT_DATA_MINOR_REV 1 /* */ /* This structure describes the parts of the joystick/gamepad */ /* For Axis and Hat switches, there is a structure that contains */ /* the number of instances, and then arrays for each instance */ /* that contain the length of the field in bits, the logical */ /* and physical limits of the device, the units code, and the */ /* units exponent (which can be used to turn a logical value */ /* into something meaningful, like 10 degrees, or 3 inches, */ /* or 42 grams). */ /* */ /* Buttons in the data field are aggregated and packed into */ /* a longword and the count is provided here. */ /* */ /* The number of available axes are also provided as a */ /* shortcut to having to go through each axis to add the */ /* counts. */ /* */ /* The vendor and product ID is provided for special casing */ /* devices in code */ /* */ /* The version/minor codes allow for detection of binary */ /* incompatable versions, as well as upward binary compatable */ /* feature additions. Additional cells are provided at the */ /* end for use by extended features (when they are used, and */ /* the first part of the structure is unmodified, roll the */ /* minor version value). */ /* */ /* Lastly, there is a minimal section for potential user */ /* writes to the device. It is generalized, so the caller */ /* has to know about the USB device and HID/USB requests. */ /* */ #define JOYSTICK_OUTPUT_AVAILABLE 1 #define JOYSTICK_OUTPUT_NOTAVAILABLE 0 typedef struct _joystick_limit_data { int size; int type; int version; int minor; int vendor_id; int product_id; unsigned __int64 button_valid; /* Bits that are valid */ int button_count; /* Number of buttons */ int num_axes; /* Number of Axes */ JOYSTICK_AXIS_INFO hat; /* Hat switch */ JOYSTICK_AXIS_INFO x; /* X Axis */ JOYSTICK_AXIS_INFO y; /* Y Axis */ JOYSTICK_AXIS_INFO z; /* Z Axis */ JOYSTICK_AXIS_INFO rx; /* RX Axis */ JOYSTICK_AXIS_INFO ry; /* RY Axis */ JOYSTICK_AXIS_INFO rz; /* RZ Axis */ JOYSTICK_AXIS_INFO vx; /* VX Axis */ JOYSTICK_AXIS_INFO vy; /* VY Axis */ JOYSTICK_AXIS_INFO vz; /* VZ Axis */ JOYSTICK_AXIS_INFO vbrx; /* VBRX Axis */ JOYSTICK_AXIS_INFO vbry; /* VBRY Axis */ JOYSTICK_AXIS_INFO vbrz; /* VBRZ Axis */ JOYSTICK_AXIS_INFO vno; /* VNO Axis */ JOYSTICK_AXIS_INFO slider; /* SLIDER */ JOYSTICK_AXIS_INFO wheel; /* WHEEL */ JOYSTICK_AXIS_INFO dial; /* DIAL */ int extras_longs [32]; /** */ /** */ /** This section reports a minimum of data for devices that support */ /** output. So far in our limited testing all output devices are vendor */ /** specific. So for the time being we will just report the useage page */ /** type and the maximum number of bytes that can be sent down the pipe. */ /** */ /** Note that usage page values from ff00 - ffff are vendor */ /** defined. */ /** */ /** */ int output_available; int output_max_bytes; int output_item_usage_page; } JOYSTICK_LIMIT_DATA; #define JOYSTICK_LIMIT_DATA_SIZE 24184 #pragma __member_alignment __restore #ifdef __INITIAL_POINTER_SIZE /* Defined whenever ptr size pragmas supported */ #pragma __required_pointer_size __restore /* Restore the previously-defined required ptr size */ #endif #ifdef __cplusplus } #endif #pragma __standard #endif /* __AGDEF_LOADED */ /*****************************************************************/ /* /* End of the AGDEF.H inclusion /* /*****************************************************************/ #define JOYSTICK_SCALE_ENABLE 0x01 #define JOYSTICK_SCALE_CENTER 0x02 #define JOYSTICK_SCALE_INVERT 0x04 typedef struct _joystick_scale { int flags; /* Scaling bits */ int range; /* Original range value */ int out_range; /* Adjusted output range factor */ int in_range; /* Adjusted input range factor */ int min; /* Min */ int max; /* Max */ int invert; } JOYSTICK_SCALE; #define JOYSTICK_LOGITECH_VENDOR_ID 1103 #define JOYSTICK_LOGITECH_THRUSTMASTER 45313 #define JOYSTICK_LOGITECH_VENDOR_ID_2 1133 #define JOYSTICK_LOGITECH_STEERING_W 49678 #define JOYSTICK_SAITEK_VENDOR_ID 1699 #define JOYSTICK_CYBORG_EVO_WIRELESS 13630 #define JOYSTICK_X45 1340 #define JOYSTICK_MICROSOFT_VENDOR_ID 1118 #define JOYSTICK_MICROSOFT_JOYSTICK 8 #define JOYSTICK_GRAVIS_VENDOR_ID 1149 #define JOYSTICK_GRAVIS_GAMEPAD 16389 #define JOYSTICK_UNKNOWN_VENDOR 0 #define JOYSTICK_UNKNOWN_PRODUCT 0 /* * The bits here are dual-use, they are used to * describe which axis to map to one of the "standard" * axis. The are also used to tell the user * which of the standard 5 axis are valid. */ #define JOYSTICK_NO_AXIS 0x00000 #define JOYSTICK_X_AXIS 0x00001 #define JOYSTICK_Y_AXIS 0x00002 #define JOYSTICK_Z_AXIS 0x00004 #define JOYSTICK_RX_AXIS 0x00008 #define JOYSTICK_RY_AXIS 0x00010 #define JOYSTICK_RZ_AXIS 0x00020 #define JOYSTICK_VX_AXIS 0x00040 #define JOYSTICK_VY_AXIS 0x00080 #define JOYSTICK_VZ_AXIS 0x00100 #define JOYSTICK_VBRZ_AXIS 0x00200 #define JOYSTICK_VBRX_AXIS 0x00400 #define JOYSTICK_VBRY_AXIS 0x00800 #define JOYSTICK_VNO_AXIS 0x01000 #define JOYSTICK_SLIDER_AXIS 0x02000 #define JOYSTICK_WHEEL_AXIS 0x04000 #define JOYSTICK_DIAL_AXIS 0x08000 #define JOYSTICK_THROTTLE_AXIS 0x10000 #define JOYSTICK_DEF_INVERT_X 0x01 #define JOYSTICK_DEF_INVERT_Y 0x02 #define JOYSTICK_DEF_INVERT_Z 0x04 #define JOYSTICK_DEF_INVERT_RZ 0x08 #define JOYSTICK_DEF_INVERT_THROTTLE 0x10 #define JOYSTICK_DEF_BUTTON_MAP 0x20 #define JOYSTICK_DEF_FULL_SCALE 0x40 #define JOYSTICK_DEF_PERMANENT 0 /* Block wasn't malloc'd */ #define JOYSTICK_DEF_DYNAMIC 1 /* Block was malloc'd */ typedef struct _joystick_definition { int dynamic; /* Block was malloc'd */ int vendor_id; /* USB vendor ID */ int product_id; /* USB product ID */ char vendor_name[80]; /* Vendor Name */ char product_name[80]; /* Product Name */ int flags; /* Flags */ int x_map[2]; /* Which axis is X */ int y_map[2]; /* Which axis is Y */ int z_map[2]; /* Which axis is Z */ int rz_map[2]; /* Which axis is RZ */ int throttle_map[2]; /* Which axis is Throttle */ int button_map_count; /* Button remap count */ char button_map[32]; /* Button map */ } JOYSTICK_DEFINITION; static JOYSTICK_DEFINITION saitek_evo_record = { JOYSTICK_DEF_PERMANENT, JOYSTICK_SAITEK_VENDOR_ID, JOYSTICK_CYBORG_EVO_WIRELESS, "Saitek", "Cyborg EVO Wireless", 0, {JOYSTICK_X_AXIS, 0}, /* X */ {JOYSTICK_Y_AXIS, 0}, /* Y */ {JOYSTICK_NO_AXIS, 0}, /* Z */ {JOYSTICK_RZ_AXIS, 0}, /* RZ */ {JOYSTICK_Z_AXIS, 0}, /* Throttle */ {0} }; static JOYSTICK_DEFINITION saitek_x45_record = { JOYSTICK_DEF_PERMANENT, JOYSTICK_SAITEK_VENDOR_ID, JOYSTICK_X45, "Saitek", "X45 Flight Stick", JOYSTICK_DEF_FULL_SCALE, {JOYSTICK_X_AXIS, 0}, /* X */ {JOYSTICK_Y_AXIS, 0}, /* Y */ {JOYSTICK_Z_AXIS, 0}, /* Z */ {JOYSTICK_RZ_AXIS, 0}, /* RZ */ {JOYSTICK_SLIDER_AXIS, 0}, /* Throttle */ {0} }; static JOYSTICK_DEFINITION microsoft_sidewinder_record = { JOYSTICK_DEF_PERMANENT, JOYSTICK_MICROSOFT_VENDOR_ID, JOYSTICK_MICROSOFT_JOYSTICK, "Microsoft", "Sidewinder", JOYSTICK_DEF_FULL_SCALE, {JOYSTICK_X_AXIS, 0}, /* X */ {JOYSTICK_Y_AXIS, 0}, /* Y */ {JOYSTICK_NO_AXIS, 0}, /* Z */ {JOYSTICK_RZ_AXIS, 0}, /* RZ */ {JOYSTICK_SLIDER_AXIS, 0}, /* Throttle */ {0} }; static JOYSTICK_DEFINITION logitech_thrustmaster_record = { JOYSTICK_DEF_PERMANENT, JOYSTICK_LOGITECH_VENDOR_ID, JOYSTICK_LOGITECH_THRUSTMASTER, "Logitech", "ThrustMaster Top Gun Afterburner", JOYSTICK_DEF_FULL_SCALE, {JOYSTICK_X_AXIS, 0}, /* X */ {JOYSTICK_Y_AXIS, 0}, /* Y */ {JOYSTICK_NO_AXIS, 0}, /* Z */ {JOYSTICK_RZ_AXIS, 0}, /* RZ */ {JOYSTICK_SLIDER_AXIS, 0}, /* Throttle */ {0} }; static JOYSTICK_DEFINITION logitech_steering_wheel_record = { JOYSTICK_DEF_PERMANENT, JOYSTICK_LOGITECH_VENDOR_ID_2, JOYSTICK_LOGITECH_STEERING_W, "Logitech", "Steering Wheel", JOYSTICK_DEF_FULL_SCALE, {JOYSTICK_X_AXIS, 0}, /* X */ {JOYSTICK_NO_AXIS, 0}, /* Y */ {JOYSTICK_NO_AXIS, 0}, /* Z */ {JOYSTICK_NO_AXIS, 0}, /* RZ */ {JOYSTICK_Y_AXIS, 0}, /* Throttle */ {0} }; static JOYSTICK_DEFINITION gravis_gamepad_record = { JOYSTICK_DEF_PERMANENT, JOYSTICK_GRAVIS_VENDOR_ID, JOYSTICK_GRAVIS_GAMEPAD, "Gravis", "Game Pad", JOYSTICK_DEF_FULL_SCALE, {JOYSTICK_X_AXIS, 0}, /* X */ {JOYSTICK_NO_AXIS, 0}, /* Y */ {JOYSTICK_NO_AXIS, 0}, /* Z */ {JOYSTICK_NO_AXIS, 0}, /* RZ */ {JOYSTICK_Y_AXIS, 0}, /* Throttle */ {0} }; static JOYSTICK_DEFINITION unknown_5_axis_joystick_record = { JOYSTICK_DEF_PERMANENT, JOYSTICK_UNKNOWN_VENDOR, JOYSTICK_UNKNOWN_PRODUCT, "Unknown", "Unknown 5 Axis Joystick", JOYSTICK_DEF_FULL_SCALE, {JOYSTICK_X_AXIS, 0}, /* X */ {JOYSTICK_Y_AXIS, 0}, /* Y */ {JOYSTICK_NO_AXIS, 0}, /* Z */ {JOYSTICK_RZ_AXIS, 0}, /* RZ */ {JOYSTICK_Z_AXIS, 0}, /* Throttle */ {0} }; static JOYSTICK_DEFINITION unknown_4_axis_joystick_record = { JOYSTICK_DEF_PERMANENT, JOYSTICK_UNKNOWN_VENDOR, JOYSTICK_UNKNOWN_PRODUCT, "Unknown", "Unknown 4 Axis Joystick", JOYSTICK_DEF_FULL_SCALE, {JOYSTICK_X_AXIS, 0}, /* X */ {JOYSTICK_Y_AXIS, 0}, /* Y */ {JOYSTICK_NO_AXIS, 0}, /* Z */ {JOYSTICK_RZ_AXIS, 0}, /* RZ */ {JOYSTICK_Z_AXIS, 0}, /* Throttle */ {0} }; static JOYSTICK_DEFINITION unknown_3_axis_joystick_record = { JOYSTICK_DEF_PERMANENT, JOYSTICK_UNKNOWN_VENDOR, JOYSTICK_UNKNOWN_PRODUCT, "Unknown", "Unknown 3 Axis Joystick", JOYSTICK_DEF_FULL_SCALE, {JOYSTICK_X_AXIS, 0}, /* X */ {JOYSTICK_Y_AXIS, 0}, /* Y */ {JOYSTICK_NO_AXIS, 0}, /* Z */ {JOYSTICK_NO_AXIS, 0}, /* RZ */ {JOYSTICK_Z_AXIS, 0}, /* Throttle */ {0} }; static JOYSTICK_DEFINITION unknown_2_axis_joystick_record = { JOYSTICK_DEF_PERMANENT, JOYSTICK_UNKNOWN_VENDOR, JOYSTICK_UNKNOWN_PRODUCT, "Unknown", "Unknown 2 Axis Joystick", JOYSTICK_DEF_FULL_SCALE, {JOYSTICK_X_AXIS, 0}, /* X */ {JOYSTICK_NO_AXIS, 0}, /* Y */ {JOYSTICK_NO_AXIS, 0}, /* Z */ {JOYSTICK_NO_AXIS, 0}, /* RZ */ {JOYSTICK_SLIDER_AXIS, 0}, /* Throttle */ {0} }; typedef struct _joystick_def_array { int max; int count; JOYSTICK_DEFINITION *info[]; } JOYSTICK_DEF_ARRAY; typedef struct _joy_context { unsigned short int channel; /* VMS IO channel number */ int polling; /* Polling mode */ int poll_interval; /* In polled mode, the time interval in ms */ unsigned int buttons; /* Formatted button mask: Hat in upper 8 bits, 24 buttons in low bits */ unsigned int hat; /* Hat switch */ int x; /* Scaled X output */ int y; /* Scaled Y output */ int z; /* Scaled Z output */ int rz; /* Scaled RZ output */ int throttle; /* Scaled throttle output */ unsigned int old_buttons; /* Previous values for the above */ unsigned int old_hat; int old_x; int old_y; int old_z; int old_rz; int old_throttle; JOYSTICK_SCALE x_scale; /* X Scaling information */ JOYSTICK_SCALE y_scale; /* Y Scaling information */ JOYSTICK_SCALE z_scale; /* Z Scaling information */ JOYSTICK_SCALE rz_scale; /* RZ Scaling information */ JOYSTICK_SCALE throttle_scale; /* Throttle Scaling information */ int *x_data; /* X Scaling information */ int *y_data; /* Y Scaling information */ int *z_data; /* Z Scaling information */ int *rz_data; /* RZ Scaling information */ int *throttle_data; /* Throttle Scaling information */ JOYSTICK_AXIS_INSTANCE *x_axis; /* X axis pointer */ JOYSTICK_AXIS_INSTANCE *y_axis; /* Y */ JOYSTICK_AXIS_INSTANCE *z_axis; /* Z */ JOYSTICK_AXIS_INSTANCE *rz_axis; /* RZ */ JOYSTICK_AXIS_INSTANCE *throttle_axis; /* Throttle */ void (*callback_address)(); /* Callback address */ JOYSTICK_INPUT_FRAME data; /* Raw input data from device */ JOYSTICK_LIMIT_DATA info; /* Limit data information from device */ JOYSTICK_DEF_ARRAY *joydef_array; /* Joystick definition array */ JOYSTICK_DEFINITION *joydef; /* Current joystick definition */ int axes_valid; /* Which of the 5 standard axis are valid */ char device_name[128]; /* Device name - like "AGA0" */ } JOY_CONTEXT; #define JOYSTICK_STOPPED 0 #define JOYSTICK_POLLED 1 #define JOYSTICK_ASYNC 2 /* * Declare external scope routine prototypes */ int vmsJoyGetCalibrationData( char *calib_file, JOYSTICK_LIMIT_DATA *calib, int vendor, int product, char *devname); int vmsSetJoystickCalibration (JOY_CONTEXT *joy, JOYSTICK_LIMIT_DATA *limit); int vmsJoySetScale(JOY_CONTEXT *joy, int flags, int range, int axis_type); int vmsJoyScale(int in, JOYSTICK_SCALE *scale, JOYSTICK_AXIS_INSTANCE *axis); char * vmsJoyGetVendorName(JOY_CONTEXT *joy, int vendor_id); char * vmsJoyGetProductName(JOY_CONTEXT *joy, int vendor_id, int product_id); int vmsAssignJoystick (JOY_CONTEXT *joy); void vmsDeassignJoystick (JOY_CONTEXT *joy); int vmsReadQIOJoystick (JOY_CONTEXT *joy); void vmsReadJoystick (JOY_CONTEXT **rjoy, int *buttons, int *x, int *y, int *z, int *rz, int *throttle); void vmsPollJoystick (int astprm); int vmsCloseJoystick (JOY_CONTEXT *joy); void vmsStopJoystick (JOY_CONTEXT *joy); int vmsOpenJoystick (JOY_CONTEXT **rjoy); int vmsStartJoystick (JOY_CONTEXT **rjoy, int type, void (*callback_address)(unsigned int buttons, int x, int y, int z, int rz, int throttle, #ifdef VMS_GLUT void *ret_joy)); #else JOY_CONTEXT *ret_joy)); #endif int vmsQueryJoystick (int *num_buttons, int *num_axes, int *valid_axes, JOY_CONTEXT **rjoy); #endif