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
5cafa70d
There was an error fetching the commit references. Please try again later.
Commit
5cafa70d
authored
4 years ago
by
Morph
Browse files
Options
Downloads
Patches
Plain Diff
applets/controller: Auto accept a valid single player configuration
parent
484623cd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/yuzu/applets/controller.cpp
+18
-11
18 additions, 11 deletions
src/yuzu/applets/controller.cpp
src/yuzu/applets/controller.h
+5
-3
5 additions, 3 deletions
src/yuzu/applets/controller.h
src/yuzu/main.cpp
+1
-0
1 addition, 0 deletions
src/yuzu/main.cpp
with
24 additions
and
14 deletions
src/yuzu/applets/controller.cpp
+
18
−
11
View file @
5cafa70d
...
...
@@ -229,6 +229,13 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
connect
(
ui
->
buttonBox
,
&
QDialogButtonBox
::
accepted
,
this
,
&
QtControllerSelectorDialog
::
ApplyConfiguration
);
// Enhancement: Check if the parameters have already been met before disconnecting controllers.
// If all the parameters are met AND only allows a single player,
// stop the constructor here as we do not need to continue.
if
(
CheckIfParametersMet
()
&&
parameters
.
enable_single_mode
)
{
return
;
}
// If keep_controllers_connected is false, forcefully disconnect all controllers
if
(
!
parameters
.
keep_controllers_connected
)
{
for
(
auto
player
:
player_groupboxes
)
{
...
...
@@ -236,13 +243,18 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
}
}
CheckIfParametersMet
();
resize
(
0
,
0
);
}
QtControllerSelectorDialog
::~
QtControllerSelectorDialog
()
=
default
;
int
QtControllerSelectorDialog
::
exec
()
{
if
(
parameters_met
&&
parameters
.
enable_single_mode
)
{
return
QDialog
::
Accepted
;
}
return
QDialog
::
exec
();
}
void
QtControllerSelectorDialog
::
ApplyConfiguration
()
{
// Update the controller state once more, just to be sure they are properly applied.
for
(
std
::
size_t
index
=
0
;
index
<
NUM_PLAYERS
;
++
index
)
{
...
...
@@ -287,7 +299,7 @@ void QtControllerSelectorDialog::CallConfigureInputDialog() {
CheckIfParametersMet
();
}
void
QtControllerSelectorDialog
::
CheckIfParametersMet
()
{
bool
QtControllerSelectorDialog
::
CheckIfParametersMet
()
{
// Here, we check and validate the current configuration against all applicable parameters.
const
auto
num_connected_players
=
static_cast
<
int
>
(
std
::
count_if
(
player_groupboxes
.
begin
(),
player_groupboxes
.
end
(),
...
...
@@ -301,7 +313,7 @@ void QtControllerSelectorDialog::CheckIfParametersMet() {
num_connected_players
>
max_supported_players
)
{
parameters_met
=
false
;
ui
->
buttonBox
->
setEnabled
(
parameters_met
);
return
;
return
parameters_met
;
}
// Next, check against all connected controllers.
...
...
@@ -326,14 +338,9 @@ void QtControllerSelectorDialog::CheckIfParametersMet() {
return
true
;
}();
if
(
!
all_controllers_compatible
)
{
parameters_met
=
false
;
ui
->
buttonBox
->
setEnabled
(
parameters_met
);
return
;
}
parameters_met
=
true
;
parameters_met
=
all_controllers_compatible
;
ui
->
buttonBox
->
setEnabled
(
parameters_met
);
return
parameters_met
;
}
void
QtControllerSelectorDialog
::
SetSupportedControllers
()
{
...
...
This diff is collapsed.
Click to expand it.
src/yuzu/applets/controller.h
+
5
−
3
View file @
5cafa70d
...
...
@@ -33,6 +33,8 @@ public:
InputCommon
::
InputSubsystem
*
input_subsystem_
);
~
QtControllerSelectorDialog
()
override
;
int
exec
()
override
;
private:
// Applies the current configuration.
void
ApplyConfiguration
();
...
...
@@ -43,9 +45,9 @@ private:
// Initializes the "Configure Input" Dialog.
void
CallConfigureInputDialog
();
// Checks the current configuration against the given parameters
and
//
set
s the value of parameters_met.
void
CheckIfParametersMet
();
// Checks the current configuration against the given parameters
.
//
This sets and return
s the value of parameters_met.
bool
CheckIfParametersMet
();
// Sets the controller icons for "Supported Controller Types".
void
SetSupportedControllers
();
...
...
This diff is collapsed.
Click to expand it.
src/yuzu/main.cpp
+
1
−
0
View file @
5cafa70d
...
...
@@ -288,6 +288,7 @@ GMainWindow::~GMainWindow() {
void
GMainWindow
::
ControllerSelectorReconfigureControllers
(
const
Core
::
Frontend
::
ControllerParameters
&
parameters
)
{
QtControllerSelectorDialog
dialog
(
this
,
parameters
,
input_subsystem
.
get
());
dialog
.
setWindowFlags
(
Qt
::
Dialog
|
Qt
::
CustomizeWindowHint
|
Qt
::
WindowStaysOnTopHint
|
Qt
::
WindowTitleHint
|
Qt
::
WindowSystemMenuHint
);
dialog
.
setWindowModality
(
Qt
::
WindowModal
);
...
...
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