| 514 | } ovrInputState2; |
| 515 | |
| 516 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetInputState(ovrSession session, ovrControllerType controllerType, ovrInputState* inputState) |
| 517 | { |
| 518 | REV_TRACE(ovr_GetInputState); |
| 519 | MICROPROFILE_META_CPU("Controller Type", controllerType); |
| 520 | |
| 521 | if (!session) |
| 522 | return ovrError_InvalidSession; |
| 523 | |
| 524 | if (!inputState) |
| 525 | return ovrError_InvalidParameter; |
| 526 | |
| 527 | ovrInputState state = { 0 }; |
| 528 | |
| 529 | ovrResult result = ovrSuccess; |
| 530 | if (session->Input && session->Session) |
| 531 | result = session->Input->GetInputState(session, controllerType, &state); |
| 532 | |
| 533 | // We need to make sure we don't write outside of the bounds of the struct |
| 534 | // when the client expects a pre-1.7 version of LibOVR. |
| 535 | if (Runtime::Get().MinorVersion < 7) |
| 536 | memcpy(inputState, &state, sizeof(ovrInputState1)); |
| 537 | else if (Runtime::Get().MinorVersion < 11) |
| 538 | memcpy(inputState, &state, sizeof(ovrInputState2)); |
| 539 | else |
| 540 | memcpy(inputState, &state, sizeof(ovrInputState)); |
| 541 | |
| 542 | return result; |
| 543 | } |
| 544 | |
| 545 | OVR_PUBLIC_FUNCTION(unsigned int) ovr_GetConnectedControllerTypes(ovrSession session) |
| 546 | { |
nothing calls this directly
no test coverage detected