joyful/internal/configparser/schema.go
eviLu 7e4d4f3c20 Add support for setting vendor/device IDs (#10)
Sets vendor and product IDs, defaults to the prior default values.
This is needed for some games to be able to correctly identify the virtual devices since not all games support device indexes.

Reviewed-on: https://codeberg.org/annabunches/joyful/pulls/10
2026-09-12 16:22:43 +02:00

75 lines
1.9 KiB
Go

// These types comprise the YAML schema that doesn't need custom unmarshalling.
package configparser
type Config struct {
Devices []DeviceConfig
Modes []string
Rules []RuleConfig
}
// TODO: configure custom unmarshaling so we can overload Buttons, Axes, and RelativeAxes...
type DeviceConfigVirtual struct {
Name string
VendorId string `yaml:"vendor_id,omitempty"`
DeviceId string `yaml:"device_id,omitempty"`
Preset string
NumButtons int `yaml:"num_buttons,omitempty"`
NumAxes int `yaml:"num_axes,omitempty"`
NumRelativeAxes int `yaml:"num_rel_axes"`
Buttons []string
Axes []string
RelativeAxes []string `yaml:"rel_axes,omitempty"`
}
type RuleConfigButton struct {
Input RuleTargetConfigButton
Output RuleTargetConfigButton
}
type RuleConfigButtonCombo struct {
Inputs []RuleTargetConfigButton
Output RuleTargetConfigButton
}
type RuleConfigButtonLatched struct {
Input RuleTargetConfigButton
Output RuleTargetConfigButton
}
type RuleConfigAxis struct {
Input RuleTargetConfigAxis
Output RuleTargetConfigAxis
}
type RuleConfigHat struct {
Input RuleTargetConfigHat
Output RuleTargetConfigHat
}
type RuleConfigAxisCombined struct {
InputLower RuleTargetConfigAxis `yaml:"input_lower,omitempty"`
InputUpper RuleTargetConfigAxis `yaml:"input_upper,omitempty"`
Output RuleTargetConfigAxis
}
type RuleConfigAxisToButton struct {
Hold bool
RepeatRateMin int `yaml:"repeat_rate_min,omitempty"`
RepeatRateMax int `yaml:"repeat_rate_max,omitempty"`
Input RuleTargetConfigAxis
Output RuleTargetConfigButton
}
type RuleConfigAxisToRelaxis struct {
RepeatRateMin int `yaml:"repeat_rate_min"`
RepeatRateMax int `yaml:"repeat_rate_max"`
Increment int
Input RuleTargetConfigAxis
Output RuleTargetConfigRelaxis
}
type RuleConfigModeSelect struct {
Input RuleTargetConfigButton
Output RuleTargetConfigModeSelect
}