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.
18 #define WIN32_LEAN_AND_MEAN
29 static JoystickRecord iForceCaps;
30 static int iForceInit=FALSE;
33 #define WIN_TACTILE_ON
35 // ----------------------------------------------------------------------------
39 extern Bool _cdecl InitStick(JoystickRecord*);
41 int IForce_Init(int port)
45 if (iForceInit) return 1;
47 if (port < 1 || port > 4) return 0;
49 SetJoystickPort(port);
50 result = InitStick(&iForceCaps);
52 logentry( "IFORCE: Initialization failed!.\n");
56 if (!EnableForces()) {
57 logentry("IFORCE: Unable to enable forces.\n");
65 logentry("IFORCE: Initialization complete.\n");
75 if (!iForceInit) return 1;
85 int IForce_GetCaps(IForce_Caps *caps)
87 if (!iForceInit) return 0;
89 if (iForceCaps.PositionAxes >= 2) {
90 caps->axes_mask = JOY_1_X_AXIS;
91 caps->axes_mask &= JOY_1_Y_AXIS;
93 if (iForceCaps.PositionAxes == 4) {
94 caps->axes_mask &= JOY_1_POV;
101 void IForce_ReadRawValues(int *axis)
105 if (!iForceInit) return;
107 memset(&joy, 0, sizeof(joy));
108 joy.dwSize = sizeof(joy);
109 joy.dwFlags = JOY_RETURNALL | JOY_USEDEADZONE;
110 joyGetPosEx(JOYSTICKID1, &joy);
112 axis[0] = joy.dwXpos;
113 axis[1] = joy.dwYpos;
114 axis[2] = joy.dwZpos;
115 axis[4] = joy.dwRpos;
116 axis[5] = joy.dwUpos;
117 axis[6] = joy.dwVpos;