summaryrefslogtreecommitdiff
path: root/Config.cs
blob: b8c19431f566aca866d4511ed3bc46cf6512ffc3 (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#define SIMPLE_KEYBOARD_LAYER

using SharpPluginLoader.Core.Configuration;
using SharpPluginLoader.Core.IO;

namespace MHWNewCamera
{
    internal class Config : IConfig
    {
        public struct Settings
        {
            public const float DEFAULT_SPEED = 5.25f;
            public const float DEFAULT_SPEED_MODIFIER = 0.40f;
            public const float DEFAULT_SENSITIVITY = 0.045f;
            public const float DEFAULT_ZOOM_SPEED = 0.02f;
            public const double DEFAULT_PITCH_LIMIT = -1.0;
            public const double MAX_PITCH_LIMIT = 89.95;
            public const int DEFAULT_DEADZONE = 4750;

            public Settings()
            {
                CameraSpeed = DEFAULT_SPEED;
                CameraSpeedModifier = DEFAULT_SPEED_MODIFIER;
                CameraSensitivity = DEFAULT_SENSITIVITY;
                CameraZoomSpeed = DEFAULT_ZOOM_SPEED;
                CameraPitchLimit = DEFAULT_PITCH_LIMIT;
                StickDeadzone = DEFAULT_DEADZONE;
            }

            public float CameraSpeed { get; set; }
            public float CameraSpeedModifier { get; set; }
            public float CameraSensitivity { get; set; }
            public float CameraZoomSpeed { get; set; }
            public double CameraPitchLimit { get; set; }
            public int StickDeadzone { get; set; }
        }

        public struct Preset
        {
            public double FOV { get; set; }
            public float Forward { get; set; }
            public float Right { get; set; }
            public float Up { get; set; }
            public double Roll { get; set; }
            public bool DisableFading { get; set; }
        }

        public struct SavedPosition
        {
            public float PosX { get; set; }
            public float PosY { get; set; }
            public float PosZ { get; set; }
            public float TargetX { get; set; }
            public float TargetY { get; set; }
            public float TargetZ { get; set; }
            public double Roll { get; set; }
        }

        public String Name => "MHWNewCamera";
        public String Version => "4.0";

        private static Dictionary<string, Button> buttonMap = new Dictionary<string, Button>
        {
            { "r1", Button.R1 }, { "rb", Button.R1 },
            { "r2", Button.R2 }, { "rt", Button.R2 },
            { "r3", Button.R3 }, { "rstick", Button.R3 },
            { "l1", Button.L1 }, { "lb", Button.L1 },
            { "l2", Button.L2 }, { "lt", Button.L2 },
            { "l3", Button.L3 }, { "lstick", Button.L3 },
            { "a", Button.Cross }, { "cross", Button.Cross },
            { "b", Button.Circle }, { "circle", Button.Circle },
            { "x", Button.Square }, { "square", Button.Square },
            { "y", Button.Triangle }, { "triangle", Button.Triangle },
            { "start", Button.Options }, { "options", Button.Options },
            { "select", Button.Share }, { "share", Button.Share },
            { "up", Button.Up },
            { "down", Button.Down },
            { "left", Button.Left },
            { "right", Button.Right }
        };

        public static Button[]? ParseCombo(String comboString)
        {
            string[] buttonStrings = comboString.Split(",");
            if (buttonStrings.Length == 2)
            {
                string b1 = buttonStrings[0].ToLower();
                string b2 = buttonStrings[1].ToLower();
                if (buttonMap.ContainsKey(b1) && buttonMap.ContainsKey(b2))
                {
                    return [ buttonMap[b1], buttonMap[b2] ];
                }
            }
            return null;
        }

        public bool DisableMod { get; set; } = false;

#if SIMPLE_KEYBOARD_LAYER
        public bool EnableKeyboard { get; set; } = true;
        public int KeyboardLookSensitivity { get; set; } = 19750;
#endif

        public bool EnableCombo { get; set; } = true;
        public String FreeCameraCombo { get; set; } = "RStick,LT";
        public bool DisableComboButton1UnlessButton2Held { get; set; } = false;

        public Settings CameraSettings { get; set; } = new Settings();
        public bool PerspectiveCameraEnabled { get; set; } = false;
        public Dictionary<String, Preset> Presets { get; set; } = new Dictionary<String, Preset>();
        public String Selected { get; set; } = "";
        public Dictionary<String, SavedPosition> Positions { get; set; } = new Dictionary<String, SavedPosition>();

        public bool TripleShadowResolution { get; set; } = false;
        public float ShadowRangeOffset { get; set; } = 0.7f;
        public bool ApplyShadowRange { get; set; } = false;
        public float ShadowRadiusOffset { get; set; } = -0.0001f;
        public bool ApplyShadowRadius { get; set; } = false;
        public bool HigherShadowDetailInHoarfrost { get; set; } = false;
        public bool SSAOAdjustments { get; set; } = false;
        public bool SSRAdjustments { get; set; } = false;
        public bool EnableHQMode { get; set; } = false;
        public bool DisableLODLimits { get; set; } = false;
        public float FoliageLODBias { get; set; } = 3.0f;
        public float TerrainLODBias { get; set; } = 16.0f;
        public float FoliageLODFactor { get; set; } = 0.0f;
        public float TerrainLODFactor { get; set; } = 0.0f;
        public float SnowLODBias { get; set; } = 32.0f;
        public bool ApplyLODFactors { get; set; } = false;
        public bool LargerFoliageSwayRange { get; set; } = false;
        public bool DisableReducedRateAnimations { get; set; } = false;
        public bool DisableVolumetricDownsample { get; set; } = false;

        public bool OverrideViewMode { get; set; } = false;
    }
}