Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions DS4Windows/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

<converters:ShellViewportWidthConverter x:Key="ShellViewportWidth" />

<!-- Live-updatable layout direction, set from code (App.xaml.cs -> SetUICulture) based on the selected language -->
<FlowDirection x:Key="AppFlowDirection">LeftToRight</FlowDirection>

<Style TargetType="{x:Type Button}" x:Key="NoBGHoverBtn">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
Expand Down
26 changes: 25 additions & 1 deletion DS4Windows/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ private void Application_Startup(object sender, StartupEventArgs e)

private void ApplicationStartupCore(object sender, StartupEventArgs e)
{
// Flip only each window's *content* to match the selected culture's reading direction,
// never the Window object itself -- setting FlowDirection on the Window would also mirror
// the native window chrome (min/max/close button side) and any image/icon inside, which we
// don't want. The actual direction value is kept in the "AppFlowDirection" resource and
// updated from SetUICulture whenever the language changes.
EventManager.RegisterClassHandler(typeof(Window), FrameworkElement.LoadedEvent,
new RoutedEventHandler(SyncWindowContentFlowDirection));

runShutdown = true;
skipSave = true;

Expand Down Expand Up @@ -1123,6 +1131,15 @@ public void WriteIPCResultDataMMF(string dataStr)
}
}

private void SyncWindowContentFlowDirection(object sender, RoutedEventArgs e)
{
if (sender is Window window && window.Content is FrameworkElement rootContent &&
Application.Current.Resources["AppFlowDirection"] is FlowDirection dir)
{
rootContent.FlowDirection = dir;
}
}

private void SetUICulture(string culture)
{
try
Expand All @@ -1134,9 +1151,16 @@ private void SetUICulture(string culture)
// fixes the culture in threads
CultureInfo.DefaultThreadCurrentCulture = ci;
CultureInfo.DefaultThreadCurrentUICulture = ci;
//DS4WinWPF.Properties.Resources.Culture = ci;
DS4WinWPF.Properties.Resources.Culture = ci;
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;

// Match content layout direction to the selected culture (RTL for fa/ar/he, etc.).
// Stored as a resource that SyncWindowContentFlowDirection reads whenever a window
// loads, and applied only to each window's Content -- never the Window object itself,
// so native window chrome (min/max/close button side) and images stay unaffected.
Application.Current.Resources["AppFlowDirection"] =
ci.TextInfo.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
}
catch (CultureNotFoundException) { /* Skip setting culture that we cannot set */ }
}
Expand Down
67 changes: 19 additions & 48 deletions DS4Windows/DS4Forms/About.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,13 @@
Title="{lex:LocExtension HotkeysAbout}" Height="450" Width="800"
Style="{DynamicResource WindowStyle}">
<DockPanel>
<Label x:Name="headerLb" Content="DS4Windows - hbashton Build (Version " DockPanel.Dock="Top" HorizontalAlignment="Center" />
<Label x:Name="headerLb" Content="{lex:Loc About.HeaderLabel}" DockPanel.Dock="Top" HorizontalAlignment="Center" />

<TabControl>
<TabItem Header="Hotkeys">
<TextBlock TextWrapping="Wrap" xml:space="preserve">Use HidHide to Prevent Double Input: Hides the physical controller from games while DS4Windows continues using it, preventing duplicate inputs
Click left side of touchpad: Left Touch
Click right side of touchpad: Right Touch
Click touchpad with 2 fingers: Multitouch
Click upper part of touchpad: Upper Touch
PS + Options or hold PS for 10 secs: Disconnect Controller (Only on Bluetooth)
Touch Touchpad + PS: Turn off touchpad movement (clicking still works)
Pad click on lower right: Right click (Best used when right side is used as a mouse button)
Two fingers up/down on touchpad*: Scroll Up/Down
Tap then hold touchpad*: Left mouse drag
2 finger touchpad swipe left or right: Cycle through profiles
Shift Modifer: Hold an action to use another set of controls
When mapping keyboard and mouse:
Toggle: The key will remain in a "held down" state until pressed again
Macro: Assign multiple keys to one input
Scan Code: Keys are interpreted differently. May be needed for certain games
*If enabled</TextBlock>
<TabItem Header="{lex:Loc About.TabHotkeys}">
<TextBlock TextWrapping="Wrap" Text="{lex:Loc About.HotkeysText}" />
</TabItem>
<TabItem Header="License">
<TabItem Header="{lex:Loc About.TabLicense}">
<TextBox TextWrapping="Wrap" xml:space="preserve" IsReadOnly="True" VerticalScrollBarVisibility="Visible">GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Expand Down Expand Up @@ -708,12 +692,12 @@ Public License instead of this License. But first, please read
&lt;https://www.gnu.org/licenses/why-not-lgpl.html&gt;.
</TextBox>
</TabItem>
<TabItem Header="Credits">
<TabItem Header="{lex:Loc About.TabCredits}">
<DockPanel>
<StackPanel DockPanel.Dock="Top" Margin="10,0">
<StackPanel Orientation="Horizontal">
<!-- <TextBlock><Hyperlink x:Name="siteLink" Click="SiteLink_Click" Foreground="{DynamicResource AccentColor}">Site</Hyperlink></TextBlock> -->
<TextBlock Margin="20,0,0,0"><Hyperlink x:Name="sourceLink" Click="SourceLink_Click" Foreground="{DynamicResource AccentColor}">Source</Hyperlink></TextBlock>
<TextBlock Margin="20,0,0,0"><Hyperlink x:Name="sourceLink" Click="SourceLink_Click" Foreground="{DynamicResource AccentColor}"><Run Text="{lex:Loc About.SourceLink}"/></Hyperlink></TextBlock>
<TextBlock Margin="20,0,0,0"><Hyperlink Click="Ryochan7Link_Click" Foreground="{DynamicResource AccentColor}">Ryochan7</Hyperlink></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal">
Expand All @@ -724,9 +708,9 @@ Public License instead of this License. But first, please read
<TextBlock><Hyperlink x:Name="electrobrainsLink" Click="ElectrobrainsLink_Click" Foreground="{DynamicResource AccentColor}">electrobrains (Branched off of)</Hyperlink></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock><Hyperlink Click="ContributorsLink_OnClick" Foreground="{DynamicResource AccentColor}">Contributors</Hyperlink></TextBlock>
<TextBlock><Hyperlink Click="ContributorsLink_OnClick" Foreground="{DynamicResource AccentColor}"><Run Text="{lex:Loc About.ContributorsLink}"/></Hyperlink></TextBlock>
</StackPanel>
<Label Content="Translators:" Margin="0,20,0,0" />
<Label Content="{lex:Loc About.Translators}" Margin="0,20,0,0" />
</StackPanel>
<TextBox TextWrapping="Wrap" xml:space="preserve" IsReadOnly="True"
DockPanel.Dock="Bottom" VerticalScrollBarVisibility="Auto" Margin="10,0,10,10">xLive - Arabic
Expand All @@ -747,26 +731,21 @@ dondrakon - Ukranian
</TextBox>
</DockPanel>
</TabItem>
<TabItem Header="Extras">
<TabItem Header="{lex:Loc About.TabExtras}">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="4">
<Border BorderThickness="1" CornerRadius="10" BorderBrush="{DynamicResource BorderColor}">
<StackPanel Margin="8">
<TextBlock Text="HidHide" FontSize="18" FontWeight="Bold" />
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<TextBlock Text="Project URL:" />
<TextBlock Text="{lex:Loc About.ProjectUrl}" />
<TextBlock Margin="8,0,0,0">
<Hyperlink x:Name="hidHideLink" Click="HidHideLink_Click" Foreground="{DynamicResource AccentColor}">https://github.com/nefarius/HidHide/</Hyperlink>
</TextBlock>
</StackPanel>
<Expander Header="Description" Margin="0,8,0,0">
<Expander Header="{lex:Loc About.Description}" Margin="0,8,0,0">
<Expander.Content>
<TextBlock TextWrapping="Wrap">
<TextBlock.Text>
Use HidHide to configure and hide any input controllers from other apps running on your system.
Some games require only one controller to be present or double input will cause problems in game. Written by nefarius.
</TextBlock.Text>
</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{lex:Loc About.HidHideDesc}" />
</Expander.Content>
</Expander>
</StackPanel>
Expand All @@ -776,22 +755,14 @@ dondrakon - Ukranian
<StackPanel Margin="8">
<TextBlock Text="FakerInput" FontSize="18" FontWeight="Bold" />
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<TextBlock Text="Project URL:" />
<TextBlock Text="{lex:Loc About.ProjectUrl}" />
<TextBlock Margin="8,0,0,0">
<Hyperlink x:Name="fakerInputLink" Click="FakerInputLink_Click" Foreground="{DynamicResource AccentColor}">https://github.com/Ryochan7/FakerInput/</Hyperlink>
</TextBlock>
</StackPanel>
<Expander Header="Description" Margin="0,8,0,0">
<Expander Header="{lex:Loc About.Description}" Margin="0,8,0,0">
<Expander.Content>
<TextBlock TextWrapping="Wrap">
<TextBlock.Text>
Use FakerInput driver to expose system-wide virtual keyboard, relative mouse, and absolute mouse.
Allows virtual KB+M events to be usable in some situations when SendInput fails.
Such situations are elevated process and games, UAC prompts, and anti-cheat systems that block SendInput events.
Use of FakerInput is necessary to allow DS4Windows to work with some games with anti-cheat protection
like Valorant.
</TextBlock.Text>
</TextBlock>
<TextBlock TextWrapping="Wrap" Text="{lex:Loc About.FakerInputDesc}" />
</Expander.Content>
</Expander>
</StackPanel>
Expand All @@ -801,7 +772,7 @@ dondrakon - Ukranian
<StackPanel Margin="8">
<TextBlock Text="CRC32" FontSize="18" FontWeight="Bold" />
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<TextBlock Text="Project URL:" />
<TextBlock Text="{lex:Loc About.ProjectUrl}" />
<TextBlock Margin="8,0,0,0">
<Hyperlink x:Name="crc32Link" Click="Crc32Link_Click" Foreground="{DynamicResource AccentColor}">https://github.com/dariogriffo/Crc32</Hyperlink>
</TextBlock>
Expand All @@ -813,7 +784,7 @@ dondrakon - Ukranian
<StackPanel Margin="8">
<TextBlock Text="1&#x20ac; Filter" FontSize="18" FontWeight="Bold" />
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<TextBlock Text="Project URL:" />
<TextBlock Text="{lex:Loc About.ProjectUrl}" />
<TextBlock Margin="8,0,0,0">
<Hyperlink x:Name="oneEuroLink" Click="OneEuroLink_Click" Foreground="{DynamicResource AccentColor}">http://cristal.univ-lille.fr/~casiez/1euro/</Hyperlink>
</TextBlock>
Expand All @@ -825,7 +796,7 @@ dondrakon - Ukranian
<StackPanel Margin="8">
<TextBlock Text="H.NotifyIcon" FontSize="18" FontWeight="Bold" />
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<TextBlock Text="Project URL:" />
<TextBlock Text="{lex:Loc About.ProjectUrl}" />
<TextBlock Margin="8,0,0,0">
<Hyperlink x:Name="hNotifyIconLink" Click="HNotifyIconLink_Click" Foreground="{DynamicResource AccentColor}">https://github.com/HavenDV/H.NotifyIcon/</Hyperlink>
</TextBlock>
Expand All @@ -837,7 +808,7 @@ dondrakon - Ukranian
<StackPanel Margin="8">
<TextBlock Text="vJoyInterfaceCS" FontSize="18" FontWeight="Bold" />
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<TextBlock Text="Project URL:" />
<TextBlock Text="{lex:Loc About.ProjectUrl}" />
<TextBlock Margin="8,0,0,0">
<Hyperlink x:Name="vjoyInterfaceLink" Click="VJoyInterfaceLink_Click" Foreground="{DynamicResource AccentColor}">https://github.com/shauleiz/vJoy/tree/master/apps/common/vJoyInterfaceCS</Hyperlink>
</TextBlock>
Expand Down
Loading