Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
VolcanicArts committed May 30, 2022
2 parents bdcff92 + e103ce2 commit 0ccf2f6
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 13 deletions.
6 changes: 3 additions & 3 deletions VRCOSC.Game/Modules/Frameworks/IntegrationModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public abstract class IntegrationModule : Module

private const int keyeventf_keyup = 0x0002;

protected virtual IReadOnlyDictionary<Enum, int[]> KeyCombinations => new Dictionary<Enum, int[]>();
protected virtual IReadOnlyDictionary<Enum, WindowsVKey[]> KeyCombinations => new Dictionary<Enum, WindowsVKey[]>();
protected virtual string TargetProcess => string.Empty;
protected virtual string ReturnProcess => "vrchat";

Expand Down Expand Up @@ -83,12 +83,12 @@ private void executeKeyCombination(Enum combinationKey)

foreach (var key in keys)
{
holdKey(key);
holdKey((int)key);
}

foreach (var key in keys)
{
releaseKey(key);
releaseKey((int)key);
}
}

Expand Down
44 changes: 44 additions & 0 deletions VRCOSC.Game/Modules/Frameworks/WindowsVKey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) VolcanicArts. Licensed under the GPL-3.0 License.
// See the LICENSE file in the repository root for full license text.

namespace VRCOSC.Game.Modules.Frameworks;

public enum WindowsVKey
{
VK_BACK = 0x08,
VK_TAB = 0x09,
VK_RETURN = 0x0D,
VK_SPACE = 0x20,
VK_LEFT = 0x25,
VK_UP = 0x26,
VK_RIGHT = 0x27,
VK_DOWN = 0x28,
VK_LSHIFT = 0xA0,
VK_LCONTROL = 0xA2,
VK_A = 0x41,
VK_B = 0x42,
VK_C = 0x43,
VK_D = 0x44,
VK_E = 0x45,
VK_F = 0x46,
VK_G = 0x47,
VK_H = 0x48,
VK_I = 0x49,
VK_J = 0x4A,
VK_K = 0x4B,
VK_L = 0x4C,
VK_M = 0x4D,
VK_N = 0x4E,
VK_O = 0x4F,
VK_P = 0x50,
VK_Q = 0x51,
VK_R = 0x52,
VK_S = 0x53,
VK_T = 0x54,
VK_U = 0x55,
VK_V = 0x56,
VK_W = 0x57,
VK_X = 0x58,
VK_Y = 0x59,
VK_Z = 0x5A
}
6 changes: 3 additions & 3 deletions VRCOSC.Game/Modules/Modules/Discord/DiscordModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public class DiscordModule : IntegrationModule

protected override string TargetProcess => "discord";

protected override IReadOnlyDictionary<Enum, int[]> KeyCombinations => new Dictionary<Enum, int[]>()
protected override IReadOnlyDictionary<Enum, WindowsVKey[]> KeyCombinations => new Dictionary<Enum, WindowsVKey[]>()
{
{ DiscordInputParameters.DiscordMic, new[] { 0xA2, 0xA0, 0x4D } },
{ DiscordInputParameters.DiscordDeafen, new[] { 0xA2, 0xA0, 0x44 } }
{ DiscordInputParameters.DiscordMic, new[] { WindowsVKey.VK_LCONTROL, WindowsVKey.VK_LSHIFT, WindowsVKey.VK_M } },
{ DiscordInputParameters.DiscordDeafen, new[] { WindowsVKey.VK_LCONTROL, WindowsVKey.VK_LSHIFT, WindowsVKey.VK_D } }
};

protected override void OnParameterReceived(Enum key, object value)
Expand Down
15 changes: 8 additions & 7 deletions VRCOSC.Game/Modules/Modules/Spotify/SpotifyModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using VRCOSC.Game.Modules.Frameworks;

Expand All @@ -13,7 +14,7 @@ public class SpotifyModule : IntegrationModule
public override string Title => "Spotify";
public override string Description => "Integration with the Spotify desktop app";
public override string Author => "VolcanicArts";
public override Colour4 Colour => Colour4.Green.Darken(0.5f);
public override Colour4 Colour => Color4Extensions.FromHex(@"1ed760").Darken(0.5f);
public override ModuleType Type => ModuleType.Integrations;

public override IReadOnlyCollection<Enum> InputParameters => new List<Enum>
Expand All @@ -27,13 +28,13 @@ public class SpotifyModule : IntegrationModule

protected override string TargetProcess => "spotify";

protected override IReadOnlyDictionary<Enum, int[]> KeyCombinations => new Dictionary<Enum, int[]>()
protected override IReadOnlyDictionary<Enum, WindowsVKey[]> KeyCombinations => new Dictionary<Enum, WindowsVKey[]>()
{
{ SpotifyInputParameters.SpotifyPlayPause, new[] { 0x20 } },
{ SpotifyInputParameters.SpotifyNext, new[] { 0xA2, 0x27 } },
{ SpotifyInputParameters.SpotifyPrevious, new[] { 0xA2, 0x25 } },
{ SpotifyInputParameters.SpotifyVolumeUp, new[] { 0xA2, 0x26 } },
{ SpotifyInputParameters.SpotifyVolumeDown, new[] { 0xA2, 0x28 } }
{ SpotifyInputParameters.SpotifyPlayPause, new[] { WindowsVKey.VK_SPACE } },
{ SpotifyInputParameters.SpotifyNext, new[] { WindowsVKey.VK_LCONTROL, WindowsVKey.VK_RIGHT } },
{ SpotifyInputParameters.SpotifyPrevious, new[] { WindowsVKey.VK_LCONTROL, WindowsVKey.VK_LEFT } },
{ SpotifyInputParameters.SpotifyVolumeUp, new[] { WindowsVKey.VK_LCONTROL, WindowsVKey.VK_UP } },
{ SpotifyInputParameters.SpotifyVolumeDown, new[] { WindowsVKey.VK_LCONTROL, WindowsVKey.VK_DOWN } }
};

protected override void OnParameterReceived(Enum key, object value)
Expand Down

0 comments on commit 0ccf2f6

Please sign in to comment.