Beispiel #1
0
        public bool FindProcess()
        {
            if (HasProcess())
            {
                return(true);
            }

            if (processChanged_)
            {
                processChanged_ = false;
            }

            // Only support the DirectX 11 binary. The DirectX 9 one has different addresses.
            Process found_process = (from x in new Process[] { ffxiv_.GetCurrentFFXIVProcess() }
                                     where x != null && !x.HasExited && x.MainModule != null && x.MainModule.ModuleName == "ffxiv_dx11.exe"
                                     select x).FirstOrDefault <Process>();

            if (found_process != null && found_process.HasExited)
            {
                found_process = null;
            }
            bool changed_existance = (process_ == null) != (found_process == null);
            bool changed_pid       = process_ != null && found_process != null && process_.Id != found_process.Id;

            if (changed_existance || changed_pid)
            {
                player_ptr_addr_     = IntPtr.Zero;
                job_data_outer_addr_ = IntPtr.Zero;
                process_             = found_process != null ? new LimitedProcess(found_process) : null;

                if (process_ != null)
                {
                    ReadSignatures();
                }
            }

            if (process_ == null && !showed_dx9_error_)
            {
                int found_32bit = (from x in Process.GetProcessesByName("ffxiv")
                                   where !x.HasExited && x.MainModule != null && x.MainModule.ModuleName == "ffxiv.exe"
                                   select x).Count();
                if (found_32bit > 0)
                {
                    logger_.Log(LogLevel.Error, "Found DirectX9 FFXIV process. Requires DirectX11.");
                    showed_dx9_error_ = true;
                }
            }

            return(process_ != null);
        }
Beispiel #2
0
        private Process FindProcess()
        {
            Process process = FFXIVRepository.GetCurrentFFXIVProcess();

            if (process == null)
            {
                return(null);
            }
            if (process.ProcessName == "ffxiv")
            {
                logger.Log(LogLevel.Error, "{0}", "DX9 is not supported.");
                return(null);
            }
            else if (process.ProcessName != "ffxiv_dx11")
            {
                logger.Log(LogLevel.Error, "{0}", "Unknown ffxiv process.");
                return(null);
            }
            return(process);
        }
Beispiel #3
0
        private void FindProcess()
        {
            if (processHandle != IntPtr.Zero)
            {
                if (process != null && !process.HasExited)
                {
                    // The current handle is still valid.
                    return;
                }
                else
                {
                    CloseProcessHandle();
                }
            }

            Process proc = repository.GetCurrentFFXIVProcess();

            if (proc == null || proc.HasExited)
            {
                return;
            }

            if (proc.ProcessName == "ffxiv")
            {
                if (!hasLoggedDx9)
                {
                    hasLoggedDx9 = true;
                    logger.Log(LogLevel.Error, "{0}", "不支持 DX9 模式启动的游戏,请参考 https://www.yuque.com/ffcafe/act/dx11/ 解决");
                }
                return;
            }
            else if (proc.ProcessName != "ffxiv_dx11")
            {
                logger.Log(LogLevel.Error, "{0}", "Unknown ffxiv process.");
                return;
            }

            process       = proc;
            processHandle = NativeMethods.OpenProcess(ProcessAccessFlags.VirtualMemoryRead, false, proc.Id);
            logger.Log(LogLevel.Info, "游戏进程:{0},来源:解析插件轮询", proc.Id);
        }
Beispiel #4
0
        private void FindProcess()
        {
            return;

            if (processHandle != IntPtr.Zero)
            {
                if (process != null && !process.HasExited)
                {
                    // The current handle is still valid.
                    return;
                }
                else
                {
                    CloseProcessHandle();
                }
            }

            Process proc = repository.GetCurrentFFXIVProcess();

            if (proc == null || proc.HasExited)
            {
                return;
            }

            if (proc.ProcessName == "ffxiv")
            {
                logger.Log(LogLevel.Error, "{0}", "DX9 is not supported.");
                return;
            }
            else if (proc.ProcessName != "ffxiv_dx11")
            {
                logger.Log(LogLevel.Error, "{0}", "Unknown ffxiv process.");
                return;
            }

            process       = proc;
            processHandle = NativeMethods.OpenProcess(ProcessAccessFlags.VirtualMemoryRead, false, proc.Id);
        }