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

Support Elite: Dangerous #1896

Merged
merged 84 commits into from
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
1f90faf
Added a simple Elite: Dangerous profile
DrParanoia Aug 20, 2019
f39778d
Don't provide alpha for color since it's not needed
DrParanoia Aug 20, 2019
e88bb08
Merge branch 'dev' into feature/support_elite_dangerous
DrParanoia Aug 21, 2019
cfa00fe
Merge branch 'feature/activate_deactivate_callbacks' into feature/sup…
DrParanoia Aug 21, 2019
ec5abf2
Added a layer and color pickers for initial control color groups
DrParanoia Aug 21, 2019
8b5efe4
Started working on highlighting key binds
DrParanoia Aug 21, 2019
09be475
Merge branch 'feature/activate_deactivate_callbacks' into feature/sup…
DrParanoia Aug 22, 2019
2d2f9ad
Working on blinking keys
DrParanoia Aug 22, 2019
427a08f
Added Status node for Elite: Dangerous
DrParanoia Aug 22, 2019
e8bd2f6
Merge branch 'feature/activate_deactivate_callbacks' into feature/sup…
DrParanoia Aug 22, 2019
088e5d8
Fixed overridden methods
DrParanoia Aug 22, 2019
74de390
Implemented detection of currend binds file
DrParanoia Aug 22, 2019
4da4475
Merge branch 'feature/activate_deactivate_callbacks' into feature/sup…
DrParanoia Aug 22, 2019
d0a9f12
Fixed lifecycle method names
DrParanoia Aug 22, 2019
458479f
Started parsing binds file
DrParanoia Aug 25, 2019
b4aab5b
Implemented binds file parsing
DrParanoia Aug 25, 2019
954272d
Fixed a crash when reading file after it was changed
DrParanoia Aug 25, 2019
5cd7dd4
Improved color groups
DrParanoia Aug 26, 2019
6ccdbbf
Implemented game status parsing
DrParanoia Aug 26, 2019
c7d8c01
Better storage and handling of control groups
DrParanoia Aug 26, 2019
0208093
Highlight modifier keys
DrParanoia Aug 26, 2019
8588080
Properly detect if all modifier keys are pressed before highlighting
DrParanoia Aug 26, 2019
015d42a
Refactored where key and control group presets are stored
DrParanoia Aug 28, 2019
66efc79
Merge branch 'feature/activate_deactivate_callbacks' into feature/sup…
DrParanoia Aug 28, 2019
de128be
Fixed missed merge conflict notation
DrParanoia Aug 28, 2019
e49c185
Cleaned up color settings a bit
DrParanoia Aug 28, 2019
1e6915d
Changed GuiFocus argument for GameStateCondition to array
DrParanoia Aug 28, 2019
0f8a836
Updated binds command list
DrParanoia Aug 28, 2019
82acc04
Filled in bind command color groups (needs more work)
DrParanoia Aug 28, 2019
cd944e6
Fixed incorrect check for not set flags
DrParanoia Aug 28, 2019
8a3d052
Implemented key color transition smoothing
DrParanoia Aug 29, 2019
a3cd249
Fixed wrong colors for smoothed out keys
DrParanoia Aug 29, 2019
610c9c3
Merge branch 'feature/activate_deactivate_callbacks' into feature/sup…
DrParanoia Aug 29, 2019
7612749
Fixed broken supercruise command group
DrParanoia Aug 29, 2019
1ccdc86
Started working on Journal file parsing
DrParanoia Aug 29, 2019
c61d5e6
Added and implemented parsing for some JournalEvent models
DrParanoia Aug 30, 2019
6fc8f6e
Implemented some startup journal parsing
DrParanoia Aug 30, 2019
ef369a1
Reverted SharpDX.RawInput to 4.0.1
DrParanoia Aug 30, 2019
35e5175
Removed journal reading profiling and re-formatted the code
DrParanoia Aug 30, 2019
58be0fe
Merge branch 'dev' into feature/support_elite_dangerous
DrParanoia Aug 30, 2019
4f8aa18
Watch last journal file
DrParanoia Aug 30, 2019
3773a5f
Updated control groups, flags and gui focus modes
DrParanoia Aug 30, 2019
da132a5
Improved chaff, hsl and shield cell keys highlighting when switching …
DrParanoia Aug 30, 2019
8599f68
Added silent running key
DrParanoia Aug 30, 2019
b2f89a0
Started working on states for FSD animations
DrParanoia Aug 30, 2019
da3df7a
Implemented an FSD countdown animation
DrParanoia Aug 30, 2019
c0b4a61
Improved fsd state handling when initially reading Journal files
DrParanoia Sep 1, 2019
de87e72
Separated Ship and SRV controls a bit
DrParanoia Sep 1, 2019
23b0f4c
Better control group separation between Ship and SRV
DrParanoia Sep 1, 2019
21cffb9
Merge branch 'bugfix/animation-mix-duration' into feature/support-eli…
DrParanoia Sep 1, 2019
855b877
Merge branch 'dev' into feature/support-elite-dangerous
DrParanoia Sep 1, 2019
5b3066f
Implemented hyperspace jump animation
DrParanoia Sep 1, 2019
3f505e9
Fixed ship and SRV controls showing when they shouldn't
DrParanoia Sep 1, 2019
25bb17f
Fixed FSD countdown animation when charging for supercruise
DrParanoia Sep 1, 2019
44e7148
Implemented ability to specify animation to be played only once
DrParanoia Sep 1, 2019
97076db
Implemented a simple hyperspace exit animation
DrParanoia Sep 1, 2019
ebf60b3
Refactored animations a bit
DrParanoia Sep 2, 2019
aaf3a07
Improved the hyperspace exit animation
DrParanoia Sep 2, 2019
bf7c775
Added most of the different colors for different stars on hyperspace …
DrParanoia Sep 2, 2019
c9b243b
Made keys for ADS and FSS at least light up
DrParanoia Sep 2, 2019
a06e2cb
Do not disable FSD buttons due to deployed hardpoints if in supercruise
DrParanoia Sep 2, 2019
3f5dac1
Removed Sublime Text from the process list
DrParanoia Sep 2, 2019
c62dfd0
Merge branch 'dev' into feature/support-elite-dangerous
DrParanoia Sep 6, 2019
be35200
Disabled FSS button when FSD is charging
DrParanoia Sep 6, 2019
67be700
Fixed a crash when there are no binds found
DrParanoia Sep 8, 2019
5dbf9fc
Implemented default key bindings parsing in case when custom control …
DrParanoia Sep 8, 2019
c0fd7a0
Added more commands to control groups
DrParanoia Sep 8, 2019
2705342
Added more commands to control groups
DrParanoia Sep 8, 2019
b36952d
Reworked how key effects are created (blinking keys)
DrParanoia Sep 8, 2019
f47e339
Implemented power distributor key dimming based on current pip values
DrParanoia Sep 8, 2019
f980ee8
Merge branch 'dev' into feature/support-elite-dangerous
DrParanoia Sep 8, 2019
7579607
Fixed a crash when the game is not running and there is no status
DrParanoia Sep 8, 2019
482c167
Merge branch 'dev' into feature/support-elite-dangerous
DrParanoia Jan 3, 2020
730b4d4
Added a missing closing tag after a merge
DrParanoia Jan 3, 2020
6be2aad
Overwrite found key bindings instead of trying to add them (should fi…
DrParanoia Jan 4, 2020
7416c80
Implemented automatic switching to a newer journal file if it was cre…
DrParanoia Jan 6, 2020
aa86a6c
Removed unneeded comments
DrParanoia Jan 7, 2020
571d425
Fixed a crash in case Elite Dangerous directory or the status.json fi…
DrParanoia Jan 8, 2020
aaca81c
Added ability to specify different key background colors when in Comb…
DrParanoia Jan 8, 2020
3ac1963
Merge branch 'dev' of https://github.com/antonpup/Aurora into dev
DrParanoia Jan 28, 2020
8e80791
Cleaned up the color pickers a bit
DrParanoia Jan 28, 2020
558341b
Merge branch 'dev' into feature/support-elite-dangerous
DrParanoia Feb 16, 2020
cbdf8d2
Merge branch 'dev' into feature/support-elite-dangerous
DrParanoia Feb 26, 2020
7436afe
Merge branch 'dev' into feature/support-elite-dangerous
DrParanoia Mar 13, 2020
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Aurora.Profiles.EliteDangerous"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:EnumDeviceKeys="clr-namespace:Aurora.Devices"
xmlns:EnumPercentEffectType="clr-namespace:Aurora.Settings"
xmlns:EnumValueConverters="clr-namespace:Aurora.Utils"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:Controls="clr-namespace:Aurora.Controls" x:Class="Aurora.Profiles.EliteDangerous.Control_EliteDangerous"
mc:Ignorable="d"
d:DesignHeight="300" Height="Auto" Width="Auto" d:DesignWidth="850">
<UserControl.Resources>
<ResourceDictionary>
<ObjectDataProvider x:Key="PercentEffectType" MethodName="GetValues" ObjectType="{x:Type System:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="EnumPercentEffectType:PercentEffectType" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<EnumValueConverters:PercentEffectTypeToStringVC x:Key="PercentEffectTypeToStringVC"/>
<DataTemplate x:Key="PercentEffectTypeTemplate">
<TextBlock Text="{Binding Converter={StaticResource PercentEffectTypeToStringVC}}" />
</DataTemplate>

<EnumValueConverters:DeviceKeysToStringVC x:Key="DeviceKeysToStringVC"/>
<DataTemplate x:Key="DeviceKeys">
<TextBlock Text="{Binding Converter={StaticResource DeviceKeysToStringVC}}" />
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>

<Grid>
<TabControl>
<TabItem Header="Overview">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

<TextBlock Grid.Row="2" Margin="18,15,10,10" VerticalAlignment="Top" TextWrapping="Wrap" HorizontalAlignment="Left">Note: if using default Elite: Dangerous controls, the game needs to be launched at least once.</TextBlock>

<TextBlock Grid.Row="1" Margin="18,0,10,10" VerticalAlignment="Top" TextWrapping="Wrap">Elite: Dangerous support works using the games Journal API. This means that no memory reading or other potentially bannable methods are involved.</TextBlock>
<CheckBox Grid.Row="0" Margin="10,10,10,10" x:Name="game_enabled" Content="Enable Aurora to provide lighting effects with Elite: Dangerous" HorizontalAlignment="Left" VerticalAlignment="Top" Checked="game_enabled_Checked" Unchecked="game_enabled_Checked"/>
</Grid>
</TabItem>
</TabControl>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using Aurora.Controls;
using Aurora.Utils;
using System;
using System.IO;
using Ionic.Zip;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Navigation;
using Aurora.Devices;
using Aurora.Settings;
using Xceed.Wpf.Toolkit;
using Aurora.Profiles.EliteDangerous.GSI;
using MessageBox = System.Windows.MessageBox;

namespace Aurora.Profiles.EliteDangerous
{
/// <summary>
/// Interaction logic for Control_EliteDangerous.xaml
/// </summary>
public partial class Control_EliteDangerous : UserControl
{
private Application profile_manager;

public Control_EliteDangerous(Application profile)
{
InitializeComponent();

profile_manager = profile;

SetSettings();

if (!(profile_manager.Settings as FirstTimeApplicationSettings).IsFirstTimeInstalled)
{
(profile_manager.Settings as FirstTimeApplicationSettings).IsFirstTimeInstalled = true;
}

profile_manager.ProfileChanged += Control_EliteDangerous_ProfileChanged;

}

private void Control_EliteDangerous_ProfileChanged(object sender, EventArgs e)
{
SetSettings();
}

private void SetSettings()
{
this.game_enabled.IsChecked = profile_manager.Settings.IsEnabled;

}

//Overview

private void game_enabled_Checked(object sender, RoutedEventArgs e)
{
if (IsLoaded)
{
profile_manager.Settings.IsEnabled = (this.game_enabled.IsChecked.HasValue) ? this.game_enabled.IsChecked.Value : false;
profile_manager.SaveProfiles();
}
}

private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.IO;

namespace Aurora.Profiles.EliteDangerous
{
public static class EliteConfig
{
public const int KEY_BLINK_SPEED = 20;
public static readonly string JOURNAL_API_DIR = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
"Saved Games",
"Frontier Developments",
"Elite Dangerous"
);
public static readonly string STATUS_FILE = Path.Combine(JOURNAL_API_DIR, "Status.json");

public static readonly string BINDINGS_DIR = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"Frontier Developments",
"Elite Dangerous",
"Options",
"Bindings"
);
public static readonly string BINDINGS_PRESET_FILE = Path.Combine(BINDINGS_DIR, "StartPreset.start");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using Aurora.Settings;
using Aurora.Profiles.EliteDangerous.Layers;
using System.Collections.Generic;
using CSScriptLibrary;

namespace Aurora.Profiles.EliteDangerous
{
public class EliteDangerous : Application
{
public EliteDangerous()
: base(new LightEventConfig
{
Name = "Elite: Dangerous",
ID = "EliteDangerous",
ProcessNames = new[] { "EliteDangerous64.exe" },
UpdateInterval = 16,
SettingsType = typeof(EliteDangerousSettings),
ProfileType = typeof(EliteDangerousProfile),
OverviewControlType = typeof(Control_EliteDangerous),
GameStateType = typeof(GSI.GameState_EliteDangerous),
Event = new GameEvent_EliteDangerous(),
IconURI = "Resources/elite_dangerous_256x256.png"
})
{

var extra = new List<LayerHandlerEntry>
{
new LayerHandlerEntry("EliteDangerousBackground", "Elite: Dangerous Background Layer", typeof(EliteDangerousBackgroundLayerHandler)),
new LayerHandlerEntry("EliteDangerousKeyBinds", "Elite: Dangerous Key Binds Layer", typeof(EliteDangerousKeyBindsLayerHandler)),
new LayerHandlerEntry("EliteDangerousAnimations", "Elite: Dangerous Animation Layer", typeof(EliteDangerousAnimationLayerHandler)),
};

Global.LightingStateManager.RegisterLayerHandlers(extra, false);

foreach (var entry in extra)
{
Config.ExtraAvailableLayers.Add(entry.Key);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Aurora.Settings;
using Aurora.Settings.Layers;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Aurora.Profiles.EliteDangerous
{
public class EliteDangerousProfile : ApplicationProfile
{
public EliteDangerousProfile() : base()
{

}

public override void Reset()
{
base.Reset();
Layers = new System.Collections.ObjectModel.ObservableCollection<Layer>()
{
new Layer("Animations", new Layers.EliteDangerousAnimationLayerHandler()),
new Layer("Key Binds", new Layers.EliteDangerousKeyBindsLayerHandler()),
new Layer("Background", new Layers.EliteDangerousBackgroundLayerHandler()),
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Aurora.Settings;

namespace Aurora.Profiles.EliteDangerous
{
public class EliteDangerousSettings : FirstTimeApplicationSettings
{
private string gamePath = "";

public string GamePath { get { return gamePath; } set { gamePath = value; InvokePropertyChanged(); } }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
using System;
using Aurora.Profiles.EliteDangerous.GSI.Nodes;
using Aurora.Profiles.EliteDangerous.Layers;

namespace Aurora.Profiles.EliteDangerous.GSI
{
public class GameStateCondition
{
long flagsSet;
long flagsNotSet;
GuiFocus[] guiFocus;

private Func<GameState_EliteDangerous, bool> callback = null;

public GameStateCondition(long flagsSet = Flag.UNSPECIFIED, long flagsNotSet = Flag.UNSPECIFIED, GuiFocus[] guiFocus = null,
Func<GameState_EliteDangerous, bool> callback = null)
{
this.flagsSet = flagsSet;
this.guiFocus = guiFocus;
this.flagsNotSet = flagsNotSet;
this.callback = callback;
}

public GameStateCondition(Func<GameState_EliteDangerous, bool> callback)
{
this.callback = callback;
}

public bool IsSatisfied(GameState_EliteDangerous gameState)
{
if (callback != null && !callback(gameState))
{
return false;
}

if (guiFocus != null && Array.IndexOf(guiFocus, gameState.Status.GuiFocus) == Flag.UNSPECIFIED)
{
return false;
}

if (flagsSet != Flag.UNSPECIFIED && !Flag.IsFlagSet(gameState.Status.Flags, flagsSet))
{
return false;
}

if (flagsNotSet != Flag.UNSPECIFIED && Flag.AtLeastOneFlagSet(gameState.Status.Flags, flagsNotSet))
{
return false;
}

return true;
}
}

public class NeedsGameState
{
public GameStateCondition NeededGameStateCondition;

public NeedsGameState()
{
}

public NeedsGameState(GameStateCondition neededGameStateCondition)
{
this.NeededGameStateCondition = neededGameStateCondition;
}

public bool IsSatisfied(GameState_EliteDangerous gameState)
{
if (NeededGameStateCondition != null)
{
return NeededGameStateCondition.IsSatisfied(gameState);
}

return true;
}
}

public class GameState_EliteDangerous : GameState<GameState_EliteDangerous>
{
private Status status;
private Nodes.Journal journal;
private Nodes.Controls controls;

public Nodes.Journal Journal
{
get
{
if (journal == null)
journal = new Nodes.Journal();

return journal;
}
}

public Status Status
{
get
{
if (status == null)
status = new Status();

return status;
}
}

public Nodes.Controls Controls
{
get
{
if (controls == null)
controls = new Nodes.Controls();

return controls;
}
}

/// <summary>
/// Creates a default GameState_EliteDangerous instance.
/// </summary>
public GameState_EliteDangerous() : base()
{
}
}
}
Loading