mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-22 17:56:59 +01:00
Optimize PrintRoSectionInfo (#2151)
This commit is contained in:
parent
0d984f61b2
commit
0ee314fb3b
1 changed files with 21 additions and 17 deletions
|
@ -4,7 +4,6 @@ using LibHac.FsSystem;
|
||||||
using LibHac.Loader;
|
using LibHac.Loader;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
@ -68,33 +67,38 @@ namespace Ryujinx.HLE.Loaders.Executables
|
||||||
|
|
||||||
private void PrintRoSectionInfo()
|
private void PrintRoSectionInfo()
|
||||||
{
|
{
|
||||||
byte[] roBuffer = Ro.ToArray();
|
string rawTextBuffer = Encoding.ASCII.GetString(Ro);
|
||||||
string rawTextBuffer = Encoding.ASCII.GetString(roBuffer, 0, (int)RoSize);
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
int zero = BitConverter.ToInt32(roBuffer, 0);
|
string modulePath = null;
|
||||||
|
|
||||||
if (zero == 0)
|
if (BitConverter.ToInt32(Ro.Slice(0, 4)) == 0)
|
||||||
{
|
{
|
||||||
int length = BitConverter.ToInt32(roBuffer, 4);
|
int length = BitConverter.ToInt32(Ro.Slice(4, 4));
|
||||||
string modulePath = Encoding.UTF8.GetString(roBuffer, 8, length);
|
if (length > 0)
|
||||||
|
{
|
||||||
|
modulePath = Encoding.UTF8.GetString(Ro.Slice(8, length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MatchCollection moduleMatches = Regex.Matches(rawTextBuffer, @"[a-z]:[\\/][ -~]{5,}\.nss", RegexOptions.IgnoreCase);
|
if (string.IsNullOrEmpty(modulePath))
|
||||||
if (moduleMatches.Count > 0)
|
|
||||||
{
|
{
|
||||||
modulePath = moduleMatches.First().Value;
|
Match moduleMatch = Regex.Match(rawTextBuffer, @"[a-z]:[\\/][ -~]{5,}\.nss", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||||
|
if (moduleMatch.Success)
|
||||||
|
{
|
||||||
|
modulePath = moduleMatch.Value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stringBuilder.AppendLine($" Module: {modulePath}");
|
stringBuilder.AppendLine($" Module: {modulePath}");
|
||||||
}
|
|
||||||
|
|
||||||
MatchCollection fsSdkMatches = Regex.Matches(rawTextBuffer, @"sdk_version: ([0-9.]*)");
|
Match fsSdkMatch = Regex.Match(rawTextBuffer, @"sdk_version: ([0-9.]*)", RegexOptions.Compiled);
|
||||||
if (fsSdkMatches.Count != 0)
|
if (fsSdkMatch.Success)
|
||||||
{
|
{
|
||||||
stringBuilder.AppendLine($" FS SDK Version: {fsSdkMatches.First().Value.Replace("sdk_version: ", "")}");
|
stringBuilder.AppendLine($" FS SDK Version: {fsSdkMatch.Value.Replace("sdk_version: ", "")}");
|
||||||
}
|
}
|
||||||
|
|
||||||
MatchCollection sdkMwMatches = Regex.Matches(rawTextBuffer, @"SDK MW[ -~]*");
|
MatchCollection sdkMwMatches = Regex.Matches(rawTextBuffer, @"SDK MW[ -~]*", RegexOptions.Compiled);
|
||||||
if (sdkMwMatches.Count != 0)
|
if (sdkMwMatches.Count != 0)
|
||||||
{
|
{
|
||||||
string libHeader = " SDK Libraries: ";
|
string libHeader = " SDK Libraries: ";
|
||||||
|
|
Loading…
Reference in a new issue