mirror of
https://github.com/TomHarte/CLK.git
synced 2025-11-05 22:17:16 +00:00
Avoid ambiguity with new DelaySlot 'key'.
This commit is contained in:
@@ -49,7 +49,7 @@ enum class BBCKey: uint16_t {
|
|||||||
//
|
//
|
||||||
// Break; a key, but not on the keyboard matrix.
|
// Break; a key, but not on the keyboard matrix.
|
||||||
//
|
//
|
||||||
Break = 0xfffd,
|
Break = 0xfffc,
|
||||||
|
|
||||||
//
|
//
|
||||||
// Master only keys.
|
// Master only keys.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace Electron;
|
using namespace Electron;
|
||||||
|
|
||||||
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const {
|
uint16_t KeyboardMapper::mapped_key_for_key(const Inputs::Keyboard::Key key) const {
|
||||||
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return Electron::Key::dest
|
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return Electron::Key::dest
|
||||||
switch(key) {
|
switch(key) {
|
||||||
default: break;
|
default: break;
|
||||||
@@ -70,7 +70,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) const {
|
|||||||
return MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
return MachineTypes::MappedKeyboardMachine::KeyNotMapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint16_t *CharacterMapper::sequence_for_character(char character) const {
|
const uint16_t *CharacterMapper::sequence_for_character(const char character) const {
|
||||||
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define KEYS(...) {__VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define SHIFT(...) {KeyShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define SHIFT(...) {KeyShift, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
#define CTRL(...) {KeyControl, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
#define CTRL(...) {KeyControl, __VA_ARGS__, MachineTypes::MappedKeyboardMachine::KeyEndSequence}
|
||||||
@@ -148,6 +148,6 @@ const uint16_t *CharacterMapper::sequence_for_character(char character) const {
|
|||||||
return table_lookup_sequence_for_character(key_sequences, character);
|
return table_lookup_sequence_for_character(key_sequences, character);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CharacterMapper::needs_pause_after_key(uint16_t key) const {
|
bool CharacterMapper::needs_pause_after_key(const uint16_t key) const {
|
||||||
return !is_modifier(Key(key));
|
return !is_modifier(Key(key));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ enum Key: uint16_t {
|
|||||||
// Virtual keys.
|
// Virtual keys.
|
||||||
KeyF1 = 0xfff0, KeyF2, KeyF3, KeyF4, KeyF5, KeyF6, KeyF7, KeyF8, KeyF9, KeyF0,
|
KeyF1 = 0xfff0, KeyF2, KeyF3, KeyF4, KeyF5, KeyF6, KeyF7, KeyF8, KeyF9, KeyF0,
|
||||||
|
|
||||||
KeyBreak = 0xfffd,
|
KeyBreak = 0xfffc,
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr bool is_modifier(const Key key) {
|
constexpr bool is_modifier(const Key key) {
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ enum Key: uint16_t {
|
|||||||
KeyF8 = 0xfff5,
|
KeyF8 = 0xfff5,
|
||||||
|
|
||||||
// Physical keys not within the usual matrix.
|
// Physical keys not within the usual matrix.
|
||||||
KeyRestore = 0xfffd,
|
KeyRestore = 0xfffc,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||||
|
|||||||
@@ -137,6 +137,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
static constexpr uint16_t KeyNotMapped = 0xfffe;
|
static constexpr uint16_t KeyNotMapped = 0xfffe;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Indicates that a key is not mapped (for the keyboard mapper) or that a
|
||||||
|
character cannot be typed (for the character mapper).
|
||||||
|
*/
|
||||||
|
static constexpr uint16_t DelaySlot = 0xfffd;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Allows individual machines to provide the mapping between host keys
|
Allows individual machines to provide the mapping between host keys
|
||||||
as per Inputs::Keyboard and their native scheme.
|
as per Inputs::Keyboard and their native scheme.
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ enum Key: uint16_t {
|
|||||||
KeyEquals = 0x0700 | 0x80, KeyReturn = 0x0700 | 0x20, KeyRightShift = 0x0700 | 0x10,
|
KeyEquals = 0x0700 | 0x80, KeyReturn = 0x0700 | 0x20, KeyRightShift = 0x0700 | 0x10,
|
||||||
KeyForwardSlash = 0x0700 | 0x08, Key0 = 0x0700 | 0x04, KeyL = 0x0700 | 0x02, Key8 = 0x0700 | 0x01,
|
KeyForwardSlash = 0x0700 | 0x08, Key0 = 0x0700 | 0x04, KeyL = 0x0700 | 0x02, Key8 = 0x0700 | 0x01,
|
||||||
|
|
||||||
KeyNMI = 0xfffd,
|
KeyNMI = 0xfffc,
|
||||||
KeyJasminReset = 0xfffc,
|
KeyJasminReset = 0xfffb,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ uint16_t Typer::try_type_next_character() {
|
|||||||
delegate_->clear_all_keys();
|
delegate_->clear_all_keys();
|
||||||
if(character_mapper_.needs_pause_after_reset_all_keys() ||
|
if(character_mapper_.needs_pause_after_reset_all_keys() ||
|
||||||
(string_pointer_ > 0 && string_[string_pointer_ - 1] == string_[string_pointer_])) {
|
(string_pointer_ > 0 && string_[string_pointer_ - 1] == string_[string_pointer_])) {
|
||||||
return 0xffff; // Arbitrarily. Anything non-zero will do.
|
return MachineTypes::MappedKeyboardMachine::DelaySlot;
|
||||||
}
|
}
|
||||||
++phase_;
|
++phase_;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user