1
0
Fork 0

David Fries:

Fixes for 64bit systems
This commit is contained in:
torsten 2010-03-10 08:29:08 +00:00 committed by Tim Moore
parent 89023eda69
commit f3677a4ddf

View file

@ -67,7 +67,7 @@ int main ( int argc, char ** argv )
ax = new float [ numaxes ] ;
activeaxes = numaxes;
if( numaxes < 4 )
if( numaxes > 4 )
{
printf("max 4 axes joysticks supported at the moment, however %i axes were detected\nWill only use the first 4 axes!\n", numaxes);
activeaxes = 4;
@ -101,17 +101,17 @@ int main ( int argc, char ** argv )
js->read( &b, ax );
for ( axis = 0 ; axis < activeaxes ; axis++ )
{
long axisvalue = (long int)(ax[axis]*2147483647.0);
printf("axisval=%li\n", axisvalue);
memcpy(packet+len, &axisvalue, 4);
len+=4;
int32_t axisvalue = (int32_t)(ax[axis]*2147483647.0);
printf("axisval=%li\n", (long)axisvalue);
memcpy(packet+len, &axisvalue, sizeof(axisvalue));
len+=sizeof(axisvalue);
}
// fill emtpy values into packes when less than 4 axes
for( ; axis < 4; axis++ )
{
long axisvalue = 0;
memcpy(packet+len, &axisvalue, 4);
len+=4;
int32_t axisvalue = 0;
memcpy(packet+len, &axisvalue, sizeof(axisvalue));
len+=sizeof(axisvalue);
}
long int b_l = b;