Repository navigation
Expand file tree
/
Copy pathNintendoSwitch_KeyboardMapping.cpp
More file actions
80 lines (59 loc) · 2.38 KB
/
Copy pathNintendoSwitch_KeyboardMapping.cpp
File metadata and controls
80 lines (59 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* Nintendo Keyboard Mapping
*
* From: https://github.com/PokemonAutomation/
*
*/
#include "NintendoSwitch_KeyboardMapping.h"
//#include <iostream>
//using std::cout;
//using std::endl;
namespace PokemonAutomation{
namespace NintendoSwitch{
KeyboardMappingOption::~KeyboardMappingOption(){
ADVANCED_MODE.remove_listener(*this);
}
KeyboardMappingOption::KeyboardMappingOption()
: BatchOption(LockMode::UNLOCK_WHILE_RUNNING)
, DESCRIPTION(
"The following table is the mapping of keyboard keys to Switch controller presses. "
"If you wish to remap a key, click on the cell in the \"Key\" column and press the desired key. "
"You do not need to edit any of the other columns.<br><br>"
"<font color=\"orange\">Note for keys that change behavior when combined with "
"SHIFT or CTRL, you should include all of those combinations as well. "
"For example, the default mapping for the Y button is both '/' and '?' "
"because they are treated as different keys depending on whether SHIFT "
"is held down. Letters are exempt from this as both lower and upper case "
"letters are considered the same.</font>"
"<br><br>"
"Advanced users are free to edit the rest of the table. You can create "
"new mappings or mappings that result in multiple buttons. "
"For example, there is a special mapping for pressing A + R "
"simultaneously that is useful for CFW users who are remotely "
"controlling the program over Team Viewer."
)
, ADVANCED_MODE(
"Unlock entire table (Advanced Mode):",
LockMode::UNLOCK_WHILE_RUNNING,
false
)
, LEFT_JOYCON2(true)
, RIGHT_JOYCON2(false)
{
PA_ADD_STATIC(DESCRIPTION);
PA_ADD_OPTION(ADVANCED_MODE);
PA_ADD_OPTION(PRO_CONTROLLER2);
PA_ADD_OPTION(LEFT_JOYCON2);
PA_ADD_OPTION(RIGHT_JOYCON2);
ADVANCED_MODE.add_listener(*this);
}
void KeyboardMappingOption::load_json(const JsonValue& json){
BatchOption::load_json(json);
KeyboardMappingOption::on_config_value_changed(this);
}
void KeyboardMappingOption::on_config_value_changed(void* object){
PRO_CONTROLLER2.set_advanced_mode(ADVANCED_MODE);
LEFT_JOYCON2.set_advanced_mode(ADVANCED_MODE);
RIGHT_JOYCON2.set_advanced_mode(ADVANCED_MODE);
}
}
}