mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_03_66_src
Former-commit-id: 85c5e03a28b8f21052b683221c8fe9361852ae6d
This commit is contained in:
parent
b411ad17ff
commit
be8f7c439b
@ -55,7 +55,7 @@
|
||||
#define INIT16BPP 0x00000080 // simulate a 16BPP initial desktop setting (in GetDeviceCaps API)
|
||||
#define KEEPCURSORFIXED 0x00000100 // inhibit SetCursorPos operation
|
||||
#define DISABLEGAMMARAMP 0x00000200 // let the application retrieve the desktop DC (for capability queries)
|
||||
//#define DIFFERENTIALMOUSE 0x00000400 // emulates the 360-degrees-free-running mouse style....
|
||||
#define INDEPENDENTREFRESH 0x00000400 // Makes automatic primary surface refresh but independently from the message loop processing
|
||||
#define FIXNCHITTEST 0x00000800 // fixes WM_NCHITTEST message X,Y coordinates
|
||||
#define LIMITFPS 0x00001000 // delays primary blit operations to limit FPS
|
||||
#define SKIPFPS 0x00002000 // skips primary blit operations up to limit
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0911330dda18c4e1fb5f3caa8c1b951a333f79a64f3fe23b3eaf9d65225391b7
|
||||
size 647680
|
||||
oid sha256:3bd601d4523889f0cf019a183f5bc5476c5c03662c5f5a93a98686354056a73c
|
||||
size 648704
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6a8148495ebac5bf9b0f2298eaaab28a3572c88cc967ecebbef876b60cf8eb95
|
||||
oid sha256:740b5c2156b6965fee001072a8910fe5a3ae4523be53ac3e041723fa50361df1
|
||||
size 567296
|
||||
|
@ -1,97 +0,0 @@
|
||||
[window]
|
||||
posx=950
|
||||
posy=64
|
||||
sizx=320
|
||||
sizy=200
|
||||
exportpath=D:\DxWnd\exports.ok\
|
||||
exepath=D:\Games\Restricted Area\
|
||||
[keymapping]
|
||||
corner=0x78
|
||||
fullscreen=0x0D
|
||||
workarea=0x7A
|
||||
desktop=0x7B
|
||||
[target]
|
||||
title0=Betrayal in Antara
|
||||
path0=D:\Games\Betrayal in Antara\ANTARAR.EXE
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=681574434
|
||||
flagg0=1207959552
|
||||
flagh0=20
|
||||
flagi0=-2011168764
|
||||
flagj0=4224
|
||||
flagk0=65536
|
||||
flagl0=0
|
||||
flagm0=0
|
||||
dflag0=0
|
||||
posx0=50
|
||||
posy0=50
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
||||
swapeffect0=0
|
||||
maxddinterface0=7
|
||||
title1=Silver
|
||||
path1=D:\Games\Silver\silver.exe
|
||||
launchpath1=
|
||||
module1=
|
||||
opengllib1=
|
||||
notes1=
|
||||
registry1=
|
||||
ver1=0
|
||||
coord1=0
|
||||
flag1=136314998
|
||||
flagg1=1208483856
|
||||
flagh1=20
|
||||
flagi1=138412036
|
||||
flagj1=4224
|
||||
flagk1=268500992
|
||||
flagl1=0
|
||||
flagm1=0
|
||||
dflag1=0
|
||||
posx1=-1250
|
||||
posy1=50
|
||||
sizx1=800
|
||||
sizy1=600
|
||||
maxfps1=0
|
||||
initts1=0
|
||||
winver1=0
|
||||
maxres1=-1
|
||||
swapeffect1=0
|
||||
maxddinterface1=7
|
||||
title2=Restricted Area
|
||||
path2=D:\Games\Restricted Area\Ra.exe
|
||||
launchpath2=
|
||||
module2=
|
||||
opengllib2=
|
||||
notes2=
|
||||
registry2=
|
||||
ver2=0
|
||||
coord2=0
|
||||
flag2=681574434
|
||||
flagg2=1744830464
|
||||
flagh2=20
|
||||
flagi2=138412038
|
||||
flagj2=4224
|
||||
flagk2=327680
|
||||
flagl2=0
|
||||
flagm2=0
|
||||
dflag2=0
|
||||
posx2=50
|
||||
posy2=50
|
||||
sizx2=800
|
||||
sizy2=600
|
||||
maxfps2=0
|
||||
initts2=0
|
||||
winver2=0
|
||||
maxres2=-1
|
||||
swapeffect2=0
|
||||
maxddinterface2=7
|
30
build/exports/Microsoft Golf 2001.dxw
Normal file
30
build/exports/Microsoft Golf 2001.dxw
Normal file
@ -0,0 +1,30 @@
|
||||
[target]
|
||||
title0=Microsoft Golf 2001
|
||||
path0=D:\Games\msgolf2001\golf2001.exe
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=-2011148254
|
||||
flagg0=1207960576
|
||||
flagh0=20
|
||||
flagi0=138412036
|
||||
flagj0=69210240
|
||||
flagk0=327680
|
||||
flagl0=0
|
||||
flagm0=0
|
||||
tflag0=0
|
||||
dflag0=0
|
||||
posx0=50
|
||||
posy0=50
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
||||
swapeffect0=0
|
||||
maxddinterface0=7
|
@ -1097,4 +1097,8 @@ fix: updated RedrawWindow, now allows better handling of "Galapagos" pause scree
|
||||
|
||||
v2.03.65
|
||||
fix: handling of fullscreen switching on closest monitor (in multimonitor systems)
|
||||
fix: X,Y starting win position can now be negative integer (in multimonitor systems)
|
||||
fix: X,Y starting win position can now be negative integer (in multimonitor systems)
|
||||
|
||||
v2.03.66
|
||||
fix: terminated the separation between ddraw method interfaces
|
||||
fix: force clipper now builds a clipper for the real primary surface (useful when desktop composition is disabled)
|
@ -13,13 +13,13 @@
|
||||
extern LPDIRECTDRAWSURFACE lpDDSEmu_Prim;
|
||||
extern LPDIRECTDRAW lpPrimaryDD;
|
||||
extern Blt_Type pBlt;
|
||||
extern ReleaseS_Type pReleaseSMethod();
|
||||
extern ReleaseS_Type pReleaseSMethod(int);
|
||||
extern CreateSurface1_Type pCreateSurface1;
|
||||
extern CreateSurface1_Type pCreateSurface2;
|
||||
extern CreateSurface1_Type pCreateSurface3;
|
||||
extern CreateSurface2_Type pCreateSurface4;
|
||||
extern CreateSurface2_Type pCreateSurface7;
|
||||
extern Unlock4_Type pUnlockMethod();
|
||||
extern Unlock4_Type pUnlockMethod(int);
|
||||
extern HDC hFlippedDC;
|
||||
extern BOOL bFlippedDC;
|
||||
extern ReleaseDC_Type pReleaseDC1;
|
||||
@ -31,7 +31,7 @@ extern ReleaseDC_Type pReleaseDC7;
|
||||
extern void BlitError(HRESULT, LPRECT, LPRECT, int);
|
||||
extern void BlitTrace(char *, LPRECT, LPRECT, int);
|
||||
extern void DescribeSurface(LPDIRECTDRAWSURFACE, int, char *, int);
|
||||
extern void TextureHandling(LPDIRECTDRAWSURFACE);
|
||||
extern void TextureHandling(LPDIRECTDRAWSURFACE, int);
|
||||
extern GetSurfaceDesc2_Type pGetSurfaceDescMethod();
|
||||
extern int GetSurfaceDescSize();
|
||||
extern GetSurfaceDesc2_Type GetSurfaceDescMethod();
|
||||
@ -97,8 +97,8 @@ static HRESULT sBltNoPrimary(int dxversion, Blt_Type pBlt, char *api, LPDIRECTDR
|
||||
// }
|
||||
// break;
|
||||
case DDERR_SURFACEBUSY:
|
||||
(*pUnlockMethod())(lpdds, NULL);
|
||||
if (lpddssrc) (*pUnlockMethod())(lpddssrc, NULL);
|
||||
(*pUnlockMethod(dxversion))(lpdds, NULL);
|
||||
if (lpddssrc) (*pUnlockMethod(dxversion))(lpddssrc, NULL);
|
||||
if (IsDebug) BlitTrace("BUSY", lpsrcrect ? &srcrect : NULL, lpdestrect, __LINE__);
|
||||
res=(*pBlt)(lpdds, lpdestrect, lpddssrc, lpsrcrect ? &srcrect : NULL, dwflags|DDBLT_WAIT, lpddbltfx);
|
||||
break;
|
||||
@ -113,7 +113,7 @@ static HRESULT sBltNoPrimary(int dxversion, Blt_Type pBlt, char *api, LPDIRECTDR
|
||||
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0;
|
||||
if(dxw.dwFlags5 & TEXTUREMASK) {
|
||||
// Texture Handling on Blt
|
||||
TextureHandling(lpdds);
|
||||
TextureHandling(lpdds, dxversion);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -202,8 +202,8 @@ static HRESULT sBltToPrimary(int dxversion, Blt_Type pBlt, char *api, LPDIRECTDR
|
||||
}
|
||||
// Try to handle HDC lock concurrency....
|
||||
if(res==DDERR_SURFACEBUSY){
|
||||
(*pUnlockMethod())(lpdds, NULL);
|
||||
if(lpddssrc) (*pUnlockMethod())(lpdds, NULL);
|
||||
(*pUnlockMethod(dxversion))(lpdds, NULL);
|
||||
if(lpddssrc) (*pUnlockMethod(dxversion))(lpdds, NULL);
|
||||
if (IsDebug) BlitTrace("BUSY", lpsrcrect, &destrect, __LINE__);
|
||||
res= (*pBlt)(lpdds, &destrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx);
|
||||
if (res) BlitError(res, lpsrcrect, &destrect, __LINE__);
|
||||
@ -213,12 +213,12 @@ static HRESULT sBltToPrimary(int dxversion, Blt_Type pBlt, char *api, LPDIRECTDR
|
||||
// to do: handle possible situations with surface 2 / 4 / 7 types
|
||||
DDSURFACEDESC2 ddsd;
|
||||
LPDIRECTDRAWSURFACE2 lpddsTmp;
|
||||
extern CreateSurface2_Type pCreateSurfaceMethod();
|
||||
extern CreateSurface2_Type pCreateSurfaceMethod(int);
|
||||
if (IsDebug) BlitTrace("KEYSRC", lpsrcrect, &destrect, __LINE__);
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = GetSurfaceDescSize();
|
||||
(*pGetSurfaceDescMethod())((LPDIRECTDRAWSURFACE2)lpddssrc, &ddsd);
|
||||
res=(*pCreateSurfaceMethod())(lpPrimaryDD, &ddsd, (LPDIRECTDRAWSURFACE *)&lpddsTmp, NULL);
|
||||
res=(*pCreateSurfaceMethod(dxversion))(lpPrimaryDD, &ddsd, (LPDIRECTDRAWSURFACE *)&lpddsTmp, NULL);
|
||||
if(res) OutTraceE("CreateSurface: ERROR %x(%s) at %d", res, ExplainDDError(res), __LINE__);
|
||||
// copy background
|
||||
res= (*pBlt)((LPDIRECTDRAWSURFACE)lpddsTmp, lpsrcrect, lpdds, &destrect, DDBLT_WAIT, NULL);
|
||||
@ -230,7 +230,7 @@ static HRESULT sBltToPrimary(int dxversion, Blt_Type pBlt, char *api, LPDIRECTDR
|
||||
res= (*pBlt)(lpdds, &destrect, (LPDIRECTDRAWSURFACE)lpddsTmp, lpsrcrect, DDBLT_WAIT, lpddbltfx);
|
||||
if(res) OutTraceE("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), __LINE__);
|
||||
if (res) BlitError(res, lpsrcrect, &destrect, __LINE__);
|
||||
(*pReleaseSMethod())((LPDIRECTDRAWSURFACE)lpddsTmp);
|
||||
(*pReleaseSMethod(dxversion))((LPDIRECTDRAWSURFACE)lpddsTmp);
|
||||
}
|
||||
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK;
|
||||
}
|
||||
@ -309,10 +309,10 @@ static HRESULT sBltToPrimary(int dxversion, Blt_Type pBlt, char *api, LPDIRECTDR
|
||||
|
||||
// v2.03.49: resumed because if fixes locked surfaces on "Red Alert 1" on WinXP as reported by cloudstr
|
||||
if(lpddssrc) { // lpddssrc could be NULL!!!
|
||||
res=(*pUnlockMethod())(lpddssrc, NULL);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, NULL);
|
||||
if(res && (res!=DDERR_NOTLOCKED)) OutTraceE("Unlock ERROR: lpdds=%x err=%x(%s)\n", lpddssrc, res, ExplainDDError(res));
|
||||
}
|
||||
res=(*pUnlockMethod())(lpdds, NULL); // v2.03.24 reintroduced because of "Virtua Cop"
|
||||
res=(*pUnlockMethod(dxversion))(lpdds, NULL); // v2.03.24 reintroduced because of "Virtua Cop"
|
||||
if(res && (res!=DDERR_NOTLOCKED)) OutTraceE("Unlock ERROR: lpdds=%x err=%x(%s)\n", lpdds, res, ExplainDDError(res));
|
||||
|
||||
if (IsDebug) BlitTrace("BUSY", &emurect, &destrect, __LINE__);
|
||||
|
125
dll/ddraw.cpp
125
dll/ddraw.cpp
@ -17,7 +17,7 @@
|
||||
|
||||
extern BOOL IsChangeDisplaySettingsHotPatched;
|
||||
DWORD dwBackBufferCaps;
|
||||
extern void TextureHandling(LPDIRECTDRAWSURFACE);
|
||||
extern void TextureHandling(LPDIRECTDRAWSURFACE, int);
|
||||
extern void SetMinimalCaps(LPDDCAPS, LPDDCAPS);
|
||||
ColorConversion_Type pColorConversion = NULL;
|
||||
|
||||
@ -368,6 +368,7 @@ LPDIRECTDRAWSURFACE lpDDZBuffer=NULL;
|
||||
LPDIRECTDRAW lpPrimaryDD=NULL;
|
||||
int iBakBufferVersion;
|
||||
LPDIRECTDRAWPALETTE lpDDP=NULL;
|
||||
LPDIRECTDRAWCLIPPER lpddC=NULL;
|
||||
int iDDPExtraRefCounter=0;
|
||||
// v2.02.37: globals to store requested main surface capabilities
|
||||
DDSURFACEDESC2 DDSD_Prim;
|
||||
@ -602,6 +603,7 @@ void InitDSScreenParameters(int dxversion, LPDIRECTDRAWSURFACE lpdds)
|
||||
case 4: pGetPixelFormat=pGetPixelFormat4; break;
|
||||
case 7: pGetPixelFormat=pGetPixelFormat7; break;
|
||||
}
|
||||
//OutTrace("dxversion=%d pGetPixelFormat=%x\n", dxversion, pGetPixelFormat);
|
||||
p.dwSize=sizeof(DDPIXELFORMAT);
|
||||
if(res=(*pGetPixelFormat)(lpdds, &p)){
|
||||
OutTraceE("GetPixelFormat: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
@ -838,10 +840,10 @@ SetPalette_Type pSetPaletteMethod(int dxversion)
|
||||
return pSetPalette;
|
||||
}
|
||||
|
||||
ReleaseS_Type pReleaseSMethod()
|
||||
ReleaseS_Type pReleaseSMethod(int dxversion)
|
||||
{
|
||||
ReleaseS_Type pReleaseS;
|
||||
switch(iBakBufferVersion){
|
||||
switch(dxversion){
|
||||
case 1: pReleaseS=pReleaseS1; break;
|
||||
case 2: pReleaseS=pReleaseS2; break;
|
||||
case 3: pReleaseS=pReleaseS3; break;
|
||||
@ -864,6 +866,19 @@ ReleaseDC_Type pReleaseDCMethod()
|
||||
return pReleaseDC;
|
||||
}
|
||||
|
||||
SetClipper_Type pSetClipperMethod(int dxversion)
|
||||
{
|
||||
SetClipper_Type pSetClipper;
|
||||
switch(dxversion){
|
||||
case 1: pSetClipper=pSetClipper1; break;
|
||||
case 2: pSetClipper=pSetClipper2; break;
|
||||
case 3: pSetClipper=pSetClipper3; break;
|
||||
case 4: pSetClipper=pSetClipper4; break;
|
||||
case 7: pSetClipper=pSetClipper7; break;
|
||||
}
|
||||
return pSetClipper;
|
||||
}
|
||||
|
||||
Blt_Type pBltMethod()
|
||||
{
|
||||
Blt_Type pBlt;
|
||||
@ -890,10 +905,10 @@ GetDC_Type pGetDCMethod()
|
||||
return pGetDC;
|
||||
}
|
||||
|
||||
Unlock4_Type pUnlockMethod()
|
||||
Unlock4_Type pUnlockMethod(int dxversion)
|
||||
{
|
||||
Unlock4_Type pUnlock;
|
||||
switch(iBakBufferVersion){
|
||||
switch(dxversion){
|
||||
case 1: pUnlock=(Unlock4_Type)pUnlock1; break;
|
||||
case 2: pUnlock=(Unlock4_Type)pUnlock2; break;
|
||||
case 3: pUnlock=(Unlock4_Type)pUnlock3; break;
|
||||
@ -903,10 +918,10 @@ Unlock4_Type pUnlockMethod()
|
||||
return pUnlock;
|
||||
}
|
||||
|
||||
Lock_Type pLockMethod()
|
||||
Lock_Type pLockMethod(int dxversion)
|
||||
{
|
||||
Lock_Type pLock;
|
||||
switch(iBakBufferVersion){
|
||||
switch(dxversion){
|
||||
case 1: pLock=pLock1; break;
|
||||
case 2: pLock=pLock2; break;
|
||||
case 3: pLock=pLock3; break;
|
||||
@ -916,10 +931,10 @@ Lock_Type pLockMethod()
|
||||
return pLock;
|
||||
}
|
||||
|
||||
CreateSurface2_Type pCreateSurfaceMethod()
|
||||
CreateSurface2_Type pCreateSurfaceMethod(int dxversion)
|
||||
{
|
||||
CreateSurface2_Type pCreateSurface;
|
||||
switch(iBakBufferVersion){
|
||||
switch(dxversion){
|
||||
case 1: pCreateSurface=(CreateSurface2_Type)pCreateSurface1; break;
|
||||
case 2: pCreateSurface=(CreateSurface2_Type)pCreateSurface2; break;
|
||||
case 3: pCreateSurface=(CreateSurface2_Type)pCreateSurface3; break;
|
||||
@ -943,6 +958,19 @@ GetSurfaceDesc2_Type pGetSurfaceDescMethod()
|
||||
return pGetSurfaceDesc;
|
||||
}
|
||||
|
||||
GetGDISurface_Type pGetGDISurfaceMethod(int dxversion)
|
||||
{
|
||||
GetGDISurface_Type pGetGDISurface;
|
||||
switch(dxversion){
|
||||
default:
|
||||
case 1: pGetGDISurface = pGetGDISurface1; break;
|
||||
case 2: pGetGDISurface = pGetGDISurface2; break;
|
||||
case 4: pGetGDISurface = pGetGDISurface4; break;
|
||||
case 7: pGetGDISurface = pGetGDISurface7; break;
|
||||
}
|
||||
return pGetGDISurface;
|
||||
}
|
||||
|
||||
int lpddsHookedVersion()
|
||||
{
|
||||
return iBakBufferVersion;
|
||||
@ -1210,7 +1238,7 @@ static void HookDDSurface(LPDIRECTDRAWSURFACE *lplpdds, int dxversion, BOOL isPr
|
||||
SetHook((void *)(**(DWORD **)lplpdds + 8), extReleaseS2, (void **)&pReleaseS2, "Release(S2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdds + 12), extAddAttachedSurface2, (void **)&pAddAttachedSurface2, "AddAttachedSurface(S2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdds + 28), extBltFast2, (void **)&pBltFast2, "BltFast(S2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdds + 20), extBlt2, (void **)&pBlt2, "Blt(S1)");
|
||||
SetHook((void *)(**(DWORD **)lplpdds + 20), extBlt2, (void **)&pBlt2, "Blt(S2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdds + 32), extDeleteAttachedSurface2, (void **)&pDeleteAttachedSurface2, "DeleteAttachedSurface(S2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdds + 36), extEnumAttachedSurfaces2, (void **)&pEnumAttachedSurfaces2, "EnumAttachedSurfaces(S2)");
|
||||
SetHook((void *)(**(DWORD **)lplpdds + 44), extFlip2, (void **)&pFlip2, "Flip(S2)");
|
||||
@ -1905,7 +1933,7 @@ static HRESULT WINAPI extQueryInterfaceS(QueryInterface_Type pQueryInterfaceS, v
|
||||
|
||||
if(dwLocalTexVersion) {
|
||||
// Texture Handling on QueryInterface
|
||||
if(dxw.dwFlags5 & TEXTUREMASK) TextureHandling((LPDIRECTDRAWSURFACE)lpdds);
|
||||
if(dxw.dwFlags5 & TEXTUREMASK) TextureHandling((LPDIRECTDRAWSURFACE)lpdds, dwLocalTexVersion);
|
||||
HookTexture(obp, dwLocalTexVersion);
|
||||
}
|
||||
|
||||
@ -2278,23 +2306,15 @@ static void BuildRealSurfaces(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurfa
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuPrim]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0);
|
||||
if(res==DDERR_PRIMARYSURFACEALREADYEXISTS){
|
||||
GetGDISurface_Type pGetGDISurface;
|
||||
switch(dxversion){
|
||||
default:
|
||||
case 1: pGetGDISurface = pGetGDISurface1; break;
|
||||
case 2: pGetGDISurface = pGetGDISurface2; break;
|
||||
case 4: pGetGDISurface = pGetGDISurface4; break;
|
||||
case 7: pGetGDISurface = pGetGDISurface7; break;
|
||||
}
|
||||
OutTraceDW("CreateSurface: ASSERT DDSEmu_Prim already exists\n");
|
||||
if(dxw.Windowize){
|
||||
// in Windowize mode, the desktop properties are untouched, then the current primary surface can be recycled
|
||||
res=(*pGetGDISurface)(lpdd, &lpDDSEmu_Prim);
|
||||
res=(*pGetGDISurfaceMethod(dxversion))(lpdd, &lpDDSEmu_Prim);
|
||||
}
|
||||
else {
|
||||
// in non-Windowized mode, the primary surface must be released and rebuilt with the proper properties
|
||||
res=(*pGetGDISurface)(lpdd, &lpDDSEmu_Prim);
|
||||
if (lpDDSEmu_Prim) while((*pReleaseSMethod())(lpDDSEmu_Prim));
|
||||
res=(*pGetGDISurfaceMethod(dxversion))(lpdd, &lpDDSEmu_Prim);
|
||||
if (lpDDSEmu_Prim) while((*pReleaseSMethod(dxversion))(lpDDSEmu_Prim));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0);
|
||||
}
|
||||
}
|
||||
@ -2307,6 +2327,17 @@ static void BuildRealSurfaces(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurfa
|
||||
if(IsDebug) DescribeSurface(lpDDSEmu_Prim, dxversion, "DDSEmu_Prim", __LINE__);
|
||||
InitDSScreenParameters(dxversion, lpDDSEmu_Prim);
|
||||
dxwss.PopSurface(lpDDSEmu_Prim);
|
||||
|
||||
if (dxw.dwFlags3 & FORCECLIPPER){
|
||||
OutTraceDW("CreateSurface: FORCE SetClipper on primary hwnd=%x lpdds=%x\n",
|
||||
dxw.GethWnd(), lpDDSEmu_Prim);
|
||||
res=lpdd->CreateClipper(0, &lpddC, NULL);
|
||||
if (res) OutTraceE("CreateSurface: CreateClipper ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
res=lpddC->SetHWnd(0, dxw.GethWnd());
|
||||
if (res) OutTraceE("CreateSurface: SetHWnd ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
res=lpDDSEmu_Prim->SetClipper(lpddC);
|
||||
if (res) OutTraceE("CreateSurface: SetClipper ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
}
|
||||
// can't hook lpDDSEmu_Prim as generic, since the Flip method is unimplemented for a PRIMARY surface!
|
||||
// better avoid it or hook just useful methods.
|
||||
//if (dxw.dwTFlags & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Prim, dxw.dwDDVersion);
|
||||
@ -2544,7 +2575,7 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
}
|
||||
OutTraceE("CreateSurface: CreateSurface DDERR_PRIMARYSURFACEALREADYEXISTS workaround\n");
|
||||
(*pGetGDISurface)(lpPrimaryDD, &lpPrim);
|
||||
while ((*pReleaseSMethod())(lpPrim));
|
||||
while ((*pReleaseSMethod(dxversion))(lpPrim));
|
||||
res = (*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
}
|
||||
/* fall through */
|
||||
@ -2770,7 +2801,7 @@ static HRESULT BuildBackBufferDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
|
||||
memset(&prim, 0, sizeof(DDSURFACEDESC2));
|
||||
prim.dwSize = (dxversion >= 4) ? sizeof(DDSURFACEDESC2) : sizeof(DDSURFACEDESC);
|
||||
res=lpPrim->GetSurfaceDesc((DDSURFACEDESC *)&prim);
|
||||
(*pReleaseSMethod())(lpPrim);
|
||||
(*pReleaseSMethod(dxversion))(lpPrim);
|
||||
ddsd.dwWidth = prim.dwWidth;
|
||||
ddsd.dwHeight = prim.dwHeight;
|
||||
OutTraceDW("BMX FIX: res=%x(%s) wxh=(%dx%d)\n", res, ExplainDDError(res),ddsd.dwWidth, ddsd.dwHeight);
|
||||
@ -3371,7 +3402,7 @@ HRESULT WINAPI PrimaryStretchBlt(int dxversion, Blt_Type pBlt, LPDIRECTDRAWSURFA
|
||||
if(res) OutTraceE("PrimaryStretchBlt: BltFast ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
}
|
||||
}
|
||||
(*pReleaseSMethod())(lpddsTmp);
|
||||
(*pReleaseSMethod(dxversion))(lpddsTmp);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -3420,7 +3451,7 @@ HRESULT WINAPI PrimaryBilinearBlt(int dxversion, Blt_Type pBlt, LPDIRECTDRAWSURF
|
||||
BltFast_Type pBltFast;
|
||||
int dwSize;
|
||||
|
||||
switch(iBakBufferVersion){
|
||||
switch(dxversion){
|
||||
default:
|
||||
case 1: pBltFast=pBltFast1; pCreateSurface=pCreateSurface1; dwSize = sizeof(DDSURFACEDESC); break;
|
||||
case 2: pBltFast=pBltFast2; pCreateSurface=(CreateSurface1_Type)pCreateSurface2; dwSize = sizeof(DDSURFACEDESC); break;
|
||||
@ -3464,7 +3495,7 @@ HRESULT WINAPI PrimaryBilinearBlt(int dxversion, Blt_Type pBlt, LPDIRECTDRAWSURF
|
||||
memset(&ddsd,0,dwSize);
|
||||
ddsd.dwSize = dwSize;
|
||||
ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0);
|
||||
res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0);
|
||||
if(res) {
|
||||
OutTraceE("PrimaryBilinearBlt: Lock ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return DD_OK;
|
||||
@ -3474,7 +3505,7 @@ HRESULT WINAPI PrimaryBilinearBlt(int dxversion, Blt_Type pBlt, LPDIRECTDRAWSURF
|
||||
memset(&ddsd,0,dwSize);
|
||||
ddsd.dwSize = dwSize;
|
||||
ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
res=(*pLockMethod())(lpddsTmp, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0);
|
||||
res=(*pLockMethod(dxversion))(lpddsTmp, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0);
|
||||
if(res) {
|
||||
OutTraceE("PrimaryBilinearBlt: Lock ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return DD_OK;
|
||||
@ -3520,8 +3551,8 @@ HRESULT WINAPI PrimaryBilinearBlt(int dxversion, Blt_Type pBlt, LPDIRECTDRAWSURF
|
||||
(*pResize_HQ)(bSourceBuf, lpsrcrect, SrcPitch, bDestBuf, lpdestrect, DestPitch);
|
||||
|
||||
// fast-blit to primary
|
||||
(*pUnlockMethod())(lpddssrc, NULL);
|
||||
(*pUnlockMethod())(lpddsTmp, NULL);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, NULL);
|
||||
(*pUnlockMethod(dxversion))(lpddsTmp, NULL);
|
||||
if(dxw.dwFlags3 & FORCECLIPPER) {
|
||||
res= (*pBlt)(lpdds, lpdestrect, lpddsTmp, &TmpRect, DDBLT_WAIT, 0);
|
||||
if(res) OutTraceE("PrimaryBilinearBlt: Blt ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
@ -3530,8 +3561,8 @@ HRESULT WINAPI PrimaryBilinearBlt(int dxversion, Blt_Type pBlt, LPDIRECTDRAWSURF
|
||||
res= (*pBltFast)(lpdds, lpdestrect->left, lpdestrect->top, lpddsTmp, &TmpRect, DDBLTFAST_WAIT);
|
||||
if(res) OutTraceE("PrimaryBilinearBlt: BltFast ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
}
|
||||
(*pReleaseSMethod())(lpddsTmp);
|
||||
if(lpddsCopy) (*pReleaseSMethod())(lpddsCopy);
|
||||
(*pReleaseSMethod(dxversion))(lpddsTmp);
|
||||
if(lpddsCopy) (*pReleaseSMethod(dxversion))(lpddsCopy);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -3555,8 +3586,8 @@ HRESULT WINAPI ColorConversionEmulated(int dxversion, LPDIRECTDRAWSURFACE lpdds,
|
||||
}
|
||||
res=(*pEmuBlt)(dxversion, pBlt, lpDDSEmu_Back, &emurect, lpdds, &emurect, DDBLT_WAIT, 0);
|
||||
if(res==DDERR_SURFACEBUSY){
|
||||
(*pUnlockMethod())(lpdds, NULL);
|
||||
(*pUnlockMethod())(lpDDSEmu_Back, NULL);
|
||||
(*pUnlockMethod(dxversion))(lpdds, NULL);
|
||||
(*pUnlockMethod(dxversion))(lpDDSEmu_Back, NULL);
|
||||
res=(*pEmuBlt)(dxversion, pBlt, lpDDSEmu_Back, &emurect, lpdds, &emurect, DDBLT_WAIT, 0);
|
||||
}
|
||||
if(res) {
|
||||
@ -3684,7 +3715,7 @@ HRESULT WINAPI extFlip(int dxversion, Flip_Type pFlip, LPDIRECTDRAWSURFACE lpdds
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
ddsd.dwWidth = dxw.GetScreenWidth();
|
||||
}
|
||||
res2=(*pCreateSurfaceMethod())(lpPrimaryDD, &ddsd, &lpddsTmp, NULL);
|
||||
res2=(*pCreateSurfaceMethod(dxversion))(lpPrimaryDD, &ddsd, &lpddsTmp, NULL);
|
||||
if(res2) {
|
||||
OutTraceE("CreateSurface: ERROR %x(%s) at %d\n", res2, ExplainDDError(res2), __LINE__);
|
||||
OutTraceE("Size=%d lpPrimaryDD=%x lpDDSBack=%x %s\n",
|
||||
@ -3738,7 +3769,7 @@ HRESULT WINAPI extFlip(int dxversion, Flip_Type pFlip, LPDIRECTDRAWSURFACE lpdds
|
||||
// restore flipped backbuffer and delete temporary surface
|
||||
res2= (*pBlt)(lpddssrc, NULL, lpddsTmp, NULL, DDBLT_WAIT, NULL);
|
||||
if(res2) OutTraceE("Blt: ERROR %x(%s) at %d\n", res2, ExplainDDError(res2), __LINE__);
|
||||
(*pReleaseSMethod())(lpddsTmp);
|
||||
(*pReleaseSMethod(dxversion))(lpddsTmp);
|
||||
}
|
||||
|
||||
if(res) OutTraceE("Flip: Blt ERROR %x(%s)\n", res, ExplainDDError(res));
|
||||
@ -4094,7 +4125,7 @@ HRESULT WINAPI extSetClipper7(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWCLIPPER lpd
|
||||
DDSURFACEDESC SaveSurfaceDesc;
|
||||
LPDIRECTDRAWSURFACE SaveSurface = NULL;
|
||||
|
||||
static HRESULT WINAPI extLock(Lock_Type pLock, LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD flags, HANDLE hEvent)
|
||||
static HRESULT WINAPI extLock(int dxversion, Lock_Type pLock, LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD flags, HANDLE hEvent)
|
||||
{
|
||||
HRESULT res;
|
||||
|
||||
@ -4111,7 +4142,7 @@ static HRESULT WINAPI extLock(Lock_Type pLock, LPDIRECTDRAWSURFACE lpdds, LPRECT
|
||||
|
||||
res=(*pLock)(lpdds, lprect, lpDDSurfaceDesc, flags, hEvent);
|
||||
if(res==DDERR_SURFACEBUSY){ // v70: fix for "Ancient Evil"
|
||||
(*pUnlockMethod())(lpdds, NULL);
|
||||
(*pUnlockMethod(dxversion))(lpdds, NULL);
|
||||
res = (*pLock)(lpdds, lprect, lpDDSurfaceDesc, flags, hEvent);
|
||||
OutTraceDW("Lock RETRY: ret=%x(%s)\n", res, ExplainDDError(res));
|
||||
}
|
||||
@ -4139,15 +4170,15 @@ static HRESULT WINAPI extLock(Lock_Type pLock, LPDIRECTDRAWSURFACE lpdds, LPRECT
|
||||
}
|
||||
|
||||
HRESULT WINAPI extLock1(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD flags, HANDLE hEvent)
|
||||
{ return extLock(pLock1, lpdds, lprect, lpDDSurfaceDesc, flags, hEvent); }
|
||||
{ return extLock(1, pLock1, lpdds, lprect, lpDDSurfaceDesc, flags, hEvent); }
|
||||
HRESULT WINAPI extLock2(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD flags, HANDLE hEvent)
|
||||
{ return extLock(pLock2, lpdds, lprect, lpDDSurfaceDesc, flags, hEvent); }
|
||||
{ return extLock(2, pLock2, lpdds, lprect, lpDDSurfaceDesc, flags, hEvent); }
|
||||
HRESULT WINAPI extLock3(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD flags, HANDLE hEvent)
|
||||
{ return extLock(pLock3, lpdds, lprect, lpDDSurfaceDesc, flags, hEvent); }
|
||||
{ return extLock(3, pLock3, lpdds, lprect, lpDDSurfaceDesc, flags, hEvent); }
|
||||
HRESULT WINAPI extLock4(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD flags, HANDLE hEvent)
|
||||
{ return extLock(pLock4, lpdds, lprect, lpDDSurfaceDesc, flags, hEvent); }
|
||||
{ return extLock(4, pLock4, lpdds, lprect, lpDDSurfaceDesc, flags, hEvent); }
|
||||
HRESULT WINAPI extLock7(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD flags, HANDLE hEvent)
|
||||
{ return extLock(pLock7, lpdds, lprect, lpDDSurfaceDesc, flags, hEvent); }
|
||||
{ return extLock(7, pLock7, lpdds, lprect, lpDDSurfaceDesc, flags, hEvent); }
|
||||
|
||||
LPDIRECTDRAWSURFACE2 lpDDSBuffer = NULL;
|
||||
|
||||
@ -4187,7 +4218,7 @@ static HRESULT WINAPI extLockDir(int dxversion, Lock_Type pLock, LPDIRECTDRAWSUR
|
||||
if(res2)
|
||||
OutTraceE("Lock: GetGDISurface ERROR res=%x(%s) at %d\n", res2, ExplainDDError(res2), __LINE__);
|
||||
else
|
||||
(*pReleaseSMethod())(lpDDSPrim);
|
||||
(*pReleaseSMethod(dxversion))(lpDDSPrim);
|
||||
if(lpdds==lpDDSPrim){
|
||||
if(dxw.dwFlags1 & LOCKEDSURFACE){
|
||||
DDSURFACEDESC2 ddsd;
|
||||
@ -4359,7 +4390,7 @@ static HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRA
|
||||
|
||||
if((dxw.dwFlags5 & TEXTUREMASK) && (!IsPrim)) {
|
||||
// Texture Handling on Unlock
|
||||
TextureHandling(lpdds);
|
||||
TextureHandling(lpdds, dxversion);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -4427,10 +4458,10 @@ static HRESULT WINAPI extUnlockDir(int dxversion, Unlock4_Type pUnlock, LPDIRECT
|
||||
OffsetRect(lprect, upleft.x, upleft.y);
|
||||
res=(*pUnlock)((LPDIRECTDRAWSURFACE)lpDDSBuffer, lprect);
|
||||
(*pBlt)(lpdds, lprect, (LPDIRECTDRAWSURFACE)lpDDSBuffer, NULL, DDBLT_WAIT, 0);
|
||||
(*pReleaseSMethod())((LPDIRECTDRAWSURFACE)lpDDSBuffer);
|
||||
(*pReleaseSMethod(dxversion))((LPDIRECTDRAWSURFACE)lpDDSBuffer);
|
||||
lpDDSBuffer = NULL;
|
||||
}
|
||||
(*pReleaseSMethod())(lpDDSPrim); // to leave a correct refcount
|
||||
(*pReleaseSMethod(dxversion))(lpDDSPrim); // to leave a correct refcount
|
||||
}
|
||||
|
||||
res=(*pUnlock)(lpdds, lprect);
|
||||
|
@ -12,11 +12,11 @@ typedef HRESULT (WINAPI *Lock_Type)(LPDIRECTDRAWSURFACE, LPRECT, LPDDSURFACEDESC
|
||||
typedef HRESULT (WINAPI *Unlock4_Type)(LPDIRECTDRAWSURFACE, LPRECT);
|
||||
typedef HRESULT (WINAPI *Unlock1_Type)(LPDIRECTDRAWSURFACE, LPVOID);
|
||||
|
||||
extern Lock_Type pLockMethod();
|
||||
extern Unlock4_Type pUnlockMethod();
|
||||
extern Lock_Type pLockMethod(int);
|
||||
extern Unlock4_Type pUnlockMethod(int);
|
||||
extern int Set_dwSize_From_Surface();
|
||||
|
||||
void DDrawScreenShot()
|
||||
void DDrawScreenShot(int dxversion)
|
||||
{
|
||||
LPDIRECTDRAWSURFACE s;
|
||||
DDSURFACEDESC2 ddsd;
|
||||
@ -49,7 +49,7 @@ void DDrawScreenShot()
|
||||
memset(&ddsd,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(s, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(s, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("ScreenShot: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return;
|
||||
}
|
||||
@ -126,6 +126,6 @@ void DDrawScreenShot()
|
||||
fclose(hf);
|
||||
break;
|
||||
}
|
||||
res=(*pUnlockMethod())(s, NULL);
|
||||
res=(*pUnlockMethod(dxversion))(s, NULL);
|
||||
if (res) OutTraceE("ScreenShot: Unlock ERROR lpdds=%x res=%x(%s) at %d\n", s, res, ExplainDDError(res), __LINE__);
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ typedef HRESULT (WINAPI *Lock_Type)(LPDIRECTDRAWSURFACE, LPRECT, LPDDSURFACEDESC
|
||||
typedef HRESULT (WINAPI *Unlock4_Type)(LPDIRECTDRAWSURFACE, LPRECT);
|
||||
typedef HRESULT (WINAPI *Unlock1_Type)(LPDIRECTDRAWSURFACE, LPVOID);
|
||||
|
||||
extern Lock_Type pLockMethod();
|
||||
extern Unlock4_Type pUnlockMethod();
|
||||
extern Lock_Type pLockMethod(int);
|
||||
extern Unlock4_Type pUnlockMethod(int);
|
||||
extern int Set_dwSize_From_Surface();
|
||||
|
||||
#define GRIDSIZE 16
|
||||
@ -103,7 +103,7 @@ static char *SurfaceType(DDPIXELFORMAT ddpfPixelFormat)
|
||||
return sSurfaceType;
|
||||
}
|
||||
|
||||
void TextureHighlight(LPDIRECTDRAWSURFACE s)
|
||||
void TextureHighlight(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
{
|
||||
DDSURFACEDESC2 ddsd;
|
||||
int x, y, w, h;
|
||||
@ -111,7 +111,7 @@ void TextureHighlight(LPDIRECTDRAWSURFACE s)
|
||||
memset(&ddsd,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(s, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(s, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("TextureHigh: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return;
|
||||
}
|
||||
@ -171,11 +171,11 @@ void TextureHighlight(LPDIRECTDRAWSURFACE s)
|
||||
break;
|
||||
}
|
||||
}
|
||||
res=(*pUnlockMethod())(s, NULL);
|
||||
res=(*pUnlockMethod(dxversion))(s, NULL);
|
||||
if (res) OutTraceE("TextureHigh: Unlock ERROR lpdds=%x res=%x(%s) at %d\n", s, res, ExplainDDError(res), __LINE__);
|
||||
}
|
||||
|
||||
static void TextureDump(LPDIRECTDRAWSURFACE s)
|
||||
static void TextureDump(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
{
|
||||
DDSURFACEDESC2 ddsd;
|
||||
int w, h, iSurfaceSize, iScanLineSize;
|
||||
@ -200,7 +200,7 @@ static void TextureDump(LPDIRECTDRAWSURFACE s)
|
||||
memset(&ddsd,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(s, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(s, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("TextureDump: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return;
|
||||
}
|
||||
@ -294,11 +294,11 @@ static void TextureDump(LPDIRECTDRAWSURFACE s)
|
||||
fclose(hf);
|
||||
break;
|
||||
}
|
||||
res=(*pUnlockMethod())(s, NULL);
|
||||
res=(*pUnlockMethod(dxversion))(s, NULL);
|
||||
if (res) OutTraceE("TextureDump: Unlock ERROR lpdds=%x res=%x(%s) at %d\n", s, res, ExplainDDError(res), __LINE__);
|
||||
}
|
||||
|
||||
static void TextureHack(LPDIRECTDRAWSURFACE s)
|
||||
static void TextureHack(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
{
|
||||
DDSURFACEDESC2 ddsd;
|
||||
int w, h, iSurfaceSize, iScanLineSize;
|
||||
@ -307,7 +307,7 @@ static void TextureHack(LPDIRECTDRAWSURFACE s)
|
||||
memset(&ddsd,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(s, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(s, 0, (LPDDSURFACEDESC)&ddsd, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("TextureHack: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return;
|
||||
}
|
||||
@ -382,23 +382,23 @@ static void TextureHack(LPDIRECTDRAWSURFACE s)
|
||||
fclose(hf);
|
||||
break;
|
||||
}
|
||||
res=(*pUnlockMethod())(s, NULL);
|
||||
res=(*pUnlockMethod(dxversion))(s, NULL);
|
||||
if (res) OutTraceE("TextureHack: Unlock ERROR lpdds=%x res=%x(%s) at %d\n", s, res, ExplainDDError(res), __LINE__);
|
||||
}
|
||||
|
||||
void TextureHandling(LPDIRECTDRAWSURFACE s)
|
||||
void TextureHandling(LPDIRECTDRAWSURFACE s, int dxversion)
|
||||
{
|
||||
//OutTrace("TextureHandling(1-7): dxw.dwFlags5 = %x\n", dxw.dwFlags5 & (TEXTUREHIGHLIGHT|TEXTUREDUMP|TEXTUREHACK));
|
||||
switch(dxw.dwFlags5 & TEXTUREMASK){
|
||||
default:
|
||||
case TEXTUREHIGHLIGHT:
|
||||
TextureHighlight(s);
|
||||
TextureHighlight(s, dxversion);
|
||||
break;
|
||||
case TEXTUREDUMP:
|
||||
TextureDump(s);
|
||||
TextureDump(s, dxversion);
|
||||
break;
|
||||
case TEXTUREHACK:
|
||||
TextureHack(s);
|
||||
TextureHack(s, dxversion);
|
||||
break;
|
||||
case TEXTURETRANSP:
|
||||
//TextureTransp(s);
|
||||
|
200
dll/dxemublt.cpp
200
dll/dxemublt.cpp
@ -11,8 +11,8 @@ typedef HRESULT (WINAPI *Lock_Type)(LPDIRECTDRAWSURFACE, LPRECT, LPDDSURFACEDESC
|
||||
typedef HRESULT (WINAPI *Unlock4_Type)(LPDIRECTDRAWSURFACE, LPRECT);
|
||||
typedef HRESULT (WINAPI *Unlock1_Type)(LPDIRECTDRAWSURFACE, LPVOID);
|
||||
|
||||
extern Lock_Type pLockMethod();
|
||||
extern Unlock4_Type pUnlockMethod();
|
||||
extern Lock_Type pLockMethod(int);
|
||||
extern Unlock4_Type pUnlockMethod(int);
|
||||
|
||||
extern DWORD PaletteEntries[256];
|
||||
extern DWORD *Palette16BPP;
|
||||
@ -150,7 +150,7 @@ static HRESULT WINAPI EmuBlt_8_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAWS
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("EmuBlt8_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -161,14 +161,14 @@ static HRESULT WINAPI EmuBlt_8_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAWS
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("EmuBlt8_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("EmuBlt8_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return 0;
|
||||
}
|
||||
@ -198,9 +198,9 @@ static HRESULT WINAPI EmuBlt_8_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAWS
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, w, h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("EmuBlt8_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("EmuBlt8_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -226,7 +226,7 @@ static HRESULT WINAPI BilinearBlt_8_to_32(int dxversion, Blt_Type pBlt, LPDIRECT
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("BilBlt8_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -237,14 +237,14 @@ static HRESULT WINAPI BilinearBlt_8_to_32(int dxversion, Blt_Type pBlt, LPDIRECT
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("BilBlt8_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("BilBlt8_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return 0;
|
||||
}
|
||||
@ -297,9 +297,9 @@ static HRESULT WINAPI BilinearBlt_8_to_32(int dxversion, Blt_Type pBlt, LPDIRECT
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, 2*w, 2*h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("BilBlt8_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("BilBlt8_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -320,7 +320,7 @@ static HRESULT WINAPI EmuBlt_16_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("EmuBlt16_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -331,14 +331,14 @@ static HRESULT WINAPI EmuBlt_16_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("EmuBlt16_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("EmuBlt16_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -371,9 +371,9 @@ static HRESULT WINAPI EmuBlt_16_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, w, h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("EmuBlt16_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("EmuBlt16_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -394,7 +394,7 @@ static HRESULT WINAPI Deinterlace_16_to_32(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("EmuBlt16_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -405,14 +405,14 @@ static HRESULT WINAPI Deinterlace_16_to_32(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("EmuBlt16_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("EmuBlt16_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -472,9 +472,9 @@ static HRESULT WINAPI Deinterlace_16_to_32(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, w, h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("EmuBlt16_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("EmuBlt16_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -500,7 +500,7 @@ static HRESULT WINAPI BilinearBlt_16_to_32(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("BilBlt16_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -511,14 +511,14 @@ static HRESULT WINAPI BilinearBlt_16_to_32(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("BilBlt16_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("BilBlt16_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -573,9 +573,9 @@ static HRESULT WINAPI BilinearBlt_16_to_32(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, 2*w, 2*h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("BilBlt16_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("BilBlt16_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -596,7 +596,7 @@ static HRESULT WINAPI EmuBlt_24_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("EmuBlt24_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -607,14 +607,14 @@ static HRESULT WINAPI EmuBlt_24_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("EmuBlt24_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("EmuBlt24_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -647,9 +647,9 @@ static HRESULT WINAPI EmuBlt_24_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, w, h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("EmuBlt24_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("EmuBlt24_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -673,7 +673,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("EmuBlt32_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -684,14 +684,14 @@ static HRESULT WINAPI EmuBlt_32_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("EmuBlt32_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("EmuBlt32_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -721,9 +721,9 @@ static HRESULT WINAPI EmuBlt_32_to_32(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, w, h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst,lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst,lpdestrect);
|
||||
if (res) OutTraceE("EmuBlt32_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("EmuBlt32_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -744,7 +744,7 @@ static HRESULT WINAPI EmuBlt_8_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAWS
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("EmuBlt8_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -755,14 +755,14 @@ static HRESULT WINAPI EmuBlt_8_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAWS
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("EmuBlt8_16: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("EmuBlt8_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return 0;
|
||||
}
|
||||
@ -792,9 +792,9 @@ static HRESULT WINAPI EmuBlt_8_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAWS
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect16(dest0, w, h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("EmuBlt8_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("EmuBlt8_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -822,7 +822,7 @@ static HRESULT WINAPI BilinearBlt_8_to_16(int dxversion, Blt_Type pBlt, LPDIRECT
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("BilBlt8_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -835,14 +835,14 @@ static HRESULT WINAPI BilinearBlt_8_to_16(int dxversion, Blt_Type pBlt, LPDIRECT
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("BilBlt8_16: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("BilBlt8_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return 0;
|
||||
}
|
||||
@ -894,9 +894,9 @@ static HRESULT WINAPI BilinearBlt_8_to_16(int dxversion, Blt_Type pBlt, LPDIRECT
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect16(dest0, 2*w, 2*h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("BilBlt8_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("BilBlt8_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -921,7 +921,7 @@ static HRESULT WINAPI EmuBlt_16_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("EmuBlt16_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -932,14 +932,14 @@ static HRESULT WINAPI EmuBlt_16_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("EmuBlt16_16: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("EmuBlt16_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return 0;
|
||||
}
|
||||
@ -999,9 +999,9 @@ static HRESULT WINAPI EmuBlt_16_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect16(dest0, w, h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("EmuBlt16_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("EmuBlt16_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -1029,7 +1029,7 @@ static HRESULT WINAPI BilinearBlt_16_to_16(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("BilBlt16_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -1042,14 +1042,14 @@ static HRESULT WINAPI BilinearBlt_16_to_16(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("BilBlt16_16: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("BilBlt16_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -1102,9 +1102,9 @@ static HRESULT WINAPI BilinearBlt_16_to_16(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect16((SHORT *)dest0, 2*w, 2*h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("BilBlt16_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("BilBlt16_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -1126,7 +1126,7 @@ static HRESULT WINAPI EmuBlt_24_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("EmuBlt24_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -1137,14 +1137,14 @@ static HRESULT WINAPI EmuBlt_24_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("EmuBlt24_16: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("EmuBlt24_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return 0;
|
||||
}
|
||||
@ -1174,9 +1174,9 @@ static HRESULT WINAPI EmuBlt_24_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect16(dest0, w, h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("EmuBlt24_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("EmuBlt24_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -1197,7 +1197,7 @@ static HRESULT WINAPI EmuBlt_32_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("EmuBlt32_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -1208,14 +1208,14 @@ static HRESULT WINAPI EmuBlt_32_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("EmuBlt32_16: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("EmuBlt32_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return 0;
|
||||
}
|
||||
@ -1245,9 +1245,9 @@ static HRESULT WINAPI EmuBlt_32_to_16(int dxversion, Blt_Type pBlt, LPDIRECTDRAW
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect16(dest0, w, h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("EmuBlt32_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("EmuBlt32_16: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -1273,7 +1273,7 @@ static HRESULT WINAPI BilinearBlt_32_to_32(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2));
|
||||
ddsd_dst.dwSize = Set_dwSize_From_Surface();
|
||||
ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH;
|
||||
if(res=(*pLockMethod())(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
if(res=(*pLockMethod(dxversion))(lpddsdst, 0, (LPDDSURFACEDESC)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){
|
||||
OutTraceE("BilBlt32_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -1284,14 +1284,14 @@ static HRESULT WINAPI BilinearBlt_32_to_32(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
if (lpsurface) { // already locked, just get info ....
|
||||
if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) {
|
||||
OutTraceE("BilBlt32_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(res=(*pLockMethod())(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
|
||||
(*pUnlockMethod())(lpddsdst,0);
|
||||
if(res=(*pLockMethod(dxversion))(lpddssrc, 0, (LPDDSURFACEDESC)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
|
||||
(*pUnlockMethod(dxversion))(lpddsdst,0);
|
||||
OutTraceE("BilBlt32_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
@ -1347,9 +1347,9 @@ static HRESULT WINAPI BilinearBlt_32_to_32(int dxversion, Blt_Type pBlt, LPDIREC
|
||||
|
||||
if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, 2*w, 2*h, destpitch);
|
||||
|
||||
res=(*pUnlockMethod())(lpddsdst, lpdestrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddsdst, lpdestrect);
|
||||
if (res) OutTraceE("BilBlt32_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__);
|
||||
res=(*pUnlockMethod())(lpddssrc, lpsrcrect);
|
||||
res=(*pUnlockMethod(dxversion))(lpddssrc, lpsrcrect);
|
||||
if (res) OutTraceE("BilBlt32_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddssrc, res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
}
|
||||
|
@ -445,22 +445,24 @@ void DumpImportTable(HMODULE module)
|
||||
void SetHook(void *target, void *hookproc, void **hookedproc, char *hookname)
|
||||
{
|
||||
void *tmp;
|
||||
char msg[81];
|
||||
char msg[201];
|
||||
DWORD dwTmp, oldprot;
|
||||
static DWORD MinHook=0xFFFFFFFF;
|
||||
static DWORD MaxHook=0;
|
||||
|
||||
OutTraceH("SetHook: DEBUG target=%x, proc=%x name=%s\n", target, hookproc, hookname);
|
||||
// keep track of hooked call range to avoid re-hooking of hooked addresses !!!
|
||||
if ((DWORD)hookproc < MinHook) MinHook=(DWORD)hookproc;
|
||||
if ((DWORD)hookproc > MaxHook) MaxHook=(DWORD)hookproc;
|
||||
dwTmp = *(DWORD *)target;
|
||||
if(dwTmp == (DWORD)hookproc) return; // already hooked
|
||||
if((dwTmp <= MaxHook) && (dwTmp >= MinHook)) return; // already hooked
|
||||
if(dwTmp == (DWORD)hookproc) {
|
||||
OutTraceH("target already hooked\n");
|
||||
return; // already hooked
|
||||
}
|
||||
if(*(DWORD *)hookedproc == (DWORD)hookproc) {
|
||||
OutTraceH("hook already hooked\n");
|
||||
return; // already hooked
|
||||
}
|
||||
if(dwTmp == 0){
|
||||
sprintf(msg,"SetHook ERROR: NULL target for %s\n", hookname);
|
||||
OutTraceDW(msg);
|
||||
MessageBox(0, msg, "SetHook", MB_OK | MB_ICONEXCLAMATION);
|
||||
if (IsAssertEnabled) MessageBox(0, msg, "SetHook", MB_OK | MB_ICONEXCLAMATION);
|
||||
return; // error condition
|
||||
}
|
||||
if(!VirtualProtect(target, 4, PAGE_READWRITE, &oldprot)) {
|
||||
@ -487,6 +489,7 @@ void SetHook(void *target, void *hookproc, void **hookedproc, char *hookname)
|
||||
tmp = *hookedproc;
|
||||
}
|
||||
*hookedproc = tmp;
|
||||
OutTraceH("SetHook: DEBUG2 *hookedproc=%x, name=%s\n", tmp, hookname);
|
||||
}
|
||||
|
||||
// v2.02.53: thorough scan - the IAT is scanned considering the possibility to have each dll module
|
||||
@ -1150,7 +1153,10 @@ DWORD WINAPI MessagePoller(LPVOID lpParameter)
|
||||
#define DXWREFRESHINTERVAL 20
|
||||
while(TRUE){
|
||||
Sleep(DXWREFRESHINTERVAL);
|
||||
SendMessage(dxw.GethWnd(), WM_NCHITTEST, 0, 0);
|
||||
if(dxw.dwFlags2 & INDEPENDENTREFRESH)
|
||||
dxw.ScreenRefresh();
|
||||
else
|
||||
SendMessage(dxw.GethWnd(), WM_NCHITTEST, 0, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "TlHelp32.h"
|
||||
|
||||
#define VERSION "2.03.65"
|
||||
#define VERSION "2.03.66"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
//#define LOCKTHREADS
|
||||
|
Binary file not shown.
@ -332,7 +332,7 @@ FARPROC Remap_GDI32_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
//--------------------------------------------------------------------------------------------
|
||||
|
||||
extern DWORD PaletteEntries[256];
|
||||
extern Unlock4_Type pUnlockMethod();
|
||||
extern Unlock4_Type pUnlockMethod(int);
|
||||
extern HRESULT WINAPI sBlt(int, Blt_Type, char *, LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT, DWORD, LPDDBLTFX, BOOL);
|
||||
|
||||
extern GetDC_Type pGetDC;
|
||||
@ -412,8 +412,6 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
if(dxw.Windowize){
|
||||
res= dxw.GetScreenWidth();
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
extern GetDC_Type pGetDCMethod();
|
||||
extern ReleaseDC_Type pReleaseDCMethod();
|
||||
extern Unlock1_Type pUnlockMethod();
|
||||
extern Unlock1_Type pUnlockMethod(int);
|
||||
|
||||
void BlitToWindow(HWND w, LPDIRECTDRAWSURFACE s)
|
||||
{
|
||||
|
@ -1123,7 +1123,6 @@ static HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devi
|
||||
}
|
||||
OutTraceD3D("SUCCESS! device=%x\n", *ppd3dd);
|
||||
lpD3DActiveDevice = *ppd3dd;
|
||||
// memcpy(gActiveDeviceParams, param, 64*sizeof(DWORD));
|
||||
|
||||
if(dwD3DVersion == 8){
|
||||
HookD3DDevice8(ppd3dd);
|
||||
@ -1139,8 +1138,7 @@ static HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devi
|
||||
GetHookInfo()->Height=(short)dxw.GetScreenHeight();
|
||||
GetHookInfo()->Width=(short)dxw.GetScreenWidth();
|
||||
GetHookInfo()->ColorDepth=(short)dxw.VirtualPixelFormat.dwRGBBitCount;
|
||||
|
||||
return 0;
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI extCreateDevice8(void *lpd3d, UINT adapter, D3DDEVTYPE dt, HWND hfw, DWORD bf, D3DPRESENT_PARAMETERS *ppp, void **ppd3dd)
|
||||
@ -1248,7 +1246,7 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp
|
||||
GetHookInfo()->Width=(short)dxw.GetScreenWidth();
|
||||
GetHookInfo()->ColorDepth=(short)dxw.VirtualPixelFormat.dwRGBBitCount;
|
||||
|
||||
return 0;
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
extern char *ExplainRenderstateValue(DWORD Value);
|
||||
|
@ -107,7 +107,6 @@ HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
|
||||
case 0xD7B70EE0: // CLSID_DirectDraw:
|
||||
// v2.03.18: fixed
|
||||
OutTraceDW("CoCreateInstance: CLSID_DirectDraw object\n");
|
||||
HookDDSession((LPDIRECTDRAW *)ppv, 1);
|
||||
switch (*(DWORD *)&riid){
|
||||
LPDIRECTDRAW lpOldDDraw;
|
||||
case 0x6C14DB80:
|
||||
|
135
dll/shareddc.cpp
135
dll/shareddc.cpp
@ -21,6 +21,7 @@
|
||||
extern HandleDDThreadLock_Type pReleaseDDThreadLock;
|
||||
extern GetDC_Type pGetDCMethod();
|
||||
extern ReleaseDC_Type pReleaseDCMethod();
|
||||
//void setClippingRegion(HDC, HDC, HWND, bool, const POINT&);
|
||||
|
||||
/*---------------------------------------------------------------------------------+
|
||||
| |
|
||||
@ -191,8 +192,8 @@ HDC dxwSDC::GetPrimaryDC(HDC hdc)
|
||||
origin.y -= mainwin.y;
|
||||
OutTraceB("dxwSDC::GetPrimaryDC: origin=(%d,%d)\n", origin.x, origin.y);
|
||||
|
||||
copyDcAttributes(VirtualHDC, hdc, origin);
|
||||
setClippingRegion(VirtualHDC, hdc, origin);
|
||||
copyDcAttributes(VirtualHDC, hdc, origin);
|
||||
setClippingRegion(VirtualHDC, hdc, dxw.GethWnd(), FALSE, origin); // no good
|
||||
|
||||
return VirtualHDC;
|
||||
}
|
||||
@ -314,11 +315,36 @@ void dxwSDC::copyDcAttributes(HDC destDC, HDC origDc, POINT origin)
|
||||
origFont = SelectObject(destDC, GetCurrentObject(origDc, OBJ_FONT));
|
||||
origBrush = SelectObject(destDC, GetCurrentObject(origDc, OBJ_BRUSH));
|
||||
origPen = SelectObject(destDC, GetCurrentObject(origDc, OBJ_PEN));
|
||||
|
||||
if (GM_ADVANCED == GetGraphicsMode(origDc)){
|
||||
SetGraphicsMode(destDC, GM_ADVANCED);
|
||||
XFORM transform = {};
|
||||
GetWorldTransform(origDc, &transform);
|
||||
SetWorldTransform(destDC, &transform);
|
||||
}
|
||||
|
||||
SetMapMode(destDC, GetMapMode(origDc));
|
||||
|
||||
POINT viewportOrg = {};
|
||||
GetViewportOrgEx(origDc, &viewportOrg);
|
||||
SetViewportOrgEx(destDC, viewportOrg.x + origin.x, viewportOrg.y + origin.y, NULL);
|
||||
SIZE viewportExt = {};
|
||||
GetViewportExtEx(origDc, &viewportExt);
|
||||
SetViewportExtEx(destDC, viewportExt.cx, viewportExt.cy, NULL);
|
||||
|
||||
POINT windowOrg = {};
|
||||
GetWindowOrgEx(origDc, &windowOrg);
|
||||
SetWindowOrgEx(destDC, windowOrg.x, windowOrg.y, NULL);
|
||||
SIZE windowExt = {};
|
||||
GetWindowExtEx(origDc, &windowExt);
|
||||
SetWindowExtEx(destDC, windowExt.cx, windowExt.cy, NULL);
|
||||
|
||||
SetArcDirection(destDC, GetArcDirection(origDc));
|
||||
SetBkColor(destDC, GetBkColor(origDc));
|
||||
SetBkMode(destDC, GetBkMode(origDc));
|
||||
SetDCBrushColor(destDC, GetDCBrushColor(origDc));
|
||||
SetDCPenColor(destDC, GetDCPenColor(origDc));
|
||||
SetLayout(destDC, GetLayout(origDc));
|
||||
SetPolyFillMode(destDC, GetPolyFillMode(origDc));
|
||||
SetROP2(destDC, GetROP2(origDc));
|
||||
SetStretchBltMode(destDC, GetStretchBltMode(origDc));
|
||||
@ -335,8 +361,7 @@ void dxwSDC::copyDcAttributes(HDC destDC, HDC origDc, POINT origin)
|
||||
SetBrushOrgEx(destDC, brushOrg.x, brushOrg.y, NULL);
|
||||
|
||||
POINT currentPos = {};
|
||||
(*pMoveToEx)(origDc, 0, 0, ¤tPos);
|
||||
(*pMoveToEx)(origDc, currentPos.x, currentPos.y, NULL);
|
||||
(*pGetCurrentPositionEx)(origDc, ¤tPos);
|
||||
dxw.MapClient(¤tPos);
|
||||
(*pMoveToEx)(destDC, currentPos.x, currentPos.y, NULL);
|
||||
}
|
||||
@ -344,76 +369,60 @@ void dxwSDC::copyDcAttributes(HDC destDC, HDC origDc, POINT origin)
|
||||
typedef struct
|
||||
{
|
||||
HDC compatDc;
|
||||
POINT origin;
|
||||
HWND rootWnd;
|
||||
} ExcludeClipRectsData_Type;
|
||||
|
||||
static BOOL CALLBACK excludeClipRectsForOverlappingWindows(HWND hwnd, LPARAM lParam)
|
||||
static BOOL CALLBACK excludeClipRectForOverlappingWindow(HWND hwnd, LPARAM lParam)
|
||||
{
|
||||
ExcludeClipRectsData_Type *excludeClipRectsData = (ExcludeClipRectsData_Type *)lParam;
|
||||
if (!IsWindowVisible(hwnd)) return TRUE; // go ahead
|
||||
if (hwnd == excludeClipRectsData->rootWnd) return FALSE; // stop
|
||||
if(dxw.IsDesktop(hwnd)) return FALSE;
|
||||
if (hwnd == excludeClipRectsData->rootWnd) return FALSE;
|
||||
if (!IsWindowVisible(hwnd)) return TRUE;
|
||||
|
||||
RECT windowRect = {};
|
||||
GetWindowRect(hwnd, &windowRect);
|
||||
|
||||
HRGN windowRgn = (*pCreateRectRgnIndirect)(&windowRect);
|
||||
ExtSelectClipRgn(excludeClipRectsData->compatDc, windowRgn, RGN_DIFF);
|
||||
DeleteObject(windowRgn);
|
||||
OutTraceB("dxwSDC::excludeClipRect: hwnd=%x rect=(%d,%d)-(%d,%d)\n", hwnd, windowRect.left, windowRect.top, windowRect.right, windowRect.bottom);
|
||||
|
||||
RECT rect = {};
|
||||
(*pGetClientRect)(hwnd, &rect);
|
||||
OffsetRect(&rect, -excludeClipRectsData->origin.x, -excludeClipRectsData->origin.y);
|
||||
ExcludeClipRect(excludeClipRectsData->compatDc, rect.left, rect.top, rect.right, rect.bottom);
|
||||
OutTraceB("dxwSDC::excludeClipRects: hwnd=%x rect=(%d,%d)-(%d,%d)\n", hwnd, rect.left, rect.top, rect.right, rect.bottom);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void dxwSDC::setClippingRegion(HDC compatDc, HDC origDc, POINT& origin)
|
||||
static void excludeClipRectsForOverlappingWindows(HWND hwnd, BOOL isMenuWindow, HDC compatDc)
|
||||
{
|
||||
OutTraceB("dxwSDC::setClippingRegion: compdc=%x origdc=%x origin=(%d,%d)\n", compatDc, origDc, origin.x, origin.y);
|
||||
HRGN clipRgn = CreateRectRgn(0, 0, 0, 0);
|
||||
const bool isEmptyClipRgn = (1 != GetRandomRgn(origDc, clipRgn, SYSRGN));
|
||||
OutTraceB("dxwSDC::setClippingRegion: isEmptyClipRgn=%x\n", isEmptyClipRgn);
|
||||
// scale clip region
|
||||
POINT upleft={0, 0};
|
||||
//(*pClientToScreen)(dxw.GethWnd(), &upleft);
|
||||
(*pClientToScreen)(CurrenthWnd, &upleft);
|
||||
if(IsDebug){
|
||||
OutTraceB("dxwSDC::setClippingRegion: upleft=(%d,%d)\n", upleft.x, upleft.y);
|
||||
ExcludeClipRectsData_Type excludeClipRectsData = { compatDc, GetAncestor(hwnd, GA_ROOT) };
|
||||
if (!isMenuWindow){
|
||||
EnumWindows(&excludeClipRectForOverlappingWindow, (LPARAM)(&excludeClipRectsData));
|
||||
}
|
||||
OffsetRgn(clipRgn, -upleft.x, -upleft.y);
|
||||
if(IsDebug){
|
||||
RECT RgnBox;
|
||||
GetRgnBox(clipRgn, &RgnBox);
|
||||
OutTraceB("dxwSDC::setClippingRegion: RgnBox=(%d,%d)-(%d,%d) size=(%dx%d)\n",
|
||||
RgnBox.left, RgnBox.top, RgnBox.right, RgnBox.bottom, RgnBox.right-RgnBox.left, RgnBox.bottom-RgnBox.top);
|
||||
}
|
||||
// end of scaling
|
||||
SelectClipRgn(compatDc, isEmptyClipRgn ? NULL : clipRgn);
|
||||
DeleteObject(clipRgn);
|
||||
|
||||
HRGN origClipRgn = (*pCreateRectRgn)(0, 0, 0, 0);
|
||||
if (1 == GetClipRgn(origDc, origClipRgn))
|
||||
{
|
||||
OutTraceB("dxwSDC::setClippingRegion: GetClipRgn==1\n");
|
||||
OffsetRgn(origClipRgn, origin.x, origin.y);
|
||||
ExtSelectClipRgn(compatDc, origClipRgn, RGN_AND);
|
||||
if(IsDebug){
|
||||
RECT RgnBox;
|
||||
GetRgnBox(origClipRgn, &RgnBox); // for logging only
|
||||
OutTraceB("dxwSDC::setClippingRegion: OrigRgnBox=(%d,%d)-(%d,%d)\n", RgnBox.left, RgnBox.top, RgnBox.right, RgnBox.bottom);
|
||||
}
|
||||
}
|
||||
DeleteObject(origClipRgn);
|
||||
|
||||
if(dxw.dwFlags7 & FIXCLIPPERAREA){
|
||||
// to finish .....
|
||||
// on Win10 this part seems unnecessary and giving troubles .....
|
||||
if (!isEmptyClipRgn){
|
||||
OutTraceB("dxwSDC::setClippingRegion: isEmptyClipRgn FALSE\n");
|
||||
HWND hwnd = WindowFromDC(origDc);
|
||||
if (hwnd && (!dxw.IsDesktop(hwnd))){
|
||||
ExcludeClipRectsData_Type excludeClipRectsData = { compatDc, origin, dxw.GethWnd() };
|
||||
//ExcludeClipRectsData_Type excludeClipRectsData = { compatDc, origin, GetAncestor(hwnd, GA_ROOT) };
|
||||
OutTraceB("dxwSDC::setClippingRegion: compatdc=%x origin=(%d,%d) ancestor=%x\n",
|
||||
compatDc, origin.x, origin.y, dxw.GethWnd());
|
||||
EnumWindows(&excludeClipRectsForOverlappingWindows,(LPARAM)(&excludeClipRectsData));
|
||||
}
|
||||
}
|
||||
HWND menuWindow = FindWindow((LPCSTR)(0x8000), NULL);
|
||||
while (menuWindow && menuWindow != hwnd){
|
||||
excludeClipRectForOverlappingWindow(menuWindow, (LPARAM)(&excludeClipRectsData));
|
||||
menuWindow = FindWindowEx(NULL, menuWindow, (LPCSTR)(0x8000), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void dxwSDC::setClippingRegion(HDC compatDc, HDC origDc, HWND hwnd, bool isMenuWindow, const POINT& origin)
|
||||
{
|
||||
HRGN clipRgn = (*pCreateRectRgn)(0, 0, 0, 0);
|
||||
if (1 == GetClipRgn(origDc, clipRgn)){
|
||||
OffsetRgn(clipRgn, origin.x, origin.y);
|
||||
SelectClipRgn(compatDc, clipRgn);
|
||||
}
|
||||
|
||||
if ((hwnd) && (dxw.dwFlags7 & FIXCLIPPERAREA)){
|
||||
if (isMenuWindow || 1 != GetRandomRgn(origDc, clipRgn, SYSRGN)){
|
||||
RECT rect = {};
|
||||
(*pGetWindowRect)(hwnd, &rect);
|
||||
(*pSetRectRgn)(clipRgn, rect.left, rect.top, rect.right, rect.bottom);
|
||||
}
|
||||
|
||||
excludeClipRectsForOverlappingWindows(hwnd, isMenuWindow, compatDc);
|
||||
ExtSelectClipRgn(compatDc, clipRgn, RGN_AND);
|
||||
}
|
||||
|
||||
DeleteObject(clipRgn);
|
||||
SetMetaRgn(compatDc);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public: // methods
|
||||
|
||||
private:
|
||||
void copyDcAttributes(HDC, HDC, POINT);
|
||||
void setClippingRegion(HDC, HDC, POINT&);
|
||||
void setClippingRegion(HDC, HDC, HWND, bool, const POINT &);
|
||||
|
||||
HDC PrimaryDC;
|
||||
HDC VirtualHDC;
|
||||
|
@ -109,7 +109,7 @@ void dx_FullScreenToggle(HWND hwnd)
|
||||
}
|
||||
(*pUpdateWindow)(hwnd);
|
||||
RestoreDDrawSurfaces();
|
||||
RestoreD3DSurfaces(bFullScreen);
|
||||
//RestoreD3DSurfaces(bFullScreen);
|
||||
bFullScreen = !bFullScreen; // switch toggle
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
|
||||
static int LastTimeShift;
|
||||
static int SaveTimeShift;
|
||||
static BOOL TimeShiftToggle=TRUE;
|
||||
extern void DDrawScreenShot();
|
||||
extern void DDrawScreenShot(int);
|
||||
|
||||
if(DoOnce){
|
||||
DoOnce=FALSE;
|
||||
@ -558,7 +558,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
|
||||
}
|
||||
break;
|
||||
case DXVK_PRINTSCREEN:
|
||||
DDrawScreenShot();
|
||||
DDrawScreenShot(dxw.dwDDVersion);
|
||||
break;
|
||||
case DXVK_CORNERIZE:
|
||||
dx_Cornerize(hwnd);
|
||||
|
@ -33,6 +33,7 @@ void CTabDirectX::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_FORCECLIPPER, cTarget->m_ForceClipper);
|
||||
DDX_Check(pDX, IDC_BLITFROMBACKBUFFER, cTarget->m_BlitFromBackBuffer);
|
||||
DDX_Check(pDX, IDC_AUTOREFRESH, cTarget->m_AutoRefresh);
|
||||
DDX_Check(pDX, IDC_INDEPENDENTREFRESH, cTarget->m_IndependentRefresh);
|
||||
DDX_Check(pDX, IDC_TEXTUREFORMAT, cTarget->m_TextureFormat);
|
||||
DDX_Check(pDX, IDC_SUPPRESSRELEASE, cTarget->m_SuppressRelease);
|
||||
DDX_Check(pDX, IDC_VIDEOTOSYSTEMMEM, cTarget->m_VideoToSystemMem);
|
||||
|
@ -136,6 +136,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_ForceClipper = FALSE;
|
||||
m_DisableGammaRamp = FALSE;
|
||||
m_AutoRefresh = FALSE;
|
||||
m_IndependentRefresh = FALSE;
|
||||
m_TextureFormat = FALSE;
|
||||
m_FixWinFrame = FALSE;
|
||||
m_EnableClipping = FALSE;
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
BOOL m_ForceClipper;
|
||||
BOOL m_DisableGammaRamp;
|
||||
BOOL m_AutoRefresh;
|
||||
BOOL m_IndependentRefresh;
|
||||
BOOL m_TextureFormat;
|
||||
BOOL m_FixWinFrame;
|
||||
BOOL m_EnableClipping;
|
||||
|
5
host/dxwnd.ini
Normal file
5
host/dxwnd.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[window]
|
||||
posx=50
|
||||
posy=50
|
||||
sizx=320
|
||||
sizy=200
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -194,6 +194,7 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
t->flags7 = 0;
|
||||
t->flags8 = 0;
|
||||
t->tflags = 0;
|
||||
t->dflags = 0;
|
||||
if(dlg->m_UnNotify) t->flags |= UNNOTIFY;
|
||||
if(dlg->m_Windowize) t->flags2 |= WINDOWIZE;
|
||||
if(dlg->m_HookDLLs) t->flags3 |= HOOKDLLS;
|
||||
@ -289,7 +290,6 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_OutDWTrace) t->tflags |= OUTDXWINTRACE;
|
||||
if(dlg->m_OutDDRAWTrace) t->tflags |= OUTDDRAWTRACE;
|
||||
if(dlg->m_OutD3DTrace) t->tflags |= OUTD3DTRACE;
|
||||
//if(dlg->m_DXProxed) t->tflags |= DXPROXED;
|
||||
if(dlg->m_AssertDialog) t->tflags |= ASSERTDIALOG;
|
||||
if(dlg->m_ImportTable) t->tflags |= OUTIMPORTTABLE;
|
||||
if(dlg->m_RegistryOp) t->tflags |= OUTREGISTRY;
|
||||
@ -356,6 +356,7 @@ void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_ForceClipper) t->flags3 |= FORCECLIPPER;
|
||||
if(dlg->m_DisableGammaRamp) t->flags2 |= DISABLEGAMMARAMP;
|
||||
if(dlg->m_AutoRefresh) t->flags |= AUTOREFRESH;
|
||||
if(dlg->m_IndependentRefresh) t->flags2 |= INDEPENDENTREFRESH;
|
||||
if(dlg->m_TextureFormat) t->flags5 |= TEXTUREFORMAT;
|
||||
if(dlg->m_FixWinFrame) t->flags |= FIXWINFRAME;
|
||||
if(dlg->m_EnableClipping) t->flags |= ENABLECLIPPING;
|
||||
@ -544,12 +545,10 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_OutDWTrace = t->tflags & OUTDXWINTRACE ? 1 : 0;
|
||||
dlg->m_OutD3DTrace = t->tflags & OUTD3DTRACE ? 1 : 0;
|
||||
dlg->m_OutDDRAWTrace = t->tflags & OUTDDRAWTRACE ? 1 : 0;
|
||||
//dlg->m_DXProxed = t->tflags & DXPROXED ? 1 : 0;
|
||||
dlg->m_AssertDialog = t->tflags & ASSERTDIALOG ? 1 : 0;
|
||||
dlg->m_ImportTable = t->tflags & OUTIMPORTTABLE ? 1 : 0;
|
||||
dlg->m_RegistryOp = t->tflags & OUTREGISTRY ? 1 : 0;
|
||||
dlg->m_TraceHooks = t->tflags & TRACEHOOKS ? 1 : 0;
|
||||
//dlg->m_HandleDC = t->flags & HANDLEDC ? 1 : 0;
|
||||
dlg->m_HandleExceptions = t->flags & HANDLEEXCEPTIONS ? 1 : 0;
|
||||
dlg->m_SuppressIME = t->flags2 & SUPPRESSIME ? 1 : 0;
|
||||
dlg->m_SuppressD3DExt = t->flags3 & SUPPRESSD3DEXT ? 1 : 0;
|
||||
@ -612,6 +611,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_ForceClipper = t->flags3 & FORCECLIPPER ? 1 : 0;
|
||||
dlg->m_DisableGammaRamp = t->flags2 & DISABLEGAMMARAMP ? 1 : 0;
|
||||
dlg->m_AutoRefresh = t->flags & AUTOREFRESH ? 1 : 0;
|
||||
dlg->m_IndependentRefresh = t->flags2 & INDEPENDENTREFRESH ? 1 : 0;
|
||||
dlg->m_TextureFormat = t->flags5 & TEXTUREFORMAT ? 1 : 0;
|
||||
dlg->m_FixWinFrame = t->flags & FIXWINFRAME ? 1 : 0;
|
||||
dlg->m_EnableClipping = t->flags & ENABLECLIPPING ? 1 : 0;
|
||||
@ -767,6 +767,7 @@ static void SaveConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i,
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "tflag%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->tflags);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
sprintf_s(key, sizeof(key), "dflag%i", i);
|
||||
sprintf_s(val, sizeof(val), "%i", TargetMap->dflags);
|
||||
WritePrivateProfileString("target", key, val, InitPath);
|
||||
|
BIN
host/resource
BIN
host/resource
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user