@@ -363,36 +363,44 @@ BOOL CJoystickManager::DoEnumObjectsCallback(const DIDEVICEOBJECTINSTANCE* pdido
363
363
int axisIndex = -1 ;
364
364
365
365
if (pdidoi->guidType == GUID_XAxis)
366
- axisIndex = 0 ;
366
+ axisIndex = eJoyX ;
367
367
if (pdidoi->guidType == GUID_YAxis)
368
- axisIndex = 1 ;
368
+ axisIndex = eJoyY ;
369
369
if (pdidoi->guidType == GUID_ZAxis)
370
- axisIndex = 2 ;
370
+ axisIndex = eJoyZ ;
371
371
if (pdidoi->guidType == GUID_RxAxis)
372
- axisIndex = 3 ;
372
+ axisIndex = eJoyRx ;
373
373
if (pdidoi->guidType == GUID_RyAxis)
374
- axisIndex = 4 ;
374
+ axisIndex = eJoyRy ;
375
375
if (pdidoi->guidType == GUID_RzAxis)
376
- axisIndex = 5 ;
376
+ axisIndex = eJoyRz ;
377
377
if (pdidoi->guidType == GUID_Slider)
378
- axisIndex = 6 ;
378
+ axisIndex = eJoyS1 ;
379
379
380
+ SString strStatus;
380
381
// Save the range and the axis index
381
382
if (axisIndex >= 0 && axisIndex < NUMELMS (m_DevInfo.axis ) && range.lMin < range.lMax )
382
383
{
383
- m_DevInfo.axis [axisIndex].lMin = range.lMin ;
384
- m_DevInfo.axis [axisIndex].lMax = range.lMax ;
385
- m_DevInfo.axis [axisIndex].bEnabled = true ;
386
- m_DevInfo.axis [axisIndex].dwType = pdidoi->dwType ;
387
-
388
- m_DevInfo.iAxisCount ++;
389
- WriteDebugEvent (
390
- SString (" Added axis index %d. lMin:%d lMax:%d (iAxisCount:%d)" , axisIndex, range.lMin , range.lMax , m_DevInfo.iAxisCount ));
384
+ if (!m_DevInfo.axis [axisIndex].bEnabled )
385
+ {
386
+ m_DevInfo.axis [axisIndex].lMin = range.lMin ;
387
+ m_DevInfo.axis [axisIndex].lMax = range.lMax ;
388
+ m_DevInfo.axis [axisIndex].bEnabled = true ;
389
+ m_DevInfo.axis [axisIndex].dwType = pdidoi->dwType ;
390
+
391
+ m_DevInfo.iAxisCount ++;
392
+ strStatus = SString (" Added axis index %d. lMin:%d lMax:%d (iAxisCount:%d)" , axisIndex, range.lMin , range.lMax , m_DevInfo.iAxisCount );
393
+ }
394
+ else
395
+ {
396
+ strStatus = SString (" Ignoring duplicate axis index %d" , axisIndex);
397
+ }
391
398
}
392
399
else
393
400
{
394
- WriteDebugEvent ( SStringX ( " Failed to recognise axis" )) ;
401
+ strStatus = " Failed to recognise axis" ;
395
402
}
403
+ WriteDebugEvent (" " + strStatus);
396
404
397
405
#ifdef MTA_DEBUG
398
406
#if 0
0 commit comments