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
f4f64cc1
There was an error fetching the commit references. Please try again later.
Commit
f4f64cc1
authored
7 years ago
by
muemart
Committed by
noah katz
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add button labels for sdl joystick mappings
parent
f10a7081
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/yuzu/configuration/configure_input.cpp
+46
-17
46 additions, 17 deletions
src/yuzu/configuration/configure_input.cpp
with
46 additions
and
17 deletions
src/yuzu/configuration/configure_input.cpp
+
46
−
17
View file @
f4f64cc1
...
@@ -166,34 +166,63 @@ void ConfigureInput::restoreDefaults() {
...
@@ -166,34 +166,63 @@ void ConfigureInput::restoreDefaults() {
}
}
void
ConfigureInput
::
updateButtonLabels
()
{
void
ConfigureInput
::
updateButtonLabels
()
{
QString
non_
keyboard
(
tr
(
"[non-keyboard
]"
));
QString
unk
no
w
n_
mapping
(
tr
(
"[unknown
]"
));
auto
Key
ToText
=
[
&
non_
keyboard
](
const
Common
::
ParamPackage
&
param
)
{
auto
Button
ToText
=
[
&
unk
no
w
n_
mapping
](
const
Common
::
ParamPackage
&
param
)
{
if
(
!
param
.
Has
(
"engine"
))
{
if
(
!
param
.
Has
(
"engine"
))
{
return
QString
(
"[not set]"
);
return
QString
(
"[not set]"
);
}
else
if
(
param
.
Get
(
"engine"
,
""
)
!=
"keyboard"
)
{
}
else
if
(
param
.
Get
(
"engine"
,
""
)
==
"keyboard"
)
{
return
non_keyboard
;
}
else
{
return
getKeyName
(
param
.
Get
(
"code"
,
0
));
return
getKeyName
(
param
.
Get
(
"code"
,
0
));
}
else
if
(
param
.
Get
(
"engine"
,
""
)
==
"sdl"
)
{
QString
text
=
QString
(
"Joystick %1"
).
arg
(
param
.
Get
(
"joystick"
,
""
).
c_str
());
if
(
param
.
Has
(
"hat"
))
{
text
+=
QString
(
" Hat %1 %2"
)
.
arg
(
param
.
Get
(
"hat"
,
""
).
c_str
(),
param
.
Get
(
"direction"
,
""
).
c_str
());
}
if
(
param
.
Has
(
"axis"
))
{
text
+=
QString
(
" Axis %1%2"
)
.
arg
(
param
.
Get
(
"axis"
,
""
).
c_str
(),
param
.
Get
(
"direction"
,
""
).
c_str
());
}
if
(
param
.
Has
(
"button"
))
{
text
+=
QString
(
" Button %1"
).
arg
(
param
.
Get
(
"button"
,
""
).
c_str
());
}
return
text
;
}
else
{
return
unknown_mapping
;
}
};
auto
AnalogToText
=
[
&
unknown_mapping
,
&
ButtonToText
](
const
Common
::
ParamPackage
&
param
,
const
std
::
string
&
dir
)
{
if
(
!
param
.
Has
(
"engine"
))
{
return
QString
(
"[not set]"
);
}
else
if
(
param
.
Get
(
"engine"
,
""
)
==
"analog_from_button"
)
{
return
ButtonToText
(
Common
::
ParamPackage
{
param
.
Get
(
dir
,
""
)});
}
else
if
(
param
.
Get
(
"engine"
,
""
)
==
"sdl"
)
{
if
(
dir
==
"modifier"
)
{
return
QString
(
"[unused]"
);
}
QString
text
=
QString
(
"Joystick %1"
).
arg
(
param
.
Get
(
"joystick"
,
""
).
c_str
());
if
(
dir
==
"left"
||
dir
==
"right"
)
{
text
+=
QString
(
" Axis %1"
).
arg
(
param
.
Get
(
"axis_x"
,
""
).
c_str
());
}
else
if
(
dir
==
"up"
||
dir
==
"down"
)
{
text
+=
QString
(
" Axis %1"
).
arg
(
param
.
Get
(
"axis_y"
,
""
).
c_str
());
}
return
text
;
}
else
{
return
unknown_mapping
;
}
}
};
};
for
(
int
button
=
0
;
button
<
Settings
::
NativeButton
::
NumButtons
;
button
++
)
{
for
(
int
button
=
0
;
button
<
Settings
::
NativeButton
::
NumButtons
;
button
++
)
{
button_map
[
button
]
->
setText
(
Key
ToText
(
buttons_param
[
button
]));
button_map
[
button
]
->
setText
(
Button
ToText
(
buttons_param
[
button
]));
}
}
for
(
int
analog_id
=
0
;
analog_id
<
Settings
::
NativeAnalog
::
NumAnalogs
;
analog_id
++
)
{
for
(
int
analog_id
=
0
;
analog_id
<
Settings
::
NativeAnalog
::
NumAnalogs
;
analog_id
++
)
{
if
(
analogs_param
[
analog_id
].
Get
(
"engine"
,
""
)
!=
"analog_from_button"
)
{
for
(
int
sub_button_id
=
0
;
sub_button_id
<
ANALOG_SUB_BUTTONS_NUM
;
sub_button_id
++
)
{
for
(
QPushButton
*
button
:
analog_map_buttons
[
analog_id
])
{
if
(
analog_map_buttons
[
analog_id
][
sub_button_id
])
{
if
(
button
)
analog_map_buttons
[
analog_id
][
sub_button_id
]
->
setText
(
button
->
setText
(
non_keyboard
);
AnalogToText
(
analogs_param
[
analog_id
],
analog_sub_buttons
[
sub_button_id
]));
}
}
else
{
for
(
int
sub_button_id
=
0
;
sub_button_id
<
ANALOG_SUB_BUTTONS_NUM
;
sub_button_id
++
)
{
Common
::
ParamPackage
param
(
analogs_param
[
analog_id
].
Get
(
analog_sub_buttons
[
sub_button_id
],
""
));
if
(
analog_map_buttons
[
analog_id
][
sub_button_id
])
analog_map_buttons
[
analog_id
][
sub_button_id
]
->
setText
(
KeyToText
(
param
));
}
}
}
}
analog_map_stick
[
analog_id
]
->
setText
(
"Set Analog Stick"
);
analog_map_stick
[
analog_id
]
->
setText
(
"Set Analog Stick"
);
...
...
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