mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 15:31:26 +12:00
mmjoy: fix connection update spam
This commit is contained in:
parent
df5af50866
commit
f7ec679242
2 changed files with 7 additions and 3 deletions
|
@ -440,7 +440,8 @@ bool mm_joystick_handler::GetMMJOYDevice(int index, MMJOYDevice* dev)
|
||||||
js_info.dwFlags = JOY_RETURNALL;
|
js_info.dwFlags = JOY_RETURNALL;
|
||||||
joyGetDevCaps(index, &js_caps, sizeof(js_caps));
|
joyGetDevCaps(index, &js_caps, sizeof(js_caps));
|
||||||
|
|
||||||
if (joyGetPosEx(index, &js_info) != JOYERR_NOERROR)
|
dev->device_status = joyGetPosEx(index, &js_info);
|
||||||
|
if (dev->device_status != JOYERR_NOERROR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char drv[32];
|
char drv[32];
|
||||||
|
@ -495,8 +496,10 @@ PadHandlerBase::connection mm_joystick_handler::update_connection(const std::sha
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return connection::disconnected;
|
return connection::disconnected;
|
||||||
|
|
||||||
MMRESULT status = joyGetPosEx(dev->device_id, &dev->device_info);
|
const auto old_status = dev->device_status;
|
||||||
if (status == JOYERR_NOERROR && GetMMJOYDevice(dev->device_id, dev.get()))
|
dev->device_status = joyGetPosEx(dev->device_id, &dev->device_info);
|
||||||
|
|
||||||
|
if (dev->device_status == JOYERR_NOERROR && (old_status == JOYERR_NOERROR || GetMMJOYDevice(dev->device_id, dev.get())))
|
||||||
{
|
{
|
||||||
return connection::connected;
|
return connection::connected;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ class mm_joystick_handler final : public PadHandlerBase
|
||||||
std::string device_name{ "" };
|
std::string device_name{ "" };
|
||||||
JOYINFOEX device_info{};
|
JOYINFOEX device_info{};
|
||||||
JOYCAPS device_caps{};
|
JOYCAPS device_caps{};
|
||||||
|
MMRESULT device_status = JOYERR_UNPLUGGED;
|
||||||
u64 trigger_left = 0;
|
u64 trigger_left = 0;
|
||||||
u64 trigger_right = 0;
|
u64 trigger_right = 0;
|
||||||
std::vector<u64> axis_left = { 0,0,0,0 };
|
std::vector<u64> axis_left = { 0,0,0,0 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue