aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Ava/UI/Views/Input
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Ava/UI/Views/Input')
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml616
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs160
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/InputView.axaml225
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/InputView.axaml.cs61
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml675
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml.cs210
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml2
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs8
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml2
-rw-r--r--src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs8
10 files changed, 1391 insertions, 576 deletions
diff --git a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml
index d636873a..08bdf90f 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml
+++ b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml
@@ -1,13 +1,11 @@
<UserControl
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
- xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
- xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input"
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -15,6 +13,7 @@
d:DesignWidth="800"
x:Class="Ryujinx.Ava.UI.Views.Input.ControllerInputView"
x:DataType="viewModels:ControllerInputViewModel"
+ x:CompileBindings="True"
mc:Ignorable="d"
Focusable="True">
<Design.DataContext>
@@ -34,191 +33,10 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Orientation="Vertical">
- <StackPanel
- Margin="0 0 0 5"
- Orientation="Vertical"
- Spacing="5">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="10" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <!-- Player Selection -->
- <Grid
- Grid.Column="0"
- Margin="2"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Center">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <TextBlock
- Margin="5,0,10,0"
- Width="90"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsPlayer}" />
- <ComboBox
- Grid.Column="1"
- Name="PlayerIndexBox"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Center"
- SelectionChanged="PlayerIndexBox_OnSelectionChanged"
- ItemsSource="{Binding PlayerIndexes}"
- SelectedIndex="{Binding PlayerId}">
- <ComboBox.ItemTemplate>
- <DataTemplate>
- <TextBlock Text="{Binding Name}" />
- </DataTemplate>
- </ComboBox.ItemTemplate>
- </ComboBox>
- </Grid>
- <!-- Profile Selection -->
- <Grid
- Grid.Column="2"
- Margin="2"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Center">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <TextBlock
- Margin="5,0,10,0"
- Width="90"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsProfile}" />
- <ui:FAComboBox
- Grid.Column="1"
- IsEditable="True"
- Name="ProfileBox"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Center"
- SelectedIndex="0"
- ItemsSource="{Binding ProfilesList}"
- Text="{Binding ProfileName, Mode=TwoWay}" />
- <Button
- Grid.Column="2"
- MinWidth="0"
- Margin="5,0,0,0"
- VerticalAlignment="Center"
- ToolTip.Tip="{locale:Locale ControllerSettingsLoadProfileToolTip}"
- Command="{ReflectionBinding LoadProfile}">
- <ui:SymbolIcon
- Symbol="Upload"
- FontSize="15"
- Height="20" />
- </Button>
- <Button
- Grid.Column="3"
- MinWidth="0"
- Margin="5,0,0,0"
- VerticalAlignment="Center"
- ToolTip.Tip="{locale:Locale ControllerSettingsSaveProfileToolTip}"
- Command="{ReflectionBinding SaveProfile}">
- <ui:SymbolIcon
- Symbol="Save"
- FontSize="15"
- Height="20" />
- </Button>
- <Button
- Grid.Column="4"
- MinWidth="0"
- Margin="5,0,0,0"
- VerticalAlignment="Center"
- ToolTip.Tip="{locale:Locale ControllerSettingsRemoveProfileToolTip}"
- Command="{ReflectionBinding RemoveProfile}">
- <ui:SymbolIcon
- Symbol="Delete"
- FontSize="15"
- Height="20" />
- </Button>
- </Grid>
- </Grid>
- <Separator />
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="10" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <!-- Input Device -->
- <Grid
- Grid.Column="0"
- Margin="2"
- HorizontalAlignment="Stretch">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <TextBlock
- Grid.Column="0"
- Margin="5,0,10,0"
- Width="90"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsInputDevice}" />
- <ComboBox
- Grid.Column="1"
- Name="DeviceBox"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Center"
- ItemsSource="{Binding DeviceList}"
- SelectedIndex="{Binding Device}" />
- <Button
- Grid.Column="2"
- MinWidth="0"
- Margin="5,0,0,0"
- VerticalAlignment="Center"
- Command="{ReflectionBinding LoadDevices}">
- <ui:SymbolIcon
- Symbol="Refresh"
- FontSize="15"
- Height="20"/>
- </Button>
- </Grid>
- <!-- Controller Type -->
- <Grid
- Grid.Column="2"
- Margin="2"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Center">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <TextBlock
- Margin="5,0,10,0"
- Width="90"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsControllerType}" />
- <ComboBox
- Grid.Column="1"
- HorizontalAlignment="Stretch"
- ItemsSource="{Binding Controllers}"
- SelectedIndex="{Binding Controller}">
- <ComboBox.ItemTemplate>
- <DataTemplate DataType="models:ControllerModel">
- <TextBlock Text="{Binding Name}" />
- </DataTemplate>
- </ComboBox.ItemTemplate>
- </ComboBox>
- </Grid>
- </Grid>
- </StackPanel>
<!-- Button / JoyStick Settings -->
<Grid
Name="SettingButtons"
- MinHeight="450"
- IsVisible="{Binding ShowSettings}">
+ MinHeight="450">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@@ -257,9 +75,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsTriggerZL}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="ButtonZl">
<TextBlock
- Text="{ReflectionBinding Configuration.ButtonZl, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.ButtonZl, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -273,9 +91,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsTriggerL}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="ButtonL">
<TextBlock
- Text="{ReflectionBinding Configuration.ButtonL, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.ButtonL, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -289,9 +107,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonMinus}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="ButtonMinus">
<TextBlock
- Text="{ReflectionBinding Configuration.ButtonMinus, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.ButtonMinus, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -311,100 +129,8 @@
Margin="0,0,0,10"
HorizontalAlignment="Center"
Text="{locale:Locale ControllerSettingsLStick}" />
- <!-- Left Joystick Keyboard -->
- <StackPanel
- IsVisible="{Binding !IsController}"
- Orientation="Vertical">
- <!-- Left Joystick Button -->
- <StackPanel
- Margin="0,0,0,4"
- Orientation="Horizontal">
- <TextBlock
- Margin="0,0,10,0"
- Width="120"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsStickButton}"
- TextAlignment="Center" />
- <ToggleButton>
- <TextBlock
- Text="{ReflectionBinding Configuration.LeftKeyboardStickButton, Mode=TwoWay, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <!-- Left Joystick Up -->
- <StackPanel
- Margin="0,0,0,4"
- Orientation="Horizontal">
- <TextBlock
- Margin="0,0,10,0"
- Width="120"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsStickUp}"
- TextAlignment="Center" />
- <ToggleButton>
- <TextBlock
- Text="{ReflectionBinding Configuration.LeftStickUp, Mode=TwoWay, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <!-- Left Joystick Down -->
- <StackPanel
- Margin="0,0,0,4"
- Orientation="Horizontal">
- <TextBlock
- Margin="0,0,10,0"
- Width="120"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsStickDown}"
- TextAlignment="Center" />
- <ToggleButton>
- <TextBlock
- Text="{ReflectionBinding Configuration.LeftStickDown, Mode=TwoWay, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <!-- Left Joystick Left -->
- <StackPanel
- Margin="0,0,0,4"
- Orientation="Horizontal">
- <TextBlock
- Margin="0,0,10,0"
- Width="120"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsStickLeft}"
- TextAlignment="Center" />
- <ToggleButton>
- <TextBlock
- Text="{ReflectionBinding Configuration.LeftStickLeft, Mode=TwoWay, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <!-- Left Joystick Right -->
- <StackPanel
- Margin="0,0,0,4"
- Orientation="Horizontal">
- <TextBlock
- Margin="0,0,10,0"
- Width="120"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsStickRight}"
- TextAlignment="Center" />
- <ToggleButton>
- <TextBlock
- Text="{ReflectionBinding Configuration.LeftStickRight, Mode=TwoWay, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- </StackPanel>
<!-- Left Joystick Controller -->
- <StackPanel
- IsVisible="{Binding IsController}"
- Orientation="Vertical">
+ <StackPanel Orientation="Vertical">
<!-- Left Joystick Button -->
<StackPanel
Orientation="Horizontal">
@@ -415,9 +141,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsStickButton}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="LeftStickButton">
<TextBlock
- Text="{ReflectionBinding Configuration.LeftControllerStickButton, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.LeftStickButton, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -432,22 +158,22 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsStickStick}"
TextAlignment="Center" />
- <ToggleButton Tag="stick">
+ <ToggleButton Name="LeftJoystick" Tag="stick">
<TextBlock
- Text="{ReflectionBinding Configuration.LeftJoystick, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.LeftJoystick, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
<Separator
Margin="0,8,0,8"
Height="1" />
- <CheckBox IsChecked="{ReflectionBinding Configuration.LeftInvertStickX}">
+ <CheckBox IsChecked="{Binding Config.LeftInvertStickX}">
<TextBlock Text="{locale:Locale ControllerSettingsStickInvertXAxis}" />
</CheckBox>
- <CheckBox IsChecked="{ReflectionBinding Configuration.LeftInvertStickY}">
+ <CheckBox IsChecked="{Binding Config.LeftInvertStickY}">
<TextBlock Text="{locale:Locale ControllerSettingsStickInvertYAxis}" />
</CheckBox>
- <CheckBox IsChecked="{ReflectionBinding Configuration.LeftRotate90}">
+ <CheckBox IsChecked="{Binding Config.LeftRotate90}">
<TextBlock Text="{locale:Locale ControllerSettingsRotate90}" />
</CheckBox>
<Separator
@@ -468,11 +194,11 @@
IsSnapToTickEnabled="True"
SmallChange="0.01"
Minimum="0"
- Value="{ReflectionBinding Configuration.DeadzoneLeft, Mode=TwoWay}" />
+ Value="{Binding Config.DeadzoneLeft, Mode=TwoWay}" />
<TextBlock
VerticalAlignment="Center"
Width="25"
- Text="{ReflectionBinding Configuration.DeadzoneLeft, StringFormat=\{0:0.00\}}" />
+ Text="{Binding Config.DeadzoneLeft, StringFormat=\{0:0.00\}}" />
</StackPanel>
<TextBlock
HorizontalAlignment="Center"
@@ -488,11 +214,11 @@
IsSnapToTickEnabled="True"
SmallChange="0.01"
Minimum="0"
- Value="{ReflectionBinding Configuration.RangeLeft, Mode=TwoWay}" />
+ Value="{Binding Config.RangeLeft, Mode=TwoWay}" />
<TextBlock
VerticalAlignment="Center"
Width="25"
- Text="{ReflectionBinding Configuration.RangeLeft, StringFormat=\{0:0.00\}}" />
+ Text="{Binding Config.RangeLeft, StringFormat=\{0:0.00\}}" />
</StackPanel>
</StackPanel>
</StackPanel>
@@ -525,9 +251,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsDPadUp}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="DpadUp">
<TextBlock
- Text="{ReflectionBinding Configuration.DpadUp, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.DpadUp, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -542,9 +268,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsDPadDown}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="DpadDown">
<TextBlock
- Text="{ReflectionBinding Configuration.DpadDown, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.DpadDown, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -559,9 +285,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsDPadLeft}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="DpadLeft">
<TextBlock
- Text="{ReflectionBinding Configuration.DpadLeft, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.DpadLeft, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -576,9 +302,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsDPadRight}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="DpadRight">
<TextBlock
- Text="{ReflectionBinding Configuration.DpadRight, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.DpadRight, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -591,6 +317,13 @@
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
+ <!-- Controller Picture -->
+ <Image
+ Margin="0,10"
+ MaxHeight="300"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Source="{Binding Image}" />
<Border
BorderBrush="{DynamicResource ThemeControlBorderColor}"
BorderThickness="1"
@@ -612,92 +345,89 @@
IsSnapToTickEnabled="True"
SmallChange="0.01"
Minimum="0"
- Value="{ReflectionBinding Configuration.TriggerThreshold, Mode=TwoWay}" />
+ Value="{Binding Config.TriggerThreshold, Mode=TwoWay}" />
<TextBlock
Width="25"
- Text="{ReflectionBinding Configuration.TriggerThreshold, StringFormat=\{0:0.00\}}" />
+ Text="{Binding Config.TriggerThreshold, StringFormat=\{0:0.00\}}" />
</StackPanel>
<StackPanel
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsVisible="{Binding !IsRight}"
- Orientation="Horizontal">
- <TextBlock
- Width="20"
+ Orientation="Vertical"
+ IsVisible="{Binding HasSides}">
+ <StackPanel
+ Margin="0,4,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsLeftSR}"
- TextAlignment="Center" />
- <ToggleButton>
+ IsVisible="{Binding IsLeft}"
+ Orientation="Horizontal">
<TextBlock
- Text="{ReflectionBinding Configuration.LeftButtonSr, Mode=TwoWay, Converter={StaticResource Key}}"
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLeftSR}"
TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <StackPanel
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsVisible="{Binding !IsRight}"
- Orientation="Horizontal">
- <TextBlock
- Width="20"
+ <ToggleButton Name="LeftButtonSr">
+ <TextBlock
+ Text="{Binding Config.LeftButtonSr, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsLeftSL}"
- TextAlignment="Center" />
- <ToggleButton>
+ IsVisible="{Binding IsLeft}"
+ Orientation="Horizontal">
<TextBlock
- Text="{ReflectionBinding Configuration.LeftButtonSl, Mode=TwoWay, Converter={StaticResource Key}}"
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLeftSL}"
TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <StackPanel
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsVisible="{Binding !IsLeft}"
- Orientation="Horizontal">
- <TextBlock
- Width="20"
+ <ToggleButton Name="LeftButtonSl">
+ <TextBlock
+ Text="{Binding Config.LeftButtonSl, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsRightSR}"
- TextAlignment="Center" />
- <ToggleButton>
+ IsVisible="{Binding IsRight}"
+ Orientation="Horizontal">
<TextBlock
- Text="{ReflectionBinding Configuration.RightButtonSr, Mode=TwoWay, Converter={StaticResource Key}}"
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRightSR}"
TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <StackPanel
- Margin="0,4,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- IsVisible="{Binding !IsLeft}"
- Orientation="Horizontal">
- <TextBlock
- Width="20"
+ <ToggleButton Name="RightButtonSr">
+ <TextBlock
+ Text="{Binding Config.RightButtonSr, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsRightSL}"
- TextAlignment="Center" />
- <ToggleButton>
+ IsVisible="{Binding IsRight}"
+ Orientation="Horizontal">
<TextBlock
- Text="{ReflectionBinding Configuration.RightButtonSl, Mode=TwoWay, Converter={StaticResource Key}}"
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRightSL}"
TextAlignment="Center" />
- </ToggleButton>
+ <ToggleButton Name="RightButtonSl">
+ <TextBlock
+ Text="{Binding Config.RightButtonSl, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
</StackPanel>
</StackPanel>
</Border>
- <!-- Controller Picture -->
- <Image
- Margin="0,10,0,0"
- MaxHeight="300"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch"
- Source="{Binding Image}" />
<!-- Motion + Rumble -->
<StackPanel
Margin="0,10,0,0"
@@ -709,8 +439,7 @@
BorderThickness="1"
CornerRadius="5"
VerticalAlignment="Bottom"
- HorizontalAlignment="Stretch"
- IsVisible="{Binding IsController}">
+ HorizontalAlignment="Stretch">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
@@ -720,7 +449,7 @@
Margin="10"
MinWidth="0"
Grid.Column="0"
- IsChecked="{ReflectionBinding Configuration.EnableMotion, Mode=TwoWay}">
+ IsChecked="{Binding Config.EnableMotion, Mode=TwoWay}">
<TextBlock Text="{locale:Locale ControllerSettingsMotion}" />
</CheckBox>
<Button
@@ -736,7 +465,6 @@
BorderThickness="1"
CornerRadius="5"
HorizontalAlignment="Stretch"
- IsVisible="{Binding IsController}"
Margin="0,-1,0,0">
<Grid>
<Grid.ColumnDefinitions>
@@ -747,7 +475,7 @@
Margin="10"
MinWidth="0"
Grid.Column="0"
- IsChecked="{ReflectionBinding Configuration.EnableRumble, Mode=TwoWay}">
+ IsChecked="{Binding Config.EnableRumble, Mode=TwoWay}">
<TextBlock Text="{locale:Locale ControllerSettingsRumble}" />
</CheckBox>
<Button
@@ -793,9 +521,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsTriggerZR}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="ButtonZr">
<TextBlock
- Text="{ReflectionBinding Configuration.ButtonZr, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.ButtonZr, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -811,9 +539,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsTriggerR}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="ButtonR">
<TextBlock
- Text="{ReflectionBinding Configuration.ButtonR, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.ButtonR, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -829,15 +557,15 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonPlus}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="ButtonPlus">
<TextBlock
- Text="{ReflectionBinding Configuration.ButtonPlus, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.ButtonPlus, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
</Grid>
</Border>
- <!-- Right Joystick -->
+ <!-- Right Buttons -->
<Border
BorderBrush="{DynamicResource ThemeControlBorderColor}"
BorderThickness="1"
@@ -864,9 +592,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonA}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="ButtonA">
<TextBlock
- Text="{ReflectionBinding Configuration.ButtonA, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.ButtonA, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -881,9 +609,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonB}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="ButtonB">
<TextBlock
- Text="{ReflectionBinding Configuration.ButtonB, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.ButtonB, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -898,9 +626,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonX}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="ButtonX">
<TextBlock
- Text="{ReflectionBinding Configuration.ButtonX, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.ButtonX, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -915,9 +643,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonY}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="ButtonY">
<TextBlock
- Text="{ReflectionBinding Configuration.ButtonY, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.ButtonY, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -937,100 +665,8 @@
Margin="0,0,0,10"
HorizontalAlignment="Center"
Text="{locale:Locale ControllerSettingsRStick}" />
- <!-- Right Joystick Keyboard -->
- <StackPanel
- IsVisible="{Binding !IsController}"
- Orientation="Vertical">
- <!-- Right Joystick Button -->
- <StackPanel
- Margin="0,0,0,4"
- Orientation="Horizontal">
- <TextBlock
- Margin="0,0,10,0"
- Width="120"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsStickButton}"
- TextAlignment="Center" />
- <ToggleButton>
- <TextBlock
- Text="{ReflectionBinding Configuration.RightKeyboardStickButton, Mode=TwoWay, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <!-- Right Joystick Up -->
- <StackPanel
- Margin="0,0,0,4"
- Orientation="Horizontal">
- <TextBlock
- Margin="0,0,10,0"
- Width="120"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsStickUp}"
- TextAlignment="Center" />
- <ToggleButton>
- <TextBlock
- Text="{ReflectionBinding Configuration.RightStickUp, Mode=TwoWay, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <!-- Right Joystick Down -->
- <StackPanel
- Margin="0,0,0,4"
- Orientation="Horizontal">
- <TextBlock
- Margin="0,0,10,0"
- Width="120"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsStickDown}"
- TextAlignment="Center" />
- <ToggleButton>
- <TextBlock
- Text="{ReflectionBinding Configuration.RightStickDown, Mode=TwoWay, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <!-- Right Joystick Left -->
- <StackPanel
- Margin="0,0,0,4"
- Orientation="Horizontal">
- <TextBlock
- Margin="0,0,10,0"
- Width="120"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsStickLeft}"
- TextAlignment="Center" />
- <ToggleButton>
- <TextBlock
- Text="{ReflectionBinding Configuration.RightStickLeft, Mode=TwoWay, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <!-- Right Joystick Right -->
- <StackPanel
- Margin="0,0,0,4"
- Orientation="Horizontal">
- <TextBlock
- Margin="0,0,10,0"
- Width="120"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsStickRight}"
- TextAlignment="Center" />
- <ToggleButton>
- <TextBlock
- Text="{ReflectionBinding Configuration.RightStickRight, Mode=TwoWay, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- </StackPanel>
<!-- Right Joystick Controller -->
- <StackPanel
- IsVisible="{Binding IsController}"
- Orientation="Vertical">
+ <StackPanel Orientation="Vertical">
<!-- Right Joystick Button -->
<StackPanel
Orientation="Horizontal">
@@ -1041,9 +677,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsStickButton}"
TextAlignment="Center" />
- <ToggleButton>
+ <ToggleButton Name="RightStickButton">
<TextBlock
- Text="{ReflectionBinding Configuration.RightControllerStickButton, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.RightStickButton, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -1059,20 +695,20 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsStickStick}"
TextAlignment="Center" />
- <ToggleButton Tag="stick">
+ <ToggleButton Name="RightJoystick" Tag="stick">
<TextBlock
- Text="{ReflectionBinding Configuration.RightJoystick, Mode=TwoWay, Converter={StaticResource Key}}"
+ Text="{Binding Config.RightJoystick, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
<Separator Margin="0,8,0,8" Height="1" />
- <CheckBox IsChecked="{ReflectionBinding Configuration.RightInvertStickX}">
+ <CheckBox IsChecked="{Binding Config.RightInvertStickX}">
<TextBlock Text="{locale:Locale ControllerSettingsStickInvertXAxis}" />
</CheckBox>
- <CheckBox IsChecked="{ReflectionBinding Configuration.RightInvertStickY}">
+ <CheckBox IsChecked="{Binding Config.RightInvertStickY}">
<TextBlock Text="{locale:Locale ControllerSettingsStickInvertYAxis}" />
</CheckBox>
- <CheckBox IsChecked="{ReflectionBinding Configuration.RightRotate90}">
+ <CheckBox IsChecked="{Binding Config.RightRotate90}">
<TextBlock Text="{locale:Locale ControllerSettingsRotate90}" />
</CheckBox>
<Separator Margin="0,8,0,8" Height="1" />
@@ -1093,11 +729,11 @@
Padding="0"
VerticalAlignment="Center"
Minimum="0"
- Value="{ReflectionBinding Configuration.DeadzoneRight, Mode=TwoWay}" />
+ Value="{Binding Config.DeadzoneRight, Mode=TwoWay}" />
<TextBlock
VerticalAlignment="Center"
Width="25"
- Text="{ReflectionBinding Configuration.DeadzoneRight, StringFormat=\{0:0.00\}}" />
+ Text="{Binding Config.DeadzoneRight, StringFormat=\{0:0.00\}}" />
</StackPanel>
<TextBlock
HorizontalAlignment="Center"
@@ -1113,11 +749,11 @@
IsSnapToTickEnabled="True"
SmallChange="0.01"
Minimum="0"
- Value="{ReflectionBinding Configuration.RangeRight, Mode=TwoWay}" />
+ Value="{Binding Config.RangeRight, Mode=TwoWay}" />
<TextBlock
VerticalAlignment="Center"
Width="25"
- Text="{ReflectionBinding Configuration.RangeRight, StringFormat=\{0:0.00\}}" />
+ Text="{Binding Config.RangeRight, StringFormat=\{0:0.00\}}" />
</StackPanel>
</StackPanel>
</StackPanel>
diff --git a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs
index 35129706..52fc6238 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs
+++ b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs
@@ -1,35 +1,28 @@
+using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.LogicalTree;
-using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.Helpers;
-using Ryujinx.Ava.UI.Models;
-using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.Ava.UI.ViewModels.Input;
using Ryujinx.Common.Configuration.Hid.Controller;
using Ryujinx.Input;
using Ryujinx.Input.Assigner;
-using System;
namespace Ryujinx.Ava.UI.Views.Input
{
public partial class ControllerInputView : UserControl
{
- private bool _dialogOpen;
-
private ButtonKeyAssigner _currentAssigner;
- internal ControllerInputViewModel ViewModel { get; set; }
public ControllerInputView()
{
- DataContext = ViewModel = new ControllerInputViewModel(this);
-
InitializeComponent();
foreach (ILogical visual in SettingButtons.GetLogicalDescendants())
{
- if (visual is ToggleButton button && visual is not CheckBox)
+ if (visual is ToggleButton button and not CheckBox)
{
button.IsCheckedChanged += Button_IsCheckedChanged;
}
@@ -59,7 +52,7 @@ namespace Ryujinx.Ava.UI.Views.Input
bool isStick = button.Tag != null && button.Tag.ToString() == "stick";
- if (_currentAssigner == null)
+ if (_currentAssigner == null && (bool)button.IsChecked)
{
_currentAssigner = new ButtonKeyAssigner(button);
@@ -67,14 +60,86 @@ namespace Ryujinx.Ava.UI.Views.Input
PointerPressed += MouseClick;
- IKeyboard keyboard = (IKeyboard)ViewModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations.
+ IKeyboard keyboard = (IKeyboard)(DataContext as ControllerInputViewModel).parentModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations.
IButtonAssigner assigner = CreateButtonAssigner(isStick);
_currentAssigner.ButtonAssigned += (sender, e) =>
{
- if (e.IsAssigned)
+ if (e.ButtonValue.HasValue)
{
- ViewModel.IsModified = true;
+ var viewModel = (DataContext as ControllerInputViewModel);
+ var buttonValue = e.ButtonValue.Value;
+ viewModel.parentModel.IsModified = true;
+
+ switch (button.Name)
+ {
+ case "ButtonZl":
+ viewModel.Config.ButtonZl = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "ButtonL":
+ viewModel.Config.ButtonL = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "ButtonMinus":
+ viewModel.Config.ButtonMinus = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "LeftStickButton":
+ viewModel.Config.LeftStickButton = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "LeftJoystick":
+ viewModel.Config.LeftJoystick = buttonValue.AsGamepadStickId();
+ break;
+ case "DpadUp":
+ viewModel.Config.DpadUp = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "DpadDown":
+ viewModel.Config.DpadDown = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "DpadLeft":
+ viewModel.Config.DpadLeft = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "DpadRight":
+ viewModel.Config.DpadRight = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "LeftButtonSr":
+ viewModel.Config.LeftButtonSr = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "LeftButtonSl":
+ viewModel.Config.LeftButtonSl = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "RightButtonSr":
+ viewModel.Config.RightButtonSr = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "RightButtonSl":
+ viewModel.Config.RightButtonSl = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "ButtonZr":
+ viewModel.Config.ButtonZr = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "ButtonR":
+ viewModel.Config.ButtonR = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "ButtonPlus":
+ viewModel.Config.ButtonPlus = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "ButtonA":
+ viewModel.Config.ButtonA = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "ButtonB":
+ viewModel.Config.ButtonB = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "ButtonX":
+ viewModel.Config.ButtonX = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "ButtonY":
+ viewModel.Config.ButtonY = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "RightStickButton":
+ viewModel.Config.RightStickButton = buttonValue.AsGamepadButtonInputId();
+ break;
+ case "RightJoystick":
+ viewModel.Config.RightJoystick = buttonValue.AsGamepadStickId();
+ break;
+ }
}
};
@@ -100,82 +165,29 @@ namespace Ryujinx.Ava.UI.Views.Input
}
}
- public void SaveCurrentProfile()
- {
- ViewModel.Save();
- }
-
- private IButtonAssigner CreateButtonAssigner(bool forStick)
- {
- IButtonAssigner assigner;
-
- var device = ViewModel.Devices[ViewModel.Device];
-
- if (device.Type == DeviceType.Keyboard)
- {
- assigner = new KeyboardKeyAssigner((IKeyboard)ViewModel.SelectedGamepad);
- }
- else if (device.Type == DeviceType.Controller)
- {
- assigner = new GamepadButtonAssigner(ViewModel.SelectedGamepad, (ViewModel.Config as StandardControllerInputConfig).TriggerThreshold, forStick);
- }
- else
- {
- throw new Exception("Controller not supported");
- }
-
- return assigner;
- }
-
private void MouseClick(object sender, PointerPressedEventArgs e)
{
- bool shouldUnbind = false;
-
- if (e.GetCurrentPoint(this).Properties.IsMiddleButtonPressed)
- {
- shouldUnbind = true;
- }
+ bool shouldUnbind = e.GetCurrentPoint(this).Properties.IsMiddleButtonPressed;
_currentAssigner?.Cancel(shouldUnbind);
PointerPressed -= MouseClick;
}
- private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ private IButtonAssigner CreateButtonAssigner(bool forStick)
{
- if (ViewModel.IsModified && !_dialogOpen)
- {
- _dialogOpen = true;
-
- var result = await ContentDialogHelper.CreateConfirmationDialog(
- LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmMessage],
- LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmSubMessage],
- LocaleManager.Instance[LocaleKeys.InputDialogYes],
- LocaleManager.Instance[LocaleKeys.InputDialogNo],
- LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
-
- if (result == UserResult.Yes)
- {
- ViewModel.Save();
- }
-
- _dialogOpen = false;
+ IButtonAssigner assigner;
- ViewModel.IsModified = false;
+ assigner = new GamepadButtonAssigner((DataContext as ControllerInputViewModel).parentModel.SelectedGamepad, ((DataContext as ControllerInputViewModel).parentModel.Config as StandardControllerInputConfig).TriggerThreshold, forStick);
- if (e.AddedItems.Count > 0)
- {
- var player = (PlayerModel)e.AddedItems[0];
- ViewModel.PlayerId = player.Id;
- }
- }
+ return assigner;
}
- public void Dispose()
+ protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
{
+ base.OnDetachedFromVisualTree(e);
_currentAssigner?.Cancel();
_currentAssigner = null;
- ViewModel.Dispose();
}
}
}
diff --git a/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml
new file mode 100644
index 00000000..b4940941
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml
@@ -0,0 +1,225 @@
+<UserControl
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
+ xmlns:views="clr-namespace:Ryujinx.Ava.UI.Views.Input"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ d:DesignHeight="800"
+ d:DesignWidth="800"
+ x:Class="Ryujinx.Ava.UI.Views.Input.InputView"
+ x:DataType="viewModels:InputViewModel"
+ x:CompileBindings="True"
+ mc:Ignorable="d"
+ Focusable="True">
+ <Design.DataContext>
+ <viewModels:InputViewModel />
+ </Design.DataContext>
+ <UserControl.Styles>
+ <Style Selector="ToggleButton">
+ <Setter Property="Width" Value="90" />
+ <Setter Property="Height" Value="27" />
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
+ </Style>
+ </UserControl.Styles>
+ <StackPanel
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Orientation="Vertical">
+ <StackPanel
+ Margin="0 0 0 5"
+ Orientation="Vertical"
+ Spacing="5">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="10" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <!-- Player Selection -->
+ <Grid
+ Grid.Column="0"
+ Margin="2"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <TextBlock
+ Margin="5,0,10,0"
+ Width="90"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsPlayer}" />
+ <ComboBox
+ Grid.Column="1"
+ Name="PlayerIndexBox"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center"
+ SelectionChanged="PlayerIndexBox_OnSelectionChanged"
+ ItemsSource="{Binding PlayerIndexes}"
+ SelectedIndex="{Binding PlayerId}">
+ <ComboBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding Name}" />
+ </DataTemplate>
+ </ComboBox.ItemTemplate>
+ </ComboBox>
+ </Grid>
+ <!-- Profile Selection -->
+ <Grid
+ Grid.Column="2"
+ Margin="2"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="Auto"/>
+ </Grid.ColumnDefinitions>
+ <TextBlock
+ Margin="5,0,10,0"
+ Width="90"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsProfile}" />
+ <ui:FAComboBox
+ Grid.Column="1"
+ IsEditable="True"
+ Name="ProfileBox"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center"
+ SelectedIndex="0"
+ ItemsSource="{Binding ProfilesList}"
+ Text="{Binding ProfileName, Mode=TwoWay}" />
+ <Button
+ Grid.Column="2"
+ MinWidth="0"
+ Margin="5,0,0,0"
+ VerticalAlignment="Center"
+ ToolTip.Tip="{locale:Locale ControllerSettingsLoadProfileToolTip}"
+ Command="{Binding LoadProfile}">
+ <ui:SymbolIcon
+ Symbol="Upload"
+ FontSize="15"
+ Height="20" />
+ </Button>
+ <Button
+ Grid.Column="3"
+ MinWidth="0"
+ Margin="5,0,0,0"
+ VerticalAlignment="Center"
+ ToolTip.Tip="{locale:Locale ControllerSettingsSaveProfileToolTip}"
+ Command="{Binding SaveProfile}">
+ <ui:SymbolIcon
+ Symbol="Save"
+ FontSize="15"
+ Height="20" />
+ </Button>
+ <Button
+ Grid.Column="4"
+ MinWidth="0"
+ Margin="5,0,0,0"
+ VerticalAlignment="Center"
+ ToolTip.Tip="{locale:Locale ControllerSettingsRemoveProfileToolTip}"
+ Command="{Binding RemoveProfile}">
+ <ui:SymbolIcon
+ Symbol="Delete"
+ FontSize="15"
+ Height="20" />
+ </Button>
+ </Grid>
+ </Grid>
+ <Separator />
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="10" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <!-- Input Device -->
+ <Grid
+ Grid.Column="0"
+ Margin="2"
+ HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <TextBlock
+ Grid.Column="0"
+ Margin="5,0,10,0"
+ Width="90"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsInputDevice}" />
+ <ComboBox
+ Grid.Column="1"
+ Name="DeviceBox"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center"
+ ItemsSource="{Binding DeviceList}"
+ SelectedIndex="{Binding Device}" />
+ <Button
+ Grid.Column="2"
+ MinWidth="0"
+ Margin="5,0,0,0"
+ VerticalAlignment="Center"
+ Command="{Binding LoadDevices}">
+ <ui:SymbolIcon
+ Symbol="Refresh"
+ FontSize="15"
+ Height="20"/>
+ </Button>
+ </Grid>
+ <!-- Controller Type -->
+ <Grid
+ Grid.Column="2"
+ Margin="2"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Center">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+ <TextBlock
+ Margin="5,0,10,0"
+ Width="90"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsControllerType}" />
+ <ComboBox
+ Grid.Column="1"
+ HorizontalAlignment="Stretch"
+ ItemsSource="{Binding Controllers}"
+ SelectedIndex="{Binding Controller}">
+ <ComboBox.ItemTemplate>
+ <DataTemplate DataType="models:ControllerModel">
+ <TextBlock Text="{Binding Name}" />
+ </DataTemplate>
+ </ComboBox.ItemTemplate>
+ </ComboBox>
+ </Grid>
+ </Grid>
+ </StackPanel>
+ <ContentControl Content="{Binding ConfigViewModel}" IsVisible="{Binding ShowSettings}">
+ <ContentControl.DataTemplates>
+ <DataTemplate DataType="viewModels:ControllerInputViewModel">
+ <views:ControllerInputView />
+ </DataTemplate>
+ <DataTemplate DataType="viewModels:KeyboardInputViewModel">
+ <views:KeyboardInputView />
+ </DataTemplate>
+ </ContentControl.DataTemplates>
+ </ContentControl>
+ </StackPanel>
+</UserControl>
diff --git a/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml.cs
new file mode 100644
index 00000000..356381a8
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml.cs
@@ -0,0 +1,61 @@
+using Avalonia.Controls;
+using Ryujinx.Ava.Common.Locale;
+using Ryujinx.Ava.UI.Helpers;
+using Ryujinx.Ava.UI.Models;
+using Ryujinx.Ava.UI.ViewModels.Input;
+
+namespace Ryujinx.Ava.UI.Views.Input
+{
+ public partial class InputView : UserControl
+ {
+ private bool _dialogOpen;
+ private InputViewModel ViewModel { get; set; }
+
+ public InputView()
+ {
+ DataContext = ViewModel = new InputViewModel(this);
+
+ InitializeComponent();
+ }
+
+ public void SaveCurrentProfile()
+ {
+ ViewModel.Save();
+ }
+
+ private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (ViewModel.IsModified && !_dialogOpen)
+ {
+ _dialogOpen = true;
+
+ var result = await ContentDialogHelper.CreateConfirmationDialog(
+ LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmMessage],
+ LocaleManager.Instance[LocaleKeys.DialogControllerSettingsModifiedConfirmSubMessage],
+ LocaleManager.Instance[LocaleKeys.InputDialogYes],
+ LocaleManager.Instance[LocaleKeys.InputDialogNo],
+ LocaleManager.Instance[LocaleKeys.RyujinxConfirm]);
+
+ if (result == UserResult.Yes)
+ {
+ ViewModel.Save();
+ }
+
+ _dialogOpen = false;
+
+ ViewModel.IsModified = false;
+
+ if (e.AddedItems.Count > 0)
+ {
+ var player = (PlayerModel)e.AddedItems[0];
+ ViewModel.PlayerId = player.Id;
+ }
+ }
+ }
+
+ public void Dispose()
+ {
+ ViewModel.Dispose();
+ }
+ }
+}
diff --git a/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml
new file mode 100644
index 00000000..e4566f46
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml
@@ -0,0 +1,675 @@
+<UserControl
+ xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input"
+ xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ d:DesignHeight="800"
+ d:DesignWidth="800"
+ x:Class="Ryujinx.Ava.UI.Views.Input.KeyboardInputView"
+ x:DataType="viewModels:KeyboardInputViewModel"
+ x:CompileBindings="True"
+ mc:Ignorable="d"
+ Focusable="True">
+ <Design.DataContext>
+ <viewModels:KeyboardInputViewModel />
+ </Design.DataContext>
+ <UserControl.Resources>
+ <helpers:KeyValueConverter x:Key="Key" />
+ </UserControl.Resources>
+ <UserControl.Styles>
+ <Style Selector="ToggleButton">
+ <Setter Property="Width" Value="90" />
+ <Setter Property="Height" Value="27" />
+ <Setter Property="HorizontalAlignment" Value="Stretch" />
+ </Style>
+ </UserControl.Styles>
+ <StackPanel
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Orientation="Vertical">
+ <!-- Button / JoyStick Settings -->
+ <Grid
+ Name="SettingButtons"
+ MinHeight="450">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+ <!-- Left Controls -->
+ <StackPanel
+ Orientation="Vertical"
+ Margin="0,0,5,0"
+ Grid.Column="0">
+ <!-- Left Triggers -->
+ <Border
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ IsVisible="{Binding IsLeft}"
+ MinHeight="90"
+ CornerRadius="5">
+ <Grid
+ Margin="10"
+ HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <StackPanel
+ Grid.Column="0"
+ Grid.Row="0"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsTriggerZL}"
+ TextAlignment="Center" />
+ <ToggleButton Name="ButtonZl">
+ <TextBlock
+ Text="{Binding Config.ButtonZl, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Grid.Column="0"
+ Grid.Row="1"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsTriggerL}"
+ TextAlignment="Center" />
+ <ToggleButton Name="ButtonL">
+ <TextBlock
+ Text="{Binding Config.ButtonL, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Grid.Column="1"
+ Grid.Row="1"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonMinus}"
+ TextAlignment="Center" />
+ <ToggleButton Name="ButtonMinus">
+ <TextBlock
+ Text="{Binding Config.ButtonMinus, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </Grid>
+ </Border>
+ <!-- Left Joystick -->
+ <Border
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ IsVisible="{Binding IsLeft}"
+ Margin="0,5,0,0"
+ CornerRadius="5">
+ <StackPanel
+ Margin="10"
+ Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLStick}" />
+ <!-- Left Joystick Keyboard -->
+ <StackPanel Orientation="Vertical">
+ <!-- Left Joystick Button -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsStickButton}"
+ TextAlignment="Center" />
+ <ToggleButton Name="LeftStickButton">
+ <TextBlock
+ Text="{Binding Config.LeftStickButton, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Left Joystick Up -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsStickUp}"
+ TextAlignment="Center" />
+ <ToggleButton Name="LeftStickUp">
+ <TextBlock
+ Text="{Binding Config.LeftStickUp, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Left Joystick Down -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsStickDown}"
+ TextAlignment="Center" />
+ <ToggleButton Name="LeftStickDown">
+ <TextBlock
+ Text="{Binding Config.LeftStickDown, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Left Joystick Left -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsStickLeft}"
+ TextAlignment="Center" />
+ <ToggleButton Name="LeftStickLeft">
+ <TextBlock
+ Text="{Binding Config.LeftStickLeft, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Left Joystick Right -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsStickRight}"
+ TextAlignment="Center" />
+ <ToggleButton Name="LeftStickRight">
+ <TextBlock
+ Text="{Binding Config.LeftStickRight, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ <!-- Left DPad -->
+ <Border
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ VerticalAlignment="Top"
+ IsVisible="{Binding IsLeft}"
+ Margin="0,5,0,0"
+ CornerRadius="5">
+ <StackPanel
+ Margin="10"
+ Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsDPad}" />
+ <StackPanel Orientation="Vertical">
+ <!-- Left DPad Up -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsDPadUp}"
+ TextAlignment="Center" />
+ <ToggleButton Name="DpadUp">
+ <TextBlock
+ Text="{Binding Config.DpadUp, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Left DPad Down -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsDPadDown}"
+ TextAlignment="Center" />
+ <ToggleButton Name="DpadDown">
+ <TextBlock
+ Text="{Binding Config.DpadDown, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Left DPad Left -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsDPadLeft}"
+ TextAlignment="Center" />
+ <ToggleButton Name="DpadLeft">
+ <TextBlock
+ Text="{Binding Config.DpadLeft, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Left DPad Right -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsDPadRight}"
+ TextAlignment="Center" />
+ <ToggleButton Name="DpadRight">
+ <TextBlock
+ Text="{Binding Config.DpadRight, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ </StackPanel>
+ <!-- Triggers & Side Buttons -->
+ <StackPanel
+ Grid.Column="1"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch">
+ <!-- Controller Picture -->
+ <Image
+ Margin="0,10"
+ MaxHeight="300"
+ HorizontalAlignment="Stretch"
+ VerticalAlignment="Stretch"
+ Source="{Binding Image}" />
+ <Border
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ CornerRadius="5"
+ MinHeight="90"
+ IsVisible="{Binding HasSides}">
+ <StackPanel
+ Margin="8"
+ Orientation="Vertical">
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding IsLeft}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLeftSR}"
+ TextAlignment="Center" />
+ <ToggleButton Name="LeftButtonSr">
+ <TextBlock
+ Text="{Binding Config.LeftButtonSr, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding IsLeft}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsLeftSL}"
+ TextAlignment="Center" />
+ <ToggleButton Name="LeftButtonSl">
+ <TextBlock
+ Text="{Binding Config.LeftButtonSl, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding IsRight}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRightSR}"
+ TextAlignment="Center" />
+ <ToggleButton Name="RightButtonSr">
+ <TextBlock
+ Text="{Binding Config.RightButtonSr, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding IsRight}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRightSL}"
+ TextAlignment="Center" />
+ <ToggleButton Name="RightButtonSl">
+ <TextBlock
+ Text="{Binding Config.RightButtonSl, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ </StackPanel>
+ <!-- Right Controls -->
+ <StackPanel
+ Orientation="Vertical"
+ Margin="5,0,0,0"
+ Grid.Column="2">
+ <!-- Right Triggers -->
+ <Border
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ IsVisible="{Binding IsRight}"
+ MinHeight="90"
+ CornerRadius="5">
+ <Grid
+ Margin="10"
+ HorizontalAlignment="Stretch">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+ <StackPanel
+ Grid.Column="1"
+ Grid.Row="0"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsTriggerZR}"
+ TextAlignment="Center" />
+ <ToggleButton Name="ButtonZr">
+ <TextBlock
+ Text="{Binding Config.ButtonZr, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Grid.Column="1"
+ Grid.Row="1"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsTriggerR}"
+ TextAlignment="Center" />
+ <ToggleButton Name="ButtonR">
+ <TextBlock
+ Text="{Binding Config.ButtonR, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Grid.Column="0"
+ Grid.Row="1"
+ HorizontalAlignment="Right"
+ VerticalAlignment="Center"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonPlus}"
+ TextAlignment="Center" />
+ <ToggleButton Name="ButtonPlus">
+ <TextBlock
+ Text="{Binding Config.ButtonPlus, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </Grid>
+ </Border>
+ <!-- Right Buttons -->
+ <Border
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ IsVisible="{Binding IsRight}"
+ Margin="0,5,0,0"
+ CornerRadius="5">
+ <StackPanel
+ Margin="10"
+ Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtons}" />
+ <StackPanel
+ Orientation="Vertical">
+ <!-- Right Buttons A -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="120"
+ Margin="0,0,10,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonA}"
+ TextAlignment="Center" />
+ <ToggleButton Name="ButtonA">
+ <TextBlock
+ Text="{Binding Config.ButtonA, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Right Buttons B -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="120"
+ Margin="0,0,10,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonB}"
+ TextAlignment="Center" />
+ <ToggleButton Name="ButtonB">
+ <TextBlock
+ Text="{Binding Config.ButtonB, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Right Buttons X -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="120"
+ Margin="0,0,10,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonX}"
+ TextAlignment="Center" />
+ <ToggleButton Name="ButtonX">
+ <TextBlock
+ Text="{Binding Config.ButtonX, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Right Buttons Y -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="120"
+ Margin="0,0,10,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsButtonY}"
+ TextAlignment="Center" />
+ <ToggleButton Name="ButtonY">
+ <TextBlock
+ Text="{Binding Config.ButtonY, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ <!-- Right DPad -->
+ <Border
+ Padding="10"
+ BorderBrush="{DynamicResource ThemeControlBorderColor}"
+ BorderThickness="1"
+ CornerRadius="5"
+ IsVisible="{Binding IsRight}"
+ Margin="0,5,0,0">
+ <StackPanel Orientation="Vertical">
+ <TextBlock
+ Margin="0,0,0,10"
+ HorizontalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsRStick}" />
+ <!-- Right Joystick Keyboard -->
+ <StackPanel Orientation="Vertical">
+ <!-- Right Joystick Button -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsStickButton}"
+ TextAlignment="Center" />
+ <ToggleButton Name="RightStickButton">
+ <TextBlock
+ Text="{Binding Config.RightStickButton, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Right Joystick Up -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsStickUp}"
+ TextAlignment="Center" />
+ <ToggleButton Name="RightStickUp">
+ <TextBlock
+ Text="{Binding Config.RightStickUp, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Right Joystick Down -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsStickDown}"
+ TextAlignment="Center" />
+ <ToggleButton Name="RightStickDown">
+ <TextBlock
+ Text="{Binding Config.RightStickDown, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Right Joystick Left -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsStickLeft}"
+ TextAlignment="Center" />
+ <ToggleButton Name="RightStickLeft">
+ <TextBlock
+ Text="{Binding Config.RightStickLeft, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ <!-- Right Joystick Right -->
+ <StackPanel
+ Margin="0,0,0,4"
+ Orientation="Horizontal">
+ <TextBlock
+ Margin="0,0,10,0"
+ Width="120"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="{locale:Locale ControllerSettingsStickRight}"
+ TextAlignment="Center" />
+ <ToggleButton Name="RightStickRight">
+ <TextBlock
+ Text="{Binding Config.RightStickRight, Converter={StaticResource Key}}"
+ TextAlignment="Center" />
+ </ToggleButton>
+ </StackPanel>
+ </StackPanel>
+ </StackPanel>
+ </Border>
+ </StackPanel>
+ </Grid>
+ </StackPanel>
+</UserControl> \ No newline at end of file
diff --git a/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml.cs
new file mode 100644
index 00000000..f7024c5d
--- /dev/null
+++ b/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml.cs
@@ -0,0 +1,210 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
+using Avalonia.Input;
+using Avalonia.Interactivity;
+using Avalonia.LogicalTree;
+using Ryujinx.Ava.UI.Helpers;
+using Ryujinx.Ava.UI.ViewModels.Input;
+using Ryujinx.Input;
+using Ryujinx.Input.Assigner;
+
+namespace Ryujinx.Ava.UI.Views.Input
+{
+ public partial class KeyboardInputView : UserControl
+ {
+ private ButtonKeyAssigner _currentAssigner;
+
+ public KeyboardInputView()
+ {
+ InitializeComponent();
+
+ foreach (ILogical visual in SettingButtons.GetLogicalDescendants())
+ {
+ if (visual is ToggleButton button and not CheckBox)
+ {
+ button.IsCheckedChanged += Button_IsCheckedChanged;
+ }
+ }
+ }
+
+ protected override void OnPointerReleased(PointerReleasedEventArgs e)
+ {
+ base.OnPointerReleased(e);
+
+ if (_currentAssigner != null && _currentAssigner.ToggledButton != null && !_currentAssigner.ToggledButton.IsPointerOver)
+ {
+ _currentAssigner.Cancel();
+ }
+ }
+
+ private void Button_IsCheckedChanged(object sender, RoutedEventArgs e)
+ {
+ if (sender is ToggleButton button)
+ {
+ if ((bool)button.IsChecked)
+ {
+ if (_currentAssigner != null && button == _currentAssigner.ToggledButton)
+ {
+ return;
+ }
+
+ bool isStick = button.Tag != null && button.Tag.ToString() == "stick";
+
+ if (_currentAssigner == null && (bool)button.IsChecked)
+ {
+ _currentAssigner = new ButtonKeyAssigner(button);
+
+ this.Focus(NavigationMethod.Pointer);
+
+ PointerPressed += MouseClick;
+
+ IKeyboard keyboard = (IKeyboard)(DataContext as KeyboardInputViewModel).parentModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations.
+ IButtonAssigner assigner = CreateButtonAssigner(isStick);
+
+ _currentAssigner.ButtonAssigned += (sender, e) =>
+ {
+ if (e.ButtonValue.HasValue)
+ {
+ var viewModel = (DataContext as KeyboardInputViewModel);
+ var buttonValue = e.ButtonValue.Value;
+ viewModel.parentModel.IsModified = true;
+
+ switch (button.Name)
+ {
+ case "ButtonZl":
+ viewModel.Config.ButtonZl = buttonValue.AsKey();
+ break;
+ case "ButtonL":
+ viewModel.Config.ButtonL = buttonValue.AsKey();
+ break;
+ case "ButtonMinus":
+ viewModel.Config.ButtonMinus = buttonValue.AsKey();
+ break;
+ case "LeftStickButton":
+ viewModel.Config.LeftStickButton = buttonValue.AsKey();
+ break;
+ case "LeftStickUp":
+ viewModel.Config.LeftStickUp = buttonValue.AsKey();
+ break;
+ case "LeftStickDown":
+ viewModel.Config.LeftStickDown = buttonValue.AsKey();
+ break;
+ case "LeftStickRight":
+ viewModel.Config.LeftStickRight = buttonValue.AsKey();
+ break;
+ case "LeftStickLeft":
+ viewModel.Config.LeftStickLeft = buttonValue.AsKey();
+ break;
+ case "DpadUp":
+ viewModel.Config.DpadUp = buttonValue.AsKey();
+ break;
+ case "DpadDown":
+ viewModel.Config.DpadDown = buttonValue.AsKey();
+ break;
+ case "DpadLeft":
+ viewModel.Config.DpadLeft = buttonValue.AsKey();
+ break;
+ case "DpadRight":
+ viewModel.Config.DpadRight = buttonValue.AsKey();
+ break;
+ case "LeftButtonSr":
+ viewModel.Config.LeftButtonSr = buttonValue.AsKey();
+ break;
+ case "LeftButtonSl":
+ viewModel.Config.LeftButtonSl = buttonValue.AsKey();
+ break;
+ case "RightButtonSr":
+ viewModel.Config.RightButtonSr = buttonValue.AsKey();
+ break;
+ case "RightButtonSl":
+ viewModel.Config.RightButtonSl = buttonValue.AsKey();
+ break;
+ case "ButtonZr":
+ viewModel.Config.ButtonZr = buttonValue.AsKey();
+ break;
+ case "ButtonR":
+ viewModel.Config.ButtonR = buttonValue.AsKey();
+ break;
+ case "ButtonPlus":
+ viewModel.Config.ButtonPlus = buttonValue.AsKey();
+ break;
+ case "ButtonA":
+ viewModel.Config.ButtonA = buttonValue.AsKey();
+ break;
+ case "ButtonB":
+ viewModel.Config.ButtonB = buttonValue.AsKey();
+ break;
+ case "ButtonX":
+ viewModel.Config.ButtonX = buttonValue.AsKey();
+ break;
+ case "ButtonY":
+ viewModel.Config.ButtonY = buttonValue.AsKey();
+ break;
+ case "RightStickButton":
+ viewModel.Config.RightStickButton = buttonValue.AsKey();
+ break;
+ case "RightStickUp":
+ viewModel.Config.RightStickUp = buttonValue.AsKey();
+ break;
+ case "RightStickDown":
+ viewModel.Config.RightStickDown = buttonValue.AsKey();
+ break;
+ case "RightStickRight":
+ viewModel.Config.RightStickRight = buttonValue.AsKey();
+ break;
+ case "RightStickLeft":
+ viewModel.Config.RightStickLeft = buttonValue.AsKey();
+ break;
+ }
+ }
+ };
+
+ _currentAssigner.GetInputAndAssign(assigner, keyboard);
+ }
+ else
+ {
+ if (_currentAssigner != null)
+ {
+ ToggleButton oldButton = _currentAssigner.ToggledButton;
+
+ _currentAssigner.Cancel();
+ _currentAssigner = null;
+ button.IsChecked = false;
+ }
+ }
+ }
+ else
+ {
+ _currentAssigner?.Cancel();
+ _currentAssigner = null;
+ }
+ }
+ }
+
+ private void MouseClick(object sender, PointerPressedEventArgs e)
+ {
+ bool shouldUnbind = e.GetCurrentPoint(this).Properties.IsMiddleButtonPressed;
+
+ _currentAssigner?.Cancel(shouldUnbind);
+
+ PointerPressed -= MouseClick;
+ }
+
+ private IButtonAssigner CreateButtonAssigner(bool forStick)
+ {
+ IButtonAssigner assigner;
+
+ assigner = new KeyboardKeyAssigner((IKeyboard)(DataContext as KeyboardInputViewModel).parentModel.SelectedGamepad);
+
+ return assigner;
+ }
+
+ protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
+ {
+ base.OnDetachedFromVisualTree(e);
+ _currentAssigner?.Cancel();
+ _currentAssigner = null;
+ }
+ }
+}
diff --git a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml
index a6b587f6..0d018e29 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml
+++ b/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml
@@ -6,7 +6,7 @@
xmlns:controls="clr-namespace:Ryujinx.Ava.UI.Controls"
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
- xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input"
mc:Ignorable="d"
x:Class="Ryujinx.Ava.UI.Views.Input.MotionInputView"
x:DataType="viewModels:MotionInputViewModel"
diff --git a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs
index 1b340752..2304364b 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs
+++ b/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs
@@ -1,9 +1,7 @@
using Avalonia.Controls;
using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.UI.Models;
-using Ryujinx.Ava.UI.ViewModels;
-using Ryujinx.Common.Configuration.Hid.Controller;
+using Ryujinx.Ava.UI.ViewModels.Input;
using System.Threading.Tasks;
namespace Ryujinx.Ava.UI.Views.Input
@@ -19,7 +17,7 @@ namespace Ryujinx.Ava.UI.Views.Input
public MotionInputView(ControllerInputViewModel viewModel)
{
- var config = viewModel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
+ var config = viewModel.Config;
_viewModel = new MotionInputViewModel
{
@@ -51,7 +49,7 @@ namespace Ryujinx.Ava.UI.Views.Input
};
contentDialog.PrimaryButtonClick += (sender, args) =>
{
- var config = viewModel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
+ var config = viewModel.Config;
config.Slot = content._viewModel.Slot;
config.Sensitivity = content._viewModel.Sensitivity;
config.GyroDeadzone = content._viewModel.GyroDeadzone;
diff --git a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml
index 5b7087a4..1beb1f06 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml
+++ b/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml
@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:locale="clr-namespace:Ryujinx.Ava.Common.Locale"
- xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input"
mc:Ignorable="d"
x:Class="Ryujinx.Ava.UI.Views.Input.RumbleInputView"
x:DataType="viewModels:RumbleInputViewModel"
diff --git a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs b/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs
index 9307f872..58a4b416 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs
+++ b/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs
@@ -1,9 +1,7 @@
using Avalonia.Controls;
using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.UI.Models;
-using Ryujinx.Ava.UI.ViewModels;
-using Ryujinx.Common.Configuration.Hid.Controller;
+using Ryujinx.Ava.UI.ViewModels.Input;
using System.Threading.Tasks;
namespace Ryujinx.Ava.UI.Views.Input
@@ -19,7 +17,7 @@ namespace Ryujinx.Ava.UI.Views.Input
public RumbleInputView(ControllerInputViewModel viewModel)
{
- var config = viewModel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
+ var config = viewModel.Config;
_viewModel = new RumbleInputViewModel
{
@@ -47,7 +45,7 @@ namespace Ryujinx.Ava.UI.Views.Input
contentDialog.PrimaryButtonClick += (sender, args) =>
{
- var config = viewModel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
+ var config = viewModel.Config;
config.StrongRumble = content._viewModel.StrongRumble;
config.WeakRumble = content._viewModel.WeakRumble;
};