mirror of
https://github.com/stenzek/duckstation.git
synced 2024-11-26 23:50:31 +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,
|
const char* name, const char* display_name, const char* icon_name,
|
||||||
bool show_type)
|
bool show_type)
|
||||||
{
|
{
|
||||||
if (type == InputBindingInfo::Type::Pointer)
|
if (type == InputBindingInfo::Type::Pointer || type == InputBindingInfo::Type::RelativePointer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TinyString title;
|
TinyString title;
|
||||||
|
@ -791,6 +791,7 @@ void ImGuiManager::DrawInputsOverlay()
|
|||||||
case InputBindingInfo::Type::Macro:
|
case InputBindingInfo::Type::Macro:
|
||||||
case InputBindingInfo::Type::Unknown:
|
case InputBindingInfo::Type::Unknown:
|
||||||
case InputBindingInfo::Type::Pointer:
|
case InputBindingInfo::Type::Pointer:
|
||||||
|
case InputBindingInfo::Type::RelativePointer:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@ struct InputBindingInfo
|
|||||||
Axis,
|
Axis,
|
||||||
HalfAxis,
|
HalfAxis,
|
||||||
Motor,
|
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,
|
Macro,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ static const Controller::ControllerBindingInfo s_binding_info[] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// 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("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),
|
BUTTON("Right", TRANSLATE_NOOP("PlayStationMouse", "Right Button"), ICON_PF_MOUSE_BUTTON_2, PlayStationMouse::Binding::Right, GenericInputBinding::Circle),
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
@ -405,7 +405,7 @@ void ControllerBindingWidget::createBindingWidgets(QWidget* parent)
|
|||||||
for (const Controller::ControllerBindingInfo& bi : m_controller_info->bindings)
|
for (const Controller::ControllerBindingInfo& bi : m_controller_info->bindings)
|
||||||
{
|
{
|
||||||
if (bi.type == InputBindingInfo::Type::Axis || bi.type == InputBindingInfo::Type::HalfAxis ||
|
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)
|
if (!axis_gbox)
|
||||||
{
|
{
|
||||||
@ -484,7 +484,8 @@ void ControllerBindingWidget::bindBindingWidgets(QWidget* parent)
|
|||||||
for (const Controller::ControllerBindingInfo& bi : m_controller_info->bindings)
|
for (const Controller::ControllerBindingInfo& bi : m_controller_info->bindings)
|
||||||
{
|
{
|
||||||
if (bi.type == InputBindingInfo::Type::Axis || bi.type == InputBindingInfo::Type::HalfAxis ||
|
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));
|
InputBindingWidget* widget = parent->findChild<InputBindingWidget*>(QString::fromUtf8(bi.name));
|
||||||
if (!widget)
|
if (!widget)
|
||||||
|
@ -303,7 +303,7 @@ bool InputManager::ParseBindingAndGetSource(std::string_view binding, InputBindi
|
|||||||
|
|
||||||
std::string InputManager::ConvertInputBindingKeyToString(InputBindingInfo::Type binding_type, InputBindingKey key)
|
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
|
// pointer and device bindings don't have a data part
|
||||||
if (key.source_type == InputSourceType::Pointer)
|
if (key.source_type == InputSourceType::Pointer)
|
||||||
@ -356,7 +356,7 @@ std::string InputManager::ConvertInputBindingKeysToString(InputBindingInfo::Type
|
|||||||
const InputBindingKey* keys, size_t num_keys)
|
const InputBindingKey* keys, size_t num_keys)
|
||||||
{
|
{
|
||||||
// can't have a chord of devices/pointers
|
// 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
|
// so only take the first
|
||||||
if (num_keys > 0)
|
if (num_keys > 0)
|
||||||
@ -857,7 +857,7 @@ void InputManager::AddPadBindings(const SettingsInterface& si, const std::string
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case InputBindingInfo::Type::Pointer:
|
case InputBindingInfo::Type::RelativePointer:
|
||||||
{
|
{
|
||||||
auto cb = [pad_index, base = bi.bind_index](InputBindingKey key, float value) {
|
auto cb = [pad_index, base = bi.bind_index](InputBindingKey key, float value) {
|
||||||
if (!System::IsValid())
|
if (!System::IsValid())
|
||||||
@ -887,6 +887,9 @@ void InputManager::AddPadBindings(const SettingsInterface& si, const std::string
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case InputBindingInfo::Type::Pointer:
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ERROR_LOG("Unhandled binding info type {}", static_cast<u32>(bi.type));
|
ERROR_LOG("Unhandled binding info type {}", static_cast<u32>(bi.type));
|
||||||
break;
|
break;
|
||||||
@ -1309,7 +1312,8 @@ void InputManager::UpdatePointerRelativeDelta(u32 index, InputPointerAxis axis,
|
|||||||
void InputManager::UpdateRelativeMouseMode()
|
void InputManager::UpdateRelativeMouseMode()
|
||||||
{
|
{
|
||||||
// Check for relative mode bindings, and enable if there's anything using it.
|
// 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)
|
if (!has_relative_mode_bindings)
|
||||||
{
|
{
|
||||||
for (const auto& it : s_binding_map)
|
for (const auto& it : s_binding_map)
|
||||||
|
Loading…
Reference in New Issue
Block a user