Jeżeli chcesz wyciągać jakieś dane z klienta gry za pomocą C# to da się to zrobić bo się tym bawiłem, ale problem raczej nie jest na poziomie jakiego języka użyć, a jak wyciągać te adresy/dane.
Kod którego używałem do pewnej gierki do wyciągania z niej danych przy wywołaniu RefreshData()
na Windowsie:
Na Lunixa nie znalazłem jak to zrobić
public class MemoryContext
{
const int PROCESS_WM_READ = 0x0010;
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
private int xor;
private int baseAddress;
private int AddrXOR = 0x511458;
private int AddrLevel = 0x545470;
private Process process;
private IntPtr handle;
public MemoryContext(string processName)
{
process = Process.GetProcessesByName(processName).FirstOrDefault();
if (process == null)
{
throw new Exception($"Process with name: '{processName}' is not running");
}
baseAddress = process.MainModule.BaseAddress.ToInt32();
handle = OpenProcess(PROCESS_WM_READ, false, process.Id);
int bytesRead = 0;
byte[] buffer = new byte[4];
ReadProcessMemory((int)handle, AddrXOR + baseAddress, buffer, buffer.Length, ref bytesRead);
xor = BitConverter.ToInt32(buffer, 0);
}
public GameInfo RefreshData()
{
var gameInfo = new GameInfo();
int bytesRead = 0;
byte[] buffer = new byte[4];
ReadProcessMemory((int)handle, AddrLevel + baseAddress, buffer, buffer.Length, ref bytesRead);
gameInfo.Level = BitConverter.ToInt32(buffer, 0);
return gameInfo;
}
}