Made the UI mode unlock symbols reflect the selected controller type.

This commit is contained in:
Leon Styhre 2021-07-01 17:48:14 +02:00
parent 3185083ca5
commit 2eb8240211
2 changed files with 39 additions and 8 deletions

View file

@ -124,7 +124,35 @@ std::string UIModeController::getFormattedPassKeyStr()
std::string out = ""; std::string out = "";
for (auto c : mPassKeySequence) { for (auto c : mPassKeySequence) {
out += (out == "") ? "" : ", "; // Add a comma after the first entry. out += (out == "") ? "" : " , "; // Add commas between the entries.
std::string controllerType = Settings::getInstance()->getString("InputControllerType");
std::string symbolA;
std::string symbolB;
std::string symbolX;
std::string symbolY;
if (controllerType == "snes") {
symbolA = "B";
symbolB = "A";
symbolX = "Y";
symbolY = "X";
}
else if (controllerType == "ps4" || controllerType == "ps5") {
// These symbols are far from perfect but you can at least understand what
// they are supposed to depict.
symbolA = "\uF00D"; // Cross.
symbolB = "\uF111"; // Circle
symbolX = "\uF04D"; // Square.
symbolY = "\uF0D8"; // Triangle.
}
else {
// Xbox controller.
symbolA = "A";
symbolB = "B";
symbolX = "X";
symbolY = "Y";
}
switch (c) { switch (c) {
case 'u': case 'u':
@ -140,16 +168,16 @@ std::string UIModeController::getFormattedPassKeyStr()
out += Utils::String::unicode2Chars(0x2192); // Arrow pointing right. out += Utils::String::unicode2Chars(0x2192); // Arrow pointing right.
break; break;
case 'a': case 'a':
out += "A"; out += symbolA;
break; break;
case 'b': case 'b':
out += "B"; out += symbolB;
break; break;
case 'x': case 'x':
out += "X"; out += symbolX;
break; break;
case 'y': case 'y':
out += "Y"; out += symbolY;
break; break;
} }
} }

View file

@ -43,8 +43,8 @@ public:
private: private:
UIModeController(); UIModeController();
bool inputIsMatch(InputConfig * config, Input input); bool inputIsMatch(InputConfig* config, Input input);
bool isValidInput(InputConfig * config, Input input); bool isValidInput(InputConfig* config, Input input);
// Return UI mode to 'full'. // Return UI mode to 'full'.
void unlockUIMode(); void unlockUIMode();
@ -53,10 +53,13 @@ private:
// Default passkeyseq = "uuddlrlrba", as defined in the setting 'UIMode_passkey'. // Default passkeyseq = "uuddlrlrba", as defined in the setting 'UIMode_passkey'.
std::string mPassKeySequence; std::string mPassKeySequence;
std::string mCurrentUIMode;
int mPassKeyCounter; int mPassKeyCounter;
// These are Xbox button names, so they may be different in pracise on non-Xbox controllers.
const std::vector<std::string> mInputVals = const std::vector<std::string> mInputVals =
{ "up", "down", "left", "right", "a", "b", "x", "y" }; { "up", "down", "left", "right", "a", "b", "x", "y" };
std::string mCurrentUIMode;
}; };
#endif // ES_APP_VIEWS_UI_MODE_CONTROLLER_H #endif // ES_APP_VIEWS_UI_MODE_CONTROLLER_H