75 [[nodiscard]] std::span<const uint8_t, KeyMatrixPosition::NUM_ROWS>
getKeys()
const;
79 template<
typename Archive>
80 void serialize(Archive& ar,
unsigned version);
84 void signalMSXEvent(
const Event& event,
85 EmuTime::param time)
noexcept override;
87 void signalStateChange(
const StateChange& event)
override;
88 void stopReplay(EmuTime::param time)
noexcept override;
91 void executeUntil(EmuTime::param time)
override;
95 void changeKeyMatrixEvent (EmuTime::param time, uint8_t row, uint8_t newValue);
97 void processCapslockEvent(EmuTime::param time,
bool down);
98 void processCodeKanaChange(EmuTime::param time,
bool down);
99 void processGraphChange(EmuTime::param time,
bool down);
100 void processKeypadEnterKey(EmuTime::param time,
bool down);
101 void processSdlKey(EmuTime::param time,
SDLKey key);
102 bool processQueuedEvent(
const Event& event, EmuTime::param time);
103 bool processKeyEvent(EmuTime::param time,
bool down,
const KeyEvent& keyEvent);
105 void processCmd(
Interpreter& interp, std::span<const TclObject> tokens,
bool up);
106 bool pressUnicodeByUser(
109 uint8_t pressAscii(
unsigned unicode,
bool down);
110 void pressLockKeys(uint8_t lockKeysMask,
bool down);
111 [[nodiscard]]
bool commonKeys(
unsigned unicode1,
unsigned unicode2)
const;
112 void debug(
const char* format, ...)
const;
125 std::vector<KeyCodeMsxMapping> keyCodeTab;
126 std::vector<ScanCodeMsxMapping> scanCodeTab;
128 const std::array<KeyMatrixPosition, UnicodeKeymap::KeyInfo::NUM_MODIFIERS>& modifierPos;
134 void execute(std::span<const TclObject> tokens,
TclObject& result,
135 EmuTime::param time)
override;
136 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
139 struct KeyMatrixDownCmd final : RecordedCommand {
140 KeyMatrixDownCmd(CommandController& commandController,
141 StateChangeDistributor& stateChangeDistributor,
142 Scheduler& scheduler);
143 void execute(std::span<const TclObject> tokens, TclObject& result,
144 EmuTime::param time)
override;
145 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
148 class KeyInserter final :
public RecordedCommand,
public Schedulable {
150 KeyInserter(CommandController& commandController,
151 StateChangeDistributor& stateChangeDistributor,
152 Scheduler& scheduler);
154 template<
typename Archive>
155 void serialize(Archive& ar,
unsigned version);
158 void type(std::string_view str);
159 void reschedule(EmuTime::param time);
162 void execute(std::span<const TclObject> tokens, TclObject& result,
163 EmuTime::param time)
override;
164 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
165 void tabCompletion(std::vector<std::string>& tokens)
const override;
168 void executeUntil(EmuTime::param time)
override;
171 std::string text_utf8;
173 uint8_t lockKeysMask = 0;
174 bool releaseLast =
false;
175 uint8_t oldLocksOn = 0;
177 bool releaseBeforePress =
false;
178 int typingFrequency = 15;
181 struct Msxcode2UnicodeCmd final :
public Command {
182 explicit Msxcode2UnicodeCmd(CommandController& commandController);
183 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
184 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
185 } msxcode2UnicodeCmd;
187 struct Unicode2MsxcodeCmd final :
public Command {
188 explicit Unicode2MsxcodeCmd(CommandController& commandController);
189 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
190 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
191 } unicode2MsxcodeCmd;
193 class CapsLockAligner final :
private EventListener,
private Schedulable {
195 CapsLockAligner(EventDistributor& eventDistributor,
196 Scheduler& scheduler);
201 int signalEvent(
const Event& event)
override;
204 void executeUntil(EmuTime::param time)
override;
206 void alignCapsLock(EmuTime::param time);
209 EventDistributor& eventDistributor;
211 enum CapsLockAlignerStateType {
212 MUST_ALIGN_CAPSLOCK, MUST_DISTRIBUTE_KEY_RELEASE, IDLE
216 KeyboardSettings keyboardSettings;
218 class MsxKeyEventQueue final :
public Schedulable {
220 MsxKeyEventQueue(Scheduler& scheduler, Interpreter& interp);
221 void process_asap(EmuTime::param time,
224 template<
typename Archive>
225 void serialize(Archive& ar,
unsigned version);
228 void executeUntil(EmuTime::param time)
override;
230 std::deque<Event> eventQueue;
234 struct KeybDebuggable final : SimpleDebuggable {
235 explicit KeybDebuggable(MSXMotherBoard& motherBoard);
236 [[nodiscard]] uint8_t
read(
unsigned address)
override;
237 void write(
unsigned address, uint8_t value)
override;
240 UnicodeKeymap unicodeKeymap;
243 std::vector<std::pair<SDL_Keycode, uint32_t>> lastUnicodeForKeycode;
246 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> cmdKeyMatrix;
248 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> typeKeyMatrix;
250 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> userKeyMatrix;
252 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> hostKeyMatrix;
254 mutable std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> keyMatrix;
256 uint8_t msxModifiers = 0xff;
259 const bool hasKeypad;
263 const bool blockRow11;
265 const bool keyGhosting;
267 const bool keyGhostingSGCprotected;
271 const uint8_t modifierIsLock;
272 mutable bool keysChanged =
false;
std::variant< KeyUpEvent, KeyDownEvent, MouseMotionEvent, MouseButtonUpEvent, MouseButtonDownEvent, MouseWheelEvent, JoystickAxisMotionEvent, JoystickHatEvent, JoystickButtonUpEvent, JoystickButtonDownEvent, OsdControlReleaseEvent, OsdControlPressEvent, WindowEvent, TextEvent, FileDropEvent, QuitEvent, FinishFrameEvent, CliCommandEvent, GroupEvent, BootEvent, FrameDrawnEvent, BreakEvent, SwitchRendererEvent, TakeReverseSnapshotEvent, AfterTimedEvent, MachineLoadedEvent, MachineActivatedEvent, MachineDeactivatedEvent, MidiInReaderEvent, MidiInWindowsEvent, MidiInCoreMidiEvent, MidiInCoreMidiVirtualEvent, MidiInALSAEvent, Rs232TesterEvent, Rs232NetEvent, ImGuiDelayedActionEvent, ImGuiActiveEvent > Event