public static Tuple <IntPtr, IntPtr> GetAddressRange(Process program, string asmName)
        {
            Module64 module = program.Module64(asmName);

            if (module != null)
            {
                return(new Tuple <IntPtr, IntPtr>(module.BaseAddress, module.BaseAddress + module.MemorySize));
            }
            return(new Tuple <IntPtr, IntPtr>(IntPtr.Zero, IntPtr.Zero));
        }
        public bool HookProcess()
        {
            IsHooked = Program != null && !Program.HasExited;
            if (!IsHooked && DateTime.Now > LastHooked.AddSeconds(1))
            {
                LastHooked = DateTime.Now;

                Process[] processes = Process.GetProcessesByName("OriWotW");
                Program = processes != null && processes.Length > 0 ? processes[0] : null;

                if (Program == null)
                {
                    processes = Process.GetProcessesByName("OriAndTheWillOfTheWisps");
                    Program   = processes != null && processes.Length > 0 ? processes[0] : null;
                }

                if (Program == null)
                {
                    processes = Process.GetProcessesByName("OriAndTheWillOfTheWisps-PC");
                    Program   = processes != null && processes.Length > 0 ? processes[0] : null;
                }

                if (Program != null && !Program.HasExited)
                {
                    MemoryReader.Update64Bit(Program);
                    FindIl2Cpp.InitializeIl2Cpp(Program);
                    Module64 module = Program.Module64("GameAssembly.dll");
                    MemoryManager.Version = PointerVersion.All;
                    if (module != null)
                    {
                        switch (module.MemorySize)
                        {
                        case 77447168: MemoryManager.Version = PointerVersion.V2; break;

                        case 77844480: MemoryManager.Version = PointerVersion.V3; break;
                        }
                    }
                    uberIDLookup   = null;
                    noPausePatched = null;
                    debugEnabled   = null;
                    IsHooked       = true;
                    fpsTimer.Reset();
                }
            }

            fpsTimer.Update(IsHooked ? FrameCount() : 0);
            return(IsHooked);
        }
Exemple #3
0
 public static Module64 Module64(this Process p, string moduleName)
 {
     Module64[] modules = p.Modules64();
     if (modules != null)
     {
         for (int i = 0; i < modules.Length; i++)
         {
             Module64 module = modules[i];
             if (module.Name.Equals(moduleName, StringComparison.OrdinalIgnoreCase))
             {
                 return(module);
             }
         }
     }
     return(null);
 }