8#define XINPUT_GAMEPAD_DPAD_UP 0x0001
9#define XINPUT_GAMEPAD_DPAD_DOWN 0x0002
10#define XINPUT_GAMEPAD_DPAD_LEFT 0x0004
11#define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
12#define XINPUT_GAMEPAD_START 0x0010
13#define XINPUT_GAMEPAD_BACK 0x0020
14#define XINPUT_GAMEPAD_LEFT_THUMB 0x0040
15#define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
16#define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
17#define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
18#define XINPUT_GAMEPAD_A 0x1000
19#define XINPUT_GAMEPAD_B 0x2000
20#define XINPUT_GAMEPAD_X 0x4000
21#define XINPUT_GAMEPAD_Y 0x8000
22#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849
23#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689
24#define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30
25#define XUSER_INDEX_ANY 0x000000FF
27typedef struct xinput_gamepad_s
39typedef struct xinput_state_s
42 xinput_gamepad_t Gamepad;
46typedef struct xinput_keystroke_s
56DWORD (WINAPI *qXInputGetState)(DWORD
index, xinput_state_t *state);
57DWORD (WINAPI *qXInputGetKeystroke)(DWORD
index, DWORD reserved, xinput_keystroke_t *keystroke);
59qbool vid_xinputinitialized =
false;
60int vid_xinputindex = -1;
82cvar_t joy_xinputavailable = {
CF_CLIENT |
CF_READONLY,
"joy_xinputavailable",
"0",
"indicates which devices are being reported by the Windows XInput API (first controller = 1, second = 2, third = 4, fourth = 8, added together)"};
87cvar_t joy_index = {
CF_CLIENT,
"joy_index",
"0",
"selects which joystick to use if you have multiple (0 uses the first controller, 1 uses the second, ...)"};
141cvar_t vid_stereobuffer = {
CF_CLIENT |
CF_ARCHIVE,
"vid_stereobuffer",
"0",
"enables 'quad-buffered' stereo rendering for stereo shutterglasses, HMD (head mounted display) devices, or polarized stereo LCDs, if supported by your drivers"};
145cvar_t vid_touchscreen_density = {
CF_CLIENT,
"vid_touchscreen_density",
"2.0",
"Standard quantized screen density multiplier (see Android documentation for DisplayMetrics), similar values are given on iPhoneOS"};
149cvar_t vid_vsync = {
CF_CLIENT |
CF_ARCHIVE,
"vid_vsync",
"0",
"sync to vertical blank, prevents 'tearing' (seeing part of one frame and part of another on the screen at the same time) at the cost of latency, >= 1 always syncs and <= -1 is adaptive (stops syncing if the framerate drops, unsupported by some platforms), automatically disabled when doing timedemo benchmarks"};
151cvar_t vid_mouse_clickthrough = {
CF_CLIENT |
CF_ARCHIVE,
"vid_mouse_clickthrough",
"0",
"mouse behavior in windowed mode: 0 = click to focus, 1 = allow interaction even if the window is not focused (click-through behaviour, can be useful when using third-party game overlays)"};
156cvar_t gl_finish = {
CF_CLIENT |
CF_CLIENT,
"gl_finish",
"0",
"make the cpu wait for the graphics processor at the end of each rendered frame (can help with strange input or video lag problems on some machines)"};
157cvar_t vid_sRGB = {
CF_CLIENT |
CF_ARCHIVE,
"vid_sRGB",
"0",
"if hardware is capable, modify rendering to be gamma corrected for the sRGB color standard (computer monitors, TVs), recommended"};
158cvar_t vid_sRGB_fallback = {
CF_CLIENT |
CF_ARCHIVE,
"vid_sRGB_fallback",
"0",
"do an approximate sRGB fallback if not properly supported by hardware (2: also use the fallback if framebuffer is 8bit, 3: always use the fallback even if sRGB is supported)"};
160cvar_t vid_touchscreen = {
CF_CLIENT,
"vid_touchscreen",
"0",
"Use touchscreen-style input (no mouse grab, track mouse motion only while button is down, screen areas for mimicing joystick axes and buttons"};
161cvar_t vid_touchscreen_showkeyboard = {
CF_CLIENT,
"vid_touchscreen_showkeyboard",
"0",
"shows the platform's screen keyboard for text entry, can be set by csqc or menu qc if it wants to receive text input, does nothing if the platform has no screen keyboard"};
165cvar_t vid_desktopfullscreen = {
CF_CLIENT |
CF_ARCHIVE,
"vid_desktopfullscreen",
"1",
"force desktop resolution and refresh rate (disable modesetting), also use some OS-dependent tricks for better fullscreen integration; disabling may reveal OS/driver/SDL bugs with multi-monitor configurations"};
169cvar_t vid_ignore_taskbar = {
CF_CLIENT |
CF_ARCHIVE,
"vid_ignore_taskbar",
"1",
"in windowed mode, prevent the Windows taskbar and window borders from affecting the size and placement of the window. it will be aligned centered and uses the unaltered vid_width/vid_height values"};
172cvar_t v_gamma = {
CF_CLIENT |
CF_ARCHIVE,
"v_gamma",
"1",
"inverse gamma correction value, a brightness effect that does not affect white or black, and tends to make the image grey and dull"};
187cvar_t v_psycho = {
CF_CLIENT,
"v_psycho",
"0",
"easter egg - R.I.P. zinx http://obits.al.com/obituaries/birmingham/obituary.aspx?n=christopher-robert-lais&pid=186080667"};
255void (
GLAPIENTRY *qglCompressedTexSubImage3D)(
GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint zoffset,
GLsizei width,
GLsizei height,
GLsizei depth,
GLenum format,
GLsizei imageSize,
const void *
data);
343void (
GLAPIENTRY *qglTexSubImage3D)(
GLenum target,
GLint level,
GLint xoffset,
GLint yoffset,
GLint zoffset,
GLsizei width,
GLsizei height,
GLsizei depth,
GLenum format,
GLenum type,
const GLvoid *
pixels);
407#define sscanf sscanf_s
410typedef struct glfunction_s
422 {
"core",
"glActiveTexture", (
void **) &qglActiveTexture},
423 {
"core",
"glAttachShader", (
void **) &qglAttachShader},
424 {
"core",
"glBeginQuery", (
void **) &qglBeginQuery},
425 {
"core",
"glBindAttribLocation", (
void **) &qglBindAttribLocation},
426 {
"core",
"glBindBuffer", (
void **) &qglBindBuffer},
427 {
"core",
"glBindBufferBase", (
void **) &qglBindBufferBase},
428 {
"core",
"glBindBufferRange", (
void **) &qglBindBufferRange},
429 {
"core",
"glBindFramebuffer", (
void **) &qglBindFramebuffer},
430 {
"core",
"glBindRenderbuffer", (
void **) &qglBindRenderbuffer},
431 {
"core",
"glBindTexture", (
void **) &qglBindTexture},
432 {
"core",
"glBindVertexArray", (
void **) &qglBindVertexArray},
433 {
"core",
"glBlendEquation", (
void **) &qglBlendEquation},
434 {
"core",
"glBlendFunc", (
void **) &qglBlendFunc},
435 {
"core",
"glBlendFuncSeparate", (
void **) &qglBlendFuncSeparate},
436 {
"core",
"glBlitFramebuffer", (
void **) &qglBlitFramebuffer},
437 {
"core",
"glBufferData", (
void **) &qglBufferData},
438 {
"core",
"glBufferSubData", (
void **) &qglBufferSubData},
439 {
"core",
"glCheckFramebufferStatus", (
void **) &qglCheckFramebufferStatus},
440 {
"core",
"glClear", (
void **) &qglClear},
441 {
"core",
"glClearColor", (
void **) &qglClearColor},
442 {
"core",
"glClearDepth", (
void **) &qglClearDepth},
443 {
"core",
"glClearStencil", (
void **) &qglClearStencil},
444 {
"core",
"glColorMask", (
void **) &qglColorMask},
445 {
"core",
"glCompileShader", (
void **) &qglCompileShader},
446 {
"core",
"glCompressedTexImage2D", (
void **) &qglCompressedTexImage2D},
447 {
"core",
"glCompressedTexImage3D", (
void **) &qglCompressedTexImage3D},
448 {
"core",
"glCompressedTexSubImage2D", (
void **) &qglCompressedTexSubImage2D},
449 {
"core",
"glCompressedTexSubImage3D", (
void **) &qglCompressedTexSubImage3D},
450 {
"core",
"glCopyTexImage2D", (
void **) &qglCopyTexImage2D},
451 {
"core",
"glCopyTexSubImage2D", (
void **) &qglCopyTexSubImage2D},
452 {
"core",
"glCopyTexSubImage3D", (
void **) &qglCopyTexSubImage3D},
453 {
"core",
"glCreateProgram", (
void **) &qglCreateProgram},
454 {
"core",
"glCreateShader", (
void **) &qglCreateShader},
455 {
"core",
"glCullFace", (
void **) &qglCullFace},
456 {
"core",
"glDeleteBuffers", (
void **) &qglDeleteBuffers},
457 {
"core",
"glDeleteFramebuffers", (
void **) &qglDeleteFramebuffers},
458 {
"core",
"glDeleteProgram", (
void **) &qglDeleteProgram},
459 {
"core",
"glDeleteQueries", (
void **) &qglDeleteQueries},
460 {
"core",
"glDeleteRenderbuffers", (
void **) &qglDeleteRenderbuffers},
461 {
"core",
"glDeleteShader", (
void **) &qglDeleteShader},
462 {
"core",
"glDeleteTextures", (
void **) &qglDeleteTextures},
463 {
"core",
"glDeleteVertexArrays", (
void **)&qglDeleteVertexArrays},
464 {
"core",
"glDepthFunc", (
void **) &qglDepthFunc},
465 {
"core",
"glDepthMask", (
void **) &qglDepthMask},
466 {
"core",
"glDepthRange", (
void **) &qglDepthRange},
467 {
"core",
"glDepthRangef", (
void **) &qglDepthRangef},
468 {
"core",
"glDetachShader", (
void **) &qglDetachShader},
469 {
"core",
"glDisable", (
void **) &qglDisable},
470 {
"core",
"glDisableVertexAttribArray", (
void **) &qglDisableVertexAttribArray},
471 {
"core",
"glDrawArrays", (
void **) &qglDrawArrays},
472 {
"core",
"glDrawBuffer", (
void **) &qglDrawBuffer},
473 {
"core",
"glDrawBuffers", (
void **) &qglDrawBuffers},
474 {
"core",
"glDrawElements", (
void **) &qglDrawElements},
475 {
"core",
"glEnable", (
void **) &qglEnable},
476 {
"core",
"glEnableVertexAttribArray", (
void **) &qglEnableVertexAttribArray},
477 {
"core",
"glEndQuery", (
void **) &qglEndQuery},
478 {
"core",
"glFinish", (
void **) &qglFinish},
479 {
"core",
"glFlush", (
void **) &qglFlush},
480 {
"core",
"glFramebufferRenderbuffer", (
void **) &qglFramebufferRenderbuffer},
481 {
"core",
"glFramebufferTexture1D", (
void **) &qglFramebufferTexture1D},
482 {
"core",
"glFramebufferTexture2D", (
void **) &qglFramebufferTexture2D},
483 {
"core",
"glFramebufferTexture3D", (
void **) &qglFramebufferTexture3D},
484 {
"core",
"glFramebufferTextureLayer", (
void **) &qglFramebufferTextureLayer},
485 {
"core",
"glGenBuffers", (
void **) &qglGenBuffers},
486 {
"core",
"glGenFramebuffers", (
void **) &qglGenFramebuffers},
487 {
"core",
"glGenQueries", (
void **) &qglGenQueries},
488 {
"core",
"glGenRenderbuffers", (
void **) &qglGenRenderbuffers},
489 {
"core",
"glGenTextures", (
void **) &qglGenTextures},
490 {
"core",
"glGenVertexArrays", (
void **)&qglGenVertexArrays},
491 {
"core",
"glGenerateMipmap", (
void **) &qglGenerateMipmap},
492 {
"core",
"glGetActiveAttrib", (
void **) &qglGetActiveAttrib},
493 {
"core",
"glGetActiveUniform", (
void **) &qglGetActiveUniform},
494 {
"core",
"glGetActiveUniformBlockName", (
void **) &qglGetActiveUniformBlockName},
495 {
"core",
"glGetActiveUniformBlockiv", (
void **) &qglGetActiveUniformBlockiv},
496 {
"core",
"glGetActiveUniformName", (
void **) &qglGetActiveUniformName},
497 {
"core",
"glGetActiveUniformsiv", (
void **) &qglGetActiveUniformsiv},
498 {
"core",
"glGetAttachedShaders", (
void **) &qglGetAttachedShaders},
499 {
"core",
"glGetAttribLocation", (
void **) &qglGetAttribLocation},
500 {
"core",
"glGetBooleanv", (
void **) &qglGetBooleanv},
501 {
"core",
"glGetCompressedTexImage", (
void **) &qglGetCompressedTexImage},
502 {
"core",
"glGetDoublev", (
void **) &qglGetDoublev},
503 {
"core",
"glGetError", (
void **) &qglGetError},
504 {
"core",
"glGetFloatv", (
void **) &qglGetFloatv},
505 {
"core",
"glGetFramebufferAttachmentParameteriv", (
void **) &qglGetFramebufferAttachmentParameteriv},
506 {
"core",
"glGetIntegeri_v", (
void **) &qglGetIntegeri_v},
507 {
"core",
"glGetIntegerv", (
void **) &qglGetIntegerv},
508 {
"core",
"glGetProgramInfoLog", (
void **) &qglGetProgramInfoLog},
509 {
"core",
"glGetProgramiv", (
void **) &qglGetProgramiv},
510 {
"core",
"glGetQueryObjectiv", (
void **) &qglGetQueryObjectiv},
511 {
"core",
"glGetQueryObjectuiv", (
void **) &qglGetQueryObjectuiv},
512 {
"core",
"glGetQueryiv", (
void **) &qglGetQueryiv},
513 {
"core",
"glGetRenderbufferParameteriv", (
void **) &qglGetRenderbufferParameteriv},
514 {
"core",
"glGetShaderInfoLog", (
void **) &qglGetShaderInfoLog},
515 {
"core",
"glGetShaderSource", (
void **) &qglGetShaderSource},
516 {
"core",
"glGetShaderiv", (
void **) &qglGetShaderiv},
519 {
"core",
"glGetTexImage", (
void **) &qglGetTexImage},
520 {
"core",
"glGetTexLevelParameterfv", (
void **) &qglGetTexLevelParameterfv},
521 {
"core",
"glGetTexLevelParameteriv", (
void **) &qglGetTexLevelParameteriv},
522 {
"core",
"glGetTexParameterfv", (
void **) &qglGetTexParameterfv},
523 {
"core",
"glGetTexParameteriv", (
void **) &qglGetTexParameteriv},
524 {
"core",
"glGetUniformBlockIndex", (
void **) &qglGetUniformBlockIndex},
525 {
"core",
"glGetUniformIndices", (
void **) &qglGetUniformIndices},
526 {
"core",
"glGetUniformLocation", (
void **) &qglGetUniformLocation},
527 {
"core",
"glGetUniformfv", (
void **) &qglGetUniformfv},
528 {
"core",
"glGetUniformiv", (
void **) &qglGetUniformiv},
529 {
"core",
"glGetVertexAttribPointerv", (
void **) &qglGetVertexAttribPointerv},
530 {
"core",
"glGetVertexAttribdv", (
void **) &qglGetVertexAttribdv},
531 {
"core",
"glGetVertexAttribfv", (
void **) &qglGetVertexAttribfv},
532 {
"core",
"glGetVertexAttribiv", (
void **) &qglGetVertexAttribiv},
533 {
"core",
"glHint", (
void **) &qglHint},
534 {
"core",
"glIsBuffer", (
void **) &qglIsBuffer},
535 {
"core",
"glIsEnabled", (
void **) &qglIsEnabled},
536 {
"core",
"glIsFramebuffer", (
void **) &qglIsFramebuffer},
537 {
"core",
"glIsQuery", (
void **) &qglIsQuery},
538 {
"core",
"glIsRenderbuffer", (
void **) &qglIsRenderbuffer},
539 {
"core",
"glLinkProgram", (
void **) &qglLinkProgram},
541 {
"core",
"glPixelStorei", (
void **) &qglPixelStorei},
542 {
"core",
"glPointSize", (
void **) &qglPointSize},
543 {
"core",
"glPolygonMode", (
void **) &qglPolygonMode},
544 {
"core",
"glPolygonOffset", (
void **) &qglPolygonOffset},
545 {
"core",
"glReadBuffer", (
void **) &qglReadBuffer},
546 {
"core",
"glReadPixels", (
void **) &qglReadPixels},
547 {
"core",
"glRenderbufferStorage", (
void **) &qglRenderbufferStorage},
548 {
"core",
"glRenderbufferStorageMultisample", (
void **) &qglRenderbufferStorageMultisample},
549 {
"core",
"glSampleCoverage", (
void **) &qglSampleCoverage},
550 {
"core",
"glScissor", (
void **) &qglScissor},
551 {
"core",
"glShaderSource", (
void **) &qglShaderSource},
552 {
"core",
"glStencilFunc", (
void **) &qglStencilFunc},
553 {
"core",
"glStencilMask", (
void **) &qglStencilMask},
554 {
"core",
"glStencilOp", (
void **) &qglStencilOp},
555 {
"core",
"glTexImage2D", (
void **) &qglTexImage2D},
556 {
"core",
"glTexImage3D", (
void **) &qglTexImage3D},
557 {
"core",
"glTexParameterf", (
void **) &qglTexParameterf},
558 {
"core",
"glTexParameterfv", (
void **) &qglTexParameterfv},
559 {
"core",
"glTexParameteri", (
void **) &qglTexParameteri},
560 {
"core",
"glTexSubImage2D", (
void **) &qglTexSubImage2D},
561 {
"core",
"glTexSubImage3D", (
void **) &qglTexSubImage3D},
562 {
"core",
"glUniform1f", (
void **) &qglUniform1f},
563 {
"core",
"glUniform1fv", (
void **) &qglUniform1fv},
564 {
"core",
"glUniform1i", (
void **) &qglUniform1i},
565 {
"core",
"glUniform1iv", (
void **) &qglUniform1iv},
566 {
"core",
"glUniform2f", (
void **) &qglUniform2f},
567 {
"core",
"glUniform2fv", (
void **) &qglUniform2fv},
568 {
"core",
"glUniform2i", (
void **) &qglUniform2i},
569 {
"core",
"glUniform2iv", (
void **) &qglUniform2iv},
570 {
"core",
"glUniform3f", (
void **) &qglUniform3f},
571 {
"core",
"glUniform3fv", (
void **) &qglUniform3fv},
572 {
"core",
"glUniform3i", (
void **) &qglUniform3i},
573 {
"core",
"glUniform3iv", (
void **) &qglUniform3iv},
574 {
"core",
"glUniform4f", (
void **) &qglUniform4f},
575 {
"core",
"glUniform4fv", (
void **) &qglUniform4fv},
576 {
"core",
"glUniform4i", (
void **) &qglUniform4i},
577 {
"core",
"glUniform4iv", (
void **) &qglUniform4iv},
578 {
"core",
"glUniformBlockBinding", (
void **) &qglUniformBlockBinding},
579 {
"core",
"glUniformMatrix2fv", (
void **) &qglUniformMatrix2fv},
580 {
"core",
"glUniformMatrix3fv", (
void **) &qglUniformMatrix3fv},
581 {
"core",
"glUniformMatrix4fv", (
void **) &qglUniformMatrix4fv},
582 {
"core",
"glUnmapBuffer", (
void **) &qglUnmapBuffer},
583 {
"core",
"glUseProgram", (
void **) &qglUseProgram},
584 {
"core",
"glValidateProgram", (
void **) &qglValidateProgram},
585 {
"core",
"glVertexAttrib1d", (
void **) &qglVertexAttrib1d},
586 {
"core",
"glVertexAttrib1dv", (
void **) &qglVertexAttrib1dv},
587 {
"core",
"glVertexAttrib1f", (
void **) &qglVertexAttrib1f},
588 {
"core",
"glVertexAttrib1fv", (
void **) &qglVertexAttrib1fv},
589 {
"core",
"glVertexAttrib1s", (
void **) &qglVertexAttrib1s},
590 {
"core",
"glVertexAttrib1sv", (
void **) &qglVertexAttrib1sv},
591 {
"core",
"glVertexAttrib2d", (
void **) &qglVertexAttrib2d},
592 {
"core",
"glVertexAttrib2dv", (
void **) &qglVertexAttrib2dv},
593 {
"core",
"glVertexAttrib2f", (
void **) &qglVertexAttrib2f},
594 {
"core",
"glVertexAttrib2fv", (
void **) &qglVertexAttrib2fv},
595 {
"core",
"glVertexAttrib2s", (
void **) &qglVertexAttrib2s},
596 {
"core",
"glVertexAttrib2sv", (
void **) &qglVertexAttrib2sv},
597 {
"core",
"glVertexAttrib3d", (
void **) &qglVertexAttrib3d},
598 {
"core",
"glVertexAttrib3dv", (
void **) &qglVertexAttrib3dv},
599 {
"core",
"glVertexAttrib3f", (
void **) &qglVertexAttrib3f},
600 {
"core",
"glVertexAttrib3fv", (
void **) &qglVertexAttrib3fv},
601 {
"core",
"glVertexAttrib3s", (
void **) &qglVertexAttrib3s},
602 {
"core",
"glVertexAttrib3sv", (
void **) &qglVertexAttrib3sv},
603 {
"core",
"glVertexAttrib4Nbv", (
void **) &qglVertexAttrib4Nbv},
604 {
"core",
"glVertexAttrib4Niv", (
void **) &qglVertexAttrib4Niv},
605 {
"core",
"glVertexAttrib4Nsv", (
void **) &qglVertexAttrib4Nsv},
606 {
"core",
"glVertexAttrib4Nub", (
void **) &qglVertexAttrib4Nub},
607 {
"core",
"glVertexAttrib4Nubv", (
void **) &qglVertexAttrib4Nubv},
608 {
"core",
"glVertexAttrib4Nuiv", (
void **) &qglVertexAttrib4Nuiv},
609 {
"core",
"glVertexAttrib4Nusv", (
void **) &qglVertexAttrib4Nusv},
610 {
"core",
"glVertexAttrib4bv", (
void **) &qglVertexAttrib4bv},
611 {
"core",
"glVertexAttrib4d", (
void **) &qglVertexAttrib4d},
612 {
"core",
"glVertexAttrib4dv", (
void **) &qglVertexAttrib4dv},
613 {
"core",
"glVertexAttrib4f", (
void **) &qglVertexAttrib4f},
614 {
"core",
"glVertexAttrib4fv", (
void **) &qglVertexAttrib4fv},
615 {
"core",
"glVertexAttrib4iv", (
void **) &qglVertexAttrib4iv},
616 {
"core",
"glVertexAttrib4s", (
void **) &qglVertexAttrib4s},
617 {
"core",
"glVertexAttrib4sv", (
void **) &qglVertexAttrib4sv},
618 {
"core",
"glVertexAttrib4ubv", (
void **) &qglVertexAttrib4ubv},
619 {
"core",
"glVertexAttrib4uiv", (
void **) &qglVertexAttrib4uiv},
620 {
"core",
"glVertexAttrib4usv", (
void **) &qglVertexAttrib4usv},
621 {
"core",
"glVertexAttribPointer", (
void **) &qglVertexAttribPointer},
622 {
"core",
"glViewport", (
void **) &qglViewport},
623 {
"glBindFragDataLocation",
"glBindFragDataLocation", (
void **) &qglBindFragDataLocation},
624 {
"GL_ARB_debug_output",
"glDebugMessageControlARB", (
void **)&qglDebugMessageControlARB},
625 {
"GL_ARB_debug_output",
"glDebugMessageInsertARB", (
void **)&qglDebugMessageInsertARB},
626 {
"GL_ARB_debug_output",
"glDebugMessageCallbackARB", (
void **)&qglDebugMessageCallbackARB},
627 {
"GL_ARB_debug_output",
"glGetDebugMessageLogARB", (
void **)&qglGetDebugMessageLogARB},
628 {
"GL_ARB_debug_output",
"glGetPointerv", (
void **)&qglGetPointerv},
688 qbool missingrequiredfuncs =
false;
689 static char missingfuncs[16384];
700 Con_DPrintf(
"GL context is missing required function \"%s\"!\n", func->
name);
701 missingrequiredfuncs =
true;
702 dp_strlcat(missingfuncs,
" ",
sizeof(missingfuncs));
707 if (missingrequiredfuncs)
708 Sys_Error(
"OpenGL driver/hardware lacks required features:\n%s", missingfuncs);
716 GLint numextensions = 0;
733 Sys_Error(
"OpenGL driver/hardware supports version %i.%i but 3.2 is the minimum\n", majorv, minorv);
737 for (j = 0; j < numextensions; j++)
747 Con_DPrint(
"Checking OpenGL extensions...\n");
793#ifdef GL_MAX_DRAW_BUFFERS
799#ifdef GL_MAX_CUBE_MAP_TEXTURE_SIZE
809#ifdef GL_MAX_3D_TEXTURE_SIZE
822 Con_Print(
"Using GLES2 rendering path\n");
827 Con_Print(
"Using GL32 rendering path\n");
847#ifdef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
859 value *= deadzone > 0 ? (1.0f / (1.0f - deadzone)) : 1.0f;
861 return value * fsensitivity;
878 for (j = 32;j < 36;j++)
888 xinput_state_t xinputstate;
890 memset(joystate, 0,
sizeof(*joystate));
892 if (vid_xinputindex >= 0 && qXInputGetState && qXInputGetState(vid_xinputindex, &xinputstate) == S_OK)
894 joystate->
is360 =
true;
895 joystate->
button[ 0] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) != 0;
896 joystate->
button[ 1] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) != 0;
897 joystate->
button[ 2] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) != 0;
898 joystate->
button[ 3] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) != 0;
899 joystate->
button[ 4] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_START) != 0;
900 joystate->
button[ 5] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_BACK) != 0;
901 joystate->
button[ 6] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_THUMB) != 0;
902 joystate->
button[ 7] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_THUMB) != 0;
903 joystate->
button[ 8] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER) != 0;
904 joystate->
button[ 9] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER) != 0;
905 joystate->
button[10] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_A) != 0;
906 joystate->
button[11] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_B) != 0;
907 joystate->
button[12] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_X) != 0;
908 joystate->
button[13] = (xinputstate.Gamepad.wButtons & XINPUT_GAMEPAD_Y) != 0;
909 joystate->
button[14] = xinputstate.Gamepad.bLeftTrigger >= XINPUT_GAMEPAD_TRIGGER_THRESHOLD;
910 joystate->
button[15] = xinputstate.Gamepad.bRightTrigger >= XINPUT_GAMEPAD_TRIGGER_THRESHOLD;
911 joystate->
button[16] = xinputstate.Gamepad.sThumbLY < -16384;
912 joystate->
button[17] = xinputstate.Gamepad.sThumbLY > 16384;
913 joystate->
button[18] = xinputstate.Gamepad.sThumbLX < -16384;
914 joystate->
button[19] = xinputstate.Gamepad.sThumbLX > 16384;
915 joystate->
button[20] = xinputstate.Gamepad.sThumbRY < -16384;
916 joystate->
button[21] = xinputstate.Gamepad.sThumbRY > 16384;
917 joystate->
button[22] = xinputstate.Gamepad.sThumbRX < -16384;
918 joystate->
button[23] = xinputstate.Gamepad.sThumbRX > 16384;
919 joystate->
axis[ 4] = xinputstate.Gamepad.bLeftTrigger * (1.0f / 255.0f);
920 joystate->
axis[ 5] = xinputstate.Gamepad.bRightTrigger * (1.0f / 255.0f);
921 joystate->
axis[ 0] = xinputstate.Gamepad.sThumbLX * (1.0f / 32767.0f);
922 joystate->
axis[ 1] = xinputstate.Gamepad.sThumbLY * (1.0f / 32767.0f);
923 joystate->
axis[ 2] = xinputstate.Gamepad.sThumbRX * (1.0f / 32767.0f);
924 joystate->
axis[ 3] = xinputstate.Gamepad.sThumbRY * (1.0f / 32767.0f);
937#if MAXJOYBUTTON != 36
938#error this code must be updated if MAXJOYBUTTON changes!
940 joystate->
button[32] =
f > 0.0f;
941 joystate->
button[33] =
f < 0.0f;
942 joystate->
button[34] =
r > 0.0f;
943 joystate->
button[35] =
r < 0.0f;
974#if MAXJOYBUTTON != 36
975#error this code must be updated if MAXJOYBUTTON changes!
979 {
K_JOY1,
K_ENTER}, {
K_JOY2,
K_ESCAPE}, {
K_JOY3, 0}, {
K_JOY4, 0}, {
K_JOY5, 0}, {
K_JOY6, 0}, {
K_JOY7, 0}, {
K_JOY8, 0}, {
K_JOY9, 0}, {
K_JOY10, 0}, {
K_JOY11, 0}, {
K_JOY12, 0}, {
K_JOY13, 0}, {
K_JOY14, 0}, {
K_JOY15, 0}, {
K_JOY16, 0},
980 {
K_AUX1, 0}, {
K_AUX2, 0}, {
K_AUX3, 0}, {
K_AUX4, 0}, {
K_AUX5, 0}, {
K_AUX6, 0}, {
K_AUX7, 0}, {
K_AUX8, 0}, {
K_AUX9, 0}, {
K_AUX10, 0}, {
K_AUX11, 0}, {
K_AUX12, 0}, {
K_AUX13, 0}, {
K_AUX14, 0}, {
K_AUX15, 0}, {
K_AUX16, 0},
1017 if (joystate->
is360)
1022 xinput_keystroke_t keystroke;
1023 while (qXInputGetKeystroke && qXInputGetKeystroke(XUSER_INDEX_ANY, 0, &keystroke) == S_OK)
1024 Con_Printf(
"XInput KeyStroke: VirtualKey %i, Unicode %i, Flags %x, UserIndex %i, HidCode %i\n", keystroke.VirtualKey, keystroke.Unicode, keystroke.Flags, keystroke.UserIndex, keystroke.HidCode);
1061 int xinputcount = 0;
1062 int xinputindex = -1;
1063 int xinputavailable = 0;
1064 xinput_state_t state;
1066 for (
i = 0;
i < 4;
i++)
1068 if (qXInputGetState && qXInputGetState(
i, &state) == S_OK)
1070 xinputavailable |= 1<<
i;
1071 if (
index == xinputcount)
1076 if (joy_xinputavailable.
integer != xinputavailable)
1078 if (vid_xinputindex != xinputindex)
1080 vid_xinputindex = xinputindex;
1081 if (xinputindex >= 0)
1082 Con_Printf(
"Joystick %i opened (XInput Device %i)\n",
index, xinputindex);
1105 for (
i = 0;
i < 3;
i++)
1110 for (
i = 0;
i < 3;
i++)
1135 for(
i = 0;
i < 3*rampsize; ++
i)
1148 static float n[3], nd[3], nt[3];
1149 static int init =
true;
1150 unsigned short *ramp;
1155 for (
x = 0;
x < 3;
x++)
1158 nd[
x] = (rand()&1)?-0.25:0.25;
1163 for (
x = 0;
x < 3;
x++)
1175 for (
x = 0, ramp = ramps;
x < 3;
x++)
1176 for (
y = 0, t =
n[
x] - 0.75f;
y < rampsize;
y++, t += 0.75f * (2.0f / rampsize))
1177 *ramp++ = (
unsigned short)(
cos(t*(
M_PI*2.0)) * 32767.0f + 32767.0f);
1185 qbool gamma_changed =
false;
1187#define BOUNDCVAR(cvar, m1, m2) c = &(cvar);f = bound(m1, c->value, m2);if (c->value != f) Cvar_SetValueQuick(c, f);
1233#define GAMMACHECK(cache, value) if (cache != (value)) gamma_changed = true;cache = (value)
1235 gamma_changed =
true;
1259 {
"XInputGetState", (
void **) &qXInputGetState},
1260 {
"XInputGetKeystroke", (
void **) &qXInputGetKeystroke},
1263static const char* xinputdllnames [] =
1444 Con_Printf(
"Video Mode: %s%s %dx%d %dbpp%s%s on display %i\n",
1478 Con_Printf(
"VID_Restart: changing from %s%s %dx%d %dbpp%s%s on display %i, to %s%s %dx%d %dbpp%s%s on display %i.\n",
1480 oldmode.
fullscreen ?
"fullscreen" :
"window",
1499 Sys_Error(
"Unable to restore to last working video mode");
1601 if(
a->width >
b->width)
1603 if(
a->width <
b->width)
1605 if(
a->height >
b->height)
1607 if(
a->height <
b->height)
1609 if(
a->refreshrate >
b->refreshrate)
1611 if(
a->refreshrate <
b->refreshrate)
1617 if(
a->pixelheight_num *
b->pixelheight_denom >
a->pixelheight_denom *
b->pixelheight_num)
1619 if(
a->pixelheight_num *
b->pixelheight_denom <
a->pixelheight_denom *
b->pixelheight_num)
1648 if(
modes[
i].pixelheight_num *
modes[
i-1].pixelheight_denom !=
modes[
i].pixelheight_denom *
modes[
i-1].pixelheight_num)
void SCR_DeferLoadingPlaque(qbool startup)
void Cmd_AddCommand(unsigned flags, const char *cmd_name, xcommand_t function, const char *description)
called by the init functions of other parts of the program to register commands and functions to call...
#define CF_READONLY
cvar cannot be changed from the console or the command buffer, and is considered CF_PERSISTENT
#define CF_CLIENT
cvar/command that only the client can change/execute
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
char * va(char *buf, size_t buflen, const char *format,...)
int dpsnprintf(char *buffer, size_t buffersize, const char *format,...)
Returns the number of printed characters, excluding the final '\0' or returns -1 if the buffer isn't ...
#define dp_strlcat(dst, src, dsize)
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
void Con_DPrint(const char *msg)
A Con_Print that only shows up if the "developer" cvar is set.
void Cvar_SetValueQuick(cvar_t *var, float value)
void Cvar_SetQuick(cvar_t *var, const char *value)
void Cvar_RegisterVariable(cvar_t *variable)
registers a cvar that already has the name, string, and optionally the archive elements set.
static int(ZEXPORT *qz_inflate)(z_stream *strm
cvar_t gl_texturecompression_color
#define GL_MAX_TEXTURE_SIZE
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE
#define GL_MAX_DRAW_BUFFERS
#define GL_MAX_3D_TEXTURE_SIZE
void(GLAPIENTRY * GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const GLvoid *userParam)
#define GL_SHADING_LANGUAGE_VERSION
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
#define GL_NUM_EXTENSIONS
#define Image_sRGBFloatFromLinearFloat(c)
void Key_Event(int key, int ascii, qbool down)
void Key_ReleaseAll(void)
@ K_X360_LEFT_THUMB_RIGHT
@ K_X360_RIGHT_THUMB_DOWN
@ K_X360_RIGHT_THUMB_RIGHT
@ K_X360_RIGHT_THUMB_LEFT
#define invpow(base, number)
#define bound(min, num, max)
#define lhrandom(MIN, MAX)
LadyHavoc: this function never returns exactly MIN or exactly MAX, because of a QuakeC bug in id1 whe...
void BuildGammaTable16(float prescale, float gamma, float scale, float base, float contrastboost, unsigned short *out, int rampsize)
#define MAX_INPUTLINE
maximum size of console commandline, QuakeC strings, and many other text processing buffers
void R_Modules_Shutdown(void)
void R_Modules_Start(void)
command interpreter state - the tokenizing and execution of commands, as well as pointers to which cv...
double realtime
the accumulated mainloop time since application started (with filtering), without any slowmo or clamp...
unsigned char button[MAXJOYBUTTON]
0 or 1
qbool is360
indicates this joystick is a Microsoft Xbox 360 Controller For Windows
float axis[MAXJOYAXIS]
-1 to +1
qbool desktopfullscreen
whether the display hardware mode can be changed
qbool ext_texture_filter_anisotropic
qbool amd_texture_texture4
qbool ext_texture_compression_s3tc
int glversion
this is at least 32
int glshaderversion
this is at least 150 (GL 3.2)
unsigned int maxtexturesize_2d
qbool sRGB3D
whether 3D rendering is sRGB corrected (based on sRGBcapable3D)
int forcetextype
always use GL_BGRA for D3D, always use GL_RGBA for GLES, etc
unsigned int maxtexturesize_3d
unsigned int maxtexturesize_cubemap
qbool sRGB2D
whether 2D rendering is sRGB corrected (based on sRGBcapable2D)
qbool sRGBcapable3D
whether 3D rendering can be sRGB corrected (renderpath)
unsigned int max_anisotropy
viddef_mode_t mode
currently active video mode
qbool allowalphatocoverage
indicates the GL_AlphaToCoverage function works on this renderpath and framebuffer
unsigned int maxdrawbuffers
qbool sRGBcapable2D
whether 2D rendering can be sRGB corrected (renderpath)
void Sys_Error(const char *error,...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN
Causes the entire program to exit ASAP.
qbool Sys_LoadDependency(const char **dllnames, dllhandle_t *handle, const dllfunction_t *fcts)
int Sys_CheckParm(const char *parm)
qbool GL_ExtensionSupported(const char *name)
qbool VID_InitMode(const viddef_mode_t *mode)
allocates and opens an appropriate OpenGL context (and its window)
void * GL_GetProcAddress(const char *name)
void VID_Shutdown(void)
Called at shutdown.
void VID_BuildJoyState(vid_joystate_t *joystate)
GLsizei const GLfloat * value
GLuint GLuint GLintptr GLsizeiptr size
const char * uniformBlockName
const char * gl_vendor
brand of graphics chip
static struct vidfallback_s vidfallbacks[]
GLenum GLenum GLuint texture
GLsizei GLsizei GLchar * source
cvar_t vid_minimize_on_focus_loss
cvar_t joy_sensitivityside
void VID_Shared_Init(void)
static int VID_SortModes_Compare(const void *a_, const void *b_)
cvar_t joy_x360_sensitivityup
cvar_t joy_x360_sensitivitypitch
GLenum GLsizei GLsizei height
GLint GLenum GLsizei GLsizei GLint border
#define BOUNDCVAR(cvar, m1, m2)
GLfloat GLfloat GLfloat v2
GLint GLint GLint GLint GLint GLint GLint dstY1
GLint GLint GLint yoffset
GLubyte GLubyte GLubyte GLubyte w
cvar_t joy_deadzoneforward
static int gamma_forcenextframe
void VID_Shared_BuildJoyState_Finish(vid_joystate_t *joystate)
GLenum GLenum GLuint GLint GLint layer
static float cachewhite[3]
GLvoid *GLAPIENTRY * qglMapBuffer(GLenum target, GLenum access)
static int cachecolorenable
GLenum GLenum sfactorAlpha
cvar_t joy_sensitivityforward
GLint GLenum GLsizei GLsizei GLint GLsizei imageSize
GLint GLenum GLboolean normalized
#define GAMMACHECK(cache, value)
static float cachecontrast
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
cvar_t gl_info_extensions
qbool vid_gammatables_trivial
this is set to true if all color control values are at default setting, and it therefore would make n...
void VID_ApplyGammaToColor(const float *rgb, float *out)
applies current gamma settings to a color (0-1 range)
GLsizeiptr const GLvoid GLenum usage
GLenum GLenum GLint * params
static int joybuttonkey360[][2]
cvar_t vid_touchscreen_ydpi
cvar_t joy_sensitivitypitch
static void Force_CenterView_f(cmd_state_t *cmd)
cvar_t joy_x360_deadzoneup
unsigned int vid_gammatables_serial
so other subsystems can poll if gamma parameters have changed; this starts with 0 and gets increased ...
GLuint GLuint uniformBlockBinding
GLsizei GLenum GLenum GLuint GLenum GLsizei GLchar * messageLog
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
GLsizeiptr const GLvoid * data
GLenum GLenum GLsizei count
qbool VID_JoyBlockEmulatedKeys(int keycode)
const GLuint * framebuffers
cvar_t joy_sensitivityroll
GLint GLint GLint GLsizei GLsizei GLenum format
GLint GLenum GLint GLint y
GLubyte GLubyte GLubyte z
cvar_t joy_x360_sensitivityroll
void GL_InitFunctions(void)
GLsizei const char ** uniformNames
cvar_t joy_x360_deadzoneforward
GLint GLenum GLsizei GLsizei GLsizei depth
cvar_t vid_info_displaycount
const GLuint * renderbuffers
GLint GLenum GLboolean GLsizei stride
GLenum GLuint GLenum GLsizei length
GLsizei GLenum GLenum GLuint * ids
vid_joystate_t vid_joystate
cvar_t vid_touchscreen_xdpi
cvar_t joy_x360_sensitivityforward
static float cachegrey[3]
cvar_t joy_x360_sensitivityyaw
GLuint GLsizei GLsizei char * uniformName
cvar_t vid_touchscreen_density
cvar_t joy_x360_axispitch
cvar_t joy_x360_axisforward
const GLubyte *GLAPIENTRY * qglGetStringi(GLenum name, GLuint index)
cvar_t vid_touchscreen_showkeyboard
GLint GLenum GLenum GLvoid * pixels
const char * gl_version
begins with 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.3.1, or 1.4.0
cvar_t joy_x360_deadzoneside
cvar_t vid_mouse_clickthrough
GLsizei GLenum const GLvoid * indices
static float cacheblack[3]
GLenum GLenum renderbuffertarget
const char * gl_renderer
graphics chip model and other information
cvar_t joy_x360_deadzonepitch
void VID_ApplyJoyState(vid_joystate_t *joystate)
GLuint GLuint GLintptr offset
GLint GLint GLint GLint GLint dstY0
viddef_t vid
global video state
const GLubyte *GLAPIENTRY * qglGetString(GLenum name)
qbool GL_CheckExtension(const char *name, const char *disableparm, int silent)
static glfunction_t openglfuncs[]
static float cachecontrastboost
GLint GLint GLint GLint dstX0
GLenum GLenum GLuint GLint level
void VID_UpdateGamma(void)
updates cachegamma variables and bumps vid_gammatables_serial if anything changed (ONLY to be called ...
void VID_Shared_BuildJoyState_Begin(vid_joystate_t *joystate)
void VID_ClearExtensions(void)
GLfloat GLfloat GLfloat GLfloat v3
cvar_t vid_desktopfullscreen
GLenum GLenum GLenum dfactorAlpha
GLsizei const GLuint * uniformIndices
GLint GLint internalFormat
GLenum GLuint GLenum GLsizei const GLchar * buf
void VID_BuildGammaTables(unsigned short *ramps, int rampsize)
builds the current gamma tables into an array (needs 3*rampsize items)
static float cachebrightness
size_t VID_SortModes(vid_mode_t *modes, size_t count, qbool usebpp, qbool userefreshrate, qbool useaspect)
cvar_t joy_x360_sensitivityside
cvar_t vid_touchscreen_supportshowkeyboard
cvar_t joy_x360_deadzoneyaw
GLint GLint GLint GLint GLint GLint dstX1
GLsizei GLenum GLenum * types
GLsizei GLenum GLenum GLuint GLenum * severities
GLint GLint GLint GLint zoffset
GLsizei GLboolean transpose
qbool vid_commandlinecheck
GLclampf GLclampf GLclampf alpha
static void VID_KeyEventForButton(qbool oldbutton, qbool newbutton, int key, double *timer)
GLsizei const GLchar ** string
void VID_Restart_f(cmd_state_t *cmd)
double vid_joybuttontimer[MAXJOYBUTTON]
cvar_t joy_sensitivityyaw
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLsizei GLsizei GLchar * infoLog
static int VID_Mode(viddef_mode_t *mode)
NULL mode means read it from the cvars.
cvar_t joy_x360_deadzoneroll
int VID_Shared_SetJoystick(int index)
static int joybuttonkey[MAXJOYBUTTON][2]
cvar_t joy_axiskeyevents_deadzone
float VID_JoyState_GetAxis(const vid_joystate_t *joystate, int axis, float fsensitivity, float deadzone)