mirror of
https://github.com/stenzek/duckstation.git
synced 2024-11-22 21:39:40 +00:00
InputManager: Fix relative mode engaging for gun controllers
It still needs to activate when using raw input.
This commit is contained in:
parent
350429466a
commit
c2316dfdc8
@ -1625,7 +1625,7 @@ void FullscreenUI::DrawInputBindingButton(SettingsInterface* bsi, InputBindingIn
|
||||
const char* name, const char* display_name, const char* icon_name,
|
||||
bool show_type)
|
||||
{
|
||||
if (type == InputBindingInfo::Type::Pointer)
|
||||
if (type == InputBindingInfo::Type::Pointer || type == InputBindingInfo::Type::RelativePointer)
|
||||
return;
|
||||
|
||||
TinyString title;
|
||||
|
@ -791,6 +791,7 @@ void ImGuiManager::DrawInputsOverlay()
|
||||
case InputBindingInfo::Type::Macro:
|
||||
case InputBindingInfo::Type::Unknown:
|
||||
case InputBindingInfo::Type::Pointer:
|
||||
case InputBindingInfo::Type::RelativePointer:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -15,7 +15,8 @@ struct InputBindingInfo
|
||||
Axis,
|
||||
HalfAxis,
|
||||
Motor,
|
||||
Pointer, // Receive relative mouse movement events, bind_index is offset by the axis.
|
||||
Pointer, // Absolute pointer, does not receive any events, but is queryable.
|
||||
RelativePointer, // Receive relative mouse movement events, bind_index is offset by the axis.
|
||||
Macro,
|
||||
};
|
||||
|
||||
|
@ -202,7 +202,7 @@ static const Controller::ControllerBindingInfo s_binding_info[] = {
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
{ "Pointer", TRANSLATE_NOOP("PlaystationMouse", "Pointer"), ICON_PF_MOUSE_ANY, static_cast<u32>(PlayStationMouse::Binding::PointerX), InputBindingInfo::Type::Pointer, GenericInputBinding::Unknown },
|
||||
{ "Pointer", TRANSLATE_NOOP("PlaystationMouse", "Pointer"), ICON_PF_MOUSE_ANY, static_cast<u32>(PlayStationMouse::Binding::PointerX), InputBindingInfo::Type::RelativePointer, GenericInputBinding::Unknown },
|
||||
BUTTON("Left", TRANSLATE_NOOP("PlayStationMouse", "Left Button"), ICON_PF_MOUSE_BUTTON_1, PlayStationMouse::Binding::Left, GenericInputBinding::Cross),
|
||||
BUTTON("Right", TRANSLATE_NOOP("PlayStationMouse", "Right Button"), ICON_PF_MOUSE_BUTTON_2, PlayStationMouse::Binding::Right, GenericInputBinding::Circle),
|
||||
// clang-format on
|
||||
|
@ -405,7 +405,7 @@ void ControllerBindingWidget::createBindingWidgets(QWidget* parent)
|
||||
for (const Controller::ControllerBindingInfo& bi : m_controller_info->bindings)
|
||||
{
|
||||
if (bi.type == InputBindingInfo::Type::Axis || bi.type == InputBindingInfo::Type::HalfAxis ||
|
||||
bi.type == InputBindingInfo::Type::Pointer)
|
||||
bi.type == InputBindingInfo::Type::Pointer || bi.type == InputBindingInfo::Type::RelativePointer)
|
||||
{
|
||||
if (!axis_gbox)
|
||||
{
|
||||
@ -484,7 +484,8 @@ void ControllerBindingWidget::bindBindingWidgets(QWidget* parent)
|
||||
for (const Controller::ControllerBindingInfo& bi : m_controller_info->bindings)
|
||||
{
|
||||
if (bi.type == InputBindingInfo::Type::Axis || bi.type == InputBindingInfo::Type::HalfAxis ||
|
||||
bi.type == InputBindingInfo::Type::Button || bi.type == InputBindingInfo::Type::Pointer)
|
||||
bi.type == InputBindingInfo::Type::Button || bi.type == InputBindingInfo::Type::Pointer ||
|
||||
bi.type == InputBindingInfo::Type::RelativePointer)
|
||||
{
|
||||
InputBindingWidget* widget = parent->findChild<InputBindingWidget*>(QString::fromUtf8(bi.name));
|
||||
if (!widget)
|
||||
|
@ -303,7 +303,7 @@ bool InputManager::ParseBindingAndGetSource(std::string_view binding, InputBindi
|
||||
|
||||
std::string InputManager::ConvertInputBindingKeyToString(InputBindingInfo::Type binding_type, InputBindingKey key)
|
||||
{
|
||||
if (binding_type == InputBindingInfo::Type::Pointer)
|
||||
if (binding_type == InputBindingInfo::Type::Pointer || binding_type == InputBindingInfo::Type::RelativePointer)
|
||||
{
|
||||
// pointer and device bindings don't have a data part
|
||||
if (key.source_type == InputSourceType::Pointer)
|
||||
@ -356,7 +356,7 @@ std::string InputManager::ConvertInputBindingKeysToString(InputBindingInfo::Type
|
||||
const InputBindingKey* keys, size_t num_keys)
|
||||
{
|
||||
// can't have a chord of devices/pointers
|
||||
if (binding_type == InputBindingInfo::Type::Pointer)
|
||||
if (binding_type == InputBindingInfo::Type::Pointer || binding_type == InputBindingInfo::Type::Pointer)
|
||||
{
|
||||
// so only take the first
|
||||
if (num_keys > 0)
|
||||
@ -857,7 +857,7 @@ void InputManager::AddPadBindings(const SettingsInterface& si, const std::string
|
||||
}
|
||||
break;
|
||||
|
||||
case InputBindingInfo::Type::Pointer:
|
||||
case InputBindingInfo::Type::RelativePointer:
|
||||
{
|
||||
auto cb = [pad_index, base = bi.bind_index](InputBindingKey key, float value) {
|
||||
if (!System::IsValid())
|
||||
@ -887,6 +887,9 @@ void InputManager::AddPadBindings(const SettingsInterface& si, const std::string
|
||||
}
|
||||
break;
|
||||
|
||||
case InputBindingInfo::Type::Pointer:
|
||||
break;
|
||||
|
||||
default:
|
||||
ERROR_LOG("Unhandled binding info type {}", static_cast<u32>(bi.type));
|
||||
break;
|
||||
@ -1309,7 +1312,8 @@ void InputManager::UpdatePointerRelativeDelta(u32 index, InputPointerAxis axis,
|
||||
void InputManager::UpdateRelativeMouseMode()
|
||||
{
|
||||
// Check for relative mode bindings, and enable if there's anything using it.
|
||||
bool has_relative_mode_bindings = !s_pointer_move_callbacks.empty();
|
||||
// Raw input needs to force relative mode/clipping, because it's now disconnected from the system pointer.
|
||||
bool has_relative_mode_bindings = !s_pointer_move_callbacks.empty() || IsUsingRawInput();
|
||||
if (!has_relative_mode_bindings)
|
||||
{
|
||||
for (const auto& it : s_binding_map)
|
||||
|
Loading…
Reference in New Issue
Block a user