Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
schmaldeo committed Nov 17, 2024
2 parents 28def10 + f2c78ac commit 24a1fd5
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 29 deletions.
37 changes: 19 additions & 18 deletions DS4Windows/DS4Forms/ControllerReadingsControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,33 +213,44 @@ public sbyte RsDriftY
public ControllerReadingsControl()
{
InitializeComponent();
inputContNum.Content = $"#{deviceNum+1}";
inputContNum.Content = $"#{deviceNum + 1}";
exposeState = new DS4StateExposed(baseState);

readingTimer = new NonFormTimer();
readingTimer.Interval = 1000 / 60.0;

LsDeadXChanged += ChangeLsDeadControls;
LsDeadYChanged += ChangeLsDeadControls;
LsDeadXChanged += ChangeLsDriftControls;
LsDeadYChanged += ChangeLsDriftControls;

RsDeadXChanged += ChangeRsDeadControls;
RsDeadYChanged += ChangeRsDeadControls;

SixAxisDeadXChanged += ChangeSixAxisDeadControls;
SixAxisDeadZChanged += ChangeSixAxisDeadControls;
RsDeadXChanged += ChangeRsDriftControls;
RsDeadYChanged += ChangeRsDriftControls;

LsDriftXChanged += ChangeLsDriftControls;
LsDriftYChanged += ChangeLsDriftControls;

RsDriftXChanged += ChangeRsDriftControls;
RsDriftYChanged += ChangeRsDriftControls;

SixAxisDeadXChanged += ChangeSixAxisDeadControls;
SixAxisDeadZChanged += ChangeSixAxisDeadControls;

DeviceNumChanged += ControllerReadingsControl_DeviceNumChanged;
}

private void ControllerReadingsControl_DeviceNumChanged(object sender, EventArgs e)
{
inputContNum.Content = $"#{deviceNum+1}";
inputContNum.Content = $"#{deviceNum + 1}";
}

private void ChangeSixAxisDeadControls(object sender, EventArgs e)
{
sixAxisDeadEllipse.Width = sixAxisXDead * CANVAS_WIDTH;
sixAxisDeadEllipse.Height = sixAxisZDead * CANVAS_WIDTH;
Canvas.SetLeft(sixAxisDeadEllipse, CANVAS_MIDPOINT - (sixAxisXDead * CANVAS_WIDTH / 2.0));
Canvas.SetTop(sixAxisDeadEllipse, CANVAS_MIDPOINT - (sixAxisZDead * CANVAS_WIDTH / 2.0));
}

private void ChangeRsDriftControls(object sender, EventArgs e)
Expand All @@ -258,21 +269,12 @@ private void ChangeLsDriftControls(object sender, EventArgs e)
Canvas.SetTop(lsDriftEllipse, (1 + (LsDriftY / 127.0) - lsDeadY) * CANVAS_MIDPOINT);
}

private void ChangeSixAxisDeadControls(object sender, EventArgs e)
{
sixAxisDeadEllipse.Width = sixAxisXDead * CANVAS_WIDTH;
sixAxisDeadEllipse.Height = sixAxisZDead * CANVAS_WIDTH;
Canvas.SetLeft(sixAxisDeadEllipse, CANVAS_MIDPOINT - (sixAxisXDead * CANVAS_WIDTH / 2.0));
Canvas.SetTop(sixAxisDeadEllipse, CANVAS_MIDPOINT - (sixAxisZDead * CANVAS_WIDTH / 2.0));
}

private void ChangeRsDeadControls(object sender, EventArgs e)
{
rsDeadEllipse.Width = rsDeadX * CANVAS_WIDTH;
rsDeadEllipse.Height = rsDeadY * CANVAS_WIDTH;
Canvas.SetLeft(rsDeadEllipse, CANVAS_MIDPOINT - (rsDeadX * CANVAS_WIDTH / 2.0));
Canvas.SetTop(rsDeadEllipse, CANVAS_MIDPOINT - (rsDeadY * CANVAS_WIDTH / 2.0));
ChangeRsDriftControls(sender, e);
}

private void ChangeLsDeadControls(object sender, EventArgs e)
Expand All @@ -281,7 +283,6 @@ private void ChangeLsDeadControls(object sender, EventArgs e)
lsDeadEllipse.Height = lsDeadY * CANVAS_WIDTH;
Canvas.SetLeft(lsDeadEllipse, CANVAS_MIDPOINT - (lsDeadX * CANVAS_WIDTH / 2.0));
Canvas.SetTop(lsDeadEllipse, CANVAS_MIDPOINT - (lsDeadY * CANVAS_WIDTH / 2.0));
ChangeLsDriftControls(sender, e);
}

public void UseDevice(int index, int profileDevIdx)
Expand Down Expand Up @@ -346,8 +347,8 @@ private void ControllerReadingTimer_Elapsed(object sender, System.Timers.Elapsed
//bool mappedLS = interState.LX != x || interState.LY != y;
//if (mappedLS)
//{
Canvas.SetLeft(lsMapValRec, interState.LX / 255.0 * CANVAS_WIDTH - 3);
Canvas.SetTop(lsMapValRec, interState.LY / 255.0 * CANVAS_WIDTH - 3);
Canvas.SetLeft(lsMapValRec, interState.LX / 255.0 * CANVAS_WIDTH - 3);
Canvas.SetTop(lsMapValRec, interState.LY / 255.0 * CANVAS_WIDTH - 3);
//}

x = baseState.RX;
Expand Down
2 changes: 1 addition & 1 deletion DS4Windows/DS4Forms/ControllerRegisterOptionsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<TextBlock>
<Hyperlink NavigateUri="https://github.com/schmaldeo/DS4Windows/blob/moonlight/doc/moonlight_support.md"
RequestNavigate="Hyperlink_RequestNavigate">
About Moonlight support
About virtual controller support
</Hyperlink>
</TextBlock>
</StackPanel>
Expand Down
3 changes: 2 additions & 1 deletion DS4Windows/DS4Forms/ProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,11 @@
<TabItem x:Name="specialActionsTab" Header="Special Actions">
<DockPanel x:Name="specialActionDockPanel">
<DockPanel x:Name="baseSpeActPanel" DockPanel.Dock="Top">
<UniformGrid Rows="1" Columns="3" DockPanel.Dock="Top">
<UniformGrid Rows="1" Columns="4" DockPanel.Dock="Top">
<Button x:Name="newActionBtn" Content="{lex:Loc NewAction}" Margin="0,0,5,0" Click="NewActionBtn_Click" />
<Button x:Name="editActionBtn" Content="{lex:Loc EditAction}" IsEnabled="{Binding ItemSelected}" Margin="5,0" Click="EditActionBtn_Click" />
<Button x:Name="removeActionBtn" Content="{lex:Loc RemoveAction}" IsEnabled="{Binding ItemSelected}" Margin="5,0,0,0" Click="RemoveActionBtn_Click" />
<Button Content="{lex:Loc ExportSpecialActions}" Margin="5 0 0 0" Click="ExportSpecialActions_OnClick"/>
</UniformGrid>

<ListView x:Name="specialActionsLV" ItemsSource="{Binding ActionCol}" SelectedIndex="{Binding SpecialActionIndex}" SelectedItem="{Binding CurrentSpecialActionItem,Mode=OneWayToSource}" DockPanel.Dock="Bottom" Margin="0,10,0,0">
Expand Down
17 changes: 17 additions & 0 deletions DS4Windows/DS4Forms/ProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1782,6 +1782,23 @@ private void CalibrateStick_OnClick(object sender, RoutedEventArgs e)
};
window.ShowDialog();
}

private void ExportSpecialActions_OnClick(object sender, RoutedEventArgs e)
{
var dialog = new SaveFileDialog();
dialog.AddExtension = true;
dialog.DefaultExt = ".xml";
dialog.FileName = "Actions";
dialog.Filter = "DS4Windows Special Actions (*.xml)|*.xml";
if (dialog.ShowDialog() == DialogResult.OK)
{
var profileStream = new StreamReader(@$"{Global.appdatapath}\Actions.xml").BaseStream;
var dialogStream = dialog.OpenFile();
profileStream.CopyTo(dialogStream);
profileStream.Close();
dialogStream.Close();
}
}
}

public class ResourcePaths
Expand Down
6 changes: 3 additions & 3 deletions DS4Windows/DS4WinWPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<EnableNETAnalyzers>false</EnableNETAnalyzers>
<ServerGarbageCollection>true</ServerGarbageCollection>
<AssemblyVersion>3.9.2</AssemblyVersion>
<FileVersion>3.9.2</FileVersion>
<Version>3.9.2</Version>
<AssemblyVersion>3.9.5</AssemblyVersion>
<FileVersion>3.9.5</FileVersion>
<Version>3.9.5</Version>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<Copyright>Copyright © Scarlet.Crush Productions 2012, 2013; InhexSTER, HecticSeptic, electrobrains 2013, 2014; Jays2Kings 2013, 2014, 2015, 2016; Ryochan7 2017-2023, schmaldeo 2024</Copyright>
Expand Down
Binary file modified DS4Windows/Resources/100.ico
Binary file not shown.
11 changes: 10 additions & 1 deletion DS4Windows/Translations/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion DS4Windows/Translations/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ Please click OK to confirm that you have read the message. Press Cancel to be re
<value>Custom</value>
</data>
<data name="ControllerSupportMoonlight" xml:space="preserve">
<value>Moonlight Support</value>
<value>Virtual Controller Support</value>
</data>
<data name="AdvancedSupport" xml:space="preserve">
<value>Advanced Support</value>
Expand Down Expand Up @@ -1472,4 +1472,7 @@ Please click OK to confirm that you have read the message. Press Cancel to be re
<data name="CancelCurrentMacroTooltip" xml:space="preserve">
<value>Indicates whether running this macro should stop a currently running one</value>
</data>
<data name="ExportSpecialActions" xml:space="preserve">
<value>Export actions</value>
</data>
</root>
2 changes: 1 addition & 1 deletion DS4Windows/newest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.2
3.9.4
6 changes: 3 additions & 3 deletions doc/moonlight_support.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Moonlight virtual controller support

Moonlight virtual controller is supported from version 3.7.0 up.
You can enable it in `Settings -> Device Options -> Moonlight Support`.
ViGEm-based virtual controllers are supported from version 3.7.0 up.
You can enable it in `Settings -> Device Options -> Virtual Controller Support`.

## Support modes

Expand All @@ -10,7 +10,7 @@ Not selecting `Advanced Support` means you're using the simple implementation of
which should be sufficient for most users.

#### Technicalities
When a new controller is detected, its checked for being virtual. Normally, if it's detected that it's a virtual device,
When a new controller is detected, it's checked for being virtual. Normally, if it's detected that it's a virtual device,
it simply wouldn't be added to the controllers list. However, this behaviour makes the detection of the Moonlight virtual controller impossible.
To counteract this, this support mode makes all devices with a matching Vendor and Product ID skip the check.

Expand Down

0 comments on commit 24a1fd5

Please sign in to comment.