aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Services/Lbl/LblControllerServer.cs
blob: 899e882e57ddd7ceeb088d52e902903923270467 (plain) (blame)
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
namespace Ryujinx.HLE.HOS.Services.Lbl
{
    [Service("lbl")]
    class LblControllerServer : ILblController
    {
        private bool _vrModeEnabled;
        private float _currentBrightnessSettingForVrMode;

        public LblControllerServer(ServiceCtx context) : base(context) { }

        protected override void SetCurrentBrightnessSettingForVrMode(float currentBrightnessSettingForVrMode)
        {
            if (float.IsNaN(currentBrightnessSettingForVrMode) || float.IsInfinity(currentBrightnessSettingForVrMode))
            {
                _currentBrightnessSettingForVrMode = 0.0f;

                return;
            }

            _currentBrightnessSettingForVrMode = currentBrightnessSettingForVrMode;
        }

        protected override float GetCurrentBrightnessSettingForVrMode()
        {
            if (float.IsNaN(_currentBrightnessSettingForVrMode) || float.IsInfinity(_currentBrightnessSettingForVrMode))
            {
                return 0.0f;
            }

            return _currentBrightnessSettingForVrMode;
        }

        internal override void EnableVrMode()
        {
            _vrModeEnabled = true;

            // NOTE: Service check _vrModeEnabled field value in a thread and then change the screen brightness.
            //       Since we don't support that. It's fine to do nothing.
        }

        internal override void DisableVrMode()
        {
            _vrModeEnabled = false;

            // NOTE: Service check _vrModeEnabled field value in a thread and then change the screen brightness.
            //       Since we don't support that. It's fine to do nothing.
        }

        protected override bool IsVrModeEnabled()
        {
            return _vrModeEnabled;
        }
    }
}