mirror of
https://github.com/wiiu-env/EnvironmentLoader.git
synced 2024-11-27 08:14:14 +01:00
Make input reading more reliable
This commit is contained in:
parent
10337d5fba
commit
f60e8a340d
@ -1,4 +1,6 @@
|
|||||||
#include "InputUtils.h"
|
#include "InputUtils.h"
|
||||||
|
#include "logger.h"
|
||||||
|
#include <coreinit/thread.h>
|
||||||
#include <padscore/kpad.h>
|
#include <padscore/kpad.h>
|
||||||
#include <padscore/wpad.h>
|
#include <padscore/wpad.h>
|
||||||
#include <vpad/input.h>
|
#include <vpad/input.h>
|
||||||
@ -97,11 +99,15 @@ InputUtils::InputData InputUtils::getControllerInput() {
|
|||||||
InputData inputData{};
|
InputData inputData{};
|
||||||
VPADStatus vpadStatus{};
|
VPADStatus vpadStatus{};
|
||||||
VPADReadError vpadError = VPAD_READ_UNINITIALIZED;
|
VPADReadError vpadError = VPAD_READ_UNINITIALIZED;
|
||||||
if (VPADRead(VPAD_CHAN_0, &vpadStatus, 1, &vpadError) > 0 && vpadError == VPAD_READ_SUCCESS) {
|
do {
|
||||||
inputData.trigger = vpadStatus.trigger;
|
if (VPADRead(VPAD_CHAN_0, &vpadStatus, 1, &vpadError) > 0 && vpadError == VPAD_READ_SUCCESS) {
|
||||||
inputData.hold = vpadStatus.hold;
|
inputData.trigger = vpadStatus.trigger;
|
||||||
inputData.release = vpadStatus.release;
|
inputData.hold = vpadStatus.hold;
|
||||||
}
|
inputData.release = vpadStatus.release;
|
||||||
|
} else {
|
||||||
|
OSSleepTicks(OSMillisecondsToTicks(1));
|
||||||
|
}
|
||||||
|
} while (vpadError == VPAD_READ_NO_SAMPLES);
|
||||||
|
|
||||||
KPADStatus kpadStatus{};
|
KPADStatus kpadStatus{};
|
||||||
KPADError kpadError = KPAD_ERROR_UNINITIALIZED;
|
KPADError kpadError = KPAD_ERROR_UNINITIALIZED;
|
||||||
|
Loading…
Reference in New Issue
Block a user