Merge remote-tracking branch 'origin/libretro' into net-rollback
This commit is contained in:
commit
a3d50fc197
|
@ -215,14 +215,50 @@ protected:
|
||||||
std::vector<std::string> newValue;
|
std::vector<std::string> newValue;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
std::string::size_type end = paths.find(';', start);
|
if (paths[start] == '"')
|
||||||
if (end == std::string::npos)
|
{
|
||||||
end = paths.size();
|
std::string v;
|
||||||
if (start != end)
|
start++;
|
||||||
newValue.push_back(paths.substr(start, end - start));
|
while (true)
|
||||||
if (end == paths.size())
|
{
|
||||||
break;
|
if (paths[start] == '"')
|
||||||
start = end + 1;
|
{
|
||||||
|
if (start + 1 >= paths.size())
|
||||||
|
{
|
||||||
|
newValue.push_back(v);
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
if (paths[start + 1] == '"')
|
||||||
|
{
|
||||||
|
v += paths[start++];
|
||||||
|
start++;
|
||||||
|
}
|
||||||
|
else if (paths[start + 1] == ';')
|
||||||
|
{
|
||||||
|
newValue.push_back(v);
|
||||||
|
start += 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v += paths[start++];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
v += paths[start++];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string::size_type end = paths.find(';', start);
|
||||||
|
if (end == std::string::npos)
|
||||||
|
end = paths.size();
|
||||||
|
if (start != end)
|
||||||
|
newValue.push_back(paths.substr(start, end - start));
|
||||||
|
if (end == paths.size())
|
||||||
|
break;
|
||||||
|
start = end + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
}
|
}
|
||||||
|
@ -263,12 +299,32 @@ protected:
|
||||||
doSave(const std::string& section, const std::string& name) const
|
doSave(const std::string& section, const std::string& name) const
|
||||||
{
|
{
|
||||||
std::string s;
|
std::string s;
|
||||||
for (auto& v : value)
|
for (const auto& v : value)
|
||||||
{
|
{
|
||||||
if (s.empty())
|
if (!s.empty())
|
||||||
s = v;
|
s += ';';
|
||||||
|
if (v.find(';') != std::string::npos || (!v.empty() && v[0] == '"'))
|
||||||
|
{
|
||||||
|
s += '"';
|
||||||
|
std::string v2 = v;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
auto pos = v2.find('"');
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
{
|
||||||
|
s += v2.substr(0, pos + 1) + '"';
|
||||||
|
v2 = v2.substr(pos + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s += v2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s += '"';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
s += ";" + v;
|
s += v;
|
||||||
}
|
}
|
||||||
cfgSaveStr(section, name, s);
|
cfgSaveStr(section, name, s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,17 +311,20 @@ static void ImGui_Impl_NewFrame()
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
// Read keyboard modifiers inputs
|
// Read keyboard modifiers inputs
|
||||||
io.KeyCtrl = (kb_shift[0] & (0x01 | 0x10)) != 0;
|
io.KeyCtrl = 0;
|
||||||
io.KeyShift = (kb_shift[0] & (0x02 | 0x20)) != 0;
|
io.KeyShift = 0;
|
||||||
io.KeyAlt = false;
|
io.KeyAlt = false;
|
||||||
io.KeySuper = false;
|
io.KeySuper = false;
|
||||||
|
|
||||||
memset(&io.KeysDown[0], 0, sizeof(io.KeysDown));
|
memset(&io.KeysDown[0], 0, sizeof(io.KeysDown));
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(kb_key[0]); i++)
|
for (int port = 0; port < 4; port++)
|
||||||
if (kb_key[0][i] != 0)
|
{
|
||||||
io.KeysDown[kb_key[0][i]] = true;
|
io.KeyCtrl |= (kb_shift[port] & (0x01 | 0x10)) != 0;
|
||||||
else
|
io.KeyShift |= (kb_shift[port] & (0x02 | 0x20)) != 0;
|
||||||
break;
|
|
||||||
|
for (int i = 0; i < IM_ARRAYSIZE(kb_key[0]); i++)
|
||||||
|
if (kb_key[port][i] != 0)
|
||||||
|
io.KeysDown[kb_key[port][i]] = true;
|
||||||
|
}
|
||||||
if (mouseX < 0 || mouseX >= screen_width || mouseY < 0 || mouseY >= screen_height)
|
if (mouseX < 0 || mouseX >= screen_width || mouseY < 0 || mouseY >= screen_height)
|
||||||
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue