mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-06 02:33:44 -04:00
expose inputs related to cursor from hid
This commit is contained in:
parent
f83e60243e
commit
93cdb65693
2 changed files with 27 additions and 4 deletions
|
|
@ -121,9 +121,15 @@ void Module::LoadInputDevices() {
|
||||||
Settings::values.current_input_profile.buttons.begin() +
|
Settings::values.current_input_profile.buttons.begin() +
|
||||||
Settings::NativeButton::BUTTON_HID_END,
|
Settings::NativeButton::BUTTON_HID_END,
|
||||||
buttons.begin(), Input::CreateDevice<Input::ButtonDevice>);
|
buttons.begin(), Input::CreateDevice<Input::ButtonDevice>);
|
||||||
|
zl_button = Input::CreateDevice<Input::ButtonDevice>(
|
||||||
|
Settings::values.current_input_profile.buttons[Settings::NativeButton::ZL]);
|
||||||
|
zr_button = Input::CreateDevice<Input::ButtonDevice>(
|
||||||
|
Settings::values.current_input_profile.buttons[Settings::NativeButton::ZR]);
|
||||||
circle_pad = Input::CreateDevice<Input::AnalogDevice>(
|
circle_pad = Input::CreateDevice<Input::AnalogDevice>(
|
||||||
Settings::values.current_input_profile.analogs[Settings::NativeAnalog::CirclePad]);
|
Settings::values.current_input_profile.analogs[Settings::NativeAnalog::CirclePad]);
|
||||||
motion_device = Input::CreateDevice<Input::MotionDevice>(
|
c_stick = Input::CreateDevice<Input::AnalogDevice>(
|
||||||
|
Settings::values.current_input_profile.analogs[Settings::NativeAnalog::CStick]);
|
||||||
|
motion_device = Input::CreateDevice<Input::MotionDevice>(
|
||||||
Settings::values.current_input_profile.motion_device);
|
Settings::values.current_input_profile.motion_device);
|
||||||
touch_device = Input::CreateDevice<Input::TouchDevice>(
|
touch_device = Input::CreateDevice<Input::TouchDevice>(
|
||||||
Settings::values.current_input_profile.touch_device);
|
Settings::values.current_input_profile.touch_device);
|
||||||
|
|
@ -217,6 +223,16 @@ void Module::UpdatePadCallback(std::uintptr_t user_data, s64 cycles_late) {
|
||||||
state.debug.Assign(buttons[Debug - BUTTON_HID_BEGIN]->GetStatus());
|
state.debug.Assign(buttons[Debug - BUTTON_HID_BEGIN]->GetStatus());
|
||||||
state.gpio14.Assign(buttons[Gpio14 - BUTTON_HID_BEGIN]->GetStatus());
|
state.gpio14.Assign(buttons[Gpio14 - BUTTON_HID_BEGIN]->GetStatus());
|
||||||
|
|
||||||
|
|
||||||
|
// Setting up inputs for Cursor Class.
|
||||||
|
float c_stick_x_f, c_stick_y_f;
|
||||||
|
std::tie(c_stick_x_f, c_stick_y_f) = c_stick->GetStatus();
|
||||||
|
stylusInput[0] = c_stick_x_f;
|
||||||
|
stylusInput[1] = c_stick_y_f;
|
||||||
|
stylusInput[2] = zl_button->GetStatus();
|
||||||
|
stylusInput[3] = zr_button->GetStatus();
|
||||||
|
// LOG_INFO(Service_HID, "C-Stick X: {}, C-Stick Y: {}, ZL: {}, ZR: {}", stylusInput[0], stylusInput[1], stylusInput[2], stylusInput[3]);
|
||||||
|
|
||||||
// Get current circle pad position and update circle pad direction
|
// Get current circle pad position and update circle pad direction
|
||||||
float circle_pad_x_f, circle_pad_y_f;
|
float circle_pad_x_f, circle_pad_y_f;
|
||||||
std::tie(circle_pad_x_f, circle_pad_y_f) = circle_pad->GetStatus();
|
std::tie(circle_pad_x_f, circle_pad_y_f) = circle_pad->GetStatus();
|
||||||
|
|
@ -320,6 +336,10 @@ void Module::UpdatePadCallback(std::uintptr_t user_data, s64 cycles_late) {
|
||||||
system.CoreTiming().ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event);
|
system.CoreTiming().ScheduleEvent(pad_update_ticks - cycles_late, pad_update_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::array<float, 4> Module::getStylusInputs(){
|
||||||
|
return stylusInput;
|
||||||
|
}
|
||||||
|
|
||||||
void Module::UpdateAccelerometerCallback(std::uintptr_t user_data, s64 cycles_late) {
|
void Module::UpdateAccelerometerCallback(std::uintptr_t user_data, s64 cycles_late) {
|
||||||
SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
|
SharedMem* mem = reinterpret_cast<SharedMem*>(shared_mem->GetPointer());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ public:
|
||||||
class Interface : public ServiceFramework<Interface> {
|
class Interface : public ServiceFramework<Interface> {
|
||||||
public:
|
public:
|
||||||
Interface(std::shared_ptr<Module> hid, const char* name, u32 max_session);
|
Interface(std::shared_ptr<Module> hid, const char* name, u32 max_session);
|
||||||
|
// Stylus X, Y, ZL, ZR
|
||||||
std::shared_ptr<Module> GetModule() const;
|
std::shared_ptr<Module> GetModule() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -335,7 +335,7 @@ public:
|
||||||
void UseArticClient(const std::shared_ptr<Network::ArticBase::Client>& client);
|
void UseArticClient(const std::shared_ptr<Network::ArticBase::Client>& client);
|
||||||
|
|
||||||
void ReloadInputDevices();
|
void ReloadInputDevices();
|
||||||
|
std::array<float, 4> getStylusInputs();
|
||||||
const PadState& GetState() const;
|
const PadState& GetState() const;
|
||||||
|
|
||||||
// Updating period for each HID device. These empirical values are measured from a 11.2 3DS.
|
// Updating period for each HID device. These empirical values are measured from a 11.2 3DS.
|
||||||
|
|
@ -388,12 +388,15 @@ private:
|
||||||
std::atomic<bool> is_device_reload_pending{true};
|
std::atomic<bool> is_device_reload_pending{true};
|
||||||
std::array<std::unique_ptr<Input::ButtonDevice>, Settings::NativeButton::NUM_BUTTONS_HID>
|
std::array<std::unique_ptr<Input::ButtonDevice>, Settings::NativeButton::NUM_BUTTONS_HID>
|
||||||
buttons;
|
buttons;
|
||||||
|
std::unique_ptr<Input::ButtonDevice> zl_button;
|
||||||
|
std::unique_ptr<Input::ButtonDevice> zr_button;
|
||||||
std::unique_ptr<Input::AnalogDevice> circle_pad;
|
std::unique_ptr<Input::AnalogDevice> circle_pad;
|
||||||
|
std::unique_ptr<Input::AnalogDevice> c_stick;
|
||||||
std::unique_ptr<Input::MotionDevice> motion_device;
|
std::unique_ptr<Input::MotionDevice> motion_device;
|
||||||
std::unique_ptr<Input::TouchDevice> controller_touch_device;
|
std::unique_ptr<Input::TouchDevice> controller_touch_device;
|
||||||
std::unique_ptr<Input::TouchDevice> touch_device;
|
std::unique_ptr<Input::TouchDevice> touch_device;
|
||||||
std::unique_ptr<Input::TouchDevice> touch_btn_device;
|
std::unique_ptr<Input::TouchDevice> touch_btn_device;
|
||||||
|
std::array<float, 4> stylusInput = {0};
|
||||||
std::shared_ptr<ArticBaseController> artic_controller;
|
std::shared_ptr<ArticBaseController> artic_controller;
|
||||||
std::shared_ptr<Network::ArticBase::Client> artic_client;
|
std::shared_ptr<Network::ArticBase::Client> artic_client;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue