-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPlugin.cs
More file actions
48 lines (40 loc) · 1.74 KB
/
Copy pathPlugin.cs
File metadata and controls
48 lines (40 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using FSR4Bridge.Patches;
using FSR4Bridge.Source;
namespace FSR4Bridge
{
[BepInDependency("com.matsix.sptvr", BepInDependency.DependencyFlags.SoftDependency)]
[BepInPlugin("com.matsix.fsr4bridge", "FSR4 Bridge", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource MyLog;
private void Awake()
{
MyLog = Logger;
Fsr4Config.Bind(Config);
Fsr4Bridge.SptVrPresent = Chainloader.PluginInfos.ContainsKey("com.matsix.sptvr");
if (Fsr4Bridge.SptVrPresent)
MyLog.LogInfo("FSR4Bridge: SPT-VR detected — driving VR FSR4 as well as flatscreen.");
new Fsr4RenderPatch().Enable();
new Fsr4NativeAAPatch().Enable();
// Free the FFX contexts + VRAM when the user turns FSR4 off mid-session (they lazily
// rebuild if re-enabled; kept alive across renderer refreshes otherwise).
Fsr4Config.Enabled.SettingChanged += (_, __) =>
{
if (!Fsr4Config.Enabled.Value)
Fsr4Bridge.InvalidateContexts();
};
// Apply Native AA live (the game only re-runs Switch on a quality-setting change otherwise).
Fsr4Config.NativeAA.SettingChanged += (_, __) => Fsr4NativeAAPatch.ReapplyOnToggle();
MyLog.LogInfo("FSR4Bridge loaded — select an FSR mode in Graphics settings and toggle 'Enable FSR4' in the config.");
}
// Detaches the opaque-capture CommandBuffer when the bridge stops rendering (FSR off in game
// settings, perma-fail, menus)
private void Update()
{
Fsr4Bridge.IdleTick();
}
}
}