Add map function to create controller mappings

This commit is contained in:
Iwan Timmer
2017-10-24 20:51:08 +02:00
parent a0c43053e7
commit f08b701223
6 changed files with 185 additions and 4 deletions

View File

@@ -139,6 +139,7 @@ static void help() {
printf("\tstream\t\t\tStream computer to device\n");
printf("\tlist\t\t\tList available games and applications\n");
printf("\tquit\t\t\tQuit the application or game being streamed\n");
printf("\tmap\t\t\tCreate mapping file for gamepad\n");
printf("\thelp\t\t\tShow this help\n");
printf("\n Global Options\n\n");
printf("\t-config <config>\tLoad configuration file\n");
@@ -194,6 +195,17 @@ int main(int argc, char* argv[]) {
if (config.debug_level > 0)
printf("Moonlight Embedded %d.%d.%d (%s)\n", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH, COMPILE_OPTIONS);
if (strcmp("map", config.action) == 0) {
if (config.inputsCount != 1) {
printf("You need to specify one input device using -input.\n");
exit(-1);
}
evdev_create(config.inputs[0], NULL, config.debug_level > 0);
evdev_map(config.inputs[0]);
exit(0);
}
if (config.address == NULL) {
config.address = malloc(MAX_ADDRESS_SIZE);
if (config.address == NULL) {