mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2026-04-08 17:06:26 +00:00
Provide gamepad mask at startup
This commit is contained in:
@@ -91,6 +91,8 @@ static bool* currentReverse;
|
||||
|
||||
static bool grabbingDevices;
|
||||
|
||||
int evdev_gamepads = 0;
|
||||
|
||||
#define QUIT_MODIFIERS (MODIFIER_SHIFT|MODIFIER_ALT|MODIFIER_CTRL)
|
||||
#define QUIT_KEY KEY_Q
|
||||
#define QUIT_BUTTONS (PLAY_FLAG|BACK_FLAG|LB_FLAG|RB_FLAG)
|
||||
@@ -495,6 +497,9 @@ void evdev_create(const char* device, struct mapping* mappings, bool verbose) {
|
||||
mappings = default_mapping;
|
||||
}
|
||||
|
||||
if (!is_keyboard && !is_mouse)
|
||||
evdev_gamepads++;
|
||||
|
||||
int dev = numDevices;
|
||||
numDevices++;
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
|
||||
#include "mapping.h"
|
||||
|
||||
extern int evdev_gamepads;
|
||||
|
||||
void evdev_create(const char* device, struct mapping* mappings, bool verbose);
|
||||
void evdev_loop();
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ static GAMEPAD_STATE gamepads[4];
|
||||
static int keyboard_modifiers;
|
||||
static int activeGamepadMask = 0;
|
||||
|
||||
int sdl_gamepads = 0;
|
||||
|
||||
void sdlinput_init(char* mappings) {
|
||||
memset(gamepads, 0, sizeof(gamepads));
|
||||
|
||||
@@ -50,6 +52,7 @@ void sdlinput_init(char* mappings) {
|
||||
|
||||
for (int i = 0; i < SDL_NumJoysticks(); ++i) {
|
||||
if (SDL_IsGameController(i)) {
|
||||
sdl_gamepads++;
|
||||
if (!SDL_GameControllerOpen(i)) {
|
||||
fprintf(stderr, "Could not open gamecontroller %i: %s\n", i, SDL_GetError());
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <SDL.h>
|
||||
|
||||
extern int sdl_gamepads;
|
||||
|
||||
static const short keyCodes1[] = {
|
||||
0, //SDLK_EXCLAIM
|
||||
0, //SDLK_QUOTEDBL
|
||||
|
||||
Reference in New Issue
Block a user