Is there a good way to peek just 1 byte from an address?
Everytime I'll try it, it takes the full 4 byte length of the address, no matter what I try.
E.g. Wind Waker Map Address starts with "0x109764F0", the first byte is "73" the second "65", the third "61" and the fourth "00", so its 73656100
Now I wan't to read only the first or second byte instead of the full range.
So I would use "0x109764F1" to get the second byte, but it still uses the full range starting with 73, instead of 65.
Can somebody help me out here?
Also every "0" gets ignored by peeking, which corrupts the reading of a value
e.g. when the value is 000001FF the result will be something like 1FF.
The code for peeking is this
How would I modify it to read just 1 byte from an address?
TCPGecko.cs on GitHub > TCPGecko.cs
Everytime I'll try it, it takes the full 4 byte length of the address, no matter what I try.
E.g. Wind Waker Map Address starts with "0x109764F0", the first byte is "73" the second "65", the third "61" and the fourth "00", so its 73656100
Now I wan't to read only the first or second byte instead of the full range.
So I would use "0x109764F1" to get the second byte, but it still uses the full range starting with 73, instead of 65.
Can somebody help me out here?
Also every "0" gets ignored by peeking, which corrupts the reading of a value
e.g. when the value is 000001FF the result will be something like 1FF.
The code for peeking is this
Code:
public UInt32 peek(UInt32 address)
{
if (!ValidMemory.ValidAddress(address))
{
return 0;
}
//address will be alligned to 4
UInt32 paddress = address & 0xFFFFFFFC;
//Create a memory stream for the actual dump
MemoryStream stream = new MemoryStream();
//make sure to not send data to the output
GeckoProgress oldUpdate = this.PChunkUpdate;
this.PChunkUpdate = null;
try
{
//dump data
this.Dump(paddress, paddress + 4, stream);
//go to beginning
stream.Seek(0, SeekOrigin.Begin);
Byte[] buffer = new Byte[4];
stream.Read(buffer, 0, 4);
//Read buffer
UInt32 result = BitConverter.ToUInt32(buffer, 0);
//Swap to machine endianness and return
result = ByteSwap.Swap(result);
return result;
}
finally
{
this.PChunkUpdate = oldUpdate;
//make sure the Stream is properly closed
stream.Close();
}
}
How would I modify it to read just 1 byte from an address?
TCPGecko.cs on GitHub > TCPGecko.cs
Last edited by Dekirai,