mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_02_31_src
Former-commit-id: e532b31652aeb08b559f61757c211a100810b42c
This commit is contained in:
parent
884ef0807b
commit
6d56f83f1f
@ -92,6 +92,7 @@
|
||||
#define EMULATEREGISTRY 0x00000400 // Emulate registry api to read extra keys
|
||||
#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 DISABLEHAL 0x00002000 // Disable HAL support (IID_IDirect3DHALDevice)
|
||||
|
||||
// logging Tflags DWORD:
|
||||
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general
|
||||
@ -160,7 +161,7 @@ int EndHook(void);
|
||||
void GetDllVersion(char *);
|
||||
int GetHookStatus(DXWNDSTATUS *);
|
||||
DXWNDSTATUS *GetHookInfo();
|
||||
int HookInit(TARGETMAP *, HWND);
|
||||
void HookInit(TARGETMAP *, HWND);
|
||||
|
||||
void *SetHook(void *, void *);
|
||||
void SetHook(void *, void *, void **, char *);
|
||||
@ -189,7 +190,7 @@ LRESULT CALLBACK extWindowProc(HWND, UINT, WPARAM, LPARAM);
|
||||
#define IsTraceE (TRUE)
|
||||
#define IsDebug (dxw.dwTFlags & OUTDEBUG)
|
||||
#define IsAssertEnabled (dxw.dwTFlags & ASSERTDIALOG)
|
||||
#define STEP OutTrace("STEP at %s:%d\n", __MODULE__, __LINE__)
|
||||
#define STEP OutTrace("STEP at %s:%d\n", __FILE__, __LINE__)
|
||||
|
||||
extern void WhndStackPush(HWND, WNDPROC);
|
||||
extern WNDPROC WhndGetWindowProc(HWND );
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0df4a17760b4266a73aaf34565be1febb6bcf0d2fc0d776ca6aeb7fb6c861e28
|
||||
size 365568
|
||||
oid sha256:ff5e1a04f90b69aaeac5520885d280a978746c9674a5085725d17d45593af92a
|
||||
size 378368
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2f9e10ed36d2163eb58084363d6e218f827109487beda4962fd48c59fed8b1e8
|
||||
oid sha256:a15a98b4e75ff8b03d04af4bf9b30445a6af7324468d3276316063fede54375a
|
||||
size 524288
|
||||
|
731
build/dxwnd.ini
731
build/dxwnd.ini
@ -1,11 +1,11 @@
|
||||
[target]
|
||||
title0=Carnivores
|
||||
path0=D:\Games\Carnivores\HUNTSOFT.EXE
|
||||
title0=101 Airborne Invasion
|
||||
path0=D:\Games\101air\101.exe
|
||||
module0=
|
||||
opengllib0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=671088674
|
||||
flag0=134217762
|
||||
flagg0=134217728
|
||||
flagh0=20
|
||||
flagi0=0
|
||||
@ -22,17 +22,17 @@ sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
title1=Crazy Taxy
|
||||
path1=D:\Games\Crazy_Taxi\Crazy Taxi PC Version\crazy_taxi_pc.exe
|
||||
title1=688I Hunter Killer
|
||||
path1=D:\Games\688\688I_HK.EXE
|
||||
module1=
|
||||
opengllib1=
|
||||
ver1=0
|
||||
coord1=0
|
||||
flag1=671219744
|
||||
flagg1=134217728
|
||||
coord1=1
|
||||
flag1=-938999262
|
||||
flagg1=135266304
|
||||
flagh1=20
|
||||
flagi1=0
|
||||
tflag1=67
|
||||
tflag1=3
|
||||
initx1=0
|
||||
inity1=0
|
||||
minx1=0
|
||||
@ -41,21 +41,21 @@ maxx1=0
|
||||
maxy1=0
|
||||
posx1=50
|
||||
posy1=50
|
||||
sizx1=800
|
||||
sizy1=600
|
||||
sizx1=1200
|
||||
sizy1=900
|
||||
maxfps1=0
|
||||
initts1=0
|
||||
title2=Duckman
|
||||
path2=D:\Games\duckman\DUCKMAN.EXE
|
||||
title2=Abomination the Nemesis Project
|
||||
path2=D:\Games\Abomination\Abomb.exe
|
||||
module2=
|
||||
opengllib2=
|
||||
ver2=0
|
||||
coord2=0
|
||||
flag2=134217762
|
||||
flagg2=134217728
|
||||
flagh2=1044
|
||||
flagh2=20
|
||||
flagi2=0
|
||||
tflag2=3
|
||||
tflag2=67
|
||||
initx2=0
|
||||
inity2=0
|
||||
minx2=0
|
||||
@ -68,17 +68,17 @@ sizx2=800
|
||||
sizy2=600
|
||||
maxfps2=0
|
||||
initts2=0
|
||||
title3=Crazy Frog Racer
|
||||
path3=D:\Games\CrazyFrog\CRAZY.EXE
|
||||
module3=
|
||||
title3=Balls of Steel
|
||||
path3=D:\Games\Balls of Steel\bos.exe
|
||||
module3=duke.ddp mutation.ddp
|
||||
opengllib3=
|
||||
ver3=8
|
||||
ver3=0
|
||||
coord3=0
|
||||
flag3=134217762
|
||||
flagg3=134217729
|
||||
flag3=167772192
|
||||
flagg3=202375169
|
||||
flagh3=20
|
||||
flagi3=0
|
||||
tflag3=64
|
||||
tflag3=263
|
||||
initx3=0
|
||||
inity3=0
|
||||
minx3=0
|
||||
@ -91,17 +91,17 @@ sizx3=800
|
||||
sizy3=600
|
||||
maxfps3=0
|
||||
initts3=0
|
||||
title4=Dark Angael
|
||||
path4=D:\Games\Dark Angael\GAME.EXE
|
||||
title4=Barrage
|
||||
path4=D:\Games\Barrage\SRC\BARRAGE.EXE
|
||||
module4=
|
||||
opengllib4=
|
||||
ver4=0
|
||||
coord4=0
|
||||
flag4=134217762
|
||||
flagg4=134217728
|
||||
flagh4=20
|
||||
flag4=142606368
|
||||
flagg4=135266304
|
||||
flagh4=8212
|
||||
flagi4=0
|
||||
tflag4=0
|
||||
tflag4=7
|
||||
initx4=0
|
||||
inity4=0
|
||||
minx4=0
|
||||
@ -114,17 +114,17 @@ sizx4=800
|
||||
sizy4=600
|
||||
maxfps4=0
|
||||
initts4=0
|
||||
title5=Dark Colony
|
||||
path5=D:\Games\Dark Colony\DCOLONY\DC.EXE
|
||||
title5=Carnivores
|
||||
path5=D:\Games\Carnivores\HUNTSOFT.EXE
|
||||
module5=
|
||||
opengllib5=
|
||||
ver5=0
|
||||
coord5=0
|
||||
flag5=134217762
|
||||
flagg5=134217728
|
||||
flag5=671088674
|
||||
flagg5=135266304
|
||||
flagh5=20
|
||||
flagi5=0
|
||||
tflag5=0
|
||||
tflag5=64
|
||||
initx5=0
|
||||
inity5=0
|
||||
minx5=0
|
||||
@ -137,17 +137,17 @@ sizx5=800
|
||||
sizy5=600
|
||||
maxfps5=0
|
||||
initts5=0
|
||||
title6=Dark Judgement
|
||||
path6=D:\Games\Dark Judgement\Dark Judgement.EXE
|
||||
title6=Crazy Frog Racer
|
||||
path6=D:\Games\CrazyFrog\CRAZY.EXE
|
||||
module6=
|
||||
opengllib6=
|
||||
ver6=0
|
||||
ver6=8
|
||||
coord6=0
|
||||
flag6=134217762
|
||||
flagg6=134217728
|
||||
flagg6=134217729
|
||||
flagh6=20
|
||||
flagi6=0
|
||||
tflag6=0
|
||||
tflag6=64
|
||||
initx6=0
|
||||
inity6=0
|
||||
minx6=0
|
||||
@ -160,17 +160,17 @@ sizx6=800
|
||||
sizy6=600
|
||||
maxfps6=0
|
||||
initts6=0
|
||||
title7=Descent 3
|
||||
path7=D:\Games\Descent_3\Descent 3.exe
|
||||
title7=Crazy Taxy
|
||||
path7=D:\Games\Crazy_Taxi\Crazy Taxi PC Version\crazy_taxi_pc.exe
|
||||
module7=
|
||||
opengllib7=
|
||||
ver7=0
|
||||
coord7=0
|
||||
flag7=134217760
|
||||
flagg7=134348801
|
||||
flag7=671219744
|
||||
flagg7=134217728
|
||||
flagh7=20
|
||||
flagi7=0
|
||||
tflag7=3
|
||||
tflag7=66
|
||||
initx7=0
|
||||
inity7=0
|
||||
minx7=0
|
||||
@ -183,13 +183,13 @@ sizx7=800
|
||||
sizy7=600
|
||||
maxfps7=0
|
||||
initts7=0
|
||||
title8=Dark Vengeance
|
||||
path8=D:\Games\dark_vengeance\dv.exe
|
||||
title8=Dark Angael
|
||||
path8=D:\Games\Dark Angael\GAME.EXE
|
||||
module8=
|
||||
opengllib8=
|
||||
ver8=0
|
||||
coord8=0
|
||||
flag8=142606368
|
||||
flag8=134217762
|
||||
flagg8=134217728
|
||||
flagh8=20
|
||||
flagi8=0
|
||||
@ -206,14 +206,14 @@ sizx8=800
|
||||
sizy8=600
|
||||
maxfps8=0
|
||||
initts8=0
|
||||
title9=Dweep
|
||||
path9=D:\Games\dweep\Dweep.exe
|
||||
title9=Dark Colony
|
||||
path9=D:\Games\Dark Colony\DCOLONY\DC.EXE
|
||||
module9=
|
||||
opengllib9=
|
||||
ver9=0
|
||||
coord9=0
|
||||
flag9=134234146
|
||||
flagg9=134283264
|
||||
flag9=134217762
|
||||
flagg9=134217728
|
||||
flagh9=20
|
||||
flagi9=0
|
||||
tflag9=0
|
||||
@ -228,16 +228,16 @@ posy9=50
|
||||
sizx9=800
|
||||
sizy9=600
|
||||
maxfps9=0
|
||||
initts9=2
|
||||
title10=Eliminator
|
||||
path10=D:\Games\eliminat\Eliminator.exe
|
||||
initts9=0
|
||||
title10=Dark Judgement
|
||||
path10=D:\Games\Dark Judgement\Dark Judgement.EXE
|
||||
module10=
|
||||
opengllib10=
|
||||
ver10=0
|
||||
coord10=0
|
||||
flag10=134217760
|
||||
flag10=134217826
|
||||
flagg10=134217728
|
||||
flagh10=1044
|
||||
flagh10=20
|
||||
flagi10=0
|
||||
tflag10=3
|
||||
initx10=0
|
||||
@ -246,46 +246,46 @@ minx10=0
|
||||
miny10=0
|
||||
maxx10=0
|
||||
maxy10=0
|
||||
posx10=800
|
||||
posy10=600
|
||||
sizx10=400
|
||||
sizy10=300
|
||||
posx10=50
|
||||
posy10=50
|
||||
sizx10=800
|
||||
sizy10=600
|
||||
maxfps10=0
|
||||
initts10=0
|
||||
title11=Sims.exe
|
||||
path11=D:\Games\sims\Sims.exe
|
||||
title11=Dark Vengeance
|
||||
path11=D:\Games\dark_vengeance\dv.exe
|
||||
module11=
|
||||
opengllib11=
|
||||
ver11=0
|
||||
coord11=0
|
||||
flag11=134217762
|
||||
flag11=142606386
|
||||
flagg11=134217728
|
||||
flagh11=1044
|
||||
flagh11=8212
|
||||
flagi11=0
|
||||
tflag11=67
|
||||
tflag11=3
|
||||
initx11=0
|
||||
inity11=0
|
||||
minx11=0
|
||||
miny11=0
|
||||
maxx11=0
|
||||
maxy11=0
|
||||
maxx11=800
|
||||
maxy11=600
|
||||
posx11=50
|
||||
posy11=50
|
||||
sizx11=800
|
||||
sizy11=600
|
||||
maxfps11=0
|
||||
initts11=0
|
||||
title12=Fighting Forces
|
||||
path12=D:\Games\Fighting Forces\FFORCE.EXE
|
||||
title12=Descent 3
|
||||
path12=D:\Games\Descent_3\Descent 3.exe
|
||||
module12=
|
||||
opengllib12=
|
||||
ver12=0
|
||||
coord12=0
|
||||
flag12=134217760
|
||||
flagg12=671088640
|
||||
flagh12=2068
|
||||
flagg12=134348801
|
||||
flagh12=4
|
||||
flagi12=0
|
||||
tflag12=515
|
||||
tflag12=0
|
||||
initx12=0
|
||||
inity12=0
|
||||
minx12=0
|
||||
@ -298,17 +298,17 @@ sizx12=800
|
||||
sizy12=600
|
||||
maxfps12=0
|
||||
initts12=0
|
||||
title13=Final Fighter
|
||||
path13=D:\Games\Final Fighter\FinalFighter.exe
|
||||
title13=Descent 3 main
|
||||
path13=D:\Games\Descent_3\main.exe
|
||||
module13=
|
||||
opengllib13=
|
||||
ver13=0
|
||||
coord13=0
|
||||
flag13=939524128
|
||||
flagg13=135266305
|
||||
flagh13=20
|
||||
flag13=771891232
|
||||
flagg13=201457664
|
||||
flagh13=8212
|
||||
flagi13=0
|
||||
tflag13=513
|
||||
tflag13=3
|
||||
initx13=0
|
||||
inity13=0
|
||||
minx13=0
|
||||
@ -321,17 +321,17 @@ sizx13=800
|
||||
sizy13=600
|
||||
maxfps13=0
|
||||
initts13=0
|
||||
title14=Gangsters 2
|
||||
path14=D:\Games\Gangsters 2\Gangsters2.exe
|
||||
title14=Duckman
|
||||
path14=D:\Games\duckman\DUCKMAN.EXE
|
||||
module14=
|
||||
opengllib14=
|
||||
ver14=0
|
||||
coord14=0
|
||||
flag14=134217762
|
||||
flag14=402653218
|
||||
flagg14=134217728
|
||||
flagh14=20
|
||||
flagh14=1044
|
||||
flagi14=0
|
||||
tflag14=3
|
||||
tflag14=2
|
||||
initx14=0
|
||||
inity14=0
|
||||
minx14=0
|
||||
@ -344,15 +344,15 @@ sizx14=800
|
||||
sizy14=600
|
||||
maxfps14=0
|
||||
initts14=0
|
||||
title15=Hard Truck - Road to Victory
|
||||
path15=C:\Hard Truck\HTruck.exe
|
||||
title15=Dweep
|
||||
path15=D:\Games\dweep\Dweep.exe
|
||||
module15=
|
||||
opengllib15=
|
||||
ver15=0
|
||||
coord15=0
|
||||
flag15=134217760
|
||||
flagg15=134217728
|
||||
flagh15=2068
|
||||
flag15=134234146
|
||||
flagg15=134283264
|
||||
flagh15=20
|
||||
flagi15=0
|
||||
tflag15=0
|
||||
initx15=0
|
||||
@ -366,41 +366,41 @@ posy15=50
|
||||
sizx15=800
|
||||
sizy15=600
|
||||
maxfps15=0
|
||||
initts15=0
|
||||
title16=Final Odyssey
|
||||
path16=D:\Games\Final odyssey\FinalOdy.exe
|
||||
initts15=2
|
||||
title16=Eliminator
|
||||
path16=D:\Games\eliminat\Eliminator.exe
|
||||
module16=
|
||||
opengllib16=
|
||||
ver16=0
|
||||
coord16=0
|
||||
flag16=134217760
|
||||
flagg16=134217728
|
||||
flagh16=4
|
||||
flagh16=1044
|
||||
flagi16=0
|
||||
tflag16=64
|
||||
tflag16=3
|
||||
initx16=0
|
||||
inity16=0
|
||||
minx16=0
|
||||
miny16=0
|
||||
maxx16=0
|
||||
maxy16=0
|
||||
posx16=50
|
||||
posy16=50
|
||||
sizx16=800
|
||||
sizy16=600
|
||||
posx16=800
|
||||
posy16=600
|
||||
sizx16=400
|
||||
sizy16=300
|
||||
maxfps16=0
|
||||
initts16=0
|
||||
title17=Gex
|
||||
path17=D:\Games\gex\GEX.EXE
|
||||
title17=EMPIRES.EXE
|
||||
path17=D:\Games\Age of Empires\EMPIRES.EXE
|
||||
module17=
|
||||
opengllib17=
|
||||
ver17=0
|
||||
coord17=0
|
||||
flag17=134217761
|
||||
flag17=134217762
|
||||
flagg17=134217728
|
||||
flagh17=20
|
||||
flagi17=0
|
||||
tflag17=67
|
||||
tflag17=64
|
||||
initx17=0
|
||||
inity17=0
|
||||
minx17=0
|
||||
@ -413,17 +413,17 @@ sizx17=800
|
||||
sizy17=600
|
||||
maxfps17=0
|
||||
initts17=0
|
||||
title18=Hellcopter
|
||||
path18=D:\Games\Hellcopter\HCopter.exe
|
||||
title18=EPIC40K.EXE
|
||||
path18=D:\Games\war_hammer_final_liberation\EPIC40K.EXE
|
||||
module18=
|
||||
opengllib18=
|
||||
ver18=0
|
||||
coord18=0
|
||||
flag18=134217760
|
||||
flagg18=134217728
|
||||
flagh18=1044
|
||||
flag18=134217762
|
||||
flagg18=135266304
|
||||
flagh18=20
|
||||
flagi18=0
|
||||
tflag18=513
|
||||
tflag18=3
|
||||
initx18=0
|
||||
inity18=0
|
||||
minx18=0
|
||||
@ -436,17 +436,17 @@ sizx18=800
|
||||
sizy18=600
|
||||
maxfps18=0
|
||||
initts18=0
|
||||
title19=Imperialism II
|
||||
path19=D:\Games\imperialism_2\imperialism II.exe
|
||||
title19=Fable - The Lost Chapters
|
||||
path19=D:\Games\Fable - The Lost Chapters\Fable.exe
|
||||
module19=
|
||||
opengllib19=
|
||||
ver19=0
|
||||
coord19=0
|
||||
flag19=671090722
|
||||
flagg19=235929600
|
||||
ver19=9
|
||||
coord19=1
|
||||
flag19=134217760
|
||||
flagg19=201457672
|
||||
flagh19=20
|
||||
flagi19=0
|
||||
tflag19=3
|
||||
tflag19=258
|
||||
initx19=0
|
||||
inity19=0
|
||||
minx19=0
|
||||
@ -455,21 +455,21 @@ maxx19=0
|
||||
maxy19=0
|
||||
posx19=50
|
||||
posy19=50
|
||||
sizx19=1200
|
||||
sizy19=900
|
||||
sizx19=800
|
||||
sizy19=600
|
||||
maxfps19=0
|
||||
initts19=0
|
||||
title20=Fable - The Lost Chapters
|
||||
path20=D:\Games\Fable - The Lost Chapters\Fable.exe
|
||||
title20=Fighting Forces
|
||||
path20=D:\Games\Fighting Forces\FFORCE.EXE
|
||||
module20=
|
||||
opengllib20=
|
||||
ver20=9
|
||||
ver20=0
|
||||
coord20=0
|
||||
flag20=134217760
|
||||
flagg20=201457664
|
||||
flagh20=20
|
||||
flagg20=671088640
|
||||
flagh20=3092
|
||||
flagi20=0
|
||||
tflag20=259
|
||||
tflag20=514
|
||||
initx20=0
|
||||
inity20=0
|
||||
minx20=0
|
||||
@ -482,8 +482,491 @@ sizx20=800
|
||||
sizy20=600
|
||||
maxfps20=0
|
||||
initts20=0
|
||||
title21=Final Fighter
|
||||
path21=D:\Games\Final Fighter\FinalFighter.exe
|
||||
module21=
|
||||
opengllib21=
|
||||
ver21=0
|
||||
coord21=0
|
||||
flag21=939524128
|
||||
flagg21=135266305
|
||||
flagh21=4
|
||||
flagi21=0
|
||||
tflag21=512
|
||||
initx21=0
|
||||
inity21=0
|
||||
minx21=0
|
||||
miny21=0
|
||||
maxx21=0
|
||||
maxy21=0
|
||||
posx21=50
|
||||
posy21=50
|
||||
sizx21=800
|
||||
sizy21=600
|
||||
maxfps21=0
|
||||
initts21=0
|
||||
title22=Final Odyssey
|
||||
path22=D:\Games\Final odyssey\FinalOdy.exe
|
||||
module22=
|
||||
opengllib22=
|
||||
ver22=0
|
||||
coord22=0
|
||||
flag22=134217760
|
||||
flagg22=134217728
|
||||
flagh22=4
|
||||
flagi22=0
|
||||
tflag22=64
|
||||
initx22=0
|
||||
inity22=0
|
||||
minx22=0
|
||||
miny22=0
|
||||
maxx22=0
|
||||
maxy22=0
|
||||
posx22=50
|
||||
posy22=50
|
||||
sizx22=800
|
||||
sizy22=600
|
||||
maxfps22=0
|
||||
initts22=0
|
||||
title23=Gangsters 2
|
||||
path23=D:\Games\Gangsters 2\Gangsters2.exe
|
||||
module23=
|
||||
opengllib23=
|
||||
ver23=0
|
||||
coord23=0
|
||||
flag23=134217762
|
||||
flagg23=134217728
|
||||
flagh23=20
|
||||
flagi23=0
|
||||
tflag23=2
|
||||
initx23=0
|
||||
inity23=0
|
||||
minx23=0
|
||||
miny23=0
|
||||
maxx23=0
|
||||
maxy23=0
|
||||
posx23=50
|
||||
posy23=50
|
||||
sizx23=800
|
||||
sizy23=600
|
||||
maxfps23=0
|
||||
initts23=0
|
||||
title24=Gex
|
||||
path24=D:\Games\gex\GEX.EXE
|
||||
module24=
|
||||
opengllib24=
|
||||
ver24=0
|
||||
coord24=0
|
||||
flag24=134217761
|
||||
flagg24=134217728
|
||||
flagh24=20
|
||||
flagi24=0
|
||||
tflag24=66
|
||||
initx24=0
|
||||
inity24=0
|
||||
minx24=0
|
||||
miny24=0
|
||||
maxx24=0
|
||||
maxy24=0
|
||||
posx24=50
|
||||
posy24=50
|
||||
sizx24=800
|
||||
sizy24=600
|
||||
maxfps24=0
|
||||
initts24=0
|
||||
title25=Hard Truck - Road to Victory
|
||||
path25=C:\Hard Truck\HTruck.exe
|
||||
module25=
|
||||
opengllib25=
|
||||
ver25=0
|
||||
coord25=0
|
||||
flag25=134217760
|
||||
flagg25=134217728
|
||||
flagh25=2068
|
||||
flagi25=0
|
||||
tflag25=0
|
||||
initx25=0
|
||||
inity25=0
|
||||
minx25=0
|
||||
miny25=0
|
||||
maxx25=0
|
||||
maxy25=0
|
||||
posx25=50
|
||||
posy25=50
|
||||
sizx25=800
|
||||
sizy25=600
|
||||
maxfps25=0
|
||||
initts25=0
|
||||
title26=Hellcopter
|
||||
path26=D:\Games\Hellcopter\HCopter.exe
|
||||
module26=
|
||||
opengllib26=
|
||||
ver26=0
|
||||
coord26=0
|
||||
flag26=134217760
|
||||
flagg26=134217728
|
||||
flagh26=1044
|
||||
flagi26=0
|
||||
tflag26=512
|
||||
initx26=0
|
||||
inity26=0
|
||||
minx26=0
|
||||
miny26=0
|
||||
maxx26=0
|
||||
maxy26=0
|
||||
posx26=50
|
||||
posy26=50
|
||||
sizx26=800
|
||||
sizy26=600
|
||||
maxfps26=0
|
||||
initts26=0
|
||||
title27=Heroes of Might & Magic 2 Gold
|
||||
path27=D:\Games\heroes2gold\HEROES2W.EXE
|
||||
module27=
|
||||
opengllib27=
|
||||
ver27=0
|
||||
coord27=0
|
||||
flag27=134217730
|
||||
flagg27=143654912
|
||||
flagh27=20
|
||||
flagi27=0
|
||||
tflag27=770
|
||||
initx27=0
|
||||
inity27=0
|
||||
minx27=0
|
||||
miny27=0
|
||||
maxx27=0
|
||||
maxy27=0
|
||||
posx27=50
|
||||
posy27=50
|
||||
sizx27=800
|
||||
sizy27=600
|
||||
maxfps27=0
|
||||
initts27=0
|
||||
title28=Hooligans Storm over Europe
|
||||
path28=D:\Games\Hooligans\Hooligans.exe
|
||||
module28=
|
||||
opengllib28=
|
||||
ver28=0
|
||||
coord28=0
|
||||
flag28=134742048
|
||||
flagg28=202375168
|
||||
flagh28=20
|
||||
flagi28=0
|
||||
tflag28=259
|
||||
initx28=0
|
||||
inity28=0
|
||||
minx28=0
|
||||
miny28=0
|
||||
maxx28=0
|
||||
maxy28=0
|
||||
posx28=50
|
||||
posy28=50
|
||||
sizx28=800
|
||||
sizy28=600
|
||||
maxfps28=0
|
||||
initts28=0
|
||||
title29=Imperialism
|
||||
path29=D:\Games\Imperialism\Imperialism.exe
|
||||
module29=
|
||||
opengllib29=
|
||||
ver29=0
|
||||
coord29=0
|
||||
flag29=671621154
|
||||
flagg29=135266304
|
||||
flagh29=20
|
||||
flagi29=0
|
||||
tflag29=3
|
||||
initx29=0
|
||||
inity29=0
|
||||
minx29=0
|
||||
miny29=0
|
||||
maxx29=0
|
||||
maxy29=0
|
||||
posx29=50
|
||||
posy29=50
|
||||
sizx29=1200
|
||||
sizy29=900
|
||||
maxfps29=0
|
||||
initts29=0
|
||||
title30=Imperialism II
|
||||
path30=D:\Games\imperialism_2\imperialism II.exe
|
||||
module30=
|
||||
opengllib30=
|
||||
ver30=0
|
||||
coord30=1
|
||||
flag30=671096866
|
||||
flagg30=470810640
|
||||
flagh30=52
|
||||
flagi30=0
|
||||
tflag30=3
|
||||
initx30=0
|
||||
inity30=0
|
||||
minx30=0
|
||||
miny30=0
|
||||
maxx30=0
|
||||
maxy30=0
|
||||
posx30=50
|
||||
posy30=50
|
||||
sizx30=800
|
||||
sizy30=600
|
||||
maxfps30=0
|
||||
initts30=0
|
||||
title31=Mechwarrior 3
|
||||
path31=D:\Games\Mechwarrior 3 (full)\Mech3.exe
|
||||
module31=
|
||||
opengllib31=
|
||||
ver31=0
|
||||
coord31=0
|
||||
flag31=671096866
|
||||
flagg31=134217728
|
||||
flagh31=20
|
||||
flagi31=0
|
||||
tflag31=0
|
||||
initx31=0
|
||||
inity31=0
|
||||
minx31=0
|
||||
miny31=0
|
||||
maxx31=0
|
||||
maxy31=0
|
||||
posx31=50
|
||||
posy31=50
|
||||
sizx31=800
|
||||
sizy31=600
|
||||
maxfps31=0
|
||||
initts31=0
|
||||
title32=Raiden II
|
||||
path32=D:\Games\raiden2\RAIDENII.EXE
|
||||
module32=
|
||||
opengllib32=
|
||||
ver32=0
|
||||
coord32=1
|
||||
flag32=134217762
|
||||
flagg32=134217728
|
||||
flagh32=20
|
||||
flagi32=0
|
||||
tflag32=0
|
||||
initx32=0
|
||||
inity32=0
|
||||
minx32=0
|
||||
miny32=0
|
||||
maxx32=0
|
||||
maxy32=0
|
||||
posx32=50
|
||||
posy32=50
|
||||
sizx32=800
|
||||
sizy32=600
|
||||
maxfps32=0
|
||||
initts32=0
|
||||
title33=Rapanui
|
||||
path33=D:\Games\Rapanui\Rapanui.exe
|
||||
module33=
|
||||
opengllib33=
|
||||
ver33=0
|
||||
coord33=0
|
||||
flag33=134217762
|
||||
flagg33=134217728
|
||||
flagh33=20
|
||||
flagi33=0
|
||||
tflag33=0
|
||||
initx33=0
|
||||
inity33=0
|
||||
minx33=0
|
||||
miny33=0
|
||||
maxx33=0
|
||||
maxy33=0
|
||||
posx33=50
|
||||
posy33=50
|
||||
sizx33=800
|
||||
sizy33=600
|
||||
maxfps33=0
|
||||
initts33=0
|
||||
title34=Silent Hunter II (shell)
|
||||
path34=D:\Games\Silent Hunter II\Shell\Shell.exe
|
||||
module34=
|
||||
opengllib34=
|
||||
ver34=0
|
||||
coord34=0
|
||||
flag34=402653221
|
||||
flagg34=135266304
|
||||
flagh34=20
|
||||
flagi34=0
|
||||
tflag34=3
|
||||
initx34=0
|
||||
inity34=0
|
||||
minx34=0
|
||||
miny34=0
|
||||
maxx34=800
|
||||
maxy34=600
|
||||
posx34=50
|
||||
posy34=50
|
||||
sizx34=800
|
||||
sizy34=600
|
||||
maxfps34=0
|
||||
initts34=0
|
||||
title35=Silent Hunter II (sim)
|
||||
path35=D:\Games\Silent Hunter II\Sim\Sim.exe
|
||||
module35=
|
||||
opengllib35=
|
||||
ver35=0
|
||||
coord35=0
|
||||
flag35=134217780
|
||||
flagg35=134217728
|
||||
flagh35=20
|
||||
flagi35=0
|
||||
tflag35=0
|
||||
initx35=400
|
||||
inity35=300
|
||||
minx35=0
|
||||
miny35=0
|
||||
maxx35=800
|
||||
maxy35=600
|
||||
posx35=50
|
||||
posy35=50
|
||||
sizx35=800
|
||||
sizy35=600
|
||||
maxfps35=0
|
||||
initts35=0
|
||||
title36=The Sims
|
||||
path36=D:\Games\sims\Sims.exe
|
||||
module36=
|
||||
opengllib36=
|
||||
ver36=0
|
||||
coord36=0
|
||||
flag36=738336800
|
||||
flagg36=134217728
|
||||
flagh36=1044
|
||||
flagi36=0
|
||||
tflag36=66
|
||||
initx36=0
|
||||
inity36=0
|
||||
minx36=0
|
||||
miny36=0
|
||||
maxx36=0
|
||||
maxy36=0
|
||||
posx36=50
|
||||
posy36=50
|
||||
sizx36=800
|
||||
sizy36=600
|
||||
maxfps36=0
|
||||
initts36=0
|
||||
title37=Tomb Raider - The Last Revelation
|
||||
path37=D:\Games\Tomb Raider - The Last Revelation\tomb4.exe
|
||||
module37=
|
||||
opengllib37=
|
||||
ver37=0
|
||||
coord37=0
|
||||
flag37=134217826
|
||||
flagg37=134217728
|
||||
flagh37=20
|
||||
flagi37=0
|
||||
tflag37=3
|
||||
initx37=0
|
||||
inity37=0
|
||||
minx37=0
|
||||
miny37=0
|
||||
maxx37=0
|
||||
maxy37=0
|
||||
posx37=50
|
||||
posy37=50
|
||||
sizx37=800
|
||||
sizy37=600
|
||||
maxfps37=0
|
||||
initts37=0
|
||||
title38=TOMB2.EXE
|
||||
path38=D:\Games\Tomb Raider 2\TOMB2.EXE
|
||||
module38=
|
||||
opengllib38=
|
||||
ver38=0
|
||||
coord38=0
|
||||
flag38=134217760
|
||||
flagg38=201326592
|
||||
flagh38=2068
|
||||
flagi38=0
|
||||
tflag38=0
|
||||
initx38=0
|
||||
inity38=0
|
||||
minx38=0
|
||||
miny38=0
|
||||
maxx38=0
|
||||
maxy38=0
|
||||
posx38=50
|
||||
posy38=50
|
||||
sizx38=800
|
||||
sizy38=600
|
||||
maxfps38=0
|
||||
initts38=0
|
||||
title39=wa.exe
|
||||
path39=D:\Games\worms_arma\Worms_2_Armageddon\wa.exe
|
||||
module39=
|
||||
opengllib39=
|
||||
ver39=0
|
||||
coord39=0
|
||||
flag39=713031712
|
||||
flagg39=142606336
|
||||
flagh39=20
|
||||
flagi39=0
|
||||
tflag39=3
|
||||
initx39=0
|
||||
inity39=0
|
||||
minx39=0
|
||||
miny39=0
|
||||
maxx39=0
|
||||
maxy39=0
|
||||
posx39=50
|
||||
posy39=50
|
||||
sizx39=800
|
||||
sizy39=600
|
||||
maxfps39=0
|
||||
initts39=0
|
||||
title40=Western Front
|
||||
path40=D:\Games\Western Front\wf.exe
|
||||
module40=
|
||||
opengllib40=
|
||||
ver40=0
|
||||
coord40=0
|
||||
flag40=679477282
|
||||
flagg40=134217728
|
||||
flagh40=20
|
||||
flagi40=0
|
||||
tflag40=0
|
||||
initx40=0
|
||||
inity40=0
|
||||
minx40=0
|
||||
miny40=0
|
||||
maxx40=0
|
||||
maxy40=0
|
||||
posx40=50
|
||||
posy40=50
|
||||
sizx40=800
|
||||
sizy40=600
|
||||
maxfps40=0
|
||||
initts40=0
|
||||
title41=G-Nome
|
||||
path41=D:\Games\G-Nome\G-NOME.EXE
|
||||
module41=
|
||||
opengllib41=
|
||||
ver41=0
|
||||
coord41=0
|
||||
flag41=713031714
|
||||
flagg41=134217728
|
||||
flagh41=20
|
||||
flagi41=0
|
||||
tflag41=3
|
||||
initx41=0
|
||||
inity41=0
|
||||
minx41=0
|
||||
miny41=0
|
||||
maxx41=0
|
||||
maxy41=0
|
||||
posx41=50
|
||||
posy41=50
|
||||
sizx41=0
|
||||
sizy41=0
|
||||
maxfps41=0
|
||||
initts41=0
|
||||
[window]
|
||||
posx=928
|
||||
posy=224
|
||||
posx=908
|
||||
posy=205
|
||||
sizx=320
|
||||
sizy=455
|
||||
sizy=420
|
||||
|
@ -195,3 +195,21 @@ added CoCreateInstanceEx hook - "Final Fighter" seems to be using it, but who kn
|
||||
added "Don't move D3D Rendering Window" window option to make "Fable Lost Chapters" working
|
||||
GUI:
|
||||
updated default values on new entry creation to map most-likely-to-work parameters
|
||||
|
||||
v2.02.31
|
||||
CORE:
|
||||
disabled annoying compilation security warnings
|
||||
improved advapi32.dll hooking and logging
|
||||
handling of complex primary surfaces with backbuffer surface inherited from one directdraw session to the following and with different interfaces
|
||||
fixed SetCooperativeLevel handling in case of WINDOWED mode against desktop hwnd==NULL
|
||||
fixed GetGDISurface in EMULATED mode
|
||||
hooked gdi32 API set for Imperialism I & II and 688 Hunter Killer:GetClipBox, Polyline, PolyBezierTo, PolylineTo, PolyDraw, MoveToEx, ArcTo, LineTo, StretchDIBits, SetDIBitsToDevice, SetPixel, Ellipse, Polygon, Arc, CreateEllipticRgn, CreateEllipticRgnIndirect, CreateRectRgn, CreateRectRgnIndirect, CreatePolygonRgn, DrawTextA, DrawTextExA.
|
||||
fixed gdi32.dll hooking for TextOutA, TabbedTextOutA, Rectangle, BitBlt, PatBlt, StretchBlt, CreateFont, CreateFontIndirect
|
||||
improved ddraw proxy logging
|
||||
added / fixed user32.dll API FrameRect, TabbedTextOutA, CloseWindow, DestroyWindow, SendMessageW
|
||||
opengl: fixed glCreateContext, wglMakeCurrent to make Descent III playable in opengl video mode.
|
||||
fixed DeferWindowPos hook to make Imperialism II working
|
||||
fixed SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN properties
|
||||
fixed window class logging causing program crash
|
||||
GUI:
|
||||
added "GDI/Scale font parameters" & "DirectX/Disable HAL support" options
|
@ -1,3 +1,5 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <stdio.h>
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
@ -9,6 +11,7 @@ static HookEntry_Type Hooks[]={
|
||||
{"RegOpenKeyExA", NULL, (FARPROC *)&pRegOpenKeyEx, (FARPROC)extRegOpenKeyEx},
|
||||
{"RegCloseKey", NULL, (FARPROC *)&pRegCloseKey, (FARPROC)extRegCloseKey},
|
||||
{"RegQueryValueExA", NULL, (FARPROC *)&pRegQueryValueEx, (FARPROC)extRegQueryValueEx},
|
||||
{"RegCreateKeyA", NULL, (FARPROC *)&pRegCreateKey, (FARPROC)extRegCreateKey},
|
||||
{"RegCreateKeyExA", NULL, (FARPROC *)&pRegCreateKeyEx, (FARPROC)extRegCreateKeyEx},
|
||||
{"RegSetValueExA", NULL, (FARPROC *)&pRegSetValueEx, (FARPROC)extRegSetValueEx},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
@ -65,7 +68,7 @@ LONG WINAPI extRegOpenKeyEx(
|
||||
|
||||
if((res==ERROR_SUCCESS) || !(dxw.dwFlags3 & EMULATEREGISTRY)) return res;
|
||||
|
||||
*phkResult=HKEY_FAKE;
|
||||
if(phkResult) *phkResult=HKEY_FAKE;
|
||||
FILE *regf;
|
||||
char sKey[256+1];
|
||||
sprintf(sKey,"%s\\%s", hKey2String(hKey), lpSubKey);
|
||||
@ -75,8 +78,8 @@ LONG WINAPI extRegOpenKeyEx(
|
||||
fgets(RegBuf, 256, regf);
|
||||
while (!feof(regf)){
|
||||
if(RegBuf[0]=='['){
|
||||
if(!strncmp(&RegBuf[1],sKey,strlen(sKey)) && RegBuf[strlen(sKey)+1]==']'){
|
||||
OutTraceD("RegOpenKeyEx: found fake Key=\"%s\" hkResult=%x\n", sKey, *phkResult);
|
||||
if((!strncmp(&RegBuf[1],sKey,strlen(sKey))) && (RegBuf[strlen(sKey)+1]==']')){
|
||||
OutTrace("RegOpenKeyEx: found fake Key=\"%s\" hkResult=%x\n", sKey, *phkResult);
|
||||
fclose(regf);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
@ -110,11 +113,11 @@ LONG WINAPI extRegQueryValueEx(
|
||||
case REG_DWORD: OutTrace("Data=0x%x\n", *(DWORD *)lpData); break;
|
||||
case REG_BINARY:
|
||||
{
|
||||
int i;
|
||||
DWORD i;
|
||||
unsigned char *p;
|
||||
p = lpData;
|
||||
OutTrace("Data=");
|
||||
for(i=0; i<*lpcbData; i++) OutTrace("%02.2X,", *p++);
|
||||
OutTrace("Data=%02.2X", p++);
|
||||
for(i=1; i<*lpcbData; i++) OutTrace(",%02.2X", *p++);
|
||||
OutTrace("\n");
|
||||
}
|
||||
break;
|
||||
@ -129,7 +132,6 @@ LONG WINAPI extRegQueryValueEx(
|
||||
return res;
|
||||
}
|
||||
|
||||
// going through here means we're in EMULATEREGISTRY mode
|
||||
//if(!(dxw.dwFlags3 & EMULATEREGISTRY)) return res;
|
||||
|
||||
// try emulated registry
|
||||
@ -221,10 +223,17 @@ LONG WINAPI extRegCloseKey(HKEY hKey)
|
||||
LONG WINAPI extRegSetValueEx(HKEY hKey, LPCTSTR lpValueName, DWORD Reserved, DWORD dwType, const BYTE *lpData, DWORD cbData)
|
||||
{
|
||||
if (IsTraceR){
|
||||
OutTrace("RegSetValueEx: hKey=%x Type=%x(%s) cbData=%d\n", hKey, lpValueName, dwType, ExplainRegType(dwType), cbData);
|
||||
OutTrace("RegSetValueEx: hKey=%x ValueName=\"%s\" Type=%x(%s) cbData=%d ", hKey, lpValueName, dwType, ExplainRegType(dwType), cbData);
|
||||
switch(dwType){
|
||||
case REG_DWORD: OutTrace("Data=%x\n", *(DWORD *)lpData); break;
|
||||
case REG_NONE: OutTrace("ValueName=\"%s\"\n", lpData); break;
|
||||
case REG_NONE: OutTrace("Data=\"%s\"\n", lpData); break;
|
||||
case REG_BINARY: {
|
||||
DWORD i;
|
||||
OutTrace("Data=%02.2X,", *lpData);
|
||||
for(i=1; i<cbData; i++) OutTrace("%02.2X", lpData[i]);
|
||||
OutTrace("\n");
|
||||
};
|
||||
break;
|
||||
default: OutTrace("\n");
|
||||
}
|
||||
}
|
||||
@ -236,7 +245,7 @@ LONG WINAPI extRegCreateKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD Reserved, LPTST
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition)
|
||||
{
|
||||
OutTraceR("RegCreateKeyEx: hKey=%x(%s) SubKey=\"%s\" Class=%x\n", hKey, hKey2String(hKey), lpSubKey, lpClass);
|
||||
if (dxw.dwFlags3 && EMULATEREGISTRY){
|
||||
if (dxw.dwFlags3 & EMULATEREGISTRY){
|
||||
*phkResult = HKEY_FAKE;
|
||||
if(lpdwDisposition) *lpdwDisposition=REG_OPENED_EXISTING_KEY;
|
||||
return ERROR_SUCCESS;
|
||||
@ -246,3 +255,13 @@ LONG WINAPI extRegCreateKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD Reserved, LPTST
|
||||
lpSecurityAttributes, phkResult, lpdwDisposition);
|
||||
}
|
||||
|
||||
LONG WINAPI extRegCreateKey(HKEY hKey, LPCTSTR lpSubKey, PHKEY phkResult)
|
||||
{
|
||||
OutTraceR("RegCreateKey: hKey=%x(%s) SubKey=\"%s\"\n", hKey, hKey2String(hKey), lpSubKey);
|
||||
if (dxw.dwFlags3 & EMULATEREGISTRY){
|
||||
*phkResult = HKEY_FAKE;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
return (*pRegCreateKey)(hKey, lpSubKey, phkResult);
|
||||
}
|
||||
|
218
dll/ddraw.cpp
218
dll/ddraw.cpp
@ -1,6 +1,7 @@
|
||||
// to do: duplicate EnumSurfaces(D) handling
|
||||
// fix Unlock duplicate hook in Judge Dredd Pinball
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define INITGUID
|
||||
|
||||
#include <windows.h>
|
||||
@ -216,12 +217,13 @@ SetEntries_Type pSetEntries;
|
||||
|
||||
LPDIRECTDRAWSURFACE lpDDSEmu_Prim=NULL, lpDDSEmu_Back=NULL;
|
||||
LPDIRECTDRAWSURFACE lpDDSBack=NULL;
|
||||
// v2.1.87: lpPrimaryDD is the DIRECTDRAW object to which the primary surface and all
|
||||
// the service objects (emulated backbuffer, emulater primary, ....) are attached.
|
||||
LPDIRECTDRAW lpPrimaryDD=NULL;
|
||||
LPDIRECTDRAW lpBackBufferDD=NULL;
|
||||
int iBakBufferVersion;
|
||||
LPDIRECTDRAWCLIPPER lpDDC=NULL;
|
||||
LPDIRECTDRAWPALETTE lpDDP=NULL;
|
||||
LPDIRECTDRAW lpDD=NULL;
|
||||
// v2.1.87: lpServiceDD is the DIRECTDRAW object to which the primary surface and all
|
||||
// the service objects (emulated backbuffer, emulater primary, ....) are attached.
|
||||
LPDIRECTDRAW lpServiceDD=NULL;
|
||||
DWORD PaletteEntries[256];
|
||||
DWORD *Palette16BPP = NULL;
|
||||
void *EmuScreenBuffer = NULL; // to implement pitch bug fix
|
||||
@ -667,7 +669,13 @@ Unlock4_Type pUnlockMethod(LPDIRECTDRAWSURFACE lpdds)
|
||||
{
|
||||
char sMsg[81];
|
||||
void * extUnlock;
|
||||
extUnlock=(void *)*(DWORD *)(*(DWORD *)lpdds + 128);
|
||||
__try{ // v2.02.31: catch some possible exception (i.e. Abomination in EMULATION mode)
|
||||
extUnlock=(void *)*(DWORD *)(*(DWORD *)lpdds + 128);
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER){
|
||||
OutTraceE("Exception at %d\n",__LINE__);
|
||||
return (Unlock4_Type)pUnlock1;
|
||||
};
|
||||
if(extUnlock==(void *)extUnlock1) return (Unlock4_Type)pUnlock1;
|
||||
if(extUnlock==(void *)extUnlock4) return (Unlock4_Type)pUnlock4;
|
||||
if(extUnlock==(void *)extUnlockDir1) return (Unlock4_Type)pUnlock1;
|
||||
@ -743,10 +751,10 @@ int lpddHookedVersion(LPDIRECTDRAW lpdd)
|
||||
__except (EXCEPTION_EXECUTE_HANDLER){
|
||||
extCreateSurface=NULL;
|
||||
};
|
||||
if(extCreateSurface==(void *)extCreateSurface1) return 1;
|
||||
if(extCreateSurface==(void *)extCreateSurface2) return 2;
|
||||
if(extCreateSurface==(void *)extCreateSurface4) return 4;
|
||||
if(extCreateSurface==(void *)extCreateSurface7) return 7;
|
||||
if(extCreateSurface==(void *)extCreateSurface4) return 4;
|
||||
if(extCreateSurface==(void *)extCreateSurface2) return 2;
|
||||
if(extCreateSurface==(void *)extCreateSurface1) return 1;
|
||||
sprintf_s(sMsg, 80, "lpddHookedVersion(%x) can't match %x\n", lpdd, extCreateSurface);
|
||||
OutTraceD(sMsg);
|
||||
if (IsAssertEnabled) MessageBox(0, sMsg, "lpddHookedVersion", MB_OK | MB_ICONEXCLAMATION);
|
||||
@ -833,7 +841,7 @@ int Set_dwSize_From_Surface(LPDIRECTDRAWSURFACE lpdds)
|
||||
lpdds==lpDDSEmu_Prim ||
|
||||
lpdds==lpDDSEmu_Back
|
||||
)
|
||||
dxversion=lpddHookedVersion(lpServiceDD); // v2.1.87 fix
|
||||
dxversion=lpddHookedVersion(lpPrimaryDD); // v2.01.87-v2.02.31 fix
|
||||
else
|
||||
dxversion=lpddsHookedVersion(lpdds);
|
||||
|
||||
@ -1282,10 +1290,6 @@ HRESULT WINAPI extGetCapsD(LPDIRECTDRAW lpdd, LPDDCAPS c1, LPDDCAPS c2)
|
||||
OutTraceD("\n");
|
||||
}
|
||||
|
||||
// GHO TRY
|
||||
// tricky: it seems that this DD method is called using an un-hooked directdraw handle....
|
||||
lpDD=lpdd;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -1337,8 +1341,6 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I
|
||||
|
||||
HookDDSession(lplpdd, dxw.dwDDVersion);
|
||||
|
||||
// added v2.1.44
|
||||
lpDD = *lplpdd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1420,8 +1422,6 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
|
||||
|
||||
HookDDSession(lplpdd,dxw.dwDDVersion);
|
||||
|
||||
// added v2.1.44
|
||||
lpDD = *lplpdd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1482,6 +1482,9 @@ HRESULT WINAPI extQueryInterfaceD(void *lpdd, REFIID riid, LPVOID *obp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// some unhandled interfaces in emulation mode:
|
||||
// REFIID={84e63de0-46aa-11cf-816f-0000c020156e}: IID_IDirect3DHALDevice
|
||||
|
||||
HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp)
|
||||
{
|
||||
HRESULT res;
|
||||
@ -1507,6 +1510,15 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp)
|
||||
case 0x06675a80:
|
||||
dwLocalDDVersion = 7;
|
||||
break;
|
||||
case 0x84e63de0:
|
||||
if (dxw.dwFlags3 & DISABLEHAL){ // IID_IDirect3DHALDevice - Dark Vengeance
|
||||
// this is odd: this piece of code returns the very same error code returned by the actual
|
||||
// QueryInterface call, but avoid a memory corruption and makes the game working....
|
||||
// there must be something wrong behind it.
|
||||
OutTraceD("QueryInterface: suppress IID_IDirect3DHALDevice interface res=DDERR_GENERIC\n");
|
||||
return DDERR_GENERIC;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (dwLocalDDVersion > dxw.dwMaxDDVersion) {
|
||||
@ -1690,33 +1702,30 @@ void FixWindowFrame(HWND hwnd)
|
||||
HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags)
|
||||
{
|
||||
HRESULT res;
|
||||
HWND hDesktop;
|
||||
|
||||
OutTraceD("SetCooperativeLevel: hwnd=%x dwFlags=%x(%s)\n",
|
||||
hwnd, dwflags,ExplainCoopFlags(dwflags));
|
||||
|
||||
InitDDScreenParameters((LPDIRECTDRAW)lpdd);
|
||||
|
||||
// WARN: Tomb Raider 4 demo is setting cooperative level against hwnd 0 (desktop)
|
||||
// so in this case better use the registered hWnd value. Same as GP500, who uses
|
||||
// the desktop window handle.
|
||||
// v2.1.82 fix:
|
||||
hDesktop=(*pGetDesktopWindow)();
|
||||
if ((hwnd==0) || (hwnd==hDesktop)) {
|
||||
OutTraceD("SetCooperativeLevel: detected desktop hwnd=%x redirected to %x\n", hwnd, dxw.GethWnd());
|
||||
hwnd=dxw.GethWnd();
|
||||
// this fixes the blocks on "Tomb Raider IV" !!!!
|
||||
if(dxw.dwFlags1 & FIXPARENTWIN) hwnd=dxw.hParentWnd;
|
||||
}
|
||||
|
||||
if (dwflags & DDSCL_FULLSCREEN){
|
||||
// v2.01.82 fix:
|
||||
// WARN: Tomb Raider 4 demo is setting cooperative level against hwnd 0 (desktop)
|
||||
// so in this case better use the registered hWnd value. Same as GP500, who uses
|
||||
// the desktop window handle.
|
||||
// v2.02.31 fix:
|
||||
// Hooligans - Storm over Europe wants to set cooperative level NORMAL to hwnd 0
|
||||
// that is legitimate, but setting against desktop window gives an error code - so
|
||||
// the zero hwnd redirection had to be moved within the FULLSCREEN if case.
|
||||
if(dxw.IsRealDesktop(hwnd)){
|
||||
OutTraceD("SetCooperativeLevel: desktop hwnd=%x -> %x\n", hwnd, dxw.GethWnd());
|
||||
hwnd=dxw.GethWnd();
|
||||
}
|
||||
dxw.SetFullScreen(TRUE);
|
||||
dwflags &= ~(DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX);
|
||||
dwflags |= DDSCL_NORMAL;
|
||||
//res=(*pSetCooperativeLevel)(lpdd, hwnd, DDSCL_NORMAL);
|
||||
res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags);
|
||||
AdjustWindowFrame(hwnd, dxw.GetScreenWidth(), dxw.GetScreenHeight());
|
||||
//FixWindowFrame(hwnd); //-- incompatible with Microsoft Madness
|
||||
if (dxw.dwFlags1 & FIXWINFRAME) FixWindowFrame(hwnd);
|
||||
}
|
||||
else{
|
||||
@ -1738,7 +1747,7 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags)
|
||||
// done, so better repeat the check here.
|
||||
|
||||
if ((res==DD_OK) && (hwnd!=NULL)){
|
||||
if (hwnd==hDesktop){
|
||||
if (hwnd==(*pGetDesktopWindow)()){
|
||||
OutTraceE("SetCooperativeLevel: attempt to work on desktop window\n");
|
||||
}
|
||||
else
|
||||
@ -1767,12 +1776,40 @@ static char *FixSurfaceCaps(LPDDSURFACEDESC2 lpddsd)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT:
|
||||
// Duckman
|
||||
OutTrace("FixSurfaceCaps: SystemMemory OffScreen PixelFormat\n");
|
||||
lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
|
||||
lpddsd->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN;
|
||||
return SetPixFmt(lpddsd);
|
||||
switch (lpddsd->ddsCaps.dwCaps){
|
||||
case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY:
|
||||
// Duckman
|
||||
OutTrace("FixSurfaceCaps: SystemMemory OffScreen PixelFormat\n");
|
||||
//lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY;
|
||||
//lpddsd->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN;
|
||||
return SetPixFmt(lpddsd);
|
||||
break;
|
||||
case DDSCAPS_SYSTEMMEMORY|DDSCAPS_ZBUFFER:
|
||||
// the Sims
|
||||
OutTrace("FixSurfaceCaps: SystemMemory ZBuffer for the Sims\n");
|
||||
//lpddsd->ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY|DDSCAPS_ZBUFFER; identical ...
|
||||
return "ZBUFFER";
|
||||
break;
|
||||
#if 0
|
||||
case DDSCAPS_TEXTURE:
|
||||
// Descent 3 cursors & other graphics
|
||||
OutTrace("FixSurfaceCaps: Texture for Descent 3\n");
|
||||
lpddsd->ddsCaps.dwCaps = DDSCAPS_TEXTURE|DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN;
|
||||
SetPixFmt(lpddsd);
|
||||
return "TEXTURE1";
|
||||
break;
|
||||
case DDSCAPS_TEXTURE|DDSCAPS_VIDEOMEMORY:
|
||||
// Descent 3 cursors & other graphics
|
||||
OutTrace("FixSurfaceCaps: VideoMemory Texture for Descent 3\n");
|
||||
lpddsd->ddsCaps.dwCaps = DDSCAPS_TEXTURE|DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN;
|
||||
SetPixFmt(lpddsd);
|
||||
return "TEXTURE2";
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH:
|
||||
switch (lpddsd->ddsCaps.dwCaps){
|
||||
case DDSCAPS_OFFSCREENPLAIN|DDSCAPS_VIDEOMEMORY:
|
||||
@ -1785,6 +1822,7 @@ static char *FixSurfaceCaps(LPDDSURFACEDESC2 lpddsd)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1841,7 +1879,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
|
||||
GetHookInfo()->Width=(short)dxw.GetScreenWidth();
|
||||
GetHookInfo()->ColorDepth=(short)dxw.VirtualPixelFormat.dwRGBBitCount;
|
||||
GetHookInfo()->DXVersion=dxversion;
|
||||
lpServiceDD = lpdd; // v2.1.87
|
||||
lpPrimaryDD = lpdd; // v2.1.87
|
||||
|
||||
dxw.dwPrimarySurfaceCaps = ddsd.ddsCaps.dwCaps;
|
||||
dxw.dwBackBufferCount = (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) ? ddsd.dwBackBufferCount : 0;
|
||||
@ -1851,17 +1889,22 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
|
||||
if (lpDDC) while(lpDDC->Release());
|
||||
if (lpDDSEmu_Back) while(lpDDSEmu_Back->Release());
|
||||
if (lpDDSEmu_Prim) while(lpDDSEmu_Prim->Release());
|
||||
if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT)
|
||||
if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) {
|
||||
if (lpDDSBack) while(lpDDSBack->Release());
|
||||
lpBackBufferDD = NULL;
|
||||
}
|
||||
}
|
||||
lpDDC=NULL;
|
||||
lpDDSEmu_Back=NULL;
|
||||
lpDDSEmu_Prim=NULL;
|
||||
if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT)
|
||||
lpDDSBack=NULL;
|
||||
|
||||
int BBCount=1;
|
||||
if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) BBCount=ddsd.dwBackBufferCount;
|
||||
if ((BBCount > 0) && (iBakBufferVersion < 4)){
|
||||
lpDDSBack=NULL;
|
||||
OutTraceD("CreateSurface: backbuffer cleared - BackBufferCount=%d\n", BBCount);
|
||||
}
|
||||
|
||||
if (BBCount > MAXBACKBUFFERS){
|
||||
char sMsg[81];
|
||||
sprintf_s(sMsg, 80, "CreateSurface: BackBufferCount=%d\n", BBCount);
|
||||
@ -1888,9 +1931,19 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Primary]" , __LINE__);
|
||||
res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
if(res){
|
||||
OutTraceE("CreateSurface ERROR: res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd);
|
||||
return res;
|
||||
if (res==DDERR_PRIMARYSURFACEALREADYEXISTS){
|
||||
LPDIRECTDRAWSURFACE lpPrim;
|
||||
OutTraceE("CreateSurface: CreateSurface DDERR_PRIMARYSURFACEALREADYEXISTS workaround\n");
|
||||
(*pGetGDISurface)(lpPrimaryDD, &lpPrim);
|
||||
while ((*pReleaseS)(lpPrim));
|
||||
res = (*pCreateSurface)(lpdd, &ddsd, lplpdds, 0);
|
||||
}
|
||||
/* fall through */
|
||||
if(res){
|
||||
OutTraceE("CreateSurface ERROR: res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
lpDDSPrim = *lplpdds;
|
||||
OutTraceD("CreateSurface: created PRIMARY DDSPrim=%x\n", lpDDSPrim);
|
||||
@ -1922,7 +1975,10 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
|
||||
OutTraceD("CreateSurface: created BACK DDSBack=%x\n", lpDDSBack);
|
||||
dxw.UnmarkPrimarySurface(lpDDSBack);
|
||||
HookDDSurfaceGeneric(&lpDDSBack, dxversion); // added !!!
|
||||
lpBackBufferDD = lpdd; // v2.02.31
|
||||
iBakBufferVersion=dxversion; // v2.02.31
|
||||
}
|
||||
|
||||
FlipChainLength=BBCount;
|
||||
// V2.1.85: tricky !!!!
|
||||
// When a real backbuffer is created, it has a reference to its frontbuffer.
|
||||
@ -2050,7 +2106,7 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf
|
||||
GetHookInfo()->DXVersion=dxversion;
|
||||
dxw.dwPrimarySurfaceCaps = ddsd.ddsCaps.dwCaps;
|
||||
dxw.dwBackBufferCount = (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) ? ddsd.dwBackBufferCount : 0;
|
||||
lpServiceDD = lpdd; // v2.1.87
|
||||
lpPrimaryDD = lpdd; // v2.1.87
|
||||
|
||||
// clean up service objects
|
||||
// beware of the different behaviour between older and newer directdraw releases...
|
||||
@ -2074,7 +2130,11 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf
|
||||
|
||||
int BBCount=1;
|
||||
if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) BBCount=ddsd.dwBackBufferCount;
|
||||
if (BBCount > 0){
|
||||
// beware: a previously allocated backbuffer should be cleared or not depending on
|
||||
// the ddraw version of the backbuffer surface, not the current one!
|
||||
//if(0){ // ok for Silent Hunter II
|
||||
//if(1){ // ok for Dark Vengeance
|
||||
if ((BBCount > 0) && (iBakBufferVersion < 4)){
|
||||
lpDDSBack=NULL;
|
||||
OutTraceD("CreateSurface: BackBufferCount=%d\n", BBCount);
|
||||
}
|
||||
@ -2093,6 +2153,14 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir Primary]" , __LINE__);
|
||||
res = (*pCreateSurface)(lpdd, &ddsd, &lpDDSPrim, pu);
|
||||
if(res){
|
||||
if (res==DDERR_PRIMARYSURFACEALREADYEXISTS){
|
||||
LPDIRECTDRAWSURFACE lpPrim;
|
||||
OutTraceE("CreateSurface: CreateSurface DDERR_PRIMARYSURFACEALREADYEXISTS workaround\n");
|
||||
(*pGetGDISurface)(lpPrimaryDD, &lpPrim);
|
||||
while ((*pReleaseS)(lpPrim));
|
||||
res = (*pCreateSurface)(lpdd, &ddsd, &lpDDSPrim, pu);
|
||||
}
|
||||
/* fall through */
|
||||
if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){
|
||||
OutTraceD("CreateSurface: CreateSurface DDERR_OUTOFVIDEOMEMORY ERROR at %d, retry in SYSTEMMEMORY\n", __LINE__);
|
||||
ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; // try ...
|
||||
@ -2139,11 +2207,12 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf
|
||||
RenewClipper(lpdd, lpDDSPrim);
|
||||
}
|
||||
|
||||
|
||||
HookDDSurfacePrim(&lpDDSPrim, dxversion);
|
||||
if(dxw.dwFlags1 & CLIPCURSOR) dxw.SetClipCursor();
|
||||
|
||||
if (!BBCount) return 0;
|
||||
FlipChainLength=BBCount;
|
||||
if (lpDDSBack) return 0; // v2.02.31: if you got a previous backbuffer surface, use it!
|
||||
|
||||
ddsd.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
||||
// warning: can't create zero sized backbuffer surface !!!!
|
||||
@ -2187,8 +2256,9 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf
|
||||
// reference to the zero count.
|
||||
// Should this hold for EMULATED mode as well? Maybe, but Diablo crashes....
|
||||
lpDDSBack->AddRef();
|
||||
lpBackBufferDD = lpdd;
|
||||
iBakBufferVersion=dxversion; // v2.02.31
|
||||
|
||||
if(dxw.dwFlags1 & CLIPCURSOR) dxw.SetClipCursor();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2275,7 +2345,6 @@ HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreateSurface
|
||||
lpddsd->dwFlags++;
|
||||
}
|
||||
|
||||
lpDD = lpdd;
|
||||
if (dxw.dwFlags3 & SAVECAPS) ddsd=*lpddsd;
|
||||
|
||||
if (dxw.dwFlags1 & EMULATESURFACE)
|
||||
@ -2298,6 +2367,13 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
|
||||
OutTraceD("GetAttachedSurface(%d): lpdds=%x%s caps=%x(%s)\n",
|
||||
dxversion, lpdds, (IsPrim?"(PRIM)":""), lpddsc->dwCaps, ExplainDDSCaps(lpddsc->dwCaps));
|
||||
|
||||
#if 0
|
||||
if(0 && (lpddsc->dwCaps & DDSCAPS_MIPMAP)){
|
||||
OutTraceD("GetAttachedSurface: emulate MIPMAP capability\n");
|
||||
lpddsc->dwCaps &= ~DDSCAPS_MIPMAP;
|
||||
}
|
||||
#endif
|
||||
|
||||
// if not primary, just proxy the method
|
||||
|
||||
// v2.1.81: fix to make "Silver" working: if the primary surface was created with
|
||||
@ -2397,7 +2473,7 @@ static void BlitTrace(char *label, LPRECT lps, LPRECT lpd, int line)
|
||||
OutTrace(" dest=(%d,%d)-(%d,%d)",lpd->left, lpd->top, lpd->right, lpd->bottom);
|
||||
else
|
||||
OutTrace(" dest=(NULL)");
|
||||
OutTrace(" at %d\n", __LINE__);
|
||||
OutTrace(" at %d\n", line);
|
||||
ReleaseMutex(hTraceMutex);
|
||||
return;
|
||||
}
|
||||
@ -2452,7 +2528,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
|
||||
#endif
|
||||
|
||||
#define FIXBIGGERRECT 1
|
||||
#ifdef FIXBIGGERRECT
|
||||
#if FIXBIGGERRECT
|
||||
if(ToPrim && lpdestrect){
|
||||
if((DWORD)lpdestrect->bottom > dxw.GetScreenHeight()) lpdestrect->bottom = dxw.GetScreenHeight();
|
||||
if((DWORD)lpdestrect->right > dxw.GetScreenWidth()) lpdestrect->right = dxw.GetScreenWidth();
|
||||
@ -2542,7 +2618,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
|
||||
// Blit to primary surface
|
||||
|
||||
if(dxw.HandleFPS()) return DD_OK;
|
||||
|
||||
|
||||
destrect=dxw.MapWindowRect(lpdestrect);
|
||||
|
||||
if(!(dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER))){
|
||||
@ -2649,7 +2725,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
|
||||
if (IsDebug) BlitTrace("BACK2PRIM", &emurect, &destrect, __LINE__);
|
||||
res=(*pBlt)(lpDDSEmu_Prim, &destrect, lpDDSSource, &emurect, DDBLT_WAIT, 0);
|
||||
if (res==DDERR_NOCLIPLIST){
|
||||
RenewClipper(lpDD, lpDDSEmu_Prim);
|
||||
RenewClipper(lpPrimaryDD, lpDDSEmu_Prim);
|
||||
if (IsDebug) BlitTrace("NOCLIP", &emurect, &destrect, __LINE__);
|
||||
res=(*pBlt)(lpDDSEmu_Prim, &destrect, lpDDSSource, &emurect, DDBLT_WAIT, 0);
|
||||
}
|
||||
@ -2707,8 +2783,7 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc,
|
||||
// emulation to primary surface Flip - you can't flip to window surfaces,
|
||||
// so you have to replace it with Blt operations.
|
||||
|
||||
//lpdds->GetDDInterface(lpDD); from IDirectDrawSurface2 only
|
||||
if((dwflags & DDFLIP_WAIT) || (dxw.dwFlags1 & SAVELOAD)) lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKEND , 0);
|
||||
if((dwflags & DDFLIP_WAIT) || (dxw.dwFlags1 & SAVELOAD)) lpPrimaryDD->WaitForVerticalBlank(DDWAITVB_BLOCKEND , 0);
|
||||
|
||||
if(lpddssrc){
|
||||
//res=lpdds->Blt(0, lpddssrc, 0, DDBLT_WAIT, 0);
|
||||
@ -3015,7 +3090,7 @@ HRESULT WINAPI extLockDir(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAW
|
||||
|
||||
// this hooker operates on
|
||||
// Beware!!! for strange reason, the function gets hooked to ANY surface, also non primary ones!!!
|
||||
// to find out whether it is the primary or not, using lpdds==lpDD->GetGDISurface(&lpDDSPrim);
|
||||
// to find out whether it is the primary or not, using lpdds==lpPrimaryDD->GetGDISurface(&lpDDSPrim);
|
||||
|
||||
if(IsTraceD){
|
||||
OutTrace("Lock: lpdds=%x flags=%x(%s) lpdds2=%x",
|
||||
@ -3026,7 +3101,7 @@ HRESULT WINAPI extLockDir(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAW
|
||||
OutTrace(" rect=(NULL)\n");
|
||||
}
|
||||
|
||||
(*pGetGDISurface)(lpDD, &lpDDSPrim);
|
||||
(*pGetGDISurface)(lpPrimaryDD, &lpDDSPrim);
|
||||
if(lpdds==lpDDSPrim){
|
||||
if(dxw.dwFlags1 & LOCKEDSURFACE){
|
||||
DDSURFACEDESC2 ddsd;
|
||||
@ -3040,8 +3115,7 @@ HRESULT WINAPI extLockDir(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAW
|
||||
ddsd.ddsCaps.dwCaps = 0;
|
||||
//if (SurfaceDescrSize(lpdds)==sizeof(DDSURFACEDESC2)) ddsd.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN;
|
||||
DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir FixBuf]" , __LINE__);
|
||||
//res=(*pCreateSurfaceMethod(lpdds))(lpDD, &ddsd, (LPDIRECTDRAWSURFACE *)&lpDDSBuffer, 0);
|
||||
res=(*pCreateSurface1)(lpDD, (DDSURFACEDESC *)&ddsd, (LPDIRECTDRAWSURFACE *)&lpDDSBuffer, 0);
|
||||
res=(*pCreateSurface1)(lpPrimaryDD, (DDSURFACEDESC *)&ddsd, (LPDIRECTDRAWSURFACE *)&lpDDSBuffer, 0);
|
||||
if(res){
|
||||
OutTraceE("CreateSurface: ERROR on DDSBuffer res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
@ -3141,7 +3215,7 @@ HRESULT WINAPI extUnlockDir(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSUR
|
||||
OutTrace("lpvoid=%x\n", lprect);
|
||||
}
|
||||
|
||||
(*pGetGDISurface)(lpDD, &lpDDSPrim);
|
||||
(*pGetGDISurface)(lpPrimaryDD, &lpDDSPrim);
|
||||
if((lpdds==lpDDSPrim) && (dxw.dwFlags1 & LOCKEDSURFACE)){
|
||||
RECT client;
|
||||
POINT upleft={0,0};
|
||||
@ -3195,7 +3269,7 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC)
|
||||
if(lpDDP==NULL){
|
||||
// should link here to the GDI palette? See Hyperblade....
|
||||
dxw.palNumEntries=256;
|
||||
res=(*pCreatePalette)(lpDD, DDPCAPS_ALLOW256|DDPCAPS_8BIT|DDPCAPS_INITIALIZE, dxw.palPalEntry, &lpDDP, NULL);
|
||||
res=(*pCreatePalette)(lpPrimaryDD, DDPCAPS_ALLOW256|DDPCAPS_8BIT|DDPCAPS_INITIALIZE, dxw.palPalEntry, &lpDDP, NULL);
|
||||
if (res) {
|
||||
OutTraceE("GetDC: CreatePalette ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||
return res;
|
||||
@ -3244,6 +3318,14 @@ HRESULT WINAPI extFlipToGDISurface(LPDIRECTDRAW lpdd)
|
||||
HRESULT WINAPI extGetGDISurface(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE *w)
|
||||
{
|
||||
int res;
|
||||
|
||||
// v2.02.31:
|
||||
// in EMULATED mode, should not return the actual ddraw primary surface, but the virtual one.
|
||||
if(dxw.dwFlags1 & EMULATESURFACE){
|
||||
*w=dxw.GetPrimarySurface();
|
||||
return DD_OK;
|
||||
}
|
||||
|
||||
res=(*pGetGDISurface)(lpdd, w);
|
||||
if (res) {
|
||||
OutTraceE("GetGDISurface: ERROR lpdd=%x res=%x(%s)\n", lpdd, res, ExplainDDError(res));
|
||||
@ -3599,6 +3681,7 @@ HRESULT WINAPI extAddAttachedSurface(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURF
|
||||
|
||||
IsPrim=dxw.IsAPrimarySurface(lpdds);
|
||||
OutTraceD("AddAttachedSurface: lpdds=%x%s lpddsadd=%x\n", lpdds, IsPrim?"(PRIM)":"", lpddsadd);
|
||||
//if(!lpddsadd) return DDERR_CANNOTATTACHSURFACE; // to avoid a crash...
|
||||
res=(*pAddAttachedSurface)(lpdds, lpddsadd);
|
||||
if (res) {
|
||||
HRESULT sdres;
|
||||
@ -3717,7 +3800,7 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd)
|
||||
BOOL IsClosed;
|
||||
|
||||
dxversion=lpddHookedVersion(lpdd); // must be called BEFORE releasing the session!!
|
||||
OutTraceD("Release(D): lpdd=%x\n", lpdd);
|
||||
OutTraceD("Release(D): lpdd=%x dxversion=%d\n", lpdd, dxversion);
|
||||
|
||||
IsClosed=0;
|
||||
__try{
|
||||
@ -3733,7 +3816,7 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd)
|
||||
|
||||
ref=IsClosed?0:(*pReleaseD)(lpdd);
|
||||
|
||||
if (lpdd == lpServiceDD) { // v2.1.87: fix for Dungeon Keeper II
|
||||
if (lpdd == lpPrimaryDD) { // v2.1.87: fix for Dungeon Keeper II
|
||||
OutTraceD("Release(D): service lpdd=%x version=%d\n", lpdd, dxversion);
|
||||
if((dxversion<4) && (ref==0)){
|
||||
// directdraw old versions automatically free all linked objects when the parent session is closed.
|
||||
@ -3741,9 +3824,12 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd)
|
||||
lpDDSEmu_Prim=NULL;
|
||||
lpDDSEmu_Back=NULL;
|
||||
lpDDC=NULL;
|
||||
lpDDSBack=NULL;
|
||||
lpDDP=NULL;
|
||||
lpServiceDD=NULL; // v2.02.11
|
||||
lpPrimaryDD=NULL; // v2.02.31
|
||||
if(lpBackBufferDD==lpdd){
|
||||
lpBackBufferDD=NULL;
|
||||
lpDDSBack=NULL; // beware: Silent Hunter II seems to require the backbuffer ....
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#define DIRECTINPUT_VERSION 0x800
|
||||
|
||||
#include <windows.h>
|
||||
#include <dinput.h>
|
||||
#include "dxwnd.h"
|
||||
|
@ -1211,3 +1211,14 @@ char *ExplainRegType(DWORD c)
|
||||
return "???";
|
||||
}
|
||||
|
||||
char *ExplainDCType(DWORD c)
|
||||
{
|
||||
char *Captions[GDI_OBJ_LAST+1]={
|
||||
"NULL", "OBJ_PEN", "OBJ_BRUSH", "OBJ_DC",
|
||||
"OBJ_METADC", "OBJ_PAL", "OBJ_FONT", "OBJ_BITMAP",
|
||||
"OBJ_REGION", "OBJ_METAFILE", "OBJ_MEMDC", "OBJ_EXTPEN",
|
||||
"OBJ_ENHMETADC", "OBJ_ENHMETAFILE", "OBJ_COLORSPACE"};
|
||||
|
||||
if (c>=0 && c<=GDI_OBJ_LAST) return Captions[c];
|
||||
return "???";
|
||||
}
|
||||
|
@ -33,3 +33,4 @@ extern char *ExplainDevModeFields(DWORD);
|
||||
extern char *ExplainMCICommands(DWORD);
|
||||
extern char *ExplainMCIFlags(DWORD, DWORD);
|
||||
extern char *ExplainRegType(DWORD);
|
||||
extern char *ExplainDCType(DWORD);
|
||||
|
@ -57,7 +57,7 @@ static char *Flag3Names[32]={
|
||||
"FORCEHOOKOPENGL", "MARKBLIT", "HOOKDLLS", "SUPPRESSD3DEXT",
|
||||
"HOOKENABLED", "FIXD3DFRAME", "FORCE16BPP", "BLACKWHITE",
|
||||
"SAVECAPS", "SINGLEPROCAFFINITY", "EMULATEREGISTRY", "CDROMDRIVETYPE",
|
||||
"Flag3:13", "Flag3:14", "Flag3:15", "Flag3:16",
|
||||
"NOWINDOWMOVE", "Flag3:14", "Flag3:15", "Flag3:16",
|
||||
"", "", "", "",
|
||||
"", "", "", "",
|
||||
"", "", "", "",
|
||||
@ -924,8 +924,10 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
|
||||
}
|
||||
break;
|
||||
case WM_ERASEBKGND:
|
||||
OutTraceD("WindowProc: WM_ERASEBKGND(%x,%x) - suppressed\n", wparam, lparam);
|
||||
return 1; // 1 == OK, erased
|
||||
if(dxw.IsRealDesktop(hwnd)){
|
||||
OutTraceD("WindowProc: WM_ERASEBKGND(%x,%x) - suppressed\n", wparam, lparam);
|
||||
return 1; // 1 == OK, erased
|
||||
}
|
||||
break;
|
||||
case WM_DISPLAYCHANGE:
|
||||
if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()){
|
||||
@ -1126,7 +1128,7 @@ static void RecoverScreenMode()
|
||||
DEVMODE InitDevMode;
|
||||
BOOL res;
|
||||
EnumDisplaySettings(NULL, ENUM_REGISTRY_SETTINGS, &InitDevMode);
|
||||
OutTraceD("ChangeDisplaySettings: RECOVER wxh=(%dx%d) BitsPerPel=%d\n",
|
||||
OutTraceD("ChangeDisplaySettings: RECOVER WxH=(%dx%d) BitsPerPel=%d\n",
|
||||
InitDevMode.dmPelsWidth, InitDevMode.dmPelsHeight, InitDevMode.dmBitsPerPel);
|
||||
InitDevMode.dmFields |= DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
res=(*pChangeDisplaySettings)(&InitDevMode, 0);
|
||||
@ -1306,10 +1308,8 @@ void SetSingleProcessAffinity(void)
|
||||
OutTraceE("SetProcessAffinityMask: ERROR err=%d\n", GetLastError());
|
||||
}
|
||||
|
||||
int HookInit(TARGETMAP *target, HWND hwnd)
|
||||
void HookInit(TARGETMAP *target, HWND hwnd)
|
||||
{
|
||||
BOOL res;
|
||||
WINDOWPOS wp;
|
||||
HMODULE base;
|
||||
char *sModule;
|
||||
char sModuleBuf[60+1];
|
||||
@ -1320,16 +1320,24 @@ int HookInit(TARGETMAP *target, HWND hwnd)
|
||||
|
||||
dxw.InitTarget(target);
|
||||
|
||||
// v2.1.75: is it correct to set hWnd here?
|
||||
dxw.SethWnd(hwnd);
|
||||
dxw.hParentWnd=GetParent(hwnd);
|
||||
dxw.hChildWnd=hwnd;
|
||||
if(hwnd){ // v2/02.32: skip this when in code injection mode.
|
||||
// v2.1.75: is it correct to set hWnd here?
|
||||
//dxw.SethWnd(hwnd);
|
||||
dxw.hParentWnd=GetParent(hwnd);
|
||||
dxw.hChildWnd=hwnd;
|
||||
// v2.02.31: set main win either this one or the parent!
|
||||
dxw.SethWnd((dxw.dwFlags1 & FIXPARENTWIN) ? GetParent(hwnd) : hwnd);
|
||||
}
|
||||
|
||||
OutTraceD("HookInit: path=\"%s\" module=\"%s\" dxversion=%s pos=(%d,%d) size=(%d,%d) hWnd=%x dxw.hParentWnd=%x desktop=%x\n",
|
||||
target->path, target->module, dxversions[dxw.dwTargetDDVersion],
|
||||
target->posx, target->posy, target->sizx, target->sizy,
|
||||
hwnd, dxw.hParentWnd, GetDesktopWindow());
|
||||
if (IsDebug){
|
||||
if(IsTraceD){
|
||||
OutTrace("HookInit: path=\"%s\" module=\"%s\" dxversion=%s pos=(%d,%d) size=(%d,%d)",
|
||||
target->path, target->module, dxversions[dxw.dwTargetDDVersion],
|
||||
target->posx, target->posy, target->sizx, target->sizy);
|
||||
if(hwnd) OutTrace(" hWnd=%x dxw.hParentWnd=%x desktop=%x\n", hwnd, dxw.hParentWnd, GetDesktopWindow());
|
||||
else OutTrace("\n");
|
||||
}
|
||||
|
||||
if (hwnd && IsDebug){
|
||||
DWORD dwStyle, dwExStyle;
|
||||
dwStyle=GetWindowLong(dxw.GethWnd(), GWL_STYLE);
|
||||
dwExStyle=GetWindowLong(dxw.GethWnd(), GWL_EXSTYLE);
|
||||
@ -1349,7 +1357,8 @@ int HookInit(TARGETMAP *target, HWND hwnd)
|
||||
|
||||
if (dxw.dwTFlags & DXPROXED){
|
||||
HookDDProxy(base, dxw.dwTargetDDVersion);
|
||||
return 0;
|
||||
//return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// make InitPosition used for both DInput and DDraw
|
||||
@ -1382,14 +1391,14 @@ int HookInit(TARGETMAP *target, HWND hwnd)
|
||||
InitScreenParameters();
|
||||
|
||||
if (IsDebug) OutTraceD("MoveWindow: target pos=(%d,%d) size=(%d,%d)\n", dxw.iPosX, dxw.iPosY, dxw.iSizX, dxw.iSizY); //v2.02.09
|
||||
if(dxw.dwFlags1 & FIXPARENTWIN){
|
||||
CalculateWindowPos(hwnd, dxw.iSizX, dxw.iSizY, &wp);
|
||||
if (IsDebug) OutTraceD("MoveWindow: dxw.hParentWnd=%x pos=(%d,%d) size=(%d,%d)\n", dxw.hParentWnd, wp.x, wp.y, wp.cx, wp.cy);
|
||||
res=(*pMoveWindow)(dxw.hParentWnd, wp.x, wp.y, wp.cx, wp.cy, FALSE);
|
||||
if(!res) OutTraceE("MoveWindow ERROR: dxw.hParentWnd=%x err=%d at %d\n", dxw.hParentWnd, GetLastError(), __LINE__);
|
||||
}
|
||||
//if(dxw.dwFlags1 & FIXPARENTWIN){
|
||||
// CalculateWindowPos(hwnd, dxw.iSizX, dxw.iSizY, &wp);
|
||||
// if (IsDebug) OutTraceD("MoveWindow: dxw.hParentWnd=%x pos=(%d,%d) size=(%d,%d)\n", dxw.hParentWnd, wp.x, wp.y, wp.cx, wp.cy);
|
||||
// res=(*pMoveWindow)(dxw.hParentWnd, wp.x, wp.y, wp.cx, wp.cy, FALSE);
|
||||
// if(!res) OutTraceE("MoveWindow ERROR: dxw.hParentWnd=%x err=%d at %d\n", dxw.hParentWnd, GetLastError(), __LINE__);
|
||||
//}
|
||||
|
||||
return 0;
|
||||
//return 0;
|
||||
}
|
||||
|
||||
LPCSTR ProcToString(LPCSTR proc)
|
||||
|
@ -1,3 +1,5 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <stdio.h>
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
@ -31,6 +33,24 @@ dxwCore::~dxwCore()
|
||||
{
|
||||
}
|
||||
|
||||
void dxwCore::SetFullScreen(BOOL fs, int line)
|
||||
{
|
||||
OutTraceD("SetFullScreen: %s at %d\n", fs?"FULLSCREEN":"WINDOWED", line);
|
||||
FullScreen=fs;
|
||||
}
|
||||
|
||||
void dxwCore::SetFullScreen(BOOL fs)
|
||||
{
|
||||
OutTraceD("SetFullScreen: %s\n", fs?"FULLSCREEN":"WINDOWED");
|
||||
FullScreen=fs;
|
||||
}
|
||||
|
||||
BOOL dxwCore::IsFullScreen()
|
||||
{
|
||||
// if(dxw.dwFlagsX && ALWAYSFULLSCREEN) return TRUE;
|
||||
return FullScreen;
|
||||
}
|
||||
|
||||
void dxwCore::InitTarget(TARGETMAP *target)
|
||||
{
|
||||
dwFlags1 = target->flags;
|
||||
@ -154,6 +174,15 @@ BOOL dxwCore::IsDesktop(HWND hwnd)
|
||||
);
|
||||
}
|
||||
|
||||
BOOL dxwCore::IsRealDesktop(HWND hwnd)
|
||||
{
|
||||
return (
|
||||
(hwnd == 0)
|
||||
||
|
||||
(hwnd == (*pGetDesktopWindow)())
|
||||
);
|
||||
}
|
||||
|
||||
// v2.1.93: FixCursorPos completely revised to introduce a clipping tolerance in
|
||||
// clipping regions as well as in normal operations
|
||||
|
||||
@ -288,6 +317,13 @@ void dxwCore::EraseClipCursor()
|
||||
(*pClipCursor)(NULL);
|
||||
}
|
||||
|
||||
void dxwCore::SethWnd(HWND hwnd)
|
||||
{
|
||||
OutTraceD("SethWnd: setting main win=%x\n", hwnd);
|
||||
hWnd=hwnd;
|
||||
hWndFPS=hwnd;
|
||||
}
|
||||
|
||||
RECT dxwCore::MapWindowRect(LPRECT lpRect)
|
||||
{
|
||||
POINT UpLeft={0,0};
|
||||
@ -296,6 +332,10 @@ RECT dxwCore::MapWindowRect(LPRECT lpRect)
|
||||
int w, h, bx, by; // width, height and x,y borders
|
||||
if (!(*pGetClientRect)(hWnd, &ClientRect)){
|
||||
OutTraceE("GetClientRect ERROR: err=%d hwnd=%x at %d\n", GetLastError(), hWnd, __LINE__);
|
||||
// v2.02.31: try....
|
||||
ClientRect.top=ClientRect.left=0;
|
||||
ClientRect.right=dxw.iSizX;
|
||||
ClientRect.bottom=dxw.iSizY;
|
||||
}
|
||||
RetRect=ClientRect;
|
||||
bx = by = 0;
|
||||
@ -308,7 +348,7 @@ RECT dxwCore::MapWindowRect(LPRECT lpRect)
|
||||
else {
|
||||
by = (h - (w * 600 / 800))/2;
|
||||
}
|
||||
OutTraceD("bx=%d by=%d\n", bx, by);
|
||||
OutTraceB("bx=%d by=%d\n", bx, by);
|
||||
}
|
||||
|
||||
if(lpRect){
|
||||
@ -336,29 +376,49 @@ RECT dxwCore::MapWindowRect(LPRECT lpRect)
|
||||
void dxwCore::MapClient(LPRECT rect)
|
||||
{
|
||||
RECT client;
|
||||
int w, h;
|
||||
(*pGetClientRect)(hWnd, &client);
|
||||
rect->left= rect->left * client.right / dwScreenWidth;
|
||||
rect->top= rect->top * client.bottom / dwScreenHeight;
|
||||
rect->right= rect->right * client.right / dwScreenWidth;
|
||||
rect->bottom= rect->bottom * client.bottom / dwScreenHeight;
|
||||
w = client.right ? client.right : iSizX;
|
||||
h = client.bottom ? client.bottom : iSizY;
|
||||
rect->left= rect->left * w / (int)dwScreenWidth;
|
||||
rect->top= rect->top * h / (int)dwScreenHeight;
|
||||
rect->right= rect->right * w / (int)dwScreenWidth;
|
||||
rect->bottom= rect->bottom * h / (int)dwScreenHeight;
|
||||
}
|
||||
|
||||
void dxwCore::MapClient(int *nXDest, int *nYDest, int *nWDest, int *nHDest)
|
||||
{
|
||||
RECT client;
|
||||
int w, h;
|
||||
(*pGetClientRect)(hWnd, &client);
|
||||
*nXDest= *nXDest * client.right / dwScreenWidth;
|
||||
*nYDest= *nYDest * client.bottom / dwScreenHeight;
|
||||
*nWDest= *nWDest * client.right / dwScreenWidth;
|
||||
*nHDest= *nHDest * client.bottom / dwScreenHeight;
|
||||
w = client.right ? client.right : iSizX;
|
||||
h = client.bottom ? client.bottom : iSizY;
|
||||
*nXDest= *nXDest * w / (int)dwScreenWidth;
|
||||
*nYDest= *nYDest * h / (int)dwScreenHeight;
|
||||
*nWDest= *nWDest * w / (int)dwScreenWidth;
|
||||
*nHDest= *nHDest * h / (int)dwScreenHeight;
|
||||
}
|
||||
|
||||
void dxwCore::MapClient(LPPOINT lppoint)
|
||||
{
|
||||
RECT client;
|
||||
int w, h;
|
||||
(*pGetClientRect)(hWnd, &client);
|
||||
lppoint->x = (lppoint->x * client.right) / dwScreenWidth;
|
||||
lppoint->y = (lppoint->y * client.bottom) / dwScreenHeight;
|
||||
w = client.right ? client.right : iSizX;
|
||||
h = client.bottom ? client.bottom : iSizY;
|
||||
lppoint->x = (lppoint->x * w) / (int)dwScreenWidth;
|
||||
lppoint->y = (lppoint->y * h) / (int)dwScreenHeight;
|
||||
}
|
||||
|
||||
void dxwCore::MapClient(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 * w / (int)dwScreenWidth;
|
||||
*nYDest= *nYDest * h / (int)dwScreenHeight;
|
||||
}
|
||||
|
||||
void dxwCore::MapWindow(LPRECT rect)
|
||||
@ -367,10 +427,10 @@ void dxwCore::MapWindow(LPRECT rect)
|
||||
POINT upleft = {0,0};
|
||||
(*pGetClientRect)(hWnd, &client);
|
||||
(*pClientToScreen)(hWnd, &upleft);
|
||||
rect->left= upleft.x + ((rect->left * client.right) / dwScreenWidth);
|
||||
rect->top= upleft.y + ((rect->top * client.bottom) / dwScreenHeight);
|
||||
rect->right= upleft.x + ((rect->right * client.right) / dwScreenWidth);
|
||||
rect->bottom= upleft.y + ((rect->bottom * client.bottom) / dwScreenHeight);
|
||||
rect->left= upleft.x + ((rect->left * client.right) / (int)dwScreenWidth);
|
||||
rect->top= upleft.y + ((rect->top * client.bottom) / (int)dwScreenHeight);
|
||||
rect->right= upleft.x + ((rect->right * client.right) / (int)dwScreenWidth);
|
||||
rect->bottom= upleft.y + ((rect->bottom * client.bottom) / (int)dwScreenHeight);
|
||||
}
|
||||
|
||||
void dxwCore::MapWindow(int *nXDest, int *nYDest, int *nWDest, int *nHDest)
|
||||
@ -379,10 +439,10 @@ void dxwCore::MapWindow(int *nXDest, int *nYDest, int *nWDest, int *nHDest)
|
||||
POINT upleft = {0,0};
|
||||
(*pGetClientRect)(hWnd, &client);
|
||||
(*pClientToScreen)(hWnd, &upleft);
|
||||
*nXDest= upleft.x + ((*nXDest * client.right) / dwScreenWidth);
|
||||
*nYDest= upleft.y + ((*nYDest * client.bottom) / dwScreenHeight);
|
||||
*nWDest= (*nWDest * client.right) / dwScreenWidth;
|
||||
*nHDest= (*nHDest * client.bottom) / dwScreenHeight;
|
||||
*nXDest= upleft.x + ((*nXDest * client.right) / (int)dwScreenWidth);
|
||||
*nYDest= upleft.y + ((*nYDest * client.bottom) / (int)dwScreenHeight);
|
||||
*nWDest= (*nWDest * client.right) / (int)dwScreenWidth;
|
||||
*nHDest= (*nHDest * client.bottom) / (int)dwScreenHeight;
|
||||
}
|
||||
|
||||
void dxwCore::MapWindow(LPPOINT lppoint)
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
// Operations
|
||||
public: // methods
|
||||
void InitTarget(TARGETMAP *);
|
||||
void SethWnd(HWND hwnd) {hWnd=hwnd; hWndFPS=hwnd;}
|
||||
void SethWnd(HWND hwnd);
|
||||
void SethWnd(HWND hwnd, HWND hwndfps) {hWnd=hwnd; hWndFPS=hwndfps;}
|
||||
void InitWindowPos(int, int, int, int);
|
||||
HWND GethWnd(void) {return hWnd;}
|
||||
@ -21,9 +21,11 @@ public: // methods
|
||||
void SetScreenSize(int x, int y) {if(x)dwScreenWidth=x; if(y)dwScreenHeight=y;}
|
||||
DWORD GetScreenWidth(void) {return dwScreenWidth;}
|
||||
DWORD GetScreenHeight(void) {return dwScreenHeight;}
|
||||
void SetFullScreen(BOOL fs) {FullScreen=fs;}
|
||||
BOOL IsFullScreen() {return FullScreen;}
|
||||
void SetFullScreen(BOOL);
|
||||
void SetFullScreen(BOOL, int);
|
||||
BOOL IsFullScreen();
|
||||
BOOL IsDesktop(HWND);
|
||||
BOOL IsRealDesktop(HWND);
|
||||
POINT FixCursorPos(POINT);
|
||||
void FixNCHITCursorPos(LPPOINT);
|
||||
void SetClipCursor(void);
|
||||
@ -33,6 +35,7 @@ public: // methods
|
||||
void MapClient(LPPOINT);
|
||||
void MapClient(LPRECT);
|
||||
void MapClient(int *, int *, int *, int *);
|
||||
void MapClient(int *, int *);
|
||||
void MapWindow(LPPOINT);
|
||||
void MapWindow(LPRECT);
|
||||
void MapWindow(int *, int *, int *, int *);
|
||||
|
@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
|
||||
#define VERSION "2.02.29"
|
||||
#define VERSION "2.02.31"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
|
||||
|
Binary file not shown.
594
dll/gdi32.cpp
594
dll/gdi32.cpp
@ -8,7 +8,6 @@
|
||||
static HookEntry_Type Hooks[]={
|
||||
{"GetDeviceCaps", (FARPROC)GetDeviceCaps, (FARPROC *)&pGDIGetDeviceCaps, (FARPROC)extGetDeviceCaps},
|
||||
{"TextOutA", (FARPROC)TextOutA, (FARPROC *)&pGDITextOutA, (FARPROC)extTextOutA},
|
||||
{"TabbedTextOutA", (FARPROC)TabbedTextOutA, (FARPROC *)&pTabbedTextOutA, (FARPROC)extTabbedTextOutA},
|
||||
{"ScaleWindowExtEx", (FARPROC)ScaleWindowExtEx, (FARPROC *)&pGDIScaleWindowExtEx, (FARPROC)extScaleWindowExtEx},
|
||||
{"Rectangle", (FARPROC)Rectangle, (FARPROC *)&pGDIRectangle, (FARPROC)extRectangle},
|
||||
{"SaveDC", (FARPROC)SaveDC, (FARPROC *)&pGDISaveDC, (FARPROC)extGDISaveDC},
|
||||
@ -17,6 +16,29 @@ static HookEntry_Type Hooks[]={
|
||||
{"SelectPalette", (FARPROC)SelectPalette, (FARPROC *)&pGDISelectPalette, (FARPROC)extSelectPalette},
|
||||
{"RealizePalette", (FARPROC)RealizePalette, (FARPROC *)&pGDIRealizePalette, (FARPROC)extRealizePalette},
|
||||
{"GetSystemPaletteEntries", (FARPROC)GetSystemPaletteEntries, (FARPROC *)&pGDIGetSystemPaletteEntries, (FARPROC)extGetSystemPaletteEntries},
|
||||
{"GetClipBox", (FARPROC)NULL, (FARPROC *)&pGDIGetClipBox, (FARPROC)extGetClipBox},
|
||||
{"Polyline", (FARPROC)NULL, (FARPROC *)&pPolyline, (FARPROC)extPolyline},
|
||||
{"PolyBezierTo", (FARPROC)NULL, (FARPROC *)&pPolyBezierTo, (FARPROC)extPolyBezierTo},
|
||||
{"PolylineTo", (FARPROC)NULL, (FARPROC *)&pPolylineTo, (FARPROC)extPolylineTo},
|
||||
{"PolyDraw", (FARPROC)NULL, (FARPROC *)&pPolyDraw, (FARPROC)extPolyDraw},
|
||||
{"MoveToEx", (FARPROC)NULL, (FARPROC *)&pMoveToEx, (FARPROC)extMoveToEx},
|
||||
{"ArcTo", (FARPROC)NULL, (FARPROC *)&pArcTo, (FARPROC)extArcTo},
|
||||
{"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},
|
||||
{"Ellipse", (FARPROC)NULL, (FARPROC *)&pEllipse, (FARPROC)extEllipse},
|
||||
{"Polygon", (FARPROC)NULL, (FARPROC *)&pPolygon, (FARPROC)extPolygon},
|
||||
{"Arc", (FARPROC)NULL, (FARPROC *)&pArc, (FARPROC)extArc},
|
||||
{"CreateEllipticRgn", (FARPROC)NULL, (FARPROC *)&pCreateEllipticRgn, (FARPROC)extCreateEllipticRgn},
|
||||
{"CreateEllipticRgnIndirect", (FARPROC)NULL, (FARPROC *)&pCreateEllipticRgnIndirect, (FARPROC)extCreateEllipticRgnIndirect},
|
||||
{"CreateRectRgn", (FARPROC)NULL, (FARPROC *)&pCreateRectRgn, (FARPROC)extCreateRectRgn},
|
||||
{"CreateRectRgnIndirect", (FARPROC)NULL, (FARPROC *)&pCreateRectRgnIndirect, (FARPROC)extCreateRectRgnIndirect},
|
||||
{"CreatePolygonRgn", (FARPROC)NULL, (FARPROC *)&pCreatePolygonRgn, (FARPROC)extCreatePolygonRgn},
|
||||
{"DrawTextA", (FARPROC)NULL, (FARPROC *)&pDrawText, (FARPROC)extDrawText},
|
||||
{"DrawTextExA", (FARPROC)NULL, (FARPROC *)&pDrawTextEx, (FARPROC)extDrawTextEx},
|
||||
{"MaskBlt", (FARPROC)NULL, (FARPROC *)&pMaskBlt, (FARPROC)extMaskBlt},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
@ -41,9 +63,9 @@ static HookEntry_Type GDIHooks[]={
|
||||
};
|
||||
|
||||
static HookEntry_Type EmuHooks[]={
|
||||
{"SetTextColor", (FARPROC)SetTextColor, (FARPROC *)&pGDISetTextColor, (FARPROC)extSetTextColor},
|
||||
{"SetBkColor", (FARPROC)SetBkColor, (FARPROC *)&pGDISetBkColor, (FARPROC)extSetBkColor},
|
||||
{"CreateFont", (FARPROC)CreateFont, (FARPROC *)&pGDICreateFont, (FARPROC)extCreateFont},
|
||||
//{"SetTextColor", (FARPROC)SetTextColor, (FARPROC *)&pGDISetTextColor, (FARPROC)extSetTextColor},
|
||||
//{"SetBkColor", (FARPROC)SetBkColor, (FARPROC *)&pGDISetBkColor, (FARPROC)extSetBkColor},
|
||||
{"CreateFontA", (FARPROC)CreateFont, (FARPROC *)&pGDICreateFont, (FARPROC)extCreateFont},
|
||||
{"CreateFontIndirectA", (FARPROC)CreateFontIndirectA, (FARPROC *)&pGDICreateFontIndirect, (FARPROC)extCreateFontIndirect},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
@ -277,35 +299,17 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
|
||||
|
||||
BOOL WINAPI extTextOutA(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cchString)
|
||||
{
|
||||
BOOL res;
|
||||
BOOL ret;
|
||||
OutTraceD("TextOut: hdc=%x xy=(%d,%d) str=(%d)\"%s\"\n", hdc, nXStart, nYStart, cchString, lpString);
|
||||
if (dxw.dwFlags1 & FIXTEXTOUT) {
|
||||
POINT anchor;
|
||||
anchor.x=nXStart;
|
||||
anchor.y=nYStart;
|
||||
(*pClientToScreen)(dxw.GethWnd(), &anchor);
|
||||
nXStart=anchor.x;
|
||||
nYStart=anchor.y;
|
||||
}
|
||||
res=(*pGDITextOutA)(hdc, nXStart, nYStart, lpString, cchString);
|
||||
return res;
|
||||
}
|
||||
|
||||
LONG WINAPI extTabbedTextOutA(HDC hDC, int X, int Y, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions, int nTabOrigin)
|
||||
{
|
||||
BOOL res;
|
||||
OutTraceD("TabbedTextOut: hdc=%x xy=(%d,%d) nCount=%d nTP=%d nTOS=%d str=(%d)\"%s\"\n",
|
||||
hDC, X, Y, nCount, nTabPositions, nTabOrigin, lpString);
|
||||
if (dxw.dwFlags1 & FIXTEXTOUT) {
|
||||
POINT anchor;
|
||||
anchor.x=X;
|
||||
anchor.y=Y;
|
||||
(*pClientToScreen)(dxw.GethWnd(), &anchor);
|
||||
X=anchor.x;
|
||||
Y=anchor.y;
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient(&nXStart, &nYStart);
|
||||
OutTraceD("TextOut: fixed dest=(%d,%d)\n", nXStart, nYStart);
|
||||
}
|
||||
res=(*pTabbedTextOutA)(hDC, X, Y, lpString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin);
|
||||
return res;
|
||||
|
||||
ret=(*pGDITextOutA)(hdc, nXStart, nYStart, lpString, cchString);
|
||||
if(!ret) OutTraceE("TextOut: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extScaleWindowExtEx(HDC hdc, int Xnum, int Xdenom, int Ynum, int Ydenom, LPSIZE lpSize)
|
||||
@ -320,21 +324,18 @@ BOOL WINAPI extScaleWindowExtEx(HDC hdc, int Xnum, int Xdenom, int Ynum, int Yde
|
||||
|
||||
BOOL WINAPI extRectangle(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
|
||||
{
|
||||
int ret;
|
||||
|
||||
OutTraceD("Rectangle: hdc=%x xy=(%d,%d)-(%d,%d)\n", hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
if (dxw.dwFlags1 & FIXTEXTOUT) {
|
||||
POINT anchor;
|
||||
anchor.x=nLeftRect;
|
||||
anchor.y=nTopRect;
|
||||
(*pClientToScreen)(dxw.GethWnd(), &anchor);
|
||||
nLeftRect=anchor.x;
|
||||
nTopRect=anchor.y;
|
||||
anchor.x=nRightRect;
|
||||
anchor.y=nBottomRect;
|
||||
(*pClientToScreen)(dxw.GethWnd(), &anchor);
|
||||
nRightRect=anchor.x;
|
||||
nBottomRect=anchor.y;
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient(&nLeftRect, &nTopRect, &nRightRect, &nBottomRect);
|
||||
OutTraceD("Rectangle: fixed dest=(%d,%d)-(%d,%d)\n", nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
}
|
||||
return (*pGDIRectangle)(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
|
||||
ret=(*pGDIRectangle)(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
if(!ret) OutTraceE("Rectangle: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int WINAPI extGDISaveDC(HDC hdc)
|
||||
@ -492,7 +493,7 @@ static HDC WINAPI winDDGetDC(HWND hwnd, char *api)
|
||||
dxw.ResetPrimarySurface();
|
||||
dxw.SetPrimarySurface();
|
||||
|
||||
if(dxw.IsDesktop(hwnd)) hwnd=dxw.GethWnd();
|
||||
if(dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
|
||||
|
||||
if(dxw.lpDDSPrimHDC){
|
||||
if (PrimHDC){
|
||||
@ -702,6 +703,8 @@ 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
|
||||
// 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))){
|
||||
int nWDest, nHDest;
|
||||
nWDest= nWidth;
|
||||
@ -710,6 +713,15 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
|
||||
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
|
||||
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
|
||||
}
|
||||
else if(WindowFromDC(hdcDest)==NULL){
|
||||
// V2.02.31: See StretchBlt.
|
||||
int nWDest, nHDest;
|
||||
nWDest= nWidth;
|
||||
nHDest= nHeight;
|
||||
dxw.MapWindow(&nXDest, &nYDest, &nWDest, &nHDest);
|
||||
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop);
|
||||
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
|
||||
}
|
||||
else {
|
||||
res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
|
||||
}
|
||||
@ -727,11 +739,18 @@ BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
|
||||
|
||||
if (dxw.HandleFPS()) return TRUE;
|
||||
|
||||
OutTraceB("GDI.StretchBlt: DEBUG FullScreen=%x target hdctype=%x(%s) hwnd=%x\n",
|
||||
dxw.IsFullScreen(), GetObjectType(hdcDest), ExplainDCType(GetObjectType(hdcDest)), WindowFromDC(hdcDest));
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){
|
||||
int nWDest, nHDest;
|
||||
dxw.MapClient(&nXDest, &nYDest, &nWDest, &nHDest);
|
||||
dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight);
|
||||
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
|
||||
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, dwRop);
|
||||
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
|
||||
}
|
||||
else if(WindowFromDC(hdcDest)==NULL){
|
||||
// V2.02.31: See StretchBlt.
|
||||
dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight);
|
||||
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
|
||||
}
|
||||
else {
|
||||
res=(*pGDIPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop);
|
||||
@ -751,9 +770,21 @@ BOOL WINAPI extGDIStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, in
|
||||
|
||||
if (dxw.HandleFPS()) return TRUE;
|
||||
|
||||
// to do: what happend if StretchBlt is applied on screen DC ?
|
||||
OutTraceB("GDI.StretchBlt: DEBUG FullScreen=%x target hdctype=%x(%s) hwnd=%x\n",
|
||||
dxw.IsFullScreen(), GetObjectType(hdcDest), ExplainDCType(GetObjectType(hdcDest)), WindowFromDC(hdcDest));
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){
|
||||
dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight);
|
||||
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
|
||||
}
|
||||
else if(WindowFromDC(hdcDest)==NULL){
|
||||
// V2.02.31: In "Silent Hunter II" intro movie, QuickTime 5 renders the vidoe on the PrimarySurface->GetDC device context,
|
||||
// that is a memory device type associated to NULL (desktop) window, through GDI StretchBlt api. So, you shoud compensate
|
||||
// by scaling and offsetting to main window.
|
||||
dxw.MapWindow(&nXDest, &nYDest, &nWidth, &nHeight);
|
||||
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
|
||||
}
|
||||
|
||||
if (dxw.dwFlags2 & SHOWFPSOVERLAY) dxw.ShowFPS(hdcDest);
|
||||
res=(*pGDIStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop);
|
||||
if(!res) OutTraceE("GDI.StretchBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
||||
return res;
|
||||
@ -798,6 +829,14 @@ HFONT WINAPI extCreateFont(int nHeight, int nWidth, int nEscapement, int nOrient
|
||||
DWORD fdwPitchAndFamily, LPCTSTR lpszFace)
|
||||
{
|
||||
OutTraceD("CreateFont: h=%d w=%d face=\"%s\"\n", nHeight, nWidth, lpszFace);
|
||||
if(dxw.dwFlags1 & FIXTEXTOUT) {
|
||||
if(nHeight > 0) dxw.MapClient(&nWidth, &nHeight);
|
||||
else {
|
||||
nHeight= -nHeight;
|
||||
dxw.MapClient(&nWidth, &nHeight);
|
||||
nHeight= -nHeight;
|
||||
}
|
||||
}
|
||||
return (*pGDICreateFont)(nHeight, nWidth, nEscapement, nOrientation, fnWeight,
|
||||
fdwItalic, fdwUnderline, fdwStrikeOut, fdwCharSet,
|
||||
fdwOutputPrecision, fdwClipPrecision, NONANTIALIASED_QUALITY,
|
||||
@ -813,6 +852,14 @@ HFONT WINAPI extCreateFontIndirect(const LOGFONT* lplf)
|
||||
OutTraceD("CreateFontIndirect: h=%d w=%d face=\"%s\"\n", lplf->lfHeight, lplf->lfWidth, lplf->lfFaceName);
|
||||
memcpy((char *)&lf, (char *)lplf, sizeof(LOGFONT));
|
||||
lf.lfQuality=NONANTIALIASED_QUALITY;
|
||||
if(dxw.dwFlags1 & FIXTEXTOUT) {
|
||||
if(lf.lfHeight > 0) dxw.MapClient((int *)&lf.lfWidth, (int *)&lf.lfHeight);
|
||||
else {
|
||||
lf.lfHeight= -lf.lfHeight;
|
||||
dxw.MapClient((int *)&lf.lfWidth, (int *)&lf.lfHeight);
|
||||
lf.lfHeight= -lf.lfHeight;
|
||||
}
|
||||
}
|
||||
retHFont=((*pGDICreateFontIndirect)(&lf));
|
||||
if(retHFont)
|
||||
OutTraceD("CreateFontIndirect: hfont=%x\n", retHFont);
|
||||
@ -843,3 +890,452 @@ BOOL WINAPI extGetDeviceGammaRamp(HDC hDC, LPVOID lpRamp)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int WINAPI extGetClipBox(HDC hdc, LPRECT lprc)
|
||||
{
|
||||
// v2.02.31: needed in "Imperialism II" to avoid blit clipping
|
||||
int ret;
|
||||
char *sRetCodes[4]={"ERROR", "NULLREGION", "SIMPLEREGION", "COMPLEXREGION"};
|
||||
OutTraceD("GetClipBox: hdc=%x\n", hdc);
|
||||
ret=(*pGDIGetClipBox)(hdc, lprc);
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc)) && (ret!=ERROR)){
|
||||
OutTraceD("GetClipBox: scaling main win coordinates (%d,%d)-(%d,%d)\n",
|
||||
lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
*lprc=dxw.GetScreenRect();
|
||||
}
|
||||
OutTraceD("GetClipBox: ret=%x(%s)\n", ret, sRetCodes[ret]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extPolyline(HDC hdc, const POINT *lppt, int cPoints)
|
||||
{
|
||||
BOOL ret;
|
||||
if(IsTraceD){
|
||||
int i;
|
||||
OutTrace("Polyline: hdc=%x cPoints=%d pt=", hdc, cPoints);
|
||||
for(i=0; i<cPoints; i++) OutTrace("(%d,%d) ", lppt[i].x, lppt[i].y);
|
||||
OutTrace("\n");
|
||||
}
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
int i;
|
||||
OutTrace("Polyline: fixed cPoints=%d pt=", cPoints);
|
||||
for(i=0; i<cPoints; i++) {
|
||||
dxw.MapClient((LPPOINT)&lppt[i]);
|
||||
OutTrace("(%d,%d) ", lppt[i].x, lppt[i].y);
|
||||
}
|
||||
OutTrace("\n");
|
||||
}
|
||||
ret=(*pPolyline)(hdc, lppt, cPoints);
|
||||
if(!ret)OutTraceE("Polyline: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extLineTo(HDC hdc, int nXEnd, int nYEnd)
|
||||
{
|
||||
BOOL ret;
|
||||
OutTraceD("LineTo: hdc=%x pt=(%d,%d)\n", hdc, nXEnd, nYEnd);
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient(&nXEnd, &nYEnd);
|
||||
OutTraceD("LineTo: fixed pt=(%d,%d)\n", nXEnd, nYEnd);
|
||||
}
|
||||
ret=(*pLineTo)(hdc, nXEnd, nYEnd);
|
||||
if(!ret)OutTraceE("LineTo: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extArcTo(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nXRadial1, int nYRadial1, int nXRadial2, int nYRadial2)
|
||||
{
|
||||
BOOL ret;
|
||||
OutTraceD("ArcTo: hdc=%x rect=(%d,%d)(%d,%d) radial=(%d,%d)(%d,%d)\n",
|
||||
hdc, nLeftRect, nTopRect, nRightRect, nBottomRect, nXRadial1, nYRadial1, nXRadial2, nYRadial2);
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient(&nLeftRect, &nTopRect, &nRightRect, &nBottomRect);
|
||||
dxw.MapClient(&nXRadial1, &nYRadial1, &nXRadial2, &nYRadial2);
|
||||
OutTraceD("ArcTo: fixed rect=(%d,%d)(%d,%d) radial=(%d,%d)(%d,%d)\n",
|
||||
nLeftRect, nTopRect, nRightRect, nBottomRect, nXRadial1, nYRadial1, nXRadial2, nYRadial2);
|
||||
}
|
||||
ret=(*pArcTo)(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect, nXRadial1, nYRadial1, nXRadial2, nYRadial2);
|
||||
if(!ret)OutTraceE("ArcTo: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extMoveToEx(HDC hdc, int X, int Y, LPPOINT lpPoint)
|
||||
{
|
||||
BOOL ret;
|
||||
OutTraceD("MoveToEx: hdc=%x pt=(%d,%d)\n", hdc, X, Y);
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient(&X, &Y);
|
||||
OutTraceD("MoveToEx: fixed pt=(%d,%d)\n", X, Y);
|
||||
}
|
||||
ret=(*pMoveToEx)(hdc, X, Y, lpPoint);
|
||||
if(!ret)OutTraceE("MoveToEx: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extPolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes, int cCount)
|
||||
{
|
||||
BOOL ret;
|
||||
if(IsTraceD){
|
||||
int i;
|
||||
OutTrace("PolyDraw: hdc=%x cCount=%d pt=", hdc, cCount);
|
||||
for(i=0; i<cCount; i++) OutTrace("(%x:%d,%d) ", lpbTypes[i], lppt[i].x, lppt[i].y);
|
||||
OutTrace("\n");
|
||||
}
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
int i;
|
||||
OutTrace("PolyDraw: fixed cCount=%d pt=", cCount);
|
||||
for(i=0; i<cCount; i++) {
|
||||
dxw.MapClient((LPPOINT)&lppt[i]);
|
||||
OutTrace("(%d,%d) ", lppt[i].x, lppt[i].y);
|
||||
}
|
||||
OutTrace("\n");
|
||||
}
|
||||
ret=(*pPolyDraw)(hdc, lppt, lpbTypes, cCount);
|
||||
if(!ret)OutTraceE("PolyDraw: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extPolylineTo(HDC hdc, const POINT *lppt, DWORD cCount)
|
||||
{
|
||||
BOOL ret;
|
||||
if(IsTraceD){
|
||||
DWORD i;
|
||||
OutTrace("PolylineTo: hdc=%x cCount=%d pt=", hdc, cCount);
|
||||
for(i=0; i<cCount; i++) OutTrace("(%d,%d) ", lppt[i].x, lppt[i].y);
|
||||
OutTrace("\n");
|
||||
}
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
DWORD i;
|
||||
OutTrace("PolylineTo: fixed cCount=%d pt=", cCount);
|
||||
for(i=0; i<cCount; i++) {
|
||||
dxw.MapClient((LPPOINT)&lppt[i]);
|
||||
OutTrace("(%d,%d) ", lppt[i].x, lppt[i].y);
|
||||
}
|
||||
OutTrace("\n");
|
||||
}
|
||||
ret=(*pPolylineTo)(hdc, lppt, cCount);
|
||||
if(!ret)OutTraceE("PolylineTo: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extPolyBezierTo(HDC hdc, const POINT *lppt, DWORD cCount)
|
||||
{
|
||||
BOOL ret;
|
||||
if(IsTraceD){
|
||||
DWORD i;
|
||||
OutTrace("PolyBezierTo: hdc=%x cCount=%d pt=", hdc, cCount);
|
||||
for(i=0; i<cCount; i++) OutTrace("(%d,%d) ", lppt[i].x, lppt[i].y);
|
||||
OutTrace("\n");
|
||||
}
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
DWORD i;
|
||||
OutTrace("PolyBezierTo: fixed cCount=%d pt=", cCount);
|
||||
for(i=0; i<cCount; i++) {
|
||||
dxw.MapClient((LPPOINT)&lppt[i]);
|
||||
OutTrace("(%d,%d) ", lppt[i].x, lppt[i].y);
|
||||
}
|
||||
OutTrace("\n");
|
||||
}
|
||||
ret=(*pPolyBezierTo)(hdc, lppt, cCount);
|
||||
if(!ret)OutTraceE("PolyBezierTo: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int WINAPI extStretchDIBits(HDC hdc, int XDest, int YDest, int nDestWidth, int nDestHeight, int XSrc, int YSrc, int nSrcWidth, int nSrcHeight,
|
||||
const VOID *lpBits, const BITMAPINFO *lpBitsInfo, UINT iUsage, DWORD dwRop)
|
||||
{
|
||||
int ret;
|
||||
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));
|
||||
|
||||
if (dxw.IsFullScreen() && (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);
|
||||
if(!ret || (ret==GDI_ERROR)) OutTraceE("StretchDIBits: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int WINAPI extSetDIBitsToDevice(HDC hdc, int XDest, int YDest, DWORD dwWidth, DWORD dwHeight, int XSrc, int YSrc, UINT uStartScan, UINT cScanLines,
|
||||
const VOID *lpvBits, const BITMAPINFO *lpbmi, UINT fuColorUse)
|
||||
{
|
||||
int ret;
|
||||
BITMAPINFOHEADER *bmi;
|
||||
OutTraceD("SetDIBitsToDevice: hdc=%x dest=(%d,%d)-(%dx%d) src=(%d,%d)-(%dx%d)\n",
|
||||
hdc, XDest, YDest, dwWidth, dwHeight, XSrc, YSrc, uStartScan, cScanLines);
|
||||
bmi=(BITMAPINFOHEADER *)&(lpbmi->bmiHeader);
|
||||
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);
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
DWORD OrigWidth, OrigHeight;
|
||||
int OrigXDest, OrigYDest;
|
||||
OrigWidth=dwWidth;
|
||||
OrigHeight=dwHeight;
|
||||
OrigXDest=XDest;
|
||||
OrigYDest=YDest;
|
||||
dxw.MapClient(&XDest, &YDest, (int *)&dwWidth, (int *)&dwHeight);
|
||||
OutTraceD("SetDIBitsToDevice: fixed dest=(%d,%d)-(%d,%d)\n", XDest, YDest, dwWidth, dwHeight);
|
||||
HDC hTempDc;
|
||||
HBITMAP hbmPic;
|
||||
if(!(hTempDc=CreateCompatibleDC(hdc)))
|
||||
OutTraceE("CreateCompatibleDC: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
|
||||
// tricky part: CreateCompatibleBitmap is needed to set the dc size, but it has to be performed
|
||||
// against hdc to set for color depth, then selected (through SelectObject) against the temporary
|
||||
// dc to assign the needed size and color space to the temporary dc.
|
||||
if(!(hbmPic=CreateCompatibleBitmap(hdc, OrigWidth, OrigHeight)))
|
||||
OutTraceE("CreateCompatibleBitmap: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
|
||||
if(!SelectObject(hTempDc, hbmPic))
|
||||
OutTraceE("SelectObject: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
|
||||
if(!(*pSetDIBitsToDevice)(hTempDc, 0, 0, OrigWidth, OrigHeight, XSrc, YSrc, uStartScan, cScanLines, lpvBits, lpbmi, fuColorUse))
|
||||
OutTraceE("SetDIBitsToDevice: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
|
||||
if(!(ret=(*pGDIStretchBlt)(hdc, XDest, YDest, dwWidth, dwHeight, hTempDc, 0, 0, OrigWidth, OrigHeight, SRCCOPY)))
|
||||
OutTraceE("StretchBlt: ERROR err=%d at=%d\n", GetLastError(), __LINE__);
|
||||
DeleteDC(hTempDc);
|
||||
}
|
||||
else{
|
||||
ret=(*pSetDIBitsToDevice)(hdc, XDest, YDest, 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;
|
||||
}
|
||||
|
||||
//HBITMAP WINAPI extCreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight)
|
||||
//{
|
||||
// HBITMAP ret;
|
||||
// OutTraceD("CreateCompatibleBitmap: hdc=%x size=(%d,%d)\n",
|
||||
// hdc, nWidth, nHeight);
|
||||
//
|
||||
// if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
// dxw.MapClient(&nWidth, &nHeight);
|
||||
// OutTraceD("CreateCompatibleBitmap: fixed size=(%d,%d)\n", nWidth, nHeight);
|
||||
// }
|
||||
//
|
||||
// ret=(*pCreateCompatibleBitmap)(hdc, nWidth, nHeight);
|
||||
// if(!ret) OutTraceE("CreateCompatibleBitmap: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
// return ret;
|
||||
//}
|
||||
|
||||
COLORREF WINAPI extSetPixel(HDC hdc, int X, int Y, COLORREF crColor)
|
||||
{
|
||||
COLORREF ret;
|
||||
OutTraceD("SetPixel: hdc=%x color=%x point=(%d,%d)\n", hdc, crColor, X, Y);
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient(&X, &Y);
|
||||
OutTraceD("SetPixel: fixed pos=(%d,%d)\n", X, Y);
|
||||
}
|
||||
|
||||
ret=(*pSetPixel)(hdc, X, Y, crColor);
|
||||
// both 0x00000000 and 0xFFFFFFFF are legitimate colors and therefore valid return codes...
|
||||
//if(ret==GDI_ERROR) OutTraceE("SetPixel: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extEllipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
|
||||
{
|
||||
int ret;
|
||||
OutTraceD("Ellipse: hdc=%x rect=(%d,%d)-(%d,%d)\n", hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient(&nLeftRect, &nTopRect, &nRightRect, &nBottomRect);
|
||||
OutTraceD("Ellipse: fixed dest=(%d,%d)-(%d,%d)\n", nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
}
|
||||
|
||||
ret=(*pEllipse)(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
if(!ret) OutTraceE("Ellipse: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extPolygon(HDC hdc, const POINT *lpPoints, int cCount)
|
||||
{
|
||||
BOOL ret;
|
||||
if(IsTraceD){
|
||||
int i;
|
||||
OutTrace("Polygon: hdc=%x cCount=%d pt=", hdc, cCount);
|
||||
for(i=0; i<cCount; i++) OutTrace("(%d,%d) ", lpPoints[i].x, lpPoints[i].y);
|
||||
OutTrace("\n");
|
||||
}
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
int i;
|
||||
OutTrace("Polygon: fixed cCount=%d pt=", cCount);
|
||||
for(i=0; i<cCount; i++) {
|
||||
dxw.MapClient((LPPOINT)&lpPoints[i]);
|
||||
OutTrace("(%d,%d) ", lpPoints[i].x, lpPoints[i].y);
|
||||
}
|
||||
OutTrace("\n");
|
||||
}
|
||||
ret=(*pPolygon)(hdc, lpPoints, cCount);
|
||||
if(!ret)OutTraceE("Polygon: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extArc(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect, int nXStartArc, int nYStartArc, int nXEndArc, int nYEndArc)
|
||||
{
|
||||
int ret;
|
||||
OutTraceD("Arc: hdc=%x rect=(%d,%d)-(%d,%d) start=(%d,%d) end=(%d,%d)\n",
|
||||
hdc, nLeftRect, nTopRect, nRightRect, nBottomRect, nXStartArc, nYStartArc, nXEndArc, nYEndArc);
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient(&nLeftRect, &nTopRect, &nRightRect, &nBottomRect);
|
||||
dxw.MapClient(&nXStartArc, &nYStartArc, &nXEndArc, &nYEndArc);
|
||||
OutTraceD("Arc: fixed rect=(%d,%d)-(%d,%d) start=(%d,%d) end=(%d,%d)\n",
|
||||
nLeftRect, nTopRect, nRightRect, nBottomRect, nXStartArc, nYStartArc, nXEndArc, nYEndArc);
|
||||
}
|
||||
|
||||
ret=(*pArc)(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect, nXStartArc, nYStartArc, nXEndArc, nYEndArc);
|
||||
if(!ret) OutTraceE("Arc: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRGN WINAPI extCreateEllipticRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
|
||||
{
|
||||
HRGN ret;
|
||||
OutTraceD("CreateEllipticRgn: rect=(%d,%d)-(%d,%d)\n", nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
|
||||
if (dxw.IsFullScreen()){
|
||||
dxw.MapClient(&nLeftRect, &nTopRect, &nRightRect, &nBottomRect);
|
||||
OutTraceD("CreateEllipticRgn: fixed rect=(%d,%d)-(%d,%d)\n", nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
}
|
||||
|
||||
ret=(*pCreateEllipticRgn)(nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
if(!ret) OutTraceE("CreateEllipticRgn: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRGN WINAPI extCreateEllipticRgnIndirect(const RECT *lprc)
|
||||
{
|
||||
HRGN ret;
|
||||
OutTraceD("CreateEllipticRgnIndirect: rect=(%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
|
||||
if (dxw.IsFullScreen()){
|
||||
dxw.MapClient((RECT *)lprc);
|
||||
OutTraceD("CreateEllipticRgnIndirect: fixed rect=(%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
}
|
||||
|
||||
ret=(*pCreateEllipticRgnIndirect)(lprc);
|
||||
if(!ret) OutTraceE("CreateEllipticRgnIndirect: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRGN WINAPI extCreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
|
||||
{
|
||||
HRGN ret;
|
||||
OutTraceD("CreateRectRgn: rect=(%d,%d)-(%d,%d)\n", nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
|
||||
if (dxw.IsFullScreen()){
|
||||
dxw.MapClient(&nLeftRect, &nTopRect, &nRightRect, &nBottomRect);
|
||||
OutTraceD("CreateRectRgn: fixed rect=(%d,%d)-(%d,%d)\n", nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
}
|
||||
|
||||
ret=(*pCreateRectRgn)(nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
if(!ret) OutTraceE("CreateRectRgn: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRGN WINAPI extCreateRectRgnIndirect(const RECT *lprc)
|
||||
{
|
||||
HRGN ret;
|
||||
OutTraceD("CreateRectRgnIndirect: rect=(%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
|
||||
if (dxw.IsFullScreen()){
|
||||
dxw.MapClient((RECT *)lprc);
|
||||
OutTraceD("CreateRectRgnIndirect: fixed rect=(%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
}
|
||||
|
||||
ret=(*pCreateRectRgnIndirect)(lprc);
|
||||
if(!ret) OutTraceE("CreateRectRgnIndirect: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRGN WINAPI extCreatePolygonRgn(const POINT *lpPoints, int cPoints, int fnPolyFillMode)
|
||||
{
|
||||
HRGN ret;
|
||||
if(IsTraceD){
|
||||
int i;
|
||||
OutTrace("CreatePolygonRgn: PolyFillMode=%x cCount=%d pt=", fnPolyFillMode, cPoints);
|
||||
for(i=0; i<cPoints; i++) OutTrace("(%d,%d) ", lpPoints[i].x, lpPoints[i].y);
|
||||
OutTrace("\n");
|
||||
}
|
||||
if (dxw.IsFullScreen()){
|
||||
int i;
|
||||
OutTrace("CreatePolygonRgn: fixed cCount=%d pt=", cPoints);
|
||||
for(i=0; i<cPoints; i++) {
|
||||
dxw.MapClient((LPPOINT)&lpPoints[i]);
|
||||
OutTrace("(%d,%d) ", lpPoints[i].x, lpPoints[i].y);
|
||||
}
|
||||
OutTrace("\n");
|
||||
}
|
||||
ret=(*pCreatePolygonRgn)(lpPoints, cPoints, fnPolyFillMode);
|
||||
if(!ret)OutTraceE("CreatePolygonRgn: ERROR ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int WINAPI extDrawText(HDC hdc, LPCTSTR lpchText, int nCount, LPRECT lpRect, UINT uFormat)
|
||||
{
|
||||
int ret;
|
||||
OutTraceD("DrawText: hdc=%x rect=(%d,%d)-(%d,%d) Format=%x Text=(%d)\"%s\"\n",
|
||||
hdc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, uFormat, nCount, lpchText);
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient((RECT *)lpRect);
|
||||
OutTraceD("DrawText: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
|
||||
}
|
||||
|
||||
ret=(*pDrawText)(hdc, lpchText, nCount, lpRect, uFormat);
|
||||
if(!ret) OutTraceE("DrawText: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
int WINAPI extDrawTextEx(HDC hdc, LPTSTR lpchText, int nCount, LPRECT lpRect, UINT dwDTFormat, LPDRAWTEXTPARAMS lpDTParams)
|
||||
{
|
||||
int ret;
|
||||
OutTraceD("DrawTextEx: hdc=%x rect=(%d,%d)-(%d,%d) DTFormat=%x Text=(%d)\"%s\"\n",
|
||||
hdc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, dwDTFormat, nCount, lpchText);
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient((RECT *)lpRect);
|
||||
OutTraceD("DrawTextEx: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
|
||||
}
|
||||
|
||||
ret=(*pDrawTextEx)(hdc, lpchText, nCount, lpRect, dwDTFormat, lpDTParams);
|
||||
if(!ret) OutTraceE("DrawTextEx: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI extMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc,
|
||||
int nXSrc, int nYSrc, HBITMAP hbmMask, int xMask, int yMask, DWORD dwRop)
|
||||
{
|
||||
BOOL ret;
|
||||
OutTraceD("MaskBlt: hdcDest=%x pos=(%d,%d) size=(%dx%d) hdcSrc=%x pos=(%d,%d) hbmMask=%x Mask=(%d,%d) dwRop=%x\n",
|
||||
hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, hbmMask, xMask, yMask, dwRop);
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdcDest))){
|
||||
dxw.MapClient(&nXDest, &nYDest, &nWidth, &nHeight);
|
||||
OutTraceD("MaskBlt: fixed pos=(%d,%d) size=(%dx%d)\n", nXDest, nYDest, nWidth, nHeight);
|
||||
}
|
||||
|
||||
ret=(*pMaskBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, hbmMask, xMask, yMask, dwRop);
|
||||
if(!ret) OutTraceE("MaskBlt: ERROR ret=%x err=%d\n", ret, GetLastError());
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// to map:
|
||||
// GetCurrentPositionEx
|
||||
// GetViewportExtEx
|
||||
// DPtoLP
|
||||
// GetWindowOrgEx
|
||||
// LPtoDP
|
||||
// OffsetViewportOrgEx
|
||||
// OffsetWindowOrgEx
|
||||
// TransparentBlt
|
||||
// to do: eliminate FIXTEXTOUT handling
|
||||
|
||||
BOOL SetTextJustification(
|
||||
_In_ HDC hdc,
|
||||
_In_ int nBreakExtra, <----
|
||||
_In_ int nBreakCount
|
||||
);
|
||||
#endif
|
@ -602,7 +602,7 @@ HRESULT WINAPI extQueryInterfaceDProxy(void *lpdd, REFIID riid, LPVOID *obp)
|
||||
{
|
||||
HRESULT res;
|
||||
unsigned int dxVersion;
|
||||
OutTraceP("QueryInterface(D): PROXED lpdd=%x REFIID=%x(%s)\n", lpdd, riid.Data1, ExplainGUID((GUID *)&riid.Data1));
|
||||
OutTraceP("QueryInterface(D): PROXED lpdd=%x REFIID=%x(%s) obp=%x\n", lpdd, riid.Data1, ExplainGUID((GUID *)&riid.Data1), *obp);
|
||||
res = (*pQueryInterfaceD)(lpdd, riid, obp);
|
||||
if(res) {
|
||||
OutTraceP("QueryInterface(D): ret=%x(%s)\n", res, ExplainDDError(res));
|
||||
@ -1748,7 +1748,6 @@ static void HookDDSessionProxy(LPDIRECTDRAW *lplpdd, int dxVersion)
|
||||
HRESULT WINAPI extDirectDrawCreateProxy(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, IUnknown FAR *pu)
|
||||
{
|
||||
HRESULT res;
|
||||
int DDVersion;
|
||||
|
||||
OutTraceP("DirectDrawCreate: PROXED guid=%x(%s)\n",
|
||||
lpguid, ExplainGUID(lpguid));
|
||||
@ -1759,19 +1758,26 @@ HRESULT WINAPI extDirectDrawCreateProxy(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplp
|
||||
return res;
|
||||
}
|
||||
|
||||
DDVersion=1;
|
||||
if (lpguid) switch (*(DWORD *)lpguid){
|
||||
case 0x6C14DB80: DDVersion=1; break;
|
||||
case 0xB3A6F3E0: DDVersion=2; break;
|
||||
case 0x9c59509a: DDVersion=4; break;
|
||||
case 0x15e65ec0: DDVersion=7; break;
|
||||
dxw.dwDDVersion=1;
|
||||
char *mode;
|
||||
switch ((DWORD)lpguid){
|
||||
case 0: mode="NULL"; break;
|
||||
case DDCREATE_HARDWAREONLY: mode="DDCREATE_HARDWAREONLY"; break;
|
||||
case DDCREATE_EMULATIONONLY: mode="DDCREATE_EMULATIONONLY"; break;
|
||||
default:
|
||||
switch (*(DWORD *)lpguid){
|
||||
case 0x6C14DB80: dxw.dwDDVersion=1; mode="IID_IDirectDraw"; break;
|
||||
case 0xB3A6F3E0: dxw.dwDDVersion=2; mode="IID_IDirectDraw2"; break;
|
||||
case 0x9c59509a: dxw.dwDDVersion=4; mode="IID_IDirectDraw4"; break;
|
||||
case 0x15e65ec0: dxw.dwDDVersion=7; mode="IID_IDirectDraw7"; break;
|
||||
default: mode="unknown"; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
OutTraceP("DirectDrawCreate: lpdd=%x guid=%x DDVersion=%d\n",
|
||||
*lplpdd, (lpguid ? *(DWORD *)lpguid:0), DDVersion);
|
||||
OutTraceP("DirectDrawCreateEx: lpdd=%x guid=%s DDVersion=%d\n", *lplpdd, mode, dxw.dwDDVersion);
|
||||
|
||||
#ifdef HOOKDDRAW
|
||||
HookDDSessionProxy(lplpdd, DDVersion);
|
||||
HookDDSessionProxy(lplpdd, dxw.dwDDVersion);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -1779,31 +1785,38 @@ HRESULT WINAPI extDirectDrawCreateProxy(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplp
|
||||
HRESULT WINAPI extDirectDrawCreateExProxy(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, REFIID RefIid, IUnknown FAR *pu)
|
||||
{
|
||||
HRESULT res;
|
||||
int DDVersion;
|
||||
|
||||
OutTraceP("DirectDrawCreateEx: PROXED guid=%x(%s) refiid=%x\n",
|
||||
lpguid, ExplainGUID(lpguid), RefIid);
|
||||
|
||||
res = (*pDirectDrawCreate)(lpguid, lplpdd, pu);
|
||||
res = (*pDirectDrawCreateEx)(lpguid, lplpdd, RefIid, pu);
|
||||
if(res) {
|
||||
OutTraceP("DirectDrawCreateEx: ERROR res=%x(%s)\n", res, ExplainDDError(res));
|
||||
return res;
|
||||
}
|
||||
|
||||
DDVersion=1;
|
||||
if (lpguid) switch (*(DWORD *)lpguid){
|
||||
case 0x6C14DB80: DDVersion=1; break;
|
||||
case 0xB3A6F3E0: DDVersion=2; break;
|
||||
case 0x9c59509a: DDVersion=4; break;
|
||||
case 0x15e65ec0: DDVersion=7; break;
|
||||
dxw.dwDDVersion=7;
|
||||
char *mode;
|
||||
switch ((DWORD)lpguid){
|
||||
case 0: mode="NULL"; break;
|
||||
case DDCREATE_HARDWAREONLY: mode="DDCREATE_HARDWAREONLY"; break;
|
||||
case DDCREATE_EMULATIONONLY: mode="DDCREATE_EMULATIONONLY"; break;
|
||||
default:
|
||||
switch (*(DWORD *)lpguid){
|
||||
case 0x6C14DB80: dxw.dwDDVersion=1; mode="IID_IDirectDraw"; break;
|
||||
case 0xB3A6F3E0: dxw.dwDDVersion=2; mode="IID_IDirectDraw2"; break;
|
||||
case 0x9c59509a: dxw.dwDDVersion=4; mode="IID_IDirectDraw4"; break;
|
||||
case 0x15e65ec0: dxw.dwDDVersion=7; mode="IID_IDirectDraw7"; break;
|
||||
default: mode="unknown"; break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
OutTraceP("DirectDrawCreateEx: lpdd=%x guid=%x DDVersion=%d\n",
|
||||
*lplpdd, (lpguid ? *(DWORD *)lpguid:0), DDVersion);
|
||||
OutTraceP("DirectDrawCreateEx: lpdd=%x guid=%s DDVersion=%d\n", *lplpdd, mode, dxw.dwDDVersion);
|
||||
|
||||
#ifdef HOOKDDRAW
|
||||
HookDDSessionProxy(lplpdd, DDVersion);
|
||||
HookDDSessionProxy(lplpdd, dxw.dwDDVersion);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -247,15 +247,22 @@ void WINAPI extglClear(GLbitfield mask)
|
||||
HGLRC WINAPI extwglCreateContext(HDC hdc)
|
||||
{
|
||||
HGLRC ret;
|
||||
OutTraceD("wglCreateContext: hdc=%x\n", hdc);
|
||||
// v2.02.31: don't let it use desktop hdc
|
||||
if(dxw.IsDesktop(WindowFromDC(hdc))){
|
||||
HDC oldhdc = hdc;
|
||||
hdc=(*pGDIGetDC)(dxw.GethWnd());
|
||||
OutTraceD("wglCreateContext: remapped desktop hdc=%x->%x\n", oldhdc, hdc);
|
||||
}
|
||||
ret=(*pwglCreateContext)(hdc);
|
||||
if(ret!=NULL){
|
||||
if(ret){
|
||||
HWND hwnd;
|
||||
hwnd=WindowFromDC(hdc);
|
||||
dxw.SethWnd(hwnd);
|
||||
OutTraceD("wglCreateContext: hdc=%x hwnd=%x\n", hdc, hwnd);
|
||||
OutTraceD("wglCreateContext: SET hwnd=%x\n", hwnd);
|
||||
}
|
||||
else {
|
||||
OutTraceD("wglCreateContext: ERROR hdc=%x err=%x\n", hdc, GetLastError());
|
||||
OutTraceD("wglCreateContext: ERROR err=%x\n", GetLastError());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -281,6 +288,12 @@ BOOL WINAPI extwglMakeCurrent(HDC hdc, HGLRC hglrc)
|
||||
BOOL ret;
|
||||
|
||||
OutTraceD("wglMakeCurrent: hdc=%x hglrc=%x\n", hdc, hglrc);
|
||||
// v2.02.31: don't let it use desktop hdc
|
||||
if(dxw.IsDesktop(WindowFromDC(hdc))){
|
||||
HDC oldhdc = hdc;
|
||||
hdc=(*pGDIGetDC)(dxw.GethWnd());
|
||||
OutTraceD("wglMakeCurrent: remapped desktop hdc=%x->%x\n", oldhdc, hdc);
|
||||
}
|
||||
ret=(*pwglMakeCurrent)(hdc, hglrc);
|
||||
if(ret){
|
||||
HWND hWnd;
|
||||
|
@ -18,6 +18,7 @@ type definitions
|
||||
// advapi32.dll
|
||||
|
||||
typedef LONG (WINAPI *RegCloseKey_Type)(HKEY);
|
||||
typedef LONG (WINAPI *RegCreateKey_Type)(HKEY, LPCTSTR, PHKEY);
|
||||
typedef LONG (WINAPI *RegCreateKeyEx_Type)(HKEY, LPCTSTR, DWORD, LPTSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD);
|
||||
typedef LONG (WINAPI *RegOpenKeyEx_Type)(HKEY, LPCTSTR, DWORD, REGSAM, PHKEY);
|
||||
typedef LONG (WINAPI *RegQueryValueEx_Type)(HKEY, LPCTSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
|
||||
@ -43,10 +44,12 @@ typedef HFONT (WINAPI *CreateFontIndirect_Type)(const LOGFONT*);
|
||||
typedef HPALETTE(WINAPI *GDICreatePalette_Type)(CONST LOGPALETTE *);
|
||||
typedef HDWP (WINAPI *DeferWindowPos_Type)(HDWP, HWND, HWND, int, int, int, int, UINT);
|
||||
typedef BOOL (WINAPI *DeleteDC_Type)(HDC);
|
||||
typedef int (WINAPI *GetClipBox_Type)(HDC, LPRECT);
|
||||
typedef int (WINAPI *GetDeviceCaps_Type)(HDC, int);
|
||||
typedef BOOL (WINAPI *GetDeviceGammaRamp_Type)(HDC, LPVOID);
|
||||
typedef BOOL (WINAPI *GetSystemPaletteEntries_Type)(HDC, UINT, UINT, LPPALETTEENTRY);
|
||||
typedef BOOL (WINAPI *PatBlt_Type)(HDC, int, int, int, int, DWORD);
|
||||
typedef BOOL (WINAPI *Polyline_Type)(HDC, const POINT *, int);
|
||||
typedef UINT (WINAPI *RealizePalette_Type)(HDC);
|
||||
typedef BOOL (WINAPI *Rectangle_Type)(HDC, int, int, int, int);
|
||||
typedef BOOL (WINAPI *RestoreDC_Type)(HDC, int);
|
||||
@ -57,8 +60,28 @@ typedef COLORREF (WINAPI *SetBkColor_Type)(HDC, COLORREF);
|
||||
typedef BOOL (WINAPI *SetDeviceGammaRamp_Type)(HDC, LPVOID);
|
||||
typedef COLORREF(WINAPI *SetTextColor_Type)(HDC, COLORREF);
|
||||
typedef BOOL (WINAPI *StretchBlt_Type)(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
|
||||
typedef LONG (WINAPI *TabbedTextOutA_Type)(HDC, int, int, LPCTSTR, int, int, const LPINT, int);
|
||||
typedef int (WINAPI *StretchDIBits_Type)(HDC, int, int, int, int, int, int, int, int, const VOID *, const BITMAPINFO *, UINT, DWORD);
|
||||
typedef BOOL (WINAPI *TextOut_Type)(HDC, int, int, LPCTSTR, int);
|
||||
typedef BOOL (WINAPI *PolyBezierTo_Type)(HDC, const POINT *, DWORD);
|
||||
typedef BOOL (WINAPI *PolylineTo_Type)(HDC, const POINT *, DWORD);
|
||||
typedef BOOL (WINAPI *PolyDraw_Type)(HDC, const POINT *, const BYTE *, int);
|
||||
typedef BOOL (WINAPI *MoveToEx_Type)(HDC, int, int, LPPOINT);
|
||||
typedef BOOL (WINAPI *ArcTo_Type)(HDC, int, int, int, int, int, int, int, int);
|
||||
typedef BOOL (WINAPI *LineTo_Type)(HDC, int, int);
|
||||
typedef int (WINAPI *SetDIBitsToDevice_Type)(HDC, int, int, DWORD, DWORD, int, int, UINT, UINT, const VOID *, const BITMAPINFO *, UINT);
|
||||
typedef HBITMAP (WINAPI *CreateCompatibleBitmap_Type)(HDC, int, int);
|
||||
typedef COLORREF(WINAPI *SetPixel_Type)(HDC, int, int, COLORREF);
|
||||
typedef BOOL (WINAPI *Ellipse_Type)(HDC, int, int, int, int);
|
||||
typedef BOOL (WINAPI *Polygon_Type)(HDC, const POINT *, int);
|
||||
typedef BOOL (WINAPI *Arc_Type)(HDC, int, int, int, int, int, int, int, int);
|
||||
typedef HRGN (WINAPI *CreateEllipticRgn_Type)(int, int, int, int);
|
||||
typedef HRGN (WINAPI *CreateEllipticRgnIndirect_Type)(const RECT *);
|
||||
typedef HRGN (WINAPI *CreateRectRgn_Type)(int, int, int, int);
|
||||
typedef HRGN (WINAPI *CreateRectRgnIndirect_Type)(const RECT *);
|
||||
typedef HRGN (WINAPI *CreatePolygonRgn_Type)(const POINT *, int, int);
|
||||
typedef int (WINAPI *DrawText_Type)(HDC, LPCTSTR, int, LPRECT, UINT);
|
||||
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);
|
||||
|
||||
// Kernel32.dll:
|
||||
typedef BOOL (WINAPI *GetDiskFreeSpaceA_Type)(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD);
|
||||
@ -99,6 +122,7 @@ typedef LRESULT (WINAPI *DefWindowProc_Type)(HWND, UINT, WPARAM, LPARAM);
|
||||
typedef BOOL (WINAPI *EndPaint_Type)(HWND, const PAINTSTRUCT *);
|
||||
typedef LONG (WINAPI *EnumDisplaySettings_Type)(LPCTSTR, DWORD, LPDEVMODEA);
|
||||
typedef int (WINAPI *FillRect_Type)(HDC, const RECT *, HBRUSH);
|
||||
typedef int (WINAPI *FrameRect_Type)(HDC, const RECT *, HBRUSH);
|
||||
typedef BOOL (WINAPI *GetClientRect_Type)(HWND, LPRECT);
|
||||
typedef BOOL (WINAPI *GetClipCursor_Type)(LPRECT);
|
||||
typedef BOOL (WINAPI *GetCursorPos_Type)(LPPOINT);
|
||||
@ -124,6 +148,9 @@ typedef LONG (WINAPI *SetWindowLong_Type)(HWND, int, LONG);
|
||||
typedef BOOL (WINAPI *SetWindowPos_Type)(HWND, HWND, int, int, int, int, UINT);
|
||||
typedef int (WINAPI *ShowCursor_Type)(BOOL);
|
||||
typedef BOOL (WINAPI *ShowWindow_Type)(HWND, int);
|
||||
typedef LONG (WINAPI *TabbedTextOutA_Type)(HDC, int, int, LPCTSTR, int, int, const LPINT, int);
|
||||
typedef BOOL (WINAPI *DestroyWindow_Type)(HWND);
|
||||
typedef BOOL (WINAPI *CloseWindow_Type)(HWND);
|
||||
|
||||
// Winmm.dll:
|
||||
typedef MCIERROR(WINAPI *mciSendCommand_Type)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR);
|
||||
@ -148,6 +175,7 @@ hooked APIs real pointers
|
||||
// advapi32.dll
|
||||
|
||||
DXWEXTERN RegCloseKey_Type pRegCloseKey DXWINITIALIZED;
|
||||
DXWEXTERN RegCreateKey_Type pRegCreateKey DXWINITIALIZED;
|
||||
DXWEXTERN RegCreateKeyEx_Type pRegCreateKeyEx DXWINITIALIZED;
|
||||
DXWEXTERN RegOpenKeyEx_Type pRegOpenKeyEx DXWINITIALIZED;
|
||||
DXWEXTERN RegQueryValueEx_Type pRegQueryValueEx DXWINITIALIZED;
|
||||
@ -173,10 +201,12 @@ DXWEXTERN CreateFontIndirect_Type pGDICreateFontIndirect DXWINITIALIZED;
|
||||
DXWEXTERN GDICreatePalette_Type pGDICreatePalette DXWINITIALIZED;
|
||||
DXWEXTERN DeferWindowPos_Type pGDIDeferWindowPos DXWINITIALIZED;
|
||||
DXWEXTERN DeleteDC_Type pGDIDeleteDC DXWINITIALIZED;
|
||||
DXWEXTERN GetClipBox_Type pGDIGetClipBox DXWINITIALIZED;
|
||||
DXWEXTERN GetDeviceCaps_Type pGDIGetDeviceCaps DXWINITIALIZED;
|
||||
DXWEXTERN GetDeviceGammaRamp_Type pGDIGetDeviceGammaRamp DXWINITIALIZED;
|
||||
DXWEXTERN GetSystemPaletteEntries_Type pGDIGetSystemPaletteEntries DXWINITIALIZED;
|
||||
DXWEXTERN PatBlt_Type pGDIPatBlt DXWINITIALIZED;
|
||||
DXWEXTERN Polyline_Type pPolyline DXWINITIALIZED;
|
||||
DXWEXTERN RealizePalette_Type pGDIRealizePalette DXWINITIALIZED;
|
||||
DXWEXTERN Rectangle_Type pGDIRectangle DXWINITIALIZED;
|
||||
DXWEXTERN RestoreDC_Type pGDIRestoreDC DXWINITIALIZED;
|
||||
@ -187,8 +217,28 @@ DXWEXTERN SetBkColor_Type pGDISetBkColor DXWINITIALIZED;
|
||||
DXWEXTERN SetDeviceGammaRamp_Type pGDISetDeviceGammaRamp DXWINITIALIZED;
|
||||
DXWEXTERN SetTextColor_Type pGDISetTextColor DXWINITIALIZED;
|
||||
DXWEXTERN StretchBlt_Type pGDIStretchBlt DXWINITIALIZED;
|
||||
DXWEXTERN TabbedTextOutA_Type pTabbedTextOutA DXWINITIALIZED;
|
||||
DXWEXTERN StretchDIBits_Type pStretchDIBits DXWINITIALIZED;
|
||||
DXWEXTERN TextOut_Type pGDITextOutA DXWINITIALIZED;
|
||||
DXWEXTERN LineTo_Type pLineTo DXWINITIALIZED;
|
||||
DXWEXTERN ArcTo_Type pArcTo DXWINITIALIZED;
|
||||
DXWEXTERN MoveToEx_Type pMoveToEx DXWINITIALIZED;
|
||||
DXWEXTERN PolyDraw_Type pPolyDraw DXWINITIALIZED;
|
||||
DXWEXTERN PolylineTo_Type pPolylineTo DXWINITIALIZED;
|
||||
DXWEXTERN PolyBezierTo_Type pPolyBezierTo DXWINITIALIZED;
|
||||
DXWEXTERN SetDIBitsToDevice_Type pSetDIBitsToDevice DXWINITIALIZED;
|
||||
DXWEXTERN CreateCompatibleBitmap_Type pCreateCompatibleBitmap DXWINITIALIZED;
|
||||
DXWEXTERN SetPixel_Type pSetPixel DXWINITIALIZED;
|
||||
DXWEXTERN Ellipse_Type pEllipse DXWINITIALIZED;
|
||||
DXWEXTERN Polygon_Type pPolygon DXWINITIALIZED;
|
||||
DXWEXTERN Arc_Type pArc DXWINITIALIZED;
|
||||
DXWEXTERN CreateEllipticRgn_Type pCreateEllipticRgn DXWINITIALIZED;
|
||||
DXWEXTERN CreateEllipticRgnIndirect_Type pCreateEllipticRgnIndirect DXWINITIALIZED;
|
||||
DXWEXTERN CreateRectRgn_Type pCreateRectRgn DXWINITIALIZED;
|
||||
DXWEXTERN CreateRectRgnIndirect_Type pCreateRectRgnIndirect DXWINITIALIZED;
|
||||
DXWEXTERN CreatePolygonRgn_Type pCreatePolygonRgn DXWINITIALIZED;
|
||||
DXWEXTERN DrawText_Type pDrawText DXWINITIALIZED;
|
||||
DXWEXTERN DrawTextEx_Type pDrawTextEx DXWINITIALIZED;
|
||||
DXWEXTERN MaskBlt_Type pMaskBlt DXWINITIALIZED;
|
||||
|
||||
// Kernel32.dll:
|
||||
DXWEXTERN GetDiskFreeSpaceA_Type pGetDiskFreeSpaceA DXWINITIALIZED;
|
||||
@ -228,6 +278,7 @@ DXWEXTERN DefWindowProc_Type pDefWindowProc DXWINITIALIZED;
|
||||
DXWEXTERN EndPaint_Type pEndPaint DXWINITIALIZED;
|
||||
DXWEXTERN EnumDisplaySettings_Type pEnumDisplaySettings DXWINITIALIZED;
|
||||
DXWEXTERN FillRect_Type pFillRect DXWINITIALIZED;
|
||||
DXWEXTERN FrameRect_Type pFrameRect DXWINITIALIZED;
|
||||
DXWEXTERN GetClientRect_Type pGetClientRect DXWINITIALIZED;
|
||||
DXWEXTERN GetClipCursor_Type pGetClipCursor DXWINITIALIZED;
|
||||
DXWEXTERN GetCursorPos_Type pGetCursorPos DXWINITIALIZED;
|
||||
@ -246,7 +297,8 @@ DXWEXTERN PeekMessage_Type pPeekMessage DXWINITIALIZED;
|
||||
DXWEXTERN RegisterClassExA_Type pRegisterClassExA DXWINITIALIZED;
|
||||
DXWEXTERN GDIReleaseDC_Type pGDIReleaseDC DXWINITIALIZED;
|
||||
DXWEXTERN ScreenToClient_Type pScreenToClient DXWINITIALIZED;
|
||||
DXWEXTERN SendMessage_Type pSendMessage DXWINITIALIZED;
|
||||
DXWEXTERN SendMessage_Type pSendMessageA DXWINITIALIZED;
|
||||
DXWEXTERN SendMessage_Type pSendMessageW DXWINITIALIZED;
|
||||
DXWEXTERN SetCursor_Type pSetCursor DXWINITIALIZED;
|
||||
DXWEXTERN SetCursorPos_Type pSetCursorPos DXWINITIALIZED;
|
||||
DXWEXTERN SetTimer_Type pSetTimer DXWINITIALIZED;
|
||||
@ -254,6 +306,9 @@ DXWEXTERN SetWindowLong_Type pSetWindowLong DXWINITIALIZED;
|
||||
DXWEXTERN SetWindowPos_Type pSetWindowPos DXWINITIALIZED;
|
||||
DXWEXTERN ShowCursor_Type pShowCursor DXWINITIALIZED;
|
||||
DXWEXTERN ShowWindow_Type pShowWindow DXWINITIALIZED;
|
||||
DXWEXTERN TabbedTextOutA_Type pTabbedTextOutA DXWINITIALIZED;
|
||||
DXWEXTERN DestroyWindow_Type pDestroyWindow DXWINITIALIZED;
|
||||
DXWEXTERN CloseWindow_Type pCloseWindow DXWINITIALIZED;
|
||||
|
||||
// Winmm.dll:
|
||||
DXWEXTERN mciSendCommand_Type pmciSendCommand DXWINITIALIZED;
|
||||
@ -266,6 +321,7 @@ hook procedures (possibly more tnan one per each API...)
|
||||
// advapi32.dll
|
||||
|
||||
extern LONG WINAPI extRegCloseKey(HKEY);
|
||||
extern LONG WINAPI extRegCreateKey(HKEY, LPCTSTR, PHKEY);
|
||||
extern LONG WINAPI extRegCreateKeyEx(HKEY, LPCTSTR, DWORD, LPTSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD);
|
||||
extern LONG WINAPI extRegOpenKeyEx(HKEY, LPCTSTR, DWORD, REGSAM, PHKEY);
|
||||
extern LONG WINAPI extRegQueryValueEx(HKEY, LPCTSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
|
||||
@ -294,10 +350,12 @@ extern HPALETTE WINAPI extGDICreatePalette(CONST LOGPALETTE *);
|
||||
extern HDWP WINAPI extDeferWindowPos(HDWP, HWND, HWND, int, int, int, int, UINT);
|
||||
extern BOOL WINAPI extGDIDeleteDC(HDC);
|
||||
extern BOOL WINAPI extDDDeleteDC(HDC);
|
||||
extern int WINAPI extGetClipBox(HDC, LPRECT);
|
||||
extern int WINAPI extGetDeviceCaps(HDC, int);
|
||||
extern BOOL WINAPI extGetDeviceGammaRamp(HDC, LPVOID);
|
||||
extern UINT WINAPI extGetSystemPaletteEntries(HDC, UINT, UINT, LPPALETTEENTRY);
|
||||
extern BOOL WINAPI extGDIPatBlt(HDC, int, int, int, int, DWORD);
|
||||
extern BOOL WINAPI extPolyline(HDC, const POINT *, int);
|
||||
extern BOOL WINAPI extDDBitBlt(HDC, int, int, int, int, HDC, int, int, DWORD);
|
||||
extern UINT WINAPI extRealizePalette(HDC);
|
||||
extern BOOL WINAPI extRectangle(HDC, int, int, int, int);
|
||||
@ -309,9 +367,29 @@ extern COLORREF WINAPI extSetBkColor(HDC, COLORREF);
|
||||
extern BOOL WINAPI extSetDeviceGammaRamp(HDC, LPVOID);
|
||||
extern COLORREF WINAPI extSetTextColor(HDC, COLORREF);
|
||||
extern BOOL WINAPI extGDIStretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
|
||||
extern int WINAPI extStretchDIBits(HDC, int, int, int, int, int, int, int, int, const VOID *, const BITMAPINFO *, UINT, DWORD);
|
||||
extern BOOL WINAPI extDDStretchBlt(HDC, int, int, int, int, HDC, int, int, int, int, DWORD);
|
||||
extern LONG WINAPI extTabbedTextOutA(HDC, int, int, LPCTSTR, int, int, const LPINT, int);
|
||||
extern BOOL WINAPI extTextOutA(HDC, int, int, LPCTSTR, int);
|
||||
extern BOOL WINAPI extPolyBezierTo(HDC, const POINT *, DWORD);
|
||||
extern BOOL WINAPI extPolylineTo(HDC, const POINT *, DWORD);
|
||||
extern BOOL WINAPI extPolyDraw(HDC, const POINT *, const BYTE *, int);
|
||||
extern BOOL WINAPI extMoveToEx(HDC, int, int, LPPOINT);
|
||||
extern BOOL WINAPI extArcTo(HDC, int, int, int, int, int, int, int, int);
|
||||
extern BOOL WINAPI extLineTo(HDC, int, int);
|
||||
extern int WINAPI extSetDIBitsToDevice(HDC, int, int, DWORD, DWORD, int, int, UINT, UINT, const VOID *, const BITMAPINFO *, UINT);
|
||||
extern HBITMAP WINAPI extCreateCompatibleBitmap(HDC, int, int);
|
||||
extern COLORREF WINAPI extSetPixel(HDC, int, int, COLORREF);
|
||||
extern BOOL WINAPI extEllipse(HDC, int, int, int, int);
|
||||
extern BOOL WINAPI extPolygon(HDC, const POINT *, int);
|
||||
extern BOOL WINAPI extArc(HDC, int, int, int, int, int, int, int, int);
|
||||
extern HRGN WINAPI extCreateEllipticRgn(int, int, int, int);
|
||||
extern HRGN WINAPI extCreateEllipticRgnIndirect(const RECT *);
|
||||
extern HRGN WINAPI extCreateRectRgn(int, int, int, int);
|
||||
extern HRGN WINAPI extCreateRectRgnIndirect(const RECT *);
|
||||
extern HRGN WINAPI extCreatePolygonRgn(const POINT *, int, int);
|
||||
extern int WINAPI extDrawText(HDC, LPCTSTR, int, LPRECT, UINT);
|
||||
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);
|
||||
|
||||
// Kernel32.dll:
|
||||
extern BOOL WINAPI extGetDiskFreeSpaceA(LPCSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD);
|
||||
@ -352,6 +430,7 @@ extern LRESULT WINAPI extDefWindowProc(HWND, UINT, WPARAM, LPARAM);
|
||||
extern BOOL WINAPI extEndPaint(HWND, const PAINTSTRUCT *);
|
||||
extern LONG WINAPI extEnumDisplaySettings(LPCTSTR, DWORD, DEVMODE *);
|
||||
extern int WINAPI extFillRect(HDC, const RECT *, HBRUSH);
|
||||
extern int WINAPI extFrameRect(HDC, const RECT *, HBRUSH);
|
||||
extern BOOL WINAPI extGetClientRect(HWND, LPRECT);
|
||||
extern BOOL WINAPI extGetClipCursor(LPRECT);
|
||||
extern BOOL WINAPI extGetCursorPos(LPPOINT);
|
||||
@ -382,6 +461,10 @@ extern LONG WINAPI extSetWindowLong(HWND, int, LONG);
|
||||
extern BOOL WINAPI extSetWindowPos(HWND, HWND, int, int, int, int, UINT);
|
||||
extern int WINAPI extShowCursor(BOOL);
|
||||
extern BOOL WINAPI extShowWindow(HWND, int);
|
||||
extern LONG WINAPI extTabbedTextOutA(HDC, int, int, LPCTSTR, int, int, const LPINT, int);
|
||||
extern BOOL WINAPI extDestroyWindow(HWND);
|
||||
extern BOOL WINAPI extCloseWindow(HWND);
|
||||
|
||||
|
||||
// Winmm.dll:
|
||||
extern MCIERROR WINAPI extmciSendCommand(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR);
|
||||
|
333
dll/user32.cpp
333
dll/user32.cpp
@ -1,5 +1,8 @@
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <stdio.h>
|
||||
#include "dxwnd.h"
|
||||
#include "dxwcore.hpp"
|
||||
#include "syslibs.h"
|
||||
@ -19,13 +22,17 @@ static HookEntry_Type Hooks[]={
|
||||
{"EnumDisplaySettingsA", (FARPROC)EnumDisplaySettingsA, (FARPROC *)&pEnumDisplaySettings, (FARPROC)extEnumDisplaySettings},
|
||||
{"GetClipCursor", (FARPROC)GetClipCursor, (FARPROC*)&pGetClipCursor, (FARPROC)extGetClipCursor},
|
||||
{"ClipCursor", (FARPROC)ClipCursor, (FARPROC *)&pClipCursor, (FARPROC)extClipCursor},
|
||||
{"FillRect", (FARPROC)FillRect, (FARPROC *)&pFillRect, (FARPROC)extFillRect},
|
||||
{"FillRect", (FARPROC)NULL, (FARPROC *)&pFillRect, (FARPROC)extFillRect},
|
||||
{"FrameRect", (FARPROC)NULL, (FARPROC *)&pFrameRect, (FARPROC)extFrameRect},
|
||||
{"DefWindowProcA", (FARPROC)DefWindowProcA, (FARPROC *)&pDefWindowProc, (FARPROC)extDefWindowProc},
|
||||
{"CreateWindowExA", (FARPROC)CreateWindowExA, (FARPROC *)&pCreateWindowExA, (FARPROC)extCreateWindowExA},
|
||||
{"CreateWindowExW", (FARPROC)CreateWindowExW, (FARPROC *)&pCreateWindowExW, (FARPROC)extCreateWindowExW},
|
||||
{"RegisterClassExA", (FARPROC)RegisterClassExA, (FARPROC *)&pRegisterClassExA, (FARPROC)extRegisterClassExA},
|
||||
{"GetSystemMetrics", (FARPROC)GetSystemMetrics, (FARPROC *)&pGetSystemMetrics, (FARPROC)extGetSystemMetrics},
|
||||
{"GetDesktopWindow", (FARPROC)GetDesktopWindow, (FARPROC *)&pGetDesktopWindow, (FARPROC)extGetDesktopWindow},
|
||||
{"TabbedTextOutA", (FARPROC)TabbedTextOutA, (FARPROC *)&pTabbedTextOutA, (FARPROC)extTabbedTextOutA},
|
||||
{"CloseWindow", (FARPROC)NULL, (FARPROC *)&pCloseWindow, (FARPROC)extCloseWindow},
|
||||
{"DestroyWindow", (FARPROC)NULL, (FARPROC *)&pDestroyWindow, (FARPROC)extDestroyWindow},
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
@ -63,7 +70,8 @@ static HookEntry_Type MessageHooks[]={
|
||||
static HookEntry_Type MouseHooks[]={
|
||||
{"GetCursorPos", (FARPROC)GetCursorPos, (FARPROC *)&pGetCursorPos, (FARPROC)extGetCursorPos},
|
||||
{"SetCursor", (FARPROC)SetCursor, (FARPROC *)&pSetCursor, (FARPROC)extSetCursor},
|
||||
{"SendMessageA", (FARPROC)SendMessageA, (FARPROC *)&pSendMessage, (FARPROC)extSendMessage}, // ???
|
||||
{"SendMessageA", (FARPROC)SendMessageA, (FARPROC *)&pSendMessageA, (FARPROC)extSendMessage}, // ???
|
||||
{"SendMessageW", (FARPROC)SendMessageW, (FARPROC *)&pSendMessageW, (FARPROC)extSendMessage}, // ???
|
||||
//{"SetPhysicalCursorPos", NULL, (FARPROC *)&pSetCursor, (FARPROC)extSetCursor}, // ???
|
||||
{0, NULL, 0, 0} // terminator
|
||||
};
|
||||
@ -157,8 +165,18 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, DEVMODE *lpDevMode, DWORD dwfla
|
||||
// save desired settings first v.2.1.89
|
||||
// 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.
|
||||
if(lpDevMode && (lpDevMode->dmFields & (DM_PELSWIDTH | DM_PELSHEIGHT)))
|
||||
if(lpDevMode && (lpDevMode->dmFields & (DM_PELSWIDTH | DM_PELSHEIGHT))){
|
||||
RECT client;
|
||||
dxw.SetScreenSize(lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight);
|
||||
// v2.02.31: when main win is bigger that expected resolution, you're in windowed fullscreen mode
|
||||
//(*pGetClientRect)((dxw.dwFlags1 & FIXPARENTWIN) ? dxw.hParentWnd : dxw.GethWnd(), &client);
|
||||
(*pGetClientRect)(dxw.GethWnd(), &client);
|
||||
OutTraceD("%s: current hWnd=%x size=(%d,%d)\n", fname, dxw.GethWnd(), client.right, client.bottom);
|
||||
if((client.right>=(LONG)lpDevMode->dmPelsWidth) && (client.bottom>=(LONG)lpDevMode->dmPelsHeight)) {
|
||||
OutTraceD("%s: entering FULLSCREEN mode\n", fname);
|
||||
dxw.SetFullScreen(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if ((dwflags==0 || dwflags==CDS_FULLSCREEN) && lpDevMode){
|
||||
if (dxw.dwFlags1 & EMULATESURFACE || !(lpDevMode->dmFields & DM_BITSPERPEL)){
|
||||
@ -497,7 +515,7 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong)
|
||||
WNDPROC lres;
|
||||
WNDPROC OldProc;
|
||||
// GPL fix
|
||||
if(dxw.IsDesktop(hwnd)) {
|
||||
if(dxw.IsRealDesktop(hwnd)) {
|
||||
hwnd=dxw.GethWnd();
|
||||
OutTraceD("SetWindowLong: DESKTOP hwnd, FIXING hwnd=%x\n",hwnd);
|
||||
}
|
||||
@ -571,47 +589,17 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c
|
||||
|
||||
HDWP WINAPI extDeferWindowPos(HDWP hWinPosInfo, HWND hwnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags)
|
||||
{
|
||||
// v2.02.31: heavily used by "Imperialism II" !!!
|
||||
HDWP res;
|
||||
|
||||
OutTraceD("DeferWindowPos: hwnd=%x%s pos=(%d,%d) dim=(%d,%d) Flags=%x\n",
|
||||
hwnd, dxw.IsFullScreen()?"(FULLSCREEN)":"", X, Y, cx, cy, uFlags);
|
||||
|
||||
//if ((hwnd != dxw.GethWnd()) || !dxw.IsFullScreen()){
|
||||
{
|
||||
// just proxy
|
||||
res=(*pGDIDeferWindowPos)(hWinPosInfo, hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
|
||||
if(!res)OutTraceE("SetWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
||||
return res;
|
||||
if(dxw.IsFullScreen()){
|
||||
dxw.MapClient(&X, &Y, &cx, &cy);
|
||||
OutTraceD("DeferWindowPos: remapped pos=(%d,%d) dim=(%d,%d)\n", X, Y, cx, cy);
|
||||
}
|
||||
|
||||
if (dxw.dwFlags1 & LOCKWINPOS){
|
||||
return hWinPosInfo;
|
||||
}
|
||||
|
||||
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
|
||||
int UpdFlag =0;
|
||||
int MaxX, MaxY;
|
||||
MaxX = dxw.iSizX;
|
||||
MaxY = dxw.iSizY;
|
||||
if (!MaxX) MaxX = dxw.GetScreenWidth();
|
||||
if (!MaxY) MaxY = dxw.GetScreenHeight();
|
||||
if(cx>MaxX) { cx=MaxX; UpdFlag=1; }
|
||||
if(cy>MaxY) { cy=MaxY; UpdFlag=1; }
|
||||
if (UpdFlag)
|
||||
OutTraceD("SetWindowPos: using max dim=(%d,%d)\n", cx, cy);
|
||||
}
|
||||
|
||||
// useful??? to be demonstrated....
|
||||
// when altering main window in fullscreen mode, fix the coordinates for borders
|
||||
DWORD dwCurStyle;
|
||||
RECT rect;
|
||||
rect.top=rect.left=0;
|
||||
rect.right=cx; rect.bottom=cy;
|
||||
dwCurStyle=(*pGetWindowLong)(hwnd, GWL_STYLE);
|
||||
AdjustWindowRect(&rect, dwCurStyle, FALSE);
|
||||
cx=rect.right; cy=rect.bottom;
|
||||
OutTraceD("SetWindowPos: main form hwnd=%x fixed size=(%d,%d)\n", hwnd, cx, cy);
|
||||
|
||||
res=(*pGDIDeferWindowPos)(hWinPosInfo, hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
|
||||
if(!res)OutTraceE("DeferWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
||||
return res;
|
||||
@ -653,7 +641,7 @@ LRESULT WINAPI extSendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
break;
|
||||
}
|
||||
}
|
||||
ret=(*pSendMessage)(hwnd, Msg, wParam, lParam);
|
||||
ret=(*pSendMessageA)(hwnd, Msg, wParam, lParam);
|
||||
OutTraceW("SendMessage: lresult=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
@ -808,7 +796,7 @@ BOOL WINAPI extGetMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgF
|
||||
Message=lpMsg->message & 0xFFFF;
|
||||
if((Message <= WM_MOUSELAST) && (Message >= WM_MOUSEFIRST)){
|
||||
FixedHwnd=(hwnd)?hwnd:dxw.GethWnd();
|
||||
if(dxw.IsDesktop(FixedHwnd)) FixedHwnd=dxw.GethWnd(); // GPL fix...
|
||||
if(dxw.IsRealDesktop(FixedHwnd)) FixedHwnd=dxw.GethWnd(); // GPL fix...
|
||||
lpMsg->pt=FixMessagePt(FixedHwnd, lpMsg->pt);
|
||||
lpMsg->lParam = MAKELPARAM(lpMsg->pt.x, lpMsg->pt.y);
|
||||
OutTraceC("PeekMessage: fixed lparam/pt=(%d,%d)\n", lpMsg->pt.x, lpMsg->pt.y);
|
||||
@ -935,8 +923,8 @@ int WINAPI extMapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT
|
||||
}
|
||||
|
||||
if(dxw.IsFullScreen()){
|
||||
if(dxw.IsDesktop(hWndTo)) hWndTo=dxw.GethWnd();
|
||||
if(dxw.IsDesktop(hWndFrom)) hWndFrom=dxw.GethWnd();
|
||||
if(dxw.IsRealDesktop(hWndTo)) hWndTo=dxw.GethWnd();
|
||||
if(dxw.IsRealDesktop(hWndFrom)) hWndFrom=dxw.GethWnd();
|
||||
}
|
||||
|
||||
// should scale the retcode ???
|
||||
@ -951,7 +939,7 @@ HWND WINAPI extGetDesktopWindow(void)
|
||||
HWND res;
|
||||
|
||||
OutTraceD("GetDesktopWindow: FullScreen=%x\n", dxw.IsFullScreen());
|
||||
if (dxw.IsFullScreen()){
|
||||
if (dxw.IsFullScreen()){
|
||||
OutTraceD("GetDesktopWindow: returning main window hwnd=%x\n", dxw.GethWnd());
|
||||
return dxw.GethWnd();
|
||||
}
|
||||
@ -974,11 +962,13 @@ int WINAPI extGetSystemMetrics(int nindex)
|
||||
switch(nindex){
|
||||
case SM_CXFULLSCREEN:
|
||||
case SM_CXSCREEN:
|
||||
case SM_CXVIRTUALSCREEN: // v2.02.31
|
||||
res = pSetDevMode->dmPelsWidth;
|
||||
OutTraceD("GetDeviceCaps: fix HORZRES cap=%d\n", res);
|
||||
return res;
|
||||
case SM_CYFULLSCREEN:
|
||||
case SM_CYSCREEN:
|
||||
case SM_CYVIRTUALSCREEN: // v2.02.31
|
||||
res = pSetDevMode->dmPelsHeight;
|
||||
OutTraceD("GetDeviceCaps: fix VERTRES cap=%d\n", res);
|
||||
return res;
|
||||
@ -988,11 +978,13 @@ int WINAPI extGetSystemMetrics(int nindex)
|
||||
switch(nindex){
|
||||
case SM_CXFULLSCREEN:
|
||||
case SM_CXSCREEN:
|
||||
case SM_CXVIRTUALSCREEN: // v2.02.31
|
||||
res= dxw.GetScreenWidth();
|
||||
OutTraceD("GetSystemMetrics: fix SM_CXSCREEN=%d\n", res);
|
||||
break;
|
||||
case SM_CYFULLSCREEN:
|
||||
case SM_CYSCREEN:
|
||||
case SM_CYVIRTUALSCREEN: // v2.02.31
|
||||
res= dxw.GetScreenHeight();
|
||||
OutTraceD("GetSystemMetrics: fix SM_CYSCREEN=%d\n", res);
|
||||
break;
|
||||
@ -1014,35 +1006,8 @@ ATOM WINAPI extRegisterClassExA(WNDCLASSEX *lpwcx)
|
||||
return (*pRegisterClassExA)(lpwcx);
|
||||
}
|
||||
|
||||
HWND WINAPI extCreateWindowExW(
|
||||
DWORD dwExStyle,
|
||||
LPCWSTR lpClassName,
|
||||
LPCWSTR lpWindowName,
|
||||
DWORD dwStyle,
|
||||
int x,
|
||||
int y,
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
HWND hWndParent,
|
||||
HMENU hMenu,
|
||||
HINSTANCE hInstance,
|
||||
LPVOID lpParam)
|
||||
{
|
||||
char sClassName[256+1];
|
||||
char sWindowName[256+1];
|
||||
wcstombs_s(NULL, sClassName, lpClassName, 80);
|
||||
wcstombs_s(NULL, sWindowName, lpWindowName, 80);
|
||||
|
||||
OutTraceD("CreateWindowExW: class=\"%ls\" wname=\"%ls\" pos=(%d,%d) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n",
|
||||
lpClassName, lpWindowName, x, y, nWidth, nHeight,
|
||||
dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
|
||||
if(IsDebug) OutTrace("CreateWindowExW: DEBUG screen=(%d,%d)\n", dxw.GetScreenWidth(), dxw.GetScreenHeight());
|
||||
|
||||
return extCreateWindowExA(dwExStyle, sClassName, sWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
|
||||
}
|
||||
|
||||
// GHO: pro Diablo
|
||||
HWND WINAPI extCreateWindowExA(
|
||||
static HWND WINAPI extCreateWindowCommon(
|
||||
LPCTSTR ApiName,
|
||||
DWORD dwExStyle,
|
||||
LPCTSTR lpClassName,
|
||||
LPCTSTR lpWindowName,
|
||||
@ -1060,14 +1025,9 @@ HWND WINAPI extCreateWindowExA(
|
||||
WNDPROC pWindowProc;
|
||||
BOOL isValidHandle=TRUE;
|
||||
|
||||
OutTraceD("CreateWindowExA: class=\"%s\" wname=\"%s\" pos=(%d,%d) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n",
|
||||
lpClassName, lpWindowName, x, y, nWidth, nHeight,
|
||||
dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
|
||||
if(IsDebug) OutTrace("CreateWindowExA: DEBUG screen=(%d,%d)\n", dxw.GetScreenWidth(), dxw.GetScreenHeight());
|
||||
|
||||
// no maximized windows in any case
|
||||
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
|
||||
OutTraceD("CreateWindowExA: handling PREVENTMAXIMIZE mode\n");
|
||||
OutTraceD("%s: handling PREVENTMAXIMIZE mode\n", ApiName);
|
||||
dwStyle &= ~(WS_MAXIMIZE | WS_POPUP);
|
||||
dwExStyle &= ~WS_EX_TOPMOST;
|
||||
}
|
||||
@ -1117,7 +1077,7 @@ HWND WINAPI extCreateWindowExA(
|
||||
}
|
||||
nWidth=screen.right;
|
||||
nHeight=screen.bottom;
|
||||
OutTraceD("CreateWindowExA: fixed BIG win pos=(%d,%d) size=(%d,%d)\n", x, y, nWidth, nHeight);
|
||||
OutTraceD("%s: fixed BIG win pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight);
|
||||
}
|
||||
else {
|
||||
// invalid parent coordinates: use initial placement, but leave the size.
|
||||
@ -1128,7 +1088,7 @@ HWND WINAPI extCreateWindowExA(
|
||||
//}
|
||||
nWidth=dxw.iSizX;
|
||||
nHeight=dxw.iSizY;
|
||||
OutTraceD("CreateWindowExA: renewed BIG win pos=(%d,%d) size=(%d,%d)\n", x, y, nWidth, nHeight);
|
||||
OutTraceD("%s: renewed BIG win pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight);
|
||||
}
|
||||
dxw.SetFullScreen(TRUE);
|
||||
if(dxw.Coordinates==DXW_DESKTOP_WORKAREA){
|
||||
@ -1139,14 +1099,14 @@ HWND WINAPI extCreateWindowExA(
|
||||
nWidth=workarea.right;
|
||||
nHeight=workarea.bottom;
|
||||
dwStyle=(dxw.dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW;
|
||||
OutTraceD("CreateWindowExA: WORKAREA win pos=(%d,%d) size=(%d,%d)\n", x, y, nWidth, nHeight);
|
||||
OutTraceD("%s: WORKAREA win pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight);
|
||||
}
|
||||
}
|
||||
|
||||
if(!dxw.IsFullScreen()){ // v2.1.63: needed for "Monster Truck Madness"
|
||||
wndh= (*pCreateWindowExA)(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight,
|
||||
hWndParent, hMenu, hInstance, lpParam);
|
||||
OutTraceD("CreateWindowExA: windowed mode ret=%x\n", wndh);
|
||||
OutTraceD("%s: windowed mode ret=%x\n", ApiName, wndh);
|
||||
return wndh;
|
||||
}
|
||||
|
||||
@ -1154,25 +1114,25 @@ HWND WINAPI extCreateWindowExA(
|
||||
// Age of Empires....
|
||||
if (dwStyle & WS_CHILD){
|
||||
dxw.MapClient(&x, &y, &nWidth, &nHeight);
|
||||
OutTraceD("CreateWindowExA: fixed WS_CHILD pos=(%d,%d) size=(%d,%d)\n",
|
||||
x, y, nWidth, nHeight);
|
||||
OutTraceD("%s: fixed WS_CHILD pos=(%d,%d) size=(%d,%d)\n",
|
||||
ApiName, x, y, nWidth, nHeight);
|
||||
}
|
||||
// needed for Diablo, that creates a new control parent window that must be
|
||||
// overlapped to the directdraw surface.
|
||||
else if (dwExStyle & WS_EX_CONTROLPARENT){
|
||||
dxw.MapWindow(&x, &y, &nWidth, &nHeight);
|
||||
OutTraceD("CreateWindowExA: fixed WS_EX_CONTROLPARENT pos=(%d,%d) size=(%d,%d)\n",
|
||||
x, y, nWidth, nHeight);
|
||||
OutTraceD("%s: fixed WS_EX_CONTROLPARENT pos=(%d,%d) size=(%d,%d)\n",
|
||||
ApiName, x, y, nWidth, nHeight);
|
||||
}
|
||||
|
||||
OutTraceB("CreateWindowExA: fixed pos=(%d,%d) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n",
|
||||
x, y, nWidth, nHeight, dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
|
||||
OutTraceB("%s: fixed pos=(%d,%d) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n",
|
||||
ApiName, x, y, nWidth, nHeight, dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
|
||||
|
||||
wndh= (*pCreateWindowExA)(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight,
|
||||
hWndParent, hMenu, hInstance, lpParam);
|
||||
if (wndh==(HWND)NULL){
|
||||
OutTraceE("CreateWindowExA: ERROR err=%d Style=%x(%s) ExStyle=%x\n",
|
||||
GetLastError(), dwStyle, ExplainStyle(dwStyle), dwExStyle);
|
||||
OutTraceE("%s: ERROR err=%d Style=%x(%s) ExStyle=%x\n",
|
||||
ApiName, GetLastError(), dwStyle, ExplainStyle(dwStyle), dwExStyle);
|
||||
return wndh;
|
||||
}
|
||||
|
||||
@ -1181,7 +1141,7 @@ HWND WINAPI extCreateWindowExA(
|
||||
extern void AdjustWindowPos(HWND, DWORD, DWORD);
|
||||
(*pSetWindowLong)(wndh, GWL_STYLE, (dxw.dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW);
|
||||
(*pSetWindowLong)(wndh, GWL_EXSTYLE, 0);
|
||||
OutTraceD("CreateWindowExA: hwnd=%x, set style=WS_OVERLAPPEDWINDOW extstyle=0\n", wndh);
|
||||
OutTraceD("%s: hwnd=%x, set style=WS_OVERLAPPEDWINDOW extstyle=0\n", ApiName, wndh);
|
||||
AdjustWindowPos(wndh, nWidth, nHeight);
|
||||
(*pShowWindow)(wndh, SW_SHOWNORMAL);
|
||||
}
|
||||
@ -1196,13 +1156,75 @@ HWND WINAPI extCreateWindowExA(
|
||||
OutTraceD("Hooking CHILD wndh=%x WindowProc %x->%x\n", wndh, pWindowProc, extChildWindowProc);
|
||||
res=(*pSetWindowLong)(wndh, GWL_WNDPROC, (LONG)extChildWindowProc);
|
||||
WhndStackPush(wndh, pWindowProc);
|
||||
if(!res) OutTraceE("CreateWindowExA: SetWindowLong ERROR %x\n", GetLastError());
|
||||
if(!res) OutTraceE("%s: SetWindowLong ERROR %x\n", ApiName, GetLastError());
|
||||
}
|
||||
|
||||
OutTraceD("CreateWindowExA: ret=%x\n", wndh);
|
||||
OutTraceD("%s: ret=%x\n", ApiName, wndh);
|
||||
return wndh;
|
||||
}
|
||||
|
||||
static LPCSTR ClassToStr(LPCSTR Class)
|
||||
{
|
||||
static char AtomBuf[20+1];
|
||||
if(((DWORD)Class & 0xFFFF0000) == 0){
|
||||
sprintf(AtomBuf, "ATOM(%X)", Class);
|
||||
return AtomBuf;
|
||||
}
|
||||
return Class;
|
||||
}
|
||||
|
||||
// to do: implement and use ClassToWStr() for widechar call
|
||||
|
||||
HWND WINAPI extCreateWindowExW(
|
||||
DWORD dwExStyle,
|
||||
LPCWSTR lpClassName,
|
||||
LPCWSTR lpWindowName,
|
||||
DWORD dwStyle,
|
||||
int x,
|
||||
int y,
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
HWND hWndParent,
|
||||
HMENU hMenu,
|
||||
HINSTANCE hInstance,
|
||||
LPVOID lpParam)
|
||||
{
|
||||
char sClassName[256+1];
|
||||
char sWindowName[256+1];
|
||||
wcstombs_s(NULL, sClassName, lpClassName, 80);
|
||||
wcstombs_s(NULL, sWindowName, lpWindowName, 80);
|
||||
|
||||
OutTraceD("CreateWindowExW: class=\"%ls\" wname=\"%ls\" pos=(%d,%d) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n",
|
||||
lpClassName, lpWindowName, x, y, nWidth, nHeight,
|
||||
dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
|
||||
if(IsDebug) OutTrace("CreateWindowExW: DEBUG screen=(%d,%d)\n", dxw.GetScreenWidth(), dxw.GetScreenHeight());
|
||||
|
||||
return extCreateWindowCommon("CreateWindowExW", dwExStyle, sClassName, sWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
|
||||
}
|
||||
|
||||
// GHO: pro Diablo
|
||||
HWND WINAPI extCreateWindowExA(
|
||||
DWORD dwExStyle,
|
||||
LPCTSTR lpClassName,
|
||||
LPCTSTR lpWindowName,
|
||||
DWORD dwStyle,
|
||||
int x,
|
||||
int y,
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
HWND hWndParent,
|
||||
HMENU hMenu,
|
||||
HINSTANCE hInstance,
|
||||
LPVOID lpParam)
|
||||
{
|
||||
OutTraceD("CreateWindowExA: class=\"%s\" wname=\"%s\" pos=(%d,%d) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n",
|
||||
ClassToStr(lpClassName), lpWindowName, x, y, nWidth, nHeight,
|
||||
dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle));
|
||||
if(IsDebug) OutTrace("CreateWindowExA: DEBUG screen=(%d,%d)\n", dxw.GetScreenWidth(), dxw.GetScreenHeight());
|
||||
|
||||
return extCreateWindowCommon("CreateWindowExA", dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
|
||||
}
|
||||
|
||||
LRESULT WINAPI extCallWindowProc(WNDPROC lpPrevWndFunc, HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// v2.02.30: fix (Imperialism II): apply to main window only !!!
|
||||
@ -1233,39 +1255,48 @@ LRESULT WINAPI extDefWindowProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lPara
|
||||
|
||||
int WINAPI extFillRect(HDC hdc, const RECT *lprc, HBRUSH hbr)
|
||||
{
|
||||
RECT rc, trim;
|
||||
HWND hWnd;
|
||||
OutTraceD("FillRect: hdc=%x xy=(%d,%d)-(%d,%d)\n", hdc, lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
int res;
|
||||
RECT rc;
|
||||
OutTraceD("FillRect: hdc=%x hbrush=%x rect=(%d,%d)-(%d,%d)\n", hdc, hbr, lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
|
||||
// when not in fullscreen mode, just proxy the call
|
||||
if(!dxw.IsFullScreen()) return (*pFillRect)(hdc, lprc, hbr);
|
||||
|
||||
memcpy(&rc, lprc, sizeof(rc));
|
||||
hWnd = WindowFromDC(hdc);
|
||||
if((hWnd == dxw.GethWnd()) ||
|
||||
(hWnd == 0) ||
|
||||
(hWnd == GetDesktopWindow())){
|
||||
// trim: some games (Player Manager 98) clear the screen by filling an exagerated rect
|
||||
(*pGetClientRect)(dxw.GethWnd(), &trim);
|
||||
hdc=GetDC(dxw.GethWnd());
|
||||
dxw.MapWindowRect(&rc);
|
||||
if(rc.left < trim.left) rc.left = trim.left;
|
||||
if(rc.top < trim.top) rc.top = trim.top;
|
||||
if(rc.right > trim.right) rc.right = trim.right;
|
||||
if(rc.bottom > trim.bottom) rc.bottom = trim.bottom;
|
||||
OutTraceD("FillRect: hwnd=%x hdc=%x fixed xy=(%d,%d)-(%d,%d)\n", hWnd, hdc, rc.left, rc.top, rc.right, rc.bottom);
|
||||
if(OBJ_DC == GetObjectType(hdc)){
|
||||
if(rc.left < 0) rc.left = 0;
|
||||
if(rc.top < 0) rc.top = 0;
|
||||
if((DWORD)rc.right > dxw.GetScreenWidth()) rc.right = dxw.GetScreenWidth();
|
||||
if((DWORD)rc.bottom > dxw.GetScreenHeight()) rc.bottom = dxw.GetScreenHeight();
|
||||
dxw.MapClient(&rc);
|
||||
OutTraceD("FillRect: fixed rect=(%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
|
||||
}
|
||||
if (dxw.dwFlags1 & FIXTEXTOUT) {
|
||||
// to be verified: why shifting and not scaling?
|
||||
POINT anchor;
|
||||
anchor.x=rc.left;
|
||||
anchor.y=rc.top;
|
||||
(*pClientToScreen)(dxw.GethWnd(), &anchor);
|
||||
rc.left=anchor.x;
|
||||
rc.top=anchor.y;
|
||||
anchor.x=rc.right;
|
||||
anchor.y=rc.bottom;
|
||||
(*pClientToScreen)(dxw.GethWnd(), &anchor);
|
||||
rc.right=anchor.x;
|
||||
rc.bottom=anchor.y;
|
||||
|
||||
res=(*pFillRect)(hdc, &rc, hbr);
|
||||
return res;
|
||||
}
|
||||
|
||||
int WINAPI extFrameRect(HDC hdc, const RECT *lprc, HBRUSH hbr)
|
||||
{
|
||||
int res;
|
||||
RECT rc;
|
||||
OutTraceD("FrameRect: hdc=%x hbrush=%x rect=(%d,%d)-(%d,%d)\n", hdc, hbr, lprc->left, lprc->top, lprc->right, lprc->bottom);
|
||||
|
||||
// when not in fullscreen mode, just proxy the call
|
||||
if(!dxw.IsFullScreen()) return (*pFrameRect)(hdc, lprc, hbr);
|
||||
|
||||
memcpy(&rc, lprc, sizeof(rc));
|
||||
if(OBJ_DC == GetObjectType(hdc)){
|
||||
if(rc.left < 0) rc.left = 0;
|
||||
if(rc.top < 0) rc.top = 0;
|
||||
if((DWORD)rc.right > dxw.GetScreenWidth()) rc.right = dxw.GetScreenWidth();
|
||||
if((DWORD)rc.bottom > dxw.GetScreenHeight()) rc.bottom = dxw.GetScreenHeight();
|
||||
dxw.MapClient(&rc);
|
||||
OutTraceD("FrameRect: fixed rect=(%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
|
||||
}
|
||||
return (*pFillRect)(hdc, &rc, hbr);
|
||||
|
||||
res=(*pFrameRect)(hdc, &rc, hbr);
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOL WINAPI extClipCursor(RECT *lpRectArg)
|
||||
@ -1363,7 +1394,7 @@ LONG WINAPI extChangeDisplaySettings(DEVMODE *lpDevMode, DWORD dwflags)
|
||||
{
|
||||
if(IsTraceD){
|
||||
OutTrace("ChangeDisplaySettings: lpDevMode=%x flags=%x", lpDevMode, dwflags);
|
||||
if (lpDevMode) OutTrace(" fields=%x(%s) size=(%d x %d) bpp=%x",
|
||||
if (lpDevMode) OutTrace(" fields=%x(%s) size=(%d x %d) bpp=%d",
|
||||
lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields),
|
||||
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);
|
||||
OutTrace("\n");
|
||||
@ -1376,7 +1407,7 @@ LONG WINAPI extChangeDisplaySettingsEx(LPCTSTR lpszDeviceName, DEVMODE *lpDevMod
|
||||
{
|
||||
if(IsTraceD){
|
||||
OutTrace("ChangeDisplaySettingsEx: DeviceName=%s lpDevMode=%x flags=%x", lpszDeviceName, lpDevMode, dwflags);
|
||||
if (lpDevMode) OutTrace(" size=(%d x %d) bpp=%x",
|
||||
if (lpDevMode) OutTrace(" size=(%d x %d) bpp=%d",
|
||||
lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel);
|
||||
OutTrace("\n");
|
||||
}
|
||||
@ -1391,8 +1422,7 @@ HDC WINAPI extGDIGetDC(HWND hwnd)
|
||||
|
||||
OutTraceD("GDI.GetDC: hwnd=%x\n", hwnd);
|
||||
lochwnd=hwnd;
|
||||
//if (dxw.IsFullScreen() && dxw.IsDesktop()) {
|
||||
if (dxw.IsDesktop(hwnd)) {
|
||||
if (dxw.IsRealDesktop(hwnd)) {
|
||||
OutTraceD("GDI.GetDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd());
|
||||
lochwnd=dxw.GethWnd();
|
||||
}
|
||||
@ -1437,7 +1467,7 @@ HDC WINAPI extGDIGetWindowDC(HWND hwnd)
|
||||
HWND lochwnd;
|
||||
OutTraceD("GDI.GetWindowDC: hwnd=%x\n", hwnd);
|
||||
lochwnd=hwnd;
|
||||
if (dxw.IsDesktop(hwnd)) {
|
||||
if (dxw.IsRealDesktop(hwnd)) {
|
||||
OutTraceD("GDI.GetWindowDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd());
|
||||
lochwnd=dxw.GethWnd();
|
||||
}
|
||||
@ -1465,7 +1495,7 @@ int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC)
|
||||
int res;
|
||||
|
||||
OutTraceD("GDI.ReleaseDC: hwnd=%x hdc=%x\n", hwnd, hDC);
|
||||
if (dxw.IsDesktop(hwnd)) hwnd=dxw.GethWnd();
|
||||
if (dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
|
||||
|
||||
#if 0
|
||||
if(dxw.lpDDSPrimHDC){
|
||||
@ -1700,6 +1730,7 @@ BOOL WINAPI extScrollDC(HDC hDC, int dx, int dy, const RECT *lprcScroll, const R
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HWND WINAPI extGetTopWindow(HWND hwnd)
|
||||
{
|
||||
HWND ret;
|
||||
@ -1708,4 +1739,46 @@ HWND WINAPI extGetTopWindow(HWND hwnd)
|
||||
ret = (dxw.IsFullScreen() && dxw.IsDesktop(hwnd)) ? dxw.GethWnd() : (*pGetTopWindow)(hwnd);
|
||||
OutTraceD("GetTopWindow: ret=%x\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
LONG WINAPI extTabbedTextOutA(HDC hdc, int X, int Y, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions, int nTabOrigin)
|
||||
{
|
||||
BOOL res;
|
||||
OutTraceD("TabbedTextOut: hdc=%x xy=(%d,%d) nCount=%d nTP=%d nTOS=%d str=(%d)\"%s\"\n",
|
||||
hdc, X, Y, nCount, nTabPositions, nTabOrigin, lpString);
|
||||
|
||||
if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){
|
||||
dxw.MapClient(&X, &Y);
|
||||
OutTraceD("TextOut: fixed dest=(%d,%d)\n", X, Y);
|
||||
}
|
||||
|
||||
res=(*pTabbedTextOutA)(hdc, X, Y, lpString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin);
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOL WINAPI extDestroyWindow(HWND hWnd)
|
||||
{
|
||||
BOOL res;
|
||||
OutTraceB("DestroyWindow: hwnd=%x\n", hWnd);
|
||||
if (hWnd == dxw.GethWnd()) {
|
||||
OutTraceD("DestroyWindow: destroy main hwnd=%x\n", hWnd);
|
||||
if(1) return 0;
|
||||
dxw.SethWnd(NULL);
|
||||
}
|
||||
res=(*pDestroyWindow)(hWnd);
|
||||
if(!res)OutTraceE("DestroyWindow: ERROR err=%d\n", GetLastError());
|
||||
return res;
|
||||
}
|
||||
|
||||
BOOL WINAPI extCloseWindow(HWND hWnd)
|
||||
{
|
||||
BOOL res;
|
||||
OutTraceB("CloseWindow: hwnd=%x\n", hWnd);
|
||||
if (hWnd == dxw.GethWnd()) {
|
||||
OutTraceD("CloseWindow: close main hwnd=%x\n", hWnd);
|
||||
dxw.SethWnd(NULL);
|
||||
}
|
||||
res=(*pCloseWindow)(hWnd);
|
||||
if(!res)OutTraceE("CloseWindow: ERROR err=%d\n", GetLastError());
|
||||
return res;
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
|
@ -20,8 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// MainFrm.cpp : CMainFrame defines the class behavior.
|
||||
//
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "dxwndhost.h"
|
||||
|
||||
|
@ -159,6 +159,7 @@
|
||||
#define IDC_CDROMDRIVETYPE 1114
|
||||
#define IDC_OUTREGISTRY 1115
|
||||
#define IDC_NOWINDOWMOVE 1116
|
||||
#define IDC_DISABLEHAL 1117
|
||||
#define ID_MODIFY 32771
|
||||
#define ID_DELETE 32772
|
||||
#define ID_ADD 32773
|
||||
|
@ -3,6 +3,8 @@
|
||||
// Write the project specific include files.
|
||||
//
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
#if !defined(AFX_STDAFX_H__9139BF92_2E61_4CBC_AB58_646DE772409F__INCLUDED_)
|
||||
#define AFX_STDAFX_H__9139BF92_2E61_4CBC_AB58_646DE772409F__INCLUDED_
|
||||
|
||||
|
@ -39,6 +39,7 @@ void CTabDirectX::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Check(pDX, IDC_FULLRECTBLT, cTarget->m_FullRectBlt);
|
||||
DDX_Check(pDX, IDC_NOPALETTEUPDATE, cTarget->m_NoPaletteUpdate);
|
||||
DDX_Check(pDX, IDC_SETCOMPATIBILITY, cTarget->m_SetCompatibility);
|
||||
DDX_Check(pDX, IDC_DISABLEHAL, cTarget->m_DisableHAL);
|
||||
DDX_Check(pDX, IDC_SAVECAPS, cTarget->m_SaveCaps);
|
||||
// DirectInput
|
||||
DDX_Check(pDX, IDC_HOOKDI, cTarget->m_HookDI);
|
||||
|
@ -1,8 +1,6 @@
|
||||
// TargetDlg.cpp : Implementation
|
||||
//
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "dxwndhost.h"
|
||||
#include "TargetDlg.h"
|
||||
@ -36,6 +34,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_SuppressIME = FALSE;
|
||||
m_SuppressD3DExt = FALSE;
|
||||
m_SetCompatibility = FALSE;
|
||||
m_DisableHAL = FALSE;
|
||||
m_SaveCaps = FALSE;
|
||||
m_SingleProcAffinity = FALSE;
|
||||
m_LimitResources = FALSE;
|
||||
|
@ -106,6 +106,7 @@ public:
|
||||
BOOL m_CDROMDriveType;
|
||||
BOOL m_SuppressIME;
|
||||
BOOL m_SetCompatibility;
|
||||
BOOL m_DisableHAL;
|
||||
BOOL m_SaveCaps;
|
||||
BOOL m_SingleProcAffinity;
|
||||
BOOL m_WireFrame;
|
||||
|
Binary file not shown.
@ -1,8 +1,6 @@
|
||||
// dxwndhost.cpp : Application and class definitions
|
||||
//
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "dxwndhost.h"
|
||||
|
||||
|
@ -316,13 +316,13 @@ BEGIN
|
||||
CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,38,126,9
|
||||
GROUPBOX "DirectDraw Surface handling",IDC_STATIC,112,3,181,167
|
||||
CONTROL "VIDEO->SYSTEM surf. on fail",IDC_VIDEOTOSYSTEMMEM,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,118,49,126,9
|
||||
CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,61,127,10
|
||||
CONTROL "Make Backbuf attachable",IDC_BACKBUFATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,84,119,10
|
||||
CONTROL "Blit from BackBuffer",IDC_BLITFROMBACKBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,95,119,10
|
||||
CONTROL "Suppress clipping",IDC_SUPPRESSCLIPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,107,119,10
|
||||
CONTROL "Full RECT Blit",IDC_FULLRECTBLT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,119,119,10
|
||||
CONTROL "Palette update don't Blit",IDC_NOPALETTEUPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,130,119,10
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,118,50,126,9
|
||||
CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,62,127,10
|
||||
CONTROL "Make Backbuf attachable",IDC_BACKBUFATTACH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,86,119,10
|
||||
CONTROL "Blit from BackBuffer",IDC_BLITFROMBACKBUFFER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,98,119,10
|
||||
CONTROL "Suppress clipping",IDC_SUPPRESSCLIPPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,110,119,10
|
||||
CONTROL "Full RECT Blit",IDC_FULLRECTBLT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,122,119,10
|
||||
CONTROL "Palette update don't Blit",IDC_NOPALETTEUPDATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,134,119,10
|
||||
LTEXT "DirectInput initial coord. and X,Y range",IDC_STATIC,19,197,146,9
|
||||
LTEXT "X",IDC_STATIC,13,212,9,9
|
||||
LTEXT "Y",IDC_STATIC,40,212,9,9
|
||||
@ -339,9 +339,10 @@ BEGIN
|
||||
EDITTEXT IDC_MAXY,148,209,17,14,ES_AUTOHSCROLL,WS_EX_RIGHT
|
||||
CONTROL "DirectInput Hooking",IDC_HOOKDI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,182,97,12
|
||||
GROUPBOX "DirectInput",IDC_STATIC,7,172,286,61
|
||||
CONTROL "Set AERO compatible mode",IDC_SETCOMPATIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,141,109,12
|
||||
CONTROL "Highlight blit to primary",IDC_MARKBLIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,72,127,10
|
||||
CONTROL "Set AERO compatible mode",IDC_SETCOMPATIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,146,109,12
|
||||
CONTROL "Highlight blit to primary",IDC_MARKBLIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,74,127,10
|
||||
CONTROL "Preserve surface capabilities",IDC_SAVECAPS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,14,109,12
|
||||
CONTROL "Disable HAL support",IDC_DISABLEHAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,158,109,12
|
||||
END
|
||||
|
||||
IDD_TAB_MOUSE DIALOGEX 0, 0, 300, 240
|
||||
@ -437,7 +438,7 @@ IDD_TAB_GDI DIALOGEX 0, 0, 300, 240
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "Fix TextOutA placement",IDC_FIXTEXTOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,28,125,10
|
||||
CONTROL "Scale font parameters",IDC_FIXTEXTOUT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,28,125,10
|
||||
GROUPBOX "GDI Handling",IDC_STATIC,6,3,140,51
|
||||
CONTROL "Hook GDI",IDC_HOOKGDI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,16,119,10
|
||||
CONTROL "Map GDI HDC to Primary DC",IDC_MAPGDITOPRIMARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,40,119,10
|
||||
|
Binary file not shown.
@ -1,8 +1,6 @@
|
||||
// dxwndhostDoc.cpp : CDxwndhostDoc Define the behavior of the class.
|
||||
//
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "dxwndhost.h"
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
|
||||
// dxwndhostView.cpp : CDxwndhostView Define the behavior of the class.
|
||||
//
|
||||
|
||||
@ -142,6 +140,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_SuppressIME) t->flags2 |= SUPPRESSIME;
|
||||
if(dlg->m_SuppressD3DExt) t->flags3 |= SUPPRESSD3DEXT;
|
||||
if(dlg->m_SetCompatibility) t->flags2 |= SETCOMPATIBILITY;
|
||||
if(dlg->m_DisableHAL) t->flags3 |= DISABLEHAL;
|
||||
if(dlg->m_SaveCaps) t->flags3 |= SAVECAPS;
|
||||
if(dlg->m_SingleProcAffinity) t->flags3 |= SINGLEPROCAFFINITY;
|
||||
if(dlg->m_SaveLoad) t->flags |= SAVELOAD;
|
||||
@ -253,6 +252,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_SuppressIME = t->flags2 & SUPPRESSIME ? 1 : 0;
|
||||
dlg->m_SuppressD3DExt = t->flags3 & SUPPRESSD3DEXT ? 1 : 0;
|
||||
dlg->m_SetCompatibility = t->flags2 & SETCOMPATIBILITY ? 1 : 0;
|
||||
dlg->m_DisableHAL = t->flags3 & DISABLEHAL ? 1 : 0;
|
||||
dlg->m_SaveCaps = t->flags3 & SAVECAPS ? 1 : 0;
|
||||
dlg->m_SingleProcAffinity = t->flags3 & SINGLEPROCAFFINITY ? 1 : 0;
|
||||
dlg->m_LimitResources = t->flags2 & LIMITRESOURCES ? 1 : 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user