2022-09-08 21:29:16 +02:00
|
|
|
|
using BepInEx;
|
2023-04-02 09:13:21 +02:00
|
|
|
|
using BepInEx.Bootstrap;
|
2022-09-08 21:29:16 +02:00
|
|
|
|
using BepInEx.Configuration;
|
|
|
|
|
using Comfort.Common;
|
2023-01-10 11:49:09 +01:00
|
|
|
|
using EFT;
|
2022-09-18 23:54:23 +02:00
|
|
|
|
using EFT.Settings.Graphics;
|
2023-01-10 11:49:09 +01:00
|
|
|
|
using System.Collections;
|
2022-09-20 22:43:40 +02:00
|
|
|
|
using System.ComponentModel;
|
2023-01-10 11:49:09 +01:00
|
|
|
|
using UnityEngine;
|
2022-09-08 21:29:16 +02:00
|
|
|
|
|
2023-01-10 11:49:09 +01:00
|
|
|
|
/* Dependencies:
|
|
|
|
|
* ../BepInEx/core/
|
|
|
|
|
* BepInEx.dll
|
|
|
|
|
* ../EscapeFromTarkov_Data/Managed/
|
|
|
|
|
* Aki.Reflection.dll
|
|
|
|
|
* Assembly-CSharp.dll
|
|
|
|
|
* Comfort.dll
|
|
|
|
|
* ItemComponent.Types.dll
|
|
|
|
|
* System.dll
|
|
|
|
|
* Unity.Postprocessing.Runtime.dll
|
|
|
|
|
* UnityEngine.dll
|
|
|
|
|
* UnityEngine.CoreModule.dll
|
|
|
|
|
*/
|
2022-09-17 20:08:36 +02:00
|
|
|
|
namespace ScopeTweaks
|
2022-09-08 21:29:16 +02:00
|
|
|
|
{
|
2023-04-01 16:46:33 +02:00
|
|
|
|
[BepInPlugin("com.notGreg.scopeTweaks", "notGreg's Scope Tweaks", "3.5.3")]
|
2023-04-02 09:13:21 +02:00
|
|
|
|
[BepInDependency("FOVFix", BepInDependency.DependencyFlags.SoftDependency)]
|
2022-09-08 21:29:16 +02:00
|
|
|
|
public class Plugin : BaseUnityPlugin
|
|
|
|
|
{
|
|
|
|
|
ConfigEntry<int> scopeCameraResolutionScale;
|
2023-04-03 11:47:11 +02:00
|
|
|
|
//ConfigEntry<EFOVScalingMode> scopeFixType;
|
2022-09-28 20:14:35 +02:00
|
|
|
|
ConfigEntry<bool> enableDebug;
|
2022-09-16 13:24:26 +02:00
|
|
|
|
|
2022-09-18 22:12:16 +02:00
|
|
|
|
enum EFOVScalingMode
|
2022-09-17 19:49:55 +02:00
|
|
|
|
{
|
2022-09-16 13:24:26 +02:00
|
|
|
|
Disabled,
|
2022-09-20 22:43:40 +02:00
|
|
|
|
[Description("Magnified optics")]
|
|
|
|
|
ScopesOnly,
|
|
|
|
|
[Description("All sights")]
|
|
|
|
|
All,
|
2022-09-16 13:24:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-01-10 11:49:09 +01:00
|
|
|
|
//The following assignments should allow for faster patching in the future.
|
|
|
|
|
|
2023-04-01 16:46:33 +02:00
|
|
|
|
//The correct GClass can be found by searching for "ClearSettings" in Assembly-CSharp.dll via dnSpy, netFiddle, ilSpy, etc.
|
|
|
|
|
SharedGameSettingsClass settingsLibrary = Singleton<SharedGameSettingsClass>.Instance;
|
2023-01-10 11:49:09 +01:00
|
|
|
|
|
|
|
|
|
//The correct GClass can be found by searching for "SetFov" in Assembly-CSharp.dll via dnSpy, netFiddle, ilSpy, etc.
|
2023-04-01 16:46:33 +02:00
|
|
|
|
CameraClass setFovLibrary = CameraClass.Instance;
|
2023-01-10 11:49:09 +01:00
|
|
|
|
|
2022-09-17 19:49:55 +02:00
|
|
|
|
void Awake()
|
|
|
|
|
{
|
2023-04-02 09:13:21 +02:00
|
|
|
|
if (Chainloader.PluginInfos.ContainsKey("FOVFix"))
|
|
|
|
|
{
|
|
|
|
|
Logger.LogWarning("Fontaine's FOV Fix detected! FOV Fix will NOT be available.");
|
|
|
|
|
}
|
2022-09-17 19:49:55 +02:00
|
|
|
|
|
|
|
|
|
scopeCameraResolutionScale = Config.Bind(
|
|
|
|
|
"General",
|
|
|
|
|
"Scope camera scale %",
|
2022-09-20 22:02:46 +02:00
|
|
|
|
80,
|
2023-04-02 09:13:21 +02:00
|
|
|
|
new ConfigDescription("Additional override applied on top of currently enabled resolution scaling method.", new AcceptableValueRange<int>(10, 100)));
|
2022-09-24 08:42:25 +02:00
|
|
|
|
|
2023-04-03 11:47:11 +02:00
|
|
|
|
//scopeFixType = Config.Bind(
|
|
|
|
|
//"General",
|
|
|
|
|
//"High FOV sight tweak",
|
|
|
|
|
//EFOVScalingMode.ScopesOnly,
|
|
|
|
|
//new ConfigDescription(""));
|
2022-09-24 08:42:25 +02:00
|
|
|
|
|
2022-09-28 20:14:35 +02:00
|
|
|
|
enableDebug = Config.Bind("Debug", "Enable debug logging", false);
|
|
|
|
|
}
|
2022-09-16 10:29:54 +02:00
|
|
|
|
|
2023-02-27 20:25:16 +01:00
|
|
|
|
void FixedUpdate()
|
2022-09-17 19:49:55 +02:00
|
|
|
|
{
|
2023-01-10 11:49:09 +01:00
|
|
|
|
//Check if the game is in a valid state and execute logic depening on the status of the game
|
2022-09-20 22:02:46 +02:00
|
|
|
|
if (Singleton<AbstractGame>.Instance == null) return;
|
|
|
|
|
GameStatus currentGameState = Singleton<AbstractGame>.Instance.Status;
|
2022-09-16 13:24:26 +02:00
|
|
|
|
|
2023-04-03 11:47:11 +02:00
|
|
|
|
if (mainPlayer != null)
|
|
|
|
|
{
|
|
|
|
|
if (Input.GetKeyDown("["))
|
|
|
|
|
{
|
|
|
|
|
StopAllCoroutines();
|
|
|
|
|
CameraClass.Instance.SetFov(35, 1.0f, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Input.GetKeyDown("]"))
|
|
|
|
|
{
|
|
|
|
|
StopAllCoroutines();
|
|
|
|
|
CameraClass.Instance.SetFov(defaultInGameFOV, 1.0f, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (mainPlayer != null && mainPlayer.ProceduralWeaponAnimation.IsAiming)
|
|
|
|
|
//{
|
|
|
|
|
// if (Input.GetMouseButtonDown(0))
|
|
|
|
|
// {
|
|
|
|
|
// inGameFOV = 50;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if (Input.GetMouseButtonUp(0))
|
|
|
|
|
// {
|
|
|
|
|
// inGameFOV = defaultInGameFOV;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
2023-01-10 11:49:09 +01:00
|
|
|
|
//logic should only execute once per game instead of every frame
|
2022-09-20 22:02:46 +02:00
|
|
|
|
if (!gameStateChanged(currentGameState)) return;
|
2022-09-16 10:29:54 +02:00
|
|
|
|
|
2023-01-10 11:49:09 +01:00
|
|
|
|
switch (currentGameState)
|
2022-09-16 10:29:54 +02:00
|
|
|
|
{
|
2022-09-20 22:02:46 +02:00
|
|
|
|
case GameStatus.Started:
|
|
|
|
|
{
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo("Getting local player");
|
2022-09-20 22:02:46 +02:00
|
|
|
|
mainPlayer = getLocalPlayer();
|
2022-09-08 21:29:16 +02:00
|
|
|
|
|
2022-09-20 22:02:46 +02:00
|
|
|
|
subscribeHandsChangedEvent();
|
2022-09-08 21:29:16 +02:00
|
|
|
|
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo("Assigning cameras...");
|
2022-09-20 22:02:46 +02:00
|
|
|
|
StartCoroutine(tryGetScopeCamera());
|
2022-09-15 21:14:26 +02:00
|
|
|
|
|
2022-09-28 20:14:35 +02:00
|
|
|
|
defaultInGameFOV = inGameFOV;
|
2022-09-20 22:02:46 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GameStatus.SoftStopping:
|
2022-09-28 20:14:35 +02:00
|
|
|
|
case GameStatus.Stopping:
|
2022-09-20 22:02:46 +02:00
|
|
|
|
case GameStatus.Stopped:
|
|
|
|
|
{
|
2022-09-28 20:14:35 +02:00
|
|
|
|
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo("Resetting...");
|
2022-09-20 22:02:46 +02:00
|
|
|
|
scopeCamera = null;
|
|
|
|
|
mainPlayer = null;
|
2022-09-28 20:14:35 +02:00
|
|
|
|
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo($"Restoring FOV in settings: {defaultInGameFOV}");
|
2022-09-28 20:14:35 +02:00
|
|
|
|
inGameFOV = defaultInGameFOV;
|
|
|
|
|
|
2022-09-20 22:02:46 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default: break;
|
2022-09-15 21:14:26 +02:00
|
|
|
|
}
|
2022-09-20 22:02:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// GAME STATUS
|
|
|
|
|
/// </summary>
|
2022-09-15 21:14:26 +02:00
|
|
|
|
|
2022-09-20 22:02:46 +02:00
|
|
|
|
GameStatus lastGameState;
|
2023-01-10 11:49:09 +01:00
|
|
|
|
//compare current game status to the last saved game status, return true if game status has changed
|
2022-09-20 22:02:46 +02:00
|
|
|
|
bool gameStateChanged(GameStatus currentState)
|
|
|
|
|
{
|
|
|
|
|
if (currentState == lastGameState) return false;
|
|
|
|
|
lastGameState = currentState;
|
|
|
|
|
return true;
|
2022-09-17 19:49:55 +02:00
|
|
|
|
}
|
2022-09-16 13:24:26 +02:00
|
|
|
|
|
2023-04-01 16:46:33 +02:00
|
|
|
|
Player mainPlayer = null;
|
2023-01-10 11:49:09 +01:00
|
|
|
|
//find and return the player character in the session
|
2022-09-20 22:02:46 +02:00
|
|
|
|
Player getLocalPlayer()
|
2022-09-18 22:12:16 +02:00
|
|
|
|
{
|
2023-02-27 20:25:16 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo("Looking for local player...");
|
|
|
|
|
Player localPlayer = Singleton<GameWorld>.Instance.RegisteredPlayers.Find(p => p.IsYourPlayer);
|
|
|
|
|
if (enableDebug.Value && localPlayer != null) Logger.LogInfo($"Found local player: {localPlayer.GetType()}");
|
|
|
|
|
return localPlayer;
|
2022-09-18 22:12:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-20 22:02:46 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// FIELD OF VIEW
|
|
|
|
|
/// </summary>
|
2022-09-28 20:14:35 +02:00
|
|
|
|
///
|
|
|
|
|
private int defaultInGameFOV;
|
|
|
|
|
private int inGameFOV
|
2022-09-18 22:12:16 +02:00
|
|
|
|
{
|
2023-01-10 11:49:09 +01:00
|
|
|
|
get
|
|
|
|
|
{
|
2023-04-01 16:46:33 +02:00
|
|
|
|
int fov = Singleton<SharedGameSettingsClass>.Instance.Game.Settings.FieldOfView.Value;
|
2022-09-28 20:14:35 +02:00
|
|
|
|
return fov;
|
|
|
|
|
}
|
2023-01-10 11:49:09 +01:00
|
|
|
|
set
|
|
|
|
|
{
|
2023-04-01 16:46:33 +02:00
|
|
|
|
Singleton<SharedGameSettingsClass>.Instance.Game.Settings.FieldOfView.Value = value;
|
2022-09-28 20:14:35 +02:00
|
|
|
|
}
|
2022-09-18 22:12:16 +02:00
|
|
|
|
}
|
2022-09-18 23:54:23 +02:00
|
|
|
|
|
2022-09-20 22:02:46 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// CAMERA SETUP
|
|
|
|
|
/// </summary>
|
2022-09-24 08:42:25 +02:00
|
|
|
|
Camera scopeCamera = null;
|
|
|
|
|
|
2022-09-20 22:02:46 +02:00
|
|
|
|
IEnumerator tryGetScopeCamera()
|
2022-09-17 19:49:55 +02:00
|
|
|
|
{
|
2022-09-20 22:02:46 +02:00
|
|
|
|
string cameraName = "BaseOpticCamera(Clone)";
|
|
|
|
|
if (GameObject.Find(cameraName) != null)
|
2022-09-17 19:49:55 +02:00
|
|
|
|
{
|
2022-09-20 22:02:46 +02:00
|
|
|
|
scopeCamera = GameObject.Find(cameraName).GetComponent<Camera>();
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo($"Camera \"{scopeCamera.name}\" found!");
|
2023-02-20 17:08:45 +01:00
|
|
|
|
StopCoroutine(tryGetScopeCamera());
|
2022-09-17 19:49:55 +02:00
|
|
|
|
}
|
2022-09-20 22:02:46 +02:00
|
|
|
|
yield break;
|
2022-09-17 19:49:55 +02:00
|
|
|
|
}
|
2022-09-18 22:12:16 +02:00
|
|
|
|
|
2023-02-20 17:08:45 +01:00
|
|
|
|
SSAAOptic ssaaOpticInstance = null;
|
|
|
|
|
|
2022-09-20 22:02:46 +02:00
|
|
|
|
void setScopeCameraResolutionScale(int value)
|
2022-09-17 19:49:55 +02:00
|
|
|
|
{
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (scopeCamera == null || !scopeCamera.isActiveAndEnabled)
|
|
|
|
|
{
|
|
|
|
|
if (enableDebug.Value) Logger.LogInfo("ScopeCam inactive or absent!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-09-16 13:24:26 +02:00
|
|
|
|
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo($"Setting Scope res scale to {value}%");
|
2023-02-20 17:08:45 +01:00
|
|
|
|
|
|
|
|
|
if (ssaaOpticInstance == null)
|
|
|
|
|
{
|
|
|
|
|
ssaaOpticInstance = scopeCamera.GetComponent<SSAAOptic>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ssaaOpticInstance.OpticCameraToMainCameraResolutionRatio = (float)(currentScalingFactor * (value / 100.0f));
|
2022-09-20 22:02:46 +02:00
|
|
|
|
}
|
2022-09-15 21:14:26 +02:00
|
|
|
|
|
2022-09-20 22:02:46 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// PLAYER WEAPON EVENTS
|
|
|
|
|
/// </summary>
|
2023-04-03 11:47:11 +02:00
|
|
|
|
|
2022-09-20 22:02:46 +02:00
|
|
|
|
void subscribeHandsChangedEvent()
|
|
|
|
|
{
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo("Subscribing to HandsChanged Event");
|
2022-09-20 22:02:46 +02:00
|
|
|
|
mainPlayer.HandsChangedEvent += (handsArgs) =>
|
2022-09-17 19:49:55 +02:00
|
|
|
|
{
|
2022-09-20 22:02:46 +02:00
|
|
|
|
subscribeOnAimingChangedEvent();
|
|
|
|
|
};
|
|
|
|
|
}
|
2022-09-15 21:14:26 +02:00
|
|
|
|
|
2022-09-20 22:02:46 +02:00
|
|
|
|
void subscribeOnAimingChangedEvent()
|
|
|
|
|
{
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo("Subscribing to OnAimingChanged Event");
|
2022-09-20 22:02:46 +02:00
|
|
|
|
mainPlayer.HandsController.OnAimingChanged += (aimingArgs) =>
|
2022-09-08 21:29:16 +02:00
|
|
|
|
{
|
2022-09-20 22:43:40 +02:00
|
|
|
|
currentScalingFactor = getCurrentScalingFactor();
|
|
|
|
|
StartCoroutine(tryGetScopeCamera());
|
2023-02-27 20:25:16 +01:00
|
|
|
|
|
2023-04-03 11:47:11 +02:00
|
|
|
|
//if (!mainPlayer.ProceduralWeaponAnimation.IsAiming)
|
|
|
|
|
//{
|
|
|
|
|
// float aimSpeed = 0.7f * mainPlayer.ProceduralWeaponAnimation.AimingSpeed;
|
|
|
|
|
|
|
|
|
|
// switch (scopeFixType.Value)
|
|
|
|
|
// {
|
|
|
|
|
// case EFOVScalingMode.Disabled:
|
|
|
|
|
// {
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case EFOVScalingMode.ScopesOnly:
|
|
|
|
|
// {
|
|
|
|
|
// if (mainPlayer.ProceduralWeaponAnimation.CurrentScope.IsOptic)
|
|
|
|
|
// {
|
|
|
|
|
// inGameFOV = defaultInGameFOV;
|
|
|
|
|
// StopAllCoroutines();
|
|
|
|
|
// setFovLibrary.SetFov(defaultInGameFOV, aimSpeed, true);
|
|
|
|
|
// //mainPlayer.ProceduralWeaponAnimation.ApplyFovAdjustments(mainPlayer);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case EFOVScalingMode.All:
|
|
|
|
|
// {
|
|
|
|
|
// inGameFOV = defaultInGameFOV;
|
|
|
|
|
// StopAllCoroutines();
|
|
|
|
|
// setFovLibrary.SetFov(defaultInGameFOV, aimSpeed, true);
|
|
|
|
|
// //mainPlayer.ProceduralWeaponAnimation.ApplyFovAdjustments(mainPlayer);
|
|
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
2022-09-16 13:24:26 +02:00
|
|
|
|
|
2022-09-20 22:43:40 +02:00
|
|
|
|
if (mainPlayer.ProceduralWeaponAnimation.IsAiming)
|
2022-09-18 23:54:23 +02:00
|
|
|
|
{
|
2023-04-02 09:13:21 +02:00
|
|
|
|
if(enableDebug.Value) Logger.LogInfo($"Scope: {mainPlayer.ProceduralWeaponAnimation.CurrentAimingMod.Item.LocalizedName()} isOptic: {mainPlayer.ProceduralWeaponAnimation.CurrentScope.IsOptic}");
|
|
|
|
|
|
|
|
|
|
if (enableDebug.Value) Logger.LogInfo("Updating scope resolution");
|
|
|
|
|
setScopeCameraResolutionScale(scopeCameraResolutionScale.Value);
|
|
|
|
|
|
2022-09-28 20:14:35 +02:00
|
|
|
|
defaultInGameFOV = inGameFOV;
|
2023-04-03 11:47:11 +02:00
|
|
|
|
//switch (scopeFixType.Value)
|
|
|
|
|
//{
|
|
|
|
|
// case EFOVScalingMode.Disabled:
|
|
|
|
|
// {
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case EFOVScalingMode.ScopesOnly:
|
|
|
|
|
// {
|
|
|
|
|
// if (mainPlayer.ProceduralWeaponAnimation.CurrentScope.IsOptic)
|
|
|
|
|
// {
|
|
|
|
|
// forceADSFOV();
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case EFOVScalingMode.All:
|
|
|
|
|
// {
|
|
|
|
|
// forceADSFOV();
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2022-09-20 22:02:46 +02:00
|
|
|
|
}
|
|
|
|
|
};
|
2022-09-18 23:54:23 +02:00
|
|
|
|
}
|
2022-09-08 21:29:16 +02:00
|
|
|
|
|
2023-04-02 09:13:21 +02:00
|
|
|
|
void forceADSFOV()
|
2022-09-20 22:43:40 +02:00
|
|
|
|
{
|
2023-02-20 17:08:45 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo("Applying aiming tweaks");
|
2023-01-10 11:49:09 +01:00
|
|
|
|
|
2023-02-27 20:25:16 +01:00
|
|
|
|
float aimSpeed = mainPlayer.ProceduralWeaponAnimation.AimingSpeed * 0.7f;
|
|
|
|
|
|
2023-04-02 09:13:21 +02:00
|
|
|
|
//Doesn't take effect if Fontaine's FOV Fix is loaded.
|
|
|
|
|
if (!Chainloader.PluginInfos.ContainsKey("FOVFix"))
|
2023-04-03 11:47:11 +02:00
|
|
|
|
{
|
2023-04-02 09:13:21 +02:00
|
|
|
|
setFovLibrary.SetFov(35, aimSpeed, false);
|
|
|
|
|
inGameFOV = 50;
|
|
|
|
|
}
|
2022-09-20 22:43:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-24 08:42:25 +02:00
|
|
|
|
float currentScalingFactor = 1.0f;
|
2022-09-20 22:02:46 +02:00
|
|
|
|
|
2022-09-18 23:54:23 +02:00
|
|
|
|
float getCurrentScalingFactor()
|
|
|
|
|
{
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo("Getting current scaling factor:");
|
2023-04-01 16:46:33 +02:00
|
|
|
|
var graphics = Singleton<SharedGameSettingsClass>.Instance.Graphics.Settings;
|
2022-09-18 23:54:23 +02:00
|
|
|
|
|
|
|
|
|
if (graphics.DLSSEnabled)
|
|
|
|
|
{
|
|
|
|
|
float DLSSFactor = 1.0f;
|
|
|
|
|
switch (graphics.DLSSMode.Value)
|
|
|
|
|
{
|
|
|
|
|
case EDLSSMode.Off: { DLSSFactor = 1.0f; break; }
|
|
|
|
|
case EDLSSMode.Quality: { DLSSFactor = 0.67f; break; }
|
|
|
|
|
case EDLSSMode.Balanced: { DLSSFactor = 0.58f; break; }
|
|
|
|
|
case EDLSSMode.Performance: { DLSSFactor = 0.5f; break; }
|
2022-09-18 23:59:26 +02:00
|
|
|
|
case EDLSSMode.UltraPerformance: { DLSSFactor = 0.33f; break; }
|
2022-09-18 23:54:23 +02:00
|
|
|
|
}
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo($"DLSS factor: {DLSSFactor}");
|
2022-09-18 23:54:23 +02:00
|
|
|
|
return DLSSFactor;
|
|
|
|
|
}
|
|
|
|
|
if (graphics.FSREnabled)
|
|
|
|
|
{
|
|
|
|
|
float FSRFactor = 1.0f;
|
|
|
|
|
switch (graphics.FSRMode.Value)
|
|
|
|
|
{
|
|
|
|
|
case EFSRMode.Off: { FSRFactor = 1.0f; break; }
|
2022-09-18 23:59:26 +02:00
|
|
|
|
case EFSRMode.UltraQuality: { FSRFactor = 0.77f; break; }
|
2022-09-18 23:54:23 +02:00
|
|
|
|
case EFSRMode.Quality: { FSRFactor = 0.66f; break; }
|
|
|
|
|
case EFSRMode.Balanced: { FSRFactor = 0.59f; break; }
|
|
|
|
|
case EFSRMode.Performance: { FSRFactor = 0.5f; break; }
|
|
|
|
|
}
|
2023-01-10 11:49:09 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo($"FSR factor: {FSRFactor}");
|
2022-09-18 23:54:23 +02:00
|
|
|
|
return FSRFactor;
|
2022-09-08 21:29:16 +02:00
|
|
|
|
}
|
2023-02-19 11:58:12 +01:00
|
|
|
|
if (graphics.FSR2Enabled)
|
|
|
|
|
{
|
|
|
|
|
float FSR2Factor = 1.0f;
|
|
|
|
|
switch (graphics.FSR2Mode.Value)
|
|
|
|
|
{
|
|
|
|
|
case EFSR2Mode.Off: { FSR2Factor = 1.0f; break; }
|
|
|
|
|
case EFSR2Mode.Quality: { FSR2Factor = 0.67f; break; }
|
|
|
|
|
case EFSR2Mode.Balanced: { FSR2Factor = 0.59f; break; }
|
|
|
|
|
case EFSR2Mode.Performance: { FSR2Factor = 0.5f; break; }
|
|
|
|
|
case EFSR2Mode.UltraPerformance: { FSR2Factor = 0.33f; break; }
|
|
|
|
|
}
|
|
|
|
|
if (enableDebug.Value) Logger.LogInfo($"FSR factor: {FSR2Factor}");
|
|
|
|
|
return FSR2Factor;
|
|
|
|
|
}
|
2022-09-18 23:54:23 +02:00
|
|
|
|
|
2023-02-20 17:08:45 +01:00
|
|
|
|
if (enableDebug.Value) Logger.LogInfo($"Supersampling factor: {graphics.SuperSamplingFactor}");
|
|
|
|
|
return graphics.SuperSamplingFactor;
|
2022-09-08 21:29:16 +02:00
|
|
|
|
}
|
2023-01-10 11:49:09 +01:00
|
|
|
|
}
|
2022-09-20 22:02:46 +02:00
|
|
|
|
}
|