Skip to content

Commit

Permalink
fix(linux/input): battery values conversion (#2715)
Browse files Browse the repository at this point in the history
  • Loading branch information
ABeltramo committed Jun 17, 2024
1 parent 0c02f8b commit fb18b38
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/platform/linux/input/inputtino_gamepad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ namespace platf::gamepad {
state = inputtino::PS5Joypad::BATTERY_FULL;
break;
}
std::get<inputtino::PS5Joypad>(*gamepad->joypad).set_battery(state, battery.percentage);
// Battery values in Moonlight are in the range [0, 0xFF (255)]
// Inputtino expects them as a percentage [0, 100]
std::get<inputtino::PS5Joypad>(*gamepad->joypad).set_battery(state, battery.percentage / 2.55);
}
}

Expand Down
2 changes: 1 addition & 1 deletion third-party/inputtino

0 comments on commit fb18b38

Please sign in to comment.