vkQuake2 doxygen  1.0 dev
vid_dll.c
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 Copyright (C) 2018-2019 Krzysztof Kondrak
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 
14 See the GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 
20 */
21 // Main windowed and fullscreen graphics interface module. This module
22 // is used for both the software and OpenGL/Vulkan rendering versions of the
23 // Quake refresh engine.
24 #include <assert.h>
25 #include <float.h>
26 
27 #include "..\client\client.h"
28 #include "winquake.h"
29 //#include "zmouse.h"
30 
31 // Structure containing functions exported from refresh DLL
33 
35 
36 #ifndef WM_MOUSEWHEEL
37 #define WM_MOUSEWHEEL (WM_MOUSELAST+1) // message that will be supported by the OS
38 #endif
39 
41 
42 // Console variables that we need to access from this module
44 cvar_t *vid_ref; // Name of Refresh DLL loaded
45 cvar_t *vid_xpos; // X coordinate of window position
46 cvar_t *vid_ypos; // Y coordinate of window position
52 
53 // Global variables used internally by this module
54 viddef_t viddef; // global video state; used by other modules
55 HINSTANCE reflib_library; // Handle to refresh DLL
57 
58 HWND cl_hwnd; // Main window handle for life of program
59 
60 #define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) )
61 
62 LONG WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
63 
65 
66 extern unsigned sys_msg_time;
67 
68 /*
69 ** WIN32 helper functions
70 */
71 extern qboolean s_win95;
72 
73 static void WIN_DisableAltTab( void )
74 {
75  if ( s_alttab_disabled )
76  return;
77 
78  if ( s_win95 )
79  {
80  BOOL old;
81 
82  SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, &old, 0 );
83  }
84  else
85  {
86  RegisterHotKey( 0, 0, MOD_ALT, VK_TAB );
87  RegisterHotKey( 0, 1, MOD_ALT, VK_RETURN );
88  }
89  s_alttab_disabled = true;
90 }
91 
92 static void WIN_EnableAltTab( void )
93 {
94  if ( s_alttab_disabled )
95  {
96  if ( s_win95 )
97  {
98  BOOL old;
99 
100  SystemParametersInfo( SPI_SCREENSAVERRUNNING, 0, &old, 0 );
101  }
102  else
103  {
104  UnregisterHotKey( 0, 0 );
105  UnregisterHotKey( 0, 1 );
106  }
107 
108  s_alttab_disabled = false;
109  }
110 }
111 
112 /*
113 ==========================================================================
114 
115 DLL GLUE
116 
117 ==========================================================================
118 */
119 
120 #define MAXPRINTMSG 8192
121 void VID_Printf (int print_level, char *fmt, ...)
122 {
123  va_list argptr;
124  char msg[MAXPRINTMSG];
125  static qboolean inupdate;
126 
127  va_start (argptr,fmt);
128  vsnprintf (msg,MAXPRINTMSG,fmt,argptr);
129  va_end (argptr);
130 
131  if (print_level == PRINT_ALL)
132  {
133  Com_Printf ("%s", msg);
134  }
135  else if ( print_level == PRINT_DEVELOPER )
136  {
137  Com_DPrintf ("%s", msg);
138  }
139  else if ( print_level == PRINT_ALERT )
140  {
141  MessageBox( 0, msg, "PRINT_ALERT", MB_ICONWARNING );
142  OutputDebugString( msg );
143  }
144 }
145 
146 void VID_Error (int err_level, char *fmt, ...)
147 {
148  va_list argptr;
149  char msg[MAXPRINTMSG];
150  static qboolean inupdate;
151 
152  va_start (argptr,fmt);
153  vsnprintf (msg,MAXPRINTMSG,fmt,argptr);
154  va_end (argptr);
155 
156  Com_Error (err_level,"%s", msg);
157 }
158 
159 //==========================================================================
160 
161 byte scantokey[128] =
162  {
163 // 0 1 2 3 4 5 6 7
164 // 8 9 A B C D E F
165  0 , 27, '1', '2', '3', '4', '5', '6',
166  '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0
167  'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
168  'o', 'p', '[', ']', 13 , K_CTRL,'a', 's', // 1
169  'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
170  '\'' , '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2
171  'b', 'n', 'm', ',', '.', '/', K_SHIFT,'*',
172  K_ALT,' ', 0 , K_F1, K_F2, K_F3, K_F4, K_F5, // 3
173  K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, 0 , K_HOME,
176  K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5
177  0 , 0 , 0 , 0 , 0 , 0 , 0 , 0,
178  0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6
179  0 , 0 , 0 , 0 , 0 , 0 , 0 , 0,
180  0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7
181 };
182 
183 /*
184 =======
185 MapKey
186 
187 Map from windows to quake keynums
188 =======
189 */
190 int MapKey (int key)
191 {
192  int result;
193  int modified = ( key >> 16 ) & 255;
194  qboolean is_extended = false;
195 
196  if ( modified > 127)
197  return 0;
198 
199  if ( key & ( 1 << 24 ) )
200  is_extended = true;
201 
202  result = scantokey[modified];
203 
204  if ( !is_extended )
205  {
206  switch ( result )
207  {
208  case K_HOME:
209  return K_KP_HOME;
210  case K_UPARROW:
211  return K_KP_UPARROW;
212  case K_PGUP:
213  return K_KP_PGUP;
214  case K_LEFTARROW:
215  return K_KP_LEFTARROW;
216  case K_RIGHTARROW:
217  return K_KP_RIGHTARROW;
218  case K_END:
219  return K_KP_END;
220  case K_DOWNARROW:
221  return K_KP_DOWNARROW;
222  case K_PGDN:
223  return K_KP_PGDN;
224  case K_INS:
225  return K_KP_INS;
226  case K_DEL:
227  return K_KP_DEL;
228  default:
229  return result;
230  }
231  }
232  else
233  {
234  switch ( result )
235  {
236  case 0x0D:
237  return K_KP_ENTER;
238  case 0x2F:
239  return K_KP_SLASH;
240  case 0xAF:
241  return K_KP_PLUS;
242  }
243  return result;
244  }
245 }
246 
247 void AppActivate(BOOL fActive, BOOL minimize)
248 {
249  Minimized = minimize;
250 
251  Key_ClearStates();
252 
253  // we don't want to act like we're active if we're minimized
254  if (fActive && !Minimized)
255  ActiveApp = true;
256  else
257  ActiveApp = false;
258 
259  // minimize/restore mouse-capture on demand
260  if (!ActiveApp)
261  {
262  IN_Activate (false);
263  CDAudio_Activate (false);
264  S_Activate (false);
265 
266  if ( win_noalttab->value )
267  {
269  }
270  }
271  else
272  {
273  IN_Activate (true);
274  CDAudio_Activate (true);
275  S_Activate (true);
276  if ( win_noalttab->value )
277  {
279  }
280  }
281 }
282 
283 /*
284 ====================
285 MainWndProc
286 
287 main window procedure
288 ====================
289 */
290 LONG WINAPI MainWndProc (
291  HWND hWnd,
292  UINT uMsg,
293  WPARAM wParam,
294  LPARAM lParam)
295 {
296  LONG lRet = 0;
297 
298  if ( uMsg == MSH_MOUSEWHEEL )
299  {
300  if ( ( ( int ) wParam ) > 0 )
301  {
303  Key_Event( K_MWHEELUP, false, sys_msg_time );
304  }
305  else
306  {
309  }
310  return DefWindowProc (hWnd, uMsg, wParam, lParam);
311  }
312 
313  switch (uMsg)
314  {
315  case WM_MOUSEWHEEL:
316  /*
317  ** this chunk of code theoretically only works under NT4 and Win98
318  ** since this message doesn't exist under Win95
319  */
320  if ( ( short ) HIWORD( wParam ) > 0 )
321  {
323  Key_Event( K_MWHEELUP, false, sys_msg_time );
324  }
325  else
326  {
329  }
330  break;
331 
332  case WM_HOTKEY:
333  return 0;
334 
335  case WM_CREATE:
336  cl_hwnd = hWnd;
337 
338  MSH_MOUSEWHEEL = RegisterWindowMessage("MSWHEEL_ROLLMSG");
339  return DefWindowProc (hWnd, uMsg, wParam, lParam);
340 
341  case WM_PAINT:
342  SCR_DirtyScreen (); // force entire screen to update next frame
343  return DefWindowProc (hWnd, uMsg, wParam, lParam);
344 
345  case WM_DESTROY:
346  // let sound and input know about this?
347  cl_hwnd = NULL;
348  return DefWindowProc (hWnd, uMsg, wParam, lParam);
349 
350  case WM_ACTIVATE:
351  {
352  int fActive, fMinimized;
353 
354  // KJB: Watch this for problems in fullscreen modes with Alt-tabbing.
355  fActive = LOWORD(wParam);
356  fMinimized = (BOOL) HIWORD(wParam);
357 
358  AppActivate( fActive != WA_INACTIVE, fMinimized);
359 
360  if ( reflib_active )
361  re.AppActivate( !( fActive == WA_INACTIVE ) );
362  }
363  return DefWindowProc (hWnd, uMsg, wParam, lParam);
364 
365  case WM_MOVE:
366  {
367  int xPos, yPos;
368  RECT r;
369  int style;
370 
371  if (!vid_fullscreen->value)
372  {
373  xPos = (short) LOWORD(lParam); // horizontal position
374  yPos = (short) HIWORD(lParam); // vertical position
375 
376  r.left = 0;
377  r.top = 0;
378  r.right = 1;
379  r.bottom = 1;
380 
381  style = GetWindowLong( hWnd, GWL_STYLE );
382  AdjustWindowRect( &r, style, FALSE );
383 
384  Cvar_SetValue( "vid_xpos", xPos + r.left);
385  Cvar_SetValue( "vid_ypos", yPos + r.top);
386  vid_xpos->modified = false;
387  vid_ypos->modified = false;
388  if (ActiveApp)
389  IN_Activate (true);
390  }
391  }
392  return DefWindowProc (hWnd, uMsg, wParam, lParam);
393 
394 // this is complicated because Win32 seems to pack multiple mouse events into
395 // one update sometimes, so we always check all states and look for events
396  case WM_LBUTTONDOWN:
397  case WM_LBUTTONUP:
398  case WM_RBUTTONDOWN:
399  case WM_RBUTTONUP:
400  case WM_MBUTTONDOWN:
401  case WM_MBUTTONUP:
402  case WM_MOUSEMOVE:
403  {
404  int temp;
405 
406  temp = 0;
407 
408  if (wParam & MK_LBUTTON)
409  temp |= 1;
410 
411  if (wParam & MK_RBUTTON)
412  temp |= 2;
413 
414  if (wParam & MK_MBUTTON)
415  temp |= 4;
416 
417  IN_MouseEvent (temp);
418  }
419  break;
420 
421  case WM_SYSCOMMAND:
422  if ( wParam == SC_SCREENSAVE )
423  return 0;
424  return DefWindowProc (hWnd, uMsg, wParam, lParam);
425  case WM_SYSKEYDOWN:
426  if ( wParam == 13 )
427  {
428  if ( vid_fullscreen )
429  {
430  Cvar_SetValue( "vid_fullscreen", !vid_fullscreen->value );
431  }
432  return 0;
433  }
434  else if (wParam == VK_F4)
435  {
436  CL_Disconnect();
437  Com_Quit();
438  return 0;
439  }
440  // fall through
441  case WM_KEYDOWN:
442  Key_Event( MapKey( lParam ), true, sys_msg_time);
443  break;
444 
445  case WM_SYSKEYUP:
446  case WM_KEYUP:
447  Key_Event( MapKey( lParam ), false, sys_msg_time);
448  break;
449 
450  case MM_MCINOTIFY:
451  {
452  LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
453  lRet = CDAudio_MessageHandler (hWnd, uMsg, wParam, lParam);
454  }
455  break;
456 
457  default: // pass all unhandled messages to DefWindowProc
458  return DefWindowProc (hWnd, uMsg, wParam, lParam);
459  }
460 
461  /* return 0 if handled message, 1 if not */
462  return DefWindowProc( hWnd, uMsg, wParam, lParam );
463 }
464 
465 /*
466 ============
467 VID_Restart_f
468 
469 Console command to re-start the video mode and refresh DLL. We do this
470 simply by setting the modified flag for the vid_ref variable, which will
471 cause the entire video mode and refresh DLL to be reset on the next frame.
472 ============
473 */
474 void VID_Restart_f (void)
475 {
476  vid_ref->modified = true;
477 }
478 
479 void VID_Front_f( void )
480 {
481  SetWindowLong( cl_hwnd, GWL_EXSTYLE, WS_EX_TOPMOST );
482  SetForegroundWindow( cl_hwnd );
483 }
484 
485 /*
486 ** VID_GetModeInfo
487 */
488 typedef struct vidmode_s
489 {
490  const char *description;
491  int width, height;
492  int mode;
493 } vidmode_t;
494 
496 {
497  { "Mode 0: 320x240", 320, 240, 0 },
498  { "Mode 1: 400x300", 400, 300, 1 },
499  { "Mode 2: 512x384", 512, 384, 2 },
500  { "Mode 3: 640x480", 640, 480, 3 },
501  { "Mode 4: 800x600", 800, 600, 4 },
502  { "Mode 5: 960x720", 960, 720, 5 },
503  { "Mode 6: 1024x768", 1024, 768, 6 },
504  { "Mode 7: 1152x864", 1152, 864, 7 },
505  { "Mode 8: 1280x960", 1280, 960, 8 },
506  { "Mode 9: 1366x768", 1366, 768, 9 },
507  { "Mode 10: 1600x1200", 1600, 1200, 10 },
508  { "Mode 11: 1920x1080", 1920, 1080, 11 },
509  { "Mode 12: 2048x1536", 2048, 1536, 12 },
510  { "Mode 13: 2560x1440", 2560, 1440, 13 },
511  { "Mode 14: 3840x2160", 3840, 2160, 14 },
512 };
513 
515 {
516  if (mode == -1) // custom mode (using r_customwidth and r_customheight)
517  {
520  return true;
521  }
522 
523  if ( mode < 0 || mode >= VID_NUM_MODES )
524  return false;
525 
528 
529  return true;
530 }
531 
532 /*
533 ** VID_UpdateWindowPosAndSize
534 */
536 {
537  RECT r;
538  int style;
539  int w, h;
540 
541  r.left = 0;
542  r.top = 0;
543  r.right = viddef.width;
544  r.bottom = viddef.height;
545 
546  style = GetWindowLong( cl_hwnd, GWL_STYLE );
547  AdjustWindowRect( &r, style, FALSE );
548 
549  w = r.right - r.left;
550  h = r.bottom - r.top;
551 
552  MoveWindow( cl_hwnd, vid_xpos->value, vid_ypos->value, w, h, TRUE );
553 }
554 
555 /*
556 ** VID_NewWindow
557 */
558 void VID_NewWindow ( int width, int height)
559 {
560  viddef.width = width;
561  viddef.height = height;
562 
563  cl.force_refdef = true; // can't use a paused refdef
564 
565  char hudscale[4];
566  memset(hudscale, 0, sizeof(hudscale));
567 
568  int wscale = viddef.width / 800;
569  int hscale = viddef.height / 480;
570 
571  if (wscale > hscale) wscale = hscale;
572  if (wscale < 1) wscale = 1;
573 
574  snprintf(hudscale, 4, "%2d", wscale);
575  vid_hudscale = Cvar_Set("hudscale", hudscale);
576 }
577 
578 void VID_FreeReflib (void)
579 {
580  if ( !FreeLibrary( reflib_library ) )
581  Com_Error( ERR_FATAL, "Reflib FreeLibrary failed" );
582  memset (&re, 0, sizeof(re));
584  reflib_active = false;
585 }
586 
587 /*
588 ==============
589 VID_LoadRefresh
590 ==============
591 */
593 {
594  refimport_t ri;
596 
597  if ( reflib_active )
598  {
599  re.Shutdown();
600  VID_FreeReflib ();
601  }
602 
603  Com_Printf( "------- Loading %s -------\n", name );
604 
605  if ( ( reflib_library = LoadLibrary( name ) ) == 0 )
606  {
607  Com_Printf( "LoadLibrary(\"%s\") failed\n", name );
608 
609  return false;
610  }
611 
614  ri.Cmd_Argc = Cmd_Argc;
615  ri.Cmd_Argv = Cmd_Argv;
622  ri.Cvar_Get = Cvar_Get;
623  ri.Cvar_Set = Cvar_Set;
628 
629  if ( ( GetRefAPI = (void *) GetProcAddress( reflib_library, "GetRefAPI" ) ) == 0 )
630  Com_Error( ERR_FATAL, "GetProcAddress failed on %s", name );
631 
632  re = GetRefAPI( ri );
633 
634  if (re.api_version != API_VERSION)
635  {
636  VID_FreeReflib ();
637  Com_Error (ERR_FATAL, "%s has incompatible api_version", name);
638  }
639 
640  if ( re.Init( global_hInstance, MainWndProc ) == false )
641  {
642  re.Shutdown();
643  VID_FreeReflib ();
644  return false;
645  }
646 
647  Com_Printf( "------------------------------------\n");
648  reflib_active = true;
649 
650 //======
651 //PGM
653  if(vid_ref)
654  {
655  if(!strcmp (vid_ref->string, "gl"))
657  else if (!strcmp(vid_ref->string, "vk"))
659  else if(!strcmp(vid_ref->string, "soft"))
661  }
662 //PGM
663 //======
664 
665  return true;
666 }
667 
668 /*
669 ============
670 VID_CheckChanges
671 
672 This function gets called once just before drawing each frame, and it's sole purpose in life
673 is to check to see if any of the video mode parameters have changed, and if they have to
674 update the rendering DLL and/or video mode to match.
675 ============
676 */
677 void VID_CheckChanges (void)
678 {
679  char name[100];
680 
681  if ( win_noalttab->modified )
682  {
683  if ( win_noalttab->value )
684  {
686  }
687  else
688  {
690  }
691  win_noalttab->modified = false;
692  }
693 
694  if ( vid_ref->modified )
695  {
696  cl.force_refdef = true; // can't use a paused refdef
697  S_StopAllSounds();
698  }
699  while (vid_ref->modified)
700  {
701  /*
702  ** refresh has changed
703  */
704  vid_ref->modified = false;
705  vid_fullscreen->modified = true;
706  cl.refresh_prepped = false;
707  cls.disable_screen = true;
708 
709  Com_sprintf( name, sizeof(name), "ref_%s.dll", vid_ref->string );
710  if ( !VID_LoadRefresh( name ) )
711  {
712  if ( strcmp (vid_ref->string, "soft") == 0 )
713  Com_Error (ERR_FATAL, "Couldn't fall back to software refresh!");
714  Cvar_Set( "vid_ref", "soft" );
715 
716  /*
717  ** drop the console if we fail to load a refresh
718  */
719  if ( cls.key_dest != key_console )
720  {
722  }
723  }
724  cls.disable_screen = false;
725  }
726 
727  /*
728  ** update our window position
729  */
730  if ( vid_xpos->modified || vid_ypos->modified )
731  {
732  if (!vid_fullscreen->value)
734 
735  vid_xpos->modified = false;
736  vid_ypos->modified = false;
737  }
738 }
739 
740 /*
741 ============
742 VID_Init
743 ============
744 */
745 void VID_Init (void)
746 {
747  /* Create the video variables so we know how to start the graphics drivers */
748  vid_ref = Cvar_Get ("vid_ref", "vk", CVAR_ARCHIVE);
749  vid_xpos = Cvar_Get ("vid_xpos", "3", CVAR_ARCHIVE);
750  vid_ypos = Cvar_Get ("vid_ypos", "22", CVAR_ARCHIVE);
751  vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ARCHIVE);
752  vid_gamma = Cvar_Get( "vid_gamma", "1", CVAR_ARCHIVE );
753  win_noalttab = Cvar_Get( "win_noalttab", "0", CVAR_ARCHIVE );
754  r_customwidth = Cvar_Get( "r_customwidth", "1024", CVAR_ARCHIVE );
755  r_customheight = Cvar_Get( "r_customheight", "768", CVAR_ARCHIVE );
756  viewsize = Cvar_Get( "viewsize", "100", CVAR_ARCHIVE );
757 
758  /* Add some console commands that we want to handle */
759  Cmd_AddCommand ("vid_restart", VID_Restart_f);
760  Cmd_AddCommand ("vid_front", VID_Front_f);
761 
762  /* Disable the 3Dfx splash screen */
763  putenv("FX_GLIDE_NO_SPLASH=0");
764 
765  /* Start the graphics mode and load refresh DLL */
767 }
768 
769 /*
770 ============
771 VID_Shutdown
772 ============
773 */
774 void VID_Shutdown (void)
775 {
776  if ( reflib_active )
777  {
778  re.Shutdown ();
779  VID_FreeReflib ();
780  }
781 }
782 
783 
K_KP_ENTER
#define K_KP_ENTER
Definition: keys.h:70
GetRefAPI
refexport_t GetRefAPI(refimport_t rimp)
Definition: r_main.c:1456
K_INS
#define K_INS
Definition: keys.h:53
refimport_t::Cmd_RemoveCommand
void(* Cmd_RemoveCommand)(char *name)
Definition: ref.h:197
Cbuf_ExecuteText
void Cbuf_ExecuteText(int exec_when, char *text)
Definition: cmd.c:171
height
GLsizei height
Definition: qgl_win.c:69
VID_Restart_f
void VID_Restart_f(void)
Definition: vid_dll.c:474
K_KP_RIGHTARROW
#define K_KP_RIGHTARROW
Definition: keys.h:66
TRUE
#define TRUE
Definition: stb_vorbis.c:617
MSH_MOUSEWHEEL
static UINT MSH_MOUSEWHEEL
Definition: vid_dll.c:40
vidmode_s::width
int width
Definition: vid_dll.c:491
K_PGUP
#define K_PGUP
Definition: keys.h:56
vidmode_s::mode
int mode
Definition: vid_dll.c:492
K_F6
#define K_F6
Definition: keys.h:46
IN_MouseEvent
void IN_MouseEvent(int mstate)
Definition: in_win.c:233
VID_Front_f
void VID_Front_f(void)
Definition: vid_dll.c:479
client_static_t::disable_screen
float disable_screen
Definition: client.h:212
s_alttab_disabled
static qboolean s_alttab_disabled
Definition: vid_dll.c:64
ri
refimport_t ri
Definition: r_main.c:25
PRINT_DEVELOPER
#define PRINT_DEVELOPER
Definition: qcommon.h:752
reflib_active
qboolean reflib_active
Definition: vid_dll.c:56
K_F12
#define K_F12
Definition: keys.h:52
Key_Event
void Key_Event(int key, qboolean down, unsigned time)
Definition: keys.c:744
refimport_t::Vid_NewWindow
void(* Vid_NewWindow)(int width, int height)
Definition: ref.h:222
refimport_t::Cmd_ExecuteText
void(* Cmd_ExecuteText)(int exec_when, char *text)
Definition: ref.h:200
K_ALT
#define K_ALT
Definition: keys.h:38
cvar_s::modified
qboolean modified
Definition: q_shared.h:330
r_customheight
cvar_t * r_customheight
Definition: vid_dll.c:50
VID_UpdateWindowPosAndSize
void VID_UpdateWindowPosAndSize(int x, int y)
Definition: vid_dll.c:535
K_BACKSPACE
#define K_BACKSPACE
Definition: keys.h:32
K_KP_END
#define K_KP_END
Definition: keys.h:67
refimport_t::FS_LoadFile
int(* FS_LoadFile)(char *name, void **buf)
Definition: ref.h:209
refimport_t::Cvar_Get
cvar_t *(* Cvar_Get)(char *name, char *value, int flags)
Definition: ref.h:216
cvar_s::string
char * string
Definition: q_shared.h:327
qboolean
qboolean
Definition: q_shared.h:63
x
GLint GLenum GLint x
Definition: qgl_win.c:116
CDAudio_MessageHandler
LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: cd_win.c:377
K_F2
#define K_F2
Definition: keys.h:42
K_KP_MINUS
#define K_KP_MINUS
Definition: keys.h:74
viewsize
cvar_t * viewsize
Definition: vid_dll.c:51
API_VERSION
#define API_VERSION
Definition: ref.h:128
WM_MOUSEWHEEL
#define WM_MOUSEWHEEL
Definition: vid_dll.c:37
winquake.h
Con_ToggleConsole_f
void Con_ToggleConsole_f(void)
Definition: console.c:68
MapKey
int MapKey(int key)
Definition: vid_dll.c:190
refimport_t::Cvar_Set
cvar_t *(* Cvar_Set)(char *name, char *value)
Definition: ref.h:217
CDAudio_Activate
void CDAudio_Activate(qboolean active)
Definition: cd_win.c:506
VID_Printf
void VID_Printf(int print_level, char *fmt,...)
Definition: vid_dll.c:121
width
GLint GLsizei width
Definition: qgl_win.c:115
SCR_DirtyScreen
void SCR_DirtyScreen(void)
Definition: cl_scrn.c:681
CL_Disconnect
void CL_Disconnect(void)
Definition: cl_main.c:618
refexport_t::AppActivate
void(* AppActivate)(qboolean activate)
Definition: ref.h:185
Cvar_Get
cvar_t * Cvar_Get(char *var_name, char *var_value, int flags)
Definition: cvar.c:127
K_F5
#define K_F5
Definition: keys.h:45
K_KP_PLUS
#define K_KP_PLUS
Definition: keys.h:75
WIN_DisableAltTab
static void WIN_DisableAltTab(void)
Definition: vid_dll.c:73
VID_NewWindow
void VID_NewWindow(int width, int height)
Definition: vid_dll.c:558
viddef_t
Definition: vid.h:27
cvar_s
Definition: q_shared.h:324
K_HOME
#define K_HOME
Definition: keys.h:57
K_CTRL
#define K_CTRL
Definition: keys.h:39
client_state_t::force_refdef
qboolean force_refdef
Definition: client.h:100
K_MWHEELDOWN
#define K_MWHEELDOWN
Definition: keys.h:131
IN_Activate
void IN_Activate(qboolean active)
Definition: in_win.c:399
refimport_t::FS_FreeFile
void(* FS_FreeFile)(void *buf)
Definition: ref.h:210
viddef
viddef_t viddef
Definition: vid_dll.c:54
Cmd_Argv
char * Cmd_Argv(int arg)
Definition: cmd.c:517
vid_hudscale
cvar_t * vid_hudscale
Definition: vid_dll.c:48
msg
cvar_t * msg
Definition: cl_main.c:83
refimport_t::Vid_GetModeInfo
qboolean(* Vid_GetModeInfo)(int *width, int *height, int mode)
Definition: ref.h:220
PRINT_ALERT
#define PRINT_ALERT
Definition: q_shared.h:110
sys_msg_time
unsigned sys_msg_time
Definition: sys_win.c:48
Cmd_Argc
int Cmd_Argc(void)
Definition: cmd.c:507
Cmd_RemoveCommand
void Cmd_RemoveCommand(char *cmd_name)
Definition: cmd.c:724
global_hInstance
HINSTANCE global_hInstance
Definition: sys_win.c:633
K_KP_5
#define K_KP_5
Definition: keys.h:65
refimport_t::Con_Printf
void(* Con_Printf)(int print_level, char *str,...)
Definition: ref.h:202
PRINT_ALL
#define PRINT_ALL
Definition: qcommon.h:751
K_F8
#define K_F8
Definition: keys.h:48
K_KP_SLASH
#define K_KP_SLASH
Definition: keys.h:73
VIDREF_VK
#define VIDREF_VK
Definition: q_shared.h:1202
r
GLdouble GLdouble r
Definition: qgl_win.c:336
Minimized
qboolean Minimized
Definition: sys_win.c:44
VIDREF_GL
#define VIDREF_GL
Definition: q_shared.h:1203
K_KP_INS
#define K_KP_INS
Definition: keys.h:71
K_END
#define K_END
Definition: keys.h:58
viddef_t::width
unsigned width
Definition: vid.h:29
refimport_t
Definition: ref.h:192
K_F9
#define K_F9
Definition: keys.h:49
refimport_t::Cmd_AddCommand
void(* Cmd_AddCommand)(char *name, void(*cmd)(void))
Definition: ref.h:196
BOOL
CONST COLORREF COLORREF BOOL
Definition: qgl_win.c:60
s_win95
qboolean s_win95
Definition: sys_win.c:40
UINT
CONST PIXELFORMATDESCRIPTOR UINT
Definition: qgl_win.c:35
vidmode_s::description
const char * description
Definition: vid_dll.c:490
Cmd_AddCommand
void Cmd_AddCommand(char *cmd_name, xcommand_t function)
Definition: cmd.c:691
client_state_t::refresh_prepped
qboolean refresh_prepped
Definition: client.h:98
refimport_t::Sys_Error
void(* Sys_Error)(int err_level, char *str,...)
Definition: ref.h:194
FS_LoadFile
int FS_LoadFile(char *path, void **buffer)
Definition: files.c:398
K_LEFTARROW
#define K_LEFTARROW
Definition: keys.h:35
CVAR_ARCHIVE
#define CVAR_ARCHIVE
Definition: q_shared.h:316
viddef_t::height
unsigned height
Definition: vid.h:29
K_F11
#define K_F11
Definition: keys.h:51
refexport_t
Definition: ref.h:133
cvar_s::value
float value
Definition: q_shared.h:331
Cvar_SetValue
void Cvar_SetValue(char *var_name, float value)
Definition: cvar.c:317
K_DOWNARROW
#define K_DOWNARROW
Definition: keys.h:34
K_KP_DEL
#define K_KP_DEL
Definition: keys.h:72
K_KP_UPARROW
#define K_KP_UPARROW
Definition: keys.h:62
K_KP_HOME
#define K_KP_HOME
Definition: keys.h:61
refimport_t::FS_Gamedir
char *(* FS_Gamedir)(void)
Definition: ref.h:214
key_console
@ key_console
Definition: client.h:200
scantokey
byte scantokey[128]
Definition: vid_dll.c:161
NULL
#define NULL
Definition: q_shared.h:67
vid_modes
vidmode_t vid_modes[]
Definition: vid_dll.c:495
VIDREF_SOFT
#define VIDREF_SOFT
Definition: q_shared.h:1204
Com_Error
void Com_Error(int code, char *fmt,...)
Definition: common.c:181
VID_FreeReflib
void VID_FreeReflib(void)
Definition: vid_dll.c:578
K_F7
#define K_F7
Definition: keys.h:47
K_PAUSE
#define K_PAUSE
Definition: keys.h:77
VID_Init
void VID_Init(void)
Definition: vid_dll.c:745
name
cvar_t * name
Definition: cl_main.c:79
K_RIGHTARROW
#define K_RIGHTARROW
Definition: keys.h:36
ERR_FATAL
#define ERR_FATAL
Definition: qcommon.h:743
y
GLint y
Definition: qgl_win.c:115
WIN_EnableAltTab
static void WIN_EnableAltTab(void)
Definition: vid_dll.c:92
re
refexport_t re
Definition: vid_dll.c:32
K_F3
#define K_F3
Definition: keys.h:43
VID_MenuInit
void VID_MenuInit(void)
Definition: vid_menu.c:290
VID_NUM_MODES
#define VID_NUM_MODES
Definition: vid_dll.c:60
vidmode_t
struct vidmode_s vidmode_t
ActiveApp
qboolean ActiveApp
Definition: sys_win.c:43
vid_ref
cvar_t * vid_ref
Definition: vid_dll.c:44
VID_CheckChanges
void VID_CheckChanges(void)
Definition: vid_dll.c:677
vid_gamma
cvar_t * vid_gamma
Definition: vid_dll.c:43
AppActivate
void AppActivate(BOOL fActive, BOOL minimize)
Definition: vid_dll.c:247
VID_GetModeInfo
qboolean VID_GetModeInfo(int *width, int *height, int mode)
Definition: vid_dll.c:514
refimport_t::Vid_MenuInit
void(* Vid_MenuInit)(void)
Definition: ref.h:221
FS_Gamedir
char * FS_Gamedir(void)
Definition: files.c:559
vid_fullscreen
cvar_t * vid_fullscreen
Definition: vid_dll.c:47
refexport_t::Shutdown
void(* Shutdown)(void)
Definition: ref.h:142
Com_Quit
void Com_Quit(void)
Definition: common.c:235
K_DEL
#define K_DEL
Definition: keys.h:54
vid_xpos
cvar_t * vid_xpos
Definition: vid_dll.c:45
Cvar_Set
cvar_t * Cvar_Set(char *var_name, char *value)
Definition: cvar.c:278
Com_DPrintf
void Com_DPrintf(char *fmt,...)
Definition: common.c:157
S_StopAllSounds
void S_StopAllSounds(void)
Definition: snd_dma.c:785
reflib_library
HINSTANCE reflib_library
Definition: vid_dll.c:55
refexport_t::api_version
int api_version
Definition: ref.h:136
FS_FreeFile
void FS_FreeFile(void *buffer)
Definition: files.c:437
S_Activate
void S_Activate(qboolean active)
Definition: snd_win.c:844
client_static_t::key_dest
keydest_t key_dest
Definition: client.h:205
VID_Shutdown
void VID_Shutdown(void)
Definition: vid_dll.c:774
K_KP_PGUP
#define K_KP_PGUP
Definition: keys.h:63
K_KP_DOWNARROW
#define K_KP_DOWNARROW
Definition: keys.h:68
K_PGDN
#define K_PGDN
Definition: keys.h:55
VIDREF_OTHER
#define VIDREF_OTHER
Definition: q_shared.h:1205
K_MWHEELUP
#define K_MWHEELUP
Definition: keys.h:132
w
GLdouble GLdouble GLdouble w
Definition: qgl_win.c:291
Com_Printf
void Com_Printf(char *fmt,...)
Definition: common.c:104
FALSE
#define FALSE
Definition: stb_vorbis.c:618
r_customwidth
cvar_t * r_customwidth
Definition: vid_dll.c:49
refimport_t::Cvar_SetValue
void(* Cvar_SetValue)(char *name, float value)
Definition: ref.h:218
K_SHIFT
#define K_SHIFT
Definition: keys.h:40
mode
GLenum mode
Definition: qgl_win.c:113
cls
client_static_t cls
Definition: cl_main.c:90
VID_Error
void VID_Error(int err_level, char *fmt,...)
Definition: vid_dll.c:146
K_KP_PGDN
#define K_KP_PGDN
Definition: keys.h:69
Key_ClearStates
void Key_ClearStates(void)
Definition: keys.c:935
vidmode_s::height
int height
Definition: vid_dll.c:491
VID_LoadRefresh
qboolean VID_LoadRefresh(char *name)
Definition: vid_dll.c:592
K_F4
#define K_F4
Definition: keys.h:44
K_F10
#define K_F10
Definition: keys.h:50
vid_ypos
cvar_t * vid_ypos
Definition: vid_dll.c:46
K_UPARROW
#define K_UPARROW
Definition: keys.h:33
refexport_t::Init
qboolean(* Init)(void *hinstance, void *wndproc)
Definition: ref.h:139
vidmode_s
Definition: vid_dll.c:488
cl
client_state_t cl
Definition: cl_main.c:91
GetRefAPI_t
refexport_t(* GetRefAPI_t)(refimport_t)
Definition: ref.h:227
cl_hwnd
HWND cl_hwnd
Definition: vid_dll.c:58
MainWndProc
LONG WINAPI MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: vid_dll.c:290
refimport_t::Cmd_Argc
int(* Cmd_Argc)(void)
Definition: ref.h:198
Com_sprintf
void Com_sprintf(char *dest, int size, char *fmt,...)
Definition: q_shared.c:1223
vidref_val
int vidref_val
Definition: cl_ents.c:28
K_KP_LEFTARROW
#define K_KP_LEFTARROW
Definition: keys.h:64
refimport_t::Cmd_Argv
char *(* Cmd_Argv)(int i)
Definition: ref.h:199
K_F1
#define K_F1
Definition: keys.h:41
MAXPRINTMSG
#define MAXPRINTMSG
Definition: vid_dll.c:120
win_noalttab
cvar_t * win_noalttab
Definition: vid_dll.c:34