DirectX Input With PS3 Controller?

Started by
14 comments, last by CDTMD 14 years, 4 months ago
Ok but even then you can set the ranges. Even then the preset ranges should be similar.

so (-1000+1000)/2
= (0)/2
= 0

I also changed it to this.

HRESULT hRes = PS3Device->GetProperty( DIPROP_RANGE, (LPDIPROPHEADER)&diprg );
if ( SUCCEEDED( hRes ) )
{
outr<<diprg.lMin<<endl;
outr<<diprg.lMax<<endl;
}

So it should print out the preset min/max values. But the file is always blank.

Any way Endurion set it like this
NewCtrl.m_iMin = diprg.lMin;
NewCtrl.m_iMax = diprg.lMax;

What type is NewCtrl? He doesn't declare it in the code.
Advertisement
Quote:Original post by CDTMD
Ok but even then you can set the ranges. Even then the preset ranges should be similar.

so (-1000+1000)/2
= (0)/2
= 0

I also changed it to this.

HRESULT hRes = PS3Device->GetProperty( DIPROP_RANGE, (LPDIPROPHEADER)&diprg );
if ( SUCCEEDED( hRes ) )
{
outr<<diprg.lMin<<endl;
outr<<diprg.lMax<<endl;
}

So it should print out the preset min/max values. But the file is always blank.

What "file"? There is always some values in the structure, regardless of whether they are correct or not.

Quote:
Any way Endurion set it like this
NewCtrl.m_iMin = diprg.lMin;
NewCtrl.m_iMax = diprg.lMax;

What type is NewCtrl? He doesn't declare it in the code.


"Of what type is NewCtrl" is not the point. You can assign the values to anything you want, for further processing.

Niko Suni

By file I meant like output.txt. I am using ofstream to see the values.

I also did try using int to get the values but again the file showed nothing...
Strange I think I just found the problem... I just tried and it wont output anything... It seems that the function: enumObjectsCallback() is not being called.... Why?

// Creates an Input Object for monitoring mouse input, and one for keyboard input.
bool PS3Input::init(HINSTANCE hInst, HWND wndHandle)
{
...
PS3Device->EnumObjects( enumObjCallback, NULL, DIDFT_ALL );

return true;
}

BOOL CALLBACK PS3Input::enumObjectsCallback( const DIDEVICEOBJECTINSTANCE* instance, VOID* context )
{
...
}

BOOL CALLBACK enumObjCallback( const DIDEVICEOBJECTINSTANCE* instance, VOID* context )
{
if (context != NULL) {
return ((PS3Input *)context)->enumObjectsCallback(instance, context);
} else {
return DIENUM_STOP;
}
}

Am I doing it wrong? It works for enumJoysticksCallback()
Put a breakpoint to the first row of your enumObjCallback function, run the debugger to that point and observe the parameters. Optionally, step thru the rest of the function. Can you spot the mistake?

(Hint: you are supposed to supply the context for the callback).

Niko Suni

Awesome thanks! It works now. I now get values between 0-65535. I made a temporary dead zone by only checking for 0 or 65535. It works! I just have to mess with the dead zone so I can do x and y at the same time but other than that it works perfectly thank you!

This topic is closed to new replies.

Advertisement