Emu: some cleanup

This commit is contained in:
Megamouse 2021-04-07 23:05:18 +02:00
parent a3e8a61547
commit 03b76b4606
149 changed files with 957 additions and 1139 deletions

View file

@ -186,7 +186,7 @@ void ds4_pad_handler::init_config(pad_config* cfg, const std::string& name)
u32 ds4_pad_handler::get_battery_level(const std::string& padId)
{
std::shared_ptr<DS4Device> device = get_hid_device(padId);
const std::shared_ptr<DS4Device> device = get_hid_device(padId);
if (device == nullptr || device->hidDevice == nullptr)
{
return 0;
@ -266,7 +266,7 @@ std::unordered_map<u64, u16> ds4_pad_handler::get_button_values(const std::share
keyBuffer[DS4KeyCodes::RSYPos] = Clamp0To255((127.5f - buf[4]) * 2.0f);
// bleh, dpad in buffer is stored in a different state
u8 dpadState = buf[5] & 0xf;
const u8 dpadState = buf[5] & 0xf;
switch (dpadState)
{
case 0x08: // none pressed
@ -366,7 +366,7 @@ pad_preview_values ds4_pad_handler::get_preview_values(const std::unordered_map<
};
}
bool ds4_pad_handler::GetCalibrationData(DS4Device* ds4Dev)
bool ds4_pad_handler::GetCalibrationData(DS4Device* ds4Dev) const
{
if (!ds4Dev || !ds4Dev->hidDevice)
{
@ -601,7 +601,7 @@ int ds4_pad_handler::send_output_report(DS4Device* device)
if (!device || !device->hidDevice)
return -2;
auto config = device->config;
const auto config = device->config;
if (config == nullptr)
return -2; // hid_write and hid_write_control return -1 on error
@ -682,7 +682,7 @@ ds4_pad_handler::DataStatus ds4_pad_handler::get_data(DS4Device* device)
return DataStatus::NoNewData;
}
int offset = 0;
int offset;
// check report and set offset
if (device->bt_controller && buf[0] == 0x11 && res == 78)
{