Compare commits

..

33 Commits

Author SHA1 Message Date
Evan Husted
76b8c79a4c Merge branch 'master' into Change-Controller-LED-Color 2025-01-24 13:42:44 -06:00
Evan Husted
5e8ba2c245 cleanup testing changes 2025-01-24 13:12:55 -06:00
Evan Husted
8b76295ee0 forgot to use the new locale key 2025-01-24 13:10:39 -06:00
Evan Husted
e8025e175d Rainbow LED 2025-01-24 13:03:10 -06:00
Evan Husted
8a22d9a942 tab 2025-01-23 22:58:08 -06:00
Evan Husted
344c1a5fef Clear LED on game close as well 2025-01-23 21:59:54 -06:00
Evan Husted
a6dfbe9ec2 Clear the LED on all controllers when settings window is closed and when input view is removed from the visual tree. 2025-01-23 21:39:19 -06:00
Evan Husted
5f02765130 Allow the ability to turn off the LED entirely
Only works for DualSense; in my testing, my DualShock 4 ignored the requests to set the LED to off.
2025-01-23 20:29:59 -06:00
Evan Husted
6619453aed Check if controller supports Rumble rather than trying to rumble for 100ms 2025-01-23 19:32:36 -06:00
Evan Husted
b442d32b7c directly compare result of rumble instead of storing an error int 2025-01-23 19:30:11 -06:00
Evan Husted
033f305872 log line to match other optional gamepad features 2025-01-23 19:28:26 -06:00
Evan Husted
bf869b0ee1 Properly save default 2025-01-23 19:18:29 -06:00
Evan Husted
72d5af8b46 Update LED as its changed in the UI 2025-01-23 19:02:35 -06:00
Evan Husted
cfe42563f2 Add the LED functionality to the base IGamepad interface 2025-01-23 18:33:52 -06:00
Evan Husted
5712e83a11 UI: enable LED changing 2025-01-23 17:22:25 -06:00
Evan Husted
8e642f0fe9 Merge branch 'master' into Change-Controller-LED-Color 2025-01-23 17:19:15 -06:00
Evan Husted
5276991517 Update SDL2Gamepad.cs 2025-01-22 22:37:03 -06:00
Evan Husted
898153ae13 Update SDL2Gamepad.cs 2025-01-22 22:35:09 -06:00
mika
96e9e3611d move logic around 2025-01-23 05:29:18 +01:00
mika
9aa834c268 maybe this works 2025-01-23 05:02:11 +01:00
mika
97dfeae99f test2 2025-01-23 04:24:01 +01:00
mika
740e35872d test 2025-01-23 03:40:45 +01:00
mika
2c4236f733 test 2025-01-23 03:39:33 +01:00
mika
e945565259 just testing if git works 2025-01-23 03:38:00 +01:00
mika
bdaaddb591 just testing if git is working 2025-01-23 03:38:00 +01:00
Otozinclus
488b09f974 Check if controller has a controllable LED 2025-01-23 03:38:00 +01:00
Evan Husted
f4c3a2e487 fix formatting & styling 2025-01-23 03:37:59 +01:00
Otozinclus
eff11f52a8 Change controller LED color
This changes the controller LED color. Now I need to add the option to change it in the settings
2025-01-23 03:37:59 +01:00
mika
c21aa86a7b just testing if git works 2025-01-23 00:09:07 +01:00
mika
861531f431 just testing if git is working 2025-01-23 00:06:24 +01:00
Otozinclus
6c0526c59f Check if controller has a controllable LED 2025-01-22 23:18:41 +01:00
Evan Husted
e861204078 fix formatting & styling 2025-01-22 16:04:57 -06:00
Otozinclus
8904397685 Change controller LED color
This changes the controller LED color. Now I need to add the option to change it in the settings
2025-01-22 21:55:53 +01:00
6 changed files with 18 additions and 80 deletions

View File

@@ -42,7 +42,7 @@
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.3-build14" />
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.30.0-build32" />
<PackageVersion Include="Gommon" Version="2.7.1" />
<PackageVersion Include="Gommon" Version="2.7.0.2" />
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
<PackageVersion Include="Sep" Version="0.6.0" />
<PackageVersion Include="shaderc.net" Version="0.1.0" />

View File

@@ -1,62 +1,28 @@
using Gommon;
using System;
using System;
using System.Drawing;
using System.Threading.Tasks;
namespace Ryujinx.Common.Utilities
{
public static class Rainbow
public class Rainbow
{
public static bool CyclingEnabled { get; set; }
public static void Enable()
{
if (!CyclingEnabled)
{
CyclingEnabled = true;
Executor.ExecuteBackgroundAsync(async () =>
{
while (CyclingEnabled)
{
await Task.Delay(15);
Tick();
}
});
}
}
public static void Disable()
{
CyclingEnabled = false;
}
public static float Speed { get; set; } = 1;
public const float Speed = 1;
public static Color Color { get; private set; } = Color.Blue;
public static void Tick()
{
Color = HsbToRgb((Color.GetHue() + Speed) / 360);
Color = HsbToRgb(
(Color.GetHue() + Speed) / 360,
1,
1
);
UpdatedHandler.Call(Color.ToArgb());
RainbowColorUpdated?.Invoke(Color.ToArgb());
}
public static void Reset()
{
Color = Color.Blue;
UpdatedHandler.Clear();
}
public static event Action<int> RainbowColorUpdated;
public static event Action<int> Updated
{
add => UpdatedHandler.Add(value);
remove => UpdatedHandler.Remove(value);
}
internal static Event<int> UpdatedHandler = new();
private static Color HsbToRgb(float hue, float saturation = 1, float brightness = 1)
private static Color HsbToRgb(float hue, float saturation, float brightness)
{
int r = 0, g = 0, b = 0;
if (saturation == 0)

View File

@@ -148,8 +148,6 @@ namespace Ryujinx.Input.SDL2
{
if (disposing && _gamepadHandle != nint.Zero)
{
Rainbow.Updated -= RainbowColorChanged;
SDL_GameControllerClose(_gamepadHandle);
_gamepadHandle = nint.Zero;
@@ -228,15 +226,6 @@ namespace Ryujinx.Input.SDL2
private static Vector3 GsToMs2(Vector3 gs) => gs / SDL_STANDARD_GRAVITY;
private void RainbowColorChanged(int packedRgb)
{
if (!_configuration.Led.UseRainbow) return;
SetLed((uint)packedRgb);
}
private bool _rainbowColorEnabled;
public void SetConfiguration(InputConfig configuration)
{
lock (_userMappingLock)
@@ -247,20 +236,11 @@ namespace Ryujinx.Input.SDL2
{
if (_configuration.Led.TurnOffLed)
(this as IGamepad).ClearLed();
else switch (_configuration.Led.UseRainbow)
{
case true when !_rainbowColorEnabled:
Rainbow.Updated += RainbowColorChanged;
_rainbowColorEnabled = true;
break;
case false when _rainbowColorEnabled:
Rainbow.Updated -= RainbowColorChanged;
_rainbowColorEnabled = false;
break;
}
if (!_configuration.Led.TurnOffLed && !_rainbowColorEnabled)
else if (_configuration.Led.UseRainbow)
Rainbow.RainbowColorUpdated += clr => SetLed((uint)clr);
else
SetLed(_configuration.Led.LedColor);
}
_buttonsUserMapping.Clear();

View File

@@ -168,6 +168,8 @@ namespace Ryujinx.SDL2.Common
HandleSDLEvent(ref evnt);
}
});
Rainbow.Tick();
waitHandle.Wait(WaitTimeMs);
}

View File

@@ -501,8 +501,6 @@ namespace Ryujinx.Ava
_renderingThread.Start();
_viewModel.Volume = ConfigurationState.Instance.System.AudioVolume.Value;
Rainbow.Enable();
MainLoop();
@@ -592,11 +590,7 @@ namespace Ryujinx.Ava
foreach (IGamepad gamepad in RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepads())
{
gamepad?.ClearLed();
gamepad?.Dispose();
}
Rainbow.Disable();
Rainbow.Reset();
_isStopped = true;
Stop();

View File

@@ -118,8 +118,6 @@ namespace Ryujinx.Ava
OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion));
}
}
Logger.Info?.Print(LogClass.Application, "Up to date.");
_running = false;
@@ -190,8 +188,6 @@ namespace Ryujinx.Ava
OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion));
}
}
Logger.Info?.Print(LogClass.Application, "Up to date.");
_running = false;