Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions ControlUp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class ControlUpPlugin : GenericPlugin
private FullscreenTriggerMode _lastTriggerMode;
private bool _lastEnableHotkey;

private bool _gameRunning = false;

public ControlUpPlugin(IPlayniteAPI playniteAPI) : base(playniteAPI)
{
try
Expand Down Expand Up @@ -75,6 +77,18 @@ public ControlUpPlugin(IPlayniteAPI playniteAPI) : base(playniteAPI)

public override Guid Id => Guid.Parse("8d646e1b-c919-49d7-be40-5ef9960064bc");

public override void OnGameStarted (OnGameStartedEventArgs args)
{
_gameRunning = true;
_fileLogger?.Info($"Game started: {args.Game?.Name}");
}

public override void OnGameStopped(OnGameStoppedEventArgs args)
{
_gameRunning = false;
_fileLogger?.Info($"Game stopped: {args.Game?.Name}");
}

public override void OnApplicationStarted(OnApplicationStartedEventArgs args)
{
var currentMode = PlayniteApi.ApplicationInfo.Mode;
Expand All @@ -94,7 +108,7 @@ public override void OnApplicationStarted(OnApplicationStartedEventArgs args)
bool sdkConnected = connectedControllers != null && connectedControllers.Count > 0;
bool hidConnected = HidControllerDetector.IsAnyControllerConnected();
_controllerWasConnected = sdkConnected || hidConnected;

// Get controller name from SDK or HID (HID includes connection type)
string controllerName = null;
if (sdkConnected && connectedControllers.Count > 0)
Expand Down Expand Up @@ -156,10 +170,10 @@ public override void OnControllerConnected(OnControllerConnectedArgs args)
var controllerId = args.Controller?.InstanceId;
_fileLogger?.Info($"SDK OnControllerConnected: '{controllerName}' (ID: {controllerId})");

// Don't trigger if in fullscreen, popup showing, or disabled
if (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Fullscreen || _popupShowing)
// Don't trigger if in fullscreen, popup showing, game already running or disabled
if (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Fullscreen || _popupShowing || _gameRunning)
{
_fileLogger?.Info("Ignoring connection - fullscreen or popup showing");
_fileLogger?.Info("Ignoring connection - fullscreen, popup showing or game running");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion extension.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Id: ControlUp.8d646e1b-c919-49d7-be40-5ef9960064bc
Name: ControlUp
Author: Huddini
Version: 2.5.0
Version: 2.5.1
Module: ControlUp.dll
Type: GenericPlugin
Icon: icon.png
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.5.0
2.5.1