Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure gamepads connect automatically to first player without controller #405

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jphautin
Copy link

@jphautin jphautin commented Dec 19, 2024

This PR aims to manage better controller connection/disconnection.

The aim is to update the the input view when the gamepad is connected or disconnected accordingly.
and to map new gamepad connected to first player without any controller setup.

Also take into account some steamOS specific behavior (remove Steam virtual pad from list of available gamepads).

@github-actions github-actions bot added the gui Affects the Avalonia UI or translations. label Dec 19, 2024
Copy link
Member

@GreemDev GreemDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, there's differing levels of indentation in places, such as in LinkDevicesToPlayers.
Each level of indentation should be equivalent to 4 spaces.

}
}

private List<Tuple<string,string>> getGamepadsDescriptions() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetGamepadsDescriptions

@@ -41,6 +46,76 @@ protected virtual void Dispose(bool disposing)
}
}

private void removeSDPWhenExternalPadsConnected(List<Tuple<string,string>> availableDevices) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RemoveSdpWhenExternalPadsConnected


//update Device for current user based on new configuration.
var config = ConfigurationState.Instance.Hid.InputConfig.Value.Find(inputConfig => inputConfig.PlayerIndex == PlayerId);
var device = Devices.FindFirst(d => d.Id==config.Id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply proper spacing.

var config = ConfigurationState.Instance.Hid.InputConfig.Value.Find(inputConfig => inputConfig.PlayerIndex == PlayerId);
var device = Devices.FindFirst(d => d.Id==config.Id);
if (device.HasValue) {
Device=Devices.IndexOf(device);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gui Affects the Avalonia UI or translations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants