74 [[nodiscard]] std::span<const uint8_t, KeyMatrixPosition::NUM_ROWS>
getKeys()
const;
78 template<
typename Archive>
79 void serialize(Archive& ar,
unsigned version);
83 void signalMSXEvent(
const Event& event,
84 EmuTime::param time)
noexcept override;
86 void signalStateChange(
const StateChange& event)
override;
87 void stopReplay(EmuTime::param time)
noexcept override;
90 void executeUntil(EmuTime::param time)
override;
94 void changeKeyMatrixEvent (EmuTime::param time, uint8_t row, uint8_t newValue);
96 void processCapslockEvent(EmuTime::param time,
bool down);
97 void processCodeKanaChange(EmuTime::param time,
bool down);
98 void processGraphChange(EmuTime::param time,
bool down);
99 void processKeypadEnterKey(EmuTime::param time,
bool down);
100 void processSdlKey(EmuTime::param time,
SDLKey key);
101 bool processQueuedEvent(
const Event& event, EmuTime::param time);
102 bool processKeyEvent(EmuTime::param time,
bool down,
const KeyEvent& keyEvent);
104 void processCmd(
Interpreter& interp, std::span<const TclObject> tokens,
bool up);
105 bool pressUnicodeByUser(
108 uint8_t pressAscii(
unsigned unicode,
bool down);
109 void pressLockKeys(uint8_t lockKeysMask,
bool down);
110 bool commonKeys(
unsigned unicode1,
unsigned unicode2);
111 void debug(
const char* format, ...);
124 std::vector<KeyCodeMsxMapping> keyCodeTab;
125 std::vector<ScanCodeMsxMapping> scanCodeTab;
127 const std::array<KeyMatrixPosition, UnicodeKeymap::KeyInfo::NUM_MODIFIERS>& modifierPos;
133 void execute(std::span<const TclObject> tokens,
TclObject& result,
134 EmuTime::param time)
override;
135 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
138 struct KeyMatrixDownCmd final : RecordedCommand {
139 KeyMatrixDownCmd(CommandController& commandController,
140 StateChangeDistributor& stateChangeDistributor,
141 Scheduler& scheduler);
142 void execute(std::span<const TclObject> tokens, TclObject& result,
143 EmuTime::param time)
override;
144 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
147 class KeyInserter final :
public RecordedCommand,
public Schedulable {
149 KeyInserter(CommandController& commandController,
150 StateChangeDistributor& stateChangeDistributor,
151 Scheduler& scheduler);
153 template<
typename Archive>
154 void serialize(Archive& ar,
unsigned version);
157 void type(std::string_view str);
158 void reschedule(EmuTime::param time);
161 void execute(std::span<const TclObject> tokens, TclObject& result,
162 EmuTime::param time)
override;
163 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
164 void tabCompletion(std::vector<std::string>& tokens)
const override;
167 void executeUntil(EmuTime::param time)
override;
170 std::string text_utf8;
172 uint8_t lockKeysMask = 0;
173 bool releaseLast =
false;
174 uint8_t oldLocksOn = 0;
176 bool releaseBeforePress =
false;
177 int typingFrequency = 15;
180 struct Msxcode2UnicodeCmd final :
public Command {
181 Msxcode2UnicodeCmd(CommandController& commandController);
182 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
183 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
184 } msxcode2UnicodeCmd;
186 struct Unicode2MsxcodeCmd final :
public Command {
187 Unicode2MsxcodeCmd(CommandController& commandController);
188 void execute(std::span<const TclObject> tokens, TclObject& result)
override;
189 [[nodiscard]] std::string help(std::span<const TclObject> tokens)
const override;
190 } unicode2MsxcodeCmd;
192 class CapsLockAligner final :
private EventListener,
private Schedulable {
194 CapsLockAligner(EventDistributor& eventDistributor,
195 Scheduler& scheduler);
200 int signalEvent(
const Event& event)
override;
203 void executeUntil(EmuTime::param time)
override;
205 void alignCapsLock(EmuTime::param time);
208 EventDistributor& eventDistributor;
210 enum CapsLockAlignerStateType {
211 MUST_ALIGN_CAPSLOCK, MUST_DISTRIBUTE_KEY_RELEASE, IDLE
215 KeyboardSettings keyboardSettings;
217 class MsxKeyEventQueue final :
public Schedulable {
219 MsxKeyEventQueue(Scheduler& scheduler, Interpreter& interp);
220 void process_asap(EmuTime::param time,
223 template<
typename Archive>
224 void serialize(Archive& ar,
unsigned version);
227 void executeUntil(EmuTime::param time)
override;
229 std::deque<Event> eventQueue;
233 struct KeybDebuggable final : SimpleDebuggable {
234 explicit KeybDebuggable(MSXMotherBoard& motherBoard);
235 [[nodiscard]] uint8_t
read(
unsigned address)
override;
236 void write(
unsigned address, uint8_t value)
override;
239 UnicodeKeymap unicodeKeymap;
242 std::vector<std::pair<SDL_Keycode, uint32_t>> lastUnicodeForKeycode;
245 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> cmdKeyMatrix;
247 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> typeKeyMatrix;
249 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> userKeyMatrix;
251 std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> hostKeyMatrix;
253 mutable std::array<uint8_t, KeyMatrixPosition::NUM_ROWS> keyMatrix;
255 uint8_t msxModifiers = 0xff;
258 const bool hasKeypad;
262 const bool blockRow11;
264 const bool keyGhosting;
266 const bool keyGhostingSGCprotected;
270 const uint8_t modifierIsLock;
271 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