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, 576 insertions, 1391 deletions
diff --git a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml
index 08bdf90f..d636873a 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml
+++ b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml
@@ -1,11 +1,13 @@
<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:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels.Input"
+ xmlns:models="clr-namespace:Ryujinx.Ava.UI.Models"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
xmlns:helpers="clr-namespace:Ryujinx.Ava.UI.Helpers"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
@@ -13,7 +15,6 @@
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>
@@ -33,10 +34,191 @@
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">
+ MinHeight="450"
+ IsVisible="{Binding ShowSettings}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
@@ -75,9 +257,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsTriggerZL}"
TextAlignment="Center" />
- <ToggleButton Name="ButtonZl">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.ButtonZl, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.ButtonZl, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -91,9 +273,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsTriggerL}"
TextAlignment="Center" />
- <ToggleButton Name="ButtonL">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.ButtonL, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.ButtonL, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -107,9 +289,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonMinus}"
TextAlignment="Center" />
- <ToggleButton Name="ButtonMinus">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.ButtonMinus, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.ButtonMinus, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -129,8 +311,100 @@
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 Orientation="Vertical">
+ <StackPanel
+ IsVisible="{Binding IsController}"
+ Orientation="Vertical">
<!-- Left Joystick Button -->
<StackPanel
Orientation="Horizontal">
@@ -141,9 +415,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsStickButton}"
TextAlignment="Center" />
- <ToggleButton Name="LeftStickButton">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.LeftStickButton, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.LeftControllerStickButton, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -158,22 +432,22 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsStickStick}"
TextAlignment="Center" />
- <ToggleButton Name="LeftJoystick" Tag="stick">
+ <ToggleButton Tag="stick">
<TextBlock
- Text="{Binding Config.LeftJoystick, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.LeftJoystick, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
<Separator
Margin="0,8,0,8"
Height="1" />
- <CheckBox IsChecked="{Binding Config.LeftInvertStickX}">
+ <CheckBox IsChecked="{ReflectionBinding Configuration.LeftInvertStickX}">
<TextBlock Text="{locale:Locale ControllerSettingsStickInvertXAxis}" />
</CheckBox>
- <CheckBox IsChecked="{Binding Config.LeftInvertStickY}">
+ <CheckBox IsChecked="{ReflectionBinding Configuration.LeftInvertStickY}">
<TextBlock Text="{locale:Locale ControllerSettingsStickInvertYAxis}" />
</CheckBox>
- <CheckBox IsChecked="{Binding Config.LeftRotate90}">
+ <CheckBox IsChecked="{ReflectionBinding Configuration.LeftRotate90}">
<TextBlock Text="{locale:Locale ControllerSettingsRotate90}" />
</CheckBox>
<Separator
@@ -194,11 +468,11 @@
IsSnapToTickEnabled="True"
SmallChange="0.01"
Minimum="0"
- Value="{Binding Config.DeadzoneLeft, Mode=TwoWay}" />
+ Value="{ReflectionBinding Configuration.DeadzoneLeft, Mode=TwoWay}" />
<TextBlock
VerticalAlignment="Center"
Width="25"
- Text="{Binding Config.DeadzoneLeft, StringFormat=\{0:0.00\}}" />
+ Text="{ReflectionBinding Configuration.DeadzoneLeft, StringFormat=\{0:0.00\}}" />
</StackPanel>
<TextBlock
HorizontalAlignment="Center"
@@ -214,11 +488,11 @@
IsSnapToTickEnabled="True"
SmallChange="0.01"
Minimum="0"
- Value="{Binding Config.RangeLeft, Mode=TwoWay}" />
+ Value="{ReflectionBinding Configuration.RangeLeft, Mode=TwoWay}" />
<TextBlock
VerticalAlignment="Center"
Width="25"
- Text="{Binding Config.RangeLeft, StringFormat=\{0:0.00\}}" />
+ Text="{ReflectionBinding Configuration.RangeLeft, StringFormat=\{0:0.00\}}" />
</StackPanel>
</StackPanel>
</StackPanel>
@@ -251,9 +525,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsDPadUp}"
TextAlignment="Center" />
- <ToggleButton Name="DpadUp">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.DpadUp, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.DpadUp, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -268,9 +542,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsDPadDown}"
TextAlignment="Center" />
- <ToggleButton Name="DpadDown">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.DpadDown, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.DpadDown, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -285,9 +559,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsDPadLeft}"
TextAlignment="Center" />
- <ToggleButton Name="DpadLeft">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.DpadLeft, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.DpadLeft, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -302,9 +576,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsDPadRight}"
TextAlignment="Center" />
- <ToggleButton Name="DpadRight">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.DpadRight, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.DpadRight, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -317,13 +591,6 @@
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"
@@ -345,89 +612,92 @@
IsSnapToTickEnabled="True"
SmallChange="0.01"
Minimum="0"
- Value="{Binding Config.TriggerThreshold, Mode=TwoWay}" />
+ Value="{ReflectionBinding Configuration.TriggerThreshold, Mode=TwoWay}" />
<TextBlock
Width="25"
- Text="{Binding Config.TriggerThreshold, StringFormat=\{0:0.00\}}" />
+ Text="{ReflectionBinding Configuration.TriggerThreshold, StringFormat=\{0:0.00\}}" />
</StackPanel>
<StackPanel
- Orientation="Vertical"
- IsVisible="{Binding HasSides}">
- <StackPanel
- Margin="0,4,0,0"
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding !IsRight}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
- IsVisible="{Binding IsLeft}"
- Orientation="Horizontal">
+ Text="{locale:Locale ControllerSettingsLeftSR}"
+ TextAlignment="Center" />
+ <ToggleButton>
<TextBlock
- Width="20"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsLeftSR}"
+ Text="{ReflectionBinding Configuration.LeftButtonSr, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
- <ToggleButton Name="LeftButtonSr">
- <TextBlock
- Text="{Binding Config.LeftButtonSr, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <StackPanel
- Margin="0,4,0,0"
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding !IsRight}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
- IsVisible="{Binding IsLeft}"
- Orientation="Horizontal">
+ Text="{locale:Locale ControllerSettingsLeftSL}"
+ TextAlignment="Center" />
+ <ToggleButton>
<TextBlock
- Width="20"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsLeftSL}"
+ Text="{ReflectionBinding Configuration.LeftButtonSl, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
- <ToggleButton Name="LeftButtonSl">
- <TextBlock
- Text="{Binding Config.LeftButtonSl, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <StackPanel
- Margin="0,4,0,0"
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding !IsLeft}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
- IsVisible="{Binding IsRight}"
- Orientation="Horizontal">
+ Text="{locale:Locale ControllerSettingsRightSR}"
+ TextAlignment="Center" />
+ <ToggleButton>
<TextBlock
- Width="20"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsRightSR}"
+ Text="{ReflectionBinding Configuration.RightButtonSr, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
- <ToggleButton Name="RightButtonSr">
- <TextBlock
- Text="{Binding Config.RightButtonSr, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
- <StackPanel
- Margin="0,4,0,0"
+ </ToggleButton>
+ </StackPanel>
+ <StackPanel
+ Margin="0,4,0,0"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ IsVisible="{Binding !IsLeft}"
+ Orientation="Horizontal">
+ <TextBlock
+ Width="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
- IsVisible="{Binding IsRight}"
- Orientation="Horizontal">
+ Text="{locale:Locale ControllerSettingsRightSL}"
+ TextAlignment="Center" />
+ <ToggleButton>
<TextBlock
- Width="20"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{locale:Locale ControllerSettingsRightSL}"
+ Text="{ReflectionBinding Configuration.RightButtonSl, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
- <ToggleButton Name="RightButtonSl">
- <TextBlock
- Text="{Binding Config.RightButtonSl, Converter={StaticResource Key}}"
- TextAlignment="Center" />
- </ToggleButton>
- </StackPanel>
+ </ToggleButton>
</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"
@@ -439,7 +709,8 @@
BorderThickness="1"
CornerRadius="5"
VerticalAlignment="Bottom"
- HorizontalAlignment="Stretch">
+ HorizontalAlignment="Stretch"
+ IsVisible="{Binding IsController}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
@@ -449,7 +720,7 @@
Margin="10"
MinWidth="0"
Grid.Column="0"
- IsChecked="{Binding Config.EnableMotion, Mode=TwoWay}">
+ IsChecked="{ReflectionBinding Configuration.EnableMotion, Mode=TwoWay}">
<TextBlock Text="{locale:Locale ControllerSettingsMotion}" />
</CheckBox>
<Button
@@ -465,6 +736,7 @@
BorderThickness="1"
CornerRadius="5"
HorizontalAlignment="Stretch"
+ IsVisible="{Binding IsController}"
Margin="0,-1,0,0">
<Grid>
<Grid.ColumnDefinitions>
@@ -475,7 +747,7 @@
Margin="10"
MinWidth="0"
Grid.Column="0"
- IsChecked="{Binding Config.EnableRumble, Mode=TwoWay}">
+ IsChecked="{ReflectionBinding Configuration.EnableRumble, Mode=TwoWay}">
<TextBlock Text="{locale:Locale ControllerSettingsRumble}" />
</CheckBox>
<Button
@@ -521,9 +793,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsTriggerZR}"
TextAlignment="Center" />
- <ToggleButton Name="ButtonZr">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.ButtonZr, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.ButtonZr, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -539,9 +811,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsTriggerR}"
TextAlignment="Center" />
- <ToggleButton Name="ButtonR">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.ButtonR, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.ButtonR, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -557,15 +829,15 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonPlus}"
TextAlignment="Center" />
- <ToggleButton Name="ButtonPlus">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.ButtonPlus, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.ButtonPlus, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
</Grid>
</Border>
- <!-- Right Buttons -->
+ <!-- Right Joystick -->
<Border
BorderBrush="{DynamicResource ThemeControlBorderColor}"
BorderThickness="1"
@@ -592,9 +864,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonA}"
TextAlignment="Center" />
- <ToggleButton Name="ButtonA">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.ButtonA, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.ButtonA, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -609,9 +881,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonB}"
TextAlignment="Center" />
- <ToggleButton Name="ButtonB">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.ButtonB, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.ButtonB, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -626,9 +898,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonX}"
TextAlignment="Center" />
- <ToggleButton Name="ButtonX">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.ButtonX, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.ButtonX, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -643,9 +915,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsButtonY}"
TextAlignment="Center" />
- <ToggleButton Name="ButtonY">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.ButtonY, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.ButtonY, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -665,8 +937,100 @@
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 Orientation="Vertical">
+ <StackPanel
+ IsVisible="{Binding IsController}"
+ Orientation="Vertical">
<!-- Right Joystick Button -->
<StackPanel
Orientation="Horizontal">
@@ -677,9 +1041,9 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsStickButton}"
TextAlignment="Center" />
- <ToggleButton Name="RightStickButton">
+ <ToggleButton>
<TextBlock
- Text="{Binding Config.RightStickButton, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.RightControllerStickButton, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
@@ -695,20 +1059,20 @@
VerticalAlignment="Center"
Text="{locale:Locale ControllerSettingsStickStick}"
TextAlignment="Center" />
- <ToggleButton Name="RightJoystick" Tag="stick">
+ <ToggleButton Tag="stick">
<TextBlock
- Text="{Binding Config.RightJoystick, Converter={StaticResource Key}}"
+ Text="{ReflectionBinding Configuration.RightJoystick, Mode=TwoWay, Converter={StaticResource Key}}"
TextAlignment="Center" />
</ToggleButton>
</StackPanel>
<Separator Margin="0,8,0,8" Height="1" />
- <CheckBox IsChecked="{Binding Config.RightInvertStickX}">
+ <CheckBox IsChecked="{ReflectionBinding Configuration.RightInvertStickX}">
<TextBlock Text="{locale:Locale ControllerSettingsStickInvertXAxis}" />
</CheckBox>
- <CheckBox IsChecked="{Binding Config.RightInvertStickY}">
+ <CheckBox IsChecked="{ReflectionBinding Configuration.RightInvertStickY}">
<TextBlock Text="{locale:Locale ControllerSettingsStickInvertYAxis}" />
</CheckBox>
- <CheckBox IsChecked="{Binding Config.RightRotate90}">
+ <CheckBox IsChecked="{ReflectionBinding Configuration.RightRotate90}">
<TextBlock Text="{locale:Locale ControllerSettingsRotate90}" />
</CheckBox>
<Separator Margin="0,8,0,8" Height="1" />
@@ -729,11 +1093,11 @@
Padding="0"
VerticalAlignment="Center"
Minimum="0"
- Value="{Binding Config.DeadzoneRight, Mode=TwoWay}" />
+ Value="{ReflectionBinding Configuration.DeadzoneRight, Mode=TwoWay}" />
<TextBlock
VerticalAlignment="Center"
Width="25"
- Text="{Binding Config.DeadzoneRight, StringFormat=\{0:0.00\}}" />
+ Text="{ReflectionBinding Configuration.DeadzoneRight, StringFormat=\{0:0.00\}}" />
</StackPanel>
<TextBlock
HorizontalAlignment="Center"
@@ -749,11 +1113,11 @@
IsSnapToTickEnabled="True"
SmallChange="0.01"
Minimum="0"
- Value="{Binding Config.RangeRight, Mode=TwoWay}" />
+ Value="{ReflectionBinding Configuration.RangeRight, Mode=TwoWay}" />
<TextBlock
VerticalAlignment="Center"
Width="25"
- Text="{Binding Config.RangeRight, StringFormat=\{0:0.00\}}" />
+ Text="{ReflectionBinding Configuration.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 52fc6238..35129706 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs
+++ b/src/Ryujinx.Ava/UI/Views/Input/ControllerInputView.axaml.cs
@@ -1,28 +1,35 @@
-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.ViewModels.Input;
+using Ryujinx.Ava.UI.Models;
+using Ryujinx.Ava.UI.ViewModels;
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 and not CheckBox)
+ if (visual is ToggleButton button && visual is not CheckBox)
{
button.IsCheckedChanged += Button_IsCheckedChanged;
}
@@ -52,7 +59,7 @@ namespace Ryujinx.Ava.UI.Views.Input
bool isStick = button.Tag != null && button.Tag.ToString() == "stick";
- if (_currentAssigner == null && (bool)button.IsChecked)
+ if (_currentAssigner == null)
{
_currentAssigner = new ButtonKeyAssigner(button);
@@ -60,86 +67,14 @@ namespace Ryujinx.Ava.UI.Views.Input
PointerPressed += MouseClick;
- IKeyboard keyboard = (IKeyboard)(DataContext as ControllerInputViewModel).parentModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations.
+ IKeyboard keyboard = (IKeyboard)ViewModel.AvaloniaKeyboardDriver.GetGamepad("0"); // Open Avalonia keyboard for cancel operations.
IButtonAssigner assigner = CreateButtonAssigner(isStick);
_currentAssigner.ButtonAssigned += (sender, e) =>
{
- if (e.ButtonValue.HasValue)
+ if (e.IsAssigned)
{
- 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;
- }
+ ViewModel.IsModified = true;
}
};
@@ -165,29 +100,82 @@ 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 = e.GetCurrentPoint(this).Properties.IsMiddleButtonPressed;
+ bool shouldUnbind = false;
+
+ if (e.GetCurrentPoint(this).Properties.IsMiddleButtonPressed)
+ {
+ shouldUnbind = true;
+ }
_currentAssigner?.Cancel(shouldUnbind);
PointerPressed -= MouseClick;
}
- private IButtonAssigner CreateButtonAssigner(bool forStick)
+ private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
- IButtonAssigner assigner;
+ if (ViewModel.IsModified && !_dialogOpen)
+ {
+ _dialogOpen = true;
- assigner = new GamepadButtonAssigner((DataContext as ControllerInputViewModel).parentModel.SelectedGamepad, ((DataContext as ControllerInputViewModel).parentModel.Config as StandardControllerInputConfig).TriggerThreshold, forStick);
+ 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]);
- return assigner;
+ 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;
+ }
+ }
}
- protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
+ public void Dispose()
{
- 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
deleted file mode 100644
index b4940941..00000000
--- a/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml
+++ /dev/null
@@ -1,225 +0,0 @@
-<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
deleted file mode 100644
index 356381a8..00000000
--- a/src/Ryujinx.Ava/UI/Views/Input/InputView.axaml.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-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
deleted file mode 100644
index e4566f46..00000000
--- a/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml
+++ /dev/null
@@ -1,675 +0,0 @@
-<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
deleted file mode 100644
index f7024c5d..00000000
--- a/src/Ryujinx.Ava/UI/Views/Input/KeyboardInputView.axaml.cs
+++ /dev/null
@@ -1,210 +0,0 @@
-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 0d018e29..a6b587f6 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.Input"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
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 2304364b..1b340752 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs
+++ b/src/Ryujinx.Ava/UI/Views/Input/MotionInputView.axaml.cs
@@ -1,7 +1,9 @@
using Avalonia.Controls;
using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.UI.ViewModels.Input;
+using Ryujinx.Ava.UI.Models;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.Common.Configuration.Hid.Controller;
using System.Threading.Tasks;
namespace Ryujinx.Ava.UI.Views.Input
@@ -17,7 +19,7 @@ namespace Ryujinx.Ava.UI.Views.Input
public MotionInputView(ControllerInputViewModel viewModel)
{
- var config = viewModel.Config;
+ var config = viewModel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
_viewModel = new MotionInputViewModel
{
@@ -49,7 +51,7 @@ namespace Ryujinx.Ava.UI.Views.Input
};
contentDialog.PrimaryButtonClick += (sender, args) =>
{
- var config = viewModel.Config;
+ var config = viewModel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
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 1beb1f06..5b7087a4 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.Input"
+ xmlns:viewModels="clr-namespace:Ryujinx.Ava.UI.ViewModels"
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 58a4b416..9307f872 100644
--- a/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs
+++ b/src/Ryujinx.Ava/UI/Views/Input/RumbleInputView.axaml.cs
@@ -1,7 +1,9 @@
using Avalonia.Controls;
using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Ava.UI.ViewModels.Input;
+using Ryujinx.Ava.UI.Models;
+using Ryujinx.Ava.UI.ViewModels;
+using Ryujinx.Common.Configuration.Hid.Controller;
using System.Threading.Tasks;
namespace Ryujinx.Ava.UI.Views.Input
@@ -17,7 +19,7 @@ namespace Ryujinx.Ava.UI.Views.Input
public RumbleInputView(ControllerInputViewModel viewModel)
{
- var config = viewModel.Config;
+ var config = viewModel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
_viewModel = new RumbleInputViewModel
{
@@ -45,7 +47,7 @@ namespace Ryujinx.Ava.UI.Views.Input
contentDialog.PrimaryButtonClick += (sender, args) =>
{
- var config = viewModel.Config;
+ var config = viewModel.Configuration as InputConfiguration<GamepadInputId, StickInputId>;
config.StrongRumble = content._viewModel.StrongRumble;
config.WeakRumble = content._viewModel.WeakRumble;
};