2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
15 #pragma off (unreferenced)
16 static char rcsid[] = "$Id: iforce.c,v 1.1.1.1 2001-01-19 03:30:15 bradleyb Exp $";
17 #pragma on (unreferenced)
22 #define WIN32_LEAN_AND_MEAN
33 static JoystickRecord iForceCaps;
34 static int iForceInit=FALSE;
37 #define WIN_TACTILE_ON
39 // ----------------------------------------------------------------------------
43 extern Bool _cdecl InitStick(JoystickRecord*);
45 int IForce_Init(int port)
49 if (iForceInit) return 1;
51 if (port < 1 || port > 4) return 0;
53 SetJoystickPort(port);
54 result = InitStick(&iForceCaps);
56 logentry( "IFORCE: Initialization failed!.\n");
60 if (!EnableForces()) {
61 logentry("IFORCE: Unable to enable forces.\n");
69 logentry("IFORCE: Initialization complete.\n");
79 if (!iForceInit) return 1;
89 int IForce_GetCaps(IForce_Caps *caps)
91 if (!iForceInit) return 0;
93 if (iForceCaps.PositionAxes >= 2) {
94 caps->axes_mask = JOY_1_X_AXIS;
95 caps->axes_mask &= JOY_1_Y_AXIS;
97 if (iForceCaps.PositionAxes == 4) {
98 caps->axes_mask &= JOY_1_POV;
105 void IForce_ReadRawValues(int *axis)
109 if (!iForceInit) return;
111 memset(&joy, 0, sizeof(joy));
112 joy.dwSize = sizeof(joy);
113 joy.dwFlags = JOY_RETURNALL | JOY_USEDEADZONE;
114 joyGetPosEx(JOYSTICKID1, &joy);
116 axis[0] = joy.dwXpos;
117 axis[1] = joy.dwYpos;
118 axis[2] = joy.dwZpos;
119 axis[4] = joy.dwRpos;
120 axis[5] = joy.dwUpos;
121 axis[6] = joy.dwVpos;