Exemple #1
0
        private void Timer1_Tick(object sender, EventArgs e)
        {
            if (this._lock)
            {
                return;
            }

            if (RemoteMem == null)
            {
                if (this.AttachProc())
                {
                    if (Config.PatchAutoPause)
                    {
                        AutoPause.Apply();
                    }
                }
            }
            else
            {
                try
                {
                    var(mt, mti) = RemoteMem.GetMtAndMti(MemoryData.MtAddress);

                    this._movement = this._rng.Sync(mti, in mt);

                    // On load or rng injection, reload and reset.
                    if (this._movement == -1)
                    {
                        this._rng.LoadState(mti, in mt);
                        this.ResetGridHighlighting();
                    }

                    this.Generate();
                }
                // Couldn't read from process, so we dispose.
                catch (Win32Exception)
                {
                    RemoteMem.Dispose();
                    RemoteMem = null;
                }
            }
        }
Exemple #2
0
        private void ForceUpdate()
        {
            if (RemoteMem == null)
            {
                return;
            }

            try
            {
                this._movement = -1;
                var(mt, mti)   = RemoteMem.GetMtAndMti(MemoryData.MtAddress);
                this._rng.LoadState(mti, in mt);
                this.Generate();
            }
            // Couldn't read from process, so we dispose.
            catch (Win32Exception)
            {
                RemoteMem.Dispose();
                RemoteMem = null;
            }
        }
Exemple #3
0
        private bool AttachProc()
        {
            if (RemoteMem != null)
            {
                return(false);
            }

            var procs = Process.GetProcessesByName("FFXII_TZA");

            if (!procs.Any())
            {
                return(false);
            }

            var proc = procs.Single();

            if (proc.HasExited)
            {
                return(false);
            }

            RemoteMem = new RemoteMemory(proc);
            return(true);
        }