Debian Codegraph @

win32/plugins/dfxvideo/winsrc/key.c

raw
1 /***************************************************************************
2 key.c - description
3 -------------------
4 begin : Sun Oct 28 2001
5 copyright : (C) 2001 by Pete Bernert
6 email : [email protected]
7 ***************************************************************************/
8
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. See also the license.txt file for *
15 * additional informations. *
16 * *
17 ***************************************************************************/
18
19 #define _IN_KEY
20
21 #include "externals.h"
22 #include "menu.h"
23 #include "gpu.h"
24 #include "draw.h"
25 #include "key.h"
26
27 #include "record.h"
28
29 ////////////////////////////////////////////////////////////////////////
30 // KeyBoard handler stuff
31 ////////////////////////////////////////////////////////////////////////
32
33 WNDPROC wpOrgWndProc=0;
34 unsigned long ulKeybits=0;
35 char szGPUKeys[11];
36
37 ////////////////////////////////////////////////////////////////////////
38 // keyboard handler
39 ////////////////////////////////////////////////////////////////////////
40
41 void CALLBACK GPUshowScreenPic(unsigned char * pMem);
42 void CALLBACK GPUgetScreenPic(unsigned char * pMem);
43
44 LRESULT CALLBACK KeyWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
45 {
46 switch(message)
47 {
48 //--------------------------------------------------//
49 case WM_ACTIVATE: // some scanline window mode fixing stuff
50 case WM_MOVE:
51 {
52 if(!iUseScanLines) break;
53 if(!iWindowMode) break;
54 if(bIsFirstFrame) break;
55 MoveScanLineArea(hwnd);
56 }break;
57 //--------------------------------------------------//
58 case WM_KEYDOWN: // keydown
59 if(wParam==(WPARAM)szGPUKeys[2]) ulKeybits|=KEY_RESETTEXSTORE;
60 break;
61 //--------------------------------------------------//
62 case WM_SYSKEYUP: // alt+enter
63 if(wParam==VK_RETURN) bChangeWinMode=TRUE;
64 break;
65 //--------------------------------------------------//
66 case WM_KEYUP: // key up
67
68 if(iDebugMode && wParam==(WPARAM)szGPUKeys[9])
69 iFVDisplay=!iFVDisplay;
70
71 if(wParam==(WPARAM)szGPUKeys[0])
72 {
73 if(ulKeybits&KEY_SHOWFPS)
74 {
75 DestroyPic();
76 ulKeybits&=~KEY_SHOWFPS;
77 DoClearScreenBuffer();
78 }
79 else
80 {
81 ulKeybits|=KEY_SHOWFPS;
82 szDispBuf[0]=0;
83 BuildDispMenu(0);
84 }
85 break;
86 }
87 if(wParam==(WPARAM)szGPUKeys[1]) {ShowGpuPic();break;}
88
89 if(wParam==(WPARAM)szGPUKeys[6])
90 {
91 if(RECORD_RECORDING==TRUE)
92 {RECORD_RECORDING=FALSE;RECORD_Stop();}
93 else
94 {RECORD_RECORDING=TRUE;RECORD_Start();}
95 BuildDispMenu(0);
96 break;
97 }
98
99 if(wParam==(WPARAM)szGPUKeys[2]) {SwitchDispMenu(-1); break;}
100 if(wParam==(WPARAM)szGPUKeys[3]) {SwitchDispMenu(1); break;}
101 if(wParam==(WPARAM)szGPUKeys[4]) {BuildDispMenu(-1); break;}
102 if(wParam==(WPARAM)szGPUKeys[5]) {BuildDispMenu( 1); break;}
103 if(wParam==(WPARAM)szGPUKeys[7]) {bVsync_Key = bVsync_Key==TRUE ? FALSE : TRUE; BuildDispMenu(0);break;}
104 if(wParam==(WPARAM)szGPUKeys[8])
105 {
106 iFastFwd = 1 - iFastFwd;
107 bSkipNextFrame = FALSE;
108 UseFrameSkip=iFastFwd;
109 BuildDispMenu(0);
110 break;
111 }
112 break;
113 //--------------------------------------------------//
114 }
115 return wpOrgWndProc( hwnd, message, wParam, lParam );
116 }
117
118 ////////////////////////////////////////////////////////////////////////
119
120 void SetKeyHandler(void)
121 {
122 if(!wpOrgWndProc) // setup keyhandler
123 {
124 wpOrgWndProc = (WNDPROC)GetWindowLong(hWGPU, GWL_WNDPROC );
125 SetWindowLong(hWGPU, GWL_WNDPROC, (long)KeyWndProc);
126 }
127 }
128
129 ////////////////////////////////////////////////////////////////////////
130
131 void ReleaseKeyHandler(void)
132 {
133 if(wpOrgWndProc)
134 SetWindowLong(hWGPU,GWL_WNDPROC, // set old proc
135 (long)wpOrgWndProc);
136 wpOrgWndProc = 0;
137 }