InputManager: Adjust scope of constants

This commit is contained in:
Stenzek 2025-01-13 16:35:40 +10:00
parent 3476140ba2
commit aaf2a4b614
No known key found for this signature in database
2 changed files with 12 additions and 5 deletions

View File

@ -33,7 +33,7 @@
LOG_CHANNEL(InputManager); LOG_CHANNEL(InputManager);
namespace { namespace InputManager {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Constants // Constants
@ -41,8 +41,6 @@ namespace {
enum : u32 enum : u32
{ {
MAX_KEYS_PER_BINDING = 4,
MAX_MOTORS_PER_PAD = 2,
FIRST_EXTERNAL_INPUT_SOURCE = static_cast<u32>(InputSourceType::Pointer) + 1u, FIRST_EXTERNAL_INPUT_SOURCE = static_cast<u32>(InputSourceType::Pointer) + 1u,
LAST_EXTERNAL_INPUT_SOURCE = static_cast<u32>(InputSourceType::Count), LAST_EXTERNAL_INPUT_SOURCE = static_cast<u32>(InputSourceType::Count),
}; };
@ -55,6 +53,8 @@ enum : u32
// all keys go active, and for axis callbacks, when all are active and // all keys go active, and for axis callbacks, when all are active and
// the value changes. // the value changes.
namespace {
struct InputBinding struct InputBinding
{ {
InputBindingKey keys[MAX_KEYS_PER_BINDING] = {}; InputBindingKey keys[MAX_KEYS_PER_BINDING] = {};
@ -103,7 +103,6 @@ struct MacroButton
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Forward Declarations (for static qualifier) // Forward Declarations (for static qualifier)
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
namespace InputManager {
static std::optional<InputBindingKey> ParseHostKeyboardKey(std::string_view source, std::string_view sub_binding); static std::optional<InputBindingKey> ParseHostKeyboardKey(std::string_view source, std::string_view sub_binding);
static std::optional<InputBindingKey> ParsePointerKey(std::string_view source, std::string_view sub_binding); static std::optional<InputBindingKey> ParsePointerKey(std::string_view source, std::string_view sub_binding);
static std::optional<InputBindingKey> ParseSensorKey(std::string_view source, std::string_view sub_binding); static std::optional<InputBindingKey> ParseSensorKey(std::string_view source, std::string_view sub_binding);
@ -135,7 +134,6 @@ static void UpdateMacroButtons();
static void UpdateInputSourceState(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock, static void UpdateInputSourceState(const SettingsInterface& si, std::unique_lock<std::mutex>& settings_lock,
InputSourceType type, std::unique_ptr<InputSource> (*factory_function)()); InputSourceType type, std::unique_ptr<InputSource> (*factory_function)());
} // namespace InputManager
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Local Variables // Local Variables
@ -198,6 +196,8 @@ static bool s_relative_mouse_mode_active = false;
static bool s_hide_host_mouse_cursor = false; static bool s_hide_host_mouse_cursor = false;
static bool s_hide_host_mouse_cusor_active = false; static bool s_hide_host_mouse_cusor_active = false;
} // namespace InputManager
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Binding Parsing // Binding Parsing
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------

View File

@ -189,6 +189,13 @@ public:
}; };
namespace InputManager { namespace InputManager {
/// Maximum number of buttons that can be part of a chord.
static constexpr u32 MAX_KEYS_PER_BINDING = 4;
/// Maximum number of output vibration motors per pad.
static constexpr u32 MAX_MOTORS_PER_PAD = 2;
/// Minimum interval between vibration updates when the effect is continuous. /// Minimum interval between vibration updates when the effect is continuous.
static constexpr double VIBRATION_UPDATE_INTERVAL_SECONDS = 0.5; // 500ms static constexpr double VIBRATION_UPDATE_INTERVAL_SECONDS = 0.5; // 500ms