static CsLocalPlayer() { var clientModule = Memory.Modules.First(m => m.ModuleName == "client.dll"); var scanner = new Memory.SignatureScanner { Address = clientModule.BaseAddress, ScanSize = clientModule.ModuleMemorySize }; Memory.AddressResolver.Register(nameof(CsLocalPlayer), () => { const string pattern = "88 26 ? ? ? ? ? ? 08 ? ? ? ? ? ? ? ? ? ? ? 88 26"; var address = scanner.Scan(pattern, 4); return(Marshal.ReadIntPtr(address)); }); Memory.ValueResolver.Register(nameof(Health), () => { var address = Memory.AddressResolver.Resolve(nameof(CsLocalPlayer)); return(Memory.ReadInt32(address, 0xFC)); }); Memory.ValueResolver.Register(nameof(Team), () => { var address = Memory.AddressResolver.Resolve(nameof(CsLocalPlayer)); return((CsTeam)Memory.ReadInt32(address, 0xF0)); }); }
static Game() { var signatureScanner = new Memory.SignatureScanner(); Memory.AddressResolver.Register(GameSongTimeSignatureScan1, () => { var address = signatureScanner.Scan("DD 45 EC DD 1D", 5); return(address); }); Memory.AddressResolver.Register(nameof(SongTime), () => { var address = Memory.AddressResolver.Resolve(GameSongTimeSignatureScan1); return(Memory.ReadIntPtr(address)); }); Memory.ValueResolver.Register(nameof(SongTime), () => { var address = Memory.AddressResolver.Resolve(nameof(SongTime)); return(Memory.ReadDouble(address)); }); }