From 3c8a099788cf13bd38f17f7be846c363cb2f7100 Mon Sep 17 00:00:00 2001 From: Noah Sherwin Date: Wed, 27 Jan 2021 22:19:51 -0800 Subject: [PATCH 1/2] Add Throttle to SPV3.Configuration.Chimera SPV3.Configuration.Chimera * Added Throttle/_throttle --- src/Configuration.Chimera.cs | 40 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/src/Configuration.Chimera.cs b/src/Configuration.Chimera.cs index 9323e52f..be8f0af9 100644 --- a/src/Configuration.Chimera.cs +++ b/src/Configuration.Chimera.cs @@ -27,12 +27,13 @@ namespace SPV3 { - public class ConfigurationChimera : INotifyPropertyChanged - { + public class ConfigurationChimera : INotifyPropertyChanged + { private bool _anisotropicFiltering = true; - private bool _blockLOD = false; - private int _interpolation = 8; - private bool _uncapCinematic = true; + private bool _blockLOD = false; + private int _interpolation = 8; + private bool _uncapCinematic = true; + private byte _throttle = 0; public Chimera Configuration { get; } = (Chimera) Chimera(Paths.Directory); @@ -80,6 +81,17 @@ public bool BlockLOD } } + public byte Throttle + { + get => _throttle; + set + { + if (value == _throttle) return; + _throttle = value; + OnPropertyChanged(); + } + } + public event PropertyChangedEventHandler PropertyChanged; public void Load() @@ -88,18 +100,20 @@ public void Load() Configuration.Load(); - Interpolation = Configuration.Interpolation; - AnisotropicFiltering = Configuration.AnisotropicFiltering; - UncapCinematic = Configuration.UncapCinematic; - BlockLOD = Configuration.BlockLOD; + Interpolation = Configuration.Interpolation; + AnisotropicFiltering = Configuration.AnisotropicFiltering; + UncapCinematic = Configuration.UncapCinematic; + BlockLOD = Configuration.BlockLOD; + Throttle = Configuration.Throttle; } public void Save() { - Configuration.Interpolation = (byte) Interpolation; - Configuration.AnisotropicFiltering = AnisotropicFiltering; - Configuration.UncapCinematic = UncapCinematic; - Configuration.BlockLOD = BlockLOD; + Configuration.Interpolation = (byte) Interpolation; + Configuration.AnisotropicFiltering = AnisotropicFiltering; + Configuration.UncapCinematic = UncapCinematic; + Configuration.BlockLOD = BlockLOD; + Configuration.Throttle = Throttle; Configuration.Save(); } From adb0334c2aa543768e1a6f080545849783bc8b70 Mon Sep 17 00:00:00 2001 From: Noah Sherwin Date: Thu, 28 Jan 2021 02:38:15 -0800 Subject: [PATCH 2/2] Add Chimera Throttle to SPV3 Configurator, infer from framerate; Changed VSync to ComboBox SPV3.Configuration.Loader * Added FramerateControl byte with switch affecting FramerateIsCapped and Vsync booleans. * Set Vsync to False by default. * Added FramerateIsCapped boolean. SPV3.Configuration.UserControl * Changed Vsync to FramerateControl ComboBox. * Assign Framerate-1 to Chimera's Throttle during UserControl initialization. * Added FramerateControl() to modify Chimera.Throttle when the Framerate or FramerateControl is changed. --- src/Configuration.Loader.cs | 93 +++++++++++++++++++-------- src/Configuration.UserControl.xaml | 22 +++++-- src/Configuration.UserControl.xaml.cs | 65 +++++++++++++------ 3 files changed, 128 insertions(+), 52 deletions(-) diff --git a/src/Configuration.Loader.cs b/src/Configuration.Loader.cs index 67094837..f3e080af 100644 --- a/src/Configuration.Loader.cs +++ b/src/Configuration.Loader.cs @@ -36,24 +36,27 @@ public class ConfigurationLoader : INotifyPropertyChanged { private const int Length = 256; - private byte _adapter; /* physical monitor to run hce/spv3 on */ - private bool _borderless = false; /* run hce/spv3 without window borders */ - private bool _cinemabars = false; /* toggle spv3 cinematic black bars */ - private byte _displayMode = 0; /* display - fullscreen/window/borderless */ - private bool _doom = false; /* toggle spv3 doom mode */ - private bool _eax = false; /* toggle hw accel. & environmental sound */ - private bool _elevated = false; /* runs spv3/hce in elevated (admin) mode */ - private byte _framerate = 60; /* framerate to run spv3 at (in vsync mode) */ - private bool _gammaOn = false; /* when false, runs spv3/hce with -nogamma */ - private byte _gamma = 150; /* gamma level to run spv3 at (in vsync mode) */ - private ushort _height = (ushort) PrimaryScreen.Bounds.Height; /* height spv3/hce will be displayed at */ - private bool _photo = false; /* enables spv3 photo/blind mode */ - private bool _preset = true; /* use the built-in spv3 controller preset */ - private bool _resolutionEnabled = false; /* ability to provide custom resolution */ - private bool _shaders = true; /* toggle spv3 post-processing effects */ - private bool _vsync = false; /* V-sync preference (locked vs unlocked) */ - private ushort _width = (ushort) PrimaryScreen.Bounds.Width; /* width spv3/hce will be displayed at */ - private bool _window = false; /* runs spv3/hce as a windowed application */ + private byte _adapter; /* physical monitor to run hce/spv3 on */ + private bool _borderless = false; /* run hce/spv3 without window borders */ + private bool _cinemabars = false; /* toggle spv3 cinematic black bars */ + private byte _displayMode = 0; /* display - fullscreen/window/borderless */ + private bool _doom = false; /* toggle spv3 doom mode */ + private bool _eax = false; /* toggle hw accel. & environmental sound */ + private bool _elevated = false; /* runs spv3/hce in elevated (admin) mode */ + private byte _framerate = 60; /* framerate to run spv3 at (in vsync mode) */ + private byte _framerateControl = 1; /* fps control - vsync, throttle, uncap */ + private bool _framerateIsCapped = true; + + private bool _gammaOn = false; /* when false, runs spv3/hce with -nogamma */ + private byte _gamma = 150; /* gamma level to run spv3 at (in vsync mode) */ + private ushort _height = (ushort) PrimaryScreen.Bounds.Height; /* height spv3/hce will be displayed at */ + private bool _photo = false; /* enables spv3 photo/blind mode */ + private bool _preset = true; /* use the built-in spv3 controller preset */ + private bool _resolutionEnabled = false; /* ability to provide custom resolution */ + private bool _shaders = true; /* toggle spv3 post-processing effects */ + private bool _vsync = false; /* V-sync preference (locked vs unlocked) */ + private ushort _width = (ushort) PrimaryScreen.Bounds.Width; /* width spv3/hce will be displayed at */ + private bool _window = false; /* runs spv3/hce as a windowed application */ /** * 0 == Fullscreen @@ -168,17 +171,44 @@ public byte Framerate } } - public bool Vsync + public byte FramerateControl { - get => _vsync; - set + get => _framerateControl; + set + { + if (value == _framerateControl) return; + _framerateControl = value; + OnPropertyChanged(); + switch (value) { - if (value == _vsync) return; - _vsync = value; - OnPropertyChanged(); - if (value == true) - ResetDisplayMode(); + case 0: // V-Sync + FramerateIsCapped = true; + Vsync = true; + break; + case 1: // Throttle + FramerateIsCapped = true; + Vsync = false; + break; + case 2: // Unlimited + FramerateIsCapped = false; + Vsync = false; + break; + default: break; } + } + } + + public bool Vsync + { + get => _vsync; + set + { + if (value == _vsync) return; + _vsync = value; + OnPropertyChanged(); + if (value == true) + ResetDisplayMode(); + } } public bool EAX @@ -273,6 +303,17 @@ public bool Elevated } } + public bool FramerateIsCapped + { + get => _framerateIsCapped; + set + { + if (value == _framerateIsCapped) return; + _framerateIsCapped = value; + OnPropertyChanged(); + } + } + public List Adapters => AllScreens .Select ( diff --git a/src/Configuration.UserControl.xaml b/src/Configuration.UserControl.xaml index 96235b79..c9b945af 100644 --- a/src/Configuration.UserControl.xaml +++ b/src/Configuration.UserControl.xaml @@ -101,15 +101,25 @@ IsEnabled="{Binding Loader.ResolutionEnabled}" Grid.ColumnSpan="1" /> -