1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-12 21:38:38 +00:00

Broken commit because.

This commit is contained in:
SpoinkyNL 2016-02-28 11:03:08 +01:00
parent ad5c28ff6f
commit ca6c020385
20 changed files with 120 additions and 37 deletions

View File

@ -66,6 +66,9 @@
<setting name="SecondaryColor" serializeAs="String">
<value>#FFFF0000</value>
</setting>
<setting name="ContextualColor" serializeAs="String">
<value>False</value>
</setting>
</Artemis.Modules.Games.RocketLeague.RocketLeague>
<Artemis.Settings.Offsets>
<setting name="RocketLeague" serializeAs="String">

View File

@ -17,7 +17,7 @@
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Teal.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
<ResourceDictionary Source="/Resources/Icons.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@ -274,7 +274,7 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Modules\Games\RocketLeague\RocketLeagueModel.cs" />
<Compile Include="Modules\Games\Witcher3\RocketLeagueSettings.cs" />
<Compile Include="Modules\Games\Witcher3\Witcher3Settings.cs" />
<Compile Include="Modules\Games\Witcher3\Witcher3.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>

View File

@ -68,17 +68,19 @@ namespace Artemis.Managers
if (effectModel.Name == ActiveEffect.Name)
return;
ActiveEffect?.Dispose();
if (!_mainManager.Running)
// If the main manager is running, pause it and safely change the effect
if (_mainManager.Running)
{
_mainManager.Start(effectModel);
ChangeEffectWithPause(effectModel);
return;
}
// If it's not running, change the effect and start it afterwards.
ActiveEffect = effectModel;
ActiveEffect.Enable();
_mainManager.Start(effectModel);
if (ActiveEffect is GameModel)
return;
@ -90,6 +92,17 @@ namespace Artemis.Managers
_events.PublishOnUIThread(new ActiveEffectChanged(ActiveEffect.Name));
}
private void ChangeEffectWithPause(EffectModel effectModel)
{
_mainManager.Pause(effectModel);
_mainManager.PauseCallback += MainManagerOnPauseCallback;
}
private void MainManagerOnPauseCallback(EffectModel callbackEffect)
{
}
/// <summary>
/// Clears the current effect
/// </summary>

View File

@ -10,6 +10,7 @@ namespace Artemis.Models
public MainManager MainManager;
public string Name;
public bool Initialized;
protected EffectModel(MainManager mainManager)
{
@ -18,8 +19,6 @@ namespace Artemis.Models
public abstract void Dispose();
public event SettingsUpdateHandler SettingsUpdateEvent;
// Called on creation
public abstract void Enable();

View File

@ -19,6 +19,8 @@ namespace Artemis.Modules.Effects.AudioVisualizer
private readonly SampleAggregator _sampleAggregator = new SampleAggregator(FftLength);
private bool _generating;
private IWaveIn _waveIn;
private int _sensitivity;
private bool _fromBottom;
public AudioVisualizerModel(MainManager mainManager, AudioVisualizerSettings settings) : base(mainManager)
{
@ -27,6 +29,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
DeviceIds = new List<string>();
SpectrumData = new List<byte>();
Scale = 4;
Initialized = false;
}
public int Lines { get; set; }
@ -42,6 +45,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
public override void Dispose()
{
Initialized = false;
_sampleAggregator.PerformFFT = false;
_sampleAggregator.FftCalculated -= FftCalculated;
@ -52,6 +56,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
public override void Enable()
{
Initialized = false;
Lines = MainManager.KeyboardManager.ActiveKeyboard.Width;
// TODO: Device selection
@ -59,6 +64,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active)
.FirstOrDefault()?.ID;
// Apply settings
SoundRectangles = new List<KeyboardRectangle>();
for (var i = 0; i < Lines; i++)
{
@ -72,17 +78,21 @@ namespace Artemis.Modules.Effects.AudioVisualizer
},
LinearGradientMode.Vertical) {ContainedBrush = false, Height = 0});
}
_sensitivity = Settings.Sensitivity;
_fromBottom = Settings.FromBottom;
_sampleAggregator.FftCalculated += FftCalculated;
_sampleAggregator.PerformFFT = true;
// Start listening for sound data
_waveIn = new WasapiLoopbackCapture();
_waveIn.DataAvailable += OnDataAvailable;
_waveIn.StartRecording();
Initialized = true;
}
public override void Update()
{
{
// Start filling the model
_generating = true;
@ -108,7 +118,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
height = (int) Math.Round(SpectrumData[i]/2.55);
// Apply Sensitivity setting
height = height*Settings.Sensitivity;
height = height* _sensitivity;
var keyboardHeight =
(int) Math.Round(MainManager.KeyboardManager.ActiveKeyboard.Height/100.00*height*Scale);
if (keyboardHeight > SoundRectangles[i].Height)
@ -119,7 +129,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
SoundRectangles[i].X = i*Scale;
SoundRectangles[i].Width = Scale;
if (Settings.FromBottom)
if (_fromBottom)
SoundRectangles[i].Y = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale -
SoundRectangles[i].Height;
}

View File

@ -81,12 +81,11 @@
<!-- Bar direction -->
<TextBlock Grid.Row="4" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
Height="16" Margin="0,9,0,10">
Grow bars bottom (broken, sorry!)
Grow bars bottom
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=EffectSettings.FromBottom, Mode=TwoWay}"
Grid.Row="4" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes"
OffLabel="No"
Margin="0,0,-5,0" Width="114" IsEnabled="False" />
OffLabel="No" Margin="0,0,-5,0" Width="114" />
<!-- Bars amount -->
<TextBlock Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"

View File

@ -14,6 +14,7 @@ namespace Artemis.Modules.Effects.Debug
Name = "Debug Effect";
Settings = settings;
Scale = 4;
Initialized = false;
}
public int Scale { get; set; }
@ -24,10 +25,13 @@ namespace Artemis.Modules.Effects.Debug
public override void Dispose()
{
Initialized = false;
}
public override void Enable()
{
Initialized = false;
KeyboardRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
{
Color.Red,
@ -38,6 +42,8 @@ namespace Artemis.Modules.Effects.Debug
Color.Purple,
Color.DeepPink
}, LinearGradientMode.Horizontal);
Initialized = true;
}
public override void Update()

View File

@ -9,14 +9,23 @@ namespace Artemis.Modules.Effects.TypeHole
public TypeHoleModel(MainManager mainManager) : base(mainManager)
{
Name = "TypeHole";
Initialized = false;
}
public override void Dispose()
{
Initialized = false;
// Disable logic
}
public override void Enable()
{
Initialized = false;
// Enable logic
Initialized = true;
}
public override void Update()

View File

@ -23,19 +23,25 @@ namespace Artemis.Modules.Effects.TypeWave
_waves = new List<Wave>();
_randomColor = Color.Red;
Settings = settings;
Initialized = false;
}
public TypeWaveSettings Settings { get; set; }
public override void Dispose()
{
Initialized = false;
MainManager.KeyboardHook.Unsubscribe(HandleKeypress);
}
public override void Enable()
{
Initialized = false;
// Listener won't start unless the effect is active
MainManager.KeyboardHook.Subscribe(HandleKeypress);
Initialized = true;
}
public override void Update()

View File

@ -22,7 +22,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
@ -109,7 +108,7 @@
SmallChange="1" IsSnapToTickEnabled="True" />
<!-- Buttons -->
<StackPanel Grid.Column="0" Grid.Row="7" Orientation="Horizontal" VerticalAlignment="Bottom">
<StackPanel Grid.Column="0" Grid.Row="8" Orientation="Horizontal" VerticalAlignment="Bottom">
<Button x:Name="ResetSettings" Content="Reset effect" VerticalAlignment="Top" Width="100"
Style="{DynamicResource SquareButtonStyle}" />
<Button x:Name="SaveSettings" Content="Save changes" VerticalAlignment="Top" Width="100"

View File

@ -25,6 +25,7 @@ namespace Artemis.Modules.Games.CounterStrike
ProcessName = "csgo";
Scale = 4;
Enabled = Settings.Enabled;
Initialized = false;
}
public CounterStrikeSettings Settings { get; set; }
@ -41,11 +42,14 @@ namespace Artemis.Modules.Games.CounterStrike
public override void Dispose()
{
Initialized = false;
MainManager.GameStateWebServer.GameDataReceived -= HandleGameData;
}
public override void Enable()
{
Initialized = false;
// Some keyboards have a different baseline, Corsair F-keys start at row 1
_topRow = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRegions.First(r => r.RegionName == "TopRow");
AmmoRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, _topRow.TopLeft.X,
@ -64,6 +68,8 @@ namespace Artemis.Modules.Games.CounterStrike
Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale - Scale
};
MainManager.GameStateWebServer.GameDataReceived += HandleGameData;
Initialized = true;
}
public override void Update()

View File

@ -58,5 +58,17 @@ namespace Artemis.Modules.Games.RocketLeague {
this["SecondaryColor"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool ContextualColor {
get {
return ((bool)(this["ContextualColor"]));
}
set {
this["ContextualColor"] = value;
}
}
}
}

View File

@ -11,5 +11,8 @@
<Setting Name="SecondaryColor" Type="System.Windows.Media.Color" Scope="User">
<Value Profile="(Default)">#FFFF0000</Value>
</Setting>
<Setting Name="ContextualColor" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -31,6 +31,7 @@ namespace Artemis.Modules.Games.RocketLeague
ProcessName = "RocketLeague";
Scale = 4;
Enabled = Settings.Enabled;
Initialized = false;
}
public RocketLeagueSettings Settings { get; set; }
@ -39,11 +40,14 @@ namespace Artemis.Modules.Games.RocketLeague
public override void Dispose()
{
Initialized = false;
_memory = null;
}
public override void Enable()
{
Initialized = false;
_boostRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
{
ColorHelpers.ToDrawingColor(Settings.MainColor),
@ -53,23 +57,10 @@ namespace Artemis.Modules.Games.RocketLeague
MemoryHelpers.GetPointers();
_pointer = JsonConvert.DeserializeObject<GamePointersCollectionModel>(Offsets.Default.RocketLeague);
//var test =
// JsonConvert.SerializeObject(new List<GamePointersCollectionModel>
// {
// new GamePointersCollectionModel
// {
// Game = "RocketLeague",
// GameVersion = "1.12",
// GameAddresses = new List<GamePointer> {new GamePointer
// {
// Description = "Boost",
// BasePointer = new IntPtr(0x01581AF4),
// Offsets = new []{0xB4, 0x104, 0x320, 0x708, 0x21C}
// }}
// }
// });
var tempProcess = MemoryHelpers.GetProcessIfRunning(ProcessName);
_memory = new Memory(tempProcess);
Initialized = true;
}
public override void Update()

View File

@ -13,12 +13,14 @@ namespace Artemis.Modules.Games.RocketLeague
public bool Enabled { get; set; }
public Color MainColor { get; set; }
public Color SecondaryColor { get; set; }
public bool ContextualColor { get; set; }
public sealed override void Load()
{
Enabled = RocketLeague.Default.Enabled;
MainColor = RocketLeague.Default.MainColor;
SecondaryColor = RocketLeague.Default.SecondaryColor;
ContextualColor = RocketLeague.Default.ContextualColor;
}
public sealed override void Save()
@ -26,6 +28,7 @@ namespace Artemis.Modules.Games.RocketLeague
RocketLeague.Default.Enabled = Enabled;
RocketLeague.Default.MainColor = MainColor;
RocketLeague.Default.SecondaryColor = SecondaryColor;
RocketLeague.Default.ContextualColor = ContextualColor;
RocketLeague.Default.Save();
}
@ -35,6 +38,7 @@ namespace Artemis.Modules.Games.RocketLeague
Enabled = true;
MainColor = Color.FromArgb(255, 255, 80, 0);
SecondaryColor = Color.FromArgb(255, 255, 0, 0);
ContextualColor = false;
}
}
}

View File

@ -4,7 +4,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:cal="http://www.caliburnproject.org"
xmlns:cal="http://www.caliburnproject.org"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
d:DesignHeight="476.986" d:DesignWidth="538.772">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
@ -19,6 +20,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
@ -58,13 +60,23 @@
Grid.Row="2" Grid.Column="1" Width="110" HorizontalAlignment="Right"
VerticalAlignment="Center" Margin="0,5,-1,5" Height="22" />
<TextBlock Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
<!-- Secondary color -->
<TextBlock Grid.Row="3" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"
Height="16" Margin="0,8">
Color bar according to boost amount
</TextBlock>
<controls:ToggleSwitch IsChecked="{Binding Path=RocketLeagueSettings.ContextualColor, Mode=TwoWay}"
Grid.Row="3" Grid.Column="1" HorizontalAlignment="Right" OnLabel="Yes" OffLabel="No"
Margin="0,0,-5,0" Width="114" />
<!-- Info text -->
<TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="#535353" MaxWidth="510" TextAlignment="Justify">
Tip: To find a color combination you like, start an exhibition match, pickup 100 boost and play around with the colors.
They'll appear on your keyboard immediately! Once you're satisfied don't forget to click save changes.
</TextBlock>
<TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
<TextBlock Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Center" Margin="0,8"
TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="Segoe UI Semibold"
Foreground="#535353" MaxWidth="510" TextAlignment="Justify">
Note: Requires patch x.x. When a new patch is released Artemis downloads new pointers for the latest version (unless disabled in settings).

View File

@ -25,7 +25,8 @@ namespace Artemis.Modules.Games.Witcher3
ProcessName = "witcher3";
Scale = 4;
Enabled = Settings.Enabled;
Initialized = false;
_updateSw = new Stopwatch();
_signRegex = new Regex("ActiveSign=(.*)", RegexOptions.Compiled);
}
@ -36,6 +37,7 @@ namespace Artemis.Modules.Games.Witcher3
public override void Dispose()
{
Initialized = false;
_witcherSettings = null;
_updateSw.Reset();
@ -43,6 +45,8 @@ namespace Artemis.Modules.Games.Witcher3
public override void Enable()
{
Initialized = false;
_signRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>(),
LinearGradientMode.Horizontal)
{
@ -57,6 +61,8 @@ namespace Artemis.Modules.Games.Witcher3
_witcherSettings = witcherSettings;
_updateSw.Start();
Initialized = true;
}
public override void Update()

View File

@ -48,12 +48,17 @@ namespace Artemis.ViewModels.Abstract
if (EffectEnabled)
MainManager.EffectManager.ClearEffect();
else
MainManager.EffectManager.ChangeEffect(EffectModel);
MainManager.Restart(EffectModel);
}
public void SaveSettings()
{
EffectSettings?.Save();
if (!EffectEnabled)
return;
// Restart the effect if it's currently running to apply settings.
MainManager.Restart(EffectModel);
}
public void ResetSettings()