mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_02_88_src
Former-commit-id: 7016413cfc5c8f6c6af6498062e9d1f36294e800
This commit is contained in:
parent
754d4ebe62
commit
41fa5c4132
Include
build
Resources_CN.dllResources_EN.dllResources_IT.dlldxwnd.dlldxwnd.exedxwnd.ini
exports
readme-relnotes.txtdll
ddraw.cppdxemublt.cppdxhook.cppdxwcore.cppdxwcore.hppdxwnd.cppdxwnd.vs2008.suohd3d.cpphd3d7.cppkernel32.cpp
host
DesktopDialog.cppDesktopDialog.hResource.hStatusDialog.cppTabCompat.cppTargetDlg.cppTargetDlg.hdxwnd.inidxwndhost.apsdxwndhost.cppdxwndhost.rcdxwndhost.vs2008.suodxwndhost.vs2008.vcprojdxwndhostView.cppdxwndhostView.h
res
locale
@ -148,6 +148,7 @@
|
||||
|
||||
// fifth flags DWORD dxw.dwFlags5:
|
||||
#define DIABLOTWEAK 0x00000001 // ... ??? ...
|
||||
#define CLEARTARGET 0x00000002 // forces a D3D clean on target surface upon each BeginScene invocation
|
||||
|
||||
// logging Tflags DWORD:
|
||||
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general
|
||||
@ -204,7 +205,7 @@ typedef struct
|
||||
short IsFullScreen;
|
||||
short Width, Height;
|
||||
short ColorDepth;
|
||||
//DDPIXELFORMAT VirtualPixel;
|
||||
DDPIXELFORMAT pfd;
|
||||
short DXVersion;
|
||||
HWND hWnd;
|
||||
DWORD dwPid;
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:782d53dad4046b681b15ecfbc8dd370c7a8097b7903daf63e4089c9b96916158
|
||||
size 125952
|
||||
oid sha256:4de37cdb906c386f2ba4b7f6793d36614ad77fcc432b1a21de322f93df87522a
|
||||
size 132096
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9ad4422aea023277c8d4310eb68782709f10d7567c8b12af62a30a32b3016c57
|
||||
size 131072
|
||||
oid sha256:3997d0254b83f70e4dd1ae372d7c5aefb6d6aeb5b6345651fca1dd1fa166b015
|
||||
size 137216
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ab41e49d035c39a3a88ce07e5900ea8b8e8768ad56749e8f06969b9df343374f
|
||||
size 132096
|
||||
oid sha256:2b27f7aa0eaa1fe4770e14f916970df79b1885df82aef47f260b00527074d10a
|
||||
size 138240
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4f143e88ec5785fc2144af1a779b09b9e0791bf0e1e7d7050c1921d36284787e
|
||||
size 501248
|
||||
oid sha256:b6a90eedd9d99a4deac23538e6b96663ef88f4d640ddf13bc9e58289bbd6ba82
|
||||
size 503296
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ad3ceed714b0d4f97f1187893964ff234e6c48de19bac84b66a1f25c9105088c
|
||||
size 549376
|
||||
oid sha256:79e9b0ed736620751f6a8788cba0d30c929abf45772b782f8fa6ccfdb6fa173c
|
||||
size 557568
|
||||
|
119
build/dxwnd.ini
119
build/dxwnd.ini
@ -2,120 +2,5 @@
|
||||
sizx=320
|
||||
sizy=200
|
||||
lang=automatic
|
||||
posx=1429
|
||||
posy=317
|
||||
[target]
|
||||
title0=Age of Empires
|
||||
path0=D:\Games\Age of Empires\Empires.exe
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
ver0=0
|
||||
coord0=2
|
||||
flag0=134217762
|
||||
flagg0=1207959568
|
||||
flagh0=20
|
||||
flagi0=4195332
|
||||
tflag0=6147
|
||||
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
|
||||
title1=Diablo
|
||||
path1=D:\Games\Diablo\Diablo.exe
|
||||
launchpath1=
|
||||
module1=
|
||||
opengllib1=
|
||||
ver1=1
|
||||
coord1=3
|
||||
flag1=138428450
|
||||
flagg1=1242562576
|
||||
flagh1=20
|
||||
flagi1=4195328
|
||||
tflag1=0
|
||||
initx1=0
|
||||
inity1=0
|
||||
minx1=0
|
||||
miny1=0
|
||||
maxx1=0
|
||||
maxy1=0
|
||||
posx1=50
|
||||
posy1=50
|
||||
sizx1=640
|
||||
sizy1=480
|
||||
maxfps1=0
|
||||
initts1=0
|
||||
winver1=0
|
||||
maxres1=0
|
||||
title2=Dune 2000
|
||||
path2=D:\Games\Dune 2000\DUNE2000.DAT
|
||||
launchpath2=D:\Games\Dune 2000\DUNE2000.EXE
|
||||
module2=
|
||||
opengllib2=
|
||||
ver2=0
|
||||
coord2=2
|
||||
flag2=671105058
|
||||
flagg2=1207959568
|
||||
flagh2=20
|
||||
flagi2=4195332
|
||||
tflag2=64
|
||||
initx2=0
|
||||
inity2=0
|
||||
minx2=0
|
||||
miny2=0
|
||||
maxx2=0
|
||||
maxy2=0
|
||||
posx2=50
|
||||
posy2=50
|
||||
sizx2=800
|
||||
sizy2=600
|
||||
maxfps2=0
|
||||
initts2=0
|
||||
winver2=0
|
||||
maxres2=-1
|
||||
title3=Genocide (REMIXED VERSION)
|
||||
path3=D:\Games\genocide\remixed version (1999)\genocide\genocide.exe
|
||||
launchpath3=
|
||||
module3=
|
||||
opengllib3=
|
||||
ver3=0
|
||||
coord3=3
|
||||
flag3=134217762
|
||||
flagg3=1207959568
|
||||
flagh3=20
|
||||
flagi3=4195332
|
||||
tflag3=6402
|
||||
initx3=0
|
||||
inity3=0
|
||||
minx3=0
|
||||
miny3=0
|
||||
maxx3=0
|
||||
maxy3=0
|
||||
posx3=50
|
||||
posy3=50
|
||||
sizx3=800
|
||||
sizy3=600
|
||||
maxfps3=0
|
||||
initts3=0
|
||||
winver3=0
|
||||
maxres3=-1
|
||||
title4=Dune 2000
|
||||
module4=
|
||||
opengllib4=
|
||||
title5=Genocide (REMIXED VERSION)
|
||||
module5=
|
||||
opengllib5=
|
||||
flagj0=0
|
||||
flagj1=1
|
||||
flagj2=0
|
||||
flagj3=0
|
||||
posx=50
|
||||
posy=50
|
||||
|
@ -1,5 +1,5 @@
|
||||
[window]
|
||||
posx=1392
|
||||
posy=385
|
||||
posx=1803
|
||||
posy=246
|
||||
sizx=320
|
||||
sizy=200
|
||||
|
@ -569,3 +569,14 @@ added debug messages about hooked window class and name
|
||||
fix: ignore IME window when hooking main win, destroy it when requested
|
||||
fix: ignore HWND_MESSAGE type windows
|
||||
added "Diablo tweak" compatibility flag for Diablo proper screen update handling. It is a temporary tweak waiting to understand better how to properly manage it.
|
||||
|
||||
v2.02.88
|
||||
fix: DIABLOTWEAK flag defaulted to FALSE
|
||||
add: CLEARTARGET flag - forces a Clear CLEAR_TARGET operation on D3D BeginPaint: useful in combination with wireframe mode.
|
||||
updated "Optimize CPU" behavior: now it emulates a VSync wait also on D3D8/D3D9. Fixes some "swimming" problem in "Soul Reaver 2", and saves CPU time by limiting the FPS to the refresh rate.
|
||||
fixed positioning of FPS and time stretching indication on screen overlay
|
||||
cleaned up GUI project: no more japanese and localized resources, no more unreferenced resources.
|
||||
GUI: added Desktop status window
|
||||
GUI: added pixel format descriptor to DxWnd status
|
||||
|
||||
|
||||
|
@ -294,7 +294,6 @@ int iRefreshDelayCount=2;
|
||||
void SetVSyncDelays(LPDIRECTDRAW lpdd)
|
||||
{
|
||||
DDSURFACEDESC2 ddsdRefreshRate;
|
||||
int Reminder;
|
||||
HRESULT res;
|
||||
|
||||
memset(&ddsdRefreshRate, 0, sizeof(ddsdRefreshRate));
|
||||
@ -305,18 +304,7 @@ void SetVSyncDelays(LPDIRECTDRAW lpdd)
|
||||
res=(*pGetDisplayMode)(lpdd, (LPDDSURFACEDESC)&ddsdRefreshRate);
|
||||
}
|
||||
if(res) return;
|
||||
gdwRefreshRate = ddsdRefreshRate.dwRefreshRate;
|
||||
if(!gdwRefreshRate) return;
|
||||
iRefreshDelayCount=0;
|
||||
Reminder=0;
|
||||
do{
|
||||
iRefreshDelays[iRefreshDelayCount]=(1000+Reminder)/gdwRefreshRate;
|
||||
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");
|
||||
dxw.SetVSyncDelays(ddsdRefreshRate.dwRefreshRate);
|
||||
}
|
||||
|
||||
static void Stopper(char *s, int line)
|
||||
@ -1892,6 +1880,7 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd,
|
||||
dxw.SetScreenSize(dwwidth, dwheight);
|
||||
GetHookInfo()->Height=(short)dxw.GetScreenHeight();
|
||||
GetHookInfo()->Width=(short)dxw.GetScreenWidth();
|
||||
GetHookInfo()->ColorDepth=(short)dwbpp;
|
||||
if(dxw.Windowize) AdjustWindowFrame(dxw.GethWnd(), dwwidth, dwheight);
|
||||
|
||||
if(dxw.dwFlags1 & EMULATESURFACE){
|
||||
@ -1909,6 +1898,7 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd,
|
||||
}
|
||||
else{
|
||||
OutTraceDW("SetDisplayMode: mode=STANDARD BPP=%d\n", dwbpp);
|
||||
dxw.VirtualPixelFormat.dwRGBBitCount = dwbpp;
|
||||
dxw.ActualPixelFormat.dwRGBBitCount = dwbpp;
|
||||
}
|
||||
|
||||
@ -2501,7 +2491,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;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
|
||||
ddsd.dwWidth = dxw.GetScreenWidth();
|
||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||
if(dxw.dwFlags4 & BILINEARFILTER){
|
||||
@ -2842,6 +2832,13 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate
|
||||
lpDDSPrim = *lplpdds;
|
||||
dxw.MarkPrimarySurface(lpDDSPrim);
|
||||
|
||||
DDSURFACEDESC2 ddsdpix;
|
||||
memset((void *)&ddsdpix, 0, sizeof(DDSURFACEDESC));
|
||||
ddsdpix.dwSize = sizeof(DDSURFACEDESC);
|
||||
ddsdpix.dwFlags = DDSD_PIXELFORMAT;
|
||||
(*pGetSurfaceDescMethod(lpDDSPrim))((LPDIRECTDRAWSURFACE2)lpDDSPrim, &ddsdpix);
|
||||
GetHookInfo()->pfd=ddsdpix.ddpfPixelFormat; // v2.02.88
|
||||
|
||||
if (BBCount){
|
||||
// build emulated backbuffer surface
|
||||
res=BuildBackBuffer(lpdd, pCreateSurface, lpddsd, dxversion, &lpDDSBack, NULL);
|
||||
@ -3525,6 +3522,7 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy,
|
||||
if(dwtrans & DDBLTFAST_WAIT) flags = DDBLT_WAIT;
|
||||
if(dwtrans & DDBLTFAST_DESTCOLORKEY) flags |= DDBLT_KEYDEST;
|
||||
if(dwtrans & DDBLTFAST_SRCCOLORKEY) flags |= DDBLT_KEYSRC;
|
||||
//if(dwtrans & DDBLTFAST_SRCCOLORKEY) flags |= DDBLT_COLORFILL;
|
||||
|
||||
if ((dxw.dwFlags2 & FULLRECTBLT) && ToPrim){
|
||||
return sBlt("BltFast", lpdds, NULL, lpddssrc, lpsrcrect, flags, NULL, FALSE);
|
||||
@ -3542,16 +3540,23 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy,
|
||||
else{
|
||||
// does it EVER goes through here? NULL is not a valid rect value for BltFast call....
|
||||
// yes, forced in FULLRECTBLT mode!
|
||||
ddsd.dwSize=Set_dwSize_From_Surface(lpddssrc);
|
||||
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT;
|
||||
ret=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd);
|
||||
if (ret){
|
||||
OutTraceE("BltFast: GetSurfaceDesc ERROR %x at %d\n", ret, __LINE__);
|
||||
return 0;
|
||||
// yes, when BltFast on DDBLTFAST_SRCCOLORKEY!! (Pax Corpus)
|
||||
if(lpddssrc){
|
||||
ddsd.dwSize=Set_dwSize_From_Surface(lpddssrc);
|
||||
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT;
|
||||
ret=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd);
|
||||
if (ret){
|
||||
OutTraceE("BltFast: GetSurfaceDesc ERROR %x at %d\n", ret, __LINE__);
|
||||
return 0;
|
||||
}
|
||||
destrect.right = destrect.left + ddsd.dwWidth;
|
||||
destrect.bottom = destrect.top + ddsd.dwHeight;
|
||||
ret=sBlt("BltFast", lpdds, &destrect, lpddssrc, NULL, flags, NULL, FALSE);
|
||||
}
|
||||
else{
|
||||
//ret=sBlt("BltFast", lpdds, NULL, lpddssrc, NULL, flags, NULL, FALSE);
|
||||
ret=DD_OK;
|
||||
}
|
||||
destrect.right = destrect.left + ddsd.dwWidth;
|
||||
destrect.bottom = destrect.top + ddsd.dwHeight;
|
||||
ret=sBlt("BltFast", lpdds, &destrect, lpddssrc, NULL, flags, NULL, FALSE);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -3559,16 +3564,11 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy,
|
||||
|
||||
HRESULT WINAPI extWaitForVerticalBlank(LPDIRECTDRAW lpdd, DWORD dwflags, HANDLE hevent)
|
||||
{
|
||||
static DWORD time = 0;
|
||||
static BOOL step = 0;
|
||||
DWORD tmp;
|
||||
if(!(dxw.dwFlags1 & SAVELOAD)) return (*pWaitForVerticalBlank)(lpdd, dwflags, hevent);
|
||||
tmp = (*pGetTickCount)();
|
||||
if((time - tmp) > 32) time = tmp;
|
||||
(*pSleep)(time - tmp);
|
||||
time += iRefreshDelays[step++];
|
||||
if(step >= iRefreshDelayCount) step=0;
|
||||
return 0;
|
||||
if(dxw.dwFlags1 & SAVELOAD){
|
||||
dxw.VSyncWait();
|
||||
return 0;
|
||||
}
|
||||
return (*pWaitForVerticalBlank)(lpdd, dwflags, hevent);
|
||||
}
|
||||
|
||||
#define DDPCAPS_INITIALIZE_LEGACY 0x00000008l
|
||||
|
@ -261,7 +261,7 @@ static HRESULT WINAPI BilinearBlt_8_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT l
|
||||
srcpitch = ddsd_src.lPitch - w;
|
||||
|
||||
// OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch);
|
||||
for(y = 0; y < h-1; y ++){ // first h-1 lines ....
|
||||
for(y = 0; y < h-1; y ++){ // first h-1 lines ....
|
||||
register DWORD Q1, Q2, Q3, Q4, Q5;
|
||||
Q5 = Melt32(PaletteEntries[*(src8)], PaletteEntries[*(src8+ddsd_src.lPitch)]);
|
||||
for(x = 0; x < w; x ++){
|
||||
|
@ -93,7 +93,7 @@ static char *Flag4Names[32]={
|
||||
};
|
||||
|
||||
static char *Flag5Names[32]={
|
||||
"DIABLOCHEAT", "", "", "",
|
||||
"DIABLOTWEAK", "CLEARTARGET", "", "",
|
||||
"", "", "", "",
|
||||
"", "", "", "",
|
||||
"", "", "", "",
|
||||
@ -106,8 +106,8 @@ static char *Flag5Names[32]={
|
||||
static char *TFlagNames[32]={
|
||||
"OUTTRACE", "OUTDDRAWTRACE", "OUTWINMESSAGES", "OUTCURSORTRACE",
|
||||
"OUTPROXYTRACE", "DXPROXED", "ASSERTDIALOG", "OUTIMPORTTABLE",
|
||||
"OUTDEBUG", "OUTREGISTRY", "TRACEHOOKS", "",
|
||||
"", "", "", "",
|
||||
"OUTDEBUG", "OUTREGISTRY", "TRACEHOOKS", "OUTD3DTRACE",
|
||||
"OUTDXWINTRACE", "", "", "",
|
||||
"", "", "", "",
|
||||
"", "", "", "",
|
||||
"", "", "", "",
|
||||
@ -1515,10 +1515,31 @@ void HookInit(TARGETMAP *target, HWND hwnd)
|
||||
#ifdef CREATEDESKTOP
|
||||
if(CREATEDESKTOP){
|
||||
if (!hDesktopWindow){
|
||||
//hDesktopWindow=CreateWindowEx(0, "STATIC", "DxWnd Desktop", 0,
|
||||
hDesktopWindow=CreateWindowEx(WS_EX_CONTROLPARENT, "STATIC", "DxWnd Desktop", 0,
|
||||
target->posx, target->posy, target->sizx, target->sizy, NULL, NULL, NULL, NULL);
|
||||
static ATOM aClass;
|
||||
WNDCLASSEX WndClsEx;
|
||||
HINSTANCE hinst=NULL;
|
||||
hinst=GetModuleHandle(NULL);
|
||||
WndClsEx.cbSize = sizeof(WNDCLASSEX);
|
||||
WndClsEx.style = 0;
|
||||
WndClsEx.lpfnWndProc = DefWindowProc;
|
||||
WndClsEx.cbClsExtra = 0;
|
||||
WndClsEx.cbWndExtra = 0;
|
||||
WndClsEx.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
WndClsEx.hCursor = NULL;
|
||||
WndClsEx.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
||||
//WndClsEx.hbrBackground = CreateSolidBrush(RGB(200,0,0));
|
||||
WndClsEx.lpszMenuName = NULL;
|
||||
WndClsEx.lpszClassName = "dxwnd:desktop";
|
||||
WndClsEx.hInstance = hinst;
|
||||
WndClsEx.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
|
||||
|
||||
aClass=RegisterClassEx(&WndClsEx);
|
||||
|
||||
//HWND hParent = (*pGetDesktopWindow)();
|
||||
HWND hParent = GetDesktopWindow(); // not hooked yet !
|
||||
hDesktopWindow=CreateWindowEx(0, "dxwnd:desktop", "DxWnd Desktop", 0, 0, 0, 0, 0, hParent, NULL, hinst, NULL);
|
||||
if(hDesktopWindow){
|
||||
MoveWindow(hDesktopWindow, target->posx, target->posy, target->sizx, target->sizy, TRUE);
|
||||
OutTraceDW("created desktop emulation: hwnd=%x\n", hDesktopWindow);
|
||||
}
|
||||
else{
|
||||
@ -1555,6 +1576,7 @@ void HookInit(TARGETMAP *target, HWND hwnd)
|
||||
OutTrace("HookInit: dxw.hParentWnd=%x class=\"%s\" text=\"%s\" style=%x(%s) exstyle=%x(%s)\n",
|
||||
dxw.hParentWnd, ClassName, WinText, dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
|
||||
OutTrace("HookInit: target window pos=(%d,%d) size=(%d,%d)\n", dxw.iPosX, dxw.iPosY, dxw.iSizX, dxw.iSizY);
|
||||
dxw.DumpDesktopStatus();
|
||||
}
|
||||
|
||||
if (SKIPIMEWINDOW) {
|
||||
@ -1575,7 +1597,7 @@ void HookInit(TARGETMAP *target, HWND hwnd)
|
||||
#ifdef CREATEDESKTOP
|
||||
if(CREATEDESKTOP){
|
||||
if (hDesktopWindow){
|
||||
OutTraceDW("HookInit: set new parent=%x\n", hDesktopWindow);
|
||||
OutTraceDW("HookInit: set new parent=%x to main win=%x\n", hDesktopWindow, dxw.hChildWnd);
|
||||
SetParent(dxw.hChildWnd, hDesktopWindow);
|
||||
dxw.hParentWnd = hDesktopWindow;
|
||||
}
|
||||
|
185
dll/dxwcore.cpp
185
dll/dxwcore.cpp
@ -45,6 +45,10 @@ dxwCore::dxwCore()
|
||||
MustShowOverlay=FALSE;
|
||||
TimerEvent.dwTimerType = TIMER_TYPE_NONE;
|
||||
WinDBInit();
|
||||
// initialization of default vsync emulation array
|
||||
iRefreshDelays[0]=16;
|
||||
iRefreshDelays[1]=17;
|
||||
iRefreshDelayCount=2;
|
||||
}
|
||||
|
||||
dxwCore::~dxwCore()
|
||||
@ -140,6 +144,53 @@ void dxwCore::SetScreenSize(int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
void dxwCore::DumpDesktopStatus()
|
||||
{
|
||||
HDC hDC;
|
||||
HWND hDesktop;
|
||||
RECT desktop;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
int iPixelFormat, iBPP;
|
||||
char ColorMask[65]; // are there 64BPP cards? I bet no....
|
||||
|
||||
// get the current pixel format index
|
||||
hDesktop = GetDesktopWindow();
|
||||
hDC = GetDC(hDesktop);
|
||||
::GetWindowRect(hDesktop, &desktop);
|
||||
iBPP = GetDeviceCaps(hDC, BITSPIXEL);
|
||||
iPixelFormat = GetPixelFormat(hDC);
|
||||
if(!iPixelFormat) iPixelFormat=1; // why returns 0???
|
||||
// obtain a detailed description of that pixel format
|
||||
if(!DescribePixelFormat(hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd)){
|
||||
OutTrace("DescribePixelFormat ERROR: err=%d\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
memset(ColorMask, ' ', 64); // blank fill
|
||||
ColorMask[64] = 0; // terminate
|
||||
for (int i=pfd.cRedShift; i<pfd.cRedShift+pfd.cRedBits; i++) ColorMask[i]='R';
|
||||
for (int i=pfd.cGreenShift; i<pfd.cGreenShift+pfd.cGreenBits; i++) ColorMask[i]='G';
|
||||
for (int i=pfd.cBlueShift; i<pfd.cBlueShift+pfd.cBlueBits; i++) ColorMask[i]='B';
|
||||
for (int i=pfd.cAlphaShift; i<pfd.cAlphaShift+pfd.cAlphaBits; i++) ColorMask[i]='A';
|
||||
OutTrace(
|
||||
"Desktop"
|
||||
"\tSize (W x H)=(%d x %d)\n"
|
||||
"\tColor depth = %d (color bits = %d)\n"
|
||||
"\tPixel format = %d\n"
|
||||
"\tColor mask (RGBA)= (%d,%d,%d,%d)\n"
|
||||
"\tColor shift (RGBA)= (%d,%d,%d,%d)\n"
|
||||
"\tColor mask = \"%s\"\n"
|
||||
,
|
||||
desktop.right, desktop.bottom,
|
||||
iBPP, pfd.cColorBits,
|
||||
iPixelFormat,
|
||||
pfd.cRedBits, pfd.cGreenBits, pfd.cBlueBits, pfd.cAlphaBits,
|
||||
pfd.cRedShift, pfd.cGreenShift, pfd.cBlueShift, pfd.cAlphaShift,
|
||||
ColorMask
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
// Primary surfaces auxiliary functions
|
||||
/* ------------------------------------------------------------------ */
|
||||
@ -934,7 +985,42 @@ BOOL dxwCore::HandleFPS()
|
||||
if(dwFlags2 & SKIPFPS) if(SkipFrameCount(dxw.MaxFPS)) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
// auxiliary functions ...
|
||||
|
||||
void dxwCore::SetVSyncDelays(UINT RefreshRate)
|
||||
{
|
||||
int Reminder;
|
||||
|
||||
if((RefreshRate < 10) || (RefreshRate > 100)) return;
|
||||
|
||||
gdwRefreshRate = RefreshRate;
|
||||
if(!gdwRefreshRate) return;
|
||||
iRefreshDelayCount=0;
|
||||
Reminder=0;
|
||||
do{
|
||||
iRefreshDelays[iRefreshDelayCount]=(1000+Reminder)/gdwRefreshRate;
|
||||
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");
|
||||
}
|
||||
|
||||
void dxwCore::VSyncWait()
|
||||
{
|
||||
static DWORD time = 0;
|
||||
static BOOL step = 0;
|
||||
DWORD tmp;
|
||||
tmp = (*pGetTickCount)();
|
||||
if((time - tmp) > 32) time = tmp;
|
||||
(*pSleep)(time - tmp);
|
||||
time += iRefreshDelays[step++];
|
||||
if(step >= iRefreshDelayCount) step=0;
|
||||
}
|
||||
|
||||
|
||||
static float fMul[17]={2.14F, 1.95F, 1.77F, 1.61F, 1.46F, 1.33F, 1.21F, 1.10F, 1.00F, 0.91F, 0.83F, 0.75F, 0.68F, 0.62F, 0.56F, 0.51F, 0.46F};
|
||||
//static float fMul[17]={0.46F, 0.51F, 0.56F, 0.62F, 0.68F, 0.75F, 0.83F, 0.91F, 1.00F, 1.10F, 1.21F, 1.33F, 1.46F, 1.61F, 1.77F, 1.95F, 2.14F};
|
||||
|
||||
@ -1045,7 +1131,7 @@ void dxwCore::GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime)
|
||||
static DWORD dwStartTick=0;
|
||||
static DWORD dwUpdateTick=0;
|
||||
static FILETIME StartFileTime;
|
||||
extern DXWNDSTATUS *pStatus;
|
||||
// extern DXWNDSTATUS *pStatus;
|
||||
|
||||
if(dwStartTick==0) {
|
||||
SYSTEMTIME StartingTime;
|
||||
@ -1080,7 +1166,7 @@ void dxwCore::GetSystemTime(LPSYSTEMTIME lpSystemTime)
|
||||
static DWORD dwStartTick=0;
|
||||
static DWORD dwUpdateTick=0;
|
||||
static FILETIME StartFileTime;
|
||||
extern DXWNDSTATUS *pStatus;
|
||||
// extern DXWNDSTATUS *pStatus;
|
||||
|
||||
if(dwStartTick==0) {
|
||||
SYSTEMTIME StartingTime;
|
||||
@ -1109,16 +1195,27 @@ void dxwCore::GetSystemTime(LPSYSTEMTIME lpSystemTime)
|
||||
|
||||
void dxwCore::ShowOverlay()
|
||||
{
|
||||
if (MustShowOverlay) this->ShowOverlay(GetDC(hWnd));
|
||||
if (MustShowOverlay) {
|
||||
RECT rect;
|
||||
(*pGetClientRect)(hWnd, &rect);
|
||||
this->ShowOverlay(GetDC(hWnd), rect.right, rect.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
void dxwCore::ShowOverlay(LPDIRECTDRAWSURFACE lpdds)
|
||||
{
|
||||
HDC hdc; // the working dc
|
||||
if (MustShowOverlay) {
|
||||
HDC hdc; // the working dc
|
||||
int h, w;
|
||||
if(!lpdds) return;
|
||||
if (FAILED(lpdds->GetDC(&hdc))) return;
|
||||
this->ShowOverlay(hdc);
|
||||
w = this->GetScreenWidth();
|
||||
h = this->GetScreenHeight();
|
||||
if(this->dwFlags4 & BILINEARFILTER) {
|
||||
w <<=1;
|
||||
h <<=1;
|
||||
}
|
||||
this->ShowOverlay(hdc, w, h);
|
||||
lpdds->ReleaseDC(hdc);
|
||||
}
|
||||
}
|
||||
@ -1126,28 +1223,23 @@ void dxwCore::ShowOverlay(LPDIRECTDRAWSURFACE lpdds)
|
||||
void dxwCore::ShowOverlay(HDC hdc)
|
||||
{
|
||||
if(!hdc) return;
|
||||
if (dwFlags2 & SHOWFPSOVERLAY) ShowFPS(hdc);
|
||||
if (dwFlags4 & SHOWTIMESTRETCH) ShowTimeStretching(hdc);
|
||||
RECT rect;
|
||||
(*pGetClientRect)(hWnd, &rect);
|
||||
this->ShowOverlay(GetDC(hWnd), rect.right, rect.bottom);
|
||||
}
|
||||
|
||||
//void dxwCore::ShowFPS()
|
||||
//{
|
||||
// this->ShowFPS(GetDC(hWnd));
|
||||
//}
|
||||
//
|
||||
//void dxwCore::ShowFPS(LPDIRECTDRAWSURFACE lpdds)
|
||||
//{
|
||||
// HDC hdc; // the working dc
|
||||
// if (FAILED(lpdds->GetDC(&hdc))) return;
|
||||
// this->ShowFPS(hdc);
|
||||
// lpdds->ReleaseDC(hdc);
|
||||
//}
|
||||
void dxwCore::ShowOverlay(HDC hdc, int w, int h)
|
||||
{
|
||||
if(!hdc) return;
|
||||
if (dwFlags2 & SHOWFPSOVERLAY) ShowFPS(hdc, w, h);
|
||||
if (dwFlags4 & SHOWTIMESTRETCH) ShowTimeStretching(hdc, w, h);
|
||||
}
|
||||
|
||||
// nasty global to ensure that the corner is picked semi-random, but never overlapped
|
||||
// between FPS and TimeStretch (and, as a side effect, never twice the same!)
|
||||
static int LastCorner;
|
||||
|
||||
void dxwCore::ShowFPS(HDC xdc)
|
||||
void dxwCore::ShowFPS(HDC xdc, int w, int h)
|
||||
{
|
||||
char sBuf[81];
|
||||
static DWORD dwTimer = 0;
|
||||
@ -1156,18 +1248,23 @@ void dxwCore::ShowFPS(HDC xdc)
|
||||
static DWORD color;
|
||||
|
||||
if((*pGetTickCount)()-dwTimer > 6000){
|
||||
RECT rect;
|
||||
dwTimer = (*pGetTickCount)();
|
||||
corner = dwTimer % 4;
|
||||
if(corner==LastCorner) corner = (corner+1) % 4;
|
||||
LastCorner = corner;
|
||||
color=0xFF0000; // blue
|
||||
(*pGetClientRect)(hWnd, &rect);
|
||||
//(*pGetClientRect)(hWnd, &rect);
|
||||
//switch (corner) {
|
||||
//case 0: x=10; y=10; break;
|
||||
//case 1: x=rect.right-60; y=10; break;
|
||||
//case 2: x=rect.right-60; y=rect.bottom-20; break;
|
||||
//case 3: x=10; y=rect.bottom-20; break;
|
||||
//}
|
||||
switch (corner) {
|
||||
case 0: x=10; y=10; break;
|
||||
case 1: x=rect.right-60; y=10; break;
|
||||
case 2: x=rect.right-60; y=rect.bottom-20; break;
|
||||
case 3: x=10; y=rect.bottom-20; break;
|
||||
case 1: x=w-60; y=10; break;
|
||||
case 2: x=w-60; y=h-20; break;
|
||||
case 3: x=10; y=h-20; break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1178,27 +1275,7 @@ void dxwCore::ShowFPS(HDC xdc)
|
||||
TextOut(xdc, x, y, sBuf, strlen(sBuf));
|
||||
}
|
||||
|
||||
//void dxwCore::ShowTimeStretching()
|
||||
//{
|
||||
// HDC hdc;
|
||||
// hdc=GetDC(hWnd);
|
||||
// if(hdc)this->ShowTimeStretching(hdc);
|
||||
//}
|
||||
//
|
||||
//void dxwCore::ShowTimeStretching(LPDIRECTDRAWSURFACE lpdds)
|
||||
//{
|
||||
// HDC hdc; // the working dc
|
||||
// __try {
|
||||
// if (FAILED(lpdds->GetDC(&hdc))) return;
|
||||
// }
|
||||
// __except(EXCEPTION_EXECUTE_HANDLER){
|
||||
// return;
|
||||
// }
|
||||
// if(hdc)this->ShowTimeStretching(hdc);
|
||||
// lpdds->ReleaseDC(hdc);
|
||||
//}
|
||||
|
||||
void dxwCore::ShowTimeStretching(HDC xdc)
|
||||
void dxwCore::ShowTimeStretching(HDC xdc, int w, int h)
|
||||
{
|
||||
char sBuf[81];
|
||||
static DWORD dwTimer = 0;
|
||||
@ -1208,7 +1285,6 @@ void dxwCore::ShowTimeStretching(HDC xdc)
|
||||
static int LastTimeShift = 1000; // any initial number different from -8 .. +8
|
||||
|
||||
if((*pGetTickCount)()-dwTimer > 4000){
|
||||
RECT rect;
|
||||
if(LastTimeShift==TimeShift) return; // after a while, stop the show
|
||||
dwTimer = (*pGetTickCount)();
|
||||
LastTimeShift=TimeShift;
|
||||
@ -1216,12 +1292,17 @@ void dxwCore::ShowTimeStretching(HDC xdc)
|
||||
if(corner==LastCorner) corner = (corner+1) % 4;
|
||||
LastCorner = corner;
|
||||
color=0x0000FF; // red
|
||||
(*pGetClientRect)(hWnd, &rect);
|
||||
//(*pGetClientRect)(hWnd, &rect);
|
||||
//switch (corner) {
|
||||
//case 0: x=10; y=10; break;
|
||||
//case 1: x=rect.right-60; y=10; break;
|
||||
//case 2: x=rect.right-60; y=rect.bottom-20; break;
|
||||
//case 3: x=10; y=rect.bottom-20; break;
|
||||
switch (corner) {
|
||||
case 0: x=10; y=10; break;
|
||||
case 1: x=rect.right-60; y=10; break;
|
||||
case 2: x=rect.right-60; y=rect.bottom-20; break;
|
||||
case 3: x=10; y=rect.bottom-20; break;
|
||||
case 1: x=w-60; y=10; break;
|
||||
case 2: x=w-60; y=h-20; break;
|
||||
case 3: x=10; y=h-20; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,7 @@ public: // methods
|
||||
LARGE_INTEGER dxwCore::StretchCounter(LARGE_INTEGER);
|
||||
void ShowOverlay();
|
||||
void ShowOverlay(HDC);
|
||||
void ShowOverlay(HDC, int, int);
|
||||
void ShowOverlay(LPDIRECTDRAWSURFACE);
|
||||
char *GetTSCaption(void);
|
||||
char *GetTSCaption(int);
|
||||
@ -119,6 +120,9 @@ public: // methods
|
||||
LARGE_INTEGER StretchLargeCounter(LARGE_INTEGER);
|
||||
UINT MapKeysConfig(UINT, LPARAM, WPARAM);
|
||||
void MapKeysInit();
|
||||
void SetVSyncDelays(UINT);
|
||||
void VSyncWait();
|
||||
void DumpDesktopStatus();
|
||||
|
||||
public: // simple data variables
|
||||
BOOL Windowize;
|
||||
@ -170,9 +174,13 @@ private:
|
||||
void UnmarkPrimarySurface(LPDIRECTDRAWSURFACE);
|
||||
void UnmarkBackBufferSurface(LPDIRECTDRAWSURFACE);
|
||||
BOOL MustShowOverlay;
|
||||
void ShowFPS(HDC);
|
||||
void ShowTimeStretching(HDC);
|
||||
void ShowFPS(HDC, int, int);
|
||||
void ShowTimeStretching(HDC, int, int);
|
||||
TimerEvent_Type TimerEvent;
|
||||
DWORD gdwRefreshRate;
|
||||
#define MAXREFRESHDELAYCOUNT 20
|
||||
int iRefreshDelays[MAXREFRESHDELAYCOUNT];
|
||||
int iRefreshDelayCount;
|
||||
};
|
||||
|
||||
extern dxwCore dxw;
|
||||
|
@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
|
||||
#define VERSION "2.02.87"
|
||||
#define VERSION "2.02.88"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
|
||||
@ -93,6 +93,7 @@ int SetTarget(TARGETMAP *targets){
|
||||
pStatus->TaskIdx=0;
|
||||
pStatus->hWnd=NULL;
|
||||
pStatus->ColorDepth=0;
|
||||
memset((void *)&(pStatus->pfd), 0, sizeof(DDPIXELFORMAT));
|
||||
pStatus->Height = pStatus->Width = 0;
|
||||
pStatus->DXVersion = 0;
|
||||
for(i = 0; targets[i].path[0]; i ++){
|
||||
@ -207,6 +208,7 @@ LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam)
|
||||
pStatus->dwPid=GetProcessId(GetCurrentProcess());
|
||||
pStatus->TimeShift=pMapping[i].InitTS;
|
||||
pStatus->CursorX = pStatus->CursorY = 0;
|
||||
memset((void *)&(pStatus->pfd), 0, sizeof(DDPIXELFORMAT));
|
||||
DxWndStatus = *pStatus;
|
||||
HookInit(&pMapping[i], hwnd);
|
||||
}
|
||||
|
Binary file not shown.
11
dll/hd3d.cpp
11
dll/hd3d.cpp
@ -726,6 +726,7 @@ HRESULT WINAPI extReset(void *pd3dd, D3DPRESENT_PARAMETERS* pPresParam)
|
||||
}
|
||||
|
||||
dxw.SetScreenSize(pPresParam->BackBufferWidth, pPresParam->BackBufferHeight);
|
||||
dxw.SetVSyncDelays(mode.RefreshRate);
|
||||
|
||||
GetHookInfo()->IsFullScreen = dxw.IsFullScreen();
|
||||
GetHookInfo()->DXVersion=(short)dwD3DVersion;
|
||||
@ -742,6 +743,7 @@ HRESULT WINAPI extPresent(void *pd3dd, CONST RECT *pSourceRect, CONST RECT *pDes
|
||||
OutTraceB("Present\n");
|
||||
// frame counter handling....
|
||||
if (dxw.HandleFPS()) return D3D_OK;
|
||||
if (dxw.dwFlags1 & SAVELOAD) dxw.VSyncWait();
|
||||
// proxy ....
|
||||
res=(*pPresent)(pd3dd, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
|
||||
dxw.ShowOverlay();
|
||||
@ -763,6 +765,7 @@ HRESULT WINAPI extGetDisplayMode8(void *lpd3d, D3DDISPLAYMODE *pMode)
|
||||
pMode->Height = dxw.GetScreenHeight();
|
||||
}
|
||||
OutTraceD3D("GetDisplayMode(8): fixed size=(%dx%d)\n", pMode->Width, pMode->Height);
|
||||
dxw.SetVSyncDelays(pMode->RefreshRate);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -781,6 +784,7 @@ HRESULT WINAPI extGetDisplayMode9(void *lpd3d, UINT iSwapChain, D3DDISPLAYMODE *
|
||||
pMode->Height = dxw.GetScreenHeight();
|
||||
}
|
||||
OutTraceD3D("GetDisplayMode(9): fixed size=(%dx%d)\n", pMode->Width, pMode->Height);
|
||||
dxw.SetVSyncDelays(pMode->RefreshRate);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -817,6 +821,7 @@ HRESULT WINAPI extGetAdapterDisplayMode8(void *lpd3d, UINT Adapter, D3DDISPLAYMO
|
||||
pMode->Height = dxw.GetScreenHeight();
|
||||
}
|
||||
OutTraceD3D("GetAdapterDisplayMode(8): fixed size=(%dx%d)\n", pMode->Width, pMode->Height);
|
||||
dxw.SetVSyncDelays(pMode->RefreshRate);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -835,6 +840,7 @@ HRESULT WINAPI extGetAdapterDisplayMode9(void *lpd3d, UINT Adapter, D3DDISPLAYMO
|
||||
pMode->Height = dxw.GetScreenHeight();
|
||||
}
|
||||
OutTraceD3D("GetAdapterDisplayMode(9): fixed size=(%dx%d)\n", pMode->Width, pMode->Height);
|
||||
dxw.SetVSyncDelays(pMode->RefreshRate);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -967,6 +973,8 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
|
||||
HookD3DDevice9(ppd3dd);
|
||||
}
|
||||
|
||||
dxw.SetVSyncDelays(mode.RefreshRate);
|
||||
|
||||
GetHookInfo()->IsFullScreen = dxw.IsFullScreen();
|
||||
GetHookInfo()->DXVersion=(short)dwD3DVersion;
|
||||
GetHookInfo()->Height=(short)dxw.GetScreenHeight();
|
||||
@ -1049,6 +1057,8 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp
|
||||
|
||||
HookD3DDevice9(ppd3dd);
|
||||
|
||||
dxw.SetVSyncDelays(mode.RefreshRate);
|
||||
|
||||
GetHookInfo()->IsFullScreen = dxw.IsFullScreen();
|
||||
GetHookInfo()->DXVersion=(short)dwD3DVersion;
|
||||
GetHookInfo()->Height=(short)dxw.GetScreenHeight();
|
||||
@ -1182,6 +1192,7 @@ HRESULT WINAPI extCreateAdditionalSwapChain(void *lpd3dd, D3DPRESENT_PARAMETERS
|
||||
}
|
||||
|
||||
(dwD3DVersion == 9) ? HookD3DDevice9(&lpd3dd) : HookD3DDevice8(&lpd3dd);
|
||||
dxw.SetVSyncDelays(mode.RefreshRate);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -863,7 +863,7 @@ HRESULT WINAPI extBeginScene2(void *d3dd)
|
||||
{
|
||||
HRESULT res;
|
||||
OutTraceD3D("BeginScene(2): d3dd=%x\n", d3dd);
|
||||
if(dxw.dwFlags4 & ZBUFFERCLEAN){
|
||||
if((dxw.dwFlags4 & ZBUFFERCLEAN) || (dxw.dwFlags5 & CLEARTARGET)){
|
||||
HRESULT res2;
|
||||
LPDIRECT3DVIEWPORT2 vp;
|
||||
D3DVIEWPORT vpd;
|
||||
@ -877,7 +877,8 @@ HRESULT WINAPI extBeginScene2(void *d3dd)
|
||||
d3dRect.x2 = vpd.dwX + vpd.dwWidth;
|
||||
d3dRect.y2 = vpd.dwY + vpd.dwHeight;
|
||||
OutTraceD3D("d3dRect=(%d,%d)-(%d,%d)\n", d3dRect.x1, d3dRect.y1, d3dRect.x2, d3dRect.y2);
|
||||
vp->Clear(1, &d3dRect, D3DCLEAR_ZBUFFER);
|
||||
if(dxw.dwFlags4 & ZBUFFERCLEAN) vp->Clear(1, &d3dRect, D3DCLEAR_ZBUFFER);
|
||||
if(dxw.dwFlags5 & CLEARTARGET) vp->Clear(1, &d3dRect, D3DCLEAR_TARGET);
|
||||
}
|
||||
}
|
||||
res=(*pBeginScene2)(d3dd);
|
||||
@ -889,7 +890,7 @@ HRESULT WINAPI extBeginScene3(void *d3dd)
|
||||
{
|
||||
HRESULT res;
|
||||
OutTraceD3D("BeginScene(3): d3dd=%x\n", d3dd);
|
||||
if(dxw.dwFlags4 & (ZBUFFERCLEAN|ZBUFFER0CLEAN)){
|
||||
if((dxw.dwFlags4 & (ZBUFFERCLEAN|ZBUFFER0CLEAN)) || (dxw.dwFlags5 & CLEARTARGET)){
|
||||
HRESULT res2;
|
||||
LPDIRECT3DVIEWPORT3 vp;
|
||||
D3DVIEWPORT vpd;
|
||||
@ -905,6 +906,7 @@ HRESULT WINAPI extBeginScene3(void *d3dd)
|
||||
OutTraceD3D("d3dRect=(%d,%d)-(%d,%d)\n", d3dRect.x1, d3dRect.y1, d3dRect.x2, d3dRect.y2);
|
||||
if(dxw.dwFlags4 & ZBUFFERCLEAN )vp->Clear2(1, &d3dRect, D3DCLEAR_ZBUFFER, 0, 1.0, 0);
|
||||
if(dxw.dwFlags4 & ZBUFFER0CLEAN)vp->Clear2(1, &d3dRect, D3DCLEAR_ZBUFFER, 0, 0.0, 0);
|
||||
if(dxw.dwFlags5 & CLEARTARGET) vp->Clear(1, &d3dRect, D3DCLEAR_TARGET);
|
||||
}
|
||||
}
|
||||
res=(*pBeginScene3)(d3dd);
|
||||
|
@ -10,8 +10,11 @@
|
||||
//#undef IsTraceDW
|
||||
//#define IsTraceDW TRUE
|
||||
|
||||
BOOL WINAPI extCheckRemoteDebuggerPresent(HANDLE, PBOOL);
|
||||
|
||||
static HookEntry_Type Hooks[]={
|
||||
{HOOK_IAT_CANDIDATE, "IsDebuggerPresent", (FARPROC)NULL, (FARPROC *)NULL, (FARPROC)extIsDebuggerPresent},
|
||||
{HOOK_IAT_CANDIDATE, "CheckRemoteDebuggerPresent", (FARPROC)NULL, (FARPROC *)NULL, (FARPROC)extCheckRemoteDebuggerPresent},
|
||||
{HOOK_IAT_CANDIDATE, "GetProcAddress", (FARPROC)GetProcAddress, (FARPROC *)&pGetProcAddress, (FARPROC)extGetProcAddress},
|
||||
{HOOK_IAT_CANDIDATE, "LoadLibraryA", (FARPROC)LoadLibraryA, (FARPROC *)&pLoadLibraryA, (FARPROC)extLoadLibraryA},
|
||||
{HOOK_IAT_CANDIDATE, "LoadLibraryExA", (FARPROC)LoadLibraryExA, (FARPROC *)&pLoadLibraryExA, (FARPROC)extLoadLibraryExA},
|
||||
@ -628,7 +631,7 @@ DWORD WINAPI extGetLogicalDrives(void)
|
||||
DevBit = 0x1 << i;
|
||||
if(DevMask & DevBit){
|
||||
char RootPathName[10];
|
||||
sprintf(RootPathName, "%c:\\", 'A'+i);
|
||||
sprintf_s(RootPathName, 4, "%c:\\", 'A'+i);
|
||||
Vol = GetVolumeInformation(RootPathName, NULL, NULL, NULL, 0, 0, 0, 0);
|
||||
OutTrace("Vol=%s status=%x\n", RootPathName, Vol);
|
||||
if(!Vol) DevMask &= ~DevBit;
|
||||
@ -722,3 +725,12 @@ BOOL WINAPI extCreateProcessA(
|
||||
OutTraceDW("CreateProcess: SUPPRESS ApplicationName=%s CommandLine=\"%s\"\n", lpApplicationName, lpCommandLine);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI extCheckRemoteDebuggerPresent(HANDLE hProcess, PBOOL pbDebuggerPresent)
|
||||
{
|
||||
BOOL ret;
|
||||
if(pbDebuggerPresent) *pbDebuggerPresent = FALSE;
|
||||
ret= (hProcess==(HANDLE)0xFFFFFFFF) ? FALSE : TRUE;
|
||||
OutTraceDW("CheckRemoteDebuggerPresent: hProcess=%x ret=%x\n", hProcess, ret);
|
||||
return ret;
|
||||
}
|
||||
|
103
host/DesktopDialog.cpp
Normal file
103
host/DesktopDialog.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
// DesktopDialog.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "dxwndhost.h"
|
||||
#include "DesktopDialog.h"
|
||||
|
||||
// CDesktopDialog dialog
|
||||
|
||||
IMPLEMENT_DYNAMIC(CDesktopDialog, CDialog)
|
||||
|
||||
CDesktopDialog::CDesktopDialog(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CDesktopDialog::IDD, pParent)
|
||||
{
|
||||
}
|
||||
|
||||
CDesktopDialog::~CDesktopDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void CDesktopDialog::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDesktopDialog, CDialog)
|
||||
ON_WM_TIMER()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
#define IDDesktopTIMER 2
|
||||
|
||||
// CDesktopDialog message handlers
|
||||
|
||||
void CDesktopDialog::OnTimer(UINT_PTR nIDEvent)
|
||||
{
|
||||
char sMsg[1024];
|
||||
|
||||
CDialog::OnTimer(nIDEvent);
|
||||
|
||||
RECT desktop;
|
||||
HDC hDC;
|
||||
// Get a handle to the desktop window
|
||||
const CWnd *hDesktop = GetDesktopWindow();
|
||||
// Get the size of screen to the variable desktop
|
||||
hDesktop->GetWindowRect(&desktop);
|
||||
// The top left corner will have coordinates (0,0)
|
||||
// and the bottom right corner will have coordinates
|
||||
// (horizontal, vertical)
|
||||
hDC = ::GetDC(::GetDesktopWindow());
|
||||
int iBPP = GetDeviceCaps(hDC, BITSPIXEL);
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
int iPixelFormat;
|
||||
// get the current pixel format index
|
||||
iPixelFormat = ::GetPixelFormat(hDC);
|
||||
if(!iPixelFormat) iPixelFormat=1; // why returns 0???
|
||||
if(iPixelFormat){
|
||||
// obtain a detailed description of that pixel format
|
||||
::DescribePixelFormat(hDC, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
sprintf_s(sMsg, 1024,
|
||||
"Desktop size (W x H)=(%d x %d)\n"
|
||||
"Color depth = %d (color bits = %d)\n"
|
||||
"Pixel format = %d\n"
|
||||
"Color bits (RGBA)=(%d,%d,%d,%d)\n"
|
||||
"Color shift (RGBA)=(%d,%d,%d,%d)\n"
|
||||
,
|
||||
desktop.right, desktop.bottom,
|
||||
iBPP, pfd.cColorBits,
|
||||
iPixelFormat,
|
||||
pfd.cRedBits, pfd.cGreenBits, pfd.cBlueBits, pfd.cAlphaBits,
|
||||
pfd.cRedShift, pfd.cGreenShift, pfd.cBlueShift, pfd.cAlphaShift
|
||||
);
|
||||
}
|
||||
else{
|
||||
sprintf_s(sMsg, 1024, "error %d", GetLastError());
|
||||
}
|
||||
|
||||
|
||||
this->SetDlgItemTextA(IDC_DESKTOPINFO, sMsg);
|
||||
}
|
||||
|
||||
BOOL CDesktopDialog::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
SetTimer(IDDesktopTIMER, 1000, NULL);
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CDesktopDialog::OnOK()
|
||||
{
|
||||
// TODO: Add your specialized code here and/or call the base class
|
||||
|
||||
KillTimer(IDDesktopTIMER);
|
||||
// stop timer
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
27
host/DesktopDialog.h
Normal file
27
host/DesktopDialog.h
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CDesktopDialog dialog
|
||||
|
||||
class CDesktopDialog : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CDesktopDialog)
|
||||
|
||||
public:
|
||||
CDesktopDialog(CWnd* pParent = NULL); // standard constructor
|
||||
virtual ~CDesktopDialog();
|
||||
|
||||
// Dialog Data
|
||||
enum { IDD = IDD_DESKTOP };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
protected:
|
||||
virtual void OnOK();
|
||||
};
|
BIN
host/Resource.h
BIN
host/Resource.h
Binary file not shown.
@ -39,7 +39,6 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
|
||||
LPCSTR Status;
|
||||
char sMsg[1024];
|
||||
char sMsg2[1024];
|
||||
char sMsgBuf[80+1];
|
||||
char DllVersion[21];
|
||||
DXWNDSTATUS DxWndStatus;
|
||||
extern PRIVATEMAP *pTitles;
|
||||
@ -78,14 +77,43 @@ void CStatusDialog::OnTimer(UINT_PTR nIDEvent)
|
||||
DxWndStatus.isLogging?"ON":"OFF",
|
||||
DxWndStatus.CursorX, DxWndStatus.CursorY);
|
||||
strcat(sMsg, sMsg2);
|
||||
if(DxWndStatus.pfd.dwFlags & DDPF_FOURCC){
|
||||
char *fcc;
|
||||
fcc = (char *)&(DxWndStatus.pfd.dwFourCC);
|
||||
sprintf_s(sMsg2, 1024,
|
||||
"\nFourCC = %x (%c%c%c%c)",
|
||||
DxWndStatus.pfd.dwFourCC,
|
||||
isprint(fcc[0])?fcc[0]:'.', isprint(fcc[1])?fcc[1]:'.', isprint(fcc[2])?fcc[2]:'.', isprint(fcc[3])?fcc[3]:'.'
|
||||
);
|
||||
strcat(sMsg, sMsg2);
|
||||
}
|
||||
if(DxWndStatus.pfd.dwSize){
|
||||
sprintf_s(sMsg2, 1024,
|
||||
"\nPixel format=%s%s%s%s%s%s",
|
||||
(DxWndStatus.pfd.dwFlags & DDPF_ALPHAPIXELS) ? "ALPHAPIXELS ":"",
|
||||
(DxWndStatus.pfd.dwFlags & DDPF_ALPHA) ? "ALPHA ":"",
|
||||
(DxWndStatus.pfd.dwFlags & DDPF_FOURCC) ? "FOURCC ":"",
|
||||
(DxWndStatus.pfd.dwFlags & (DDPF_PALETTEINDEXED4|DDPF_PALETTEINDEXEDTO8|DDPF_PALETTEINDEXED8)) ? "PALETTEINDEXED ":"",
|
||||
(DxWndStatus.pfd.dwFlags & DDPF_RGB) ? "RGB ":"",
|
||||
(DxWndStatus.pfd.dwFlags & DDPF_YUV) ? "YUV ":""
|
||||
);
|
||||
strcat(sMsg, sMsg2);
|
||||
}
|
||||
if(DxWndStatus.pfd.dwFlags & DDPF_RGB){
|
||||
sprintf_s(sMsg2, 1024,
|
||||
"\nColor mask (RGBA)=(%x,%x,%x,%x)",
|
||||
DxWndStatus.pfd.dwRBitMask, DxWndStatus.pfd.dwGBitMask, DxWndStatus.pfd.dwBBitMask, DxWndStatus.pfd.dwRGBAlphaBitMask
|
||||
);
|
||||
strcat(sMsg, sMsg2);
|
||||
}
|
||||
if(Target->flags2 & (SHOWFPS|SHOWFPSOVERLAY)){
|
||||
sprintf(sMsgBuf, "\nFPS = %d", DxWndStatus.FPSCount);
|
||||
strcat(sMsg, sMsgBuf);
|
||||
sprintf(sMsg2, "\nFPS = %d", DxWndStatus.FPSCount);
|
||||
strcat(sMsg, sMsg2);
|
||||
}
|
||||
if(Target->flags2 & TIMESTRETCH){
|
||||
if(DxWndStatus.TimeShift>=-8 && DxWndStatus.TimeShift<=8){
|
||||
sprintf(sMsgBuf, "\nTime speed %s", GetTSCaption(DxWndStatus.TimeShift));
|
||||
strcat(sMsg, sMsgBuf);
|
||||
sprintf(sMsg2, "\nTime speed %s", GetTSCaption(DxWndStatus.TimeShift));
|
||||
strcat(sMsg, sMsg2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ void CTabCompat::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_NOTEXTURES, cTarget->m_NoTextures);
|
||||
DDX_Check(pDX, IDC_WIREFRAME, cTarget->m_WireFrame);
|
||||
DDX_Check(pDX, IDC_DISABLEFOGGING, cTarget->m_DisableFogging);
|
||||
DDX_Check(pDX, IDC_CLEARTARGET, cTarget->m_ClearTarget);
|
||||
|
||||
// Registry management
|
||||
DDX_Check(pDX, IDC_EMULATEREGISTRY, cTarget->m_EmulateRegistry);
|
||||
|
@ -40,7 +40,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_SuppressIME = FALSE;
|
||||
m_SuppressD3DExt = FALSE;
|
||||
m_SetCompatibility = TRUE;
|
||||
m_DiabloTweak = TRUE;
|
||||
m_DiabloTweak = FALSE;
|
||||
m_DisableHAL = FALSE;
|
||||
m_ForcesHEL = FALSE;
|
||||
m_ColorFix = FALSE;
|
||||
|
@ -140,6 +140,7 @@ public:
|
||||
BOOL m_NoPower2Fix;
|
||||
BOOL m_NoPerfCounter;
|
||||
BOOL m_DisableFogging;
|
||||
BOOL m_ClearTarget;
|
||||
BOOL m_SuppressIME;
|
||||
BOOL m_SetCompatibility;
|
||||
BOOL m_DiabloTweak;
|
||||
|
@ -1,5 +0,0 @@
|
||||
[window]
|
||||
posx=1213
|
||||
posy=261
|
||||
sizx=320
|
||||
sizy=200
|
Binary file not shown.
@ -105,7 +105,6 @@ CDxwndhostApp theApp;
|
||||
BOOL CDxwndhostApp::InitInstance()
|
||||
{
|
||||
char InitPath[MAX_PATH];
|
||||
int CompatibilityMinLevel;
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// standard initialization
|
||||
|
Binary file not shown.
Binary file not shown.
@ -223,6 +223,10 @@
|
||||
RelativePath=".\CppUACSelfElevation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DesktopDialog.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\dib.cpp"
|
||||
>
|
||||
@ -454,6 +458,10 @@
|
||||
RelativePath=".\cdib.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DesktopDialog.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\dxTabCtrl.h"
|
||||
>
|
||||
@ -547,6 +555,10 @@
|
||||
RelativePath=".\res\bigicons.bmp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\bitmap1.bmp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\dxw1.ico"
|
||||
>
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "TargetDlg.h"
|
||||
#include "SystemTray.h"
|
||||
#include "StatusDialog.h"
|
||||
#include "DesktopDialog.h"
|
||||
#include "PaletteDialog.h"
|
||||
#include "TimeSliderDialog.h"
|
||||
|
||||
@ -63,6 +64,7 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView)
|
||||
ON_COMMAND(ID_RUN, OnRun)
|
||||
ON_COMMAND(ID_TRAY_RESTORE, OnTrayRestore)
|
||||
ON_COMMAND(ID_VIEW_STATUS, OnViewStatus)
|
||||
ON_COMMAND(ID_VIEW_DESKTOP, OnViewDesktop)
|
||||
ON_COMMAND(ID_VIEW_PALETTE, OnViewPalette)
|
||||
ON_COMMAND(ID_VIEW_TIMESLIDER, OnViewTimeSlider)
|
||||
ON_COMMAND(ID_DESKTOPCOLORDEPTH_8BPP, OnDesktopcolordepth8bpp)
|
||||
@ -177,6 +179,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_NoPower2Fix) t->flags4 |= NOPOWER2FIX;
|
||||
if(dlg->m_NoPerfCounter) t->flags4 |= NOPERFCOUNTER;
|
||||
if(dlg->m_DisableFogging) t->flags4 |= DISABLEFOGGING;
|
||||
if(dlg->m_ClearTarget) t->flags5 |= CLEARTARGET;
|
||||
if(dlg->m_SuppressIME) t->flags2 |= SUPPRESSIME;
|
||||
if(dlg->m_SuppressD3DExt) t->flags3 |= SUPPRESSD3DEXT;
|
||||
if(dlg->m_SetCompatibility) t->flags2 |= SETCOMPATIBILITY;
|
||||
@ -375,6 +378,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_NoPower2Fix = t->flags4 & NOPOWER2FIX ? 1 : 0;
|
||||
dlg->m_NoPerfCounter = t->flags4 & NOPERFCOUNTER ? 1 : 0;
|
||||
dlg->m_DisableFogging = t->flags4 & DISABLEFOGGING ? 1 : 0;
|
||||
dlg->m_ClearTarget = t->flags5 & CLEARTARGET ? 1 : 0;
|
||||
dlg->m_SaveLoad = t->flags & SAVELOAD ? 1 : 0;
|
||||
dlg->m_SlowDown = t->flags & SLOWDOWN ? 1 : 0;
|
||||
dlg->m_BlitFromBackBuffer = t->flags & BLITFROMBACKBUFFER ? 1 : 0;
|
||||
@ -1462,6 +1466,13 @@ void CDxwndhostView::OnViewStatus()
|
||||
pDlg->ShowWindow(SW_SHOW);
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnViewDesktop()
|
||||
{
|
||||
CDesktopDialog *pDlg = new CDesktopDialog();
|
||||
BOOL ret = pDlg->Create(CDesktopDialog::IDD, this);
|
||||
pDlg->ShowWindow(SW_SHOW);
|
||||
}
|
||||
|
||||
void CDxwndhostView::OnViewPalette()
|
||||
{
|
||||
CPaletteDialog *pDlg = new CPaletteDialog();
|
||||
|
@ -83,6 +83,7 @@ protected:
|
||||
afx_msg void OnHookStop();
|
||||
afx_msg void OnTrayRestore();
|
||||
afx_msg void OnViewStatus();
|
||||
afx_msg void OnViewDesktop();
|
||||
afx_msg void OnViewPalette();
|
||||
afx_msg void OnViewTimeSlider();
|
||||
afx_msg void OnExit();
|
||||
|
Binary file not shown.
Before ![]() (image error) Size: 9.1 KiB After ![]() (image error) Size: 5.1 KiB ![]() ![]() |
Binary file not shown.
Before ![]() (image error) Size: 314 B |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user