Beispiel #1
0
        public GameState()
        {
            ctx = MemoryContext.FromProcess();
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            lastRift = stopwatch;
            UpdateGameState();
            clientWidth  = snapshot.Window.ClientRect.Width;
            clientHeight = snapshot.Window.ClientRect.Height;
        }
Beispiel #2
0
        internal static void Main(string[] args)
        {
            Console.WindowWidth = 120;
            Console.BufferWidth = 120;

            Console.WriteLine("Creating context.");
            var ctx = MemoryContext.FromProcess(new ManualResetEvent(false));

            Console.WriteLine("Context created.");

            Track(() => ctx.DataSegment.ObjectManager.PlayerDataManager[0]);
        }
Beispiel #3
0
        private MemoryContext CreateMemoryContext()
        {
            var ctx = default(MemoryContext);

            // Wait for process attachment.
            while ((ctx = MemoryContext.FromProcess()) == null)
            {
                Thread.Sleep(1000);
            }

            // Wait for full initialization.
            while (ctx.DataSegment.ApplicationLoopCount == 0)
            {
                Thread.Sleep(1000);
            }

            return(ctx);
        }
Beispiel #4
0
        private MemoryContext CreateMemoryContext()
        {
            var ctx = default(MemoryContext);

            while (ctx == null)
            {
                var processes = Process.GetProcessesByName("Diablo III64");
                if (processes.Any())
                {
                    var process = default(Process);
                    if (processes.Length == 1)
                    {
                        process = processes[0];
                    }

                    if (process != null)
                    {
                        ctx = MemoryContext.FromProcess(process);
                        break;
                    }
                }
                else
                {
                    Trace.WriteLine("Could not find any process.");
                }
                Thread.Sleep(1000);
            }
            Trace.WriteLine("Found a process.");

            while (true)
            {
                try
                {
                    SymbolPatcher64.UpdateSymbolTable(ctx);
                    Trace.WriteLine("Symbol table updated.");
                    return(ctx);
                }
                catch (Exception exception)
                {
                    Trace.WriteLine($"Could not update symbol table, optimized for patch {SymbolPatcher64.VerifiedBuild}, running {ctx.MainModuleVersion.Revision}: " + exception.Message);
                    Thread.Sleep(5000);
                }
            }
        }