mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-07-04 00:20:47 -07:00
Debugger: Initial implementation
# Conflicts: # src/Ryujinx.HLE/Debugger/Debugger.cs # src/Ryujinx.HLE/Debugger/GdbSignal.cs # src/Ryujinx.HLE/Debugger/Message/AbortMessage.cs # src/Ryujinx.HLE/Debugger/Message/BreakInMessage.cs # src/Ryujinx.HLE/Debugger/Message/CommandMessage.cs # src/Ryujinx.HLE/Debugger/Message/IMessage.cs # src/Ryujinx.HLE/Debugger/Message/SendNackMessage.cs # src/Ryujinx.HLE/Debugger/StringStream.cs # src/Ryujinx.HLE/Switch.cs
This commit is contained in:
68
src/Ryujinx.HLE/Debugger/StringStream.cs
Normal file
68
src/Ryujinx.HLE/Debugger/StringStream.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace Ryujinx.HLE.Debugger
|
||||
{
|
||||
class StringStream
|
||||
{
|
||||
private readonly string Data;
|
||||
private int Position;
|
||||
|
||||
public StringStream(string s)
|
||||
{
|
||||
Data = s;
|
||||
}
|
||||
|
||||
public char ReadChar()
|
||||
{
|
||||
return Data[Position++];
|
||||
}
|
||||
|
||||
public string ReadUntil(char needle)
|
||||
{
|
||||
int needlePos = Data.IndexOf(needle, Position);
|
||||
|
||||
if (needlePos == -1)
|
||||
{
|
||||
needlePos = Data.Length;
|
||||
}
|
||||
|
||||
string result = Data.Substring(Position, needlePos - Position);
|
||||
Position = needlePos + 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
public string ReadLength(int len)
|
||||
{
|
||||
string result = Data.Substring(Position, len);
|
||||
Position += len;
|
||||
return result;
|
||||
}
|
||||
|
||||
public string ReadRemaining()
|
||||
{
|
||||
string result = Data.Substring(Position);
|
||||
Position = Data.Length;
|
||||
return result;
|
||||
}
|
||||
|
||||
public ulong ReadRemainingAsHex()
|
||||
{
|
||||
return ulong.Parse(ReadRemaining(), NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
public ulong ReadUntilAsHex(char needle)
|
||||
{
|
||||
return ulong.Parse(ReadUntil(needle), NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
public ulong ReadLengthAsHex(int len)
|
||||
{
|
||||
return ulong.Parse(ReadLength(len), NumberStyles.HexNumber);
|
||||
}
|
||||
|
||||
public bool IsEmpty()
|
||||
{
|
||||
return Position >= Data.Length;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user