Error out in linuxinput if stdin is used for rom loading.
This commit is contained in:
parent
38f7673fac
commit
dd3a1d0df2
|
@ -173,6 +173,12 @@ static void *linuxraw_input_init(void)
|
||||||
if (!isatty(0))
|
if (!isatty(0))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (driver.stdin_claimed)
|
||||||
|
{
|
||||||
|
RARCH_WARN("stdin is already used for ROM loading. Cannot use stdin for input.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
linuxraw_input_t *linuxraw = (linuxraw_input_t*)calloc(1, sizeof(*linuxraw));
|
linuxraw_input_t *linuxraw = (linuxraw_input_t*)calloc(1, sizeof(*linuxraw));
|
||||||
if (!linuxraw)
|
if (!linuxraw)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -279,7 +285,7 @@ static void linuxraw_input_poll(void *data)
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
uint16_t t;
|
uint16_t t;
|
||||||
|
|
||||||
while (read(0, &c, 1) > 0)
|
while (read(STDIN_FILENO, &c, 1) > 0)
|
||||||
{
|
{
|
||||||
if (c == KEY_C && (linuxraw->state[KEY_LEFTCTRL] || linuxraw->state[KEY_RIGHTCTRL]))
|
if (c == KEY_C && (linuxraw->state[KEY_LEFTCTRL] || linuxraw->state[KEY_RIGHTCTRL]))
|
||||||
kill(getpid(), SIGINT);
|
kill(getpid(), SIGINT);
|
||||||
|
@ -289,7 +295,7 @@ static void linuxraw_input_poll(void *data)
|
||||||
|
|
||||||
// ignore extended scancodes
|
// ignore extended scancodes
|
||||||
if (!c)
|
if (!c)
|
||||||
read(0, &t, 2);
|
read(STDIN_FILENO, &t, 2);
|
||||||
else
|
else
|
||||||
linuxraw->state[c] = pressed;
|
linuxraw->state[c] = pressed;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue