mirror of
https://github.com/SysRay/psOff_public.git
synced 2024-11-23 14:29:39 +00:00
Merge branch 'features' into trophies-list
This commit is contained in:
commit
cfdf0215af
@ -64,6 +64,7 @@ class Hotkeys: public IHotkeys {
|
|||||||
};
|
};
|
||||||
|
|
||||||
auto readBind = [](std::string& str, KBind* kb) -> bool {
|
auto readBind = [](std::string& str, KBind* kb) -> bool {
|
||||||
|
if (str.length() == 0) return false;
|
||||||
auto delim = str.find_last_of("||");
|
auto delim = str.find_last_of("||");
|
||||||
if (delim != std::string::npos) {
|
if (delim != std::string::npos) {
|
||||||
auto mod = str.substr(0, delim - 1);
|
auto mod = str.substr(0, delim - 1);
|
||||||
@ -83,9 +84,12 @@ class Hotkeys: public IHotkeys {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kb->kc = SDL_GetScancodeFromName(str.c_str());
|
if ((kb->kc = SDL_GetScancodeFromName(str.c_str())) != SDL_SCANCODE_UNKNOWN) {
|
||||||
kb->mod = 0x0000;
|
kb->mod = 0x0000;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto [lock, jData] = accessConfig()->accessModule(ConfigModFlag::CONTROLS);
|
auto [lock, jData] = accessConfig()->accessModule(ConfigModFlag::CONTROLS);
|
||||||
@ -97,6 +101,7 @@ class Hotkeys: public IHotkeys {
|
|||||||
|
|
||||||
auto& bind = m_binds[(uint32_t)it->second];
|
auto& bind = m_binds[(uint32_t)it->second];
|
||||||
if (!readBind(temp, &bind)) {
|
if (!readBind(temp, &bind)) {
|
||||||
|
printf("Missing key binding for \"%s\"!\n", bname.c_str());
|
||||||
bind = {0, 0};
|
bind = {0, 0};
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -184,19 +184,21 @@ Config::Config() {
|
|||||||
removeUnused = [&getVal, &removeUnused](json& obj, json& def) -> bool {
|
removeUnused = [&getVal, &removeUnused](json& obj, json& def) -> bool {
|
||||||
bool unused = false;
|
bool unused = false;
|
||||||
|
|
||||||
for (auto& [ckey, cval]: obj.items()) {
|
for (auto it = obj.begin(); it != obj.end();) {
|
||||||
if (ckey.starts_with("_")) { // Temporary (probably) workaround to stop removing underscore objects
|
auto& ckey = it.key();
|
||||||
continue;
|
if (!ckey.starts_with("_")) { // Temporary (probably) workaround to stop removing underscore objects
|
||||||
}
|
json& dval = getVal(def, ckey);
|
||||||
json& dval = getVal(def, ckey);
|
|
||||||
|
|
||||||
if (dval.is_null()) {
|
if (dval.is_null()) {
|
||||||
obj.erase(ckey);
|
it = obj.erase(it);
|
||||||
unused = true;
|
unused = true;
|
||||||
} else if (dval.is_structured()) {
|
continue;
|
||||||
unused |= removeUnused(cval, dval);
|
} else if (dval.is_structured()) {
|
||||||
continue;
|
unused |= removeUnused(*it, dval);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
return unused;
|
return unused;
|
||||||
|
Loading…
Reference in New Issue
Block a user