aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Tamper/AtmosphereProgram.cs
blob: a2aa73a4fa2ac08e25de70b84c14072c9fee9148 (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
using Ryujinx.HLE.HOS.Services.Hid;
using Ryujinx.HLE.HOS.Tamper.Operations;

namespace Ryujinx.HLE.HOS.Tamper
{
    class AtmosphereProgram : ITamperProgram
    {
        private Parameter<long> _pressedKeys;
        private IOperation _entryPoint;

        public string Name { get; }
        public bool TampersCodeMemory { get; set; } = false;
        public ITamperedProcess Process { get; }
        public bool IsEnabled { get; set; }

        public AtmosphereProgram(string name, ITamperedProcess process, Parameter<long> pressedKeys, IOperation entryPoint)
        {
            Name = name;
            Process = process;
            _pressedKeys = pressedKeys;
            _entryPoint = entryPoint;
        }

        public void Execute(ControllerKeys pressedKeys)
        {
            if (IsEnabled)
            {
                _pressedKeys.Value = (long)pressedKeys;
                _entryPoint.Execute();
            }
        }
    }
}