For DOS Protected Mode version of sensor core software
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

574 lines
18 KiB

3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //-----------------------------------------------------------------------------
  2. // File: FFConst.cpp
  3. //
  4. // Desc: Demonstrates an application which sets a force feedback constant force
  5. // determined by the user.
  6. //
  7. // Copyright (c) Microsoft Corporation. All rights reserved.
  8. //-----------------------------------------------------------------------------
  9. #define STRICT
  10. #define DIRECTINPUT_VERSION 0x0800
  11. #include <windows.h>
  12. #include <windowsx.h>
  13. #include <tchar.h>
  14. #include <commctrl.h>
  15. #include <basetsd.h>
  16. #include <mmsystem.h>
  17. #pragma warning(push)
  18. #pragma warning(disable:6000 28251)
  19. #include <dinput.h>
  20. #pragma warning(pop)
  21. #include <math.h>
  22. #include "resource.h"
  23. #if defined(DEBUG) | defined(_DEBUG)
  24. #include <crtdbg.h>
  25. #endif
  26. //-----------------------------------------------------------------------------
  27. // Function prototypes
  28. //-----------------------------------------------------------------------------
  29. INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam );
  30. BOOL CALLBACK EnumFFDevicesCallback( const DIDEVICEINSTANCE* pInst, VOID* pContext );
  31. BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext );
  32. HRESULT InitDirectInput( HWND hDlg );
  33. VOID FreeDirectInput();
  34. VOID OnPaint( HWND hDlg );
  35. HRESULT OnMouseMove( HWND hDlg, INT x, INT y, UINT keyFlags );
  36. VOID OnLeftButtonDown( HWND hDlg, INT x, INT y, UINT keyFlags );
  37. VOID OnLeftButtonUp( HWND hDlg, INT x, INT y, UINT keyFlags );
  38. INT CoordToForce( INT x );
  39. HRESULT SetDeviceForcesXY();
  40. //-----------------------------------------------------------------------------
  41. // Defines, constants, and global variables
  42. //-----------------------------------------------------------------------------
  43. #define SAFE_DELETE(p) { if(p) { delete (p); (p)=nullptr; } }
  44. #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } }
  45. #define FEEDBACK_WINDOW_X 20
  46. #define FEEDBACK_WINDOW_Y 60
  47. #define FEEDBACK_WINDOW_WIDTH 200
  48. LPDIRECTINPUT8 g_pDI = nullptr;
  49. LPDIRECTINPUTDEVICE8 g_pDevice = nullptr;
  50. LPDIRECTINPUTEFFECT g_pEffect = nullptr;
  51. BOOL g_bActive = TRUE;
  52. DWORD g_dwNumForceFeedbackAxis = 0;
  53. INT g_nXForce;
  54. INT g_nYForce;
  55. DWORD g_dwLastEffectSet; // Time of the previous force feedback effect set
  56. //-----------------------------------------------------------------------------
  57. // Name: WinMain()
  58. // Desc: Entry point for the application. Since we use a simple dialog for
  59. // user interaction we don't need to pump messages.
  60. //-----------------------------------------------------------------------------
  61. INT WINAPI WinMain( _In_ HINSTANCE hInst, _In_opt_ HINSTANCE, _In_ LPSTR, _In_ INT )
  62. {
  63. // Enable run-time memory check for debug builds.
  64. #if defined(DEBUG) | defined(_DEBUG)
  65. _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
  66. #endif
  67. InitCommonControls();
  68. // Display the main dialog box.
  69. DialogBox( hInst, MAKEINTRESOURCE( IDD_FORCE_FEEDBACK ), nullptr, MainDlgProc );
  70. return 0;
  71. }
  72. //-----------------------------------------------------------------------------
  73. // Name: MainDlgProc
  74. // Desc: Handles dialog messages
  75. //-----------------------------------------------------------------------------
  76. INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
  77. {
  78. switch( msg )
  79. {
  80. case WM_INITDIALOG:
  81. if( FAILED( InitDirectInput( hDlg ) ) )
  82. {
  83. MessageBox( nullptr, _T( "Error Initializing DirectInput " )
  84. _T( "The sample will now exit." ),
  85. _T( "FFConst" ), MB_ICONERROR | MB_OK );
  86. EndDialog( hDlg, 0 );
  87. }
  88. // Init the time of the last force feedback effect
  89. g_dwLastEffectSet = timeGetTime();
  90. break;
  91. case WM_MOUSEMOVE:
  92. if( FAILED( OnMouseMove( hDlg, GET_X_LPARAM( lParam ), GET_Y_LPARAM( lParam ), ( UINT )wParam ) ) )
  93. {
  94. MessageBox( nullptr, _T( "Error setting effect parameters. " )
  95. _T( "The sample will now exit." ),
  96. _T( "FFConst" ), MB_ICONERROR | MB_OK );
  97. EndDialog( hDlg, 0 );
  98. }
  99. break;
  100. case WM_LBUTTONDOWN:
  101. OnLeftButtonDown( hDlg, GET_X_LPARAM( lParam ), GET_Y_LPARAM( lParam ), ( UINT )wParam );
  102. break;
  103. case WM_LBUTTONUP:
  104. OnLeftButtonUp( hDlg, GET_X_LPARAM( lParam ), GET_Y_LPARAM( lParam ), ( UINT )wParam );
  105. break;
  106. case WM_PAINT:
  107. OnPaint( hDlg );
  108. break;
  109. case WM_ACTIVATE:
  110. if( WA_INACTIVE != wParam && g_pDevice )
  111. {
  112. // Make sure the device is acquired, if we are gaining focus.
  113. g_pDevice->Acquire();
  114. if( g_pEffect )
  115. g_pEffect->Start( 1, 0 ); // Start the effect
  116. }
  117. break;
  118. case WM_COMMAND:
  119. switch( LOWORD( wParam ) )
  120. {
  121. case IDCANCEL:
  122. EndDialog( hDlg, 0 );
  123. break;
  124. default:
  125. return FALSE; // Message not handled
  126. }
  127. break;
  128. case WM_DESTROY:
  129. // Cleanup everything
  130. KillTimer( hDlg, 0 );
  131. FreeDirectInput();
  132. break;
  133. default:
  134. return FALSE; // Message not handled
  135. }
  136. return TRUE; // Message handled
  137. }
  138. //-----------------------------------------------------------------------------
  139. // Name: InitDirectInput()
  140. // Desc: Initialize the DirectInput variables.
  141. //-----------------------------------------------------------------------------
  142. HRESULT InitDirectInput( HWND hDlg )
  143. {
  144. DIPROPDWORD dipdw;
  145. HRESULT hr;
  146. // Register with the DirectInput subsystem and get a pointer
  147. // to a IDirectInput interface we can use.
  148. if( FAILED( hr = DirectInput8Create( GetModuleHandle( nullptr ), DIRECTINPUT_VERSION,
  149. IID_IDirectInput8, ( VOID** )&g_pDI, nullptr ) ) )
  150. {
  151. return hr;
  152. }
  153. // Look for a force feedback device we can use
  154. if( FAILED( hr = g_pDI->EnumDevices( DI8DEVCLASS_GAMECTRL,
  155. EnumFFDevicesCallback, nullptr,
  156. DIEDFL_ATTACHEDONLY | DIEDFL_FORCEFEEDBACK ) ) )
  157. {
  158. return hr;
  159. }
  160. if( !g_pDevice )
  161. {
  162. MessageBox( nullptr, _T( "Force feedback device not found. " )
  163. _T( "The sample will now exit." ),
  164. _T( "FFConst" ), MB_ICONERROR | MB_OK );
  165. EndDialog( hDlg, 0 );
  166. return S_OK;
  167. }
  168. // Set the data format to "simple joystick" - a predefined data format. A
  169. // data format specifies which controls on a device we are interested in,
  170. // and how they should be reported.
  171. //
  172. // This tells DirectInput that we will be passing a DIJOYSTATE structure to
  173. // IDirectInputDevice8::GetDeviceState(). Even though we won't actually do
  174. // it in this sample. But setting the data format is important so that the
  175. // DIJOFS_* values work properly.
  176. if( FAILED( hr = g_pDevice->SetDataFormat( &c_dfDIJoystick ) ) )
  177. return hr;
  178. // Set the cooperative level to let DInput know how this device should
  179. // interact with the system and with other DInput applications.
  180. // Exclusive access is required in order to perform force feedback.
  181. if( FAILED( hr = g_pDevice->SetCooperativeLevel( hDlg,
  182. DISCL_EXCLUSIVE |
  183. DISCL_FOREGROUND ) ) )
  184. {
  185. return hr;
  186. }
  187. // Since we will be playing force feedback effects, we should disable the
  188. // auto-centering spring.
  189. dipdw.diph.dwSize = sizeof( DIPROPDWORD );
  190. dipdw.diph.dwHeaderSize = sizeof( DIPROPHEADER );
  191. dipdw.diph.dwObj = 0;
  192. dipdw.diph.dwHow = DIPH_DEVICE;
  193. dipdw.dwData = FALSE;
  194. if( FAILED( hr = g_pDevice->SetProperty( DIPROP_AUTOCENTER, &dipdw.diph ) ) )
  195. return hr;
  196. // Enumerate and count the axes of the joystick
  197. if( FAILED( hr = g_pDevice->EnumObjects( EnumAxesCallback,
  198. ( VOID* )&g_dwNumForceFeedbackAxis, DIDFT_AXIS ) ) )
  199. return hr;
  200. // This simple sample only supports one or two axis joysticks
  201. if( g_dwNumForceFeedbackAxis > 2 )
  202. g_dwNumForceFeedbackAxis = 2;
  203. // This application needs only one effect: Applying raw forces.
  204. DWORD rgdwAxes[2] = { DIJOFS_X, DIJOFS_Y };
  205. LONG rglDirection[2] = { 0, 0 };
  206. DICONSTANTFORCE cf = { 0 };
  207. DIEFFECT eff;
  208. ZeroMemory( &eff, sizeof( eff ) );
  209. eff.dwSize = sizeof( DIEFFECT );
  210. eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
  211. eff.dwDuration = INFINITE;
  212. eff.dwSamplePeriod = 0;
  213. eff.dwGain = DI_FFNOMINALMAX;
  214. eff.dwTriggerButton = DIEB_NOTRIGGER;
  215. eff.dwTriggerRepeatInterval = 0;
  216. eff.cAxes = g_dwNumForceFeedbackAxis;
  217. eff.rgdwAxes = rgdwAxes;
  218. eff.rglDirection = rglDirection;
  219. eff.lpEnvelope = 0;
  220. eff.cbTypeSpecificParams = sizeof( DICONSTANTFORCE );
  221. eff.lpvTypeSpecificParams = &cf;
  222. eff.dwStartDelay = 0;
  223. // Create the prepared effect
  224. if( FAILED( hr = g_pDevice->CreateEffect( GUID_ConstantForce,
  225. &eff, &g_pEffect, nullptr ) ) )
  226. {
  227. return hr;
  228. }
  229. if( !g_pEffect )
  230. return E_FAIL;
  231. return S_OK;
  232. }
  233. //-----------------------------------------------------------------------------
  234. // Name: EnumAxesCallback()
  235. // Desc: Callback function for enumerating the axes on a joystick and counting
  236. // each force feedback enabled axis
  237. //-----------------------------------------------------------------------------
  238. BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi,
  239. VOID* pContext )
  240. {
  241. auto pdwNumForceFeedbackAxis = reinterpret_cast<DWORD*>( pContext );
  242. if( ( pdidoi->dwFlags & DIDOI_FFACTUATOR ) != 0 )
  243. ( *pdwNumForceFeedbackAxis )++;
  244. return DIENUM_CONTINUE;
  245. }
  246. //-----------------------------------------------------------------------------
  247. // Name: EnumFFDevicesCallback()
  248. // Desc: Called once for each enumerated force feedback device. If we find
  249. // one, create a device interface on it so we can play with it.
  250. //-----------------------------------------------------------------------------
  251. BOOL CALLBACK EnumFFDevicesCallback( const DIDEVICEINSTANCE* pInst,
  252. VOID* pContext )
  253. {
  254. LPDIRECTINPUTDEVICE8 pDevice;
  255. HRESULT hr;
  256. // Obtain an interface to the enumerated force feedback device.
  257. hr = g_pDI->CreateDevice( pInst->guidInstance, &pDevice, nullptr );
  258. // If it failed, then we can't use this device for some
  259. // bizarre reason. (Maybe the user unplugged it while we
  260. // were in the middle of enumerating it.) So continue enumerating
  261. if( FAILED( hr ) )
  262. return DIENUM_CONTINUE;
  263. // We successfully created an IDirectInputDevice8. So stop looking
  264. // for another one.
  265. g_pDevice = pDevice;
  266. return DIENUM_STOP;
  267. }
  268. //-----------------------------------------------------------------------------
  269. // Name: FreeDirectInput()
  270. // Desc: Initialize the DirectInput variables.
  271. //-----------------------------------------------------------------------------
  272. VOID FreeDirectInput()
  273. {
  274. // Unacquire the device one last time just in case
  275. // the app tried to exit while the device is still acquired.
  276. if( g_pDevice )
  277. g_pDevice->Unacquire();
  278. // Release any DirectInput objects.
  279. SAFE_RELEASE( g_pEffect );
  280. SAFE_RELEASE( g_pDevice );
  281. SAFE_RELEASE( g_pDI );
  282. }
  283. //-----------------------------------------------------------------------------
  284. // Name: OnPaint()
  285. // Desc: Handles the WM_PAINT window message
  286. //-----------------------------------------------------------------------------
  287. VOID OnPaint( HWND hDlg )
  288. {
  289. PAINTSTRUCT ps;
  290. HDC hDC;
  291. HPEN hpenOld;
  292. HPEN hpenBlack;
  293. HBRUSH hbrOld;
  294. HBRUSH hbrBlack;
  295. INT x;
  296. INT y;
  297. hDC = BeginPaint( hDlg, &ps );
  298. if( !hDC )
  299. return;
  300. // Everything is scaled to the size of the window.
  301. hpenBlack = GetStockPen( BLACK_PEN );
  302. hpenOld = SelectPen( hDC, hpenBlack );
  303. // Draw force feedback bounding rect
  304. MoveToEx( hDC, FEEDBACK_WINDOW_X, FEEDBACK_WINDOW_Y, nullptr );
  305. LineTo( hDC, FEEDBACK_WINDOW_X,
  306. FEEDBACK_WINDOW_Y + FEEDBACK_WINDOW_WIDTH );
  307. LineTo( hDC, FEEDBACK_WINDOW_X + FEEDBACK_WINDOW_WIDTH,
  308. FEEDBACK_WINDOW_Y + FEEDBACK_WINDOW_WIDTH );
  309. LineTo( hDC, FEEDBACK_WINDOW_X + FEEDBACK_WINDOW_WIDTH,
  310. FEEDBACK_WINDOW_Y );
  311. LineTo( hDC, FEEDBACK_WINDOW_X,
  312. FEEDBACK_WINDOW_Y );
  313. // Calculate center of feedback window for center marker
  314. x = FEEDBACK_WINDOW_X + FEEDBACK_WINDOW_WIDTH / 2;
  315. y = FEEDBACK_WINDOW_Y + FEEDBACK_WINDOW_WIDTH / 2;
  316. // Draw center marker
  317. MoveToEx( hDC, x, y - 10, nullptr );
  318. LineTo( hDC, x, y + 10 + 1 );
  319. MoveToEx( hDC, x - 10, y, nullptr );
  320. LineTo( hDC, x + 10 + 1, y );
  321. hbrBlack = GetStockBrush( BLACK_BRUSH );
  322. hbrOld = SelectBrush( hDC, hbrBlack );
  323. x = MulDiv( FEEDBACK_WINDOW_WIDTH,
  324. g_nXForce + DI_FFNOMINALMAX,
  325. 2 * DI_FFNOMINALMAX );
  326. y = MulDiv( FEEDBACK_WINDOW_WIDTH,
  327. g_nYForce + DI_FFNOMINALMAX,
  328. 2 * DI_FFNOMINALMAX );
  329. x += FEEDBACK_WINDOW_X;
  330. y += FEEDBACK_WINDOW_Y;
  331. Ellipse( hDC, x - 5, y - 5, x + 6, y + 6 );
  332. SelectBrush( hDC, hbrOld );
  333. SelectPen( hDC, hpenOld );
  334. EndPaint( hDlg, &ps );
  335. }
  336. //-----------------------------------------------------------------------------
  337. // Name: OnMouseMove()
  338. // Desc: If the mouse button is down, then change the direction of
  339. // the force to match the new location.
  340. //-----------------------------------------------------------------------------
  341. HRESULT OnMouseMove( HWND hDlg, INT x, INT y, UINT keyFlags )
  342. {
  343. HRESULT hr;
  344. DWORD dwCurrentTime;
  345. if( !g_pEffect )
  346. return S_OK;
  347. if( keyFlags & MK_LBUTTON )
  348. {
  349. dwCurrentTime = timeGetTime();
  350. if( dwCurrentTime - g_dwLastEffectSet < 100 )
  351. {
  352. // Don't allow setting effect more often than
  353. // 100ms since every time an effect is set, the
  354. // device will jerk.
  355. //
  356. // Note: This is not neccessary, and is specific to this sample
  357. return S_OK;
  358. }
  359. g_dwLastEffectSet = dwCurrentTime;
  360. x -= FEEDBACK_WINDOW_X;
  361. y -= FEEDBACK_WINDOW_Y;
  362. g_nXForce = CoordToForce( x );
  363. g_nYForce = CoordToForce( y );
  364. InvalidateRect( hDlg, 0, TRUE );
  365. UpdateWindow( hDlg );
  366. if( FAILED( hr = SetDeviceForcesXY() ) )
  367. return hr;
  368. }
  369. return S_OK;
  370. }
  371. //-----------------------------------------------------------------------------
  372. // Name: OnLeftButtonDown()
  373. // Desc: Capture the mouse so we can follow it, and start updating the
  374. // force information.
  375. //-----------------------------------------------------------------------------
  376. VOID OnLeftButtonDown( HWND hDlg, INT x, INT y, UINT keyFlags )
  377. {
  378. SetCapture( hDlg );
  379. OnMouseMove( hDlg, x, y, MK_LBUTTON );
  380. }
  381. //-----------------------------------------------------------------------------
  382. // Name: OnLeftButtonUp()
  383. // Desc: Stop capturing the mouse when the button goes up.
  384. //-----------------------------------------------------------------------------
  385. VOID OnLeftButtonUp( HWND hDlg, INT x, INT y, UINT keyFlags )
  386. {
  387. ReleaseCapture();
  388. }
  389. //-----------------------------------------------------------------------------
  390. // Name: CoordToForce()
  391. // Desc: Convert a coordinate 0 <= nCoord <= FEEDBACK_WINDOW_WIDTH
  392. // to a force value in the range -DI_FFNOMINALMAX to +DI_FFNOMINALMAX.
  393. //-----------------------------------------------------------------------------
  394. INT CoordToForce( INT nCoord )
  395. {
  396. INT nForce = MulDiv( nCoord, 2 * DI_FFNOMINALMAX, FEEDBACK_WINDOW_WIDTH )
  397. - DI_FFNOMINALMAX;
  398. // Keep force within bounds
  399. if( nForce < -DI_FFNOMINALMAX )
  400. nForce = -DI_FFNOMINALMAX;
  401. if( nForce > +DI_FFNOMINALMAX )
  402. nForce = +DI_FFNOMINALMAX;
  403. return nForce;
  404. }
  405. //-----------------------------------------------------------------------------
  406. // Name: SetDeviceForcesXY()
  407. // Desc: Apply the X and Y forces to the effect we prepared.
  408. //-----------------------------------------------------------------------------
  409. HRESULT SetDeviceForcesXY()
  410. {
  411. // Modifying an effect is basically the same as creating a new one, except
  412. // you need only specify the parameters you are modifying
  413. LONG rglDirection[2] = { 0, 0 };
  414. DICONSTANTFORCE cf;
  415. if( g_dwNumForceFeedbackAxis == 1 )
  416. {
  417. // If only one force feedback axis, then apply only one direction and
  418. // keep the direction at zero
  419. cf.lMagnitude = g_nXForce;
  420. rglDirection[0] = 0;
  421. }
  422. else
  423. {
  424. // If two force feedback axis, then apply magnitude from both directions
  425. rglDirection[0] = g_nXForce;
  426. rglDirection[1] = g_nYForce;
  427. cf.lMagnitude = ( DWORD )sqrt( ( double )g_nXForce * ( double )g_nXForce +
  428. ( double )g_nYForce * ( double )g_nYForce );
  429. }
  430. DIEFFECT eff;
  431. ZeroMemory( &eff, sizeof( eff ) );
  432. eff.dwSize = sizeof( DIEFFECT );
  433. eff.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS;
  434. eff.cAxes = g_dwNumForceFeedbackAxis;
  435. eff.rglDirection = rglDirection;
  436. eff.lpEnvelope = 0;
  437. eff.cbTypeSpecificParams = sizeof( DICONSTANTFORCE );
  438. eff.lpvTypeSpecificParams = &cf;
  439. eff.dwStartDelay = 0;
  440. // Now set the new parameters and start the effect immediately.
  441. return g_pEffect->SetParameters( &eff, DIEP_DIRECTION |
  442. DIEP_TYPESPECIFICPARAMS |
  443. DIEP_START );
  444. }