File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 <ClCompile Include =" Runners\BasicRunner.cpp" />
2626 <ClCompile Include =" SharedDataStruct.cpp" />
2727 <ClInclude Include =" CleanCheat.h" />
28+ <ClInclude Include =" CleanCheat\FeatureSettings.h" />
2829 <ClInclude Include =" CleanCheat\Macros.h" />
2930 <ClInclude Include =" CleanCheat\HookManager.h" />
3031 <ClInclude Include =" CleanCheat\MemoryManager.h" />
Original file line number Diff line number Diff line change 11#pragma once
22#include " Macros.h"
3+ #include " FeatureSettings.h"
34
4- template <typename TType>
5+ template <typename TType, class TSettings = FeatureSettings >
56ABSTRACT class FeatureBase
67{
78private:
89 bool _init = false ;
910
11+ public:
12+ TSettings* Settings;
13+
1014public:
1115 virtual ~FeatureBase () = default ;
12- virtual void Discard () { }
1316
1417protected:
1518 virtual void OnExecute (TType* param) = 0;
@@ -20,6 +23,15 @@ ABSTRACT class FeatureBase
2023 }
2124
2225public:
26+ // / <summary>
27+ // / Determinate initialization status
28+ // / </summary>
29+ // / <returns>`True` if initialized, otherwise `False`</returns>
30+ bool IsInitialized () const
31+ {
32+ return _init;
33+ }
34+
2335 // / <summary>
2436 // / Condition runner will use to determine will execute this feature or not
2537 // / </summary>
@@ -46,15 +58,6 @@ ABSTRACT class FeatureBase
4658 OnExecute (param);
4759 }
4860
49- // / <summary>
50- // / Determinate initialization status
51- // / </summary>
52- // / <returns>`True` if initialized, otherwise `False`</returns>
53- bool IsInitialized () const
54- {
55- return _init;
56- }
57-
5861 // / <summary>
5962 // / Initialize
6063 // / </summary>
@@ -64,6 +67,18 @@ ABSTRACT class FeatureBase
6467 return false ;
6568 _init = true ;
6669
70+ Settings = new TSettings ();
71+ Settings->OnInit ();
72+
6773 return OnInit (initData);
6874 }
75+
76+ // / <summary>
77+ // / Discard
78+ // / </summary>
79+ virtual void Discard ()
80+ {
81+ delete Settings;
82+ Settings = nullptr ;
83+ }
6984};
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ // / <summary>
4+ // / Features settings class
5+ // / </summary>
6+ class FeatureSettings
7+ {
8+ public:
9+ bool Enable = true ;
10+
11+ public:
12+ virtual ~FeatureSettings () = default ;
13+
14+ protected:
15+ virtual void OnInit () { }
16+ };
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ template <typename TType>
77ABSTRACT class RunnerBase
88{
99protected:
10- std::vector<FeatureBase<TType>*> _features;
10+ std::vector<FeatureBase<TType, int8_t >*> _features;
1111
1212public:
1313 virtual ~RunnerBase () = default ;
@@ -35,7 +35,7 @@ ABSTRACT class RunnerBase
3535 {
3636 for (FeatureBase<TType>* const & feature : _features)
3737 {
38- if (feature->Condition (item))
38+ if (feature->Settings -> Enable && feature-> Condition (item))
3939 feature->Execute (item);
4040 }
4141 }
Original file line number Diff line number Diff line change @@ -9,5 +9,5 @@ void BasicFeature::OnExecute(int* param)
99
1010bool BasicFeature::Condition (int * param)
1111{
12- return true ;
12+ return Settings-> Enable ;
1313}
Original file line number Diff line number Diff line change 11#pragma once
22#include " CleanCheat/FeatureBase.h"
33
4- class BasicFeature final : public FeatureBase<int >
4+ class BasicSettings final : public FeatureSettings
5+ {
6+ public:
7+ bool Test = false ;
8+ };
9+
10+ class BasicFeature final : public FeatureBase<int , BasicSettings>
511{
612protected:
713 void OnExecute (int * param) override ;
You can’t perform that action at this time.
0 commit comments