mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
api: dump key binding strings (#606)
Print out human readable text for vKey when dumping bindings.
This commit is contained in:
@@ -278,6 +278,8 @@ std::string Button::getVKeyString() {
|
|||||||
return "Left Alt";
|
return "Left Alt";
|
||||||
case 0xA5:
|
case 0xA5:
|
||||||
return "Right Alt";
|
return "Right Alt";
|
||||||
|
case INVALID_VKEY:
|
||||||
|
return "Invalid";
|
||||||
default:
|
default:
|
||||||
|
|
||||||
// check win API
|
// check win API
|
||||||
|
|||||||
@@ -83,12 +83,20 @@ public:
|
|||||||
if (this->override_enabled) {
|
if (this->override_enabled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// has a device
|
||||||
|
if (!this->device_identifier.empty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// naive, and has a valid vKey
|
||||||
if (this->vKey != INVALID_VKEY) {
|
if (this->vKey != INVALID_VKEY) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto &alternative : this->alternatives) {
|
for (auto &alternative : this->alternatives) {
|
||||||
if (alternative.vKey != INVALID_VKEY) {
|
if (!alternative.getDeviceIdentifier().empty() ||
|
||||||
|
alternative.getVKey() != INVALID_VKEY) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2569,9 +2569,10 @@ void dump_button_bindings(std::vector<Button> *buttons) {
|
|||||||
|
|
||||||
if (button->isNaive()) {
|
if (button->isNaive()) {
|
||||||
log_misc(
|
log_misc(
|
||||||
"rawinput", " [{}] dev=Naive, vkey={}",
|
"rawinput", " [{}] dev=Naive, vkey={} ({})",
|
||||||
button->getName(),
|
button->getName(),
|
||||||
button->getVKey()
|
button->getVKey(),
|
||||||
|
button->getVKeyString()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
log_misc(
|
log_misc(
|
||||||
@@ -2584,18 +2585,27 @@ void dump_button_bindings(std::vector<Button> *buttons) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto& alt : button->getAlternatives()) {
|
for (auto& alt : button->getAlternatives()) {
|
||||||
if (alt.getVKey() == INVALID_VKEY) {
|
if (!alt.isValid()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (alt.isNaive()) {
|
||||||
|
log_misc(
|
||||||
|
"rawinput", " [{}] (alt) dev=Naive, vkey={} ({})",
|
||||||
|
alt.getName(),
|
||||||
|
alt.getVKey(),
|
||||||
|
alt.getVKeyString()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
log_misc(
|
log_misc(
|
||||||
"rawinput", " [{}] (alt) dev={}, vkey={}, analogtype={}",
|
"rawinput", " [{}] (alt) dev={}, vkey={}, analogtype={}",
|
||||||
button->getName(),
|
alt.getName(),
|
||||||
alt.isNaive() ? "Naive" : alt.getDeviceIdentifier(),
|
alt.getDeviceIdentifier(),
|
||||||
alt.getVKey(),
|
alt.getVKey(),
|
||||||
static_cast<uint32_t>(alt.getAnalogType())
|
static_cast<uint32_t>(alt.getAnalogType())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_analog_bindings() {
|
void dump_analog_bindings() {
|
||||||
|
|||||||
Reference in New Issue
Block a user