1
0
mirror of https://github.com/DxWnd/DxWnd.reloaded synced 2024-12-30 09:25:35 +01:00

v2_03_35_src

Former-commit-id: 6cd1f5b22c8dc6e2e54a29d755c7b74f422e1cd2
This commit is contained in:
gho tik 2015-03-09 12:41:22 -04:00 committed by Refael ACkermann
parent fac41402f0
commit c4c0b5877f
38 changed files with 384 additions and 78 deletions

View File

@ -198,6 +198,8 @@
#define CONFIRMONCLOSE 0x00004000 // on close button, ask the user before closing the window / terminating the program
#define TERMINATEONCLOSE 0x00008000 // on WM_CLOSE message, also terminates the program
#define FLIPEMULATION 0x00010000 // create virtual primary and backbuffer as un-attached surfaces and replace Flip with Blt
#define SETZBUFFERBITDEPTHS 0x00020000 // when not set, set the legacy dwZBufferBitDepths field in the directdraw capability from GetCaps()
#define SHAREDDC 0x00040000 // enable sharing window DC and primary surface DC
// logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c01c7fd1f64f802d8807161a3d3e61c674473cb75ea1ce1b888b42c325af145d
size 581632
oid sha256:7974a9d6ece70e47422cce4c82daa4d31131c217d89aa967ad23993ba7a3268c
size 583680

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:36da51e4bf39269c8ad561b1573553024b8de8be9072da196c89e32955a2ffb8
size 541696
oid sha256:cd704d7423b954daf34806d31bb047aa8d606752a5fa6cd1f9f602b668c5e5f3
size 542208

View File

@ -6,10 +6,10 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=134218272
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=4
flagi0=4194308
tflag0=0
initx0=0
inity0=0
@ -25,3 +25,7 @@ maxfps0=0
initts0=0
winver0=0
maxres0=-1
notes0=
flagj0=128
flagk0=0
swapeffect0=0

View File

@ -0,0 +1,31 @@
[target]
title0=Avernum demo
path0=D:\Games\Avernum Demo\Avernum.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=136314914
flagg0=1745879040
flagh0=16
flagi0=138412036
flagj0=4224
flagk0=0
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=1200
sizy0=900
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,31 @@
[target]
title0=Banzai Bug
path0=D:\Games\Banzai Bug\EXE\RELEASE.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=1
coord0=0
flag0=685899810
flagg0=1207959680
flagh0=20
flagi0=138412036
flagj0=4224
flagk0=131072
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

31
build/exports/Cydonia.dxw Normal file
View File

@ -0,0 +1,31 @@
[target]
title0=Cydonia
path0=D:\Games\Cydonia\cydonia.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=136314914
flagg0=1207959552
flagh0=20
flagi0=138543108
flagj0=4224
flagk0=0
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,31 @@
[target]
title0=Diablo MP demo
path0=D:\Games\Diablo MP demo\diablo_s.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=136331298
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4225
flagk0=0
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -27,5 +27,5 @@ winver0=0
maxres0=0
notes0=
flagj0=128
flagk0=0
flagk0=65536
swapeffect0=0

View File

@ -27,3 +27,5 @@ maxres0=-1
launchpath0=
notes0=
flagj0=128
flagk0=65536
swapeffect0=0

View File

@ -27,3 +27,5 @@ maxfps0=0
initts0=0
winver0=0
maxres0=-1
flagk0=65536
swapeffect0=0

View File

@ -5,11 +5,11 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=704667680
flag0=704667682
flagg0=1208090896
flagh0=20
flagi0=4
tflag0=64
flagi0=4194308
tflag0=0
initx0=0
inity0=0
minx0=0
@ -24,3 +24,8 @@ maxfps0=0
initts0=0
winver0=0
maxres0=-1
launchpath0=
notes0=
flagj0=128
flagk0=65536
swapeffect0=0

View File

@ -27,5 +27,5 @@ maxres0=-1
launchpath0=
notes0=
flagj0=128
flagk0=0
flagk0=65536
swapeffect0=0

View File

@ -6,12 +6,12 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flag0=142606370
flagg0=1242562560
flagh0=20
flagi0=138413060
flagi0=205520900
flagj0=4224
tflag0=6151
tflag0=0
initx0=0
inity0=0
minx0=0
@ -26,3 +26,6 @@ maxfps0=0
initts0=0
winver0=0
maxres0=-1
notes0=
flagk0=0
swapeffect0=0

View File

@ -5,10 +5,10 @@ module0=
opengllib0=
ver0=0
coord0=0
flag0=704643104
flag0=704643106
flagg0=1207959552
flagh0=20
flagi0=4
flagi0=4194308
tflag0=0
initx0=0
inity0=0
@ -24,3 +24,8 @@ maxfps0=0
initts0=0
winver0=0
maxres0=-1
launchpath0=
notes0=
flagj0=128
flagk0=65536
swapeffect0=0

View File

@ -9,7 +9,7 @@ flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=4194308
tflag0=1024
tflag0=0
initx0=0
inity0=0
minx0=0
@ -26,3 +26,6 @@ winver0=0
maxres0=-1
launchpath0=
flagj0=128
notes0=
flagk0=65536
swapeffect0=0

View File

@ -5,10 +5,10 @@ module0=
opengllib0=
ver0=7
coord0=0
flag0=671088672
flagg0=134217728
flag0=671088674
flagg0=1207959552
flagh0=20
flagi0=1028
flagi0=4194308
tflag0=0
initx0=0
inity0=0
@ -24,3 +24,8 @@ maxfps0=0
initts0=0
winver0=0
maxres0=-1
launchpath0=
notes0=
flagj0=128
flagk0=65536
swapeffect0=0

View File

@ -26,3 +26,6 @@ launchpath0=
flagj0=128
winver0=0
maxres0=0
notes0=
flagk0=65536
swapeffect0=0

View File

@ -0,0 +1,31 @@
[target]
title0=The Sting!
path0=D:\Games\sting\Sting.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=136314914
flagg0=1207959552
flagh0=16
flagi0=138412036
flagj0=4224
flagk0=0
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -876,4 +876,15 @@ fix: protections for GDI ReleaseDC operations against null window or DC
v2.03.34:
fix: handling of real primary/backbuffer surfaces in non-emulated modes and WinXP: now uses system memory if possible, video memory otherwise.
fix: simulation of backbuffer attach in non emulated modes.
fix: mciSendString hooker, was losing a final command line argument
fix: mciSendString hooker, was losing a final command line argument
v2.03.35:
add: added "Set ZBufferBitDepths capability" flag to set a no longer supported fields in the capability structure. This makes ""Banzai Bug" bypass the capability checks.
fix: better handling of surface capabilities in flippable mode
fix: fixed bug in primary surface handling when already created ...
add: added ""Share ddraw and GDI DC" flag: sharing was introduced in release v2.03.19, but proved to be incompatible in many situations. Now it is off by default and enabled when necessary.
fix: the flags for disabling DDSCAPS_SYSTEMMEMORY capability are now used also in non-emulated flipping emulation mode. Depending on the video card, it may help getting compatibility.
fix: handling of NULL DC in non emulated modes: the NULL DC (corresponding to the whole desktop) is replaced by the window DC. This reduces problems like clearing the whole desktop.
fix: EnumDisplayModes was returning wrong modes list in SVGA mode.
fix: applied the error suppression to the DeleteAttachedSurface hooker.
fix: hooked User32 CreateRectRegion/Indirect calls.

View File

@ -1472,8 +1472,8 @@ static void HandleCapsD(char *sLabel, LPDDCAPS c)
c->dwFXCaps, ExplainDDFXCaps(c->dwFXCaps),
c->dwFXAlphaCaps, ExplainDDFXALPHACaps(c->dwFXAlphaCaps),
c->dwCKeyCaps, ExplainDDCKeyCaps(c->dwCKeyCaps));
OutTraceDDRAW("GetCaps(%s): VidMemTotal=%x VidMemFree=%x\n",
sLabel, c->dwVidMemTotal, c->dwVidMemFree);
OutTraceDDRAW("GetCaps(%s): VidMemTotal=%x VidMemFree=%x ZBufferBitDepths=%x(%s)\n",
sLabel, c->dwVidMemTotal, c->dwVidMemFree, c->dwZBufferBitDepths, ExplainZBufferBitDepths(c->dwZBufferBitDepths));
if(dxw.dwFlags2 & LIMITRESOURCES){ // check for memory value overflow
const DWORD dwMaxMem = 0x70000000;
if(c->dwVidMemTotal > dwMaxMem) c->dwVidMemTotal = dwMaxMem;
@ -1485,7 +1485,20 @@ static void HandleCapsD(char *sLabel, LPDDCAPS c)
c->dwVidMemTotal = dwHugeMem;
c->dwVidMemFree = dwHugeMem;
}
if((dxw.dwFlags5 & STRESSRESOURCES) || (dxw.dwFlags5 & STRESSRESOURCES))
if(dxw.dwFlags6 & SETZBUFFERBITDEPTHS){
// From MSDN https://msdn.microsoft.com/en-us/library/windows/desktop/gg426101%28v=vs.85%29.aspx :
// dwZBufferBitDepths
// DDBD_8, DDBD_16, DDBD_24, or DDBD_32. (Indicate 8, 16, 24, or 32 bits per pixel.)
// This member is obsolete for DirectX 6.0 and later.
// Use the IDirect3D7::EnumZBufferFormats to retrieve information about supported depth buffer formats.
// v2.03.35: needed to bypass the "Banzai Bug" initial controls
if (c->dwZBufferBitDepths == 0) {
c->dwZBufferBitDepths = (DDBD_8|DDBD_16|DDBD_24|DDBD_32);
OutTraceDDRAW("GetCaps(%s): FIXED ZBufferBitDepths=%x(%s)\n",
sLabel, c->dwZBufferBitDepths, ExplainZBufferBitDepths(c->dwZBufferBitDepths));
}
}
if((dxw.dwFlags5 & STRESSRESOURCES) || (dxw.dwFlags2 & LIMITRESOURCES))
OutTraceDDRAW("GetCaps(%s): FIXED VidMemTotal=%x VidMemFree=%x\n", sLabel, c->dwVidMemTotal, c->dwVidMemFree);
}
@ -2182,30 +2195,25 @@ static void ClearSurfaceDesc(void *ddsd, int dxversion)
((LPDDSURFACEDESC)ddsd)->dwSize = size;
}
static void BuildRealSurfaces(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurface, LPDDSURFACEDESC2 lpddsd, int dxversion)
static void BuildRealSurfaces(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurface, int dxversion)
{
HRESULT res;
DDSURFACEDESC2 ddsd;
OutTraceDW("DEBUG: BuildRealSurfaces: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
OutTraceDW("DEBUG: BuildRealSurfaces: lpdd=%x pCreateSurface=%x version=%d\n", lpdd, pCreateSurface, dxversion);
if(lpDDSEmu_Prim==NULL){
ClearSurfaceDesc((void *)&ddsd, dxversion);
ddsd.dwFlags = DDSD_CAPS;
// try DDSCAPS_SYSTEMMEMORY first, then suppress it if not supported
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE|DDSCAPS_SYSTEMMEMORY;
// no, DDSCAPS_SYSTEMMEMORY cause screen flickering while moving the window (and other troubles?)
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuPrim]", __LINE__));
res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0);
if(res==DDERR_INCOMPATIBLEPRIMARY) {
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuPrim]", __LINE__));
res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0);
}
if(res==DDERR_PRIMARYSURFACEALREADYEXISTS){
OutTraceDW("CreateSurface: ASSERT DDSEmu_Prim already exists\n");
if(dxw.Windowize){
// in Winowize mode, the desktop properties are untouched, then the current primary surface can be recycled
// in Windowize mode, the desktop properties are untouched, then the current primary surface can be recycled
res=(*pGetGDISurface)(lpdd, &lpDDSEmu_Prim);
(*pReleaseS)(lpDDSEmu_Prim);
}
else {
// in non-Windowized mode, the primary surface must be released and rebuilt with the proper properties
@ -2231,8 +2239,7 @@ static void BuildRealSurfaces(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurfa
if(lpDDSEmu_Back==NULL){
ClearSurfaceDesc((void *)&ddsd, dxversion);
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
//ddsd.ddsCaps.dwCaps = dwBackBufferCaps;
ddsd.ddsCaps.dwCaps = dwBackBufferCaps|DDSCAPS_SYSTEMMEMORY;
ddsd.ddsCaps.dwCaps = dwBackBufferCaps;
ddsd.dwWidth = dxw.GetScreenWidth();
ddsd.dwHeight = dxw.GetScreenHeight();
if(dxw.dwFlags4 & BILINEAR2XFILTER){
@ -2310,11 +2317,11 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
// this is important to avoid that certain D3D operations will abort - see "Forsaken" problem
if(dxw.dwFlags6 & NOSYSMEMBACKBUF) dwBackBufferCaps = DDSCAPS_OFFSCREENPLAIN;
bFlippedDC = TRUE;
if(dxw.dwFlags6 & SHAREDDC) bFlippedDC = TRUE;
if(dxw.dwFlags5 & GDIMODE) return DD_OK;
BuildRealSurfaces(lpdd, pCreateSurface, lpddsd, dxversion);
BuildRealSurfaces(lpdd, pCreateSurface, dxversion);
return DD_OK;
}
@ -2343,8 +2350,10 @@ static HRESULT BuildPrimaryFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea
if(!(lpddsd->dwFlags & DDSD_BACKBUFFERCOUNT) || (lpddsd->dwBackBufferCount == 0)) ddsd.dwBackBufferCount = 1;
// dwCaps
ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_PRIMARYSURFACE|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM);
ddsd.ddsCaps.dwCaps |= (DDSCAPS_COMPLEX|DDSCAPS_FLIP|DDSCAPS_OFFSCREENPLAIN);
ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_PRIMARYSURFACE|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM|DDSCAPS_FRONTBUFFER);
ddsd.ddsCaps.dwCaps |= (DDSCAPS_COMPLEX|DDSCAPS_FLIP|DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY);
// on WinXP Fifa 99 doesn't like DDSCAPS_SYSTEMMEMORY cap, so better to leave a way to unset it....
if(dxw.dwFlags6 & NOSYSMEMPRIMARY) ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
// dwWidth & dwHeight
ddsd.dwWidth = dxw.GetScreenWidth();
@ -2367,12 +2376,15 @@ static HRESULT BuildPrimaryFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCrea
// set a global capability value for surfaces that have to blit to primary
dwBackBufferCaps = (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY);
// on WinXP Fifa 99 doesn't like DDSCAPS_SYSTEMMEMORY cap, so better to leave a way to unset it....
// this is important to avoid that certain D3D operations will abort - see "Forsaken" problem
if(dxw.dwFlags6 & NOSYSMEMBACKBUF) dwBackBufferCaps = DDSCAPS_OFFSCREENPLAIN;
bFlippedDC = TRUE;
if(dxw.dwFlags6 & SHAREDDC) bFlippedDC = TRUE;
if(dxw.dwFlags5 & GDIMODE) return DD_OK;
BuildRealSurfaces(lpdd, pCreateSurface, lpddsd, dxversion);
BuildRealSurfaces(lpdd, pCreateSurface, dxversion);
return DD_OK;
}
@ -2488,6 +2500,7 @@ static HRESULT BuildBackBufferFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pC
HRESULT res;
OutTraceDW("DEBUG: BuildBackBufferFlippable: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
//MessageBox(NULL, "BuildBackBufferFlippable", "DxWnd", MB_OK);
// create BackBuffer surface
memcpy(&ddsd, lpddsd, lpddsd->dwSize);
@ -2495,8 +2508,8 @@ static HRESULT BuildBackBufferFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pC
ddsd.dwFlags &= ~(DDSD_BACKBUFFERCOUNT|DDSD_REFRESHRATE);
ddsd.dwFlags |= (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT);
ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_BACKBUFFER|DDSCAPS_PRIMARYSURFACE);
ddsd.ddsCaps.dwCaps |= (DDSCAPS_FLIP|DDSCAPS_COMPLEX|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM);
ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_PRIMARYSURFACE|DDSCAPS_FRONTBUFFER|DDSCAPS_BACKBUFFER|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM);
ddsd.ddsCaps.dwCaps |= (DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN);
ddsd.dwWidth = dxw.GetScreenWidth();
ddsd.dwHeight = dxw.GetScreenHeight();
@ -2675,6 +2688,57 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
return DD_OK;
}
static HRESULT BuildGenericFlippable(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurface, LPDDSURFACEDESC2 lpddsd, int dxversion, LPDIRECTDRAWSURFACE *lplpdds, void *pu)
{
DDSURFACEDESC2 ddsd;
HRESULT res;
OutTraceDW("DEBUG: BuildGenericFlippable: lpdd=%x pCreateSurface=%x lpddsd=%x version=%d\n", lpdd, pCreateSurface, lpddsd, dxversion);
memcpy(&ddsd, lpddsd, lpddsd->dwSize); // Copy over ....
FixSurfaceCaps(&ddsd, dxversion);
if(dxw.dwFlags6 & POWER2WIDTH){ // v2.03.28: POWER2WIDTH to fix "Midtown Madness" in surface emulation mode
if(((ddsd.dwFlags & (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH)) == (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH)) &&
(ddsd.ddsCaps.dwCaps & DDSCAPS_OFFSCREENPLAIN)
){
DWORD dwWidth;
dwWidth = ((ddsd.dwWidth + 3) >> 2) << 2;
if(dwWidth != ddsd.dwWidth) OutTraceDW("CreateSurface: fixed surface width %d->%d\n", ddsd.dwWidth, dwWidth);
ddsd.dwWidth = dwWidth;
}
}
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, pu);
if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res!=DD_OK)){
OutTraceDW("CreateSurface ERROR: res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__);
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, pu);
}
if (res) {
OutTraceE("CreateSurface: ERROR on Emu_Generic res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
OutTraceDW("CreateSurface: CREATED lpddsd=%x version=%d %s\n",
*lplpdds, dxversion, LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Emu Generic]", __LINE__));
// v2.02.66: if 8BPP paletized surface and a primary palette exixts, apply.
// fixes "Virtua Fighter PC" palette bug
if(lpDDP && (ddsd.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8)){
res=(*pSetPalette)(*lplpdds, lpDDP);
if(res)
OutTraceE("SetPalette: ERROR on lpdds=%x(Emu_Generic) res=%x(%s) at %d\n", *lplpdds, res, ExplainDDError(res), __LINE__);
else
OutTraceDW("CreateSurface: applied lpddp=%x to lpdds=%x\n", lpDDP, *lplpdds);
}
// diagnostic hooks ....
HookDDSurfaceGeneric(lplpdds, dxversion);
return DD_OK;
}
static HRESULT BuildGenericDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurface, LPDDSURFACEDESC2 lpddsd, int dxversion, LPDIRECTDRAWSURFACE *lplpdds, void *pu)
{
HRESULT res;
@ -2743,7 +2807,8 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate
BuildPrimary = BuildPrimaryFlippable;
BuildBackBuffer = BuildBackBufferFlippable;
AttachBackBuffer = AttachBackBufferFlippable;
BuildGeneric = BuildGenericEmu;
BuildGeneric = BuildGenericFlippable;
//BuildGeneric = BuildGenericEmu;
break;
case PRIMARY_EMULATED:
BuildPrimary = BuildPrimaryEmu;
@ -2974,10 +3039,16 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
lpBackBuffer = dxwss.GetBackBufferSurface();
if(lpBackBuffer){
*lplpddas = lpBackBuffer;
OutTraceDW("GetAttachedSurface(%d): SIMULATE attached to PRIM=%x\n", dxversion, lpdds);
OutTraceDW("GetAttachedSurface(%d): SIMULATE BACKBUF attach to PRIM=%x\n", dxversion, lpdds);
return DD_OK;
}
}
// arguable utility ....
if ((IsPrim || IsBack) && lpDDZBuffer && (lpddsc->dwCaps & DDSCAPS_ZBUFFER)){
*lplpddas = lpDDZBuffer;
OutTraceDW("GetAttachedSurface(%d): SIMULATE ZBUFFER attach to %s=%x\n", dxversion, IsPrim?"PRIM":"BACK", lpdds);
return DD_OK;
}
OutTraceE("GetAttachedSurface(%d): ERROR res=%x(%s) at %d\n", dxversion, res, ExplainDDError(res), __LINE__);
}
else {
@ -3350,18 +3421,6 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc,
OutTraceDDRAW("Flip: lpdds=%x%s, src=%x, flags=%x(%s)\n",
lpdds, IsPrim?"(PRIM)":"", lpddssrc, dwflags, ExplainFlipFlags(dwflags));
if (!(dxw.dwFlags6 & FLIPEMULATION) && 0) {
OutTrace("DEBUG: attempting actual Flip\n");
//res=(*pFlip)(lpdds, lpddssrc, dwflags);
res=(*pFlip)(lpdds, lpddssrc, 0);
if(res){
OutTraceE("Flip: ERROR res=%x(%s)\n", res, ExplainDDError(res));
return res;
}
if(dxw.dwFlags1 & EMULATESURFACE) dxw.ScreenRefresh();
return DD_OK;
}
if (!IsPrim){
if(lpddssrc){
res=(*pFlip)(lpdds, lpddssrc, dwflags);
@ -3822,8 +3881,10 @@ HRESULT WINAPI extLockDir(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACED
}
else{
// since it can't scale, at least the updated rect is centered into the window.
(*pGetClientRect)(dxw.GethWnd(), &client);
(*pClientToScreen)(dxw.GethWnd(), &upleft);
HWND hwnd;
hwnd = dxw.GethWnd();
(*pGetClientRect)(hwnd, &client);
(*pClientToScreen)(hwnd, &upleft);
if (!lprect) lprect=&client;
OffsetRect(lprect,
upleft.x+(client.right-dxw.GetScreenWidth())/2,
@ -4009,6 +4070,8 @@ ReleaseDC with Unlock, returning the surface memory ptr (???) as HDC
and avoiding the consistency check performed by surface::GetDC (why
should it bother if the screen is 32BPP and the surface is not??? */
// to do: double extGetDC/ReleaseDC in Emu/Dir mode ?
HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC)
{
HRESULT res;
@ -4016,6 +4079,14 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC)
IsPrim=dxwss.IsAPrimarySurface(lpdds);
OutTraceDDRAW("GetDC: lpdss=%x%s\n",lpdds, IsPrim?"(PRIM)":"");
// In non-emulated mode, better return the window DC rather than the actual primary surfce DC,
// because that would refer to the whole desktop
if (!(dxw.dwFlags1 & EMULATESURFACE) && IsPrim) {
*pHDC = (*pGDIGetDC)(dxw.GethWnd());
return DD_OK;
}
res=(*pGetDC)(lpdds, pHDC);
if (res==DDERR_CANTCREATEDC &&
@ -4069,7 +4140,8 @@ HRESULT WINAPI extFlipToGDISurface(LPDIRECTDRAW lpdd)
// res=(*pFlipToGDISurface)(lpdd);
// if (res) OutTraceE("FlipToGDISurface: ERROR res=%x(%s), skipping\n", res, ExplainDDError(res));
// pretend you flipped anyway....
bFlippedDC = TRUE;
if(dxw.dwFlags6 & SHAREDDC) bFlippedDC = TRUE;
return DD_OK;
}
@ -4189,15 +4261,6 @@ HRESULT WINAPI myEnumModesFilterDirect(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID l
if (IsDebug) EnumModesCallbackDumper(lpDDSurfaceDesc, NULL);
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
// if PREVENTMAXIMIZE is set, don't let the caller know about forbidden screen settings.
if((lpDDSurfaceDesc->dwHeight > dxw.GetScreenHeight()) ||
(lpDDSurfaceDesc->dwWidth > dxw.GetScreenWidth())){
OutTraceDW("EnumDisplayModes: skipping screen size=(%d,%d)\n", lpDDSurfaceDesc->dwHeight, lpDDSurfaceDesc->dwWidth);
return DDENUMRET_OK;
}
}
// tricky part: for each color depth related to current video resolution, fake each of the
// supported resolutions, unless is greater than maximum allowed
@ -4207,6 +4270,14 @@ HRESULT WINAPI myEnumModesFilterDirect(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID l
lpDDSurfaceDesc->dwHeight=SupportedRes[ResIdx].h;
lpDDSurfaceDesc->dwWidth=SupportedRes[ResIdx].w;
if((dxw.dwFlags4 & LIMITSCREENRES) && CheckResolutionLimit(lpDDSurfaceDesc)) return DDENUMRET_OK;
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
// if PREVENTMAXIMIZE is set, don't let the caller know about forbidden screen settings.
if((lpDDSurfaceDesc->dwHeight > dxw.GetScreenHeight()) ||
(lpDDSurfaceDesc->dwWidth > dxw.GetScreenWidth())){
OutTraceDW("EnumDisplayModes: skipping screen size=(%d,%d)\n", lpDDSurfaceDesc->dwHeight, lpDDSurfaceDesc->dwWidth);
return DDENUMRET_OK;
}
}
res=(*((NewContext_Type *)lpContext)->lpCallback)(lpDDSurfaceDesc, ((NewContext_Type *)lpContext)->lpContext);
OutTraceDW("EnumDisplayModes(D): proposed size[%d]=(%d,%d) res=%x\n", ResIdx, SupportedRes[ResIdx].w, SupportedRes[ResIdx].h, res);
if(res==DDENUMRET_CANCEL) break;
@ -4564,6 +4635,7 @@ HRESULT WINAPI extDeleteAttachedSurface(LPDIRECTDRAWSURFACE lpdds, DWORD dwflag
OutTraceDW("DeleteAttachedSurface: emulating surface detach lpdds=%x\n", lpddsdel);
res = DD_OK;
}
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK;
return res;
}
@ -4982,7 +5054,7 @@ HRESULT WINAPI extDirectDrawEnumerateEx(LPDDENUMCALLBACKEX lpCallback, LPVOID lp
ret=(*pDirectDrawEnumerateEx)(lpCallback, lpContext, dwFlags);
}
if(ret) OutTraceE("DirectDrawEnumerateEx: ERROR res=%x(%s)\n", ret, ExplainDDError(ret));
if(dxw.dwFlags1 & SUPPRESSDXERRORS) ret=0;
if(dxw.dwFlags1 & SUPPRESSDXERRORS) ret=DD_OK;
return ret;
}

View File

@ -1622,6 +1622,22 @@ char *ExplainRegionType(DWORD c)
return "unknown";
}
char *ExplainZBufferBitDepths(DWORD c)
{
static char eb[128];
unsigned int l;
strcpy(eb,"DDBD_");
if(c & DDBD_8) strcat(eb, "8+");
if(c & DDBD_16) strcat(eb, "16+");
if(c & DDBD_24) strcat(eb, "24+");
if(c & DDBD_32) strcat(eb, "32+");
l=strlen(eb);
if (l>strlen("DDBD_")) eb[l-1]=0; // delete last '+' if any
else strcpy(eb,"NULL");
return(eb);
}
#define _FACD3D 0x876
#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code )
#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code )

View File

@ -53,3 +53,4 @@ extern char *ExplainChangeDisplaySettingsFlags(DWORD);
extern char *ExplainDICooperativeFlags(DWORD);
extern char *ExplainRegionType(DWORD);
extern char *ExplainPixelFormat(LPDDPIXELFORMAT);
extern char *ExplainZBufferBitDepths(DWORD);

View File

@ -108,8 +108,8 @@ static char *Flag6Names[32]={
"FORCESWAPEFFECT", "LEGACYALLOC", "NODESTROYWINDOW", "NOMOVIES",
"SUPPRESSRELEASE", "FIXMOVIESCOLOR", "WOW64REGISTRY", "DISABLEMAXWINMODE",
"FIXPITCH", "POWER2WIDTH", "HIDETASKBAR", "ACTIVATEAPP",
"NOSYSMEMPRIMARY", "NOSYSMEMBACKBUF", "", "",
"", "", "", "",
"NOSYSMEMPRIMARY", "NOSYSMEMBACKBUF", "CONFIRMONCLOSE", "TERMINATEONCLOSE",
"FLIPEMULATION", "SETZBUFFERBITDEPTHS", "SHAREDDC", "",
"", "", "", "",
"", "", "", "",
"", "", "", "",

View File

@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "TlHelp32.h"
#define VERSION "2.03.34"
#define VERSION "2.03.35"
#define DDTHREADLOCK 1
//#define LOCKTHREADS

Binary file not shown.

View File

@ -118,8 +118,9 @@ static HookEntry_Type ScaledHooks[]={
// commented out since they alter text on screen...... (see Imperialism II difficulty level menu)
//{HOOK_IAT_CANDIDATE, "CreateEllipticRgn", (FARPROC)NULL, (FARPROC *)&pCreateEllipticRgn, (FARPROC)extCreateEllipticRgn},
//{HOOK_IAT_CANDIDATE, "CreateEllipticRgnIndirect", (FARPROC)NULL, (FARPROC *)&pCreateEllipticRgnIndirect, (FARPROC)extCreateEllipticRgnIndirect},
//{HOOK_IAT_CANDIDATE, "CreateRectRgn", (FARPROC)NULL, (FARPROC *)&pCreateRectRgn, (FARPROC)extCreateRectRgn},
//{HOOK_IAT_CANDIDATE, "CreateRectRgnIndirect", (FARPROC)NULL, (FARPROC *)&pCreateRectRgnIndirect, (FARPROC)extCreateRectRgnIndirect},
// CreateRectRgn must be hooked in scaled mode to let Avernum work correctly!
{HOOK_IAT_CANDIDATE, "CreateRectRgn", (FARPROC)NULL, (FARPROC *)&pCreateRectRgn, (FARPROC)extCreateRectRgn},
{HOOK_IAT_CANDIDATE, "CreateRectRgnIndirect", (FARPROC)NULL, (FARPROC *)&pCreateRectRgnIndirect, (FARPROC)extCreateRectRgnIndirect},
//{HOOK_IAT_CANDIDATE, "CreatePolygonRgn", (FARPROC)NULL, (FARPROC *)&pCreatePolygonRgn, (FARPROC)extCreatePolygonRgn},
// same as emulated GDI ...
{HOOK_IAT_CANDIDATE, "CreateCompatibleDC", (FARPROC)CreateCompatibleDC, (FARPROC *)&pGDICreateCompatibleDC, (FARPROC)extGDICreateCompatibleDC},

View File

@ -27,9 +27,15 @@ void BlitToWindow(HWND w, LPDIRECTDRAWSURFACE s)
if(!s) return; // for surface color fill
res=(*pGetDC)(s, &shdc);
if(res) OutTrace("ddraw GetDC error lpdds=%x res=%x(%s)\n", s, res, ExplainDDError(res));
if(res) {
OutTrace("ddraw GetDC error lpdds=%x res=%x(%s)\n", s, res, ExplainDDError(res));
return;
}
thdc=(*pGDIGetDC)(w);
if(!thdc) OutTrace("GDI GetDC error=%d\n", GetLastError());
if(!thdc) {
OutTrace("GDI GetDC error=%d\n", GetLastError());
return;
}
client = dxw.MapClientRect(NULL);
if(dxw.dwFlags5 & CENTERTOWIN){
int x, y;

View File

@ -36,6 +36,7 @@ void CTabDirect3D::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_FORCESHEL, cTarget->m_ForcesHEL);
DDX_Check(pDX, IDC_FIXREFCOUNTER, cTarget->m_FixRefCounter);
DDX_Check(pDX, IDC_RETURNNULLREF, cTarget->m_ReturnNullRef);
DDX_Check(pDX, IDC_SETZBUFFERBITDEPTHS, cTarget->m_SetZBufferBitDepths);
// Ddraw tweaks
DDX_Check(pDX, IDC_NOSYSMEMPRIMARY, cTarget->m_NoSysMemPrimary);

View File

@ -31,6 +31,7 @@ void CTabSysLibs::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_CLIENTREMAPPING, cTarget->m_ClientRemapping);
DDX_Radio(pDX, IDC_GDINONE, cTarget->m_DCEmulationMode);
DDX_Check(pDX, IDC_FIXTEXTOUT, cTarget->m_FixTextOut);
DDX_Check(pDX, IDC_SHAREDDC, cTarget->m_SharedDC);
// OpenGL
DDX_Check(pDX, IDC_HOOKOPENGL, cTarget->m_HookOpenGL); // duplicated

View File

@ -56,6 +56,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_NoImagehlp = FALSE;
m_ReplacePrivOps = FALSE;
m_ForcesHEL = FALSE;
m_SetZBufferBitDepths = FALSE;
m_ForcesSwapEffect = FALSE;
m_ColorFix = FALSE;
m_NoPixelFormat = FALSE;
@ -120,6 +121,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_CursorClipping = FALSE;
m_VideoToSystemMem = FALSE;
m_FixTextOut = FALSE;
m_SharedDC = TRUE; // seems better .....
m_HookGlide = FALSE;
m_RemapMCI = TRUE;
m_NoMovies = FALSE;

View File

@ -88,6 +88,7 @@ public:
BOOL m_CursorClipping;
BOOL m_VideoToSystemMem;
BOOL m_FixTextOut;
BOOL m_SharedDC;
BOOL m_HookGlide;
BOOL m_RemapMCI;
BOOL m_NoMovies;
@ -181,6 +182,7 @@ public:
BOOL m_DisableMaxWinMode;
BOOL m_NoImagehlp;
BOOL m_ForcesHEL;
BOOL m_SetZBufferBitDepths;
BOOL m_ForcesSwapEffect;
BOOL m_ColorFix;
BOOL m_NoPixelFormat;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -286,6 +286,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_DisableMaxWinMode) t->flags6 |= DISABLEMAXWINMODE;
if(dlg->m_NoImagehlp) t->flags5 |= NOIMAGEHLP;
if(dlg->m_ForcesHEL) t->flags3 |= FORCESHEL;
if(dlg->m_SetZBufferBitDepths) t->flags6 |= SETZBUFFERBITDEPTHS;
if(dlg->m_ForcesSwapEffect) t->flags6 |= FORCESWAPEFFECT;
if(dlg->m_ColorFix) t->flags3 |= COLORFIX;
if(dlg->m_NoPixelFormat) t->flags3 |= NOPIXELFORMAT;
@ -317,6 +318,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_CursorClipping) t->flags |= CLIPCURSOR;
if(dlg->m_VideoToSystemMem) t->flags |= SWITCHVIDEOMEMORY;
if(dlg->m_FixTextOut) t->flags |= FIXTEXTOUT;
if(dlg->m_SharedDC) t->flags6 |= SHAREDDC;
if(dlg->m_HookGlide) t->flags4 |= HOOKGLIDE;
if(dlg->m_RemapMCI) t->flags5 |= REMAPMCI;
if(dlg->m_NoMovies) t->flags6 |= NOMOVIES;
@ -498,6 +500,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_DisableMaxWinMode = t->flags6 & DISABLEMAXWINMODE ? 1 : 0;
dlg->m_NoImagehlp = t->flags5 & NOIMAGEHLP ? 1 : 0;
dlg->m_ForcesHEL = t->flags3 & FORCESHEL ? 1 : 0;
dlg->m_SetZBufferBitDepths = t->flags6 & SETZBUFFERBITDEPTHS ? 1 : 0;
dlg->m_ForcesSwapEffect = t->flags6 & FORCESWAPEFFECT ? 1 : 0;
dlg->m_ColorFix = t->flags3 & COLORFIX ? 1 : 0;
dlg->m_NoPixelFormat = t->flags3 & NOPIXELFORMAT ? 1 : 0;
@ -546,6 +549,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_CursorClipping = t->flags & CLIPCURSOR ? 1 : 0;
dlg->m_VideoToSystemMem = t->flags & SWITCHVIDEOMEMORY ? 1 : 0;
dlg->m_FixTextOut = t->flags & FIXTEXTOUT ? 1 : 0;
dlg->m_SharedDC = t->flags6 & SHAREDDC ? 1 : 0;
dlg->m_HookGlide = t->flags4 & HOOKGLIDE ? 1 : 0;
dlg->m_RemapMCI = t->flags5 & REMAPMCI ? 1 : 0;
dlg->m_NoMovies = t->flags6 & NOMOVIES ? 1 : 0;

Binary file not shown.

Binary file not shown.