-
Notifications
You must be signed in to change notification settings - Fork 2.5k
PSMove Support #14719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
PSMove Support #14719
Conversation
| if(ctx->report_sensors) | ||
| { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if(ctx->report_sensors) | |
| { | |
| if (ctx->report_sensors) { |
Please use SDL style for this file
| if(ctx->report_sensors) | ||
| { | ||
|
|
||
| float sensor_data[3]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| float sensor_data[3]; | |
| float sensor_data[3]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
etc.
| sensor_data[2] = -(float)(((ctx->input.common.aZ[0] + ctx->input.common.aZ2[0]) + | ||
| ((ctx->input.common.aZ[1] + ctx->input.common.aZ2[1]) << 8)) / 2 - 0x8000); | ||
| } else { | ||
| sensor_data[0] = (float)(Sint16)(ctx->input.common.aX[0] + (ctx->input.common.aX[1] << 8)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LOAD16 macro may be helpful here:
#define LOAD16(A, B) (Sint16)((Uint16)(A) | (((Uint16)(B)) << 8))There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed I was parsing these wrong, though looking at PSMoveAPI seems like I need 2 different functions
Pushed something for this
|
Usually when I'm trying to puzzle out sensor values, I'll start with the accelerometer and compare the values with a PS4 controller to get the correct axis order and sign, and figure out the scale to match the magnitude of 1G. Then usually the axes will be the same order and sign for the gyro. The gyro scale is harder, but sometimes the spec sheet will help, and then I use testcontroller to validate all the values. |
Looking at the PS4 HID Driver, I should probably add code to handle the calibration data before looking at conversions |
Us
Description
This adds support for the PlayStation Move Controller.
I have not tested this with the PS4 Revision (CECH-ZCM2), as I only own the ZCM1 Revision for PS3. I have also not had a chance to test this on any platform but Linux.
I have not implemented Gyroscope or Accelerometer support for the Move yet, as I have no idea how to properly convert the values into what SDL expects or how to handle the half-frame approach of the data that's used in the ZCM1 Models, this, and due to a lack of testing outside Linux (if anyone reading this could test on other plats, it would be appreciated!) is why the PR is currently a draft.
I also currently do not have access to Xcode to add SDL_hidapi_psmove.c to the project (No idea why Ci mostly compiles)
The HIDAPI Driver is heavily based on PSMoveAPI, using the
psmovecli utility the project provides is required to pair the PSMove to a non PlayStation DeviceExisting Issue(s)