mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
Add usz alias for std::size_t
This commit is contained in:
parent
360c4d1554
commit
fb29933d3d
173 changed files with 718 additions and 717 deletions
|
|
@ -158,7 +158,7 @@ std::vector<std::string> ds3_pad_handler::ListDevices()
|
|||
if (!Init())
|
||||
return ds3_pads_list;
|
||||
|
||||
for (size_t i = 1; i <= controllers.size(); ++i) // Controllers 1-n in GUI
|
||||
for (usz i = 1; i <= controllers.size(); ++i) // Controllers 1-n in GUI
|
||||
{
|
||||
ds3_pads_list.emplace_back(m_name_string + std::to_string(i));
|
||||
}
|
||||
|
|
@ -231,13 +231,13 @@ std::shared_ptr<ds3_pad_handler::ds3_device> ds3_pad_handler::get_ds3_device(con
|
|||
if (!Init())
|
||||
return nullptr;
|
||||
|
||||
const size_t pos = padId.find(m_name_string);
|
||||
const usz pos = padId.find(m_name_string);
|
||||
if (pos == umax)
|
||||
return nullptr;
|
||||
|
||||
const int pad_number = std::stoi(padId.substr(pos + 9));
|
||||
if (pad_number > 0 && pad_number + 0u <= controllers.size())
|
||||
return controllers[static_cast<size_t>(pad_number) - 1];
|
||||
return controllers[static_cast<usz>(pad_number) - 1];
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ std::shared_ptr<ds4_pad_handler::DS4Device> ds4_pad_handler::GetDS4Device(const
|
|||
if (!Init())
|
||||
return nullptr;
|
||||
|
||||
size_t pos = padId.find(m_name_string);
|
||||
usz pos = padId.find(m_name_string);
|
||||
if (pos == umax)
|
||||
return nullptr;
|
||||
|
||||
|
|
@ -721,7 +721,7 @@ std::vector<std::string> ds4_pad_handler::ListDevices()
|
|||
if (!Init())
|
||||
return ds4_pads_list;
|
||||
|
||||
for (size_t i = 1; i <= controllers.size(); ++i) // Controllers 1-n in GUI
|
||||
for (usz i = 1; i <= controllers.size(); ++i) // Controllers 1-n in GUI
|
||||
{
|
||||
ds4_pads_list.emplace_back(m_name_string + std::to_string(i));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ std::vector<std::string> dualsense_pad_handler::ListDevices()
|
|||
if (!Init())
|
||||
return dualsense_pads_list;
|
||||
|
||||
for (size_t i = 1; i < controllers.size(); ++i)
|
||||
for (usz i = 1; i < controllers.size(); ++i)
|
||||
{
|
||||
dualsense_pads_list.emplace_back(m_name_string + std::to_string(i));
|
||||
}
|
||||
|
|
@ -243,7 +243,7 @@ dualsense_pad_handler::DualSenseDataStatus dualsense_pad_handler::GetRawData(con
|
|||
|
||||
const int res = hid_read(device->hidDevice, buf.data(), 128);
|
||||
// looks like controller disconnected or read error
|
||||
|
||||
|
||||
if (res == -1)
|
||||
return DualSenseDataStatus::ReadError;
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ dualsense_pad_handler::DualSenseDataStatus dualsense_pad_handler::GetRawData(con
|
|||
{
|
||||
device->dataMode = DualSenseDataMode::Enhanced;
|
||||
device->btCon = false;
|
||||
offset = 1;
|
||||
offset = 1;
|
||||
}
|
||||
break;
|
||||
case 0x31:
|
||||
|
|
@ -476,7 +476,7 @@ std::unordered_map<u64, u16> dualsense_pad_handler::get_button_values(const std:
|
|||
|
||||
data = buf[6] & 0x03;
|
||||
keyBuffer[DualSenseKeyCodes::PSButton] = ((data & 0x01) != 0) ? 255 : 0;
|
||||
keyBuffer[DualSenseKeyCodes::TouchPad] = ((data & 0x02) != 0) ? 255 : 0;
|
||||
keyBuffer[DualSenseKeyCodes::TouchPad] = ((data & 0x02) != 0) ? 255 : 0;
|
||||
|
||||
return keyBuffer;
|
||||
}
|
||||
|
|
@ -577,7 +577,7 @@ std::unordered_map<u64, u16> dualsense_pad_handler::get_button_values(const std:
|
|||
|
||||
data = buf[9] & 0x03;
|
||||
keyBuffer[DualSenseKeyCodes::PSButton] = ((data & 0x01) != 0) ? 255 : 0;
|
||||
keyBuffer[DualSenseKeyCodes::TouchPad] = ((data & 0x02) != 0) ? 255 : 0;
|
||||
keyBuffer[DualSenseKeyCodes::TouchPad] = ((data & 0x02) != 0) ? 255 : 0;
|
||||
|
||||
return keyBuffer;
|
||||
}
|
||||
|
|
@ -599,7 +599,7 @@ std::shared_ptr<dualsense_pad_handler::DualSenseDevice> dualsense_pad_handler::G
|
|||
if (!Init())
|
||||
return nullptr;
|
||||
|
||||
size_t pos = padId.find(m_name_string);
|
||||
usz pos = padId.find(m_name_string);
|
||||
if (pos == umax)
|
||||
return nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ int xinput_pad_handler::GetDeviceNumber(const std::string& padId)
|
|||
if (!Init())
|
||||
return -1;
|
||||
|
||||
size_t pos = padId.find(m_name_string);
|
||||
usz pos = padId.find(m_name_string);
|
||||
if (pos == umax)
|
||||
return -1;
|
||||
|
||||
|
|
@ -487,8 +487,8 @@ void xinput_pad_handler::apply_pad_data(const std::shared_ptr<PadDevice>& device
|
|||
|
||||
// The left motor is the low-frequency rumble motor. The right motor is the high-frequency rumble motor.
|
||||
// The two motors are not the same, and they create different vibration effects. Values range between 0 to 65535.
|
||||
size_t idx_l = profile->switch_vibration_motors ? 1 : 0;
|
||||
size_t idx_s = profile->switch_vibration_motors ? 0 : 1;
|
||||
usz idx_l = profile->switch_vibration_motors ? 1 : 0;
|
||||
usz idx_s = profile->switch_vibration_motors ? 0 : 1;
|
||||
|
||||
u16 speed_large = profile->enable_vibration_motor_large ? pad->m_vibrateMotors[idx_l].m_value : static_cast<u16>(vibration_min);
|
||||
u16 speed_small = profile->enable_vibration_motor_small ? pad->m_vibrateMotors[idx_s].m_value : static_cast<u16>(vibration_min);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue