73 lines
2.4 KiB
Diff
73 lines
2.4 KiB
Diff
kkoshelev@gmail.com
|
|
Add extra "-pin" argument to use specific pin when pairing.
|
|
--- moonlight-orig/src/config.h 2022-05-26 15:41:01.746182723 -0700
|
|
+++ moonlight-embedded/src/config.h 2022-05-27 11:48:21.543079367 -0700
|
|
@@ -30,7 +30,7 @@
|
|
int debug_level;
|
|
char* app;
|
|
char* action;
|
|
- char* address;
|
|
+ char* address;
|
|
char* mapping;
|
|
char* platform;
|
|
char* audio_device;
|
|
@@ -47,6 +47,7 @@
|
|
char* inputs[MAX_INPUTS];
|
|
int inputsCount;
|
|
enum codecs codec;
|
|
+ int pin;
|
|
} CONFIGURATION, *PCONFIGURATION;
|
|
|
|
extern bool inputAdded;
|
|
--- moonlight-orig/src/config.c 2022-05-26 15:41:01.746182723 -0700
|
|
+++ moonlight-embedded/src/config.c 2022-05-27 11:58:36.815496952 -0700
|
|
@@ -72,6 +72,7 @@
|
|
{"verbose", no_argument, NULL, 'z'},
|
|
{"debug", no_argument, NULL, 'Z'},
|
|
{"nomouseemulation", no_argument, NULL, '4'},
|
|
+ {"pin", required_argument, NULL, '5'},
|
|
{0, 0, 0, 0},
|
|
};
|
|
|
|
@@ -244,6 +245,9 @@
|
|
case '4':
|
|
config->mouse_emulation = false;
|
|
break;
|
|
+ case '5':
|
|
+ config->pin = atoi(value);
|
|
+ break;
|
|
case 1:
|
|
if (config->action == NULL)
|
|
config->action = value;
|
|
@@ -364,6 +368,7 @@
|
|
config->mouse_emulation = true;
|
|
config->rotate = 0;
|
|
config->codec = CODEC_UNSPECIFIED;
|
|
+ config->pin = 0;
|
|
|
|
config->inputsCount = 0;
|
|
config->mapping = get_path("gamecontrollerdb.txt", getenv("XDG_DATA_DIRS"));
|
|
@@ -381,7 +386,7 @@
|
|
} else {
|
|
int option_index = 0;
|
|
int c;
|
|
- while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:lm:no:p:q:r:s:tu:v:w:xy4", long_options, &option_index)) != -1) {
|
|
+ while ((c = getopt_long_only(argc, argv, "-abc:d:efg:h:i:j:k:lm:no:p:q:r:s:tu:v:w:xy45:", long_options, &option_index)) != -1) {
|
|
parse_argument(c, optarg, config);
|
|
}
|
|
}
|
|
--- moonlight-orig/src/main.c 2022-05-26 15:41:01.750182764 -0700
|
|
+++ moonlight-embedded/src/main.c 2022-05-27 11:46:42.714538602 -0700
|
|
@@ -373,7 +373,11 @@
|
|
stream(&server, &config, system);
|
|
} else if (strcmp("pair", config.action) == 0) {
|
|
char pin[5];
|
|
- sprintf(pin, "%d%d%d%d", (int)random() % 10, (int)random() % 10, (int)random() % 10, (int)random() % 10);
|
|
+ if (config.pin > 0 && config.pin <= 9999) {
|
|
+ sprintf(pin, "%04d", config.pin);
|
|
+ } else {
|
|
+ sprintf(pin, "%d%d%d%d", (int)random() % 10, (int)random() % 10, (int)random() % 10, (int)random() % 10);
|
|
+ }
|
|
printf("Please enter the following PIN on the target PC: %s\n", pin);
|
|
fflush(stdout);
|
|
if (gs_pair(&server, &pin[0]) != GS_OK) {
|