int joy = 0;
int i;
+#if defined(TARGET_SDL2)
+ /* map special "play/pause" media key to default key for play/pause actions */
+ if (key == KSYM_PlayPause)
+ key = KSYM_space;
+#endif
+
+ HandleSpecialGameControllerKeys(key, key_status);
+
if (game_status == GAME_MODE_PLAYING)
{
/* only needed for single-step tape recording mode */
}
#endif
}
+
+void HandleSpecialGameControllerKeys(Key key, int key_status)
+{
+#if defined(TARGET_SDL2)
+#if defined(KSYM_Rewind) && defined(KSYM_FastForward)
+ int button = SDL_CONTROLLER_BUTTON_INVALID;
+
+ /* map keys to joystick buttons (special hack for Amazon Fire TV remote) */
+ if (key == KSYM_Rewind)
+ button = SDL_CONTROLLER_BUTTON_A;
+ else if (key == KSYM_FastForward || key == KSYM_Menu)
+ button = SDL_CONTROLLER_BUTTON_B;
+
+ if (button != SDL_CONTROLLER_BUTTON_INVALID)
+ {
+ Event event;
+
+ event.type = (key_status == KEY_PRESSED ? SDL_CONTROLLERBUTTONDOWN :
+ SDL_CONTROLLERBUTTONUP);
+
+ event.cbutton.which = 0; /* first joystick (Amazon Fire TV remote) */
+ event.cbutton.button = button;
+ event.cbutton.state = (key_status == KEY_PRESSED ? SDL_PRESSED :
+ SDL_RELEASED);
+
+ HandleJoystickEvent(&event);
+ }
+#endif
+#endif
+}
void HandleKey(Key, int);
void HandleJoystick();
void HandleSpecialGameControllerButtons(Event *);
+void HandleSpecialGameControllerKeys(Key, int);
#endif
#if defined(TARGET_SDL2)
#define KSYM_Menu SDLK_MENU
#define KSYM_Back SDLK_AC_BACK
+#define KSYM_PlayPause SDLK_AUDIOPLAY
+#if defined(PLATFORM_ANDROID)
+#define KSYM_Rewind SDLK_AUDIORWND
+#define KSYM_FastForward SDLK_AUDIOFFWD
+#endif
#endif
#define KSYM_space SDLK_SPACE
case KSYM_Return:
#if defined(TARGET_SDL2)
case KSYM_Menu:
+#if defined(KSYM_Rewind)
+ case KSYM_Rewind: /* for Amazon Fire TV remote */
+#endif
#endif
result = 1;
break;
case KSYM_Escape:
#if defined(TARGET_SDL2)
case KSYM_Back:
+#if defined(KSYM_FastForward)
+ case KSYM_FastForward: /* for Amazon Fire TV remote */
+#endif
#endif
result = 0;
break;