private void SetFoVNumeric(decimal fov) { ClampEx.Clamp(ref fov, FoVNumeric.Minimum, FoVNumeric.Maximum); if (FoVNumeric.InvokeRequired) { FoVNumeric.BeginInvoke((MethodInvoker) delegate() { FoVNumeric.Value = fov; }); } else { FoVNumeric.Value = fov; } }
private void DoRAChecks() //this is where we do aspect ratio checks to ensure we limit FoV at non-widescreen values to reduce potential for any cheating { if (SelectedMemory == null || !SelectedMemory.IsRunning() || SelectedMemory.ProcMemory.RequiresElevation() || CurrentSession == null || CurrentSession.GetSessionTime().TotalSeconds < 30) { return; //if you do aspect ratio checks too soon, they'll return invalid values } try { var mode = SelectedMemory.ReadIntAddress(MemoryAddresses.UO_R_MODE_ADDRESS, 0x20); var ratio = 0d; if (mode == -1) { var width = SelectedMemory.ReadIntAddress(MemoryAddresses.UO_R_WIDTH_ADDRESS, 0x20); var height = SelectedMemory.ReadIntAddress(MemoryAddresses.UO_R_HEIGHT_ADDRESS, 0x20); if (width <= 0 || height <= 0) { Log.WriteLine("Got bad width/height: " + width + ", " + height); return; } ratio = width / (double)height; } var maxFoV = (mode != -1 || (ratio < 1.7 && mode == -1)) ? 105 : 130; if (FoVNumeric.InvokeRequired) { FoVNumeric.Invoke((MethodInvoker) delegate() { FoVNumeric.Maximum = maxFoV; }); } else { FoVNumeric.Maximum = maxFoV; } SetFoVNumeric(FoVNumeric.Value); //will set it to the value if it can, if not, falls back on maximum } catch (Exception ex) { Log.WriteLine("An exception happened while trying to get current game resolution:" + Environment.NewLine + ex.ToString()); } }