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 = "";
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) {
case 'u':
@ -140,16 +168,16 @@ std::string UIModeController::getFormattedPassKeyStr()
out += Utils::String::unicode2Chars(0x2192); // Arrow pointing right.
break;
case 'a':
out += "A";
out += symbolA;
break;
case 'b':
out += "B";
out += symbolB;
break;
case 'x':
out += "X";
out += symbolX;
break;
case 'y':
out += "Y";
out += symbolY;
break;
}
}

View file

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