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