mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Strafe fixes
GTA V fixes
This commit is contained in:
parent
96eadfecbb
commit
b9ebdeefa1
@ -1,4 +1,5 @@
|
|||||||
using System.Drawing;
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@ -67,6 +68,8 @@ namespace Artemis.DeviceProviders.CoolerMaster
|
|||||||
for (var y = 0; y < Height; y++)
|
for (var y = 0; y < Height; y++)
|
||||||
{
|
{
|
||||||
var c = b.GetPixel(x, y);
|
var c = b.GetPixel(x, y);
|
||||||
|
if (c.R != 0)
|
||||||
|
Console.WriteLine();
|
||||||
matrix.KeyColor[y, x] = new KEY_COLOR(c.R, c.G, c.B);
|
matrix.KeyColor[y, x] = new KEY_COLOR(c.R, c.G, c.B);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -81,13 +81,18 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
PreviewSettings = new PreviewSettings(new Rect(15, 30, 751, 284), Resources.k65);
|
PreviewSettings = new PreviewSettings(new Rect(15, 30, 751, 284), Resources.k65);
|
||||||
break;
|
break;
|
||||||
case "STRAFE RGB":
|
case "STRAFE RGB":
|
||||||
Height = 7;
|
Height = 8;
|
||||||
Width = 22;
|
Width = 22;
|
||||||
Slug = "corsair-strafe-rgb";
|
Slug = "corsair-strafe-rgb";
|
||||||
PreviewSettings = new PreviewSettings(new Rect(23, 30, 940, 303), Resources.strafe);
|
PreviewSettings = new PreviewSettings(new Rect(23, 12, 937, 324), Resources.strafe);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Height = 8;
|
||||||
|
Width = 22;
|
||||||
|
Slug = "corsair-strafe-rgb";
|
||||||
|
PreviewSettings = new PreviewSettings(new Rect(23, 12, 937, 324), Resources.strafe);
|
||||||
|
|
||||||
Logger.Debug("Corsair SDK reported device as: {0}", _keyboard.DeviceInfo.Model);
|
Logger.Debug("Corsair SDK reported device as: {0}", _keyboard.DeviceInfo.Model);
|
||||||
_keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush());
|
_keyboard.Brush = _keyboardBrush ?? (_keyboardBrush = new ImageBrush());
|
||||||
}
|
}
|
||||||
@ -114,29 +119,8 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
/// <param name="bitmap"></param>
|
/// <param name="bitmap"></param>
|
||||||
public override void DrawBitmap(Bitmap bitmap)
|
public override void DrawBitmap(Bitmap bitmap)
|
||||||
{
|
{
|
||||||
|
_keyboardBrush.Image = bitmap;
|
||||||
// For STRAFE, stretch the image on row 2.
|
_keyboard.Update();
|
||||||
if (_keyboard.DeviceInfo.Model == "STRAFE RGB")
|
|
||||||
{
|
|
||||||
using (var strafeBitmap = new Bitmap(22, 8))
|
|
||||||
{
|
|
||||||
using (var g = Graphics.FromImage(strafeBitmap))
|
|
||||||
{
|
|
||||||
g.DrawImage(bitmap, new Point(0, 0));
|
|
||||||
g.DrawImage(bitmap, new Rectangle(0, 3, 22, 7), new Rectangle(0, 2, 22, 7),
|
|
||||||
GraphicsUnit.Pixel);
|
|
||||||
|
|
||||||
_keyboardBrush.Image = strafeBitmap;
|
|
||||||
_keyboard.Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_keyboardBrush.Image = bitmap;
|
|
||||||
_keyboard.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
public override KeyMatch? GetKeyPosition(Keys keyCode)
|
||||||
|
|||||||
@ -29,7 +29,6 @@ namespace Artemis.Modules.Games.GtaV
|
|||||||
|
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
var process = System.Diagnostics.Process.GetProcessesByName("GTA5").First();
|
|
||||||
DllManager.PlaceLogitechDll();
|
DllManager.PlaceLogitechDll();
|
||||||
_pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
_pipeServer.PipeMessage += PipeServerOnPipeMessage;
|
||||||
base.Enable();
|
base.Enable();
|
||||||
|
|||||||
@ -53,7 +53,7 @@ using System.Windows;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("1.9.0.0")]
|
[assembly: AssemblyVersion("1.9.0.1")]
|
||||||
[assembly: AssemblyFileVersion("1.9.0.0")]
|
[assembly: AssemblyFileVersion("1.9.0.1")]
|
||||||
[assembly: InternalsVisibleTo("Artemis.Explorables")]
|
[assembly: InternalsVisibleTo("Artemis.Explorables")]
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@ -37,8 +37,11 @@ namespace Artemis.Utilities.DataReaders
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Change the registry key to point to the fake DLL
|
// Change the registry key to point to the fake DLL
|
||||||
var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\CLSID\{a6519e67-7632-4375-afdf-caa889744403}\ServerBinary", true);
|
// Key doesn't exist yet on systems without LGS installed
|
||||||
key?.SetValue(null, DllPath + @"\LogitechLed.dll");
|
var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\CLSID\{a6519e67-7632-4375-afdf-caa889744403}\ServerBinary", true) ??
|
||||||
|
Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Classes\CLSID\{a6519e67-7632-4375-afdf-caa889744403}\ServerBinary", true);
|
||||||
|
|
||||||
|
key.SetValue(null, DllPath + @"\LogitechLed.dll");
|
||||||
|
|
||||||
// Make sure the fake DLL is in place
|
// Make sure the fake DLL is in place
|
||||||
if (!Directory.Exists(DllPath))
|
if (!Directory.Exists(DllPath))
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -12,7 +11,6 @@ using System.Windows.Forms;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Artemis.DAL;
|
using Artemis.DAL;
|
||||||
using Artemis.DeviceProviders;
|
|
||||||
using Artemis.Events;
|
using Artemis.Events;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
@ -46,14 +44,14 @@ namespace Artemis.ViewModels
|
|||||||
{
|
{
|
||||||
public sealed class ProfileEditorViewModel : Screen, IDropTarget
|
public sealed class ProfileEditorViewModel : Screen, IDropTarget
|
||||||
{
|
{
|
||||||
|
private readonly KeybindModel _copyKeybind;
|
||||||
private readonly DeviceManager _deviceManager;
|
private readonly DeviceManager _deviceManager;
|
||||||
private readonly MetroDialogService _dialogService;
|
private readonly MetroDialogService _dialogService;
|
||||||
private readonly LoopManager _loopManager;
|
private readonly LoopManager _loopManager;
|
||||||
private readonly ModuleModel _moduleModel;
|
private readonly ModuleModel _moduleModel;
|
||||||
private readonly KeybindModel _copyKeybind;
|
private readonly KeybindModel _pasteKeybind;
|
||||||
private ImageSource _keyboardPreview;
|
private ImageSource _keyboardPreview;
|
||||||
private ObservableCollection<LayerModel> _layers;
|
private ObservableCollection<LayerModel> _layers;
|
||||||
private readonly KeybindModel _pasteKeybind;
|
|
||||||
private ObservableCollection<string> _profileNames;
|
private ObservableCollection<string> _profileNames;
|
||||||
private bool _saving;
|
private bool _saving;
|
||||||
private LayerModel _selectedLayer;
|
private LayerModel _selectedLayer;
|
||||||
@ -348,9 +346,7 @@ namespace Artemis.ViewModels
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (SelectedLayer != null)
|
if (SelectedLayer != null)
|
||||||
{
|
|
||||||
SelectedLayer.InsertAfter(layerModel);
|
SelectedLayer.InsertAfter(layerModel);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SelectedProfile.Layers.Add(layerModel);
|
SelectedProfile.Layers.Add(layerModel);
|
||||||
@ -405,6 +401,9 @@ namespace Artemis.ViewModels
|
|||||||
if (_saving || SelectedProfile == null || _deviceManager.ChangingKeyboard)
|
if (_saving || SelectedProfile == null || _deviceManager.ChangingKeyboard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
SelectedProfile.Width = _deviceManager.ActiveKeyboard.Width;
|
||||||
|
SelectedProfile.Height = _deviceManager.ActiveKeyboard.Height;
|
||||||
|
|
||||||
_saving = true;
|
_saving = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -421,8 +420,7 @@ namespace Artemis.ViewModels
|
|||||||
{
|
{
|
||||||
if (_deviceManager.ActiveKeyboard == null)
|
if (_deviceManager.ActiveKeyboard == null)
|
||||||
{
|
{
|
||||||
_dialogService.ShowMessageBox("Cannot add profile.",
|
_dialogService.ShowMessageBox("Cannot add profile.", "To add a profile, please select a keyboard in the options menu first.");
|
||||||
"To add a profile, please select a keyboard in the options menu first.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,9 +699,7 @@ namespace Artemis.ViewModels
|
|||||||
: Cursors.SizeAll;
|
: Cursors.SizeAll;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
KeyboardPreviewCursor = Cursors.Hand;
|
KeyboardPreviewCursor = Cursors.Hand;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Point GetScaledPosition(MouseEventArgs e)
|
private Point GetScaledPosition(MouseEventArgs e)
|
||||||
@ -716,11 +712,11 @@ namespace Artemis.ViewModels
|
|||||||
var heightScale = sourceImage.ActualHeight / _deviceManager.ActiveKeyboard.PreviewSettings.BackgroundRectangle.Height;
|
var heightScale = sourceImage.ActualHeight / _deviceManager.ActiveKeyboard.PreviewSettings.BackgroundRectangle.Height;
|
||||||
|
|
||||||
// Remove the preview settings' offset from the cursor postion
|
// Remove the preview settings' offset from the cursor postion
|
||||||
pos.X = pos.X - (previewSettings.OverlayRectangle.X * widthScale);
|
pos.X = pos.X - previewSettings.OverlayRectangle.X * widthScale;
|
||||||
pos.Y = pos.Y - (previewSettings.OverlayRectangle.Y * heightScale);
|
pos.Y = pos.Y - previewSettings.OverlayRectangle.Y * heightScale;
|
||||||
|
|
||||||
// Scale the X and Y position down to match the keyboard's physical size and thus the layer positions
|
// Scale the X and Y position down to match the keyboard's physical size and thus the layer positions
|
||||||
pos.X = pos.X * (SelectedProfile.Width / (previewSettings.OverlayRectangle.Width*widthScale));
|
pos.X = pos.X * (SelectedProfile.Width / (previewSettings.OverlayRectangle.Width * widthScale));
|
||||||
pos.Y = pos.Y * (SelectedProfile.Height / (previewSettings.OverlayRectangle.Height * heightScale));
|
pos.Y = pos.Y * (SelectedProfile.Height / (previewSettings.OverlayRectangle.Height * heightScale));
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user