Skip to content

Commit a4b8ded

Browse files
committed
cleanup: remove unused GetDeviceInfo()
1 parent d04a6f1 commit a4b8ded

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

packages/gamepads_windows/windows/gamepad.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ std::string AppLocalDeviceIdToString(const APP_LOCAL_DEVICE_ID& id) {
4646
return oss.str();
4747
}
4848

49-
std::list<Event> diff_states(const GameInputDeviceInfo& device_info,
50-
const GameInputGamepadState& old,
51-
const GameInputGamepadState& current) {
49+
std::list<Event> diff_states(const GameInputGamepadState& old, const GameInputGamepadState& current) {
5250
std::time_t now = std::time(nullptr);
5351
int time = static_cast<int>(now);
5452

@@ -78,7 +76,7 @@ std::list<Event> diff_states(const GameInputDeviceInfo& device_info,
7876
{time, "analog", "rightTrigger", current.rightTrigger});
7977
}
8078
if (old.buttons != current.buttons) {
81-
// While device_info.controllerButtonCount often gives 14,
79+
// While GameInputDeviceInfo.controllerButtonCount often gives 14,
8280
// if you install GameInput v3 redistributable, the reported
8381
// button count drops to zero. Button input is still reported.
8482
for (uint32_t i = 0; i < 14; ++i) {
@@ -212,17 +210,15 @@ void Gamepads::on_gamepad_disconnected(IGameInputDevice * device)
212210

213211

214212
void Gamepads::read_gamepad(GamepadData* gamepad, IGameInputDevice* device) {
215-
auto info = device->GetDeviceInfo();
216-
217213
GameInputGamepadState previous_state;
218-
while (info != nullptr && !gamepad->stop_thead && g_gameInput != nullptr) {
214+
while (!gamepad->stop_thead && g_gameInput != nullptr) {
219215
IGameInputReading* reading;
220216
GameInputGamepadState state;
221217
g_gameInput->GetCurrentReading(GameInputKindGamepad, device, &reading);
222218
if (reading != nullptr) {
223219
if(reading->GetGamepadState(&state)) {
224220
if (are_states_different(previous_state, state)) {
225-
auto events = diff_states(*info, state, previous_state);
221+
auto events = diff_states(state, previous_state);
226222
for (auto event : events) {
227223
if (event_emitter.has_value()) {
228224
(*event_emitter)(gamepad, event);

0 commit comments

Comments
 (0)