75 [[nodiscard]] std::span<const uint8_t, KeyMatrixPosition::NUM_ROWS>
getKeys()
const;
78 void setFocus(
bool newFocus, EmuTime::param time);
80 template<
typename Archive>
81 void serialize(Archive& ar,
unsigned version);
85 void signalMSXEvent(
const Event& event,
86 EmuTime::param time)
noexcept override;
88 void signalStateChange(
const StateChange& event)
override;
89 void stopReplay(EmuTime::param time)
noexcept override;
92 void executeUntil(EmuTime::param time)
override;
94 void syncHostKeyMatrix(EmuTime::param time);
97 void changeKeyMatrixEvent (EmuTime::param time, uint8_t row, uint8_t newValue);
99 void processCapslockEvent(EmuTime::param time,
bool down);
100 void processCodeKanaChange(EmuTime::param time,
bool down);
101 void processGraphChange(EmuTime::param time,
bool down);
102 void processKeypadEnterKey(EmuTime::param time,
bool down);
103 void processSdlKey(EmuTime::param time,
SDLKey key);
104 bool processQueuedEvent(
const Event& event, EmuTime::param time);
105 bool processKeyEvent(EmuTime::param time,
bool down,
const KeyEvent& keyEvent);
107 void processCmd(
Interpreter& interp, std::span<const TclObject> tokens,
bool up);
108 bool pressUnicodeByUser(
111 uint8_t pressAscii(
unsigned unicode,
bool down);
112 void pressLockKeys(uint8_t lockKeysMask,
bool down);
113 [[nodiscard]]
bool commonKeys(
unsigned unicode1,
unsigned unicode2)
const;
114 void debug(
const char* format, ...)
const;
127 std::vector<KeyCodeMsxMapping> keyCodeTab;
128 std::vector<ScanCodeMsxMapping> scanCodeTab;
136 void execute(std::span<const TclObject> tokens,
TclObject& result,
137 EmuTime::param time)
override;
138 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
141 struct KeyMatrixDownCmd final : RecordedCommand {
142 KeyMatrixDownCmd(CommandController& commandController,
143 StateChangeDistributor& stateChangeDistributor,
144 Scheduler& scheduler);
145 void execute(std::span<const TclObject> tokens, TclObject& result,
146 EmuTime::param time)
override;
147 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
150 class KeyInserter final :
public RecordedCommand,
public Schedulable {
152 KeyInserter(CommandController& commandController,
153 StateChangeDistributor& stateChangeDistributor,
154 Scheduler& scheduler);
156 template<
typename Archive>
157 void serialize(Archive& ar,
unsigned version);
160 void type(std::string_view str);
161 void reschedule(EmuTime::param time);
164 void execute(std::span<const TclObject> tokens, TclObject& result,
165 EmuTime::param time)
override;
166 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
167 void tabCompletion(std::vector<std::string>& tokens)
const override;
170 void executeUntil(EmuTime::param time)
override;
173 std::string text_utf8;
175 uint8_t lockKeysMask = 0;
176 bool releaseLast =
false;
177 uint8_t oldLocksOn = 0;
179 bool releaseBeforePress =
false;
180 int typingFrequency = 15;
183 struct Msxcode2UnicodeCmd final :
public Command {
184 explicit Msxcode2UnicodeCmd(CommandController& commandController);
185 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
186 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
187 } msxcode2UnicodeCmd;
189 struct Unicode2MsxcodeCmd final :
public Command {
190 explicit Unicode2MsxcodeCmd(CommandController& commandController);
191 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
192 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
193 } unicode2MsxcodeCmd;
195 class CapsLockAligner final :
private EventListener,
private Schedulable {
197 CapsLockAligner(EventDistributor& eventDistributor,
198 Scheduler& scheduler);
203 bool signalEvent(
const Event& event)
override;
206 void executeUntil(EmuTime::param time)
override;
208 void alignCapsLock(EmuTime::param time);
211 EventDistributor& eventDistributor;
213 enum CapsLockAlignerStateType {
214 MUST_ALIGN_CAPSLOCK, MUST_DISTRIBUTE_KEY_RELEASE, IDLE
218 KeyboardSettings keyboardSettings;
220 class MsxKeyEventQueue final :
public Schedulable {
222 MsxKeyEventQueue(Scheduler& scheduler, Interpreter& interp);
223 void process_asap(EmuTime::param time,
226 template<
typename Archive>
227 void serialize(Archive& ar,
unsigned version);
230 void executeUntil(EmuTime::param time)
override;
232 std::deque<Event> eventQueue;
236 struct KeybDebuggable final : SimpleDebuggable {
237 explicit KeybDebuggable(MSXMotherBoard& motherBoard);
238 [[nodiscard]] uint8_t
read(
unsigned address)
override;
239 void write(
unsigned address, uint8_t value)
override;
242 UnicodeKeymap unicodeKeymap;
245 std::vector<std::pair<SDL_Keycode, uint32_t>> lastUnicodeForKeycode;
248 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> cmdKeyMatrix;
250 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> typeKeyMatrix;
252 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> userKeyMatrix;
254 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> hostKeyMatrix;
256 mutable std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> keyMatrix;
258 uint8_t msxModifiers = 0xff;
261 const bool hasKeypad;
265 const bool blockRow11;
267 const bool keyGhosting;
269 const bool keyGhostingSGCprotected;
273 const uint8_t modifierIsLock;
274 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