hos: Cleanup the project (#2634)
* hos: Cleanup the project Since a lot of changes has been done on the HOS project, there are some leftover here and there, or class just used in one service, things at wrong places, and more. This PR fixes that, additionnally to that, I've realigned some vars because I though it make the code more readable. * Address gdkchan feedback * addresses Thog feedback * Revert ElfSymbol
This commit is contained in:
parent
3f2486342b
commit
5d08e9b495
36 changed files with 261 additions and 382 deletions
|
@ -7,11 +7,19 @@ namespace Ryujinx.HLE.Loaders.Mods
|
|||
{
|
||||
class IPSwitchPatcher
|
||||
{
|
||||
readonly StreamReader _reader;
|
||||
public string BuildId { get; }
|
||||
|
||||
const string BidHeader = "@nsobid-";
|
||||
|
||||
private enum Token
|
||||
{
|
||||
Normal,
|
||||
String,
|
||||
EscapeChar,
|
||||
Comment
|
||||
}
|
||||
|
||||
private readonly StreamReader _reader;
|
||||
public string BuildId { get; }
|
||||
|
||||
public IPSwitchPatcher(StreamReader reader)
|
||||
{
|
||||
string header = reader.ReadLine();
|
||||
|
@ -26,14 +34,6 @@ namespace Ryujinx.HLE.Loaders.Mods
|
|||
BuildId = header.Substring(BidHeader.Length).TrimEnd().TrimEnd('0');
|
||||
}
|
||||
|
||||
private enum Token
|
||||
{
|
||||
Normal,
|
||||
String,
|
||||
EscapeChar,
|
||||
Comment
|
||||
}
|
||||
|
||||
// Uncomments line and unescapes C style strings within
|
||||
private static string PreprocessLine(string line)
|
||||
{
|
||||
|
@ -56,24 +56,24 @@ namespace Ryujinx.HLE.Loaders.Mods
|
|||
case Token.String:
|
||||
state = c switch
|
||||
{
|
||||
'"' => Token.Normal,
|
||||
'"' => Token.Normal,
|
||||
'\\' => Token.EscapeChar,
|
||||
_ => Token.String
|
||||
_ => Token.String
|
||||
};
|
||||
break;
|
||||
case Token.EscapeChar:
|
||||
state = Token.String;
|
||||
c = c switch
|
||||
{
|
||||
'a' => '\a',
|
||||
'b' => '\b',
|
||||
'f' => '\f',
|
||||
'n' => '\n',
|
||||
'r' => '\r',
|
||||
't' => '\t',
|
||||
'v' => '\v',
|
||||
'a' => '\a',
|
||||
'b' => '\b',
|
||||
'f' => '\f',
|
||||
'n' => '\n',
|
||||
'r' => '\r',
|
||||
't' => '\t',
|
||||
'v' => '\v',
|
||||
'\\' => '\\',
|
||||
_ => '?'
|
||||
_ => '?'
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
@ -119,7 +119,8 @@ namespace Ryujinx.HLE.Loaders.Mods
|
|||
for (int i = 0; i < hexstr.Length; i += 2)
|
||||
{
|
||||
int high = ParseHexByte((byte)hexstr[i]);
|
||||
int low = ParseHexByte((byte)hexstr[i + 1]);
|
||||
int low = ParseHexByte((byte)hexstr[i + 1]);
|
||||
|
||||
bytes[i >> 1] = (byte)((high << 4) | low);
|
||||
}
|
||||
|
||||
|
@ -131,11 +132,11 @@ namespace Ryujinx.HLE.Loaders.Mods
|
|||
{
|
||||
if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
|
||||
{
|
||||
return Int32.TryParse(str.Substring(2), System.Globalization.NumberStyles.HexNumber, null, out value);
|
||||
return int.TryParse(str.Substring(2), System.Globalization.NumberStyles.HexNumber, null, out value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Int32.TryParse(str, System.Globalization.NumberStyles.Integer, null, out value);
|
||||
return int.TryParse(str, System.Globalization.NumberStyles.Integer, null, out value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,7 +149,7 @@ namespace Ryujinx.HLE.Loaders.Mods
|
|||
|
||||
MemPatch patches = new MemPatch();
|
||||
|
||||
bool enabled = false;
|
||||
bool enabled = false;
|
||||
bool printValues = false;
|
||||
int offset_shift = 0;
|
||||
|
||||
|
@ -236,7 +237,7 @@ namespace Ryujinx.HLE.Loaders.Mods
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!Int32.TryParse(tokens[0], System.Globalization.NumberStyles.HexNumber, null, out int offset))
|
||||
if (!int.TryParse(tokens[0], System.Globalization.NumberStyles.HexNumber, null, out int offset))
|
||||
{
|
||||
ParseWarn();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue