mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-26 19:57:51 -05:00
core/hid: Improve accuary of mouse implementation
This commit is contained in:
@ -42,8 +42,7 @@ void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing,
|
||||
|
||||
next_state.key = keyboard_state;
|
||||
next_state.modifier = keyboard_modifier_state;
|
||||
// This is always enabled on HW. Check what it actually does
|
||||
next_state.modifier.unknown.Assign(1);
|
||||
next_state.attribute.is_connected.Assign(1);
|
||||
}
|
||||
|
||||
keyboard_lifo.WriteNextEntry(next_state);
|
||||
|
@ -38,6 +38,7 @@ private:
|
||||
struct KeyboardState {
|
||||
s64 sampling_number;
|
||||
Core::HID::KeyboardModifier modifier;
|
||||
Core::HID::KeyboardAttribute attribute;
|
||||
Core::HID::KeyboardKey key;
|
||||
};
|
||||
static_assert(sizeof(KeyboardState) == 0x30, "KeyboardState is an invalid size");
|
||||
|
@ -38,15 +38,16 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
||||
if (Settings::values.mouse_enabled) {
|
||||
const auto& mouse_button_state = emulated_devices->GetMouseButtons();
|
||||
const auto& mouse_position_state = emulated_devices->GetMousePosition();
|
||||
const auto& mouse_wheel_state = emulated_devices->GetMouseDeltaWheel();
|
||||
const auto& mouse_wheel_state = emulated_devices->GetMouseWheel();
|
||||
next_state.attribute.is_connected.Assign(1);
|
||||
next_state.x = static_cast<s32>(mouse_position_state.x * Layout::ScreenUndocked::Width);
|
||||
next_state.y = static_cast<s32>(mouse_position_state.y * Layout::ScreenUndocked::Height);
|
||||
next_state.delta_x = next_state.x - last_entry.x;
|
||||
next_state.delta_y = next_state.y - last_entry.y;
|
||||
next_state.delta_wheel_x = mouse_wheel_state.x;
|
||||
next_state.delta_wheel_y = mouse_wheel_state.y;
|
||||
next_state.delta_wheel_x = mouse_wheel_state.x - last_mouse_wheel_state.x;
|
||||
next_state.delta_wheel_y = mouse_wheel_state.y - last_mouse_wheel_state.y;
|
||||
|
||||
last_mouse_wheel_state = mouse_wheel_state;
|
||||
next_state.button = mouse_button_state;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
namespace Core::HID {
|
||||
class EmulatedDevices;
|
||||
struct MouseState;
|
||||
struct AnalogStickState;
|
||||
} // namespace Core::HID
|
||||
|
||||
namespace Service::HID {
|
||||
@ -37,6 +38,7 @@ private:
|
||||
static_assert(sizeof(mouse_lifo) == 0x350, "mouse_lifo is an invalid size");
|
||||
Core::HID::MouseState next_state{};
|
||||
|
||||
Core::HID::AnalogStickState last_mouse_wheel_state;
|
||||
Core::HID::EmulatedDevices* emulated_devices;
|
||||
};
|
||||
} // namespace Service::HID
|
||||
|
Reference in New Issue
Block a user