Index: Installer/dxgl.nsi |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | ; Finish page
|
61 | 61 | !define MUI_FINISHPAGE_RUN "$INSTDIR\dxglcfg.exe"
|
62 | 62 | !define MUI_FINISHPAGE_RUN_TEXT "Configure DXGL"
|
63 | | -!define MUI_FINISHPAGE_SHOWREADME "$SYSDIR\notepad.exe $INSTDIR\ReadMe.md"
|
| 63 | +!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\ReadMe.txt"
|
64 | 64 | !insertmacro MUI_PAGE_FINISH
|
65 | 65 |
|
66 | 66 | ; Uninstaller pages
|
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | File "..\${SRCDIR}\dxglcfg.exe"
|
120 | 120 | CreateShortCut "$SMPROGRAMS\DXGL\Configure DXGL.lnk" "$INSTDIR\dxglcfg.exe"
|
121 | 121 | File "..\${SRCDIR}\ddraw.dll"
|
122 | | - File "..\ReadMe.md"
|
| 122 | + File /oname=ReadMe.txt "..\ReadMe.md"
|
123 | 123 | File "..\COPYING.txt"
|
124 | 124 | File "..\Help\dxgl.chm"
|
125 | 125 | CreateShortCut "$SMPROGRAMS\DXGL\DXGL Help.lnk" "$INSTDIR\dxgl.chm"
|
— | — | @@ -318,7 +318,7 @@ |
319 | 319 | Delete "$INSTDIR\${PRODUCT_NAME}.url"
|
320 | 320 | Delete "$INSTDIR\uninst.exe"
|
321 | 321 | Delete "$INSTDIR\COPYING.txt"
|
322 | | - Delete "$INSTDIR\ReadMe.md"
|
| 322 | + Delete "$INSTDIR\ReadMe.txt"
|
323 | 323 | Delete "$INSTDIR\ddraw.dll"
|
324 | 324 | Delete "$INSTDIR\dxglcfg.exe"
|
325 | 325 | Delete "$INSTDIR\dxgltest.exe"
|
Index: ddraw/ddraw.cpp |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | #include "hooks.h"
|
30 | 30 | #include <intrin.h>
|
31 | 31 |
|
32 | | -DXGLCFG dxglcfg;
|
| 32 | +extern "C" {DXGLCFG dxglcfg; }
|
33 | 33 | DWORD gllock = 0;
|
34 | 34 | HMODULE sysddraw = NULL;
|
35 | 35 | HRESULT (WINAPI *sysddrawcreate)(GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter) = NULL;
|
Index: ddraw/ddraw.h |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | DDRAW_API void WINAPI ReleaseDDThreadLock();
|
58 | 58 | DDRAW_API BOOL IsDXGLDDraw();
|
59 | 59 |
|
60 | | -extern DXGLCFG dxglcfg;
|
| 60 | +extern "C" {extern DXGLCFG dxglcfg; }
|
61 | 61 | extern DWORD gllock;
|
62 | 62 | extern const GUID device_template;
|
63 | 63 | struct glRenderer;
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -1432,7 +1432,12 @@ |
1433 | 1433 | }
|
1434 | 1434 | TRACE_EXIT(0, 0);
|
1435 | 1435 | }
|
| 1436 | +extern "C" void glDirectDraw7_GetSizes(glDirectDraw7 *glDD7, LONG *sizes)
|
| 1437 | +{
|
| 1438 | + glDD7->GetSizes(sizes);
|
| 1439 | +}
|
1436 | 1440 |
|
| 1441 | +
|
1437 | 1442 | HRESULT WINAPI glDirectDraw7::SetCooperativeLevel(HWND hWnd, DWORD dwFlags)
|
1438 | 1443 | {
|
1439 | 1444 | TRACE_ENTER(3,14,this,13,hWnd,9,dwFlags);
|
Index: ddraw/glRenderWindow.cpp |
— | — | @@ -27,26 +27,6 @@ |
28 | 28 | bool hotkeyregistered = false;
|
29 | 29 | #endif
|
30 | 30 |
|
31 | | -void WaitForObjectAndMessages(HANDLE object)
|
32 | | -{
|
33 | | - MSG Msg;
|
34 | | - while(1)
|
35 | | - {
|
36 | | - switch(MsgWaitForMultipleObjects(1,&object,FALSE,INFINITE,QS_ALLINPUT))
|
37 | | - {
|
38 | | - case WAIT_OBJECT_0:
|
39 | | - return;
|
40 | | - case WAIT_OBJECT_0+1:
|
41 | | - while(PeekMessage(&Msg,NULL,0,0,PM_REMOVE))
|
42 | | - {
|
43 | | - TranslateMessage(&Msg);
|
44 | | - DispatchMessage(&Msg);
|
45 | | - }
|
46 | | - }
|
47 | | - }
|
48 | | -
|
49 | | -}
|
50 | | -
|
51 | 31 | glRenderWindow::glRenderWindow(int width, int height, bool fullscreen, HWND parent, glDirectDraw7 *glDD7, bool devwnd)
|
52 | 32 | {
|
53 | 33 | ddInterface = glDD7;
|
— | — | @@ -55,24 +35,9 @@ |
56 | 36 | this->fullscreen = fullscreen;
|
57 | 37 | this->device = devwnd;
|
58 | 38 | hParentWnd = parent;
|
59 | | - ReadyEvent = CreateEvent(NULL,false,false,NULL);
|
60 | | - hThread = CreateThread(NULL,0,ThreadEntry,this,0,NULL);
|
61 | | - WaitForObjectAndMessages(ReadyEvent);
|
62 | | - CloseHandle(ReadyEvent);
|
63 | | - ReadyEvent = NULL;
|
64 | | -}
|
65 | | -
|
66 | | -DWORD WINAPI glRenderWindow::ThreadEntry(void *entry)
|
67 | | -{
|
68 | | - return ((glRenderWindow*)entry)->_Entry();
|
69 | | -}
|
70 | | -
|
71 | | -DWORD glRenderWindow::_Entry()
|
72 | | -{
|
73 | 39 | char *windowname;
|
74 | 40 | if (device) windowname = "DirectDrawDeviceWnd";
|
75 | 41 | else windowname = "Renderer";
|
76 | | - MSG Msg;
|
77 | 42 | if(!wndclasscreated)
|
78 | 43 | {
|
79 | 44 | wndclass.cbSize = sizeof(WNDCLASSEXA);
|
— | — | @@ -92,7 +57,6 @@ |
93 | 58 | }
|
94 | 59 | RECT rectRender;
|
95 | 60 | GetClientRect(hParentWnd,&rectRender);
|
96 | | - dead = false;
|
97 | 61 | if(hParentWnd)
|
98 | 62 | {
|
99 | 63 | hWnd = CreateWindowA("DirectDrawDeviceWnd",windowname,WS_CHILD|WS_VISIBLE,0,0,rectRender.right - rectRender.left,
|
— | — | @@ -115,13 +79,6 @@ |
116 | 80 | Beep(120, 1000);
|
117 | 81 | }
|
118 | 82 | #endif
|
119 | | - SetEvent(ReadyEvent);
|
120 | | - while((GetMessage(&Msg, NULL, 0, 0) > 0) && !dead)
|
121 | | - {
|
122 | | - TranslateMessage(&Msg);
|
123 | | - DispatchMessage(&Msg);
|
124 | | - }
|
125 | | - return 0;
|
126 | 83 | }
|
127 | 84 |
|
128 | 85 | glRenderWindow::~glRenderWindow()
|
— | — | @@ -129,9 +86,7 @@ |
130 | 87 | #ifdef _DEBUG
|
131 | 88 | if(hotkeyregistered) UnregisterHotKey(hWnd,1);
|
132 | 89 | #endif
|
133 | | - SendMessage(hWnd,WM_CLOSE,0,0);
|
134 | | - WaitForSingleObject(hThread,INFINITE);
|
135 | | - CloseHandle(hThread);
|
| 90 | + DestroyWindow(hWnd);
|
136 | 91 | }
|
137 | 92 |
|
138 | 93 | #ifdef _TRACE
|
— | — | @@ -198,13 +153,11 @@ |
199 | 154 | return SendMessage(hParent,msg,wParam,newpos);
|
200 | 155 | }
|
201 | 156 | else return SendMessage(hParent,msg,wParam,lParam);
|
202 | | - case WM_CLOSE:
|
| 157 | +/* case WM_CLOSE:
|
203 | 158 | DestroyWindow(hWnd);
|
204 | | - return 0;
|
| 159 | + return 0;*/
|
205 | 160 | case WM_DESTROY:
|
206 | | - PostQuitMessage(0);
|
207 | | - dead = true;
|
208 | | - return 0;
|
| 161 | + return FALSE;
|
209 | 162 | #ifdef _DEBUG
|
210 | 163 | case WM_HOTKEY:
|
211 | 164 | #ifdef _TRACE
|
Index: ddraw/glRenderWindow.h |
— | — | @@ -22,7 +22,6 @@ |
23 | 23 | LRESULT CALLBACK RenderWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
24 | 24 |
|
25 | 25 | class glDirectDraw7;
|
26 | | -void WaitForObjectAndMessages(HANDLE object);
|
27 | 26 | class glRenderWindow
|
28 | 27 | {
|
29 | 28 | public:
|
— | — | @@ -33,15 +32,11 @@ |
34 | 33 | LRESULT WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
35 | 34 | static DWORD WINAPI ThreadEntry(void *entry);
|
36 | 35 | private:
|
37 | | - DWORD _Entry();
|
38 | 36 | HWND hWnd;
|
39 | 37 | HWND hParentWnd;
|
40 | | - HANDLE hThread;
|
41 | | - HANDLE ReadyEvent;
|
42 | 38 | int width;
|
43 | 39 | int height;
|
44 | 40 | bool fullscreen;
|
45 | | - bool dead;
|
46 | 41 | bool device;
|
47 | 42 | glDirectDraw7 *ddInterface;
|
48 | 43 | };
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -23,7 +23,6 @@ |
24 | 24 | #include "glDirectDraw.h"
|
25 | 25 | #include "glDirectDrawSurface.h"
|
26 | 26 | #include "glDirectDrawPalette.h"
|
27 | | -#include "glRenderWindow.h"
|
28 | 27 | #include "glRenderer.h"
|
29 | 28 | #include "glDirect3DDevice.h"
|
30 | 29 | #include "glDirect3DLight.h"
|
— | — | @@ -170,13 +169,13 @@ |
171 | 170 | ShowWindow(This->hWnd, SW_MAXIMIZE);
|
172 | 171 | break;
|
173 | 172 | }
|
| 173 | + if (width)
|
| 174 | + {
|
| 175 | + // TODO: Adjust window rect
|
| 176 | + }
|
| 177 | + SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
174 | 178 | }
|
175 | | - if(width)
|
176 | | - {
|
177 | | - // TODO: Adjust window rect
|
178 | | - }
|
179 | | - SetWindowPos(This->hWnd,HWND_TOP,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
180 | | - This->RenderWnd = new glRenderWindow(width,height,fullscreen,This->hWnd,glDD7,devwnd);
|
| 179 | + //This->RenderWnd = new glRenderWindow(width,height,fullscreen,This->hWnd,glDD7,devwnd);
|
181 | 180 | This->inputs[0] = (void*)width;
|
182 | 181 | This->inputs[1] = (void*)height;
|
183 | 182 | This->inputs[2] = (void*)bpp;
|
— | — | @@ -200,7 +199,7 @@ |
201 | 200 | EnterCriticalSection(&This->cs);
|
202 | 201 | This->opcode = OP_DELETE;
|
203 | 202 | SetEvent(This->start);
|
204 | | - WaitForObjectAndMessages(This->busy);
|
| 203 | + WaitForSingleObject(This->busy, INFINITE);
|
205 | 204 | CloseHandle(This->start);
|
206 | 205 | CloseHandle(This->busy);
|
207 | 206 | LeaveCriticalSection(&This->cs);
|
— | — | @@ -283,7 +282,7 @@ |
284 | 283 | {
|
285 | 284 | EnterCriticalSection(&This->cs);
|
286 | 285 | RECT r,r2;
|
287 | | - if(((cmd->dest->ddsd.ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER)) &&
|
| 286 | + /*if(((cmd->dest->ddsd.ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER)) &&
|
288 | 287 | (cmd->dest->ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)) ||
|
289 | 288 | ((cmd->dest->ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) &&
|
290 | 289 | !(cmd->dest->ddsd.ddsCaps.dwCaps & DDSCAPS_FLIP)))
|
— | — | @@ -292,7 +291,7 @@ |
293 | 292 | GetClientRect(This->RenderWnd->GetHWnd(),&r2);
|
294 | 293 | if(memcmp(&r2,&r,sizeof(RECT)) != 0)
|
295 | 294 | SetWindowPos(This->RenderWnd->GetHWnd(),NULL,0,0,r.right,r.bottom,SWP_SHOWWINDOW);
|
296 | | - }
|
| 295 | + }*/
|
297 | 296 | This->inputs[0] = cmd;
|
298 | 297 | This->opcode = OP_BLT;
|
299 | 298 | SetEvent(This->start);
|
— | — | @@ -470,8 +469,10 @@ |
471 | 470 | This->inputs[5] = (void*)newwnd;
|
472 | 471 | This->inputs[6] = (void*)devwnd;
|
473 | 472 | This->opcode = OP_SETWND;
|
| 473 | + /*delete This->RenderWnd;
|
| 474 | + This->RenderWnd = new glRenderWindow(width, height, fullscreen, newwnd, This->ddInterface, devwnd);*/
|
474 | 475 | SetEvent(This->start);
|
475 | | - WaitForObjectAndMessages(This->busy);
|
| 476 | + WaitForSingleObject(This->busy, INFINITE);
|
476 | 477 | LeaveCriticalSection(&This->cs);
|
477 | 478 | }
|
478 | 479 | /**
|
— | — | @@ -1138,10 +1139,11 @@ |
1139 | 1140 | wglDeleteContext(This->hRC);
|
1140 | 1141 | This->hRC = NULL;
|
1141 | 1142 | };
|
1142 | | - if(This->hDC) ReleaseDC(This->RenderWnd->GetHWnd(),This->hDC);
|
| 1143 | + //if(This->hDC) ReleaseDC(This->RenderWnd->GetHWnd(),This->hDC);
|
| 1144 | + if (This->hDC) ReleaseDC(This->hWnd, This->hDC);
|
1143 | 1145 | This->hDC = NULL;
|
1144 | | - delete This->RenderWnd;
|
1145 | | - This->RenderWnd = NULL;
|
| 1146 | + /*delete This->RenderWnd;
|
| 1147 | + This->RenderWnd = NULL;*/
|
1146 | 1148 | SetEvent(This->busy);
|
1147 | 1149 | return 0;
|
1148 | 1150 | break;
|
— | — | @@ -1302,7 +1304,8 @@ |
1303 | 1305 | pfd.cColorBits = bpp;
|
1304 | 1306 | pfd.iLayerType = PFD_MAIN_PLANE;
|
1305 | 1307 | InterlockedIncrement(&gllock);
|
1306 | | - This->hDC = GetDC(This->RenderWnd->GetHWnd());
|
| 1308 | + //This->hDC = GetDC(This->RenderWnd->GetHWnd());
|
| 1309 | + This->hDC = GetDC(hWnd);
|
1307 | 1310 | if(!This->hDC)
|
1308 | 1311 | {
|
1309 | 1312 | DEBUG("glRenderer::InitGL: Can not create hDC\n");
|
— | — | @@ -1333,7 +1336,8 @@ |
1334 | 1337 | DEBUG("glRenderer::InitGL: Can not activate GL context\n");
|
1335 | 1338 | wglDeleteContext(This->hRC);
|
1336 | 1339 | This->hRC = NULL;
|
1337 | | - ReleaseDC(This->RenderWnd->GetHWnd(),This->hDC);
|
| 1340 | + //ReleaseDC(This->RenderWnd->GetHWnd(),This->hDC);
|
| 1341 | + ReleaseDC(hWnd, This->hDC);
|
1338 | 1342 | This->hDC = NULL;
|
1339 | 1343 | InterlockedDecrement(&gllock);
|
1340 | 1344 | LeaveCriticalSection(&dll_cs);
|
— | — | @@ -1911,13 +1915,13 @@ |
1912 | 1916 | int progtype;
|
1913 | 1917 | RECT r,r2;
|
1914 | 1918 | glUtil_BlendEnable(This->util, FALSE);
|
1915 | | - if((src->ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
|
| 1919 | + /*if((src->ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
|
1916 | 1920 | {
|
1917 | 1921 | GetClientRect(This->hWnd,&r);
|
1918 | 1922 | GetClientRect(This->RenderWnd->GetHWnd(),&r2);
|
1919 | 1923 | if(memcmp(&r2,&r,sizeof(RECT)))
|
1920 | | - SetWindowPos(This->RenderWnd->GetHWnd(),NULL,0,0,r.right,r.bottom,SWP_SHOWWINDOW);
|
1921 | | - }
|
| 1924 | + SetWindowPos(This->RenderWnd->GetHWnd(),NULL,0,0,r.right,r.bottom,SWP_SHOWWINDOW|SWP_ASYNCWINDOWPOS);
|
| 1925 | + }*/
|
1922 | 1926 | glUtil_DepthTest(This->util, FALSE);
|
1923 | 1927 | RECT *viewrect = &r2;
|
1924 | 1928 | glRenderer__SetSwap(This,vsync);
|
— | — | @@ -1947,8 +1951,10 @@ |
1948 | 1952 | viewport[0] = viewport[1] = 0;
|
1949 | 1953 | viewport[2] = viewrect->right;
|
1950 | 1954 | viewport[3] = viewrect->bottom;
|
1951 | | - ClientToScreen(This->RenderWnd->GetHWnd(),(LPPOINT)&viewrect->left);
|
1952 | | - ClientToScreen(This->RenderWnd->GetHWnd(),(LPPOINT)&viewrect->right);
|
| 1955 | + /*ClientToScreen(This->RenderWnd->GetHWnd(),(LPPOINT)&viewrect->left);
|
| 1956 | + ClientToScreen(This->RenderWnd->GetHWnd(),(LPPOINT)&viewrect->right);*/
|
| 1957 | + ClientToScreen(This->hWnd,(LPPOINT)&viewrect->left);
|
| 1958 | + ClientToScreen(This->hWnd,(LPPOINT)&viewrect->right);
|
1953 | 1959 | view[0] = (GLfloat)viewrect->left;
|
1954 | 1960 | view[1] = (GLfloat)viewrect->right;
|
1955 | 1961 | view[2] = (GLfloat)src->mipmaps[0].bigy-(GLfloat)viewrect->top;
|
— | — | @@ -2041,7 +2047,8 @@ |
2042 | 2048 | BufferObject_Unmap(This->pbo, GL_PIXEL_PACK_BUFFER);
|
2043 | 2049 | BufferObject_Unbind(This->pbo, GL_PIXEL_PACK_BUFFER);
|
2044 | 2050 | glPixelStorei(GL_PACK_ALIGNMENT,packalign);
|
2045 | | - HDC hRenderDC = (HDC)::GetDC(This->RenderWnd->GetHWnd());
|
| 2051 | + //HDC hRenderDC = (HDC)::GetDC(This->RenderWnd->GetHWnd());
|
| 2052 | + HDC hRenderDC = (HDC)::GetDC(This->hWnd);
|
2046 | 2053 | HGDIOBJ hPrevObj = 0;
|
2047 | 2054 | POINT dest = {0,0};
|
2048 | 2055 | POINT srcpoint = {0,0};
|
— | — | @@ -2048,11 +2055,15 @@ |
2049 | 2056 | SIZE wnd = {This->dib.width,This->dib.height};
|
2050 | 2057 | BLENDFUNCTION func = {AC_SRC_OVER,0,255,AC_SRC_ALPHA};
|
2051 | 2058 | hPrevObj = SelectObject(This->dib.hdc,This->dib.hbitmap);
|
2052 | | - ClientToScreen(This->RenderWnd->GetHWnd(),&dest);
|
2053 | | - UpdateLayeredWindow(This->RenderWnd->GetHWnd(),hRenderDC,&dest,&wnd,
|
2054 | | - This->dib.hdc,&srcpoint,0,&func,ULW_ALPHA);
|
| 2059 | + //ClientToScreen(This->RenderWnd->GetHWnd(),&dest);
|
| 2060 | + ClientToScreen(This->hWnd, &dest);
|
| 2061 | + /*UpdateLayeredWindow(This->RenderWnd->GetHWnd(),hRenderDC,&dest,&wnd,
|
| 2062 | + This->dib.hdc,&srcpoint,0,&func,ULW_ALPHA);*/
|
| 2063 | + UpdateLayeredWindow(This->hWnd, hRenderDC, &dest, &wnd,
|
| 2064 | + This->dib.hdc, &srcpoint, 0, &func, ULW_ALPHA);
|
2055 | 2065 | SelectObject(This->dib.hdc,hPrevObj);
|
2056 | | - ReleaseDC(This->RenderWnd->GetHWnd(),hRenderDC);
|
| 2066 | + //ReleaseDC(This->RenderWnd->GetHWnd(),hRenderDC);
|
| 2067 | + ReleaseDC(This->hWnd, hRenderDC);
|
2057 | 2068 | }
|
2058 | 2069 | if(setsync) SetEvent(This->busy);
|
2059 | 2070 |
|
— | — | @@ -2248,8 +2259,6 @@ |
2249 | 2260 | EnterCriticalSection(&dll_cs);
|
2250 | 2261 | wglMakeCurrent(NULL, NULL);
|
2251 | 2262 | ReleaseDC(This->hWnd,This->hDC);
|
2252 | | - delete This->RenderWnd;
|
2253 | | - This->RenderWnd = new glRenderWindow(width,height,fullscreen,newwnd,This->ddInterface, devwnd);
|
2254 | 2263 | PIXELFORMATDESCRIPTOR pfd;
|
2255 | 2264 | GLuint pf;
|
2256 | 2265 | InterlockedIncrement(&gllock);
|
— | — | @@ -2260,7 +2269,9 @@ |
2261 | 2270 | pfd.iPixelType = PFD_TYPE_RGBA;
|
2262 | 2271 | pfd.cColorBits = bpp;
|
2263 | 2272 | pfd.iLayerType = PFD_MAIN_PLANE;
|
2264 | | - This->hDC = GetDC(This->RenderWnd->GetHWnd());
|
| 2273 | + This->hWnd = newwnd;
|
| 2274 | + //This->hDC = GetDC(This->RenderWnd->GetHWnd());
|
| 2275 | + This->hDC = GetDC(This->hWnd);
|
2265 | 2276 | if(!This->hDC)
|
2266 | 2277 | DEBUG("glRenderer::SetWnd: Can not create hDC\n");
|
2267 | 2278 | pf = ChoosePixelFormat(This->hDC,&pfd);
|
Index: ddraw/glRenderer.h |
— | — | @@ -111,13 +111,11 @@ |
112 | 112 | #ifdef __cplusplus
|
113 | 113 | class glDirectDraw7;
|
114 | 114 | class glDirect3DDevice7;
|
115 | | -class glRenderWindow;
|
116 | 115 | struct glDirectDrawClipper;
|
117 | 116 | extern "C" {
|
118 | 117 | #else
|
119 | 118 | typedef int glDirectDraw7;
|
120 | 119 | typedef int glDirect3DDevice7;
|
121 | | -typedef int glRenderWindow;
|
122 | 120 | #endif
|
123 | 121 |
|
124 | 122 | /** @brief glRenderer struct
|
— | — | @@ -135,7 +133,6 @@ |
136 | 134 | HANDLE hThread;
|
137 | 135 | HDC hDC;
|
138 | 136 | HWND hWnd;
|
139 | | - glRenderWindow *RenderWnd;
|
140 | 137 | DIB dib;
|
141 | 138 | FBO fbo;
|
142 | 139 | BufferObject *pbo;
|
Index: ddraw/hooks.c |
— | — | @@ -19,8 +19,12 @@ |
20 | 20 | #include "hooks.h"
|
21 | 21 | #include <tlhelp32.h>
|
22 | 22 | #include "../minhook-1.3/include/MinHook.h"
|
23 | | -void glDirectDraw7_UnrestoreDisplayMode(LPDIRECTDRAW7 lpDD7); // temporary until glDirectDraw is converted to C
|
24 | 23 |
|
| 24 | +// temporary stuff until glDirectDraw is converted to C
|
| 25 | +void glDirectDraw7_UnrestoreDisplayMode(LPDIRECTDRAW7 lpDD7);
|
| 26 | +void glDirectDraw7_GetSizes(LPDIRECTDRAW7 lpDD7);
|
| 27 | +extern DXGLCFG dxglcfg;
|
| 28 | +
|
25 | 29 | const TCHAR *wndprop = _T("DXGLWndProc");
|
26 | 30 | const TCHAR *wndpropdd7 = _T("DXGLWndDD7");
|
27 | 31 | static HWND_HOOK *hwndhooks = NULL;
|
— | — | @@ -246,6 +250,11 @@ |
247 | 251 | }
|
248 | 252 | LRESULT CALLBACK DXGLWndHookProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
249 | 253 | {
|
| 254 | + int oldx, oldy;
|
| 255 | + float mulx, muly;
|
| 256 | + int translatex, translatey;
|
| 257 | + LPARAM newpos;
|
| 258 | + LONG sizes[6];
|
250 | 259 | WNDPROC parentproc;
|
251 | 260 | HWND_HOOK *wndhook;
|
252 | 261 | LPDIRECTDRAW7 lpDD7;
|
— | — | @@ -275,6 +284,41 @@ |
276 | 285 | if (lpDD7) glDirectDraw7_UnrestoreDisplayMode(lpDD7);
|
277 | 286 | }
|
278 | 287 | break;
|
| 288 | + case WM_MOUSEMOVE:
|
| 289 | + case WM_LBUTTONDOWN:
|
| 290 | + case WM_LBUTTONUP:
|
| 291 | + case WM_LBUTTONDBLCLK:
|
| 292 | + case WM_RBUTTONDOWN:
|
| 293 | + case WM_RBUTTONUP:
|
| 294 | + case WM_RBUTTONDBLCLK:
|
| 295 | + case WM_MBUTTONDOWN:
|
| 296 | + case WM_MBUTTONUP:
|
| 297 | + case WM_MBUTTONDBLCLK:
|
| 298 | + case WM_MOUSEWHEEL:
|
| 299 | + case WM_XBUTTONDOWN:
|
| 300 | + case WM_XBUTTONUP:
|
| 301 | + case WM_XBUTTONDBLCLK:
|
| 302 | + case WM_MOUSEHWHEEL:
|
| 303 | + if ((dxglcfg.scaler != 0) && lpDD7)
|
| 304 | + {
|
| 305 | + oldx = LOWORD(lParam);
|
| 306 | + oldy = HIWORD(lParam);
|
| 307 | + glDirectDraw7_GetSizes(lpDD7, sizes);
|
| 308 | + mulx = (float)sizes[2] / (float)sizes[0];
|
| 309 | + muly = (float)sizes[3] / (float)sizes[1];
|
| 310 | + translatex = (sizes[4] - sizes[0]) / 2;
|
| 311 | + translatey = (sizes[5] - sizes[1]) / 2;
|
| 312 | + oldx -= translatex;
|
| 313 | + oldy -= translatey;
|
| 314 | + oldx = (int)((float)oldx * mulx);
|
| 315 | + oldy = (int)((float)oldy * muly);
|
| 316 | + if (oldx < 0) oldx = 0;
|
| 317 | + if (oldy < 0) oldy = 0;
|
| 318 | + if (oldx >= sizes[2]) oldx = sizes[2] - 1;
|
| 319 | + if (oldy >= sizes[3]) oldy = sizes[3] - 1;
|
| 320 | + wParam = oldx + (oldy << 16);
|
| 321 | + }
|
| 322 | + break;
|
279 | 323 | }
|
280 | 324 | return CallWindowProc(parentproc, hWnd, uMsg, wParam, lParam);
|
281 | 325 | }
|
Index: ddraw/include/d3dtypes.h |
— | — | @@ -279,8 +279,8 @@ |
280 | 280 | } DUMMYUNIONNAME7;
|
281 | 281 | #if defined(__cplusplus) && defined(D3D_OVERLOADS)
|
282 | 282 | public:
|
283 | | - _D3DLVERTEX() {}
|
284 | | - _D3DLVERTEX(const D3DVECTOR& v, DWORD _color, DWORD _specular, float _tu, float _tv) {
|
| 283 | + _D3DLVERTEX() {} //-V730
|
| 284 | + _D3DLVERTEX(const D3DVECTOR& v, DWORD _color, DWORD _specular, float _tu, float _tv) { //-V730
|
285 | 285 | x = v.x; y = v.y; z = v.z;
|
286 | 286 | color = _color; specular = _specular;
|
287 | 287 | tu = _tu; tv = _tv;
|