Improve compression support (still need to fix errored compression indexing)
This commit is contained in:
parent
67583f528c
commit
f79fa9b804
1 changed files with 75 additions and 33 deletions
|
@ -74,6 +74,16 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
{ "Dn", "std::nullptr_t" },
|
{ "Dn", "std::nullptr_t" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static readonly Dictionary<string, string> SubstitutionExtra = new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{"Sa", "std::allocator"},
|
||||||
|
{"Sb", "std::basic_string"},
|
||||||
|
{"Ss", "std::basic_string<char, ::std::char_traits<char>, ::std::allocator<char>>"},
|
||||||
|
{"Si", "std::basic_istream<char, ::std::char_traits<char>>"},
|
||||||
|
{"So", "std::basic_ostream<char, ::std::char_traits<char>>"},
|
||||||
|
{"Sd", "std::basic_iostream<char, ::std::char_traits<char>>"}
|
||||||
|
};
|
||||||
|
|
||||||
private static int FromBase36(string encoded)
|
private static int FromBase36(string encoded)
|
||||||
{
|
{
|
||||||
string base36 = "0123456789abcdefghijklmnopqrstuvwxyz";
|
string base36 = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||||
|
@ -97,8 +107,22 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
pos = -1;
|
pos = -1;
|
||||||
if (compressionData.Count == 0 || !compression.StartsWith("S"))
|
if (compressionData.Count == 0 || !compression.StartsWith("S"))
|
||||||
return null;
|
return null;
|
||||||
// TODO: special compression for std
|
|
||||||
if (compression.StartsWith("S_"))
|
string temp = null;
|
||||||
|
if (compression.Length > 2 && BuiltinTypes.TryGetValue(compression.Substring(0, 2), out temp))
|
||||||
|
{
|
||||||
|
pos = 2;
|
||||||
|
res = temp;
|
||||||
|
compression = compression.Substring(2);
|
||||||
|
}
|
||||||
|
else if (compression.StartsWith("St"))
|
||||||
|
{
|
||||||
|
pos = 2;
|
||||||
|
canHaveUnqualifiedName = true;
|
||||||
|
res = "std";
|
||||||
|
compression = compression.Substring(2);
|
||||||
|
}
|
||||||
|
else if (compression.StartsWith("S_"))
|
||||||
{
|
{
|
||||||
pos = 2;
|
pos = 2;
|
||||||
res = compressionData[0];
|
res = compressionData[0];
|
||||||
|
@ -116,7 +140,9 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
|
|
||||||
id = FromBase36(partialId);
|
id = FromBase36(partialId);
|
||||||
if (id == -1 || compressionData.Count <= (id + 1))
|
if (id == -1 || compressionData.Count <= (id + 1))
|
||||||
|
{
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
res = compressionData[id + 1];
|
res = compressionData[id + 1];
|
||||||
pos = partialId.Length + 1;
|
pos = partialId.Length + 1;
|
||||||
canHaveUnqualifiedName= true;
|
canHaveUnqualifiedName= true;
|
||||||
|
@ -168,6 +194,10 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
else
|
else
|
||||||
res.Add(res[res.Count - 1] + "::" + data);
|
res.Add(res[res.Count - 1] + "::" + data);
|
||||||
i += pos;
|
i += pos;
|
||||||
|
if (mangled[i] == 'E')
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (chr == 'E')
|
else if (chr == 'E')
|
||||||
|
@ -275,6 +305,8 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
if (temp2 != null)
|
if (temp2 != null)
|
||||||
{
|
{
|
||||||
temp = temp2 + " " + temp;
|
temp = temp2 + " " + temp;
|
||||||
|
compressionData.Add(temp);
|
||||||
|
// need more data
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,13 +314,17 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
if (temp2 != null)
|
if (temp2 != null)
|
||||||
{
|
{
|
||||||
temp = temp + temp2;
|
temp = temp + temp2;
|
||||||
|
compressionData.Add(temp);
|
||||||
|
// need more data
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp2 = ReadSpecialQualifiers(chr);
|
temp2 = ReadSpecialQualifiers(chr);
|
||||||
if (temp2 != null)
|
if (temp2 != null)
|
||||||
{
|
{
|
||||||
temp = temp+ temp2;
|
temp = temp + temp2;
|
||||||
|
|
||||||
|
// need more data
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,9 +338,12 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
i += pos;
|
i += pos;
|
||||||
temp = temp2 + temp;
|
temp = temp2 + temp;
|
||||||
res.Add(temp);
|
res.Add(temp);
|
||||||
|
compressionData.Add(temp);
|
||||||
temp = null;
|
temp = null;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
pos = -1;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
else if (part.StartsWith("N"))
|
else if (part.StartsWith("N"))
|
||||||
{
|
{
|
||||||
|
@ -313,8 +352,9 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
if (pos != -1 && name != null)
|
if (pos != -1 && name != null)
|
||||||
{
|
{
|
||||||
i += pos + 1;
|
i += pos + 1;
|
||||||
temp = name[name.Count - 1] + temp;
|
temp = name[name.Count - 1] + " " + temp;
|
||||||
res.Add(temp);
|
res.Add(temp);
|
||||||
|
compressionData.Add(temp);
|
||||||
temp = null;
|
temp = null;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -324,7 +364,6 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
temp2 = ReadBuiltinType(part, out pos);
|
temp2 = ReadBuiltinType(part, out pos);
|
||||||
if (pos == -1)
|
if (pos == -1)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Error: builtin part = " + part);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (temp != null)
|
if (temp != null)
|
||||||
|
@ -332,6 +371,7 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
else
|
else
|
||||||
temp = temp2;
|
temp = temp2;
|
||||||
res.Add(temp);
|
res.Add(temp);
|
||||||
|
compressionData.Add(temp);
|
||||||
temp = null;
|
temp = null;
|
||||||
i = i + pos -1;
|
i = i + pos -1;
|
||||||
}
|
}
|
||||||
|
@ -360,9 +400,11 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
::= <data name>
|
::= <data name>
|
||||||
::= <special-name>
|
::= <special-name>
|
||||||
*/
|
*/
|
||||||
public static string Parse(string mangled)
|
public static string Parse(string originalMangled)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Mangled: " + mangled);
|
Console.WriteLine("Mangled: " + originalMangled);
|
||||||
|
|
||||||
|
string mangled = originalMangled;
|
||||||
List<string> compressionData = new List<string>();
|
List<string> compressionData = new List<string>();
|
||||||
string res = null;
|
string res = null;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
@ -386,14 +428,14 @@ namespace Ryujinx.Core.OsHle.Diagnostics
|
||||||
List<string> parameters = ReadParameters(mangled, compressionData, out pos);
|
List<string> parameters = ReadParameters(mangled, compressionData, out pos);
|
||||||
// parameters parsing error, we return the original data to avoid information loss.
|
// parameters parsing error, we return the original data to avoid information loss.
|
||||||
if (pos == -1)
|
if (pos == -1)
|
||||||
return mangled;
|
return originalMangled;
|
||||||
res += "(";
|
res += "(";
|
||||||
res += String.Join(", ", parameters);
|
res += String.Join(", ", parameters);
|
||||||
res += ")";
|
res += ")";
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return mangled;
|
return originalMangled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue