mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-04 14:26:20 +12:00
HID/IR: Cleanup and minor fixes (#768)
Some checks are pending
Android Build / x64 (release) (push) Waiting to run
Android Build / arm64 (release) (push) Waiting to run
HTTP Server Build / build (push) Waiting to run
Hydra Core Build / Windows (push) Waiting to run
Hydra Core Build / MacOS (push) Waiting to run
Hydra Core Build / Linux (push) Waiting to run
Hydra Core Build / Android-x64 (push) Waiting to run
Hydra Core Build / ARM-Libretro (push) Waiting to run
Linux AppImage Build / build (push) Waiting to run
Linux Build / build (push) Waiting to run
MacOS Build / MacOS-arm64 (push) Waiting to run
MacOS Build / MacOS-x86_64 (push) Waiting to run
MacOS Build / MacOS-Universal (push) Blocked by required conditions
Qt Build / Windows (push) Waiting to run
Qt Build / MacOS-arm64 (push) Waiting to run
Qt Build / MacOS-x86_64 (push) Waiting to run
Qt Build / MacOS-Universal (push) Blocked by required conditions
Qt Build / Linux (push) Waiting to run
Windows Build / build (push) Waiting to run
iOS Simulator Build / build (push) Waiting to run
Some checks are pending
Android Build / x64 (release) (push) Waiting to run
Android Build / arm64 (release) (push) Waiting to run
HTTP Server Build / build (push) Waiting to run
Hydra Core Build / Windows (push) Waiting to run
Hydra Core Build / MacOS (push) Waiting to run
Hydra Core Build / Linux (push) Waiting to run
Hydra Core Build / Android-x64 (push) Waiting to run
Hydra Core Build / ARM-Libretro (push) Waiting to run
Linux AppImage Build / build (push) Waiting to run
Linux Build / build (push) Waiting to run
MacOS Build / MacOS-arm64 (push) Waiting to run
MacOS Build / MacOS-x86_64 (push) Waiting to run
MacOS Build / MacOS-Universal (push) Blocked by required conditions
Qt Build / Windows (push) Waiting to run
Qt Build / MacOS-arm64 (push) Waiting to run
Qt Build / MacOS-x86_64 (push) Waiting to run
Qt Build / MacOS-Universal (push) Blocked by required conditions
Qt Build / Linux (push) Waiting to run
Windows Build / build (push) Waiting to run
iOS Simulator Build / build (push) Waiting to run
This commit is contained in:
parent
2e148ae997
commit
620e3699ec
4 changed files with 10 additions and 10 deletions
|
@ -124,9 +124,9 @@ class HIDService {
|
|||
// Then, set them according to the new value of x
|
||||
newButtons &= ~(HID::Keys::CirclePadLeft | HID::Keys::CirclePadRight);
|
||||
if (x >= 41) // Pressing right
|
||||
newButtons |= 1 << 28;
|
||||
newButtons |= HID::Keys::CirclePadRight;
|
||||
else if (x <= -41) // Pressing left
|
||||
newButtons |= 1 << 29;
|
||||
newButtons |= HID::Keys::CirclePadLeft;
|
||||
}
|
||||
|
||||
void setCirclepadY(s16 y) {
|
||||
|
@ -136,9 +136,9 @@ class HIDService {
|
|||
// Then, set them according to the new value of y
|
||||
newButtons &= ~(HID::Keys::CirclePadUp | HID::Keys::CirclePadDown);
|
||||
if (y >= 41) // Pressing up
|
||||
newButtons |= 1 << 30;
|
||||
newButtons |= HID::Keys::CirclePadUp;
|
||||
else if (y <= -41) // Pressing down
|
||||
newButtons |= 1 << 31;
|
||||
newButtons |= HID::Keys::CirclePadDown;
|
||||
}
|
||||
|
||||
void setCStickX(s16 x) { cStickX = x; }
|
||||
|
|
|
@ -26,9 +26,9 @@ namespace IR {
|
|||
|
||||
ButtonState() {
|
||||
// Response header for button state reads
|
||||
cStick.header = static_cast<u8>(CPPResponseID::PollButtons);
|
||||
cStick.x = static_cast<u32>(CirclePadPro::ButtonState::C_STICK_CENTER);
|
||||
cStick.y = static_cast<u32>(CirclePadPro::ButtonState::C_STICK_CENTER);
|
||||
cStick.header = u8(CPPResponseID::PollButtons);
|
||||
cStick.x = u32(CirclePadPro::ButtonState::C_STICK_CENTER);
|
||||
cStick.y = u32(CirclePadPro::ButtonState::C_STICK_CENTER);
|
||||
|
||||
// Fully charged
|
||||
buttons.batteryLevel = 0x1F;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "ipc.hpp"
|
||||
#include "kernel.hpp"
|
||||
#include "services/ir/circlepad_pro.hpp"
|
||||
|
||||
namespace HIDCommands {
|
||||
enum : u32 {
|
||||
|
@ -39,7 +40,7 @@ void HIDService::reset() {
|
|||
roll = pitch = yaw = 0;
|
||||
accelX = accelY = accelZ = 0;
|
||||
|
||||
cStickX = cStickY = 0;
|
||||
cStickX = cStickY = IR::CirclePadPro::ButtonState::C_STICK_CENTER;
|
||||
}
|
||||
|
||||
void HIDService::handleSyncRequest(u32 messagePointer) {
|
||||
|
@ -170,7 +171,7 @@ void HIDService::updateInputs(u64 currentTick) {
|
|||
const size_t padEntryOffset = 0x28 + (nextPadIndex * 0x10); // Offset in the array of 8 pad entries
|
||||
nextPadIndex = (nextPadIndex + 1) % 8; // Move to next entry
|
||||
|
||||
const u32 pressed = (currentButtons ^ previousButtons) & currentButtons; // Pressed buttons
|
||||
const u32 pressed = (currentButtons ^ previousButtons) & currentButtons; // Pressed buttons
|
||||
const u32 released = (currentButtons ^ previousButtons) & previousButtons; // Released buttons
|
||||
|
||||
writeSharedMem<u32>(padEntryOffset, currentButtons);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "kernel.hpp"
|
||||
#include "services/ir/ir_types.hpp"
|
||||
|
||||
#define log printf
|
||||
using namespace IR;
|
||||
|
||||
namespace IRUserCommands {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue