-extern qboolean vid_hidden;
-extern qboolean vid_activewindow;
-extern cvar_t vid_hardwaregammasupported;
-extern qboolean vid_usinghwgamma;
-extern qboolean vid_supportrefreshrate;
-
-extern cvar_t vid_fullscreen;
-extern cvar_t vid_width;
-extern cvar_t vid_height;
-extern cvar_t vid_bitsperpixel;
-extern cvar_t vid_samples;
-extern cvar_t vid_refreshrate;
-extern cvar_t vid_userefreshrate;
-extern cvar_t vid_vsync;
-extern cvar_t vid_mouse;
-extern cvar_t vid_grabkeyboard;
-extern cvar_t vid_stick_mouse;
-extern cvar_t vid_resizable;
-extern cvar_t vid_minwidth;
-extern cvar_t vid_minheight;
-
-extern cvar_t gl_finish;
-
-extern cvar_t v_gamma;
-extern cvar_t v_contrast;
-extern cvar_t v_brightness;
-extern cvar_t v_color_enable;
-extern cvar_t v_color_black_r;
-extern cvar_t v_color_black_g;
-extern cvar_t v_color_black_b;
-extern cvar_t v_color_grey_r;
-extern cvar_t v_color_grey_g;
-extern cvar_t v_color_grey_b;
-extern cvar_t v_color_white_r;
-extern cvar_t v_color_white_g;
-extern cvar_t v_color_white_b;
-extern cvar_t v_hwgamma;
+#define MAXJOYAXIS 16
+// if this is changed, the corresponding code in vid_shared.c must be updated
+#define MAXJOYBUTTON 36
+typedef struct vid_joystate_s
+{
+ float axis[MAXJOYAXIS]; // -1 to +1
+ unsigned char button[MAXJOYBUTTON]; // 0 or 1
+ qbool is360; // indicates this joystick is a Microsoft Xbox 360 Controller For Windows
+}
+vid_joystate_t;
+
+extern vid_joystate_t vid_joystate;
+
+extern struct cvar_s joy_index;
+extern struct cvar_s joy_enable;
+extern struct cvar_s joy_detected;
+extern struct cvar_s joy_active;
+
+float VID_JoyState_GetAxis(const vid_joystate_t *joystate, int axis, float sensitivity, float deadzone);
+void VID_ApplyJoyState(vid_joystate_t *joystate);
+void VID_BuildJoyState(vid_joystate_t *joystate);
+void VID_Shared_BuildJoyState_Begin(vid_joystate_t *joystate);
+void VID_Shared_BuildJoyState_Finish(vid_joystate_t *joystate);
+int VID_Shared_SetJoystick(int index);
+qbool VID_JoyBlockEmulatedKeys(int keycode);
+void VID_EnableJoystick(qbool enable);
+
+extern qbool vid_hidden;
+extern qbool vid_activewindow;
+extern qbool vid_supportrefreshrate;
+
+extern struct cvar_s vid_fullscreen;
+extern struct cvar_s vid_borderless;
+extern struct cvar_s vid_width;
+extern struct cvar_s vid_height;
+extern struct cvar_s vid_bitsperpixel;
+extern struct cvar_s vid_samples;
+extern struct cvar_s vid_refreshrate;
+extern struct cvar_s vid_userefreshrate;
+extern struct cvar_s vid_touchscreen_density;
+extern struct cvar_s vid_touchscreen_xdpi;
+extern struct cvar_s vid_touchscreen_ydpi;
+extern struct cvar_s vid_vsync;
+extern struct cvar_s vid_mouse;
+extern struct cvar_s vid_mouse_clickthrough;
+extern struct cvar_s vid_grabkeyboard;
+extern struct cvar_s vid_touchscreen;
+extern struct cvar_s vid_touchscreen_showkeyboard;
+extern struct cvar_s vid_touchscreen_supportshowkeyboard;
+extern struct cvar_s vid_stick_mouse;
+extern struct cvar_s vid_resizable;
+extern struct cvar_s vid_desktopfullscreen;
+#ifdef WIN32
+extern struct cvar_s vid_ignore_taskbar;
+#endif
+extern struct cvar_s vid_minwidth;
+extern struct cvar_s vid_minheight;
+extern struct cvar_s vid_sRGB;
+extern struct cvar_s vid_sRGB_fallback;
+
+extern struct cvar_s gl_finish;
+
+extern struct cvar_s v_gamma;
+extern struct cvar_s v_contrast;
+extern struct cvar_s v_brightness;
+extern struct cvar_s v_color_enable;
+extern struct cvar_s v_color_black_r;
+extern struct cvar_s v_color_black_g;
+extern struct cvar_s v_color_black_b;
+extern struct cvar_s v_color_grey_r;
+extern struct cvar_s v_color_grey_g;
+extern struct cvar_s v_color_grey_b;
+extern struct cvar_s v_color_white_r;
+extern struct cvar_s v_color_white_g;
+extern struct cvar_s v_color_white_b;