]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_agl.c
Fix bugs in ModList_RebuildList such that it no longer lists files in the quake direc...
[xonotic/darkplaces.git] / vid_agl.c
index 92341bcf5ac2af6c91ca0a172dc2a4adac45316a..bacbb5ffd4d23a47fa49765cc489711257aa097c 100644 (file)
--- 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);
@@ -315,7 +312,7 @@ int VID_GetGamma(unsigned short *ramps, int rampsize)
 
 void signal_handler(int sig)
 {
-       printf("Received signal %d, exiting...\n", sig);
+       Sys_PrintfToTerminal("Received signal %d, exiting...\n", sig);
        VID_RestoreSystemGamma();
        Sys_Quit(1);
 }
@@ -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)
@@ -1136,6 +1158,11 @@ long GetDictionaryLong(CFDictionaryRef d, const void *key)
     return value;
 }
 
+vid_mode_t *VID_GetDesktopMode(void)
+{
+       return NULL; // FIXME add desktopfullscreen
+}
+
 size_t VID_ListModes(vid_mode_t *modes, size_t maxcount)
 {
        CGDirectDisplayID mainDisplay = CGMainDisplayID();