Rise
The Vieneo Province
Loading...
Searching...
No Matches
joystick.cpp
Go to the documentation of this file.
1#include "joystick.h"
2#include "Viewscreen.h"
4#include "../MathUtilities.h"
6
8
9namespace
10{
11 int DirectInputExceptionFilter(DWORD code, DWORD* exceptionCode)
12 {
13 *exceptionCode = code;
14 // Stack overflow and other process-corrupting exceptions are not safe to resume from.
15 return code == EXCEPTION_STACK_OVERFLOW ? EXCEPTION_CONTINUE_SEARCH : EXCEPTION_EXECUTE_HANDLER;
16 }
17
18 HRESULT GuardedCreateDevice(LPDIRECTINPUT8 directInput, const GUID* guid,
19 LPDIRECTINPUTDEVICE8* device, DWORD* exceptionCode)
20 {
21 *device = nullptr;
22 *exceptionCode = 0;
23 __try
24 {
25 return directInput->CreateDevice(*guid, device, nullptr);
26 }
27 __except (DirectInputExceptionFilter(GetExceptionCode(), exceptionCode))
28 {
29 *device = nullptr;
30 return E_UNEXPECTED;
31 }
32 }
33
34 HRESULT GuardedGetDeviceStatus(LPDIRECTINPUT8 directInput, const GUID* guid, DWORD* exceptionCode)
35 {
36 *exceptionCode = 0;
37 __try
38 {
39 return directInput->GetDeviceStatus(*guid);
40 }
41 __except (DirectInputExceptionFilter(GetExceptionCode(), exceptionCode))
42 {
43 return E_UNEXPECTED;
44 }
45 }
46
47 bool GuardedReleaseDevice(LPDIRECTINPUTDEVICE8* device, DWORD* exceptionCode)
48 {
49 *exceptionCode = 0;
50 if (!*device)
51 return true;
52
53 __try
54 {
55 (*device)->Release();
56 *device = nullptr;
57 return true;
58 }
59 __except (DirectInputExceptionFilter(GetExceptionCode(), exceptionCode))
60 {
61 // Never call through an interface that already raised a native exception.
62 *device = nullptr;
63 return false;
64 }
65 }
66
67 HRESULT GuardedSetDataFormat(LPDIRECTINPUTDEVICE8 device, DWORD* exceptionCode)
68 {
69 *exceptionCode = 0;
70 __try
71 {
72 return device->SetDataFormat(&c_dfDIJoystick);
73 }
74 __except (DirectInputExceptionFilter(GetExceptionCode(), exceptionCode))
75 {
76 return E_UNEXPECTED;
77 }
78 }
79
80 HRESULT GuardedSetCooperativeLevel(LPDIRECTINPUTDEVICE8 device, HWND window, DWORD* exceptionCode)
81 {
82 *exceptionCode = 0;
83 __try
84 {
85 return device->SetCooperativeLevel(window, DISCL_EXCLUSIVE | DISCL_BACKGROUND);
86 }
87 __except (DirectInputExceptionFilter(GetExceptionCode(), exceptionCode))
88 {
89 return E_UNEXPECTED;
90 }
91 }
92
93 HRESULT GuardedEnumObjects(LPDIRECTINPUTDEVICE8 device, LPDIENUMDEVICEOBJECTSCALLBACK callback,
94 void* context, DWORD* exceptionCode)
95 {
96 *exceptionCode = 0;
97 __try
98 {
99 return device->EnumObjects(callback, context, DIDFT_ALL);
100 }
101 __except (DirectInputExceptionFilter(GetExceptionCode(), exceptionCode))
102 {
103 return E_UNEXPECTED;
104 }
105 }
106
107 HRESULT GuardedSetRange(LPDIRECTINPUTDEVICE8 device, DIPROPHEADER* rangeHeader, DWORD* exceptionCode)
108 {
109 *exceptionCode = 0;
110 __try
111 {
112 return device->SetProperty(DIPROP_RANGE, rangeHeader);
113 }
114 __except (DirectInputExceptionFilter(GetExceptionCode(), exceptionCode))
115 {
116 return E_UNEXPECTED;
117 }
118 }
119
120 void FormatGuid(const GUID& guid, char* output, size_t outputSize)
121 {
122 sprintf_s(output, outputSize,
123 "{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}",
124 guid.Data1, guid.Data2, guid.Data3,
125 guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
126 guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
127 }
128}
129
131{
132 viewscreen = ptr;
133 logger = ptr->logger;
134 hDlg = nullptr;
135}
136
137HRESULT joystick::Poll(InputConfig* config, long* value)
138{
139 if (!config)
140 logger->Log("joystick::Poll config is nullptr!", Logger::Level::Fatal);
141
142 if (!config->g_pJoystick) // no device
143 return E_FAIL;
144
145 logger->AddToCallStack("joystick::Poll");
146
147 DIJOYSTATE js;
148 char msg[199];
149 bool alreadyPolled = false;
150
151 // we may have already polled this joystick once this frame! use the old data
152 for (size_t t = 0; t < polledGuids.size(); t++)
153 {
154 auto polledGuid = polledGuids.at(t);
155 if (polledGuid == config->guid)
156 {
157 alreadyPolled = true;
158 js = polledDeviceStates.at(t);
159 }
160 }
161
162 if (!alreadyPolled)
163 {
164 HRESULT hr;
165
166 // Poll the device to read the current state
167 if (FAILED(config->g_pJoystick->Poll()))
168 {
169 if (FAILED(hr = config->g_pJoystick->Acquire()))
170 {
171 sprintf_s(msg, sizeof msg, "Failed to Poll and failed to Acquire device: %s (%S)", config->friendlyName.c_str(), Rendering::ErrorString(hr));
173 }
174 }
175
176 // Get the input's device state
177 if (FAILED(hr = config->g_pJoystick->GetDeviceState(sizeof DIJOYSTATE, &js)))
178 {
179 sprintf_s(msg, sizeof msg, "joystick::GetOrPoll failed to GetDeviceState DIJOYSTICK: %s (%S)", config->friendlyName.c_str(), Rendering::ErrorString(hr));
182 sprintf_s(msg, sizeof msg, "It appears a game controller was unplugged or stolen by another application: %s", config->friendlyName.c_str());
183 MessageBoxA(Rendering::ClientWindow(), msg, "Lost Joystick Connection", MB_ICONWARNING | MB_OK);
184 SAFE_RELEASE(config->g_pJoystick);
185 return hr;
186 }
187
188 polledGuids.emplace_back(config->guid);
189 polledDeviceStates.emplace_back(js);
190
191 if (g_bTextInput == 1) // bindings
192 {
194 for (auto i = 0; i < 32; i++)
195 {
196 if (js.rgbButtons[i])
197 ptr->SetButton(config->guid, i, config->friendlyName);
198 }
199 for (auto i = 0; i < 4; i++)
200 {
201 if (js.rgdwPOV[i] == 0 || js.rgdwPOV[i] == 9000 || js.rgdwPOV[i] == 18000 || js.rgdwPOV[i] == 27000)
202 ptr->SetPOV(config->guid, i, js.rgdwPOV[i], config->friendlyName);
203 }
204 }
205 else
206 {
207 char profile = ProfileFlags::GLOBAL;
209 profile |= ProfileFlags::INTERIOR;
210 else if (playerships[0].groundvehicle)
211 profile |= ProfileFlags::GV;
212 else
213 profile |= ProfileFlags::AIRSPACE;
214 for (auto binding : viewscreen->gameclass->config.buttonBindings)
215 {
216 if (allowedUsage[binding.function] & profile && config->guid == binding.guid && js.rgbButtons[binding.index])
217 viewscreen->RunBindingFunction(binding.function, config->oldJs.rgbButtons[binding.index]);
218 }
219 for (auto binding : viewscreen->gameclass->config.povBindings)
220 {
221 if (allowedUsage[binding.function] & profile && config->guid == binding.guid && binding.Test(js.rgdwPOV[binding.index]))
222 viewscreen->RunBindingFunction(binding.function, binding.Test(config->oldJs.rgdwPOV[binding.index]));
223 }
224 }
225
226 // store for comparison in keybindings above
227 config->oldJs = js;
228 }
229
230 // map axes
231 switch (config->axis)
232 {
233 case 0: *value = js.lX; break;
234 case 1: *value = js.lY; break;
235 case 2: *value = js.lZ; break;
236 case 3: *value = js.lRx; break;
237 case 4: *value = js.lRy; break;
238 case 5: *value = js.lRz; break;
239 case 6: *value = js.rglSlider[0]; break;
240 case 7: *value = js.rglSlider[1]; break;
241 default: *value = 0; break;
242 }
243
244 if (abs(*value) > 2000)
245 {
246 sprintf_s(msg, sizeof msg, "Value was out-of-range for game controller: %i", *value);
248 return E_FAIL;
249 }
250
251 if (config->invert)
252 *value = -(*value);
253
254 // 500 to 1000 for accelerator
255 if (config->split)
256 {
257 *value = (*value + 500) * 2;
258 if (*value > 1000)
259 *value = 1000;
260 }
261
262 if (config->oldValue != *value)
263 config->hasMoved = true;
264
265 if (!config->hasMoved)
266 return E_FAIL;
267
268 return S_OK;
269}
270
271void joystick::Update(float fElapsedTime)
272{
273 logger->AddToCallStack("joystick::Update");
274
275 if (!viewscreen->camera)
276 logger->Log("joystick::Update viewscreen->camera is nullptr!", Logger::Level::Fatal);
277
278 long value;
279
280 polledGuids.clear();
281 polledDeviceStates.clear();
282 if (g_bTextInput == 1) // bindings
283 {
285 ptr->ClearButtons();
286 ptr->ClearPOVs();
287 }
288
290 {
291 if (abs(value) > nullzone)
292 {
293 if (value > 0)
294 viewscreen->targetLeftright = powf(static_cast<float>(value) * 0.001f, 2.0f) * viewscreen->camera->rightlimit;
295 else
296 viewscreen->targetLeftright = powf(static_cast<float>(value) * 0.001f, 2.0f) * viewscreen->camera->leftlimit;
297 if (abs(value) > 400)
298 {
301 }
302 }
303 else
305 }
307 {
308 if (abs(value) > nullzone)
309 {
310 if (value > 0)
311 viewscreen->targetUpdown = powf(static_cast<float>(value) * 0.001f, 2.0f) * viewscreen->camera->uplimit;
312 else
313 viewscreen->targetUpdown = powf(static_cast<float>(value) * 0.001f, 2.0f) * viewscreen->camera->downlimit;
314 if (abs(value) > 400)
315 {
318 }
319 }
320 else
321 viewscreen->targetUpdown = 0.0f;
322 }
323
324 if (SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigWalkLateral, &value)))
325 {
326 if (abs(value) > nullzone)
327 ourcockpit.turnin = static_cast<float>(value) * 0.001f;
328 if (abs(value) > 400)
329 {
332 }
333 }
334 if (SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigWalkVertical, &value)))
335 {
336 if (abs(value) > nullzone)
337 ourcockpit.moving = -static_cast<float>(value) * 0.001f;
338 if (abs(value) > 400)
339 {
342 }
343 }
344
345 if (!playerships[0].groundvehicle)
346 {
347 if (SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigPitch, &value)))
348 {
351 {
352 if (labs(value) > nullzone) // null zone
353 viewscreen->pitchInput = static_cast<float>(value) * 0.001f;
354 else
355 viewscreen->pitchInput = 0.0f;
356 }
357 else if (labs(value) > 400)
359 }
360
361 if (SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigPitchTrim, &value)))
362 {
363 if (labs(value) > nullzone)
364 {
365 float adj = fElapsedTime * 0.06f * trimlimiterC * 2;
366 if (playerships[0].reference == REF_ONGROUND)
367 adj *= 5;
368 viewscreen->gameclass->bus->PitchTrimScalar += adj * static_cast<float>(value) * 0.001f;
370 if (abs(value) > 400)
371 {
374 viewscreen->pitchTrimMod = true;
375 }
376 }
377 }
378 }
379 else
380 viewscreen->pitchInput = 0.0f;
381
382 if (!playerships[0].groundvehicle)
383 {
384 if (SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigRoll, &value)))
385 {
388 {
389 if (labs(value) > nullzone)
390 viewscreen->rollInput = static_cast<float>(value) * 0.001f;
391 else
392 viewscreen->rollInput = 0.0f;
393 }
394 else if (labs(value) > 400)
396 }
397 }
398 else
399 viewscreen->rollInput = 0.0f;
400
401 if (!playerships[0].groundvehicle)
402 {
403 if (SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigYaw, &value)))
404 {
407 {
408 if (labs(value) > nullzone)
409 viewscreen->yawInput = static_cast<float>(value) * 0.001f;
410 else
411 viewscreen->yawInput = 0.0f;
412 }
413 else
414 {
415 viewscreen->yawInput = static_cast<float>(value) * 0.001f * fabsf(static_cast<float>(value) * 0.001f);
416 }
417 }
418 }
419
420 // body gear steering for aircrafts, also for ground vehicles
421 if ((playerships[0].groundvehicle || ourcockpit.vdat.steering > 0) && SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigSteer, &value)))
422 {
423 viewscreen->steerInput = static_cast<float>(value) * 0.001f * fabsf(static_cast<float>(value) * 0.001f);
424 if (fabsf(viewscreen->steerInput) > 0.4f)
425 {
428 }
429 }
430
431 if (!playerships[0].groundvehicle)
432 {
433 if (ourcockpit.engines > 0 && SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigThrustLeft, &value)))
434 {
435 static long entryLastLeft=LONG_MIN;
436 if(viewscreen->gameclass->bus->AFCS.AutothrottleEngaged&&entryLastLeft!=LONG_MIN&&labs(value-entryLastLeft)>40)
438 // Hold the engagement baseline so a slow lever movement also takes over.
439 if(!viewscreen->gameclass->bus->AFCS.AutothrottleEngaged||entryLastLeft==LONG_MIN) entryLastLeft=value;
441 viewscreen->gameclass->bus->EngineThrustLever[0] = static_cast<float>(-value + 1000) / 2000.0f;
442 else
443 viewscreen->gameclass->bus->AFCS.DesiredClosingSpeed = powf(static_cast<float>(-value + 1000) / 2000.0f, 4.0f) * 12.0f; // 12 km/s
444 }
445 if (ourcockpit.engines > 1 && SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigThrustRight, &value)))
446 {
447 static long entryLastRight=LONG_MIN;
448 if(viewscreen->gameclass->bus->AFCS.AutothrottleEngaged&&entryLastRight!=LONG_MIN&&labs(value-entryLastRight)>40)
450 // Hold the engagement baseline so a slow lever movement also takes over.
451 if(!viewscreen->gameclass->bus->AFCS.AutothrottleEngaged||entryLastRight==LONG_MIN) entryLastRight=value;
453 {
454 if (ourcockpit.engines == 2)
455 viewscreen->gameclass->bus->EngineThrustLever[1] = static_cast<float>(-value + 1000) / 2000.0f;
456 else if (ourcockpit.engines == 3)
457 viewscreen->gameclass->bus->EngineThrustLever[2] = static_cast<float>(-value + 1000) / 2000.0f;
458 }
459 }
460 }
461 else
462 {
463 if (SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigGas, &value)))
464 {
465 viewscreen->gameclass->bus->EngineThrustLever[0] = static_cast<float>(-value + 1000) / 2000.0f;
466 if (viewscreen->gameclass->bus->EngineThrustLever[0] > 0.40f)
467 {
470 }
471 }
472 }
473
474 if (!playerships[0].groundvehicle)
475 {
476 if (SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigLeftToeBrake, &value)))
477 {
478 viewscreen->gameclass->bus->LeftBrake = static_cast<float>(-value + 1000) / 2000.0f;
479 }
480 if (SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigRightToeBrake, &value)))
481 {
482 viewscreen->gameclass->bus->RightBrake = static_cast<float>(-value + 1000) / 2000.0f;
483 }
484 }
485 else
486 {
487 if (SUCCEEDED(Poll(&viewscreen->gameclass->config.inputConfigBrake, &value)))
488 {
489 viewscreen->gameclass->bus->LeftBrake = viewscreen->gameclass->bus->RightBrake = static_cast<float>(-value + 1000) / 2000.0f;
490 if (viewscreen->gameclass->bus->RightBrake > 0.4f)
491 {
494 }
495 }
496 }
497
498 /*
499 // These were copied out of propulsion!
500 // Force-Feedback
501 if (viewscreen->gameclass->config.g_bFeedback && viewscreen->advanceframe)
502 {
503 if (FAILED(viewscreen->SetDeviceForcesXY()))
504 {
505 viewscreen->gameclass->config.g_bFeedback = false;
506 }
507 }
508 // Force-feedback
509 if (viewscreen->gameclass->config.g_bFeedback && viewscreen->advanceframe)
510 {
511 if (viewscreen->gameclass->bus->IndicatedAirspeedKms > 0.04f)
512 viewscreen->g_nXForce = (int)(viewscreen->ptrPropulsion->qz*viewscreen->roll*300.0f); // qz figured in vertical translation area
513 else
514 viewscreen->g_nXForce = (int)(viewscreen->roll*195493.0f);
515 }
516 // Force-feedback
517 if (viewscreen->gameclass->config.g_bFeedback && viewscreen->advanceframe)
518 {
519 if (viewscreen->gameclass->bus->IndicatedAirspeedKms > 0.04f)
520 viewscreen->g_nYForce = (int)(viewscreen->ptrPropulsion->qz*viewscreen->pitch*300.0f);
521 else
522 viewscreen->g_nYForce = (int)(viewscreen->pitch*195493.0f);
523 }
524 */
525
526 logger->AddToCallStack("joystick::Update DONE");
527}
528
529void joystick::Initialize(HWND prmHWND)
530{
531 hDlg = prmHWND;
532
533 logger->AddToCallStack("joystick::Initialize");
534
535 EnumDevices(); // only need to do again if something about the peripheral configuration changes
536
552}
553
555{
556 logger->AddToCallStack("joystick::EnumDevices");
557
558 // Device notifications can arrive before DirectInput has been initialized.
559 // Preserve the list so callers do not treat a skipped scan as a removal.
560 if (!viewscreen->g_pDI)
561 {
562 logger->Log("joystick::EnumDevices skipped because DirectInput is not initialized", Logger::Level::Warn);
563 return DIERR_NOTINITIALIZED;
564 }
565
566 HRESULT hr;
567
568 deviceList.clear();
569
570 logger->Log("joystick::EnumDevices Starting...");
571 if (FAILED(hr = viewscreen->g_pDI->EnumDevices(DI8DEVCLASS_GAMECTRL, &EnumDevicesCallback, this, DIEDFL_ATTACHEDONLY)))
572 {
573 logger->Log("joystick::EnumDevices() failed!", Logger::Level::Warn);
574 return hr;
575 }
576
577 logger->Log("joystick::EnumDevices Done!");
578 return S_OK;
579}
580
581void joystick::InitializeDevice(InputConfig* config, std::string control) const
582{
583 logger->AddToCallStack("joystick::InitializeDevice");
584
585 config->friendlyName = control;
586
587 // Because we can configure it on the fly, we have to release them
588 char msg[599];
589 sprintf_s(msg, sizeof msg, "joystick::InitializeDevice Releasing %s", control.c_str());
590 logger->Log(msg);
591 logger->AddToCallStack("joystick::InitializeDevice Release");
592 auto releaseDevice = [&](const char* reason)
593 {
594 DWORD releaseExceptionCode = 0;
595 if (GuardedReleaseDevice(&config->g_pJoystick, &releaseExceptionCode))
596 return;
597
598 sprintf_s(msg, sizeof msg,
599 "joystick::InitializeDevice caught native exception 0x%08lX releasing %s during %s; continuing with the device disabled",
600 releaseExceptionCode, control.c_str(), reason);
602 };
603 releaseDevice("rebind");
604 DWORD nativeExceptionCode = 0;
605
606 if (config->guid == MYGUID_DEFAULT) // not yet configured, no client.cfg
607 {
608 if (!deviceList.empty())
609 {
610 int priority = 10;
611 for (size_t device = 0; device < deviceList.size(); device++)
612 {
613 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
614 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
615 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
616 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
617 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
618 control == "Look Lateral")
619 {
620 config->guid = deviceList.at(device).guidInstance;
621 config->axis = 3; // X Rotation
622 }
623 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
624 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
625 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
626 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
627 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
628 control == "Look Vertical")
629 {
630 config->guid = deviceList.at(device).guidInstance;
631 config->axis = 4; // Y Rotation
632 }
633 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
634 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
635 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
636 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
637 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
638 control == "Turn")
639 {
640 config->guid = deviceList.at(device).guidInstance;
641 config->axis = 0; // X Axis
642 }
643 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
644 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
645 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
646 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
647 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
648 control == "Walk")
649 {
650 config->guid = deviceList.at(device).guidInstance;
651 config->axis = 1; // Y Axis
652 }
653 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Pro Flight X-55 Rhino Stick") == 0 ||
654 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Pro Flight X-56 Rhino Stick") == 0 ||
655 wcscmp(deviceList.at(device).tszInstanceName, L"WingMan Force 3D") == 0 ||
656 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech WingMan Force 3D USB") == 0 ||
657 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Cyborg USB Stick") == 0 ||
658 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech Extreme 3D") == 0 ||
659 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech Extreme 3D Pro USB") == 0 ||
660 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek ST290 Pro") == 0 ||
661 wcscmp(deviceList.at(device).tszInstanceName, L"T.16000M") == 0 ||
662 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas X") == 0 ||
663 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas") == 0 ||
664 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas 4") == 0) &&
665 control == "Pitch" && priority > 1)
666 {
667 config->guid = deviceList.at(device).guidInstance;
668 config->axis = 1; // Y Axis
669
673
674 //viewscreen->gameclass->config.buttonBindings.emplace_back(ButtonBinding(BindingEnum::PITCHTRIM_DOWN, config->guid, 6)); // 10??
675 //viewscreen->gameclass->config.buttonBindings.emplace_back(ButtonBinding(BindingEnum::PITCHTRIM_UP, config->guid, 8)); // 12??
676
678 viewscreen->gameclass->config.povBindings.emplace_back(POVBinding(BindingEnum::RCS_DOWN, config->guid, 0, 18000));
680 viewscreen->gameclass->config.povBindings.emplace_back(POVBinding(BindingEnum::RCS_LEFT, config->guid, 0, 27000));
681
682 priority = 1;
683 }
684 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
685 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
686 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
687 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
688 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
689 control == "Pitch" && priority > 9)
690 {
691 config->guid = deviceList.at(device).guidInstance;
692 config->axis = 1; // Y Axis
693 priority = 9;
694 }
695 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Pro Flight X-55 Rhino Stick") == 0 ||
696 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Pro Flight X-56 Rhino Stick") == 0 ||
697 wcscmp(deviceList.at(device).tszInstanceName, L"WingMan Force 3D") == 0 ||
698 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech WingMan Force 3D USB") == 0 ||
699 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Cyborg USB Stick") == 0 ||
700 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech Extreme 3D") == 0 ||
701 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech Extreme 3D Pro USB") == 0 ||
702 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek ST290 Pro") == 0 ||
703 wcscmp(deviceList.at(device).tszInstanceName, L"T.16000M") == 0 ||
704 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas X") == 0 ||
705 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas") == 0 ||
706 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas 4") == 0) &&
707 control == "Roll" && priority > 1)
708 {
709 config->guid = deviceList.at(device).guidInstance;
710 config->axis = 0; // X Axis
711 priority = 1;
712 }
713 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
714 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
715 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
716 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
717 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
718 control == "Roll" && priority > 9)
719 {
720 config->guid = deviceList.at(device).guidInstance;
721 config->axis = 0; // X Axis
722 priority = 9;
723 }
724 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Pro Flight X-55 Rhino Stick") == 0 ||
725 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Pro Flight X-56 Rhino Stick") == 0 ||
726 wcscmp(deviceList.at(device).tszInstanceName, L"WingMan Force 3D") == 0 ||
727 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech WingMan Force 3D USB") == 0 ||
728 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Cyborg USB Stick") == 0 ||
729 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech Extreme 3D") == 0 ||
730 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech Extreme 3D Pro USB") == 0 ||
731 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek ST290 Pro") == 0 ||
732 wcscmp(deviceList.at(device).tszInstanceName, L"T.16000M") == 0 ||
733 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas X") == 0 ||
734 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas") == 0 ||
735 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas 4") == 0) &&
736 control == "Yaw" && priority > 1)
737 {
738 config->guid = deviceList.at(device).guidInstance;
739 config->axis = 5; // Z Rotation
740 priority = 1;
741 }
742 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Pro Flight X-55 Rhino Throttle") == 0 ||
743 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Pro Flight X-56 Rhino Throttle") == 0) &&
744 control == "Left Thrust" && priority > 1)
745 {
746 config->guid = deviceList.at(device).guidInstance;
747 config->axis = 0; // X Axis
748 priority = 1;
749 }
750 if ((wcscmp(deviceList.at(device).tszInstanceName, L"WingMan Force 3D") == 0 ||
751 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech WingMan Force 3D USB") == 0) &&
752 control == "Left Thrust" && priority > 2)
753 {
754 config->guid = deviceList.at(device).guidInstance;
755 config->axis = 6; // Slider 1
756 priority = 2;
757 }
758 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Cyborg USB Stick") == 0 ||
759 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech Extreme 3D") == 0 ||
760 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech Extreme 3D Pro USB") == 0 ||
761 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek ST290 Pro") == 0 ||
762 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas X") == 0 ||
763 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas") == 0 ||
764 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas 4") == 0) &&
765 control == "Left Thrust" && priority > 2)
766 {
767 config->guid = deviceList.at(device).guidInstance;
768 config->axis = 2; // Z Axis
769 priority = 2;
770 }
771 if ((wcscmp(deviceList.at(device).tszInstanceName, L"T.16000M") == 0) &&
772 control == "Left Thrust" && priority > 2)
773 {
774 config->guid = deviceList.at(device).guidInstance;
775 config->axis = 6; //
776 priority = 2;
777 }
778 if ((wcscmp(deviceList.at(device).tszInstanceName, L"T.16000M") == 0) &&
779 control == "Right Thrust" && priority > 2)
780 {
781 config->guid = deviceList.at(device).guidInstance;
782 config->axis = 6; //
783 priority = 2;
784 }
785 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
786 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
787 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
788 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
789 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
790 control == "Left Thrust" && priority > 9)
791 {
792 config->guid = deviceList.at(device).guidInstance;
793 config->axis = 2; // Z Axis
794 config->split = true;
795 priority = 9;
796 }
797 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Pro Flight X-55 Rhino Throttle") == 0 ||
798 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Pro Flight X-56 Rhino Throttle") == 0) &&
799 control == "Right Thrust" && priority > 1)
800 {
801 config->guid = deviceList.at(device).guidInstance;
802 config->axis = 1; // Y Axis
803 priority = 1;
804 }
805 if ((wcscmp(deviceList.at(device).tszInstanceName, L"WingMan Force 3D") == 0 ||
806 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech WingMan Force 3D USB") == 0) &&
807 control == "Right Thrust" && priority > 2)
808 {
809 config->guid = deviceList.at(device).guidInstance;
810 config->axis = 6; // Slider 1
811 priority = 2;
812 }
813 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Saitek Cyborg USB Stick") == 0 ||
814 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech Extreme 3D") == 0 ||
815 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech Extreme 3D Pro USB") == 0 ||
816 wcscmp(deviceList.at(device).tszInstanceName, L"Saitek ST290 Pro") == 0 ||
817 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas X") == 0 ||
818 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas") == 0 ||
819 wcscmp(deviceList.at(device).tszInstanceName, L"T.Flight Hotas 4") == 0) &&
820 control == "Right Thrust" && priority > 2)
821 {
822 config->guid = deviceList.at(device).guidInstance;
823 config->axis = 2; // Z Axis
824 priority = 2;
825 }
826 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
827 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
828 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
829 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
830 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
831 control == "Right Thrust" && priority > 9)
832 {
833 config->guid = deviceList.at(device).guidInstance;
834 config->axis = 2; // Z Axis
835 config->split = true;
836 priority = 9;
837 }
838 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
839 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
840 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
841 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
842 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
843 control == "Left Toe Brake" && priority > 9)
844 {
845 config->guid = deviceList.at(device).guidInstance;
846 config->axis = 2; // Z Axis
847 config->split = true;
848 config->invert = true;
849 priority = 9;
850 }
851 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
852 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
853 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
854 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
855 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
856 control == "Right Toe Brake" && priority > 9)
857 {
858 config->guid = deviceList.at(device).guidInstance;
859 config->axis = 2; // Z Axis
860 config->split = true;
861 config->invert = true;
862 priority = 9;
863 }
864
865#pragma region Steering
866
867 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (PXN-V3II)") == 0 ||
868 wcscmp(deviceList.at(device).tszInstanceName, L"Logitech G29 Driving Force Racing Wheel USB") == 0) &&
869 control == "Steering" && priority > 1)
870 {
871 config->guid = deviceList.at(device).guidInstance;
872 config->axis = 0;
876 priority = 1;
877 }
878 if (wcscmp(deviceList.at(device).tszInstanceName, L"T.16000M") == 0 &&
879 control == "Steering" && priority > 2)
880 {
881 config->guid = deviceList.at(device).guidInstance;
882 config->axis = 5;
883 priority = 2;
884 }
885 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
886 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
887 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
888 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
889 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
890 control == "Steering" && priority > 9)
891 {
892 config->guid = deviceList.at(device).guidInstance;
893 config->axis = 0; // X Axis
894 priority = 9;
895 }
896
897#pragma endregion
898
899 if (wcscmp(deviceList.at(device).tszInstanceName, L"Controller (PXN-V3II)") == 0 && control == "Gas" && priority > 1)
900 {
901 config->guid = deviceList.at(device).guidInstance;
902 config->axis = 2; // Z Axis
903 config->split = true;
904 priority = 1;
905 }
906 if (wcscmp(deviceList.at(device).tszInstanceName, L"Logitech G29 Driving Force Racing Wheel USB") == 0 && control == "Gas" && priority > 1)
907 {
908 config->guid = deviceList.at(device).guidInstance;
909 config->axis = 1;
910 config->split = true;
911 priority = 1;
912 }
913 if (wcscmp(deviceList.at(device).tszInstanceName, L"T.16000M") == 0 && control == "Gas" && priority > 2)
914 {
915 config->guid = deviceList.at(device).guidInstance;
916 config->axis = 6;
917 priority = 2;
918 }
919 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
920 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
921 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
922 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
923 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
924 control == "Gas" && priority > 9)
925 {
926 config->guid = deviceList.at(device).guidInstance;
927 config->axis = 2; // Z Axis
928 config->split = true;
929 priority = 9;
930 }
931 if (wcscmp(deviceList.at(device).tszInstanceName, L"Controller (PXN-V3II)") == 0 && control == "Brake" && priority > 1)
932 {
933 config->guid = deviceList.at(device).guidInstance;
934 config->axis = 2; // Z Axis
935 config->split = true;
936 config->invert = true;
937 priority = 1;
938 }
939 if (wcscmp(deviceList.at(device).tszInstanceName, L"Logitech G29 Driving Force Racing Wheel USB") == 0 && control == "Brake" && priority > 1)
940 {
941 config->guid = deviceList.at(device).guidInstance;
942 config->axis = 6;
943 config->split = true;
944 config->invert = true;
945 priority = 1;
946 }
947 if ((wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox One For Windows)") == 0 ||
948 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (XBOX 360 For Windows)") == 0 ||
949 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (ZD Game For Windows)") == 0 ||
950 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Gamepad for Xbox 360)") == 0 ||
951 wcscmp(deviceList.at(device).tszInstanceName, L"Controller (Xbox 360 Wireless Receiver for Windows)") == 0) &&
952 control == "Brake" && priority > 9)
953 {
954 config->guid = deviceList.at(device).guidInstance;
955 config->axis = 2; // Z Axis
956 config->split = true;
957 config->invert = true;
958 priority = 9;
959 }
960 }
961 // but then we would take for example the flight controllers for flight mappings, throttle for throttle mappings ... steering wheel if they have steering wheel
962 // here is where we would find and use an appropriate device
963 // so if they have a Saitek Pro Flight X-55 Rhino Stick or Saitek Pro Flight X-56 Rhino Stick or Saitek Cyborg Evo
964 if (config->guid == MYGUID_DEFAULT) // still not assigned
965 {
966 config->guid = MYGUID_NULL; // keyboard and mouse
967 config->axis = 0;
968 }
969 }
970 else
971 {
972 config->guid = MYGUID_NULL;
973 }
974 }
975
976 if (config->guid == MYGUID_NULL || config->IsFreeTrack())
977 return;
978
979 HRESULT hr;
980
981 char guidText[64];
982 FormatGuid(config->guid, guidText, sizeof guidText);
983 const wchar_t* deviceName = L"<GUID not present in the enumerated device list>";
984 for (const auto& device : deviceList)
985 {
986 if (device.guidInstance == config->guid)
987 {
988 deviceName = device.tszInstanceName;
989 break;
990 }
991 }
992
993 sprintf_s(msg, sizeof msg, "joystick::InitializeDevice CreateDevice control=%s device=%S GUID=%s",
994 control.c_str(), deviceName, guidText);
995 logger->Log(msg);
996
997 if (!viewscreen->g_pDI)
998 {
999 sprintf_s(msg, sizeof msg,
1000 "joystick::InitializeDevice cannot initialize control=%s device=%S GUID=%s because DirectInput is null",
1001 control.c_str(), deviceName, guidText);
1003 return;
1004 }
1005
1006 logger->AddToCallStack("joystick::InitializeDevice GetDeviceStatus");
1007 nativeExceptionCode = 0;
1008 hr = GuardedGetDeviceStatus(viewscreen->g_pDI, &config->guid, &nativeExceptionCode);
1009 if (nativeExceptionCode != 0)
1010 {
1011 sprintf_s(msg, sizeof msg,
1012 "joystick::InitializeDevice caught native exception 0x%08lX in GetDeviceStatus for control=%s device=%S GUID=%s; the device driver may have failed; continuing with the control disabled",
1013 nativeExceptionCode, control.c_str(), deviceName, guidText);
1015 return;
1016 }
1017 if (FAILED(hr))
1018 {
1019 sprintf_s(msg, sizeof msg,
1020 "joystick::InitializeDevice GetDeviceStatus failed for control=%s device=%S GUID=%s; the device may be disconnected or the GUID may be stale",
1021 control.c_str(), deviceName, guidText);
1022 // A configured device being unplugged or removed is expected user-state,
1023 // so retain it in the local trace without sending a server error report.
1024 logger->Log(msg, Logger::Level::Warn, hr);
1025 return;
1026 }
1027 logger->Log("joystick::InitializeDevice GetDeviceStatus succeeded");
1028 logger->AddToCallStack("joystick::InitializeDevice CreateDevice");
1029
1030 // Obtain an interface to the enumerated force feedback device.
1031 nativeExceptionCode = 0;
1032 hr = GuardedCreateDevice(viewscreen->g_pDI, &config->guid, &config->g_pJoystick, &nativeExceptionCode);
1033 if (nativeExceptionCode != 0)
1034 {
1035 sprintf_s(msg, sizeof msg,
1036 "joystick::InitializeDevice caught native exception 0x%08lX in CreateDevice for control=%s device=%S GUID=%s; the GUID may be stale or the device driver may have failed; continuing with the control disabled",
1037 nativeExceptionCode, control.c_str(), deviceName, guidText);
1039 return;
1040 }
1041 if (FAILED(hr))
1042 // If it failed, then we can't use this device for some
1043 // bizarre reason. (Maybe the user unplugged it while we
1044 // were in the middle of enumerating it.) So continue enumerating
1045 {
1046 sprintf_s(msg, sizeof msg,
1047 "joystick::InitializeDevice CreateDevice failed for control=%s device=%S GUID=%s; the device may be disconnected or the GUID may be stale",
1048 control.c_str(), deviceName, guidText);
1051 MessageBoxA(Rendering::ClientWindow(), msg, "Initialize Game Controller", MB_ICONWARNING | MB_OK);
1052 return;
1053 }
1054 logger->Log("joystick::InitializeDevice CreateDevice succeeded");
1055
1056 // Set the data format to "simple joystick" - a predefined data format. A
1057 // data format specifies which controls on a device we are interested in,
1058 // and how they should be reported.
1059 //
1060 // This tells DirectInput that we will be passing a DIJOYSTATE structure to
1061 // IDirectInputDevice8::GetDeviceState(). Even though we won't actually do
1062 // it in this sample. But setting the data format is important so that the
1063 // DIJOFS_* values work properly.
1064 logger->Log("joystick::InitializeDevice Calling SetDataFormat...");
1065 logger->AddToCallStack("joystick::InitializeDevice SetDataFormat");
1066 nativeExceptionCode = 0;
1067 hr = GuardedSetDataFormat(config->g_pJoystick, &nativeExceptionCode);
1068 if (nativeExceptionCode != 0)
1069 {
1070 sprintf_s(msg, sizeof msg,
1071 "joystick::InitializeDevice caught native exception 0x%08lX in SetDataFormat for control=%s device=%S GUID=%s; continuing with the control disabled",
1072 nativeExceptionCode, control.c_str(), deviceName, guidText);
1074 releaseDevice("SetDataFormat native exception cleanup");
1075 return;
1076 }
1077 if (FAILED(hr))
1078 {
1079 sprintf_s(msg, sizeof msg, "joystick::InitializeDevice SetDataFormat failed for control=%s device=%S GUID=%s",
1080 control.c_str(), deviceName, guidText);
1081 logger->Log(msg, Logger::Level::Error, hr);
1082 releaseDevice("SetDataFormat failure cleanup");
1083 return;
1084 }
1085 logger->Log("joystick::InitializeDevice Done with SetDataFormat!");
1086
1087 // Set the cooperative level to let DInput know how this device should
1088 // interact with the system and with other DInput applications.
1089 // Exclusive access is required in order to perform force feedback.
1090 logger->Log("joystick::InitializeDevice Calling SetCooperativeLevel...");
1091 logger->AddToCallStack("joystick::InitializeDevice SetCooperativeLevel");
1092 nativeExceptionCode = 0;
1093 hr = GuardedSetCooperativeLevel(config->g_pJoystick, hDlg, &nativeExceptionCode);
1094 if (nativeExceptionCode != 0)
1095 {
1096 sprintf_s(msg, sizeof msg,
1097 "joystick::InitializeDevice caught native exception 0x%08lX in SetCooperativeLevel for control=%s device=%S GUID=%s; continuing with the control disabled",
1098 nativeExceptionCode, control.c_str(), deviceName, guidText);
1100 releaseDevice("SetCooperativeLevel native exception cleanup");
1101 return;
1102 }
1103 if (FAILED(hr))
1104 {
1105 sprintf_s(msg, sizeof msg, "joystick::InitializeDevice SetCooperativeLevel failed for control=%s device=%S GUID=%s",
1106 control.c_str(), deviceName, guidText);
1107 logger->Log(msg, Logger::Level::Error, hr);
1108 releaseDevice("SetCooperativeLevel failure cleanup");
1109 return;
1110 }
1111 logger->Log("joystick::InitializeDevice Done with SetCooperativeLevel!");
1112
1113 // Enumerate and count the axes of the joystick
1114 logger->Log("joystick::InitializeDevice Calling EnumObjects for axes...");
1115 Wrapper wrapper;
1116 wrapper.config = config;
1117 wrapper.logger = logger;
1118 wrapper.game = viewscreen->gameclass;
1119 logger->AddToCallStack("joystick::InitializeDevice EnumObjects");
1120 nativeExceptionCode = 0;
1121 hr = GuardedEnumObjects(config->g_pJoystick, &EnumAxesCallback, &wrapper, &nativeExceptionCode);
1122 if (nativeExceptionCode != 0)
1123 {
1124 sprintf_s(msg, sizeof msg,
1125 "joystick::InitializeDevice caught native exception 0x%08lX in EnumObjects for control=%s device=%S GUID=%s; continuing with the control disabled",
1126 nativeExceptionCode, control.c_str(), deviceName, guidText);
1128 releaseDevice("EnumObjects native exception cleanup");
1129 return;
1130 }
1131 if (FAILED(hr)) // DIDFT_AXIS
1132 {
1133 sprintf_s(msg, sizeof msg, "joystick::InitializeDevice EnumObjects failed for control=%s device=%S GUID=%s",
1134 control.c_str(), deviceName, guidText);
1135 logger->Log(msg, Logger::Level::Error, hr);
1136 releaseDevice("EnumObjects failure cleanup");
1137 return;
1138 }
1139 logger->Log("joystick::InitializeDevice Done with EnumObjects!");
1140
1141 /*
1142 if (config->forceFeedback)
1143 {
1144 // This simple sample only supports one or two axis joysticks
1145
1146 if (viewscreen->g_dwNumForceFeedbackAxis < 2)
1147 {
1148 logger->Log("Unsupported number of force feedback axes...", Logger::Level::Warn);
1149 return E_FAIL;
1150 }
1151
1152 viewscreen->g_dwNumForceFeedbackAxis = 2;
1153
1154 // This application needs only one effect: Applying raw forces.
1155 DWORD rgdwAxes[2] = { DIJOFS_X, DIJOFS_Y };
1156 LONG rglDirection[2] = { 0, 0 };
1157 DICONSTANTFORCE cf = { 0 };
1158
1159 DIEFFECT eff;
1160 ZeroMemory(&eff, sizeof DIEFFECT);
1161 eff.dwSize = sizeof(DIEFFECT);
1162 eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
1163 eff.dwDuration = INFINITE;
1164 eff.dwSamplePeriod = 0;
1165 eff.dwGain = DI_FFNOMINALMAX;
1166 eff.dwTriggerButton = DIEB_NOTRIGGER;
1167 eff.dwTriggerRepeatInterval = 0;
1168 eff.cAxes = viewscreen->g_dwNumForceFeedbackAxis;
1169 eff.rgdwAxes = rgdwAxes;
1170 eff.rglDirection = rglDirection;
1171 eff.lpEnvelope = 0;
1172 eff.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
1173 eff.lpvTypeSpecificParams = &cf;
1174 eff.dwStartDelay = 0;
1175
1176 // Create the prepared effect
1177 logger->Log("Calling CreateEffect for FF...");
1178 if (FAILED(hr = config->g_pJoystick->CreateEffect(GUID_ConstantForce, &eff, &viewscreen->g_pEffectCF, NULL)))
1179 {
1180 if (hr == DIERR_DEVICEFULL)
1181 logger->Log("CreateEffect(GUID_ConstantForce) failed! The device is full.", Logger::Level::Warn);
1182 else if (hr == DIERR_DEVICENOTREG)
1183 logger->Log("CreateEffect(GUID_ConstantForce) failed! The device or device instance is not registered with Microsoft® DirectInput®.", Logger::Level::Warn);
1184 else if (hr == DIERR_INVALIDPARAM)
1185 logger->Log("CreateEffect(GUID_ConstantForce) failed! An invalid parameter was passed.", Logger::Level::Warn);
1186 else if (hr == DIERR_NOTINITIALIZED)
1187 logger->Log("CreateEffect(GUID_ConstantForce) failed! The object has not been initialized.", Logger::Level::Warn);
1188 else
1189 {
1190 char msg[99];
1191 sprintf_s(msg, sizeof(msg), "CreateEffect(GUID_ConstantForce) failed! Unknown cause: %S", Rendering::ErrorString(hr));
1192 logger->Log(msg, Logger::Level::Warn);
1193 }
1194 return;
1195 }
1196 logger->Log("Done with CreateEffect!");
1197
1198 if (config->g_pEffectCF == nullptr)
1199 {
1200 logger->Log("viewscreen->g_pEffectCF is nullptr!", Logger::Level::Warn);
1201 return E_FAIL;
1202 }
1203
1204
1205
1206 DIPERIODIC ss = { 0, 0, 0, 30000 };
1207 rglDirection[0] = 1; rglDirection[1] = 0;
1208
1209 eff.dwSize = sizeof(DIEFFECT);
1210 eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
1211 eff.dwDuration = INFINITE;
1212 eff.dwSamplePeriod = 0;
1213 eff.dwGain = DI_FFNOMINALMAX;
1214 eff.dwTriggerButton = DIEB_NOTRIGGER;
1215 eff.dwTriggerRepeatInterval = 0;
1216 eff.cAxes = viewscreen->g_dwNumForceFeedbackAxis;
1217 eff.rgdwAxes = rgdwAxes;
1218 eff.rglDirection = rglDirection;
1219 eff.lpEnvelope = 0;
1220 eff.cbTypeSpecificParams = sizeof(DIPERIODIC);
1221 eff.lpvTypeSpecificParams = &ss;
1222 eff.dwStartDelay = 0;
1223
1224 // Create the prepared effect
1225 logger->Log("Calling CreateEffect (round 2)...");
1226 if (FAILED(hr = config->g_pJoystick->CreateEffect(GUID_Square, &eff, &viewscreen->g_pEffectSS, NULL)))
1227 {
1228 if (hr == DIERR_DEVICEFULL)
1229 logger->Log("CreateEffect(GUID_Square) failed! The device is full.", Logger::Level::Warn);
1230 else if (hr == DIERR_DEVICENOTREG)
1231 logger->Log("CreateEffect(GUID_Square) failed! The device or device instance is not registered with Microsoft® DirectInput®.", Logger::Level::Warn);
1232 else if (hr == DIERR_INVALIDPARAM)
1233 logger->Log("CreateEffect(GUID_Square) failed! An invalid parameter was passed.", Logger::Level::Warn);
1234 else if (hr == DIERR_NOTINITIALIZED)
1235 logger->Log("CreateEffect(GUID_Square) failed! The object has not been initialized.", Logger::Level::Warn);
1236 else
1237 {
1238 char msg[99];
1239 sprintf_s(msg, sizeof(msg), "CreateEffect(GUID_Square) failed! Unknown cause: %S", Rendering::ErrorString(hr));
1240 logger->Log(msg, Logger::Level::Warn);
1241 }
1242 return hr;
1243 }
1244 logger->Log("Done with CreateEffect (round 2)!");
1245 if (viewscreen->g_pEffectSS == nullptr)
1246 {
1247 logger->Log("viewscreen->g_pEffectSS is nullptr!", Logger::Level::Warn);
1248 return E_FAIL;
1249 }
1250
1251 viewscreen->g_pJoystick->Acquire();
1252 if (viewscreen->g_pEffectCF)
1253 viewscreen->g_pEffectCF->Start(1, 0); // Start the effect
1254 if (viewscreen->g_pEffectSS)
1255 viewscreen->g_pEffectSS->Start(1, 0); // Start the effect
1256
1257 } // End of force-feedback section
1258 */
1259
1260 logger->AddToCallStack("joystick::InitializeDevice DONE");
1261}
1262
1263BOOL CALLBACK joystick::EnumAxesCallback(const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext)
1264{
1265 Wrapper* wrapper = static_cast<Wrapper*>(pContext);
1266 //InputConfig* config = static_cast<InputConfig*>(pContext);
1267
1268 /*
1269 DWORD* pdwNumForceFeedbackAxis = &instance->g_dwNumForceFeedbackAxis;
1270
1271 if ((pdidoi->dwFlags & DIDOI_FFACTUATOR) != 0)
1272 (*pdwNumForceFeedbackAxis)++;
1273 */
1274
1275 // For axes that are returned, set the DIPROP_RANGE property for the
1276 // enumerated axis in order to scale min/max values.
1277 if (pdidoi->dwType & DIDFT_AXIS)
1278 {
1279 DIPROPRANGE diprg;
1280 diprg.diph.dwSize = sizeof(DIPROPRANGE);
1281 diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
1282 diprg.diph.dwHow = DIPH_BYID;
1283 diprg.diph.dwObj = pdidoi->dwType; // Specify the enumerated axis
1284 // ReSharper disable once CppAssignedValueIsNeverUsed
1285 diprg.lMin = -1000;
1286 // ReSharper disable once CppAssignedValueIsNeverUsed
1287 diprg.lMax = +1000;
1288
1289 // Set the range for the axis
1290 HRESULT hr;
1291 DWORD nativeExceptionCode = 0;
1292 hr = GuardedSetRange(wrapper->config->g_pJoystick, &diprg.diph, &nativeExceptionCode);
1293 if (nativeExceptionCode != 0)
1294 {
1295 char msg[599];
1296 sprintf_s(msg, sizeof msg,
1297 "Caught native exception 0x%08lX setting DIPROP_RANGE on axis %S for %s; skipping this axis",
1298 nativeExceptionCode, pdidoi->tszName, wrapper->config->friendlyName.c_str());
1299 wrapper->logger->Log(msg, Logger::Level::Error);
1300 }
1301 else if (FAILED(hr))
1302 {
1303 char msg[599];
1304 sprintf_s(msg, sizeof msg, "Failed to SetProperty of DIPROP_RANGE on %S: %i", pdidoi->tszName, hr);
1305 wrapper->logger->Log(msg, Logger::Level::Error, hr);
1306 wrapper->game->ToggleFullScreen(false);
1307 MessageBoxA(nullptr, msg, "Could not EnumAxesCallback", MB_ICONERROR | MB_OK);
1308 }
1309 }
1310
1311 return DIENUM_CONTINUE;
1312}
1313
1314BOOL CALLBACK joystick::EnumDevicesCallback(const DIDEVICEINSTANCE* pInst, VOID* pContext)
1315{
1316 joystick* instance = static_cast<joystick*>(pContext);
1317 instance->logger->AddToCallStack("joystick::EnumFFDevicesCallback");
1318
1319 if (!instance->viewscreen->g_pDI)
1320 {
1321 instance->logger->Log("viewscreen->g_pDI is nullptr!", Logger::Level::Error);
1322 return DIENUM_CONTINUE;
1323 }
1324
1325 if (!pInst)
1326 {
1327 instance->logger->Log("pInst is nullptr!", Logger::Level::Error);
1328 return DIENUM_CONTINUE;
1329 }
1330
1331 try
1332 {
1333 // Obtain an interface to the enumerated force feedback device.
1334 LPDIRECTINPUTDEVICE8 pDevice;
1335 if (FAILED(instance->viewscreen->g_pDI->CreateDevice(pInst->guidInstance, &pDevice, NULL)))
1336 // If it failed, then we can't use this device for some
1337 // bizarre reason. (Maybe the user unplugged it while we
1338 // were in the middle of enumerating it.) So continue enumerating
1339 {
1340 instance->logger->Log("This one failed, continue enumerating...");
1341 return DIENUM_CONTINUE;
1342 }
1343 }
1344 catch (const std::exception& e)
1345 {
1346 instance->logger->Log(const_cast<char*>(e.what()), Logger::Level::Error);
1347 }
1348
1349 char msg[999];
1350 sprintf_s(msg, sizeof msg, "Found a good device, adding to list: %S", pInst->tszInstanceName);
1351 instance->logger->Log(msg);
1352
1353 instance->deviceList.emplace_back(*pInst);
1354
1355 return DIENUM_CONTINUE;
1356}
1357
1358/*
1359HRESULT joystick::SetDeviceForcesXY() const
1360{
1361 logger->AddToCallStack("joystick::SetDeviceForcesXY");
1362
1363 HRESULT hr;
1364 LONG rglDirection[2];
1365 //DWORD rgdwAxes[2] = { DIJOFS_X, DIJOFS_Y };
1366 DICONSTANTFORCE cf;
1367
1368 if (g_dwNumForceFeedbackAxis == 1)
1369 {
1370 cf.lMagnitude = g_nXForce;
1371 rglDirection[0] = rglDirection[1] = 0;
1372 }
1373 else
1374 {
1375 rglDirection[0] = g_nXForce;
1376 rglDirection[1] = g_nYForce;
1377 cf.lMagnitude = (DWORD)sqrt(pow((double)g_nXForce, 2) + pow((double)g_nYForce, 2));
1378 }
1379
1380 if (cf.lMagnitude > DI_FFNOMINALMAX)
1381 cf.lMagnitude = DI_FFNOMINALMAX;
1382 if (rglDirection[0] > DI_FFNOMINALMAX)
1383 rglDirection[0] = DI_FFNOMINALMAX;
1384
1385
1386 DIEFFECT eff;
1387 eff.dwSize = sizeof(DIEFFECT);
1388 eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
1389 eff.cAxes = g_dwNumForceFeedbackAxis;
1390 eff.rglDirection = rglDirection;
1391 eff.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
1392 eff.lpvTypeSpecificParams = &cf;
1393
1394 if (g_pEffectCF == nullptr)
1395 {
1396
1397 return E_FAIL;
1398 }
1399
1400 if (FAILED(hr = g_pEffectCF->SetParameters(&eff, DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS)))
1401 {
1402 return hr;
1403 }
1404
1405
1406 DIPERIODIC ss;
1407
1408 if (gameclass->bus->IndicatedAirspeedKms > 0.02f) // Greater than stall speed
1409 {
1410 float f_temp = fabsf(RiseMath::ToDegree(aoa));
1411 if (f_temp > 9.0f && f_temp < 15.0f)
1412 ss.dwMagnitude = (unsigned long)((f_temp - 9.0f)*1666.7f);
1413 else if (f_temp >= 15.0f)
1414 ss.dwMagnitude = 10000L;
1415 else
1416 ss.dwMagnitude = 0L;
1417 }
1418 else
1419 ss.dwMagnitude = 0L;
1420
1421 ss.dwPeriod = 30000L;
1422 ss.dwPhase = 0L;
1423 ss.lOffset = 0L;
1424
1425 eff.cbTypeSpecificParams = sizeof(DIPERIODIC);
1426 eff.lpvTypeSpecificParams = &ss;
1427
1428 if (FAILED(hr = g_pEffectSS->SetParameters(&eff, DIEP_TYPESPECIFICPARAMS)))
1429 return hr;
1430}
1431*/
@ GroundVehicleKeysSteer
Definition ActiveHelp.h:369
@ MoveAroundKeys
Definition ActiveHelp.h:386
@ LookAroundGamepad
Definition ActiveHelp.h:419
@ GroundVehicleJoySteer
Definition ActiveHelp.h:373
@ GroundVehicleJoyGas
Definition ActiveHelp.h:393
@ WhereIsTheBrakeKeys
Definition ActiveHelp.h:391
@ LookAroundMouse
Definition ActiveHelp.h:384
@ GroundVehicleKeysGas
Definition ActiveHelp.h:392
@ MoveAroundJoy
Definition ActiveHelp.h:426
@ WhereIsTheBrakeJoy
Definition ActiveHelp.h:377
#define SAFE_RELEASE(value)
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
SCRIPT_CONTROL SCRIPT_STATE const void SCRIPT_CONTROL SCRIPT_STATE const int SCRIPT_TABDEF const BYTE SCRIPT_STRING_ANALYSIS BOOL
SCRIPT_CONTROL SCRIPT_STATE const void DWORD
@ D_CONFIGURATION
Definition DialogBase.h:11
const GUID MYGUID_DEFAULT
Definition Guids.h:5
const GUID MYGUID_NULL
Definition Guids.h:3
constexpr auto Clamp(T1 val, T2 min, T3 max)
@ REF_INANOTHER
Definition ServerTypes.h:45
@ REF_ONGROUND
Definition ServerTypes.h:43
@ FIREWEAPON_2
Definition binding.h:24
@ RCS_UP
Definition binding.h:26
@ DOWNSHIFT
Definition binding.h:19
@ FIREWEAPON_1
Definition binding.h:23
@ FLIGHTDIRECTOR_CYCLE
Definition binding.h:45
@ HORN
Definition binding.h:17
@ UPSHIFT
Definition binding.h:20
@ RCS_DOWN
Definition binding.h:25
@ RCS_LEFT
Definition binding.h:65
@ RCS_RIGHT
Definition binding.h:66
@ AIRSPACE
Definition binding.h:114
@ GV
Definition binding.h:113
@ INTERIOR
Definition binding.h:112
@ GLOBAL
Definition binding.h:111
float RightBrake
Definition Bus.h:383
float LeftBrake
Definition Bus.h:383
float EngineThrustLever[MAX_ENGINES]
Definition Bus.h:357
struct Bus::Afcs AFCS
float PitchTrimScalar
Definition Bus.h:415
Orbital::BusState orbit
Definition Bus.h:481
ButtonBinding(BindingEnum prmFunction, GUID prmGuid, unsigned char prmIndex)
Definition binding.h:241
InputConfig inputConfigSteer
Definition config.h:38
InputConfig inputConfigLeftToeBrake
Definition config.h:41
InputConfig inputConfigGas
Definition config.h:39
InputConfig inputConfigThrustRight
Definition config.h:36
InputConfig inputConfigLookLateral
Definition config.h:43
InputConfig inputConfigBrake
Definition config.h:40
std::vector< ButtonBinding > buttonBindings
Definition config.h:55
InputConfig inputConfigWalkLateral
Definition config.h:46
InputConfig inputConfigRoll
Definition config.h:33
InputConfig inputConfigLookVertical
Definition config.h:44
InputConfig inputConfigWalkVertical
Definition config.h:47
InputConfig inputConfigThrustLeft
Definition config.h:35
std::vector< POVBinding > povBindings
Definition config.h:56
InputConfig inputConfigYaw
Definition config.h:34
InputConfig inputConfigRightToeBrake
Definition config.h:42
InputConfig inputConfigPitch
Definition config.h:32
InputConfig inputConfigPitchTrim
Definition config.h:45
void SetButton(GUID guid, int index, std::string friendly)
void SetPOV(GUID guid, int index, DWORD value, std::string friendly)
static DialogBase * dialogs[D_ENUMERATION]
Definition DialogBase.h:41
std::unique_ptr< Bus > bus
Definition GameClass.h:108
Config config
Definition GameClass.h:100
std::unique_ptr< HMI > GUI
Definition GameClass.h:106
bool TurnOffDOR(bool preserveGuidance=false) const
void ToggleFullScreen(bool goFullScreen)
void AutopilotDisconnect() const
SPlayerData player[MAX_ONLINEPLAYERS]
Definition gui.h:1093
InformationDialog * informationDialog
Definition gui.h:1120
unsigned char ourplayerC
Definition gui.h:1094
bool DismissHelp(int helpId, int nControlID=GUI_UNDERSTOOD)
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition Logger.cpp:283
void AddToCallStack(const char *msg)
Definition Logger.cpp:355
@ Warn
Definition Logger.h:26
@ Fatal
Definition Logger.h:29
@ Error
Definition Logger.h:28
POVBinding(BindingEnum prmFunction, GUID prmGuid, unsigned char prmIndex, DWORD prmValue)
Definition binding.h:259
bool allowPan
Definition Camera.h:18
float rightlimit
Definition Camera.h:23
float leftlimit
Definition Camera.h:22
bool allowTilt
Definition Camera.h:19
float uplimit
Definition Camera.h:24
float downlimit
Definition Camera.h:25
bool pitchTrimMod
Definition Viewscreen.h:101
float steerInput
Definition Viewscreen.h:372
float yawInput
Definition Viewscreen.h:372
float pitchInput
Definition Viewscreen.h:372
void RunBindingFunction(BindingEnum function, bool repeating)
GameClass * gameclass
Definition Viewscreen.h:439
float rollInput
Definition Viewscreen.h:372
LPDIRECTINPUT8 g_pDI
Definition Viewscreen.h:210
float targetUpdown
Definition Viewscreen.h:445
float targetLeftright
Definition Viewscreen.h:444
Logger * logger
Definition Viewscreen.h:440
SCamera * camera
Definition Viewscreen.h:137
HWND hDlg
Definition joystick.h:35
std::vector< DIDEVICEINSTANCE > deviceList
Definition joystick.h:29
joystick(Viewscreen *ptr)
Definition joystick.cpp:130
static BOOL CALLBACK EnumDevicesCallback(const DIDEVICEINSTANCE *pInst, VOID *pContext)
void InitializeDevice(InputConfig *config, std::string control) const
Definition joystick.cpp:581
void Update(float fElapsedTime)
Definition joystick.cpp:271
std::vector< GUID > polledGuids
Definition joystick.h:47
static BOOL CALLBACK EnumAxesCallback(const DIDEVICEOBJECTINSTANCE *pdidoi, VOID *pContext)
HRESULT Poll(InputConfig *config, long *value)
Definition joystick.cpp:137
const int nullzone
Definition joystick.h:30
HRESULT EnumDevices()
Definition joystick.cpp:554
std::vector< DIJOYSTATE > polledDeviceStates
Definition joystick.h:48
Viewscreen * viewscreen
Definition joystick.h:33
void Initialize(HWND prmHWND)
Definition joystick.cpp:529
Logger * logger
Definition joystick.h:34
s_network_objects playerships[MAX_SCAN]
Definition globals.cpp:112
Scockpit ourcockpit
Definition globals.cpp:114
char g_bTextInput
Definition globals.cpp:61
#define trimlimiterC
Definition globals.h:44
bool ManualAttitudeDisconnect(const Guidance &g)
Definition OrbitState.h:355
HWND ClientWindow()
const wchar_t * ErrorString(HRESULT code)
bool DorOn
Definition Bus.h:148
bool AutothrottleEngaged
Definition Bus.h:88
bool TvmOn
Definition Bus.h:151
bool AutopilotEngaged
Definition Bus.h:87
float DesiredClosingSpeed
Definition Bus.h:152
bool IsFreeTrack() const
Definition InputConfig.h:23
LPDIRECTINPUTDEVICE8 g_pJoystick
Definition InputConfig.h:22
DIJOYSTATE oldJs
Definition InputConfig.h:28
std::string friendlyName
Definition InputConfig.h:26
unsigned char axis
Definition InputConfig.h:14
char steering
float moving
Definition globals.h:683
SVesselDC vdat
Definition globals.h:664
bool wheeled
Definition globals.h:596
float turnin
Definition globals.h:684
char engines
Definition globals.h:630
Logger * logger
Definition joystick.h:40
InputConfig * config
Definition joystick.h:39
GameClass * game
Definition joystick.h:41