X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=vid_agl.c;h=d21ffc063193ab1078fc0f3c9624fae4bf358e4f;hb=3bef3df7af6d281af8216d5151f19cd6ad663d1b;hp=92341bcf5ac2af6c91ca0a172dc2a4adac45316a;hpb=e596d336891db86a2fb84791f5db7de764e33c08;p=xonotic%2Fdarkplaces.git diff --git a/vid_agl.c b/vid_agl.c index 92341bcf..d21ffc06 100644 --- a/vid_agl.c +++ b/vid_agl.c @@ -212,11 +212,8 @@ void VID_Finish (void) if (!vid_hidden) { - CHECKGLERROR if (r_speeds.integer == 2 || gl_finish.integer) - { - qglFinish();CHECKGLERROR - } + GL_Finish(); qaglSwapBuffers(context); } VID_UpdateGamma(false, GAMMA_TABLE_SIZE); @@ -399,6 +396,7 @@ void VID_Shutdown(void) if (context == NULL && window == NULL) return; + VID_EnableJoystick(false); VID_SetMouse(false, false, false); VID_RestoreSystemGamma(); @@ -694,8 +692,6 @@ qboolean VID_InitMode(viddef_mode_t *mode) } } - memset(&vid.support, 0, sizeof(vid.support)); - if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL) Sys_Error("glGetString not found in %s", gl_driver); @@ -1115,8 +1111,34 @@ void Sys_SendKeyEvents(void) } } +void VID_BuildJoyState(vid_joystate_t *joystate) +{ + VID_Shared_BuildJoyState_Begin(joystate); + VID_Shared_BuildJoyState_Finish(joystate); +} + +void VID_EnableJoystick(qboolean enable) +{ + int index = joy_enable.integer > 0 ? joy_index.integer : -1; + qboolean success = false; + int sharedcount = 0; + sharedcount = VID_Shared_SetJoystick(index); + if (index >= 0 && index < sharedcount) + success = true; + + // update cvar containing count of XInput joysticks + if (joy_detected.integer != sharedcount) + Cvar_SetValueQuick(&joy_detected, sharedcount); + + Cvar_SetValueQuick(&joy_active, success ? 1 : 0); +} + void IN_Move (void) { + vid_joystate_t joystate; + VID_EnableJoystick(true); + VID_BuildJoyState(&joystate); + VID_ApplyJoyState(&joystate); } static bool GetDictionaryBoolean(CFDictionaryRef d, const void *key)