Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
3b4da2d7
There was an error fetching the commit references. Please try again later.
Commit
3b4da2d7
authored
4 years ago
by
german
Browse files
Options
Downloads
Patches
Plain Diff
Fix connect and disconnect controller events
parent
e7c1d7bf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/yuzu/configuration/configure_input.cpp
+5
-1
5 additions, 1 deletion
src/yuzu/configuration/configure_input.cpp
src/yuzu/configuration/configure_input_player.cpp
+32
-14
32 additions, 14 deletions
src/yuzu/configuration/configure_input_player.cpp
with
37 additions
and
15 deletions
src/yuzu/configuration/configure_input.cpp
+
5
−
1
View file @
3b4da2d7
...
...
@@ -190,12 +190,16 @@ void ConfigureInput::ApplyConfiguration() {
// This emulates a delay between disconnecting and reconnecting controllers as some games
// do not respond to a change in controller type if it was instantaneous.
using
namespace
std
::
chrono_literals
;
std
::
this_thread
::
sleep_for
(
6
0ms
);
std
::
this_thread
::
sleep_for
(
15
0ms
);
for
(
auto
*
controller
:
player_controllers
)
{
controller
->
TryConnectSelectedController
();
}
// This emulates a delay between disconnecting and reconnecting controllers as some games
// do not respond to a change in controller type if it was instantaneous.
std
::
this_thread
::
sleep_for
(
150ms
);
advanced
->
ApplyConfiguration
();
const
bool
pre_docked_mode
=
Settings
::
values
.
use_docked_mode
.
GetValue
();
...
...
This diff is collapsed.
Click to expand it.
src/yuzu/configuration/configure_input_player.cpp
+
32
−
14
View file @
3b4da2d7
...
...
@@ -579,11 +579,11 @@ void ConfigureInputPlayer::ApplyConfiguration() {
// Apply configuration for handheld
if
(
player_index
==
0
)
{
auto
&
handheld
=
Settings
::
values
.
players
.
GetValue
()[
HANDHELD_INDEX
];
const
auto
handheld_connected
=
handheld
.
connected
;
if
(
player
.
controller_type
==
Settings
::
ControllerType
::
Handheld
)
{
handheld
=
player
;
}
handheld
.
connected
=
ui
->
groupConnectedController
->
isChecked
()
&&
player
.
controller_type
==
Settings
::
ControllerType
::
Handheld
;
handheld
.
connected
=
handheld_connected
;
}
}
...
...
@@ -595,6 +595,18 @@ void ConfigureInputPlayer::TryConnectSelectedController() {
const
auto
player_connected
=
ui
->
groupConnectedController
->
isChecked
()
&&
controller_type
!=
Settings
::
ControllerType
::
Handheld
;
// Connect Handheld depending on Player 1's controller configuration.
if
(
player_index
==
0
&&
controller_type
==
Settings
::
ControllerType
::
Handheld
)
{
auto
&
handheld
=
Settings
::
values
.
players
.
GetValue
()[
HANDHELD_INDEX
];
const
auto
handheld_connected
=
ui
->
groupConnectedController
->
isChecked
()
&&
controller_type
==
Settings
::
ControllerType
::
Handheld
;
// Connect only if handheld is going from disconnected to connected
if
(
!
handheld
.
connected
&&
handheld_connected
)
{
UpdateController
(
controller_type
,
HANDHELD_INDEX
,
true
);
}
handheld
.
connected
=
handheld_connected
;
}
if
(
player
.
controller_type
==
controller_type
&&
player
.
connected
==
player_connected
)
{
// Set vibration devices in the event that the input device has changed.
ConfigureVibration
::
SetVibrationDevices
(
player_index
);
...
...
@@ -606,22 +618,11 @@ void ConfigureInputPlayer::TryConnectSelectedController() {
ConfigureVibration
::
SetVibrationDevices
(
player_index
);
// Connect/Disconnect Handheld depending on Player 1's controller configuration.
if
(
player_index
==
0
)
{
auto
&
handheld
=
Settings
::
values
.
players
.
GetValue
()[
HANDHELD_INDEX
];
if
(
controller_type
==
Settings
::
ControllerType
::
Handheld
)
{
handheld
=
player
;
}
handheld
.
connected
=
ui
->
groupConnectedController
->
isChecked
()
&&
controller_type
==
Settings
::
ControllerType
::
Handheld
;
UpdateController
(
Settings
::
ControllerType
::
Handheld
,
HANDHELD_INDEX
,
handheld
.
connected
);
}
if
(
!
player
.
connected
)
{
return
;
}
UpdateController
(
controller_type
,
player_index
,
player_connected
);
UpdateController
(
controller_type
,
player_index
,
true
);
}
void
ConfigureInputPlayer
::
TryDisconnectSelectedController
()
{
...
...
@@ -632,11 +633,28 @@ void ConfigureInputPlayer::TryDisconnectSelectedController() {
const
auto
player_connected
=
ui
->
groupConnectedController
->
isChecked
()
&&
controller_type
!=
Settings
::
ControllerType
::
Handheld
;
// Disconnect Handheld depending on Player 1's controller configuration.
if
(
player_index
==
0
&&
player
.
controller_type
==
Settings
::
ControllerType
::
Handheld
)
{
const
auto
&
handheld
=
Settings
::
values
.
players
.
GetValue
()[
HANDHELD_INDEX
];
const
auto
handheld_connected
=
ui
->
groupConnectedController
->
isChecked
()
&&
controller_type
==
Settings
::
ControllerType
::
Handheld
;
// Disconnect only if handheld is going from connected to disconnected
if
(
handheld
.
connected
&&
!
handheld_connected
)
{
UpdateController
(
controller_type
,
HANDHELD_INDEX
,
false
);
}
return
;
}
// Do not do anything if the controller configuration has not changed.
if
(
player
.
controller_type
==
controller_type
&&
player
.
connected
==
player_connected
)
{
return
;
}
// Do not disconnect if the controller is already disconnected
if
(
!
player
.
connected
)
{
return
;
}
// Disconnect the controller first.
UpdateController
(
controller_type
,
player_index
,
false
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment