-#include "pad.h"
-
-char *PSEgetLibName(void) {
- return _("Gamepad/Keyboard Input");
-}
-
-uint32_t PSEgetLibType(void) {
- return PSE_LT_PAD;
-}
-
-uint32_t PSEgetLibVersion(void) {
- return (1 << 16) | (1 << 8);
-}
-
-long PADinit(long flags) {
- LoadPADConfig();
-
- g.PadState[0].PadMode = 0;
- g.PadState[0].PadID = 0x41;
- g.PadState[1].PadMode = 0;
- g.PadState[1].PadID = 0x41;
-
- return PSE_PAD_ERR_SUCCESS;
-}
-
-long PADshutdown(void) {
- PADclose();
- return PSE_PAD_ERR_SUCCESS;
-}
-
-static pthread_t ThreadID;
-static volatile uint8_t TerminateThread = 0;
-
-static void *JoyThread(void *param) {
- while (!TerminateThread) {
- CheckJoy();
- usleep(1000);
- }
- pthread_exit(0);
- return NULL;
-}
-
-long PADopen(unsigned long *Disp) {
- g.Disp = (Display *)*Disp;
-
- if (!g.Opened) {
- if (SDL_WasInit(SDL_INIT_EVERYTHING)) {
- if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) {
- return PSE_PAD_ERR_FAILURE;
- }
- } else if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE) == -1) {
- return PSE_PAD_ERR_FAILURE;
- }
-
- InitSDLJoy();
- InitKeyboard();
-
- g.KeyLeftOver = 0;