mirror of
https://github.com/archr-linux/fileman.git
synced 2026-07-13 03:19:08 -07:00
Merge pull request #11 from Oendaril/master
Standardizing device input mapping
This commit is contained in:
@@ -166,139 +166,25 @@
|
||||
#define VIEWER_SCROLL_SPEED 20
|
||||
|
||||
// Button events
|
||||
#if defined(DEVICE_AMD64)
|
||||
#define BUTTON_PRESSED_UP event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_UP
|
||||
#define BUTTON_PRESSED_DOWN event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_DOWN
|
||||
#define BUTTON_PRESSED_LEFT event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_LEFT
|
||||
#define BUTTON_PRESSED_RIGHT event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_RIGHT
|
||||
#define BUTTON_PRESSED_PAGEUP event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 4 || event.jbutton.button == 6)
|
||||
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 5 || event.jbutton.button == 7)
|
||||
#define BUTTON_PRESSED_VALIDATE event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 1
|
||||
#define BUTTON_PRESSED_BACK event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 0
|
||||
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 3
|
||||
#define BUTTON_PRESSED_SELECT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 2
|
||||
#define BUTTON_HELD_UP SDL_JoystickGetButton(g_joystick, 13)
|
||||
#define BUTTON_HELD_DOWN SDL_JoystickGetButton(g_joystick, 14)
|
||||
#define BUTTON_HELD_LEFT SDL_JoystickGetButton(g_joystick, 15)
|
||||
#define BUTTON_HELD_RIGHT SDL_JoystickGetButton(g_joystick, 16)
|
||||
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4) || SDL_JoystickGetButton(g_joystick, 6)
|
||||
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5) || SDL_JoystickGetButton(g_joystick, 7)
|
||||
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 3)
|
||||
#define BUTTON_HELD_VALIDATE SDL_JoystickGetButton(g_joystick, 1)
|
||||
#elif defined(DEVICE_RK3326)
|
||||
#define BUTTON_PRESSED_UP event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_UP || event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 8
|
||||
#define BUTTON_PRESSED_DOWN event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_DOWN || event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 9
|
||||
#define BUTTON_PRESSED_LEFT event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_LEFT || event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 10
|
||||
#define BUTTON_PRESSED_RIGHT event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_RIGHT || event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 11
|
||||
#define BUTTON_PRESSED_PAGEUP event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 4
|
||||
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 5
|
||||
#define BUTTON_PRESSED_VALIDATE event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 0
|
||||
#define BUTTON_PRESSED_BACK event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 1
|
||||
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 2
|
||||
#define BUTTON_PRESSED_SELECT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 3
|
||||
#define BUTTON_HELD_UP SDL_JoystickGetHat(g_joystick, 0) == SDL_HAT_UP || SDL_JoystickGetButton(g_joystick, 8)
|
||||
#define BUTTON_HELD_DOWN SDL_JoystickGetHat(g_joystick, 0) == SDL_HAT_DOWN || SDL_JoystickGetButton(g_joystick, 9)
|
||||
#define BUTTON_HELD_LEFT SDL_JoystickGetHat(g_joystick, 0) == SDL_HAT_LEFT || SDL_JoystickGetButton(g_joystick, 10)
|
||||
#define BUTTON_HELD_RIGHT SDL_JoystickGetHat(g_joystick, 0) == SDL_HAT_RIGHT || SDL_JoystickGetButton(g_joystick, 11)
|
||||
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4)
|
||||
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5)
|
||||
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 3)
|
||||
#define BUTTON_HELD_VALIDATE SDL_JoystickGetButton(g_joystick, 0)
|
||||
#elif defined(DEVICE_RK3399)
|
||||
#define BUTTON_PRESSED_UP event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 13
|
||||
#define BUTTON_PRESSED_DOWN event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 14
|
||||
#define BUTTON_PRESSED_LEFT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 15
|
||||
#define BUTTON_PRESSED_RIGHT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 16
|
||||
#define BUTTON_PRESSED_PAGEUP event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 4 || event.jbutton.button == 6)
|
||||
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 5 || event.jbutton.button == 7)
|
||||
#define BUTTON_PRESSED_VALIDATE event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 1
|
||||
#define BUTTON_PRESSED_BACK event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 0
|
||||
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 2
|
||||
#define BUTTON_PRESSED_SELECT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 3
|
||||
#define BUTTON_HELD_UP SDL_JoystickGetButton(g_joystick, 13)
|
||||
#define BUTTON_HELD_DOWN SDL_JoystickGetButton(g_joystick, 14)
|
||||
#define BUTTON_HELD_LEFT SDL_JoystickGetButton(g_joystick, 15)
|
||||
#define BUTTON_HELD_RIGHT SDL_JoystickGetButton(g_joystick, 16)
|
||||
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4) || SDL_JoystickGetButton(g_joystick, 6)
|
||||
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5) || SDL_JoystickGetButton(g_joystick, 7)
|
||||
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 3)
|
||||
#define BUTTON_HELD_VALIDATE SDL_JoystickGetButton(g_joystick, 1)
|
||||
#elif defined(DEVICE_RK3566)
|
||||
#define BUTTON_PRESSED_UP event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 13
|
||||
#define BUTTON_PRESSED_DOWN event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 14
|
||||
#define BUTTON_PRESSED_LEFT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 15
|
||||
#define BUTTON_PRESSED_RIGHT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 16
|
||||
#define BUTTON_PRESSED_PAGEUP event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 4 || event.jbutton.button == 6)
|
||||
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 5 || event.jbutton.button == 7)
|
||||
#define BUTTON_PRESSED_VALIDATE event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 1
|
||||
#define BUTTON_PRESSED_BACK event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 0
|
||||
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 2
|
||||
#define BUTTON_PRESSED_SELECT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 3
|
||||
#define BUTTON_HELD_UP SDL_JoystickGetButton(g_joystick, 13)
|
||||
#define BUTTON_HELD_DOWN SDL_JoystickGetButton(g_joystick, 14)
|
||||
#define BUTTON_HELD_LEFT SDL_JoystickGetButton(g_joystick, 15)
|
||||
#define BUTTON_HELD_RIGHT SDL_JoystickGetButton(g_joystick, 16)
|
||||
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4) || SDL_JoystickGetButton(g_joystick, 6)
|
||||
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5) || SDL_JoystickGetButton(g_joystick, 7)
|
||||
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 3)
|
||||
#define BUTTON_HELD_VALIDATE SDL_JoystickGetButton(g_joystick, 1)
|
||||
#elif defined(DEVICE_RK3566_X55)
|
||||
#define BUTTON_PRESSED_UP event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 13
|
||||
#define BUTTON_PRESSED_DOWN event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 14
|
||||
#define BUTTON_PRESSED_LEFT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 15
|
||||
#define BUTTON_PRESSED_RIGHT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 16
|
||||
#define BUTTON_PRESSED_PAGEUP event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 4 || event.jbutton.button == 6)
|
||||
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 5 || event.jbutton.button == 7)
|
||||
#define BUTTON_PRESSED_VALIDATE event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 0
|
||||
#define BUTTON_PRESSED_BACK event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 1
|
||||
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 2
|
||||
#define BUTTON_PRESSED_SELECT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 3
|
||||
#define BUTTON_HELD_UP SDL_JoystickGetButton(g_joystick, 13)
|
||||
#define BUTTON_HELD_DOWN SDL_JoystickGetButton(g_joystick, 14)
|
||||
#define BUTTON_HELD_LEFT SDL_JoystickGetButton(g_joystick, 15)
|
||||
#define BUTTON_HELD_RIGHT SDL_JoystickGetButton(g_joystick, 16)
|
||||
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4) || SDL_JoystickGetButton(g_joystick, 6)
|
||||
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5) || SDL_JoystickGetButton(g_joystick, 7)
|
||||
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 3)
|
||||
#define BUTTON_HELD_VALIDATE SDL_JoystickGetButton(g_joystick, 1)
|
||||
#elif defined(DEVICE_RK3588)
|
||||
#define BUTTON_PRESSED_UP event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_UP
|
||||
#define BUTTON_PRESSED_DOWN event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_DOWN
|
||||
#define BUTTON_PRESSED_LEFT event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_LEFT
|
||||
#define BUTTON_PRESSED_RIGHT event.type == SDL_JOYHATMOTION && event.jhat.value == SDL_HAT_RIGHT
|
||||
#define BUTTON_PRESSED_PAGEUP event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 4 || event.jbutton.button == 6)
|
||||
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 5 || event.jbutton.button == 7)
|
||||
#define BUTTON_PRESSED_VALIDATE event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 1
|
||||
#define BUTTON_PRESSED_BACK event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 0
|
||||
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 3
|
||||
#define BUTTON_PRESSED_SELECT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 2
|
||||
#define BUTTON_HELD_UP SDL_JoystickGetButton(g_joystick, 13)
|
||||
#define BUTTON_HELD_DOWN SDL_JoystickGetButton(g_joystick, 14)
|
||||
#define BUTTON_HELD_LEFT SDL_JoystickGetButton(g_joystick, 15)
|
||||
#define BUTTON_HELD_RIGHT SDL_JoystickGetButton(g_joystick, 16)
|
||||
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4) || SDL_JoystickGetButton(g_joystick, 6)
|
||||
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5) || SDL_JoystickGetButton(g_joystick, 7)
|
||||
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 3)
|
||||
#define BUTTON_HELD_VALIDATE SDL_JoystickGetButton(g_joystick, 1)
|
||||
#elif defined(DEVICE_S922X)
|
||||
#define BUTTON_PRESSED_UP event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 8
|
||||
#define BUTTON_PRESSED_DOWN event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 9
|
||||
#define BUTTON_PRESSED_LEFT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 10
|
||||
#define BUTTON_PRESSED_RIGHT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 11
|
||||
#define BUTTON_PRESSED_PAGEUP event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 4 || event.jbutton.button == 6)
|
||||
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_JOYBUTTONDOWN && (event.jbutton.button == 5 || event.jbutton.button == 7)
|
||||
#define BUTTON_PRESSED_VALIDATE event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 1
|
||||
#define BUTTON_PRESSED_BACK event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 0
|
||||
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 2
|
||||
#define BUTTON_PRESSED_SELECT event.type == SDL_JOYBUTTONDOWN && event.jbutton.button == 3
|
||||
#define BUTTON_HELD_UP SDL_JoystickGetButton(g_joystick, 8)
|
||||
#define BUTTON_HELD_DOWN SDL_JoystickGetButton(g_joystick, 9)
|
||||
#define BUTTON_HELD_LEFT SDL_JoystickGetButton(g_joystick, 10)
|
||||
#define BUTTON_HELD_RIGHT SDL_JoystickGetButton(g_joystick, 11)
|
||||
#define BUTTON_HELD_PAGEUP SDL_JoystickGetButton(g_joystick, 4) || SDL_JoystickGetButton(g_joystick, 6)
|
||||
#define BUTTON_HELD_PAGEDOWN SDL_JoystickGetButton(g_joystick, 5) || SDL_JoystickGetButton(g_joystick, 7)
|
||||
#define BUTTON_HELD_SELECT SDL_JoystickGetButton(g_joystick, 3)
|
||||
#define BUTTON_HELD_VALIDATE SDL_JoystickGetButton(g_joystick, 1)
|
||||
#if defined(DEVICE_AMD64) || defined(DEVICE_RK3326) || defined(DEVICE_RK3399) || defined(DEVICE_RK3566) || defined(DEVICE_RK3566_X55) || defined(DEVICE_RK3588) || defined(DEVICE_S922X)
|
||||
#define BUTTON_PRESSED_UP event.type == SDL_KEYDOWN && event.key.repeat == 0 && (event.key.keysym.sym == SDLK_UP || event.key.keysym.sym == SDLK_w)
|
||||
#define BUTTON_PRESSED_DOWN event.type == SDL_KEYDOWN && event.key.repeat == 0 && (event.key.keysym.sym == SDLK_DOWN || event.key.keysym.sym == SDLK_s)
|
||||
#define BUTTON_PRESSED_LEFT event.type == SDL_KEYDOWN && event.key.repeat == 0 && event.key.keysym.sym == SDLK_LEFT
|
||||
#define BUTTON_PRESSED_RIGHT event.type == SDL_KEYDOWN && event.key.repeat == 0 && event.key.keysym.sym == SDLK_RIGHT
|
||||
#define BUTTON_PRESSED_PAGEUP event.type == SDL_KEYDOWN && event.key.repeat == 0 && (event.key.keysym.sym == SDLK_RSHIFT || event.key.keysym.sym == SDLK_HOME)
|
||||
#define BUTTON_PRESSED_PAGEDOWN event.type == SDL_KEYDOWN && event.key.repeat == 0 && (event.key.keysym.sym == SDLK_LSHIFT || event.key.keysym.sym == SDLK_END)
|
||||
#define BUTTON_PRESSED_VALIDATE event.type == SDL_KEYDOWN && event.key.repeat == 0 && event.key.keysym.sym == SDLK_x
|
||||
#define BUTTON_PRESSED_BACK event.type == SDL_KEYDOWN && event.key.repeat == 0 && event.key.keysym.sym == SDLK_z
|
||||
#define BUTTON_PRESSED_MENU_CONTEXT event.type == SDL_KEYDOWN && event.key.repeat == 0 && event.key.keysym.sym == SDLK_c
|
||||
#define BUTTON_PRESSED_SELECT event.type == SDL_KEYDOWN && event.key.repeat == 0 && event.key.keysym.sym == SDLK_a
|
||||
#define BUTTON_HELD_UP SDL_GetKeyboardState(NULL)[SDL_SCANCODE_UP] || SDL_GetKeyboardState(NULL)[SDL_SCANCODE_W]
|
||||
#define BUTTON_HELD_DOWN SDL_GetKeyboardState(NULL)[SDL_SCANCODE_DOWN] || SDL_GetKeyboardState(NULL)[SDL_SCANCODE_S]
|
||||
#define BUTTON_HELD_LEFT SDL_GetKeyboardState(NULL)[SDL_SCANCODE_LEFT]
|
||||
#define BUTTON_HELD_RIGHT SDL_GetKeyboardState(NULL)[SDL_SCANCODE_RIGHT]
|
||||
#define BUTTON_HELD_PAGEUP SDL_GetKeyboardState(NULL)[SDL_SCANCODE_RSHIFT] || SDL_GetKeyboardState(NULL)[SDL_SCANCODE_HOME]
|
||||
#define BUTTON_HELD_PAGEDOWN SDL_GetKeyboardState(NULL)[SDL_SCANCODE_LSHIFT] || SDL_GetKeyboardState(NULL)[SDL_SCANCODE_END]
|
||||
#define BUTTON_HELD_SELECT SDL_GetKeyboardState(NULL)[SDL_SCANCODE_A]
|
||||
#define BUTTON_HELD_VALIDATE SDL_GetKeyboardState(NULL)[SDL_SCANCODE_X]
|
||||
#else
|
||||
#define BUTTON_PRESSED_UP event.type == SDL_KEYDOWN && event.key.repeat == 0 && event.key.keysym.sym == SDLK_UP
|
||||
#define BUTTON_PRESSED_DOWN event.type == SDL_KEYDOWN && event.key.repeat == 0 && event.key.keysym.sym == SDLK_DOWN
|
||||
|
||||
Reference in New Issue
Block a user