openMSX
GlobalSettings.hh
Go to the documentation of this file.
1 #ifndef GLOBALSETTINGS_HH
2 #define GLOBALSETTINGS_HH
3 
4 #include "Observer.hh"
5 #include "BooleanSetting.hh"
6 #include "EnumSetting.hh"
7 #include "IntegerSetting.hh"
8 #include "StringSetting.hh"
9 #include "SpeedManager.hh"
10 #include "ThrottleManager.hh"
11 #include "ResampledSoundDevice.hh"
12 #include <memory>
13 #include <vector>
14 
15 namespace openmsx {
16 
17 class GlobalCommandController;
18 
24 class GlobalSettings final : private Observer<Setting>
25 {
26 public:
27  explicit GlobalSettings(GlobalCommandController& commandController);
29 
30  [[nodiscard]] BooleanSetting& getPauseSetting() {
31  return pauseSetting;
32  }
33  [[nodiscard]] BooleanSetting& getPowerSetting() {
34  return powerSetting;
35  }
37  return autoSaveSetting;
38  }
40  return umrCallBackSetting;
41  }
43  return invalidPsgDirectionsSetting;
44  }
46  return invalidPpiModeSetting;
47  }
49  return resampleSetting;
50  }
51  [[nodiscard]] IntegerSetting& getJoyDeadzoneSetting(int i) {
52  return *deadzoneSettings[i];
53  }
54  [[nodiscard]] SpeedManager& getSpeedManager() {
55  return speedManager;
56  }
58  return throttleManager;
59  }
60 
61 private:
62  // Observer<Setting>
63  void update(const Setting& setting) noexcept override;
64 
65 private:
66  GlobalCommandController& commandController;
67 
68  BooleanSetting pauseSetting;
69  BooleanSetting powerSetting;
70  BooleanSetting autoSaveSetting;
71  StringSetting umrCallBackSetting;
72  StringSetting invalidPsgDirectionsSetting;
73  StringSetting invalidPpiModeSetting;
75  std::vector<std::unique_ptr<IntegerSetting>> deadzoneSettings;
76  SpeedManager speedManager;
77  ThrottleManager throttleManager;
78 };
79 
80 } // namespace openmsx
81 
82 #endif
This class contains settings that are used by several other class (including some singletons).
StringSetting & getInvalidPsgDirectionsSetting()
ThrottleManager & getThrottleManager()
BooleanSetting & getPauseSetting()
BooleanSetting & getPowerSetting()
StringSetting & getUMRCallBackSetting()
EnumSetting< ResampledSoundDevice::ResampleType > & getResampleSetting()
SpeedManager & getSpeedManager()
StringSetting & getInvalidPpiModeSetting()
GlobalSettings(GlobalCommandController &commandController)
IntegerSetting & getJoyDeadzoneSetting(int i)
BooleanSetting & getAutoSaveSetting()
A Setting with an integer value.
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:10
Manages the desired ratio between emutime and real time.
Definition: SpeedManager.hh:18
Manages the throttle state of openMSX.
This file implemented 3 utility functions:
Definition: Autofire.cc:9