Index: cfgmgr/cfgmgr.layout |
— | — | @@ -1,10 +0,0 @@ |
2 | | -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> |
3 | | -<CodeBlocks_layout_file> |
4 | | - <ActiveTarget name="Unicode Debug" /> |
5 | | - <File name="cfgmgr.cpp" open="0" top="0" tabpos="0"> |
6 | | - <Cursor position="10558" topLine="305" /> |
7 | | - </File> |
8 | | - <File name="stdafx.h" open="0" top="0" tabpos="0"> |
9 | | - <Cursor position="972" topLine="0" /> |
10 | | - </File> |
11 | | -</CodeBlocks_layout_file> |
Index: cfgmgr |
Property changes on: cfgmgr |
___________________________________________________________________ |
Modified: svn:ignore |
## -4,3 +4,4 ## |
12 | 1 | Release |
13 | 2 | Release no DXGL |
14 | 3 | bin |
| 4 | +*.cbTemp |
Index: common/common.layout |
— | — | @@ -1,4 +0,0 @@ |
2 | | -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> |
3 | | -<CodeBlocks_layout_file> |
4 | | - <ActiveTarget name="Debug" /> |
5 | | -</CodeBlocks_layout_file> |
Index: dxglcfg/dxglcfg.layout |
— | — | @@ -1,7 +0,0 @@ |
2 | | -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> |
3 | | -<CodeBlocks_layout_file> |
4 | | - <ActiveTarget name="Debug" /> |
5 | | - <File name="dxglcfg.cpp" open="1" top="0" tabpos="1"> |
6 | | - <Cursor position="37000" topLine="0" /> |
7 | | - </File> |
8 | | -</CodeBlocks_layout_file> |
Index: ddraw/ddraw.cpp |
— | — | @@ -30,8 +30,9 @@ |
31 | 31 | const GUID device_template =
|
32 | 32 | { 0x9ff8900, 0x8c4a, 0x4ba4, { 0xbf, 0x29, 0x56, 0x50, 0x4a, 0xf, 0x3b, 0xb3 } };
|
33 | 33 |
|
| 34 | +DWORD timer;
|
| 35 | +int vsyncstatus;
|
34 | 36 |
|
35 | | -
|
36 | 37 | DDRAW_API void WINAPI AcquireDDThreadLock()
|
37 | 38 | {
|
38 | 39 | // FIXME: Add thread lock
|
Index: ddraw/ddraw.h |
— | — | @@ -58,5 +58,8 @@ |
59 | 59 |
|
60 | 60 | extern DXGLCFG dxglcfg;
|
61 | 61 | extern bool gllock;
|
| 62 | +extern DWORD timer;
|
| 63 | +extern int vsyncstatus;
|
62 | 64 |
|
| 65 | +
|
63 | 66 | #endif //_DDRAW_H |
\ No newline at end of file |
Index: ddraw/ddraw.vcxproj |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | <SubSystem>Windows</SubSystem>
|
91 | 91 | <GenerateDebugInformation>true</GenerateDebugInformation>
|
92 | 92 | <ModuleDefinitionFile>ddraw.def</ModuleDefinitionFile>
|
93 | | - <AdditionalDependencies>$(OutDir)cfgmgr.lib;glu32.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
| 93 | + <AdditionalDependencies>$(OutDir)cfgmgr.lib;glu32.lib;opengl32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
94 | 94 | </Link>
|
95 | 95 | </ItemDefinitionGroup>
|
96 | 96 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug no DXGL|Win32'">
|
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -553,6 +553,7 @@ |
554 | 554 | fpusetup = false;
|
555 | 555 | threadsafe = false;
|
556 | 556 | nowindowchanges = false;
|
| 557 | + timer = timeGetTime();
|
557 | 558 | ZeroMemory(&oldmode,sizeof(DEVMODE));
|
558 | 559 | surfaces = (glDirectDrawSurface7 **)malloc(1024*sizeof(glDirectDrawSurface7 *));
|
559 | 560 | if(!surfaces)
|
— | — | @@ -776,7 +777,8 @@ |
777 | 778 | else ERR(DDERR_INVALIDPARAMS);
|
778 | 779 | ddCaps.dwCaps = DDCAPS_BLT | DDCAPS_BLTCOLORFILL | DDCAPS_BLTSTRETCH |
|
779 | 780 | DDCAPS_GDI | DDCAPS_PALETTE | DDCAPS_CANBLTSYSMEM;
|
780 | | - ddCaps.dwCaps2 = DDCAPS2_CANRENDERWINDOWED | DDCAPS2_WIDESURFACES | DDCAPS2_NOPAGELOCKREQUIRED;
|
| 781 | + ddCaps.dwCaps2 = DDCAPS2_CANRENDERWINDOWED | DDCAPS2_WIDESURFACES | DDCAPS2_NOPAGELOCKREQUIRED |
|
| 782 | + DDCAPS2_FLIPINTERVAL | DDCAPS2_FLIPNOVSYNC;
|
781 | 783 | ddCaps.dwFXCaps = DDFXCAPS_BLTSHRINKX | DDFXCAPS_BLTSHRINKY |
|
782 | 784 | DDFXCAPS_BLTSTRETCHX | DDFXCAPS_BLTSTRETCHY;
|
783 | 785 | ddCaps.dwPalCaps = DDPCAPS_8BIT | DDPCAPS_PRIMARYSURFACE;
|
— | — | @@ -1198,9 +1200,9 @@ |
1199 | 1201 | HRESULT WINAPI glDirectDraw7::WaitForVerticalBlank(DWORD dwFlags, HANDLE hEvent)
|
1200 | 1202 | {
|
1201 | 1203 | if(dwFlags & DDWAITVB_BLOCKBEGINEVENT) return DDERR_UNSUPPORTED;
|
1202 | | - if(wglSwapIntervalEXT) wglSwapIntervalEXT(1);
|
| 1204 | + SetSwap(1);
|
1203 | 1205 | primary->RenderScreen(primary->texture,primary);
|
1204 | | - if(wglSwapIntervalEXT) wglSwapIntervalEXT(0);
|
| 1206 | + SetSwap(0);
|
1205 | 1207 | return DD_OK;
|
1206 | 1208 | }
|
1207 | 1209 | HRESULT WINAPI glDirectDraw7::GetAvailableVidMem(LPDDSCAPS2 lpDDSCaps2, LPDWORD lpdwTotal, LPDWORD lpdwFree)
|
— | — | @@ -1303,9 +1305,14 @@ |
1304 | 1306 | hRenderWnd = CreateWindowA("DXGLRenderWindow","Renderer",WS_CHILD|WS_VISIBLE,0,0,rectRender.right - rectRender.left,
|
1305 | 1307 | rectRender.bottom - rectRender.top,hWnd,NULL,NULL,this);
|
1306 | 1308 | SetWindowPos(hRenderWnd,HWND_TOP,0,0,rectRender.right,rectRender.bottom,SWP_SHOWWINDOW);
|
1307 | | - PIXELFORMATDESCRIPTOR pfd =
|
1308 | | - {sizeof(PIXELFORMATDESCRIPTOR),1,PFD_SUPPORT_OPENGL,bpp,
|
1309 | | - 0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,PFD_MAIN_PLANE,0,0,0,0};
|
| 1309 | + PIXELFORMATDESCRIPTOR pfd;
|
| 1310 | + ZeroMemory(&pfd,sizeof(PIXELFORMATDESCRIPTOR));
|
| 1311 | + pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
| 1312 | + pfd.nVersion = 1;
|
| 1313 | + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
| 1314 | + pfd.iPixelType = PFD_TYPE_RGBA;
|
| 1315 | + pfd.cColorBits = bpp;
|
| 1316 | + pfd.iLayerType = PFD_MAIN_PLANE;
|
1310 | 1317 | hDC = GetDC(hRenderWnd);
|
1311 | 1318 | if(!hDC)
|
1312 | 1319 | {
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -24,6 +24,16 @@ |
25 | 25 | #include "glDirectDrawPalette.h"
|
26 | 26 | #include "glDirectDrawClipper.h"
|
27 | 27 |
|
| 28 | +int swapinterval;
|
| 29 | +inline void SetSwap(int swap)
|
| 30 | +{
|
| 31 | + if(swap != swapinterval)
|
| 32 | + {
|
| 33 | + wglSwapIntervalEXT(swap);
|
| 34 | + swapinterval = swap;
|
| 35 | + }
|
| 36 | +}
|
| 37 | +
|
28 | 38 | inline int NextMultipleOf8(int number){return ((number+7) & (~7));}
|
29 | 39 | inline int NextMultipleOf4(int number){return ((number+3) & (~3));}
|
30 | 40 | inline int NextMultipleOf2(int number){return ((number+1) & (~1));}
|
— | — | @@ -715,6 +725,16 @@ |
716 | 726 | }
|
717 | 727 | HRESULT WINAPI glDirectDrawSurface7::Flip(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags)
|
718 | 728 | {
|
| 729 | + int test;
|
| 730 | + if(dwFlags & DDFLIP_NOVSYNC) SetSwap(0);
|
| 731 | + else
|
| 732 | + {
|
| 733 | + if(dwFlags & DDFLIP_INTERVAL3) SetSwap(3);
|
| 734 | + else if(dwFlags & DDFLIP_INTERVAL2) SetSwap(2);
|
| 735 | + else if(dwFlags & DDFLIP_INTERVAL4) SetSwap(4);
|
| 736 | + else SetSwap(1);
|
| 737 | + }
|
| 738 | +
|
719 | 739 | int flips = 1;
|
720 | 740 | if(lpDDSurfaceTargetOverride) ERR(DDERR_GENERIC);
|
721 | 741 | if(ddsd.ddsCaps.dwCaps & DDSCAPS_FLIP)
|
Index: ddraw/glDirectDrawSurface.h |
— | — | @@ -19,6 +19,8 @@ |
20 | 20 | #ifndef _GLDIRECTDRAWSURFACE_H
|
21 | 21 | #define _GLDIRECTDRAWSURFACE_H
|
22 | 22 |
|
| 23 | +extern inline void SetSwap(int swap);
|
| 24 | +
|
23 | 25 | typedef struct
|
24 | 26 | {
|
25 | 27 | bool enabled;
|