コード例 #1
0
ファイル: Form1.cs プロジェクト: lostlsend/FF12PCRNGHelper
        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;
                }
            }
        }