openMSX
EventDelay.hh
Go to the documentation of this file.
1 #ifndef EVENTDELAY_HH
2 #define EVENTDELAY_HH
3 
4 #include "EventListener.hh"
5 #include "Schedulable.hh"
6 #include "EmuTime.hh"
7 #include "Event.hh"
8 #include "FloatSetting.hh"
9 #include "build-info.hh"
10 #include <vector>
11 #include <deque>
12 #include <cstdint>
13 
14 namespace openmsx {
15 
16 class Scheduler;
17 class CommandController;
18 class EventDistributor;
19 class MSXEventDistributor;
20 class ReverseManager;
21 
26 class EventDelay final : private EventListener, private Schedulable
27 {
28 public:
29  EventDelay(Scheduler& scheduler, CommandController& commandController,
30  EventDistributor& eventDistributor,
31  MSXEventDistributor& msxEventDistributor,
32  ReverseManager& reverseManager);
33  ~EventDelay();
34 
35  void sync(EmuTime::param curEmu);
36  void flush();
37 
38 private:
39  // EventListener
40  int signalEvent(const Event& event) noexcept override;
41 
42  // Schedulable
43  void executeUntil(EmuTime::param time) override;
44 
45 private:
46  EventDistributor& eventDistributor;
47  MSXEventDistributor& msxEventDistributor;
48 
49  std::vector<Event> toBeScheduledEvents;
50  std::deque<Event> scheduledEvents;
51 
52 #if PLATFORM_ANDROID
53  std::vector<std::pair<int, Event>> nonMatchedKeyPresses;
54 #endif
55 
56  EmuTime prevEmu;
57  uint64_t prevReal;
58  FloatSetting delaySetting;
59 };
60 
61 } // namespace openmsx
62 
63 #endif
This class is responsible for translating host events into MSX events.
Definition: EventDelay.hh:27
void sync(EmuTime::param curEmu)
Definition: EventDelay.cc:86
EventDelay(Scheduler &scheduler, CommandController &commandController, EventDistributor &eventDistributor, MSXEventDistributor &msxEventDistributor, ReverseManager &reverseManager)
Definition: EventDelay.cc:15
A Setting with a floating point value.
Definition: FloatSetting.hh:11
Every class that wants to get scheduled at some point must inherit from this class.
Definition: Schedulable.hh:34
This file implemented 3 utility functions:
Definition: Autofire.cc:9