mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-26 00:40:56 +00:00
Revert "This should be enough for SDL controller hotplug support but I haven't tested it"
git-svn-id: https://svn.eduke32.com/eduke32@8005 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
59b0c0e3f7
commit
7ea2e4de54
5 changed files with 7 additions and 31 deletions
|
@ -222,9 +222,8 @@ int32_t handleevents_peekkeys(void);
|
||||||
|
|
||||||
extern void (*keypresscallback)(int32_t,int32_t);
|
extern void (*keypresscallback)(int32_t,int32_t);
|
||||||
extern void (*g_mouseCallback)(int32_t,int32_t);
|
extern void (*g_mouseCallback)(int32_t,int32_t);
|
||||||
extern void (*g_controllerHotplugCallback)(void);
|
|
||||||
|
|
||||||
int32_t initinput(void(*hotplugCallback)(void) = NULL);
|
int32_t initinput(void);
|
||||||
void uninitinput(void);
|
void uninitinput(void);
|
||||||
void keySetCallback(void (*callback)(int32_t,int32_t));
|
void keySetCallback(void (*callback)(int32_t,int32_t));
|
||||||
void mouseSetCallback(void (*callback)(int32_t,int32_t));
|
void mouseSetCallback(void (*callback)(int32_t,int32_t));
|
||||||
|
|
|
@ -102,8 +102,6 @@ bool g_mouseLockedToWindow = 1;
|
||||||
void (*g_mouseCallback)(int32_t, int32_t);
|
void (*g_mouseCallback)(int32_t, int32_t);
|
||||||
void mouseSetCallback(void(*callback)(int32_t, int32_t)) { g_mouseCallback = callback; }
|
void mouseSetCallback(void(*callback)(int32_t, int32_t)) { g_mouseCallback = callback; }
|
||||||
|
|
||||||
void (*g_controllerHotplugCallback)(void);
|
|
||||||
|
|
||||||
int32_t mouseAdvanceClickState(void)
|
int32_t mouseAdvanceClickState(void)
|
||||||
{
|
{
|
||||||
switch (g_mouseClickState)
|
switch (g_mouseClickState)
|
||||||
|
|
|
@ -825,8 +825,6 @@ static void LoadSDLControllerDB()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int numjoysticks;
|
|
||||||
|
|
||||||
void joyScanDevices()
|
void joyScanDevices()
|
||||||
{
|
{
|
||||||
inputdevices &= ~4;
|
inputdevices &= ~4;
|
||||||
|
@ -842,8 +840,7 @@ void joyScanDevices()
|
||||||
joydev = nullptr;
|
joydev = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
numjoysticks = SDL_NumJoysticks();
|
int numjoysticks = SDL_NumJoysticks();
|
||||||
|
|
||||||
if (numjoysticks < 1)
|
if (numjoysticks < 1)
|
||||||
{
|
{
|
||||||
buildputs("No game controllers found\n");
|
buildputs("No game controllers found\n");
|
||||||
|
@ -928,20 +925,10 @@ void joyScanDevices()
|
||||||
//
|
//
|
||||||
// initinput() -- init input system
|
// initinput() -- init input system
|
||||||
//
|
//
|
||||||
int32_t initinput(void(*hotplugCallback)(void) /*= NULL*/)
|
int32_t initinput(void)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
#if SDL_MAJOR_VERSION >= 2
|
|
||||||
if (hotplugCallback)
|
|
||||||
{
|
|
||||||
g_controllerHotplugCallback = hotplugCallback;
|
|
||||||
SDL_JoystickEventState(SDL_ENABLE);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
UNREFERENCED_PARAMETER(hotplugCallback);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Win_GetOriginalLayoutName();
|
Win_GetOriginalLayoutName();
|
||||||
Win_SetKeyboardLayoutUS(1);
|
Win_SetKeyboardLayoutUS(1);
|
||||||
|
@ -987,6 +974,7 @@ int32_t initinput(void(*hotplugCallback)(void) /*= NULL*/)
|
||||||
#if SDL_MAJOR_VERSION >= 2
|
#if SDL_MAJOR_VERSION >= 2
|
||||||
LoadSDLControllerDB();
|
LoadSDLControllerDB();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
joyScanDevices();
|
joyScanDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2111,13 +2099,7 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if SDL_MAJOR_VERSION >= 2
|
|
||||||
case SDL_CONTROLLERDEVICEADDED:
|
|
||||||
case SDL_CONTROLLERDEVICEREMOVED:
|
|
||||||
if (g_controllerHotplugCallback && SDL_NumJoysticks() != numjoysticks)
|
|
||||||
g_controllerHotplugCallback();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case SDL_JOYAXISMOTION:
|
case SDL_JOYAXISMOTION:
|
||||||
#if SDL_MAJOR_VERSION >= 2
|
#if SDL_MAJOR_VERSION >= 2
|
||||||
if (joystick.isGameController)
|
if (joystick.isGameController)
|
||||||
|
@ -2205,9 +2187,6 @@ int32_t handleevents_pollsdl(void)
|
||||||
int32_t code, rv=0, j;
|
int32_t code, rv=0, j;
|
||||||
SDL_Event ev;
|
SDL_Event ev;
|
||||||
|
|
||||||
if (g_controllerHotplugCallback && SDL_NumJoysticks() != numjoysticks)
|
|
||||||
g_controllerHotplugCallback();
|
|
||||||
|
|
||||||
while (SDL_PollEvent(&ev))
|
while (SDL_PollEvent(&ev))
|
||||||
{
|
{
|
||||||
switch (ev.type)
|
switch (ev.type)
|
||||||
|
|
|
@ -683,7 +683,7 @@ int32_t handleevents(void)
|
||||||
//
|
//
|
||||||
// initinput() -- init input system
|
// initinput() -- init input system
|
||||||
//
|
//
|
||||||
int32_t initinput(void(*hotplugCallback)(void) /*= NULL*/)
|
int32_t initinput(void)
|
||||||
{
|
{
|
||||||
Win_GetOriginalLayoutName();
|
Win_GetOriginalLayoutName();
|
||||||
Win_SetKeyboardLayoutUS(1);
|
Win_SetKeyboardLayoutUS(1);
|
||||||
|
|
|
@ -955,7 +955,7 @@ bool CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t ti
|
||||||
if (CONTROL_DoubleClickSpeed <= 0)
|
if (CONTROL_DoubleClickSpeed <= 0)
|
||||||
CONTROL_DoubleClickSpeed = 1;
|
CONTROL_DoubleClickSpeed = 1;
|
||||||
|
|
||||||
if (initinput(CONTROL_ScanForControllers))
|
if (initinput())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
KB_Startup();
|
KB_Startup();
|
||||||
|
|
Loading…
Reference in a new issue