public override TimerAction[] OnMapLoad(MemoryWatcherList watchers) { var status = (MemoryWatcher <int>)watchers["status"]; _map = (StringWatcher)watchers["map"]; if (status.Current == (int)Status.LoadingMap) { if (_map.Current.ToLower() == "59_intro") { return new TimerAction[] { TimerAction.Reset } } ; else if (_map.Current.ToLower() == "60_hongkong_mpshelipad") { return new TimerAction[] { TimerAction.Start } } ; } return(null); } }
public override TimerAction[] OnMapLoad(MemoryWatcherList watchers) { _map = (StringWatcher)watchers["map"]; if (_map.Current.ToLower() == "cm01a_sw" || _map.Current.ToLower() == "cm_globalspace") { return new TimerAction[] { TimerAction.Reset } } ; if (_map.Old.ToLower() == "cm01a_sw" && _map.Current.ToLower() == "m01_siskol1a") { return new TimerAction[] { TimerAction.Start } } ; else if (_map.Old.ToLower() == "cm_globalspace" && _map.Current.ToLower() == "m01_kiral1a") { return new TimerAction[] { TimerAction.Start } } ; else if (_map.Old.ToLower() == "cm01a_sw" && _map.Current.ToLower() == "m01_worfl1") { return new TimerAction[] { TimerAction.Start } } ; return(null); } }
public override TimerAction[] OnUpdate(Process game, MemoryWatcherList watchers) { var status = (MemoryWatcher <Status>)watchers["status"]; _map = (StringWatcher)watchers["map"]; if (status.Changed) { var map = Path.GetFileNameWithoutExtension(_map.Current).ToLower(); if (status.Old == Status.LoadingMap) { if (map == "m02") { return new TimerAction[] { TimerAction.Start } } ; } else if (status.Current == Status.LoadingMap) { if (map == "m02") { return new TimerAction[] { TimerAction.Reset } } ; } } return(null); }
public SplitOnWatching(GameState state, SplitRuleWatching rule) : base(state, rule) { videoFilename = new StringWatcher( state.ResMgrPtr + state.Version.OffResMgrToVideoMgr + state.Version.OffVideoMgrToFilename, ReadStringType.ASCII, state.Version.LenVideoMgrFilename); }
public override TimerAction[] OnMapLoad(MemoryWatcherList watchers) { _map = (StringWatcher)watchers["map"]; if (_map.Current.ToLower() == "mission_01") { return new TimerAction[] { TimerAction.Reset } } ; return(null); }
public override TimerAction[] OnMapLoad(MemoryWatcherList watchers) { StringWatcher map = (StringWatcher)watchers["map"]; if (map != null) { if (!map.Changed && map.Current == "Lev_Tut1.unr") { return(new TimerAction[] { TimerAction.Split }); } } return(null); }
public override void OnGameAttached(GameState state) { _ccHandler.Init(state); server = state.GetModule("server.dll"); client = state.GetModule("client.dll"); engine = state.GetModule("engine.dll"); var serverScanner = new SignatureScanner(state.GameProcess, server.BaseAddress, server.ModuleMemorySize); if (GameMemory.GetBaseEntityMemberOffset("m_angAbsRotation", state.GameProcess, serverScanner, out _baseEntityAngleOffset)) { Debug.WriteLine("CBaseEntity::m_angAbsRotation offset = 0x" + _baseEntityAngleOffset.ToString("X")); } if (GameMemory.GetBaseEntityMemberOffset("m_vecAngVelocity", state.GameProcess, serverScanner, out _baseEntityAngleVelOffset)) { Debug.WriteLine("CBaseEntity::m_vecAngVelocity offset = 0x" + _baseEntityAngleVelOffset.ToString("X")); } SigScanTarget _latest_Client_Trg = new SigScanTarget(0, Encoding.ASCII.GetBytes("ClientCommand, 0 length string supplied.")); _latest_Client_Trg.OnFound = (proc, scanner, ptr) => { byte[] b = BitConverter.GetBytes(ptr.ToInt32()); var target = new SigScanTarget(2, $"80 3D ?? ?? ?? ?? 00 75 ?? 68 {b[0]:X02} {b[1]:X02} {b[2]:X02} {b[3]:X02}"); // cmp byte ptr [clientcmdptr],00 IntPtr ptrPtr = scanner.Scan(target); if (ptrPtr == IntPtr.Zero) { return(IntPtr.Zero); } IntPtr ret; proc.ReadPointer(ptrPtr, out ret); Debug.WriteLine("CVEngineServer::ClientCommand szOut ptr is 0x" + ret.ToString("X")); return(ret); }; var engineScanner = new SignatureScanner(state.GameProcess, engine.BaseAddress, engine.ModuleMemorySize); _endingsWatcher.ResetAll(); _endingSeriousCount = 0; _latestClientCmd = new StringWatcher(engineScanner.Scan(_latest_Client_Trg), 50); _endingsWatcher.Add(_latestClientCmd); }
/// <summary> /// Initialize signature scanners and sigscan. /// </summary> private static void Init() { Log("Starting with default values", false); Action <string, IntPtr> SigReport = (name, ptr) => { Console.WriteLine("[INIT] " + name + (ptr == IntPtr.Zero ? " WAS NOT FOUND" : " is 0x" + ptr.ToString("X"))); }; SigScanTarget _entListSig = new SigScanTarget(6, "40 ?? 48 ?? ?? ??", "48 ?? ?? ?? ?? ?? ??", // MOV RAX,qword ptr [DAT_1814e3bc0] "8b ?? 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ff ?? ?? ?? ?? ?? 4c ?? ??"); _entListSig.OnFound = (proc, scanner, ptr) => GetPointer(ptr, 3, 7); SigScanTarget _gamePathSig = new SigScanTarget(7, "48 8B 97 ?? ?? ?? ??", "48 8D 0D ?? ?? ?? ??", // LEA RCX,[mapname] "48 8B 5C 24 ??"); _gamePathSig.OnFound = (proc, scanner, ptr) => GetPointer(ptr, 3, 7); ProcessModuleWow64Safe[] modules = game.ModulesWow64Safe(); ProcessModuleWow64Safe server = modules.FirstOrDefault(x => x.ModuleName.ToLower() == "server.dll"); ProcessModuleWow64Safe engine = modules.FirstOrDefault(x => x.ModuleName.ToLower() == "engine2.dll"); while (server == null || engine == null) { Console.WriteLine("[INIT] Modules aren't yet loaded! Waiting 1 second until next try"); Thread.Sleep(1000); } var serverScanner = new SignatureScanner(game, server.BaseAddress, server.ModuleMemorySize); var engineScanner = new SignatureScanner(game, engine.BaseAddress, engine.ModuleMemorySize); _entListPtr = serverScanner.Scan(_entListSig); SigReport("entity list", _entListPtr); _gamePathPtr = engineScanner.Scan(_gamePathSig); SigReport("game path / map name", _gamePathPtr); Console.WriteLine("gamepath " + game.ReadString(_gamePathPtr, 255) + " "); _mapName = new StringWatcher(_mapNamePtr, 255); _watchers.Add(_mapName); }
public override TimerAction[] OnMapLoad(MemoryWatcherList watchers) { var status = (MemoryWatcher <Status>)watchers["status"]; _map = (StringWatcher)watchers["map"]; if (status.Current == Status.LoadingMap) { if (_map.Current.ToLower() == "mf-warehouse") { return new TimerAction[] { TimerAction.Start } } ; } return(null); } }
public override TimerAction[] OnMapLoad(MemoryWatcherList watchers) { var status = (MemoryWatcher <Status>)watchers["status"]; _map = (StringWatcher)watchers["map"]; if (status.Current == Status.LoadingMap) { Debug.WriteLine("Wat is this:" + _map.Current); if (_map.Current.ToLower() == "..\\maps\\map00") { return new TimerAction[] { TimerAction.Start } } ; } return(null); } }
Process GetGameProcess() { Process game = null; var processes = SupportedProcessesNames.SelectMany(n => Process.GetProcessesByName(n)) .OrderByDescending(p => p.StartTime); foreach (var p in processes) { if (p.HasExited || _ignorePIDs.Contains(p.Id)) { continue; } var ignoreProcess = true; foreach (var gameSupport in SupportedGames) { if (!gameSupport.ProcessNames.Contains(p.ProcessName.ToLower())) { continue; } var modules = p.ModulesWow64Safe(); if (!gameSupport.GetHookModules().All(hook_m => modules.Any(m => hook_m.ToLower() == m.ModuleName.ToLower()))) { ignoreProcess = false; continue; } switch (gameSupport.IdentifyProcess(p)) { case IdentificationResult.Success: game = p; Game = gameSupport; break; case IdentificationResult.Undecisive: ignoreProcess = false; // don't ignore if at least one game is unsure break; } if (game != null) { break; } } if (game != null) { break; } if (ignoreProcess) { _ignorePIDs.Add(p.Id); } } if (game == null) { return(null); } if (_lastPID != game.Id) { _watchers.Clear(); if (!Patch(game)) { return(null); } var stringType = _loadMapHook == null || _loadMapHook.Encoding == StringType.ASCII ? ReadStringType.ASCII : ReadStringType.UTF16; _map = new StringWatcher(_mapPtr, stringType, MAP_SIZE) { Name = "map" }; _status = new MemoryWatcher <int>(_statusPtr) { Name = "status" }; _watchers.AddRange(new MemoryWatcher[] { _status, _map }); } _lastPID = game.Id; return(game); }