Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EA to Public files move #1071

Merged
merged 1 commit into from
May 31, 2024
Merged
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: 2 additions & 1 deletion HandheldCompanion/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:HandheldCompanion.Converters"
xmlns:local="clr-namespace:HandheldCompanion"
xmlns:math="http://hexinnovation.com/math"
xmlns:presets="clr-namespace:HandheldCompanion.Presets"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern">

<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemeResources>
<ui:ThemeResources CanBeAccessedAcrossThreads="{x:Static local:App.IsMultiThreaded}">
<ui:ThemeResources.ThemeDictionaries>
<ResourceDictionary x:Key="Light" ui:ThemeDictionary.Key="Light">
<ResourceDictionary.MergedDictionaries>
Expand Down
6 changes: 5 additions & 1 deletion HandheldCompanion/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace HandheldCompanion;
/// </summary>
public partial class App : Application
{
public static bool IsMultiThreaded { get; } = false;

/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
Expand All @@ -36,8 +38,10 @@ protected override void OnStartup(StartupEventArgs args)
var CurrentAssembly = Assembly.GetExecutingAssembly();
var fileVersionInfo = FileVersionInfo.GetVersionInfo(CurrentAssembly.Location);

// initialize log
// set environment variables
Environment.SetEnvironmentVariable("APP_BASE_DIRECTORY", AppContext.BaseDirectory);

// initialize log
LogManager.Initialize("HandheldCompanion");
LogManager.LogInformation("{0} ({1})", CurrentAssembly.GetName(), fileVersionInfo.FileVersion);

Expand Down
4 changes: 2 additions & 2 deletions HandheldCompanion/Controllers/DualSenseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public override void UpdateInputs(long ticks, float delta)
float joyShockY0 = JslGetTouchY(UserIndex);

Inputs.AxisState[AxisFlags.LeftPadX] = (short)InputUtils.MapRange(joyShockX0, 0.0f, 1.0f, short.MinValue, short.MaxValue);
Inputs.AxisState[AxisFlags.LeftPadY] = (short)InputUtils.MapRange(joyShockY0, 0.0f, 1.0f, short.MaxValue, short.MinValue);
Inputs.AxisState[AxisFlags.LeftPadY] = (short)InputUtils.MapRange(joyShockY0, 0.0f, 1.1442206f, short.MaxValue, short.MinValue);
}
else
{
Expand All @@ -76,7 +76,7 @@ public override void UpdateInputs(long ticks, float delta)
float joyShockY1 = JslGetTouchY(UserIndex, true);

Inputs.AxisState[AxisFlags.RightPadX] = (short)InputUtils.MapRange(joyShockX1, 0.0f, 1.0f, short.MinValue, short.MaxValue);
Inputs.AxisState[AxisFlags.RightPadY] = (short)InputUtils.MapRange(joyShockY1, 0.0f, 1.0f, short.MaxValue, short.MinValue);
Inputs.AxisState[AxisFlags.RightPadY] = (short)InputUtils.MapRange(joyShockY1, 0.0f, 1.1442206f, short.MaxValue, short.MinValue);
}
else
{
Expand Down
74 changes: 56 additions & 18 deletions HandheldCompanion/Controllers/IController.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,14 @@ public virtual string GetGlyph(ButtonFlags button)
switch (button)
{
case ButtonFlags.DPadUp:
return "\u219F"; // Button A
return "\u219F";
case ButtonFlags.DPadDown:
return "\u21A1"; // Button B
return "\u21A1";
case ButtonFlags.DPadLeft:
return "\u219E"; // Button X
return "\u219E";
case ButtonFlags.DPadRight:
return "\u21A0"; // Button Y
return "\u21A0";

case ButtonFlags.LeftStickClick:
return "\u21BA";
case ButtonFlags.RightStickClick:
Expand All @@ -600,10 +601,39 @@ public virtual string GetGlyph(ButtonFlags button)
return "\u21BD";
case ButtonFlags.RightStickRight:
return "\u21C1";

case ButtonFlags.VolumeUp:
return "\u21fe";
case ButtonFlags.VolumeDown:
return "\u21fd";

case ButtonFlags.LeftPadTouch:
return "\u2268";
case ButtonFlags.RightPadTouch:
return "\u2269";

case ButtonFlags.LeftPadClick:
return "\u2266";
case ButtonFlags.RightPadClick:
return "\u2267";

case ButtonFlags.LeftPadClickDown:
return "\u2274";
case ButtonFlags.LeftPadClickUp:
return "\u2270";
case ButtonFlags.LeftPadClickRight:
return "\u2272";
case ButtonFlags.LeftPadClickLeft:
return "\u226E";

case ButtonFlags.RightPadClickDown:
return "\u2275";
case ButtonFlags.RightPadClickUp:
return "\u2271";
case ButtonFlags.RightPadClickRight:
return "\u2273";
case ButtonFlags.RightPadClickLeft:
return "\u226F";
}

return defaultGlyph;
Expand All @@ -621,6 +651,14 @@ public virtual string GetGlyph(AxisFlags axis)
return "\u21C6";
case AxisFlags.RightStickY:
return "\u21F5";

// Todo, need dedicated icons
case AxisFlags.LeftPadX:
case AxisFlags.LeftPadY:
return "\u2264";
case AxisFlags.RightPadX:
case AxisFlags.RightPadY:
return "\u2265";
}

return defaultGlyph;
Expand All @@ -634,35 +672,41 @@ public virtual string GetGlyph(AxisLayoutFlags axis)
return "\u21CB";
case AxisLayoutFlags.RightStick:
return "\u21CC";

case AxisLayoutFlags.Gyroscope:
return "\u2B94";

case AxisLayoutFlags.LeftPad:
return "\u2264";
case AxisLayoutFlags.RightPad:
return "\u2265";
}

return defaultGlyph;
}

public GlyphIconInfo GetGlyphIconInfo(ButtonFlags button, int fontIconSize = 14)
{
var glyph = GetGlyph(button);
string? glyph = GetGlyph(button);
return new GlyphIconInfo
{
Name = GetButtonName(button),
Glyph = glyph,
FontSize = glyph is not null ? 28 : fontIconSize,
FontFamily = glyph is not null ? GlyphFontFamily : null,
Glyph = glyph is not null ? glyph : defaultGlyph,
FontSize = fontIconSize,
FontFamily = GlyphFontFamily,
Foreground = GetGlyphColor(button)
};
}

public GlyphIconInfo GetGlyphIconInfo(AxisLayoutFlags axis, int fontIconSize = 14)
{
var glyph = GetGlyph(axis);
string? glyph = GetGlyph(axis);
return new GlyphIconInfo
{
Name = GetAxisName(axis),
Glyph = glyph,
FontSize = glyph is not null ? 28 : fontIconSize,
FontFamily = glyph is not null ? GlyphFontFamily : null,
Glyph = glyph is not null ? glyph : defaultGlyph,
FontSize = fontIconSize,
FontFamily = GlyphFontFamily,
Foreground = GetGlyphColor(axis)
};
}
Expand All @@ -678,10 +722,7 @@ public FontIcon GetFontIcon(ButtonFlags button, int FontIconSize = 14)
};

if (FontIcon.Glyph is not null)
{
FontIcon.FontFamily = GlyphFontFamily;
FontIcon.FontSize = 28;
}

return FontIcon;
}
Expand All @@ -698,10 +739,7 @@ public FontIcon GetFontIcon(AxisLayoutFlags axis, int FontIconSize = 14)
};

if (FontIcon.Glyph is not null)
{
FontIcon.FontFamily = GlyphFontFamily;
FontIcon.FontSize = 28;
}

return FontIcon;
}
Expand Down
122 changes: 61 additions & 61 deletions HandheldCompanion/Controls/Hints/IHint.xaml
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
<UserControl
x:Class="HandheldCompanion.Controls.Hints.IHint"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:HandheldCompanion.Controls.Hints"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx="clr-namespace:HandheldCompanion.Properties"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
d:Background="White"
d:DesignHeight="120"
d:DesignWidth="800"
d:Visibility="Visible"
Visibility="Collapsed"
mc:Ignorable="d">
<Expander
Name="HintsSteamNeptuneDeskop"
Padding="15,12,12,12"
HorizontalAlignment="Stretch">
<Expander.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*" MinWidth="200" />
<ColumnDefinition Width="2*" MinWidth="200" />
</Grid.ColumnDefinitions>
<DockPanel Margin="0,12,12,12">
<ui:FontIcon
Height="40"
HorizontalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
Glyph="&#xe7ba;" />
<ui:SimpleStackPanel Margin="12,0,0,0" VerticalAlignment="Center">
<TextBlock Name="HintTitle" Style="{StaticResource BodyTextBlockStyle}" />
<TextBlock
Name="HintDescription"
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
TextWrapping="Wrap" />
</ui:SimpleStackPanel>
</DockPanel>
<Button
Name="HintActionButton"
Grid.Column="1"
Width="200"
HorizontalAlignment="Right"
d:Visibility="Visible"
Click="HintActionButton_Click"
FontSize="14"
Style="{StaticResource AccentButtonStyle}"
Visibility="Collapsed" />
</Grid>
</Expander.Header>
<TextBlock Name="HintReadMe" TextWrapping="Wrap" />
</Expander>
</UserControl>
<UserControl
x:Class="HandheldCompanion.Controls.Hints.IHint"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:HandheldCompanion.Controls.Hints"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx="clr-namespace:HandheldCompanion.Properties"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
d:Background="White"
d:DesignHeight="120"
d:DesignWidth="800"
d:Visibility="Visible"
Visibility="Collapsed"
mc:Ignorable="d">

<Expander
Name="HintsSteamNeptuneDeskop"
Padding="15,12,12,12"
HorizontalAlignment="Stretch">

<Expander.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="8*" MinWidth="200" />
<ColumnDefinition Width="2*" MinWidth="200" />
</Grid.ColumnDefinitions>

<DockPanel Margin="0,12,12,12">
<ui:FontIcon
Height="40"
HorizontalAlignment="Center"
FontFamily="{DynamicResource SymbolThemeFontFamily}"
Glyph="&#xe7ba;" />

<ui:SimpleStackPanel Margin="12,0,0,0" VerticalAlignment="Center">
<TextBlock Name="HintTitle" Style="{StaticResource BodyTextBlockStyle}" />
<TextBlock
Name="HintDescription"
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
TextWrapping="Wrap" />
</ui:SimpleStackPanel>
</DockPanel>

<Button
Name="HintActionButton"
Grid.Column="1"
Width="200"
HorizontalAlignment="Right"
d:Visibility="Visible"
Click="HintActionButton_Click"
FontSize="14"
Style="{StaticResource AccentButtonStyle}"
Visibility="Collapsed" />
</Grid>
</Expander.Header>

<TextBlock Name="HintReadMe" TextWrapping="Wrap" />
</Expander>
</UserControl>
44 changes: 22 additions & 22 deletions HandheldCompanion/Controls/Hints/IHint.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
using System.Windows;
using System.Windows.Controls;
namespace HandheldCompanion.Controls.Hints
{
/// <summary>
/// Interaction logic for IHint.xaml
/// </summary>
public partial class IHint : UserControl
{
public IHint()
{
InitializeComponent();
}
protected virtual void HintActionButton_Click(object sender, RoutedEventArgs e)
{ }
public virtual void Stop()
{ }
}
}
using System.Windows;
using System.Windows.Controls;

namespace HandheldCompanion.Controls.Hints
{
/// <summary>
/// Interaction logic for IHint.xaml
/// </summary>
public partial class IHint : UserControl
{
public IHint()
{
InitializeComponent();
}

protected virtual void HintActionButton_Click(object sender, RoutedEventArgs e)
{ }

public virtual void Stop()
{ }
}
}
Loading
Loading