mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-14 18:34:32 +00:00
Qt: Log input state when binding
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "qtutils.h"
|
||||
|
||||
#include "common/bitutils.h"
|
||||
#include "common/log.h"
|
||||
|
||||
#include "fmt/format.h"
|
||||
|
||||
@@ -18,6 +19,8 @@
|
||||
|
||||
#include "moc_inputbindingdialog.cpp"
|
||||
|
||||
LOG_CHANNEL(Host);
|
||||
|
||||
InputBindingDialog::InputBindingDialog(SettingsInterface* sif, InputBindingInfo::Type bind_type,
|
||||
std::string section_name, std::string key_name,
|
||||
std::vector<std::string> bindings, QWidget* parent)
|
||||
@@ -72,6 +75,14 @@ InputBindingDialog::~InputBindingDialog()
|
||||
Q_ASSERT(!isListeningForInput());
|
||||
}
|
||||
|
||||
void InputBindingDialog::logInputEvent(InputBindingInfo::Type bind_type, InputBindingKey key, float value,
|
||||
float initial_value, float min_value)
|
||||
{
|
||||
const TinyString key_str = InputManager::ConvertInputBindingKeyToString(bind_type, key);
|
||||
DEV_LOG("Binding input event: key={} value={:.2f} initial_value={:.2f} min_value={:.2f}", key_str, value,
|
||||
initial_value, min_value);
|
||||
}
|
||||
|
||||
bool InputBindingDialog::eventFilter(QObject* watched, QEvent* event)
|
||||
{
|
||||
const QEvent::Type event_type = event->type();
|
||||
@@ -310,6 +321,8 @@ void InputBindingDialog::inputManagerHookCallback(InputBindingKey key, float val
|
||||
m_value_ranges.emplace_back(key, std::make_pair(initial_value, min_value));
|
||||
}
|
||||
|
||||
logInputEvent(m_bind_type, key, value, initial_value, min_value);
|
||||
|
||||
const float abs_value = std::abs(value);
|
||||
const bool reverse_threshold =
|
||||
(key.source_subtype == InputSubclass::ControllerAxis && std::abs(initial_value) > 0.5f);
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <stenzek@gmail.com>
|
||||
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
|
||||
|
||||
#pragma once
|
||||
#include "common/types.h"
|
||||
|
||||
#include "ui_inputbindingdialog.h"
|
||||
|
||||
#include "util/input_manager.h"
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@@ -21,6 +25,9 @@ public:
|
||||
std::string key_name, std::vector<std::string> bindings, QWidget* parent);
|
||||
~InputBindingDialog();
|
||||
|
||||
static void logInputEvent(InputBindingInfo::Type bind_type, InputBindingKey key, float value, float initial_value,
|
||||
float min_value);
|
||||
|
||||
protected:
|
||||
enum : u32
|
||||
{
|
||||
|
||||
@@ -350,6 +350,8 @@ void InputBindingWidget::inputManagerHookCallback(InputBindingKey key, float val
|
||||
m_value_ranges.emplace_back(key, std::make_pair(initial_value, min_value));
|
||||
}
|
||||
|
||||
InputBindingDialog::logInputEvent(m_bind_type, key, value, initial_value, min_value);
|
||||
|
||||
const float abs_value = std::abs(value);
|
||||
const bool reverse_threshold =
|
||||
(key.source_subtype == InputSubclass::ControllerAxis && std::abs(initial_value) > 0.5f);
|
||||
|
||||
Reference in New Issue
Block a user