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

v2_02_32_src

Former-commit-id: fe45ae6a326109606378d67a657b9f0080001fd2
This commit is contained in:
gho tik 2013-08-30 12:38:14 -04:00 committed by Refael ACkermann
parent 6d56f83f1f
commit 3db9abb9ba
23 changed files with 775 additions and 230 deletions

View File

@ -93,6 +93,8 @@
#define CDROMDRIVETYPE 0x00000800 // Pretends that GetDriveType() always returns DRIVE_CDROM #define CDROMDRIVETYPE 0x00000800 // Pretends that GetDriveType() always returns DRIVE_CDROM
#define NOWINDOWMOVE 0x00001000 // Do not try to update window position & size on D3D rendering #define NOWINDOWMOVE 0x00001000 // Do not try to update window position & size on D3D rendering
#define DISABLEHAL 0x00002000 // Disable HAL support (IID_IDirect3DHALDevice) #define DISABLEHAL 0x00002000 // Disable HAL support (IID_IDirect3DHALDevice)
#define LOCKSYSCOLORS 0x00004000 // Lock Sys Colors changes by SetSysColors() call
#define EMULATEDC 0x00008000 // ........
// logging Tflags DWORD: // logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:ff5e1a04f90b69aaeac5520885d280a978746c9674a5085725d17d45593af92a oid sha256:47630d9ec2f6d6c9eb9b588acadace0fa49394596c03a977bb3d062a07a60074
size 378368 size 385024

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:a15a98b4e75ff8b03d04af4bf9b30445a6af7324468d3276316063fede54375a oid sha256:f985fae11aaa4f10de4c9135577527784e1b153c6403a2f5b01666f0996b8a29
size 524288 size 524288

View File

@ -27,10 +27,10 @@ path1=D:\Games\688\688I_HK.EXE
module1= module1=
opengllib1= opengllib1=
ver1=0 ver1=0
coord1=1 coord1=0
flag1=-938999262 flag1=-937950686
flagg1=135266304 flagg1=134217728
flagh1=20 flagh1=32788
flagi1=0 flagi1=0
tflag1=3 tflag1=3
initx1=0 initx1=0
@ -98,7 +98,7 @@ opengllib4=
ver4=0 ver4=0
coord4=0 coord4=0
flag4=142606368 flag4=142606368
flagg4=135266304 flagg4=134217728
flagh4=8212 flagh4=8212
flagi4=0 flagi4=0
tflag4=7 tflag4=7
@ -304,7 +304,7 @@ module13=
opengllib13= opengllib13=
ver13=0 ver13=0
coord13=0 coord13=0
flag13=771891232 flag13=771891234
flagg13=201457664 flagg13=201457664
flagh13=8212 flagh13=8212
flagi13=0 flagi13=0
@ -672,9 +672,9 @@ module29=
opengllib29= opengllib29=
ver29=0 ver29=0
coord29=0 coord29=0
flag29=671621154 flag29=679485474
flagg29=135266304 flagg29=134217728
flagh29=20 flagh29=32788
flagi29=0 flagi29=0
tflag29=3 tflag29=3
initx29=0 initx29=0
@ -689,17 +689,17 @@ sizx29=1200
sizy29=900 sizy29=900
maxfps29=0 maxfps29=0
initts29=0 initts29=0
title30=Imperialism II title30=Mechwarrior 3
path30=D:\Games\imperialism_2\imperialism II.exe path30=D:\Games\Mechwarrior 3 (full)\Mech3.exe
module30= module30=
opengllib30= opengllib30=
ver30=0 ver30=0
coord30=1 coord30=0
flag30=671096866 flag30=671096866
flagg30=470810640 flagg30=134217728
flagh30=52 flagh30=20
flagi30=0 flagi30=0
tflag30=3 tflag30=0
initx30=0 initx30=0
inity30=0 inity30=0
minx30=0 minx30=0
@ -712,13 +712,13 @@ sizx30=800
sizy30=600 sizy30=600
maxfps30=0 maxfps30=0
initts30=0 initts30=0
title31=Mechwarrior 3 title31=Raiden II
path31=D:\Games\Mechwarrior 3 (full)\Mech3.exe path31=D:\Games\raiden2\RAIDENII.EXE
module31= module31=
opengllib31= opengllib31=
ver31=0 ver31=0
coord31=0 coord31=1
flag31=671096866 flag31=134217762
flagg31=134217728 flagg31=134217728
flagh31=20 flagh31=20
flagi31=0 flagi31=0
@ -735,12 +735,12 @@ sizx31=800
sizy31=600 sizy31=600
maxfps31=0 maxfps31=0
initts31=0 initts31=0
title32=Raiden II title32=Rapanui
path32=D:\Games\raiden2\RAIDENII.EXE path32=D:\Games\Rapanui\Rapanui.exe
module32= module32=
opengllib32= opengllib32=
ver32=0 ver32=0
coord32=1 coord32=0
flag32=134217762 flag32=134217762
flagg32=134217728 flagg32=134217728
flagh32=20 flagh32=20
@ -758,42 +758,42 @@ sizx32=800
sizy32=600 sizy32=600
maxfps32=0 maxfps32=0
initts32=0 initts32=0
title33=Rapanui title33=Silent Hunter II (shell)
path33=D:\Games\Rapanui\Rapanui.exe path33=D:\Games\Silent Hunter II\Shell\Shell.exe
module33= module33=
opengllib33= opengllib33=
ver33=0 ver33=0
coord33=0 coord33=0
flag33=134217762 flag33=402653221
flagg33=134217728 flagg33=135266304
flagh33=20 flagh33=20
flagi33=0 flagi33=0
tflag33=0 tflag33=3
initx33=0 initx33=0
inity33=0 inity33=0
minx33=0 minx33=0
miny33=0 miny33=0
maxx33=0 maxx33=800
maxy33=0 maxy33=600
posx33=50 posx33=50
posy33=50 posy33=50
sizx33=800 sizx33=800
sizy33=600 sizy33=600
maxfps33=0 maxfps33=0
initts33=0 initts33=0
title34=Silent Hunter II (shell) title34=Silent Hunter II (sim)
path34=D:\Games\Silent Hunter II\Shell\Shell.exe path34=D:\Games\Silent Hunter II\Sim\Sim.exe
module34= module34=
opengllib34= opengllib34=
ver34=0 ver34=0
coord34=0 coord34=0
flag34=402653221 flag34=134217780
flagg34=135266304 flagg34=134217728
flagh34=20 flagh34=20
flagi34=0 flagi34=0
tflag34=3 tflag34=0
initx34=0 initx34=400
inity34=0 inity34=300
minx34=0 minx34=0
miny34=0 miny34=0
maxx34=800 maxx34=800
@ -804,40 +804,40 @@ sizx34=800
sizy34=600 sizy34=600
maxfps34=0 maxfps34=0
initts34=0 initts34=0
title35=Silent Hunter II (sim) title35=The Sims
path35=D:\Games\Silent Hunter II\Sim\Sim.exe path35=D:\Games\sims\Sims.exe
module35= module35=
opengllib35= opengllib35=
ver35=0 ver35=0
coord35=0 coord35=0
flag35=134217780 flag35=679616546
flagg35=134217728 flagg35=134217728
flagh35=20 flagh35=84
flagi35=0 flagi35=0
tflag35=0 tflag35=67
initx35=400 initx35=0
inity35=300 inity35=0
minx35=0 minx35=0
miny35=0 miny35=0
maxx35=800 maxx35=0
maxy35=600 maxy35=0
posx35=50 posx35=50
posy35=50 posy35=50
sizx35=800 sizx35=800
sizy35=600 sizy35=600
maxfps35=0 maxfps35=0
initts35=0 initts35=0
title36=The Sims title36=Tomb Raider - The Last Revelation
path36=D:\Games\sims\Sims.exe path36=D:\Games\Tomb Raider - The Last Revelation\tomb4.exe
module36= module36=
opengllib36= opengllib36=
ver36=0 ver36=0
coord36=0 coord36=0
flag36=738336800 flag36=134217826
flagg36=134217728 flagg36=134217728
flagh36=1044 flagh36=20
flagi36=0 flagi36=0
tflag36=66 tflag36=3
initx36=0 initx36=0
inity36=0 inity36=0
minx36=0 minx36=0
@ -850,17 +850,17 @@ sizx36=800
sizy36=600 sizy36=600
maxfps36=0 maxfps36=0
initts36=0 initts36=0
title37=Tomb Raider - The Last Revelation title37=TOMB2.EXE
path37=D:\Games\Tomb Raider - The Last Revelation\tomb4.exe path37=D:\Games\Tomb Raider 2\TOMB2.EXE
module37= module37=
opengllib37= opengllib37=
ver37=0 ver37=0
coord37=0 coord37=0
flag37=134217826 flag37=134217760
flagg37=134217728 flagg37=201326592
flagh37=20 flagh37=2068
flagi37=0 flagi37=0
tflag37=3 tflag37=0
initx37=0 initx37=0
inity37=0 inity37=0
minx37=0 minx37=0
@ -873,17 +873,17 @@ sizx37=800
sizy37=600 sizy37=600
maxfps37=0 maxfps37=0
initts37=0 initts37=0
title38=TOMB2.EXE title38=wa.exe
path38=D:\Games\Tomb Raider 2\TOMB2.EXE path38=D:\Games\worms_arma\Worms_2_Armageddon\wa.exe
module38= module38=
opengllib38= opengllib38=
ver38=0 ver38=0
coord38=0 coord38=0
flag38=134217760 flag38=713031712
flagg38=201326592 flagg38=142606336
flagh38=2068 flagh38=20
flagi38=0 flagi38=0
tflag38=0 tflag38=3
initx38=0 initx38=0
inity38=0 inity38=0
minx38=0 minx38=0
@ -896,17 +896,17 @@ sizx38=800
sizy38=600 sizy38=600
maxfps38=0 maxfps38=0
initts38=0 initts38=0
title39=wa.exe title39=Western Front
path39=D:\Games\worms_arma\Worms_2_Armageddon\wa.exe path39=D:\Games\Western Front\wf.exe
module39= module39=
opengllib39= opengllib39=
ver39=0 ver39=0
coord39=0 coord39=0
flag39=713031712 flag39=679477282
flagg39=142606336 flagg39=135266304
flagh39=20 flagh39=16404
flagi39=0 flagi39=0
tflag39=3 tflag39=0
initx39=0 initx39=0
inity39=0 inity39=0
minx39=0 minx39=0
@ -919,40 +919,40 @@ sizx39=800
sizy39=600 sizy39=600
maxfps39=0 maxfps39=0
initts39=0 initts39=0
title40=Western Front title40=G-Nome
path40=D:\Games\Western Front\wf.exe path40=D:\Games\G-Nome\G-NOME.EXE
module40= module40=
opengllib40= opengllib40=
ver40=0 ver40=0
coord40=0 coord40=0
flag40=679477282 flag40=-1433399262
flagg40=134217728 flagg40=201326592
flagh40=20 flagh40=33300
flagi40=0 flagi40=0
tflag40=0 tflag40=3
initx40=0 initx40=0
inity40=0 inity40=0
minx40=0 minx40=0
miny40=0 miny40=0
maxx40=0 maxx40=0
maxy40=0 maxy40=0
posx40=50 posx40=250
posy40=50 posy40=250
sizx40=800 sizx40=800
sizy40=600 sizy40=600
maxfps40=0 maxfps40=0
initts40=0 initts40=0
title41=G-Nome title41=GeneRally
path41=D:\Games\G-Nome\G-NOME.EXE path41=D:\Games\generally105\GeneRally.exe
module41= module41=
opengllib41= opengllib41=
ver41=0 ver41=7
coord41=0 coord41=0
flag41=713031714 flag41=134234146
flagg41=134217728 flagg41=135266305
flagh41=20 flagh41=20
flagi41=0 flagi41=0
tflag41=3 tflag41=0
initx41=0 initx41=0
inity41=0 inity41=0
minx41=0 minx41=0
@ -961,10 +961,125 @@ maxx41=0
maxy41=0 maxy41=0
posx41=50 posx41=50
posy41=50 posy41=50
sizx41=0 sizx41=800
sizy41=0 sizy41=600
maxfps41=0 maxfps41=0
initts41=0 initts41=0
title42=Warlords 3
path42=D:\Games\Warlords3\Darklord.exe
module42=
opengllib42=
ver42=0
coord42=0
flag42=-2013249502
flagg42=135266304
flagh42=20
flagi42=0
tflag42=0
initx42=0
inity42=0
minx42=0
miny42=0
maxx42=0
maxy42=0
posx42=50
posy42=50
sizx42=800
sizy42=600
maxfps42=0
initts42=0
title43=Tachyon The Fringe
path43=D:\Games\TachyonTheFringe\space.exe
module43=
opengllib43=
ver43=0
coord43=0
flag43=151011364
flagg43=134217728
flagh43=20
flagi43=0
tflag43=3
initx43=0
inity43=0
minx43=0
miny43=0
maxx43=0
maxy43=0
posx43=50
posy43=50
sizx43=800
sizy43=600
maxfps43=0
initts43=0
title44=Tanktics
path44=D:\Games\Tanktics\tanktics.exe
module44=
opengllib44=
ver44=0
coord44=1
flag44=671088674
flagg44=134217728
flagh44=20
flagi44=0
tflag44=259
initx44=0
inity44=0
minx44=0
miny44=0
maxx44=0
maxy44=0
posx44=50
posy44=50
sizx44=800
sizy44=600
maxfps44=0
initts44=0
title45=Nightmare Ned
path45=D:\Games\Ned\NITENED.EXE
module45=
opengllib45=
ver45=0
coord45=0
flag45=134217762
flagg45=134217728
flagh45=20
flagi45=0
tflag45=3
initx45=0
inity45=0
minx45=0
miny45=0
maxx45=0
maxy45=0
posx45=50
posy45=50
sizx45=800
sizy45=600
maxfps45=0
initts45=0
title46=Imperialism II
path46=D:\Games\imperialism_2\imperialism II.exe
module46=
opengllib46=
ver46=0
coord46=0
flag46=142614562
flagg46=470810688
flagh46=20
flagi46=0
tflag46=67
initx46=0
inity46=0
minx46=0
miny46=0
maxx46=0
maxy46=0
posx46=50
posy46=50
sizx46=800
sizy46=600
maxfps46=0
initts46=0
[window] [window]
posx=908 posx=908
posy=205 posy=205

View File

@ -212,4 +212,14 @@ fixed DeferWindowPos hook to make Imperialism II working
fixed SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN properties fixed SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN properties
fixed window class logging causing program crash fixed window class logging causing program crash
GUI: GUI:
added "GDI/Scale font parameters" & "DirectX/Disable HAL support" options added "GDI/Scale font parameters" & "DirectX/Disable HAL support" options
v2.02.32
CORE:
added new GDI handling mode, "Emulated devce context". Currently tested successfully on "G-Nome" only.
fixed "Prevent maximize" windows handling avoiding to disable topmost style for child windows
fixed handling of DDSCAPS_3DDEVICE surfaces in emulated mode: "Nightmare Ned" is working ok, "The Sims" works better (still crashing..)
fixed banner handling in case of device context remmapped coordinates
fixed memory leakage in SetDIBitsToDevice hooker
GUI
added radiobutton group to set the preferred GDI emulation mode

View File

@ -763,23 +763,24 @@ int lpddHookedVersion(LPDIRECTDRAW lpdd)
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static void DumpPixFmt(LPDDSURFACEDESC2 lpdd) static void DumpPixFmt(LPDDSURFACEDESC2 lpdds)
{ {
OutTraceD("PixFmt: Size=%x Flags=%x(%s) FourCC=%x RGBBitCount=%d RGBA BitMask=(%x,%x,%x,%x)\n", OutTraceD("PixFmt: Size=%x Flags=%x(%s) FourCC=%x RGBBitCount=%d RGBA BitMask=(%x,%x,%x,%x)\n",
lpdd->ddpfPixelFormat.dwSize, lpdds->ddpfPixelFormat.dwSize,
lpdd->ddpfPixelFormat.dwFlags, ExplainPixelFormatFlags(lpdd->ddpfPixelFormat.dwFlags), lpdds->ddpfPixelFormat.dwFlags, ExplainPixelFormatFlags(lpdds->ddpfPixelFormat.dwFlags),
lpdd->ddpfPixelFormat.dwFourCC, lpdds->ddpfPixelFormat.dwFourCC,
lpdd->ddpfPixelFormat.dwRGBBitCount, lpdds->ddpfPixelFormat.dwRGBBitCount,
lpdd->ddpfPixelFormat.dwRBitMask, lpdds->ddpfPixelFormat.dwRBitMask,
lpdd->ddpfPixelFormat.dwGBitMask, lpdds->ddpfPixelFormat.dwGBitMask,
lpdd->ddpfPixelFormat.dwBBitMask, lpdds->ddpfPixelFormat.dwBBitMask,
lpdd->ddpfPixelFormat.dwRGBAlphaBitMask); lpdds->ddpfPixelFormat.dwRGBAlphaBitMask);
} }
static char *SetPixFmt(LPDDSURFACEDESC2 lpdd) static char *SetPixFmt(LPDDSURFACEDESC2 lpdd)
{ {
char *pfstr; char *pfstr;
OutTraceD("SetPixFmt: BPP=%d Use565=%d\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.dwFlags1 & USERGB565 ? 1:0); OutTraceD("SetPixFmt: BPP=%d Use565=%d\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.dwFlags1 & USERGB565 ? 1:0);
memset(&lpdd->ddpfPixelFormat,0,sizeof(DDPIXELFORMAT)); memset(&lpdd->ddpfPixelFormat,0,sizeof(DDPIXELFORMAT));
lpdd->ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); lpdd->ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
lpdd->ddpfPixelFormat.dwRGBBitCount = dxw.ActualPixelFormat.dwRGBBitCount; lpdd->ddpfPixelFormat.dwRGBBitCount = dxw.ActualPixelFormat.dwRGBBitCount;
@ -1652,7 +1653,7 @@ HRESULT WINAPI extGetDisplayMode(LPDIRECTDRAW lpdd, LPDDSURFACEDESC lpddsd)
lpddsd->dwHeight = dxw.GetScreenHeight(); lpddsd->dwHeight = dxw.GetScreenHeight();
// v2.1.96: fake screen color depth // v2.1.96: fake screen color depth
if(dxw.dwFlags2 & INIT8BPP|INIT16BPP){ if(dxw.dwFlags2 & (INIT8BPP|INIT16BPP)){ // v2.02.32 fix
if(dxw.dwFlags2 & INIT8BPP) FixPixelFormat(8, &lpddsd->ddpfPixelFormat); if(dxw.dwFlags2 & INIT8BPP) FixPixelFormat(8, &lpddsd->ddpfPixelFormat);
if(dxw.dwFlags2 & INIT16BPP) FixPixelFormat(16, &lpddsd->ddpfPixelFormat); if(dxw.dwFlags2 & INIT16BPP) FixPixelFormat(16, &lpddsd->ddpfPixelFormat);
OutTraceD("GetDisplayMode: fix RGBBitCount=%d\n", lpddsd->ddpfPixelFormat.dwRGBBitCount); OutTraceD("GetDisplayMode: fix RGBBitCount=%d\n", lpddsd->ddpfPixelFormat.dwRGBBitCount);
@ -1819,6 +1820,20 @@ static char *FixSurfaceCaps(LPDDSURFACEDESC2 lpddsd)
lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
return SetPixFmt(lpddsd); return SetPixFmt(lpddsd);
break; break;
case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_3DDEVICE:
// Nightmare Ned
OutTrace("FixSurfaceCaps: Nightmare Ned\n");
lpddsd->dwFlags |= DDSD_PIXELFORMAT;
lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
return SetPixFmt(lpddsd);
break;
case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_3DDEVICE|DDSCAPS_SYSTEMMEMORY:
// Nightmare Ned
OutTrace("FixSurfaceCaps: The Sims\n");
lpddsd->dwFlags |= DDSD_PIXELFORMAT;
lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
return SetPixFmt(lpddsd);
break;
default: default:
break; break;
} }
@ -1999,7 +2014,9 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0); res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0);
if(res==DDERR_PRIMARYSURFACEALREADYEXISTS){ if(res==DDERR_PRIMARYSURFACEALREADYEXISTS){
OutTraceD("CreateSurface: ASSERT DDSEmu_Prim already exists\n"); OutTraceD("CreateSurface: ASSERT DDSEmu_Prim already exists\n");
res=(*pGetGDISurface)(lpdd, &lpDDSEmu_Prim); res=(*pGetGDISurface)(lpdd, &lpDDSEmu_Prim); // ok only if the oprevious surface has the good properties!!!
//while((*pReleaseS)(lpDDSEmu_Prim));
//res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0);
} }
if(res){ if(res){
OutTraceE("CreateSurface: CreateSurface ERROR on DDSEmu_Prim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); OutTraceE("CreateSurface: CreateSurface ERROR on DDSEmu_Prim res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);

View File

@ -57,11 +57,11 @@ static char *Flag3Names[32]={
"FORCEHOOKOPENGL", "MARKBLIT", "HOOKDLLS", "SUPPRESSD3DEXT", "FORCEHOOKOPENGL", "MARKBLIT", "HOOKDLLS", "SUPPRESSD3DEXT",
"HOOKENABLED", "FIXD3DFRAME", "FORCE16BPP", "BLACKWHITE", "HOOKENABLED", "FIXD3DFRAME", "FORCE16BPP", "BLACKWHITE",
"SAVECAPS", "SINGLEPROCAFFINITY", "EMULATEREGISTRY", "CDROMDRIVETYPE", "SAVECAPS", "SINGLEPROCAFFINITY", "EMULATEREGISTRY", "CDROMDRIVETYPE",
"NOWINDOWMOVE", "Flag3:14", "Flag3:15", "Flag3:16", "NOWINDOWMOVE", "DISABLEHAL", "LOCKSYSCOLORS", "EMULATEDC",
"", "", "", "", "Flags3:17", "Flags3:18", "Flags3:19", "Flags3:20",
"", "", "", "", "Flags3:21", "Flags3:22", "Flags3:23", "Flags3:24",
"", "", "", "", "Flags3:25", "Flags3:26", "Flags3:27", "Flags3:28",
"", "", "", "", "Flags3:29", "Flags3:30", "Flags3:31", "Flags3:32",
}; };
static char *Flag4Names[32]={ static char *Flag4Names[32]={
@ -937,10 +937,11 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
} }
break; break;
case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGING:
dxwFixWindowPos("WindowProc", hwnd, lparam);
break;
case WM_WINDOWPOSCHANGED: case WM_WINDOWPOSCHANGED:
LPWINDOWPOS wp;
wp = (LPWINDOWPOS)lparam;
dxwFixWindowPos("WindowProc", hwnd, lparam); dxwFixWindowPos("WindowProc", hwnd, lparam);
OutTraceD("WindowProc: WM_WINDOWPOSCHANGING fixed size=(%d,%d)\n", wp->cx, wp->cy);
break; break;
case WM_ENTERSIZEMOVE: case WM_ENTERSIZEMOVE:
while((*pShowCursor)(1) < 0); while((*pShowCursor)(1) < 0);
@ -1245,7 +1246,7 @@ void HookModule(HMODULE base, int dxversion)
HookOle32(base); HookOle32(base);
HookWinMM(base); HookWinMM(base);
//if(dxw.dwFlags2 & SUPPRESSIME) HookImeLib(module); //if(dxw.dwFlags2 & SUPPRESSIME) HookImeLib(module);
if(dxw.dwFlags2 & HOOKGDI) HookGDI32(base); HookGDI32(base);
if(dxw.dwFlags1 & HOOKDI) HookDirectInput(base, dxversion); if(dxw.dwFlags1 & HOOKDI) HookDirectInput(base, dxversion);
HookDirectDraw(base, dxversion); HookDirectDraw(base, dxversion);
HookDirect3D(base, dxversion); HookDirect3D(base, dxversion);

View File

@ -27,6 +27,7 @@ dxwCore::dxwCore()
//IsWithinDDraw = FALSE; //IsWithinDDraw = FALSE;
IsGDIPalette = FALSE; IsGDIPalette = FALSE;
memset(PrimSurfaces, 0, sizeof(PrimSurfaces)); memset(PrimSurfaces, 0, sizeof(PrimSurfaces));
ResetEmulatedDC();
} }
dxwCore::~dxwCore() dxwCore::~dxwCore()
@ -421,6 +422,28 @@ void dxwCore::MapClient(int *nXDest, int *nYDest)
*nYDest= *nYDest * h / (int)dwScreenHeight; *nYDest= *nYDest * h / (int)dwScreenHeight;
} }
void dxwCore::UnmapClient(LPPOINT lppoint)
{
RECT client;
int w, h;
(*pGetClientRect)(hWnd, &client);
w = client.right ? client.right : iSizX;
h = client.bottom ? client.bottom : iSizY;
lppoint->x = (lppoint->x * (int)dwScreenWidth) / w;
lppoint->y = (lppoint->y * (int)dwScreenHeight) / h;
}
void dxwCore::UnmapClient(int *nXDest, int *nYDest)
{
RECT client;
int w, h;
(*pGetClientRect)(hWnd, &client);
w = client.right ? client.right : iSizX;
h = client.bottom ? client.bottom : iSizY;
*nXDest= *nXDest * (int)dwScreenWidth / w;
*nYDest= *nYDest * (int)dwScreenHeight / h;
}
void dxwCore::MapWindow(LPRECT rect) void dxwCore::MapWindow(LPRECT rect)
{ {
RECT client; RECT client;
@ -837,10 +860,12 @@ void dxwCore::ShowBanner(HWND hwnd)
HDC hClientDC; HDC hClientDC;
HBITMAP g_hbmBall; HBITMAP g_hbmBall;
RECT client; RECT client;
RECT win;
POINT PrevViewPort;
hClientDC=GetDC(hwnd); hClientDC=(*pGDIGetDC)(hwnd);
(*pGetClientRect)(hwnd, &client); (*pGetClientRect)(hwnd, &client);
BitBlt(hClientDC, 0, 0, client.right, client.bottom, NULL, 0, 0, BLACKNESS); (*pGDIBitBlt)(hClientDC, 0, 0, client.right, client.bottom, NULL, 0, 0, BLACKNESS);
if(JustOnce || (dwFlags2 & NOBANNER)) return; if(JustOnce || (dwFlags2 & NOBANNER)) return;
JustOnce=TRUE; JustOnce=TRUE;
@ -849,21 +874,29 @@ void dxwCore::ShowBanner(HWND hwnd)
HDC hdcMem = CreateCompatibleDC(hClientDC); HDC hdcMem = CreateCompatibleDC(hClientDC);
HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmBall); HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmBall);
GetObject(g_hbmBall, sizeof(bm), &bm); GetObject(g_hbmBall, sizeof(bm), &bm);
(*pGetWindowRect)(hwnd, &win);
OutTraceD("ShowBanner: hdc=%x win=(%d,%d)-(%d,%d) banner size=(%dx%d)\n",
hwnd, win.left, win.top, win.right, win.bottom, bm.bmWidth, bm.bmHeight);
//if(!pSetViewportOrgEx) pSetViewportOrgEx=SetViewportOrgEx;
(*pSetViewportOrgEx)(hClientDC, 0, 0, &PrevViewPort);
for (int i=1; i<=16; i++){ for (int i=1; i<=16; i++){
int w, h; int w, h;
w=(bm.bmWidth*i)/8; w=(bm.bmWidth*i)/8;
h=(bm.bmHeight*i)/8; h=(bm.bmHeight*i)/8;
StretchBlt(hClientDC, (client.right-w)/2, (client.bottom-h)/2, w, h, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); (*pGDIStretchBlt)(hClientDC, (client.right-w)/2, (client.bottom-h)/2, w, h, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
Sleep(40); Sleep(40);
} }
for (int i=16; i>=8; i--){ for (int i=16; i>=8; i--){
int w, h; int w, h;
w=(bm.bmWidth*i)/8; w=(bm.bmWidth*i)/8;
h=(bm.bmHeight*i)/8; h=(bm.bmHeight*i)/8;
BitBlt(hClientDC, 0, 0, client.right, client.bottom, NULL, 0, 0, BLACKNESS); (*pGDIBitBlt)(hClientDC, 0, 0, client.right, client.bottom, NULL, 0, 0, BLACKNESS);
StretchBlt(hClientDC, (client.right-w)/2, (client.bottom-h)/2, w, h, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); (*pGDIStretchBlt)(hClientDC, (client.right-w)/2, (client.bottom-h)/2, w, h, hdcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
Sleep(40); Sleep(40);
} }
(*pSetViewportOrgEx)(hClientDC, PrevViewPort.x, PrevViewPort.y, NULL);
SelectObject(hdcMem, hbmOld); SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem); DeleteDC(hdcMem);
Sleep(200); Sleep(200);
@ -956,7 +989,7 @@ void dxwCore::FixStyle(char *ApiName, HWND hwnd, WPARAM wParam, LPARAM lParam)
if (dxw.dwFlags1 & LOCKWINSTYLE){ // set to current value if (dxw.dwFlags1 & LOCKWINSTYLE){ // set to current value
lpSS->styleNew= (*pGetWindowLong)(hwnd, GWL_EXSTYLE); lpSS->styleNew= (*pGetWindowLong)(hwnd, GWL_EXSTYLE);
} }
if (dxw.dwFlags1 & PREVENTMAXIMIZE){ // disable maximize settings if ((dxw.dwFlags1 & PREVENTMAXIMIZE) && (hwnd==hWnd)){ // disable maximize settings
if (lpSS->styleNew & WS_EX_TOPMOST){ if (lpSS->styleNew & WS_EX_TOPMOST){
OutTraceD("%s: prevent EXSTYLE topmost style\n", ApiName); OutTraceD("%s: prevent EXSTYLE topmost style\n", ApiName);
lpSS->styleNew &= ~WS_EX_TOPMOST; lpSS->styleNew &= ~WS_EX_TOPMOST;
@ -967,3 +1000,55 @@ void dxwCore::FixStyle(char *ApiName, HWND hwnd, WPARAM wParam, LPARAM lParam)
break; break;
} }
} }
HDC dxwCore::AcquireEmulatedDC(HWND hwnd)
{
HDC wdc;
if(!(wdc=(*pGDIGetDC)(hwnd)))
OutTraceE("GetDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!VirtualHDC){ // or resolution changed and you must rebuild a new one .... !!!!!
if(!(VirtualHDC=CreateCompatibleDC(wdc)))
OutTraceE("CreateCompatibleDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!VirtualPic){
if(!(VirtualPic=CreateCompatibleBitmap(wdc, dxw.GetScreenWidth(), dxw.GetScreenHeight())))
OutTraceE("CreateCompatibleBitmap: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
}
if(!SelectObject(VirtualHDC, VirtualPic)){
if(!DeleteObject(VirtualPic))
OutTraceE("DeleteObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!(VirtualPic=CreateCompatibleBitmap(wdc, dxw.GetScreenWidth(), dxw.GetScreenHeight())))
OutTraceE("CreateCompatibleBitmap: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!SelectObject(VirtualHDC, VirtualPic))
OutTraceE("SelectObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
}
}
return VirtualHDC;
}
BOOL dxwCore::ReleaseEmulatedDC(HWND hwnd)
{
BOOL ret;
HDC wdc;
RECT client;
(*pGetClientRect)(hwnd, &client);
if(!(wdc=(*pGDIGetDC)(hwnd)))
OutTraceE("GetDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!(*pGDIStretchBlt)(wdc, 0, 0, client.right, client.bottom, VirtualHDC, 0, 0, dxw.GetScreenWidth(), dxw.GetScreenHeight(), SRCCOPY))
OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
(*pInvalidateRect)(hwnd, NULL, 0);
ret=TRUE;
return ret;
}
void dxwCore::ResetEmulatedDC()
{
VirtualHDC=NULL;
VirtualPic=NULL;
VirtualOffsetX=0;
VirtualOffsetY=0;
}
BOOL dxwCore::IsVirtual(HDC hdc)
{
return (hdc==VirtualHDC) && (dwFlags3 & EMULATEDC);
}

View File

@ -36,6 +36,8 @@ public: // methods
void MapClient(LPRECT); void MapClient(LPRECT);
void MapClient(int *, int *, int *, int *); void MapClient(int *, int *, int *, int *);
void MapClient(int *, int *); void MapClient(int *, int *);
void UnmapClient(LPPOINT);
void UnmapClient(int *, int *);
void MapWindow(LPPOINT); void MapWindow(LPPOINT);
void MapWindow(LPRECT); void MapWindow(LPRECT);
void MapWindow(int *, int *, int *, int *); void MapWindow(int *, int *, int *, int *);
@ -67,6 +69,11 @@ public: // methods
POINT ScreenToClient(POINT); POINT ScreenToClient(POINT);
int GetDLLIndex(char *); int GetDLLIndex(char *);
void FixStyle(char *, HWND, WPARAM, LPARAM); void FixStyle(char *, HWND, WPARAM, LPARAM);
HDC AcquireEmulatedDC(HWND);
BOOL ReleaseEmulatedDC(HWND);
BOOL IsVirtual(HDC);
void ResetEmulatedDC();
int VirtualOffsetX, VirtualOffsetY;
public: // simple data variables public: // simple data variables
DDPIXELFORMAT ActualPixelFormat; DDPIXELFORMAT ActualPixelFormat;
@ -109,6 +116,8 @@ protected:
BOOL FullScreen; BOOL FullScreen;
HWND hWnd, hWndFPS; HWND hWnd, hWndFPS;
DWORD PrimSurfaces[DDSQLEN+1]; DWORD PrimSurfaces[DDSQLEN+1];
HDC VirtualHDC;
HBITMAP VirtualPic;
}; };
extern dxwCore dxw; extern dxwCore dxw;

View File

@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "dxwnd.h" #include "dxwnd.h"
#include "dxwcore.hpp" #include "dxwcore.hpp"
#define VERSION "2.02.31" #define VERSION "2.02.32"
#define DDTHREADLOCK 1 #define DDTHREADLOCK 1

Binary file not shown.

View File

@ -5,17 +5,43 @@
#include "dxhook.h" #include "dxhook.h"
#include "dxhelper.h" #include "dxhelper.h"
/*
dlg->m_DCEmulationMode = 0;
if(t->flags2 & HOOKGDI) dlg->m_DCEmulationMode = 1;
if(t->flags3 & EMULATEDC) dlg->m_DCEmulationMode = 2;
if(t->flags & MAPGDITOPRIMARY) dlg->m_DCEmulationMode = 3;
*/
static HookEntry_Type Hooks[]={ static HookEntry_Type Hooks[]={
{"GetDeviceCaps", (FARPROC)GetDeviceCaps, (FARPROC *)&pGDIGetDeviceCaps, (FARPROC)extGetDeviceCaps}, {"GetDeviceCaps", (FARPROC)GetDeviceCaps, (FARPROC *)&pGDIGetDeviceCaps, (FARPROC)extGetDeviceCaps},
{"TextOutA", (FARPROC)TextOutA, (FARPROC *)&pGDITextOutA, (FARPROC)extTextOutA},
{"ScaleWindowExtEx", (FARPROC)ScaleWindowExtEx, (FARPROC *)&pGDIScaleWindowExtEx, (FARPROC)extScaleWindowExtEx}, {"ScaleWindowExtEx", (FARPROC)ScaleWindowExtEx, (FARPROC *)&pGDIScaleWindowExtEx, (FARPROC)extScaleWindowExtEx},
{"Rectangle", (FARPROC)Rectangle, (FARPROC *)&pGDIRectangle, (FARPROC)extRectangle},
{"SaveDC", (FARPROC)SaveDC, (FARPROC *)&pGDISaveDC, (FARPROC)extGDISaveDC}, {"SaveDC", (FARPROC)SaveDC, (FARPROC *)&pGDISaveDC, (FARPROC)extGDISaveDC},
{"RestoreDC", (FARPROC)RestoreDC, (FARPROC *)&pGDIRestoreDC, (FARPROC)extGDIRestoreDC}, {"RestoreDC", (FARPROC)RestoreDC, (FARPROC *)&pGDIRestoreDC, (FARPROC)extGDIRestoreDC},
{"CreatePalette", (FARPROC)CreatePalette, (FARPROC *)&pGDICreatePalette, (FARPROC)extGDICreatePalette}, {"CreatePalette", (FARPROC)CreatePalette, (FARPROC *)&pGDICreatePalette, (FARPROC)extGDICreatePalette},
{"SelectPalette", (FARPROC)SelectPalette, (FARPROC *)&pGDISelectPalette, (FARPROC)extSelectPalette}, {"SelectPalette", (FARPROC)SelectPalette, (FARPROC *)&pGDISelectPalette, (FARPROC)extSelectPalette},
{"RealizePalette", (FARPROC)RealizePalette, (FARPROC *)&pGDIRealizePalette, (FARPROC)extRealizePalette}, {"RealizePalette", (FARPROC)RealizePalette, (FARPROC *)&pGDIRealizePalette, (FARPROC)extRealizePalette},
{"GetSystemPaletteEntries", (FARPROC)GetSystemPaletteEntries, (FARPROC *)&pGDIGetSystemPaletteEntries, (FARPROC)extGetSystemPaletteEntries}, {"GetSystemPaletteEntries", (FARPROC)GetSystemPaletteEntries, (FARPROC *)&pGDIGetSystemPaletteEntries, (FARPROC)extGetSystemPaletteEntries},
{"StretchDIBits", (FARPROC)StretchDIBits, (FARPROC *)&pStretchDIBits, (FARPROC)extStretchDIBits},
//{"SetDIBitsToDevice", (FARPROC)NULL, (FARPROC *)&pSetDIBitsToDevice, (FARPROC)extSetDIBitsToDevice},
//{"CreateCompatibleBitmap", (FARPROC)NULL, (FARPROC *)&pCreateCompatibleBitmap, (FARPROC)extCreateCompatibleBitmap},
{0, NULL, 0, 0} // terminator
};
static HookEntry_Type RemapHooks[]={
{"SetViewportOrgEx", (FARPROC)SetViewportOrgEx, (FARPROC *)&pSetViewportOrgEx, (FARPROC)extSetViewportOrgEx}, // needed in ShowBanner
{"SetViewportExtEx", (FARPROC)NULL, (FARPROC *)&pSetViewportExtEx, (FARPROC)extSetViewportExtEx},
{"GetViewportOrgEx", (FARPROC)NULL, (FARPROC *)&pGetViewportOrgEx, (FARPROC)extGetViewportOrgEx},
{"GetWindowOrgEx", (FARPROC)NULL, (FARPROC *)&pGetWindowOrgEx, (FARPROC)extGetWindowOrgEx},
{"SetWindowOrgEx", (FARPROC)NULL, (FARPROC *)&pSetWindowOrgEx, (FARPROC)extSetWindowOrgEx},
{"GetCurrentPositionEx", (FARPROC)NULL, (FARPROC *)&pGetCurrentPositionEx, (FARPROC)extGetCurrentPositionEx},
{"StretchDIBits", (FARPROC)StretchDIBits, (FARPROC *)&pStretchDIBits, (FARPROC)extStretchDIBits}, // unuseful
{"SetDIBitsToDevice", (FARPROC)NULL, (FARPROC *)&pSetDIBitsToDevice, (FARPROC)extSetDIBitsToDevice}, // does the stretching
{0, NULL, 0, 0} // terminator
};
static HookEntry_Type ScaledHooks[]={
{"Rectangle", (FARPROC)Rectangle, (FARPROC *)&pGDIRectangle, (FARPROC)extRectangle},
{"TextOutA", (FARPROC)TextOutA, (FARPROC *)&pGDITextOutA, (FARPROC)extTextOutA},
{"GetClipBox", (FARPROC)NULL, (FARPROC *)&pGDIGetClipBox, (FARPROC)extGetClipBox}, {"GetClipBox", (FARPROC)NULL, (FARPROC *)&pGDIGetClipBox, (FARPROC)extGetClipBox},
{"Polyline", (FARPROC)NULL, (FARPROC *)&pPolyline, (FARPROC)extPolyline}, {"Polyline", (FARPROC)NULL, (FARPROC *)&pPolyline, (FARPROC)extPolyline},
{"PolyBezierTo", (FARPROC)NULL, (FARPROC *)&pPolyBezierTo, (FARPROC)extPolyBezierTo}, {"PolyBezierTo", (FARPROC)NULL, (FARPROC *)&pPolyBezierTo, (FARPROC)extPolyBezierTo},
@ -24,9 +50,6 @@ static HookEntry_Type Hooks[]={
{"MoveToEx", (FARPROC)NULL, (FARPROC *)&pMoveToEx, (FARPROC)extMoveToEx}, {"MoveToEx", (FARPROC)NULL, (FARPROC *)&pMoveToEx, (FARPROC)extMoveToEx},
{"ArcTo", (FARPROC)NULL, (FARPROC *)&pArcTo, (FARPROC)extArcTo}, {"ArcTo", (FARPROC)NULL, (FARPROC *)&pArcTo, (FARPROC)extArcTo},
{"LineTo", (FARPROC)NULL, (FARPROC *)&pLineTo, (FARPROC)extLineTo}, {"LineTo", (FARPROC)NULL, (FARPROC *)&pLineTo, (FARPROC)extLineTo},
{"StretchDIBits", (FARPROC)StretchDIBits, (FARPROC *)&pStretchDIBits, (FARPROC)extStretchDIBits},
{"SetDIBitsToDevice", (FARPROC)NULL, (FARPROC *)&pSetDIBitsToDevice, (FARPROC)extSetDIBitsToDevice},
//{"CreateCompatibleBitmap", (FARPROC)NULL, (FARPROC *)&pCreateCompatibleBitmap, (FARPROC)extCreateCompatibleBitmap},
{"SetPixel", (FARPROC)NULL, (FARPROC *)&pSetPixel, (FARPROC)extSetPixel}, {"SetPixel", (FARPROC)NULL, (FARPROC *)&pSetPixel, (FARPROC)extSetPixel},
{"Ellipse", (FARPROC)NULL, (FARPROC *)&pEllipse, (FARPROC)extEllipse}, {"Ellipse", (FARPROC)NULL, (FARPROC *)&pEllipse, (FARPROC)extEllipse},
{"Polygon", (FARPROC)NULL, (FARPROC *)&pPolygon, (FARPROC)extPolygon}, {"Polygon", (FARPROC)NULL, (FARPROC *)&pPolygon, (FARPROC)extPolygon},
@ -38,7 +61,10 @@ static HookEntry_Type Hooks[]={
{"CreatePolygonRgn", (FARPROC)NULL, (FARPROC *)&pCreatePolygonRgn, (FARPROC)extCreatePolygonRgn}, {"CreatePolygonRgn", (FARPROC)NULL, (FARPROC *)&pCreatePolygonRgn, (FARPROC)extCreatePolygonRgn},
{"DrawTextA", (FARPROC)NULL, (FARPROC *)&pDrawText, (FARPROC)extDrawText}, {"DrawTextA", (FARPROC)NULL, (FARPROC *)&pDrawText, (FARPROC)extDrawText},
{"DrawTextExA", (FARPROC)NULL, (FARPROC *)&pDrawTextEx, (FARPROC)extDrawTextEx}, {"DrawTextExA", (FARPROC)NULL, (FARPROC *)&pDrawTextEx, (FARPROC)extDrawTextEx},
{"MaskBlt", (FARPROC)NULL, (FARPROC *)&pMaskBlt, (FARPROC)extMaskBlt}, {0, NULL, 0, 0} // terminator
};
static HookEntry_Type EmulateHooks[]={
{0, NULL, 0, 0} // terminator {0, NULL, 0, 0} // terminator
}; };
@ -49,6 +75,7 @@ static HookEntry_Type DDHooks[]={
{"BitBlt", (FARPROC)BitBlt, (FARPROC *)&pGDIBitBlt, (FARPROC)extDDBitBlt}, {"BitBlt", (FARPROC)BitBlt, (FARPROC *)&pGDIBitBlt, (FARPROC)extDDBitBlt},
{"StretchBlt", (FARPROC)StretchBlt, (FARPROC *)&pGDIStretchBlt, (FARPROC)extDDStretchBlt}, {"StretchBlt", (FARPROC)StretchBlt, (FARPROC *)&pGDIStretchBlt, (FARPROC)extDDStretchBlt},
// {"PatBlt", (FARPROC)PatBlt, (FARPROC *)&pGDIPatBlt, (FARPROC)extDDPatBlt}, // missing one ... // {"PatBlt", (FARPROC)PatBlt, (FARPROC *)&pGDIPatBlt, (FARPROC)extDDPatBlt}, // missing one ...
// {"MaskBlt", (FARPROC)NULL, (FARPROC *)&pMaskBlt, (FARPROC)extMaskBlt},
{0, NULL, 0, 0} // terminator {0, NULL, 0, 0} // terminator
}; };
@ -59,12 +86,11 @@ static HookEntry_Type GDIHooks[]={
{"BitBlt", (FARPROC)BitBlt, (FARPROC *)&pGDIBitBlt, (FARPROC)extGDIBitBlt}, {"BitBlt", (FARPROC)BitBlt, (FARPROC *)&pGDIBitBlt, (FARPROC)extGDIBitBlt},
{"StretchBlt", (FARPROC)StretchBlt, (FARPROC *)&pGDIStretchBlt, (FARPROC)extGDIStretchBlt}, {"StretchBlt", (FARPROC)StretchBlt, (FARPROC *)&pGDIStretchBlt, (FARPROC)extGDIStretchBlt},
{"PatBlt", (FARPROC)PatBlt, (FARPROC *)&pGDIPatBlt, (FARPROC)extGDIPatBlt}, {"PatBlt", (FARPROC)PatBlt, (FARPROC *)&pGDIPatBlt, (FARPROC)extGDIPatBlt},
{"MaskBlt", (FARPROC)NULL, (FARPROC *)&pMaskBlt, (FARPROC)extMaskBlt},
{0, NULL, 0, 0} // terminator {0, NULL, 0, 0} // terminator
}; };
static HookEntry_Type EmuHooks[]={ static HookEntry_Type EmuHooks[]={
//{"SetTextColor", (FARPROC)SetTextColor, (FARPROC *)&pGDISetTextColor, (FARPROC)extSetTextColor},
//{"SetBkColor", (FARPROC)SetBkColor, (FARPROC *)&pGDISetBkColor, (FARPROC)extSetBkColor},
{"CreateFontA", (FARPROC)CreateFont, (FARPROC *)&pGDICreateFont, (FARPROC)extCreateFont}, {"CreateFontA", (FARPROC)CreateFont, (FARPROC *)&pGDICreateFont, (FARPROC)extCreateFont},
{"CreateFontIndirectA", (FARPROC)CreateFontIndirectA, (FARPROC *)&pGDICreateFontIndirect, (FARPROC)extCreateFontIndirect}, {"CreateFontIndirectA", (FARPROC)CreateFontIndirectA, (FARPROC *)&pGDICreateFontIndirect, (FARPROC)extCreateFontIndirect},
{0, NULL, 0, 0} // terminator {0, NULL, 0, 0} // terminator
@ -81,39 +107,79 @@ extern HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFI
static char *libname = "gdi32.dll"; static char *libname = "gdi32.dll";
void HookGDI32(HMODULE module)
{
HookLibrary(module, Hooks, libname);
if(dxw.dwFlags1 & MAPGDITOPRIMARY)
HookLibrary(module, DDHooks, libname);
else
HookLibrary(module, GDIHooks, libname);
if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC))
HookLibrary(module, EmuHooks, libname);
if(dxw.dwFlags2 & DISABLEGAMMARAMP)
HookLibrary(module, GammaHooks, libname);
}
void HookGDI32Init() void HookGDI32Init()
{ {
HookLibInit(Hooks); HookLibInit(Hooks);
HookLibInit(RemapHooks);
HookLibInit(DDHooks); HookLibInit(DDHooks);
HookLibInit(EmuHooks); HookLibInit(EmuHooks);
HookLibInit(GammaHooks); HookLibInit(GammaHooks);
} }
void HookGDI32(HMODULE module)
{
HookLibrary(module, Hooks, libname);
if(dxw.dwFlags1 & CLIENTREMAPPING)
HookLibrary(module, RemapHooks, libname);
if(dxw.dwFlags3 & EMULATEDC)
HookLibrary(module, EmulateHooks, libname);
HookLibrary(module, ScaledHooks, libname);
HookLibrary(module, GDIHooks, libname);
if(dxw.dwFlags2 & HOOKGDI){
HookLibrary(module, EmulateHooks, libname);
HookLibrary(module, ScaledHooks, libname);
HookLibrary(module, GDIHooks, libname);
}
if(dxw.dwFlags1 & MAPGDITOPRIMARY){
HookLibrary(module, EmulateHooks, libname);
HookLibrary(module, ScaledHooks, libname);
HookLibrary(module, DDHooks, libname);
}
if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC))
HookLibrary(module, EmuHooks, libname);
if(dxw.dwFlags2 & DISABLEGAMMARAMP)
HookLibrary(module, GammaHooks, libname);
}
FARPROC Remap_GDI32_ProcAddress(LPCSTR proc, HMODULE hModule) FARPROC Remap_GDI32_ProcAddress(LPCSTR proc, HMODULE hModule)
{ {
FARPROC addr; FARPROC addr;
if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
if(dxw.dwFlags1 & MAPGDITOPRIMARY) if(addr=RemapLibrary(proc, hModule, Hooks)) return addr;
if(addr=RemapLibrary(proc, hModule, DDHooks)) return addr;
else if(dxw.dwFlags1 & CLIENTREMAPPING)
if(addr=RemapLibrary(proc, hModule, GDIHooks)) return addr; if(addr=RemapLibrary(proc, hModule, RemapHooks)) return addr;
if(dxw.dwFlags3 & EMULATEDC){
if (addr=RemapLibrary(proc, hModule, EmulateHooks)) return addr;
if (addr=RemapLibrary(proc, hModule, ScaledHooks)) return addr;
if (addr=RemapLibrary(proc, hModule, GDIHooks)) return addr;
}
if(dxw.dwFlags2 & HOOKGDI){
if (addr=RemapLibrary(proc, hModule, EmulateHooks)) return addr;
if (addr=RemapLibrary(proc, hModule, ScaledHooks)) return addr;
if (addr=RemapLibrary(proc, hModule, GDIHooks)) return addr;
}
if(dxw.dwFlags1 & MAPGDITOPRIMARY){
if (addr=RemapLibrary(proc, hModule, EmulateHooks)) return addr;
if (addr=RemapLibrary(proc, hModule, ScaledHooks)) return addr;
if (addr=RemapLibrary(proc, hModule, DDHooks)) return addr;
}
if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC)) if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC))
if(addr=RemapLibrary(proc, hModule, EmuHooks)) return addr; if(addr=RemapLibrary(proc, hModule, EmuHooks)) return addr;
if(dxw.dwFlags2 & DISABLEGAMMARAMP) if(dxw.dwFlags2 & DISABLEGAMMARAMP)
if(addr=RemapLibrary(proc, hModule, GammaHooks)) return addr; if(addr=RemapLibrary(proc, hModule, GammaHooks)) return addr;
return NULL; return NULL;
} }
@ -221,21 +287,35 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
OutTraceD("GetDeviceCaps: hdc=%x index=%x(%s) res=%x\n", OutTraceD("GetDeviceCaps: hdc=%x index=%x(%s) res=%x\n",
hdc, nindex, ExplainDeviceCaps(nindex), res); hdc, nindex, ExplainDeviceCaps(nindex), res);
#ifdef GDIEMULATIONONLY
switch(nindex){
case VERTRES:
res= dxw.GetScreenHeight();
OutTraceD("GetDeviceCaps: fix(0) VERTRES cap=%d\n", res);
break;
case HORZRES:
res= dxw.GetScreenWidth();
OutTraceD("GetDeviceCaps: fix(0) HORZRES cap=%d\n", res);
break;
}
return res;
#endif
// if you have a bypassed setting, use it first! // if you have a bypassed setting, use it first!
if(pSetDevMode){ if(pSetDevMode){
switch(nindex){ switch(nindex){
case BITSPIXEL: case BITSPIXEL:
case COLORRES: case COLORRES:
res = pSetDevMode->dmBitsPerPel; res = pSetDevMode->dmBitsPerPel;
OutTraceD("GetDeviceCaps: fix BITSPIXEL/COLORRES cap=%x\n",res); OutTraceD("GetDeviceCaps: fix(1) BITSPIXEL/COLORRES cap=%x\n",res);
return res; return res;
case HORZRES: case HORZRES:
res = pSetDevMode->dmPelsWidth; res = pSetDevMode->dmPelsWidth;
OutTraceD("GetDeviceCaps: fix HORZRES cap=%d\n", res); OutTraceD("GetDeviceCaps: fix(1) HORZRES cap=%d\n", res);
return res; return res;
case VERTRES: case VERTRES:
res = pSetDevMode->dmPelsHeight; res = pSetDevMode->dmPelsHeight;
OutTraceD("GetDeviceCaps: fix VERTRES cap=%d\n", res); OutTraceD("GetDeviceCaps: fix(1) VERTRES cap=%d\n", res);
return res; return res;
} }
} }
@ -243,26 +323,26 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
switch(nindex){ switch(nindex){
case VERTRES: case VERTRES:
res= dxw.GetScreenHeight(); res= dxw.GetScreenHeight();
OutTraceD("GetDeviceCaps: fix VERTRES cap=%d\n", res); OutTraceD("GetDeviceCaps: fix(2) VERTRES cap=%d\n", res);
break; break;
case HORZRES: case HORZRES:
res= dxw.GetScreenWidth(); res= dxw.GetScreenWidth();
OutTraceD("GetDeviceCaps: fix HORZRES cap=%d\n", res); OutTraceD("GetDeviceCaps: fix(2) HORZRES cap=%d\n", res);
break; break;
// WARNING: in no-emu mode, the INIT8BPP and INIT16BPP flags expose capabilities that // WARNING: in no-emu mode, the INIT8BPP and INIT16BPP flags expose capabilities that
// are NOT implemented and may cause later troubles! // are NOT implemented and may cause later troubles!
case RASTERCAPS: case RASTERCAPS:
if(dxw.dwFlags2 & INIT8BPP) { if(dxw.dwFlags2 & INIT8BPP) {
res |= RC_PALETTE; // v2.02.12 res |= RC_PALETTE; // v2.02.12
OutTraceD("GetDeviceCaps: fix RASTERCAPS setting RC_PALETTE cap=%x\n",res); OutTraceD("GetDeviceCaps: fix(2) RASTERCAPS setting RC_PALETTE cap=%x\n",res);
} }
break; break;
case BITSPIXEL: case BITSPIXEL:
case COLORRES: case COLORRES:
if(dxw.dwFlags2 & INIT8BPP|INIT16BPP){ if(dxw.dwFlags2 & (INIT8BPP|INIT16BPP)){ // v2.02.32 fix
if(dxw.dwFlags2 & INIT8BPP) res = 8; if(dxw.dwFlags2 & INIT8BPP) res = 8;
if(dxw.dwFlags2 & INIT16BPP) res = 16; if(dxw.dwFlags2 & INIT16BPP) res = 16;
OutTraceD("GetDeviceCaps: fix BITSPIXEL/COLORRES cap=%d\n",res); OutTraceD("GetDeviceCaps: fix(2) BITSPIXEL/COLORRES cap=%d\n",res);
} }
break; break;
} }
@ -272,7 +352,7 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
case RASTERCAPS: case RASTERCAPS:
if((dxw.VirtualPixelFormat.dwRGBBitCount==8) || (dxw.dwFlags2 & INIT8BPP)){ if((dxw.VirtualPixelFormat.dwRGBBitCount==8) || (dxw.dwFlags2 & INIT8BPP)){
res = RC_PALETTE; res = RC_PALETTE;
OutTraceD("GetDeviceCaps: fix RASTERCAPS setting RC_PALETTE cap=%x\n",res); OutTraceD("GetDeviceCaps: fix(3) RASTERCAPS setting RC_PALETTE cap=%x\n",res);
} }
break; break;
case BITSPIXEL: case BITSPIXEL:
@ -282,15 +362,15 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
if(dxw.VirtualPixelFormat.dwRGBBitCount!=0) res = dxw.VirtualPixelFormat.dwRGBBitCount; if(dxw.VirtualPixelFormat.dwRGBBitCount!=0) res = dxw.VirtualPixelFormat.dwRGBBitCount;
if(dxw.dwFlags2 & INIT8BPP) res = 8; if(dxw.dwFlags2 & INIT8BPP) res = 8;
if(dxw.dwFlags2 & INIT16BPP) res = 16; if(dxw.dwFlags2 & INIT16BPP) res = 16;
if(PrevRes != res) OutTraceD("GetDeviceCaps: fix BITSPIXEL/COLORRES cap=%d\n",res); if(PrevRes != res) OutTraceD("GetDeviceCaps: fix(3) BITSPIXEL/COLORRES cap=%d\n",res);
break; break;
case SIZEPALETTE: case SIZEPALETTE:
res = 256; res = 256;
OutTraceD("GetDeviceCaps: fix SIZEPALETTE cap=%x\n",res); OutTraceD("GetDeviceCaps: fix(3) SIZEPALETTE cap=%x\n",res);
break; break;
case NUMRESERVED: case NUMRESERVED:
res = 0; res = 0;
OutTraceD("GetDeviceCaps: fix NUMRESERVED cap=%x\n",res); OutTraceD("GetDeviceCaps: fix(3) NUMRESERVED cap=%x\n",res);
break; break;
} }
} }
@ -317,7 +397,7 @@ BOOL WINAPI extScaleWindowExtEx(HDC hdc, int Xnum, int Xdenom, int Ynum, int Yde
OutTraceD("ScaleWindowExtEx: hdc=%x num=(%d,%d) denom=(%d,%d) lpSize=%d\n", OutTraceD("ScaleWindowExtEx: hdc=%x num=(%d,%d) denom=(%d,%d) lpSize=%d\n",
hdc, Xnum, Ynum, Xdenom, Ydenom, lpSize); hdc, Xnum, Ynum, Xdenom, Ydenom, lpSize);
if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()) return 1; MessageBox(0, "ScaleWindowExtEx", "to fix", MB_OK | MB_ICONEXCLAMATION);
return (*pGDIScaleWindowExtEx)(hdc, Xnum, Xdenom, Ynum, Ydenom, lpSize); return (*pGDIScaleWindowExtEx)(hdc, Xnum, Xdenom, Ynum, Ydenom, lpSize);
} }
@ -703,8 +783,6 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
// the screen surface later on, on ReleaseDC or ddraw Blit / Flip operation. Scaling of rect coordinates is // the screen surface later on, on ReleaseDC or ddraw Blit / Flip operation. Scaling of rect coordinates is
// needed only in the first case, and must be avoided on the second, otherwise the image would be scaled twice! // needed only in the first case, and must be avoided on the second, otherwise the image would be scaled twice!
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){ if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){
int nWDest, nHDest; int nWDest, nHDest;
nWDest= nWidth; nWDest= nWidth;
@ -900,6 +978,8 @@ int WINAPI extGetClipBox(HDC hdc, LPRECT lprc)
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc)) && (ret!=ERROR)){ if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc)) && (ret!=ERROR)){
OutTraceD("GetClipBox: scaling main win coordinates (%d,%d)-(%d,%d)\n", OutTraceD("GetClipBox: scaling main win coordinates (%d,%d)-(%d,%d)\n",
lprc->left, lprc->top, lprc->right, lprc->bottom); lprc->left, lprc->top, lprc->right, lprc->bottom);
// current implementation is NOT accurate, since it always returns the whole
// virtual desktop area as the current clipbox...!!!
*lprc=dxw.GetScreenRect(); *lprc=dxw.GetScreenRect();
} }
OutTraceD("GetClipBox: ret=%x(%s)\n", ret, sRetCodes[ret]); OutTraceD("GetClipBox: ret=%x(%s)\n", ret, sRetCodes[ret]);
@ -1047,9 +1127,16 @@ int WINAPI extStretchDIBits(HDC hdc, int XDest, int YDest, int nDestWidth, int n
OutTraceD("StretchDIBits: hdc=%x dest=(%d,%d)-(%d,%d) src=(%d,%d)-(%d,%d) rop=%x(%s)\n", OutTraceD("StretchDIBits: hdc=%x dest=(%d,%d)-(%d,%d) src=(%d,%d)-(%d,%d) rop=%x(%s)\n",
hdc, XDest, YDest, nDestWidth, nDestHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, dwRop, ExplainROP(dwRop)); hdc, XDest, YDest, nDestWidth, nDestHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, dwRop, ExplainROP(dwRop));
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ if (dxw.IsFullScreen()){
dxw.MapClient(&XDest, &YDest, &nDestWidth, &nDestHeight); if(dxw.IsVirtual(hdc)){
OutTraceD("StretchDIBits: fixed dest=(%d,%d)-(%d,%d)\n", XDest, YDest, nDestWidth, nDestHeight); XDest+=dxw.VirtualOffsetX;
YDest+=dxw.VirtualOffsetY;
OutTraceD("StretchDIBits: fixed dest=(%d,%d)-(%d,%d)\n", XDest, YDest, nDestWidth, nDestHeight);
}
else if (OBJ_DC == GetObjectType(hdc)){
dxw.MapClient(&XDest, &YDest, &nDestWidth, &nDestHeight);
OutTraceD("StretchDIBits: fixed dest=(%d,%d)-(%d,%d)\n", XDest, YDest, nDestWidth, nDestHeight);
}
} }
ret=(*pStretchDIBits)(hdc, XDest, YDest, nDestWidth, nDestHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, lpBits, lpBitsInfo, iUsage, dwRop); ret=(*pStretchDIBits)(hdc, XDest, YDest, nDestWidth, nDestHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, lpBits, lpBitsInfo, iUsage, dwRop);
@ -1068,6 +1155,17 @@ int WINAPI extSetDIBitsToDevice(HDC hdc, int XDest, int YDest, DWORD dwWidth, DW
OutTraceD("SetDIBitsToDevice: BitmapInfo dim=(%dx%d) Planes=%d BPP=%d Compression=%x SizeImage=%x\n", OutTraceD("SetDIBitsToDevice: BitmapInfo dim=(%dx%d) Planes=%d BPP=%d Compression=%x SizeImage=%x\n",
bmi->biWidth, bmi->biHeight, bmi->biPlanes, bmi->biBitCount, bmi->biCompression, bmi->biSizeImage); bmi->biWidth, bmi->biHeight, bmi->biPlanes, bmi->biBitCount, bmi->biCompression, bmi->biSizeImage);
if (dxw.IsFullScreen() && dxw.IsVirtual(hdc)){
int X, Y;
X=XDest+dxw.VirtualOffsetX;
Y=YDest+dxw.VirtualOffsetY;
OutTraceD("SetDIBitsToDevice: virtual pos=(%d,%d)+(%d+%d)=(%d,%d)\n",
XDest, YDest, dxw.VirtualOffsetX, dxw.VirtualOffsetY, X, Y);
ret=(*pSetDIBitsToDevice)(hdc, X, Y, dwWidth, dwHeight, XSrc, YSrc, uStartScan, cScanLines, lpvBits, lpbmi, fuColorUse);
if(!ret || (ret==GDI_ERROR)) OutTraceE("SetDIBitsToDevice: ERROR ret=%x err=%d\n", ret, GetLastError());
return ret;
}
//else
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
DWORD OrigWidth, OrigHeight; DWORD OrigWidth, OrigHeight;
int OrigXDest, OrigYDest; int OrigXDest, OrigYDest;
@ -1092,7 +1190,10 @@ int WINAPI extSetDIBitsToDevice(HDC hdc, int XDest, int YDest, DWORD dwWidth, DW
OutTraceE("SetDIBitsToDevice: ERROR err=%d at=%d\n", GetLastError(), __LINE__); OutTraceE("SetDIBitsToDevice: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!(ret=(*pGDIStretchBlt)(hdc, XDest, YDest, dwWidth, dwHeight, hTempDc, 0, 0, OrigWidth, OrigHeight, SRCCOPY))) if(!(ret=(*pGDIStretchBlt)(hdc, XDest, YDest, dwWidth, dwHeight, hTempDc, 0, 0, OrigWidth, OrigHeight, SRCCOPY)))
OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__); OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
DeleteDC(hTempDc); if(!(DeleteObject(hbmPic))) // v2.02.32 - avoid resource leakage
OutTraceE("DeleteObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
if(!(DeleteDC(hTempDc)))
OutTraceE("DeleteDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
} }
else{ else{
ret=(*pSetDIBitsToDevice)(hdc, XDest, YDest, dwWidth, dwHeight, XSrc, YSrc, uStartScan, cScanLines, lpvBits, lpbmi, fuColorUse); ret=(*pSetDIBitsToDevice)(hdc, XDest, YDest, dwWidth, dwHeight, XSrc, YSrc, uStartScan, cScanLines, lpvBits, lpbmi, fuColorUse);
@ -1321,6 +1422,139 @@ BOOL WINAPI extMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHei
return ret; return ret;
} }
BOOL WINAPI extSetViewportOrgEx(HDC hdc, int X, int Y, LPPOINT lpPoint)
{
BOOL ret;
OutTraceD("SetViewportOrgEx: hdc=%x pos=(%d,%d)\n", hdc, X, Y);
if(dxw.IsVirtual(hdc)) {
OutTraceD("SetViewportOrgEx: virtual hdc\n");
dxw.VirtualOffsetX = X;
dxw.VirtualOffsetY = Y;
return TRUE;
}
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
dxw.MapClient(&X, &Y);
OutTraceD("SetViewportOrgEx: fixed pos=(%d,%d)\n", X, Y);
}
ret=(*pSetViewportOrgEx)(hdc, X, Y, lpPoint);
if(ret && lpPoint) {
OutTraceD("SetViewportOrgEx: previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y);
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
dxw.UnmapClient(lpPoint);
OutTraceD("SetViewportOrgEx: fixed previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y);
}
}
if(!ret) OutTraceE("SetViewportOrgEx: ERROR ret=%x err=%d\n", ret, GetLastError());
return ret;
}
BOOL WINAPI extSetViewportExtEx(HDC hdc, int nXExtent, int nYExtent, LPSIZE lpSize)
{
BOOL ret;
OutTraceD("SetViewportExtEx: hdc=%x ext=(%d,%d)\n", hdc, nXExtent, nYExtent);
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
dxw.MapClient(&nXExtent, &nYExtent);
OutTraceD("SetViewportExtEx: fixed ext=(%d,%d)\n", nXExtent, nYExtent);
}
ret=(*pSetViewportExtEx)(hdc, nXExtent, nYExtent, lpSize);
if(ret && lpSize) {
OutTraceD("SetViewportExtEx: previous ext=(%d,%d)\n", lpSize->cx, lpSize->cy);
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
dxw.UnmapClient((LPPOINT)lpSize);
OutTraceD("SetViewportExtEx: fixed previous ext=(%d,%d)\n", lpSize->cx, lpSize->cy);
}
}
if(!ret) OutTraceE("SetViewportExtEx: ERROR ret=%x err=%d\n", ret, GetLastError());
return ret;
}
BOOL WINAPI extGetViewportOrgEx(HDC hdc, LPPOINT lpPoint)
{
BOOL ret;
OutTraceD("GetViewportOrgEx: hdc=%x\n", hdc);
if(dxw.IsVirtual(hdc)) {
lpPoint->x = dxw.VirtualOffsetX;
lpPoint->y = dxw.VirtualOffsetY;
return TRUE;
}
ret=(*pGetViewportOrgEx)(hdc, lpPoint);
if(ret) {
OutTraceD("GetViewportOrgEx: ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y);
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
dxw.UnmapClient(lpPoint);
OutTraceD("GetViewportOrgEx: fixed ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y);
}
}
if(!ret) OutTraceE("GetViewportOrgEx: ERROR ret=%x err=%d\n", ret, GetLastError());
return ret;
}
BOOL WINAPI extGetWindowOrgEx(HDC hdc, LPPOINT lpPoint)
{
BOOL ret;
OutTraceD("GetWindowOrgEx: hdc=%x\n", hdc);
ret=(*pGetWindowOrgEx)(hdc, lpPoint);
if(ret) {
OutTraceD("GetWindowOrgEx: ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y);
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
dxw.UnmapClient(lpPoint);
OutTraceD("GetWindowOrgEx: fixed ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y);
}
}
if(!ret) OutTraceE("GetWindowOrgEx: ERROR ret=%x err=%d\n", ret, GetLastError());
return ret;
}
BOOL WINAPI extSetWindowOrgEx(HDC hdc, int X, int Y, LPPOINT lpPoint)
{
BOOL ret;
OutTraceD("SetWindowOrgEx: hdc=%x pos=(%d,%d)\n", hdc, X, Y);
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
dxw.MapClient(&X, &Y);
OutTraceD("SetWindowOrgEx: fixed pos=(%d,%d)\n", X, Y);
}
ret=(*pSetWindowOrgEx)(hdc, X, Y, lpPoint);
if(ret && lpPoint) {
OutTraceD("SetWindowOrgEx: previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y);
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
dxw.UnmapClient(lpPoint);
OutTraceD("SetWindowOrgEx: fixed previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y);
}
}
if(!ret) OutTraceE("SetWindowOrgEx: ERROR ret=%x err=%d\n", ret, GetLastError());
return ret;
}
BOOL WINAPI extGetCurrentPositionEx(HDC hdc, LPPOINT lpPoint)
{
BOOL ret;
OutTraceD("GetCurrentPositionEx: hdc=%x\n", hdc);
ret=(*pGetCurrentPositionEx)(hdc, lpPoint);
if(ret) {
OutTraceD("GetCurrentPositionEx: pos=(%d,%d)\n", lpPoint->x, lpPoint->y);
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
dxw.UnmapClient(lpPoint);
OutTraceD("GetCurrentPositionEx: fixed pos=(%d,%d)\n", lpPoint->x, lpPoint->y);
}
}
if(!ret) OutTraceE("GetCurrentPositionEx: ERROR ret=%x err=%d\n", ret, GetLastError());
return ret;
}
#if 0 #if 0
// to map: // to map:
// GetCurrentPositionEx // GetCurrentPositionEx
@ -1332,6 +1566,7 @@ BOOL WINAPI extMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHei
// OffsetWindowOrgEx // OffsetWindowOrgEx
// TransparentBlt // TransparentBlt
// to do: eliminate FIXTEXTOUT handling // to do: eliminate FIXTEXTOUT handling
// GetDCEx
BOOL SetTextJustification( BOOL SetTextJustification(
_In_ HDC hdc, _In_ HDC hdc,

View File

@ -82,6 +82,12 @@ typedef HRGN (WINAPI *CreatePolygonRgn_Type)(const POINT *, int, int);
typedef int (WINAPI *DrawText_Type)(HDC, LPCTSTR, int, LPRECT, UINT); typedef int (WINAPI *DrawText_Type)(HDC, LPCTSTR, int, LPRECT, UINT);
typedef int (WINAPI *DrawTextEx_Type)(HDC, LPTSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS); typedef int (WINAPI *DrawTextEx_Type)(HDC, LPTSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS);
typedef BOOL (WINAPI *MaskBlt_Type)(HDC, int, int, int, int, HDC, int, int, HBITMAP, int, int, DWORD); typedef BOOL (WINAPI *MaskBlt_Type)(HDC, int, int, int, int, HDC, int, int, HBITMAP, int, int, DWORD);
typedef BOOL (WINAPI *SetViewportOrgEx_Type)(HDC, int, int, LPPOINT);
typedef BOOL (WINAPI *SetViewportExtEx_Type)(HDC, int, int, LPSIZE);
typedef BOOL (WINAPI *GetViewportOrgEx_Type)(HDC, LPPOINT);
typedef BOOL (WINAPI *GetWindowOrgEx_Type)(HDC, LPPOINT);
typedef BOOL (WINAPI *SetWindowOrgEx_Type)(HDC, int, int, LPPOINT);
typedef BOOL (WINAPI *GetCurrentPositionEx_Type)(HDC, LPPOINT);
// Kernel32.dll: // Kernel32.dll:
typedef BOOL (WINAPI *GetDiskFreeSpaceA_Type)(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD); typedef BOOL (WINAPI *GetDiskFreeSpaceA_Type)(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD);
@ -151,6 +157,8 @@ typedef BOOL (WINAPI *ShowWindow_Type)(HWND, int);
typedef LONG (WINAPI *TabbedTextOutA_Type)(HDC, int, int, LPCTSTR, int, int, const LPINT, int); typedef LONG (WINAPI *TabbedTextOutA_Type)(HDC, int, int, LPCTSTR, int, int, const LPINT, int);
typedef BOOL (WINAPI *DestroyWindow_Type)(HWND); typedef BOOL (WINAPI *DestroyWindow_Type)(HWND);
typedef BOOL (WINAPI *CloseWindow_Type)(HWND); typedef BOOL (WINAPI *CloseWindow_Type)(HWND);
typedef BOOL (WINAPI *SetSysColors_Type)(int, const INT *, const COLORREF *);
typedef HDC (WINAPI *GetDCEx_Type)(HWND, HRGN, DWORD);
// Winmm.dll: // Winmm.dll:
typedef MCIERROR(WINAPI *mciSendCommand_Type)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR); typedef MCIERROR(WINAPI *mciSendCommand_Type)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR);
@ -239,6 +247,12 @@ DXWEXTERN CreatePolygonRgn_Type pCreatePolygonRgn DXWINITIALIZED;
DXWEXTERN DrawText_Type pDrawText DXWINITIALIZED; DXWEXTERN DrawText_Type pDrawText DXWINITIALIZED;
DXWEXTERN DrawTextEx_Type pDrawTextEx DXWINITIALIZED; DXWEXTERN DrawTextEx_Type pDrawTextEx DXWINITIALIZED;
DXWEXTERN MaskBlt_Type pMaskBlt DXWINITIALIZED; DXWEXTERN MaskBlt_Type pMaskBlt DXWINITIALIZED;
DXWEXTERN SetViewportOrgEx_Type pSetViewportOrgEx DXWINITIALIZED;
DXWEXTERN SetViewportExtEx_Type pSetViewportExtEx DXWINITIALIZED;
DXWEXTERN GetViewportOrgEx_Type pGetViewportOrgEx DXWINITIALIZED;
DXWEXTERN GetWindowOrgEx_Type pGetWindowOrgEx DXWINITIALIZED;
DXWEXTERN SetWindowOrgEx_Type pSetWindowOrgEx DXWINITIALIZED;
DXWEXTERN GetCurrentPositionEx_Type pGetCurrentPositionEx DXWINITIALIZED;
// Kernel32.dll: // Kernel32.dll:
DXWEXTERN GetDiskFreeSpaceA_Type pGetDiskFreeSpaceA DXWINITIALIZED; DXWEXTERN GetDiskFreeSpaceA_Type pGetDiskFreeSpaceA DXWINITIALIZED;
@ -309,6 +323,8 @@ DXWEXTERN ShowWindow_Type pShowWindow DXWINITIALIZED;
DXWEXTERN TabbedTextOutA_Type pTabbedTextOutA DXWINITIALIZED; DXWEXTERN TabbedTextOutA_Type pTabbedTextOutA DXWINITIALIZED;
DXWEXTERN DestroyWindow_Type pDestroyWindow DXWINITIALIZED; DXWEXTERN DestroyWindow_Type pDestroyWindow DXWINITIALIZED;
DXWEXTERN CloseWindow_Type pCloseWindow DXWINITIALIZED; DXWEXTERN CloseWindow_Type pCloseWindow DXWINITIALIZED;
DXWEXTERN SetSysColors_Type pSetSysColors DXWINITIALIZED;
DXWEXTERN GetDCEx_Type pGDIGetDCEx DXWINITIALIZED;
// Winmm.dll: // Winmm.dll:
DXWEXTERN mciSendCommand_Type pmciSendCommand DXWINITIALIZED; DXWEXTERN mciSendCommand_Type pmciSendCommand DXWINITIALIZED;
@ -390,6 +406,12 @@ extern HRGN WINAPI extCreatePolygonRgn(const POINT *, int, int);
extern int WINAPI extDrawText(HDC, LPCTSTR, int, LPRECT, UINT); extern int WINAPI extDrawText(HDC, LPCTSTR, int, LPRECT, UINT);
extern int WINAPI extDrawTextEx(HDC, LPTSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS); extern int WINAPI extDrawTextEx(HDC, LPTSTR, int, LPRECT, UINT, LPDRAWTEXTPARAMS);
extern BOOL WINAPI extMaskBlt(HDC, int, int, int, int, HDC, int, int, HBITMAP, int, int, DWORD); extern BOOL WINAPI extMaskBlt(HDC, int, int, int, int, HDC, int, int, HBITMAP, int, int, DWORD);
extern BOOL WINAPI extSetViewportOrgEx(HDC, int, int, LPPOINT);
extern BOOL WINAPI extSetViewportExtEx(HDC, int, int, LPSIZE);
extern BOOL WINAPI extGetViewportOrgEx(HDC, LPPOINT);
extern BOOL WINAPI extGetWindowOrgEx(HDC, LPPOINT);
extern BOOL WINAPI extSetWindowOrgEx(HDC, int, int, LPPOINT);
extern BOOL WINAPI extGetCurrentPositionEx(HDC, LPPOINT);
// Kernel32.dll: // Kernel32.dll:
extern BOOL WINAPI extGetDiskFreeSpaceA(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD); extern BOOL WINAPI extGetDiskFreeSpaceA(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD);
@ -464,6 +486,8 @@ extern BOOL WINAPI extShowWindow(HWND, int);
extern LONG WINAPI extTabbedTextOutA(HDC, int, int, LPCTSTR, int, int, const LPINT, int); extern LONG WINAPI extTabbedTextOutA(HDC, int, int, LPCTSTR, int, int, const LPINT, int);
extern BOOL WINAPI extDestroyWindow(HWND); extern BOOL WINAPI extDestroyWindow(HWND);
extern BOOL WINAPI extCloseWindow(HWND); extern BOOL WINAPI extCloseWindow(HWND);
extern BOOL WINAPI extSetSysColors(int, const INT *, const COLORREF *);
extern HDC WINAPI extGDIGetDCEx(HWND, HRGN, DWORD);
// Winmm.dll: // Winmm.dll:

View File

@ -33,6 +33,14 @@ static HookEntry_Type Hooks[]={
{"TabbedTextOutA", (FARPROC)TabbedTextOutA, (FARPROC *)&pTabbedTextOutA, (FARPROC)extTabbedTextOutA}, {"TabbedTextOutA", (FARPROC)TabbedTextOutA, (FARPROC *)&pTabbedTextOutA, (FARPROC)extTabbedTextOutA},
{"CloseWindow", (FARPROC)NULL, (FARPROC *)&pCloseWindow, (FARPROC)extCloseWindow}, {"CloseWindow", (FARPROC)NULL, (FARPROC *)&pCloseWindow, (FARPROC)extCloseWindow},
{"DestroyWindow", (FARPROC)NULL, (FARPROC *)&pDestroyWindow, (FARPROC)extDestroyWindow}, {"DestroyWindow", (FARPROC)NULL, (FARPROC *)&pDestroyWindow, (FARPROC)extDestroyWindow},
{"SetSysColors", (FARPROC)NULL, (FARPROC *)&pSetSysColors, (FARPROC)extSetSysColors},
{0, NULL, 0, 0} // terminator
};
static HookEntry_Type EmulateHooks[]={
{"GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extGDIGetDC},
//{"GetWindowDC", (FARPROC)GetWindowDC, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extGDIGetDC}, // not ready yet
{"ReleaseDC", (FARPROC)ReleaseDC, (FARPROC *)&pGDIReleaseDC, (FARPROC)extGDIReleaseDC},
{0, NULL, 0, 0} // terminator {0, NULL, 0, 0} // terminator
}; };
@ -46,6 +54,7 @@ static HookEntry_Type DDHooks[]={
static HookEntry_Type GDIHooks[]={ static HookEntry_Type GDIHooks[]={
{"GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extGDIGetDC}, {"GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extGDIGetDC},
{"GetDCEx", (FARPROC)NULL, (FARPROC *)&pGDIGetDCEx, (FARPROC)extGDIGetDCEx},
{"GetWindowDC", (FARPROC)GetWindowDC, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extGDIGetDC}, {"GetWindowDC", (FARPROC)GetWindowDC, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extGDIGetDC},
{"ReleaseDC", (FARPROC)ReleaseDC, (FARPROC *)&pGDIReleaseDC, (FARPROC)extGDIReleaseDC}, {"ReleaseDC", (FARPROC)ReleaseDC, (FARPROC *)&pGDIReleaseDC, (FARPROC)extGDIReleaseDC},
{"InvalidateRect", (FARPROC)InvalidateRect, (FARPROC *)&pInvalidateRect, (FARPROC)extInvalidateRect}, {"InvalidateRect", (FARPROC)InvalidateRect, (FARPROC *)&pInvalidateRect, (FARPROC)extInvalidateRect},
@ -95,6 +104,8 @@ FARPROC Remap_user32_ProcAddress(LPCSTR proc, HMODULE hModule)
{ {
FARPROC addr; FARPROC addr;
if (addr=RemapLibrary(proc, hModule, Hooks)) return addr; if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
if ((dxw.dwFlags3 & EMULATEDC) || (dxw.dwFlags2 & HOOKGDI) || (dxw.dwFlags1 & MAPGDITOPRIMARY))
if (addr=RemapLibrary(proc, hModule, EmulateHooks)) return addr;
if (addr=RemapLibrary(proc, hModule, (dxw.dwFlags1 & MAPGDITOPRIMARY) ? DDHooks : GDIHooks)) return addr; if (addr=RemapLibrary(proc, hModule, (dxw.dwFlags1 & MAPGDITOPRIMARY) ? DDHooks : GDIHooks)) return addr;
if (dxw.dwFlags1 & CLIENTREMAPPING) if (dxw.dwFlags1 & CLIENTREMAPPING)
if (addr=RemapLibrary(proc, hModule, RemapHooks)) return addr; if (addr=RemapLibrary(proc, hModule, RemapHooks)) return addr;
@ -114,7 +125,8 @@ static char *libname = "user32.dll";
void HookUser32(HMODULE hModule) void HookUser32(HMODULE hModule)
{ {
HookLibrary(hModule, Hooks, libname); HookLibrary(hModule, Hooks, libname);
if ((dxw.dwFlags3 & EMULATEDC) || (dxw.dwFlags2 & HOOKGDI) || (dxw.dwFlags1 & MAPGDITOPRIMARY))
HookLibrary(hModule, EmulateHooks, libname);
HookLibrary(hModule, (dxw.dwFlags1 & MAPGDITOPRIMARY) ? DDHooks : GDIHooks, libname); HookLibrary(hModule, (dxw.dwFlags1 & MAPGDITOPRIMARY) ? DDHooks : GDIHooks, libname);
if (dxw.dwFlags1 & CLIENTREMAPPING) HookLibrary(hModule, RemapHooks, libname); if (dxw.dwFlags1 & CLIENTREMAPPING) HookLibrary(hModule, RemapHooks, libname);
if (dxw.dwFlags1 & MESSAGEPROC) HookLibrary(hModule, MessageHooks, libname); if (dxw.dwFlags1 & MESSAGEPROC) HookLibrary(hModule, MessageHooks, libname);
@ -162,6 +174,9 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, DEVMODE *lpDevMode, DWORD dwfla
{ {
HRESULT res; HRESULT res;
// v2.02.32: reset the emulated DC used in EMULATEDC mode
dxw.ResetEmulatedDC();
// save desired settings first v.2.1.89 // save desired settings first v.2.1.89
// v2.1.95 protect when lpDevMode is null (closing game... Jedi Outcast) // v2.1.95 protect when lpDevMode is null (closing game... Jedi Outcast)
// v2.2.23 consider new width/height only when dmFields flags are set. // v2.2.23 consider new width/height only when dmFields flags are set.
@ -218,8 +233,16 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam)
OutTraceD("%s: GOT hwnd=%x pos=(%d,%d) dim=(%d,%d) Flags=%x(%s)\n", OutTraceD("%s: GOT hwnd=%x pos=(%d,%d) dim=(%d,%d) Flags=%x(%s)\n",
ApiName, hwnd, wp->x, wp->y, wp->cx, wp->cy, wp->flags, ExplainWPFlags(wp->flags)); ApiName, hwnd, wp->x, wp->y, wp->cx, wp->cy, wp->flags, ExplainWPFlags(wp->flags));
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
int UpdFlag = 0;
if(wp->cx>MaxX) { wp->cx=MaxX; UpdFlag=1; }
if(wp->cy>MaxY) { wp->cy=MaxY; UpdFlag=1; }
if (UpdFlag)
OutTraceD("%s: SET max dim=(%d,%d)\n", ApiName, wp->cx, wp->cy);
}
if ((wp->flags & (SWP_NOMOVE|SWP_NOSIZE))==(SWP_NOMOVE|SWP_NOSIZE)) return; //v2.02.13 if ((wp->flags & (SWP_NOMOVE|SWP_NOSIZE))==(SWP_NOMOVE|SWP_NOSIZE)) return; //v2.02.13
//if (wp->flags & (SWP_NOMOVE|SWP_NOSIZE)) return; //v2.02.10
if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen() && (hwnd==dxw.GethWnd())){ if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen() && (hwnd==dxw.GethWnd())){
extern void CalculateWindowPos(HWND, DWORD, DWORD, LPWINDOWPOS); extern void CalculateWindowPos(HWND, DWORD, DWORD, LPWINDOWPOS);
@ -265,15 +288,6 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam)
} }
} }
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
int UpdFlag = 0;
if(wp->cx>MaxX) { wp->cx=MaxX; UpdFlag=1; }
if(wp->cy>MaxY) { wp->cy=MaxY; UpdFlag=1; }
if (UpdFlag)
OutTraceD("%s: SET max dim=(%d,%d)\n", ApiName, wp->cx, wp->cy);
}
iLastCX= wp->cx; iLastCX= wp->cx;
iLastCY= wp->cy; iLastCY= wp->cy;
} }
@ -493,11 +507,15 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong)
if (dxw.dwFlags1 & PREVENTMAXIMIZE){ if (dxw.dwFlags1 & PREVENTMAXIMIZE){
if(nIndex==GWL_STYLE){ if(nIndex==GWL_STYLE){
OutTraceD("SetWindowLong: GWL_STYLE %x suppress MAXIMIZE\n", dwNewLong); dwNewLong &= ~WS_MAXIMIZE;
dwNewLong |= WS_OVERLAPPEDWINDOW; if(dxw.IsDesktop(hwnd)){
dwNewLong &= ~(WS_DLGFRAME|WS_MAXIMIZE|WS_POPUP|WS_VSCROLL|WS_HSCROLL|WS_CLIPSIBLINGS); OutTraceD("SetWindowLong: GWL_STYLE %x suppress MAXIMIZE\n", dwNewLong);
dwNewLong |= WS_OVERLAPPEDWINDOW;
dwNewLong &= ~(WS_DLGFRAME|WS_MAXIMIZE|WS_VSCROLL|WS_HSCROLL|WS_CLIPSIBLINGS);
}
} }
if(nIndex==GWL_EXSTYLE){ // v2.02.32: disable topmost for main window only
if(dxw.IsDesktop(hwnd) && (nIndex==GWL_EXSTYLE)){
OutTraceD("SetWindowLong: GWL_EXSTYLE %x suppress TOPMOST\n", dwNewLong); OutTraceD("SetWindowLong: GWL_EXSTYLE %x suppress TOPMOST\n", dwNewLong);
dwNewLong = dwNewLong & ~(WS_EX_TOPMOST); dwNewLong = dwNewLong & ~(WS_EX_TOPMOST);
} }
@ -544,7 +562,8 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c
OutTraceD("SetWindowPos: hwnd=%x%s pos=(%d,%d) dim=(%d,%d) Flags=%x\n", OutTraceD("SetWindowPos: hwnd=%x%s pos=(%d,%d) dim=(%d,%d) Flags=%x\n",
hwnd, dxw.IsFullScreen()?"(FULLSCREEN)":"", X, Y, cx, cy, uFlags); hwnd, dxw.IsFullScreen()?"(FULLSCREEN)":"", X, Y, cx, cy, uFlags);
if ((hwnd != dxw.GethWnd()) || !dxw.IsFullScreen()){ //if ((hwnd != dxw.GethWnd()) || !dxw.IsFullScreen()){
if (!dxw.IsDesktop(hwnd) || !dxw.IsFullScreen()){
// just proxy // just proxy
res=(*pSetWindowPos)(hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags); res=(*pSetWindowPos)(hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
if(!res)OutTraceE("SetWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__); if(!res)OutTraceE("SetWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__);
@ -555,6 +574,7 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c
// Note: any attempt to change the window position, no matter where and how, through the // Note: any attempt to change the window position, no matter where and how, through the
// SetWindowPos API is causing resizing to the default 1:1 pixed size in Commandos. // SetWindowPos API is causing resizing to the default 1:1 pixed size in Commandos.
// in such cases, there is incompatibility between LOCKWINPOS and LOCKWINSTYLE. // in such cases, there is incompatibility between LOCKWINPOS and LOCKWINSTYLE.
OutTraceD("SetWindowPos: locked position\n");
return 1; return 1;
} }
@ -1028,8 +1048,9 @@ static HWND WINAPI extCreateWindowCommon(
// no maximized windows in any case // no maximized windows in any case
if (dxw.dwFlags1 & PREVENTMAXIMIZE){ if (dxw.dwFlags1 & PREVENTMAXIMIZE){
OutTraceD("%s: handling PREVENTMAXIMIZE mode\n", ApiName); OutTraceD("%s: handling PREVENTMAXIMIZE mode\n", ApiName);
dwStyle &= ~(WS_MAXIMIZE | WS_POPUP); dwStyle &= ~WS_MAXIMIZE;
dwExStyle &= ~WS_EX_TOPMOST; //dwStyle &= ~(WS_MAXIMIZE | WS_POPUP);
//dwExStyle &= ~WS_EX_TOPMOST;
} }
// v2.1.92: fixes size & position for auxiliary big window, often used // v2.1.92: fixes size & position for auxiliary big window, often used
@ -1045,7 +1066,7 @@ static HWND WINAPI extCreateWindowCommon(
((x<=0)&&(y<=0)) || ((x==CW_USEDEFAULT)&&(y==CW_USEDEFAULT)) ((x<=0)&&(y<=0)) || ((x==CW_USEDEFAULT)&&(y==CW_USEDEFAULT))
) )
&& &&
(((DWORD)nWidth>=dxw.GetScreenWidth())&&((DWORD)nHeight>=dxw.GetScreenHeight())) ((nWidth>=(int)dxw.GetScreenWidth())&&(nHeight>=(int)dxw.GetScreenHeight()))
&& &&
!(dwExStyle & WS_EX_CONTROLPARENT) // Diablo fix !(dwExStyle & WS_EX_CONTROLPARENT) // Diablo fix
&& &&
@ -1427,21 +1448,11 @@ HDC WINAPI extGDIGetDC(HWND hwnd)
lochwnd=dxw.GethWnd(); lochwnd=dxw.GethWnd();
} }
#if 0 if(dxw.dwFlags3 & EMULATEDC)
dxw.lpDDSPrimHDC=dxw.GetPrimarySurface(); ret=dxw.AcquireEmulatedDC(lochwnd);
if(dxw.lpDDSPrimHDC){ else
HRESULT rc; ret=(*pGDIGetDC)(lochwnd);
OutTraceD("GDI.GetDC: using ddraw primary lpdds=%x\n", dxw.lpDDSPrimHDC);
rc=(*pGetDC)(dxw.lpDDSPrimHDC, &ret);
if(rc)
OutTraceE("GDI.GetDC ERROR: err=%x(%s) at %d\n", rc, ExplainDDError(rc), __LINE__);
else
OutTraceD("GDI.GetDC: hwnd=%x ret=%x\n", hwnd, ret);
return ret;
}
#endif
ret=(*pGDIGetDC)(lochwnd);
if(ret){ if(ret){
OutTraceD("GDI.GetDC: hwnd=%x ret=%x\n", lochwnd, ret); OutTraceD("GDI.GetDC: hwnd=%x ret=%x\n", lochwnd, ret);
} }
@ -1461,6 +1472,12 @@ HDC WINAPI extGDIGetDC(HWND hwnd)
return ret; return ret;
} }
HDC WINAPI extGDIGetDCEx(HWND hwnd, HRGN hrgnClip, DWORD flags)
{
MessageBox(0, "GetDCEx", "to fix", MB_OK | MB_ICONEXCLAMATION);
return (HDC)NULL;
}
HDC WINAPI extGDIGetWindowDC(HWND hwnd) HDC WINAPI extGDIGetWindowDC(HWND hwnd)
{ {
HDC ret; HDC ret;
@ -1471,7 +1488,9 @@ HDC WINAPI extGDIGetWindowDC(HWND hwnd)
OutTraceD("GDI.GetWindowDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); OutTraceD("GDI.GetWindowDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd());
lochwnd=dxw.GethWnd(); lochwnd=dxw.GethWnd();
} }
ret=(*pGDIGetWindowDC)(lochwnd); ret=(*pGDIGetWindowDC)(lochwnd);
if(ret){ if(ret){
OutTraceD("GDI.GetWindowDC: hwnd=%x ret=%x\n", lochwnd, ret); OutTraceD("GDI.GetWindowDC: hwnd=%x ret=%x\n", lochwnd, ret);
} }
@ -1497,23 +1516,11 @@ int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC)
OutTraceD("GDI.ReleaseDC: hwnd=%x hdc=%x\n", hwnd, hDC); OutTraceD("GDI.ReleaseDC: hwnd=%x hdc=%x\n", hwnd, hDC);
if (dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd(); if (dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
#if 0 if(dxw.dwFlags3 & EMULATEDC)
if(dxw.lpDDSPrimHDC){ res=dxw.ReleaseEmulatedDC(hwnd);
HRESULT rc; else
OutTraceD("GDI.ReleaseDC: using ddraw primary lpdds=%x\n", dxw.lpDDSPrimHDC); res=(*pGDIReleaseDC)(hwnd, hDC);
rc=(*pReleaseDC)(dxw.lpDDSPrimHDC, hDC);
sBlt("ReleaseDC", dxw.lpDDSPrimHDC, NULL, dxw.lpDDSPrimHDC, NULL, DDBLT_WAIT, 0, TRUE);
if(rc) {
OutTraceE("GDI.ReleaseDC ERROR: hwnd=%x err=%x(%s) at %d\n", hwnd, rc, ExplainDDError(rc), __LINE__);
}
else {
sBlt("ReleaseDC", dxw.lpDDSPrimHDC, NULL, dxw.lpDDSPrimHDC, NULL, DDBLT_WAIT, 0, TRUE);
}
return (rc ? 0 : 1);
}
#endif
res=(*pGDIReleaseDC)(hwnd, hDC);
if (!res) OutTraceE("GDI.ReleaseDC ERROR: err=%d at %d\n", GetLastError(), __LINE__); if (!res) OutTraceE("GDI.ReleaseDC ERROR: err=%d at %d\n", GetLastError(), __LINE__);
return(res); return(res);
} }
@ -1527,11 +1534,11 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
OutTraceD("GDI.BeginPaint: hwnd=%x lpPaint=%x FullScreen=%x\n", hwnd, lpPaint, dxw.IsFullScreen()); OutTraceD("GDI.BeginPaint: hwnd=%x lpPaint=%x FullScreen=%x\n", hwnd, lpPaint, dxw.IsFullScreen());
hdc=(*pBeginPaint)(hwnd, lpPaint); hdc=(*pBeginPaint)(hwnd, lpPaint);
//return hdc;
// if not in fullscreen mode, that's all! // if not in fullscreen mode, that's all!
if(!dxw.IsFullScreen()) return hdc; if(!dxw.IsFullScreen()) return hdc;
if(dxw.dwFlags3 & EMULATEDC) return dxw.AcquireEmulatedDC(hwnd);
// on MAPGDITOPRIMARY, return the PrimHDC handle instead of the window DC // on MAPGDITOPRIMARY, return the PrimHDC handle instead of the window DC
if(dxw.dwFlags1 & MAPGDITOPRIMARY) { if(dxw.dwFlags1 & MAPGDITOPRIMARY) {
if(pGetDC && dxw.lpDDSPrimHDC){ if(pGetDC && dxw.lpDDSPrimHDC){
@ -1560,8 +1567,17 @@ BOOL WINAPI extEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
BOOL ret; BOOL ret;
HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR hdc); HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR hdc);
// proxy part ...
OutTraceD("GDI.EndPaint: hwnd=%x lpPaint=%x\n", hwnd, lpPaint); OutTraceD("GDI.EndPaint: hwnd=%x lpPaint=%x\n", hwnd, lpPaint);
if((dxw.dwFlags3 & EMULATEDC) && dxw.IsFullScreen()){
ret=dxw.ReleaseEmulatedDC(hwnd);
ret=(*pEndPaint)(hwnd, lpPaint);
OutTraceD("GDI.EndPaint: hwnd=%x ret=%x\n", hwnd, ret);
if(!ret) OutTraceE("GDI.EndPaint ERROR: err=%d at %d\n", GetLastError(), __LINE__);
return ret;
}
// proxy part ...
ret=(*pEndPaint)(hwnd, lpPaint); ret=(*pEndPaint)(hwnd, lpPaint);
OutTraceD("GDI.EndPaint: hwnd=%x ret=%x\n", hwnd, ret); OutTraceD("GDI.EndPaint: hwnd=%x ret=%x\n", hwnd, ret);
if(!ret) OutTraceE("GDI.EndPaint ERROR: err=%d at %d\n", GetLastError(), __LINE__); if(!ret) OutTraceE("GDI.EndPaint ERROR: err=%d at %d\n", GetLastError(), __LINE__);
@ -1782,3 +1798,16 @@ BOOL WINAPI extCloseWindow(HWND hWnd)
if(!res)OutTraceE("CloseWindow: ERROR err=%d\n", GetLastError()); if(!res)OutTraceE("CloseWindow: ERROR err=%d\n", GetLastError());
return res; return res;
} }
BOOL WINAPI extSetSysColors(int cElements, const INT *lpaElements, const COLORREF *lpaRgbValues)
{
// v2.02.32: added to avoid SysColors changes by "Western Front"
BOOL ret;
OutTraceD("SetSysColors: Elements=%d\n", cElements);
if(dxw.dwFlags3 & LOCKSYSCOLORS) return TRUE;
ret=(*pSetSysColors)(cElements, lpaElements, lpaRgbValues);
if(!ret) OutTraceE("SetSysColors: ERROR er=%d\n", GetLastError());
return ret;
}

View File

@ -93,7 +93,6 @@
#define IDC_SIZY 1049 #define IDC_SIZY 1049
#define IDC_HOOKCHILDWIN 1050 #define IDC_HOOKCHILDWIN 1050
#define IDC_MESSAGEPROC 1051 #define IDC_MESSAGEPROC 1051
#define IDC_MAPGDITOPRIMARY 1052
#define IDC_RECOVERSCREENMODE 1053 #define IDC_RECOVERSCREENMODE 1053
#define IDC_REFRESHONRESIZE 1054 #define IDC_REFRESHONRESIZE 1054
#define IDC_BACKBUFATTACH 1055 #define IDC_BACKBUFATTACH 1055
@ -107,7 +106,6 @@
#define IDC_CURSORTRACE 1063 #define IDC_CURSORTRACE 1063
#define IDC_IMPORTTABLE 1064 #define IDC_IMPORTTABLE 1064
#define IDC_HANDLEEXCEPTIONS 1065 #define IDC_HANDLEEXCEPTIONS 1065
#define IDC_IMPORTTABLE2 1065
#define IDC_BLITFROMBACKBUFFER 1066 #define IDC_BLITFROMBACKBUFFER 1066
#define IDC_OUTDEBUG 1067 #define IDC_OUTDEBUG 1067
#define IDC_SUPPRESSCLIPPING 1068 #define IDC_SUPPRESSCLIPPING 1068
@ -160,6 +158,11 @@
#define IDC_OUTREGISTRY 1115 #define IDC_OUTREGISTRY 1115
#define IDC_NOWINDOWMOVE 1116 #define IDC_NOWINDOWMOVE 1116
#define IDC_DISABLEHAL 1117 #define IDC_DISABLEHAL 1117
#define IDC_LOCKSYSCOLORS 1118
#define IDC_GDINONE 1119
#define IDC_GDISCALED 1120
#define IDC_EMULATEDC 1121
#define IDC_MAPGDITOPRIMARY 1122
#define ID_MODIFY 32771 #define ID_MODIFY 32771
#define ID_DELETE 32772 #define ID_DELETE 32772
#define ID_ADD 32773 #define ID_ADD 32773
@ -209,7 +212,7 @@
#define _APS_3D_CONTROLS 1 #define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 156 #define _APS_NEXT_RESOURCE_VALUE 156
#define _APS_NEXT_COMMAND_VALUE 32825 #define _APS_NEXT_COMMAND_VALUE 32825
#define _APS_NEXT_CONTROL_VALUE 1091 #define _APS_NEXT_CONTROL_VALUE 1092
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -33,6 +33,7 @@ void CTabColor::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_WIREFRAME, cTarget->m_WireFrame); DDX_Check(pDX, IDC_WIREFRAME, cTarget->m_WireFrame);
DDX_Check(pDX, IDC_BLACKWHITE, cTarget->m_BlackWhite); DDX_Check(pDX, IDC_BLACKWHITE, cTarget->m_BlackWhite);
DDX_Check(pDX, IDC_USERGB565, cTarget->m_UseRGB565); DDX_Check(pDX, IDC_USERGB565, cTarget->m_UseRGB565);
DDX_Check(pDX, IDC_LOCKSYSCOLORS, cTarget->m_LockSysColors);
} }
BEGIN_MESSAGE_MAP(CTabColor, CDialog) BEGIN_MESSAGE_MAP(CTabColor, CDialog)

View File

@ -26,9 +26,8 @@ void CTabGDI::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent())); CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
DDX_Radio(pDX, IDC_GDINONE, cTarget->m_DCEmulationMode);
DDX_Check(pDX, IDC_FIXTEXTOUT, cTarget->m_FixTextOut); DDX_Check(pDX, IDC_FIXTEXTOUT, cTarget->m_FixTextOut);
DDX_Check(pDX, IDC_HOOKGDI, cTarget->m_HookGDI);
DDX_Check(pDX, IDC_MAPGDITOPRIMARY, cTarget->m_MapGDIToPrimary);
} }
BEGIN_MESSAGE_MAP(CTabGDI, CDialog) BEGIN_MESSAGE_MAP(CTabGDI, CDialog)

View File

@ -21,6 +21,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_DXVersion = -1; m_DXVersion = -1;
m_Coordinates = 0; m_Coordinates = 0;
m_DxEmulationMode = 0; // default: no emulation m_DxEmulationMode = 0; // default: no emulation
m_DCEmulationMode = 0; // default: no emulation
m_HookDI = FALSE; m_HookDI = FALSE;
m_ModifyMouse = TRUE; // default true !! m_ModifyMouse = TRUE; // default true !!
m_OutTrace = FALSE; m_OutTrace = FALSE;
@ -35,6 +36,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_SuppressD3DExt = FALSE; m_SuppressD3DExt = FALSE;
m_SetCompatibility = FALSE; m_SetCompatibility = FALSE;
m_DisableHAL = FALSE; m_DisableHAL = FALSE;
m_LockSysColors = FALSE;
m_SaveCaps = FALSE; m_SaveCaps = FALSE;
m_SingleProcAffinity = FALSE; m_SingleProcAffinity = FALSE;
m_LimitResources = FALSE; m_LimitResources = FALSE;
@ -68,14 +70,12 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_MarkBlit = FALSE; m_MarkBlit = FALSE;
m_PreventMaximize = FALSE; m_PreventMaximize = FALSE;
m_ClientRemapping = TRUE; // default true !! m_ClientRemapping = TRUE; // default true !!
m_MapGDIToPrimary = FALSE;
m_LockWinPos = FALSE; m_LockWinPos = FALSE;
m_LockWinStyle = FALSE; m_LockWinStyle = FALSE;
m_FixParentWin = FALSE; m_FixParentWin = FALSE;
m_ModalStyle = FALSE; m_ModalStyle = FALSE;
m_KeepAspectRatio = FALSE; m_KeepAspectRatio = FALSE;
m_ForceWinResize = FALSE; m_ForceWinResize = FALSE;
m_HookGDI = FALSE;
m_HideMultiMonitor = FALSE; m_HideMultiMonitor = FALSE;
m_WallpaperMode = FALSE; m_WallpaperMode = FALSE;
m_FixD3DFrame = FALSE; m_FixD3DFrame = FALSE;

View File

@ -26,6 +26,7 @@ public:
int m_DXVersion; int m_DXVersion;
int m_Coordinates; int m_Coordinates;
int m_DxEmulationMode; int m_DxEmulationMode;
int m_DCEmulationMode;
BOOL m_HookDI; BOOL m_HookDI;
BOOL m_ModifyMouse; BOOL m_ModifyMouse;
BOOL m_OutTrace; BOOL m_OutTrace;
@ -70,14 +71,12 @@ public:
BOOL m_MarkBlit; BOOL m_MarkBlit;
BOOL m_PreventMaximize; BOOL m_PreventMaximize;
BOOL m_ClientRemapping; BOOL m_ClientRemapping;
BOOL m_MapGDIToPrimary;
BOOL m_LockWinPos; BOOL m_LockWinPos;
BOOL m_LockWinStyle; BOOL m_LockWinStyle;
BOOL m_FixParentWin; BOOL m_FixParentWin;
BOOL m_ModalStyle; BOOL m_ModalStyle;
BOOL m_KeepAspectRatio; BOOL m_KeepAspectRatio;
BOOL m_ForceWinResize; BOOL m_ForceWinResize;
BOOL m_HookGDI;
BOOL m_HideMultiMonitor; BOOL m_HideMultiMonitor;
BOOL m_WallpaperMode; BOOL m_WallpaperMode;
BOOL m_FixD3DFrame; BOOL m_FixD3DFrame;
@ -107,6 +106,7 @@ public:
BOOL m_SuppressIME; BOOL m_SuppressIME;
BOOL m_SetCompatibility; BOOL m_SetCompatibility;
BOOL m_DisableHAL; BOOL m_DisableHAL;
BOOL m_LockSysColors;
BOOL m_SaveCaps; BOOL m_SaveCaps;
BOOL m_SingleProcAffinity; BOOL m_SingleProcAffinity;
BOOL m_WireFrame; BOOL m_WireFrame;

Binary file not shown.

View File

@ -438,10 +438,12 @@ IDD_TAB_GDI DIALOGEX 0, 0, 300, 240
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
CONTROL "Scale font parameters",IDC_FIXTEXTOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,28,125,10 GROUPBOX "GDI Handling",IDC_STATIC,6,7,140,131
GROUPBOX "GDI Handling",IDC_STATIC,6,3,140,51 CONTROL "No GDI handling",IDC_GDINONE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,17,26,67,10
CONTROL "Hook GDI",IDC_HOOKGDI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,16,119,10 CONTROL "Scaled GDI calls",IDC_HOOKGDI,"Button",BS_AUTORADIOBUTTON,17,38,66,10
CONTROL "Map GDI HDC to Primary DC",IDC_MAPGDITOPRIMARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,40,119,10 CONTROL "Emulated Device Context",IDC_EMULATEDC,"Button",BS_AUTORADIOBUTTON,17,50,97,10
CONTROL "Map DC to Primary Surface",IDC_MAPGDITOPRIMARY,"Button",BS_AUTORADIOBUTTON,17,62,102,10
CONTROL "Scale font parameters",IDC_FIXTEXTOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,110,125,10
END END
IDD_TAB_COLOR DIALOGEX 0, 0, 300, 240 IDD_TAB_COLOR DIALOGEX 0, 0, 300, 240
@ -456,6 +458,7 @@ BEGIN
CONTROL "3D Wireframe",IDC_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,64,96,10 CONTROL "3D Wireframe",IDC_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,64,96,10
CONTROL "Simulate BW monitor",IDC_BLACKWHITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,76,96,10 CONTROL "Simulate BW monitor",IDC_BLACKWHITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,76,96,10
CONTROL "Set 16BPP RGB565 encoding",IDC_USERGB565,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,88,126,9 CONTROL "Set 16BPP RGB565 encoding",IDC_USERGB565,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,88,126,9
CONTROL "Lock Sys Colors",IDC_LOCKSYSCOLORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,100,126,9
END END

Binary file not shown.

View File

@ -121,6 +121,15 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
case 2: t->flags |= LOCKEDSURFACE; break; case 2: t->flags |= LOCKEDSURFACE; break;
case 3: t->flags |= EMULATESURFACE; break; case 3: t->flags |= EMULATESURFACE; break;
} }
t->flags2 &= ~HOOKGDI;
t->flags &= ~MAPGDITOPRIMARY;
t->flags3 &= ~EMULATEDC;
switch(dlg->m_DCEmulationMode){
case 0: break;
case 1: t->flags2 |= HOOKGDI; break;
case 2: t->flags3 |= EMULATEDC; break;
case 3: t->flags |= MAPGDITOPRIMARY; break;
}
if(dlg->m_HookDI) t->flags |= HOOKDI; if(dlg->m_HookDI) t->flags |= HOOKDI;
if(dlg->m_ModifyMouse) t->flags |= MODIFYMOUSE; if(dlg->m_ModifyMouse) t->flags |= MODIFYMOUSE;
if(dlg->m_OutTrace) t->tflags |= OUTDDRAWTRACE; if(dlg->m_OutTrace) t->tflags |= OUTDDRAWTRACE;
@ -141,6 +150,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_SuppressD3DExt) t->flags3 |= SUPPRESSD3DEXT; if(dlg->m_SuppressD3DExt) t->flags3 |= SUPPRESSD3DEXT;
if(dlg->m_SetCompatibility) t->flags2 |= SETCOMPATIBILITY; if(dlg->m_SetCompatibility) t->flags2 |= SETCOMPATIBILITY;
if(dlg->m_DisableHAL) t->flags3 |= DISABLEHAL; if(dlg->m_DisableHAL) t->flags3 |= DISABLEHAL;
if(dlg->m_LockSysColors) t->flags3 |= LOCKSYSCOLORS;
if(dlg->m_SaveCaps) t->flags3 |= SAVECAPS; if(dlg->m_SaveCaps) t->flags3 |= SAVECAPS;
if(dlg->m_SingleProcAffinity) t->flags3 |= SINGLEPROCAFFINITY; if(dlg->m_SingleProcAffinity) t->flags3 |= SINGLEPROCAFFINITY;
if(dlg->m_SaveLoad) t->flags |= SAVELOAD; if(dlg->m_SaveLoad) t->flags |= SAVELOAD;
@ -163,14 +173,12 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_MarkBlit) t->flags3 |= MARKBLIT; if(dlg->m_MarkBlit) t->flags3 |= MARKBLIT;
if(dlg->m_PreventMaximize) t->flags |= PREVENTMAXIMIZE; if(dlg->m_PreventMaximize) t->flags |= PREVENTMAXIMIZE;
if(dlg->m_ClientRemapping) t->flags |= CLIENTREMAPPING; if(dlg->m_ClientRemapping) t->flags |= CLIENTREMAPPING;
if(dlg->m_MapGDIToPrimary) t->flags |= MAPGDITOPRIMARY;
if(dlg->m_LockWinPos) t->flags |= LOCKWINPOS; if(dlg->m_LockWinPos) t->flags |= LOCKWINPOS;
if(dlg->m_LockWinStyle) t->flags |= LOCKWINSTYLE; if(dlg->m_LockWinStyle) t->flags |= LOCKWINSTYLE;
if(dlg->m_FixParentWin) t->flags |= FIXPARENTWIN; if(dlg->m_FixParentWin) t->flags |= FIXPARENTWIN;
if(dlg->m_ModalStyle) t->flags2 |= MODALSTYLE; if(dlg->m_ModalStyle) t->flags2 |= MODALSTYLE;
if(dlg->m_KeepAspectRatio) t->flags2 |= KEEPASPECTRATIO; if(dlg->m_KeepAspectRatio) t->flags2 |= KEEPASPECTRATIO;
if(dlg->m_ForceWinResize) t->flags2 |= FORCEWINRESIZE; if(dlg->m_ForceWinResize) t->flags2 |= FORCEWINRESIZE;
if(dlg->m_HookGDI) t->flags2 |= HOOKGDI;
if(dlg->m_HideMultiMonitor) t->flags2 |= HIDEMULTIMONITOR; if(dlg->m_HideMultiMonitor) t->flags2 |= HIDEMULTIMONITOR;
if(dlg->m_WallpaperMode) t->flags2 |= WALLPAPERMODE; if(dlg->m_WallpaperMode) t->flags2 |= WALLPAPERMODE;
if(dlg->m_FixD3DFrame) t->flags3 |= FIXD3DFRAME; if(dlg->m_FixD3DFrame) t->flags3 |= FIXD3DFRAME;
@ -235,6 +243,11 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
if(t->flags & LOCKEDSURFACE) dlg->m_DxEmulationMode = 2; if(t->flags & LOCKEDSURFACE) dlg->m_DxEmulationMode = 2;
if(t->flags & EMULATESURFACE) dlg->m_DxEmulationMode = 3; if(t->flags & EMULATESURFACE) dlg->m_DxEmulationMode = 3;
dlg->m_DCEmulationMode = 0;
if(t->flags2 & HOOKGDI) dlg->m_DCEmulationMode = 1;
if(t->flags3 & EMULATEDC) dlg->m_DCEmulationMode = 2;
if(t->flags & MAPGDITOPRIMARY) dlg->m_DCEmulationMode = 3;
dlg->m_HookDI = t->flags & HOOKDI ? 1 : 0; dlg->m_HookDI = t->flags & HOOKDI ? 1 : 0;
dlg->m_ModifyMouse = t->flags & MODIFYMOUSE ? 1 : 0; dlg->m_ModifyMouse = t->flags & MODIFYMOUSE ? 1 : 0;
dlg->m_OutTrace = t->tflags & OUTDDRAWTRACE ? 1 : 0; dlg->m_OutTrace = t->tflags & OUTDDRAWTRACE ? 1 : 0;
@ -253,6 +266,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_SuppressD3DExt = t->flags3 & SUPPRESSD3DEXT ? 1 : 0; dlg->m_SuppressD3DExt = t->flags3 & SUPPRESSD3DEXT ? 1 : 0;
dlg->m_SetCompatibility = t->flags2 & SETCOMPATIBILITY ? 1 : 0; dlg->m_SetCompatibility = t->flags2 & SETCOMPATIBILITY ? 1 : 0;
dlg->m_DisableHAL = t->flags3 & DISABLEHAL ? 1 : 0; dlg->m_DisableHAL = t->flags3 & DISABLEHAL ? 1 : 0;
dlg->m_LockSysColors = t->flags3 & LOCKSYSCOLORS ? 1 : 0;
dlg->m_SaveCaps = t->flags3 & SAVECAPS ? 1 : 0; dlg->m_SaveCaps = t->flags3 & SAVECAPS ? 1 : 0;
dlg->m_SingleProcAffinity = t->flags3 & SINGLEPROCAFFINITY ? 1 : 0; dlg->m_SingleProcAffinity = t->flags3 & SINGLEPROCAFFINITY ? 1 : 0;
dlg->m_LimitResources = t->flags2 & LIMITRESOURCES ? 1 : 0; dlg->m_LimitResources = t->flags2 & LIMITRESOURCES ? 1 : 0;
@ -277,14 +291,12 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_MarkBlit = t->flags3 & MARKBLIT ? 1 : 0; dlg->m_MarkBlit = t->flags3 & MARKBLIT ? 1 : 0;
dlg->m_PreventMaximize = t->flags & PREVENTMAXIMIZE ? 1 : 0; dlg->m_PreventMaximize = t->flags & PREVENTMAXIMIZE ? 1 : 0;
dlg->m_ClientRemapping = t->flags & CLIENTREMAPPING ? 1 : 0; dlg->m_ClientRemapping = t->flags & CLIENTREMAPPING ? 1 : 0;
dlg->m_MapGDIToPrimary = t->flags & MAPGDITOPRIMARY ? 1 : 0;
dlg->m_LockWinPos = t->flags & LOCKWINPOS ? 1 : 0; dlg->m_LockWinPos = t->flags & LOCKWINPOS ? 1 : 0;
dlg->m_LockWinStyle = t->flags & LOCKWINSTYLE ? 1 : 0; dlg->m_LockWinStyle = t->flags & LOCKWINSTYLE ? 1 : 0;
dlg->m_FixParentWin = t->flags & FIXPARENTWIN ? 1 : 0; dlg->m_FixParentWin = t->flags & FIXPARENTWIN ? 1 : 0;
dlg->m_ModalStyle = t->flags2 & MODALSTYLE ? 1 : 0; dlg->m_ModalStyle = t->flags2 & MODALSTYLE ? 1 : 0;
dlg->m_KeepAspectRatio = t->flags2 & KEEPASPECTRATIO ? 1 : 0; dlg->m_KeepAspectRatio = t->flags2 & KEEPASPECTRATIO ? 1 : 0;
dlg->m_ForceWinResize = t->flags2 & FORCEWINRESIZE ? 1 : 0; dlg->m_ForceWinResize = t->flags2 & FORCEWINRESIZE ? 1 : 0;
dlg->m_HookGDI = t->flags2 & HOOKGDI ? 1 : 0;
dlg->m_HideMultiMonitor = t->flags2 & HIDEMULTIMONITOR ? 1 : 0; dlg->m_HideMultiMonitor = t->flags2 & HIDEMULTIMONITOR ? 1 : 0;
dlg->m_WallpaperMode = t->flags2 & WALLPAPERMODE ? 1 : 0; dlg->m_WallpaperMode = t->flags2 & WALLPAPERMODE ? 1 : 0;
dlg->m_FixD3DFrame = t->flags3 & FIXD3DFRAME ? 1 : 0; dlg->m_FixD3DFrame = t->flags3 & FIXD3DFRAME ? 1 : 0;