mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 07:21:25 +12:00
dualsense: fix LED updates
This commit is contained in:
parent
c8e7530e37
commit
06d2c5357b
3 changed files with 54 additions and 48 deletions
|
@ -207,12 +207,9 @@ template <class Device>
|
|||
u32 hid_pad_handler<Device>::get_battery_color(u8 battery_level, int brightness) const
|
||||
{
|
||||
static const std::array<u32, 12> battery_level_clr = {0xff00, 0xff33, 0xff66, 0xff99, 0xffcc, 0xffff, 0xccff, 0x99ff, 0x66ff, 0x33ff, 0x00ff, 0x00ff};
|
||||
u32 combined_color = battery_level_clr[0];
|
||||
// Check if we got a weird value
|
||||
if (battery_level < battery_level_clr.size())
|
||||
{
|
||||
combined_color = battery_level_clr[battery_level];
|
||||
}
|
||||
|
||||
const u32 combined_color = battery_level_clr[battery_level < battery_level_clr.size() ? battery_level : 0];
|
||||
|
||||
const u32 red = (combined_color >> 8) * brightness / 100;
|
||||
const u32 green = (combined_color & 0xff) * brightness / 100;
|
||||
return ((red << 8) | green);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue