I'm trying to do this:
public string getName(uint offset, byte[] buffer)
{
return Encoding.ASCII.GetString(PS3.GetMemory(offset, buffer));
}
But it returns me an error:
cannot convert from 'void' to 'byte[]'
But I don't know why.
public void GetMemory(uint offset, byte[] buffer)
{
if (SetAPI.API == SelectAPI.TargetManager)
Common.TmApi.GetMemory(offset, buffer);
else if (SetAPI.API == SelectAPI.ControlConsole)
Common.CcApi.GetMemory(offset, buffer);
}
Contrary to the other answer, I don't think you need to modify your GetMemory
method, which looks like it's calling void
methods (e.g. here).
It looks like GetMemory
writes into the buffer you provide, so you may just need:
// Name changed to comply with .NET naming conventions
public string GetName(uint offset, byte[] buffer)
{
// Populate buffer
PS3.GetMemory(offset, buffer);
// Convert it to string - assuming the whole array is filled with useful data
return Encoding.ASCII.GetString(buffer);
}
On the other hand, that is assuming that the buffer is exactly the right size for the name. Is that actually the case? It's unclear where you expect the value to come from, or how long you expect it to be.
See more on this question at Stackoverflow