mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
hid: Updated structs.
This commit is contained in:
parent
ff2846e481
commit
f784c9a3f3
@ -569,6 +569,11 @@ typedef struct HidVector {
|
||||
float z;
|
||||
} HidVector;
|
||||
|
||||
/// HidDirectionState
|
||||
typedef struct HidDirectionState {
|
||||
float direction[3][3]; ///< 3x3 matrix
|
||||
} HidDirectionState;
|
||||
|
||||
/// SixAxisSensorValues
|
||||
typedef struct SixAxisSensorValues {
|
||||
HidVector accelerometer;
|
||||
@ -638,7 +643,12 @@ typedef struct HidTouchScreenSharedMemoryFormat {
|
||||
/// HidMouseState
|
||||
typedef struct HidMouseState {
|
||||
u64 sampling_number; ///< SamplingNumber
|
||||
MousePosition position; ///< \ref MousePosition
|
||||
s32 x; ///< X
|
||||
s32 y; ///< Y
|
||||
s32 delta_x; ///< DeltaX
|
||||
s32 delta_y; ///< DeltaY
|
||||
s32 wheel_delta_x; ///< WheelDeltaX
|
||||
s32 wheel_delta_y; ///< WheelDeltaY
|
||||
u32 buttons; ///< Bitfield of \ref HidMouseButton.
|
||||
u32 attributes; ///< Bitfield of \ref HidMouseAttribute.
|
||||
} HidMouseState;
|
||||
@ -809,7 +819,10 @@ typedef struct HidNpadGcTriggerLifo {
|
||||
typedef struct HidSixAxisSensorState {
|
||||
u64 delta_time; ///< DeltaTime
|
||||
u64 sampling_number; ///< SamplingNumber
|
||||
SixAxisSensorValues values;
|
||||
HidVector acceleration; ///< Acceleration
|
||||
HidVector angular_velocity; ///< AngularVelocity
|
||||
HidVector angle; ///< Angle
|
||||
HidDirectionState direction; ///< Direction
|
||||
u32 attributes; ///< Bitfield of \ref HidSixAxisSensorAttribute.
|
||||
u32 reserved; ///< Reserved
|
||||
} HidSixAxisSensorState;
|
||||
|
@ -777,7 +777,12 @@ u64 hidMouseButtonsUp(void) {
|
||||
|
||||
void hidMouseRead(MousePosition *pos) {
|
||||
rwlockReadLock(&g_hidLock);
|
||||
*pos = g_mouseState.position;
|
||||
pos->x = g_mouseState.x;
|
||||
pos->y = g_mouseState.y;
|
||||
pos->velocityX = g_mouseState.delta_x;
|
||||
pos->velocityY = g_mouseState.delta_y;
|
||||
pos->scrollVelocityX = g_mouseState.wheel_delta_x;
|
||||
pos->scrollVelocityY = g_mouseState.wheel_delta_y;
|
||||
rwlockReadUnlock(&g_hidLock);
|
||||
}
|
||||
|
||||
@ -792,7 +797,12 @@ u32 hidMouseMultiRead(MousePosition *entries, u32 num_entries) {
|
||||
size_t total = hidGetMouseStates(temp_states, num_entries);
|
||||
|
||||
for (size_t i=0; i<total; i++) {
|
||||
entries[i] = temp_states[i].position;
|
||||
entries[i].x = temp_states[i].x;
|
||||
entries[i].y = temp_states[i].y;
|
||||
entries[i].velocityX = temp_states[i].delta_x;
|
||||
entries[i].velocityY = temp_states[i].delta_y;
|
||||
entries[i].scrollVelocityX = temp_states[i].wheel_delta_x;
|
||||
entries[i].scrollVelocityY = temp_states[i].wheel_delta_y;
|
||||
}
|
||||
|
||||
return total;
|
||||
@ -917,7 +927,10 @@ u32 hidSixAxisSensorValuesRead(SixAxisSensorValues *values, HidControllerID id,
|
||||
size_t total = hidGetSixAxisSensorStates(handles[handle_idx], temp_states, num_entries);
|
||||
|
||||
for (size_t i=0; i<total; i++) {
|
||||
values[i] = temp_states[i].values;
|
||||
values[i].accelerometer = temp_states[i].acceleration;
|
||||
values[i].gyroscope = temp_states[i].angular_velocity;
|
||||
values[i].unk = temp_states[i].angle;
|
||||
memcpy(values[i].orientation, &temp_states[i].direction, sizeof(temp_states[i].direction));
|
||||
}
|
||||
|
||||
return total;
|
||||
|
Loading…
Reference in New Issue
Block a user