mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Display multi-mappings correctly in the mapping list
This commit is contained in:
1 parent
49a2c93b66
commit
8c9fee064e
3 files changed
+18
-8
No files matched your search
@@ -870,4 +870,18 @@ std::string MultiInputMapping::ToConfigString() const {
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string MultiInputMapping::ToVisualString() const {
|
||||
std::string out;
|
||||
for (auto iter : mappings) {
|
||||
out += std::string(GetDeviceName(iter.deviceId)) + "." + GetKeyOrAxisName(iter) + " + ";
|
||||
}
|
||||
if (!out.empty()) {
|
||||
// remove the last ' + '
|
||||
out.pop_back();
|
||||
out.pop_back();
|
||||
out.pop_back();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
} // KeyMap
|
||||
@@ -113,6 +113,8 @@ namespace KeyMap {
|
||||
static MultiInputMapping FromConfigString(const std::string &str);
|
||||
std::string ToConfigString() const;
|
||||
|
||||
std::string ToVisualString() const;
|
||||
|
||||
bool operator <(const MultiInputMapping &other) {
|
||||
for (size_t i = 0; i < mappings.capacity(); i++) {
|
||||
// If one ran out of entries, the other wins.
|
||||
|
||||
@@ -141,18 +141,12 @@ void SingleControlMapper::Refresh() {
|
||||
|
||||
rows_.clear();
|
||||
for (size_t i = 0; i < mappings.size(); i++) {
|
||||
// TODO: Correctly handle multis.
|
||||
|
||||
auto &mapping = mappings[i].mappings[0];
|
||||
|
||||
std::string deviceName = GetDeviceName(mapping.deviceId);
|
||||
std::string keyName = KeyMap::GetKeyOrAxisName(mapping);
|
||||
|
||||
std::string multiMappingString = mappings[i].ToVisualString();
|
||||
LinearLayout *row = rightColumn->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||
row->SetSpacing(2.0f);
|
||||
rows_.push_back(row);
|
||||
|
||||
Choice *c = row->Add(new Choice(deviceName + "." + keyName, new LinearLayoutParams(FILL_PARENT, itemH, 1.0f)));
|
||||
Choice *c = row->Add(new Choice(multiMappingString, new LinearLayoutParams(FILL_PARENT, itemH, 1.0f)));
|
||||
c->SetTag(StringFromFormat("%d_Change%d", (int)i, pspKey_));
|
||||
c->OnClick.Handle(this, &SingleControlMapper::OnReplace);
|
||||
|
||||
|
||||
Reference in new issue
Block a user