Skip to content

Commit

Permalink
Fix issue #22 #30 part 5 #33 (In windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
vertigra committed Sep 30, 2023
1 parent 19d0192 commit 02253ce
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
19 changes: 17 additions & 2 deletions Configs/buttons.binding.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,27 @@
"axis": "left_stick_y"
},
{
"action": "head_left_right",
"action": "none",
"axis": "right_stick_x"
},
{
"action": "neck_up_down",
"action": "none",
"axis": "right_stick_y"
}
],

/* possible sticks buttons values:
left_stick_button
right_stick_button
*/
"sticks_buttons": [
{
"action": "head_left_right",
"button": "left_stick_button"
},
{
"action": "neck_up_down",
"button": "right_stick_button"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using XpadControl.Interfaces;
using XpadControl.Interfaces.BindingButtonsService.Dependencies;
using XpadControl.Interfaces.BindingButtonsService.Dependencies.EventArgs;
using XpadControl.Interfaces.BindingButtonsService.Dependencies.JsonModel;
using XpadControl.Interfaces.GamepadService.Dependencies.EventArgs;
using XpadControl.Interfaces.GamepadService.Dependencies.EventArgs.PropertyChangedArgs;


namespace XpadControl.Common.Services.BindingButtonsService
{
public class BindingButtonsService : IBindingButtonsService
Expand All @@ -19,9 +21,15 @@ public class BindingButtonsService : IBindingButtonsService

public BindingButtonsService(ILoggerService loggerService, IGamepadService gamepadService, string jsonConfigPath)
{
var gamepadActionBinding = jsonConfigPath.ToGamepadAction();
GamepadActionBinding gamepadActionBinding = jsonConfigPath.ToGamepadAction();

List<ButtonActionBinding> buttonBindings = gamepadActionBinding.ButtonsAction;
buttonBindings.AddRange(gamepadActionBinding.SticksButtonsAction);
buttonBindings.AddRange(gamepadActionBinding.ButtonsBumper);
buttonBindings.AddRange(gamepadActionBinding.ButtonsDpad);
buttonBindings.AddRange(gamepadActionBinding.ButtonsOption);

mButtonBindings = gamepadActionBinding.ButtonsAction;
mButtonBindings = buttonBindings;
mSticksActions = gamepadActionBinding.SticksAction;
mTriggerAction = gamepadActionBinding.TriggerAction;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public enum ConfigButtons
[EnumMember(Value = "button_back")]
Back = 0x20,

// The LS (Left Stick) button.
[EnumMember(Value = "left_stick_button")]
LS = 0x40,

// The RS (Right Stick) button.
[EnumMember(Value = "right_stick_button")]
RS = 0x80,

[EnumMember(Value = "left_bamper")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class GamepadActionBinding
[JsonPropertyName("sticks")]
public List<SticksActionBinding> SticksAction { get; set; }

[JsonPropertyName("sticks_buttons")]
public List<ButtonActionBinding> SticksButtonsAction { get; set; }

[JsonPropertyName("triggers")]
public List<TriggerActionBinding> TriggerAction { get; set; }
}
Expand Down
3 changes: 3 additions & 0 deletions XpadControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<ItemGroup>
<Compile Remove="Properties\**" />
<Compile Remove="Visual Studio 2022\**" />
<Compile Remove="XpadControl.Common.Services\**" />
<Compile Remove="XpadControl.Interfaces\**" />
<Compile Remove="XpadControl.Linux.Services.Test\**" />
Expand All @@ -22,6 +23,7 @@
<Compile Remove="XpadControl.Windows.Services.Test\**" />
<Compile Remove="XpadControl.Windows.Services\**" />
<EmbeddedResource Remove="Properties\**" />
<EmbeddedResource Remove="Visual Studio 2022\**" />
<EmbeddedResource Remove="XpadControl.Common.Services\**" />
<EmbeddedResource Remove="XpadControl.Interfaces\**" />
<EmbeddedResource Remove="XpadControl.Linux.Services.Test\**" />
Expand All @@ -32,6 +34,7 @@
<EmbeddedResource Remove="XpadControl.Windows.Services.Test\**" />
<EmbeddedResource Remove="XpadControl.Windows.Services\**" />
<None Remove="Properties\**" />
<None Remove="Visual Studio 2022\**" />
<None Remove="XpadControl.Common.Services\**" />
<None Remove="XpadControl.Interfaces\**" />
<None Remove="XpadControl.Linux.Services.Test\**" />
Expand Down

0 comments on commit 02253ce

Please sign in to comment.