17 #include <string_view>
25 class CommandController;
27 class EventDistributor;
28 class MSXEventDistributor;
29 class StateChangeDistributor;
63 [[nodiscard]]
const byte*
getKeys()
const;
67 template<
typename Archive>
68 void serialize(Archive& ar,
unsigned version);
72 void signalMSXEvent(
const std::shared_ptr<const Event>& event,
73 EmuTime::param time) noexcept
override;
75 void signalStateChange(
const std::shared_ptr<StateChange>& event)
override;
76 void stopReplay(EmuTime::param time) noexcept
override;
79 void executeUntil(EmuTime::param time)
override;
83 void changeKeyMatrixEvent (EmuTime::param time,
byte row,
byte newValue);
85 void processCapslockEvent(EmuTime::param time,
bool down);
86 void processCodeKanaChange(EmuTime::param time,
bool down);
87 void processGraphChange(EmuTime::param time,
bool down);
88 void processKeypadEnterKey(EmuTime::param time,
bool down);
89 void processSdlKey(EmuTime::param time,
bool down,
Keys::KeyCode key);
90 bool processQueuedEvent(
const Event& event, EmuTime::param time);
91 bool processKeyEvent(EmuTime::param time,
bool down,
const KeyEvent& keyEvent);
94 bool pressUnicodeByUser(
97 int pressAscii(
unsigned unicode,
bool down);
98 void pressLockKeys(
byte lockKeysMask,
bool down);
99 bool commonKeys(
unsigned unicode1,
unsigned unicode2);
100 void debug(
const char* format, ...);
115 const std::array<KeyMatrixPosition, UnicodeKeymap::KeyInfo::NUM_MODIFIERS>& modifierPos;
122 EmuTime::param time)
override;
123 [[nodiscard]] std::string help(
const std::vector<std::string>& tokens)
const override;
126 struct KeyMatrixDownCmd final : RecordedCommand {
127 KeyMatrixDownCmd(CommandController& commandController,
128 StateChangeDistributor& stateChangeDistributor,
131 EmuTime::param time)
override;
132 [[nodiscard]] std::string help(
const std::vector<std::string>& tokens)
const override;
135 class KeyInserter final :
public RecordedCommand,
public Schedulable {
137 KeyInserter(CommandController& commandController,
138 StateChangeDistributor& stateChangeDistributor,
141 template<
typename Archive>
142 void serialize(Archive& ar,
unsigned version);
145 void type(std::string_view str);
146 void reschedule(EmuTime::param time);
150 EmuTime::param time)
override;
151 [[nodiscard]] std::string help(
const std::vector<std::string>& tokens)
const override;
152 void tabCompletion(std::vector<std::string>& tokens)
const override;
155 void executeUntil(EmuTime::param time)
override;
158 std::string text_utf8;
164 bool releaseBeforePress;
168 class CapsLockAligner final :
private EventListener,
private Schedulable {
170 CapsLockAligner(EventDistributor& eventDistributor,
176 int signalEvent(
const std::shared_ptr<const Event>& event) noexcept
override;
179 void executeUntil(EmuTime::param time)
override;
181 void alignCapsLock(EmuTime::param time);
184 EventDistributor& eventDistributor;
186 enum CapsLockAlignerStateType {
187 MUST_ALIGN_CAPSLOCK, MUST_DISTRIBUTE_KEY_RELEASE,
IDLE
191 KeyboardSettings keyboardSettings;
193 class MsxKeyEventQueue final :
public Schedulable {
195 MsxKeyEventQueue(
Scheduler& scheduler, Interpreter& interp);
196 void process_asap(EmuTime::param time,
197 const std::shared_ptr<const Event>& event);
199 template<
typename Archive>
200 void serialize(Archive& ar,
unsigned version);
203 void executeUntil(EmuTime::param time)
override;
205 std::deque<std::shared_ptr<const Event>> eventQueue;
209 struct KeybDebuggable final : SimpleDebuggable {
210 explicit KeybDebuggable(MSXMotherBoard& motherBoard);
211 [[nodiscard]]
byte read(
unsigned address)
override;
212 void write(
unsigned address,
byte value)
override;
215 UnicodeKeymap unicodeKeymap;
232 const bool hasKeypad;
236 const bool blockRow11;
238 const bool keyGhosting;
240 const bool keyGhostingSGCprotected;
244 const byte modifierIsLock;
245 mutable bool keysChanged;
A position (row, column) in a keyboard matrix.
static constexpr unsigned NUM_ROWS
Rows are in the range [0..NUM_ROWS).
static constexpr int MAX_KEYSYM
void transferHostKeyMatrix(const Keyboard &source)
void serialize(Archive &ar, unsigned version)
const byte * getKeys() const
Returns a pointer to the current KeyBoard matrix.
Keyboard(MSXMotherBoard &motherBoard, Scheduler &scheduler, CommandController &commandController, EventDistributor &eventDistributor, MSXEventDistributor &msxEventDistributor, StateChangeDistributor &stateChangeDistributor, MatrixType matrix, const DeviceConfig &config)
Constructs a new Keyboard object.
Commands that directly influence the MSX state should send and events so that they can be recorded by...
Every class that wants to get scheduled at some point must inherit from this class.
Schedulable(const Schedulable &)=delete
bool pendingSyncPoint() const
virtual byte read(unsigned address, EmuTime::param time)
virtual void write(unsigned address, byte value, EmuTime::param time)
KeyCode
Constants that identify keys and key modifiers.
This file implemented 3 utility functions:
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)