Example #1
0
        public void SetProcess(ProcessModel processModel, string gameLanguage = "English", string patchVersion = "latest", bool ignoreJSONCache = false, bool scanAllMemoryRegions = false)
        {
            ProcessModel    = processModel;
            GameLanguage    = gameLanguage;
            IgnoreJSONCache = ignoreJSONCache;
            try
            {
                ProcessHandle = UnsafeNativeMethods.OpenProcess(UnsafeNativeMethods.ProcessAccessFlags.PROCESS_VM_ALL, false, (uint)ProcessModel.ProcessID);
            }
            catch (Exception)
            {
                ProcessHandle = processModel.Process.Handle;
            }
            Constants.ProcessHandle = ProcessHandle;

            _systemModules = GetProcessModules();

            SetStructures(processModel, patchVersion);

            Scanner.Instance.Locations.Clear();
            Scanner.Instance.LoadOffsets(Signatures.Resolve(processModel, patchVersion), scanAllMemoryRegions);

            ActionHelper.Resolve();
            StatusEffectHelper.Resolve();
            ZoneHelper.Resolve();
        }
Example #2
0
        public void SetProcess(ProcessModel processModel, string gameLanguage = "English", string patchVersion = "latest", bool useLocalCache = true, bool scanAllMemoryRegions = false)
        {
            ProcessModel  = processModel;
            GameLanguage  = gameLanguage;
            UseLocalCache = useLocalCache;

            UnsetProcess();

            try
            {
                ProcessHandle = UnsafeNativeMethods.OpenProcess(UnsafeNativeMethods.ProcessAccessFlags.PROCESS_VM_ALL, false, (uint)ProcessModel.ProcessID);
            }
            catch (Exception)
            {
                ProcessHandle = processModel.Process.Handle;
            }
            finally
            {
                Constants.ProcessHandle = ProcessHandle;
                IsAttached = true;
            }

            if (IsNewInstance)
            {
                IsNewInstance = false;

                ActionHelper.Resolve();
                StatusEffectHelper.Resolve();
                ZoneHelper.Resolve();

                ResolveMemoryStructures(processModel, patchVersion);
            }

            AttachmentWorker = new AttachmentWorker();
            AttachmentWorker.StartScanning(processModel);

            SystemModules.Clear();
            GetProcessModules();

            Scanner.Instance.Locations.Clear();
            Scanner.Instance.LoadOffsets(Signatures.Resolve(processModel, patchVersion), scanAllMemoryRegions);
        }