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

v2_03_20_src

Former-commit-id: a958662e8d866d5416cf839365aed28110ae7207
This commit is contained in:
gho tik 2015-10-05 12:40:44 -04:00 committed by Refael ACkermann
parent 90d46c7aa0
commit 1beb97e5aa
54 changed files with 1143 additions and 215 deletions

View File

@ -183,6 +183,8 @@
// sixth flags DWORD dxw.dwFlags6: // sixth flags DWORD dxw.dwFlags6:
#define FORCESWAPEFFECT 0x00000001 // in D3D8/9, forces the SwapEffect value in CreateDevice/Reset operations #define FORCESWAPEFFECT 0x00000001 // in D3D8/9, forces the SwapEffect value in CreateDevice/Reset operations
#define LEGACYALLOC 0x00000002 // reserve legacy memory segments
#define NODESTROYWINDOW 0x00000004 // suppress the main window destruction
// 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:30f6a78ea3b87ee01aff8159e37ade8c64528ce94e51299d3f5e5b3f7c7e8276 oid sha256:8b63cb25a2b2f543143293943a740859894c0a8b2ff156428c40376380a47a13
size 575488 size 577536

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:292da547aea629cb8b159cd7ac8c768bdc915cdd4ecd294dbc0ec14097ec869c oid sha256:c1bb172dc721bb8db528e064c3bc6acb78a0107c298e11368d28b36bb636dae6
size 539648 size 539648

View File

@ -1,5 +1,5 @@
[window] [window]
posx=1496 posx=50
posy=246 posy=50
sizx=320 sizx=320
sizy=200 sizy=200

View File

@ -0,0 +1,31 @@
[target]
title0=Alone in the Dark the New Nightmare
path0=D:\Games\Alone in the Dark\alone4.exe
launchpath0=D:\Games\Alone in the Dark\launch.exe
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=679477282
flagg0=1207959568
flagh0=20
flagi0=138412036
flagj0=4224
flagk0=0
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=1200
sizy0=900
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,29 @@
[target]
title0=Armor Command
path0=D:\Games\ArmCom\armrcmd.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=671088674
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,31 @@
[target]
title0=Battle Isle - the Andosia War
path0=D:\Games\Battle Isle - the Andosia War\BITAW.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=7
coord0=0
flag0=679477280
flagg0=1207959552
flagh0=20
flagi0=136314884
flagj0=134221952
flagk0=0
tflag0=6402
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -8,8 +8,8 @@ coord0=0
flag0=134234146 flag0=134234146
flagg0=1207959568 flagg0=1207959568
flagh0=32788 flagh0=32788
flagi0=4 flagi0=4194308
tflag0=6211 tflag0=0
initx0=0 initx0=0
inity0=0 inity0=0
minx0=0 minx0=0
@ -24,3 +24,8 @@ maxfps0=0
initts0=0 initts0=0
winver0=0 winver0=0
maxres0=-1 maxres0=-1
launchpath0=
notes0=
flagj0=128
flagk0=0
swapeffect0=0

View File

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

View File

@ -4,15 +4,15 @@ path0=D:\Games\Crusaders of Might and Magic (GOG)\crusaders.exe
launchpath0= launchpath0=
module0=gfx_d3d gfx_sw module0=gfx_d3d gfx_sw
opengllib0= opengllib0=
notes0=the ddraw.dll hooker in the game folder must be deleted or renamed \nto allow DxWnd to play the game. notes0=
ver0=0 ver0=0
coord0=0 coord0=0
flag0=-1467989966 flag0=-1467989966
flagg0=1744830472 flagg0=1209008640
flagh0=20 flagh0=65556
flagi0=138412036 flagi0=136314884
flagj0=4224 flagj0=4224
tflag0=-2147477229 tflag0=0
initx0=0 initx0=0
inity0=0 inity0=0
minx0=0 minx0=0
@ -27,3 +27,5 @@ maxfps0=0
initts0=0 initts0=0
winver0=0 winver0=0
maxres0=-1 maxres0=-1
flagk0=2
swapeffect0=0

View File

@ -8,11 +8,11 @@ notes0=
ver0=0 ver0=0
coord0=0 coord0=0
flag0=-1467989966 flag0=-1467989966
flagg0=1207959560 flagg0=1207959552
flagh0=20 flagh0=1044
flagi0=138412036 flagi0=1212153860
flagj0=4224 flagj0=4224
tflag0=6418 tflag0=0
initx0=0 initx0=0
inity0=0 inity0=0
minx0=0 minx0=0
@ -27,3 +27,5 @@ maxfps0=0
initts0=0 initts0=0
winver0=0 winver0=0
maxres0=-1 maxres0=-1
flagk0=2
swapeffect0=0

View File

@ -0,0 +1,28 @@
[target]
title0=Earth 2150
path0=D:\Games\Earth 2150\Earth2150.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=136331298
flagg0=1207959552
flagh0=20
flagi0=138412452
flagj0=8322
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,28 @@
[target]
title0=Hearts of Iron III
path0=D:\Games\Hearts of Iron III\hoi3game.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=704774688
flagg0=1207959568
flagh0=20
flagi0=138412036
flagj0=128
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

29
build/exports/Hexen95.dxw Normal file
View File

@ -0,0 +1,29 @@
[target]
title0=Hexen95
path0=D:\Games\HEXEN95\HEXEN95.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=671088674
flagg0=1207959552
flagh0=65556
flagi0=138412036
flagj0=4224
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -9,7 +9,7 @@ flag0=134217762
flagg0=1209008384 flagg0=1209008384
flagh0=20 flagh0=20
flagi0=4194308 flagi0=4194308
tflag0=64 tflag0=0
initx0=0 initx0=0
inity0=0 inity0=0
minx0=0 minx0=0
@ -25,3 +25,5 @@ initts0=0
winver0=0 winver0=0
maxres0=-1 maxres0=-1
launchpath0= launchpath0=
notes0=
flagj0=128

View File

@ -0,0 +1,29 @@
[target]
title0=Legend of the Prophet & Assassin, the
path0=D:\Games\La leggenda\Legend.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=1
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=67113088
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

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

View File

@ -0,0 +1,29 @@
[target]
title0=Myth the Fallen Lords
path0=D:\Games\myth\MYTH_TFL.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134217762
flagg0=2013265920
flagh0=20
flagi0=138412036
flagj0=4224
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,31 @@
[target]
title0=Prince of Persia 3D
path0=D:\Games\Prince_of_Persia_3D\POP3D.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=671105058
flagg0=1209008128
flagh0=20
flagi0=136314885
flagj0=128
flagk0=4
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,29 @@
[target]
title0=Puma World Football
path0=D:\Games\pumawf98\WF.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207963648
flagh0=20
flagi0=138412036
flagj0=4224
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=16
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,31 @@
[target]
title0=Real War Air Land Sea
path0=D:\Games\Real War\REALWAR.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134234146
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
flagk0=0
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,28 @@
[target]
title0=Scrapland
path0=D:\Games\Scrapland\Bin\Scrap.exe
launchpath0=
module0=
opengllib0=
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,31 @@
[target]
title0=Sherlock Holmes The Mystery of The Mummy demo
path0=D:\Games\Sherlock Holmes demo\Sherlock Holmes- Level-1- Hall\game.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=136314914
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
flagk0=0
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,28 @@
[target]
title0=SimCity 3000
path0=D:\Games\SimCity 3000\Game\Sc3.exe
launchpath0=
module0=SIMCITY.DLL
opengllib0=
ver0=1
coord0=0
flag0=1746935842
flagg0=1811939328
flagh0=131092
flagi0=136314884
flagj0=8320
tflag0=6403
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

View File

@ -0,0 +1,29 @@
[target]
title0=Spirit Warrior
path0=D:\Games\spirit\SPIRIT.EXE
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134217762
flagg0=1744830464
flagh0=1044
flagi0=1212153862
flagj0=4224
tflag0=513
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

View File

@ -0,0 +1,29 @@
[target]
title0=The Hobbit(TM)
path0=d:\Games\The Hobbit(TM)\Meridian.exe
launchpath0=
module0=
opengllib0=
notes0=1 - If you want to set screen mode other than the default included (800x600) \nyou should run the game without the hook, set the preferred screenmode in-game, \nthen change it in DxDwnd before else you'll reset back to the initial mode set.\n\n2 - To get the game working it took some checking/unchecking for a bit. \nAll that's needed is to activated "Fix Parent Window" which this game seems \nto use the invisible window for it's execution (per DxWnd manual even though \nexperimental... it works) and set the direct x version to 8.
ver0=8
coord0=0
flag0=167772194
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,29 @@
[target]
title0=Viper Racing
path0=D:\Games\Viper Racing\SIERRA\Viper Racing\Data\race.bin
launchpath0=D:\Games\Viper Racing\SIERRA\Viper Racing\Viper Racing.exe
module0=
opengllib0=
notes0=
ver0=1
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=-2009071612
flagj0=4224
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -0,0 +1,31 @@
[target]
title0=Wars & Warriors: Joan of Arc
path0=D:\Games\Wars & Warriors Johan of Arc\joan.exe
launchpath0=
module0=
opengllib0=
notes0=
ver0=0
coord0=0
flag0=134217746
flagg0=1207959552
flagh0=20
flagi0=205520900
flagj0=4224
flagk0=0
tflag0=-2147477501
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=800
maxy0=600
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

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

29
build/exports/mdk 95.dxw Normal file
View File

@ -0,0 +1,29 @@
[target]
title0=mdk 95
path0=D:\Games\MDK\MDK95.EXE
launchpath0=
module0=
opengllib0=
notes0=Must manually set MDK.CFG hddata field with install game directory
ver0=0
coord0=0
flag0=134217762
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=12416
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1

View File

@ -793,4 +793,12 @@ fix: crash when setting "showFPS overlay" with DirectX "hybrid mode"
fix: "keep aspect ratio" with DirectX "GDI mode" fix: "keep aspect ratio" with DirectX "GDI mode"
fix: when ddraw hook is set to "none", no hook operations are performed on ddraw fix: when ddraw hook is set to "none", no hook operations are performed on ddraw
add: possibility to control the D3D8/9 SwapEffect field with the "force swap effect" flag add: possibility to control the D3D8/9 SwapEffect field with the "force swap effect" flag
fix: revised handling of GDI device context shared with DirectDraw primary surface, improved behaviour of "Star trek Armada" fix: revised handling of GDI device context shared with DirectDraw primary surface, improved behaviour of "Star trek Armada"
v2.03.20:
fix: revised hookers for kernel32 GetVersionExA/W api, adding support for dwPlatformId field
fix: texture handling for texture dump/hack/highlight
add: "Reserve legacy memory segments" compatibility flag, needed for "Crusaders of Might & Magic"
add: preliminary support for ddraw7 DirectDrawCreateClipper api
add: "Suppress main window destruction" flag, to make "Prince of Persia 3D" playable
fix: fully revised ddraw surface handling in d3d1-7 versions. Now "Might & Magic IX" is supported

View File

@ -18,7 +18,7 @@
#include "syslibs.h" #include "syslibs.h"
extern BOOL IsChangeDisplaySettingsHotPatched; extern BOOL IsChangeDisplaySettingsHotPatched;
BOOL bDontReleaseBackBuffer = FALSE; BOOL bIsWithinD3DCreateDevice = FALSE;
DWORD dwBackBufferCaps; DWORD dwBackBufferCaps;
extern void TextureHandling(LPDIRECTDRAWSURFACE); extern void TextureHandling(LPDIRECTDRAWSURFACE);
ColorConversion_Type pColorConversion = NULL; ColorConversion_Type pColorConversion = NULL;
@ -33,6 +33,7 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR
HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFIID, IUnknown FAR *); HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFIID, IUnknown FAR *);
HRESULT WINAPI extDirectDrawEnumerate(LPDDENUMCALLBACK, LPVOID); HRESULT WINAPI extDirectDrawEnumerate(LPDDENUMCALLBACK, LPVOID);
HRESULT WINAPI extDirectDrawEnumerateEx(LPDDENUMCALLBACKEX, LPVOID, DWORD); HRESULT WINAPI extDirectDrawEnumerateEx(LPDDENUMCALLBACKEX, LPVOID, DWORD);
HRESULT WINAPI extDirectDrawCreateClipper(DWORD, LPDIRECTDRAWCLIPPER *, IUnknown *);
// DirectDraw // DirectDraw
HRESULT WINAPI extQueryInterfaceD(void *, REFIID, LPVOID *); HRESULT WINAPI extQueryInterfaceD(void *, REFIID, LPVOID *);
@ -64,7 +65,6 @@ HRESULT WINAPI extTestCooperativeLevel(LPDIRECTDRAW);
// STDMETHOD(EvaluateMode)(THIS_ DWORD, DWORD * ) PURE; // STDMETHOD(EvaluateMode)(THIS_ DWORD, DWORD * ) PURE;
HRESULT WINAPI extGetCapsD(LPDIRECTDRAW, LPDDCAPS, LPDDCAPS); HRESULT WINAPI extGetCapsD(LPDIRECTDRAW, LPDDCAPS, LPDDCAPS);
// DirectDrawSurface // DirectDrawSurface
HRESULT WINAPI extQueryInterfaceS(void *, REFIID, LPVOID *); HRESULT WINAPI extQueryInterfaceS(void *, REFIID, LPVOID *);
HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE); HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE);
@ -130,6 +130,7 @@ DirectDrawCreate_Type pDirectDrawCreate = NULL;
DirectDrawCreateEx_Type pDirectDrawCreateEx = NULL; DirectDrawCreateEx_Type pDirectDrawCreateEx = NULL;
DirectDrawEnumerate_Type pDirectDrawEnumerate = NULL; DirectDrawEnumerate_Type pDirectDrawEnumerate = NULL;
DirectDrawEnumerateEx_Type pDirectDrawEnumerateEx = NULL; DirectDrawEnumerateEx_Type pDirectDrawEnumerateEx = NULL;
DirectDrawCreateClipper_Type pDirectDrawCreateClipper = NULL;
/* DirectDraw hook pointers */ /* DirectDraw hook pointers */
QueryInterface_Type pQueryInterfaceD; QueryInterface_Type pQueryInterfaceD;
@ -280,6 +281,7 @@ static HookEntry_Type ddHooks[]={
{HOOK_HOT_CANDIDATE, "DirectDrawCreateEx", (FARPROC)NULL, (FARPROC *)&pDirectDrawCreateEx, (FARPROC)extDirectDrawCreateEx}, {HOOK_HOT_CANDIDATE, "DirectDrawCreateEx", (FARPROC)NULL, (FARPROC *)&pDirectDrawCreateEx, (FARPROC)extDirectDrawCreateEx},
{HOOK_HOT_CANDIDATE, "DirectDrawEnumerateA", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerate, (FARPROC)extDirectDrawEnumerate}, {HOOK_HOT_CANDIDATE, "DirectDrawEnumerateA", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerate, (FARPROC)extDirectDrawEnumerate},
{HOOK_HOT_CANDIDATE, "DirectDrawEnumerateExA", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateEx, (FARPROC)extDirectDrawEnumerateEx}, {HOOK_HOT_CANDIDATE, "DirectDrawEnumerateExA", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateEx, (FARPROC)extDirectDrawEnumerateEx},
{HOOK_HOT_CANDIDATE, "DirectDrawCreateClipper", (FARPROC)NULL, (FARPROC *)&pDirectDrawCreateClipper, (FARPROC)extDirectDrawCreateClipper},
//{HOOK_IAT_CANDIDATE, "DirectDrawEnumerateW", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateW, (FARPROC)extDirectDrawCreate}, //{HOOK_IAT_CANDIDATE, "DirectDrawEnumerateW", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateW, (FARPROC)extDirectDrawCreate},
//{HOOK_IAT_CANDIDATE, "DirectDrawEnumerateExW", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateExW, (FARPROC)extDirectDrawCreate}, //{HOOK_IAT_CANDIDATE, "DirectDrawEnumerateExW", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateExW, (FARPROC)extDirectDrawCreate},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
@ -334,87 +336,9 @@ static void Stopper(char *s, int line)
#define STOPPER(s) #define STOPPER(s)
#endif #endif
static char *sFourCC(DWORD fcc)
{
static char sRet[5];
char c;
int i;
char *t=&sRet[0];
for(i=0; i<4; i++){
c = fcc & (0xFF);
*t++ = isprint(c) ? c : '.';
c = c >> 8;
}
*t = 0;
return sRet;
}
static char *DumpPixelFormat(LPDDSURFACEDESC2 lpddsd) static char *DumpPixelFormat(LPDDSURFACEDESC2 lpddsd)
{ {
static char sBuf[512]; return ExplainPixelFormat(&(lpddsd->ddpfPixelFormat));
char sItem[256];
DWORD flags=lpddsd->ddpfPixelFormat.dwFlags;
sprintf(sBuf, " PixelFormat flags=%x(%s) BPP=%d",
flags, ExplainPixelFormatFlags(flags), lpddsd->ddpfPixelFormat.dwRGBBitCount);
if (flags & DDPF_RGB) {
if (flags & DDPF_ALPHAPIXELS) {
sprintf(sItem, " RGBA=(%x,%x,%x,%x)",
lpddsd->ddpfPixelFormat.dwRBitMask,
lpddsd->ddpfPixelFormat.dwGBitMask,
lpddsd->ddpfPixelFormat.dwBBitMask,
lpddsd->ddpfPixelFormat.dwRGBAlphaBitMask);
}
else {
sprintf(sItem, " RGB=(%x,%x,%x)",
lpddsd->ddpfPixelFormat.dwRBitMask,
lpddsd->ddpfPixelFormat.dwGBitMask,
lpddsd->ddpfPixelFormat.dwBBitMask);
}
strcat(sBuf, sItem);
}
if (flags & DDPF_YUV) {
sprintf(sItem, " YUVA=(%x,%x,%x,%x)",
lpddsd->ddpfPixelFormat.dwYBitMask,
lpddsd->ddpfPixelFormat.dwUBitMask,
lpddsd->ddpfPixelFormat.dwVBitMask,
lpddsd->ddpfPixelFormat.dwYUVAlphaBitMask);
strcat(sBuf, sItem);
}
if (flags & DDPF_ZBUFFER) {
sprintf(sItem, " SdZSbL=(%x,%x,%x,%x)",
lpddsd->ddpfPixelFormat.dwStencilBitDepth,
lpddsd->ddpfPixelFormat.dwZBitMask,
lpddsd->ddpfPixelFormat.dwStencilBitMask,
lpddsd->ddpfPixelFormat.dwLuminanceAlphaBitMask);
strcat(sBuf, sItem);
}
if (flags & DDPF_ALPHA) {
sprintf(sItem, " LBdBlZ=(%x,%x,%x,%x)",
lpddsd->ddpfPixelFormat.dwLuminanceBitMask,
lpddsd->ddpfPixelFormat.dwBumpDvBitMask,
lpddsd->ddpfPixelFormat.dwBumpLuminanceBitMask,
lpddsd->ddpfPixelFormat.dwRGBZBitMask);
strcat(sBuf, sItem);
}
if (flags & DDPF_LUMINANCE) {
sprintf(sItem, " BMbMF=(%x,%x,%x,%x)",
lpddsd->ddpfPixelFormat.dwBumpDuBitMask,
lpddsd->ddpfPixelFormat.MultiSampleCaps.wBltMSTypes,
lpddsd->ddpfPixelFormat.MultiSampleCaps.wFlipMSTypes,
lpddsd->ddpfPixelFormat.dwYUVZBitMask);
strcat(sBuf, sItem);
}
if (flags & DDPF_BUMPDUDV) {
sprintf(sItem, " O=(%x)",
lpddsd->ddpfPixelFormat.dwOperations);
strcat(sBuf, sItem);
}
if (flags & DDPF_FOURCC) {
sprintf(sItem, " FourCC=%x(%s)",
lpddsd->ddpfPixelFormat.dwFourCC, sFourCC(lpddsd->ddpfPixelFormat.dwFourCC));
strcat(sBuf, sItem);
}
return sBuf;
} }
static CHAR *LogSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line) static CHAR *LogSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line)
@ -1410,9 +1334,6 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion)
SetHook((void *)(**(DWORD **)lplpdds + 128), extUnlockDir4, (void **)&pUnlock4, "Unlock(S4)"); SetHook((void *)(**(DWORD **)lplpdds + 128), extUnlockDir4, (void **)&pUnlock4, "Unlock(S4)");
} }
if (dxversion == 7)
SetHook((void *)(**(DWORD **)lplpdds + 156), extSetSurfaceDesc, (void **)&pSetSurfaceDesc, "SetSurfaceDesc(S3)");
if (!(dxw.dwTFlags & OUTPROXYTRACE)) return; if (!(dxw.dwTFlags & OUTPROXYTRACE)) return;
// just proxed .... // just proxed ....
@ -1454,6 +1375,9 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion)
SetHook((void *)(**(DWORD **)lplpdds + 136), extUpdateOverlayDisplayProxy, (void **)&pUpdateOverlayDisplay, "UpdateOverlayDisplay(S)"); SetHook((void *)(**(DWORD **)lplpdds + 136), extUpdateOverlayDisplayProxy, (void **)&pUpdateOverlayDisplay, "UpdateOverlayDisplay(S)");
// IDirectDrawSurface::UpdateOverlayZOrder // IDirectDrawSurface::UpdateOverlayZOrder
SetHook((void *)(**(DWORD **)lplpdds + 140), extUpdateOverlayZOrderProxy, (void **)&pUpdateOverlayZOrder, "UpdateOverlayZOrder(S)"); SetHook((void *)(**(DWORD **)lplpdds + 140), extUpdateOverlayZOrderProxy, (void **)&pUpdateOverlayZOrder, "UpdateOverlayZOrder(S)");
if (dxversion == 7)
SetHook((void *)(**(DWORD **)lplpdds + 156), extSetSurfaceDesc, (void **)&pSetSurfaceDesc, "SetSurfaceDesc(S3)");
} }
static void HookGammaControl(LPVOID *obp) static void HookGammaControl(LPVOID *obp)
@ -1866,11 +1790,11 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp)
unsigned int dwLocalDDVersion; unsigned int dwLocalDDVersion;
unsigned int dwLocalTexVersion; unsigned int dwLocalTexVersion;
OutTraceDDRAW("QueryInterface(S): lpdds=%x REFIID=%x(%s) obp=%x\n",
lpdds, riid.Data1, ExplainGUID((GUID *)&riid), *obp);
IsPrim=dxw.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds); IsPrim=dxw.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds);
IsBack=dxw.IsABackBufferSurface((LPDIRECTDRAWSURFACE)lpdds); IsBack=dxw.IsABackBufferSurface((LPDIRECTDRAWSURFACE)lpdds);
OutTraceDDRAW("QueryInterface(S): lpdds=%x%s REFIID=%x(%s)\n",
lpdds, dxw.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds), riid.Data1, ExplainGUID((GUID *)&riid));
IsGammaRamp=FALSE; IsGammaRamp=FALSE;
dwLocalDDVersion=0; dwLocalDDVersion=0;
@ -2120,6 +2044,7 @@ HRESULT WINAPI extGetDisplayMode(LPDIRECTDRAW lpdd, LPDDSURFACEDESC lpddsd)
HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags) HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags)
{ {
HRESULT res; HRESULT res;
BOOL bFixFrame = FALSE;
OutTraceDDRAW("SetCooperativeLevel: lpdd=%x hwnd=%x dwFlags=%x(%s)\n", OutTraceDDRAW("SetCooperativeLevel: lpdd=%x hwnd=%x dwFlags=%x(%s)\n",
lpdd, hwnd, dwflags,ExplainCoopFlags(dwflags)); lpdd, hwnd, dwflags,ExplainCoopFlags(dwflags));
@ -2143,9 +2068,7 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags)
dxw.SetFullScreen(TRUE); dxw.SetFullScreen(TRUE);
dwflags &= ~(DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX); dwflags &= ~(DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX);
dwflags |= DDSCL_NORMAL; dwflags |= DDSCL_NORMAL;
res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); bFixFrame = TRUE;
AdjustWindowFrame(hwnd, dxw.GetScreenWidth(), dxw.GetScreenHeight());
if (dxw.dwFlags1 & FIXWINFRAME) dxw.FixWindowFrame(hwnd);
} }
else{ else{
RECT client; RECT client;
@ -2153,17 +2076,25 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags)
// v2.02.11: // v2.02.11:
// Non fullscreen cooperative mode means windowed, unless the window occupies the whole desktop area // Non fullscreen cooperative mode means windowed, unless the window occupies the whole desktop area
dxw.SetFullScreen(client.right==dxw.iSizX && client.bottom==dxw.iSizY); dxw.SetFullScreen(client.right==dxw.iSizX && client.bottom==dxw.iSizY);
//dxw.SetFullScreen(FALSE);
res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags);
} }
} }
else {
res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags);
}
if(res) res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags);
if(res){
if(res == DDERR_INVALIDPARAMS){
//hwnd = GetForegroundWindow();
PostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0);
Sleep(1000);
res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags);
}
OutTraceE("SetCooperativeLevel: ERROR lpdd=%x hwnd=%x Flags=%x err=%x(%s) at %d\n", OutTraceE("SetCooperativeLevel: ERROR lpdd=%x hwnd=%x Flags=%x err=%x(%s) at %d\n",
lpdd, hwnd, dwflags, res, ExplainDDError(res), __LINE__); lpdd, hwnd, dwflags, res, ExplainDDError(res), __LINE__);
}
if(bFixFrame){
AdjustWindowFrame(hwnd, dxw.GetScreenWidth(), dxw.GetScreenHeight());
if (dxw.dwFlags1 & FIXWINFRAME) dxw.FixWindowFrame(hwnd);
}
GetHookInfo()->IsFullScreen=dxw.IsFullScreen(); GetHookInfo()->IsFullScreen=dxw.IsFullScreen();
@ -3706,12 +3637,11 @@ HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFAC
HRESULT res; HRESULT res;
BOOL IsPrim; BOOL IsPrim;
BOOL IsBack; BOOL IsBack;
RECT rect;
IsPrim=dxw.IsAPrimarySurface(lpdds); IsPrim=dxw.IsAPrimarySurface(lpdds);
IsBack=dxw.IsABackBufferSurface(lpdds); IsBack=dxw.IsABackBufferSurface(lpdds);
if ((dxversion == 4) && lprect) CleanRect(&lprect,__LINE__);
if(IsTraceDDRAW){ if(IsTraceDDRAW){
char sRect[81]; char sRect[81];
if (dxversion == 4){ if (dxversion == 4){
@ -3723,6 +3653,18 @@ HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFAC
OutTrace("Unlock(%d): lpdds=%x%s %s\n", dxversion, lpdds, (IsPrim ? "(PRIM)": (IsBack ? "(BACK)" : "")), sRect); OutTrace("Unlock(%d): lpdds=%x%s %s\n", dxversion, lpdds, (IsPrim ? "(PRIM)": (IsBack ? "(BACK)" : "")), sRect);
} }
if(dxversion == 4){
// make lprect point elsewhere, so that the original values are not altered
if(lprect){
CleanRect(&lprect,__LINE__);
rect = *lprect;
lprect = &rect;
// v2.03.20: apparently, it seems that in ddraw 7 you can set an empty rectangle to mean the whole area ....
// this fixes the black screen otherwise present in "Arcanum".
if(IsPrim && ((lprect->right - lprect->left) == 0) && ((lprect->bottom - lprect->top) == 0)) lprect = NULL;
}
}
res=(*pUnlock)(lpdds, lprect); res=(*pUnlock)(lpdds, lprect);
if (IsPrim && res==DD_OK) { if (IsPrim && res==DD_OK) {
if(dxversion == 1) lprect=NULL; if(dxversion == 1) lprect=NULL;
@ -4190,17 +4132,14 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds)
IsPrim=dxw.IsAPrimarySurface(lpdds); IsPrim=dxw.IsAPrimarySurface(lpdds);
IsBack=dxw.IsABackBufferSurface(lpdds); IsBack=dxw.IsABackBufferSurface(lpdds);
if(IsBack && bDontReleaseBackBuffer){ res = (*pReleaseS)(lpdds);
OutTraceDDRAW("Release(S): SKIP RELEASE on lpdds=%x\n", lpdds);
res = 0;
}
else
res = (*pReleaseS)(lpdds);
OutTraceDDRAW("Release(S): lpdds=%x%s refcount=%d\n", lpdds, IsPrim?"(PRIM)":(IsBack?"(BACK)":""), res); OutTraceDDRAW("Release(S): lpdds=%x%s refcount=%d\n", lpdds, dxw.ExplainSurfaceRole(lpdds), res);
if (res==0) { // common precondition if (res==0) { // common precondition
// erase surface from primary or backbuffer list // erase surface from primary or backbuffer list
if(IsPrim || IsBack) dxw.MarkRegularSurface(lpdds); // v2-03-20: d3d 1-7 play a dirty trick: it Release the surface passed as argument until refcount == 0,
// but then rebuilds it with the original attributes! So, better not forget them.
if(!bIsWithinD3DCreateDevice && (IsPrim || IsBack)) dxw.MarkRegularSurface(lpdds);
// when releasing primary surface, erase clipping region // when releasing primary surface, erase clipping region
if(IsPrim && (dxw.dwFlags1 & CLIPCURSOR)) dxw.EraseClipCursor(); if(IsPrim && (dxw.dwFlags1 & CLIPCURSOR)) dxw.EraseClipCursor();
@ -4894,6 +4833,19 @@ HRESULT WINAPI extSetSurfaceDesc(LPDIRECTDRAWSURFACE lpdds, LPDDSURFACEDESC lpDD
HRESULT res; HRESULT res;
OutTrace("SetSurfaceDesc: REACHED\n"); OutTrace("SetSurfaceDesc: REACHED\n");
res = (*pSetSurfaceDesc)(lpdds, lpDDsd2, dwFlags); res = (*pSetSurfaceDesc)(lpdds, lpDDsd2, dwFlags);
OutTraceE("SetSurfaceDesc: ERROR res=%x(%s)\n", res, ExplainDDError(res)); if(res) OutTraceE("SetSurfaceDesc: ERROR res=%x(%s)\n", res, ExplainDDError(res));
return res; return res;
} }
HRESULT WINAPI extDirectDrawCreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, IUnknown *pUnkOuter)
{
HRESULT res;
OutTraceDW("DirectDrawCreateClipper: flags=%x\n", dwFlags);
res = (*pDirectDrawCreateClipper)(dwFlags, lplpDDClipper, pUnkOuter);
if(res) {
OutTraceE("DirectDrawCreateClipper: ERROR res=%x(%s)\n", res, ExplainDDError(res));
return res;
}
HookDDClipper(lplpDDClipper);
return res;
}

View File

@ -37,17 +37,22 @@ static unsigned int Hash(BYTE *buf, int len)
unsigned int HashSurface(BYTE *buf, int pitch, int width, int height) unsigned int HashSurface(BYTE *buf, int pitch, int width, int height)
{ {
unsigned int b = 378551; unsigned int b = 378551;
unsigned int a = 63689; unsigned int a = 63689;
DWORD hash = 0; int pixelsize;
for(int y = 0; y < height; y++){ DWORD hash = 0;
BYTE *p = buf + (y * pitch); // integer divide, intentionally throwing reminder away
for(int x = 0; x < width; x++){ pixelsize = pitch / width;
hash = hash * a + p[x]; for(int y = 0; y < height; y++){
a = a * b; BYTE *p = buf + (y * pitch);
} for(int x = 0; x < width; x++){
} for(int pixelbyte = 0; pixelbyte < pixelsize; pixelbyte++){
return hash; hash = (hash * a) + (*p++);
a = a * b;
}
}
}
return hash;
} }
static char *SurfaceType(DDPIXELFORMAT ddpfPixelFormat) static char *SurfaceType(DDPIXELFORMAT ddpfPixelFormat)

View File

@ -1803,3 +1803,86 @@ char *ExplainDDError(DWORD c)
} }
return eb; return eb;
} }
static char *sFourCC(DWORD fcc)
{
static char sRet[5];
char c;
int i;
char *t=&sRet[0];
for(i=0; i<4; i++){
c = fcc & (0xFF);
*t++ = isprint(c) ? c : '.';
c = c >> 8;
}
*t = 0;
return sRet;
}
char *ExplainPixelFormat(LPDDPIXELFORMAT ddpfPixelFormat)
{
static char sBuf[512];
char sItem[256];
DWORD flags=ddpfPixelFormat->dwFlags;
sprintf(sBuf, " PixelFormat flags=%x(%s) BPP=%d",
flags, ExplainPixelFormatFlags(flags), ddpfPixelFormat->dwRGBBitCount);
if (flags & DDPF_RGB) {
if (flags & DDPF_ALPHAPIXELS) {
sprintf(sItem, " RGBA=(%x,%x,%x,%x)",
ddpfPixelFormat->dwRBitMask,
ddpfPixelFormat->dwGBitMask,
ddpfPixelFormat->dwBBitMask,
ddpfPixelFormat->dwRGBAlphaBitMask);
}
else {
sprintf(sItem, " RGB=(%x,%x,%x)",
ddpfPixelFormat->dwRBitMask,
ddpfPixelFormat->dwGBitMask,
ddpfPixelFormat->dwBBitMask);
}
strcat(sBuf, sItem);
}
if (flags & DDPF_YUV) {
sprintf(sItem, " YUVA=(%x,%x,%x,%x)",
ddpfPixelFormat->dwYBitMask,
ddpfPixelFormat->dwUBitMask,
ddpfPixelFormat->dwVBitMask,
ddpfPixelFormat->dwYUVAlphaBitMask);
strcat(sBuf, sItem);
}
if (flags & DDPF_ZBUFFER) {
sprintf(sItem, " SdZSbL=(%x,%x,%x,%x)",
ddpfPixelFormat->dwStencilBitDepth,
ddpfPixelFormat->dwZBitMask,
ddpfPixelFormat->dwStencilBitMask,
ddpfPixelFormat->dwLuminanceAlphaBitMask);
strcat(sBuf, sItem);
}
if (flags & DDPF_ALPHA) {
sprintf(sItem, " LBdBlZ=(%x,%x,%x,%x)",
ddpfPixelFormat->dwLuminanceBitMask,
ddpfPixelFormat->dwBumpDvBitMask,
ddpfPixelFormat->dwBumpLuminanceBitMask,
ddpfPixelFormat->dwRGBZBitMask);
strcat(sBuf, sItem);
}
if (flags & DDPF_LUMINANCE) {
sprintf(sItem, " BMbMF=(%x,%x,%x,%x)",
ddpfPixelFormat->dwBumpDuBitMask,
ddpfPixelFormat->MultiSampleCaps.wBltMSTypes,
ddpfPixelFormat->MultiSampleCaps.wFlipMSTypes,
ddpfPixelFormat->dwYUVZBitMask);
strcat(sBuf, sItem);
}
if (flags & DDPF_BUMPDUDV) {
sprintf(sItem, " O=(%x)",
ddpfPixelFormat->dwOperations);
strcat(sBuf, sItem);
}
if (flags & DDPF_FOURCC) {
sprintf(sItem, " FourCC=%x(%s)",
ddpfPixelFormat->dwFourCC, sFourCC(ddpfPixelFormat->dwFourCC));
strcat(sBuf, sItem);
}
return sBuf;
}

View File

@ -51,4 +51,5 @@ extern char *ExplainRenderstateValue(DWORD);
extern char *ExplainWfPFlags(DWORD); extern char *ExplainWfPFlags(DWORD);
extern char *ExplainChangeDisplaySettingsFlags(DWORD); extern char *ExplainChangeDisplaySettingsFlags(DWORD);
extern char *ExplainDICooperativeFlags(DWORD); extern char *ExplainDICooperativeFlags(DWORD);
extern char *ExplainRegionType(DWORD); extern char *ExplainRegionType(DWORD);
extern char *ExplainPixelFormat(LPDDPIXELFORMAT);

View File

@ -103,7 +103,7 @@ static char *Flag5Names[32]={
}; };
static char *Flag6Names[32]={ static char *Flag6Names[32]={
"FORCESWAPEFFECT", "", "", "", "FORCESWAPEFFECT", "LEGACYALLOC", "NODESTROYWINDOW", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
@ -1654,6 +1654,15 @@ DWORD WINAPI MessagePoller(LPVOID lpParameter)
return 0; return 0;
} }
static void MemoryReserve()
{
VirtualAlloc((LPVOID)0x4000000, 0x04000000, MEM_RESERVE, PAGE_READWRITE);
VirtualAlloc((LPVOID)0x5000000, 0x00F00000, MEM_RESERVE, PAGE_READWRITE);
VirtualAlloc((LPVOID)0x6000000, 0x00F00000, MEM_RESERVE, PAGE_READWRITE);
VirtualAlloc((LPVOID)0x7000000, 0x00F00000, MEM_RESERVE, PAGE_READWRITE);
VirtualAlloc((LPVOID)0x8000000, 0x00F00000, MEM_RESERVE, PAGE_READWRITE);
}
void HookInit(TARGETMAP *target, HWND hwnd) void HookInit(TARGETMAP *target, HWND hwnd)
{ {
HMODULE base; HMODULE base;
@ -1667,9 +1676,12 @@ void HookInit(TARGETMAP *target, HWND hwnd)
static char *Resolutions[]={ static char *Resolutions[]={
"unlimited", "320x200", "400x300", "640x480", "800x600", "1024x768", "1280x960", "" // terminator "unlimited", "320x200", "400x300", "640x480", "800x600", "1024x768", "1280x960", "" // terminator
}; };
dxw.InitTarget(target); dxw.InitTarget(target);
// reserve legacy memory segments
if(dxw.dwFlags6 & LEGACYALLOC) MemoryReserve();
// add the DxWnd install dir to the search path, to make all included dll linkable // add the DxWnd install dir to the search path, to make all included dll linkable
DWORD dwAttrib; DWORD dwAttrib;
dwAttrib = GetFileAttributes("dxwnd.dll"); dwAttrib = GetFileAttributes("dxwnd.dll");

View File

@ -228,6 +228,25 @@ void dxwCore::DumpDesktopStatus()
// Primary surfaces auxiliary functions // Primary surfaces auxiliary functions
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
char *dxwCore::ExplainSurfaceRole(LPDIRECTDRAWSURFACE ps)
{
int i;
for (i=0;i<DDSQLEN;i++) {
if (PrimSurfaces[i]==(DWORD)ps) return "(PRIM)";
if (PrimSurfaces[i]==0) break;
}
for (i=0;i<DDSQLEN;i++) {
if (BackSurfaces[i]==(DWORD)ps) return "(BACK)";
if (BackSurfaces[i]==0) break;
}
// this should NEVER happen, but ...
extern LPDIRECTDRAWSURFACE lpDDSEmu_Back, lpDDSEmu_Prim;
if(lpDDSEmu_Back && (ps==lpDDSEmu_Back)) return "(emu.BACK)";
if(lpDDSEmu_Prim && (ps==lpDDSEmu_Prim)) return "(emu.PRIM)";
// ... just in case!
return "";
}
void dxwCore::UnmarkPrimarySurface(LPDIRECTDRAWSURFACE ps) void dxwCore::UnmarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
{ {
int i; int i;

View File

@ -79,6 +79,7 @@ public: // methods
BOOL HandleFPS(void); BOOL HandleFPS(void);
BOOL ishWndFPS(HWND); BOOL ishWndFPS(HWND);
DWORD GetTickCount(void); DWORD GetTickCount(void);
char *ExplainSurfaceRole(LPDIRECTDRAWSURFACE);
void MarkPrimarySurface(LPDIRECTDRAWSURFACE); void MarkPrimarySurface(LPDIRECTDRAWSURFACE);
BOOL IsAPrimarySurface(LPDIRECTDRAWSURFACE); BOOL IsAPrimarySurface(LPDIRECTDRAWSURFACE);
LPDIRECTDRAWSURFACE GetPrimarySurface(void); LPDIRECTDRAWSURFACE GetPrimarySurface(void);

View File

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

Binary file not shown.

View File

@ -17,6 +17,9 @@
#define HOOKD3D10ANDLATER 1 #define HOOKD3D10ANDLATER 1
#define TRACEALLMETHODS 1 #define TRACEALLMETHODS 1
extern void D3D9TextureHandling(void *, int);
extern void D3D8TextureHandling(void *, int);
typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID riid, void** ppvObj); typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID riid, void** ppvObj);
// D3D8/9 API // D3D8/9 API
@ -112,7 +115,11 @@ typedef HRESULT (WINAPI *EndStateBlock8_Type)(void *, DWORD *);
typedef HRESULT (WINAPI *EndStateBlock9_Type)(void *, IDirect3DStateBlock9**); typedef HRESULT (WINAPI *EndStateBlock9_Type)(void *, IDirect3DStateBlock9**);
typedef HRESULT (WINAPI *CreateTexture8_Type)(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **); typedef HRESULT (WINAPI *CreateTexture8_Type)(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **);
typedef HRESULT (WINAPI *CreateTexture9_Type)(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **, HANDLE *); typedef HRESULT (WINAPI *CreateTexture9_Type)(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **, HANDLE *);
#ifdef DXWNDDISABLEDHOOKS
typedef HRESULT (WINAPI *CopyRects_Type)(void *, void *, CONST RECT *, UINT, void *, CONST POINT *); typedef HRESULT (WINAPI *CopyRects_Type)(void *, void *, CONST RECT *, UINT, void *, CONST POINT *);
typedef HRESULT (WINAPI *UpdateSurface_Type)(void *, IDirect3DSurface9 *, CONST RECT *, IDirect3DSurface9 *, CONST POINT *);
typedef HRESULT (WINAPI *UpdateTexture_Type)(void *, IDirect3DBaseTexture9 *, IDirect3DBaseTexture9 *);
#endif
UINT WINAPI extGetAvailableTextureMem(void *); UINT WINAPI extGetAvailableTextureMem(void *);
HRESULT WINAPI extTestCooperativeLevel(void *); HRESULT WINAPI extTestCooperativeLevel(void *);
@ -133,7 +140,11 @@ HRESULT WINAPI extEndStateBlock8(void *, DWORD *);
HRESULT WINAPI extEndStateBlock9(void *, IDirect3DStateBlock9**); HRESULT WINAPI extEndStateBlock9(void *, IDirect3DStateBlock9**);
HRESULT WINAPI extCreateTexture8(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **); HRESULT WINAPI extCreateTexture8(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **);
HRESULT WINAPI extCreateTexture9(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **, HANDLE *); HRESULT WINAPI extCreateTexture9(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **, HANDLE *);
#ifdef DXWNDDISABLEDHOOKS
HRESULT WINAPI extCopyRects(void *, void *, CONST RECT *, UINT, void *, CONST POINT *); HRESULT WINAPI extCopyRects(void *, void *, CONST RECT *, UINT, void *, CONST POINT *);
HRESULT WINAPI extUpdateSurface(void *, IDirect3DSurface9 *, CONST RECT *, IDirect3DSurface9 *, CONST POINT *);
HRESULT WINAPI extUpdateTexture(void *, IDirect3DBaseTexture9 *, IDirect3DBaseTexture9 *);
#endif
GetAvailableTextureMem_Type pGetAvailableTextureMem = 0; GetAvailableTextureMem_Type pGetAvailableTextureMem = 0;
TestCooperativeLevel_Type pTestCooperativeLevel = 0; TestCooperativeLevel_Type pTestCooperativeLevel = 0;
@ -154,19 +165,38 @@ EndStateBlock8_Type pEndStateBlock8 = 0;
EndStateBlock9_Type pEndStateBlock9 = 0; EndStateBlock9_Type pEndStateBlock9 = 0;
CreateTexture8_Type pCreateTexture8 = 0; CreateTexture8_Type pCreateTexture8 = 0;
CreateTexture9_Type pCreateTexture9 = 0; CreateTexture9_Type pCreateTexture9 = 0;
#ifdef DXWNDDISABLEDHOOKS
CopyRects_Type pCopyRects = 0; CopyRects_Type pCopyRects = 0;
UpdateSurface_Type pUpdateSurface = NULL;
UpdateTexture_Type pUpdateTexture = NULL;
#endif
// IDirect3DTexture8/9 methods // IDirect3DTexture8/9 methods
typedef HRESULT (WINAPI *LockRect_Type)(void *, UINT, D3DLOCKED_RECT *, CONST RECT *, DWORD); typedef HRESULT (WINAPI *LockRect_Type)(void *, UINT, D3DLOCKED_RECT *, CONST RECT *, DWORD);
typedef HRESULT (WINAPI *UnlockRect_Type)(void *, UINT); typedef HRESULT (WINAPI *UnlockRect_Type)(void *, UINT);
#ifdef DXWNDDISABLEDHOOKS
typedef HRESULT (WINAPI *GetSurfaceLevel_Type)(void *, UINT, IDirect3DSurface9**);
typedef HRESULT (WINAPI *SetPrivateData_Type)(void *, REFGUID, CONST void *, DWORD, DWORD);
typedef HRESULT (WINAPI *QueryInterfaceTex_Type)(void *, REFIID, void**);
#endif
HRESULT WINAPI extLockRect(void *, UINT, D3DLOCKED_RECT *, CONST RECT *, DWORD); HRESULT WINAPI extLockRect(void *, UINT, D3DLOCKED_RECT *, CONST RECT *, DWORD);
HRESULT WINAPI extUnlockRect8(void *, UINT); HRESULT WINAPI extUnlockRect8(void *, UINT);
HRESULT WINAPI extUnlockRect9(void *, UINT); HRESULT WINAPI extUnlockRect9(void *, UINT);
#ifdef DXWNDDISABLEDHOOKS
HRESULT WINAPI extGetSurfaceLevel9(void *, UINT, IDirect3DSurface9**);
HRESULT WINAPI extSetPrivateData(void *, REFGUID, CONST void *, DWORD, DWORD);
HRESULT WINAPI extQueryInterfaceTex(void *, REFIID, void**);
#endif
LockRect_Type pLockRect = NULL; LockRect_Type pLockRect = NULL;
UnlockRect_Type pUnlockRect = NULL; UnlockRect_Type pUnlockRect = NULL;
#ifdef DXWNDDISABLEDHOOKS
GetSurfaceLevel_Type pGetSurfaceLevel9 = NULL;
SetPrivateData_Type pSetPrivateData = NULL;
QueryInterfaceTex_Type pQueryInterfaceTex = NULL;
#endif
// to sort ... // to sort ...
@ -460,8 +490,8 @@ void HookD3DDevice8(void** ppD3Ddev8)
} }
if(dxw.dwFlags5 & TEXTUREMASK){ if(dxw.dwFlags5 & TEXTUREMASK){
SetHook((void *)(**(DWORD **)ppD3Ddev8 + 80), extCreateTexture8, (void **)&pCreateTexture8, "CreateTexture(D8)"); SetHook((void *)(**(DWORD **)ppD3Ddev8 + 80), extCreateTexture8, (void **)&pCreateTexture8, "CreateTexture(D8)");
//SetHook((void *)(**(DWORD **)ppD3Ddev8 + 112), extCopyRects, (void **)&pCopyRects, "CopyRects(D8)");
} }
//SetHook((void *)(**(DWORD **)ppD3Ddev8 + 112), extCopyRects, (void **)&pCopyRects, "CopyRects(D8)");
SetHook((void *)(**(DWORD **)ppD3Ddev8 + 100), extCreateRenderTarget8, (void **)&pCreateRenderTarget8, "CreateRenderTarget(D8)"); SetHook((void *)(**(DWORD **)ppD3Ddev8 + 100), extCreateRenderTarget8, (void **)&pCreateRenderTarget8, "CreateRenderTarget(D8)");
SetHook((void *)(**(DWORD **)ppD3Ddev8 + 136), extBeginScene8, (void **)&pBeginScene8, "BeginScene(D8)"); SetHook((void *)(**(DWORD **)ppD3Ddev8 + 136), extBeginScene8, (void **)&pBeginScene8, "BeginScene(D8)");
SetHook((void *)(**(DWORD **)ppD3Ddev8 + 140), extEndScene8, (void **)&pEndScene8, "EndScene(D8)"); SetHook((void *)(**(DWORD **)ppD3Ddev8 + 140), extEndScene8, (void **)&pEndScene8, "EndScene(D8)");
@ -475,7 +505,9 @@ void HookD3DDevice8(void** ppD3Ddev8)
} }
SetHook((void *)(**(DWORD **)ppD3Ddev8 + 208), extBeginStateBlock8, (void **)&pBeginStateBlock8, "BeginStateBlock(D8)"); SetHook((void *)(**(DWORD **)ppD3Ddev8 + 208), extBeginStateBlock8, (void **)&pBeginStateBlock8, "BeginStateBlock(D8)");
SetHook((void *)(**(DWORD **)ppD3Ddev8 + 212), extEndStateBlock8, (void **)&pEndStateBlock8, "EndStateBlock(D8)"); SetHook((void *)(**(DWORD **)ppD3Ddev8 + 212), extEndStateBlock8, (void **)&pEndStateBlock8, "EndStateBlock(D8)");
if (dxw.dwFlags4 & NOTEXTURES) SetHook((void *)(**(DWORD **)ppD3Ddev8 + 244), extSetTexture8, (void **)&pSetTexture8, "SetTexture(D8)"); if((dxw.dwFlags5 & TEXTUREMASK) || (dxw.dwFlags4 & NOTEXTURES)){
SetHook((void *)(**(DWORD **)ppD3Ddev8 + 244), extSetTexture8, (void **)&pSetTexture8, "SetTexture(D8)");
}
//if (!(dxw.dwTFlags & OUTPROXYTRACE)) return; //if (!(dxw.dwTFlags & OUTPROXYTRACE)) return;
//SetHook((void *)(**(DWORD **)ppD3Ddev8 + 4), extAddRef8, (void **)&pAddRef8, "AddRef(D8)"); //SetHook((void *)(**(DWORD **)ppD3Ddev8 + 4), extAddRef8, (void **)&pAddRef8, "AddRef(D8)");
//SetHook((void *)(**(DWORD **)ppD3Ddev8 + 8), extRelease8, (void **)&pRelease8, "Release(D8)"); //SetHook((void *)(**(DWORD **)ppD3Ddev8 + 8), extRelease8, (void **)&pRelease8, "Release(D8)");
@ -503,6 +535,11 @@ void HookD3DDevice9(void** ppD3Ddev9)
if(dxw.dwFlags5 & TEXTUREMASK){ if(dxw.dwFlags5 & TEXTUREMASK){
SetHook((void *)(**(DWORD **)ppD3Ddev9 + 92), extCreateTexture9, (void **)&pCreateTexture9, "CreateTexture(D9)"); SetHook((void *)(**(DWORD **)ppD3Ddev9 + 92), extCreateTexture9, (void **)&pCreateTexture9, "CreateTexture(D9)");
} }
#ifdef DXWNDDISABLEDHOOKS
SetHook((void *)(**(DWORD **)ppD3Ddev9 + 120), extUpdateSurface, (void **)&pUpdateSurface, "UpdateSurface(D9)");
SetHook((void *)(**(DWORD **)ppD3Ddev9 + 124), extUpdateTexture, (void **)&pUpdateTexture, "UpdateTexture(D9)");
#endif
SetHook((void *)(**(DWORD **)ppD3Ddev9 + 164), extBeginScene9, (void **)&pBeginScene9, "BeginScene(D9)"); SetHook((void *)(**(DWORD **)ppD3Ddev9 + 164), extBeginScene9, (void **)&pBeginScene9, "BeginScene(D9)");
SetHook((void *)(**(DWORD **)ppD3Ddev9 + 168), extEndScene9, (void **)&pEndScene9, "EndScene(D9)"); SetHook((void *)(**(DWORD **)ppD3Ddev9 + 168), extEndScene9, (void **)&pEndScene9, "EndScene(D9)");
//SetHook((void *)(**(DWORD **)ppD3Ddev9 +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)"); //SetHook((void *)(**(DWORD **)ppD3Ddev9 +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)");
@ -517,7 +554,7 @@ void HookD3DDevice9(void** ppD3Ddev9)
} }
SetHook((void *)(**(DWORD **)ppD3Ddev9 + 240), extBeginStateBlock9, (void **)&pBeginStateBlock9, "BeginStateBlock(D9)"); SetHook((void *)(**(DWORD **)ppD3Ddev9 + 240), extBeginStateBlock9, (void **)&pBeginStateBlock9, "BeginStateBlock(D9)");
SetHook((void *)(**(DWORD **)ppD3Ddev9 + 244), extEndStateBlock9, (void **)&pEndStateBlock9, "EndStateBlock(D9)"); SetHook((void *)(**(DWORD **)ppD3Ddev9 + 244), extEndStateBlock9, (void **)&pEndStateBlock9, "EndStateBlock(D9)");
if (dxw.dwFlags4 & NOTEXTURES) { if((dxw.dwFlags5 & TEXTUREMASK) || (dxw.dwFlags4 & NOTEXTURES)){
SetHook((void *)(**(DWORD **)ppD3Ddev9 + 260), extSetTexture9, (void **)&pSetTexture9, "SetTexture(D9)"); SetHook((void *)(**(DWORD **)ppD3Ddev9 + 260), extSetTexture9, (void **)&pSetTexture9, "SetTexture(D9)");
} }
if (!(dxw.dwTFlags & OUTPROXYTRACE)) return; if (!(dxw.dwTFlags & OUTPROXYTRACE)) return;
@ -536,8 +573,13 @@ void HookD3DTexture8(void** ppD3Dtex8)
void HookD3DTexture9(void** ppD3Dtex9) void HookD3DTexture9(void** ppD3Dtex9)
{ {
OutTraceD3D("Device hook for IDirect3DTexture9 interface\n"); OutTraceD3D("Device hook for IDirect3DTexture9 interface\n");
SetHook((void *)(**(DWORD **)ppD3Dtex9 + 76), extLockRect, (void **)&pLockRect, "LockRect(D9)"); SetHook((void *)(**(DWORD **)ppD3Dtex9 + 76), extLockRect, (void **)&pLockRect, "LockRect(T9)");
SetHook((void *)(**(DWORD **)ppD3Dtex9 + 80), extUnlockRect9, (void **)&pUnlockRect, "UnlockRect(D9)"); SetHook((void *)(**(DWORD **)ppD3Dtex9 + 80), extUnlockRect9, (void **)&pUnlockRect, "UnlockRect(T9)");
#ifdef DXWNDDISABLEDHOOKS
SetHook((void *)(**(DWORD **)ppD3Dtex9 + 0), extQueryInterfaceTex, (void **)&pQueryInterfaceTex, "QueryInterface(T9)");
SetHook((void *)(**(DWORD **)ppD3Dtex9 + 16), extSetPrivateData, (void **)&pSetPrivateData, "SetPrivateData(T9)");
SetHook((void *)(**(DWORD **)ppD3Dtex9 + 72), extGetSurfaceLevel9, (void **)&pGetSurfaceLevel9, "GetSurfaceLevel(T9)");
#endif
} }
void HookDirect3D8(void *lpd3d) void HookDirect3D8(void *lpd3d)
@ -850,10 +892,10 @@ HRESULT WINAPI extPresent(void *pd3dd, CONST RECT *pSourceRect, CONST RECT *pDes
if(dxw.Windowize){ if(dxw.Windowize){
// v2.03.15 - fix target RECT region // v2.03.15 - fix target RECT region
if ((dwD3DSwapEffect == D3DSWAPEFFECT_COPY) && (dxw.dwFlags2 & KEEPASPECTRATIO)) { if ((dwD3DSwapEffect == D3DSWAPEFFECT_COPY) && (dxw.dwFlags2 & KEEPASPECTRATIO)) {
RemappedDstRect=dxw.MapClientRect((LPRECT)pDestRect); RemappedDstRect=dxw.MapClientRect((LPRECT)pDestRect);
pDestRect = &RemappedDstRect; pDestRect = &RemappedDstRect;
OutTraceB("Present: FIXED DestRect=(%d,%d)-(%d,%d)\n", RemappedDstRect.left, RemappedDstRect.top, RemappedDstRect.right, RemappedDstRect.bottom);
} }
OutTraceB("Present: FIXED DestRect=(%d,%d)-(%d,%d)\n", RemappedDstRect.left, RemappedDstRect.top, RemappedDstRect.right, RemappedDstRect.bottom);
// in case of NOD3DRESET, remap source rect. Unfortunately, this doesn't work in fullscreen mode .... // in case of NOD3DRESET, remap source rect. Unfortunately, this doesn't work in fullscreen mode ....
if((dxw.dwFlags4 & NOD3DRESET) && (pSourceRect == NULL)){ if((dxw.dwFlags4 & NOD3DRESET) && (pSourceRect == NULL)){
RemappedSrcRect = dxw.GetScreenRect(); RemappedSrcRect = dxw.GetScreenRect();
@ -1762,16 +1804,30 @@ ULONG WINAPI extEndScene9(void *lpdd3dd)
ULONG WINAPI extSetTexture8(void *lpd3dd, DWORD Stage, void* pTexture) ULONG WINAPI extSetTexture8(void *lpd3dd, DWORD Stage, void* pTexture)
{ {
(*pSetTexture8)(lpd3dd, Stage, NULL); ULONG ret;
OutTraceD3D("Device::SetTexture(8): d3dd=%x stage=%x\n", lpd3dd, Stage); if (dxw.dwFlags4 & NOTEXTURES) {
return DD_OK; (*pSetTexture8)(lpd3dd, Stage, NULL);
OutTraceD3D("Device::SetTexture(8): d3dd=%x stage=%x\n", lpd3dd, Stage);
return DD_OK;
}
ret = (*pSetTexture8)(lpd3dd, Stage, pTexture);
OutTraceD3D("Device::SetTexture(8): d3dd=%x stage=%x texture=%x ret=%x\n", lpd3dd, Stage, pTexture, ret);
if(pTexture) D3D8TextureHandling((void *)pTexture, Stage);
return ret;
} }
ULONG WINAPI extSetTexture9(void *lpd3dd, DWORD Stage, void* pTexture) ULONG WINAPI extSetTexture9(void *lpd3dd, DWORD Stage, void* pTexture)
{ {
(*pSetTexture9)(lpd3dd, Stage, NULL); ULONG ret;
OutTraceD3D("Device::SetTexture(9): d3dd=%x stage=%x\n", lpd3dd, Stage); if (dxw.dwFlags4 & NOTEXTURES) {
return DD_OK; (*pSetTexture9)(lpd3dd, Stage, NULL);
OutTraceD3D("Device::SetTexture(9): d3dd=%x stage=%x\n", lpd3dd, Stage);
return DD_OK;
}
ret = (*pSetTexture9)(lpd3dd, Stage, pTexture);
OutTraceD3D("Device::SetTexture(9): d3dd=%x stage=%x texture=%x ret=%x\n", lpd3dd, Stage, pTexture, ret);
if(pTexture) D3D9TextureHandling((void *)pTexture, Stage);
return ret;
} }
BOOL WINAPI extShowCursor8(void *lpd3dd, BOOL bShow) BOOL WINAPI extShowCursor8(void *lpd3dd, BOOL bShow)
@ -2185,21 +2241,71 @@ HRESULT WINAPI extUnlockRect(void *lpd3dtex, UINT Level, TextureHandling_Type Te
HRESULT WINAPI extUnlockRect8(void *lpd3dtex, UINT Level) HRESULT WINAPI extUnlockRect8(void *lpd3dtex, UINT Level)
{ {
extern void D3D8TextureHandling(void *, int);
return extUnlockRect(lpd3dtex, Level, D3D8TextureHandling); return extUnlockRect(lpd3dtex, Level, D3D8TextureHandling);
} }
HRESULT WINAPI extUnlockRect9(void *lpd3dtex, UINT Level) HRESULT WINAPI extUnlockRect9(void *lpd3dtex, UINT Level)
{ {
extern void D3D9TextureHandling(void *, int);
return extUnlockRect(lpd3dtex, Level, D3D9TextureHandling); return extUnlockRect(lpd3dtex, Level, D3D9TextureHandling);
} }
#ifdef DXWNDDISABLEDHOOKS
HRESULT WINAPI extGetSurfaceLevel9(void *lpd3dtex, UINT Level, IDirect3DSurface9** ppSurfaceLevel)
{
HRESULT res;
OutTraceD3D("GetSurfaceLevel(9): lpd3dtex=%x level=%d\n", lpd3dtex, Level);
res = (*pGetSurfaceLevel9)(lpd3dtex, Level, ppSurfaceLevel);
if(res == DD_OK){
OutTraceD3D("GetSurfaceLevel(9): SurfaceLevel=%x\n", lpd3dtex, Level, *ppSurfaceLevel);
//HookD3DTexture9((void **)ppSurfaceLevel);
}
return res;
}
HRESULT WINAPI extCopyRects(void *lpd3dd, void *pSourceSurface, CONST RECT *pSourceRectsArray, UINT cRects, void *pDestinationSurface, CONST POINT* pDestPointsArray) HRESULT WINAPI extCopyRects(void *lpd3dd, void *pSourceSurface, CONST RECT *pSourceRectsArray, UINT cRects, void *pDestinationSurface, CONST POINT* pDestPointsArray)
{ {
HRESULT res; HRESULT res;
OutTraceD3D("CopyRects: rects=%d\n", cRects); OutTraceD3D("CopyRects: rects=%d\n", cRects);
res = (pCopyRects)(lpd3dd, pSourceSurface, pSourceRectsArray, cRects, pDestinationSurface, pDestPointsArray); res = (pCopyRects)(lpd3dd, pSourceSurface, pSourceRectsArray, cRects, pDestinationSurface, pDestPointsArray);
extern void D3D8TextureHandling(void *, int); //extern void D3D8TextureHandling(void *, int);
//D3D8TextureHandling(pDestinationSurface, 0); //D3D8TextureHandling(pDestinationSurface, 0);
return res;} return res;
}
HRESULT WINAPI extUpdateSurface(void *lpd3dd, IDirect3DSurface9 *pSourceSurface, CONST RECT *pSourceRect, IDirect3DSurface9 *pDestinationSurface, CONST POINT *pDestPoint)
{
HRESULT res;
OutTraceD3D("UpdateSurface: lpd3dd=%x sourcesurface=%x destsurface=%x\n", lpd3dd, pSourceSurface, pDestinationSurface);
res = (*pUpdateSurface)(lpd3dd, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint);
return res;
}
HRESULT WINAPI extUpdateTexture(void *lpd3dd, IDirect3DBaseTexture9 *pSourceTexture, IDirect3DBaseTexture9 *pDestinationTexture)
{
HRESULT res;
OutTraceD3D("UpdateTexture: lpd3dd=%x sourcetexture=%x desttexture=%x\n", lpd3dd, pSourceTexture, pDestinationTexture);
res = (*pUpdateTexture)(lpd3dd, pSourceTexture, pDestinationTexture);
return res;
}
HRESULT WINAPI extSetPrivateData(void *lpd3dd, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags)
{
HRESULT res;
OutTraceD3D("SetPrivateData: lpd3dd=%x refguid=%x pData=%x size=%x flags=%x\n", lpd3dd, refguid, pData, SizeOfData, Flags);
res = (*pSetPrivateData)(lpd3dd, refguid, pData, SizeOfData, Flags);
return res;
}
HRESULT WINAPI extQueryInterfaceTex(void *obj, REFIID riid, void** ppvObj)
{
HRESULT res;
OutTraceD3D("D3D::QueryInterface(T9): d3d=%x riid=%x\n", obj, riid.Data1);
res=pQueryInterfaceTex(obj, riid, ppvObj);
if(res)
OutTraceE("D3D::QueryInterface(T9): ERROR ret=%x(%s)\n", res, ExplainDDError(res));
else
OutTraceD3D("D3D::QueryInterface(T9): obp=%x\n", *ppvObj);
return res;
}
#endif

View File

@ -9,6 +9,9 @@
#include "syslibs.h" #include "syslibs.h"
#include "dxhelper.h" #include "dxhelper.h"
//#undef OutTraceD3D
//#define OutTraceD3D OutTrace
// exported API // exported API
typedef HRESULT (WINAPI *Direct3DCreateDevice_Type)(GUID FAR *, LPDIRECT3D, LPDIRECTDRAWSURFACE, LPDIRECT3D *, LPUNKNOWN); typedef HRESULT (WINAPI *Direct3DCreateDevice_Type)(GUID FAR *, LPDIRECT3D, LPDIRECTDRAWSURFACE, LPDIRECT3D *, LPUNKNOWN);
@ -139,7 +142,6 @@ NextViewport1_Type pNextViewport1 = NULL;
DeleteViewport2_Type pDeleteViewport2 = NULL; DeleteViewport2_Type pDeleteViewport2 = NULL;
NextViewport2_Type pNextViewport2 = NULL; NextViewport2_Type pNextViewport2 = NULL;
HRESULT WINAPI extInitialize(void *); HRESULT WINAPI extInitialize(void *);
HRESULT WINAPI extEnumDevices(void *, LPD3DENUMDEVICESCALLBACK, LPVOID); HRESULT WINAPI extEnumDevices(void *, LPD3DENUMDEVICESCALLBACK, LPVOID);
HRESULT WINAPI extEnumDevices7(void *, LPD3DENUMDEVICESCALLBACK7, LPVOID); HRESULT WINAPI extEnumDevices7(void *, LPD3DENUMDEVICESCALLBACK7, LPVOID);
@ -501,8 +503,8 @@ HRESULT WINAPI extDirect3DCreateDevice(GUID FAR *lpGUID, LPDIRECT3D lpd3ddevice,
{ {
HRESULT res; HRESULT res;
OutTraceD3D("Direct3DCreateDevice: guid=%x d3ddevice=%x dds=%x UnkOuter=%x\n", OutTraceD3D("Direct3DCreateDevice: guid=%x d3ddevice=%x dds=%x%s UnkOuter=%x\n",
lpGUID, lpd3ddevice, surf, pUnkOuter); lpGUID, lpd3ddevice, surf, dxw.ExplainSurfaceRole(surf), pUnkOuter);
res=(*pDirect3DCreateDevice)(lpGUID, lpd3ddevice, surf, lplpd3ddevice, pUnkOuter); res=(*pDirect3DCreateDevice)(lpGUID, lpd3ddevice, surf, lplpd3ddevice, pUnkOuter);
if(res) OutTraceE("Direct3DCreateDevice ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); if(res) OutTraceE("Direct3DCreateDevice ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD3D("Direct3DCreateDevice: d3ddevice=%x\n", *lplpd3ddevice); else OutTraceD3D("Direct3DCreateDevice: d3ddevice=%x\n", *lplpd3ddevice);
@ -876,7 +878,8 @@ HRESULT WINAPI extCreateDevice2(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE
{ {
HRESULT res; HRESULT res;
OutTraceD3D("CreateDevice(D3D2): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); OutTraceD3D("CreateDevice(D3D2): d3d=%x GUID=%x(%s) lpdds=%x%s\n",
lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxw.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds));
res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd); res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd);
if(res) { if(res) {
OutTraceE("CreateDevice(D3D2) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); OutTraceE("CreateDevice(D3D2) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
@ -899,7 +902,8 @@ HRESULT WINAPI extCreateDevice3(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE4
{ {
HRESULT res; HRESULT res;
OutTraceD3D("CreateDevice(D3D3): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); OutTraceD3D("CreateDevice(D3D3): d3d=%x GUID=%x(%s) lpdds=%x%s\n",
lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxw.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds));
res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk); res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk);
if(res) { if(res) {
OutTraceE("CreateDevice(D3D3) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); OutTraceE("CreateDevice(D3D3) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
@ -921,25 +925,28 @@ HRESULT WINAPI extCreateDevice3(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE4
HRESULT WINAPI extCreateDevice7(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE7 lpdds, LPDIRECT3DDEVICE7 *lplpd3dd) HRESULT WINAPI extCreateDevice7(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE7 lpdds, LPDIRECT3DDEVICE7 *lplpd3dd)
{ {
// v2.02.83: D3D CreateDevice (version 7? all versions?) internally calls the Release method upon th ebackbuffer // v2.02.83: D3D CreateDevice (version 7? all versions?) internally calls the Release method upon the backbuffer
// surface, and this has to be avoided since it causes a crash. // surface, and this has to be avoided since it causes a crash.
// The bDontReleaseBackBuffer boolean tells extReleaseS NOT to perform an actual release operation. // The bIsWithinD3DCreateDevice boolean tells extReleaseS NOT to perform an actual release operation.
// v2.03.20: also, D3D CreateDevice internally Release the primary surface lpdds and builds a new primary
// using the same lpdds value, but issuing a QueryInterface call upon a zero-referenced object!
HRESULT res; HRESULT res;
extern BOOL bDontReleaseBackBuffer; extern BOOL bIsWithinD3DCreateDevice;
OutTraceD3D("CreateDevice(D3D7): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); OutTraceD3D("CreateDevice(D3D7): d3d=%x GUID=%x(%s) lpdds=%x%s\n",
bDontReleaseBackBuffer = TRUE; lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxw.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds));
bIsWithinD3DCreateDevice = TRUE;
res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd); res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd);
bDontReleaseBackBuffer = FALSE; bIsWithinD3DCreateDevice = FALSE;
if(res) { if(res) {
OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
if((dxw.dwFlags1 & AUTOMATIC) && (dxw.dwFlags1 & EMULATESURFACE)) { if((dxw.dwFlags1 & AUTOMATIC) && (dxw.dwFlags1 & EMULATESURFACE)) {
dxw.dwFlags1 &= ~EMULATESURFACE; dxw.dwFlags1 &= ~EMULATESURFACE;
dxw.dwFlags1 |= LOCKEDSURFACE; dxw.dwFlags1 |= LOCKEDSURFACE;
bDontReleaseBackBuffer = TRUE; bIsWithinD3DCreateDevice = TRUE;
res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd); res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd);
bDontReleaseBackBuffer = FALSE; bIsWithinD3DCreateDevice = FALSE;
if (res) OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); if (res) OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
else OutTraceD3D("CreateDevice(D3D7): Emulation OFF\n"); else OutTraceD3D("CreateDevice(D3D7): Emulation OFF\n");
} }
@ -1520,9 +1527,9 @@ typedef struct {
HRESULT WINAPI extZBufferProxy(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext) HRESULT WINAPI extZBufferProxy(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext)
{ {
HRESULT res; HRESULT res;
OutTraceD3D("EnumZBufferFormats: CALLBACK PixelFormat=%x(%s) context=%x\n", lpDDPixFmt->dwFlags, lpContext); OutTraceD3D("EnumZBufferFormats: CALLBACK context=%x %s \n", ((CallbackZBufArg *)lpContext)->arg, ExplainPixelFormat(lpDDPixFmt));
res = (*(((CallbackZBufArg *)lpContext)->cb))(lpDDPixFmt, ((CallbackZBufArg *)lpContext)->arg); res = (*(((CallbackZBufArg *)lpContext)->cb))(lpDDPixFmt, ((CallbackZBufArg *)lpContext)->arg);
OutTraceD3D("EnumDevices: CALLBACK ret=%x\n", res); OutTraceD3D("EnumZBufferFormats: CALLBACK ret=%x\n", res);
return res; return res;
} }

View File

@ -4,6 +4,7 @@ typedef HRESULT (WINAPI *DirectDrawCreate_Type)(GUID *, LPDIRECTDRAW *, IUnknown
typedef HRESULT (WINAPI *DirectDrawCreateEx_Type)(GUID *, LPDIRECTDRAW *, REFIID, IUnknown *); typedef HRESULT (WINAPI *DirectDrawCreateEx_Type)(GUID *, LPDIRECTDRAW *, REFIID, IUnknown *);
typedef HRESULT (WINAPI *DirectDrawEnumerate_Type)(LPDDENUMCALLBACK, LPVOID); typedef HRESULT (WINAPI *DirectDrawEnumerate_Type)(LPDDENUMCALLBACK, LPVOID);
typedef HRESULT (WINAPI *DirectDrawEnumerateEx_Type)(LPDDENUMCALLBACKEX, LPVOID, DWORD); typedef HRESULT (WINAPI *DirectDrawEnumerateEx_Type)(LPDDENUMCALLBACKEX, LPVOID, DWORD);
typedef HRESULT (WINAPI *DirectDrawCreateClipper_Type)(DWORD, LPDIRECTDRAWCLIPPER *, IUnknown *);
typedef HDC (WINAPI *GDIGetDC_Type)(HWND); typedef HDC (WINAPI *GDIGetDC_Type)(HWND);
typedef int (WINAPI *GDIReleaseDC_Type)(HWND, HDC); typedef int (WINAPI *GDIReleaseDC_Type)(HWND, HDC);

View File

@ -12,10 +12,14 @@
#define LOCKINJECTIONTHREADS #define LOCKINJECTIONTHREADS
BOOL WINAPI extCheckRemoteDebuggerPresent(HANDLE, PBOOL); BOOL WINAPI extCheckRemoteDebuggerPresent(HANDLE, PBOOL);
LPVOID WINAPI extVirtualAlloc(LPVOID, SIZE_T, DWORD, DWORD);
typedef LPVOID (WINAPI *VirtualAlloc_Type)(LPVOID, SIZE_T, DWORD, DWORD);
typedef BOOL (WINAPI *CreateProcessA_Type)(LPCTSTR, LPTSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, typedef BOOL (WINAPI *CreateProcessA_Type)(LPCTSTR, LPTSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES,
BOOL, DWORD, LPVOID, LPCTSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION); BOOL, DWORD, LPVOID, LPCTSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION);
CreateProcessA_Type pCreateProcessA = NULL; CreateProcessA_Type pCreateProcessA = NULL;
VirtualAlloc_Type pVirtualAlloc = NULL;
#ifdef NOFREELIBRARY #ifdef NOFREELIBRARY
typedef BOOL (WINAPI *FreeLibrary_Type)(HMODULE); typedef BOOL (WINAPI *FreeLibrary_Type)(HMODULE);
@ -49,6 +53,11 @@ static HookEntry_Type Hooks[]={
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
}; };
static HookEntry_Type FixAllocHooks[]={
{HOOK_IAT_CANDIDATE, "VirtualAlloc", (FARPROC)VirtualAlloc, (FARPROC *)&pVirtualAlloc, (FARPROC)extVirtualAlloc},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
};
static HookEntry_Type FixIOHooks[]={ static HookEntry_Type FixIOHooks[]={
{HOOK_IAT_CANDIDATE, "ReadFile", (FARPROC)NULL, (FARPROC *)&pReadFile, (FARPROC)extReadFile}, {HOOK_IAT_CANDIDATE, "ReadFile", (FARPROC)NULL, (FARPROC *)&pReadFile, (FARPROC)extReadFile},
{HOOK_IAT_CANDIDATE, "CreateFileA", (FARPROC)NULL, (FARPROC *)&pCreateFile, (FARPROC)extCreateFile}, {HOOK_IAT_CANDIDATE, "CreateFileA", (FARPROC)NULL, (FARPROC *)&pCreateFile, (FARPROC)extCreateFile},
@ -91,14 +100,17 @@ void HookKernel32(HMODULE module)
if(dxw.dwFlags2 & LIMITRESOURCES) HookLibrary(module, LimitHooks, libname); if(dxw.dwFlags2 & LIMITRESOURCES) HookLibrary(module, LimitHooks, libname);
if(dxw.dwFlags2 & TIMESTRETCH) HookLibrary(module, TimeHooks, libname); if(dxw.dwFlags2 & TIMESTRETCH) HookLibrary(module, TimeHooks, libname);
if(dxw.dwFlags2 & FAKEVERSION) HookLibrary(module, VersionHooks, libname); if(dxw.dwFlags2 & FAKEVERSION) HookLibrary(module, VersionHooks, libname);
if(dxw.dwFlags6 & LEGACYALLOC) HookLibrary(module, FixAllocHooks, libname);
} }
void HookKernel32Init() void HookKernel32Init()
{ {
HookLibInit(Hooks); HookLibInit(Hooks);
HookLibInit(FixIOHooks);
HookLibInit(LimitHooks); HookLibInit(LimitHooks);
HookLibInit(TimeHooks); HookLibInit(TimeHooks);
HookLibInit(VersionHooks); HookLibInit(VersionHooks);
HookLibInit(FixAllocHooks);
} }
FARPROC Remap_kernel32_ProcAddress(LPCSTR proc, HMODULE hModule) FARPROC Remap_kernel32_ProcAddress(LPCSTR proc, HMODULE hModule)
@ -127,6 +139,8 @@ FARPROC Remap_kernel32_ProcAddress(LPCSTR proc, HMODULE hModule)
if(dxw.dwFlags2 & FAKEVERSION) if(dxw.dwFlags2 & FAKEVERSION)
if (addr=RemapLibrary(proc, hModule, VersionHooks)) return addr; if (addr=RemapLibrary(proc, hModule, VersionHooks)) return addr;
if(dxw.dwFlags6 & LEGACYALLOC)
if (addr=RemapLibrary(proc, hModule, FixAllocHooks)) return addr;
return NULL; return NULL;
} }
@ -254,17 +268,25 @@ For Windows NT and Win32s, the remaining bits in the high order word specify the
For Windows 95 and Windows 98, the remaining bits of the high order word are reserved. For Windows 95 and Windows 98, the remaining bits of the high order word are reserved.
*/ */
static struct {char bMajor; char bMinor; char *sName;} WinVersions[9]= // v2.03.20: "Talonsoft's Operational Art of War II" checks the dwPlatformId field
// v2.03.20: list revised according to Microsoft compatibility settings
static struct {DWORD bMajor; DWORD bMinor; DWORD dwPlatformId; DWORD build; char *sName;} WinVersions[9]=
{ {
{4, 0, "Windows 95"}, {4, 0, VER_PLATFORM_WIN32_WINDOWS, 950, "Windows 95"},
{4,10, "Windows 98/SE"}, {4,10, VER_PLATFORM_WIN32_WINDOWS, 67766446, "Windows 98/SE"},
{4,90, "Windows ME"}, {4,90, VER_PLATFORM_WIN32_WINDOWS, 0, "Windows ME"},
{5, 0, "Windows 2000"}, // {4, 0, VER_PLATFORM_WIN32_NT, 1381, "Windows NT4.0(sp5)"},
{5, 1, "Windows XP"}, {5, 0, VER_PLATFORM_WIN32_NT, 2195, "Windows 2000"},
{5, 2, "Windows Server 2003"}, // {5, 1, VER_PLATFORM_WIN32_NT, 2600, "Windows XP(sp2)"},
{6, 0, "Windows Vista"}, {5, 1, VER_PLATFORM_WIN32_NT, 2600, "Windows XP(sp3)"},
{6, 1, "Windows 7"}, {5, 2, VER_PLATFORM_WIN32_NT, 3790, "Windows Server 2003(sp1)"},
{6, 2, "Windows 8"} // {6, 0, VER_PLATFORM_WIN32_NT, 6001, "Windows Server 2008(sp1)"},
// {6, 0, VER_PLATFORM_WIN32_NT, 6000, "Windows Vista"},
// {6, 0, VER_PLATFORM_WIN32_NT, 6001, "Windows Vista(sp1)"},
{6, 0, VER_PLATFORM_WIN32_NT, 6002, "Windows Vista(sp2)"},
{6, 1, VER_PLATFORM_WIN32_NT, 7600, "Windows 7"},
{6, 2, VER_PLATFORM_WIN32_NT, 0, "Windows 8"}
}; };
BOOL WINAPI extGetVersionExA(LPOSVERSIONINFOA lpVersionInfo) BOOL WINAPI extGetVersionExA(LPOSVERSIONINFOA lpVersionInfo)
@ -277,16 +299,17 @@ BOOL WINAPI extGetVersionExA(LPOSVERSIONINFOA lpVersionInfo)
return ret; return ret;
} }
OutTraceDW("GetVersionExA: version=%d.%d build=(%d)\n", OutTraceDW("GetVersionExA: version=%d.%d platform=%x build=(%d)\n",
lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber); lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwPlatformId, lpVersionInfo->dwBuildNumber);
if(dxw.dwFlags2 & FAKEVERSION) { if(dxw.dwFlags2 & FAKEVERSION) {
// fake Win XP build 0 // fake Win XP build 0
lpVersionInfo->dwMajorVersion = WinVersions[dxw.FakeVersionId].bMajor; lpVersionInfo->dwMajorVersion = WinVersions[dxw.FakeVersionId].bMajor;
lpVersionInfo->dwMinorVersion = WinVersions[dxw.FakeVersionId].bMinor; lpVersionInfo->dwMinorVersion = WinVersions[dxw.FakeVersionId].bMinor;
lpVersionInfo->dwPlatformId = WinVersions[dxw.FakeVersionId].dwPlatformId;
lpVersionInfo->dwBuildNumber = 0; lpVersionInfo->dwBuildNumber = 0;
OutTraceDW("GetVersionExA: FIXED version=%d.%d build=(%d) os=\"%s\"\n", OutTraceDW("GetVersionExA: FIXED version=%d.%d platform=%x build=(%d) os=\"%s\"\n",
lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber, lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwPlatformId, lpVersionInfo->dwBuildNumber,
WinVersions[dxw.FakeVersionId].sName); WinVersions[dxw.FakeVersionId].sName);
} }
return TRUE; return TRUE;
@ -302,16 +325,17 @@ BOOL WINAPI extGetVersionExW(LPOSVERSIONINFOW lpVersionInfo)
return ret; return ret;
} }
OutTraceDW("GetVersionExW: version=%d.%d build=(%d)\n", OutTraceDW("GetVersionExW: version=%d.%d platform=%x build=(%d)\n",
lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber); lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwPlatformId, lpVersionInfo->dwBuildNumber);
if(dxw.dwFlags2 & FAKEVERSION) { if(dxw.dwFlags2 & FAKEVERSION) {
// fake Win XP build 0 // fake Win XP build 0
lpVersionInfo->dwMajorVersion = WinVersions[dxw.FakeVersionId].bMajor; lpVersionInfo->dwMajorVersion = WinVersions[dxw.FakeVersionId].bMajor;
lpVersionInfo->dwMinorVersion = WinVersions[dxw.FakeVersionId].bMinor; lpVersionInfo->dwMinorVersion = WinVersions[dxw.FakeVersionId].bMinor;
lpVersionInfo->dwPlatformId = WinVersions[dxw.FakeVersionId].dwPlatformId;
lpVersionInfo->dwBuildNumber = 0; lpVersionInfo->dwBuildNumber = 0;
OutTraceDW("GetVersionExW: FIXED version=%d.%d build=(%d) os=\"%ls\"\n", OutTraceDW("GetVersionExW: FIXED version=%d.%d platform=%x build=(%d) os=\"%s\"\n",
lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber, lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwPlatformId, lpVersionInfo->dwBuildNumber,
WinVersions[dxw.FakeVersionId].sName); WinVersions[dxw.FakeVersionId].sName);
} }
return TRUE; return TRUE;
@ -1027,3 +1051,33 @@ UINT WINAPI extGetTempFileName(LPCTSTR lpPathName, LPCTSTR lpPrefixString, UINT
} }
return ret; return ret;
} }
LPVOID WINAPI extVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
{
// v2.03.20: handling of legacy memory segments.
// Some games (Crusaders of Might and Magic, the demo and the GOG release) rely on the fact that the
// program can VirtualAlloc-ate memory on certain tipically free segments (0x4000000, 0x5000000,
// 0x6000000, 0x7000000 and 0x8000000) but when the program is hooked by DxWnd these segments could
// be allocated to extra dlls or allocated memory.
// The trick is ti pre-allocate this memory and free it upon error to make it certainly available to
// the calling program.
LPVOID ret;
OutTraceB("VirtualAlloc: lpAddress=%x size=%x flag=%x protect=%x\n", lpAddress, dwSize, flAllocationType, flProtect);
ret = (*pVirtualAlloc)(lpAddress, dwSize, flAllocationType, flProtect);
if((ret == NULL) && lpAddress){
OutTraceE("VirtualAlloc: RECOVERY lpAddress=%x size=%x flag=%x protect=%x\n",
lpAddress, dwSize, flAllocationType, flProtect);
if (((DWORD)lpAddress & 0xF0FFFFFF) == 0){
BOOL bret;
bret = VirtualFree(lpAddress, 0x00000000, MEM_RELEASE);
if(!bret) OutTraceE("VirtualFree: MEM_RELEASE err=%d\n", GetLastError());
ret = (*pVirtualAlloc)(lpAddress, dwSize, flAllocationType, flProtect);
if (ret == NULL) OutTraceE("VirtualAlloc: addr=%x err=%d\n", lpAddress, GetLastError());
}
if (!ret) ret = (*pVirtualAlloc)((LPVOID)0x00000000, dwSize, flAllocationType, flProtect);
if(ret == NULL) OutTraceE("VirtualAlloc: addr=NULL err=%d\n", GetLastError());
}
OutTrace("VirtualAlloc: ret=%x\n", ret);
return ret;
}

View File

@ -137,18 +137,6 @@ static HookEntry_Type EmulateHooks[]={
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
}; };
static HookEntry_Type DDHooks[]={
{HOOK_IAT_CANDIDATE, "BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extDDBeginPaint},
//{HOOK_IAT_CANDIDATE, "BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extBeginPaint},
{HOOK_IAT_CANDIDATE, "EndPaint", (FARPROC)EndPaint, (FARPROC *)&pEndPaint, (FARPROC)extDDEndPaint},
{HOOK_IAT_CANDIDATE, "GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extDDGetDC},
{HOOK_IAT_CANDIDATE, "GetDCEx", (FARPROC)GetDCEx, (FARPROC *)&pGDIGetDCEx, (FARPROC)extDDGetDCEx},
{HOOK_IAT_CANDIDATE, "GetWindowDC", (FARPROC)GetWindowDC, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extDDGetDC},
{HOOK_IAT_CANDIDATE, "ReleaseDC", (FARPROC)ReleaseDC, (FARPROC *)&pGDIReleaseDC, (FARPROC)extDDReleaseDC},
{HOOK_IAT_CANDIDATE, "InvalidateRect", (FARPROC)InvalidateRect, (FARPROC *)&pInvalidateRect, (FARPROC)extInvalidateRect},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
};
static HookEntry_Type ScaledHooks[]={ static HookEntry_Type ScaledHooks[]={
{HOOK_IAT_CANDIDATE, "FrameRect", (FARPROC)NULL, (FARPROC *)&pFrameRect, (FARPROC)extFrameRect}, {HOOK_IAT_CANDIDATE, "FrameRect", (FARPROC)NULL, (FARPROC *)&pFrameRect, (FARPROC)extFrameRect},
{HOOK_IAT_CANDIDATE, "TabbedTextOutA", (FARPROC)TabbedTextOutA, (FARPROC *)&pTabbedTextOutA, (FARPROC)extTabbedTextOutA}, {HOOK_IAT_CANDIDATE, "TabbedTextOutA", (FARPROC)TabbedTextOutA, (FARPROC *)&pTabbedTextOutA, (FARPROC)extTabbedTextOutA},
@ -166,6 +154,18 @@ static HookEntry_Type ScaledHooks[]={
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
}; };
static HookEntry_Type DDHooks[]={
{HOOK_IAT_CANDIDATE, "BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extDDBeginPaint},
//{HOOK_IAT_CANDIDATE, "BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extBeginPaint},
{HOOK_IAT_CANDIDATE, "EndPaint", (FARPROC)EndPaint, (FARPROC *)&pEndPaint, (FARPROC)extDDEndPaint},
{HOOK_IAT_CANDIDATE, "GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extDDGetDC},
{HOOK_IAT_CANDIDATE, "GetDCEx", (FARPROC)GetDCEx, (FARPROC *)&pGDIGetDCEx, (FARPROC)extDDGetDCEx},
{HOOK_IAT_CANDIDATE, "GetWindowDC", (FARPROC)GetWindowDC, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extDDGetDC},
{HOOK_IAT_CANDIDATE, "ReleaseDC", (FARPROC)ReleaseDC, (FARPROC *)&pGDIReleaseDC, (FARPROC)extDDReleaseDC},
{HOOK_IAT_CANDIDATE, "InvalidateRect", (FARPROC)InvalidateRect, (FARPROC *)&pInvalidateRect, (FARPROC)extInvalidateRect},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
};
static HookEntry_Type RemapHooks[]={ static HookEntry_Type RemapHooks[]={
{HOOK_IAT_CANDIDATE, "ScreenToClient", (FARPROC)ScreenToClient, (FARPROC *)&pScreenToClient, (FARPROC)extScreenToClient}, {HOOK_IAT_CANDIDATE, "ScreenToClient", (FARPROC)ScreenToClient, (FARPROC *)&pScreenToClient, (FARPROC)extScreenToClient},
{HOOK_IAT_CANDIDATE, "ClientToScreen", (FARPROC)ClientToScreen, (FARPROC *)&pClientToScreen, (FARPROC)extClientToScreen}, {HOOK_IAT_CANDIDATE, "ClientToScreen", (FARPROC)ClientToScreen, (FARPROC *)&pClientToScreen, (FARPROC)extClientToScreen},
@ -1877,16 +1877,20 @@ static HDC WINAPI sGetDC(HWND hwnd, char *ApiName)
#ifdef HANDLEFLIPTOGDI #ifdef HANDLEFLIPTOGDI
extern BOOL bFlippedDC; extern BOOL bFlippedDC;
//if(bFlippedDC && (OBJ_DC == GetObjectType(ret))) {
if(bFlippedDC) { if(bFlippedDC) {
extern HDC hFlippedDC; extern HDC hFlippedDC;
LPDIRECTDRAWSURFACE lpDDSPrim; LPDIRECTDRAWSURFACE lpDDSPrim;
//extern Unlock4_Type pUnlockMethod(LPDIRECTDRAWSURFACE);
lpDDSPrim = dxw.GetPrimarySurface(); lpDDSPrim = dxw.GetPrimarySurface();
//(*pUnlockMethod(lpDDSPrim))(lpDDSPrim, NULL); #if 0
(*pGetDC)(lpDDSPrim, &hFlippedDC); // v2.03.20: beware, from this release the output from dxw.GetPrimarySurface() could be a
// zero reference counter released surface that could be used to feed a QueryInterface method,
// but would crash if used otherwise.
__try {(*pGetDC)(lpDDSPrim, &hFlippedDC);} __except(EXCEPTION_EXECUTE_HANDLER){hFlippedDC=NULL;};
#else
if (lpDDSPrim) (*pGetDC)(lpDDSPrim, &hFlippedDC);
#endif
OutTraceDW("%s: remapping flipped GDI hdc=%x\n", ApiName, hFlippedDC); OutTraceDW("%s: remapping flipped GDI hdc=%x\n", ApiName, hFlippedDC);
return hFlippedDC; if(hFlippedDC) return hFlippedDC;
} }
#endif #endif
@ -1964,7 +1968,7 @@ int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC)
OutTraceDW("GDI.ReleaseDC: releasing flipped GDI hdc=%x\n", hDC); OutTraceDW("GDI.ReleaseDC: releasing flipped GDI hdc=%x\n", hDC);
ret=(*pReleaseDC)(dxw.GetPrimarySurface(), hDC); ret=(*pReleaseDC)(dxw.GetPrimarySurface(), hDC);
if (ret) OutTraceE("GDI.ReleaseDC ERROR: err=%x(%s) at %d\n", ret, ExplainDDError(ret), __LINE__); if (ret) OutTraceE("GDI.ReleaseDC ERROR: err=%x(%s) at %d\n", ret, ExplainDDError(ret), __LINE__);
dxw.ScreenRefresh(); else dxw.ScreenRefresh();
return (ret == DD_OK); return (ret == DD_OK);
} }
#endif #endif
@ -2332,10 +2336,15 @@ LONG WINAPI extTabbedTextOutA(HDC hdc, int X, int Y, LPCTSTR lpString, int nCoun
BOOL WINAPI extDestroyWindow(HWND hWnd) BOOL WINAPI extDestroyWindow(HWND hWnd)
{ {
// v2.02.43: Empire Earth builds test surfaces that must be destroyed! // v2.02.43: "Empire Earth" builds test surfaces that must be destroyed!
// v2.03.20: "Prince of Persia 3D" destroys the main window that must be preserved!
BOOL res; BOOL res;
OutTraceB("DestroyWindow: hwnd=%x\n", hWnd); OutTraceB("DestroyWindow: hwnd=%x\n", hWnd);
if (hWnd == dxw.GethWnd()) { if (hWnd == dxw.GethWnd()) {
if(dxw.dwFlags6 & NODESTROYWINDOW) {
OutTraceDW("DestroyWindow: do NOT destroy main hwnd=%x\n", hWnd);
return TRUE;
}
OutTraceDW("DestroyWindow: destroy main hwnd=%x\n", hWnd); OutTraceDW("DestroyWindow: destroy main hwnd=%x\n", hWnd);
dxw.SethWnd(NULL); dxw.SethWnd(NULL);
} }

View File

@ -40,6 +40,7 @@ void CTabCompat::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_HIDECDROMEMPTY, cTarget->m_HideCDROMEmpty); DDX_Check(pDX, IDC_HIDECDROMEMPTY, cTarget->m_HideCDROMEmpty);
DDX_Check(pDX, IDC_DIABLOTWEAK, cTarget->m_DiabloTweak); DDX_Check(pDX, IDC_DIABLOTWEAK, cTarget->m_DiabloTweak);
DDX_Check(pDX, IDC_EASPORTSHACK, cTarget->m_EASportsHack); DDX_Check(pDX, IDC_EASPORTSHACK, cTarget->m_EASportsHack);
DDX_Check(pDX, IDC_LEGACYALLOC, cTarget->m_LegacyAlloc);
DDX_Check(pDX, IDC_NOIMAGEHLP, cTarget->m_NoImagehlp); DDX_Check(pDX, IDC_NOIMAGEHLP, cTarget->m_NoImagehlp);
DDX_Check(pDX, IDC_REPLACEPRIVOPS, cTarget->m_ReplacePrivOps); DDX_Check(pDX, IDC_REPLACEPRIVOPS, cTarget->m_ReplacePrivOps);

View File

@ -43,9 +43,9 @@ void CTabWindow::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_REFRESHONRESIZE, cTarget->m_RefreshOnResize); DDX_Check(pDX, IDC_REFRESHONRESIZE, cTarget->m_RefreshOnResize);
DDX_Check(pDX, IDC_FIXD3DFRAME, cTarget->m_FixD3DFrame); DDX_Check(pDX, IDC_FIXD3DFRAME, cTarget->m_FixD3DFrame);
DDX_Check(pDX, IDC_NOWINDOWMOVE, cTarget->m_NoWindowMove); DDX_Check(pDX, IDC_NOWINDOWMOVE, cTarget->m_NoWindowMove);
//DDX_Check(pDX, IDC_SUPPRESSCHILD, cTarget->m_SuppressChild);
DDX_Check(pDX, IDC_HIDEDESKTOP, cTarget->m_HideDesktop); DDX_Check(pDX, IDC_HIDEDESKTOP, cTarget->m_HideDesktop);
DDX_Check(pDX, IDC_UNLOCKZORDER, cTarget->m_UnlockZOrder); DDX_Check(pDX, IDC_UNLOCKZORDER, cTarget->m_UnlockZOrder);
DDX_Check(pDX, IDC_NODESTROYWINDOW, cTarget->m_NoDestroyWindow);
// color management // color management
DDX_Check(pDX, IDC_INIT8BPP, cTarget->m_Init8BPP); DDX_Check(pDX, IDC_INIT8BPP, cTarget->m_Init8BPP);

View File

@ -46,6 +46,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_AEROBoost = TRUE; // default true !! m_AEROBoost = TRUE; // default true !!
m_DiabloTweak = FALSE; m_DiabloTweak = FALSE;
m_EASportsHack = FALSE; m_EASportsHack = FALSE;
m_LegacyAlloc = FALSE;
m_NoImagehlp = FALSE; m_NoImagehlp = FALSE;
m_ReplacePrivOps = FALSE; m_ReplacePrivOps = FALSE;
m_ForcesHEL = FALSE; m_ForcesHEL = FALSE;
@ -56,9 +57,9 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_FixRefCounter = TRUE; // default true !! m_FixRefCounter = TRUE; // default true !!
m_ReturnNullRef = FALSE; m_ReturnNullRef = FALSE;
m_NoD3DReset = FALSE; m_NoD3DReset = FALSE;
//m_SuppressChild = FALSE;
m_HideDesktop = FALSE; m_HideDesktop = FALSE;
m_UnlockZOrder = FALSE; m_UnlockZOrder = FALSE;
m_NoDestroyWindow = FALSE;
m_LockSysColors = FALSE; m_LockSysColors = FALSE;
m_LockReservedPalette = FALSE; m_LockReservedPalette = FALSE;
m_ForceYUVtoRGB = FALSE; m_ForceYUVtoRGB = FALSE;

View File

@ -168,6 +168,7 @@ public:
BOOL m_AEROBoost; BOOL m_AEROBoost;
BOOL m_DiabloTweak; BOOL m_DiabloTweak;
BOOL m_EASportsHack; BOOL m_EASportsHack;
BOOL m_LegacyAlloc;
BOOL m_NoImagehlp; BOOL m_NoImagehlp;
BOOL m_ForcesHEL; BOOL m_ForcesHEL;
BOOL m_ForcesSwapEffect; BOOL m_ForcesSwapEffect;
@ -177,9 +178,9 @@ public:
BOOL m_FixRefCounter; BOOL m_FixRefCounter;
BOOL m_ReturnNullRef; BOOL m_ReturnNullRef;
BOOL m_NoD3DReset; BOOL m_NoD3DReset;
//BOOL m_SuppressChild;
BOOL m_HideDesktop; BOOL m_HideDesktop;
BOOL m_UnlockZOrder; BOOL m_UnlockZOrder;
BOOL m_NoDestroyWindow;
BOOL m_LockSysColors; BOOL m_LockSysColors;
BOOL m_LockReservedPalette; BOOL m_LockReservedPalette;
BOOL m_SingleProcAffinity; BOOL m_SingleProcAffinity;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -273,6 +273,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_AEROBoost) t->flags5 |= AEROBOOST; if(dlg->m_AEROBoost) t->flags5 |= AEROBOOST;
if(dlg->m_DiabloTweak) t->flags5 |= DIABLOTWEAK; if(dlg->m_DiabloTweak) t->flags5 |= DIABLOTWEAK;
if(dlg->m_EASportsHack) t->flags5 |= EASPORTSHACK; if(dlg->m_EASportsHack) t->flags5 |= EASPORTSHACK;
if(dlg->m_LegacyAlloc) t->flags6 |= LEGACYALLOC;
if(dlg->m_NoImagehlp) t->flags5 |= NOIMAGEHLP; if(dlg->m_NoImagehlp) t->flags5 |= NOIMAGEHLP;
if(dlg->m_ForcesHEL) t->flags3 |= FORCESHEL; if(dlg->m_ForcesHEL) t->flags3 |= FORCESHEL;
if(dlg->m_ForcesSwapEffect) t->flags6 |= FORCESWAPEFFECT; if(dlg->m_ForcesSwapEffect) t->flags6 |= FORCESWAPEFFECT;
@ -282,9 +283,9 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_FixRefCounter) t->flags4 |= FIXREFCOUNTER; if(dlg->m_FixRefCounter) t->flags4 |= FIXREFCOUNTER;
if(dlg->m_ReturnNullRef) t->flags4 |= RETURNNULLREF; if(dlg->m_ReturnNullRef) t->flags4 |= RETURNNULLREF;
if(dlg->m_NoD3DReset) t->flags4 |= NOD3DRESET; if(dlg->m_NoD3DReset) t->flags4 |= NOD3DRESET;
//if(dlg->m_SuppressChild) t->flags4 |= SUPPRESSCHILD;
if(dlg->m_HideDesktop) t->flags4 |= HIDEDESKTOP; if(dlg->m_HideDesktop) t->flags4 |= HIDEDESKTOP;
if(dlg->m_UnlockZOrder) t->flags5 |= UNLOCKZORDER; if(dlg->m_UnlockZOrder) t->flags5 |= UNLOCKZORDER;
if(dlg->m_NoDestroyWindow) t->flags6 |= NODESTROYWINDOW;
if(dlg->m_LockSysColors) t->flags3 |= LOCKSYSCOLORS; if(dlg->m_LockSysColors) t->flags3 |= LOCKSYSCOLORS;
if(dlg->m_LockReservedPalette) t->flags5 |= LOCKRESERVEDPALETTE; if(dlg->m_LockReservedPalette) t->flags5 |= LOCKRESERVEDPALETTE;
if(dlg->m_ForceYUVtoRGB) t->flags3 |= YUV2RGB; if(dlg->m_ForceYUVtoRGB) t->flags3 |= YUV2RGB;
@ -474,6 +475,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_AEROBoost = t->flags5 & AEROBOOST ? 1 : 0; dlg->m_AEROBoost = t->flags5 & AEROBOOST ? 1 : 0;
dlg->m_DiabloTweak = t->flags5 & DIABLOTWEAK ? 1 : 0; dlg->m_DiabloTweak = t->flags5 & DIABLOTWEAK ? 1 : 0;
dlg->m_EASportsHack = t->flags5 & EASPORTSHACK ? 1 : 0; dlg->m_EASportsHack = t->flags5 & EASPORTSHACK ? 1 : 0;
dlg->m_LegacyAlloc = t->flags6 & LEGACYALLOC ? 1 : 0;
dlg->m_NoImagehlp = t->flags5 & NOIMAGEHLP ? 1 : 0; dlg->m_NoImagehlp = t->flags5 & NOIMAGEHLP ? 1 : 0;
dlg->m_ForcesHEL = t->flags3 & FORCESHEL ? 1 : 0; dlg->m_ForcesHEL = t->flags3 & FORCESHEL ? 1 : 0;
dlg->m_ForcesSwapEffect = t->flags6 & FORCESWAPEFFECT ? 1 : 0; dlg->m_ForcesSwapEffect = t->flags6 & FORCESWAPEFFECT ? 1 : 0;
@ -483,9 +485,9 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_FixRefCounter = t->flags4 & FIXREFCOUNTER ? 1 : 0; dlg->m_FixRefCounter = t->flags4 & FIXREFCOUNTER ? 1 : 0;
dlg->m_ReturnNullRef = t->flags4 & RETURNNULLREF ? 1 : 0; dlg->m_ReturnNullRef = t->flags4 & RETURNNULLREF ? 1 : 0;
dlg->m_NoD3DReset = t->flags4 & NOD3DRESET ? 1 : 0; dlg->m_NoD3DReset = t->flags4 & NOD3DRESET ? 1 : 0;
//dlg->m_SuppressChild = t->flags4 & SUPPRESSCHILD ? 1 : 0;
dlg->m_HideDesktop = t->flags4 & HIDEDESKTOP ? 1 : 0; dlg->m_HideDesktop = t->flags4 & HIDEDESKTOP ? 1 : 0;
dlg->m_UnlockZOrder = t->flags5 & UNLOCKZORDER ? 1 : 0; dlg->m_UnlockZOrder = t->flags5 & UNLOCKZORDER ? 1 : 0;
dlg->m_NoDestroyWindow = t->flags6 & NODESTROYWINDOW ? 1 : 0;
dlg->m_LockSysColors = t->flags3 & LOCKSYSCOLORS ? 1 : 0; dlg->m_LockSysColors = t->flags3 & LOCKSYSCOLORS ? 1 : 0;
dlg->m_LockReservedPalette = t->flags5 & LOCKRESERVEDPALETTE ? 1 : 0; dlg->m_LockReservedPalette = t->flags5 & LOCKRESERVEDPALETTE ? 1 : 0;
dlg->m_ForceRGBtoYUV = t->flags3 & RGB2YUV ? 1 : 0; dlg->m_ForceRGBtoYUV = t->flags3 & RGB2YUV ? 1 : 0;

Binary file not shown.