Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 76b8c79a4c | |||
| 5e8ba2c245 | |||
| 8b76295ee0 | |||
| e8025e175d | |||
| 8a22d9a942 | |||
| 344c1a5fef | |||
| a6dfbe9ec2 | |||
| 5f02765130 | |||
| 6619453aed | |||
| b442d32b7c | |||
| 033f305872 | |||
| bf869b0ee1 | |||
| 72d5af8b46 | |||
| cfe42563f2 | |||
| 5712e83a11 | |||
| 8e642f0fe9 | |||
| 5276991517 | |||
| 898153ae13 | |||
| 96e9e3611d | |||
| 9aa834c268 | |||
| 97dfeae99f | |||
| 740e35872d | |||
| 2c4236f733 | |||
| e945565259 | |||
| bdaaddb591 | |||
| 488b09f974 | |||
| f4c3a2e487 | |||
| eff11f52a8 | |||
| c21aa86a7b | |||
| 861531f431 | |||
| 6c0526c59f | |||
| e861204078 | |||
| 8904397685 |
@@ -42,7 +42,7 @@
|
|||||||
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.3-build14" />
|
<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.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
|
||||||
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.30.0-build32" />
|
<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="securifybv.ShellLink" Version="0.1.0" />
|
||||||
<PackageVersion Include="Sep" Version="0.6.0" />
|
<PackageVersion Include="Sep" Version="0.6.0" />
|
||||||
<PackageVersion Include="shaderc.net" Version="0.1.0" />
|
<PackageVersion Include="shaderc.net" Version="0.1.0" />
|
||||||
|
|||||||
@@ -1,62 +1,28 @@
|
|||||||
using Gommon;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Ryujinx.Common.Utilities
|
namespace Ryujinx.Common.Utilities
|
||||||
{
|
{
|
||||||
public static class Rainbow
|
public class Rainbow
|
||||||
{
|
{
|
||||||
public static bool CyclingEnabled { get; set; }
|
public const float Speed = 1;
|
||||||
|
|
||||||
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 static Color Color { get; private set; } = Color.Blue;
|
public static Color Color { get; private set; } = Color.Blue;
|
||||||
|
|
||||||
public static void Tick()
|
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()
|
public static event Action<int> RainbowColorUpdated;
|
||||||
{
|
|
||||||
Color = Color.Blue;
|
|
||||||
UpdatedHandler.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static event Action<int> Updated
|
private static Color HsbToRgb(float hue, float saturation, float brightness)
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
int r = 0, g = 0, b = 0;
|
int r = 0, g = 0, b = 0;
|
||||||
if (saturation == 0)
|
if (saturation == 0)
|
||||||
|
|||||||
@@ -148,8 +148,6 @@ namespace Ryujinx.Input.SDL2
|
|||||||
{
|
{
|
||||||
if (disposing && _gamepadHandle != nint.Zero)
|
if (disposing && _gamepadHandle != nint.Zero)
|
||||||
{
|
{
|
||||||
Rainbow.Updated -= RainbowColorChanged;
|
|
||||||
|
|
||||||
SDL_GameControllerClose(_gamepadHandle);
|
SDL_GameControllerClose(_gamepadHandle);
|
||||||
|
|
||||||
_gamepadHandle = nint.Zero;
|
_gamepadHandle = nint.Zero;
|
||||||
@@ -228,15 +226,6 @@ namespace Ryujinx.Input.SDL2
|
|||||||
|
|
||||||
private static Vector3 GsToMs2(Vector3 gs) => gs / SDL_STANDARD_GRAVITY;
|
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)
|
public void SetConfiguration(InputConfig configuration)
|
||||||
{
|
{
|
||||||
lock (_userMappingLock)
|
lock (_userMappingLock)
|
||||||
@@ -247,20 +236,11 @@ namespace Ryujinx.Input.SDL2
|
|||||||
{
|
{
|
||||||
if (_configuration.Led.TurnOffLed)
|
if (_configuration.Led.TurnOffLed)
|
||||||
(this as IGamepad).ClearLed();
|
(this as IGamepad).ClearLed();
|
||||||
else switch (_configuration.Led.UseRainbow)
|
else if (_configuration.Led.UseRainbow)
|
||||||
{
|
Rainbow.RainbowColorUpdated += clr => SetLed((uint)clr);
|
||||||
case true when !_rainbowColorEnabled:
|
else
|
||||||
Rainbow.Updated += RainbowColorChanged;
|
|
||||||
_rainbowColorEnabled = true;
|
|
||||||
break;
|
|
||||||
case false when _rainbowColorEnabled:
|
|
||||||
Rainbow.Updated -= RainbowColorChanged;
|
|
||||||
_rainbowColorEnabled = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_configuration.Led.TurnOffLed && !_rainbowColorEnabled)
|
|
||||||
SetLed(_configuration.Led.LedColor);
|
SetLed(_configuration.Led.LedColor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_buttonsUserMapping.Clear();
|
_buttonsUserMapping.Clear();
|
||||||
|
|||||||
@@ -168,6 +168,8 @@ namespace Ryujinx.SDL2.Common
|
|||||||
HandleSDLEvent(ref evnt);
|
HandleSDLEvent(ref evnt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Rainbow.Tick();
|
||||||
|
|
||||||
waitHandle.Wait(WaitTimeMs);
|
waitHandle.Wait(WaitTimeMs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -501,8 +501,6 @@ namespace Ryujinx.Ava
|
|||||||
_renderingThread.Start();
|
_renderingThread.Start();
|
||||||
|
|
||||||
_viewModel.Volume = ConfigurationState.Instance.System.AudioVolume.Value;
|
_viewModel.Volume = ConfigurationState.Instance.System.AudioVolume.Value;
|
||||||
|
|
||||||
Rainbow.Enable();
|
|
||||||
|
|
||||||
MainLoop();
|
MainLoop();
|
||||||
|
|
||||||
@@ -592,11 +590,7 @@ namespace Ryujinx.Ava
|
|||||||
foreach (IGamepad gamepad in RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepads())
|
foreach (IGamepad gamepad in RyujinxApp.MainWindow.InputManager.GamepadDriver.GetGamepads())
|
||||||
{
|
{
|
||||||
gamepad?.ClearLed();
|
gamepad?.ClearLed();
|
||||||
gamepad?.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rainbow.Disable();
|
|
||||||
Rainbow.Reset();
|
|
||||||
|
|
||||||
_isStopped = true;
|
_isStopped = true;
|
||||||
Stop();
|
Stop();
|
||||||
|
|||||||
@@ -118,8 +118,6 @@ namespace Ryujinx.Ava
|
|||||||
OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion));
|
OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Up to date.");
|
|
||||||
|
|
||||||
_running = false;
|
_running = false;
|
||||||
|
|
||||||
@@ -190,8 +188,6 @@ namespace Ryujinx.Ava
|
|||||||
OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion));
|
OpenHelper.OpenUrl(ReleaseInformation.GetChangelogForVersion(currentVersion));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.Application, "Up to date.");
|
|
||||||
|
|
||||||
_running = false;
|
_running = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user