mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_03_10_src
Former-commit-id: d21fe6df2093a044d93999a386ea86005eddfa30
This commit is contained in:
parent
bb0b5128e0
commit
a7f9d2214f
@ -174,6 +174,7 @@
|
||||
#define STRESSRESOURCES 0x02000000 // simulates a lack of resources condition, for testing (debug opt.)
|
||||
#define MESSAGEPUMP 0x04000000 // inserts a "message pump" loop between repeated operation that may stop the task on Win7 and greater
|
||||
#define TEXTUREFORMAT 0x08000000 // Apply virtual pixel format to texture surfaces without DDSD_PIXELFORMAT attribute
|
||||
#define GSKYHACK 0x10000000 // use VIDEOMEMORY+LOCALVIDMEM capability to turn hw acceleration on ...
|
||||
|
||||
// logging Tflags DWORD:
|
||||
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general
|
||||
@ -189,6 +190,9 @@
|
||||
#define TRACEHOOKS 0x00000400 // log hook operations
|
||||
#define OUTD3DTRACE 0x00000800 // traces DxWnd direct3d screen handling
|
||||
#define OUTDXWINTRACE 0x00001000 // traces DxWnd internal operations
|
||||
#define ADDTIMESTAMP 0x20000000 // att timestamp (GetTickCount) to log file
|
||||
#define OUTDEBUGSTRING 0x40000000 // duplicate logs through OutputDebugString()
|
||||
#define ERASELOGFILE 0x80000000 // clears old trace file before writing new logs
|
||||
|
||||
#define EMULATEFLAGS (EMULATEBUFFER | EMULATESURFACE | LOCKEDSURFACE)
|
||||
#define HANDLEFPS (SHOWFPS | SHOWFPSOVERLAY | LIMITFPS | SKIPFPS)
|
||||
|
@ -7,6 +7,7 @@ lang=automatic
|
||||
;debug=1
|
||||
;multiprocesshook=0
|
||||
;checkadmin=0
|
||||
;debugview=.\DbgView.exe
|
||||
[texture]
|
||||
MinTexX=16
|
||||
MaxTexX=0
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:09c3405b326eb5eff358f5713b62cd1107c84ce64625529de44283cab2b64c9a
|
||||
size 564224
|
||||
oid sha256:1f4a7d264c0d0399abc66b1b547cb25224cb2e3138ae59c1ac06234bae23948c
|
||||
size 567808
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:be381f4fba85d8c7dcb13682c470713728dd133b38e6d4d1ed65fc6ceb74e771
|
||||
size 536064
|
||||
oid sha256:c1dcfaa8abb3449b38509567fc3220db7d161443ceebdb0e398458888c4e490f
|
||||
size 537088
|
||||
|
@ -1,25 +0,0 @@
|
||||
[window]
|
||||
posx=50
|
||||
posy=50
|
||||
sizx=320
|
||||
sizy=200
|
||||
lang=default
|
||||
;lang=automatic
|
||||
debug=1
|
||||
;multiprocesshook=0
|
||||
;checkadmin=0
|
||||
[texture]
|
||||
MinTexX=16
|
||||
MaxTexX=0
|
||||
MinTexY=16
|
||||
MaxTexY=0
|
||||
[keymapping]
|
||||
timetoggle=0x72
|
||||
altf4=0x73
|
||||
timeslow=0x74
|
||||
timefast=0x75
|
||||
cliptoggle=
|
||||
refresh=
|
||||
logtoggle=
|
||||
plocktoggle=
|
||||
fpstoggle=
|
29
build/exports/Interstate 76.dxw
Normal file
29
build/exports/Interstate 76.dxw
Normal file
@ -0,0 +1,29 @@
|
||||
[target]
|
||||
title0=Interstate 76
|
||||
path0=D:\Games\I76\I76.EXE
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=134217762
|
||||
flagg0=2013265920
|
||||
flagh0=20
|
||||
flagi0=138412036
|
||||
flagj0=4224
|
||||
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
|
29
build/exports/V2000.dxw
Normal file
29
build/exports/V2000.dxw
Normal file
@ -0,0 +1,29 @@
|
||||
[target]
|
||||
title0=V2000
|
||||
path0=D:\Games\V2000\V2000.exe
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=671088690
|
||||
flagg0=1207959680
|
||||
flagh0=65556
|
||||
flagi0=-2011168764
|
||||
flagj0=134221952
|
||||
tflag0=0
|
||||
initx0=0
|
||||
inity0=0
|
||||
minx0=0
|
||||
miny0=0
|
||||
maxx0=800
|
||||
maxy0=600
|
||||
posx0=50
|
||||
posy0=50
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
@ -725,3 +725,14 @@ add: "Set texture pixel format" flag, makes "Jeff Gordon XS Racing" working on e
|
||||
add: "GDI mode" emulation uses HALFTONE to activate GDI bilinear stretching when "Full Bilinear" filter is activated: slower, but better quality
|
||||
add: preliminary hooking for EnumZBufferFormats ddraw7 method
|
||||
fix: eliminated some handle leakage when injecting launched processes
|
||||
|
||||
v2.03.10
|
||||
add: real time logging through OutputDebugString
|
||||
add: menu command to launch DbgView.exe
|
||||
add: support for timestamped logs
|
||||
add: "Erase trace file" flag
|
||||
fix: handle leakage for primary hdc, causing rapid performance downgrade
|
||||
fix: log message reorganization
|
||||
add: SetStretchBltMode HALFTONE in GDI mode to provide bilinear filtered GDI stretching
|
||||
fix: some GDI mode optimization - should bring performances similar to D3DWindower, with similar configuration
|
||||
fix: GDI mode bug, crashing when blitting from NULL surface (to do a color fill operation)
|
1
build/redist/.gitattributes
vendored
Normal file
1
build/redist/.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.{dll,exe} filter=lfs diff=lfs merge=lfs -text
|
BIN
build/redist/ICCVID.DLL
Normal file
BIN
build/redist/ICCVID.DLL
Normal file
Binary file not shown.
3
build/redist/_isresce.dll
Normal file
3
build/redist/_isresce.dll
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:011e92e868f1f09904bef59b46972c318c2867c279380182e23bc1fd7eaf1d11
|
||||
size 31744
|
27
build/registry/dxwnd.the Hive.reg
Normal file
27
build/registry/dxwnd.the Hive.reg
Normal file
@ -0,0 +1,27 @@
|
||||
# The Hive registry settings
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Rainbow]
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Rainbow\TheHIVE]
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Rainbow\TheHIVE\GlobalInfo]
|
||||
"currentPlayer"="GHO"
|
||||
"workingGameDirectory"=".\\"
|
||||
|
||||
[HKEY_LOCAL_MACHINE\SOFTWARE\Rainbow\TheHIVE\GHO]
|
||||
"userInfo"=dword:4ac9fbcb
|
||||
"displayMode"=dword:000003fb
|
||||
"profile"=dword:00010020
|
||||
|
||||
# displaymode = 3F7 (fair)
|
||||
# displaymode = 3F9 (good)
|
||||
# displaymode = 3Fa (better)
|
||||
# displaymode = 3Fb (best)
|
||||
|
||||
# userInfo = 4ac9fbcb (1st level)
|
||||
# userInfo = 4B49fADB (2nd level)
|
||||
# userinfo = d249f6d6 (??)
|
||||
|
||||
# profile = 0x00010020 (practice)
|
||||
# profile = 0x00010000 (normal)
|
||||
# profile = 0x00010010 (expert)
|
||||
|
||||
# profile = 0x.......1 (flip joystick direction)
|
268
dll/ddraw.cpp
268
dll/ddraw.cpp
@ -410,41 +410,41 @@ static char *DumpPixelFormat(LPDDSURFACEDESC2 lpddsd)
|
||||
return sBuf;
|
||||
}
|
||||
|
||||
static void LogSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line)
|
||||
static CHAR *LogSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line)
|
||||
{
|
||||
if(!IsTraceDDRAW) return;
|
||||
OutTrace("SurfaceDesc: %s Flags=%x(%s)",
|
||||
static char sInfo[1024];
|
||||
sprintf(sInfo, "SurfaceDesc: %s Flags=%x(%s)",
|
||||
label,
|
||||
lpddsd->dwFlags, ExplainFlags(lpddsd->dwFlags));
|
||||
if (lpddsd->dwFlags & DDSD_BACKBUFFERCOUNT) OutTrace(" BackBufferCount=%d", lpddsd->dwBackBufferCount);
|
||||
if (lpddsd->dwFlags & DDSD_WIDTH) OutTrace(" Width=%d", lpddsd->dwWidth);
|
||||
if (lpddsd->dwFlags & DDSD_HEIGHT) OutTrace(" Height=%d", lpddsd->dwHeight);
|
||||
if (lpddsd->dwFlags & DDSD_PITCH) OutTrace(" Pitch=%d", lpddsd->lPitch);
|
||||
if (lpddsd->dwFlags & DDSD_MIPMAPCOUNT) OutTrace(" MipMapCount=%d", lpddsd->dwMipMapCount);
|
||||
if (lpddsd->dwFlags & DDSD_BACKBUFFERCOUNT) sprintf(sInfo, "%s BackBufferCount=%d", sInfo, lpddsd->dwBackBufferCount);
|
||||
if (lpddsd->dwFlags & DDSD_WIDTH) sprintf(sInfo, "%s Width=%d", sInfo, lpddsd->dwWidth);
|
||||
if (lpddsd->dwFlags & DDSD_HEIGHT) sprintf(sInfo, "%s Height=%d", sInfo, lpddsd->dwHeight);
|
||||
if (lpddsd->dwFlags & DDSD_PITCH) sprintf(sInfo, "%s Pitch=%d", sInfo, lpddsd->lPitch);
|
||||
if (lpddsd->dwFlags & DDSD_MIPMAPCOUNT) sprintf(sInfo, "%s MipMapCount=%d", sInfo, lpddsd->dwMipMapCount);
|
||||
if (lpddsd->dwFlags & DDSD_CAPS) {
|
||||
OutTrace(" Caps=%x(%s)", lpddsd->ddsCaps.dwCaps, ExplainDDSCaps(lpddsd->ddsCaps.dwCaps));
|
||||
sprintf(sInfo, "%s Caps=%x(%s)", sInfo, lpddsd->ddsCaps.dwCaps, ExplainDDSCaps(lpddsd->ddsCaps.dwCaps));
|
||||
if(lpddsd->dwSize==sizeof(DDSURFACEDESC2)){
|
||||
LPDDSURFACEDESC2 lpddsd2=(LPDDSURFACEDESC2)lpddsd;
|
||||
OutTrace(" Caps2=%x(%s)", lpddsd2->ddsCaps.dwCaps2, ExplainDDSCaps2(lpddsd2->ddsCaps.dwCaps2));
|
||||
OutTrace(" Caps3=%x(%s)", lpddsd2->ddsCaps.dwCaps3, ExplainDDSCaps3(lpddsd2->ddsCaps.dwCaps3));
|
||||
sprintf(sInfo, "%s Caps2=%x(%s)", sInfo, lpddsd2->ddsCaps.dwCaps2, ExplainDDSCaps2(lpddsd2->ddsCaps.dwCaps2));
|
||||
sprintf(sInfo, "%s Caps3=%x(%s)", sInfo, lpddsd2->ddsCaps.dwCaps3, ExplainDDSCaps3(lpddsd2->ddsCaps.dwCaps3));
|
||||
}
|
||||
}
|
||||
if (lpddsd->dwFlags & DDSD_CKDESTBLT ) OutTrace(" CKDestBlt=(%x,%x)", lpddsd->ddckCKDestBlt.dwColorSpaceLowValue, lpddsd->ddckCKDestBlt.dwColorSpaceHighValue);
|
||||
if (lpddsd->dwFlags & DDSD_CKDESTOVERLAY ) OutTrace(" CKDestOverlay=(%x,%x)", lpddsd->ddckCKDestOverlay.dwColorSpaceLowValue, lpddsd->ddckCKDestOverlay.dwColorSpaceHighValue);
|
||||
if (lpddsd->dwFlags & DDSD_CKSRCBLT ) OutTrace(" CKSrcBlt=(%x,%x)", lpddsd->ddckCKSrcBlt.dwColorSpaceLowValue, lpddsd->ddckCKSrcBlt.dwColorSpaceHighValue);
|
||||
if (lpddsd->dwFlags & DDSD_CKSRCOVERLAY ) OutTrace(" CKSrcOverlay=(%x,%x)", lpddsd->ddckCKSrcOverlay.dwColorSpaceLowValue, lpddsd->ddckCKSrcOverlay.dwColorSpaceHighValue);
|
||||
if (lpddsd->dwFlags & DDSD_PIXELFORMAT ) OutTrace("%s", DumpPixelFormat((LPDDSURFACEDESC2)lpddsd));
|
||||
if (lpddsd->dwFlags & DDSD_LPSURFACE) OutTrace(" Surface=%x", lpddsd->lpSurface);
|
||||
if (lpddsd->dwFlags & DDSD_ZBUFFERBITDEPTH) OutTrace(" ZBufferBitDepth=%d", lpddsd->dwZBufferBitDepth);
|
||||
if (lpddsd->dwFlags & DDSD_ALPHABITDEPTH) OutTrace(" AlphaBitDepth=%d", lpddsd->dwAlphaBitDepth);
|
||||
if (lpddsd->dwFlags & DDSD_REFRESHRATE) OutTrace(" RefreshRate=%d", lpddsd->dwRefreshRate);
|
||||
if (lpddsd->dwFlags & DDSD_LINEARSIZE) OutTrace(" LinearSize=%d", lpddsd->dwLinearSize);
|
||||
if (lpddsd->dwFlags & DDSD_CKDESTBLT ) sprintf(sInfo, "%s CKDestBlt=(%x,%x)", sInfo, lpddsd->ddckCKDestBlt.dwColorSpaceLowValue, lpddsd->ddckCKDestBlt.dwColorSpaceHighValue);
|
||||
if (lpddsd->dwFlags & DDSD_CKDESTOVERLAY ) sprintf(sInfo, "%s CKDestOverlay=(%x,%x)", sInfo, lpddsd->ddckCKDestOverlay.dwColorSpaceLowValue, lpddsd->ddckCKDestOverlay.dwColorSpaceHighValue);
|
||||
if (lpddsd->dwFlags & DDSD_CKSRCBLT ) sprintf(sInfo, "%s CKSrcBlt=(%x,%x)", sInfo, lpddsd->ddckCKSrcBlt.dwColorSpaceLowValue, lpddsd->ddckCKSrcBlt.dwColorSpaceHighValue);
|
||||
if (lpddsd->dwFlags & DDSD_CKSRCOVERLAY ) sprintf(sInfo, "%s CKSrcOverlay=(%x,%x)", sInfo, lpddsd->ddckCKSrcOverlay.dwColorSpaceLowValue, lpddsd->ddckCKSrcOverlay.dwColorSpaceHighValue);
|
||||
if (lpddsd->dwFlags & DDSD_PIXELFORMAT ) sprintf(sInfo, "%s %s", sInfo, DumpPixelFormat((LPDDSURFACEDESC2)lpddsd));
|
||||
if (lpddsd->dwFlags & DDSD_LPSURFACE) sprintf(sInfo, "%s Surface=%x", sInfo, lpddsd->lpSurface);
|
||||
if (lpddsd->dwFlags & DDSD_ZBUFFERBITDEPTH) sprintf(sInfo, "%s ZBufferBitDepth=%d", sInfo, lpddsd->dwZBufferBitDepth);
|
||||
if (lpddsd->dwFlags & DDSD_ALPHABITDEPTH) sprintf(sInfo, "%s AlphaBitDepth=%d", sInfo, lpddsd->dwAlphaBitDepth);
|
||||
if (lpddsd->dwFlags & DDSD_REFRESHRATE) sprintf(sInfo, "%s RefreshRate=%d", sInfo, lpddsd->dwRefreshRate);
|
||||
if (lpddsd->dwFlags & DDSD_LINEARSIZE) sprintf(sInfo, "%s LinearSize=%d", sInfo, lpddsd->dwLinearSize);
|
||||
if (lpddsd->dwSize == sizeof(DDSURFACEDESC2)){
|
||||
if (lpddsd->dwFlags & DDSD_TEXTURESTAGE) OutTrace(" TextureStage=%x", ((LPDDSURFACEDESC2)lpddsd)->dwTextureStage);
|
||||
if (lpddsd->dwFlags & DDSD_FVF) OutTrace(" FVF=%x", ((LPDDSURFACEDESC2)lpddsd)->dwFVF);
|
||||
if (lpddsd->dwFlags & DDSD_TEXTURESTAGE) sprintf(sInfo, "%s TextureStage=%x", sInfo, ((LPDDSURFACEDESC2)lpddsd)->dwTextureStage);
|
||||
if (lpddsd->dwFlags & DDSD_FVF) sprintf(sInfo, "%s FVF=%x", sInfo, ((LPDDSURFACEDESC2)lpddsd)->dwFVF);
|
||||
}
|
||||
|
||||
OutTrace("\n");
|
||||
|
||||
return sInfo;
|
||||
}
|
||||
|
||||
static void DumpPixFmt(LPDDSURFACEDESC2 lpdds)
|
||||
@ -452,12 +452,6 @@ static void DumpPixFmt(LPDDSURFACEDESC2 lpdds)
|
||||
OutTrace("PixelFormat: lpddsd=%x %s\n", DumpPixelFormat(lpdds));
|
||||
}
|
||||
|
||||
static void DumpSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line)
|
||||
{
|
||||
if(!IsDebug) return;
|
||||
LogSurfaceAttributes(lpddsd, label, line);
|
||||
}
|
||||
|
||||
void DescribeSurface(LPDIRECTDRAWSURFACE lpdds, int dxversion, char *label, int line)
|
||||
{
|
||||
DDSURFACEDESC2 ddsd;
|
||||
@ -491,8 +485,8 @@ void DescribeSurface(LPDIRECTDRAWSURFACE lpdds, int dxversion, char *label, int
|
||||
break;
|
||||
}
|
||||
if(res)return;
|
||||
OutTraceDW("Surface %s: ddsd=%x dxversion=%d ", label, lpdds, dxversion);
|
||||
LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, label, line);
|
||||
OutTraceDW("Surface %s: ddsd=%x dxversion=%d %s\n",
|
||||
label, lpdds, dxversion, LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, label, line));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
@ -1946,10 +1940,11 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd,
|
||||
HRESULT res = 0;
|
||||
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("SetDisplayMode: version=%d dwWidth=%i dwHeight=%i dwBPP=%i",
|
||||
version, dwwidth, dwheight, dwbpp);
|
||||
if (version==2) OutTrace(" dwRefresh=%i dwFlags=%x\n", dwrefreshrate, dwflags);
|
||||
else OutTrace("\n");
|
||||
char sInfo[81];
|
||||
strcpy(sInfo, "");
|
||||
if (version==2) sprintf(sInfo, " dwRefresh=%i dwFlags=%x", dwrefreshrate, dwflags);
|
||||
OutTrace("SetDisplayMode: version=%d dwWidth=%i dwHeight=%i dwBPP=%i%s\n",
|
||||
version, dwwidth, dwheight, dwbpp, sInfo);
|
||||
}
|
||||
|
||||
// binkplayer fix
|
||||
@ -2226,7 +2221,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
|
||||
// create Primary surface
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]" , __LINE__);
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]" , __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res){
|
||||
if (res==DDERR_PRIMARYSURFACEALREADYEXISTS){
|
||||
@ -2247,13 +2242,24 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
OutTraceDW("CreateSurface: created PRIMARY DDSPrim=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim", __LINE__);
|
||||
HookDDSurfacePrim(lplpdds, dxversion);
|
||||
// "Hoyle Casino Empire" opens a primary surface and NOT a backbuffer ....
|
||||
iBakBufferVersion=dxversion; // v2.03.01
|
||||
|
||||
// set a global capability value for surfaces that have to blit to primary
|
||||
// DDSCAPS_OFFSCREENPLAIN seems required to support the palette in memory surfaces
|
||||
// DDSCAPS_SYSTEMMEMORY makes operations faster, but it is not always good...
|
||||
dwBackBufferCaps = (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.dwFlags5 & NOSYSTEMEMULATED) dwBackBufferCaps &= ~DDSCAPS_SYSTEMMEMORY;
|
||||
if(dxw.dwFlags5 & GSKYHACK) dwBackBufferCaps = (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM);
|
||||
|
||||
if(dxw.dwFlags5 & GDIMODE) return DD_OK;
|
||||
|
||||
if(lpDDSEmu_Prim==NULL){
|
||||
ClearSurfaceDesc((void *)&ddsd, dxversion);
|
||||
ddsd.dwFlags = DDSD_CAPS;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuPrim]" , __LINE__);
|
||||
|
||||
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");
|
||||
@ -2286,12 +2292,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
if(lpDDSEmu_Back==NULL){
|
||||
ClearSurfaceDesc((void *)&ddsd, dxversion);
|
||||
ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
|
||||
// DDSCAPS_OFFSCREENPLAIN seems required to support the palette in memory surfaces
|
||||
// DDSCAPS_SYSTEMMEMORY makes operations faster, but it is not always good...
|
||||
ddsd.ddsCaps.dwCaps = (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.dwFlags5 & NOSYSTEMEMULATED) ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
|
||||
dwBackBufferCaps = ddsd.ddsCaps.dwCaps;
|
||||
ddsd.ddsCaps.dwCaps = dwBackBufferCaps;
|
||||
ddsd.dwWidth = dxw.GetScreenWidth();
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
if(dxw.dwFlags4 & BILINEAR2XFILTER){
|
||||
@ -2299,7 +2300,8 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
ddsd.dwWidth = dxw.GetScreenWidth() << 1;
|
||||
ddsd.dwHeight = dxw.GetScreenHeight() << 1;
|
||||
}
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuBack]" , __LINE__);
|
||||
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuBack]", __LINE__));
|
||||
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Back, 0);
|
||||
if(res){
|
||||
@ -2313,9 +2315,6 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
if (dxw.dwTFlags & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Back, dxversion);
|
||||
}
|
||||
|
||||
// "Hoyle Casino Empire" opens a primary surface and NOT a backbuffer ....
|
||||
iBakBufferVersion=dxversion; // v2.03.01
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
@ -2333,7 +2332,7 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
if ((lpddsd->dwFlags & DDSD_CAPS) && (lpddsd->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)) ddsd.ddsCaps.dwCaps &= ~DDSCAPS_SYSTEMMEMORY;
|
||||
|
||||
// create Primary surface
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]" , __LINE__);
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res){
|
||||
if (res==DDERR_PRIMARYSURFACEALREADYEXISTS){
|
||||
@ -2364,7 +2363,7 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
ddsd.ddsCaps.dwCaps = 0;
|
||||
if (dxversion >= 4) ddsd.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN;
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir FixBuf]" , __LINE__);
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir FixBuf]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: ERROR on DDSPrim res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__);
|
||||
@ -2399,7 +2398,7 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
GetPixFmt(&ddsd);
|
||||
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]" , __LINE__);
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res) {
|
||||
OutTraceE("CreateSurface ERROR: res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
@ -2447,7 +2446,7 @@ static HRESULT BuildBackBufferDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
|
||||
ddsd.dwHeight = prim.dwHeight;
|
||||
OutTraceDW("BMX FIX: res=%x(%s) wxh=(%dx%d)\n", res, ExplainDDError(res),ddsd.dwWidth, ddsd.dwHeight);
|
||||
}
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]" , __LINE__);
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]", __LINE__));
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res) {
|
||||
if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){
|
||||
@ -2498,7 +2497,7 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
return res;
|
||||
}
|
||||
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Emu Generic]" , __LINE__);
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Emu Generic]", __LINE__));
|
||||
|
||||
OutTraceDW("CreateSurface: created Emu_Generic dds=%x\n", *lplpdds);
|
||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSEmu_Generic", __LINE__);
|
||||
@ -2523,7 +2522,7 @@ static HRESULT BuildGenericDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf
|
||||
{
|
||||
HRESULT res;
|
||||
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)lpddsd, "[Dir Generic]" , __LINE__);
|
||||
OutTraceDW("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)lpddsd, "[Dir Generic]", __LINE__));
|
||||
|
||||
res = (*pCreateSurface)(lpdd, lpddsd, lplpdds, 0);
|
||||
if(res){
|
||||
@ -2575,10 +2574,8 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate
|
||||
BuildGeneric = BuildGenericDir;
|
||||
}
|
||||
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("CreateSurface: Version=%d lpdd=%x ", dxversion, lpdd);
|
||||
LogSurfaceAttributes((LPDDSURFACEDESC)lpddsd, "[CreateSurface]", __LINE__);
|
||||
}
|
||||
OutTraceDDRAW("CreateSurface: Version=%d lpdd=%x %s\n",
|
||||
dxversion, lpdd, LogSurfaceAttributes((LPDDSURFACEDESC)lpddsd, "[CreateSurface]", __LINE__));
|
||||
|
||||
// check for lpddsd->dwSize value
|
||||
TargetSize=(dxversion<4)?sizeof(DDSURFACEDESC):sizeof(DDSURFACEDESC2);
|
||||
@ -2670,10 +2667,12 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate
|
||||
}
|
||||
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("CreateSurface: created DDSPrim=%x DDSBack=%x", lpDDSPrim, lpDDSBack);
|
||||
if(dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)) OutTrace(" DDSEmu_Prim=%x", lpDDSEmu_Prim);
|
||||
if(dxw.dwFlags1 & EMULATESURFACE) OutTrace(" DDSEmu_Back=%x", lpDDSEmu_Back);
|
||||
OutTrace("\n");
|
||||
char sInfo[256+1];
|
||||
sprintf(sInfo, "CreateSurface: created DDSPrim=%x DDSBack=%x", lpDDSPrim, lpDDSBack);
|
||||
if(dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)) sprintf(sInfo, "%s DDSEmu_Prim=%x", sInfo, lpDDSEmu_Prim);
|
||||
if(dxw.dwFlags1 & EMULATESURFACE) sprintf(sInfo, "%s DDSEmu_Back=%x", sInfo, lpDDSEmu_Back);
|
||||
strcat(sInfo, "\n");
|
||||
OutTrace(sInfo);
|
||||
}
|
||||
|
||||
// rebuild the clipper area
|
||||
@ -2831,36 +2830,37 @@ HRESULT WINAPI extGetAttachedSurface7(LPDIRECTDRAWSURFACE lpdds, LPDDSCAPS lpdds
|
||||
|
||||
void BlitError(HRESULT res, LPRECT lps, LPRECT lpd, int line)
|
||||
{
|
||||
OutTrace("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), line);
|
||||
char sInfo[512];
|
||||
sprintf(sInfo, "Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), line);
|
||||
if (res==DDERR_INVALIDRECT){
|
||||
if (lps)
|
||||
OutTrace(" src=(%d,%d)-(%d,%d)",lps->left, lps->top, lps->right, lps->bottom);
|
||||
sprintf(sInfo, "%s src=(%d,%d)-(%d,%d)", sInfo, lps->left, lps->top, lps->right, lps->bottom);
|
||||
else
|
||||
OutTrace(" src=(NULL)");
|
||||
sprintf(sInfo, "%s src=(NULL)", sInfo);
|
||||
if (lpd)
|
||||
OutTrace(" dest=(%d,%d)-(%d,%d)",lpd->left, lpd->top, lpd->right, lpd->bottom);
|
||||
sprintf(sInfo, "%s dest=(%d,%d)-(%d,%d)", sInfo, lpd->left, lpd->top, lpd->right, lpd->bottom);
|
||||
else
|
||||
OutTrace(" dest=(NULL)");
|
||||
sprintf(sInfo, "%s dest=(NULL)", sInfo);
|
||||
}
|
||||
OutTrace("\n");
|
||||
strcat(sInfo, "\n");
|
||||
OutTrace(sInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
void BlitTrace(char *label, LPRECT lps, LPRECT lpd, int line)
|
||||
{
|
||||
extern HANDLE hTraceMutex;
|
||||
WaitForSingleObject(hTraceMutex, INFINITE);
|
||||
OutTrace("Blt: %s", label);
|
||||
char sInfo[512];
|
||||
sprintf(sInfo, "Blt: %s", label);
|
||||
if (lps)
|
||||
OutTrace(" src=(%d,%d)-(%d,%d)",lps->left, lps->top, lps->right, lps->bottom);
|
||||
sprintf(sInfo, "%s src=(%d,%d)-(%d,%d)", sInfo, lps->left, lps->top, lps->right, lps->bottom);
|
||||
else
|
||||
OutTrace(" src=(NULL)");
|
||||
sprintf(sInfo, "%s src=(NULL)", sInfo);
|
||||
if (lpd)
|
||||
OutTrace(" dest=(%d,%d)-(%d,%d)",lpd->left, lpd->top, lpd->right, lpd->bottom);
|
||||
sprintf(sInfo, "%s dest=(%d,%d)-(%d,%d)", sInfo, lpd->left, lpd->top, lpd->right, lpd->bottom);
|
||||
else
|
||||
OutTrace(" dest=(NULL)");
|
||||
OutTrace(" at %d\n", line);
|
||||
ReleaseMutex(hTraceMutex);
|
||||
sprintf(sInfo, "%s dest=(NULL)", sInfo);
|
||||
sprintf(sInfo, "%s at %d\n", sInfo, line);
|
||||
OutTrace(sInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2924,7 +2924,7 @@ HRESULT WINAPI PrimaryStretchBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, L
|
||||
res=(*pCreateSurface)(lpPrimaryDD, (LPDDSURFACEDESC)&ddsd, &lpddsTmp, NULL);
|
||||
if(res) {
|
||||
OutTraceE("CreateSurface: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(IsDebug) DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Gateway]" , __LINE__);
|
||||
OutTraceB("CreateSurface: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Gateway]", __LINE__));
|
||||
return res;
|
||||
}
|
||||
// stretch-blit to target size on OFFSCREENPLAIN temp surface
|
||||
@ -3226,9 +3226,8 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc,
|
||||
res2=(*pCreateSurfaceMethod(lpdds))(lpPrimaryDD, &ddsd, &lpddsTmp, NULL);
|
||||
if(res2) {
|
||||
OutTraceE("CreateSurface: ERROR %x(%s) at %d\n", res2, ExplainDDError(res2), __LINE__);
|
||||
OutTrace("Size=%d lpPrimaryDD=%x lpDDSBack=%x\n", ddsd.dwSize, lpPrimaryDD, lpDDSBack);
|
||||
LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[FlipBuf]", __LINE__);
|
||||
//dxw.dwFlags4 &= ~NOFLIPEMULATION;
|
||||
OutTraceE("Size=%d lpPrimaryDD=%x lpDDSBack=%x %s\n",
|
||||
ddsd.dwSize, lpPrimaryDD, lpDDSBack, LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[FlipBuf]", __LINE__));
|
||||
}
|
||||
//OutTrace("DEBUG: copied surface size=(%dx%d)\n", ddsd.dwWidth, ddsd.dwHeight);
|
||||
// copy front buffer
|
||||
@ -3317,13 +3316,11 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy,
|
||||
CleanRect(&lpsrcrect,__LINE__);
|
||||
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("BltFast: dest=%x%s src=%x%s dwTrans=%x(%s) (x,y)=(%d,%d) ",
|
||||
lpdds, ToPrim?"(PRIM)":"", lpddssrc, FromPrim?"(PRIM)":"", dwtrans, ExplainBltFastFlags(dwtrans), dwx, dwy);
|
||||
if (lpsrcrect)
|
||||
OutTrace("srcrect=(%d,%d)-(%d,%d)\n",
|
||||
lpsrcrect->left, lpsrcrect->top, lpsrcrect->right, lpsrcrect->bottom);
|
||||
else
|
||||
OutTrace("srcrect=(NULL)\n");
|
||||
char sRect[81];
|
||||
if (lpsrcrect) sprintf(sRect, "(%d,%d)-(%d,%d)", lpsrcrect->left, lpsrcrect->top, lpsrcrect->right, lpsrcrect->bottom);
|
||||
else strcpy(sRect, "(NULL)");
|
||||
OutTrace("BltFast: dest=%x%s src=%x%s dwTrans=%x(%s) (x,y)=(%d,%d) srcrect=%s\n",
|
||||
lpdds, ToPrim?"(PRIM)":"", lpddssrc, FromPrim?"(PRIM)":"", dwtrans, ExplainBltFastFlags(dwtrans), dwx, dwy, sRect);
|
||||
}
|
||||
|
||||
// consistency check ....
|
||||
@ -3460,11 +3457,11 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
|
||||
mySetPalette(0, 256, lpentries); // v2.02.76: necessary for "Requiem Avenging Angel" in SURFACEEMULATION mode
|
||||
}
|
||||
// Apply palette to backbuffer surface. This is necessary on some games: "Duckman private dick", "Total Soccer 2000", ...
|
||||
if (lpDDSBack) {
|
||||
OutTraceDW("SetPalette: apply PRIMARY palette lpDDP=%x to DDSBack=%x\n", lpddp, lpDDSBack);
|
||||
res=(*pSetPalette)(lpDDSBack, lpddp);
|
||||
if(res) OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
}
|
||||
if (lpDDSBack){
|
||||
OutTraceDW("SetPalette: apply PRIMARY palette lpDDP=%x to DDSBack=%x\n", lpddp, lpDDSBack);
|
||||
res=(*pSetPalette)(lpDDSBack, lpddp);
|
||||
if(res) OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
}
|
||||
// add a reference to simulate what would happen in reality....
|
||||
lpdds->AddRef();
|
||||
res=DD_OK;
|
||||
@ -3499,7 +3496,8 @@ HRESULT WINAPI extSetEntries(LPDIRECTDRAWPALETTE lpddp, DWORD dwflags, DWORD dws
|
||||
// e.g. dungeon keeper loading screen, Warcraft II splash, ...
|
||||
// GHO: but refreshing cause flickering when GDI was used without updating the primary surface
|
||||
// e.g. Tomb Raider 2 intro titles, Virtua Fighter PC, ...
|
||||
if ((dxw.dwFlags1 & EMULATESURFACE) && !(dxw.dwFlags2 & NOPALETTEUPDATE)) dxw.ScreenRefresh();
|
||||
// v2.03.10: do not blit also in case of GDI mode
|
||||
if ((dxw.dwFlags1 & EMULATESURFACE) && !(dxw.dwFlags2 & NOPALETTEUPDATE) && !(dxw.dwFlags5 & GDIMODE)) dxw.ScreenRefresh();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@ -3536,18 +3534,16 @@ HRESULT WINAPI extSetClipper(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWCLIPPER lpdd
|
||||
HRESULT WINAPI extLock(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD flags, HANDLE hEvent)
|
||||
{
|
||||
HRESULT res;
|
||||
BOOL IsPrim;
|
||||
|
||||
IsPrim=dxw.IsAPrimarySurface(lpdds);
|
||||
CleanRect(&lprect, __LINE__);
|
||||
|
||||
if(IsTraceDW){
|
||||
OutTrace("Lock: lpdds=%x%s flags=%x(%s) lpDDSurfaceDesc=%x",
|
||||
lpdds, (IsPrim ? "(PRIM)":""), flags, ExplainLockFlags(flags), lpDDSurfaceDesc);
|
||||
if (lprect)
|
||||
OutTrace(" rect=(%d,%d)-(%d,%d)\n", lprect->left, lprect->top, lprect->right, lprect->bottom);
|
||||
else
|
||||
OutTrace(" rect=(NULL)\n");
|
||||
if(IsTraceDDRAW){
|
||||
BOOL IsPrim=dxw.IsAPrimarySurface(lpdds);
|
||||
char sRect[81];
|
||||
if (lprect) sprintf_s(sRect, 80, "(%d,%d)-(%d,%d)", lprect->left, lprect->top, lprect->right, lprect->bottom);
|
||||
else strcpy(sRect, "(NULL)");
|
||||
OutTrace("Lock: lpdds=%x%s flags=%x(%s) lpDDSurfaceDesc=%x rect=%s\n",
|
||||
lpdds, (IsPrim ? "(PRIM)":""), flags, ExplainLockFlags(flags), lpDDSurfaceDesc, sRect);
|
||||
}
|
||||
|
||||
res=(*pLock)(lpdds, lprect, lpDDSurfaceDesc, flags, hEvent);
|
||||
@ -3557,8 +3553,8 @@ HRESULT WINAPI extLock(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACEDESC
|
||||
OutTraceDW("Lock RETRY: ret=%x(%s)\n", res, ExplainDDError(res));
|
||||
}
|
||||
if(res) OutTraceE("Lock ERROR: ret=%x(%s)\n", res, ExplainDDError(res));
|
||||
DumpSurfaceAttributes(lpDDSurfaceDesc, "[Locked]" , __LINE__);
|
||||
OutTraceB("Lock: lPitch=%d lpSurface=%x\n", lpDDSurfaceDesc->lPitch, lpDDSurfaceDesc->lpSurface);
|
||||
OutTraceB("Lock: lPitch=%d lpSurface=%x %s\n",
|
||||
lpDDSurfaceDesc->lPitch, lpDDSurfaceDesc->lpSurface, LogSurfaceAttributes(lpDDSurfaceDesc, "[Locked]", __LINE__));
|
||||
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK;
|
||||
|
||||
return res;
|
||||
@ -3578,12 +3574,12 @@ HRESULT WINAPI extLockDir(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACED
|
||||
// to find out whether it is the primary or not, using lpdds==lpPrimaryDD->GetGDISurface(&lpDDSPrim);
|
||||
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("Lock: lpdds=%x flags=%x(%s) lpDDSurfaceDesc=%x",
|
||||
lpdds, flags, ExplainLockFlags(flags), lpDDSurfaceDesc);
|
||||
if (lprect)
|
||||
OutTrace(" rect=(%d,%d)-(%d,%d)\n", lprect->left, lprect->top, lprect->right, lprect->bottom);
|
||||
else
|
||||
OutTrace(" rect=(NULL)\n");
|
||||
BOOL IsPrim=dxw.IsAPrimarySurface(lpdds);
|
||||
char sRect[81];
|
||||
if (lprect) sprintf_s(sRect, 80, "(%d,%d)-(%d,%d)", lprect->left, lprect->top, lprect->right, lprect->bottom);
|
||||
else strcpy(sRect, "(NULL)");
|
||||
OutTrace("Lock: lpdds=%x%s flags=%x(%s) lpDDSurfaceDesc=%x rect=%s\n",
|
||||
lpdds, (IsPrim ? "(PRIM)":""), flags, ExplainLockFlags(flags), lpDDSurfaceDesc, sRect);
|
||||
}
|
||||
|
||||
// V2.02.43: Empire Earth does some test Lock operations apparently before the primary surface is created
|
||||
@ -3605,8 +3601,7 @@ HRESULT WINAPI extLockDir(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACED
|
||||
ddsd.dwWidth = dxw.GetScreenWidth();
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
ddsd.ddsCaps.dwCaps = 0;
|
||||
//if (SurfaceDescrSize(lpdds)==sizeof(DDSURFACEDESC2)) ddsd.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN;
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir FixBuf]" , __LINE__);
|
||||
OutTraceB("Lock: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir FixBuf]" , __LINE__));
|
||||
res=(*pCreateSurface1)(lpPrimaryDD, (DDSURFACEDESC *)&ddsd, (LPDIRECTDRAWSURFACE *)&lpDDSBuffer, 0);
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: ERROR on DDSBuffer res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__);
|
||||
@ -3638,7 +3633,7 @@ HRESULT WINAPI extLockDir(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDDSURFACED
|
||||
res=(*pLock)(lpdds, lprect, lpDDSurfaceDesc, flags, hEvent);
|
||||
|
||||
if(res) OutTraceE("Lock ERROR: ret=%x(%s)\n", res, ExplainDDError(res));
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)lpDDSurfaceDesc, "[Locked]" , __LINE__);
|
||||
OutTraceB("Lock: %s\n", LogSurfaceAttributes((LPDDSURFACEDESC)lpDDSurfaceDesc, "[Locked]" , __LINE__));
|
||||
if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK;
|
||||
|
||||
return res;
|
||||
@ -3655,16 +3650,14 @@ HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFAC
|
||||
if ((dxversion == 4) && lprect) CleanRect(&lprect,__LINE__);
|
||||
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("Unlock(%d): lpdds=%x%s ", dxversion, lpdds, (IsPrim ? "(PRIM)":""));
|
||||
char sRect[81];
|
||||
if (dxversion == 4){
|
||||
if (lprect){
|
||||
OutTrace("rect=(%d,%d)-(%d,%d)\n", lprect->left, lprect->top, lprect->right, lprect->bottom);
|
||||
}
|
||||
else
|
||||
OutTrace("rect=(NULL)\n");
|
||||
if (lprect) sprintf_s(sRect, 80, "rect=(%d,%d)-(%d,%d)", lprect->left, lprect->top, lprect->right, lprect->bottom);
|
||||
else strcpy(sRect, "rect=(NULL)");
|
||||
}
|
||||
else
|
||||
OutTrace("lpvoid=%x\n", lprect);
|
||||
sprintf_s(sRect, 80, "lpvoid=%x", lprect);
|
||||
OutTrace("Unlock(%d): lpdds=%x%s %s\n", dxversion, lpdds, (IsPrim ? "(PRIM)":""), sRect);
|
||||
}
|
||||
|
||||
res=(*pUnlock)(lpdds, lprect);
|
||||
@ -3712,16 +3705,14 @@ HRESULT WINAPI extUnlockDir(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSUR
|
||||
if ((dxversion >= 4) && lprect) CleanRect(&lprect,__LINE__);
|
||||
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("Unlock: lpdds=%x%s ", lpdds, (IsPrim ? "(PRIM)":""));
|
||||
char sRect[81];
|
||||
if (dxversion == 4){
|
||||
if (lprect){
|
||||
OutTrace("rect=(%d,%d)-(%d,%d)\n", lprect->left, lprect->top, lprect->right, lprect->bottom);
|
||||
}
|
||||
else
|
||||
OutTrace("rect=(NULL)\n");
|
||||
if (lprect) sprintf_s(sRect, 80, "rect=(%d,%d)-(%d,%d)", lprect->left, lprect->top, lprect->right, lprect->bottom);
|
||||
else strcpy(sRect, "rect=(NULL)");
|
||||
}
|
||||
else
|
||||
OutTrace("lpvoid=%x\n", lprect);
|
||||
sprintf_s(sRect, 80, "lpvoid=%x", lprect);
|
||||
OutTrace("Unlock(%d): lpdds=%x%s %s\n", dxversion, lpdds, (IsPrim ? "(PRIM)":""), sRect);
|
||||
}
|
||||
|
||||
if(dxw.dwFlags1 & LOCKEDSURFACE){
|
||||
@ -4183,12 +4174,11 @@ HRESULT WINAPI extSetColorKey(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORK
|
||||
BOOL IsPrim;
|
||||
IsPrim=dxw.IsAPrimarySurface(lpdds);
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("SetColorKey: lpdds=%x%s flags=%x(%s) ",
|
||||
lpdds, (IsPrim ? "(PRIM)" : ""), flags, ExplainColorKeyFlag(flags));
|
||||
if (lpDDColorKey)
|
||||
OutTrace("colors=(L:%x,H:%x)\n",lpDDColorKey->dwColorSpaceLowValue, lpDDColorKey->dwColorSpaceHighValue);
|
||||
else
|
||||
OutTrace("colors=(NULL)\n");
|
||||
char sInfo[81];
|
||||
if (lpDDColorKey) sprintf(sInfo, "(L:%x,H:%x)",lpDDColorKey->dwColorSpaceLowValue, lpDDColorKey->dwColorSpaceHighValue);
|
||||
else strcpy(sInfo, "(NULL)");
|
||||
OutTrace("SetColorKey: lpdds=%x%s flags=%x(%s) colors=%s\n",
|
||||
lpdds, (IsPrim ? "(PRIM)" : ""), flags, ExplainColorKeyFlag(flags), sInfo);
|
||||
}
|
||||
|
||||
res=(*pSetColorKey)(lpdds, flags, lpDDColorKey);
|
||||
@ -4490,7 +4480,7 @@ HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDR
|
||||
return res;
|
||||
}
|
||||
|
||||
LogSurfaceAttributes(lpddsd, "GetSurfaceDesc", __LINE__);
|
||||
OutTraceDDRAW("GetSurfaceDesc: lpdds=%x %s\n", lpdds, LogSurfaceAttributes(lpddsd, "GetSurfaceDesc", __LINE__));
|
||||
|
||||
if (IsPrim) {
|
||||
OutTraceDW("GetSurfaceDesc: fixing PRIMARY surface\n");
|
||||
@ -4524,7 +4514,9 @@ HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDR
|
||||
}
|
||||
}
|
||||
|
||||
if(IsFixed) LogSurfaceAttributes(lpddsd, "GetSurfaceDesc [FIXED]", __LINE__);
|
||||
if(IsFixed){
|
||||
OutTraceDW("GetSurfaceDesc: lpdds=%x %s\n", lpdds, LogSurfaceAttributes(lpddsd, "GetSurfaceDesc [FIXED]", __LINE__));
|
||||
}
|
||||
|
||||
return DD_OK;
|
||||
}
|
||||
|
@ -153,27 +153,33 @@ static void OutTraceHeader(FILE *fp)
|
||||
fprintf(fp, "***\n");
|
||||
}
|
||||
|
||||
#define DXWMAXLOGSIZE 4096
|
||||
|
||||
void OutTrace(const char *format, ...)
|
||||
{
|
||||
va_list al;
|
||||
static char path[MAX_PATH];
|
||||
static FILE *fp=NULL; // GHO: thread safe???
|
||||
char sBuf[DXWMAXLOGSIZE+1];
|
||||
DWORD tFlags;
|
||||
static GetTickCount_Type pGetTick;
|
||||
|
||||
// check global log flag
|
||||
if(!(dxw.dwTFlags & OUTTRACE)) return;
|
||||
if(!(dxw.dwTFlags & (OUTTRACE|OUTDEBUGSTRING))) return;
|
||||
tFlags = dxw.dwTFlags;
|
||||
dxw.dwTFlags = 0x0; // to avoid possible log recursion while loading C runtime libraries!!!
|
||||
|
||||
WaitForSingleObject(hTraceMutex, INFINITE);
|
||||
if (fp == NULL){
|
||||
char *OpenMode = (tFlags & ERASELOGFILE) ? "w+" : "a+";
|
||||
pGetTick = GetTickCount; // save function pointer
|
||||
GetCurrentDirectory(MAX_PATH, path);
|
||||
strcat(path, "\\dxwnd.log");
|
||||
fp = fopen(path, "a+");
|
||||
fp = fopen(path, OpenMode);
|
||||
if (fp==NULL){ // in case of error (e.g. current dir on unwritable CD unit)...
|
||||
strcpy(path, GetDxWndPath());
|
||||
strcat(path, "\\dxwnd.log");
|
||||
fp = fopen(path, "a+");
|
||||
fp = fopen(path, OpenMode);
|
||||
}
|
||||
if (fp==NULL)
|
||||
return; // last chance: do not log...
|
||||
@ -181,11 +187,18 @@ void OutTrace(const char *format, ...)
|
||||
OutTraceHeader(fp);
|
||||
}
|
||||
va_start(al, format);
|
||||
vfprintf(fp, format, al);
|
||||
//vfprintf(fp, format, al);
|
||||
vsprintf_s(sBuf, DXWMAXLOGSIZE, format, al);
|
||||
sBuf[DXWMAXLOGSIZE]=0; // just in case of log truncation
|
||||
va_end(al);
|
||||
if(tFlags & OUTTRACE) {
|
||||
if(tFlags & ADDTIMESTAMP) fprintf(fp, "%08.8d: ", (*pGetTick)());
|
||||
fputs(sBuf, fp);
|
||||
fflush(fp);
|
||||
}
|
||||
if(tFlags & OUTDEBUGSTRING) OutputDebugString(sBuf);
|
||||
ReleaseMutex(hTraceMutex);
|
||||
|
||||
fflush(fp);
|
||||
dxw.dwTFlags = tFlags; // restore settings
|
||||
}
|
||||
|
||||
@ -775,23 +788,25 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
|
||||
// v2.1.93: adjust clipping region
|
||||
|
||||
if(IsTraceW){
|
||||
OutTrace("WindowProc[%x]: WinMsg=[0x%x]%s(%x,%x)", hwnd, message, ExplainWinMessage(message), wparam, lparam);
|
||||
char sPos[161];
|
||||
sPos[160]=0;
|
||||
sPos[0]=0;
|
||||
switch(message){
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
LPWINDOWPOS wp;
|
||||
wp = (LPWINDOWPOS)lparam;
|
||||
OutTrace(" pos=(%d,%d) size=(%dx%d) flags=%x(%s)", wp->x, wp->y, wp->cx, wp->cy, wp->flags, ExplainWPFlags(wp->flags));
|
||||
sprintf_s(sPos, 160, " pos=(%d,%d) size=(%dx%d) flags=%x(%s)", wp->x, wp->y, wp->cx, wp->cy, wp->flags, ExplainWPFlags(wp->flags));
|
||||
break;
|
||||
case WM_MOVE:
|
||||
OutTrace(" pos=(%d,%d)", HIWORD(lparam), LOWORD(lparam));
|
||||
sprintf_s(sPos, 160, " pos=(%d,%d)", HIWORD(lparam), LOWORD(lparam));
|
||||
break;
|
||||
case WM_SIZE:
|
||||
static char *modes[5]={"RESTORED", "MINIMIZED", "MAXIMIZED", "MAXSHOW", "MAXHIDE"};
|
||||
OutTrace(" mode=SIZE_%s size=(%dx%d)", modes[wparam % 5], HIWORD(lparam), LOWORD(lparam));
|
||||
break;
|
||||
sprintf_s(sPos, 160, " mode=SIZE_%s size=(%dx%d)", modes[wparam % 5], HIWORD(lparam), LOWORD(lparam));
|
||||
break;
|
||||
}
|
||||
OutTrace("\n");
|
||||
OutTrace("WindowProc[%x]: WinMsg=[0x%x]%s(%x,%x) %s\n", hwnd, message, ExplainWinMessage(message), wparam, lparam, sPos);
|
||||
}
|
||||
|
||||
if(dxw.dwFlags3 & FILTERMESSAGES){
|
||||
@ -1219,7 +1234,7 @@ LONG WINAPI myUnhandledExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo)
|
||||
switch(ExceptionInfo->ExceptionRecord->ExceptionCode){
|
||||
case 0xc0000094: // IDIV reg (Ultim@te Race Pro)
|
||||
case 0xc0000095: // DIV by 0 (divide overflow) exception (SonicR)
|
||||
case 0xc0000096: // CLI Priviliged instruction exception (Resident Evil)
|
||||
case 0xc0000096: // CLI Priviliged instruction exception (Resident Evil), FB (Asterix & Obelix)
|
||||
case 0xc000001d: // FEMMS (eXpendable)
|
||||
case 0xc0000005: // Memory exception (Tie Fighter)
|
||||
int cmdlen;
|
||||
@ -1235,6 +1250,8 @@ LONG WINAPI myUnhandledExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo)
|
||||
VirtualProtect(target, 10, oldprot, &oldprot);
|
||||
if(!FlushInstructionCache(GetCurrentProcess(), target, cmdlen))
|
||||
OutTrace("UnhandledExceptionFilter: FlushInstructionCache ERROR target=%x, err=%x\n", target, GetLastError());
|
||||
// v2.03.10 skip replaced opcode
|
||||
ExceptionInfo->ContextRecord->Eip += cmdlen; // skip ahead op-code length
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
break;
|
||||
default:
|
||||
@ -1707,12 +1724,13 @@ void HookInit(TARGETMAP *target, HWND hwnd)
|
||||
#endif
|
||||
|
||||
if(IsTraceDW){
|
||||
OutTrace("HookInit: path=\"%s\" module=\"%s\" dxversion=%s pos=(%d,%d) size=(%d,%d)",
|
||||
target->path, target->module, dxversions[dxw.dwTargetDDVersion],
|
||||
target->posx, target->posy, target->sizx, target->sizy);
|
||||
if(hwnd) OutTrace(" hWnd=%x(hdc=%x) dxw.hParentWnd=%x(hdc=%x) desktop=%x(hdc=%x)\n",
|
||||
char sInfo[1024];
|
||||
strcpy(sInfo, "");
|
||||
if(hwnd) sprintf(sInfo, " hWnd=%x(hdc=%x) dxw.hParentWnd=%x(hdc=%x) desktop=%x(hdc=%x)",
|
||||
hwnd, GetDC(hwnd), dxw.hParentWnd, GetDC(dxw.hParentWnd), GetDesktopWindow(), GetDC(GetDesktopWindow()));
|
||||
else OutTrace("\n");
|
||||
OutTrace("HookInit: path=\"%s\" module=\"%s\" dxversion=%s pos=(%d,%d) size=(%d,%d)%s\n",
|
||||
target->path, target->module, dxversions[dxw.dwTargetDDVersion],
|
||||
target->posx, target->posy, target->sizx, target->sizy, sInfo);
|
||||
if (dxw.dwFlags4 & LIMITSCREENRES) OutTrace("HookInit: max resolution=%s\n", (dxw.MaxScreenRes<6)?Resolutions[dxw.MaxScreenRes]:"unknown");
|
||||
}
|
||||
|
||||
|
@ -916,10 +916,13 @@ POINT dxwCore::SubCoordinates(POINT p1, POINT p2)
|
||||
|
||||
void dxwCore::DumpPalette(DWORD dwcount, LPPALETTEENTRY lpentries)
|
||||
{
|
||||
char sInfo[(14*256)+1];
|
||||
sInfo[0]=0;
|
||||
for(DWORD idx=0; idx<dwcount; idx++)
|
||||
OutTrace("(%02x.%02x.%02x:%02x)",
|
||||
sprintf(sInfo, "%s(%02x.%02x.%02x:%02x)", sInfo,
|
||||
lpentries[idx].peRed, lpentries[idx].peGreen, lpentries[idx].peBlue, lpentries[idx].peFlags);
|
||||
OutTrace("\n");
|
||||
strcat(sInfo,"\n");
|
||||
OutTrace(sInfo);
|
||||
}
|
||||
|
||||
void dxwCore::ScreenRefresh(void)
|
||||
@ -1057,6 +1060,7 @@ BOOL dxwCore::HandleFPS()
|
||||
void dxwCore::SetVSyncDelays(UINT RefreshRate)
|
||||
{
|
||||
int Reminder;
|
||||
char sInfo[256];
|
||||
|
||||
if((RefreshRate < 10) || (RefreshRate > 100)) return;
|
||||
|
||||
@ -1069,9 +1073,11 @@ void dxwCore::SetVSyncDelays(UINT RefreshRate)
|
||||
Reminder=(1000+Reminder)-(iRefreshDelays[iRefreshDelayCount]*gdwRefreshRate);
|
||||
iRefreshDelayCount++;
|
||||
} while(Reminder && (iRefreshDelayCount<MAXREFRESHDELAYCOUNT));
|
||||
OutTraceDW("Refresh rate=%d: delay=", gdwRefreshRate);
|
||||
for(int i=0; i<iRefreshDelayCount; i++) OutTraceDW("%d ", iRefreshDelays[i]);
|
||||
OutTraceDW("\n");
|
||||
if(IsTraceDW){
|
||||
strcpy(sInfo, "");
|
||||
for(int i=0; i<iRefreshDelayCount; i++) sprintf(sInfo, "%s%d ", sInfo, iRefreshDelays[i]);
|
||||
OutTraceDW("Refresh rate=%d: delay=%s\n", gdwRefreshRate, sInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void dxwCore::VSyncWait()
|
||||
@ -1291,7 +1297,7 @@ void dxwCore::ShowOverlay(HDC hdc)
|
||||
if(!hdc) return;
|
||||
RECT rect;
|
||||
(*pGetClientRect)(hWnd, &rect);
|
||||
this->ShowOverlay(GetDC(hWnd), rect.right, rect.bottom);
|
||||
this->ShowOverlay(hdc, rect.right, rect.bottom);
|
||||
}
|
||||
|
||||
void dxwCore::ShowOverlay(HDC hdc, int w, int h)
|
||||
|
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "TlHelp32.h"
|
||||
|
||||
#define VERSION "2.03.09"
|
||||
#define VERSION "2.03.10"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
//#define LOCKTHREADS
|
||||
@ -56,6 +56,8 @@ BOOL APIENTRY DllMain( HANDLE hmodule,
|
||||
LPVOID preserved
|
||||
)
|
||||
{
|
||||
HANDLE hCurrentThread;
|
||||
|
||||
if(dwreason == DLL_PROCESS_DETACH){
|
||||
UnmapViewOfFile(pMapping);
|
||||
CloseHandle(hMapping);
|
||||
@ -63,36 +65,8 @@ BOOL APIENTRY DllMain( HANDLE hmodule,
|
||||
|
||||
if(dwreason != DLL_PROCESS_ATTACH) return TRUE;
|
||||
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); // trick to reduce concurrency problems at program startup
|
||||
|
||||
#ifdef LOCKTHREADS
|
||||
DWORD currentPID = GetCurrentProcessId();
|
||||
DWORD currentTID = GetCurrentThreadId();
|
||||
if(currentTID && currentPID){
|
||||
int ThreadCount=0;
|
||||
HANDLE hThreadSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, NULL);
|
||||
if(hThreadSnapshot != INVALID_HANDLE_VALUE){
|
||||
DWORD result = 0;
|
||||
THREADENTRY32 tEntry;
|
||||
tEntry.dwSize = sizeof(THREADENTRY32);
|
||||
for (BOOL success = Thread32First(hThreadSnapshot, &tEntry);
|
||||
!result && success && GetLastError() != ERROR_NO_MORE_FILES;
|
||||
success = Thread32Next(hThreadSnapshot, &tEntry)){
|
||||
if ((tEntry.th32ThreadID != currentTID) && (tEntry.th32OwnerProcessID == currentPID)){
|
||||
HANDLE th;
|
||||
th=OpenThread(THREAD_SUSPEND_RESUME, FALSE, tEntry.th32ThreadID);
|
||||
ThreadCount++;
|
||||
SuspendThread(th);
|
||||
CloseHandle(th);
|
||||
}
|
||||
}
|
||||
CloseHandle(hThreadSnapshot);
|
||||
//char sMsg[81];
|
||||
//sprintf(sMsg,"suspended threads=%d", ThreadCount);
|
||||
//MessageBox(0, sMsg, "info", MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
hCurrentThread = GetCurrentThread();
|
||||
SetThreadPriority(hCurrentThread, THREAD_PRIORITY_HIGHEST); // trick to reduce concurrency problems at program startup
|
||||
|
||||
hInst = (HINSTANCE)hmodule;
|
||||
// optimization: disables DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the specified DLL
|
||||
@ -119,35 +93,9 @@ BOOL APIENTRY DllMain( HANDLE hmodule,
|
||||
if(!hDDLockMutex) hDDLockMutex = CreateMutex(0, FALSE, "DDLock_Mutex");
|
||||
}
|
||||
InjectHook();
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
|
||||
|
||||
#ifdef LOCKTHREADS
|
||||
if(currentTID && currentPID){
|
||||
int ThreadCount=0;
|
||||
HANDLE hThreadSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, NULL);
|
||||
if(hThreadSnapshot != INVALID_HANDLE_VALUE){
|
||||
DWORD result = 0;
|
||||
THREADENTRY32 tEntry;
|
||||
tEntry.dwSize = sizeof(THREADENTRY32);
|
||||
for (BOOL success = Thread32First(hThreadSnapshot, &tEntry);
|
||||
!result && success && GetLastError() != ERROR_NO_MORE_FILES;
|
||||
success = Thread32Next(hThreadSnapshot, &tEntry)){
|
||||
if ((tEntry.th32ThreadID != currentTID) && (tEntry.th32OwnerProcessID == currentPID)){
|
||||
HANDLE th;
|
||||
th=OpenThread(THREAD_SUSPEND_RESUME, FALSE, tEntry.th32ThreadID);
|
||||
ThreadCount++;
|
||||
ResumeThread(th);
|
||||
CloseHandle(th);
|
||||
}
|
||||
}
|
||||
CloseHandle(hThreadSnapshot);
|
||||
//char sMsg[81];
|
||||
//sprintf(sMsg,"resumed threads=%d", ThreadCount);
|
||||
//MessageBox(0, sMsg, "info", MB_OK | MB_ICONEXCLAMATION);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SetThreadPriority(hCurrentThread, THREAD_PRIORITY_NORMAL);
|
||||
CloseHandle(hCurrentThread);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
@ -1,3 +1,5 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
#include "syslibs.h"
|
||||
@ -301,19 +303,21 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
|
||||
|
||||
res = (*pGDIGetDeviceCaps)(hdc, nindex);
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("GetDeviceCaps: hdc=%x index=%x(%s)", hdc, nindex, ExplainDeviceCaps(nindex));
|
||||
char sInfo[1024];
|
||||
sprintf(sInfo, "GetDeviceCaps: hdc=%x index=%x(%s)", hdc, nindex, ExplainDeviceCaps(nindex));
|
||||
switch(nindex){
|
||||
case RASTERCAPS:
|
||||
OutTrace(" res=0x%04x(%s)\n",res, ExplainRasterCaps(res)); break;
|
||||
sprintf(sInfo, "%s res=0x%04x(%s)\n", sInfo, res, ExplainRasterCaps(res)); break;
|
||||
case BITSPIXEL:
|
||||
case COLORRES:
|
||||
case VERTRES:
|
||||
case SIZEPALETTE:
|
||||
case NUMRESERVED:
|
||||
OutTrace(" res=%d\n",res); break;
|
||||
sprintf(sInfo, "%s res=%d\n", sInfo, res); break;
|
||||
default:
|
||||
OutTrace(" res=0x%04x\n",res); break;
|
||||
sprintf(sInfo, "%s res=0x%04x\n", sInfo, res); break;
|
||||
}
|
||||
OutTrace(sInfo);
|
||||
}
|
||||
|
||||
switch(nindex){
|
||||
@ -897,6 +901,7 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
|
||||
//return (*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
|
||||
}
|
||||
|
||||
SetStretchBltMode(hdcDest, HALFTONE);
|
||||
if (OBJ_DC == GetObjectType(hdcDest)){
|
||||
//if(dxw.IsRealDesktop(WindowFromDC(hdcDest))) hdcDest=GetDC(dxw.GethWnd()); // ??????
|
||||
if (dxw.HandleFPS()) return TRUE;
|
||||
@ -1118,6 +1123,7 @@ int WINAPI extGetRgnBox(HRGN hrgn, LPRECT lprc)
|
||||
|
||||
BOOL WINAPI extPolyline(HDC hdc, const POINT *lppt, int cPoints)
|
||||
{
|
||||
// LOGTOBEFIXED
|
||||
BOOL ret;
|
||||
if(IsTraceDDRAW){
|
||||
int i;
|
||||
@ -1183,6 +1189,7 @@ BOOL WINAPI extMoveToEx(HDC hdc, int X, int Y, LPPOINT lpPoint)
|
||||
|
||||
BOOL WINAPI extPolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes, int cCount)
|
||||
{
|
||||
// LOGTOBEFIXED
|
||||
BOOL ret;
|
||||
if(IsTraceDDRAW){
|
||||
int i;
|
||||
@ -1206,6 +1213,7 @@ BOOL WINAPI extPolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes, int cC
|
||||
|
||||
BOOL WINAPI extPolylineTo(HDC hdc, const POINT *lppt, DWORD cCount)
|
||||
{
|
||||
// LOGTOBEFIXED
|
||||
BOOL ret;
|
||||
if(IsTraceDDRAW){
|
||||
DWORD i;
|
||||
@ -1229,6 +1237,7 @@ BOOL WINAPI extPolylineTo(HDC hdc, const POINT *lppt, DWORD cCount)
|
||||
|
||||
BOOL WINAPI extPolyBezierTo(HDC hdc, const POINT *lppt, DWORD cCount)
|
||||
{
|
||||
// LOGTOBEFIXED
|
||||
BOOL ret;
|
||||
if(IsTraceDDRAW){
|
||||
DWORD i;
|
||||
@ -1391,6 +1400,7 @@ BOOL WINAPI extEllipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int
|
||||
|
||||
BOOL WINAPI extPolygon(HDC hdc, const POINT *lpPoints, int cCount)
|
||||
{
|
||||
// LOGTOBEFIXED
|
||||
BOOL ret;
|
||||
if(IsTraceDDRAW){
|
||||
int i;
|
||||
@ -1492,6 +1502,7 @@ HRGN WINAPI extCreateRectRgnIndirect(const RECT *lprc)
|
||||
|
||||
HRGN WINAPI extCreatePolygonRgn(const POINT *lpPoints, int cPoints, int fnPolyFillMode)
|
||||
{
|
||||
// LOGTOBEFIXED
|
||||
HRGN ret;
|
||||
if(IsTraceDDRAW){
|
||||
int i;
|
||||
@ -1817,11 +1828,10 @@ BOOL WINAPI extExtTextOutA(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lp
|
||||
{
|
||||
RECT rc;
|
||||
if(IsTraceDW){
|
||||
OutTrace("ExtTextOutA: hdc=%x pos=(%d,%d) String=\"%s\" rect=", hdc, X, Y, lpString);
|
||||
if(lprc)
|
||||
OutTrace("(%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
else
|
||||
OutTrace("NULL\n");
|
||||
char sRect[81];
|
||||
if(lprc) sprintf(sRect, "(%d,%d)-(%d,%d)", lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
else strcpy(sRect, "NULL");
|
||||
OutTrace("ExtTextOutA: hdc=%x pos=(%d,%d) String=\"%s\" rect=%s\n", hdc, X, Y, lpString, sRect);
|
||||
}
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc)) && !gFixed){
|
||||
@ -1839,11 +1849,10 @@ BOOL WINAPI extExtTextOutW(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lp
|
||||
{
|
||||
RECT rc;
|
||||
if(IsTraceDW){
|
||||
OutTrace("ExtTextOutW: hdc=%x pos=(%d,%d) String=\"%ls\" rect=", hdc, X, Y, lpString);
|
||||
if(lprc)
|
||||
OutTrace("(%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
else
|
||||
OutTrace("NULL\n");
|
||||
char sRect[81];
|
||||
if(lprc) sprintf(sRect, "(%d,%d)-(%d,%d)", lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
else strcpy(sRect, "NULL");
|
||||
OutTrace("ExtTextOutW: hdc=%x pos=(%d,%d) String=\"%ls\" rect=%s\n", hdc, X, Y, lpString, sRect);
|
||||
}
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc)) && !gFixed){
|
||||
|
@ -18,6 +18,52 @@ extern GetDC_Type pGetDC;
|
||||
extern ReleaseDC_Type pReleaseDC;
|
||||
extern Unlock1_Type pUnlock1;
|
||||
|
||||
//#define HDC_CACHE_OPTIMIZED
|
||||
|
||||
#ifdef HDC_CACHE_OPTIMIZED
|
||||
void BlitToWindow(HWND w, LPDIRECTDRAWSURFACE s)
|
||||
{
|
||||
static HDC thdc = NULL;
|
||||
HDC shdc;
|
||||
static HWND LastWindow = NULL;
|
||||
RECT client;
|
||||
HRESULT res;
|
||||
BOOL ret;
|
||||
|
||||
if(!s) return; // for surface color fill
|
||||
ret=(*pGetClientRect)(w, &client);
|
||||
if(!ret) OutTrace("GetClientRect error=%d\n", GetLastError());
|
||||
res=(*pGetDC)(s, &shdc);
|
||||
if(res) OutTrace("ddraw GetDC error lpdds=%x res=%x(%s)\n", s, res, ExplainDDError(res));
|
||||
if(w != LastWindow){
|
||||
if(LastWindow){
|
||||
ret=(*pGDIReleaseDC)(LastWindow, thdc);
|
||||
if(!ret) OutTrace("GDI ReleaseDC error=%d\n", GetLastError());
|
||||
}
|
||||
LastWindow = w;
|
||||
thdc=(*pGDIGetDC)(w);
|
||||
if(!thdc) OutTrace("GDI GetDC error=%d\n", GetLastError());
|
||||
}
|
||||
if(dxw.dwFlags5 & CENTERTOWIN){
|
||||
int x, y;
|
||||
x = (client.right - dxw.GetScreenWidth()) >> 1; // right-shift 1 bit means divide by 2!
|
||||
y = (client.bottom - dxw.GetScreenHeight()) >> 1;
|
||||
ret=(*pGDIBitBlt)(thdc, x, y, dxw.GetScreenWidth(), dxw.GetScreenHeight(), shdc, 0, 0, SRCCOPY);
|
||||
if(!ret) OutTrace("BitBlt error=%d\n", GetLastError());
|
||||
}
|
||||
else{
|
||||
if(dxw.dwFlags5 & BILINEARFILTER) {
|
||||
ret=SetStretchBltMode(thdc, HALFTONE);
|
||||
if((!ret) || (ret==ERROR_INVALID_PARAMETER)) OutTrace("GDI SetStretchBltMode error=%d\n", GetLastError());
|
||||
}
|
||||
ret=(*pGDIStretchBlt)(thdc, 0, 0, client.right, client.bottom, shdc, 0, 0, dxw.GetScreenWidth(), dxw.GetScreenHeight(), SRCCOPY);
|
||||
if(!ret) OutTrace("GDI StretchBlt error=%d\n", GetLastError());
|
||||
}
|
||||
dxw.ShowOverlay(thdc);
|
||||
res=(*pReleaseDC)(s, shdc);
|
||||
if(res) OutTrace("ddraw ReleaseDC error lpdds=%x res=%x(%s)\n", s, res, ExplainDDError(res));
|
||||
}
|
||||
#else
|
||||
void BlitToWindow(HWND w, LPDIRECTDRAWSURFACE s)
|
||||
{
|
||||
HDC shdc, thdc;
|
||||
@ -25,7 +71,7 @@ void BlitToWindow(HWND w, LPDIRECTDRAWSURFACE s)
|
||||
HRESULT res;
|
||||
BOOL ret;
|
||||
|
||||
(*pUnlock1)(s, NULL);
|
||||
if(!s) return; // for surface color fill
|
||||
ret=(*pGetClientRect)(w, &client);
|
||||
if(!ret) OutTrace("GetClientRect error=%d\n", GetLastError());
|
||||
res=(*pGetDC)(s, &shdc);
|
||||
@ -53,4 +99,4 @@ void BlitToWindow(HWND w, LPDIRECTDRAWSURFACE s)
|
||||
ret=(*pGDIReleaseDC)(w, thdc);
|
||||
if(!ret) OutTrace("GDI ReleaseDC error=%d\n", GetLastError());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -617,10 +617,14 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc)
|
||||
break;
|
||||
#ifndef ANTICHEATING
|
||||
case SYSLIBIDX_KERNEL32:
|
||||
if ((DWORD)proc == 0x022D){ // "IsDebuggerPresent"
|
||||
if ((DWORD)proc == 0x0305){ // "IsDebuggerPresent"
|
||||
OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extIsDebuggerPresent);
|
||||
return (FARPROC)extIsDebuggerPresent;
|
||||
}
|
||||
if ((DWORD)proc == 0x0050){ // "CheckRemoteDebuggerPresent"
|
||||
OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), extCheckRemoteDebuggerPresent);
|
||||
return (FARPROC)extCheckRemoteDebuggerPresent;
|
||||
}
|
||||
#endif
|
||||
case SYSLIBIDX_OLE32:
|
||||
if ((DWORD)proc == 0x0011){ // "CoCreateInstance"
|
||||
@ -819,10 +823,11 @@ BOOL WINAPI extCreateProcessA(
|
||||
OutTrace("CreateProcess: event=%x(%s)\n", debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
|
||||
switch(debug_event.dwDebugEventCode){
|
||||
case EXIT_PROCESS_DEBUG_EVENT:
|
||||
//OutTrace("CreateProcess: event=%x(%s) process terminated\n", debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
|
||||
bContinueDebugging=false;
|
||||
OutTrace("CreateProcess: process terminated\n", res);
|
||||
break;
|
||||
case CREATE_PROCESS_DEBUG_EVENT:
|
||||
//OutTrace("CreateProcess: event=%x(%s) process started\n", debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
|
||||
GetModuleFileName(GetModuleHandle("dxwnd"), path, MAX_PATH);
|
||||
OutTrace("CreateProcess: injecting path=%s\n", path);
|
||||
if(!Inject(lpProcessInformation->dwProcessId, path)){
|
||||
@ -832,7 +837,7 @@ BOOL WINAPI extCreateProcessA(
|
||||
extern LPVOID GetThreadStartAddress(HANDLE);
|
||||
DWORD TargetHandle;
|
||||
DWORD EndlessLoop;
|
||||
EndlessLoop=0x9090FEEB; // assembly for JMP to here, NOP, NOP
|
||||
EndlessLoop=0x9090FEEB; // assembly for JMP to here, NOP, NOP
|
||||
SIZE_T BytesCount;
|
||||
TargetHandle = (DWORD)OpenProcess(
|
||||
PROCESS_QUERY_INFORMATION|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE,
|
||||
@ -858,6 +863,7 @@ BOOL WINAPI extCreateProcessA(
|
||||
CloseHandle(((CREATE_PROCESS_DEBUG_INFO *)&debug_event.u)->hFile);
|
||||
break;
|
||||
case EXIT_THREAD_DEBUG_EVENT:
|
||||
//OutTrace("CreateProcess: event=%x(%s) injection terminated\n", debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
|
||||
#ifdef LOCKINJECTIONTHREADS
|
||||
if(TargetHandle && StartAddress){
|
||||
if(dxw.dwFlags5 & FREEZEINJECTEDSON){
|
||||
@ -874,6 +880,7 @@ BOOL WINAPI extCreateProcessA(
|
||||
#endif
|
||||
bContinueDebugging=false;
|
||||
case EXCEPTION_DEBUG_EVENT:
|
||||
//OutTrace("CreateProcess: event=%x(%s)\n", debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode));
|
||||
{
|
||||
LPEXCEPTION_DEBUG_INFO ei;
|
||||
ei=(LPEXCEPTION_DEBUG_INFO)&debug_event.u;
|
||||
@ -889,6 +896,9 @@ BOOL WINAPI extCreateProcessA(
|
||||
}
|
||||
break;
|
||||
case LOAD_DLL_DEBUG_EVENT:
|
||||
//OutTrace("CreateProcess: event=%x(%s) dll=%s address=%x\n",
|
||||
// debug_event.dwDebugEventCode, ExplainDebugEvent(debug_event.dwDebugEventCode),
|
||||
// ((LOAD_DLL_DEBUG_INFO *)&debug_event.u)->lpImageName, ((LOAD_DLL_DEBUG_INFO *)&debug_event.u)->lpBaseOfDll);
|
||||
CloseHandle(((LOAD_DLL_DEBUG_INFO *)&debug_event.u)->hFile);
|
||||
break;
|
||||
case CREATE_THREAD_DEBUG_EVENT:
|
||||
|
@ -544,6 +544,7 @@ extern BOOL WINAPI extGetVersionExA(LPOSVERSIONINFOA);
|
||||
extern BOOL WINAPI extGetVersionExW(LPOSVERSIONINFOW);
|
||||
extern void WINAPI extGlobalMemoryStatus(LPMEMORYSTATUS);
|
||||
extern int WINAPI extIsDebuggerPresent(void);
|
||||
extern BOOL WINAPI extCheckRemoteDebuggerPresent(HANDLE, PBOOL);
|
||||
extern HMODULE WINAPI extLoadLibraryA(LPCTSTR);
|
||||
extern HMODULE WINAPI extLoadLibraryExA(LPCTSTR, HANDLE, DWORD);
|
||||
extern HMODULE WINAPI extLoadLibraryW(LPCWSTR);
|
||||
|
@ -1713,11 +1713,13 @@ LONG WINAPI extEnumDisplaySettings(LPCTSTR lpszDeviceName, DWORD iModeNum, DEVMO
|
||||
LONG WINAPI extChangeDisplaySettingsA(DEVMODEA *lpDevMode, DWORD dwflags)
|
||||
{
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("ChangeDisplaySettingsA: lpDevMode=%x flags=%x(%s)", lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags));
|
||||
if (lpDevMode) OutTrace(" DeviceName=%s fields=%x(%s) size=(%d x %d) bpp=%d",
|
||||
char sInfo[1024];
|
||||
strcpy(sInfo, "");
|
||||
if (lpDevMode) sprintf(sInfo, " DeviceName=%s fields=%x(%s) size=(%d x %d) bpp=%d",
|
||||
lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields),
|
||||
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);
|
||||
OutTrace("\n");
|
||||
OutTrace("ChangeDisplaySettingsA: lpDevMode=%x flags=%x(%s)%s\n",
|
||||
lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags), sInfo);
|
||||
}
|
||||
|
||||
if(dxw.Windowize)
|
||||
@ -1729,11 +1731,13 @@ LONG WINAPI extChangeDisplaySettingsA(DEVMODEA *lpDevMode, DWORD dwflags)
|
||||
LONG WINAPI extChangeDisplaySettingsW(DEVMODEW *lpDevMode, DWORD dwflags)
|
||||
{
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("ChangeDisplaySettingsW: lpDevMode=%x flags=%x(%s)", lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags));
|
||||
if (lpDevMode) OutTrace(" DeviceName=%ls fields=%x(%s) size=(%d x %d) bpp=%d",
|
||||
char sInfo[1024];
|
||||
strcpy(sInfo, "");
|
||||
if (lpDevMode) sprintf(sInfo, " DeviceName=%ls fields=%x(%s) size=(%d x %d) bpp=%d",
|
||||
lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields),
|
||||
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);
|
||||
OutTrace("\n");
|
||||
OutTrace("ChangeDisplaySettingsW: lpDevMode=%x flags=%x(%s)%s\n",
|
||||
lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags), sInfo);
|
||||
}
|
||||
|
||||
if(dxw.Windowize)
|
||||
@ -1745,11 +1749,13 @@ LONG WINAPI extChangeDisplaySettingsW(DEVMODEW *lpDevMode, DWORD dwflags)
|
||||
LONG WINAPI extChangeDisplaySettingsExA(LPCTSTR lpszDeviceName, DEVMODEA *lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
|
||||
{
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("ChangeDisplaySettingsExA: DeviceName=%s lpDevMode=%x flags=%x(%s)", lpszDeviceName, lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags));
|
||||
if (lpDevMode) OutTrace(" DeviceName=%s fields=%x(%s) size=(%d x %d) bpp=%d",
|
||||
char sInfo[1024];
|
||||
strcpy(sInfo, "");
|
||||
if (lpDevMode) sprintf(sInfo, " DeviceName=%s fields=%x(%s) size=(%d x %d) bpp=%d",
|
||||
lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields),
|
||||
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);
|
||||
OutTrace("\n");
|
||||
OutTrace("ChangeDisplaySettingsExA: DeviceName=%s lpDevMode=%x flags=%x(%s)%s\n",
|
||||
lpszDeviceName, lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags), sInfo);
|
||||
}
|
||||
|
||||
if(dxw.Windowize)
|
||||
@ -1761,11 +1767,13 @@ LONG WINAPI extChangeDisplaySettingsExA(LPCTSTR lpszDeviceName, DEVMODEA *lpDevM
|
||||
LONG WINAPI extChangeDisplaySettingsExW(LPCTSTR lpszDeviceName, DEVMODEW *lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
|
||||
{
|
||||
if(IsTraceDDRAW){
|
||||
OutTrace("ChangeDisplaySettingsExW: DeviceName=%ls lpDevMode=%x flags=%x(%s)", lpszDeviceName, lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags));
|
||||
if (lpDevMode) OutTrace(" DeviceName=%ls fields=%x(%s) size=(%d x %d) bpp=%d",
|
||||
char sInfo[1024];
|
||||
strcpy(sInfo, "");
|
||||
if (lpDevMode) sprintf(sInfo, " DeviceName=%ls fields=%x(%s) size=(%d x %d) bpp=%d",
|
||||
lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields),
|
||||
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);
|
||||
OutTrace("\n");
|
||||
OutTrace("ChangeDisplaySettingsExW: DeviceName=%ls lpDevMode=%x flags=%x(%s)%s\n",
|
||||
lpszDeviceName, lpDevMode, dwflags, ExplainChangeDisplaySettingsFlags(dwflags), sInfo);
|
||||
}
|
||||
|
||||
if(dxw.Windowize)
|
||||
|
BIN
host/Resource.h
BIN
host/Resource.h
Binary file not shown.
@ -48,6 +48,7 @@ void CTabDebug::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_STRESSRESOURCES, cTarget->m_StressResources);
|
||||
DDX_Check(pDX, IDC_NOSYSTEMMEMORY, cTarget->m_NoSystemMemory);
|
||||
DDX_Check(pDX, IDC_NOSYSTEMEMULATED, cTarget->m_NoSystemEmulated);
|
||||
DDX_Check(pDX, IDC_GSKYHACK, cTarget->m_GSkyHack);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTabDebug, CDialog)
|
||||
|
@ -42,6 +42,9 @@ void CTabLogs::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_OUTDEBUG, cTarget->m_OutDebug);
|
||||
DDX_Check(pDX, IDC_CURSORTRACE, cTarget->m_CursorTrace);
|
||||
DDX_Check(pDX, IDC_LOGENABLED, cTarget->m_LogEnabled);
|
||||
DDX_Check(pDX, IDC_OUTDEBUGSTRING, cTarget->m_OutDebugString);
|
||||
DDX_Check(pDX, IDC_ERASELOGFILE, cTarget->m_EraseLogFile);
|
||||
DDX_Check(pDX, IDC_ADDTIMESTAMP, cTarget->m_AddTimeStamp);
|
||||
DDX_Check(pDX, IDC_OUTWINMESSAGES, cTarget->m_OutWinMessages);
|
||||
DDX_Check(pDX, IDC_OUTDWTRACE, cTarget->m_OutDWTrace);
|
||||
DDX_Check(pDX, IDC_IMPORTTABLE, cTarget->m_ImportTable);
|
||||
|
@ -97,6 +97,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_DisableGammaRamp = FALSE;
|
||||
m_AutoRefresh = FALSE;
|
||||
m_TextureFormat = FALSE;
|
||||
m_GSkyHack = FALSE;
|
||||
m_FixWinFrame = FALSE;
|
||||
m_EnableClipping = FALSE;
|
||||
m_CursorClipping = FALSE;
|
||||
|
@ -38,6 +38,9 @@ public:
|
||||
BOOL m_OutDebug;
|
||||
BOOL m_CursorTrace;
|
||||
BOOL m_LogEnabled;
|
||||
BOOL m_EraseLogFile;
|
||||
BOOL m_AddTimeStamp;
|
||||
BOOL m_OutDebugString;
|
||||
BOOL m_OutWinMessages;
|
||||
BOOL m_OutDWTrace;
|
||||
BOOL m_OutD3DTrace;
|
||||
@ -77,6 +80,7 @@ public:
|
||||
BOOL m_DisableGammaRamp;
|
||||
BOOL m_AutoRefresh;
|
||||
BOOL m_TextureFormat;
|
||||
BOOL m_GSkyHack;
|
||||
BOOL m_FixWinFrame;
|
||||
BOOL m_EnableClipping;
|
||||
BOOL m_CursorClipping;
|
||||
|
Binary file not shown.
@ -23,10 +23,11 @@ extern int MessageBoxLangArg(UINT, UINT, UINT, ...);
|
||||
// the (limited) IPC space and allow for more record entryes (currently 255).
|
||||
|
||||
#define MAX_NOTES 1024
|
||||
#define MAX_TITLE 80
|
||||
|
||||
typedef struct PRIVATEMAP
|
||||
{
|
||||
char title[40+1];
|
||||
char title[MAX_TITLE+1];
|
||||
char launchpath[MAX_PATH+1];
|
||||
char notes[MAX_NOTES+1];
|
||||
}PRIVATEMAP;
|
||||
|
Binary file not shown.
Binary file not shown.
@ -35,6 +35,13 @@ TARGETMAP *pTargets; // idem.
|
||||
|
||||
#define LOCKINJECTIONTHREADS
|
||||
|
||||
// beware: it must operate upon count+1 sized arrays
|
||||
char *strnncpy(char *dest, char *src, size_t count)
|
||||
{
|
||||
dest[count]=0;
|
||||
return strncpy(dest, src, count);
|
||||
}
|
||||
|
||||
static char *Escape(char *s)
|
||||
{
|
||||
static char tmp[1024];
|
||||
@ -223,6 +230,9 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_OutDebug) t->tflags |= OUTDEBUG;
|
||||
if(dlg->m_CursorTrace) t->tflags |= OUTCURSORTRACE;
|
||||
if(dlg->m_LogEnabled) t->tflags |= OUTTRACE;
|
||||
if(dlg->m_OutDebugString) t->tflags |= OUTDEBUGSTRING;
|
||||
if(dlg->m_EraseLogFile) t->tflags |= ERASELOGFILE;
|
||||
if(dlg->m_AddTimeStamp) t->tflags |= ADDTIMESTAMP;
|
||||
if(dlg->m_OutWinMessages) t->tflags |= OUTWINMESSAGES;
|
||||
if(dlg->m_OutDWTrace) t->tflags |= OUTDXWINTRACE;
|
||||
if(dlg->m_OutDDRAWTrace) t->tflags |= OUTDDRAWTRACE;
|
||||
@ -276,6 +286,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_DisableGammaRamp) t->flags2 |= DISABLEGAMMARAMP;
|
||||
if(dlg->m_AutoRefresh) t->flags |= AUTOREFRESH;
|
||||
if(dlg->m_TextureFormat) t->flags5 |= TEXTUREFORMAT;
|
||||
if(dlg->m_GSkyHack) t->flags5 |= GSKYHACK;
|
||||
if(dlg->m_FixWinFrame) t->flags |= FIXWINFRAME;
|
||||
if(dlg->m_EnableClipping) t->flags |= ENABLECLIPPING;
|
||||
if(dlg->m_CursorClipping) t->flags |= CLIPCURSOR;
|
||||
@ -429,6 +440,9 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_OutDebug = t->tflags & OUTDEBUG ? 1 : 0;
|
||||
dlg->m_CursorTrace = t->tflags & OUTCURSORTRACE ? 1 : 0;
|
||||
dlg->m_LogEnabled = t->tflags & OUTTRACE ? 1 : 0;
|
||||
dlg->m_OutDebugString = t->tflags & OUTDEBUGSTRING ? 1 : 0;
|
||||
dlg->m_EraseLogFile = t->tflags & ERASELOGFILE ? 1 : 0;
|
||||
dlg->m_AddTimeStamp = t->tflags & ADDTIMESTAMP ? 1 : 0;
|
||||
dlg->m_OutWinMessages = t->tflags & OUTWINMESSAGES ? 1 : 0;
|
||||
dlg->m_OutDWTrace = t->tflags & OUTDXWINTRACE ? 1 : 0;
|
||||
dlg->m_OutD3DTrace = t->tflags & OUTD3DTRACE ? 1 : 0;
|
||||
@ -483,6 +497,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_DisableGammaRamp = t->flags2 & DISABLEGAMMARAMP ? 1 : 0;
|
||||
dlg->m_AutoRefresh = t->flags & AUTOREFRESH ? 1 : 0;
|
||||
dlg->m_TextureFormat = t->flags5 & TEXTUREFORMAT ? 1 : 0;
|
||||
dlg->m_GSkyHack = t->flags5 & GSKYHACK ? 1 : 0;
|
||||
dlg->m_FixWinFrame = t->flags & FIXWINFRAME ? 1 : 0;
|
||||
dlg->m_EnableClipping = t->flags & ENABLECLIPPING ? 1 : 0;
|
||||
dlg->m_CursorClipping = t->flags & CLIPCURSOR ? 1 : 0;
|
||||
@ -1045,9 +1060,9 @@ void CDxwndhostView::OnModify()
|
||||
dlg.m_LaunchPath = TitleMaps[i].launchpath;
|
||||
SetDlgFromTarget(&TargetMaps[i], &dlg);
|
||||
if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){
|
||||
strncpy(TitleMaps[i].title, dlg.m_Title, 40);
|
||||
strncpy(TitleMaps[i].notes, dlg.m_Notes, MAX_NOTES);
|
||||
strncpy(TitleMaps[i].launchpath, dlg.m_LaunchPath, MAX_PATH);
|
||||
strnncpy(TitleMaps[i].title, (char *)dlg.m_Title.GetString(), MAX_TITLE);
|
||||
strnncpy(TitleMaps[i].notes, (char *)dlg.m_Notes.GetString(), MAX_NOTES);
|
||||
strnncpy(TitleMaps[i].launchpath, (char *)dlg.m_LaunchPath.GetString(), MAX_PATH);
|
||||
SetTargetFromDlg(&TargetMaps[i], &dlg);
|
||||
CListCtrl& listctrl = GetListCtrl();
|
||||
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
@ -1136,6 +1151,28 @@ void CDxwndhostView::OnDeleteLog()
|
||||
_unlink(FilePath);
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnDebugView()
|
||||
{
|
||||
PROCESS_INFORMATION pinfo;
|
||||
STARTUPINFO sinfo;
|
||||
char exepath[MAX_PATH+1];
|
||||
char folderpath[MAX_PATH+1];
|
||||
ZeroMemory(&sinfo, sizeof(sinfo));
|
||||
sinfo.cb = sizeof(sinfo);
|
||||
GetPrivateProfileString("window", "debugview", "DbgView.exe", exepath, MAX_PATH, InitPath);
|
||||
strcpy_s(folderpath, sizeof(folderpath), exepath);
|
||||
PathRemoveFileSpec(folderpath);
|
||||
if(strlen(folderpath)==0) strcpy(folderpath, ".\\");
|
||||
if(!CreateProcessA(NULL, exepath, 0, 0, false, CREATE_DEFAULT_ERROR_MODE, NULL, folderpath, &sinfo, &pinfo)){
|
||||
char sInfo[81];
|
||||
sprintf(sInfo, "Error %d starting DebugView", GetLastError());
|
||||
MessageBox(sInfo, "Error", MB_ICONERROR|MB_OK);
|
||||
return;
|
||||
}
|
||||
CloseHandle(pinfo.hProcess);
|
||||
CloseHandle(pinfo.hThread);
|
||||
}
|
||||
|
||||
#define strcasecmp lstrcmpi
|
||||
|
||||
void CDxwndhostView::OnSort()
|
||||
@ -1312,7 +1349,7 @@ void CDxwndhostView::OnProcessKill()
|
||||
pos = listctrl.GetFirstSelectedItemPosition();
|
||||
i = listctrl.GetNextSelectedItem(pos);
|
||||
|
||||
strncpy(FilePath,TargetMaps[i].path,MAX_PATH);
|
||||
strnncpy(FilePath, TargetMaps[i].path, MAX_PATH);
|
||||
lpProcName=FilePath;
|
||||
while (lpNext=strchr(lpProcName,'\\')) lpProcName=lpNext+1;
|
||||
|
||||
@ -1345,9 +1382,9 @@ void CDxwndhostView::OnAdd()
|
||||
}
|
||||
memset(&TargetMaps[i],0,sizeof(TARGETMAP)); // clean up, just in case....
|
||||
if(dlg.DoModal() == IDOK && dlg.m_FilePath.GetLength()){
|
||||
strncpy(TitleMaps[i].title, dlg.m_Title, 40);
|
||||
strncpy(TitleMaps[i].notes, dlg.m_Notes, MAX_NOTES);
|
||||
strncpy(TitleMaps[i].launchpath, dlg.m_LaunchPath, MAX_PATH);
|
||||
strnncpy(TitleMaps[i].title, (char *)dlg.m_Title.GetString(), MAX_TITLE);
|
||||
strnncpy(TitleMaps[i].notes, (char *)dlg.m_Notes.GetString(), MAX_NOTES);
|
||||
strnncpy(TitleMaps[i].launchpath, (char *)dlg.m_LaunchPath.GetString(), MAX_PATH);
|
||||
SetTargetFromDlg(&TargetMaps[i], &dlg);
|
||||
CListCtrl& listctrl = GetListCtrl();
|
||||
listitem.mask = LVIF_TEXT | LVIF_IMAGE;
|
||||
@ -1640,6 +1677,9 @@ void CDxwndhostView::OnRButtonDown(UINT nFlags, CPoint point)
|
||||
case ID_PLOG_DELETE:
|
||||
OnDeleteLog();
|
||||
break;
|
||||
case ID_PLOG_DEBUGVIEW:
|
||||
OnDebugView();
|
||||
break;
|
||||
case ID_TASK_KILL:
|
||||
OnKill();
|
||||
break;
|
||||
|
@ -73,6 +73,7 @@ protected:
|
||||
afx_msg void OnSort();
|
||||
afx_msg void OnViewLog();
|
||||
afx_msg void OnDeleteLog();
|
||||
afx_msg void OnDebugView();
|
||||
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnRun();
|
||||
afx_msg void OnClearAllLogs();
|
||||
|
BIN
host/host.aps
Normal file
BIN
host/host.aps
Normal file
Binary file not shown.
BIN
host/resource
BIN
host/resource
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user