MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / PrettifyInputBinding

Method PrettifyInputBinding

pcsx2/Input/InputManager.cpp:415–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415bool InputManager::PrettifyInputBinding(SmallStringBase& binding, bool use_icons)
416{
417 if (binding.empty())
418 return false;
419
420 const std::string_view binding_view = binding.view();
421
422 SmallString ret;
423 bool changed = false;
424
425 std::string_view::size_type last = 0;
426 std::string_view::size_type next;
427 while ((next = binding_view.find('&', last)) != std::string_view::npos)
428 {
429 if (last != next)
430 {
431 const std::string_view part = StringUtil::StripWhitespace(binding_view.substr(last, next - last));
432 if (!part.empty())
433 {
434 if (!ret.empty())
435 ret.append(" + ");
436 PrettifyInputBindingPart(part, ret, changed, use_icons);
437 }
438 }
439 last = next + 1;
440 }
441 if (last < (binding_view.size() - 1))
442 {
443 const std::string_view part = StringUtil::StripWhitespace(binding_view.substr(last));
444 if (!part.empty())
445 {
446 if (!ret.empty())
447 ret.append(" + ");
448 PrettifyInputBindingPart(part, ret, changed, use_icons);
449 }
450 }
451
452 if (changed)
453 binding = ret;
454
455 return changed;
456}
457
458void InputManager::SetGamepadIconPreference(InputLayout layout)
459{

Callers

nothing calls this directly

Calls 7

StripWhitespaceFunction · 0.85
viewMethod · 0.80
substrMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
appendMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected