Debian Codegraph @

ddio/lnxforcefeedback.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /DescentIII/Main/ddio_lnx/lnxforcefeedback.cpp $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2000/04/18 00:00:33 $
23 * $Author: icculus $
24 *
25 * Linux force feedback stub
26 *
27 * $Log: lnxforcefeedback.cpp,v $
28 * Revision 1.1.1.1 2000/04/18 00:00:33 icculus
29 * initial checkin
30 *
31 *
32 * 3 4/16/99 8:28p Jeff
33 * created more stub functions
34 *
35 * 2 4/14/99 1:57a Jeff
36 * fixed case mismatched #includes
37 *
38 * 1 1/18/99 12:13a Jeff
39 *
40 * $NoKeywords: $
41 */
42
43 #include "pstring.h"
44 #include "forcefeedback.h"
45
46 bool ddForce_found; // a Force Feedback device was found
47 bool ddForce_enabled; // Force Feedback is ready and can be used
48
49 // -------------------------------------------------------------------
50 // ddio_ff_AttachForce
51 // Purpose:
52 // Attaches variables initialized in the general ddio system to
53 // the force feedback system.
54 // -------------------------------------------------------------------
55 void ddio_ff_AttachForce(void) {}
56
57 // -------------------------------------------------------------------
58 // ddio_ff_DetachForce
59 // Purpose:
60 // Detaches variables used by the force-feedback system from the
61 // ddio system
62 // -------------------------------------------------------------------
63 void ddio_ff_DetachForce(void) {}
64
65 // -------------------------------------------------------------------
66 // ddio_ff_Init
67 // Purpose:
68 // Initialize force feedback if available.
69 // -------------------------------------------------------------------
70 int ddio_ff_Init(void) {
71 ddForce_found = ddForce_enabled = false;
72 return 0;
73 }
74
75 // -------------------------------------------------------------------
76 // ddio_ffjoy_Init
77 // Purpose:
78 // Creates and acquires all joysticks
79 //
80 // Input:
81 // None
82 //
83 // Return:
84 // # of sticks acquired
85 //
86 // Description:
87 //
88 // -------------------------------------------------------------------
89 int ddio_ffjoy_Init(void) {
90 ddForce_found = ddForce_enabled = false;
91 return 0;
92 }
93
94 // -------------------------------------------------------------------
95 // ddio_ff_Acquire
96 // Purpose:
97 // Acquires a direct input device for use.
98 //
99 // Input:
100 // The device to acquire (use kDI_MaxJoy to acquire all available
101 // joysticks).
102 //
103 // Return:
104 // # of devices acquired.
105 //
106 // Description:
107 // Call this to gain access to a device after the device has been
108 // created & after regaining the focus after losing it.
109 //
110 // -------------------------------------------------------------------
111 int ddio_ff_Acquire(tDevice) { return 0; }
112
113 // -------------------------------------------------------------------
114 // ddio_ff_Unacquire
115 // Purpose:
116 // Unacquires a direct input device
117 //
118 // Input:
119 // The device to unacquire (use kDI_MaxJoy to unacquire all available
120 // joysticks).
121 //
122 // Return:
123 // # of devices unacquired.
124 //
125 // Description:
126 // Call this to lose access to a device after the device has been
127 // aquired
128 //
129 // -------------------------------------------------------------------
130 int ddio_ff_Unacquire(tDevice) { return 0; }
131
132 // -------------------------------------------------------------------
133 // ddio_ff_SetCoopLevel
134 // -------------------------------------------------------------------
135 int ddio_ff_SetCoopLevel(tDevice, int) { return 0; }
136
137 // -------------------------------------------------------------------
138 // ddio_ffjoy_Query
139 // Purpose:
140 // Besides checking what buttons/axis are available, this function
141 // also checks for force feedback support.
142 // -------------------------------------------------------------------
143 int ddio_ffjoy_Query(int, int *, int *) { return 0; }
144
145 /*
146 ========================================================================
147 Force Feedback Effect Functions
148 ========================================================================
149
150
151 */
152 // -------------------------------------------------------------------
153 // ddio_ff_GetInfo
154 // Purpose:
155 // Returns information about the current state of the low-level
156 // Force Feedback system.
157 // -------------------------------------------------------------------
158 void ddio_ff_GetInfo(bool *ff_found, bool *ff_enabled) {
159 if (ff_found)
160 *ff_found = false;
161 if (ff_enabled)
162 *ff_enabled = false;
163 }
164
165 // -------------------------------------------------------------------
166 // ddio_ffb_Pause
167 // Purpose:
168 // Pause the FFB output on the given device. Use ddio_ffb_Continue to
169 // continue where you left off.
170 // -------------------------------------------------------------------
171 void ddio_ffb_Pause(tDevice) {}
172
173 // -------------------------------------------------------------------
174 // ddio_ffb_Continue
175 // Purpose:
176 // Unpause the FFB output on the given device. Complimentary to
177 // ddio_ffb_Pause.
178 // -------------------------------------------------------------------
179 void ddio_ffb_Continue(tDevice) {}
180
181 // -------------------------------------------------------------------
182 // ddio_ffb_Enable
183 // Purpose:
184 // Must be called after initialization in order to activate the
185 // device.
186 // Use ddio_ffb_Pause & ddio_ffb_Continue if you want disable forces
187 // temporarily and resume later.
188 // -------------------------------------------------------------------
189 void ddio_ffb_Enable(tDevice) {}
190
191 // -------------------------------------------------------------------
192 // ddio_ffb_Disable
193 // Purpose:
194 // Turns off FFB, but effects still play on processor.
195 // -------------------------------------------------------------------
196 void ddio_ffb_Disable(tDevice) {}
197
198 // -------------------------------------------------------------------
199 // ddio_ffb_effectCreate
200 // Purpose:
201 // Create a single effect for future playback.
202 // Effect is given a logical ID
203 // -------------------------------------------------------------------
204 int ddio_ffb_effectCreate(tDevice, tFFB_Effect *) { return 0; }
205
206 // -------------------------------------------------------------------
207 // ddio_ffb_DestroyAll
208 // Purpose:
209 // Destroys all created effects
210 // -------------------------------------------------------------------
211 void ddio_ffb_DestroyAll(void) {}
212
213 // -------------------------------------------------------------------
214 // ddio_ffb_effectPlay
215 // Purpose:
216 // Play an effect that was previously created.
217 // -------------------------------------------------------------------
218 void ddio_ffb_effectPlay(int16_t) {}
219
220 // -------------------------------------------------------------------
221 // ddio_ffb_effectStop
222 // Purpose:
223 // Stop a single effect.
224 // -------------------------------------------------------------------
225 void ddio_ffb_effectStop(int16_t) {}
226
227 // -------------------------------------------------------------------
228 // ddio_ffb_effectStopAll
229 // Purpose:
230 // Stops all forces on the given device.
231 // -------------------------------------------------------------------
232 void ddio_ffb_effectStopAll(tDevice) {}
233
234 // -------------------------------------------------------------------
235 // ddio_ffb_effectUnload
236 // Purpose:
237 // Unload a single effect... Necessary to make room for other
238 // effects.
239 // -------------------------------------------------------------------
240 void ddio_ffb_effectUnload(int16_t) {}
241
242 // -------------------------------------------------------------------
243 // ddio_ffb_effectModify
244 // Purpose:
245 // Modifies a single effect, only if the given parameters are
246 // different from what's currently loaded.
247 // -------------------------------------------------------------------
248 void ddio_ffb_effectModify(int16_t, int *, uint32_t *, uint32_t *, uint32_t *, tEffInfo *, tEffEnvelope *) {}
249
250 // -------------------------------------------------------------------
251 // ddio_ffb_GetEffectData
252 // Purpose:
253 // Retrieves affect data for the given parameters, pass NULL for those you don't want
254 // -------------------------------------------------------------------
255 void ddio_ffb_GetEffectData(int16_t, int *, uint32_t *, uint32_t *, uint32_t *, tEffInfo *, tEffEnvelope *) {}
256
257 // -------------------------------------------------------------------
258 // ddio_ffjoy_EnableAutoCenter
259 // Purpose:
260 // Disables/Enables the autocentering of the joystick
261 // -------------------------------------------------------------------
262 void ddio_ffjoy_EnableAutoCenter(tDevice, bool) {}
263
264 // -------------------------------------------------------------------
265 // ddio_ffjoy_SetGain
266 // Purpose:
267 // Sets the gain for joystick, pass a value of 0-1
268 // -------------------------------------------------------------------
269 void ddio_ffjoy_SetGain(tDevice, float) {}
270
271 // -------------------------------------------------------------------
272 // ddio_ffjoy_IsAutoCentered
273 // Purpose:
274 // Returns true if the joystick is set for autocentering
275 // -------------------------------------------------------------------
276 bool ddio_ffjoy_IsAutoCentered(tDevice) { return true; }
277
278 // -------------------------------------------------------------------
279 // ddio_ffjoy_SupportAutoCenter
280 // Purpose:
281 // Returns true if the FF joystick supports auto centering
282 // -------------------------------------------------------------------
283 bool ddio_ffjoy_SupportAutoCenter(tDevice) { return false; }
284
285 // Given a filename resource, this loads the file and creates a resource
286 // for it. It returns a handle to that resource.
287 // If it returns NULL, then it couldn't load the project.
288 // Make sure device is aquired before calling.
289 FORCEPROJECT ddio_ForceLoadProject(char *filename, tDevice dev) { return NULL; }
290
291 // Unloads a FORCEPROJECT file
292 void ddio_ForceUnloadProject(FORCEPROJECT prj) {}
293
294 // Given a handle to a resource, and the name of the effect to load
295 // it will load that effect. Returns the effect ID, or -1 if it couldn't
296 // be created
297 int ddio_CreateForceFromProject(FORCEPROJECT project, const char *forcename) { return -1; }