Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/ois/win32/Win32ForceFeedback.cpp @ 10976

Last change on this file since 10976 was 9674, checked in by landauf, 11 years ago

fixed build for MinGW with GCC 4.6

  • Property svn:eol-style set to native
File size: 18.9 KB
RevLine 
[1505]1/*
2The zlib/libpng License
3
4Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
5
6This software is provided 'as-is', without any express or implied warranty. In no event will
7the authors be held liable for any damages arising from the use of this software.
8
9Permission is granted to anyone to use this software for any purpose, including commercial
10applications, and to alter it and redistribute it freely, subject to the following
11restrictions:
12
13    1. The origin of this software must not be misrepresented; you must not claim that
14                you wrote the original software. If you use this software in a product,
15                an acknowledgment in the product documentation would be appreciated but is
16                not required.
17
18    2. Altered source versions must be plainly marked as such, and must not be
19                misrepresented as being the original software.
20
21    3. This notice may not be removed or altered from any source distribution.
22*/
[8351]23#include "win32/Win32ForceFeedback.h"
[1505]24#include "OISException.h"
[8351]25#include <math.h>
[9674]26#include <cstddef>
[1505]27
[5695]28// 0 = No trace; 1 = Important traces; 2 = Debug traces
[5929]29#define OIS_WIN32_JOYFF_DEBUG 0
[5695]30
31#if (defined (_DEBUG) || defined(OIS_WIN32_JOYFF_DEBUG))
32  #include <iostream>
[1505]33  #include <sstream>
[5695]34  using namespace std;
[1505]35#endif
36
37using namespace OIS;
38
39//--------------------------------------------------------------//
[5695]40Win32ForceFeedback::Win32ForceFeedback(IDirectInputDevice8* pDIJoy, const DIDEVCAPS* pDIJoyCaps) :
41  mHandles(0), mJoyStick(pDIJoy), mFFAxes(0), mpDIJoyCaps(pDIJoyCaps)
[1505]42{
[5695]43#if (OIS_WIN32_JOYFF_DEBUG > 0)
44  cout << "FFSamplePeriod      : " << mpDIJoyCaps->dwFFSamplePeriod << " mu-s, "
45           << "FFMinTimeResolution : " << mpDIJoyCaps->dwFFMinTimeResolution << " mu-s,"
46           << "" << endl;
47#endif
[1505]48}
49
50//--------------------------------------------------------------//
51Win32ForceFeedback::~Win32ForceFeedback()
52{
53        //Get the effect - if it exists
54        for(EffectList::iterator i = mEffectList.begin(); i != mEffectList.end(); ++i )
55        {
56                LPDIRECTINPUTEFFECT dxEffect = i->second;
57                if( dxEffect )
[5695]58                {
[1505]59                        dxEffect->Unload();
[5695]60                        dxEffect->Release();
61                }
[1505]62        }
63
64        mEffectList.clear();
65}
66
67//--------------------------------------------------------------//
[5695]68short Win32ForceFeedback::getFFAxesNumber()
69{
70        return mFFAxes;
71}
72
73//--------------------------------------------------------------//
74unsigned short Win32ForceFeedback::getFFMemoryLoad()
75{
76    DIPROPDWORD dipdw;  // DIPROPDWORD contains a DIPROPHEADER structure.
77        dipdw.diph.dwSize       = sizeof(DIPROPDWORD); 
78        dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); 
79        dipdw.diph.dwObj        = 0; // device property
80        dipdw.diph.dwHow        = DIPH_DEVICE;
81        dipdw.dwData            = 0; // In case of any error.
82
83        const HRESULT hr = mJoyStick->GetProperty(DIPROP_FFLOAD, &dipdw.diph);
84        if(FAILED(hr))
85        {
86            if (hr == DIERR_NOTEXCLUSIVEACQUIRED)
87                    OIS_EXCEPT(E_General, "Can't query FF memory load as device was not acquired in exclusive mode");
88                else
89                    OIS_EXCEPT(E_General, "Unknown error querying FF memory load ->..");
90        }
91
92        return (unsigned short)dipdw.dwData;
93}
94
95//--------------------------------------------------------------//
[1505]96void Win32ForceFeedback::upload( const Effect* effect )
97{
98        switch( effect->force )
99        {
100                case OIS::Effect::ConstantForce: _updateConstantEffect(effect); break;
101                case OIS::Effect::RampForce: _updateRampEffect(effect); break;
102                case OIS::Effect::PeriodicForce: _updatePeriodicEffect(effect); break;
103                case OIS::Effect::ConditionalForce:     _updateConditionalEffect(effect); break;
104                //case OIS::Effect::CustomForce: _updateCustomEffect(effect); break;
105                default: OIS_EXCEPT(E_NotImplemented, "Requested Force not Implemented yet, sorry!"); break;
106        }
107}
108
109//--------------------------------------------------------------//
110void Win32ForceFeedback::modify( const Effect* eff )
111{
112        //Modifying is essentially the same as an upload, so, just reuse that function
113        upload(eff);
114}
115
116//--------------------------------------------------------------//
117void Win32ForceFeedback::remove( const Effect* eff )
118{
119        //Get the effect - if it exists
120        EffectList::iterator i = mEffectList.find(eff->_handle);
121        if( i != mEffectList.end() )
122        {
123                LPDIRECTINPUTEFFECT dxEffect = i->second;
124                if( dxEffect )
125                {
126                        dxEffect->Stop();
127                        //We care about the return value - as the effect might not
128                        //have been unlaoded
129                        if( SUCCEEDED(dxEffect->Unload()) )
[5695]130                        {
131                            dxEffect->Release();
[1505]132                                mEffectList.erase(i);
[5695]133                        }
[1505]134                }
135                else
136                        mEffectList.erase(i);
137        }
138}
139
140//--------------------------------------------------------------//
141void Win32ForceFeedback::setMasterGain( float level )
142{
143        //Between 0 - 10,000
144        int gain_level = (int)(10000.0f * level);
145
146        if( gain_level > 10000 )
147                gain_level = 10000;
148        else if( gain_level < 0 )
149                gain_level = 0;
150
151        DIPROPDWORD DIPropGain;
152        DIPropGain.diph.dwSize       = sizeof(DIPropGain);
153        DIPropGain.diph.dwHeaderSize = sizeof(DIPROPHEADER);
154        DIPropGain.diph.dwObj        = 0;
155        DIPropGain.diph.dwHow        = DIPH_DEVICE;
156        DIPropGain.dwData            = gain_level;
157
[5695]158#if (OIS_WIN32_JOYFF_DEBUG > 0)
159        cout << "Win32ForceFeedback("<< mJoyStick << ") : Setting master gain to " 
160                 << level << " => " << DIPropGain.dwData << endl;
161#endif
162
163        const HRESULT hr = mJoyStick->SetProperty(DIPROP_FFGAIN, &DIPropGain.diph);
164
165#if defined (_DEBUG)
166        if(FAILED(hr))
167            cout << "Failed to change master gain" << endl;
168#endif
[1505]169}
170
171//--------------------------------------------------------------//
172void Win32ForceFeedback::setAutoCenterMode( bool auto_on )
173{
174        DIPROPDWORD DIPropAutoCenter;
175        DIPropAutoCenter.diph.dwSize       = sizeof(DIPropAutoCenter);
176        DIPropAutoCenter.diph.dwHeaderSize = sizeof(DIPROPHEADER);
177        DIPropAutoCenter.diph.dwObj        = 0;
178        DIPropAutoCenter.diph.dwHow        = DIPH_DEVICE;
[5695]179        DIPropAutoCenter.dwData            = (auto_on ? DIPROPAUTOCENTER_ON : DIPROPAUTOCENTER_OFF);
[1505]180
[5695]181#if (OIS_WIN32_JOYFF_DEBUG > 0)
182        cout << "Win32ForceFeedback("<< mJoyStick << ") : Setting auto-center mode to " 
183                 << auto_on << " => " << DIPropAutoCenter.dwData << endl;
184#endif
185
186        const HRESULT hr = mJoyStick->SetProperty(DIPROP_AUTOCENTER, &DIPropAutoCenter.diph);
187
188#if defined (_DEBUG)
189        if(FAILED(hr))
190            cout << "Failed to change auto-center mode" << endl;
191#endif
[1505]192}
193
194//--------------------------------------------------------------//
195void Win32ForceFeedback::_updateConstantEffect( const Effect* effect )
196{
[5695]197        ConstantEffect *eff = static_cast<ConstantEffect*>(effect->getForceEffect());
198
[1505]199        DWORD           rgdwAxes[2]     = { DIJOFS_X, DIJOFS_Y };
200        LONG            rglDirection[2] = { 0, 0 };
[5695]201        DIENVELOPE      diEnvelope;
[1505]202        DICONSTANTFORCE cf;
203        DIEFFECT        diEffect;
204
205        //Currently only support 1 axis
206        //if( effect->getNumAxes() == 1 )
[5695]207        cf.lMagnitude = eff->level;
[1505]208
[5695]209#if (OIS_WIN32_JOYFF_DEBUG > 1)
210        cout << "  Level : " << eff->level
211                 << " => " << cf.lMagnitude << endl;
212#endif
213
214        _setCommonProperties(&diEffect, rgdwAxes, rglDirection, &diEnvelope, sizeof(DICONSTANTFORCE), &cf, effect, &eff->envelope);
[1505]215        _upload(GUID_ConstantForce, &diEffect, effect);
216}
217
218//--------------------------------------------------------------//
219void Win32ForceFeedback::_updateRampEffect( const Effect* effect )
220{
[5695]221        RampEffect *eff = static_cast<RampEffect*>(effect->getForceEffect());
222
[1505]223        DWORD           rgdwAxes[2]     = { DIJOFS_X, DIJOFS_Y };
224        LONG            rglDirection[2] = { 0, 0 };
[5695]225        DIENVELOPE      diEnvelope;
[1505]226        DIRAMPFORCE     rf;
227        DIEFFECT        diEffect;
228
229        //Currently only support 1 axis
[5695]230        rf.lStart = eff->startLevel;
231        rf.lEnd = eff->endLevel;
[1505]232
[5695]233        _setCommonProperties(&diEffect, rgdwAxes, rglDirection, &diEnvelope, sizeof(DIRAMPFORCE), &rf, effect, &eff->envelope );
[1505]234        _upload(GUID_RampForce, &diEffect, effect);
235}
236
237//--------------------------------------------------------------//
238void Win32ForceFeedback::_updatePeriodicEffect( const Effect* effect )
239{
[5695]240        PeriodicEffect *eff = static_cast<PeriodicEffect*>(effect->getForceEffect());
241
[1505]242        DWORD           rgdwAxes[2]     = { DIJOFS_X, DIJOFS_Y };
243        LONG            rglDirection[2] = { 0, 0 };
[5695]244        DIENVELOPE      diEnvelope;
[1505]245        DIPERIODIC      pf;
246        DIEFFECT        diEffect;
247
248        //Currently only support 1 axis
[5695]249        pf.dwMagnitude = eff->magnitude;
250        pf.lOffset = eff->offset;
251        pf.dwPhase = eff->phase;
252        pf.dwPeriod = eff->period;
[1505]253
[5695]254        _setCommonProperties(&diEffect, rgdwAxes, rglDirection, &diEnvelope, sizeof(DIPERIODIC), &pf, effect, &eff->envelope );
[1505]255
256        switch( effect->type )
257        {
258        case OIS::Effect::Square: _upload(GUID_Square, &diEffect, effect); break;
259        case OIS::Effect::Triangle: _upload(GUID_Triangle, &diEffect, effect); break;
260        case OIS::Effect::Sine: _upload(GUID_Sine, &diEffect, effect); break;
261        case OIS::Effect::SawToothUp: _upload(GUID_SawtoothUp, &diEffect, effect); break;
262        case OIS::Effect::SawToothDown: _upload(GUID_SawtoothDown, &diEffect, effect); break;
263        default: break;
264        }
265}
266
267//--------------------------------------------------------------//
268void Win32ForceFeedback::_updateConditionalEffect( const Effect* effect )
269{
[5695]270        ConditionalEffect *eff = static_cast<ConditionalEffect*>(effect->getForceEffect());
271
[1505]272        DWORD           rgdwAxes[2]     = { DIJOFS_X, DIJOFS_Y };
273        LONG            rglDirection[2] = { 0, 0 };
[5695]274        DIENVELOPE      diEnvelope;
[1505]275        DICONDITION     cf;
276        DIEFFECT        diEffect;
277
[5695]278        cf.lOffset = eff->deadband;
279        cf.lPositiveCoefficient = eff->rightCoeff;
280        cf.lNegativeCoefficient = eff->leftCoeff;
281        cf.dwPositiveSaturation = eff->rightSaturation;
282        cf.dwNegativeSaturation = eff->leftSaturation;
283        cf.lDeadBand = eff->deadband;
[1505]284
[5695]285        _setCommonProperties(&diEffect, rgdwAxes, rglDirection, &diEnvelope, sizeof(DICONDITION), &cf, effect, 0 );
[1505]286
287        switch( effect->type )
288        {
289        case OIS::Effect::Friction:     _upload(GUID_Friction, &diEffect, effect); break;
290        case OIS::Effect::Damper: _upload(GUID_Damper, &diEffect, effect); break;
291        case OIS::Effect::Inertia: _upload(GUID_Inertia, &diEffect, effect); break;
292        case OIS::Effect::Spring: _upload(GUID_Spring, &diEffect, effect); break;
293        default: break;
294        }
295}
296
297//--------------------------------------------------------------//
298void Win32ForceFeedback::_updateCustomEffect( const Effect* /*effect*/ )
299{
[5695]300    //CustomEffect *eff = static_cast<CustomEffect*>(effect->getForceEffect());
301    //
[1505]302        //DWORD           rgdwAxes[2]     = { DIJOFS_X, DIJOFS_Y };
303        //LONG            rglDirection[2] = { 0, 0 };
[5695]304        //DIENVELOPE      diEnvelope;
[1505]305        //DICUSTOMFORCE cf;
306        //DIEFFECT        diEffect;
307        //cf.cChannels = 0;
308        //cf.dwSamplePeriod = 0;
309        //cf.cSamples = 0;
310        //cf.rglForceData = 0;
[5695]311        //_setCommonProperties(&diEffect, rgdwAxes, rglDirection, &diEnvelope, sizeof(DICUSTOMFORCE), &cf, effect, &eff->envelope);
[1505]312        //_upload(GUID_CustomForce, &diEffect, effect);
313}
314
315//--------------------------------------------------------------//
316void Win32ForceFeedback::_setCommonProperties(
317                DIEFFECT* diEffect, DWORD* rgdwAxes,
[5695]318                LONG* rglDirection, DIENVELOPE* diEnvelope, DWORD struct_size,
319                LPVOID struct_type, const Effect* effect, const Envelope* envelope )
[1505]320{
321        ZeroMemory(diEffect, sizeof(DIEFFECT));
322
323        diEffect->dwSize                  = sizeof(DIEFFECT);
324        diEffect->dwFlags                 = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
325        diEffect->dwGain                  = DI_FFNOMINALMAX;
[5695]326
327        diEffect->dwTriggerButton         = DIEB_NOTRIGGER; // effect->trigger_button; // TODO: Conversion
328        diEffect->dwTriggerRepeatInterval = effect->trigger_interval;
329
330#if (OIS_WIN32_JOYFF_DEBUG > 1)
331        cout << "  Trigger :" << endl
332                 << "    Button   : " << effect->trigger_button
333                 << " => " << diEffect->dwTriggerButton << endl
334                 << "    Interval : " << effect->trigger_interval
335                 << " => " << diEffect->dwTriggerRepeatInterval << endl;
336#endif
337
338        diEffect->cAxes                   = 1; // effect->getNumAxes();
[1505]339        diEffect->rgdwAxes                = rgdwAxes;
[5695]340
341        diEffect->rglDirection            = rglDirection; // TODO: conversion from effect->direction
342
343#if (OIS_WIN32_JOYFF_DEBUG > 1)
344        cout << "  Direction : " << Effect::getDirectionName(effect->direction)
345                 << " => {";
346        for (int iDir=0; iDir < (int)diEffect->cAxes; iDir++)
347          cout << " " << diEffect->rglDirection[iDir];
348        cout << "}" << endl;
349#endif
350
351        if (diEnvelope && envelope && envelope->isUsed())
352        {
353            diEnvelope->dwSize = sizeof(DIENVELOPE);
354            diEnvelope->dwAttackLevel = envelope->attackLevel;
355            diEnvelope->dwAttackTime  = envelope->attackLength;
356            diEnvelope->dwFadeLevel   = envelope->fadeLevel;
357            diEnvelope->dwFadeTime    = envelope->fadeLength;
358            diEffect->lpEnvelope = diEnvelope;
359        }
360        else
361            diEffect->lpEnvelope = 0;
362
363#if (OIS_WIN32_JOYFF_DEBUG > 1)
364        if (diEnvelope && envelope && envelope->isUsed())
365        {
366                cout << "  Enveloppe :" << endl
367                         << "    AttackLen : " << envelope->attackLength
368                         << " => " << diEnvelope->dwAttackTime << endl
369                         << "    AttackLvl : " << envelope->attackLevel
370                         << " => " << diEnvelope->dwAttackLevel << endl
371                         << "    FadeLen   : " << envelope->fadeLength
372                         << " => " << diEnvelope->dwFadeTime << endl
373                         << "    FadeLvl   : " << envelope->fadeLevel
374                         << " => " << diEnvelope->dwFadeLevel << endl;
375        }
376#endif
377
378        diEffect->dwSamplePeriod          = 0;
379        diEffect->dwDuration              = effect->replay_length;
380        diEffect->dwStartDelay            = effect->replay_delay;
381
382#if (OIS_WIN32_JOYFF_DEBUG > 1)
383        cout << "  Replay :" << endl
384                 << "    Length : " << effect->replay_length
385                 << " => " << diEffect->dwDuration << endl
386                 << "    Delay  : " << effect->replay_delay
387                 << " => " << diEffect->dwStartDelay << endl;
388#endif
389
[1505]390        diEffect->cbTypeSpecificParams    = struct_size;
391        diEffect->lpvTypeSpecificParams   = struct_type;
392}
393
394//--------------------------------------------------------------//
395void Win32ForceFeedback::_upload( GUID guid, DIEFFECT* diEffect, const Effect* effect)
396{
397        LPDIRECTINPUTEFFECT dxEffect = 0;
398
399        //Get the effect - if it exists
400        EffectList::iterator i = mEffectList.find(effect->_handle);
401        //It has been created already
402        if( i != mEffectList.end() )
403                dxEffect = i->second;
404        else //This effect has not yet been created - generate a handle
405                effect->_handle = mHandles++;
406
407        if( dxEffect == 0 )
408        {
409                //This effect has not yet been created, so create it
410                HRESULT hr = mJoyStick->CreateEffect(guid, diEffect, &dxEffect, NULL);
411                if(SUCCEEDED(hr))
412                {
413                        mEffectList[effect->_handle] = dxEffect;
414                        dxEffect->Start(INFINITE,0);
415                }
416                else if( hr == DIERR_DEVICEFULL )
417                        OIS_EXCEPT(E_DeviceFull, "Remove an effect before adding more!");
418                else
419                        OIS_EXCEPT(E_General, "Unknown error creating effect->..");
420        }
421        else
422        {
423                //ToDo -- Update the Effect
424                HRESULT hr = dxEffect->SetParameters( diEffect, DIEP_DIRECTION |
425                        DIEP_DURATION | DIEP_ENVELOPE | DIEP_STARTDELAY | DIEP_TRIGGERBUTTON |
426                        DIEP_TRIGGERREPEATINTERVAL | DIEP_TYPESPECIFICPARAMS | DIEP_START );
427
428                if(FAILED(hr)) OIS_EXCEPT(E_InvalidParam, "Error updating device!");
429        }
430}
431
432//--------------------------------------------------------------//
433void Win32ForceFeedback::_addEffectSupport( LPCDIEFFECTINFO pdei )
434{
[5695]435#if (OIS_WIN32_JOYFF_DEBUG > 0)
436    // Dump some usefull information about the effect type.
437    cout << "Adding support for '" << pdei->tszName << "' effect type" << endl;
438        cout << "  Supported static params: ";
439        if (pdei->dwStaticParams & DIEP_AXES) cout << " Axes";
440        if (pdei->dwStaticParams & DIEP_DIRECTION) cout << " Direction";
441        if (pdei->dwStaticParams & DIEP_DURATION) cout << " Duration";
442        if (pdei->dwStaticParams & DIEP_ENVELOPE) cout << " Envelope";
443        if (pdei->dwStaticParams & DIEP_GAIN) cout << " Gain";
444        if (pdei->dwStaticParams & DIEP_SAMPLEPERIOD) cout << " SamplePeriod";
445        if (pdei->dwStaticParams & DIEP_STARTDELAY) cout << " StartDelay";
446        if (pdei->dwStaticParams & DIEP_TRIGGERBUTTON) cout << " TriggerButton";
447        if (pdei->dwStaticParams & DIEP_TRIGGERREPEATINTERVAL) cout << " TriggerRepeatInterval";
448        if (pdei->dwStaticParams & DIEP_TYPESPECIFICPARAMS) cout << " TypeSpecificParams";
449        cout << endl;
450        cout << "  Supported dynamic params: ";
451        if (pdei->dwDynamicParams & DIEP_AXES) cout << " Axes";
452        if (pdei->dwDynamicParams & DIEP_DIRECTION) cout << " Direction";
453        if (pdei->dwDynamicParams & DIEP_DURATION) cout << " Duration";
454        if (pdei->dwDynamicParams & DIEP_ENVELOPE) cout << " Envelope";
455        if (pdei->dwDynamicParams & DIEP_GAIN) cout << " Gain";
456        if (pdei->dwDynamicParams & DIEP_SAMPLEPERIOD) cout << " SamplePeriod";
457        if (pdei->dwDynamicParams & DIEP_STARTDELAY) cout << " StartDelay";
458        if (pdei->dwDynamicParams & DIEP_TRIGGERBUTTON) cout << " TriggerButton";
459        if (pdei->dwDynamicParams & DIEP_TRIGGERREPEATINTERVAL) cout << " TriggerRepeatInterval";
460        if (pdei->dwDynamicParams & DIEP_TYPESPECIFICPARAMS) cout << " TypeSpecificParams";
461        cout << endl;
462        cout << "  More details about supported parameters support: ";
463        if (pdei->dwEffType & DIEFT_STARTDELAY) cout << " StartDelay";
464        if (pdei->dwEffType & DIEFT_FFATTACK) cout << " Attack";
465        if (pdei->dwEffType & DIEFT_FFFADE) cout << " Fade";
466        if (pdei->dwEffType & DIEFT_DEADBAND) cout << " DeadBand";
467        if (pdei->dwEffType & DIEFT_SATURATION) cout << " Saturation";
468        if (pdei->dwEffType & DIEFT_POSNEGSATURATION) cout << " PosNegaturation";
469        if (pdei->dwEffType & DIEFT_POSNEGCOEFFICIENTS) cout << " PosNegCoefficients";
470        if (pdei->dwEffType & DIEFT_HARDWARE) cout << " HardwareSpecific";
471        cout << endl;
472#endif
473
474    Effect::EForce eForce;
475        switch (DIEFT_GETTYPE(pdei->dwEffType))
476        {
477            case DIEFT_CONSTANTFORCE:
478                    eForce = Effect::ConstantForce;
479                        break;
480            case DIEFT_RAMPFORCE:
481                    eForce = Effect::RampForce;
482                        break;
483            case DIEFT_PERIODIC:
484                    eForce = Effect::PeriodicForce;
485                        break;
486            case DIEFT_CONDITION:
487                    eForce = Effect::ConditionalForce;
488                        break;
489            case DIEFT_CUSTOMFORCE:
490                    eForce = Effect::CustomForce;
491                        break;
492            default:
493                    eForce = Effect::UnknownForce;
494#if defined (_DEBUG)
495                        cout << "Win32ForceFeedback: DirectInput8 Effect type support not implemented: " 
496                                 << "DIEFT_GETTYPE="<< (int)DIEFT_GETTYPE(pdei->dwEffType) << endl;
497#endif
498                        return;
499        }
500
501        //Determine what the effect type is and how it corresponds to our OIS's Enums
502        //We could save the GUIDs too, however, we will just use the predefined ones later
[1505]503        if( pdei->guid == GUID_ConstantForce )
[5695]504                _addEffectTypes(eForce, Effect::Constant );
[1505]505        else if( pdei->guid == GUID_Triangle )
[5695]506                _addEffectTypes(eForce, Effect::Triangle );
[1505]507        else if( pdei->guid == GUID_Spring )
[5695]508                _addEffectTypes(eForce, Effect::Spring );
[1505]509        else if( pdei->guid == GUID_Friction )
[5695]510                _addEffectTypes(eForce, Effect::Friction );
[1505]511        else if( pdei->guid == GUID_Square )
[5695]512                _addEffectTypes(eForce, Effect::Square );
[1505]513        else if( pdei->guid == GUID_Sine )
[5695]514                _addEffectTypes(eForce, Effect::Sine );
[1505]515        else if( pdei->guid == GUID_SawtoothUp )
[5695]516                _addEffectTypes(eForce, Effect::SawToothUp );
[1505]517        else if( pdei->guid == GUID_SawtoothDown )
[5695]518                _addEffectTypes(eForce, Effect::SawToothDown );
[1505]519        else if( pdei->guid == GUID_Damper )
[5695]520                _addEffectTypes(eForce, Effect::Damper );
[1505]521        else if( pdei->guid == GUID_Inertia )
[5695]522                _addEffectTypes(eForce, Effect::Inertia );
[1505]523        else if( pdei->guid == GUID_CustomForce )
[5695]524                _addEffectTypes(eForce, Effect::Custom );
[1505]525        else if( pdei->guid == GUID_RampForce )
[5695]526                _addEffectTypes(eForce, Effect::Ramp );
527
[1505]528#if defined (_DEBUG)
529        //Only care about this for Debugging Purposes
530        //else
531        //{
532        //      std::ostringstream ss;
533        //      ss << "Win32ForceFeedback, DirectInput8 Effect not found. Reported as: "
534        //         << pdei->tszName;
535        //      OIS_EXCEPT( E_General, ss.str().c_str());
536        //}
537#endif
538}
[5695]539
540//--------------------------------------------------------------//
541void Win32ForceFeedback::_addFFAxis()
542{
543        mFFAxes++;
544}
Note: See TracBrowser for help on using the repository browser.