Added a PlayStation 3 controller type.

This commit is contained in:
Leon Styhre 2023-01-21 11:02:32 +01:00
parent 46265bb774
commit c5507f5f80
6 changed files with 148 additions and 2 deletions

View file

@ -1087,6 +1087,7 @@ void GuiMenu::openInputDeviceOptions()
std::string selectedPlayer {Settings::getInstance()->getString("InputControllerType")}; std::string selectedPlayer {Settings::getInstance()->getString("InputControllerType")};
inputControllerType->add("XBOX", "xbox", selectedPlayer == "xbox"); inputControllerType->add("XBOX", "xbox", selectedPlayer == "xbox");
inputControllerType->add("XBOX 360", "xbox360", selectedPlayer == "xbox360"); inputControllerType->add("XBOX 360", "xbox360", selectedPlayer == "xbox360");
inputControllerType->add("PLAYSTATION 3", "ps3", selectedPlayer == "ps3");
inputControllerType->add("PLAYSTATION 4", "ps4", selectedPlayer == "ps4"); inputControllerType->add("PLAYSTATION 4", "ps4", selectedPlayer == "ps4");
inputControllerType->add("PLAYSTATION 5", "ps5", selectedPlayer == "ps5"); inputControllerType->add("PLAYSTATION 5", "ps5", selectedPlayer == "ps5");
inputControllerType->add("SNES", "snes", selectedPlayer == "snes"); inputControllerType->add("SNES", "snes", selectedPlayer == "snes");

View file

@ -126,6 +126,10 @@ void HelpStyle::applyTheme(const std::shared_ptr<ThemeData>& theme, const std::s
mCustomButtons.button_x_PS = elem->get<std::string>(PREFIX "button_x_PS"); mCustomButtons.button_x_PS = elem->get<std::string>(PREFIX "button_x_PS");
if (elem->has(PREFIX "button_y_PS")) if (elem->has(PREFIX "button_y_PS"))
mCustomButtons.button_y_PS = elem->get<std::string>(PREFIX "button_y_PS"); mCustomButtons.button_y_PS = elem->get<std::string>(PREFIX "button_y_PS");
if (elem->has(PREFIX "button_start_PS3"))
mCustomButtons.button_start_PS3 = elem->get<std::string>(PREFIX "button_start_PS3");
if (elem->has(PREFIX "button_back_PS3"))
mCustomButtons.button_back_PS3 = elem->get<std::string>(PREFIX "button_back_PS3");
if (elem->has(PREFIX "button_start_PS4")) if (elem->has(PREFIX "button_start_PS4"))
mCustomButtons.button_start_PS4 = elem->get<std::string>(PREFIX "button_start_PS4"); mCustomButtons.button_start_PS4 = elem->get<std::string>(PREFIX "button_start_PS4");
if (elem->has(PREFIX "button_back_PS4")) if (elem->has(PREFIX "button_back_PS4"))

View file

@ -57,6 +57,8 @@ struct HelpStyle {
std::string button_b_PS; std::string button_b_PS;
std::string button_x_PS; std::string button_x_PS;
std::string button_y_PS; std::string button_y_PS;
std::string button_start_PS3;
std::string button_back_PS3;
std::string button_start_PS4; std::string button_start_PS4;
std::string button_back_PS4; std::string button_back_PS4;
std::string button_start_PS5; std::string button_start_PS5;

View file

@ -81,6 +81,26 @@ void HelpComponent::assignIcons()
":/graphics/help/button_back_SNES.svg" : ":/graphics/help/button_back_SNES.svg" :
mStyle.mCustomButtons.button_back_SNES; mStyle.mCustomButtons.button_back_SNES;
} }
else if (controllerType == "ps3") {
sIconPathMap["a"] = mStyle.mCustomButtons.button_a_PS.empty() ?
":/graphics/help/button_a_PS.svg" :
mStyle.mCustomButtons.button_a_PS;
sIconPathMap["b"] = mStyle.mCustomButtons.button_b_PS.empty() ?
":/graphics/help/button_b_PS.svg" :
mStyle.mCustomButtons.button_b_PS;
sIconPathMap["x"] = mStyle.mCustomButtons.button_x_PS.empty() ?
":/graphics/help/button_x_PS.svg" :
mStyle.mCustomButtons.button_x_PS;
sIconPathMap["y"] = mStyle.mCustomButtons.button_y_PS.empty() ?
":/graphics/help/button_y_PS.svg" :
mStyle.mCustomButtons.button_y_PS;
sIconPathMap["start"] = mStyle.mCustomButtons.button_start_PS3.empty() ?
":/graphics/help/button_start_PS3.svg" :
mStyle.mCustomButtons.button_start_PS3;
sIconPathMap["back"] = mStyle.mCustomButtons.button_back_PS3.empty() ?
":/graphics/help/button_back_PS3.svg" :
mStyle.mCustomButtons.button_back_PS3;
}
else if (controllerType == "ps4") { else if (controllerType == "ps4") {
sIconPathMap["a"] = mStyle.mCustomButtons.button_a_PS.empty() ? sIconPathMap["a"] = mStyle.mCustomButtons.button_a_PS.empty() ?
":/graphics/help/button_a_PS.svg" : ":/graphics/help/button_a_PS.svg" :
@ -169,11 +189,10 @@ void HelpComponent::assignIcons()
while (it != sIconPathMap.end()) { while (it != sIconPathMap.end()) {
if (sIconPathMapOld.find(it->first) != sIconPathMapOld.end()) { if (sIconPathMapOld.find(it->first) != sIconPathMapOld.end()) {
if (sIconPathMapOld[it->first] != sIconPathMap[it->first]) { if (sIconPathMapOld[it->first] != sIconPathMap[it->first]) {
if (mIconCache.find(it->first) != mIconCache.end()) { if (mIconCache.find(it->first) != mIconCache.end())
mIconCache.erase(mIconCache.find(it->first)); mIconCache.erase(mIconCache.find(it->first));
} }
} }
}
++it; ++it;
} }
} }

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="64"
height="64"
version="1.1"
viewBox="0 0 64 64"
id="svg16"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata
id="metadata22">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs20" />
<path
id="path90-1"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.91696"
d="M 49.7662,54.555529 H 12.593712 c -0.446935,0 -0.813119,-0.377677 -0.813119,-0.847327 V 32.235458 c 0,-0.467692 0.366184,-0.845369 0.813119,-0.845369 H 49.7662 c 0.450691,0 0.811242,0.377677 0.811242,0.845369 v 21.472744 c 0,0.46965 -0.360551,0.847327 -0.811242,0.847327" />
<g
aria-label="SELECT"
transform="matrix(0.99468914,0,0,1.2611939,-3.8413711,-9.2427933)"
style="font-style:normal;font-weight:normal;font-size:15.6108px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.390271"
id="text4763-3">
<path
d="m 14.903226,22.465529 q 0,1.577853 -1.173862,2.416325 -1.16624,0.830851 -3.430116,0.830851 -2.0656916,0 -3.2395534,-0.731758 -1.1738617,-0.731758 -1.5092508,-2.218142 l 2.1724065,-0.358256 q 0.2210519,0.853717 0.8613401,1.242464 0.6402883,0.381124 1.7760376,0.381124 2.355346,0 2.355346,-1.433026 0,-0.457349 -0.274409,-0.754626 Q 12.174378,21.543209 11.678917,21.345024 11.191078,21.14684 9.7961646,20.864808 8.5918129,20.582776 8.1192192,20.415082 7.6466255,20.239765 7.2655016,20.01109 6.8843776,19.774793 6.6175909,19.447027 6.3508041,19.11926 6.1983545,18.677157 6.0535274,18.235053 6.0535274,17.663367 q 0,-1.455894 1.0900145,-2.225764 1.097637,-0.777493 3.1861961,-0.777493 1.99709,0 2.995634,0.625043 1.006168,0.625044 1.295822,2.065692 l -2.180029,0.297277 q -0.167695,-0.693646 -0.686023,-1.04428 -0.510706,-0.350634 -1.471139,-0.350634 -2.0428241,0 -2.0428241,1.280577 0,0.419236 0.2134294,0.686023 0.2210519,0.266787 0.6479107,0.457349 0.4268588,0.182939 1.730303,0.464971 1.547363,0.327766 2.210519,0.609798 0.670778,0.274409 1.059524,0.647911 0.388747,0.365879 0.594554,0.884207 0.205807,0.510706 0.205807,1.181485 z"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ffffff;fill-opacity:1;stroke-width:0.390271"
id="path4746-6" />
<path
d="M 16.557303,25.560255 V 14.820182 h 8.445707 v 1.737925 h -6.197076 v 2.698358 h 5.732105 v 1.737925 h -5.732105 v 2.82794 h 6.509597 v 1.737925 z"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ffffff;fill-opacity:1;stroke-width:0.390271"
id="path4748-7" />
<path
d="M 26.969609,25.560255 V 14.820182 h 2.248631 v 9.002148 h 5.762594 v 1.737925 z"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ffffff;fill-opacity:1;stroke-width:0.390271"
id="path4750-5" />
<path
d="M 36.50533,25.560255 V 14.820182 h 8.445706 v 1.737925 h -6.197075 v 2.698358 h 5.732104 v 1.737925 h -5.732104 v 2.82794 h 6.509597 v 1.737925 z"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ffffff;fill-opacity:1;stroke-width:0.390271"
id="path4752-3" />
<path
d="m 51.933225,23.94429 q 2.035202,0 2.827939,-2.042825 l 1.958978,0.739381 q -0.632666,1.554985 -1.859885,2.317233 -1.219597,0.754626 -2.927032,0.754626 -2.591643,0 -4.009424,-1.463516 -1.410159,-1.471139 -1.410159,-4.108517 0,-2.645 1.364424,-4.062781 1.364424,-1.417781 3.956067,-1.417781 1.890374,0 3.079481,0.762248 1.189107,0.754625 1.669323,2.225764 l -1.981845,0.541196 q -0.251541,-0.807983 -0.990922,-1.280577 -0.731758,-0.480216 -1.730303,-0.480216 -1.524495,0 -2.317233,0.945188 -0.785116,0.945187 -0.785116,2.766959 0,1.852263 0.807983,2.82794 0.815605,0.975678 2.347724,0.975678 z"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ffffff;fill-opacity:1;stroke-width:0.390271"
id="path4754-5" />
<path
d="m 63.039178,16.558107 v 9.002148 h -2.248632 v -9.002148 h -3.468228 v -1.737925 h 9.19271 v 1.737925 z"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#ffffff;fill-opacity:1;stroke-width:0.390271"
id="path4756-6" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5 KiB

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="64"
height="64"
version="1.1"
viewBox="0 0 64 64"
id="svg16"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata
id="metadata22">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs20" />
<g
style="fill:#ffffff;fill-opacity:1"
transform="matrix(0,1.8144724,1.8144724,0,49.960684,52.380052)"
id="g88-3" />
<path
id="rect5964"
d="M 53.324343,42.841092 10.675657,57.017773 V 28.46928 Z"
style="vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2.80913;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<g
aria-label="START"
transform="matrix(1.0228573,0,0,1.2264722,-3.8415156,-4.423143)"
id="text12849"
style="font-size:22.4506px;line-height:1.25;font-family:Digitalt;-inkscape-font-specification:Digitalt;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;stroke-width:0.561265">
<path
d="m 9.873594,18.321547 2.177149,-0.219712 q 0.399477,2.157175 2.456783,2.157175 2.177149,0 2.177149,-1.637855 0,-0.679111 -0.499347,-0.978719 -0.499346,-0.299607 -2.376887,-0.77898 -3.53537,-0.878849 -3.53537,-3.255736 0,-1.418143 1.098561,-2.197123 1.098562,-0.798954 2.976103,-0.798954 4.154559,0 4.274402,3.175841 l -2.277018,0.09987 q -0.239686,-1.617882 -2.017358,-1.617882 -1.897515,0 -1.897515,1.198431 0,0.439425 0.339555,0.77898 0.359529,0.339555 2.097254,0.77898 2.836286,0.739032 3.455475,1.597907 0.619189,0.858875 0.619189,1.977411 0,3.375579 -4.454167,3.375579 -4.174533,0 -4.613958,-3.655213 z"
style="font-family:Gidugu;-inkscape-font-specification:Gidugu"
id="path68246" />
<path
d="m 23.096236,21.816969 v -9.287837 h -3.315658 v -1.697776 h 8.868386 v 1.697776 H 25.35328 v 9.287837 z"
style="font-family:Gidugu;-inkscape-font-specification:Gidugu"
id="path68248" />
<path
d="m 40.014068,21.816969 h -2.416835 l -0.978718,-2.536678 h -4.434194 l -0.918796,2.536678 h -2.356914 l 4.274403,-10.985613 h 2.436808 z m -4.05469,-4.21448 -1.577934,-4.294377 -1.577933,4.294377 z"
style="font-family:Gidugu;-inkscape-font-specification:Gidugu"
id="path68250" />
<path
d="M 41.012741,21.816969 V 10.831356 h 4.753775 q 2.23707,0 3.315658,0.659137 1.078587,0.659136 1.078587,2.376887 0,2.596599 -3.235762,3.075972 1.45809,0.759006 2.776364,2.876233 l 1.258352,1.997384 H 48.323168 L 45.906333,18.201704 Q 45.52683,17.642436 45.087405,17.40275 44.64798,17.14309 43.729184,17.14309 h -0.459399 v 4.673879 z m 2.257044,-6.251812 h 1.677803 q 1.677803,0 2.277018,-0.279634 0.619189,-0.299608 0.619189,-1.258352 0,-0.918797 -0.51932,-1.198431 -0.499346,-0.299608 -2.296992,-0.299608 h -1.757698 z"
style="font-family:Gidugu;-inkscape-font-specification:Gidugu"
id="path68252" />
<path
d="m 54.654843,21.816969 v -9.287837 h -3.315658 v -1.697776 h 8.868386 v 1.697776 h -3.295684 v 9.287837 z"
style="font-family:Gidugu;-inkscape-font-specification:Gidugu"
id="path68254" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB