diff --git a/Include/dxwnd.h b/Include/dxwnd.h index 4c9c641..b93d3fc 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -122,19 +122,23 @@ #define ZBUFFERALWAYS 0x00000040 // Forces ZBUFFER D3DCMP_ALWAYS condition to show all planes.... #define DISABLEFOGGING 0x00000080 // Disable D3D fogging #define NOPOWER2FIX 0x00000100 // Handle textures whose size is not a power of 2 (32, 64, 128 ...) +#define NOPERFCOUNTER 0x00000200 // Disables the GetPerfCounter performance metrics API,as if it was not supported.... +#define ADDPROXYLIBS 0x00000400 // Add proxy libs to otherwise hook-resilient system libraries (e.g. d3d9.dll) // logging Tflags DWORD: #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general #define OUTDDRAWTRACE 0x00000002 // traces DxWnd directdraw screen handling #define OUTWINMESSAGES 0x00000004 // traces windows messages #define OUTCURSORTRACE 0x00000008 // traces cursor positions & operations -#define OUTPROXYTRACE 0x00000010 // warning: it also enables proxy functions !!!! +#define OUTPROXYTRACE 0x00000010 // enables all operations through proxy functions #define DXPROXED 0x00000020 // hook DX proxy methods to log each call in original behaviour #define ASSERTDIALOG 0x00000040 // show assert messages in Dialog Box #define OUTIMPORTTABLE 0x00000080 // dump import table contents #define OUTDEBUG 0x00000100 // detailed debugging indormation #define OUTREGISTRY 0x00000200 // log registry operations #define TRACEHOOKS 0x00000400 // log hook operations +#define OUTD3DTRACE 0x00000800 // traces DxWnd direct3d screen handling +#define OUTDXWINTRACE 0x00001000 // traces DxWnd internal operations #define EMULATEFLAGS (EMULATEBUFFER | EMULATESURFACE | LOCKEDSURFACE) #define HANDLEFPS (SHOWFPS | SHOWFPSOVERLAY | LIMITFPS | SKIPFPS) @@ -206,7 +210,9 @@ LRESULT CALLBACK extWindowProc(HWND, UINT, WPARAM, LPARAM); #define OutTraceW if(dxw.dwTFlags & OUTWINMESSAGES) OutTrace #define OutTraceX if(dxw.dwTFlags & OUTPROXYTRACE) OutTrace -#define OutTraceD if(dxw.dwTFlags & OUTDDRAWTRACE) OutTrace +#define OutTraceDW if(dxw.dwTFlags & OUTDXWINTRACE) OutTrace +#define OutTraceDDRAW if(dxw.dwTFlags & OUTDDRAWTRACE) OutTrace +#define OutTraceD3D if(dxw.dwTFlags & OUTD3DTRACE) OutTrace #define OutTraceC if(dxw.dwTFlags & OUTCURSORTRACE) OutTrace #define OutTraceB if(dxw.dwTFlags & OUTDEBUG) OutTrace #define OutTraceR if(dxw.dwTFlags & OUTREGISTRY) OutTrace @@ -216,7 +222,9 @@ LRESULT CALLBACK extWindowProc(HWND, UINT, WPARAM, LPARAM); #define IsTraceW (dxw.dwTFlags & OUTWINMESSAGES) #define IsTraceX (dxw.dwTFlags & OUTPROXYTRACE) -#define IsTraceD (dxw.dwTFlags & OUTDDRAWTRACE) +#define IsTraceDW (dxw.dwTFlags & OUTDXWINTRACE) +#define IsTraceDDRAW (dxw.dwTFlags & OUTDDRAWTRACE) +#define IsTraceD3D (dxw.dwTFlags & OUTD3DTRACE) #define IsTraceC (dxw.dwTFlags & OUTCURSORTRACE) #define IsTraceR (dxw.dwTFlags & OUTREGISTRY) #define IsTraceH (dxw.dwTFlags & TRACEHOOKS) diff --git a/build/d3d9.dll b/build/d3d9.dll new file mode 100644 index 0000000..358b5d6 --- /dev/null +++ b/build/d3d9.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbba59e9978c6b6bbab608afb2d58ca5946c5a5dd80760539334f53b7f42f2ef +size 108544 diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 96ef9a7..0c7e910 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:57ef9c7d9946325fb6dd60e4af9dc304c495324ecae9a692cf86f91992cebbfb -size 431616 +oid sha256:86344285657229fd81bf32b0431d3b4834a62cf91d50f521dd84035670bd8c9d +size 435200 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index e721987..8316ab5 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0a4a4d772a6ec7426fd16e1891cfb4b0bc0f853cbb5a6cdcaa080f131bdd340e -size 531968 +oid sha256:344f365f6f431bb76c4c42f14654160bdc40c065462b4c8c45a0f3c2ab266a70 +size 533504 diff --git a/build/dxwnd.ini b/build/dxwnd.ini index c3fe53f..b450b3a 100644 --- a/build/dxwnd.ini +++ b/build/dxwnd.ini @@ -137,17 +137,17 @@ sizx5=800 sizy5=600 maxfps5=0 initts5=0 -title6=Beavis & Butthead Do U. -path6=D:\Games\B_b\BEAVIS.EXE +title6=Army Men RTS +path6=D:\Games\Army Men RTS\amrts.exe module6= opengllib6= ver6=0 coord6=0 -flag6=671090722 +flag6=671105060 flagg6=1207959552 -flagh6=32788 -flagi6=0 -tflag6=2 +flagh6=20 +flagi6=4 +tflag6=0 initx6=0 inity6=0 minx6=0 @@ -160,17 +160,17 @@ sizx6=800 sizy6=600 maxfps6=0 initts6=0 -title7=Black & White -path7=D:\Games\Black & White\runblack.exe +title7=Beavis & Butthead Do U. +path7=D:\Games\B_b\BEAVIS.EXE module7= opengllib7= ver7=0 -coord7=1 -flag7=679477280 -flagg7=1207959568 -flagh7=20 -flagi7=4 -tflag7=258 +coord7=0 +flag7=671090722 +flagg7=1207959552 +flagh7=32788 +flagi7=0 +tflag7=2 initx7=0 inity7=0 minx7=0 @@ -183,15 +183,15 @@ sizx7=800 sizy7=600 maxfps7=0 initts7=0 -title8=Bunnies must die -path8=D:\Games\Bunnies must die\bmd.exe +title8=Black & White +path8=D:\Games\Black & White\runblack.exe module8= opengllib8= -ver8=1 -coord8=0 -flag8=142606370 -flagg8=1744830465 -flagh8=65556 +ver8=0 +coord8=1 +flag8=679477280 +flagg8=1207959568 +flagh8=20 flagi8=4 tflag8=258 initx8=0 @@ -206,17 +206,17 @@ sizx8=800 sizy8=600 maxfps8=0 initts8=0 -title9=Carmageddon 2 (GLIDE) -path9=D:\Games\Carmageddon_2\carma2_HW.exe +title9=Bunnies must die +path9=D:\Games\Bunnies must die\bmd.exe module9= opengllib9= -ver9=0 +ver9=1 coord9=0 -flag9=134217730 -flagg9=1208025088 -flagh9=20 -flagi9=12 -tflag9=0 +flag9=142606370 +flagg9=1744830465 +flagh9=65556 +flagi9=4 +tflag9=258 initx9=0 inity9=0 minx9=0 @@ -229,15 +229,15 @@ sizx9=800 sizy9=600 maxfps9=0 initts9=0 -title10=Carmageddon 2 (SW) -path10=D:\Games\Carmageddon_2\carma2_SW.exe +title10=Carmageddon 2 (GLIDE) +path10=D:\Games\Carmageddon_2\carma2_HW.exe module10= opengllib10= ver10=0 coord10=0 -flag10=671088674 +flag10=134217730 flagg10=1208025088 -flagh10=33562644 +flagh10=20 flagi10=12 tflag10=0 initx10=0 @@ -252,16 +252,16 @@ sizx10=800 sizy10=600 maxfps10=0 initts10=0 -title11=Cave Story -path11=D:\Games\Cave Story\Doukutsu.exe +title11=Carmageddon 2 (SW) +path11=D:\Games\Carmageddon_2\carma2_SW.exe module11= opengllib11= ver11=0 coord11=0 -flag11=134217762 -flagg11=1207959552 -flagh11=20 -flagi11=4 +flag11=671088674 +flagg11=1208025088 +flagh11=33562644 +flagi11=12 tflag11=0 initx11=0 inity11=0 @@ -275,17 +275,17 @@ sizx11=800 sizy11=600 maxfps11=0 initts11=0 -title12=Crimson Skies -path12=D:\Games\Crimson_Skies\crimson.exe +title12=Cave Story +path12=D:\Games\Cave Story\Doukutsu.exe module12= opengllib12= -ver12=7 +ver12=0 coord12=0 -flag12=155205668 -flagg12=1207959568 +flag12=134217762 +flagg12=1207959552 flagh12=20 -flagi12=292 -tflag12=258 +flagi12=4 +tflag12=0 initx12=0 inity12=0 minx12=0 @@ -298,17 +298,17 @@ sizx12=800 sizy12=600 maxfps12=0 initts12=0 -title13=Daikatana -path13=D:\Games\Daikatana\daikatana.exe +title13=Crimson Skies +path13=D:\Games\Crimson_Skies\crimson.exe module13= opengllib13= -ver13=12 +ver13=7 coord13=0 -flag13=269492742 -flagg13=537002497 +flag13=134234148 +flagg13=-939524096 flagh13=20 -flagi13=0 -tflag13=2 +flagi13=36 +tflag13=259 initx13=0 inity13=0 minx13=0 @@ -321,17 +321,17 @@ sizx13=800 sizy13=600 maxfps13=0 initts13=0 -title14=Devastation -path14=D:\Games\Devastation\System\Devastation.exe +title14=Daikatana +path14=D:\Games\Daikatana\daikatana.exe module14= opengllib14= -ver14=0 +ver14=12 coord14=0 -flag14=167772198 -flagg14=1209008128 -flagh14=65556 -flagi14=2 -tflag14=322 +flag14=269492742 +flagg14=537002497 +flagh14=20 +flagi14=0 +tflag14=2 initx14=0 inity14=0 minx14=0 @@ -340,21 +340,21 @@ maxx14=0 maxy14=0 posx14=50 posy14=50 -sizx14=320 -sizy14=240 +sizx14=800 +sizy14=600 maxfps14=0 initts14=0 -title15=Doom Shareware for Windows 95 -path15=D:\Games\Doom Shareware for Windows 95\Doom95.exe +title15=Devastation +path15=D:\Games\Devastation\System\Devastation.exe module15= opengllib15= ver15=0 -coord15=2 -flag15=134217762 -flagg15=1207959568 -flagh15=20 -flagi15=0 -tflag15=0 +coord15=0 +flag15=167772198 +flagg15=1209008128 +flagh15=65556 +flagi15=2 +tflag15=322 initx15=0 inity15=0 minx15=0 @@ -363,21 +363,21 @@ maxx15=0 maxy15=0 posx15=50 posy15=50 -sizx15=800 -sizy15=600 +sizx15=320 +sizy15=240 maxfps15=0 initts15=0 -title16=Duckman -path16=D:\Games\Duckman\DUCKMAN.EXE +title16=Doom Shareware for Windows 95 +path16=D:\Games\Doom Shareware for Windows 95\Doom95.exe module16= opengllib16= ver16=0 -coord16=0 +coord16=2 flag16=134217762 -flagg16=1209008128 +flagg16=1207959568 flagh16=20 -flagi16=4 -tflag16=258 +flagi16=0 +tflag16=0 initx16=0 inity16=0 minx16=0 @@ -390,17 +390,17 @@ sizx16=800 sizy16=600 maxfps16=0 initts16=0 -title17=Dungeon Keeper 2 (GOG) -path17=D:\Games\Dungeon Keeper 2 (GOG)\DKII.EXE +title17=Duckman +path17=D:\Games\Duckman\DUCKMAN.EXE module17= opengllib17= ver17=0 coord17=0 -flag17=136331298 -flagg17=1241513984 -flagh17=20 -flagi17=0 -tflag17=258 +flag17=134217762 +flagg17=1209008128 +flagh17=33554452 +flagi17=4 +tflag17=3 initx17=0 inity17=0 minx17=0 @@ -413,17 +413,17 @@ sizx17=800 sizy17=600 maxfps17=0 initts17=0 -title18=Empire Earth -path18=D:\Games\Empire Earth\Empire Earth.exe +title18=Dungeon Keeper 2 (GOG) +path18=D:\Games\Dungeon Keeper 2 (GOG)\DKII.EXE module18= opengllib18= ver18=0 coord18=0 -flag18=-1459617632 -flagg18=201326848 -flagh18=84 +flag18=136331298 +flagg18=1241513984 +flagh18=20 flagi18=0 -tflag18=262 +tflag18=258 initx18=0 inity18=0 minx18=0 @@ -432,21 +432,21 @@ maxx18=0 maxy18=0 posx18=50 posy18=50 -sizx18=0 -sizy18=0 +sizx18=800 +sizy18=600 maxfps18=0 initts18=0 -title19=F-16 Fighting Falcon -path19=D:\Games\F16\f1695.exe +title19=Empire Earth +path19=D:\Games\Empire Earth\Empire Earth.exe module19= opengllib19= ver19=0 coord19=0 -flag19=134217826 -flagg19=1209008128 -flagh19=20 -flagi19=4 -tflag19=258 +flag19=-1459617632 +flagg19=201326848 +flagh19=84 +flagi19=0 +tflag19=262 initx19=0 inity19=0 minx19=0 @@ -455,21 +455,21 @@ maxx19=0 maxy19=0 posx19=50 posy19=50 -sizx19=800 -sizy19=600 +sizx19=0 +sizy19=0 maxfps19=0 initts19=0 -title20=Fate -path20=D:\Games\Fate\Fate.exe +title20=F-16 Fighting Falcon +path20=D:\Games\F16\f1695.exe module20= opengllib20= ver20=0 coord20=0 -flag20=134217762 -flagg20=1207959552 +flag20=134217826 +flagg20=1209008128 flagh20=20 flagi20=4 -tflag20=0 +tflag20=258 initx20=0 inity20=0 minx20=0 @@ -482,14 +482,14 @@ sizx20=800 sizy20=600 maxfps20=0 initts20=0 -title21=Grand Prix Legends -path21=D:\Games\gpl\gpl.exe +title21=Fate +path21=D:\Games\Fate\Fate.exe module21= opengllib21= ver21=0 coord21=0 -flag21=679485472 -flagg21=-939524096 +flag21=134217762 +flagg21=1207959552 flagh21=20 flagi21=4 tflag21=0 @@ -505,15 +505,15 @@ sizx21=800 sizy21=600 maxfps21=0 initts21=0 -title22=Grand Prix World -path22=D:\Games\Grand Prix World\gpw.exe +title22=Gangsters +path22=D:\Games\Gangsters\gangsters.exe module22= opengllib22= ver22=0 coord22=0 -flag22=134217762 -flagg22=1207959680 -flagh22=84 +flag22=1208483874 +flagg22=1209008128 +flagh22=20 flagi22=4 tflag22=0 initx22=0 @@ -528,17 +528,17 @@ sizx22=800 sizy22=600 maxfps22=0 initts22=0 -title23=GTA 3 -path23=D:\Games\GTA3\gta3.exe +title23=Grand Prix Legends +path23=D:\Games\gpl\gpl.exe module23= opengllib23= ver23=0 coord23=0 -flag23=134217762 -flagg23=1207959552 +flag23=679485472 +flagg23=-939524096 flagh23=20 flagi23=4 -tflag23=258 +tflag23=0 initx23=0 inity23=0 minx23=0 @@ -551,17 +551,17 @@ sizx23=800 sizy23=600 maxfps23=0 initts23=0 -title24=Hearts of Iron 2 -path24=D:\Games\Hearts of Iron 2\HoI2.exe +title24=GTA 3 +path24=D:\Games\GTA3\gta3.exe module24= opengllib24= ver24=0 -coord24=2 -flag24=939526179 -flagg24=1207959568 -flagh24=32788 -flagi24=2 -tflag24=2 +coord24=0 +flag24=134217762 +flagg24=1207959552 +flagh24=20 +flagi24=4 +tflag24=258 initx24=0 inity24=0 minx24=0 @@ -574,17 +574,17 @@ sizx24=800 sizy24=600 maxfps24=0 initts24=0 -title25=Heroes of Might and Magic IV -path25=D:\Games\Heroes of Might and Magic IV\heroes4.exe +title25=Hearts of Iron 2 +path25=D:\Games\Hearts of Iron 2\HoI2.exe module25= opengllib25= ver25=0 coord25=2 -flag25=671350818 +flag25=939526179 flagg25=1207959568 -flagh25=-2147418092 -flagi25=1 -tflag25=258 +flagh25=32788 +flagi25=2 +tflag25=2 initx25=0 inity25=0 minx25=0 @@ -597,17 +597,17 @@ sizx25=800 sizy25=600 maxfps25=0 initts25=0 -title26=Hitman - Codename 47 -path26=D:\Games\Hitman - Codename 47\Hitman.Exe +title26=Heroes of Might and Magic IV +path26=D:\Games\Heroes of Might and Magic IV\heroes4.exe module26= opengllib26= -ver26=1 -coord26=0 -flag26=134234144 -flagg26=1207959808 -flagh26=20 -flagi26=4 -tflag26=2 +ver26=0 +coord26=2 +flag26=671350818 +flagg26=1207959568 +flagh26=-2147418092 +flagi26=1 +tflag26=258 initx26=0 inity26=0 minx26=0 @@ -620,17 +620,17 @@ sizx26=800 sizy26=600 maxfps26=0 initts26=0 -title27=Hitman 2 Silent Assassin -path27=D:\Games\Hitman 2 Silent Assassin\hitman2.exe +title27=Hitman - Codename 47 +path27=D:\Games\Hitman - Codename 47\Hitman.Exe module27= opengllib27= -ver27=0 -coord27=2 -flag27=134234150 -flagg27=1207959568 +ver27=1 +coord27=0 +flag27=134234144 +flagg27=1207959808 flagh27=20 flagi27=4 -tflag27=0 +tflag27=2 initx27=0 inity27=0 minx27=0 @@ -643,16 +643,16 @@ sizx27=800 sizy27=600 maxfps27=0 initts27=0 -title28=Homeworld 2 -path28=D:\Games\Homeworld2\Bin\Release\Homeworld2.exe +title28=Hitman 2 Silent Assassin +path28=D:\Games\Hitman 2 Silent Assassin\hitman2.exe module28= opengllib28= ver28=0 -coord28=0 -flag28=671154178 -flagg28=134217728 -flagh28=285 -flagi28=0 +coord28=2 +flag28=134234150 +flagg28=1207959568 +flagh28=20 +flagi28=4 tflag28=0 initx28=0 inity28=0 @@ -666,16 +666,16 @@ sizx28=800 sizy28=600 maxfps28=0 initts28=0 -title29=Imperialism -path29=D:\Games\Imperialism\Imperialism.exe +title29=Homeworld 2 +path29=D:\Games\Homeworld2\Bin\Release\Homeworld2.exe module29= opengllib29= ver29=0 coord29=0 -flag29=-1467998174 -flagg29=1209008128 -flagh29=20 -flagi29=4 +flag29=671154178 +flagg29=134217728 +flagh29=285 +flagi29=0 tflag29=0 initx29=0 inity29=0 @@ -689,13 +689,13 @@ sizx29=800 sizy29=600 maxfps29=0 initts29=0 -title30=Imperialism II -path30=D:\Games\Imperialism 2\imperialism II.exe +title30=Imperialism +path30=D:\Games\Imperialism\Imperialism.exe module30= opengllib30= ver30=0 coord30=0 -flag30=679485474 +flag30=-1467998174 flagg30=1209008128 flagh30=20 flagi30=4 @@ -712,17 +712,17 @@ sizx30=800 sizy30=600 maxfps30=0 initts30=0 -title31=International Football 2000 -path31=D:\Games\International Football 2000\MSIF2000.ICD +title31=Imperialism II +path31=D:\Games\Imperialism 2\imperialism II.exe module31= opengllib31= ver31=0 coord31=0 -flag31=150994976 -flagg31=1207959552 +flag31=679485474 +flagg31=1209008128 flagh31=20 flagi31=4 -tflag31=258 +tflag31=0 initx31=0 inity31=0 minx31=0 @@ -735,17 +735,17 @@ sizx31=800 sizy31=600 maxfps31=0 initts31=0 -title32=Jet Moto -path32=D:\Games\Jet_Moto\JETMOTO.EXE +title32=International Football 2000 +path32=D:\Games\International Football 2000\MSIF2000.ICD module32= opengllib32= ver32=0 coord32=0 -flag32=671088674 -flagg32=1207959568 +flag32=150994976 +flagg32=1207959552 flagh32=20 -flagi32=0 -tflag32=0 +flagi32=4 +tflag32=258 initx32=0 inity32=0 minx32=0 @@ -758,17 +758,17 @@ sizx32=800 sizy32=600 maxfps32=0 initts32=0 -title33=Kiss Psycho Circus -path33=D:\Games\Kiss\client.exe +title33=Jet Moto +path33=D:\Games\Jet_Moto\JETMOTO.EXE module33= opengllib33= ver33=0 coord33=0 -flag33=134234148 -flagg33=-939523840 +flag33=671088674 +flagg33=1207959568 flagh33=20 -flagi33=16 -tflag33=2 +flagi33=0 +tflag33=0 initx33=0 inity33=0 minx33=0 @@ -781,17 +781,17 @@ sizx33=800 sizy33=600 maxfps33=0 initts33=0 -title34=Kohan II Kings of War -path34=D:\Games\Kohan II Kings of War\k2.exe +title34=KISS Pinball +path34=D:\Games\KISS Pinball\kisspin.exe module34= opengllib34= -ver34=0 +ver34=1 coord34=0 -flag34=134217762 +flag34=679616546 flagg34=1207959552 -flagh34=20 +flagh34=98324 flagi34=4 -tflag34=0 +tflag34=259 initx34=0 inity34=0 minx34=0 @@ -804,17 +804,17 @@ sizx34=800 sizy34=600 maxfps34=0 initts34=0 -title35=L.E.D. Wars (not working) -path35=D:\Games\l.e.d._wars\LED.EXE +title35=Kiss Psycho Circus +path35=D:\Games\Kiss\client.exe module35= opengllib35= ver35=0 coord35=0 -flag35=713039906 -flagg35=1207959569 -flagh35=65556 -flagi35=4 -tflag35=258 +flag35=134234148 +flagg35=-939523840 +flagh35=20 +flagi35=16 +tflag35=2 initx35=0 inity35=0 minx35=0 @@ -827,17 +827,17 @@ sizx35=800 sizy35=600 maxfps35=0 initts35=0 -title36=Land of the Dead -path36=D:\Games\Land of the Dead\System\LOTD.exe +title36=Knights Of Honor +path36=D:\Games\Knights Of Honor\KoH.exe module36= opengllib36= ver36=0 -coord36=2 -flag36=134217766 -flagg36=1207959568 -flagh36=20 -flagi36=0 -tflag36=64 +coord36=0 +flag36=-402382814 +flagg36=1207959552 +flagh36=65556 +flagi36=4 +tflag36=6431 initx36=0 inity36=0 minx36=0 @@ -850,17 +850,17 @@ sizx36=800 sizy36=600 maxfps36=0 initts36=0 -title37=Last Bronx -path37=D:\Games\Last_Bronx\LB.EXE +title37=KnightShift +path37=D:\Games\knightshift\KnightShift.ex1 module37= opengllib37= -ver37=0 +ver37=8 coord37=0 -flag37=134217762 -flagg37=-939520000 +flag37=134217760 +flagg37=1207959552 flagh37=20 flagi37=4 -tflag37=0 +tflag37=3 initx37=0 inity37=0 minx37=0 @@ -871,10 +871,10 @@ posx37=50 posy37=50 sizx37=800 sizy37=600 -maxfps37=20 -initts37=4 -title38=LEGOŽ Marvel Super Heroes Demo -path38=C:\Program Files (x86)\Warner Bros. Interactive Entertainment\LEGOŽ Marvel Super Heroes Demo\LEGOMarvelDemo.exe +maxfps37=0 +initts37=0 +title38=Kohan II Kings of War +path38=D:\Games\Kohan II Kings of War\k2.exe module38= opengllib38= ver38=0 @@ -882,8 +882,8 @@ coord38=0 flag38=134217762 flagg38=1207959552 flagh38=20 -flagi38=4 -tflag38=0 +flagi38=1028 +tflag38=6163 initx38=0 inity38=0 minx38=0 @@ -896,17 +896,17 @@ sizx38=800 sizy38=600 maxfps38=0 initts38=0 -title39=Lords of the Realm 2 -path39=D:\Games\Lords of the Realm 2\LORDS2.EXE +title39=L.E.D. Wars (not working) +path39=D:\Games\l.e.d._wars\LED.EXE module39= opengllib39= ver39=0 coord39=0 -flag39=134217762 -flagg39=1209008128 +flag39=713039906 +flagg39=1744830481 flagh39=65556 flagi39=4 -tflag39=0 +tflag39=258 initx39=0 inity39=0 minx39=0 @@ -919,17 +919,17 @@ sizx39=800 sizy39=600 maxfps39=0 initts39=0 -title40=Mageslayer -path40=D:\Games\MAGE\MAGESLAY.EXE +title40=Land of the Dead +path40=D:\Games\Land of the Dead\System\LOTD.exe module40= opengllib40= ver40=0 -coord40=0 -flag40=134217762 -flagg40=1207959584 +coord40=2 +flag40=134217766 +flagg40=1207959568 flagh40=20 flagi40=0 -tflag40=67 +tflag40=64 initx40=0 inity40=0 minx40=0 @@ -942,14 +942,14 @@ sizx40=800 sizy40=600 maxfps40=0 initts40=0 -title41=Magic & Mayhem -path41=D:\Games\Magic_&_Mayhem\Chaos.exe +title41=Last Bronx +path41=D:\Games\Last_Bronx\LB.EXE module41= opengllib41= ver41=0 coord41=0 flag41=134217762 -flagg41=1207959552 +flagg41=-939520000 flagh41=20 flagi41=4 tflag41=0 @@ -963,18 +963,18 @@ posx41=50 posy41=50 sizx41=800 sizy41=600 -maxfps41=0 -initts41=0 -title42=Motocross Madness (DEMO) -path42=D:\Games\Motocross Madness Trial\mcm.exe +maxfps41=20 +initts41=4 +title42=LEGOŽ Marvel Super Heroes Demo +path42=C:\Program Files (x86)\Warner Bros. Interactive Entertainment\LEGOŽ Marvel Super Heroes Demo\LEGOMarvelDemo.exe module42= opengllib42= ver42=0 coord42=0 -flag42=134217760 +flag42=134217762 flagg42=1207959552 flagh42=20 -flagi42=0 +flagi42=4 tflag42=0 initx42=0 inity42=0 @@ -988,15 +988,15 @@ sizx42=800 sizy42=600 maxfps42=0 initts42=0 -title43=Pandemonium 2 (GLIDE) -path43=D:\Games\Pandemonium 2\pandy.exe +title43=Lords of the Realm 2 +path43=D:\Games\Lords of the Realm 2\LORDS2.EXE module43= opengllib43= ver43=0 coord43=0 flag43=134217762 -flagg43=1207959552 -flagh43=20 +flagg43=1209008128 +flagh43=65556 flagi43=4 tflag43=0 initx43=0 @@ -1011,17 +1011,17 @@ sizx43=800 sizy43=600 maxfps43=0 initts43=0 -title44=Panzer Dragoon -path44=D:\Games\Panzer Dragoon\game\PANZERDG.EXE +title44=Mageslayer +path44=D:\Games\MAGE\MAGESLAY.EXE module44= opengllib44= ver44=0 coord44=0 -flag44=134217762 -flagg44=1207959552 +flag44=136314914 +flagg44=1476395008 flagh44=20 -flagi44=4 -tflag44=67 +flagi44=1 +tflag44=83 initx44=0 inity44=0 minx44=0 @@ -1034,17 +1034,17 @@ sizx44=800 sizy44=600 maxfps44=0 initts44=0 -title45=Praetorians -path45=D:\games\Praetorians\Praetorians.exe +title45=Magic & Mayhem +path45=D:\Games\Magic_&_Mayhem\Chaos.exe module45= opengllib45= ver45=0 -coord45=2 -flag45=134217760 -flagg45=1209008144 -flagh45=22 +coord45=0 +flag45=134217762 +flagg45=1207959552 +flagh45=20 flagi45=4 -tflag45=2 +tflag45=0 initx45=0 inity45=0 minx45=0 @@ -1057,17 +1057,17 @@ sizx45=800 sizy45=600 maxfps45=0 initts45=0 -title46=Praetorians (DEMO) -path46=D:\Games\Praetorians Demo\Praetorians.exe +title46=Motocross Madness (DEMO) +path46=D:\Games\Motocross Madness Trial\mcm.exe module46= opengllib46= ver46=0 coord46=0 flag46=134217760 flagg46=1207959552 -flagh46=65556 -flagi46=4 -tflag46=2 +flagh46=20 +flagi46=0 +tflag46=0 initx46=0 inity46=0 minx46=0 @@ -1080,17 +1080,17 @@ sizx46=800 sizy46=600 maxfps46=0 initts46=0 -title47=Project Nomads (DEMO) -path47=D:\Games\Project Nomads Demo\bin\win32\nomads.exe +title47=Pandemonium 2 (GLIDE) +path47=D:\Games\Pandemonium 2\pandy.exe module47= opengllib47= -ver47=8 +ver47=0 coord47=0 -flag47=-1476394974 -flagg47=1207959808 -flagh47=4 -flagi47=0 -tflag47=274 +flag47=134217762 +flagg47=1207959552 +flagh47=20 +flagi47=4 +tflag47=0 initx47=0 inity47=0 minx47=0 @@ -1103,17 +1103,17 @@ sizx47=800 sizy47=600 maxfps47=0 initts47=0 -title48=Rayman 2 Demo -path48=D:\Games\Rayman2Demo\Rayman2Demo.exe +title48=Panzer Dragoon +path48=D:\Games\Panzer Dragoon\game\PANZERDG.EXE module48= opengllib48= -ver48=7 +ver48=0 coord48=0 -flag48=402653219 -flagg48=1208025088 -flagh48=2097172 -flagi48=0 -tflag48=258 +flag48=134217762 +flagg48=1207959552 +flagh48=20 +flagi48=4 +tflag48=67 initx48=0 inity48=0 minx48=0 @@ -1125,18 +1125,18 @@ posy48=50 sizx48=800 sizy48=600 maxfps48=0 -initts48=4 -title49=Shadows of the Empire (DEMO) -path49=D:\Games\Shadows of the Empire\shadows.exe +initts48=0 +title49=Praetorians +path49=D:\games\Praetorians\Praetorians.exe module49= opengllib49= ver49=0 coord49=2 -flag49=134479906 -flagg49=1207959568 -flagh49=33554452 -flagi49=0 -tflag49=274 +flag49=134217760 +flagg49=1209008144 +flagh49=22 +flagi49=4 +tflag49=2 initx49=0 inity49=0 minx49=0 @@ -1149,17 +1149,17 @@ sizx49=800 sizy49=600 maxfps49=0 initts49=0 -title50=Star Wars Episode I Racer -path50=D:\Games\Star Wars Episode 1 racer\SWEP1RCR.EXE +title50=Praetorians (DEMO) +path50=D:\Games\Praetorians Demo\Praetorians.exe module50= opengllib50= ver50=0 coord50=0 -flag50=679493669 -flagg50=1210056720 -flagh50=8212 -flagi50=20 -tflag50=67 +flag50=150994976 +flagg50=1209008128 +flagh50=65556 +flagi50=4 +tflag50=6419 initx50=0 inity50=0 minx50=0 @@ -1172,20 +1172,20 @@ sizx50=800 sizy50=600 maxfps50=0 initts50=0 -title51=StarCraft +title51=Primitive Wars module51= opengllib51= -title52=Tomb Raider 4 (DEMO) +title52=Project IGI module52= opengllib52= -path51=D:\Games\Starcraft\StarCraft.exe +path51=D:\Games\Primitive Wars\Pw.exe ver51=0 coord51=0 -flag51=134217762 -flagg51=134283264 +flag51=671088674 +flagg51=134217728 flagh51=20 -flagi51=8 -tflag51=64 +flagi51=0 +tflag51=0 initx51=0 inity51=0 minx51=0 @@ -1198,14 +1198,14 @@ sizx51=800 sizy51=600 maxfps51=0 initts51=0 -path52=D:\Games\Tomb Raider - The Last Revelation (Demo)\tomb4.exe -ver52=7 +path52=D:\Games\Project IGI\pc\IGI.exe +ver52=0 coord52=0 -flag52=134217760 -flagg52=1207959552 +flag52=671105060 +flagg52=-939524096 flagh52=20 -flagi52=0 -tflag52=258 +flagi52=4 +tflag52=67 initx52=0 inity52=0 minx52=0 @@ -1218,17 +1218,17 @@ sizx52=800 sizy52=600 maxfps52=0 initts52=0 -title53=Tomb Raider II -path53=D:\Games\Tomb Raider II\Tomb2.exe +title53=Project Nomads (DEMO) +path53=D:\Games\Project Nomads Demo\bin\win32\nomads.exe module53= opengllib53= -ver53=0 +ver53=8 coord53=0 -flag53=671088674 -flagg53=1207959552 -flagh53=20 +flag53=-1476394974 +flagg53=1207959808 +flagh53=4 flagi53=0 -tflag53=0 +tflag53=274 initx53=0 inity53=0 minx53=0 @@ -1241,17 +1241,17 @@ sizx53=800 sizy53=600 maxfps53=0 initts53=0 -title54=Tomb Raider II Gold (DEMO) -path54=D:\Games\Tomb Raider II Gold (Demo)\Tomb2.exe +title54=Rayman 2 Demo +path54=D:\Games\Rayman2Demo\Rayman2Demo.exe module54= opengllib54= -ver54=0 -coord54=2 -flag54=671088674 -flagg54=1224736784 -flagh54=20 +ver54=7 +coord54=0 +flag54=402653217 +flagg54=1208025088 +flagh54=2097172 flagi54=0 -tflag54=258 +tflag54=6419 initx54=0 inity54=0 minx54=0 @@ -1263,18 +1263,18 @@ posy54=50 sizx54=800 sizy54=600 maxfps54=0 -initts54=0 -title55=Tomb Raider III -path55=D:\Games\Tomb Raider III\tomb3.exe +initts54=4 +title55=Shadows of the Empire (DEMO) +path55=D:\Games\Shadows of the Empire\shadows.exe module55= opengllib55= ver55=0 coord55=2 -flag55=134217760 -flagg55=1241514000 -flagh55=20 +flag55=134479906 +flagg55=1207959568 +flagh55=33554452 flagi55=0 -tflag55=322 +tflag55=274 initx55=0 inity55=0 minx55=0 @@ -1287,17 +1287,17 @@ sizx55=800 sizy55=600 maxfps55=0 initts55=0 -title56=Virtua Fighter 2 (DEMO) -path56=D:\Games\vf2_demo\VF2DEMO.EXE +title56=Star Wars Episode I Racer +path56=D:\Games\Star Wars Episode 1 racer\SWEP1RCR.EXE module56= opengllib56= ver56=0 coord56=0 -flag56=939524131 -flagg56=1207959664 -flagh56=20 -flagi56=0 -tflag56=0 +flag56=679493669 +flagg56=1210056720 +flagh56=8212 +flagi56=20 +tflag56=65 initx56=0 inity56=0 minx56=0 @@ -1310,17 +1310,17 @@ sizx56=800 sizy56=600 maxfps56=0 initts56=0 -title57=Virtua Fighter PC -path57=D:\Games\Virtua Fighter\VFPC.EXE +title57=StarCraft +path57=D:\Games\Starcraft\StarCraft.exe module57= opengllib57= ver57=0 coord57=0 -flag57=402653218 -flagg57=1224736784 -flagh57=33562644 -flagi57=0 -tflag57=258 +flag57=134217762 +flagg57=134283264 +flagh57=20 +flagi57=8 +tflag57=64 initx57=0 inity57=0 minx57=0 @@ -1333,17 +1333,17 @@ sizx57=800 sizy57=600 maxfps57=0 initts57=0 -title58=Warcraft 2 Battlenet Ed -path58=D:\Games\Warcraft 2 Battlenet Ed\Warcraft II BNE.exe +title58=State of Emergency +path58=D:\Games\State of Emergency\KaosPC.exe module58= opengllib58= -ver58=0 +ver58=8 coord58=0 -flag58=134217762 -flagg58=1210122240 -flagh58=148 +flag58=671088676 +flagg58=1208025088 +flagh58=20 flagi58=12 -tflag58=0 +tflag58=7315 initx58=0 inity58=0 minx58=0 @@ -1354,19 +1354,19 @@ posx58=50 posy58=50 sizx58=800 sizy58=600 -maxfps58=0 -initts58=0 -title59=Wargasm -path59=D:\Games\Wargasm\tank.exe +maxfps58=50 +initts58=4 +title59=Take no Prisoners +path59=D:\Games\Take no Prisoners\TNP.EXE module59= opengllib59= ver59=0 -coord59=2 -flag59=671088672 -flagg59=1207959696 -flagh59=65556 -flagi59=0 -tflag59=3 +coord59=0 +flag59=134217762 +flagg59=134217860 +flagh59=20 +flagi59=512 +tflag59=259 initx59=0 inity59=0 minx59=0 @@ -1379,15 +1379,15 @@ sizx59=800 sizy59=600 maxfps59=0 initts59=0 -title60=Warlords Battlecry II (DEMO) -path60=D:\Games\Warlords Battlecry II Demo\Battlecry II Demo.exe +title60=Tomb Raider 4 (DEMO) +path60=D:\Games\Tomb Raider - The Last Revelation (Demo)\tomb4.exe module60= opengllib60= -ver60=0 -coord60=2 -flag60=134217762 -flagg60=1207959568 -flagh60=22 +ver60=7 +coord60=0 +flag60=134217760 +flagg60=1207959552 +flagh60=20 flagi60=0 tflag60=258 initx60=0 @@ -1402,17 +1402,17 @@ sizx60=800 sizy60=600 maxfps60=0 initts60=0 -title61=Whiteout -path61=D:\Games\Whiteout\Whiteout.exe +title61=Tomb Raider II +path61=D:\Games\Tomb Raider II\Tomb2.exe module61= opengllib61= ver61=0 coord61=0 -flag61=402653217 +flag61=671088674 flagg61=1207959552 flagh61=20 flagi61=0 -tflag61=66 +tflag61=0 initx61=0 inity61=0 minx61=0 @@ -1421,21 +1421,21 @@ maxx61=0 maxy61=0 posx61=50 posy61=50 -sizx61=640 -sizy61=480 +sizx61=800 +sizy61=600 maxfps61=0 initts61=0 -title62=Wildfire -path62=D:\Games\Wildfire\Wildfire.exe +title62=Tomb Raider II Gold (DEMO) +path62=D:\Games\Tomb Raider II Gold (Demo)\Tomb2.exe module62= opengllib62= ver62=0 -coord62=0 -flag62=-1476392958 -flagg62=1210122240 +coord62=2 +flag62=671088674 +flagg62=1224736784 flagh62=20 -flagi62=12 -tflag62=0 +flagi62=0 +tflag62=258 initx62=0 inity62=0 minx62=0 @@ -1448,17 +1448,17 @@ sizx62=800 sizy62=600 maxfps62=0 initts62=0 -title63=Worms Pinball -path63=D:\Games\Worms Pinball\WPIB.exe +title63=Tomb Raider III +path63=D:\Games\Tomb Raider III\tomb3.exe module63= opengllib63= ver63=0 coord63=2 -flag63=679477282 -flagg63=1744830480 +flag63=134217760 +flagg63=1241514000 flagh63=20 -flagi63=4 -tflag63=258 +flagi63=0 +tflag63=322 initx63=0 inity63=0 minx63=0 @@ -1471,16 +1471,16 @@ sizx63=800 sizy63=600 maxfps63=0 initts63=0 -title64=Zanzarah -path64=D:\Games\Zanzarah\System\zanthp.exe +title64=Total Annihilation Kingdoms +path64=D:\Games\Total Annihilation Kingdoms\Kingdoms.exe module64= opengllib64= -ver64=0 +ver64=7 coord64=0 -flag64=679477280 +flag64=134234146 flagg64=1207959552 flagh64=20 -flagi64=0 +flagi64=4 tflag64=0 initx64=0 inity64=0 @@ -1494,17 +1494,17 @@ sizx64=800 sizy64=600 maxfps64=0 initts64=0 -title65=Zax the Alien Hunter (DEMO) -path65=D:\Games\ZaxDemo\Zax.exe +title65=Virtua Fighter 2 (DEMO) +path65=D:\Games\vf2_demo\VF2DEMO.EXE module65= opengllib65= ver65=0 -coord65=2 -flag65=-2011168734 -flagg65=1209008144 +coord65=0 +flag65=939524131 +flagg65=1207959664 flagh65=20 flagi65=0 -tflag65=258 +tflag65=0 initx65=0 inity65=0 minx65=0 @@ -1517,17 +1517,17 @@ sizx65=800 sizy65=600 maxfps65=0 initts65=0 -title66=ZPC Zero Population Count -path66=D:\Games\ZPC\ZPC.EXE +title66=Virtua Fighter PC +path66=D:\Games\Virtua Fighter\VFPC.EXE module66= opengllib66= ver66=0 coord66=0 -flag66=134217762 -flagg66=1207959552 -flagh66=20 -flagi66=4 -tflag66=0 +flag66=402653218 +flagg66=1224736784 +flagh66=33562644 +flagi66=0 +tflag66=291 initx66=0 inity66=0 minx66=0 @@ -1540,8 +1540,445 @@ sizx66=800 sizy66=600 maxfps66=0 initts66=0 +title67=Warcraft 2 Battlenet Ed +path67=D:\Games\Warcraft 2 Battlenet Ed\Warcraft II BNE.exe +module67= +opengllib67= +ver67=0 +coord67=0 +flag67=134217762 +flagg67=1210122240 +flagh67=148 +flagi67=12 +tflag67=0 +initx67=0 +inity67=0 +minx67=0 +miny67=0 +maxx67=0 +maxy67=0 +posx67=50 +posy67=50 +sizx67=800 +sizy67=600 +maxfps67=0 +initts67=0 +title68=Wargasm +path68=D:\Games\Wargasm\tank.exe +module68= +opengllib68= +ver68=0 +coord68=2 +flag68=671088672 +flagg68=1207959696 +flagh68=65556 +flagi68=0 +tflag68=6163 +initx68=0 +inity68=0 +minx68=0 +miny68=0 +maxx68=0 +maxy68=0 +posx68=50 +posy68=50 +sizx68=800 +sizy68=600 +maxfps68=0 +initts68=0 +title69=Warlords Battlecry II (DEMO) +path69=D:\Games\Warlords Battlecry II Demo\Battlecry II Demo.exe +module69= +opengllib69= +ver69=0 +coord69=2 +flag69=134217762 +flagg69=1207959568 +flagh69=22 +flagi69=0 +tflag69=258 +initx69=0 +inity69=0 +minx69=0 +miny69=0 +maxx69=0 +maxy69=0 +posx69=50 +posy69=50 +sizx69=800 +sizy69=600 +maxfps69=0 +initts69=0 +title70=Whiteout +path70=D:\Games\Whiteout\Whiteout.exe +module70= +opengllib70= +ver70=0 +coord70=0 +flag70=402653217 +flagg70=1207959552 +flagh70=20 +flagi70=0 +tflag70=66 +initx70=0 +inity70=0 +minx70=0 +miny70=0 +maxx70=0 +maxy70=0 +posx70=50 +posy70=50 +sizx70=640 +sizy70=480 +maxfps70=0 +initts70=0 +title71=Wildfire +path71=D:\Games\Wildfire\Wildfire.exe +module71= +opengllib71= +ver71=0 +coord71=0 +flag71=-1476392958 +flagg71=1210122240 +flagh71=20 +flagi71=12 +tflag71=0 +initx71=0 +inity71=0 +minx71=0 +miny71=0 +maxx71=0 +maxy71=0 +posx71=50 +posy71=50 +sizx71=800 +sizy71=600 +maxfps71=0 +initts71=0 +title72=Worms Pinball +path72=D:\Games\Worms Pinball\WPIB.exe +module72= +opengllib72= +ver72=1 +coord72=0 +flag72=134217762 +flagg72=1207959568 +flagh72=20 +flagi72=4 +tflag72=0 +initx72=0 +inity72=0 +minx72=0 +miny72=0 +maxx72=0 +maxy72=0 +posx72=50 +posy72=50 +sizx72=800 +sizy72=600 +maxfps72=0 +initts72=0 +title73=Zanzarah +path73=D:\Games\Zanzarah\System\zanthp.exe +module73= +opengllib73= +ver73=0 +coord73=0 +flag73=679477280 +flagg73=1207959552 +flagh73=20 +flagi73=0 +tflag73=0 +initx73=0 +inity73=0 +minx73=0 +miny73=0 +maxx73=0 +maxy73=0 +posx73=50 +posy73=50 +sizx73=800 +sizy73=600 +maxfps73=0 +initts73=0 +title74=Zax the Alien Hunter (DEMO) +path74=D:\Games\ZaxDemo\Zax.exe +module74= +opengllib74= +ver74=0 +coord74=2 +flag74=-2011168734 +flagg74=1209008144 +flagh74=20 +flagi74=0 +tflag74=258 +initx74=0 +inity74=0 +minx74=0 +miny74=0 +maxx74=0 +maxy74=0 +posx74=50 +posy74=50 +sizx74=800 +sizy74=600 +maxfps74=0 +initts74=0 +title75=ZPC Zero Population Count +path75=D:\Games\ZPC\ZPC.EXE +module75= +opengllib75= +ver75=0 +coord75=0 +flag75=134217762 +flagg75=1207959552 +flagh75=20 +flagi75=4 +tflag75=0 +initx75=0 +inity75=0 +minx75=0 +miny75=0 +maxx75=0 +maxy75=0 +posx75=50 +posy75=50 +sizx75=800 +sizy75=600 +maxfps75=0 +initts75=0 +title76=Lost Valley +module76= +opengllib76= +path76=D:\Games\Lost Valley\lost valley\lost valley data.exe +ver76=0 +coord76=0 +flag76=142614562 +flagg76=1207959552 +flagh76=-2080374764 +flagi76=0 +tflag76=0 +initx76=0 +inity76=0 +minx76=0 +miny76=0 +maxx76=0 +maxy76=0 +posx76=50 +posy76=50 +sizx76=800 +sizy76=600 +maxfps76=0 +initts76=0 +title77=Grand Prix World +path77=D:\Games\Grand Prix World\gpwxp2.exe +module77= +opengllib77= +ver77=0 +coord77=0 +flag77=134217762 +flagg77=135266432 +flagh77=20 +flagi77=0 +tflag77=0 +initx77=0 +inity77=0 +minx77=0 +miny77=0 +maxx77=0 +maxy77=0 +posx77=50 +posy77=50 +sizx77=800 +sizy77=600 +maxfps77=0 +initts77=0 +title78=Premier Manager 98 +path78=D:\Games\Premier Manager 98\MANAGER.EXE +module78= +opengllib78= +ver78=0 +coord78=0 +flag78=671092770 +flagg78=1207959552 +flagh78=16 +flagi78=0 +tflag78=0 +initx78=0 +inity78=0 +minx78=0 +miny78=0 +maxx78=0 +maxy78=0 +posx78=50 +posy78=50 +sizx78=800 +sizy78=600 +maxfps78=0 +initts78=0 +title79=Fighting Force +path79=D:\Games\Fighting Force\game\fforce.exe +module79= +opengllib79= +ver79=0 +coord79=0 +flag79=134217824 +flagg79=1207959552 +flagh79=20 +flagi79=4 +tflag79=6163 +initx79=0 +inity79=0 +minx79=0 +miny79=0 +maxx79=0 +maxy79=0 +posx79=50 +posy79=50 +sizx79=800 +sizy79=600 +maxfps79=0 +initts79=0 +title80=The Bard's Tale (GOG) +path80=D:\Games\The Bard's Tale\The Bard's Tale - Copia.exe +module80= +opengllib80= +ver80=9 +coord80=0 +flag80=679485472 +flagg80=138412032 +flagh80=20 +flagi80=1024 +tflag80=6163 +initx80=0 +inity80=0 +minx80=0 +miny80=0 +maxx80=0 +maxy80=0 +posx80=50 +posy80=50 +sizx80=800 +sizy80=600 +maxfps80=0 +initts80=0 +title81=Need for Speed Underground 2 +path81=D:\Games\Need for Speed Underground 2\SPEED2.EXE +module81= +opengllib81= +ver81=9 +coord81=0 +flag81=134217762 +flagg81=1207959552 +flagh81=20 +flagi81=4 +tflag81=0 +initx81=0 +inity81=0 +minx81=0 +miny81=0 +maxx81=0 +maxy81=0 +posx81=50 +posy81=50 +sizx81=800 +sizy81=600 +maxfps81=0 +initts81=0 +title82=Need For Speed Underground +path82=D:\Games\Need For Speed Underground\speed.exe +module82= +opengllib82= +ver82=9 +coord82=0 +flag82=134217762 +flagg82=1207959552 +flagh82=20 +flagi82=1028 +tflag82=0 +initx82=0 +inity82=0 +minx82=0 +miny82=0 +maxx82=0 +maxy82=0 +posx82=50 +posy82=50 +sizx82=800 +sizy82=600 +maxfps82=0 +initts82=0 +title83=Need for Speed 2SE (3dfx) +path83=D:\Games\Need for Speed 2SE\nfs2sea.exe +module83= +opengllib83= +ver83=0 +coord83=0 +flag83=134217760 +flagg83=1207959552 +flagh83=20 +flagi83=4 +tflag83=6147 +initx83=0 +inity83=0 +minx83=0 +miny83=0 +maxx83=0 +maxy83=0 +posx83=50 +posy83=50 +sizx83=800 +sizy83=600 +maxfps83=0 +initts83=0 +title84=Need for Speed 2SE +path84=D:\Games\Need for Speed 2SE\NFS2SEN.EXE +module84= +opengllib84= +ver84=0 +coord84=0 +flag84=134217826 +flagg84=1480589312 +flagh84=20 +flagi84=4 +tflag84=6163 +initx84=0 +inity84=0 +minx84=0 +miny84=0 +maxx84=0 +maxy84=0 +posx84=50 +posy84=50 +sizx84=800 +sizy84=600 +maxfps84=0 +initts84=0 +title85=Need for Speed 3 +path85=D:\Games\Need for Speed 3\nfs3.exe +module85= +opengllib85= +ver85=1 +coord85=0 +flag85=134217762 +flagg85=1207959552 +flagh85=20 +flagi85=4 +tflag85=0 +initx85=0 +inity85=0 +minx85=0 +miny85=0 +maxx85=0 +maxy85=0 +posx85=50 +posy85=50 +sizx85=800 +sizy85=600 +maxfps85=0 +initts85=0 [window] -posx=953 -posy=245 +posx=1162 +posy=187 sizx=638 -sizy=670 +sizy=673 diff --git a/build/dxwnd_manual.pdf b/build/dxwnd_manual.pdf deleted file mode 100644 index e9a606b..0000000 Binary files a/build/dxwnd_manual.pdf and /dev/null differ diff --git a/build/exports/KnightShift.dxw b/build/exports/KnightShift.dxw new file mode 100644 index 0000000..57f09a2 --- /dev/null +++ b/build/exports/KnightShift.dxw @@ -0,0 +1,24 @@ +[target] +title0=KnightShift +path0=D:\Games\knightshift\KnightShift.ex1 +module0= +opengllib0= +ver0=8 +coord0=0 +flag0=134217760 +flagg0=1207959552 +flagh0=20 +flagi0=4 +tflag0=3 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 diff --git a/build/exports/Knights Of Honor.dxw b/build/exports/Knights Of Honor.dxw new file mode 100644 index 0000000..a86c1c7 --- /dev/null +++ b/build/exports/Knights Of Honor.dxw @@ -0,0 +1,24 @@ +[target] +title0=Knights Of Honor +path0=D:\Games\Knights Of Honor\KoH.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=-402382814 +flagg0=1207959552 +flagh0=65556 +flagi0=4 +tflag0=6431 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 diff --git a/build/exports/Kohan II Kings of War.dxw b/build/exports/Kohan II Kings of War.dxw new file mode 100644 index 0000000..ce7caaa --- /dev/null +++ b/build/exports/Kohan II Kings of War.dxw @@ -0,0 +1,24 @@ +[target] +title0=Kohan II Kings of War +path0=D:\Games\Kohan II Kings of War\k2.exe +module0= +opengllib0= +ver0=9 +coord0=0 +flag0=134217762 +flagg0=1207959552 +flagh0=20 +flagi0=1028 +tflag0=6163 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 diff --git a/build/exports/Lost Valley.dxw b/build/exports/Lost Valley.dxw new file mode 100644 index 0000000..c6e7cbc --- /dev/null +++ b/build/exports/Lost Valley.dxw @@ -0,0 +1,24 @@ +[target] +title0=Lost Valley +path0=D:\Games\Lost Valley\lost valley\lost valley data.exe +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=142614562 +flagg0=1207959552 +flagh0=-2071986156 +flagi0=0 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 diff --git a/build/exports/Empire Earth.dxw b/build/exports/Project IGI.dxw similarity index 54% rename from build/exports/Empire Earth.dxw rename to build/exports/Project IGI.dxw index 9ae2b2c..c137b42 100644 --- a/build/exports/Empire Earth.dxw +++ b/build/exports/Project IGI.dxw @@ -1,15 +1,15 @@ [target] -title0=Empire Earth -path0=D:\Games\Empire Earth\Empire Earth.exe +title0=Project IGI +path0=D:\Games\Project IGI\pc\IGI.exe module0= opengllib0= ver0=0 coord0=0 -flag0=1744847009 -flagg0=201326608 -flagh0=65620 -flagi0=0 -tflag0=23 +flag0=671105060 +flagg0=-939524096 +flagh0=20 +flagi0=4 +tflag0=67 initx0=0 inity0=0 minx0=0 diff --git a/build/exports/State of Emergency.dxw b/build/exports/State of Emergency.dxw new file mode 100644 index 0000000..1f7744b --- /dev/null +++ b/build/exports/State of Emergency.dxw @@ -0,0 +1,24 @@ +[target] +title0=State of Emergency +path0=D:\Games\State of Emergency\KaosPC.exe +module0= +opengllib0= +ver0=8 +coord0=0 +flag0=671088676 +flagg0=1207959552 +flagh0=20 +flagi0=4 +tflag0=7315 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 diff --git a/build/exports/Take no Prisoners.dxw b/build/exports/Take no Prisoners.dxw new file mode 100644 index 0000000..f43be41 --- /dev/null +++ b/build/exports/Take no Prisoners.dxw @@ -0,0 +1,24 @@ +[target] +title0=Take no Prisoners +path0=D:\Games\Take no Prisoners\TNP.EXE +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=134217860 +flagh0=20 +flagi0=512 +tflag0=259 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 diff --git a/build/exports/Worms Pinball.dxw b/build/exports/Worms Pinball.dxw new file mode 100644 index 0000000..b02bbc1 --- /dev/null +++ b/build/exports/Worms Pinball.dxw @@ -0,0 +1,24 @@ +[target] +title0=Worms Pinball +path0=D:\Games\Worms Pinball\WPIB.exe +module0= +opengllib0= +ver0=1 +coord0=0 +flag0=134217762 +flagg0=1207959568 +flagh0=20 +flagi0=4 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 diff --git a/build/issues.txt b/build/issues.txt deleted file mode 100644 index 214f7c1..0000000 --- a/build/issues.txt +++ /dev/null @@ -1,4 +0,0 @@ -Ancient Evil: working both in emulated / direct mode, but in emulated mode the cursor is not visible. -window handling for ddraw8 games - see WildFire with keep aspect ratio & client area -"devastation" intro movie - bad cooordinates -Praetorians: bad splash screen & crash \ No newline at end of file diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 4829097..32277b1 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -323,4 +323,17 @@ Clean ZBUFFER @0.0 fix: to fix "Crimson Skies" black blocks bug on ATI cards v2.02.48 New options: "Disable fogging", "Textures not power of 2 fix" -A few fix to prevent game crashes \ No newline at end of file +A few fix to prevent game crashes + +v2.02.49 +Separated ddraw, d3d and dxwnd log messages +Hooked GetAvailableVidMem method to limit memory values +Hooked ChangeDisplaySettings call in both versions ANSI and WIDECHAR, to prevent messing up with the screen +Added HookWindowProc() subroutine, called at dxhook.c@1534 +Added "Add proxy libs" flag - so far to copy a d3d9.dll proxy lib to fix d3d9 games +Hooked d3d8/9 SetCursorPosition method +Hooked d3d8/9 AddRef / release methods (for logging) +Fixed D3DDevice8/9 hooking +Hooked QueryPerformanceFrequency +Fixed a bug in d3d7 hooking +GUI: added desktop cplor setting diff --git a/d3d9proxy/d3d9.h b/d3d9proxy/d3d9.h new file mode 100644 index 0000000..4d985e8 --- /dev/null +++ b/d3d9proxy/d3d9.h @@ -0,0 +1,1667 @@ +/*==========================================================================; + * + * Copyright (C) Microsoft Corporation. All Rights Reserved. + * + * File: d3d9.h + * Content: Direct3D include file + * + ****************************************************************************/ + +#ifndef _D3D9_H_ +#define _D3D9_H_ + +#ifndef DIRECT3D_VERSION +#define DIRECT3D_VERSION 0x0900 +#endif //DIRECT3D_VERSION + +// include this file content only if compiling for DX9 interfaces +#if(DIRECT3D_VERSION >= 0x0900) + + +/* This identifier is passed to Direct3DCreate9 in order to ensure that an + * application was built against the correct header files. This number is + * incremented whenever a header (or other) change would require applications + * to be rebuilt. If the version doesn't match, Direct3DCreate9 will fail. + * (The number itself has no meaning.)*/ + +#define D3D_SDK_VERSION 31 + + +#include + +#define COM_NO_WINDOWS_H +#include + +#include + +#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500) + #define HMONITOR_DECLARED + DECLARE_HANDLE(HMONITOR); +#endif + +#define D3DAPI WINAPI + +/* + * Interface IID's + */ +#if defined( _WIN32 ) && !defined( _NO_COM) + +/* IID_IDirect3D9 */ +/* {81BDCBCA-64D4-426d-AE8D-AD0147F4275C} */ +DEFINE_GUID(IID_IDirect3D9, 0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c); + +/* IID_IDirect3DDevice9 */ +// {D0223B96-BF7A-43fd-92BD-A43B0D82B9EB} */ +DEFINE_GUID(IID_IDirect3DDevice9, 0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0xd, 0x82, 0xb9, 0xeb); + +/* IID_IDirect3DResource9 */ +// {05EEC05D-8F7D-4362-B999-D1BAF357C704} +DEFINE_GUID(IID_IDirect3DResource9, 0x5eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x4); + +/* IID_IDirect3DBaseTexture9 */ +/* {580CA87E-1D3C-4d54-991D-B7D3E3C298CE} */ +DEFINE_GUID(IID_IDirect3DBaseTexture9, 0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce); + +/* IID_IDirect3DTexture9 */ +/* {85C31227-3DE5-4f00-9B3A-F11AC38C18B5} */ +DEFINE_GUID(IID_IDirect3DTexture9, 0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5); + +/* IID_IDirect3DCubeTexture9 */ +/* {FFF32F81-D953-473a-9223-93D652ABA93F} */ +DEFINE_GUID(IID_IDirect3DCubeTexture9, 0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f); + +/* IID_IDirect3DVolumeTexture9 */ +/* {2518526C-E789-4111-A7B9-47EF328D13E6} */ +DEFINE_GUID(IID_IDirect3DVolumeTexture9, 0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6); + +/* IID_IDirect3DVertexBuffer9 */ +/* {B64BB1B5-FD70-4df6-BF91-19D0A12455E3} */ +DEFINE_GUID(IID_IDirect3DVertexBuffer9, 0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3); + +/* IID_IDirect3DIndexBuffer9 */ +/* {7C9DD65E-D3F7-4529-ACEE-785830ACDE35} */ +DEFINE_GUID(IID_IDirect3DIndexBuffer9, 0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35); + +/* IID_IDirect3DSurface9 */ +/* {0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B} */ +DEFINE_GUID(IID_IDirect3DSurface9, 0xcfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b); + +/* IID_IDirect3DVolume9 */ +/* {24F416E6-1F67-4aa7-B88E-D33F6F3128A1} */ +DEFINE_GUID(IID_IDirect3DVolume9, 0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1); + +/* IID_IDirect3DSwapChain9 */ +/* {794950F2-ADFC-458a-905E-10A10B0B503B} */ +DEFINE_GUID(IID_IDirect3DSwapChain9, 0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0xb, 0xb, 0x50, 0x3b); + +/* IID_IDirect3DVertexDeclaration9 */ +/* {DD13C59C-36FA-4098-A8FB-C7ED39DC8546} */ +DEFINE_GUID(IID_IDirect3DVertexDeclaration9, 0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46); + +/* IID_IDirect3DVertexShader9 */ +/* {EFC5557E-6265-4613-8A94-43857889EB36} */ +DEFINE_GUID(IID_IDirect3DVertexShader9, 0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36); + +/* IID_IDirect3DPixelShader9 */ +/* {6D3BDBDC-5B02-4415-B852-CE5E8BCCB289} */ +DEFINE_GUID(IID_IDirect3DPixelShader9, 0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89); + +/* IID_IDirect3DStateBlock9 */ +/* {B07C4FE5-310D-4ba8-A23C-4F0F206F218B} */ +DEFINE_GUID(IID_IDirect3DStateBlock9, 0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0xf, 0x20, 0x6f, 0x21, 0x8b); + +/* IID_IDirect3DQuery9 */ +/* {d9771460-a695-4f26-bbd3-27b840b541cc} */ +DEFINE_GUID(IID_IDirect3DQuery9, 0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc); + + +#endif + +#ifdef __cplusplus + +#ifndef DECLSPEC_UUID +#if _MSC_VER >= 1100 +#define DECLSPEC_UUID(x) __declspec(uuid(x)) +#else +#define DECLSPEC_UUID(x) +#endif +#endif + +interface DECLSPEC_UUID("81BDCBCA-64D4-426d-AE8D-AD0147F4275C") IDirect3D9; +interface DECLSPEC_UUID("D0223B96-BF7A-43fd-92BD-A43B0D82B9EB") IDirect3DDevice9; + +interface DECLSPEC_UUID("B07C4FE5-310D-4ba8-A23C-4F0F206F218B") IDirect3DStateBlock9; +interface DECLSPEC_UUID("05EEC05D-8F7D-4362-B999-D1BAF357C704") IDirect3DResource9; +interface DECLSPEC_UUID("DD13C59C-36FA-4098-A8FB-C7ED39DC8546") IDirect3DVertexDeclaration9; +interface DECLSPEC_UUID("EFC5557E-6265-4613-8A94-43857889EB36") IDirect3DVertexShader9; +interface DECLSPEC_UUID("6D3BDBDC-5B02-4415-B852-CE5E8BCCB289") IDirect3DPixelShader9; +interface DECLSPEC_UUID("580CA87E-1D3C-4d54-991D-B7D3E3C298CE") IDirect3DBaseTexture9; +interface DECLSPEC_UUID("85C31227-3DE5-4f00-9B3A-F11AC38C18B5") IDirect3DTexture9; +interface DECLSPEC_UUID("2518526C-E789-4111-A7B9-47EF328D13E6") IDirect3DVolumeTexture9; +interface DECLSPEC_UUID("FFF32F81-D953-473a-9223-93D652ABA93F") IDirect3DCubeTexture9; + +interface DECLSPEC_UUID("B64BB1B5-FD70-4df6-BF91-19D0A12455E3") IDirect3DVertexBuffer9; +interface DECLSPEC_UUID("7C9DD65E-D3F7-4529-ACEE-785830ACDE35") IDirect3DIndexBuffer9; + +interface DECLSPEC_UUID("0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B") IDirect3DSurface9; +interface DECLSPEC_UUID("24F416E6-1F67-4aa7-B88E-D33F6F3128A1") IDirect3DVolume9; + +interface DECLSPEC_UUID("794950F2-ADFC-458a-905E-10A10B0B503B") IDirect3DSwapChain9; +interface DECLSPEC_UUID("d9771460-a695-4f26-bbd3-27b840b541cc") IDirect3DQuery9; + + +#if defined(_COM_SMARTPTR_TYPEDEF) +_COM_SMARTPTR_TYPEDEF(IDirect3D9, __uuidof(IDirect3D9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DDevice9, __uuidof(IDirect3DDevice9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DStateBlock9, __uuidof(IDirect3DStateBlock9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DResource9, __uuidof(IDirect3DResource9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexDeclaration9, __uuidof(IDirect3DVertexDeclaration9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexShader9, __uuidof(IDirect3DVertexShader9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DPixelShader9, __uuidof(IDirect3DPixelShader9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DBaseTexture9, __uuidof(IDirect3DBaseTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DTexture9, __uuidof(IDirect3DTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVolumeTexture9, __uuidof(IDirect3DVolumeTexture9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DCubeTexture9, __uuidof(IDirect3DCubeTexture9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DVertexBuffer9, __uuidof(IDirect3DVertexBuffer9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DIndexBuffer9, __uuidof(IDirect3DIndexBuffer9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DSurface9, __uuidof(IDirect3DSurface9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DVolume9, __uuidof(IDirect3DVolume9)); + +_COM_SMARTPTR_TYPEDEF(IDirect3DSwapChain9, __uuidof(IDirect3DSwapChain9)); +_COM_SMARTPTR_TYPEDEF(IDirect3DQuery9, __uuidof(IDirect3DQuery9)); + +#endif +#endif + + +typedef interface IDirect3D9 IDirect3D9; +typedef interface IDirect3DDevice9 IDirect3DDevice9; +typedef interface IDirect3DStateBlock9 IDirect3DStateBlock9; +typedef interface IDirect3DVertexDeclaration9 IDirect3DVertexDeclaration9; +typedef interface IDirect3DVertexShader9 IDirect3DVertexShader9; +typedef interface IDirect3DPixelShader9 IDirect3DPixelShader9; +typedef interface IDirect3DResource9 IDirect3DResource9; +typedef interface IDirect3DBaseTexture9 IDirect3DBaseTexture9; +typedef interface IDirect3DTexture9 IDirect3DTexture9; +typedef interface IDirect3DVolumeTexture9 IDirect3DVolumeTexture9; +typedef interface IDirect3DCubeTexture9 IDirect3DCubeTexture9; +typedef interface IDirect3DVertexBuffer9 IDirect3DVertexBuffer9; +typedef interface IDirect3DIndexBuffer9 IDirect3DIndexBuffer9; +typedef interface IDirect3DSurface9 IDirect3DSurface9; +typedef interface IDirect3DVolume9 IDirect3DVolume9; +typedef interface IDirect3DSwapChain9 IDirect3DSwapChain9; +typedef interface IDirect3DQuery9 IDirect3DQuery9; + + +#include "d3d9types.h" +#include "d3d9caps.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * DLL Function for creating a Direct3D9 object. This object supports + * enumeration and allows the creation of Direct3DDevice9 objects. + * Pass the value of the constant D3D_SDK_VERSION to this function, so + * that the run-time can validate that your application was compiled + * against the right headers. + */ + +IDirect3D9 * WINAPI Direct3DCreate9(UINT SDKVersion); + + +/* + * Direct3D interfaces + */ + + + + + +#undef INTERFACE +#define INTERFACE IDirect3D9 + +DECLARE_INTERFACE_(IDirect3D9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3D9 methods ***/ + STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE; + STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE; + STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE; + STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE; + STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(CheckDeviceType)(THIS_ UINT iAdapter,D3DDEVTYPE DevType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE; + STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE; + STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE; + STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE; + STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE; + STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE; + STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE; +}; + +typedef struct IDirect3D9 *LPDIRECT3D9, *PDIRECT3D9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3D9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3D9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3D9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a) +#define IDirect3D9_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p) +#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c) +#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b) +#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d) +#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b) +#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f) +#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f) +#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d) +#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c) +#define IDirect3D9_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a) +#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f) +#else +#define IDirect3D9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3D9_AddRef(p) (p)->AddRef() +#define IDirect3D9_Release(p) (p)->Release() +#define IDirect3D9_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a) +#define IDirect3D9_GetAdapterCount(p) (p)->GetAdapterCount() +#define IDirect3D9_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c) +#define IDirect3D9_GetAdapterModeCount(p,a,b) (p)->GetAdapterModeCount(a,b) +#define IDirect3D9_EnumAdapterModes(p,a,b,c,d) (p)->EnumAdapterModes(a,b,c,d) +#define IDirect3D9_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b) +#define IDirect3D9_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f) +#define IDirect3D9_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->CheckDeviceMultiSampleType(a,b,c,d,e,f) +#define IDirect3D9_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e) +#define IDirect3D9_CheckDeviceFormatConversion(p,a,b,c,d) (p)->CheckDeviceFormatConversion(a,b,c,d) +#define IDirect3D9_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c) +#define IDirect3D9_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a) +#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f) +#endif + + + + + + + +/* SwapChain */ + + + + + + + + + + + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DDevice9 + +DECLARE_INTERFACE_(IDirect3DDevice9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DDevice9 methods ***/ + STDMETHOD(TestCooperativeLevel)(THIS) PURE; + STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE; + STDMETHOD(EvictManagedResources)(THIS) PURE; + STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE; + STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE; + STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE; + STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE; + STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE; + STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE; + STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE; + STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE; + STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE; + STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE; + STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE; + STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE; + STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE; + STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE; + STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE; + STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE; + STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE; + STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE; + STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE; + STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE; + STDMETHOD(BeginScene)(THIS) PURE; + STDMETHOD(EndScene)(THIS) PURE; + STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE; + STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE; + STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE; + STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE; + STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE; + STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE; + STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE; + STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE; + STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE; + STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE; + STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE; + STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE; + STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE; + STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE; + STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(BeginStateBlock)(THIS) PURE; + STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE; + STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE; + STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE; + STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE; + STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE; + STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE; + STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE; + STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE; + STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE; + STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE; + STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE; + STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE; + STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE; + STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE; + STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE; + STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE; + STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE; + STDMETHOD_(float, GetNPatchMode)(THIS) PURE; + STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE; + STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE; + STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE; + STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE; + STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE; + STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE; + STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE; + STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE; + STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE; + STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE; + STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE; + STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* OffsetInBytes,UINT* pStride) PURE; + STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Divider) PURE; + STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* Divider) PURE; + STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE; + STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE; + STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE; + STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE; + STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE; + STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE; + STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE; + STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE; + STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE; + STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE; + STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE; +}; + +typedef struct IDirect3DDevice9 *LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DDevice9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DDevice9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p) +#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p) +#define IDirect3DDevice9_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p) +#define IDirect3DDevice9_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a) +#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a) +#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b) +#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a) +#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c) +#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c) +#define IDirect3DDevice9_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a) +#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b) +#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b) +#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p) +#define IDirect3DDevice9_Reset(p,a) (p)->lpVtbl->Reset(p,a) +#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d) +#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d) +#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b) +#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a) +#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c) +#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b) +#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g) +#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d) +#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b) +#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b) +#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b) +#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e) +#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c) +#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f) +#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b) +#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b) +#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a) +#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a) +#define IDirect3DDevice9_BeginScene(p) (p)->lpVtbl->BeginScene(p) +#define IDirect3DDevice9_EndScene(p) (p)->lpVtbl->EndScene(p) +#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f) +#define IDirect3DDevice9_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b) +#define IDirect3DDevice9_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b) +#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b) +#define IDirect3DDevice9_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a) +#define IDirect3DDevice9_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a) +#define IDirect3DDevice9_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a) +#define IDirect3DDevice9_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a) +#define IDirect3DDevice9_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b) +#define IDirect3DDevice9_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b) +#define IDirect3DDevice9_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b) +#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b) +#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b) +#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b) +#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b) +#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b) +#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b) +#define IDirect3DDevice9_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p) +#define IDirect3DDevice9_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a) +#define IDirect3DDevice9_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a) +#define IDirect3DDevice9_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a) +#define IDirect3DDevice9_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b) +#define IDirect3DDevice9_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b) +#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c) +#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c) +#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c) +#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c) +#define IDirect3DDevice9_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a) +#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b) +#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b) +#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a) +#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a) +#define IDirect3DDevice9_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a) +#define IDirect3DDevice9_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a) +#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a) +#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p) +#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a) +#define IDirect3DDevice9_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p) +#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c) +#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f) +#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d) +#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f) +#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b) +#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a) +#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a) +#define IDirect3DDevice9_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a) +#define IDirect3DDevice9_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a) +#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b) +#define IDirect3DDevice9_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a) +#define IDirect3DDevice9_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a) +#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d) +#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b) +#define IDirect3DDevice9_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a) +#define IDirect3DDevice9_GetIndices(p,a) (p)->lpVtbl->GetIndices(p,a) +#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b) +#define IDirect3DDevice9_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a) +#define IDirect3DDevice9_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a) +#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c) +#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c) +#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c) +#define IDirect3DDevice9_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a) +#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b) +#else +#define IDirect3DDevice9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DDevice9_AddRef(p) (p)->AddRef() +#define IDirect3DDevice9_Release(p) (p)->Release() +#define IDirect3DDevice9_TestCooperativeLevel(p) (p)->TestCooperativeLevel() +#define IDirect3DDevice9_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem() +#define IDirect3DDevice9_EvictManagedResources(p) (p)->EvictManagedResources() +#define IDirect3DDevice9_GetDirect3D(p,a) (p)->GetDirect3D(a) +#define IDirect3DDevice9_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a) +#define IDirect3DDevice9_GetDisplayMode(p,a,b) (p)->GetDisplayMode(a,b) +#define IDirect3DDevice9_GetCreationParameters(p,a) (p)->GetCreationParameters(a) +#define IDirect3DDevice9_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c) +#define IDirect3DDevice9_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c) +#define IDirect3DDevice9_ShowCursor(p,a) (p)->ShowCursor(a) +#define IDirect3DDevice9_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b) +#define IDirect3DDevice9_GetSwapChain(p,a,b) (p)->GetSwapChain(a,b) +#define IDirect3DDevice9_GetNumberOfSwapChains(p) (p)->GetNumberOfSwapChains() +#define IDirect3DDevice9_Reset(p,a) (p)->Reset(a) +#define IDirect3DDevice9_Present(p,a,b,c,d) (p)->Present(a,b,c,d) +#define IDirect3DDevice9_GetBackBuffer(p,a,b,c,d) (p)->GetBackBuffer(a,b,c,d) +#define IDirect3DDevice9_GetRasterStatus(p,a,b) (p)->GetRasterStatus(a,b) +#define IDirect3DDevice9_SetDialogBoxMode(p,a) (p)->SetDialogBoxMode(a) +#define IDirect3DDevice9_SetGammaRamp(p,a,b,c) (p)->SetGammaRamp(a,b,c) +#define IDirect3DDevice9_GetGammaRamp(p,a,b) (p)->GetGammaRamp(a,b) +#define IDirect3DDevice9_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->CreateTexture(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h,i) +#define IDirect3DDevice9_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->CreateCubeTexture(a,b,c,d,e,f,g) +#define IDirect3DDevice9_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->CreateVertexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->CreateIndexBuffer(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->CreateRenderTarget(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->CreateDepthStencilSurface(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_UpdateSurface(p,a,b,c,d) (p)->UpdateSurface(a,b,c,d) +#define IDirect3DDevice9_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b) +#define IDirect3DDevice9_GetRenderTargetData(p,a,b) (p)->GetRenderTargetData(a,b) +#define IDirect3DDevice9_GetFrontBufferData(p,a,b) (p)->GetFrontBufferData(a,b) +#define IDirect3DDevice9_StretchRect(p,a,b,c,d,e) (p)->StretchRect(a,b,c,d,e) +#define IDirect3DDevice9_ColorFill(p,a,b,c) (p)->ColorFill(a,b,c) +#define IDirect3DDevice9_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->CreateOffscreenPlainSurface(a,b,c,d,e,f) +#define IDirect3DDevice9_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b) +#define IDirect3DDevice9_GetRenderTarget(p,a,b) (p)->GetRenderTarget(a,b) +#define IDirect3DDevice9_SetDepthStencilSurface(p,a) (p)->SetDepthStencilSurface(a) +#define IDirect3DDevice9_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a) +#define IDirect3DDevice9_BeginScene(p) (p)->BeginScene() +#define IDirect3DDevice9_EndScene(p) (p)->EndScene() +#define IDirect3DDevice9_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f) +#define IDirect3DDevice9_SetTransform(p,a,b) (p)->SetTransform(a,b) +#define IDirect3DDevice9_GetTransform(p,a,b) (p)->GetTransform(a,b) +#define IDirect3DDevice9_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b) +#define IDirect3DDevice9_SetViewport(p,a) (p)->SetViewport(a) +#define IDirect3DDevice9_GetViewport(p,a) (p)->GetViewport(a) +#define IDirect3DDevice9_SetMaterial(p,a) (p)->SetMaterial(a) +#define IDirect3DDevice9_GetMaterial(p,a) (p)->GetMaterial(a) +#define IDirect3DDevice9_SetLight(p,a,b) (p)->SetLight(a,b) +#define IDirect3DDevice9_GetLight(p,a,b) (p)->GetLight(a,b) +#define IDirect3DDevice9_LightEnable(p,a,b) (p)->LightEnable(a,b) +#define IDirect3DDevice9_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b) +#define IDirect3DDevice9_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b) +#define IDirect3DDevice9_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b) +#define IDirect3DDevice9_SetRenderState(p,a,b) (p)->SetRenderState(a,b) +#define IDirect3DDevice9_GetRenderState(p,a,b) (p)->GetRenderState(a,b) +#define IDirect3DDevice9_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b) +#define IDirect3DDevice9_BeginStateBlock(p) (p)->BeginStateBlock() +#define IDirect3DDevice9_EndStateBlock(p,a) (p)->EndStateBlock(a) +#define IDirect3DDevice9_SetClipStatus(p,a) (p)->SetClipStatus(a) +#define IDirect3DDevice9_GetClipStatus(p,a) (p)->GetClipStatus(a) +#define IDirect3DDevice9_GetTexture(p,a,b) (p)->GetTexture(a,b) +#define IDirect3DDevice9_SetTexture(p,a,b) (p)->SetTexture(a,b) +#define IDirect3DDevice9_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c) +#define IDirect3DDevice9_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c) +#define IDirect3DDevice9_GetSamplerState(p,a,b,c) (p)->GetSamplerState(a,b,c) +#define IDirect3DDevice9_SetSamplerState(p,a,b,c) (p)->SetSamplerState(a,b,c) +#define IDirect3DDevice9_ValidateDevice(p,a) (p)->ValidateDevice(a) +#define IDirect3DDevice9_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b) +#define IDirect3DDevice9_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b) +#define IDirect3DDevice9_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a) +#define IDirect3DDevice9_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a) +#define IDirect3DDevice9_SetScissorRect(p,a) (p)->SetScissorRect(a) +#define IDirect3DDevice9_GetScissorRect(p,a) (p)->GetScissorRect(a) +#define IDirect3DDevice9_SetSoftwareVertexProcessing(p,a) (p)->SetSoftwareVertexProcessing(a) +#define IDirect3DDevice9_GetSoftwareVertexProcessing(p) (p)->GetSoftwareVertexProcessing() +#define IDirect3DDevice9_SetNPatchMode(p,a) (p)->SetNPatchMode(a) +#define IDirect3DDevice9_GetNPatchMode(p) (p)->GetNPatchMode() +#define IDirect3DDevice9_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c) +#define IDirect3DDevice9_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->DrawIndexedPrimitive(a,b,c,d,e,f) +#define IDirect3DDevice9_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d) +#define IDirect3DDevice9_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h) +#define IDirect3DDevice9_ProcessVertices(p,a,b,c,d,e,f) (p)->ProcessVertices(a,b,c,d,e,f) +#define IDirect3DDevice9_CreateVertexDeclaration(p,a,b) (p)->CreateVertexDeclaration(a,b) +#define IDirect3DDevice9_SetVertexDeclaration(p,a) (p)->SetVertexDeclaration(a) +#define IDirect3DDevice9_GetVertexDeclaration(p,a) (p)->GetVertexDeclaration(a) +#define IDirect3DDevice9_SetFVF(p,a) (p)->SetFVF(a) +#define IDirect3DDevice9_GetFVF(p,a) (p)->GetFVF(a) +#define IDirect3DDevice9_CreateVertexShader(p,a,b) (p)->CreateVertexShader(a,b) +#define IDirect3DDevice9_SetVertexShader(p,a) (p)->SetVertexShader(a) +#define IDirect3DDevice9_GetVertexShader(p,a) (p)->GetVertexShader(a) +#define IDirect3DDevice9_SetVertexShaderConstantF(p,a,b,c) (p)->SetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantF(p,a,b,c) (p)->GetVertexShaderConstantF(a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantI(p,a,b,c) (p)->SetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantI(p,a,b,c) (p)->GetVertexShaderConstantI(a,b,c) +#define IDirect3DDevice9_SetVertexShaderConstantB(p,a,b,c) (p)->SetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9_GetVertexShaderConstantB(p,a,b,c) (p)->GetVertexShaderConstantB(a,b,c) +#define IDirect3DDevice9_SetStreamSource(p,a,b,c,d) (p)->SetStreamSource(a,b,c,d) +#define IDirect3DDevice9_GetStreamSource(p,a,b,c,d) (p)->GetStreamSource(a,b,c,d) +#define IDirect3DDevice9_SetStreamSourceFreq(p,a,b) (p)->SetStreamSourceFreq(a,b) +#define IDirect3DDevice9_GetStreamSourceFreq(p,a,b) (p)->GetStreamSourceFreq(a,b) +#define IDirect3DDevice9_SetIndices(p,a) (p)->SetIndices(a) +#define IDirect3DDevice9_GetIndices(p,a) (p)->GetIndices(a) +#define IDirect3DDevice9_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b) +#define IDirect3DDevice9_SetPixelShader(p,a) (p)->SetPixelShader(a) +#define IDirect3DDevice9_GetPixelShader(p,a) (p)->GetPixelShader(a) +#define IDirect3DDevice9_SetPixelShaderConstantF(p,a,b,c) (p)->SetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantF(p,a,b,c) (p)->GetPixelShaderConstantF(a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantI(p,a,b,c) (p)->SetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantI(p,a,b,c) (p)->GetPixelShaderConstantI(a,b,c) +#define IDirect3DDevice9_SetPixelShaderConstantB(p,a,b,c) (p)->SetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9_GetPixelShaderConstantB(p,a,b,c) (p)->GetPixelShaderConstantB(a,b,c) +#define IDirect3DDevice9_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c) +#define IDirect3DDevice9_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c) +#define IDirect3DDevice9_DeletePatch(p,a) (p)->DeletePatch(a) +#define IDirect3DDevice9_CreateQuery(p,a,b) (p)->CreateQuery(a,b) +#endif + + +#undef INTERFACE +#define INTERFACE IDirect3DStateBlock9 + +DECLARE_INTERFACE_(IDirect3DStateBlock9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DStateBlock9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(Capture)(THIS) PURE; + STDMETHOD(Apply)(THIS) PURE; +}; + +typedef struct IDirect3DStateBlock9 *LPDIRECT3DSTATEBLOCK9, *PDIRECT3DSTATEBLOCK9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DStateBlock9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DStateBlock9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DStateBlock9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DStateBlock9_Capture(p) (p)->lpVtbl->Capture(p) +#define IDirect3DStateBlock9_Apply(p) (p)->lpVtbl->Apply(p) +#else +#define IDirect3DStateBlock9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DStateBlock9_AddRef(p) (p)->AddRef() +#define IDirect3DStateBlock9_Release(p) (p)->Release() +#define IDirect3DStateBlock9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DStateBlock9_Capture(p) (p)->Capture() +#define IDirect3DStateBlock9_Apply(p) (p)->Apply() +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DSwapChain9 + +DECLARE_INTERFACE_(IDirect3DSwapChain9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DSwapChain9 methods ***/ + STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE; + STDMETHOD(GetFrontBufferData)(THIS_ IDirect3DSurface9* pDestSurface) PURE; + STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE; + STDMETHOD(GetRasterStatus)(THIS_ D3DRASTER_STATUS* pRasterStatus) PURE; + STDMETHOD(GetDisplayMode)(THIS_ D3DDISPLAYMODE* pMode) PURE; + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetPresentParameters)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE; +}; + +typedef struct IDirect3DSwapChain9 *LPDIRECT3DSWAPCHAIN9, *PDIRECT3DSWAPCHAIN9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSwapChain9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSwapChain9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e) +#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a) +#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c) +#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a) +#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->lpVtbl->GetDisplayMode(p,a) +#define IDirect3DSwapChain9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->lpVtbl->GetPresentParameters(p,a) +#else +#define IDirect3DSwapChain9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSwapChain9_AddRef(p) (p)->AddRef() +#define IDirect3DSwapChain9_Release(p) (p)->Release() +#define IDirect3DSwapChain9_Present(p,a,b,c,d,e) (p)->Present(a,b,c,d,e) +#define IDirect3DSwapChain9_GetFrontBufferData(p,a) (p)->GetFrontBufferData(a) +#define IDirect3DSwapChain9_GetBackBuffer(p,a,b,c) (p)->GetBackBuffer(a,b,c) +#define IDirect3DSwapChain9_GetRasterStatus(p,a) (p)->GetRasterStatus(a) +#define IDirect3DSwapChain9_GetDisplayMode(p,a) (p)->GetDisplayMode(a) +#define IDirect3DSwapChain9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSwapChain9_GetPresentParameters(p,a) (p)->GetPresentParameters(a) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DResource9 + +DECLARE_INTERFACE_(IDirect3DResource9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; +}; + +typedef struct IDirect3DResource9 *LPDIRECT3DRESOURCE9, *PDIRECT3DRESOURCE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DResource9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DResource9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DResource9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DResource9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DResource9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DResource9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DResource9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DResource9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DResource9_GetType(p) (p)->lpVtbl->GetType(p) +#else +#define IDirect3DResource9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DResource9_AddRef(p) (p)->AddRef() +#define IDirect3DResource9_Release(p) (p)->Release() +#define IDirect3DResource9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DResource9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DResource9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DResource9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DResource9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DResource9_GetPriority(p) (p)->GetPriority() +#define IDirect3DResource9_PreLoad(p) (p)->PreLoad() +#define IDirect3DResource9_GetType(p) (p)->GetType() +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexDeclaration9 + +DECLARE_INTERFACE_(IDirect3DVertexDeclaration9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexDeclaration9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9*,UINT* pNumElements) PURE; +}; + +typedef struct IDirect3DVertexDeclaration9 *LPDIRECT3DVERTEXDECLARATION9, *PDIRECT3DVERTEXDECLARATION9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexDeclaration9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexDeclaration9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->lpVtbl->GetDeclaration(p,a,b) +#else +#define IDirect3DVertexDeclaration9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexDeclaration9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexDeclaration9_Release(p) (p)->Release() +#define IDirect3DVertexDeclaration9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexDeclaration9_GetDeclaration(p,a,b) (p)->GetDeclaration(a,b) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexShader9 + +DECLARE_INTERFACE_(IDirect3DVertexShader9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVertexShader9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE; +}; + +typedef struct IDirect3DVertexShader9 *LPDIRECT3DVERTEXSHADER9, *PDIRECT3DVERTEXSHADER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexShader9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexShader9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) +#else +#define IDirect3DVertexShader9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexShader9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexShader9_Release(p) (p)->Release() +#define IDirect3DVertexShader9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexShader9_GetFunction(p,a,b) (p)->GetFunction(a,b) +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DPixelShader9 + +DECLARE_INTERFACE_(IDirect3DPixelShader9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DPixelShader9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(GetFunction)(THIS_ void*,UINT* pSizeOfData) PURE; +}; + +typedef struct IDirect3DPixelShader9 *LPDIRECT3DPIXELSHADER9, *PDIRECT3DPIXELSHADER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DPixelShader9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DPixelShader9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DPixelShader9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) +#else +#define IDirect3DPixelShader9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DPixelShader9_AddRef(p) (p)->AddRef() +#define IDirect3DPixelShader9_Release(p) (p)->Release() +#define IDirect3DPixelShader9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DPixelShader9_GetFunction(p,a,b) (p)->GetFunction(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DBaseTexture9 + +DECLARE_INTERFACE_(IDirect3DBaseTexture9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; +}; + +typedef struct IDirect3DBaseTexture9 *LPDIRECT3DBASETEXTURE9, *PDIRECT3DBASETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DBaseTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DBaseTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DBaseTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DBaseTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DBaseTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DBaseTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#else +#define IDirect3DBaseTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DBaseTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DBaseTexture9_Release(p) (p)->Release() +#define IDirect3DBaseTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DBaseTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DBaseTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DBaseTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DBaseTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DBaseTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DBaseTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DBaseTexture9_GetType(p) (p)->GetType() +#define IDirect3DBaseTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DBaseTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DBaseTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DBaseTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DBaseTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DBaseTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DTexture9 + +DECLARE_INTERFACE_(IDirect3DTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,IDirect3DSurface9** ppSurfaceLevel) PURE; + STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE; +}; + +typedef struct IDirect3DTexture9 *LPDIRECT3DTEXTURE9, *PDIRECT3DTEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->lpVtbl->GetSurfaceLevel(p,a,b) +#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->lpVtbl->LockRect(p,a,b,c,d) +#define IDirect3DTexture9_UnlockRect(p,a) (p)->lpVtbl->UnlockRect(p,a) +#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a) +#else +#define IDirect3DTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DTexture9_Release(p) (p)->Release() +#define IDirect3DTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DTexture9_GetType(p) (p)->GetType() +#define IDirect3DTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DTexture9_GetSurfaceLevel(p,a,b) (p)->GetSurfaceLevel(a,b) +#define IDirect3DTexture9_LockRect(p,a,b,c,d) (p)->LockRect(a,b,c,d) +#define IDirect3DTexture9_UnlockRect(p,a) (p)->UnlockRect(a) +#define IDirect3DTexture9_AddDirtyRect(p,a) (p)->AddDirtyRect(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolumeTexture9 + +DECLARE_INTERFACE_(IDirect3DVolumeTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(GetVolumeLevel)(THIS_ UINT Level,IDirect3DVolume9** ppVolumeLevel) PURE; + STDMETHOD(LockBox)(THIS_ UINT Level,D3DLOCKED_BOX* pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS_ UINT Level) PURE; + STDMETHOD(AddDirtyBox)(THIS_ CONST D3DBOX* pDirtyBox) PURE; +}; + +typedef struct IDirect3DVolumeTexture9 *LPDIRECT3DVOLUMETEXTURE9, *PDIRECT3DVOLUMETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolumeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolumeTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVolumeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVolumeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVolumeTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DVolumeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->lpVtbl->GetVolumeLevel(p,a,b) +#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->lpVtbl->LockBox(p,a,b,c,d) +#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->lpVtbl->UnlockBox(p,a) +#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->lpVtbl->AddDirtyBox(p,a) +#else +#define IDirect3DVolumeTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolumeTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DVolumeTexture9_Release(p) (p)->Release() +#define IDirect3DVolumeTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolumeTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolumeTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolumeTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolumeTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVolumeTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DVolumeTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DVolumeTexture9_GetType(p) (p)->GetType() +#define IDirect3DVolumeTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DVolumeTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DVolumeTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DVolumeTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DVolumeTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DVolumeTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DVolumeTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DVolumeTexture9_GetVolumeLevel(p,a,b) (p)->GetVolumeLevel(a,b) +#define IDirect3DVolumeTexture9_LockBox(p,a,b,c,d) (p)->LockBox(a,b,c,d) +#define IDirect3DVolumeTexture9_UnlockBox(p,a) (p)->UnlockBox(a) +#define IDirect3DVolumeTexture9_AddDirtyBox(p,a) (p)->AddDirtyBox(a) +#endif + + + + + +#undef INTERFACE +#define INTERFACE IDirect3DCubeTexture9 + +DECLARE_INTERFACE_(IDirect3DCubeTexture9, IDirect3DBaseTexture9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DBaseTexture9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE; + STDMETHOD_(DWORD, GetLOD)(THIS) PURE; + STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE; + STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE; + STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE; + STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE; + STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(GetCubeMapSurface)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,IDirect3DSurface9** ppCubeMapSurface) PURE; + STDMETHOD(LockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS_ D3DCUBEMAP_FACES FaceType,UINT Level) PURE; + STDMETHOD(AddDirtyRect)(THIS_ D3DCUBEMAP_FACES FaceType,CONST RECT* pDirtyRect) PURE; +}; + +typedef struct IDirect3DCubeTexture9 *LPDIRECT3DCUBETEXTURE9, *PDIRECT3DCUBETEXTURE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DCubeTexture9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DCubeTexture9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DCubeTexture9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DCubeTexture9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DCubeTexture9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a) +#define IDirect3DCubeTexture9_GetLOD(p) (p)->lpVtbl->GetLOD(p) +#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->lpVtbl->GetLevelCount(p) +#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a) +#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p) +#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p) +#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->lpVtbl->GetLevelDesc(p,a,b) +#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->lpVtbl->GetCubeMapSurface(p,a,b,c) +#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->lpVtbl->LockRect(p,a,b,c,d,e) +#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->lpVtbl->UnlockRect(p,a,b) +#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->lpVtbl->AddDirtyRect(p,a,b) +#else +#define IDirect3DCubeTexture9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DCubeTexture9_AddRef(p) (p)->AddRef() +#define IDirect3DCubeTexture9_Release(p) (p)->Release() +#define IDirect3DCubeTexture9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DCubeTexture9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DCubeTexture9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DCubeTexture9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DCubeTexture9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DCubeTexture9_GetPriority(p) (p)->GetPriority() +#define IDirect3DCubeTexture9_PreLoad(p) (p)->PreLoad() +#define IDirect3DCubeTexture9_GetType(p) (p)->GetType() +#define IDirect3DCubeTexture9_SetLOD(p,a) (p)->SetLOD(a) +#define IDirect3DCubeTexture9_GetLOD(p) (p)->GetLOD() +#define IDirect3DCubeTexture9_GetLevelCount(p) (p)->GetLevelCount() +#define IDirect3DCubeTexture9_SetAutoGenFilterType(p,a) (p)->SetAutoGenFilterType(a) +#define IDirect3DCubeTexture9_GetAutoGenFilterType(p) (p)->GetAutoGenFilterType() +#define IDirect3DCubeTexture9_GenerateMipSubLevels(p) (p)->GenerateMipSubLevels() +#define IDirect3DCubeTexture9_GetLevelDesc(p,a,b) (p)->GetLevelDesc(a,b) +#define IDirect3DCubeTexture9_GetCubeMapSurface(p,a,b,c) (p)->GetCubeMapSurface(a,b,c) +#define IDirect3DCubeTexture9_LockRect(p,a,b,c,d,e) (p)->LockRect(a,b,c,d,e) +#define IDirect3DCubeTexture9_UnlockRect(p,a,b) (p)->UnlockRect(a,b) +#define IDirect3DCubeTexture9_AddDirtyRect(p,a,b) (p)->AddDirtyRect(a,b) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVertexBuffer9 + +DECLARE_INTERFACE_(IDirect3DVertexBuffer9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVERTEXBUFFER_DESC *pDesc) PURE; +}; + +typedef struct IDirect3DVertexBuffer9 *LPDIRECT3DVERTEXBUFFER9, *PDIRECT3DVERTEXBUFFER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVertexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVertexBuffer9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DVertexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DVertexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DVertexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DVertexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DVertexBuffer9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVertexBuffer9_AddRef(p) (p)->AddRef() +#define IDirect3DVertexBuffer9_Release(p) (p)->Release() +#define IDirect3DVertexBuffer9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVertexBuffer9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVertexBuffer9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVertexBuffer9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVertexBuffer9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DVertexBuffer9_GetPriority(p) (p)->GetPriority() +#define IDirect3DVertexBuffer9_PreLoad(p) (p)->PreLoad() +#define IDirect3DVertexBuffer9_GetType(p) (p)->GetType() +#define IDirect3DVertexBuffer9_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DVertexBuffer9_Unlock(p) (p)->Unlock() +#define IDirect3DVertexBuffer9_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DIndexBuffer9 + +DECLARE_INTERFACE_(IDirect3DIndexBuffer9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(Lock)(THIS_ UINT OffsetToLock,UINT SizeToLock,void** ppbData,DWORD Flags) PURE; + STDMETHOD(Unlock)(THIS) PURE; + STDMETHOD(GetDesc)(THIS_ D3DINDEXBUFFER_DESC *pDesc) PURE; +}; + +typedef struct IDirect3DIndexBuffer9 *LPDIRECT3DINDEXBUFFER9, *PDIRECT3DINDEXBUFFER9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DIndexBuffer9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DIndexBuffer9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DIndexBuffer9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DIndexBuffer9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DIndexBuffer9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d) +#define IDirect3DIndexBuffer9_Unlock(p) (p)->lpVtbl->Unlock(p) +#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#else +#define IDirect3DIndexBuffer9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DIndexBuffer9_AddRef(p) (p)->AddRef() +#define IDirect3DIndexBuffer9_Release(p) (p)->Release() +#define IDirect3DIndexBuffer9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DIndexBuffer9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DIndexBuffer9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DIndexBuffer9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DIndexBuffer9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DIndexBuffer9_GetPriority(p) (p)->GetPriority() +#define IDirect3DIndexBuffer9_PreLoad(p) (p)->PreLoad() +#define IDirect3DIndexBuffer9_GetType(p) (p)->GetType() +#define IDirect3DIndexBuffer9_Lock(p,a,b,c,d) (p)->Lock(a,b,c,d) +#define IDirect3DIndexBuffer9_Unlock(p) (p)->Unlock() +#define IDirect3DIndexBuffer9_GetDesc(p,a) (p)->GetDesc(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DSurface9 + +DECLARE_INTERFACE_(IDirect3DSurface9, IDirect3DResource9) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DResource9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE; + STDMETHOD_(DWORD, GetPriority)(THIS) PURE; + STDMETHOD_(void, PreLoad)(THIS) PURE; + STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DSURFACE_DESC *pDesc) PURE; + STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE; + STDMETHOD(UnlockRect)(THIS) PURE; + STDMETHOD(GetDC)(THIS_ HDC *phdc) PURE; + STDMETHOD(ReleaseDC)(THIS_ HDC hdc) PURE; +}; + +typedef struct IDirect3DSurface9 *LPDIRECT3DSURFACE9, *PDIRECT3DSURFACE9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DSurface9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DSurface9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DSurface9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DSurface9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DSurface9_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a) +#define IDirect3DSurface9_GetPriority(p) (p)->lpVtbl->GetPriority(p) +#define IDirect3DSurface9_PreLoad(p) (p)->lpVtbl->PreLoad(p) +#define IDirect3DSurface9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DSurface9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DSurface9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c) +#define IDirect3DSurface9_UnlockRect(p) (p)->lpVtbl->UnlockRect(p) +#define IDirect3DSurface9_GetDC(p,a) (p)->lpVtbl->GetDC(p,a) +#define IDirect3DSurface9_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a) +#else +#define IDirect3DSurface9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DSurface9_AddRef(p) (p)->AddRef() +#define IDirect3DSurface9_Release(p) (p)->Release() +#define IDirect3DSurface9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DSurface9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DSurface9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DSurface9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DSurface9_SetPriority(p,a) (p)->SetPriority(a) +#define IDirect3DSurface9_GetPriority(p) (p)->GetPriority() +#define IDirect3DSurface9_PreLoad(p) (p)->PreLoad() +#define IDirect3DSurface9_GetType(p) (p)->GetType() +#define IDirect3DSurface9_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DSurface9_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DSurface9_LockRect(p,a,b,c) (p)->LockRect(a,b,c) +#define IDirect3DSurface9_UnlockRect(p) (p)->UnlockRect() +#define IDirect3DSurface9_GetDC(p,a) (p)->GetDC(a) +#define IDirect3DSurface9_ReleaseDC(p,a) (p)->ReleaseDC(a) +#endif + + + + +#undef INTERFACE +#define INTERFACE IDirect3DVolume9 + +DECLARE_INTERFACE_(IDirect3DVolume9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DVolume9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE; + STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE; + STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE; + STDMETHOD(GetContainer)(THIS_ REFIID riid,void** ppContainer) PURE; + STDMETHOD(GetDesc)(THIS_ D3DVOLUME_DESC *pDesc) PURE; + STDMETHOD(LockBox)(THIS_ D3DLOCKED_BOX * pLockedVolume,CONST D3DBOX* pBox,DWORD Flags) PURE; + STDMETHOD(UnlockBox)(THIS) PURE; +}; + +typedef struct IDirect3DVolume9 *LPDIRECT3DVOLUME9, *PDIRECT3DVOLUME9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DVolume9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DVolume9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DVolume9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d) +#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c) +#define IDirect3DVolume9_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a) +#define IDirect3DVolume9_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b) +#define IDirect3DVolume9_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) +#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->lpVtbl->LockBox(p,a,b,c) +#define IDirect3DVolume9_UnlockBox(p) (p)->lpVtbl->UnlockBox(p) +#else +#define IDirect3DVolume9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DVolume9_AddRef(p) (p)->AddRef() +#define IDirect3DVolume9_Release(p) (p)->Release() +#define IDirect3DVolume9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DVolume9_SetPrivateData(p,a,b,c,d) (p)->SetPrivateData(a,b,c,d) +#define IDirect3DVolume9_GetPrivateData(p,a,b,c) (p)->GetPrivateData(a,b,c) +#define IDirect3DVolume9_FreePrivateData(p,a) (p)->FreePrivateData(a) +#define IDirect3DVolume9_GetContainer(p,a,b) (p)->GetContainer(a,b) +#define IDirect3DVolume9_GetDesc(p,a) (p)->GetDesc(a) +#define IDirect3DVolume9_LockBox(p,a,b,c) (p)->LockBox(a,b,c) +#define IDirect3DVolume9_UnlockBox(p) (p)->UnlockBox() +#endif + + + +#undef INTERFACE +#define INTERFACE IDirect3DQuery9 + +DECLARE_INTERFACE_(IDirect3DQuery9, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + + /*** IDirect3DQuery9 methods ***/ + STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE; + STDMETHOD_(D3DQUERYTYPE, GetType)(THIS) PURE; + STDMETHOD_(DWORD, GetDataSize)(THIS) PURE; + STDMETHOD(Issue)(THIS_ DWORD dwIssueFlags) PURE; + STDMETHOD(GetData)(THIS_ void* pData,DWORD dwSize,DWORD dwGetDataFlags) PURE; +}; + +typedef struct IDirect3DQuery9 *LPDIRECT3DQUERY9, *PDIRECT3DQUERY9; + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IDirect3DQuery9_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IDirect3DQuery9_Release(p) (p)->lpVtbl->Release(p) +#define IDirect3DQuery9_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) +#define IDirect3DQuery9_GetType(p) (p)->lpVtbl->GetType(p) +#define IDirect3DQuery9_GetDataSize(p) (p)->lpVtbl->GetDataSize(p) +#define IDirect3DQuery9_Issue(p,a) (p)->lpVtbl->Issue(p,a) +#define IDirect3DQuery9_GetData(p,a,b,c) (p)->lpVtbl->GetData(p,a,b,c) +#else +#define IDirect3DQuery9_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IDirect3DQuery9_AddRef(p) (p)->AddRef() +#define IDirect3DQuery9_Release(p) (p)->Release() +#define IDirect3DQuery9_GetDevice(p,a) (p)->GetDevice(a) +#define IDirect3DQuery9_GetType(p) (p)->GetType() +#define IDirect3DQuery9_GetDataSize(p) (p)->GetDataSize() +#define IDirect3DQuery9_Issue(p,a) (p)->Issue(a) +#define IDirect3DQuery9_GetData(p,a,b,c) (p)->GetData(a,b,c) +#endif + + +/**************************************************************************** + * Flags for SetPrivateData method on all D3D9 interfaces + * + * The passed pointer is an IUnknown ptr. The SizeOfData argument to SetPrivateData + * must be set to sizeof(IUnknown*). Direct3D will call AddRef through this + * pointer and Release when the private data is destroyed. The data will be + * destroyed when another SetPrivateData with the same GUID is set, when + * FreePrivateData is called, or when the D3D9 object is freed. + ****************************************************************************/ +#define D3DSPD_IUNKNOWN 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3D9::CreateDevice's BehaviorFlags + * + ****************************************************************************/ + +#define D3DCREATE_FPU_PRESERVE 0x00000002L +#define D3DCREATE_MULTITHREADED 0x00000004L + +#define D3DCREATE_PUREDEVICE 0x00000010L +#define D3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020L +#define D3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040L +#define D3DCREATE_MIXED_VERTEXPROCESSING 0x00000080L + +#define D3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100L +#define D3DCREATE_ADAPTERGROUP_DEVICE 0x00000200L + + +/**************************************************************************** + * + * Parameter for IDirect3D9::CreateDevice's iAdapter + * + ****************************************************************************/ + +#define D3DADAPTER_DEFAULT 0 + +/**************************************************************************** + * + * Flags for IDirect3D9::EnumAdapters + * + ****************************************************************************/ + +#define D3DENUM_WHQL_LEVEL 0x00000002L + +/**************************************************************************** + * + * Maximum number of back-buffers supported in DX8 + * + ****************************************************************************/ + +#define D3DPRESENT_BACK_BUFFERS_MAX 3L + +/**************************************************************************** + * + * Flags for IDirect3DDevice9::SetGammaRamp + * + ****************************************************************************/ + +#define D3DSGR_NO_CALIBRATION 0x00000000L +#define D3DSGR_CALIBRATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DDevice9::SetCursorPosition + * + ****************************************************************************/ + +#define D3DCURSOR_IMMEDIATE_UPDATE 0x00000001L + +/**************************************************************************** + * + * Flags for IDirect3DSwapChain9::Present + * + ****************************************************************************/ + +#define D3DPRESENT_DONOTWAIT 0x00000001L +#define D3DPRESENT_LINEAR_CONTENT 0x00000002L + +/**************************************************************************** + * + * Flags for DrawPrimitive/DrawIndexedPrimitive + * Also valid for Begin/BeginIndexed + * Also valid for VertexBuffer::CreateVertexBuffer + ****************************************************************************/ + + +/* + * DirectDraw error codes + */ +#define _FACD3D 0x876 +#define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code ) +#define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code ) + +/* + * Direct3D Errors + */ +#define D3D_OK S_OK + +#define D3DERR_WRONGTEXTUREFORMAT MAKE_D3DHRESULT(2072) +#define D3DERR_UNSUPPORTEDCOLOROPERATION MAKE_D3DHRESULT(2073) +#define D3DERR_UNSUPPORTEDCOLORARG MAKE_D3DHRESULT(2074) +#define D3DERR_UNSUPPORTEDALPHAOPERATION MAKE_D3DHRESULT(2075) +#define D3DERR_UNSUPPORTEDALPHAARG MAKE_D3DHRESULT(2076) +#define D3DERR_TOOMANYOPERATIONS MAKE_D3DHRESULT(2077) +#define D3DERR_CONFLICTINGTEXTUREFILTER MAKE_D3DHRESULT(2078) +#define D3DERR_UNSUPPORTEDFACTORVALUE MAKE_D3DHRESULT(2079) +#define D3DERR_CONFLICTINGRENDERSTATE MAKE_D3DHRESULT(2081) +#define D3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_D3DHRESULT(2082) +#define D3DERR_CONFLICTINGTEXTUREPALETTE MAKE_D3DHRESULT(2086) +#define D3DERR_DRIVERINTERNALERROR MAKE_D3DHRESULT(2087) + +#define D3DERR_NOTFOUND MAKE_D3DHRESULT(2150) +#define D3DERR_MOREDATA MAKE_D3DHRESULT(2151) +#define D3DERR_DEVICELOST MAKE_D3DHRESULT(2152) +#define D3DERR_DEVICENOTRESET MAKE_D3DHRESULT(2153) +#define D3DERR_NOTAVAILABLE MAKE_D3DHRESULT(2154) +#define D3DERR_OUTOFVIDEOMEMORY MAKE_D3DHRESULT(380) +#define D3DERR_INVALIDDEVICE MAKE_D3DHRESULT(2155) +#define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156) +#define D3DERR_DRIVERINVALIDCALL MAKE_D3DHRESULT(2157) +#define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540) +#define D3DOK_NOAUTOGEN MAKE_D3DSTATUS(2159) + + +#ifdef __cplusplus +}; +#endif + +#endif /* (DIRECT3D_VERSION >= 0x0900) */ +#endif /* _D3D_H_ */ + diff --git a/d3d9proxy/d3dx9.h b/d3d9proxy/d3dx9.h new file mode 100644 index 0000000..cbaabcf --- /dev/null +++ b/d3d9proxy/d3dx9.h @@ -0,0 +1,71 @@ +////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) Microsoft Corporation. All Rights Reserved. +// +// File: d3dx9.h +// Content: D3DX utility library +// +////////////////////////////////////////////////////////////////////////////// + +#ifdef __D3DX_INTERNAL__ +#error Incorrect D3DX header used +#endif + +#ifndef __D3DX9_H__ +#define __D3DX9_H__ + + +// Defines +#include + +#define D3DX_DEFAULT ((UINT) -1) +#define D3DX_DEFAULT_NONPOW2 ((UINT) -2) +#define D3DX_DEFAULT_FLOAT FLT_MAX + +#ifndef D3DXINLINE +#ifdef _MSC_VER + #if (_MSC_VER >= 1200) + #define D3DXINLINE __forceinline + #else + #define D3DXINLINE __inline + #endif +#else + #ifdef __cplusplus + #define D3DXINLINE inline + #else + #define D3DXINLINE + #endif +#endif +#endif + + +// Includes +#include "d3d9.h" +#include "d3dx9math.h" +#include "d3dx9core.h" +#include "d3dx9mesh.h" +#include "d3dx9tex.h" +#include "d3dx9shader.h" +#include "d3dx9effect.h" +#include "d3dx9shape.h" +#include "d3dx9anim.h" + + +// Errors +#define _FACDD 0x876 +#define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code ) + +enum _D3DXERR { + D3DXERR_CANNOTMODIFYINDEXBUFFER = MAKE_DDHRESULT(2900), + D3DXERR_INVALIDMESH = MAKE_DDHRESULT(2901), + D3DXERR_CANNOTATTRSORT = MAKE_DDHRESULT(2902), + D3DXERR_SKINNINGNOTSUPPORTED = MAKE_DDHRESULT(2903), + D3DXERR_TOOMANYINFLUENCES = MAKE_DDHRESULT(2904), + D3DXERR_INVALIDDATA = MAKE_DDHRESULT(2905), + D3DXERR_LOADEDMESHASNODATA = MAKE_DDHRESULT(2906), + D3DXERR_DUPLICATENAMEDFRAGMENT = MAKE_DDHRESULT(2907), +}; + + +#endif //__D3DX9_H__ + diff --git a/d3d9proxy/d3dx9.lib b/d3d9proxy/d3dx9.lib new file mode 100644 index 0000000..11853bf Binary files /dev/null and b/d3d9proxy/d3dx9.lib differ diff --git a/d3d9proxy/myIDirect3D9.cpp b/d3d9proxy/myIDirect3D9.cpp new file mode 100644 index 0000000..3157cc6 --- /dev/null +++ b/d3d9proxy/myIDirect3D9.cpp @@ -0,0 +1,154 @@ +// myIDirect3D9.cpp + +#include "StdAfx.h" +#include "stdio.h" + +#define trace if(log) fprintf + +extern FILE *log; + +myIDirect3D9::myIDirect3D9(IDirect3D9 *pOriginal) +{ + m_pIDirect3D9 = pOriginal; +} + +myIDirect3D9::~myIDirect3D9(void) +{ +} + +HRESULT __stdcall myIDirect3D9::QueryInterface(REFIID riid, void** ppvObj) +{ + *ppvObj = NULL; + + // call this to increase AddRef at original object + // and to check if such an interface is there + + HRESULT hRes = m_pIDirect3D9->QueryInterface(riid, ppvObj); + + if (hRes == NOERROR) // if OK, send our "fake" address + { + *ppvObj = this; + } + + return hRes; +} + +ULONG __stdcall myIDirect3D9::AddRef(void) +{ + return(m_pIDirect3D9->AddRef()); +} + +ULONG __stdcall myIDirect3D9::Release(void) +{ + extern myIDirect3D9* gl_pmyIDirect3D9; + + // call original routine + ULONG count = m_pIDirect3D9->Release(); + + // in case no further Ref is there, the Original Object has deleted itself + // so do we here + if (count == 0){ + gl_pmyIDirect3D9 = NULL; + delete(this); + } + + return(count); +} + +HRESULT __stdcall myIDirect3D9::RegisterSoftwareDevice(void* pInitializeFunction) +{ + trace(log, "IDirect3D9::RegisterSoftwareDevice\n"); + return(m_pIDirect3D9->RegisterSoftwareDevice(pInitializeFunction)); +} + +UINT __stdcall myIDirect3D9::GetAdapterCount(void) +{ + trace(log, "IDirect3D9::GetAdapterCount\n"); + return(m_pIDirect3D9->GetAdapterCount()); +} + +HRESULT __stdcall myIDirect3D9::GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) +{ + trace(log, "IDirect3D9::GetAdapterIdentifier\n"); + return(m_pIDirect3D9->GetAdapterIdentifier(Adapter,Flags,pIdentifier)); +} + +UINT __stdcall myIDirect3D9::GetAdapterModeCount(UINT Adapter, D3DFORMAT Format) +{ + trace(log, "IDirect3D9::GetAdapterModeCount\n"); + return(m_pIDirect3D9->GetAdapterModeCount(Adapter, Format)); +} + +HRESULT __stdcall myIDirect3D9::EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) +{ + trace(log, "IDirect3D9::EnumAdapterModes\n"); + return(m_pIDirect3D9->EnumAdapterModes(Adapter,Format,Mode,pMode)); +} + +HRESULT __stdcall myIDirect3D9::GetAdapterDisplayMode( UINT Adapter,D3DDISPLAYMODE* pMode) +{ + trace(log, "IDirect3D9::GetAdapterDisplayMode\n"); + return(m_pIDirect3D9->GetAdapterDisplayMode(Adapter,pMode)); +} + +HRESULT __stdcall myIDirect3D9::CheckDeviceType(UINT iAdapter,D3DDEVTYPE DevType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) +{ + trace(log, "IDirect3D9::CheckDeviceType\n"); + return(m_pIDirect3D9->CheckDeviceType(iAdapter,DevType,DisplayFormat,BackBufferFormat,bWindowed)); +} + +HRESULT __stdcall myIDirect3D9::CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) +{ + trace(log, "IDirect3D9::CheckDeviceFormat\n"); + return(m_pIDirect3D9->CheckDeviceFormat(Adapter,DeviceType,AdapterFormat,Usage,RType,CheckFormat)); +} + +HRESULT __stdcall myIDirect3D9::CheckDeviceMultiSampleType(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) +{ + trace(log, "IDirect3D9::CheckDeviceMultiSampleType\n"); + return(m_pIDirect3D9->CheckDeviceMultiSampleType(Adapter,DeviceType,SurfaceFormat,Windowed,MultiSampleType,pQualityLevels)); +} + +HRESULT __stdcall myIDirect3D9::CheckDepthStencilMatch(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) +{ + trace(log, "IDirect3D9::CheckDepthStencilMatch\n"); + return(m_pIDirect3D9->CheckDepthStencilMatch(Adapter,DeviceType,AdapterFormat,RenderTargetFormat,DepthStencilFormat)); +} + +HRESULT __stdcall myIDirect3D9::CheckDeviceFormatConversion(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) +{ + trace(log, "IDirect3D9::CheckDeviceFormatConversion\n"); + return(m_pIDirect3D9->CheckDeviceFormatConversion(Adapter,DeviceType,SourceFormat,TargetFormat)); +} + +HRESULT __stdcall myIDirect3D9::GetDeviceCaps(UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) +{ + trace(log, "IDirect3D9::GetDeviceCaps\n"); + return(m_pIDirect3D9->GetDeviceCaps(Adapter,DeviceType,pCaps)); +} + +HMONITOR __stdcall myIDirect3D9::GetAdapterMonitor(UINT Adapter) +{ + trace(log, "IDirect3D9::GetAdapterMonitor\n"); + return(m_pIDirect3D9->GetAdapterMonitor(Adapter)); +} + +HRESULT __stdcall myIDirect3D9::CreateDevice(UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) +{ + trace(log, "IDirect3D9::CreateDevice\n"); + // global var + extern myIDirect3DDevice9* gl_pmyIDirect3DDevice9; + + // we intercept this call and provide our own "fake" Device Object + HRESULT hres = m_pIDirect3D9->CreateDevice( Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface); + + // Create our own Device object and store it in global pointer + // note: the object will delete itself once Ref count is zero (similar to COM objects) + gl_pmyIDirect3DDevice9 = new myIDirect3DDevice9(*ppReturnedDeviceInterface); + + // store our pointer (the fake one) for returning it to the calling progam + *ppReturnedDeviceInterface = gl_pmyIDirect3DDevice9; + + return(hres); +} + diff --git a/d3d9proxy/myIDirect3D9.h b/d3d9proxy/myIDirect3D9.h new file mode 100644 index 0000000..11ef823 --- /dev/null +++ b/d3d9proxy/myIDirect3D9.h @@ -0,0 +1,31 @@ +#pragma once + +class myIDirect3D9 : public IDirect3D9 +{ +public: + myIDirect3D9(IDirect3D9 *pOriginal); + virtual ~myIDirect3D9(void); + + // The original DX9 function definitions + HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj); + ULONG __stdcall AddRef(void); + ULONG __stdcall Release(void); + HRESULT __stdcall RegisterSoftwareDevice(void* pInitializeFunction); + UINT __stdcall GetAdapterCount(void); + HRESULT __stdcall GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) ; + UINT __stdcall GetAdapterModeCount(UINT Adapter, D3DFORMAT Format); + HRESULT __stdcall EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) ; + HRESULT __stdcall GetAdapterDisplayMode( UINT Adapter,D3DDISPLAYMODE* pMode) ; + HRESULT __stdcall CheckDeviceType(UINT iAdapter,D3DDEVTYPE DevType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) ; + HRESULT __stdcall CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) ; + HRESULT __stdcall CheckDeviceMultiSampleType(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) ; + HRESULT __stdcall CheckDepthStencilMatch(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) ; + HRESULT __stdcall CheckDeviceFormatConversion(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat); + HRESULT __stdcall GetDeviceCaps(UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) ; + HMONITOR __stdcall GetAdapterMonitor(UINT Adapter) ; + HRESULT __stdcall CreateDevice(UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) ; + // The original DX9 function definitions + +private: + IDirect3D9 *m_pIDirect3D9; +}; diff --git a/d3d9proxy/myIDirect3DDevice9.cpp b/d3d9proxy/myIDirect3DDevice9.cpp new file mode 100644 index 0000000..876b25a --- /dev/null +++ b/d3d9proxy/myIDirect3DDevice9.cpp @@ -0,0 +1,776 @@ +#include "StdAfx.h" +#include "myIDirect3DDevice9.h" +#include "stdio.h" + +#define trace if(log) fprintf + +extern FILE *log; + +myIDirect3DDevice9::myIDirect3DDevice9(IDirect3DDevice9* pOriginal) +{ + m_pIDirect3DDevice9 = pOriginal; // store the pointer to original object +} + +myIDirect3DDevice9::~myIDirect3DDevice9(void) +{ +} + +HRESULT myIDirect3DDevice9::QueryInterface (REFIID riid, void** ppvObj) +{ + trace(log, "IDirect3DDevice9::QueryInterface\n"); + // check if original dll can provide interface. then send *our* address + *ppvObj = NULL; + + HRESULT hRes = m_pIDirect3DDevice9->QueryInterface(riid, ppvObj); + + if (hRes == NOERROR) + { + *ppvObj = this; + } + + return hRes; +} + +ULONG myIDirect3DDevice9::AddRef(void) +{ + trace(log, "IDirect3DDevice9::AddRef\n"); + return(m_pIDirect3DDevice9->AddRef()); +} + +ULONG myIDirect3DDevice9::Release(void) +{ + trace(log, "IDirect3DDevice9::Release\n"); + // ATTENTION: This is a booby-trap ! Watch out ! + // If we create our own sprites, surfaces, etc. (thus increasing the ref counter + // by external action), we need to delete that objects before calling the original + // Release function + + // global var + extern myIDirect3DDevice9* gl_pmyIDirect3DDevice9; + + // release/delete own objects + // ..... + + // Calling original function now + ULONG count = m_pIDirect3DDevice9->Release(); + + // now, the Original Object has deleted itself, so do we here + if(count == 0){ + gl_pmyIDirect3DDevice9 = NULL; + delete(this); // destructor will be called automatically + } + + return (count); +} + +HRESULT myIDirect3DDevice9::TestCooperativeLevel(void) +{ + trace(log, "IDirect3DDevice9::TestCooperativeLevel\n"); + return(m_pIDirect3DDevice9->TestCooperativeLevel()); +} + +UINT myIDirect3DDevice9::GetAvailableTextureMem(void) +{ + trace(log, "IDirect3DDevice9::GetAvailableTextureMem\n"); + return(m_pIDirect3DDevice9->GetAvailableTextureMem()); +} + +HRESULT myIDirect3DDevice9::EvictManagedResources(void) +{ + trace(log, "IDirect3DDevice9::EvictManagedResources\n"); + return(m_pIDirect3DDevice9->EvictManagedResources()); +} + +HRESULT myIDirect3DDevice9::GetDirect3D(IDirect3D9** ppD3D9) +{ + trace(log, "IDirect3DDevice9::GetDirect3D\n"); + return(m_pIDirect3DDevice9->GetDirect3D(ppD3D9)); +} + +HRESULT myIDirect3DDevice9::GetDeviceCaps(D3DCAPS9* pCaps) +{ + trace(log, "IDirect3DDevice9::GetDeviceCaps\n"); + return(m_pIDirect3DDevice9->GetDeviceCaps(pCaps)); +} + +HRESULT myIDirect3DDevice9::GetDisplayMode(UINT iSwapChain,D3DDISPLAYMODE* pMode) +{ + trace(log, "IDirect3DDevice9::GetDisplayMode\n"); + return(m_pIDirect3DDevice9->GetDisplayMode(iSwapChain, pMode)); +} + +HRESULT myIDirect3DDevice9::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters) +{ + trace(log, "IDirect3DDevice9::GetCreationParameters\n"); + return(m_pIDirect3DDevice9->GetCreationParameters(pParameters)); +} + +HRESULT myIDirect3DDevice9::SetCursorProperties(UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) +{ + trace(log, "IDirect3DDevice9::SetCursorProperties\n"); + return(m_pIDirect3DDevice9->SetCursorProperties(XHotSpot,YHotSpot,pCursorBitmap)); +} + +void myIDirect3DDevice9::SetCursorPosition(int X,int Y,DWORD Flags) +{ + trace(log, "IDirect3DDevice9::SetCursorPosition\n"); + return(m_pIDirect3DDevice9->SetCursorPosition(X,Y,Flags)); +} + +BOOL myIDirect3DDevice9::ShowCursor(BOOL bShow) +{ + trace(log, "IDirect3DDevice9::ShowCursor\n"); + return(m_pIDirect3DDevice9->ShowCursor(bShow)); +} + +HRESULT myIDirect3DDevice9::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) +{ + trace(log, "IDirect3DDevice9::CreateAdditionalSwapChain\n"); + return(m_pIDirect3DDevice9->CreateAdditionalSwapChain(pPresentationParameters,pSwapChain)); +} + +HRESULT myIDirect3DDevice9::GetSwapChain(UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) +{ + trace(log, "IDirect3DDevice9::GetSwapChain\n"); + return(m_pIDirect3DDevice9->GetSwapChain(iSwapChain,pSwapChain)); +} + +UINT myIDirect3DDevice9::GetNumberOfSwapChains(void) +{ + trace(log, "IDirect3DDevice9::GetNumberOfSwapChains\n"); + return(m_pIDirect3DDevice9->GetNumberOfSwapChains()); +} + +HRESULT myIDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters) +{ + trace(log, "IDirect3DDevice9::Reset\n"); + return(m_pIDirect3DDevice9->Reset(pPresentationParameters)); +} + +HRESULT myIDirect3DDevice9::Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) +{ + trace(log, "IDirect3DDevice9::Present\n"); + // we may want to draw own things here before flipping surfaces + // ... draw own stuff ... + // this->ShowWeAreHere(); + + // call original routine + HRESULT hres = m_pIDirect3DDevice9->Present( pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); + + return (hres); +} + +HRESULT myIDirect3DDevice9::GetBackBuffer(UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) +{ + trace(log, "IDirect3DDevice9::GetBackBuffer\n"); + return(m_pIDirect3DDevice9->GetBackBuffer(iSwapChain,iBackBuffer,Type,ppBackBuffer)); +} + +HRESULT myIDirect3DDevice9::GetRasterStatus(UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) +{ + trace(log, "IDirect3DDevice9::GetRasterStatus\n"); + return(m_pIDirect3DDevice9->GetRasterStatus(iSwapChain,pRasterStatus)); +} + +HRESULT myIDirect3DDevice9::SetDialogBoxMode(BOOL bEnableDialogs) +{ + trace(log, "IDirect3DDevice9::SetDialogBoxMode\n"); + return(m_pIDirect3DDevice9->SetDialogBoxMode(bEnableDialogs)); +} + +void myIDirect3DDevice9::SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) +{ + trace(log, "IDirect3DDevice9::SetGammaRamp\n"); + return(m_pIDirect3DDevice9->SetGammaRamp(iSwapChain,Flags,pRamp)); +} + +void myIDirect3DDevice9::GetGammaRamp(UINT iSwapChain,D3DGAMMARAMP* pRamp) +{ + trace(log, "IDirect3DDevice9::GetGammaRamp\n"); + return(m_pIDirect3DDevice9->GetGammaRamp(iSwapChain,pRamp)); +} + +HRESULT myIDirect3DDevice9::CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) +{ + trace(log, "IDirect3DDevice9::CreateTexture\n"); + return(m_pIDirect3DDevice9->CreateTexture(Width,Height,Levels,Usage,Format,Pool,ppTexture,pSharedHandle)); +} + +HRESULT myIDirect3DDevice9::CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) +{ + trace(log, "IDirect3DDevice9::CreateVolumeTexture\n"); + return(m_pIDirect3DDevice9->CreateVolumeTexture(Width,Height,Depth,Levels,Usage,Format,Pool,ppVolumeTexture,pSharedHandle)); +} + +HRESULT myIDirect3DDevice9::CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) +{ + trace(log, "IDirect3DDevice9::CreateCubeTexture\n"); + return(m_pIDirect3DDevice9->CreateCubeTexture(EdgeLength,Levels,Usage,Format,Pool,ppCubeTexture,pSharedHandle)); +} + +HRESULT myIDirect3DDevice9::CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) +{ + trace(log, "IDirect3DDevice9::CreateVertexBuffer\n"); + return(m_pIDirect3DDevice9->CreateVertexBuffer(Length,Usage,FVF,Pool,ppVertexBuffer,pSharedHandle)); +} + +HRESULT myIDirect3DDevice9::CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) +{ + trace(log, "IDirect3DDevice9::CreateIndexBuffer\n"); + return(m_pIDirect3DDevice9->CreateIndexBuffer(Length,Usage,Format,Pool,ppIndexBuffer,pSharedHandle)); +} + +HRESULT myIDirect3DDevice9::CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) +{ + trace(log, "IDirect3DDevice9::CreateRenderTarget\n"); + return(m_pIDirect3DDevice9->CreateRenderTarget(Width,Height,Format,MultiSample,MultisampleQuality,Lockable,ppSurface,pSharedHandle)); +} + +HRESULT myIDirect3DDevice9::CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) +{ + trace(log, "IDirect3DDevice9::CreateDepthStencilSurface\n"); + return(m_pIDirect3DDevice9->CreateDepthStencilSurface(Width,Height,Format,MultiSample,MultisampleQuality,Discard,ppSurface,pSharedHandle)); +} + +HRESULT myIDirect3DDevice9::UpdateSurface(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) +{ + trace(log, "IDirect3DDevice9::UpdateSurface\n"); + return(m_pIDirect3DDevice9->UpdateSurface(pSourceSurface,pSourceRect,pDestinationSurface,pDestPoint)); +} + +HRESULT myIDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) +{ + trace(log, "IDirect3DDevice9::UpdateTexture\n"); + return(m_pIDirect3DDevice9->UpdateTexture(pSourceTexture,pDestinationTexture)); +} + +HRESULT myIDirect3DDevice9::GetRenderTargetData(IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) +{ + trace(log, "IDirect3DDevice9::GetRenderTargetData\n"); + return(m_pIDirect3DDevice9->GetRenderTargetData(pRenderTarget,pDestSurface)); +} + +HRESULT myIDirect3DDevice9::GetFrontBufferData(UINT iSwapChain,IDirect3DSurface9* pDestSurface) +{ + trace(log, "IDirect3DDevice9::GetFrontBufferData\n"); + return(m_pIDirect3DDevice9->GetFrontBufferData(iSwapChain,pDestSurface)); +} + +HRESULT myIDirect3DDevice9::StretchRect(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) +{ + trace(log, "IDirect3DDevice9::StretchRect\n"); + return(m_pIDirect3DDevice9->StretchRect(pSourceSurface,pSourceRect,pDestSurface,pDestRect,Filter)); +} + +HRESULT myIDirect3DDevice9::ColorFill(IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) +{ + trace(log, "IDirect3DDevice9::ColorFill\n"); + return(m_pIDirect3DDevice9->ColorFill(pSurface,pRect,color)); +} + +HRESULT myIDirect3DDevice9::CreateOffscreenPlainSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) +{ + trace(log, "IDirect3DDevice9::CreateOffscreenPlainSurface\n"); + return(m_pIDirect3DDevice9->CreateOffscreenPlainSurface(Width,Height,Format,Pool,ppSurface,pSharedHandle)); +} + +HRESULT myIDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) +{ + trace(log, "IDirect3DDevice9::SetRenderTarget\n"); + return(m_pIDirect3DDevice9->SetRenderTarget(RenderTargetIndex,pRenderTarget)); +} + +HRESULT myIDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) +{ + trace(log, "IDirect3DDevice9::GetRenderTarget\n"); + return(m_pIDirect3DDevice9->GetRenderTarget(RenderTargetIndex,ppRenderTarget)); +} + +HRESULT myIDirect3DDevice9::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil) +{ + trace(log, "IDirect3DDevice9::SetDepthStencilSurface\n"); + return(m_pIDirect3DDevice9->SetDepthStencilSurface(pNewZStencil)); +} + +HRESULT myIDirect3DDevice9::GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface) +{ + trace(log, "IDirect3DDevice9::GetDepthStencilSurface\n"); + return(m_pIDirect3DDevice9->GetDepthStencilSurface(ppZStencilSurface)); +} + +HRESULT myIDirect3DDevice9::BeginScene(void) +{ + trace(log, "IDirect3DDevice9::BeginScene\n"); + return(m_pIDirect3DDevice9->BeginScene()); +} + +HRESULT myIDirect3DDevice9::EndScene(void) +{ + trace(log, "IDirect3DDevice9::EndScene\n"); + return(m_pIDirect3DDevice9->EndScene()); +} + +HRESULT myIDirect3DDevice9::Clear(DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) +{ + trace(log, "IDirect3DDevice9::Clear\n"); + return(m_pIDirect3DDevice9->Clear(Count,pRects,Flags,Color,Z,Stencil)); +} + +HRESULT myIDirect3DDevice9::SetTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) +{ + trace(log, "IDirect3DDevice9::SetTransform\n"); + return(m_pIDirect3DDevice9->SetTransform(State,pMatrix)); +} + +HRESULT myIDirect3DDevice9::GetTransform(D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) +{ + trace(log, "IDirect3DDevice9::GetTransform\n"); + return(m_pIDirect3DDevice9->GetTransform(State,pMatrix)); +} + +HRESULT myIDirect3DDevice9::MultiplyTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) +{ + trace(log, "IDirect3DDevice9::MultiplyTransform\n"); + return(m_pIDirect3DDevice9->MultiplyTransform(State,pMatrix)); +} + +HRESULT myIDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9* pViewport) +{ + trace(log, "IDirect3DDevice9::SetViewport\n"); + return(m_pIDirect3DDevice9->SetViewport(pViewport)); +} + +HRESULT myIDirect3DDevice9::GetViewport(D3DVIEWPORT9* pViewport) +{ + trace(log, "IDirect3DDevice9::GetViewport\n"); + return(m_pIDirect3DDevice9->GetViewport(pViewport)); +} + +HRESULT myIDirect3DDevice9::SetMaterial(CONST D3DMATERIAL9* pMaterial) +{ + trace(log, "IDirect3DDevice9::SetMaterial\n"); + return(m_pIDirect3DDevice9->SetMaterial(pMaterial)); +} + +HRESULT myIDirect3DDevice9::GetMaterial(D3DMATERIAL9* pMaterial) +{ + trace(log, "IDirect3DDevice9::GetMaterial\n"); + return(m_pIDirect3DDevice9->GetMaterial(pMaterial)); +} + +HRESULT myIDirect3DDevice9::SetLight(DWORD Index,CONST D3DLIGHT9* pLight) +{ + trace(log, "IDirect3DDevice9::SetLight\n"); + return(m_pIDirect3DDevice9->SetLight(Index,pLight)); +} + +HRESULT myIDirect3DDevice9::GetLight(DWORD Index,D3DLIGHT9* pLight) +{ + trace(log, "IDirect3DDevice9::GetLight\n"); + return(m_pIDirect3DDevice9->GetLight(Index,pLight)); +} + +HRESULT myIDirect3DDevice9::LightEnable(DWORD Index,BOOL Enable) +{ + trace(log, "IDirect3DDevice9::LightEnable\n"); + return(m_pIDirect3DDevice9->LightEnable(Index,Enable)); +} + +HRESULT myIDirect3DDevice9::GetLightEnable(DWORD Index,BOOL* pEnable) +{ + trace(log, "IDirect3DDevice9::GetLightEnable\n"); + return(m_pIDirect3DDevice9->GetLightEnable(Index, pEnable)); +} + +HRESULT myIDirect3DDevice9::SetClipPlane(DWORD Index,CONST float* pPlane) +{ + trace(log, "IDirect3DDevice9::SetClipPlane\n"); + return(m_pIDirect3DDevice9->SetClipPlane(Index, pPlane)); +} + +HRESULT myIDirect3DDevice9::GetClipPlane(DWORD Index,float* pPlane) +{ + trace(log, "IDirect3DDevice9::GetClipPlane\n"); + return(m_pIDirect3DDevice9->GetClipPlane(Index,pPlane)); +} + +HRESULT myIDirect3DDevice9::SetRenderState(D3DRENDERSTATETYPE State,DWORD Value) +{ + //trace(log, "IDirect3DDevice9::SetRenderState\n"); + return(m_pIDirect3DDevice9->SetRenderState(State, Value)); +} + +HRESULT myIDirect3DDevice9::GetRenderState(D3DRENDERSTATETYPE State,DWORD* pValue) +{ + trace(log, "IDirect3DDevice9::GetRenderState\n"); + return(m_pIDirect3DDevice9->GetRenderState(State, pValue)); +} + +HRESULT myIDirect3DDevice9::CreateStateBlock(D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) +{ + trace(log, "IDirect3DDevice9::CreateStateBlock\n"); + return(m_pIDirect3DDevice9->CreateStateBlock(Type,ppSB)); +} + +HRESULT myIDirect3DDevice9::BeginStateBlock(void) +{ + trace(log, "IDirect3DDevice9::BeginStateBlock\n"); + return(m_pIDirect3DDevice9->BeginStateBlock()); +} + +HRESULT myIDirect3DDevice9::EndStateBlock(IDirect3DStateBlock9** ppSB) +{ + trace(log, "IDirect3DDevice9::EndStateBlock\n"); + return(m_pIDirect3DDevice9->EndStateBlock(ppSB)); +} + +HRESULT myIDirect3DDevice9::SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus) +{ + trace(log, "IDirect3DDevice9::SetClipStatus\n"); + return(m_pIDirect3DDevice9->SetClipStatus(pClipStatus)); +} + +HRESULT myIDirect3DDevice9::GetClipStatus(D3DCLIPSTATUS9* pClipStatus) +{ + trace(log, "IDirect3DDevice9::GetClipStatus\n"); + return(m_pIDirect3DDevice9->GetClipStatus( pClipStatus)); +} + +HRESULT myIDirect3DDevice9::GetTexture(DWORD Stage,IDirect3DBaseTexture9** ppTexture) +{ + trace(log, "IDirect3DDevice9::GetTexture\n"); + return(m_pIDirect3DDevice9->GetTexture(Stage,ppTexture)); +} + +HRESULT myIDirect3DDevice9::SetTexture(DWORD Stage,IDirect3DBaseTexture9* pTexture) +{ + trace(log, "IDirect3DDevice9::SetTexture\n"); + return(m_pIDirect3DDevice9->SetTexture(Stage,pTexture)); +} + +HRESULT myIDirect3DDevice9::GetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) +{ + trace(log, "IDirect3DDevice9::GetTextureStageState\n"); + return(m_pIDirect3DDevice9->GetTextureStageState(Stage,Type, pValue)); +} + +HRESULT myIDirect3DDevice9::SetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) +{ + trace(log, "IDirect3DDevice9::SetTextureStageState\n"); + return(m_pIDirect3DDevice9->SetTextureStageState(Stage,Type,Value)); +} + +HRESULT myIDirect3DDevice9::GetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) +{ + trace(log, "IDirect3DDevice9::GetSamplerState\n"); + return(m_pIDirect3DDevice9->GetSamplerState(Sampler,Type, pValue)); +} + +HRESULT myIDirect3DDevice9::SetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) +{ + trace(log, "IDirect3DDevice9::SetSamplerState\n"); + return(m_pIDirect3DDevice9->SetSamplerState(Sampler,Type,Value)); +} + +HRESULT myIDirect3DDevice9::ValidateDevice(DWORD* pNumPasses) +{ + trace(log, "IDirect3DDevice9::ValidateDevice\n"); + return(m_pIDirect3DDevice9->ValidateDevice( pNumPasses)); +} + +HRESULT myIDirect3DDevice9::SetPaletteEntries(UINT PaletteNumber,CONST PALETTEENTRY* pEntries) +{ + trace(log, "IDirect3DDevice9::SetPaletteEntries\n"); + return(m_pIDirect3DDevice9->SetPaletteEntries(PaletteNumber, pEntries)); +} + +HRESULT myIDirect3DDevice9::GetPaletteEntries(UINT PaletteNumber,PALETTEENTRY* pEntries) +{ + trace(log, "IDirect3DDevice9::GetPaletteEntries\n"); + return(m_pIDirect3DDevice9->GetPaletteEntries(PaletteNumber, pEntries)); +} + +HRESULT myIDirect3DDevice9::SetCurrentTexturePalette(UINT PaletteNumber) +{ + trace(log, "IDirect3DDevice9::SetCurrentTexturePalette\n"); + return(m_pIDirect3DDevice9->SetCurrentTexturePalette(PaletteNumber)); +} + +HRESULT myIDirect3DDevice9::GetCurrentTexturePalette(UINT *PaletteNumber) +{ + trace(log, "IDirect3DDevice9::GetCurrentTexturePalette\n"); + return(m_pIDirect3DDevice9->GetCurrentTexturePalette(PaletteNumber)); +} + +HRESULT myIDirect3DDevice9::SetScissorRect(CONST RECT* pRect) +{ + trace(log, "IDirect3DDevice9::SetScissorRect\n"); + return(m_pIDirect3DDevice9->SetScissorRect( pRect)); +} + +HRESULT myIDirect3DDevice9::GetScissorRect( RECT* pRect) +{ + trace(log, "IDirect3DDevice9::GetScissorRect\n"); + return(m_pIDirect3DDevice9->GetScissorRect( pRect)); +} + +HRESULT myIDirect3DDevice9::SetSoftwareVertexProcessing(BOOL bSoftware) +{ + trace(log, "IDirect3DDevice9::SetSoftwareVertexProcessing\n"); + return(m_pIDirect3DDevice9->SetSoftwareVertexProcessing(bSoftware)); +} + +BOOL myIDirect3DDevice9::GetSoftwareVertexProcessing(void) +{ + trace(log, "IDirect3DDevice9::GetSoftwareVertexProcessing\n"); + return(m_pIDirect3DDevice9->GetSoftwareVertexProcessing()); +} + +HRESULT myIDirect3DDevice9::SetNPatchMode(float nSegments) +{ + trace(log, "IDirect3DDevice9::SetNPatchMode\n"); + return(m_pIDirect3DDevice9->SetNPatchMode(nSegments)); +} + +float myIDirect3DDevice9::GetNPatchMode(void) +{ + trace(log, "IDirect3DDevice9::GetNPatchMode\n"); + return(m_pIDirect3DDevice9->GetNPatchMode()); +} + +HRESULT myIDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) +{ + trace(log, "IDirect3DDevice9::DrawPrimitive\n"); + return(m_pIDirect3DDevice9->DrawPrimitive(PrimitiveType,StartVertex,PrimitiveCount)); +} + +HRESULT myIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) +{ + trace(log, "IDirect3DDevice9::DrawIndexedPrimitive\n"); + return(m_pIDirect3DDevice9->DrawIndexedPrimitive(PrimitiveType,BaseVertexIndex,MinVertexIndex,NumVertices,startIndex,primCount)); +} + +HRESULT myIDirect3DDevice9::DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) +{ + trace(log, "IDirect3DDevice9::DrawPrimitiveUP\n"); + return(m_pIDirect3DDevice9->DrawPrimitiveUP(PrimitiveType,PrimitiveCount,pVertexStreamZeroData,VertexStreamZeroStride)); +} + +HRESULT myIDirect3DDevice9::DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) +{ + trace(log, "IDirect3DDevice9::DrawIndexedPrimitiveUP\n"); + return(m_pIDirect3DDevice9->DrawIndexedPrimitiveUP(PrimitiveType,MinVertexIndex,NumVertices,PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData,VertexStreamZeroStride)); +} + +HRESULT myIDirect3DDevice9::ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) +{ + trace(log, "IDirect3DDevice9::ProcessVertices\n"); + return(m_pIDirect3DDevice9->ProcessVertices( SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags)); +} + +HRESULT myIDirect3DDevice9::CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) +{ + trace(log, "IDirect3DDevice9::CreateVertexDeclaration\n"); + return(m_pIDirect3DDevice9->CreateVertexDeclaration( pVertexElements,ppDecl)); +} + +HRESULT myIDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl) +{ + trace(log, "IDirect3DDevice9::SetVertexDeclaration\n"); + return(m_pIDirect3DDevice9->SetVertexDeclaration(pDecl)); +} + +HRESULT myIDirect3DDevice9::GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl) +{ + trace(log, "IDirect3DDevice9::GetVertexDeclaration\n"); + return(m_pIDirect3DDevice9->GetVertexDeclaration(ppDecl)); +} + +HRESULT myIDirect3DDevice9::SetFVF(DWORD FVF) +{ + trace(log, "IDirect3DDevice9::SetFVF\n"); + return(m_pIDirect3DDevice9->SetFVF(FVF)); +} + +HRESULT myIDirect3DDevice9::GetFVF(DWORD* pFVF) +{ + trace(log, "IDirect3DDevice9::GetFVF\n"); + return(m_pIDirect3DDevice9->GetFVF(pFVF)); +} + +HRESULT myIDirect3DDevice9::CreateVertexShader(CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) +{ + trace(log, "IDirect3DDevice9::CreateVertexShader\n"); + return(m_pIDirect3DDevice9->CreateVertexShader(pFunction,ppShader)); +} + +HRESULT myIDirect3DDevice9::SetVertexShader(IDirect3DVertexShader9* pShader) +{ + trace(log, "IDirect3DDevice9::SetVertexShader\n"); + return(m_pIDirect3DDevice9->SetVertexShader(pShader)); +} + +HRESULT myIDirect3DDevice9::GetVertexShader(IDirect3DVertexShader9** ppShader) +{ + trace(log, "IDirect3DDevice9::GetVertexShader\n"); + return(m_pIDirect3DDevice9->GetVertexShader(ppShader)); +} + +HRESULT myIDirect3DDevice9::SetVertexShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) +{ + trace(log, "IDirect3DDevice9::SetVertexShaderConstantF\n"); + return(m_pIDirect3DDevice9->SetVertexShaderConstantF(StartRegister,pConstantData, Vector4fCount)); +} + +HRESULT myIDirect3DDevice9::GetVertexShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount) +{ + trace(log, "IDirect3DDevice9::GetVertexShaderConstantF\n"); + return(m_pIDirect3DDevice9->GetVertexShaderConstantF(StartRegister,pConstantData,Vector4fCount)); +} + +HRESULT myIDirect3DDevice9::SetVertexShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) +{ + trace(log, "IDirect3DDevice9::SetVertexShaderConstantI\n"); + return(m_pIDirect3DDevice9->SetVertexShaderConstantI(StartRegister,pConstantData,Vector4iCount)); +} + +HRESULT myIDirect3DDevice9::GetVertexShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount) +{ + trace(log, "IDirect3DDevice9::GetVertexShaderConstantI\n"); + return(m_pIDirect3DDevice9->GetVertexShaderConstantI(StartRegister,pConstantData,Vector4iCount)); +} + +HRESULT myIDirect3DDevice9::SetVertexShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) +{ + trace(log, "IDirect3DDevice9::SetVertexShaderConstantB\n"); + return(m_pIDirect3DDevice9->SetVertexShaderConstantB(StartRegister,pConstantData,BoolCount)); +} + +HRESULT myIDirect3DDevice9::GetVertexShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount) +{ + trace(log, "IDirect3DDevice9::GetVertexShaderConstantB\n"); + return(m_pIDirect3DDevice9->GetVertexShaderConstantB(StartRegister,pConstantData,BoolCount)); +} + +HRESULT myIDirect3DDevice9::SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) +{ + trace(log, "IDirect3DDevice9::SetStreamSource\n"); + return(m_pIDirect3DDevice9->SetStreamSource(StreamNumber,pStreamData,OffsetInBytes,Stride)); +} + +HRESULT myIDirect3DDevice9::GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* OffsetInBytes,UINT* pStride) +{ + trace(log, "IDirect3DDevice9::GetStreamSource\n"); + return(m_pIDirect3DDevice9->GetStreamSource(StreamNumber,ppStreamData,OffsetInBytes,pStride)); +} + +HRESULT myIDirect3DDevice9::SetStreamSourceFreq(UINT StreamNumber,UINT Divider) +{ + trace(log, "IDirect3DDevice9::SetStreamSourceFreq\n"); + return(m_pIDirect3DDevice9->SetStreamSourceFreq(StreamNumber,Divider)); +} + +HRESULT myIDirect3DDevice9::GetStreamSourceFreq(UINT StreamNumber,UINT* Divider) +{ + trace(log, "IDirect3DDevice9::GetStreamSourceFreq\n"); + return(m_pIDirect3DDevice9->GetStreamSourceFreq(StreamNumber,Divider)); +} + +HRESULT myIDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData) +{ + trace(log, "IDirect3DDevice9::SetIndices\n"); + return(m_pIDirect3DDevice9->SetIndices(pIndexData)); +} + +HRESULT myIDirect3DDevice9::GetIndices(IDirect3DIndexBuffer9** ppIndexData) +{ + trace(log, "IDirect3DDevice9::GetIndices\n"); + return(m_pIDirect3DDevice9->GetIndices(ppIndexData)); +} + +HRESULT myIDirect3DDevice9::CreatePixelShader(CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) +{ + trace(log, "IDirect3DDevice9::CreatePixelShader\n"); + return(m_pIDirect3DDevice9->CreatePixelShader(pFunction,ppShader)); +} + +HRESULT myIDirect3DDevice9::SetPixelShader(IDirect3DPixelShader9* pShader) +{ + trace(log, "IDirect3DDevice9::SetPixelShader\n"); + return(m_pIDirect3DDevice9->SetPixelShader(pShader)); +} + +HRESULT myIDirect3DDevice9::GetPixelShader(IDirect3DPixelShader9** ppShader) +{ + trace(log, "IDirect3DDevice9::GetPixelShader\n"); + return(m_pIDirect3DDevice9->GetPixelShader(ppShader)); +} + +HRESULT myIDirect3DDevice9::SetPixelShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) +{ + trace(log, "IDirect3DDevice9::SetPixelShaderConstantF\n"); + return(m_pIDirect3DDevice9->SetPixelShaderConstantF(StartRegister,pConstantData,Vector4fCount)); +} + +HRESULT myIDirect3DDevice9::GetPixelShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount) +{ + trace(log, "IDirect3DDevice9::GetPixelShaderConstantF\n"); + return(m_pIDirect3DDevice9->GetPixelShaderConstantF(StartRegister,pConstantData,Vector4fCount)); +} + +HRESULT myIDirect3DDevice9::SetPixelShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) +{ + trace(log, "IDirect3DDevice9::SetPixelShaderConstantI\n"); + return(m_pIDirect3DDevice9->SetPixelShaderConstantI(StartRegister,pConstantData,Vector4iCount)); +} + +HRESULT myIDirect3DDevice9::GetPixelShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount) +{ + trace(log, "IDirect3DDevice9::GetPixelShaderConstantI\n"); + return(m_pIDirect3DDevice9->GetPixelShaderConstantI(StartRegister,pConstantData,Vector4iCount)); +} + +HRESULT myIDirect3DDevice9::SetPixelShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount) +{ + trace(log, "IDirect3DDevice9::SetPixelShaderConstantB\n"); + return(m_pIDirect3DDevice9->SetPixelShaderConstantB(StartRegister,pConstantData,BoolCount)); +} + +HRESULT myIDirect3DDevice9::GetPixelShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount) +{ + trace(log, "IDirect3DDevice9::GetPixelShaderConstantB\n"); + return(m_pIDirect3DDevice9->GetPixelShaderConstantB(StartRegister,pConstantData,BoolCount)); +} + +HRESULT myIDirect3DDevice9::DrawRectPatch(UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) +{ + trace(log, "IDirect3DDevice9::DrawRectPatch\n"); + return(m_pIDirect3DDevice9->DrawRectPatch(Handle,pNumSegs, pRectPatchInfo)); +} + +HRESULT myIDirect3DDevice9::DrawTriPatch(UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) +{ + trace(log, "IDirect3DDevice9::DrawTriPatch\n"); + return(m_pIDirect3DDevice9->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo)); +} + +HRESULT myIDirect3DDevice9::DeletePatch(UINT Handle) +{ + trace(log, "IDirect3DDevice9::DeletePatch\n"); + return(m_pIDirect3DDevice9->DeletePatch(Handle)); +} + +HRESULT myIDirect3DDevice9::CreateQuery(D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) +{ + trace(log, "IDirect3DDevice9::CreateQuery\n"); + return(m_pIDirect3DDevice9->CreateQuery(Type,ppQuery)); +} + +// This is our test function +void myIDirect3DDevice9::ShowWeAreHere(void) +{ + D3DRECT rec = {1,1,50,50}; + m_pIDirect3DDevice9->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(255,255,255,0),0 ,0); +} + + diff --git a/d3d9proxy/myIDirect3DDevice9.h b/d3d9proxy/myIDirect3DDevice9.h new file mode 100644 index 0000000..29e29ed --- /dev/null +++ b/d3d9proxy/myIDirect3DDevice9.h @@ -0,0 +1,136 @@ +#pragma once + +class myIDirect3DDevice9 : public IDirect3DDevice9 +{ +public: + myIDirect3DDevice9(IDirect3DDevice9* pOriginal); + virtual ~myIDirect3DDevice9(void); + + // START: The original DX9 function definitions + HRESULT __stdcall QueryInterface (REFIID riid, void** ppvObj); + ULONG __stdcall AddRef(void); + ULONG __stdcall Release(void); + HRESULT __stdcall TestCooperativeLevel(void); + UINT __stdcall GetAvailableTextureMem(void); + HRESULT __stdcall EvictManagedResources(void); + HRESULT __stdcall GetDirect3D(IDirect3D9** ppD3D9); + HRESULT __stdcall GetDeviceCaps(D3DCAPS9* pCaps); + HRESULT __stdcall GetDisplayMode(UINT iSwapChain,D3DDISPLAYMODE* pMode); + HRESULT __stdcall GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters); + HRESULT __stdcall SetCursorProperties(UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap); + void __stdcall SetCursorPosition(int X,int Y,DWORD Flags); + BOOL __stdcall ShowCursor(BOOL bShow); + HRESULT __stdcall CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) ; + HRESULT __stdcall GetSwapChain(UINT iSwapChain,IDirect3DSwapChain9** pSwapChain); + UINT __stdcall GetNumberOfSwapChains(void); + HRESULT __stdcall Reset(D3DPRESENT_PARAMETERS* pPresentationParameters); + HRESULT __stdcall Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion); + HRESULT __stdcall GetBackBuffer(UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer); + HRESULT __stdcall GetRasterStatus(UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus); + HRESULT __stdcall SetDialogBoxMode(BOOL bEnableDialogs); + void __stdcall SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp); + void __stdcall GetGammaRamp(UINT iSwapChain,D3DGAMMARAMP* pRamp); + HRESULT __stdcall CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle); + HRESULT __stdcall CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle); + HRESULT __stdcall CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle); + HRESULT __stdcall CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle); + HRESULT __stdcall CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle); + HRESULT __stdcall CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle); + HRESULT __stdcall CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle); + HRESULT __stdcall UpdateSurface(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint); + HRESULT __stdcall UpdateTexture(IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture); + HRESULT __stdcall GetRenderTargetData(IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface); + HRESULT __stdcall GetFrontBufferData(UINT iSwapChain,IDirect3DSurface9* pDestSurface); + HRESULT __stdcall StretchRect(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter); + HRESULT __stdcall ColorFill(IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color); + HRESULT __stdcall CreateOffscreenPlainSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle); + HRESULT __stdcall SetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget); + HRESULT __stdcall GetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget); + HRESULT __stdcall SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil); + HRESULT __stdcall GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface); + HRESULT __stdcall BeginScene(void); + HRESULT __stdcall EndScene(void); + HRESULT __stdcall Clear(DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil); + HRESULT __stdcall SetTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix); + HRESULT __stdcall GetTransform(D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix); + HRESULT __stdcall MultiplyTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix); + HRESULT __stdcall SetViewport(CONST D3DVIEWPORT9* pViewport); + HRESULT __stdcall GetViewport(D3DVIEWPORT9* pViewport); + HRESULT __stdcall SetMaterial(CONST D3DMATERIAL9* pMaterial); + HRESULT __stdcall GetMaterial(D3DMATERIAL9* pMaterial); + HRESULT __stdcall SetLight(DWORD Index,CONST D3DLIGHT9* pLight); + HRESULT __stdcall GetLight(DWORD Index,D3DLIGHT9* pLight); + HRESULT __stdcall LightEnable(DWORD Index,BOOL Enable); + HRESULT __stdcall GetLightEnable(DWORD Index,BOOL* pEnable); + HRESULT __stdcall SetClipPlane(DWORD Index,CONST float* pPlane); + HRESULT __stdcall GetClipPlane(DWORD Index,float* pPlane); + HRESULT __stdcall SetRenderState(D3DRENDERSTATETYPE State,DWORD Value); + HRESULT __stdcall GetRenderState(D3DRENDERSTATETYPE State,DWORD* pValue); + HRESULT __stdcall CreateStateBlock(D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB); + HRESULT __stdcall BeginStateBlock(void); + HRESULT __stdcall EndStateBlock(IDirect3DStateBlock9** ppSB); + HRESULT __stdcall SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus); + HRESULT __stdcall GetClipStatus(D3DCLIPSTATUS9* pClipStatus); + HRESULT __stdcall GetTexture(DWORD Stage,IDirect3DBaseTexture9** ppTexture); + HRESULT __stdcall SetTexture(DWORD Stage,IDirect3DBaseTexture9* pTexture); + HRESULT __stdcall GetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue); + HRESULT __stdcall SetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value); + HRESULT __stdcall GetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue); + HRESULT __stdcall SetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value); + HRESULT __stdcall ValidateDevice(DWORD* pNumPasses); + HRESULT __stdcall SetPaletteEntries(UINT PaletteNumber,CONST PALETTEENTRY* pEntries); + HRESULT __stdcall GetPaletteEntries(UINT PaletteNumber,PALETTEENTRY* pEntries); + HRESULT __stdcall SetCurrentTexturePalette(UINT PaletteNumber); + HRESULT __stdcall GetCurrentTexturePalette(UINT *PaletteNumber); + HRESULT __stdcall SetScissorRect(CONST RECT* pRect); + HRESULT __stdcall GetScissorRect( RECT* pRect); + HRESULT __stdcall SetSoftwareVertexProcessing(BOOL bSoftware); + BOOL __stdcall GetSoftwareVertexProcessing(void); + HRESULT __stdcall SetNPatchMode(float nSegments); + float __stdcall GetNPatchMode(void); + HRESULT __stdcall DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount); + HRESULT __stdcall DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount); + HRESULT __stdcall DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride); + HRESULT __stdcall DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride); + HRESULT __stdcall ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags); + HRESULT __stdcall CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl); + HRESULT __stdcall SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl); + HRESULT __stdcall GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl); + HRESULT __stdcall SetFVF(DWORD FVF); + HRESULT __stdcall GetFVF(DWORD* pFVF); + HRESULT __stdcall CreateVertexShader(CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader); + HRESULT __stdcall SetVertexShader(IDirect3DVertexShader9* pShader); + HRESULT __stdcall GetVertexShader(IDirect3DVertexShader9** ppShader); + HRESULT __stdcall SetVertexShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount); + HRESULT __stdcall GetVertexShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount); + HRESULT __stdcall SetVertexShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount); + HRESULT __stdcall GetVertexShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount); + HRESULT __stdcall SetVertexShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount); + HRESULT __stdcall GetVertexShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount); + HRESULT __stdcall SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride); + HRESULT __stdcall GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* OffsetInBytes,UINT* pStride); + HRESULT __stdcall SetStreamSourceFreq(UINT StreamNumber,UINT Divider); + HRESULT __stdcall GetStreamSourceFreq(UINT StreamNumber,UINT* Divider); + HRESULT __stdcall SetIndices(IDirect3DIndexBuffer9* pIndexData); + HRESULT __stdcall GetIndices(IDirect3DIndexBuffer9** ppIndexData); + HRESULT __stdcall CreatePixelShader(CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader); + HRESULT __stdcall SetPixelShader(IDirect3DPixelShader9* pShader); + HRESULT __stdcall GetPixelShader(IDirect3DPixelShader9** ppShader); + HRESULT __stdcall SetPixelShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount); + HRESULT __stdcall GetPixelShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount); + HRESULT __stdcall SetPixelShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount); + HRESULT __stdcall GetPixelShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount); + HRESULT __stdcall SetPixelShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount); + HRESULT __stdcall GetPixelShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount); + HRESULT __stdcall DrawRectPatch(UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo); + HRESULT __stdcall DrawTriPatch(UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo); + HRESULT __stdcall DeletePatch(UINT Handle); + HRESULT __stdcall CreateQuery(D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery); + // END: The original DX9 function definitions + +private: + IDirect3DDevice9 *m_pIDirect3DDevice9; + + // This is our test function + void ShowWeAreHere(void); +}; diff --git a/d3d9proxy/proxydll.cpp b/d3d9proxy/proxydll.cpp new file mode 100644 index 0000000..3767409 --- /dev/null +++ b/d3d9proxy/proxydll.cpp @@ -0,0 +1,116 @@ +// proxydll.cpp +#include "stdafx.h" +#include "proxydll.h" +#include "stdio.h" + +// global variables +#pragma data_seg (".d3d9_shared") +myIDirect3DDevice9* gl_pmyIDirect3DDevice9; +myIDirect3D9* gl_pmyIDirect3D9; +HINSTANCE gl_hOriginalDll; +HINSTANCE gl_hThisInstance; +FILE *log; +#pragma data_seg () + +#define trace if(log) fprintf + +BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) +{ + // to avoid compiler lvl4 warnings + LPVOID lpDummy = lpReserved; + lpDummy = NULL; + + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: InitInstance(hModule); break; + case DLL_PROCESS_DETACH: ExitInstance(); break; + + case DLL_THREAD_ATTACH: break; + case DLL_THREAD_DETACH: break; + } + return TRUE; +} + +// Exported function (faking d3d9.dll's one-and-only export) +IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) +{ + trace(log, "Direct3DCreate9\n"); + + if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right d3d9.dll" + + // Hooking IDirect3D Object from Original Library + typedef IDirect3D9 *(WINAPI* D3D9_Type)(UINT SDKVersion); + D3D9_Type D3DCreate9_fn = (D3D9_Type) GetProcAddress( gl_hOriginalDll, "Direct3DCreate9"); + + // Debug + if (!D3DCreate9_fn) + { + OutputDebugString("PROXYDLL: Pointer to original D3DCreate9 function not received ERROR ****\r\n"); + ::ExitProcess(0); // exit the hard way + } + + // Request pointer from Original Dll. + IDirect3D9 *pIDirect3D9_orig = D3DCreate9_fn(SDKVersion); + + // Create my IDirect3D8 object and store pointer to original object there. + // note: the object will delete itself once Ref count is zero (similar to COM objects) + gl_pmyIDirect3D9 = new myIDirect3D9(pIDirect3D9_orig); + + // Return pointer to hooking Object instead of "real one" + return (gl_pmyIDirect3D9); +} + +void InitInstance(HANDLE hModule) +{ + char *logpath; + OutputDebugString("PROXYDLL: InitInstance called.\r\n"); + + // Initialisation + gl_hOriginalDll = NULL; + gl_hThisInstance = NULL; + gl_pmyIDirect3D9 = NULL; + gl_pmyIDirect3DDevice9 = NULL; + + // Storing Instance handle into global var + gl_hThisInstance = (HINSTANCE) hModule; + + log=NULL; + logpath=getenv("d3d9log"); + if(logpath) log=fopen(logpath, "a+"); +} + +void LoadOriginalDll(void) +{ + char buffer[MAX_PATH]; + + // Getting path to system dir and to d3d8.dll + ::GetSystemDirectory(buffer,MAX_PATH); + + // Append dll name + strcat(buffer,"\\d3d9.dll"); + + // try to load the system's d3d9.dll, if pointer empty + if (!gl_hOriginalDll) gl_hOriginalDll = ::LoadLibrary(buffer); + + // Debug + if (!gl_hOriginalDll) + { + OutputDebugString("PROXYDLL: Original d3d9.dll not loaded ERROR ****\r\n"); + ::ExitProcess(0); // exit the hard way + } +} + +void ExitInstance() +{ + OutputDebugString("PROXYDLL: ExitInstance called.\r\n"); + + // Release the system's d3d9.dll + if (gl_hOriginalDll) + { + ::FreeLibrary(gl_hOriginalDll); + gl_hOriginalDll = NULL; + } + + fclose(log); +} + diff --git a/d3d9proxy/proxydll.def b/d3d9proxy/proxydll.def new file mode 100644 index 0000000..d74db14 --- /dev/null +++ b/d3d9proxy/proxydll.def @@ -0,0 +1,4 @@ +LIBRARY "d3d9" + +EXPORTS + Direct3DCreate9 @1 diff --git a/d3d9proxy/proxydll.h b/d3d9proxy/proxydll.h new file mode 100644 index 0000000..5a4528b --- /dev/null +++ b/d3d9proxy/proxydll.h @@ -0,0 +1,10 @@ +// proxydll.h +#pragma once + +// Exported function +IDirect3D9* WINAPI Direct3DCreate9 (UINT SDKVersion); + +// regular functions +void InitInstance(HANDLE hModule); +void ExitInstance(void); +void LoadOriginalDll(void); \ No newline at end of file diff --git a/d3d9proxy/proxydll.sln b/d3d9proxy/proxydll.sln new file mode 100644 index 0000000..c88932b --- /dev/null +++ b/d3d9proxy/proxydll.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "proxydll", "proxydll.vcproj", "{02EB97D5-B1C5-411E-8274-83A95985DE6F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {02EB97D5-B1C5-411E-8274-83A95985DE6F}.Debug|Win32.ActiveCfg = Debug|Win32 + {02EB97D5-B1C5-411E-8274-83A95985DE6F}.Debug|Win32.Build.0 = Debug|Win32 + {02EB97D5-B1C5-411E-8274-83A95985DE6F}.Release|Win32.ActiveCfg = Release|Win32 + {02EB97D5-B1C5-411E-8274-83A95985DE6F}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/d3d9proxy/proxydll.suo b/d3d9proxy/proxydll.suo new file mode 100644 index 0000000..9d4a040 Binary files /dev/null and b/d3d9proxy/proxydll.suo differ diff --git a/d3d9proxy/proxydll.suo.old b/d3d9proxy/proxydll.suo.old new file mode 100644 index 0000000..d50ac0e Binary files /dev/null and b/d3d9proxy/proxydll.suo.old differ diff --git a/d3d9proxy/proxydll.vcproj b/d3d9proxy/proxydll.vcproj new file mode 100644 index 0000000..62ee685 --- /dev/null +++ b/d3d9proxy/proxydll.vcproj @@ -0,0 +1,253 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/d3d9proxy/stdafx.cpp b/d3d9proxy/stdafx.cpp new file mode 100644 index 0000000..2a015f2 --- /dev/null +++ b/d3d9proxy/stdafx.cpp @@ -0,0 +1,2 @@ +// stdafx.cpp +#include "stdafx.h" \ No newline at end of file diff --git a/d3d9proxy/stdafx.h b/d3d9proxy/stdafx.h new file mode 100644 index 0000000..7202acc --- /dev/null +++ b/d3d9proxy/stdafx.h @@ -0,0 +1,10 @@ +// stdafx.h +#pragma once + + +#define WIN32_LEAN_AND_MEAN +#include + +#include "d3d9.h" +#include "myIDirect3D9.h" +#include "myIDirect3DDevice9.h" diff --git a/dll/advapi.cpp b/dll/advapi.cpp index 7f9444b..3ea6f4b 100644 --- a/dll/advapi.cpp +++ b/dll/advapi.cpp @@ -72,7 +72,7 @@ LONG WINAPI extRegOpenKeyEx( FILE *regf; char sKey[256+1]; sprintf(sKey,"%s\\%s", hKey2String(hKey), lpSubKey); - OutTraceD("RegOpenKeyEx: searching for key=\"%s\"\n", sKey); + OutTraceDW("RegOpenKeyEx: searching for key=\"%s\"\n", sKey); regf=fopen("dxwnd.reg","r"); if(regf==NULL) return ERROR_FILE_NOT_FOUND; fgets(RegBuf, 256, regf); @@ -150,7 +150,7 @@ LONG WINAPI extRegQueryValueEx( else { if(hCurKey==hKey){ - //OutTraceD("loop: \"%s\"\n", RegBuf); + //OutTraceDW("loop: \"%s\"\n", RegBuf); if((RegBuf[0]=='"') && !strncmp(lpValueName, &RegBuf[1], strlen(lpValueName)) && (RegBuf[strlen(lpValueName)+1]=='"') && @@ -172,7 +172,7 @@ LONG WINAPI extRegQueryValueEx( } if(lpType) *lpType=REG_SZ; // - OutTraceD("RegQueryValueEx: Data=\"%s\" type=REG_SZ\n", lpData); + OutTraceDW("RegQueryValueEx: Data=\"%s\" type=REG_SZ\n", lpData); res=ERROR_SUCCESS; } if(!strncmp(pData,"dword:",strlen("dword:"))){ //dword value @@ -182,7 +182,7 @@ LONG WINAPI extRegQueryValueEx( memcpy(lpData, &val, sizeof(DWORD)); if(lpType) *lpType=REG_DWORD; *lpcbData=sizeof(DWORD); - OutTraceD("RegQueryValueEx: Data=0x%x type=REG_DWORD\n", val); + OutTraceDW("RegQueryValueEx: Data=0x%x type=REG_DWORD\n", val); res=ERROR_SUCCESS; } if(!strncmp(pData,"hex:",strlen("hex:"))){ //dword value @@ -190,15 +190,15 @@ LONG WINAPI extRegQueryValueEx( lpData[strlen((char *)lpData)-1]=0; // eliminates \n if(lpType) *lpType=REG_BINARY; *lpcbData=0; - OutTraceD("RegQueryValueEx: Data="); + OutTraceDW("RegQueryValueEx: Data="); while(strlen(pData)>1){ sscanf(pData, "%x,", (char *)lpData); - OutTraceD("%02.2x,", *(unsigned char *)lpData); + OutTraceDW("%02.2x,", *(unsigned char *)lpData); pData+=3; lpData++; (*lpcbData)++; } - OutTraceD(" type=REG_BINARY cbData=%d\n", *lpcbData); + OutTraceDW(" type=REG_BINARY cbData=%d\n", *lpcbData); res=ERROR_SUCCESS; } fclose(regf); diff --git a/dll/ddproxy.cpp b/dll/ddproxy.cpp index 7c24b63..018e671 100644 --- a/dll/ddproxy.cpp +++ b/dll/ddproxy.cpp @@ -666,7 +666,7 @@ HRESULT WINAPI extInitializeProxy(LPDIRECTDRAW lpdd, GUID FAR *lpguid) HRESULT res; GUID FAR *lpPrivGuid = lpguid; - OutTraceD("Initialize: lpdd=%x guid=%x(%s)\n", lpdd, lpguid, ExplainGUID(lpguid)); + OutTraceDW("Initialize: lpdd=%x guid=%x(%s)\n", lpdd, lpguid, ExplainGUID(lpguid)); res=(*pInitialize)(lpdd, lpPrivGuid); @@ -2072,18 +2072,18 @@ int WINAPI extGetDeviceCapsProxy(HDC hdc, int nindex) DWORD res; res = (*pGDIGetDeviceCaps)(hdc, nindex); - OutTraceD("GetDeviceCaps: hdc=%x index=%x(%s) res=%x\n", + OutTraceDW("GetDeviceCaps: hdc=%x index=%x(%s) res=%x\n", hdc, nindex, ExplainDeviceCaps(nindex), res); switch(nindex){ case VERTRES: - OutTraceD("GetDeviceCaps: VERTRES=%d\n", res); + OutTraceDW("GetDeviceCaps: VERTRES=%d\n", res); break; case HORZRES: - OutTraceD("GetDeviceCaps: HORZRES=%d\n", res); + OutTraceDW("GetDeviceCaps: HORZRES=%d\n", res); break; case RASTERCAPS: - OutTraceD("GetDeviceCaps: RASTERCAPS=%x(%s)\n",res, ExplainRasterCaps(res)); + OutTraceDW("GetDeviceCaps: RASTERCAPS=%x(%s)\n",res, ExplainRasterCaps(res)); break; } return res; diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index ff6737f..3cc7c50 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -44,6 +44,9 @@ HRESULT WINAPI extSetCooperativeLevel(void *, HWND, DWORD); HRESULT WINAPI extSetDisplayMode1(LPDIRECTDRAW, DWORD, DWORD, DWORD); HRESULT WINAPI extSetDisplayMode2(LPDIRECTDRAW, DWORD, DWORD, DWORD, DWORD, DWORD); HRESULT WINAPI extWaitForVerticalBlank(LPDIRECTDRAW, DWORD, HANDLE); + /*** Added in the V2 Interface ***/ +HRESULT WINAPI extGetAvailableVidMem2(LPDIRECTDRAW, LPDDSCAPS, LPDWORD, LPDWORD); +HRESULT WINAPI extGetAvailableVidMem4(LPDIRECTDRAW, LPDDSCAPS, LPDWORD, LPDWORD); /*** Added in the V4 Interface ***/ HRESULT WINAPI extTestCooperativeLevel(LPDIRECTDRAW); // STDMETHOD(StartModeTest)(THIS_ LPSIZE, DWORD, DWORD ) PURE; @@ -147,6 +150,8 @@ SetDisplayMode2_Type pSetDisplayMode2; WaitForVerticalBlank_Type pWaitForVerticalBlank; GetSurfaceFromDC_Type pGetSurfaceFromDC; GetAvailableVidMem_Type pGetAvailableVidMem; +GetAvailableVidMem_Type pGetAvailableVidMem2; +GetAvailableVidMem_Type pGetAvailableVidMem4; RestoreAllSurfaces_Type pRestoreAllSurfaces; TestCooperativeLevel_Type pTestCooperativeLevel; GetDeviceIdentifier_Type pGetDeviceIdentifier; @@ -373,7 +378,7 @@ static char *DumpPixelFormat(LPDDSURFACEDESC2 lpddsd) static void LogSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line) { - if(!IsTraceD) return; + if(!IsTraceDDRAW) return; OutTrace("SurfaceDesc: %s Flags=%x(%s)", label, lpddsd->dwFlags, ExplainFlags(lpddsd->dwFlags)); @@ -401,7 +406,7 @@ static void LogSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line) static void DumpPixFmt(LPDDSURFACEDESC2 lpdds) { - OutTraceD("PixelFormat: lpddsd=%x %s\n", DumpPixelFormat(lpdds)); + OutTrace("PixelFormat: lpddsd=%x %s\n", DumpPixelFormat(lpdds)); } static void DumpSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line) @@ -448,22 +453,6 @@ void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries) for(int idx=0; idxPalette[dwstart+idx]= lpentries[idx]; -#if 0 - typedef struct { - WORD palVersion; - WORD palNumEntries; - PALETTEENTRY palPalEntry[256]; - } LOGPALETTE256; - LOGPALETTE256 GDIPalette; - HPALETTE pal; - GDIPalette.palNumEntries=256; - GDIPalette.palVersion=0; - memcpy(GDIPalette.palPalEntry, lpentries, 256*sizeof(PALETTEENTRY)); - pal=CreatePalette((LOGPALETTE *)&GDIPalette); - SelectPalette(GetDC(dxw.GethWnd()), pal, 0); - RealizePalette(GetDC(dxw.GethWnd())); -#endif - for(i = 0; i < dwcount; i ++){ PALETTEENTRY PalColor; PalColor = lpentries[i]; @@ -487,7 +476,7 @@ void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries) (((DWORD)PalColor.peRed & 0xF8) << 8) + (((DWORD)PalColor.peGreen & 0xF8) << 3) + (((DWORD)PalColor.peBlue &0xF8) >> 3); break; default: - OutTraceD("ASSERT: unsupported Color BPP=%d\n", dxw.ActualPixelFormat.dwRGBBitCount); + OutTraceDW("ASSERT: unsupported Color BPP=%d\n", dxw.ActualPixelFormat.dwRGBBitCount); break; } } @@ -505,7 +494,7 @@ void InitDDScreenParameters(LPDIRECTDRAW lpdd) return; } - OutTraceD("InitDDScreenParameters: Actual %s\n", DumpPixelFormat((LPDDSURFACEDESC2)&ddsd)); + OutTraceDW("InitDDScreenParameters: Actual %s\n", DumpPixelFormat((LPDDSURFACEDESC2)&ddsd)); dxw.ActualPixelFormat=ddsd.ddpfPixelFormat; if(dxw.VirtualPixelFormat.dwRGBBitCount==0) dxw.VirtualPixelFormat=ddsd.ddpfPixelFormat; SetBltTransformations(); @@ -524,7 +513,7 @@ void InitDSScreenParameters(LPDIRECTDRAWSURFACE lpdds) } ddsd.ddpfPixelFormat = p; - OutTraceD("InitDSScreenParameters: Actual %s\n", DumpPixelFormat(&ddsd)); + OutTraceDW("InitDSScreenParameters: Actual %s\n", DumpPixelFormat(&ddsd)); dxw.ActualPixelFormat = p; SetBltTransformations(); return; @@ -555,7 +544,7 @@ void InitScreenParameters() // initialize to default null values, but dwRGBBitCount dxw.ActualPixelFormat.dwRGBBitCount=CurrDevMode.dmBitsPerPel; dxw.VirtualPixelFormat.dwRGBBitCount=CurrDevMode.dmBitsPerPel; // until set differently - OutTraceD("InitScreenParameters: RGBBitCount=%d\n", CurrDevMode.dmBitsPerPel); + OutTraceDW("InitScreenParameters: RGBBitCount=%d\n", CurrDevMode.dmBitsPerPel); SetBltTransformations(); return; @@ -622,7 +611,7 @@ int HookDirectDraw(HMODULE module, int version) pSetAppCompatData=(SetAppCompatData_Type)(*pGetProcAddress)(hinst, "SetAppCompatData"); if(pSetAppCompatData) { res=(*pSetAppCompatData)(2, 0); - OutTraceD("HookDirectDraw: SetAppCompatData(2,0) ret=%x(%s)\n", res, ExplainDDError(res)); + OutTraceDW("HookDirectDraw: SetAppCompatData(2,0) ret=%x(%s)\n", res, ExplainDDError(res)); } FreeLibrary(hinst); } @@ -712,7 +701,7 @@ Unlock4_Type pUnlockMethod(LPDIRECTDRAWSURFACE lpdds) if(extUnlock==(void *)extUnlockDir1) return (Unlock4_Type)pUnlock1; if(extUnlock==(void *)extUnlockDir4) return (Unlock4_Type)pUnlock4; sprintf_s(sMsg, 80, "pUnlockMethod: pUnlock(%x) can't match %x\n", lpdds, extUnlock); - OutTraceD(sMsg); + OutTraceDW(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "pUnlockMethod", MB_OK | MB_ICONEXCLAMATION); if (pUnlock4) return pUnlock4; return (Unlock4_Type)pUnlock1; @@ -728,7 +717,7 @@ CreateSurface2_Type pCreateSurfaceMethod(LPDIRECTDRAWSURFACE lpdds) if(extUnlock==(void *)extUnlockDir1) return (CreateSurface2_Type)pCreateSurface1; if(extUnlock==(void *)extUnlockDir4) return (CreateSurface2_Type)pCreateSurface4; sprintf_s(sMsg, 80, "pCreateSurfaceMethod: pUnlock(%x) can't match %x\n", lpdds, extUnlock); - OutTraceD(sMsg); + OutTraceDW(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "pCreateSurfaceMethod", MB_OK | MB_ICONEXCLAMATION); if (pCreateSurface4) return pCreateSurface4; return (CreateSurface2_Type)pCreateSurface1; @@ -744,7 +733,7 @@ int SurfaceDescrSize(LPDIRECTDRAWSURFACE lpdds) if(extUnlock==(void *)extUnlockDir1) return sizeof(DDSURFACEDESC); if(extUnlock==(void *)extUnlockDir4) return sizeof(DDSURFACEDESC2); sprintf_s(sMsg, 80, "pCreateSurfaceMethod: pUnlock(%x) can't match %x\n", lpdds, extUnlock); - OutTraceD(sMsg); + OutTraceDW(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "SurfaceDescrSize", MB_OK | MB_ICONEXCLAMATION); return sizeof(DDSURFACEDESC); } @@ -766,7 +755,7 @@ int lpddsHookedVersion(LPDIRECTDRAWSURFACE lpdds) if(extGetCaps==(void *)extGetCaps4S) return 4; if(extGetCaps==(void *)extGetCaps7S) return 7; sprintf_s(sMsg, 80, "lpddsHookedVersion(%x) can't match %x\n", lpdds, extGetCaps); - OutTraceD(sMsg); + OutTraceDW(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "lpddsHookedVersion", MB_OK | MB_ICONEXCLAMATION); return 0; } @@ -787,7 +776,7 @@ int lpddHookedVersion(LPDIRECTDRAW lpdd) 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); + OutTraceDW(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "lpddHookedVersion", MB_OK | MB_ICONEXCLAMATION); return 0; } @@ -799,7 +788,7 @@ int lpddHookedVersion(LPDIRECTDRAW lpdd) static void SetPixFmt(LPDDSURFACEDESC2 lpdd) { - OutTraceD("SetPixFmt: BPP=%d Use565=%d NoAlpha=%d\n", + OutTraceDW("SetPixFmt: BPP=%d Use565=%d NoAlpha=%d\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.dwFlags1 & USERGB565 ? 1:0, dxw.dwFlags4 & NOALPHACHANNEL ? 1:0); @@ -823,7 +812,7 @@ static void SetPixFmt(LPDDSURFACEDESC2 lpdd) // remember current virtual settings dxw.VirtualPixelFormat=lpdd->ddpfPixelFormat; - OutTraceD("SetPixFmt: %s\n", DumpPixelFormat(lpdd)); + OutTraceDW("SetPixFmt: %s\n", DumpPixelFormat(lpdd)); } // retrieves the stored pixel format @@ -831,7 +820,7 @@ static void SetPixFmt(LPDDSURFACEDESC2 lpdd) static void GetPixFmt(LPDDSURFACEDESC2 lpdd) { lpdd->ddpfPixelFormat = dxw.VirtualPixelFormat; - OutTraceD("GetPixFmt: %s\n", DumpPixelFormat(lpdd)); + OutTraceDW("GetPixFmt: %s\n", DumpPixelFormat(lpdd)); } /* ------------------------------------------------------------------ */ @@ -859,7 +848,7 @@ int Set_dwSize_From_DDraw(LPDIRECTDRAW lpdd) static void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion) { - OutTraceD("Hooking directdraw session dd=%x dxversion=%d thread_id=%x\n", + OutTraceDW("Hooking directdraw session dd=%x dxversion=%d thread_id=%x\n", *lplpdd, dxversion, GetCurrentThreadId()); // IDIrectDraw::QueryInterface @@ -915,6 +904,11 @@ static void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion) SetHook((void *)(**(DWORD **)lplpdd + 84), extSetDisplayMode1, (void **)&pSetDisplayMode1, "SetDisplayMode(D1)"); // IDIrectDraw::WaitForVerticalBlank SetHook((void *)(**(DWORD **)lplpdd + 88), extWaitForVerticalBlank, (void **)&pWaitForVerticalBlank, "WaitForVerticalBlank(D)"); + // IDIrectDraw::GetAvailableVidMem + if (dxversion == 2) + SetHook((void *)(**(DWORD **)lplpdd + 92), extGetAvailableVidMem2, (void **)&pGetAvailableVidMem2, "GetAvailableVidMem(D2)"); + if (dxversion == 4) + SetHook((void *)(**(DWORD **)lplpdd + 92), extGetAvailableVidMem4, (void **)&pGetAvailableVidMem4, "GetAvailableVidMem(D4)"); // IDIrectDraw::TestCooperativeLevel if (dxversion >= 4) SetHook((void *)(**(DWORD **)lplpdd + 104), extTestCooperativeLevel, (void **)&pTestCooperativeLevel, "TestCooperativeLevel(D)"); @@ -943,9 +937,6 @@ static void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion) SetHook((void *)(**(DWORD **)lplpdd + 68), extGetVerticalBlankStatusProxy, (void **)&pGetVerticalBlankStatus, "GetVerticalBlankStatus(D)"); // IDIrectDraw::RestoreDisplayMode SetHook((void *)(**(DWORD **)lplpdd + 76), extRestoreDisplayModeProxy, (void **)&pRestoreDisplayMode, "RestoreDisplayMode(D)"); - // IDIrectDraw::GetAvailableVidMem - if (dxversion >= 2) - SetHook((void *)(**(DWORD **)lplpdd + 92), extGetAvailableVidMemProxy, (void **)&pGetAvailableVidMem, "GetAvailableVidMem(D)"); if (dxversion >= 4){ // IDIrectDraw::GetSurfaceFromDC SetHook((void *)(**(DWORD **)lplpdd + 96), extGetSurfaceFromDCProxy, (void **)&pGetSurfaceFromDC, "GetSurfaceFromDC(D)"); @@ -958,7 +949,7 @@ static void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion) static void HookDDClipper(LPDIRECTDRAWCLIPPER FAR* lplpDDClipper) { - OutTraceD("Hooking directdraw clipper dd=%x\n", *lplpDDClipper); + OutTraceDW("Hooking directdraw clipper dd=%x\n", *lplpDDClipper); // IDirectDrawClipper::Release SetHook((void *)(**(DWORD **)lplpDDClipper + 8), extReleaseC, (void **)&pReleaseC, "Release(C)"); @@ -988,7 +979,7 @@ static void HookDDClipper(LPDIRECTDRAWCLIPPER FAR* lplpDDClipper) static void HookDDPalette(LPDIRECTDRAWPALETTE FAR* lplpDDPalette) { - OutTraceD("Hooking directdraw palette dd=%x\n", *lplpDDPalette); + OutTraceDW("Hooking directdraw palette dd=%x\n", *lplpDDPalette); /*** IDirectDrawPalette methods ***/ // IDirectDrawPalette::Release @@ -1012,7 +1003,7 @@ static void HookDDPalette(LPDIRECTDRAWPALETTE FAR* lplpDDPalette) static void HookDDSurfacePrim(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) { - OutTraceD("Hooking surface as primary dds=%x dxversion=%d thread_id=%x\n", + OutTraceDW("Hooking surface as primary dds=%x dxversion=%d thread_id=%x\n", *lplpdds, dxversion, GetCurrentThreadId()); // IDirectDrawSurface::Query @@ -1143,7 +1134,7 @@ static void HookDDSurfacePrim(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) { - OutTraceD("Hooking surface as generic dds=%x dxversion=%d thread_id=%x\n", + OutTraceDW("Hooking surface as generic dds=%x dxversion=%d thread_id=%x\n", *lplpdds, dxversion, GetCurrentThreadId()); // IDirectDrawSurface::QueryInterface @@ -1163,8 +1154,8 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) // IDirectDrawSurface::GetAttachedSurface switch(dxversion) { case 1: - case 2: - SetHook((void *)(**(DWORD **)lplpdds + 48), extGetAttachedSurface1, (void **)&pGetAttachedSurface1, "GetAttachedSurface(S1)"); + case 2: + SetHook((void *)(**(DWORD **)lplpdds + 48), extGetAttachedSurface1, (void **)&pGetAttachedSurface1, "GetAttachedSurface(S1)"); break; case 3: SetHook((void *)(**(DWORD **)lplpdds + 48), extGetAttachedSurface3, (void **)&pGetAttachedSurface3, "GetAttachedSurface(S3)"); @@ -1300,7 +1291,7 @@ static void MaskCapsD(LPDDCAPS c1, LPDDCAPS c2) //char sBuf[80+1]; char token[20+1]; DWORD val; - OutTraceD("MaskCaps\n"); + OutTraceDW("MaskCaps\n"); capfile=fopen("dxwnd.cap", "r"); if(!capfile) return; while(TRUE){ @@ -1310,7 +1301,7 @@ static void MaskCapsD(LPDDCAPS c1, LPDDCAPS c2) if(!strcmp(token, "dwCKeyCaps")) c1->dwCKeyCaps &= val; if(!strcmp(token, "dwFXCaps")) c1->dwFXCaps &= val; } - OutTraceD("MaskCaps(D-HW): caps=%x(%s) caps2=%x(%s) fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n", + OutTraceDW("MaskCaps(D-HW): caps=%x(%s) caps2=%x(%s) fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n", c1->dwCaps, ExplainDDDCaps(c1->dwCaps), c1->dwCaps2, ExplainDDDCaps2(c1->dwCaps2), c1->dwFXCaps, ExplainDDFXCaps(c1->dwFXCaps), @@ -1326,19 +1317,19 @@ static void MaskCapsD(LPDDCAPS c1, LPDDCAPS c2) HRESULT WINAPI extGetCapsD(LPDIRECTDRAW lpdd, LPDDCAPS c1, LPDDCAPS c2) { HRESULT res; - OutTraceD("GetCaps(D): PROXED lpdd=%x\n", lpdd); + OutTraceDDRAW("GetCaps(D): lpdd=%x\n", lpdd); res=(*pGetCapsD)(lpdd, c1, c2); if(res) OutTraceE("GetCaps(D): ERROR res=%x(%s)\n", res, ExplainDDError(res)); else { - if (c1) OutTraceD("GetCaps(D-HW): caps=%x(%s) caps2=%x(%s) palcaps=%x(%s) fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n", + if (c1) OutTraceDDRAW("GetCaps(D-HW): caps=%x(%s) caps2=%x(%s) palcaps=%x(%s) fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n", c1->dwCaps, ExplainDDDCaps(c1->dwCaps), c1->dwCaps2, ExplainDDDCaps2(c1->dwCaps2), c1->dwPalCaps, ExplainDDPalCaps(c1->dwPalCaps), c1->dwFXCaps, ExplainDDFXCaps(c1->dwFXCaps), c1->dwFXAlphaCaps, ExplainDDFXALPHACaps(c1->dwFXAlphaCaps), c1->dwCKeyCaps, ExplainDDCKeyCaps(c1->dwCKeyCaps)); - if (c2) OutTraceD("GetCaps(D-SW): caps=%x(%s) caps2=%x(%s) palcaps=%x(%s) fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n", + if (c2) OutTraceDDRAW("GetCaps(D-SW): caps=%x(%s) caps2=%x(%s) palcaps=%x(%s) fxcaps=%x(%s) fxalphacaps=%x(%s) keycaps=%x(%s)\n", c2->dwCaps, ExplainDDDCaps(c2->dwCaps), c2->dwCaps2, ExplainDDDCaps2(c2->dwCaps2), c2->dwPalCaps, ExplainDDPalCaps(c2->dwPalCaps), @@ -1373,7 +1364,7 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I HRESULT res; GUID FAR *lpPrivGuid = lpguid; - OutTraceD("DirectDrawCreate: guid=%x(%s)\n", lpguid, ExplainGUID(lpguid)); + OutTraceDDRAW("DirectDrawCreate: guid=%x(%s)\n", lpguid, ExplainGUID(lpguid)); if(!pDirectDrawCreate){ // not hooked yet.... HINSTANCE hinst; @@ -1385,7 +1376,7 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I else{ char sMsg[81]; sprintf_s(sMsg, 80, "DirectDrawCreate hook failed: error=%d\n", GetLastError()); - OutTraceD(sMsg); + OutTraceDW(sMsg); if(IsAssertEnabled) MessageBox(0, sMsg, "Hook", MB_OK | MB_ICONEXCLAMATION); return DDERR_GENERIC; // is there a better one? } @@ -1417,7 +1408,7 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I } break; } - OutTraceD("DirectDrawCreate: lpdd=%x guid=%s DDVersion=%d\n", *lplpdd, mode, dxw.dwDDVersion); + OutTraceDDRAW("DirectDrawCreate: lpdd=%x guid=%s DDVersion=%d\n", *lplpdd, mode, dxw.dwDDVersion); HookDDSession(lplpdd, dxw.dwDDVersion); @@ -1440,7 +1431,7 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid, HRESULT res; GUID FAR *lpPrivGuid = lpguid; - OutTraceD("DirectDrawCreateEx: guid=%x(%s) refiid=%x\n", lpguid, ExplainGUID(lpguid), iid); + OutTraceDDRAW("DirectDrawCreateEx: guid=%x(%s) refiid=%x\n", lpguid, ExplainGUID(lpguid), iid); // v2.1.70: auto-hooking (just in case...) if(!pDirectDrawCreateEx){ // not hooked yet.... @@ -1456,7 +1447,7 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid, else{ char sMsg[81]; sprintf_s(sMsg, 80, "DirectDrawCreateEx hook failed: error=%d\n", GetLastError()); - OutTraceD(sMsg); + OutTraceDW(sMsg); if(IsAssertEnabled) MessageBox(0, sMsg, "Hook", MB_OK | MB_ICONEXCLAMATION); return DDERR_GENERIC; // is there a better one? } @@ -1466,7 +1457,7 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid, res = (*pDirectDrawCreateEx)(lpPrivGuid, lplpdd, iid, pu); if (res){ - OutTraceD("DirectDrawCreateEx: res=%x(%s)\n",res, ExplainDDError(res)); + OutTraceDW("DirectDrawCreateEx: res=%x(%s)\n",res, ExplainDDError(res)); return res; } @@ -1488,7 +1479,7 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid, } break; } - OutTraceD("DirectDrawCreateEx: lpdd=%x guid=%s DDVersion=%d\n", *lplpdd, mode, dxw.dwDDVersion); + OutTraceDDRAW("DirectDrawCreateEx: lpdd=%x guid=%s DDVersion=%d\n", *lplpdd, mode, dxw.dwDDVersion); HookDDSession(lplpdd,dxw.dwDDVersion); @@ -1500,7 +1491,7 @@ HRESULT WINAPI extInitialize(LPDIRECTDRAW lpdd, GUID FAR *lpguid) HRESULT res; GUID FAR *lpPrivGuid = lpguid; - OutTraceD("Initialize: lpdd=%x guid=%x(%s)\n", lpdd, lpguid, ExplainGUID(lpguid)); + OutTraceDDRAW("Initialize: lpdd=%x guid=%x(%s)\n", lpdd, lpguid, ExplainGUID(lpguid)); if((dxw.dwFlags3 & FORCESHEL) && (lpguid==NULL)) lpPrivGuid=(GUID FAR *)DDCREATE_EMULATIONONLY; @@ -1519,7 +1510,7 @@ HRESULT WINAPI extQueryInterfaceD(void *lpdd, REFIID riid, LPVOID *obp) unsigned int dwLocalD3DVersion; res = (*pQueryInterfaceD)(lpdd, riid, obp); - OutTraceD("QueryInterface(D): lpdd=%x REFIID=%x(%s) obp=%x ret=%x at %d\n", + OutTraceDDRAW("QueryInterface(D): lpdd=%x REFIID=%x(%s) obp=%x ret=%x at %d\n", lpdd, riid.Data1, ExplainGUID((GUID *)&riid), *obp, res, __LINE__); if(res) return res; @@ -1553,15 +1544,15 @@ HRESULT WINAPI extQueryInterfaceD(void *lpdd, REFIID riid, LPVOID *obp) break; } if (! *obp) { - OutTraceD("QueryInterface(D): Interface for DX version %d not found\n", dwLocalDDVersion); + OutTraceDDRAW("QueryInterface(D): Interface for DX version %d not found\n", dwLocalDDVersion); return(0); } - if(dwLocalDDVersion) OutTraceD("QueryInterface(D): Got interface for DX version %d\n", dwLocalDDVersion); - if(dwLocalD3DVersion) OutTraceD("QueryInterface(D): Got interface for D3D version %d\n", dwLocalD3DVersion); + if(dwLocalDDVersion) OutTraceDW("QueryInterface(D): Got interface for DX version %d\n", dwLocalDDVersion); + if(dwLocalD3DVersion) OutTraceDW("QueryInterface(D): Got interface for D3D version %d\n", dwLocalD3DVersion); if (dwLocalDDVersion > dxw.dwMaxDDVersion) { *obp = NULL; - OutTraceD("QueryInterface(D): lpdd=%x REFIID=%x obp=(NULL) ret=%x at %d\n", + OutTraceDW("QueryInterface(D): lpdd=%x REFIID=%x obp=(NULL) ret=%x at %d\n", lpdd, riid.Data1, res, __LINE__); return(0); } @@ -1587,7 +1578,7 @@ HRESULT WINAPI extQueryInterfaceD(void *lpdd, REFIID riid, LPVOID *obp) break; } - OutTraceD("QueryInterface(D): lpdd=%x REFIID=%x obp=%x DDVersion=%d ret=0\n", + OutTraceDDRAW("QueryInterface(D): lpdd=%x REFIID=%x obp=%x DDVersion=%d ret=0\n", lpdd, riid.Data1, *obp, dxw.dwDDVersion); return 0; @@ -1604,7 +1595,7 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) BOOL IsGammaRamp; unsigned int dwLocalDDVersion; - OutTraceD("QueryInterface(S): lpdds=%x REFIID=%x(%s) obp=%x\n", + OutTraceDDRAW("QueryInterface(S): lpdds=%x REFIID=%x(%s) obp=%x\n", lpdds, riid.Data1, ExplainGUID((GUID *)&riid), *obp); IsPrim=dxw.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds); @@ -1629,35 +1620,36 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) dwLocalDDVersion = 7; break; case 0x84e63de0: + OutTraceDW("QueryInterface: IID_IDirect3DHALDevice\n"); 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"); + OutTraceDW("QueryInterface: suppress IID_IDirect3DHALDevice interface res=DDERR_GENERIC\n"); return DDERR_GENERIC; } break; case 0xA4665C60: // IID_IDirect3DRGBDevice - OutTraceD("QueryInterface: IID_IDirect3DRGBDevice\n"); + OutTraceDW("QueryInterface: IID_IDirect3DRGBDevice\n"); break; case 0xF2086B20: // IID_IDirect3DRampDevice - OutTraceD("QueryInterface: IID_IDirect3DRampDevice\n"); + OutTraceDW("QueryInterface: IID_IDirect3DRampDevice\n"); break; case 0x881949a1: // IID_IDirect3DMMXDevice - OutTraceD("QueryInterface: IID_IDirect3DMMXDevice\n"); + OutTraceDW("QueryInterface: IID_IDirect3DMMXDevice\n"); break; case 0x4B9F0EE0: - OutTraceD("QueryInterface: IID_IDirectDrawColorControl\n"); + OutTraceDW("QueryInterface: IID_IDirectDrawColorControl\n"); break; case 0x69C11C3E: - OutTraceD("QueryInterface: IID_IDirectDrawGammaControl\n"); + OutTraceDW("QueryInterface: IID_IDirectDrawGammaControl\n"); IsGammaRamp=TRUE; break; } if (dwLocalDDVersion > dxw.dwMaxDDVersion) { *obp = NULL; - OutTraceD("QueryInterface(S): DDVersion=%d SUPPRESSED lpdds=%x(%s) REFIID=%x obp=(NULL) ret=0 at %d\n", + OutTraceDW("QueryInterface(S): DDVersion=%d SUPPRESSED lpdds=%x(%s) REFIID=%x obp=(NULL) ret=0 at %d\n", dwLocalDDVersion, lpdds, IsPrim?"":"(PRIM)", riid.Data1, __LINE__); return(0); } @@ -1666,18 +1658,18 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) if(res) // added trace { - OutTraceD("QueryInterface(S): ERROR lpdds=%x%s REFIID=%x obp=%x ret=%x(%s) at %d\n", + OutTraceDW("QueryInterface(S): ERROR lpdds=%x%s REFIID=%x obp=%x ret=%x(%s) at %d\n", lpdds, IsPrim?"(PRIM)":"", riid.Data1, *obp, res, ExplainDDError(res), __LINE__); return res; } if (! *obp) { - OutTraceD("QueryInterface(S): Interface for DX version %d not found\n", dwLocalDDVersion); + OutTraceDW("QueryInterface(S): Interface for DX version %d not found\n", dwLocalDDVersion); return(0); } // added trace - OutTraceD("QueryInterface(S): lpdds=%x%s REFIID=%x obp=%x DDVersion=%d ret=0\n", + OutTraceDDRAW("QueryInterface(S): lpdds=%x%s REFIID=%x obp=%x DDVersion=%d ret=0\n", lpdds, IsPrim?"(PRIM)":"", riid.Data1, *obp, dwLocalDDVersion); switch (dwLocalDDVersion){ @@ -1688,7 +1680,7 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) case 7: dxw.dwDDVersion=dwLocalDDVersion; if(IsPrim){ - OutTraceD("QueryInterface(S): primary=%x new=%x\n", lpdds, *obp); + OutTraceDW("QueryInterface(S): primary=%x new=%x\n", lpdds, *obp); dxw.MarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp); HookDDSurfacePrim((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion); } @@ -1711,7 +1703,7 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) if((lpdds == lpDDSBack) && dwLocalDDVersion) { // assume that you always use the newer interface version, if available. if(dwLocalDDVersion > (UINT)iBakBufferVersion){ - OutTraceD("QueryInterface(S): switching backbuffer %x -> %x\n", lpDDSBack, *obp); + OutTraceDW("QueryInterface(S): switching backbuffer %x -> %x\n", lpDDSBack, *obp); lpDDSBack = (LPDIRECTDRAWSURFACE)*obp; iBakBufferVersion = dwLocalDDVersion; } @@ -1726,7 +1718,7 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd, DDSURFACEDESC2 ddsd; HRESULT res = 0; - if(IsTraceD){ + if(IsTraceDDRAW){ OutTrace("SetDisplayMode: version=%d dwWidth=%i dwHeight=%i dwBPP=%i", version, dwwidth, dwheight, dwbpp); if (version==2) OutTrace(" dwRefresh=%i dwFlags=%x\n", dwrefreshrate, dwflags); @@ -1745,11 +1737,11 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd, ddsd.dwSize=sizeof(ddsd); SetPixFmt(&ddsd); SetBltTransformations(); - OutTraceD("SetDisplayMode: mode=EMULATE %s ret=OK\n", DumpPixelFormat(&ddsd)); + OutTraceDW("SetDisplayMode: mode=EMULATE %s ret=OK\n", DumpPixelFormat(&ddsd)); return DD_OK; } - OutTraceD("SetDisplayMode: mode=STANDARD BPP=%d\n", dwbpp); + OutTraceDW("SetDisplayMode: mode=STANDARD BPP=%d\n", dwbpp); dxw.ActualPixelFormat.dwRGBBitCount = dwbpp; ZeroMemory(&ddsd, sizeof(ddsd)); @@ -1764,7 +1756,7 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd, else res = (*pSetDisplayMode2)(lpdd, ddsd.dwWidth, ddsd.dwHeight, dwbpp, ddsd.dwRefreshRate, 0); - OutTraceD("SetDisplayMode: fixing colordepth current=%d required=%d size=(%dx%d)\n", + OutTraceDW("SetDisplayMode: fixing colordepth current=%d required=%d size=(%dx%d)\n", ddsd.ddpfPixelFormat.dwRGBBitCount, dwbpp, ddsd.dwWidth, ddsd.dwHeight); return 0; @@ -1784,7 +1776,7 @@ HRESULT WINAPI extSetDisplayMode1(LPDIRECTDRAW lpdd, HRESULT WINAPI extGetDisplayMode(LPDIRECTDRAW lpdd, LPDDSURFACEDESC lpddsd) { - OutTraceD("GetDisplayMode\n"); + OutTraceDDRAW("GetDisplayMode: lpdd=%x lpddsd=%s\n", lpdd, lpddsd); (*pGetDisplayMode)(lpdd, lpddsd); if(dxw.dwFlags1 & EMULATESURFACE) { @@ -1798,10 +1790,10 @@ HRESULT WINAPI extGetDisplayMode(LPDIRECTDRAW lpdd, LPDDSURFACEDESC lpddsd) if(dxw.dwFlags2 & (INIT8BPP|INIT16BPP)){ // v2.02.32 fix if(dxw.dwFlags2 & INIT8BPP) FixPixelFormat(8, &lpddsd->ddpfPixelFormat); if(dxw.dwFlags2 & INIT16BPP) FixPixelFormat(16, &lpddsd->ddpfPixelFormat); - OutTraceD("GetDisplayMode: fix RGBBitCount=%d\n", lpddsd->ddpfPixelFormat.dwRGBBitCount); + OutTraceDW("GetDisplayMode: fix RGBBitCount=%d\n", lpddsd->ddpfPixelFormat.dwRGBBitCount); } - //OutTraceD("GetDisplayMode: returning WxH=(%dx%d) PixelFormat Flags=%x(%s) RGBBitCount=%d RGBAmask=(%x,%x,%x,%x) Caps=%x(%s)\n", + //OutTraceDW("GetDisplayMode: returning WxH=(%dx%d) PixelFormat Flags=%x(%s) RGBBitCount=%d RGBAmask=(%x,%x,%x,%x) Caps=%x(%s)\n", // lpddsd->dwWidth, lpddsd->dwHeight, // lpddsd->ddpfPixelFormat.dwFlags, ExplainPixelFormatFlags(lpddsd->ddpfPixelFormat.dwFlags), // lpddsd->ddpfPixelFormat.dwRGBBitCount, @@ -1809,7 +1801,7 @@ HRESULT WINAPI extGetDisplayMode(LPDIRECTDRAW lpdd, LPDDSURFACEDESC lpddsd) // lpddsd->ddpfPixelFormat.dwRGBAlphaBitMask, // lpddsd->ddsCaps.dwCaps, ExplainDDSCaps(lpddsd->ddsCaps.dwCaps)); - OutTraceD("GetDisplayMode: returning size=(%dx%d) %s\n", lpddsd->dwWidth, lpddsd->dwHeight, DumpPixelFormat((LPDDSURFACEDESC2)lpddsd)); + OutTraceDDRAW("GetDisplayMode: returning size=(%dx%d) %s\n", lpddsd->dwWidth, lpddsd->dwHeight, DumpPixelFormat((LPDDSURFACEDESC2)lpddsd)); return 0; } @@ -1818,7 +1810,7 @@ void FixWindowFrame(HWND hwnd) { LONG nOldStyle; - OutTraceD("FixWindowFrame: hwnd=%x\n", hwnd); + OutTraceDW("FixWindowFrame: hwnd=%x\n", hwnd); nOldStyle=(*pGetWindowLong)(hwnd, GWL_STYLE); if (!nOldStyle){ @@ -1826,7 +1818,7 @@ void FixWindowFrame(HWND hwnd) return; } - OutTraceD("FixWindowFrame: style=%x(%s)\n",nOldStyle,ExplainStyle(nOldStyle)); + OutTraceDW("FixWindowFrame: style=%x(%s)\n",nOldStyle,ExplainStyle(nOldStyle)); // fix style if (!(*pSetWindowLong)(hwnd, GWL_STYLE, WS_OVERLAPPEDWINDOW)){ @@ -1848,7 +1840,7 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags) { HRESULT res; - OutTraceD("SetCooperativeLevel: hwnd=%x dwFlags=%x(%s)\n", + OutTraceDDRAW("SetCooperativeLevel: hwnd=%x dwFlags=%x(%s)\n", hwnd, dwflags,ExplainCoopFlags(dwflags)); InitDDScreenParameters((LPDIRECTDRAW)lpdd); @@ -1863,7 +1855,7 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags) // 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()); + OutTraceDW("SetCooperativeLevel: desktop hwnd=%x -> %x\n", hwnd, dxw.GethWnd()); hwnd=dxw.GethWnd(); } dxw.SetFullScreen(TRUE); @@ -2175,7 +2167,7 @@ static void FixSurfaceCaps(LPDDSURFACEDESC2 lpddsd, int dxversion) if(!(lpddsd->dwFlags & DDSD_CAPS)) lpddsd->ddsCaps.dwCaps = 0; - OutTraceD("FixSurfaceCaps: Flags=%x(%s) Caps=%x(%s)\n", + OutTraceDW("FixSurfaceCaps: Flags=%x(%s) Caps=%x(%s)\n", lpddsd->dwFlags, ExplainFlags(lpddsd->dwFlags), lpddsd->ddsCaps.dwCaps, ExplainDDSCaps(lpddsd->ddsCaps.dwCaps)); if(dxw.dwFlags3 & ANALYTICMODE) return FixSurfaceCapsAnalytic(lpddsd, dxversion); @@ -2272,7 +2264,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf // then save it dxw.VirtualPixelFormat = ddsd.ddpfPixelFormat; - OutTraceD("DDSD_PIXELFORMAT: color=%d flags=%x\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.VirtualPixelFormat.dwFlags); + OutTraceDW("DDSD_PIXELFORMAT: color=%d flags=%x\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.VirtualPixelFormat.dwFlags); ddsd.dwFlags &= ~(DDSD_BACKBUFFERCOUNT|DDSD_REFRESHRATE); ddsd.dwFlags |= (DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT|DDSD_PIXELFORMAT); ddsd.ddsCaps.dwCaps &= ~(DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_COMPLEX|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM); @@ -2300,7 +2292,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf } } - OutTraceD("CreateSurface: created PRIMARY DDSPrim=%x\n", *lplpdds); + OutTraceDW("CreateSurface: created PRIMARY DDSPrim=%x\n", *lplpdds); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim", __LINE__); HookDDSurfacePrim(lplpdds, dxversion); @@ -2312,7 +2304,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSEmu_Prim, 0); if(res==DDERR_PRIMARYSURFACEALREADYEXISTS){ - OutTraceD("CreateSurface: ASSERT DDSEmu_Prim already exists\n"); + OutTraceDW("CreateSurface: ASSERT DDSEmu_Prim already exists\n"); res=(*pGetGDISurface)(lpdd, &lpDDSEmu_Prim); // ok only if the previous surface has the good properties!!! (*pReleaseS)(lpDDSEmu_Prim); } @@ -2321,7 +2313,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd); return res; } - OutTraceD("CreateSurface: created new DDSEmu_Prim=%x\n",lpDDSEmu_Prim); + OutTraceDW("CreateSurface: created new DDSEmu_Prim=%x\n",lpDDSEmu_Prim); if(IsDebug) DescribeSurface(lpDDSEmu_Prim, dxversion, "DDSEmu_Prim", __LINE__); InitDSScreenParameters(lpDDSEmu_Prim); dxw.MarkRegularSurface(lpDDSEmu_Prim); @@ -2344,7 +2336,7 @@ static HRESULT BuildPrimaryEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd); return res; } - OutTraceD("CreateSurface: created new DDSEmu_Back=%x\n", lpDDSEmu_Back); + OutTraceDW("CreateSurface: created new DDSEmu_Back=%x\n", lpDDSEmu_Back); if(IsDebug) DescribeSurface(lpDDSEmu_Back, dxversion, "DDSEmu_Back", __LINE__); dxw.MarkRegularSurface(lpDDSEmu_Back); if (dxw.dwTFlags & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Back, dxversion); @@ -2382,7 +2374,7 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf } } - OutTraceD("CreateSurface: created PRIMARY DDSPrim=%x\n", *lplpdds); + OutTraceDW("CreateSurface: created PRIMARY DDSPrim=%x\n", *lplpdds); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim", __LINE__); if(dxw.dwFlags1 & EMULATEBUFFER){ @@ -2401,7 +2393,7 @@ static HRESULT BuildPrimaryDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf OutTraceE("CreateSurface: ERROR on DDSPrim res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__); return res; } - OutTraceD("CreateSurface: created FIX DDSPrim=%x\n", *lplpdds); + OutTraceDW("CreateSurface: created FIX DDSPrim=%x\n", *lplpdds); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSPrim(2)", __LINE__); } @@ -2435,7 +2427,7 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS return res; } - OutTraceD("CreateSurface: created BACK DDSBack=%x\n", *lplpdds); + OutTraceDW("CreateSurface: created BACK DDSBack=%x\n", *lplpdds); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__); HookDDSurfaceGeneric(lplpdds, dxversion); // added !!! lpBackBufferDD = lpdd; // v2.02.31 @@ -2469,13 +2461,13 @@ static HRESULT BuildBackBufferDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS (*pReleaseS)(lpPrim); ddsd.dwWidth = prim.dwWidth; ddsd.dwHeight = prim.dwHeight; - OutTraceD("BMX FIX: res=%x(%s) wxh=(%dx%d)\n", res, ExplainDDError(res),ddsd.dwWidth, ddsd.dwHeight); + OutTraceDW("BMX FIX: res=%x(%s) wxh=(%dx%d)\n", res, ExplainDDError(res),ddsd.dwWidth, ddsd.dwHeight); } DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]" , __LINE__); res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0); if(res) { if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){ - OutTraceD("CreateSurface: CreateSurface DDERR_OUTOFVIDEOMEMORY ERROR at %d, retry in SYSTEMMEMORY\n", __LINE__); + OutTraceDW("CreateSurface: CreateSurface DDERR_OUTOFVIDEOMEMORY ERROR at %d, retry in SYSTEMMEMORY\n", __LINE__); ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; // try ... ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; // try ... res=(*pCreateSurface)(lpdd, &ddsd, lplpdds, 0); @@ -2486,7 +2478,7 @@ static HRESULT BuildBackBufferDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS } } - OutTraceD("CreateSurface: created BACK DDSBack=%x\n", *lplpdds); + OutTraceDW("CreateSurface: created BACK DDSBack=%x\n", *lplpdds); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__); HookDDSurfaceGeneric(lplpdds, dxversion); // added !!! lpBackBufferDD = lpdd; // v2.02.31 @@ -2510,7 +2502,7 @@ static HRESULT BuildGenericEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf return res; } - OutTraceD("CreateSurface: created Emu_Generic dds=%x\n", *lplpdds); + OutTraceDW("CreateSurface: created Emu_Generic dds=%x\n", *lplpdds); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSEmu_Generic", __LINE__); // diagnostic hooks .... HookDDSurfaceGeneric(lplpdds, dxversion); @@ -2527,7 +2519,7 @@ static HRESULT BuildGenericDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf res = (*pCreateSurface)(lpdd, lpddsd, lplpdds, 0); if(res){ if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){ - OutTraceD("CreateSurface ERROR: res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__); + OutTraceDW("CreateSurface ERROR: res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__); lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; lpddsd->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; res = (*pCreateSurface)(lpdd, lpddsd, lplpdds, 0); @@ -2537,13 +2529,13 @@ static HRESULT BuildGenericDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateSurf return res; } } - OutTraceD("CreateSurface: created GENERIC surface dds=%x flags=%x(%s) caps=%x(%s)\n", + OutTraceDW("CreateSurface: created GENERIC surface dds=%x flags=%x(%s) caps=%x(%s)\n", *lplpdds, lpddsd->dwFlags, ExplainFlags(lpddsd->dwFlags), lpddsd->ddsCaps.dwCaps, ExplainDDSCaps(lpddsd->ddsCaps.dwCaps)); // hooks .... HookDDSurfaceGeneric(lplpdds, dxversion); - OutTraceD("CreateSurface: created lpdds=%x type=Generic ret=%x\n", *lplpdds, res); + OutTraceDW("CreateSurface: created lpdds=%x type=Generic ret=%x\n", *lplpdds, res); if(IsDebug) DescribeSurface(*lplpdds, dxversion, "Generic", __LINE__); //v2.02.44 bug fix return DD_OK; @@ -2573,7 +2565,7 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate BuildGeneric = BuildGenericDir; } - if(IsTraceD){ + if(IsTraceDDRAW){ OutTrace("CreateSurface: Version=%d lpdd=%x ", dxversion, lpdd); LogSurfaceAttributes((LPDDSURFACEDESC)lpddsd, "[CreateSurface]", __LINE__); } @@ -2584,14 +2576,14 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate char sMsg[81]; sprintf_s(sMsg,80, "CreateSurface: ASSERT bad dwSize=%d dxversion=%d\n", lpddsd->dwSize, dxversion); - OutTraceD(sMsg); + OutTraceDW(sMsg); if(IsAssertEnabled) MessageBox(0, sMsg, "CreateSurface", MB_OK | MB_ICONEXCLAMATION); return DDERR_INVALIDPARAMS; } //GHO workaround (needed for WarWind, Rogue Spear): if (lpddsd->dwFlags && !(lpddsd->dwFlags & 0x1)){ - OutTraceD("CreateSurface: fixing illegal dwFlags value: %x -> %x\n", + OutTraceDW("CreateSurface: fixing illegal dwFlags value: %x -> %x\n", lpddsd->dwFlags, lpddsd->dwFlags+1); lpddsd->dwFlags++; } @@ -2631,13 +2623,13 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) BBCount=ddsd.dwBackBufferCount; if ((BBCount > 0) && (iBakBufferVersion < 4)){ lpDDSBack=NULL; - OutTraceD("CreateSurface: backbuffer cleared - BackBufferCount=%d\n", BBCount); + OutTraceDW("CreateSurface: backbuffer cleared - BackBufferCount=%d\n", BBCount); } if (BBCount > MAXBACKBUFFERS){ char sMsg[81]; sprintf_s(sMsg, 80, "CreateSurface: BackBufferCount=%d\n", BBCount); - OutTraceD(sMsg); + OutTraceDW(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "CreateSurface", MB_OK | MB_ICONEXCLAMATION); // recover ... BBCount = MAXBACKBUFFERS; @@ -2665,7 +2657,7 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate lpDDSBack->AddRef(); // should it be repeated BBCount times???? } - if(IsTraceD){ + if(IsTraceDDRAW){ OutTrace("CreateSurface: created DDSPrim=%x DDSBack=%x", lpDDSPrim, lpDDSBack); if(dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)) OutTrace(" DDSEmu_Prim=%x", lpDDSEmu_Prim); if(dxw.dwFlags1 & EMULATESURFACE) OutTrace(" DDSEmu_Back=%x", lpDDSEmu_Back); @@ -2680,7 +2672,7 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate // a request for a separate (not complex) backbuffer to attach later on, maybe. if ((ddsd.dwFlags & DDSD_CAPS) && (ddsd.ddsCaps.dwCaps & DDSCAPS_BACKBUFFER)){ if (lpDDSBack) { - OutTraceD("CreateSurface: returning current DDSBack=%x\n", lpDDSBack); + OutTraceDW("CreateSurface: returning current DDSBack=%x\n", lpDDSBack); *lplpdds = lpDDSBack; return DD_OK; } @@ -2696,7 +2688,7 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate if(lpddsd->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) { lpDDZBuffer=*lplpdds; DDZBufferCaps = lpddsd->ddsCaps.dwCaps; - OutTraceD("CreateSurface: lpDDZBuffer=%x save ZBUFFER caps=%x(%s)\n", lpDDZBuffer, DDZBufferCaps, ExplainDDSCaps(DDZBufferCaps)); + OutTraceDW("CreateSurface: lpDDZBuffer=%x save ZBUFFER caps=%x(%s)\n", lpDDZBuffer, DDZBufferCaps, ExplainDDSCaps(DDZBufferCaps)); } res=BuildGeneric(lpdd, pCreateSurface, lpddsd, dxversion, lplpdds, pu); @@ -2736,12 +2728,12 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet IsPrim=dxw.IsAPrimarySurface(lpdds); IsBack=dxw.IsABackBufferSurface(lpdds); - OutTraceD("GetAttachedSurface(%d): lpdds=%x%s caps=%x(%s)\n", + OutTraceDDRAW("GetAttachedSurface(%d): lpdds=%x%s caps=%x(%s)\n", dxversion, lpdds, (IsPrim?"(PRIM)":(IsBack ? "(BACK)":"")), lpddsc->dwCaps, ExplainDDSCaps(lpddsc->dwCaps)); #if 0 if(lpddsc->dwCaps & DDSCAPS_MIPMAP){ - OutTraceD("GetAttachedSurface: emulate MIPMAP capability\n"); + OutTraceDW("GetAttachedSurface: emulate MIPMAP capability\n"); lpddsc->dwCaps &= ~DDSCAPS_MIPMAP; } #endif @@ -2751,7 +2743,7 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet // //if (IsBack && (lpddsc->dwCaps & DDSCAPS_ZBUFFER) && lpDDZBuffer){ // *lplpddas = lpDDZBuffer; - // OutTraceD("GetAttachedSurface(%d): emulating ZBUFFER attach on BACKBUFFER lpddsadd=%x\n", dxversion, *lplpddas); + // OutTraceDW("GetAttachedSurface(%d): emulating ZBUFFER attach on BACKBUFFER lpddsadd=%x\n", dxversion, *lplpddas); // return 0; //} @@ -2764,7 +2756,7 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet if (IsBack && (DDSD_Prim.dwBackBufferCount > 1)){ *lplpddas = lpDDSBack; - OutTraceD("GetAttachedSurface(%d): DOUBLEBUFFER attached=%x\n", dxversion, *lplpddas); + OutTraceDW("GetAttachedSurface(%d): DOUBLEBUFFER attached=%x\n", dxversion, *lplpddas); return 0; } @@ -2774,12 +2766,12 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet if(IsPrim && (lpddsc->dwCaps & (DDSCAPS_BACKBUFFER|DDSCAPS_FLIP))) { // v2.02.42 added DDSCAPS_FLIP for Empire Earth if (lpDDSBack) { *lplpddas = lpDDSBack; - OutTraceD("GetAttachedSurface(%d): BACKBUFFER attached=%x\n", dxversion, *lplpddas); + OutTraceDW("GetAttachedSurface(%d): BACKBUFFER attached=%x\n", dxversion, *lplpddas); return 0; } else { *lplpddas = NULL; - OutTraceD("GetAttachedSurface(%d): no attached BACKBUFFER\n", dxversion); + OutTraceDW("GetAttachedSurface(%d): no attached BACKBUFFER\n", dxversion); return DDERR_NOTFOUND; } } @@ -2790,7 +2782,7 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet if(res) OutTraceE("GetAttachedSurface(%d): ERROR res=%x(%s) at %d\n", dxversion, res, ExplainDDError(res), __LINE__); else - OutTraceD("GetAttachedSurface(%d): attached=%x\n", dxversion, *lplpddas); + OutTraceDDRAW("GetAttachedSurface(%d): attached=%x\n", dxversion, *lplpddas); return res; } @@ -2817,18 +2809,18 @@ HRESULT WINAPI extGetAttachedSurface7(LPDIRECTDRAWSURFACE lpdds, LPDDSCAPS lpdds static void BlitError(HRESULT res, LPRECT lps, LPRECT lpd, int line) { - OutTraceE("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), line); + OutTrace("Blt: ERROR %x(%s) at %d", res, ExplainDDError(res), line); if (res==DDERR_INVALIDRECT){ if (lps) - OutTraceE(" src=(%d,%d)-(%d,%d)",lps->left, lps->top, lps->right, lps->bottom); + OutTrace(" src=(%d,%d)-(%d,%d)",lps->left, lps->top, lps->right, lps->bottom); else - OutTraceE(" src=(NULL)"); + OutTrace(" src=(NULL)"); if (lpd) - OutTraceE(" dest=(%d,%d)-(%d,%d)",lpd->left, lpd->top, lpd->right, lpd->bottom); + OutTrace(" dest=(%d,%d)-(%d,%d)",lpd->left, lpd->top, lpd->right, lpd->bottom); else - OutTraceE(" dest=(NULL)"); + OutTrace(" dest=(NULL)"); } - OutTraceE("\n"); + OutTrace("\n"); return; } @@ -2868,7 +2860,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, CleanRect(&lpsrcrect,__LINE__); // log - if(IsTraceD){ + if(IsTraceDW){ char sLog[256]; char sInfo[128]; sprintf(sLog, "%s: dest=%x%s src=%x%s dwFlags=%x(%s)", @@ -3037,7 +3029,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, if (isFlipping){ // handle the flipping chain ... lpddssrc=lpDDSBack; - OutTraceD("Flip: setting flip chain to lpdds=%x\n", lpddssrc); + OutTraceDW("Flip: setting flip chain to lpdds=%x\n", lpddssrc); } } @@ -3124,7 +3116,7 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc, HRESULT res; IsPrim=dxw.IsAPrimarySurface(lpdds); - OutTraceD("Flip: lpdds=%x%s, src=%x, flags=%x(%s)\n", + OutTraceDDRAW("Flip: lpdds=%x%s, src=%x, flags=%x(%s)\n", lpdds, IsPrim?"(PRIM)":"", lpddssrc, dwflags, ExplainFlipFlags(dwflags)); if (!IsPrim){ @@ -3139,7 +3131,7 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc, sd.dwSize=Set_dwSize_From_Surface(lpdds); res=lpdds->GetSurfaceDesc((DDSURFACEDESC *)&sd); - if (res) OutTraceD("Flip: GetSurfaceDesc res=%x at %d\n",res, __LINE__); + if (res) OutTraceDW("Flip: GetSurfaceDesc res=%x at %d\n",res, __LINE__); // replace these CAPS (good for seven kingdoms II) with same as lpdds surface //ddsc.dwCaps=DDSCAPS_OFFSCREENPLAIN+DDSCAPS_SYSTEMMEMORY; @@ -3220,7 +3212,7 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy, CleanRect(&lpsrcrect,__LINE__); - if(IsTraceD){ + if(IsTraceDDRAW){ OutTrace("BltFast: dest=%x%s src=%x%s dwTrans=%x(%s) (x,y)=(%d,%d) ", lpdds, ToPrim?"(PRIM)":"", lpddssrc, FromPrim?"(PRIM)":"", dwtrans, ExplainBltFastFlags(dwtrans), dwx, dwy); if (lpsrcrect) @@ -3233,7 +3225,7 @@ HRESULT WINAPI extBltFast(LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy, // consistency check .... if (lpsrcrect) if((lpsrcrect->left >= lpsrcrect->right) || (lpsrcrect->top >= lpsrcrect->bottom)) { - OutTraceD("BltFast: ASSERT bad rect at %d\n", __LINE__); + OutTraceDW("BltFast: ASSERT bad rect at %d\n", __LINE__); return 0; } @@ -3295,7 +3287,7 @@ HRESULT WINAPI extCreatePalette(LPDIRECTDRAW lpdd, DWORD dwflags, LPPALETTEENTRY { HRESULT res; - OutTraceD("CreatePalette: dwFlags=%x(%s)\n", dwflags, ExplainCreatePaletteFlags(dwflags)); + OutTraceDDRAW("CreatePalette: dwFlags=%x(%s)\n", dwflags, ExplainCreatePaletteFlags(dwflags)); if(IsDebug && (dwflags & DDPCAPS_8BIT)) dxw.DumpPalette(256, lpddpa); //if (dwflags & ~(DDPCAPS_PRIMARYSURFACE|DDPCAPS_8BIT|DDPCAPS_ALLOW256|DDPCAPS_INITIALIZE_LEGACY)) STOPPER("Palette flags"); @@ -3306,7 +3298,7 @@ HRESULT WINAPI extCreatePalette(LPDIRECTDRAW lpdd, DWORD dwflags, LPPALETTEENTRY OutTraceE("CreatePalette: ERROR res=%x(%s)\n", res, ExplainDDError(res)); return res; } - else OutTraceD("CreatePalette: OK lpddp=%x\n", *lplpddp); + else OutTraceDDRAW("CreatePalette: OK lpddp=%x\n", *lplpddp); HookDDPalette(lplpddp); return 0; @@ -3316,11 +3308,11 @@ HRESULT WINAPI extGetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE *lpl { HRESULT res; - OutTraceD("GetPalette: lpdds=%x\n", lpdds); + OutTraceDDRAW("GetPalette: lpdds=%x\n", lpdds); res=(*pGetPalette)(lpdds, lplpddp); if (res) OutTraceE("GetPalette: ERROR res=%x(%s)\n", res, ExplainDDError(res)); - else OutTraceD("GetPalette: OK\n"); + else OutTraceDDRAW("GetPalette: OK\n"); return res; } @@ -3331,15 +3323,15 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd HRESULT res; isPrim=dxw.IsAPrimarySurface(lpdds); - OutTraceD("SetPalette: lpdds=%x%s lpddp=%x\n", lpdds, isPrim?"(PRIM)":"", lpddp); + OutTraceDDRAW("SetPalette: lpdds=%x%s lpddp=%x\n", lpdds, isPrim?"(PRIM)":"", lpddp); res=(*pSetPalette)(lpdds, lpddp); res=DD_OK; if(res)OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - else OutTraceD("SetPalette: OK\n"); + else OutTraceDDRAW("SetPalette: OK\n"); if((dxw.dwFlags1 & EMULATESURFACE) && isPrim){ - OutTraceD("SetPalette: register PRIMARY palette lpDDP=%x\n", lpddp); + OutTraceDW("SetPalette: register PRIMARY palette lpDDP=%x\n", lpddp); lpDDP = lpddp; if(lpddp){ HRESULT res2; @@ -3358,20 +3350,20 @@ HRESULT WINAPI extSetEntries(LPDIRECTDRAWPALETTE lpddp, DWORD dwflags, DWORD dws { HRESULT res; - OutTraceD("SetEntries: lpddp=%x dwFlags=%x, start=%d, count=%d entries=%x\n", //GHO: added trace infos + OutTraceDDRAW("SetEntries: lpddp=%x dwFlags=%x, start=%d, count=%d entries=%x\n", //GHO: added trace infos lpddp, dwflags, dwstart, dwcount, lpentries); if(IsDebug) dxw.DumpPalette(dwcount, &lpentries[dwstart]); res = (*pSetEntries)(lpddp, dwflags, dwstart, dwcount, lpentries); if(res) OutTraceE("SetEntries: ERROR res=%x(%s)\n", res, ExplainDDError(res)); - else OutTraceD("SetEntries: OK\n"); + else OutTraceDDRAW("SetEntries: OK\n"); if((dxw.dwFlags1 & EMULATESURFACE) && (lpDDP == lpddp)){ - OutTraceD("SetEntries: update PRIMARY palette lpDDP=%x\n", lpddp); + OutTraceDW("SetEntries: update PRIMARY palette lpDDP=%x\n", lpddp); if ((dwstart + dwcount > 256) || (dwstart<0)){ dwcount=256; dwstart=0; - OutTraceD("SetEntries: ASSERT start+count > 256\n"); + OutTraceDW("SetEntries: ASSERT start+count > 256\n"); } mySetPalette(dwstart, dwcount, lpentries); @@ -3390,7 +3382,7 @@ HRESULT WINAPI extSetClipper(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWCLIPPER lpdd HRESULT res; BOOL isPrim; isPrim=dxw.IsAPrimarySurface(lpdds); - OutTraceD("SetClipper: lpdds=%x%s lpddc=%x\n", lpdds, isPrim?"(PRIM)":"", lpddc); + OutTraceDDRAW("SetClipper: lpdds=%x%s lpddc=%x\n", lpdds, isPrim?"(PRIM)":"", lpddc); // v2.1.84: SUPPRESSCLIPPING flag - improves "Monopoly Edition 3D" where continuous // clipping ON & OFF affects blitting on primary surface. @@ -3399,7 +3391,7 @@ HRESULT WINAPI extSetClipper(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWCLIPPER lpdd if(dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)){ if ((isPrim && lpDDSEmu_Prim) || ((lpdds == lpDDSBack) && lpDDSEmu_Back)){ - OutTraceD("SetClipper: skip primary/backbuffer lpdds=%x\n", lpdds); + OutTraceDW("SetClipper: skip primary/backbuffer lpdds=%x\n", lpdds); res=0; } else @@ -3421,7 +3413,7 @@ HRESULT WINAPI extLock(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAWSUR IsPrim=dxw.IsAPrimarySurface(lpdds); CleanRect(&lprect, __LINE__); - if(IsTraceD){ + if(IsTraceDDRAW){ OutTrace("Lock: lpdds=%x%s flags=%x(%s) lpdds2=%x", lpdds, (IsPrim ? "(PRIM)":""), flags, ExplainLockFlags(flags), lpdds2); if (lprect) @@ -3434,7 +3426,7 @@ HRESULT WINAPI extLock(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAWSUR if(res==DDERR_SURFACEBUSY){ // v70: fix for "Ancient Evil" (*pUnlockMethod(lpdds))(lpdds, NULL); res = (*pLock)(lpdds, lprect, lpdds2, flags, hEvent); - OutTraceD("Lock RETRY: ret=%x(%s)\n", res, ExplainDDError(res)); + OutTraceDW("Lock RETRY: ret=%x(%s)\n", res, ExplainDDError(res)); } if(res) OutTraceE("Lock ERROR: ret=%x(%s)\n", res, ExplainDDError(res)); DumpSurfaceAttributes((LPDDSURFACEDESC)lpdds2, "[Locked]" , __LINE__); @@ -3458,7 +3450,7 @@ HRESULT WINAPI extLockDir(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAW // 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==lpPrimaryDD->GetGDISurface(&lpDDSPrim); - if(IsTraceD){ + if(IsTraceDDRAW){ OutTrace("Lock: lpdds=%x flags=%x(%s) lpdds2=%x", lpdds, flags, ExplainLockFlags(flags), lpdds2); if (lprect) @@ -3510,7 +3502,7 @@ HRESULT WINAPI extLockDir(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAW OffsetRect(lprect, upleft.x+(client.right-dxw.GetScreenWidth())/2, upleft.y+(client.bottom-dxw.GetScreenHeight())/2); - OutTraceD("Lock: NULL rect remapped to (%d,%d)-(%d,%d)\n", + OutTraceDW("Lock: NULL rect remapped to (%d,%d)-(%d,%d)\n", lprect->left, lprect->top, lprect->right, lprect->bottom); } } @@ -3535,7 +3527,7 @@ HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFAC if ((dxversion == 4) && lprect) CleanRect(&lprect,__LINE__); - if(IsTraceD){ + if(IsTraceDDRAW){ OutTrace("Unlock: lpdds=%x%s ", lpdds, (IsPrim ? "(PRIM)":"")); if (dxversion == 4){ if (lprect){ @@ -3576,7 +3568,7 @@ HRESULT WINAPI extUnlockDir(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSUR if ((dxversion >= 4) && lprect) CleanRect(&lprect,__LINE__); - if(IsTraceD){ + if(IsTraceDDRAW){ OutTrace("Unlock: lpdds=%x%s ", lpdds, (IsPrim ? "(PRIM)":"")); if (dxversion == 4){ if (lprect){ @@ -3634,14 +3626,14 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC) BOOL IsPrim; IsPrim=dxw.IsAPrimarySurface(lpdds); - OutTraceD("GetDC: lpdss=%x%s\n",lpdds, IsPrim?"(PRIM)":""); + OutTraceDDRAW("GetDC: lpdss=%x%s\n",lpdds, IsPrim?"(PRIM)":""); res=(*pGetDC)(lpdds, pHDC); if (res==DDERR_CANTCREATEDC && (dxw.dwFlags1 & EMULATESURFACE) && dxw.VirtualPixelFormat.dwRGBBitCount==8) { // for 8BPP palettized surfaces, connect them to either the ddraw emulated palette or the GDI emulated palette - OutTraceD("GetDC: adding 8BPP palette to surface lpdds=%x\n", lpdds); + OutTraceDW("GetDC: adding 8BPP palette to surface lpdds=%x\n", lpdds); if(lpDDP==NULL){ // should link here to the GDI palette? See Hyperblade.... dxw.palNumEntries=256; @@ -3660,7 +3652,7 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC) res=(*pGetDC)(lpdds, pHDC); } - OutTraceD("GetDC: res=%x hdc=%x\n",res, *pHDC); + OutTraceDDRAW("GetDC: res=%x hdc=%x\n",res, *pHDC); return res; } @@ -3670,11 +3662,11 @@ HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR hdc) BOOL IsPrim; IsPrim=dxw.IsAPrimarySurface(lpdds); - OutTraceD("ReleaseDC: lpdss=%x%s hdc=%x\n",lpdds, IsPrim?"(PRIM)":"", hdc); + OutTraceDDRAW("ReleaseDC: lpdss=%x%s hdc=%x\n",lpdds, IsPrim?"(PRIM)":"", hdc); res=(*pReleaseDC)(lpdds,hdc); if((IsPrim) && (dxw.dwFlags1 & EMULATESURFACE)) sBlt("ReleaseDC", lpdds, NULL, lpdds, NULL, 0, NULL, FALSE); if (res) OutTraceE("ReleaseDC: ERROR res=%x(%s)\n", res, ExplainDDError(res)); - + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK; return res; } @@ -3683,7 +3675,7 @@ HRESULT WINAPI extFlipToGDISurface(LPDIRECTDRAW lpdd) { //HRESULT res; - OutTraceD("FlipToGDISurface: lpdd=%x\n", lpdd); + OutTraceDDRAW("FlipToGDISurface: lpdd=%x\n", lpdd); // to revise: so far, it seems the best thing to do is NOTHING, just return 0. //res=(*pFlipToGDISurface)(lpdd); //if (res) OutTraceE("FlipToGDISurface: ERROR res=%x(%s), skipping\n", res, ExplainDDError(res)); @@ -3707,7 +3699,7 @@ HRESULT WINAPI extGetGDISurface(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE *w) OutTraceE("GetGDISurface: ERROR lpdd=%x res=%x(%s)\n", lpdd, res, ExplainDDError(res)); } else { - OutTraceD("GetGDISurface: PROXED lpdd=%x w=%x\n", lpdd, *w); + OutTraceDDRAW("GetGDISurface: lpdd=%x w=%x\n", lpdd, *w); } return res; @@ -3740,7 +3732,7 @@ HRESULT WINAPI myEnumModesFilter(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpConte // if PREVENTMAXIMIZE is set, don't let the caller know about forbidden screen settings. if((lpDDSurfaceDesc->dwHeight > dxw.GetScreenHeight()) || (lpDDSurfaceDesc->dwWidth > dxw.GetScreenWidth())){ - OutTraceD("EnumDisplayModes: skipping screen size=(%d,%d)\n", lpDDSurfaceDesc->dwHeight, lpDDSurfaceDesc->dwWidth); + OutTraceDW("EnumDisplayModes: skipping screen size=(%d,%d)\n", lpDDSurfaceDesc->dwHeight, lpDDSurfaceDesc->dwWidth); return DDENUMRET_OK; } } @@ -3764,7 +3756,7 @@ HRESULT WINAPI myEnumModesFilter(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpConte HRESULT WINAPI extEnumDisplayModes(EnumDisplayModes1_Type pEnumDisplayModes, LPDIRECTDRAW lpdd, DWORD dwflags, LPDDSURFACEDESC lpddsd, LPVOID lpContext, LPDDENUMMODESCALLBACK cb) { HRESULT res; - OutTraceD("EnumDisplayModes(D): lpdd=%x flags=%x lpddsd=%x callback=%x\n", lpdd, dwflags, lpddsd, cb); + OutTraceDDRAW("EnumDisplayModes(D): lpdd=%x flags=%x lpddsd=%x callback=%x\n", lpdd, dwflags, lpddsd, cb); // note: extEnumDisplayModes serves both the EnumDisplayModes and EnumDisplayModes2 interfaces: // they differ for the lpddsd argument that should point to either DDSURFACEDESC or DDSURFACEDESC2 @@ -3829,7 +3821,7 @@ HRESULT WINAPI extEnumDisplayModes(EnumDisplayModes1_Type pEnumDisplayModes, LPD } if(res==DDENUMRET_CANCEL) break; } - OutTraceD("EnumDisplayModes(D): cycled to res=%d size=(%d,%d)\n", + OutTraceDW("EnumDisplayModes(D): cycled to res=%d size=(%d,%d)\n", SupportedDepths[DepthIdx], SupportedRes[ResIdx].w, SupportedRes[ResIdx].h); #else NewContext_Type NewContext; @@ -3843,7 +3835,7 @@ HRESULT WINAPI extEnumDisplayModes(EnumDisplayModes1_Type pEnumDisplayModes, LPD // proxy the call res=(*pEnumDisplayModes)(lpdd, dwflags, lpddsd, lpContext, cb); } - if(res) OutTraceD("EnumDisplayModes(D): ERROR res=%x(%s)\n", res, ExplainDDError(res)); + if(res) OutTraceE("EnumDisplayModes(D): ERROR res=%x(%s)\n", res, ExplainDDError(res)); return res; } @@ -3864,7 +3856,7 @@ HRESULT WINAPI extDuplicateSurface(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE s, LPD if (res) OutTraceE("DuplicateSurface: ERROR dds=%x res=%x(%s)\n", s, res, ExplainDDError(res)); else - OutTraceD("DuplicateSurface: dds=%x pdds=%x\n", s, *sp); + OutTraceDDRAW("DuplicateSurface: dds=%x pdds=%x\n", s, *sp); return res; } @@ -3874,13 +3866,13 @@ HRESULT WINAPI extGetPixelFormat(LPDIRECTDRAWSURFACE lpdds, LPDDPIXELFORMAT p) BOOL IsPrim; IsPrim=dxw.IsAPrimarySurface(lpdds); - OutTraceD("GetPixelFormat: lpdds=%x%s\n", lpdds, IsPrim?"(PRIM)":""); + OutTraceDDRAW("GetPixelFormat: lpdds=%x%s\n", lpdds, IsPrim?"(PRIM)":""); res=(*pGetPixelFormat)(lpdds, p); if(res){ OutTraceE("GetPixelFormat: ERROR res=%x(%s)\n", res, ExplainDDError(res)); } else{ - OutTraceD("GetPixelFormat: Flags=%x(%s) FourCC=%x BitCount=%d RGBA=(%x,%x,%x,%x)\n", + OutTraceDDRAW("GetPixelFormat: Flags=%x(%s) FourCC=%x BitCount=%d RGBA=(%x,%x,%x,%x)\n", p->dwFlags, ExplainPixelFormatFlags(p->dwFlags), p->dwFourCC, p->dwRGBBitCount, p->dwRBitMask, p->dwGBitMask, p->dwBBitMask, p->dwRGBAlphaBitMask ); } @@ -3892,7 +3884,7 @@ HRESULT WINAPI extGetPixelFormat(LPDIRECTDRAWSURFACE lpdds, LPDDPIXELFORMAT p) p->dwGBitMask = dxw.VirtualPixelFormat.dwGBitMask; p->dwBBitMask = dxw.VirtualPixelFormat.dwBBitMask; p->dwRGBAlphaBitMask = dxw.VirtualPixelFormat.dwRGBAlphaBitMask; - OutTraceD("GetPixelFormat: EMULATED BitCount=%d RGBA=(%x,%x,%x,%x)\n", + OutTraceDW("GetPixelFormat: EMULATED BitCount=%d RGBA=(%x,%x,%x,%x)\n", p->dwRGBBitCount, p->dwRBitMask, p->dwGBitMask, p->dwBBitMask, p->dwRGBAlphaBitMask ); } @@ -3927,7 +3919,7 @@ HRESULT WINAPI extTestCooperativeLevel(LPDIRECTDRAW lpdd) if(res) OutTraceE("TestCooperativeLevel: RestoreAllSurfaces ERROR res=%x(%s)\n", res, ExplainDDError(res)); #endif } - if(dxw.dwFlags1 & SUPPRESSDXERRORS) return DD_OK; + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK; return res; } @@ -3942,26 +3934,26 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds) res = (*pReleaseS)(lpdds); - OutTraceD("Release(S): lpdds=%x%s refcount=%d\n", lpdds, IsPrim?"(PRIM)":(IsBack?"(BACK)":""), res); + OutTraceDDRAW("Release(S): lpdds=%x%s refcount=%d\n", lpdds, IsPrim?"(PRIM)":(IsBack?"(BACK)":""), res); if (res==0) { // common precondition // when releasing primary surface, erase clipping region if(IsPrim && (dxw.dwFlags1 & CLIPCURSOR)) dxw.EraseClipCursor(); if (dxw.dwFlags1 & EMULATESURFACE) { if(lpdds==lpDDSEmu_Prim) { - OutTraceD("Release(S): Clearing lpDDSEmu_Prim pointer\n"); + OutTraceDW("Release(S): Clearing lpDDSEmu_Prim pointer\n"); lpDDSEmu_Prim=NULL; } if(lpdds==lpDDSEmu_Back) { - OutTraceD("Release(S): Clearing lpDDSEmu_Back pointer\n"); + OutTraceDW("Release(S): Clearing lpDDSEmu_Back pointer\n"); lpDDSEmu_Back=NULL; } if(lpdds==dxw.lpDDSPrimHDC) { - OutTraceD("Release(S): Clearing lpDDSPrimHDC pointer\n"); + OutTraceDW("Release(S): Clearing lpDDSPrimHDC pointer\n"); dxw.ResetPrimarySurface(); } } if(lpdds==lpDDSBack) { // v2.02.38 - OutTraceD("Release(S): Clearing lpDDSBack pointer\n"); + OutTraceDW("Release(S): Clearing lpDDSBack pointer\n"); lpDDSBack = NULL; } } @@ -3973,7 +3965,7 @@ HRESULT WINAPI extSetColorKey(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORK HRESULT res; BOOL IsPrim; IsPrim=dxw.IsAPrimarySurface(lpdds); - if(IsTraceD){ + if(IsTraceDDRAW){ OutTrace("SetColorKey: lpdds=%x%s flags=%x(%s) ", lpdds, (IsPrim ? "(PRIM)" : ""), flags, ExplainColorKeyFlag(flags)); if (lpDDColorKey) @@ -3993,13 +3985,13 @@ HRESULT WINAPI extGetColorKey(LPDIRECTDRAWSURFACE lpdds, DWORD flags, LPDDCOLORK HRESULT res; BOOL IsPrim; IsPrim=dxw.IsAPrimarySurface(lpdds); - OutTraceD("GetColorKey(S): lpdds=%x%s flags=%x(%s)\n", + OutTraceDDRAW("GetColorKey(S): lpdds=%x%s flags=%x(%s)\n", lpdds, (IsPrim ? "(PRIM)" : ""), flags, ExplainColorKeyFlag(flags)); res=(*pGetColorKey)(lpdds, flags, lpDDColorKey); if(res) OutTraceE("GetColorKey: ERROR lpdds=%x flags=%x res=%x(%s)\n", lpdds, flags, res, ExplainDDError(res)); else - OutTraceD("GetColorKey: colors=(L:%x,H:%x)\n", + OutTraceDDRAW("GetColorKey: colors=(L:%x,H:%x)\n", lpdds, lpDDColorKey->dwColorSpaceLowValue, lpDDColorKey->dwColorSpaceHighValue); return res; } @@ -4011,7 +4003,7 @@ HRESULT WINAPI extEnumAttachedSurfaces(LPDIRECTDRAWSURFACE lpdds, LPVOID lpConte IsPrim=dxw.IsAPrimarySurface(lpdds); - OutTraceD("EnumAttachedSurfaces: lpdds=%x%s Context=%x Callback=%x\n", + OutTraceDDRAW("EnumAttachedSurfaces: lpdds=%x%s Context=%x Callback=%x\n", lpdds, (IsPrim ? "(PRIM)":""), lpContext, lpEnumSurfacesCallback); if (IsPrim){ @@ -4032,7 +4024,7 @@ HRESULT WINAPI extEnumAttachedSurfaces(LPDIRECTDRAWSURFACE lpdds, LPVOID lpConte return res; } res=(lpEnumSurfacesCallback)(lpDDSBack, (LPDDSURFACEDESC)&ddsd, lpContext); - OutTraceD("EnumSurfacesCallback: on DDSBack res=%x(%s)\n", res, ExplainDDError(res)); + OutTraceDW("EnumSurfacesCallback: on DDSBack res=%x(%s)\n", res, ExplainDDError(res)); } res=0; // for Black Dahlia } @@ -4056,7 +4048,7 @@ HRESULT WINAPI extAddAttachedSurface(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURF // But beware: this holds to BACKBUFFER surfaces only, and NOT for attached ZBUFFERS or similar! IsPrim=dxw.IsAPrimarySurface(lpdds); - OutTraceD("AddAttachedSurface: lpdds=%x%s lpddsadd=%x\n", lpdds, IsPrim?"(PRIM)":"", lpddsadd); + OutTraceDDRAW("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) { @@ -4067,13 +4059,13 @@ HRESULT WINAPI extAddAttachedSurface(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURF if (sdres) OutTraceE("AddAttachedSurface: GetSurfaceDesc ERROR res=%x at %d\n", sdres, __LINE__); else - OutTraceD("AddAttachedSurface: GetSurfaceDesc dwCaps=%x(%s)\n", + OutTraceDW("AddAttachedSurface: GetSurfaceDesc dwCaps=%x(%s)\n", sd.ddsCaps.dwCaps, ExplainDDSCaps(sd.ddsCaps.dwCaps)); if (IsPrim){ if (sd.ddsCaps.dwCaps & DDSCAPS_BACKBUFFER) if ((dxw.dwFlags1 & EMULATESURFACE) && (res==DDERR_CANNOTATTACHSURFACE) || (res==DDERR_NOEXCLUSIVEMODE)) - OutTraceD("AddAttachedSurface: emulating BACKBUFFER attach on PRIMARY\n"); + OutTraceDW("AddAttachedSurface: emulating BACKBUFFER attach on PRIMARY\n"); lpDDSBack=lpddsadd; if (pAddRefS) (*pAddRefS)(lpdds); res=DD_OK; @@ -4084,7 +4076,7 @@ HRESULT WINAPI extAddAttachedSurface(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURF // is set in the game "Options" menu. if (sd.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) // DDSCAPS_BACKBUFFER for double buffering ??? if ((dxw.dwFlags1 & EMULATESURFACE) && (res==DDERR_CANNOTATTACHSURFACE)){ - OutTraceD("AddAttachedSurface: emulating ZBUFFER attach on BACKBUFFER\n"); + OutTraceDW("AddAttachedSurface: emulating ZBUFFER attach on BACKBUFFER\n"); if (pAddRefS) (*pAddRefS)(lpdds); res=DD_OK; } @@ -4097,11 +4089,11 @@ HRESULT WINAPI extAddAttachedSurface(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURF HRESULT WINAPI extDeleteAttachedSurface(LPDIRECTDRAWSURFACE lpdds, DWORD dwflags, LPDIRECTDRAWSURFACE lpddsdel) { HRESULT res; - OutTraceD("DeleteAttachedSurface: lpdds=%x flags=%x lpddsdel=%x\n", lpdds, dwflags, lpddsdel); + OutTraceDDRAW("DeleteAttachedSurface: lpdds=%x flags=%x lpddsdel=%x\n", lpdds, dwflags, lpddsdel); res=(*pDeleteAttachedSurface)(lpdds, dwflags, lpddsdel); if(res) OutTraceE("DeleteAttachedSurface: ERROR %x(%s)\n", res, ExplainDDError(res)); if (res && (lpddsdel==lpDDSBack)){ - OutTraceD("DeleteAttachedSurface: emulating surface detach lpdds=%x\n", lpddsdel); + OutTraceDW("DeleteAttachedSurface: emulating surface detach lpdds=%x\n", lpddsdel); lpDDSBack->Release(); // GHO TRY lpDDSBack=NULL; res=0; @@ -4111,7 +4103,7 @@ HRESULT WINAPI extDeleteAttachedSurface(LPDIRECTDRAWSURFACE lpdds, DWORD dwflag HRESULT WINAPI cbDump(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext) { - OutTraceD("EnumDisplayModes: CALLBACK lpdds=%x Context=%x Caps=%x(%s)\n", + OutTraceDW("EnumDisplayModes: CALLBACK lpdds=%x Context=%x Caps=%x(%s)\n", lpDDSurfaceDesc, lpContext, lpDDSurfaceDesc->ddsCaps.dwCaps, ExplainDDSCaps(lpDDSurfaceDesc->ddsCaps.dwCaps)); return 1; @@ -4124,15 +4116,15 @@ HRESULT WINAPI extGetCapsS(int dxInterface, GetCapsS_Type pGetCapsS, LPDIRECTDRA IsPrim=dxw.IsAPrimarySurface(lpdds); IsBack=dxw.IsABackBufferSurface(lpdds); IsFixed=FALSE; - OutTraceD("GetCaps(S%d): lpdds=%x%s, lpcaps=%x\n", dxInterface, lpdds, IsPrim?"(PRIM)":"", caps); + OutTraceDDRAW("GetCaps(S%d): lpdds=%x%s, lpcaps=%x\n", dxInterface, lpdds, IsPrim?"(PRIM)":"", caps); res=(*pGetCapsS)(lpdds, caps); if(res) OutTraceE("GetCaps(S%d): ERROR %x(%s)\n", dxInterface, res, ExplainDDError(res)); else - OutTraceD("GetCaps(S%d): lpdds=%x caps=%x(%s)\n", dxInterface, lpdds, caps->dwCaps, ExplainDDSCaps(caps->dwCaps)); + OutTraceDDRAW("GetCaps(S%d): lpdds=%x caps=%x(%s)\n", dxInterface, lpdds, caps->dwCaps, ExplainDDSCaps(caps->dwCaps)); if (IsPrim) { - OutTraceD("GetCaps(S%d): fixing PRIMARY surface\n", dxInterface); + OutTraceDW("GetCaps(S%d): fixing PRIMARY surface\n", dxInterface); IsFixed=TRUE; caps->dwCaps |= DDSD_Prim.ddsCaps.dwCaps; caps->dwCaps |= DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_FRONTBUFFER|DDSCAPS_VIDEOMEMORY|DDSCAPS_VISIBLE; // primary surfaces must be this way @@ -4140,14 +4132,14 @@ HRESULT WINAPI extGetCapsS(int dxInterface, GetCapsS_Type pGetCapsS, LPDIRECTDRA } if (IsBack) { - OutTraceD("GetCaps(S%d): fixing BACKBUFFER surface\n", dxInterface); + OutTraceDW("GetCaps(S%d): fixing BACKBUFFER surface\n", dxInterface); IsFixed=TRUE; caps->dwCaps |= (DDSCAPS_BACKBUFFER|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM); // you never know.... caps->dwCaps &= ~(DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); // backbuffer surfaces can't be this way } if ((caps->dwCaps & DDSCAPS_ZBUFFER) || (lpdds == lpDDZBuffer)){ - OutTraceD("GetCaps(S%d): fixing ZBUFFER surface\n", dxInterface); + OutTraceDW("GetCaps(S%d): fixing ZBUFFER surface\n", dxInterface); IsFixed=TRUE; if (DDZBufferCaps & DDSCAPS_SYSTEMMEMORY){ caps->dwCaps |= (DDSCAPS_ZBUFFER|DDSCAPS_SYSTEMMEMORY); @@ -4159,7 +4151,7 @@ HRESULT WINAPI extGetCapsS(int dxInterface, GetCapsS_Type pGetCapsS, LPDIRECTDRA } } - if(IsFixed) OutTraceD("GetCaps(S%d): lpdds=%x FIXED caps=%x(%s)\n", dxInterface, lpdds, caps->dwCaps, ExplainDDSCaps(caps->dwCaps)); + if(IsFixed) OutTraceDW("GetCaps(S%d): lpdds=%x FIXED caps=%x(%s)\n", dxInterface, lpdds, caps->dwCaps, ExplainDDSCaps(caps->dwCaps)); return res; } @@ -4191,11 +4183,11 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd) int dxversion; dxversion=lpddHookedVersion(lpdd); // must be called BEFORE releasing the session!! - OutTraceD("Release(D): lpdd=%x dxversion=%d\n", lpdd, dxversion); + OutTraceDDRAW("Release(D): lpdd=%x dxversion=%d\n", lpdd, dxversion); ActualRef=(*pReleaseD)(lpdd); VirtualRef=(LONG)ActualRef; - OutTraceD("Release(D): lpdd=%x service_lpdd=%x ref=%d\n", lpdd, lpPrimaryDD, ActualRef); + OutTraceDW("Release(D): lpdd=%x service_lpdd=%x ref=%d\n", lpdd, lpPrimaryDD, ActualRef); if (lpdd == lpPrimaryDD) { // v2.1.87: fix for Dungeon Keeper II if(dxw.dwFlags4 & FIXREFCOUNTER){ @@ -4207,11 +4199,11 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd) if(lpDDSEmu_Back) --VirtualRef; } if(VirtualRef<0) VirtualRef=0; - OutTraceD("Release(D): fixed ref counter %d->%d\n", ActualRef, VirtualRef); + OutTraceDW("Release(D): fixed ref counter %d->%d\n", ActualRef, VirtualRef); } if((dxversion<4) && (ActualRef==0)){ // directdraw old versions automatically free all linked objects when the parent session is closed. - OutTraceD("Release(D): RefCount=0 - service object RESET condition\n"); + OutTraceDW("Release(D): RefCount=0 - service object RESET condition\n"); lpDDSEmu_Prim=NULL; lpDDSEmu_Back=NULL; lpDDP=NULL; @@ -4228,7 +4220,7 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd) //extern void SwitchTo16BPP(); //if((ActualRef==0) && (dxw.dwFlags3 & FORCE16BPP)) SwitchTo16BPP(); - OutTraceD("Release(D): lpdd=%x ref=%x\n", lpdd, VirtualRef); + OutTraceDDRAW("Release(D): lpdd=%x ref=%x\n", lpdd, VirtualRef); return (ULONG)VirtualRef; } @@ -4236,7 +4228,7 @@ HRESULT WINAPI extCreateClipper(LPDIRECTDRAW lpdd, DWORD dwflags, LPDIRECTDRAWCLIPPER FAR* lplpDDClipper, IUnknown FAR* pUnkOuter) { HRESULT res; - OutTraceD("CreateClipper: lpdd=%x flags=%x\n", lpdd, dwflags); + OutTraceDDRAW("CreateClipper: lpdd=%x flags=%x\n", lpdd, dwflags); res=(*pCreateClipper)(lpdd, dwflags, lplpDDClipper, pUnkOuter); if(res) { OutTraceE("CreateClipper: ERROR res=%x(%s)\n", lpdd, res, ExplainDDError(res)); @@ -4252,7 +4244,7 @@ HRESULT WINAPI extReleaseC(LPDIRECTDRAWCLIPPER lpddClip) ref = (*pReleaseC)(lpddClip); - OutTraceD("Release(C): PROXED lpddClip=%x ref=%x\n", lpddClip, ref); + OutTraceDDRAW("Release(C): PROXED lpddClip=%x ref=%x\n", lpddClip, ref); return ref; } @@ -4270,7 +4262,7 @@ HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDR } res=(*pGetSurfaceDesc)(lpdds, lpddsd); - OutTraceD("GetSurfaceDesc: %slpdds=%x%s res=%x(%s)\n", + OutTraceDDRAW("GetSurfaceDesc: %slpdds=%x%s res=%x(%s)\n", res?"ERROR ":"", lpdds, IsPrim?"(PRIM)":(IsBack?"(BACK)":""), res, ExplainDDError(res)); if(res) { OutTraceE("GetSurfaceDesc: ERROR err=%d(%s) at %d\n", res, ExplainDDError(res), __LINE__); @@ -4280,7 +4272,7 @@ HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDR LogSurfaceAttributes(lpddsd, "GetSurfaceDesc", __LINE__); if (IsPrim) { - OutTraceD("GetSurfaceDesc: fixing PRIMARY surface\n"); + OutTraceDW("GetSurfaceDesc: fixing PRIMARY surface\n"); IsFixed=TRUE; if (dxw.dwFlags1 & EMULATESURFACE) lpddsd->ddpfPixelFormat = dxw.VirtualPixelFormat; lpddsd->ddsCaps.dwCaps |= DDSD_Prim.ddsCaps.dwCaps; @@ -4292,14 +4284,14 @@ HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDR } if (IsBack) { - OutTraceD("GetSurfaceDesc: fixing BACKBUFFER surface\n"); + OutTraceDW("GetSurfaceDesc: fixing BACKBUFFER surface\n"); IsFixed=TRUE; lpddsd->ddsCaps.dwCaps |= (DDSCAPS_BACKBUFFER|DDSCAPS_VIDEOMEMORY|DDSCAPS_LOCALVIDMEM); // you never know.... lpddsd->ddsCaps.dwCaps &= ~(DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN); // primary surfaces can't be this way } if (lpddsd->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) { - OutTraceD("GetSurfaceDesc: fixing ZBUFFER surface\n"); + OutTraceDW("GetSurfaceDesc: fixing ZBUFFER surface\n"); IsFixed=TRUE; if (DDZBufferCaps & DDSCAPS_SYSTEMMEMORY){ lpddsd->ddsCaps.dwCaps |= (DDSCAPS_ZBUFFER|DDSCAPS_SYSTEMMEMORY); @@ -4350,11 +4342,11 @@ HRESULT WINAPI extGetSurfaceDesc1(LPDIRECTDRAWSURFACE lpdds, LPDDSURFACEDESC lpd if (pGetSurfaceDesc4) return extGetSurfaceDesc((GetSurfaceDesc_Type)pGetSurfaceDesc4, (LPDIRECTDRAWSURFACE)lpdds, (LPDDSURFACEDESC)lpddsd); break; default: - OutTraceD("GetSurfaceDesc: ASSERT - bad dwSize=%d lpdds=%x at %d\n", lpddsd->dwSize, lpdds, __LINE__); + OutTraceDW("GetSurfaceDesc: ASSERT - bad dwSize=%d lpdds=%x at %d\n", lpddsd->dwSize, lpdds, __LINE__); return DDERR_INVALIDOBJECT; break; } - OutTraceD("GetSurfaceDesc: ASSERT - missing hook lpdds=%x dwSize=%d(%s) at %d\n", + OutTraceDW("GetSurfaceDesc: ASSERT - missing hook lpdds=%x dwSize=%d(%s) at %d\n", lpdds, lpddsd->dwSize, lpddsd->dwSize==sizeof(DDSURFACEDESC)?"DDSURFACEDESC":"DDSURFACEDESC2", __LINE__); return DDERR_INVALIDOBJECT; } @@ -4370,10 +4362,10 @@ HRESULT WINAPI extGetSurfaceDesc2(LPDIRECTDRAWSURFACE2 lpdds, LPDDSURFACEDESC2 l if (pGetSurfaceDesc4) return extGetSurfaceDesc((GetSurfaceDesc_Type)pGetSurfaceDesc4, (LPDIRECTDRAWSURFACE)lpdds, (LPDDSURFACEDESC)lpddsd); break; default: - OutTraceD("GetSurfaceDesc: ASSERT - bad dwSize=%d lpdds=%x at %d\n", lpddsd->dwSize, lpdds, __LINE__); + OutTraceDW("GetSurfaceDesc: ASSERT - bad dwSize=%d lpdds=%x at %d\n", lpddsd->dwSize, lpdds, __LINE__); return DDERR_INVALIDOBJECT; } - OutTraceD("GetSurfaceDesc: ASSERT - missing hook lpdds=%x dwSize=%d(%s) at %d\n", + OutTraceDW("GetSurfaceDesc: ASSERT - missing hook lpdds=%x dwSize=%d(%s) at %d\n", lpdds, lpddsd->dwSize, lpddsd->dwSize==sizeof(DDSURFACEDESC)?"DDSURFACEDESC":"DDSURFACEDESC2", __LINE__); return DDERR_INVALIDOBJECT; } @@ -4384,9 +4376,9 @@ HRESULT WINAPI extReleaseP(LPDIRECTDRAWPALETTE lpddPalette) ref = (*pReleaseP)(lpddPalette); - OutTraceD("Release(P): lpddPalette=%x ref=%x\n", lpddPalette, ref); + OutTraceDDRAW("Release(P): lpddPalette=%x ref=%x\n", lpddPalette, ref); if(lpddPalette==lpDDP && ref==0){ - OutTraceD("Release(P): clearing lpDDP=%x->NULL\n", lpDDP); + OutTraceDW("Release(P): clearing lpDDP=%x->NULL\n", lpDDP); lpDDP=NULL; } return ref; @@ -4397,11 +4389,11 @@ BOOL WINAPI DDEnumerateCallbackFilter(GUID *lpGuid, LPSTR lpDriverDescription, L BOOL res; typedef struct {LPDDENUMCALLBACK lpCallback; LPVOID lpContext;} Context_Type; Context_Type *p=(Context_Type *)lpContext; - OutTraceD("DDEnumerateCallback: guid=%x DriverDescription=\"%s\" DriverName=\"%s\" Context=%x\n", + OutTraceDW("DDEnumerateCallback: guid=%x DriverDescription=\"%s\" DriverName=\"%s\" Context=%x\n", lpGuid, lpDriverDescription, lpDriverName, p->lpContext); if((lpGuid==NULL) || !(dxw.dwFlags2 & HIDEMULTIMONITOR)) res=(*p->lpCallback)(lpGuid, lpDriverDescription, lpDriverName, p->lpContext); if((lpGuid==NULL) && (dxw.dwFlags2 & HIDEMULTIMONITOR)) res=FALSE; - OutTraceD("DDEnumerateCallback: res=%x(%s)\n", res, res?"continue":"break"); + OutTraceDW("DDEnumerateCallback: res=%x(%s)\n", res, res?"continue":"break"); return res; } @@ -4410,19 +4402,19 @@ BOOL WINAPI DDEnumerateCallbackExFilter(GUID *lpGuid, LPSTR lpDriverDescription, BOOL res; typedef struct {LPDDENUMCALLBACKEX lpCallback; LPVOID lpContext;} Context_Type; Context_Type *p=(Context_Type *)lpContext; - OutTraceD("DDEnumerateCallbackEx: guid=%x DriverDescription=\"%s\" DriverName=\"%s\" Context=%x hm=%x\n", + OutTraceDW("DDEnumerateCallbackEx: guid=%x DriverDescription=\"%s\" DriverName=\"%s\" Context=%x hm=%x\n", lpGuid, lpDriverDescription, lpDriverName, lpContext, hm); res=TRUE; if((lpGuid==NULL) || !(dxw.dwFlags2 & HIDEMULTIMONITOR)) res=(*p->lpCallback)(lpGuid, lpDriverDescription, lpDriverName, p->lpContext, hm); if((lpGuid==NULL) && (dxw.dwFlags2 & HIDEMULTIMONITOR)) res=FALSE; - OutTraceD("DDEnumerateCallbackEx: res=%x(%s)\n", res, res?"continue":"break"); + OutTraceDW("DDEnumerateCallbackEx: res=%x(%s)\n", res, res?"continue":"break"); return res; } HRESULT WINAPI extDirectDrawEnumerate(LPDDENUMCALLBACK lpCallback, LPVOID lpContext) { HRESULT ret; - OutTraceD("DirectDrawEnumerate: lpCallback=%x lpContext=%x\n", lpCallback, lpContext); + OutTraceDDRAW("DirectDrawEnumerate: lpCallback=%x lpContext=%x\n", lpCallback, lpContext); if((dxw.dwFlags2 & HIDEMULTIMONITOR) || (dxw.dwTFlags & OUTDEBUG)){ struct {LPDDENUMCALLBACK lpCallback; LPVOID lpContext;} myContext; myContext.lpCallback=lpCallback; @@ -4438,7 +4430,7 @@ HRESULT WINAPI extDirectDrawEnumerate(LPDDENUMCALLBACK lpCallback, LPVOID lpCont HRESULT WINAPI extDirectDrawEnumerateEx(LPDDENUMCALLBACKEX lpCallback, LPVOID lpContext, DWORD dwFlags) { HRESULT ret; - OutTraceP("DirectDrawEnumerateEx: lpCallback=%x lpContext=%x Flags=%x(%s)\n", + OutTraceDDRAW("DirectDrawEnumerateEx: lpCallback=%x lpContext=%x Flags=%x(%s)\n", lpCallback, lpContext, dxw.dwFlags1, ExplainDDEnumerateFlags(dwFlags)); if((dxw.dwFlags2 & HIDEMULTIMONITOR) || (dxw.dwTFlags & OUTDEBUG)){ struct {LPDDENUMCALLBACKEX lpCallback; LPVOID lpContext;} myContext; @@ -4448,26 +4440,69 @@ HRESULT WINAPI extDirectDrawEnumerateEx(LPDDENUMCALLBACKEX lpCallback, LPVOID lp } else ret=(*pDirectDrawEnumerateEx)(lpCallback, lpContext, dwFlags); - if(ret) OutTraceD("DirectDrawEnumerateEx: ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); + if(ret) OutTraceE("DirectDrawEnumerateEx: ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); return ret; } HRESULT WINAPI extDDGetGammaRamp(LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags, LPDDGAMMARAMP lpgr) { HRESULT ret; - OutTraceD("GetGammaRamp: dds=%x dwFlags=%x\n", lpdds, dwFlags); + OutTraceDDRAW("GetGammaRamp: dds=%x dwFlags=%x\n", lpdds, dwFlags); ret=(*pDDGetGammaRamp)(lpdds, dwFlags, lpgr); if(ret) OutTraceE("GetGammaRamp: ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); - else OutTraceD("GetGammaRamp: RGB=(%x,%x,%x)\n", lpgr->red, lpgr->green, lpgr->blue); + else OutTraceDDRAW("GetGammaRamp: RGB=(%x,%x,%x)\n", lpgr->red, lpgr->green, lpgr->blue); return ret; } HRESULT WINAPI extDDSetGammaRamp(LPDIRECTDRAWSURFACE lpdds, DWORD dwFlags, LPDDGAMMARAMP lpgr) { HRESULT ret; - OutTraceD("GetGammaRamp: dds=%x dwFlags=%x RGB=(%x,%x,%x)\n", lpdds, dwFlags, lpgr->red, lpgr->green, lpgr->blue); + OutTraceDDRAW("GetGammaRamp: dds=%x dwFlags=%x RGB=(%x,%x,%x)\n", lpdds, dwFlags, lpgr->red, lpgr->green, lpgr->blue); if (dxw.dwFlags2 & DISABLEGAMMARAMP) return DD_OK; ret=(*pDDSetGammaRamp)(lpdds, dwFlags, lpgr); if(ret) OutTraceE("GetGammaRamp: ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); return ret; } + + HRESULT WINAPI extGetAvailableVidMem(LPDIRECTDRAW lpdd, LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree, GetAvailableVidMem_Type pGetAvailableVidMem) +{ + HRESULT res; + OutTraceDDRAW("GetAvailableVidMem(D): lpdd=%x\n", lpdd); + res=(*pGetAvailableVidMem)(lpdd, lpDDSCaps, lpdwTotal, lpdwFree); + if(res){ + OutTraceDW("GetAvailableVidMem(D): ERROR res=%x(%s)\n", res, ExplainDDError(res)); + } + else { + OutTraceDW("GetAvailableVidMem(D): DDSCaps=%x(%s) Total=%x Free=%x\n", + *lpDDSCaps, ExplainDDSCaps(lpDDSCaps->dwCaps), *lpdwTotal, *lpdwFree); + if(dxw.dwFlags2 & LIMITRESOURCES){ // check for memory value overflow - see "Mageslayer" and "Take no Prisoners" + DWORD dwLocalTotal; + const DWORD dwMaxMem = 0x7FFFF000; + if(lpdwTotal == NULL) lpdwTotal = &dwLocalTotal; // point to usable memory.... + if(*lpdwTotal > dwMaxMem){ + if(lpdwFree != NULL){ + DWORD dwDiff = *lpdwTotal - *lpdwFree; + if(dwDiff > dwMaxMem){ + *lpdwFree = dwMaxMem; + } + else{ + *lpdwFree = dwMaxMem - dwDiff; + } + } + *lpdwTotal = dwMaxMem; + OutTraceDW("GetAvailableVidMem(D): FIXED Total=%x Free=%x\n", *lpdwTotal, *lpdwFree); + } + } + } + return res; +} + +HRESULT WINAPI extGetAvailableVidMem2(LPDIRECTDRAW lpdd, LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) +{ + return extGetAvailableVidMem(lpdd, lpDDSCaps, lpdwTotal, lpdwFree, pGetAvailableVidMem2); +} + +HRESULT WINAPI extGetAvailableVidMem4(LPDIRECTDRAW lpdd, LPDDSCAPS lpDDSCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree) +{ + return extGetAvailableVidMem(lpdd, lpDDSCaps, lpdwTotal, lpdwFree, pGetAvailableVidMem4); +} diff --git a/dll/dinput.cpp b/dll/dinput.cpp index 45a74a5..6b83488 100644 --- a/dll/dinput.cpp +++ b/dll/dinput.cpp @@ -96,7 +96,7 @@ HRESULT WINAPI extDirectInputCreate(HINSTANCE hinst, { HRESULT res; - OutTraceD("DirectInputCreate: dwVersion = %x\n", + OutTraceDW("DirectInputCreate: dwVersion = %x\n", dwversion); res = (*pDirectInputCreate)(hinst, dwversion, lplpdi, pu); @@ -111,7 +111,7 @@ HRESULT WINAPI extDirectInputCreateEx(HINSTANCE hinst, { HRESULT res; - OutTraceD("DirectInputCreateEx: dwVersion = %x REFIID = %x\n", + OutTraceDW("DirectInputCreateEx: dwVersion = %x REFIID = %x\n", dwversion, riidltf.Data1); res = (*pDirectInputCreateEx)(hinst, dwversion, riidltf, ppvout, pu); @@ -125,7 +125,7 @@ HRESULT WINAPI extQueryInterfaceI(void * lpdi, REFIID riid, LPVOID *obp) { HRESULT res; - OutTraceD("lpDI->QueryInterface: REFIID = %x\n", + OutTraceDW("lpDI->QueryInterface: REFIID = %x\n", riid.Data1); res = (*pQueryInterfaceI)(lpdi, riid, obp); @@ -145,7 +145,7 @@ HRESULT WINAPI extDirectInput8Create(HINSTANCE hinst, { HRESULT res; - OutTraceD("DirectInput8Create: dwVersion = %x REFIID = %x\n", + OutTraceDW("DirectInput8Create: dwVersion = %x REFIID = %x\n", dwversion, riidltf.Data1); res = (*pDirectInputCreateEx)(hinst, dwversion, riidltf, ppvout, pu); @@ -159,7 +159,7 @@ HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid, { HRESULT res; - OutTraceD("lpDI->CreateDevice: REFGUID = %x\n", + OutTraceDW("lpDI->CreateDevice: REFGUID = %x\n", rguid.Data1); res = (*pDICreateDevice)(lpdi, rguid, lplpdid, pu); @@ -176,7 +176,7 @@ HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid, { HRESULT res; - OutTraceD("lpDI->CreateDeviceEx: GUID = %x REFIID = %x\n", + OutTraceDW("lpDI->CreateDeviceEx: GUID = %x REFIID = %x\n", rguid.Data1, riid.Data1); res = (*pDICreateDeviceEx)(lpdi, rguid, riid, pvout, pu); @@ -195,7 +195,7 @@ HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPVOID unsigned int i; POINT p; - OutTraceD("GetDeviceData cbdata:%i\n", cbdata); + OutTraceDW("GetDeviceData cbdata:%i\n", cbdata); res = (*pGetDeviceData)(lpdid, cbdata, rgdod, pdwinout, dwflags); if(res) return res; @@ -225,7 +225,7 @@ HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPVOID } tmp += cbdata; } - OutTraceD("DEBUG: directinput mousedata=(%d,%d)\n", p.x, p.y); + OutTraceDW("DEBUG: directinput mousedata=(%d,%d)\n", p.x, p.y); } return 0; } @@ -235,7 +235,7 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO HRESULT res; POINT p = {0, 0}; - OutTraceD("GetDeviceState cbData:%i %i\n", cbdata, dxw.bActive); + OutTraceDW("GetDeviceState cbData:%i %i\n", cbdata, dxw.bActive); res = (*pGetDeviceState)(lpdid, cbdata, lpvdata); if(res) return res; @@ -257,7 +257,7 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO lpvdata->lZ = 0; *(DWORD *)lpvdata->rgbButtons = 0; } - OutTraceD("DEBUG: directinput mousestate=(%d,%d)\n", p.x, p.y); + OutTraceDW("DEBUG: directinput mousestate=(%d,%d)\n", p.x, p.y); } if(cbdata == 256 && !dxw.bActive) ZeroMemory(lpvdata, 256); @@ -266,7 +266,7 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO HRESULT WINAPI extSetDataFormat(LPDIRECTINPUTDEVICE lpdid, LPCDIDATAFORMAT lpdf) { - OutTraceD("SetDataFormat: flags = 0x%x\n", lpdf->dwFlags); + OutTraceDW("SetDataFormat: flags = 0x%x\n", lpdf->dwFlags); if(lpdf->dwFlags & DIDF_ABSAXIS) dxw.bDInputAbs = 1; if(lpdf->dwFlags & DIDF_RELAXIS) dxw.bDInputAbs = 0; @@ -275,7 +275,7 @@ HRESULT WINAPI extSetDataFormat(LPDIRECTINPUTDEVICE lpdid, LPCDIDATAFORMAT lpdf) HRESULT WINAPI extDISetCooperativeLevel(LPDIRECTINPUTDEVICE lpdid, HWND hwnd, DWORD dwflags) { - OutTraceD("lpDI->SetCooperativeLevel\n"); + OutTraceDW("lpDI->SetCooperativeLevel\n"); dwflags = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND; return (*pDISetCooperativeLevel)(lpdid, hwnd, dwflags); @@ -290,7 +290,7 @@ void GetMousePosition(int *x, int *y) extGetCursorPos(&p); *x = p.x; *y = p.y; - OutTraceD("GetMousePosition: x,y=(%d,%d)\n", *x, *y); + OutTraceDW("GetMousePosition: x,y=(%d,%d)\n", *x, *y); } void InitPosition(int x, int y, int minx, int miny, int maxx, int maxy) diff --git a/dll/dxdiaghook.cpp b/dll/dxdiaghook.cpp index b37f2ef..7d3cede 100644 --- a/dll/dxdiaghook.cpp +++ b/dll/dxdiaghook.cpp @@ -40,15 +40,15 @@ HRESULT HookDxDiag(REFIID riid, LPVOID FAR* ppv) { HMODULE dxdlib; - OutTraceD("CoCreateInstance: CLSID_DxDiagProvider object\n"); + OutTraceDW("CoCreateInstance: CLSID_DxDiagProvider object\n"); dxdlib=(*pLoadLibraryA)("dxdiagn.dll"); - OutTraceD("CoCreateInstance: dxdiagn lib handle=%x\n", dxdlib); + OutTraceDW("CoCreateInstance: dxdiagn lib handle=%x\n", dxdlib); extern void HookModule(HMODULE, int); HookModule(dxdlib, 0); switch (*(DWORD *)&riid){ case 0x9C6B4CB0: - OutTraceD("CoCreateInstance: IID_DxDiagProvider RIID\n"); + OutTraceDW("CoCreateInstance: IID_DxDiagProvider RIID\n"); // IID_DxDiagProvider::QueryInterface SetHook((void *)(**(DWORD **)ppv), extQueryInterfaceDD, (void **)&pQueryInterfaceDD, "QueryInterface(DxDiag)"); // IID_DxDiagProvider::Initialize @@ -57,7 +57,7 @@ HRESULT HookDxDiag(REFIID riid, LPVOID FAR* ppv) SetHook((void *)(**(DWORD **)ppv + 16), extGetRootContainer, (void **)&pGetRootContainer, "GetRootContainer(DxDiag)"); break; case 0x7D0F462F: - OutTraceD("CoCreateInstance: IID_IDxDiagContainer RIID\n"); + OutTraceDW("CoCreateInstance: IID_IDxDiagContainer RIID\n"); break; } @@ -68,65 +68,65 @@ HRESULT HookDxDiag(REFIID riid, LPVOID FAR* ppv) HRESULT WINAPI extInitializeDD(void *th, DXDIAG_INIT_PARAMS *pParams) { HRESULT res; - OutTraceD("DxDiag::Initialize Params=%x\n", pParams); + OutTraceDW("DxDiag::Initialize Params=%x\n", pParams); res=(*pInitializeDD)(th, pParams); - OutTraceD("DxDiag::Initialize res=%x\n", res); + OutTraceDW("DxDiag::Initialize res=%x\n", res); return res; } HRESULT WINAPI extGetRootContainer(void *th, IDxDiagContainer **ppInstance) { HRESULT res; - OutTraceD("DxDiag::GetRootContainer pInstance=%x\n", *ppInstance); + OutTraceDW("DxDiag::GetRootContainer pInstance=%x\n", *ppInstance); res=(*pGetRootContainer)(th, ppInstance); // IID_IDxDiagContainer::GetNumberOfChildContainers SetHook((void *)(**(DWORD **)ppInstance + 12), extGetNumberOfChildContainers, (void **)&pGetNumberOfChildContainers, "GetNumberOfChildContainers(DxDiag)"); // IID_IDxDiagContainer::GetProp SetHook((void *)(**(DWORD **)ppInstance + 32), extGetProp, (void **)&pGetProp, "GetProp(DxDiag)"); - OutTraceD("DxDiag::GetRootContainer res=%x\n", res); + OutTraceDW("DxDiag::GetRootContainer res=%x\n", res); return res; } HRESULT WINAPI extGetNumberOfChildContainers(void *th, DWORD *pdwCount) { HRESULT res; - OutTraceD("DxDiag::GetNumberOfChildContainers\n"); + OutTraceDW("DxDiag::GetNumberOfChildContainers\n"); res=(*pGetNumberOfChildContainers)(th, pdwCount); - OutTraceD("DxDiag::GetNumberOfChildContainers res=%x Count=%d\n", res, *pdwCount); + OutTraceDW("DxDiag::GetNumberOfChildContainers res=%x Count=%d\n", res, *pdwCount); return res; } HRESULT WINAPI extQueryInterfaceDD(void *th, REFIID riid, LPVOID *ppvObj) { HRESULT res; - OutTraceD("DxDiag::QueryInterface ref=%x\n"); + OutTraceDW("DxDiag::QueryInterface ref=%x\n"); res=(*pQueryInterfaceDD)(th, riid, ppvObj); - OutTraceD("DxDiag::QueryInterface res=%x\n", res); + OutTraceDW("DxDiag::QueryInterface res=%x\n", res); return res; } HRESULT WINAPI extGetProp(void *th, LPCWSTR pwszPropName, VARIANT *pvarProp) { HRESULT res; - OutTraceD("DxDiag::GetProp PropName=%ls\n", pwszPropName); + OutTraceDW("DxDiag::GetProp PropName=%ls\n", pwszPropName); res=(*pGetProp)(th, pwszPropName, pvarProp); if(res) OutTraceE("DxDiag::GetProp ERROR res=%x\n", res); if (!wcsncmp(L"dwDirectXVersionMajor", pwszPropName, sizeof(L"dwDirectXVersionMajor"))){ - OutTraceD("DxDiag::GetProp DirectXVersionMajor=%d\n", *pvarProp); + OutTraceDW("DxDiag::GetProp DirectXVersionMajor=%d\n", *pvarProp); //*(DWORD *)pvarProp=10; - //OutTraceD("DxDiag::GetProp fixed DirectXVersionMajor=%d\n", *pvarProp); + //OutTraceDW("DxDiag::GetProp fixed DirectXVersionMajor=%d\n", *pvarProp); } if (!wcsncmp(L"dwDirectXVersionMinor", pwszPropName, sizeof(L"dwDirectXVersionMinor"))){ - OutTraceD("DxDiag::GetProp DirectXVersionMinor=%d\n", *pvarProp); + OutTraceDW("DxDiag::GetProp DirectXVersionMinor=%d\n", *pvarProp); //*(DWORD *)pvarProp=10; - //OutTraceD("DxDiag::GetProp fixed dwDirectXVersionMinor=%d\n", *pvarProp); + //OutTraceDW("DxDiag::GetProp fixed dwDirectXVersionMinor=%d\n", *pvarProp); } if (!wcsncmp(L"szDirectXVersionLetter", pwszPropName, sizeof(L"szDirectXVersionLetter"))){ - OutTraceD("DxDiag::GetProp DirectXVersionLetter=%d\n", *pvarProp); + OutTraceDW("DxDiag::GetProp DirectXVersionLetter=%d\n", *pvarProp); //*(DWORD *)pvarProp=9; - //OutTraceD("DxDiag::GetProp fixed szDirectXVersionLetter=%d\n", *pvarProp); + //OutTraceDW("DxDiag::GetProp fixed szDirectXVersionLetter=%d\n", *pvarProp); } return res; } diff --git a/dll/dxemublt.cpp b/dll/dxemublt.cpp index 720c382..f90b534 100644 --- a/dll/dxemublt.cpp +++ b/dll/dxemublt.cpp @@ -116,7 +116,7 @@ static HRESULT WINAPI EmuBlt_8_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdest src8 += lpsrcrect->left; srcpitch = ddsd_src.lPitch - w; - // OutTraceD("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch); + // OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch); for(y = 0; y < h; y ++){ for(x = 0; x < w; x ++){ *(dest ++) = PaletteEntries[*(src8 ++)]; @@ -126,6 +126,31 @@ static HRESULT WINAPI EmuBlt_8_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdest } if(dxw.dwFlags3 & MARKBLIT) MarkRect32(dest0, w, h, destpitch); +#if 0 + if(1 && IsTraceDDRAW) { + DWORD dwStats[256]; + src8 = (BYTE *)lpsurface; + src8 += lpsrcrect->top*ddsd_src.lPitch; + src8 += lpsrcrect->left; + for(x = 0; x < 256; x ++) dwStats[x]=0; + for(y = 0; y < h; y ++){ + for(x = 0; x < w; x ++){ + dwStats[*(src8 ++)]++; + } + src8 += srcpitch; + } + OutTrace("Colors: "); + for(x = 0; x < 256; x ++) { + char sElement[8]; + if (dwStats[x]) + sprintf(sElement,"%x,", dwStats[x]); + else + strcpy(sElement, "_,"); + OutTrace(sElement); + } + OutTrace("\n"); + } +#endif res=(*pUnlockMethod(lpddsdst))(lpddsdst, lpdestrect); if (res) OutTraceE("EmuBlt8_32: Unlock ERROR dds=%x res=%x(%s) at %d\n", lpddsdst, res, ExplainDDError(res), __LINE__); @@ -134,7 +159,6 @@ static HRESULT WINAPI EmuBlt_8_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdest return res; } - static HRESULT WINAPI EmuBlt_16_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPVOID lpsurface) { @@ -189,7 +213,7 @@ static HRESULT WINAPI EmuBlt_16_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes src16 += lpsrcrect->left; srcpitch = ddsd_src.lPitch - w; - // OutTraceD("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src16,dest,srcpitch,destpitch); + // OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src16,dest,srcpitch,destpitch); if (!Palette16BPP) { // first time through ..... unsigned int pi; Palette16BPP = (DWORD *)malloc(0x10000 * sizeof(DWORD)); @@ -375,7 +399,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes src32 += lpsrcrect->left; srcpitch = ddsd_src.lPitch - w; - // OutTraceD("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src32,dest,srcpitch,destpitch); + // OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src32,dest,srcpitch,destpitch); for(y = 0; y < h; y ++){ for(x = 0; x < w; x ++) *(dest ++) = *(src32 ++); @@ -446,7 +470,7 @@ static HRESULT WINAPI EmuBlt_8_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdest src8 += lpsrcrect->left; srcpitch = ddsd_src.lPitch - w; - // OutTraceD("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch); + // OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch); for(y = 0; y < h; y ++){ for(x = 0; x < w; x ++){ *(dest ++) = (SHORT)PaletteEntries[*(src8 ++)]; @@ -471,7 +495,7 @@ static HRESULT WINAPI EmuBlt_16_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes #ifdef DXWNDDIRECTBLITTING return (*pBlt)(lpddsdst, lpdestrect, lpddssrc, lpsrcrect, dwflags, NULL); #else - OutTraceD("EmuBlt_16_to_16: UNSUPPORTED\n"); + OutTraceDW("EmuBlt_16_to_16: UNSUPPORTED\n"); return -1; #endif } @@ -610,7 +634,7 @@ static int GetMatchingPaletteEntry32(DWORD crColor) if (iMinDistance==0) break; // got the perfect match! } - OutTraceD("GetMatchingPaletteEntry32: color=%x matched with palette[%d]=%x dist=%d\n", + OutTraceDW("GetMatchingPaletteEntry32: color=%x matched with palette[%d]=%x dist=%d\n", crColor, iMinColorIndex, PaletteEntries[iMinColorIndex], iDistance); return iMinColorIndex; @@ -647,7 +671,7 @@ static int GetMatchingPaletteEntry16(DWORD crColor) if (iMinDistance==0) break; // got the perfect match! } - OutTraceD("GetMatchingPaletteEntry: color=%x matched with palette[%d]=%x dist=%d\n", + OutTraceDW("GetMatchingPaletteEntry: color=%x matched with palette[%d]=%x dist=%d\n", crColor, iMinColorIndex, PaletteEntries[iMinColorIndex], iDistance); return iMinColorIndex; @@ -678,7 +702,7 @@ static HRESULT WINAPI RevBlt_32_to_8(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdest static BYTE *PaletteFlags = NULL; int pi; - OutTraceD("RevBlt32_8: src=%x dst=%d\n", lpddssrc, lpddsdst); + OutTraceDW("RevBlt32_8: src=%x dst=%d\n", lpddssrc, lpddsdst); w = lpdestrect->right - lpdestrect->left; h = lpdestrect->bottom - lpdestrect->top; @@ -710,7 +734,7 @@ static HRESULT WINAPI RevBlt_32_to_8(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdest src8 += lpsrcrect->left; srcpitch = ddsd_src.lPitch - w; - // OutTraceD("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch); + // OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch); if (!PaletteRev32BPP) { // first time through ..... PaletteRev32BPP = (BYTE *)malloc(REVPAL32SIZE); PaletteFlags = (BYTE *)malloc(REVPAL32SIZE); @@ -756,7 +780,7 @@ static HRESULT WINAPI RevBlt_32_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes long srcpitch, destpitch; DWORD x, y, w, h; - OutTraceD("RevBlt32_16: src=%x dst=%d\n", lpddssrc, lpddsdst); + OutTraceDW("RevBlt32_16: src=%x dst=%d\n", lpddssrc, lpddsdst); w = lpdestrect->right - lpdestrect->left; h = lpdestrect->bottom - lpdestrect->top; @@ -816,7 +840,7 @@ static HRESULT WINAPI RevBlt_16_to_8(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdest static BYTE *PaletteFlags = NULL; int pi; - OutTraceD("RevBlt16_8: src=%x dst=%d\n", lpddssrc, lpddsdst); + OutTraceDW("RevBlt16_8: src=%x dst=%d\n", lpddssrc, lpddsdst); w = lpdestrect->right - lpdestrect->left; h = lpdestrect->bottom - lpdestrect->top; @@ -848,7 +872,7 @@ static HRESULT WINAPI RevBlt_16_to_8(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdest src8 += lpsrcrect->left; srcpitch = ddsd_src.lPitch - w; - // OutTraceD("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch); + // OutTraceDW("DEBUG: h=%d w=%d src=%x dst=%x spitch=%d dpitch=%d\n",h,w,src8,dest,srcpitch,destpitch); if (!PaletteRev16BPP) { // first time through ..... PaletteRev16BPP = (BYTE *)malloc(REVPAL16SIZE); PaletteFlags = (BYTE *)malloc(REVPAL16SIZE); @@ -902,7 +926,7 @@ static HRESULT WINAPI RevBlt_Null(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrec void SetBltTransformations() { - OutTraceD("SetBltTransformations: color transformation %d->%d\n", + OutTraceDW("SetBltTransformations: color transformation %d->%d\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.ActualPixelFormat.dwRGBBitCount); /* default (bad) setting */ @@ -915,24 +939,24 @@ void SetBltTransformations() case 8: pRevBlt=RevBlt_32_to_8; pEmuBlt=EmuBlt_8_to_32; - OutTraceD("set color transformation 8<->32\n"); + OutTraceDW("set color transformation 8<->32\n"); break; case 16: pRevBlt=RevBlt_32_to_16; pEmuBlt=EmuBlt_16_to_32; - OutTraceD("set color transformation 16<->32\n"); + OutTraceDW("set color transformation 16<->32\n"); break; case 24: //pRevBlt=RevBlt_24_to_32; pEmuBlt=EmuBlt_24_to_32; - OutTraceD("set color transformation 24->32\n"); + OutTraceDW("set color transformation 24->32\n"); break; case 32: pEmuBlt=EmuBlt_32_to_32; - OutTraceD("set color transformation 32->32\n"); + OutTraceDW("set color transformation 32->32\n"); break; default: - OutTraceD("unsupported color transformation %d->32\n", dxw.VirtualPixelFormat.dwRGBBitCount); + OutTraceDW("unsupported color transformation %d->32\n", dxw.VirtualPixelFormat.dwRGBBitCount); break; } break; @@ -941,28 +965,28 @@ void SetBltTransformations() case 8: pRevBlt=RevBlt_16_to_8; pEmuBlt=EmuBlt_8_to_16; - OutTraceD("set color transformation 8<->16\n"); + OutTraceDW("set color transformation 8<->16\n"); break; case 16: pRevBlt=RevBlt_16_to_16; pEmuBlt=EmuBlt_16_to_16; - OutTraceD("set color transformation 16<->16\n"); + OutTraceDW("set color transformation 16<->16\n"); break; case 24: //pRevBlt=RevBlt_24_to_16; pEmuBlt=EmuBlt_24_to_16; - OutTraceD("set color transformation 24<->16\n"); + OutTraceDW("set color transformation 24<->16\n"); break; case 32: pEmuBlt=EmuBlt_32_to_16; break; default: - OutTraceD("unsupported color transformation %d->16\n", dxw.VirtualPixelFormat.dwRGBBitCount); + OutTraceDW("unsupported color transformation %d->16\n", dxw.VirtualPixelFormat.dwRGBBitCount); break; } break; default: - OutTraceD("unsupported color transformation %d->%d\n", + OutTraceDW("unsupported color transformation %d->%d\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.ActualPixelFormat.dwRGBBitCount); break; diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 88e3f42..d867ea2 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -67,7 +67,7 @@ static char *Flag3Names[32]={ static char *Flag4Names[32]={ "NOALPHACHANNEL", "SUPPRESSCHILD", "FIXREFCOUNTER", "SHOWTIMESTRETCH", "ZBUFFERCLEAN", "ZBUFFER0CLEAN", "ZBUFFERALWAYS", "DISABLEFOGGING", - "NOPOWER2FIX", "", "", "", + "NOPOWER2FIX", "NOPERFCOUNTER", "ADDPROXYLIBS", "", "", "", "", "", "", "", "", "", "", "", "", "", @@ -143,19 +143,19 @@ static void dx_ToggleLogging() { // toggle LOGGING if(dxw.dwTFlags & OUTTRACE){ - OutTraceD("Toggle logging OFF\n"); + OutTraceDW("Toggle logging OFF\n"); dxw.dwTFlags &= ~OUTTRACE; } else { dxw.dwTFlags |= OUTTRACE; - OutTraceD("Toggle logging ON\n"); + OutTraceDW("Toggle logging ON\n"); } GetHookInfo()->isLogging=(dxw.dwTFlags & OUTTRACE); } static void SuppressIMEWindow() { - OutTraceD("WindowProc: SUPPRESS IME\n"); + OutTraceDW("WindowProc: SUPPRESS IME\n"); typedef BOOL (WINAPI *ImmDisableIME_Type)(DWORD); ImmDisableIME_Type pImmDisableIME; HMODULE ImmLib; @@ -222,7 +222,7 @@ void HookDlls(HMODULE module) } __except(EXCEPTION_EXECUTE_HANDLER) { - OutTraceD("HookDlls: EXCEPTION\n"); + OutTraceDW("HookDlls: EXCEPTION\n"); } return; } @@ -282,7 +282,7 @@ void DumpImportTable(HMODULE module) } __except(EXCEPTION_EXECUTE_HANDLER) { - OutTraceD("DumpImportTable: EXCEPTION\n"); + OutTraceDW("DumpImportTable: EXCEPTION\n"); } return; } @@ -304,23 +304,32 @@ void SetHook(void *target, void *hookproc, void **hookedproc, char *hookname) if((dwTmp <= MaxHook) && (dwTmp >= MinHook)) return; // already hooked if(dwTmp == 0){ sprintf(msg,"SetHook ERROR: NULL target for %s\n", hookname); - OutTraceD(msg); + OutTraceDW(msg); MessageBox(0, msg, "SetHook", MB_OK | MB_ICONEXCLAMATION); return; // error condition } if(!VirtualProtect(target, 4, PAGE_READWRITE, &oldprot)) { sprintf(msg,"SetHook ERROR: target=%x err=%d\n", target, GetLastError()); - OutTraceD(msg); + OutTraceDW(msg); if (IsAssertEnabled) MessageBox(0, msg, "SetHook", MB_OK | MB_ICONEXCLAMATION); return; // error condition } *(DWORD *)target = (DWORD)hookproc; - VirtualProtect(target, 4, oldprot, &oldprot); + if(!VirtualProtect(target, 4, oldprot, &oldprot)){ + OutTrace("SetHook: VirtualProtect ERROR target=%x, err=%x\n", target, GetLastError()); + return; // error condition + } +#if 0 + if(!FlushInstructionCache(GetCurrentProcess(), target, 4)){ + OutTrace("SetHook: FlushInstructionCache ERROR target=%x, err=%x\n", target, GetLastError()); + return; // error condition + } +#endif tmp=(void *)dwTmp; if (*hookedproc && *hookedproc!=tmp) { sprintf(msg,"SetHook: proc=%s oldhook=%x newhook=%x\n", hookname, hookedproc, tmp); - OutTraceD(msg); + OutTraceDW(msg); if (IsAssertEnabled) MessageBox(0, msg, "SetHook", MB_OK | MB_ICONEXCLAMATION); } *hookedproc = tmp; @@ -397,13 +406,13 @@ void *HookAPI(HMODULE module, char *dll, void *apiproc, const char *apiname, voi return 0; } pidesc = (PIMAGE_IMPORT_DESCRIPTOR)(base + rva); - OutTraceD("HookAPI: pidesc=%x\n", pidesc); + OutTraceDW("HookAPI: pidesc=%x\n", pidesc); while(pidesc->Name){ pThunk=(PCHAR)base+pidesc->FirstThunk; dwThunk = pidesc->FirstThunk; pDllName=(PSTR)base+pidesc->Name; - OutTraceD("HookAPI: pDllName=%s Name=%s\n", pDllName, pidesc->Name); + OutTraceDW("HookAPI: pDllName=%s Name=%s\n", pDllName, pidesc->Name); //impmodule = (PSTR)(base + pidesc->Name); //if(!lstrcmpi(dll, impmodule)) break; pidesc ++; @@ -417,7 +426,7 @@ void *HookAPI(HMODULE module, char *dll, void *apiproc, const char *apiname, voi ptname = (pidesc->OriginalFirstThunk) ? (PIMAGE_THUNK_DATA)(base + (DWORD)pidesc->OriginalFirstThunk) : NULL; if((apiproc==NULL) && (ptname==NULL)){ - if (IsDebug) OutTraceD("HookAPI: unreacheable api=%s dll=%s\n", apiname, dll); + if (IsDebug) OutTraceDW("HookAPI: unreacheable api=%s dll=%s\n", apiname, dll); return 0; } @@ -440,23 +449,23 @@ void *HookAPI(HMODULE module, char *dll, void *apiproc, const char *apiname, voi if(org == hookproc) return 0; // already hooked if(!VirtualProtect(&ptaddr->u1.Function, 4, PAGE_EXECUTE_READWRITE, &oldprotect)) { - OutTraceD("HookAPI: VirtualProtect error %d at %d\n", GetLastError(), __LINE__); + OutTraceDW("HookAPI: VirtualProtect error %d at %d\n", GetLastError(), __LINE__); return 0; } ptaddr->u1.Function = (DWORD)hookproc; if(!VirtualProtect(&ptaddr->u1.Function, 4, oldprotect, &oldprotect)) { - OutTraceD("HookAPI: VirtualProtect error %d at %d\n", GetLastError(), __LINE__); + OutTraceDW("HookAPI: VirtualProtect error %d at %d\n", GetLastError(), __LINE__); return 0; } if (!FlushInstructionCache(GetCurrentProcess(), &ptaddr->u1.Function, 4)) { - OutTraceD("HookAPI: FlushInstructionCache error %d at %d\n", GetLastError(), __LINE__); + OutTraceDW("HookAPI: FlushInstructionCache error %d at %d\n", GetLastError(), __LINE__); return 0; } if(IsDebug) OutTrace("HookAPI hook=%s address=%x->%x\n", apiname, org, hookproc); } __except(EXCEPTION_EXECUTE_HANDLER) { - OutTraceD("HookAPI: EXCEPTION hook=%s:%s Hook Failed.\n", dll, apiname); + OutTraceDW("HookAPI: EXCEPTION hook=%s:%s Hook Failed.\n", dll, apiname); org = 0; } return org; @@ -537,23 +546,23 @@ void *HookAPI(HMODULE module, char *dll, void *apiproc, const char *apiname, voi if(org == hookproc) return 0; // already hooked if(!VirtualProtect(&ptaddr->u1.Function, 4, PAGE_EXECUTE_READWRITE, &oldprotect)) { - OutTraceD("HookAPI: VirtualProtect error %d at %d\n", GetLastError(), __LINE__); + OutTraceDW("HookAPI: VirtualProtect error %d at %d\n", GetLastError(), __LINE__); return 0; } ptaddr->u1.Function = (DWORD)hookproc; if(!VirtualProtect(&ptaddr->u1.Function, 4, oldprotect, &oldprotect)) { - OutTraceD("HookAPI: VirtualProtect error %d at %d\n", GetLastError(), __LINE__); + OutTraceDW("HookAPI: VirtualProtect error %d at %d\n", GetLastError(), __LINE__); return 0; } if (!FlushInstructionCache(GetCurrentProcess(), &ptaddr->u1.Function, 4)) { - OutTraceD("HookAPI: FlushInstructionCache error %d at %d\n", GetLastError(), __LINE__); + OutTraceDW("HookAPI: FlushInstructionCache error %d at %d\n", GetLastError(), __LINE__); return 0; } OutTraceH("HookAPI hook=%s address=%x->%x\n", apiname, org, hookproc); } __except(EXCEPTION_EXECUTE_HANDLER) { - OutTraceD("HookAPI: EXCEPTION hook=%s:%s Hook Failed.\n", dll, apiname); + OutTraceDW("HookAPI: EXCEPTION hook=%s:%s Hook Failed.\n", dll, apiname); org = 0; } return org; @@ -643,12 +652,12 @@ void CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWPOS wp) void AdjustWindowPos(HWND hwnd, DWORD width, DWORD height) { WINDOWPOS wp; - OutTraceD("AdjustWindowPos: hwnd=%x, size=(%d,%d)\n", hwnd, width, height); + OutTraceDW("AdjustWindowPos: hwnd=%x, size=(%d,%d)\n", hwnd, width, height); CalculateWindowPos(hwnd, width, height, &wp); - OutTraceD("AdjustWindowPos: fixed pos=(%d,%d) size=(%d,%d)\n", wp.x, wp.y, wp.cx, wp.cy); + OutTraceDW("AdjustWindowPos: fixed pos=(%d,%d) size=(%d,%d)\n", wp.x, wp.y, wp.cx, wp.cy); //if(!pSetWindowPos) pSetWindowPos=SetWindowPos; - //OutTraceD("pSetWindowPos=%x\n", pSetWindowPos); - OutTraceD("hwnd=%x pos=(%d,%d) size=(%d,%d)\n", pSetWindowPos, wp.x, wp.y, wp.cx, wp.cy); + //OutTraceDW("pSetWindowPos=%x\n", pSetWindowPos); + OutTraceDW("hwnd=%x pos=(%d,%d) size=(%d,%d)\n", pSetWindowPos, wp.x, wp.y, wp.cx, wp.cy); if(!(*pSetWindowPos)(hwnd, 0, wp.x, wp.y, wp.cx, wp.cy, 0)){ OutTraceE("AdjustWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__); } @@ -658,14 +667,29 @@ void AdjustWindowPos(HWND hwnd, DWORD width, DWORD height) return; } +void HookWindowProc(HWND hwnd) +{ + WNDPROC pWindowProc; + pWindowProc = (WNDPROC)(*pGetWindowLong)(hwnd, GWL_WNDPROC); + if (pWindowProc == extWindowProc){ + // hooked already !!! + OutTraceDW("GetWindowLong: hwnd=%x WindowProc HOOK already in place\n", hwnd); + } + else {// don't hook twice .... + long lres; + WhndStackPush(hwnd, pWindowProc); + lres=(*pSetWindowLong)(hwnd, GWL_WNDPROC, (LONG)extWindowProc); + OutTraceDW("SetWindowLong: hwnd=%x HOOK WindowProc=%x->%x\n", hwnd, lres, (LONG)extWindowProc); + } +} + void AdjustWindowFrame(HWND hwnd, DWORD width, DWORD height) { HRESULT res=0; - WNDPROC pWindowProc; LONG style; - OutTraceD("AdjustWindowFrame hwnd=%x, size=(%d,%d) coord=%d\n", hwnd, width, height, dxw.Coordinates); + OutTraceDW("AdjustWindowFrame hwnd=%x, size=(%d,%d) coord=%d\n", hwnd, width, height, dxw.Coordinates); dxw.SetScreenSize(width, height); if (hwnd==NULL) return; @@ -684,29 +708,18 @@ void AdjustWindowFrame(HWND hwnd, DWORD width, DWORD height) (*pSetWindowLong)(hwnd, GWL_STYLE, style); (*pSetWindowLong)(hwnd, GWL_EXSTYLE, 0); (*pShowWindow)(hwnd, SW_SHOWNORMAL); - OutTraceD("AdjustWindowFrame hwnd=%x, set style=%s extstyle=0\n", hwnd, (style == 0) ? "0" : "WS_OVERLAPPEDWINDOW"); + OutTraceDW("AdjustWindowFrame hwnd=%x, set style=%s extstyle=0\n", hwnd, (style == 0) ? "0" : "WS_OVERLAPPEDWINDOW"); AdjustWindowPos(hwnd, width, height); // fixing windows message handling procedure - - pWindowProc = (WNDPROC)(*pGetWindowLong)(hwnd, GWL_WNDPROC); - if (pWindowProc == extWindowProc){ - // hooked already !!! - OutTraceD("GetWindowLong: extWindowProc already in place, hwnd=%x\n", hwnd); - } - else {// don't hook twice .... - long lres; - WhndStackPush(hwnd, pWindowProc); - lres=(*pSetWindowLong)(hwnd, GWL_WNDPROC, (LONG)extWindowProc); - OutTraceD("AdjustWindowFrame: fixing hwnd=%x WindowProc=%x->%x\n", hwnd, lres, (LONG)extWindowProc); - } + HookWindowProc(hwnd); // fixing cursor view and clipping region if (dxw.dwFlags1 & HIDEHWCURSOR) while ((*pShowCursor)(0) >= 0); if (dxw.dwFlags2 & SHOWHWCURSOR) while((*pShowCursor)(1) < 0); if (dxw.dwFlags1 & CLIPCURSOR) { - OutTraceD("AdjustWindowFrame: setting clip region\n"); + OutTraceDW("AdjustWindowFrame: setting clip region\n"); dxw.SetClipCursor(); } @@ -736,7 +749,7 @@ INT_PTR CALLBACK extDialogWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPA pWindowProc=WhndGetWindowProc(hwnd); if(pWindowProc) return(*pWindowProc)(hwnd, message, wparam, lparam); char *sMsg="ASSERT: DialogWinMsg pWindowProc=NULL !!!\n"; - OutTraceD(sMsg); + OutTraceDW(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "WindowProc", MB_OK | MB_ICONEXCLAMATION); return NULL; } @@ -799,7 +812,7 @@ static void dx_UpdatePositionLock(HWND hwnd) (*pGetClientRect)(hwnd,&rect); (*pClientToScreen)(hwnd,&p); dxw.dwFlags1 |= LOCKWINPOS; - OutTraceD("Toggle position lock ON\n"); + OutTraceDW("Toggle position lock ON\n"); dxw.InitWindowPos(p.x, p.y, rect.right-rect.left, rect.bottom-rect.top); } @@ -808,11 +821,11 @@ static void dx_TogglePositionLock(HWND hwnd) // toggle position locking if(dxw.dwFlags1 & LOCKWINPOS){ // unlock - OutTraceD("Toggle position lock OFF\n"); + OutTraceDW("Toggle position lock OFF\n"); dxw.dwFlags1 &= ~LOCKWINPOS; } else { - OutTraceD("Toggle position lock ON\n"); + OutTraceDW("Toggle position lock ON\n"); dxw.dwFlags1 |= LOCKWINPOS; dx_UpdatePositionLock(hwnd); } @@ -915,19 +928,19 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case WM_NCCALCSIZE: if((dxw.dwFlags1 & LOCKWINPOS) && (hwnd == dxw.GethWnd())){ // v2.02.30: don't alter child and other windows.... - OutTraceD("WindowProc: WS_NCCALCSIZE wparam=%x\n", wparam); + OutTraceDW("WindowProc: WS_NCCALCSIZE wparam=%x\n", wparam); if(wparam){ // nothing so far .... if (IsDebug){ NCCALCSIZE_PARAMS *ncp; ncp = (NCCALCSIZE_PARAMS *) lparam; - OutTraceD("WindowProc: WS_NCCALCSIZE rect[0]=(%d,%d)-(%d,%d)\n", + OutTraceDW("WindowProc: WS_NCCALCSIZE rect[0]=(%d,%d)-(%d,%d)\n", ncp->rgrc[0].left, ncp->rgrc[0].top, ncp->rgrc[0].right, ncp->rgrc[0].bottom); - OutTraceD("WindowProc: WS_NCCALCSIZE rect[1]=(%d,%d)-(%d,%d)\n", + OutTraceDW("WindowProc: WS_NCCALCSIZE rect[1]=(%d,%d)-(%d,%d)\n", ncp->rgrc[1].left, ncp->rgrc[1].top, ncp->rgrc[1].right, ncp->rgrc[1].bottom); - OutTraceD("WindowProc: WS_NCCALCSIZE rect[2]=(%d,%d)-(%d,%d)\n", + OutTraceDW("WindowProc: WS_NCCALCSIZE rect[2]=(%d,%d)-(%d,%d)\n", ncp->rgrc[2].left, ncp->rgrc[2].top, ncp->rgrc[2].right, ncp->rgrc[2].bottom); - OutTraceD("WindowProc: WS_NCCALCSIZE winrect=(%d,%d)-(%d,%d)\n", + OutTraceDW("WindowProc: WS_NCCALCSIZE winrect=(%d,%d)-(%d,%d)\n", ncp->lppos->x, ncp->lppos->y, ncp->lppos->cx, ncp->lppos->cy); } } @@ -960,7 +973,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp case WM_IME_KEYDOWN: case WM_IME_KEYUP: if(dxw.dwFlags2 & SUPPRESSIME){ - OutTraceD("WindowProc: SUPPRESS WinMsg=[0x%x]%s(%x,%x)\n", message, ExplainWinMessage(message), wparam, lparam); + OutTraceDW("WindowProc: SUPPRESS WinMsg=[0x%x]%s(%x,%x)\n", message, ExplainWinMessage(message), wparam, lparam); return 0; } break; @@ -981,13 +994,13 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case WM_ERASEBKGND: if(dxw.IsDesktop(hwnd)){ - OutTraceD("WindowProc: WM_ERASEBKGND(%x,%x) - suppressed\n", wparam, lparam); + OutTraceDW("WindowProc: WM_ERASEBKGND(%x,%x) - suppressed\n", wparam, lparam); return 1; // 1 == OK, erased } break; case WM_DISPLAYCHANGE: if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()){ - OutTraceD("WindowProc: prevent WM_DISPLAYCHANGE depth=%d size=(%d,%d)\n", + OutTraceDW("WindowProc: prevent WM_DISPLAYCHANGE depth=%d size=(%d,%d)\n", wparam, HIWORD(lparam), LOWORD(lparam)); // v2.02.43: unless EMULATESURFACE is set, lock the screen resolution only, but not the color depth! if(dxw.dwFlags1 & EMULATESURFACE) return 0; @@ -1001,7 +1014,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp LPWINDOWPOS wp; wp = (LPWINDOWPOS)lparam; dxwFixWindowPos("WindowProc", hwnd, lparam); - OutTraceD("WindowProc: WM_WINDOWPOSCHANGING fixed size=(%d,%d)\n", wp->cx, wp->cy); + OutTraceDW("WindowProc: WM_WINDOWPOSCHANGING fixed size=(%d,%d)\n", wp->cx, wp->cy); break; case WM_ENTERSIZEMOVE: if(IsToBeLocked){ @@ -1090,16 +1103,16 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp GetHookInfo()->CursorY=HIWORD(lparam); break; case WM_SETFOCUS: - OutTraceD("WindowProc: hwnd=%x GOT FOCUS\n", hwnd); + OutTraceDW("WindowProc: hwnd=%x GOT FOCUS\n", hwnd); if (dxw.dwFlags1 & ENABLECLIPPING) extClipCursor(lpClipRegion); break; case WM_KILLFOCUS: - OutTraceD("WindowProc: hwnd=%x LOST FOCUS\n", hwnd); + OutTraceDW("WindowProc: hwnd=%x LOST FOCUS\n", hwnd); if (dxw.dwFlags1 & CLIPCURSOR) dxw.EraseClipCursor(); if (dxw.dwFlags1 & ENABLECLIPPING) (*pClipCursor)(NULL); break; case WM_CLOSE: - OutTraceD("WindowProc: WM_CLOSE - terminating process\n"); + OutTraceDW("WindowProc: WM_CLOSE - terminating process\n"); if(dxw.dwFlags3 & FORCE16BPP) RecoverScreenMode(); TerminateProcess(GetCurrentProcess(),0); break; @@ -1108,7 +1121,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp switch (wparam){ case VK_F12: if(dxw.dwFlags1 & CLIPCURSOR){ - OutTraceD("WindowProc: WM_SYSKEYDOWN key=%x ToggleState=%x\n",wparam,ClipCursorToggleState); + OutTraceDW("WindowProc: WM_SYSKEYDOWN key=%x ToggleState=%x\n",wparam,ClipCursorToggleState); ClipCursorToggleState = !ClipCursorToggleState; ClipCursorToggleState ? dxw.SetClipCursor() : dxw.EraseClipCursor(); } @@ -1138,7 +1151,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case VK_F4: if (dxw.dwFlags1 & HANDLEALTF4) { - OutTraceD("WindowProc: WM_SYSKEYDOWN(ALT-F4) - terminating process\n"); + OutTraceDW("WindowProc: WM_SYSKEYDOWN(ALT-F4) - terminating process\n"); TerminateProcess(GetCurrentProcess(),0); } break; @@ -1180,12 +1193,12 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp return ret; } - //OutTraceD("ASSERT: WindowProc mismatch hwnd=%x\n", hwnd); + //OutTraceDW("ASSERT: WindowProc mismatch hwnd=%x\n", hwnd); // ??? maybe it's a normal condition, whenever you don't have a WindowProc routine // like in Commandos 2. Flag it? char sMsg[81]; sprintf(sMsg,"ASSERT: WindowProc mismatch hwnd=%x\n", hwnd); - OutTraceD(sMsg); + OutTraceDW(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "WindowProc", MB_OK | MB_ICONEXCLAMATION); return (*pDefWindowProc)(hwnd, message, wparam, lparam); } @@ -1209,7 +1222,7 @@ static void SaveScreenMode() if(DoOnce) return; DoOnce=TRUE; EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &InitDevMode); - OutTraceD("DXWND: Initial display mode WxH=(%dx%d) BitsPerPel=%d\n", + OutTraceDW("DXWND: Initial display mode WxH=(%dx%d) BitsPerPel=%d\n", InitDevMode.dmPelsWidth, InitDevMode.dmPelsHeight, InitDevMode.dmBitsPerPel); } @@ -1218,11 +1231,11 @@ static void RecoverScreenMode() DEVMODE CurrentDevMode; BOOL res; EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &CurrentDevMode); - OutTraceD("ChangeDisplaySettings: recover CURRENT WxH=(%dx%d) BitsPerPel=%d TARGET WxH=(%dx%d) BitsPerPel=%d\n", + OutTraceDW("ChangeDisplaySettings: recover CURRENT WxH=(%dx%d) BitsPerPel=%d TARGET WxH=(%dx%d) BitsPerPel=%d\n", CurrentDevMode.dmPelsWidth, CurrentDevMode.dmPelsHeight, CurrentDevMode.dmBitsPerPel, InitDevMode.dmPelsWidth, InitDevMode.dmPelsHeight, InitDevMode.dmBitsPerPel); InitDevMode.dmFields = (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT); - res=(*pChangeDisplaySettings)(&InitDevMode, 0); + res=(*pChangeDisplaySettingsA)(&InitDevMode, 0); if(res) OutTraceE("ChangeDisplaySettings: ERROR err=%d at %d\n", GetLastError(), __LINE__); } @@ -1231,11 +1244,11 @@ void SwitchTo16BPP() DEVMODE CurrentDevMode; BOOL res; EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &CurrentDevMode); - OutTraceD("ChangeDisplaySettings: CURRENT wxh=(%dx%d) BitsPerPel=%d -> 16\n", + OutTraceDW("ChangeDisplaySettings: CURRENT wxh=(%dx%d) BitsPerPel=%d -> 16\n", CurrentDevMode.dmPelsWidth, CurrentDevMode.dmPelsHeight, CurrentDevMode.dmBitsPerPel); CurrentDevMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; CurrentDevMode.dmBitsPerPel = 16; - res=(*pChangeDisplaySettings)(&CurrentDevMode, CDS_UPDATEREGISTRY); + res=(*pChangeDisplaySettingsA)(&CurrentDevMode, CDS_UPDATEREGISTRY); if(res) OutTraceE("ChangeDisplaySettings: ERROR err=%d at %d\n", GetLastError(), __LINE__); } @@ -1243,13 +1256,13 @@ static void LockScreenMode(DWORD dmPelsWidth, DWORD dmPelsHeight, DWORD dmBitsPe { DEVMODE InitDevMode; BOOL res; - OutTraceD("ChangeDisplaySettings: LOCK wxh=(%dx%d) BitsPerPel=%d -> wxh=(%dx%d) BitsPerPel=%d\n", + OutTraceDW("ChangeDisplaySettings: LOCK wxh=(%dx%d) BitsPerPel=%d -> wxh=(%dx%d) BitsPerPel=%d\n", InitDevMode.dmPelsWidth, InitDevMode.dmPelsHeight, InitDevMode.dmBitsPerPel, dmPelsWidth, dmPelsHeight, dmBitsPerPel); if( (dmPelsWidth != InitDevMode.dmPelsWidth) || (dmPelsHeight !=InitDevMode.dmPelsHeight) || (dmBitsPerPel != InitDevMode.dmBitsPerPel)){ - res=(*pChangeDisplaySettings)(&InitDevMode, 0); + res=(*pChangeDisplaySettingsA)(&InitDevMode, 0); if(res) OutTraceE("ChangeDisplaySettings: ERROR err=%d at %d\n", GetLastError(), __LINE__); } } @@ -1300,7 +1313,7 @@ LONG WINAPI myUnhandledExceptionFilter(LPEXCEPTION_POINTERS ExceptionInfo) LPTOP_LEVEL_EXCEPTION_FILTER WINAPI extSetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter) { - OutTraceD("SetUnhandledExceptionFilter: lpExceptionFilter=%x\n", lpTopLevelExceptionFilter); + OutTraceDW("SetUnhandledExceptionFilter: lpExceptionFilter=%x\n", lpTopLevelExceptionFilter); extern LONG WINAPI myUnhandledExceptionFilter(LPEXCEPTION_POINTERS); return (*pSetUnhandledExceptionFilter)(myUnhandledExceptionFilter); } @@ -1310,7 +1323,7 @@ void HookExceptionHandler(void) void *tmp; HMODULE base; - OutTraceD("Set exception handlers\n"); + OutTraceDW("Set exception handlers\n"); base=GetModuleHandle(NULL); pSetUnhandledExceptionFilter = SetUnhandledExceptionFilter; //v2.1.75 override default exception handler, if any.... @@ -1385,15 +1398,15 @@ void SetSingleProcessAffinity(void) DWORD ProcessAffinityMask, SystemAffinityMask; if(!GetProcessAffinityMask(GetCurrentProcess(), &ProcessAffinityMask, &SystemAffinityMask)) OutTraceE("GetProcessAffinityMask: ERROR err=%d\n", GetLastError()); - OutTraceD("Process affinity=%x\n", ProcessAffinityMask); + OutTraceDW("Process affinity=%x\n", ProcessAffinityMask); for (i=0; i<(8 * sizeof(DWORD)); i++){ if (ProcessAffinityMask & 0x1) break; ProcessAffinityMask >>= 1; } - OutTraceD("First process affinity bit=%d\n", i); + OutTraceDW("First process affinity bit=%d\n", i); ProcessAffinityMask &= 0x1; for (; i; i--) ProcessAffinityMask <<= 1; - OutTraceD("Process affinity=%x\n", ProcessAffinityMask); + OutTraceDW("Process affinity=%x\n", ProcessAffinityMask); if (!SetProcessAffinityMask(GetCurrentProcess(), ProcessAffinityMask)) OutTraceE("SetProcessAffinityMask: ERROR err=%d\n", GetLastError()); } @@ -1440,7 +1453,7 @@ void HookInit(TARGETMAP *target, HWND hwnd) dxw.SethWnd((dxw.dwFlags1 & FIXPARENTWIN) ? GetParent(hwnd) : hwnd); } - if(IsTraceD){ + if(IsTraceDDRAW){ 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); @@ -1448,6 +1461,19 @@ void HookInit(TARGETMAP *target, HWND hwnd) else OutTrace("\n"); } +#if 0 + if(dxw.dwFlags4 & ADDPROXYLIBS){ + #define MAX_FILE_PATH 512 + char sSourcePath[MAX_FILE_PATH+1]; + char *p; + GetModuleFileName(GetModuleHandle("dxwnd"), sSourcePath, MAX_FILE_PATH); + p=&sSourcePath[strlen(sSourcePath)-strlen("dxwnd.dll")]; + strcpy(p, "d3d9.dll"); + OutTraceDW("HookInit: copy %s -> d3d9.dll\n", sSourcePath); + CopyFile(sSourcePath, "d3d9.dll", FALSE); + } +#endif + if (hwnd && IsDebug){ DWORD dwStyle, dwExStyle; dwStyle=GetWindowLong(dxw.GethWnd(), GWL_STYLE); @@ -1489,7 +1515,7 @@ void HookInit(TARGETMAP *target, HWND hwnd) OutTraceE("HookInit: LoadLibrary ERROR module=%s err=%d\n", sModule, GetLastError()); } else { - OutTraceD("HookInit: hooking additional module=%s base=%x\n", sModule, base); + OutTraceDW("HookInit: hooking additional module=%s base=%x\n", sModule, base); if (dxw.dwTFlags & OUTIMPORTTABLE) DumpImportTable(base); HookModule(base, dxw.dwTargetDDVersion); } @@ -1507,8 +1533,9 @@ void HookInit(TARGETMAP *target, HWND hwnd) } InitScreenParameters(); + if(hwnd) HookWindowProc(hwnd); - if (IsDebug) OutTraceD("MoveWindow: target pos=(%d,%d) size=(%d,%d)\n", dxw.iPosX, dxw.iPosY, dxw.iSizX, dxw.iSizY); //v2.02.09 + if (IsDebug) OutTraceDW("MoveWindow: target pos=(%d,%d) size=(%d,%d)\n", dxw.iPosX, dxw.iPosY, dxw.iSizX, dxw.iSizY); //v2.02.09 } LPCSTR ProcToString(LPCSTR proc) @@ -1527,7 +1554,8 @@ FARPROC RemapLibrary(LPCSTR proc, HMODULE hModule, HookEntry_Type *Hooks) for(; Hooks->APIName; Hooks++){ if (!strcmp(proc,Hooks->APIName)){ if (Hooks->StoreAddress) *(Hooks->StoreAddress)=(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), (Hooks->StoreAddress) ? *(Hooks->StoreAddress) : 0); + OutTraceDW("GetProcAddress: hooking proc=%s addr=%x->%x\n", + ProcToString(proc), (Hooks->StoreAddress) ? *(Hooks->StoreAddress) : 0, Hooks->HookerAddress); return Hooks->HookerAddress; } } diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp index b3131b9..eab33d5 100644 --- a/dll/dxwcore.cpp +++ b/dll/dxwcore.cpp @@ -37,14 +37,14 @@ dxwCore::~dxwCore() void dxwCore::SetFullScreen(BOOL fs, int line) { - OutTraceD("SetFullScreen: %s at %d\n", fs?"FULLSCREEN":"WINDOWED", line); + OutTraceDW("SetFullScreen: %s at %d\n", fs?"FULLSCREEN":"WINDOWED", line); FullScreen=fs; } void dxwCore::SetFullScreen(BOOL fs) { if(dxw.dwFlags3 & FULLSCREENONLY) fs=TRUE; - OutTraceD("SetFullScreen: %s\n", fs?"FULLSCREEN":"WINDOWED"); + OutTraceDW("SetFullScreen: %s\n", fs?"FULLSCREEN":"WINDOWED"); FullScreen=fs; } @@ -84,7 +84,7 @@ void dxwCore::InitTarget(TARGETMAP *target) void dxwCore::UnmarkPrimarySurface(LPDIRECTDRAWSURFACE ps) { int i; - // OutTraceD("PRIMARYSURFACE del %x\n",ps); + // OutTraceDW("PRIMARYSURFACE del %x\n",ps); for (i=0;iFPSCount = FPSCount; // for overlay display // show fps on win title bar @@ -1077,7 +1077,7 @@ void dxwCore::ShowBanner(HWND hwnd) GetObject(g_hbmBall, sizeof(bm), &bm); (*pGetWindowRect)(hwnd, &win); - OutTraceD("ShowBanner: hdc=%x win=(%d,%d)-(%d,%d) banner size=(%dx%d)\n", + OutTraceDW("ShowBanner: hwnd=%x win=(%d,%d)-(%d,%d) banner size=(%dx%d)\n", hwnd, win.left, win.top, win.right, win.bottom, bm.bmWidth, bm.bmHeight); //if(!pSetViewportOrgEx) pSetViewportOrgEx=SetViewportOrgEx; @@ -1153,7 +1153,7 @@ int dxwCore::GetDLLIndex(char *lpFileName) (!lstrcmpi(lpName,SysNames[idx])) || (!lstrcmpi(lpName,SysNameExt)) ){ - OutTraceB("Registered DLL FileName=%s\n", lpFileName); + OutTraceDW("Registered DLL FileName=%s\n", lpFileName); break; } } @@ -1168,7 +1168,7 @@ void dxwCore::FixStyle(char *ApiName, HWND hwnd, WPARAM wParam, LPARAM lParam) switch (wParam) { case GWL_STYLE: - OutTraceD("%s: new Style=%x(%s)\n", + OutTraceDW("%s: new Style=%x(%s)\n", ApiName, lpSS->styleNew, ExplainStyle(lpSS->styleNew)); if (dxw.dwFlags1 & FIXWINFRAME){ // set canonical style lpSS->styleNew= WS_OVERLAPPEDWINDOW; @@ -1178,13 +1178,13 @@ void dxwCore::FixStyle(char *ApiName, HWND hwnd, WPARAM wParam, LPARAM lParam) } if (dxw.dwFlags1 & PREVENTMAXIMIZE){ // disable maximize settings if (lpSS->styleNew & WS_MAXIMIZE){ - OutTraceD("%s: prevent maximize style\n", ApiName); + OutTraceDW("%s: prevent maximize style\n", ApiName); lpSS->styleNew &= ~WS_MAXIMIZE; } } break; case GWL_EXSTYLE: - OutTraceD("%s: new ExStyle=%x(%s)\n", + OutTraceDW("%s: new ExStyle=%x(%s)\n", ApiName, lpSS->styleNew, ExplainExStyle(lpSS->styleNew)); if (dxw.dwFlags1 & FIXWINFRAME){ // set canonical style lpSS->styleNew= 0; @@ -1194,7 +1194,7 @@ void dxwCore::FixStyle(char *ApiName, HWND hwnd, WPARAM wParam, LPARAM lParam) } if ((dxw.dwFlags1 & PREVENTMAXIMIZE) && (hwnd==hWnd)){ // disable maximize settings if (lpSS->styleNew & WS_EX_TOPMOST){ - OutTraceD("%s: prevent EXSTYLE topmost style\n", ApiName); + OutTraceDW("%s: prevent EXSTYLE topmost style\n", ApiName); lpSS->styleNew &= ~WS_EX_TOPMOST; } } diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index ddf12ff..f31070b 100644 --- a/dll/dxwnd.cpp +++ b/dll/dxwnd.cpp @@ -24,7 +24,7 @@ along with this program. If not, see . #include "dxwnd.h" #include "dxwcore.hpp" -#define VERSION "2.02.48" +#define VERSION "2.02.49" #define DDTHREADLOCK 1 @@ -92,7 +92,7 @@ int SetTarget(TARGETMAP *targets){ pStatus->Height = pStatus->Width = 0; pStatus->DXVersion = 0; for(i = 0; targets[i].path[0]; i ++){ - //OutTraceD("SetTarget entry %s\n",pMapping[i].path); + //OutTraceDW("SetTarget entry %s\n",pMapping[i].path); pMapping[i] = targets[i]; for(j = 0; pMapping[i].path[j]; j ++) pMapping[i].path[j] = tolower(pMapping[i].path[j]); diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 6509a8b..b6b2296 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/gdi32.cpp b/dll/gdi32.cpp index 2c302f5..f74fe4d 100644 --- a/dll/gdi32.cpp +++ b/dll/gdi32.cpp @@ -286,7 +286,7 @@ static COLORREF GetMatchingColor(COLORREF crColor) if (iMinDistance==0) break; // got the perfect match! } - OutTraceD("GetMatchingColor: color=%x matched with palette[%d]=%x dist=%d\n", + OutTraceDW("GetMatchingColor: color=%x matched with palette[%d]=%x dist=%d\n", crColor, iMinColorIndex, PaletteEntries[iMinColorIndex], iDistance); PalColor=PaletteEntries[iMinColorIndex]; switch(dxw.ActualPixelFormat.dwRGBBitCount){ @@ -318,7 +318,7 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex) DWORD res; res = (*pGDIGetDeviceCaps)(hdc, nindex); - if(IsTraceD){ + if(IsTraceDDRAW){ OutTrace("GetDeviceCaps: hdc=%x index=%x(%s)", hdc, nindex, ExplainDeviceCaps(nindex)); switch(nindex){ case RASTERCAPS: @@ -341,15 +341,15 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex) case BITSPIXEL: case COLORRES: res = pSetDevMode->dmBitsPerPel; - OutTraceD("GetDeviceCaps: fix(1) BITSPIXEL/COLORRES cap=%x\n",res); + OutTraceDW("GetDeviceCaps: fix(1) BITSPIXEL/COLORRES cap=%x\n",res); return res; case HORZRES: res = pSetDevMode->dmPelsWidth; - OutTraceD("GetDeviceCaps: fix(1) HORZRES cap=%d\n", res); + OutTraceDW("GetDeviceCaps: fix(1) HORZRES cap=%d\n", res); return res; case VERTRES: res = pSetDevMode->dmPelsHeight; - OutTraceD("GetDeviceCaps: fix(1) VERTRES cap=%d\n", res); + OutTraceDW("GetDeviceCaps: fix(1) VERTRES cap=%d\n", res); return res; } } @@ -357,18 +357,18 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex) switch(nindex){ case VERTRES: res= dxw.GetScreenHeight(); - OutTraceD("GetDeviceCaps: fix(2) VERTRES cap=%d\n", res); + OutTraceDW("GetDeviceCaps: fix(2) VERTRES cap=%d\n", res); break; case HORZRES: res= dxw.GetScreenWidth(); - OutTraceD("GetDeviceCaps: fix(2) HORZRES cap=%d\n", res); + OutTraceDW("GetDeviceCaps: fix(2) HORZRES cap=%d\n", res); break; // WARNING: in no-emu mode, the INIT8BPP and INIT16BPP flags expose capabilities that // are NOT implemented and may cause later troubles! case RASTERCAPS: if(dxw.dwFlags2 & INIT8BPP) { res |= RC_PALETTE; // v2.02.12 - OutTraceD("GetDeviceCaps: fix(2) RASTERCAPS setting RC_PALETTE cap=%x\n",res); + OutTraceDW("GetDeviceCaps: fix(2) RASTERCAPS setting RC_PALETTE cap=%x\n",res); } break; case BITSPIXEL: @@ -376,7 +376,7 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex) if(dxw.dwFlags2 & (INIT8BPP|INIT16BPP)){ // v2.02.32 fix if(dxw.dwFlags2 & INIT8BPP) res = 8; if(dxw.dwFlags2 & INIT16BPP) res = 16; - OutTraceD("GetDeviceCaps: fix(2) BITSPIXEL/COLORRES cap=%d\n",res); + OutTraceDW("GetDeviceCaps: fix(2) BITSPIXEL/COLORRES cap=%d\n",res); } break; //case NUMCOLORS: // numcolors windows bug fix.... @@ -389,7 +389,7 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex) case RASTERCAPS: if((dxw.VirtualPixelFormat.dwRGBBitCount==8) || (dxw.dwFlags2 & INIT8BPP)){ res |= RC_PALETTE; - OutTraceD("GetDeviceCaps: fix(3) RASTERCAPS setting RC_PALETTE cap=%x(%s)\n", res, ExplainRasterCaps(res)); + OutTraceDW("GetDeviceCaps: fix(3) RASTERCAPS setting RC_PALETTE cap=%x(%s)\n", res, ExplainRasterCaps(res)); } break; case BITSPIXEL: @@ -399,15 +399,15 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex) if(dxw.VirtualPixelFormat.dwRGBBitCount!=0) res = dxw.VirtualPixelFormat.dwRGBBitCount; if(dxw.dwFlags2 & INIT8BPP) res = 8; if(dxw.dwFlags2 & INIT16BPP) res = 16; - if(PrevRes != res) OutTraceD("GetDeviceCaps: fix(3) BITSPIXEL/COLORRES cap=%d\n",res); + if(PrevRes != res) OutTraceDW("GetDeviceCaps: fix(3) BITSPIXEL/COLORRES cap=%d\n",res); break; case SIZEPALETTE: res = 256; - OutTraceD("GetDeviceCaps: fix(3) SIZEPALETTE cap=%x\n",res); + OutTraceDW("GetDeviceCaps: fix(3) SIZEPALETTE cap=%x\n",res); break; case NUMRESERVED: res = 0; - OutTraceD("GetDeviceCaps: fix(3) NUMRESERVED cap=%x\n",res); + OutTraceDW("GetDeviceCaps: fix(3) NUMRESERVED cap=%x\n",res); break; } } @@ -417,11 +417,11 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex) BOOL WINAPI extTextOutA(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cchString) { BOOL ret; - OutTraceD("TextOut: hdc=%x xy=(%d,%d) str=(%d)\"%s\"\n", hdc, nXStart, nYStart, cchString, lpString); + OutTraceDW("TextOut: hdc=%x xy=(%d,%d) str=(%d)\"%s\"\n", hdc, nXStart, nYStart, cchString, lpString); if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ dxw.MapClient(&nXStart, &nYStart); - OutTraceD("TextOut: fixed dest=(%d,%d)\n", nXStart, nYStart); + OutTraceDW("TextOut: fixed dest=(%d,%d)\n", nXStart, nYStart); } ret=(*pGDITextOutA)(hdc, nXStart, nYStart, lpString, cchString); @@ -431,7 +431,7 @@ BOOL WINAPI extTextOutA(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int BOOL WINAPI extScaleWindowExtEx(HDC hdc, int Xnum, int Xdenom, int Ynum, int Ydenom, LPSIZE lpSize) { - OutTraceD("ScaleWindowExtEx: hdc=%x num=(%d,%d) denom=(%d,%d) lpSize=%d\n", + OutTraceDW("ScaleWindowExtEx: hdc=%x num=(%d,%d) denom=(%d,%d) lpSize=%d\n", hdc, Xnum, Ynum, Xdenom, Ydenom, lpSize); MessageBox(0, "ScaleWindowExtEx", "to fix", MB_OK | MB_ICONEXCLAMATION); @@ -443,11 +443,11 @@ BOOL WINAPI extRectangle(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, i { int ret; - OutTraceD("Rectangle: hdc=%x xy=(%d,%d)-(%d,%d)\n", hdc, nLeftRect, nTopRect, nRightRect, nBottomRect); + OutTraceDW("Rectangle: hdc=%x xy=(%d,%d)-(%d,%d)\n", hdc, nLeftRect, nTopRect, nRightRect, nBottomRect); 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); + OutTraceDW("Rectangle: fixed dest=(%d,%d)-(%d,%d)\n", nLeftRect, nTopRect, nRightRect, nBottomRect); } ret=(*pGDIRectangle)(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect); @@ -460,7 +460,7 @@ int WINAPI extGDISaveDC(HDC hdc) int ret; ret=(*pGDISaveDC)(hdc); - OutTraceD("GDI.SaveDC: hdc=%x ret=%x\n", hdc, ret); + OutTraceDW("GDI.SaveDC: hdc=%x ret=%x\n", hdc, ret); return ret; } @@ -469,7 +469,7 @@ BOOL WINAPI extGDIRestoreDC(HDC hdc, int nSavedDC) BOOL ret; ret=(*pGDIRestoreDC)(hdc, nSavedDC); - OutTraceD("GDI.RestoreDC: hdc=%x nSavedDC=%x ret=%x\n", hdc, nSavedDC, ret); + OutTraceDW("GDI.RestoreDC: hdc=%x nSavedDC=%x ret=%x\n", hdc, nSavedDC, ret); return ret; } @@ -484,14 +484,14 @@ HPALETTE WINAPI extGDICreatePalette(CONST LOGPALETTE *plpal) HPALETTE ret; int idx; - OutTraceD("GDI.CreatePalette: plpal=%x version=%x NumEntries=%x\n", plpal, plpal->palVersion, plpal->palNumEntries); + OutTraceDW("GDI.CreatePalette: plpal=%x version=%x NumEntries=%x\n", plpal, plpal->palVersion, plpal->palNumEntries); ret=(*pGDICreatePalette)(plpal); if(IsDebug){ - OutTraceD("PalEntry[%x]= ", plpal->palNumEntries); - for(idx=0; idxpalNumEntries; idx++) OutTraceD("(%x)", plpal->palPalEntry[idx]); - OutTraceD("\n"); + OutTraceDW("PalEntry[%x]= ", plpal->palNumEntries); + for(idx=0; idxpalNumEntries; idx++) OutTraceDW("(%x)", plpal->palPalEntry[idx]); + OutTraceDW("\n"); } - OutTraceD("GDI.CreatePalette: hPalette=%x\n", ret); + OutTraceDW("GDI.CreatePalette: hPalette=%x\n", ret); return ret; } @@ -502,9 +502,9 @@ HPALETTE WINAPI extSelectPalette(HDC hdc, HPALETTE hpal, BOOL bForceBackground) HPALETTE ret; ret=(*pGDISelectPalette)(hdc, hpal, bForceBackground); - OutTraceD("GDI.SelectPalette: hdc=%x hpal=%x ForceBackground=%x ret=%x\n", hdc, hpal, bForceBackground, ret); + OutTraceDW("GDI.SelectPalette: hdc=%x hpal=%x ForceBackground=%x ret=%x\n", hdc, hpal, bForceBackground, ret); if((OBJ_DC == GetObjectType(hdc)) && (dxw.dwFlags1 & EMULATESURFACE)){ - OutTraceD("GDI.SelectPalette: register desktop palette hpal=%x\n", hpal); + OutTraceDW("GDI.SelectPalette: register desktop palette hpal=%x\n", hpal); hDesktopPalette=hpal; } return ret; @@ -522,7 +522,7 @@ UINT WINAPI extRealizePalette(HDC hdc) UINT ret; extern void mySetPalette(int, int, LPPALETTEENTRY); - OutTraceD("GDI.RealizePalette: hdc=%x\n", hdc); + OutTraceDW("GDI.RealizePalette: hdc=%x\n", hdc); if((OBJ_DC == GetObjectType(hdc)) && (dxw.dwFlags1 & EMULATESURFACE)){ PALETTEENTRY PalEntries[256]; UINT nEntries; @@ -533,7 +533,7 @@ UINT WINAPI extRealizePalette(HDC hdc) } else ret=(*pGDIRealizePalette)(hdc); - OutTraceD("GDI.RealizePalette: hdc=%x ret=%x\n", hdc, ret); + OutTraceDW("GDI.RealizePalette: hdc=%x ret=%x\n", hdc, ret); return ret; } @@ -613,14 +613,14 @@ UINT WINAPI extGetSystemPaletteEntries(HDC hdc, UINT iStartIndex, UINT nEntries, { int ret; - OutTraceD("GetSystemPaletteEntries: hdc=%x start=%d num=%d\n", hdc, iStartIndex, nEntries); + OutTraceDW("GetSystemPaletteEntries: hdc=%x start=%d num=%d\n", hdc, iStartIndex, nEntries); ret=(*pGDIGetSystemPaletteEntries)(hdc, iStartIndex, nEntries, lppe); - OutTraceD("GetSystemPaletteEntries: ret=%d\n", ret); + OutTraceDW("GetSystemPaletteEntries: ret=%d\n", ret); if((ret == 0) && (dxw.dwFlags1 & EMULATESURFACE)) { // use static default data... for(UINT idx=0; idx 0) dxw.MapClient(&nWidth, &nHeight); else { @@ -1114,7 +1115,7 @@ HFONT WINAPI extCreateFontIndirect(const LOGFONT* lplf) { LOGFONT lf; HFONT retHFont; - OutTraceD("CreateFontIndirect: h=%d w=%d face=\"%s\"\n", lplf->lfHeight, lplf->lfWidth, lplf->lfFaceName); + OutTraceDW("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) { @@ -1127,18 +1128,18 @@ HFONT WINAPI extCreateFontIndirect(const LOGFONT* lplf) } retHFont=((*pGDICreateFontIndirect)(&lf)); if(retHFont) - OutTraceD("CreateFontIndirect: hfont=%x\n", retHFont); + OutTraceDW("CreateFontIndirect: hfont=%x\n", retHFont); else - OutTraceD("CreateFontIndirect: error=%d at %d\n", GetLastError(), __LINE__); + OutTraceDW("CreateFontIndirect: error=%d at %d\n", GetLastError(), __LINE__); return retHFont; } BOOL WINAPI extSetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) { BOOL ret; - OutTraceD("SetDeviceGammaRamp: hdc=%x\n", hDC); + OutTraceDW("SetDeviceGammaRamp: hdc=%x\n", hDC); if(dxw.dwFlags2 & DISABLEGAMMARAMP) { - OutTraceD("SetDeviceGammaRamp: SUPPRESSED\n"); + OutTraceDW("SetDeviceGammaRamp: SUPPRESSED\n"); return TRUE; } ret=(*pGDISetDeviceGammaRamp)(hDC, lpRamp); @@ -1149,7 +1150,7 @@ BOOL WINAPI extSetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) BOOL WINAPI extGetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) { BOOL ret; - OutTraceD("GetDeviceGammaRamp: hdc=%x\n", hDC); + OutTraceDW("GetDeviceGammaRamp: hdc=%x\n", hDC); ret=(*pGDIGetDeviceGammaRamp)(hDC, lpRamp); if(!ret) OutTraceE("GetDeviceGammaRamp: ERROR err=%d\n", GetLastError()); return ret; @@ -1160,23 +1161,23 @@ 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); + OutTraceDW("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", + OutTraceDW("GetClipBox: scaling main win coordinates (%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom); // current implementation is NOT accurate, since it always returns the whole // virtual desktop area as the current clipbox...!!! *lprc=dxw.GetScreenRect(); } - OutTraceD("GetClipBox: ret=%x(%s)\n", ret, sRetCodes[ret]); + OutTraceDW("GetClipBox: ret=%x(%s)\n", ret, sRetCodes[ret]); return ret; } BOOL WINAPI extPolyline(HDC hdc, const POINT *lppt, int cPoints) { BOOL ret; - if(IsTraceD){ + if(IsTraceDDRAW){ int i; OutTrace("Polyline: hdc=%x cPoints=%d pt=", hdc, cPoints); for(i=0; ibmiHeader); - OutTraceD("SetDIBitsToDevice: BitmapInfo dim=(%dx%d) Planes=%d BPP=%d Compression=%x SizeImage=%x\n", + OutTraceDW("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() && dxw.IsVirtual(hdc)){ int X, Y; X=XDest+dxw.VirtualOffsetX; Y=YDest+dxw.VirtualOffsetY; - OutTraceD("SetDIBitsToDevice: virtual pos=(%d,%d)+(%d+%d)=(%d,%d)\n", + OutTraceDW("SetDIBitsToDevice: virtual pos=(%d,%d)+(%d+%d)=(%d,%d)\n", XDest, YDest, dxw.VirtualOffsetX, dxw.VirtualOffsetY, X, Y); ret=(*pSetDIBitsToDevice)(hdc, X, Y, dwWidth, dwHeight, XSrc, YSrc, uStartScan, cScanLines, lpvBits, lpbmi, fuColorUse); if(!ret || (ret==GDI_ERROR)) OutTraceE("SetDIBitsToDevice: ERROR ret=%x err=%d\n", ret, GetLastError()); @@ -1361,7 +1362,7 @@ int WINAPI extSetDIBitsToDevice(HDC hdc, int XDest, int YDest, DWORD dwWidth, DW 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); + OutTraceDW("SetDIBitsToDevice: fixed dest=(%d,%d)-(%d,%d)\n", XDest, YDest, dwWidth, dwHeight); HDC hTempDc; HBITMAP hbmPic; if(!(hTempDc=CreateCompatibleDC(hdc))) @@ -1392,12 +1393,12 @@ int WINAPI extSetDIBitsToDevice(HDC hdc, int XDest, int YDest, DWORD dwWidth, DW //HBITMAP WINAPI extCreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight) //{ // HBITMAP ret; -// OutTraceD("CreateCompatibleBitmap: hdc=%x size=(%d,%d)\n", +// OutTraceDW("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); +// OutTraceDW("CreateCompatibleBitmap: fixed size=(%d,%d)\n", nWidth, nHeight); // } // // ret=(*pCreateCompatibleBitmap)(hdc, nWidth, nHeight); @@ -1408,11 +1409,11 @@ int WINAPI extSetDIBitsToDevice(HDC hdc, int XDest, int YDest, DWORD dwWidth, DW 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); + OutTraceDW("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); + OutTraceDW("SetPixel: fixed pos=(%d,%d)\n", X, Y); } ret=(*pSetPixel)(hdc, X, Y, crColor); @@ -1424,11 +1425,11 @@ COLORREF WINAPI extSetPixel(HDC hdc, int X, int Y, COLORREF crColor) 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); + OutTraceDW("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); + OutTraceDW("Ellipse: fixed dest=(%d,%d)-(%d,%d)\n", nLeftRect, nTopRect, nRightRect, nBottomRect); } ret=(*pEllipse)(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect); @@ -1439,7 +1440,7 @@ BOOL WINAPI extEllipse(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int BOOL WINAPI extPolygon(HDC hdc, const POINT *lpPoints, int cCount) { BOOL ret; - if(IsTraceD){ + if(IsTraceDDRAW){ int i; OutTrace("Polygon: hdc=%x cCount=%d pt=", hdc, cCount); for(i=0; ileft, lprc->top, lprc->right, lprc->bottom); + OutTraceDW("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); + OutTraceDW("CreateEllipticRgnIndirect: fixed rect=(%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom); } ret=(*pCreateEllipticRgnIndirect)(lprc); @@ -1510,11 +1511,11 @@ HRGN WINAPI extCreateEllipticRgnIndirect(const RECT *lprc) 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); + OutTraceDW("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); + OutTraceDW("CreateRectRgn: fixed rect=(%d,%d)-(%d,%d)\n", nLeftRect, nTopRect, nRightRect, nBottomRect); } ret=(*pCreateRectRgn)(nLeftRect, nTopRect, nRightRect, nBottomRect); @@ -1525,11 +1526,11 @@ HRGN WINAPI extCreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nB HRGN WINAPI extCreateRectRgnIndirect(const RECT *lprc) { HRGN ret; - OutTraceD("CreateRectRgnIndirect: rect=(%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom); + OutTraceDW("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); + OutTraceDW("CreateRectRgnIndirect: fixed rect=(%d,%d)-(%d,%d)\n", lprc->left, lprc->top, lprc->right, lprc->bottom); } ret=(*pCreateRectRgnIndirect)(lprc); @@ -1540,7 +1541,7 @@ HRGN WINAPI extCreateRectRgnIndirect(const RECT *lprc) HRGN WINAPI extCreatePolygonRgn(const POINT *lpPoints, int cPoints, int fnPolyFillMode) { HRGN ret; - if(IsTraceD){ + if(IsTraceDDRAW){ int i; OutTrace("CreatePolygonRgn: PolyFillMode=%x cCount=%d pt=", fnPolyFillMode, cPoints); for(i=0; ileft, 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); + OutTraceDW("DrawText: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } ret=(*pDrawText)(hdc, lpchText, nCount, lpRect, uFormat); @@ -1579,12 +1580,12 @@ int WINAPI extDrawText(HDC hdc, LPCTSTR lpchText, int nCount, LPRECT lpRect, UIN 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", + OutTraceDW("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); + OutTraceDW("DrawTextEx: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } ret=(*pDrawTextEx)(hdc, lpchText, nCount, lpRect, dwDTFormat, lpDTParams); @@ -1596,12 +1597,12 @@ BOOL WINAPI extMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHei 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", + OutTraceDW("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); + OutTraceDW("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); @@ -1612,10 +1613,10 @@ BOOL WINAPI extMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHei BOOL WINAPI extSetViewportOrgEx(HDC hdc, int X, int Y, LPPOINT lpPoint) { BOOL ret; - OutTraceD("SetViewportOrgEx: hdc=%x pos=(%d,%d)\n", hdc, X, Y); + OutTraceDW("SetViewportOrgEx: hdc=%x pos=(%d,%d)\n", hdc, X, Y); if(dxw.IsVirtual(hdc)) { - OutTraceD("SetViewportOrgEx: virtual hdc\n"); + OutTraceDW("SetViewportOrgEx: virtual hdc\n"); dxw.VirtualOffsetX = X; dxw.VirtualOffsetY = Y; return TRUE; @@ -1623,15 +1624,15 @@ BOOL WINAPI extSetViewportOrgEx(HDC hdc, int X, int Y, LPPOINT lpPoint) if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ dxw.MapClient(&X, &Y); - OutTraceD("SetViewportOrgEx: fixed pos=(%d,%d)\n", X, Y); + OutTraceDW("SetViewportOrgEx: fixed pos=(%d,%d)\n", X, Y); } ret=(*pSetViewportOrgEx)(hdc, X, Y, lpPoint); if(ret && lpPoint) { - OutTraceD("SetViewportOrgEx: previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); + OutTraceDW("SetViewportOrgEx: previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ dxw.UnmapClient(lpPoint); - OutTraceD("SetViewportOrgEx: fixed previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); + OutTraceDW("SetViewportOrgEx: fixed previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); } } if(!ret) OutTraceE("SetViewportOrgEx: ERROR ret=%x err=%d\n", ret, GetLastError()); @@ -1641,19 +1642,19 @@ BOOL WINAPI extSetViewportOrgEx(HDC hdc, int X, int Y, LPPOINT lpPoint) BOOL WINAPI extSetViewportExtEx(HDC hdc, int nXExtent, int nYExtent, LPSIZE lpSize) { BOOL ret; - OutTraceD("SetViewportExtEx: hdc=%x ext=(%d,%d)\n", hdc, nXExtent, nYExtent); + OutTraceDW("SetViewportExtEx: hdc=%x ext=(%d,%d)\n", hdc, nXExtent, nYExtent); if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ dxw.MapClient(&nXExtent, &nYExtent); - OutTraceD("SetViewportExtEx: fixed ext=(%d,%d)\n", nXExtent, nYExtent); + OutTraceDW("SetViewportExtEx: fixed ext=(%d,%d)\n", nXExtent, nYExtent); } ret=(*pSetViewportExtEx)(hdc, nXExtent, nYExtent, lpSize); if(ret && lpSize) { - OutTraceD("SetViewportExtEx: previous ext=(%d,%d)\n", lpSize->cx, lpSize->cy); + OutTraceDW("SetViewportExtEx: previous ext=(%d,%d)\n", lpSize->cx, lpSize->cy); if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ dxw.UnmapClient((LPPOINT)lpSize); - OutTraceD("SetViewportExtEx: fixed previous ext=(%d,%d)\n", lpSize->cx, lpSize->cy); + OutTraceDW("SetViewportExtEx: fixed previous ext=(%d,%d)\n", lpSize->cx, lpSize->cy); } } @@ -1664,7 +1665,7 @@ BOOL WINAPI extSetViewportExtEx(HDC hdc, int nXExtent, int nYExtent, LPSIZE lpSi BOOL WINAPI extGetViewportOrgEx(HDC hdc, LPPOINT lpPoint) { BOOL ret; - OutTraceD("GetViewportOrgEx: hdc=%x\n", hdc); + OutTraceDW("GetViewportOrgEx: hdc=%x\n", hdc); if(dxw.IsVirtual(hdc)) { lpPoint->x = dxw.VirtualOffsetX; @@ -1674,10 +1675,10 @@ BOOL WINAPI extGetViewportOrgEx(HDC hdc, LPPOINT lpPoint) ret=(*pGetViewportOrgEx)(hdc, lpPoint); if(ret) { - OutTraceD("GetViewportOrgEx: ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); + OutTraceDW("GetViewportOrgEx: ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ dxw.UnmapClient(lpPoint); - OutTraceD("GetViewportOrgEx: fixed ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); + OutTraceDW("GetViewportOrgEx: fixed ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); } } @@ -1688,14 +1689,14 @@ BOOL WINAPI extGetViewportOrgEx(HDC hdc, LPPOINT lpPoint) BOOL WINAPI extGetWindowOrgEx(HDC hdc, LPPOINT lpPoint) { BOOL ret; - OutTraceD("GetWindowOrgEx: hdc=%x\n", hdc); + OutTraceDW("GetWindowOrgEx: hdc=%x\n", hdc); ret=(*pGetWindowOrgEx)(hdc, lpPoint); if(ret) { - OutTraceD("GetWindowOrgEx: ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); + OutTraceDW("GetWindowOrgEx: ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ dxw.UnmapClient(lpPoint); - OutTraceD("GetWindowOrgEx: fixed ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); + OutTraceDW("GetWindowOrgEx: fixed ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); } } @@ -1706,19 +1707,19 @@ BOOL WINAPI extGetWindowOrgEx(HDC hdc, LPPOINT lpPoint) BOOL WINAPI extSetWindowOrgEx(HDC hdc, int X, int Y, LPPOINT lpPoint) { BOOL ret; - OutTraceD("SetWindowOrgEx: hdc=%x pos=(%d,%d)\n", hdc, X, Y); + OutTraceDW("SetWindowOrgEx: hdc=%x pos=(%d,%d)\n", hdc, X, Y); if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ dxw.MapClient(&X, &Y); - OutTraceD("SetWindowOrgEx: fixed pos=(%d,%d)\n", X, Y); + OutTraceDW("SetWindowOrgEx: fixed pos=(%d,%d)\n", X, Y); } ret=(*pSetWindowOrgEx)(hdc, X, Y, lpPoint); if(ret && lpPoint) { - OutTraceD("SetWindowOrgEx: previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); + OutTraceDW("SetWindowOrgEx: previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ dxw.UnmapClient(lpPoint); - OutTraceD("SetWindowOrgEx: fixed previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); + OutTraceDW("SetWindowOrgEx: fixed previous ViewPort=(%d,%d)\n", lpPoint->x, lpPoint->y); } } if(!ret) OutTraceE("SetWindowOrgEx: ERROR ret=%x err=%d\n", ret, GetLastError()); @@ -1728,14 +1729,14 @@ BOOL WINAPI extSetWindowOrgEx(HDC hdc, int X, int Y, LPPOINT lpPoint) BOOL WINAPI extGetCurrentPositionEx(HDC hdc, LPPOINT lpPoint) { BOOL ret; - OutTraceD("GetCurrentPositionEx: hdc=%x\n", hdc); + OutTraceDW("GetCurrentPositionEx: hdc=%x\n", hdc); ret=(*pGetCurrentPositionEx)(hdc, lpPoint); if(ret) { - OutTraceD("GetCurrentPositionEx: pos=(%d,%d)\n", lpPoint->x, lpPoint->y); + OutTraceDW("GetCurrentPositionEx: pos=(%d,%d)\n", lpPoint->x, lpPoint->y); if (dxw.IsFullScreen() && (OBJ_DC == GetObjectType(hdc))){ dxw.UnmapClient(lpPoint); - OutTraceD("GetCurrentPositionEx: fixed pos=(%d,%d)\n", lpPoint->x, lpPoint->y); + OutTraceDW("GetCurrentPositionEx: fixed pos=(%d,%d)\n", lpPoint->x, lpPoint->y); } } if(!ret) OutTraceE("GetCurrentPositionEx: ERROR ret=%x err=%d\n", ret, GetLastError()); @@ -1745,7 +1746,7 @@ BOOL WINAPI extGetCurrentPositionEx(HDC hdc, LPPOINT lpPoint) BOOL WINAPI extCreateScalableFontResourceA(DWORD fdwHidden, LPCTSTR lpszFontRes, LPCTSTR lpszFontFile, LPCTSTR lpszCurrentPath) { BOOL res; - OutTraceD("CreateScalableFontResource: hidden=%d FontRes=\"%s\" FontFile=\"%s\" CurrentPath=\"%s\"\n", + OutTraceDW("CreateScalableFontResource: hidden=%d FontRes=\"%s\" FontFile=\"%s\" CurrentPath=\"%s\"\n", fdwHidden, lpszFontRes, lpszFontFile, lpszCurrentPath); if(dxw.dwFlags3 & FONTBYPASS) return TRUE; res=(*pCreateScalableFontResourceA)(fdwHidden, lpszFontRes, lpszFontFile, lpszCurrentPath); @@ -1756,7 +1757,7 @@ BOOL WINAPI extCreateScalableFontResourceA(DWORD fdwHidden, LPCTSTR lpszFontRes, BOOL WINAPI extCreateScalableFontResourceW(DWORD fdwHidden, LPCWSTR lpszFontRes, LPCWSTR lpszFontFile, LPCWSTR lpszCurrentPath) { BOOL res; - OutTraceD("CreateScalableFontResource: hidden=%d FontRes=\"%ls\" FontFile=\"%ls\" CurrentPath=\"%ls\"\n", + OutTraceDW("CreateScalableFontResource: hidden=%d FontRes=\"%ls\" FontFile=\"%ls\" CurrentPath=\"%ls\"\n", fdwHidden, lpszFontRes, lpszFontFile, lpszCurrentPath); if(dxw.dwFlags3 & FONTBYPASS) return TRUE; res=(*pCreateScalableFontResourceW)(fdwHidden, lpszFontRes, lpszFontFile, lpszCurrentPath); @@ -1767,9 +1768,9 @@ BOOL WINAPI extCreateScalableFontResourceW(DWORD fdwHidden, LPCWSTR lpszFontRes, int WINAPI extAddFontResourceA(LPCTSTR lpszFontFile) { BOOL res; - OutTraceD("AddFontResource: FontFile=\"%s\"\n", lpszFontFile); + OutTraceDW("AddFontResource: FontFile=\"%s\"\n", lpszFontFile); if(dxw.dwFlags3 & FONTBYPASS) { - OutTraceD("AddFontResource: SUPPRESSED FontFile=\"%s\"\n", lpszFontFile); + OutTraceDW("AddFontResource: SUPPRESSED FontFile=\"%s\"\n", lpszFontFile); return TRUE; } res=(*pAddFontResourceA)(lpszFontFile); @@ -1780,9 +1781,9 @@ int WINAPI extAddFontResourceA(LPCTSTR lpszFontFile) int WINAPI extAddFontResourceW(LPCWSTR lpszFontFile) { BOOL res; - OutTraceD("AddFontResource: FontFile=\"%ls\"\n", lpszFontFile); + OutTraceDW("AddFontResource: FontFile=\"%ls\"\n", lpszFontFile); if(dxw.dwFlags3 & FONTBYPASS) { - OutTraceD("AddFontResource: SUPPRESSED FontFile=\"%ls\"\n", lpszFontFile); + OutTraceDW("AddFontResource: SUPPRESSED FontFile=\"%ls\"\n", lpszFontFile); return TRUE; } res=(*pAddFontResourceW)(lpszFontFile); @@ -1793,14 +1794,14 @@ int WINAPI extAddFontResourceW(LPCWSTR lpszFontFile) UINT WINAPI extSetSystemPaletteUse(HDC hdc, UINT uUsage) { //BOOL res; - OutTraceD("SetSystemPaletteUse: hdc=%x Usage=%x(%s)\n", hdc, uUsage, ExplainPaletteUse(uUsage)); + OutTraceDW("SetSystemPaletteUse: hdc=%x Usage=%x(%s)\n", hdc, uUsage, ExplainPaletteUse(uUsage)); return SYSPAL_NOSTATIC256; } #if 0 int WINAPI extSetMapMode(HDC hdc, int fnMapMode) { - OutTraceD("SetMapMode: hdc=%x MapMode=%d\n", hdc, fnMapMode); + OutTraceDW("SetMapMode: hdc=%x MapMode=%d\n", hdc, fnMapMode); return TRUE; } #endif diff --git a/dll/hd3d.cpp b/dll/hd3d.cpp index e63af05..c28be5d 100644 --- a/dll/hd3d.cpp +++ b/dll/hd3d.cpp @@ -36,6 +36,8 @@ typedef HRESULT (WINAPI *GetViewport_Type)(void *, D3DVIEWPORT9 *); typedef HRESULT (WINAPI *SetViewport_Type)(void *, D3DVIEWPORT9 *); typedef void (WINAPI *SetGammaRamp_Type)(void *, UINT, DWORD, D3DGAMMARAMP *); typedef void (WINAPI *GetGammaRamp_Type)(void *, UINT, D3DGAMMARAMP *); +typedef void (WINAPI *SetCursorPosition9_Type)(void *, int, int, DWORD); +typedef void (WINAPI *SetCursorPosition8_Type)(void *, int, int, DWORD); typedef HRESULT (WINAPI *D3D10CreateDevice_Type)(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, ID3D10Device **); typedef HRESULT (WINAPI *D3D10CreateDeviceAndSwapChain_Type)(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device **); @@ -43,7 +45,9 @@ typedef HRESULT (WINAPI *D3D10CreateDevice1_Type)(IDXGIAdapter *, D3D10_DRIVER_T typedef HRESULT (WINAPI *D3D10CreateDeviceAndSwapChain1_Type)(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device **); typedef HRESULT (WINAPI *D3D11CreateDevice_Type)(IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT, const D3D_FEATURE_LEVEL *, UINT, UINT, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **); typedef HRESULT (WINAPI *D3D11CreateDeviceAndSwapChain_Type)(IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT, const D3D_FEATURE_LEVEL *, UINT, UINT, const DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **); -typedef void (WINAPI *RSSetViewports_Type)(void *, UINT, D3D11_VIEWPORT *); +typedef void (WINAPI *RSSetViewports_Type)(void *, UINT, D3D11_VIEWPORT *); +typedef ULONG (WINAPI *AddRef_Type)(void *); +typedef ULONG (WINAPI *Release_Type)(void *); HRESULT WINAPI extQueryInterfaceD3D8(void *, REFIID, void** ); HRESULT WINAPI extQueryInterfaceDev8(void *, REFIID, void** ); @@ -74,8 +78,14 @@ HRESULT WINAPI extGetRenderState(void *, D3DRENDERSTATETYPE, DWORD); HRESULT WINAPI extCreateAdditionalSwapChain(void *, D3DPRESENT_PARAMETERS *, IDirect3DSwapChain9 **); HRESULT WINAPI extGetViewport(void *, D3DVIEWPORT9 *); HRESULT WINAPI extSetViewport(void *, D3DVIEWPORT9 *); +HRESULT WINAPI extReset(void *, D3DPRESENT_PARAMETERS *); void WINAPI extSetGammaRamp(void *, UINT, DWORD, D3DGAMMARAMP *); void WINAPI extGetGammaRamp(void *, UINT, D3DGAMMARAMP *); +void WINAPI extSetCursorPosition9(void *, int, int, DWORD); +void WINAPI extSetCursorPosition8(void *, int, int, DWORD); +ULONG WINAPI extAddRef9(void *); +ULONG WINAPI extRelease9(void *); + HRESULT WINAPI extD3D10CreateDevice(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, ID3D10Device **); HRESULT WINAPI extD3D10CreateDeviceAndSwapChain(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device **); @@ -119,6 +129,8 @@ GetViewport_Type pGetViewport = 0; SetViewport_Type pSetViewport = 0; SetGammaRamp_Type pSetGammaRamp = 0; GetGammaRamp_Type pGetGammaRamp = 0; +SetCursorPosition9_Type pSetCursorPosition9 = 0; +SetCursorPosition8_Type pSetCursorPosition8 = 0; D3D10CreateDevice_Type pD3D10CreateDevice = 0; D3D10CreateDeviceAndSwapChain_Type pD3D10CreateDeviceAndSwapChain = 0; @@ -128,13 +140,32 @@ D3D11CreateDevice_Type pD3D11CreateDevice = 0; D3D11CreateDeviceAndSwapChain_Type pD3D11CreateDeviceAndSwapChain = 0; RSSetViewports_Type pRSSetViewports = 0; +AddRef_Type pAddRef9 = 0; +Release_Type pRelease9 = 0; + DWORD dwD3DVersion; +void dxwCopyProxyLib9() +{ + #define MAX_FILE_PATH 512 + DWORD dwAttrib; + char sSourcePath[MAX_FILE_PATH+1]; + char *p; + + dwAttrib = GetFileAttributes("dxwnd.dll"); + if (dwAttrib != INVALID_FILE_ATTRIBUTES && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) return; + GetModuleFileName(GetModuleHandle("dxwnd"), sSourcePath, MAX_FILE_PATH); + p=&sSourcePath[strlen(sSourcePath)-strlen("dxwnd.dll")]; + strcpy(p, "d3d9.dll"); + OutTraceDW("HookInit: copy %s -> d3d9.dll\n", sSourcePath); + CopyFile(sSourcePath, "d3d9.dll", FALSE); +} + FARPROC Remap_d3d8_ProcAddress(LPCSTR proc, HMODULE hModule) { if (!strcmp(proc,"Direct3DCreate8") && !pDirect3DCreate8){ pDirect3DCreate8=(Direct3DCreate8_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate8); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate8); return (FARPROC)extDirect3DCreate8; } // NULL -> keep the original call address @@ -143,55 +174,56 @@ FARPROC Remap_d3d8_ProcAddress(LPCSTR proc, HMODULE hModule) HRESULT WINAPI voidDirect3DShaderValidatorCreate9(void) { - OutTraceD("Direct3DShaderValidatorCreate9: SUPPRESSED\n"); + OutTraceDW("Direct3DShaderValidatorCreate9: SUPPRESSED\n"); return 0; } void WINAPI voidDebugSetLevel(void) { - OutTraceD("DebugSetLevel: SUPPRESSED\n"); + OutTraceDW("DebugSetLevel: SUPPRESSED\n"); } void WINAPI voidDebugSetMute(void) { - OutTraceD("DebugSetMute: SUPPRESSED\n"); + OutTraceDW("DebugSetMute: SUPPRESSED\n"); } FARPROC Remap_d3d9_ProcAddress(LPCSTR proc, HMODULE hModule) { // NULL -> keep the original call address // (FARPROC)-1 -> returns NULL + if(dxw.dwFlags4 & ADDPROXYLIBS) dxwCopyProxyLib9(); if (!strcmp(proc,"Direct3DCreate9") && !pDirect3DCreate9){ pDirect3DCreate9=(Direct3DCreate9_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate9); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate9); return (FARPROC)extDirect3DCreate9; } if (!strcmp(proc,"Direct3DCreate9Ex") && !pDirect3DCreate9Ex){ pDirect3DCreate9Ex=(Direct3DCreate9Ex_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate9Ex); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate9Ex); return (FARPROC)extDirect3DCreate9Ex; } if (!strcmp(proc,"CheckFullScreen") && !pCheckFullScreen){ pCheckFullScreen=(CheckFullScreen_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pCheckFullScreen); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pCheckFullScreen); return (FARPROC)extCheckFullScreen; } if (!(dxw.dwFlags3 & SUPPRESSD3DEXT)) return NULL; if (!strcmp(proc,"Direct3DShaderValidatorCreate9")){ - OutTraceD("GetProcAddress: suppressing Direct3DShaderValidatorCreate9\n"); + OutTraceDW("GetProcAddress: suppressing Direct3DShaderValidatorCreate9\n"); return (FARPROC)voidDirect3DShaderValidatorCreate9; //return (FARPROC)-1; } if (!strcmp(proc,"DebugSetLevel")){ - OutTraceD("GetProcAddress: suppressing DebugSetLevel\n"); + OutTraceDW("GetProcAddress: suppressing DebugSetLevel\n"); return (FARPROC)voidDebugSetLevel; //return (FARPROC)-1; } if (!strcmp(proc,"DebugSetMute")){ - OutTraceD("GetProcAddress: suppressing DebugSetMute\n"); + OutTraceDW("GetProcAddress: suppressing DebugSetMute\n"); return (FARPROC)voidDebugSetMute; //return (FARPROC)-1; } @@ -202,12 +234,12 @@ FARPROC Remap_d3d10_ProcAddress(LPCSTR proc, HMODULE hModule) { if (!strcmp(proc,"D3D10CreateDevice") && !pD3D10CreateDevice){ pD3D10CreateDevice=(D3D10CreateDevice_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDevice); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDevice); return (FARPROC)extD3D10CreateDevice; } if (!strcmp(proc,"D3D10CreateDeviceAndSwapChain") && !pD3D10CreateDeviceAndSwapChain){ pD3D10CreateDeviceAndSwapChain=(D3D10CreateDeviceAndSwapChain_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDeviceAndSwapChain); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDeviceAndSwapChain); return (FARPROC)extD3D10CreateDeviceAndSwapChain; } // NULL -> keep the original call address @@ -218,12 +250,12 @@ FARPROC Remap_d3d10_1_ProcAddress(LPCSTR proc, HMODULE hModule) { if (!strcmp(proc,"D3D10CreateDevice1") && !pD3D10CreateDevice1){ pD3D10CreateDevice1=(D3D10CreateDevice1_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDevice1); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDevice1); return (FARPROC)extD3D10CreateDevice1; } if (!strcmp(proc,"D3D10CreateDeviceAndSwapChain1") && !pD3D10CreateDeviceAndSwapChain1){ pD3D10CreateDeviceAndSwapChain1=(D3D10CreateDeviceAndSwapChain1_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDeviceAndSwapChain1); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D10CreateDeviceAndSwapChain1); return (FARPROC)extD3D10CreateDeviceAndSwapChain1; } // NULL -> keep the original call address @@ -234,12 +266,12 @@ FARPROC Remap_d3d11_ProcAddress(LPCSTR proc, HMODULE hModule) { if (!strcmp(proc,"D3D11CreateDevice") && !pD3D11CreateDevice){ pD3D11CreateDevice=(D3D11CreateDevice_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D11CreateDevice); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D11CreateDevice); return (FARPROC)extD3D11CreateDevice; } if (!strcmp(proc,"D3D11CreateDeviceAndSwapChain") && !pD3D11CreateDeviceAndSwapChain){ pD3D11CreateDeviceAndSwapChain=(D3D11CreateDeviceAndSwapChain_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D11CreateDeviceAndSwapChain); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pD3D11CreateDeviceAndSwapChain); return (FARPROC)extD3D11CreateDeviceAndSwapChain; } // NULL -> keep the original call address @@ -257,6 +289,8 @@ int HookDirect3D(HMODULE module, int version){ switch(version){ case 0: // D3D8 + if(dxw.dwFlags4 & ADDPROXYLIBS) dxwCopyProxyLib9(); + tmp = HookAPI(module, "d3d8.dll", NULL, "Direct3DCreate8", extDirect3DCreate8); if(tmp) pDirect3DCreate8 = (Direct3DCreate8_Type)tmp; // D3D9 @@ -294,13 +328,14 @@ int HookDirect3D(HMODULE module, int version){ } break; case 9: - hinst = LoadLibrary("d3d9.dll"); + if(dxw.dwFlags4 & ADDPROXYLIBS) dxwCopyProxyLib9(); + hinst = (*pLoadLibraryA)("d3d9.dll"); pDirect3DCreate9 = - (Direct3DCreate9_Type)GetProcAddress(hinst, "Direct3DCreate9"); + (Direct3DCreate9_Type)(*pGetProcAddress)(hinst, "Direct3DCreate9"); pDirect3DCreate9Ex = - (Direct3DCreate9Ex_Type)GetProcAddress(hinst, "Direct3DCreate9Ex"); + (Direct3DCreate9Ex_Type)(*pGetProcAddress)(hinst, "Direct3DCreate9Ex"); pCheckFullScreen = - (CheckFullScreen_Type)GetProcAddress(hinst, "CheckFullScreen"); + (CheckFullScreen_Type)(*pGetProcAddress)(hinst, "CheckFullScreen"); if(pDirect3DCreate9){ lpd3d = (LPDIRECT3D9)extDirect3DCreate9(31); if(lpd3d) lpd3d->Release(); @@ -308,9 +343,9 @@ int HookDirect3D(HMODULE module, int version){ break; #ifdef HOOKD3D10ANDLATER case 10: - hinst = LoadLibrary("d3d10.dll"); + hinst = (*pLoadLibraryA)("d3d10.dll"); pD3D10CreateDevice = - (D3D10CreateDevice_Type)GetProcAddress(hinst, "D3D10CreateDevice"); + (D3D10CreateDevice_Type)(*pGetProcAddress)(hinst, "D3D10CreateDevice"); if(pD3D10CreateDevice){ res = extD3D10CreateDevice( NULL, @@ -321,9 +356,9 @@ int HookDirect3D(HMODULE module, int version){ &lpd3d10); if(res==DD_OK) lpd3d10->Release(); } - hinst = LoadLibrary("d3d10_1.dll"); + hinst = (*pLoadLibraryA)("d3d10_1.dll"); pD3D10CreateDevice1 = - (D3D10CreateDevice1_Type)GetProcAddress(hinst, "D3D10CreateDevice1"); + (D3D10CreateDevice1_Type)(*pGetProcAddress)(hinst, "D3D10CreateDevice1"); break; if(pD3D10CreateDevice1){ res = extD3D10CreateDevice1( @@ -337,7 +372,7 @@ int HookDirect3D(HMODULE module, int version){ if(res==DD_OK) lpd3d10->Release(); } pD3D10CreateDeviceAndSwapChain = - (D3D10CreateDeviceAndSwapChain_Type)GetProcAddress(hinst, "D3D10CreateDeviceAndSwapChain"); + (D3D10CreateDeviceAndSwapChain_Type)(*pGetProcAddress)(hinst, "D3D10CreateDeviceAndSwapChain"); if(pD3D10CreateDeviceAndSwapChain){ DXGI_SWAP_CHAIN_DESC swapChainDesc; IDXGISwapChain *pSwapChain; @@ -374,9 +409,9 @@ int HookDirect3D(HMODULE module, int version){ } break; case 11: - hinst = LoadLibrary("d3d11.dll"); + hinst = (*pLoadLibraryA)("d3d11.dll"); pD3D11CreateDevice = - (D3D11CreateDevice_Type)GetProcAddress(hinst, "D3D11CreateDevice"); + (D3D11CreateDevice_Type)(*pGetProcAddress)(hinst, "D3D11CreateDevice"); if(pD3D11CreateDevice){ D3D_FEATURE_LEVEL FeatureLevel; ID3D11DeviceContext *pImmediateContext; @@ -394,7 +429,7 @@ int HookDirect3D(HMODULE module, int version){ if(res==DD_OK) lpd3d11->Release(); } pD3D11CreateDeviceAndSwapChain = - (D3D11CreateDeviceAndSwapChain_Type)GetProcAddress(hinst, "D3D11CreateDeviceAndSwapChain"); + (D3D11CreateDeviceAndSwapChain_Type)(*pGetProcAddress)(hinst, "D3D11CreateDeviceAndSwapChain"); break; #endif } @@ -402,41 +437,100 @@ int HookDirect3D(HMODULE module, int version){ return 0; } +void HookD3DDevice8(void** ppD3Ddev8) +{ + void *pReset; + OutTraceDW("Device hook for IID_IDirect3DDevice8 interface\n"); + pReset=NULL; // to avoid assert condition + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 0), extQueryInterfaceDev8, (void **)&pQueryInterfaceDev8, "QueryInterface(D8)"); + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 24), extGetDirect3D, (void **)&pGetDirect3D, "GetDirect3D(D8)"); + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 32), extGetDisplayMode8, (void **)&pGetDisplayMode8, "GetDisplayMode(D8)"); + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 44), extSetCursorPosition8, (void **)&pSetCursorPosition8, "SetCursorPosition(D8)"); + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D8)"); + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 56), extReset, (void **)&pReset, "Reset(D8)"); + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 60), extPresent, (void **)&pPresent, "Present(D8)"); + if(dxw.dwFlags2 & DISABLEGAMMARAMP){ + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 72), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D8)"); + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 76), extGetGammaRamp, (void **)&pGetGammaRamp, "GetGammaRamp(D8)"); + } + if(dxw.dwFlags2 & WIREFRAME){ + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 200), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D8)"); + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 204), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D8)"); + (*pSetRenderState)((void *)*ppD3Ddev8, D3DRS_FILLMODE, D3DFILL_WIREFRAME); + } +} + +void HookD3DDevice9(void** ppD3Ddev9) +{ + void *pReset; + OutTraceDW("Device hook for IID_IDirect3DDevice9 interface\n"); + pReset=NULL; // to avoid assert condition + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 0), extQueryInterfaceDev9, (void **)&pQueryInterfaceDev9, "QueryInterface(D9)"); + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 24), extGetDirect3D, (void **)&pGetDirect3D, "GetDirect3D(D9)"); + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 32), extGetDisplayMode9, (void **)&pGetDisplayMode9, "GetDisplayMode(D9)"); + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 44), extSetCursorPosition9, (void **)&pSetCursorPosition9, "SetCursorPosition(D9)"); + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)"); + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 64), extReset, (void **)&pReset, "Reset(D9)"); + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 68), extPresent, (void **)&pPresent, "Present(D9)"); + if(dxw.dwFlags2 & DISABLEGAMMARAMP){ + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 84), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D9)"); + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 88), extGetGammaRamp, (void **)&pGetGammaRamp, "GetGammaRamp(D9)"); + } + //SetHook((void *)(**(DWORD **)ppD3Ddev9 +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)"); + //SetHook((void *)(**(DWORD **)ppD3Ddev9 +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)"); + if(dxw.dwFlags2 & WIREFRAME){ + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 228), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D9)"); + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 232), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D9)"); + (*pSetRenderState)((void *)*ppD3Ddev9, D3DRS_FILLMODE, D3DFILL_WIREFRAME); + } + + if (!(dxw.dwTFlags & OUTPROXYTRACE)) return; + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 4), extAddRef9, (void **)&pAddRef9, "AddRef(D9)"); + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 8), extRelease9, (void **)&pRelease9, "Release(D9)"); +} + + void* WINAPI extDirect3DCreate8(UINT sdkversion) { void *lpd3d; - dwD3DVersion = 8; + OutTraceD3D("Direct3DCreate8: sdkversion=%x\n", sdkversion); lpd3d = (*pDirect3DCreate8)(sdkversion); - if(!lpd3d) return 0; + if(!lpd3d) { + OutTraceD3D("Direct3DCreate8: ERROR err=%d\n", GetLastError()); + return 0; + } + dwD3DVersion = 8; SetHook((void *)(*(DWORD *)lpd3d + 0), extQueryInterfaceD3D8, (void **)&pQueryInterfaceD3D8, "QueryInterface(D8)"); SetHook((void *)(*(DWORD *)lpd3d + 16), extGetAdapterCount8, (void **)&pGetAdapterCount8, "GetAdapterCount(D8)"); SetHook((void *)(*(DWORD *)lpd3d + 20), extGetAdapterIdentifier8, (void **)&pGetAdapterIdentifier8, "GetAdapterIdentifier(D8)"); SetHook((void *)(*(DWORD *)lpd3d + 28), extEnumAdapterModes8, (void **)&pEnumAdapterModes8, "EnumAdapterModes(D8)"); SetHook((void *)(*(DWORD *)lpd3d + 32), extGetAdapterDisplayMode8, (void **)&pGetAdapterDisplayMode8, "GetAdapterDisplayMode(D8)"); SetHook((void *)(*(DWORD *)lpd3d + 60), extCreateDevice, (void **)&pCreateDevice8, "CreateDevice(D8)"); + OutTraceD3D("Direct3DCreate8: d3d=%x\n", lpd3d); - OutTraceD("Direct3DCreate8: SDKVERSION=%x pCreateDevice=%x\n", - sdkversion, pCreateDevice8); return lpd3d; } void* WINAPI extDirect3DCreate9(UINT sdkversion) { - void *lpd3d; + void *lpd3d; + + OutTraceD3D("Direct3DCreate9: sdkversion=%x\n", sdkversion); + lpd3d = (*pDirect3DCreate9)(sdkversion); + if(!lpd3d) { + OutTraceD3D("Direct3DCreate9: ERROR err=%d\n", GetLastError()); + return 0; + } dwD3DVersion = 9; - lpd3d = (*pDirect3DCreate9)(sdkversion); - if(!lpd3d) return 0; SetHook((void *)(*(DWORD *)lpd3d + 0), extQueryInterfaceD3D9, (void **)&pQueryInterfaceD3D9, "QueryInterface(D9)"); SetHook((void *)(*(DWORD *)lpd3d + 16), extGetAdapterCount9, (void **)&pGetAdapterCount9, "GetAdapterCount(D9)"); SetHook((void *)(*(DWORD *)lpd3d + 20), extGetAdapterIdentifier9, (void **)&pGetAdapterIdentifier9, "GetAdapterIdentifier(D9)"); SetHook((void *)(*(DWORD *)lpd3d + 28), extEnumAdapterModes9, (void **)&pEnumAdapterModes9, "EnumAdapterModes(D9)"); SetHook((void *)(*(DWORD *)lpd3d + 32), extGetAdapterDisplayMode9, (void **)&pGetAdapterDisplayMode9, "GetAdapterDisplayMode(D9)"); SetHook((void *)(*(DWORD *)lpd3d + 64), extCreateDevice, (void **)&pCreateDevice9, "CreateDevice(D9)"); - - OutTraceD("Direct3DCreate9: SDKVERSION=%x pCreateDevice=%x\n", - sdkversion, pCreateDevice9); + OutTraceD3D("Direct3DCreate9: d3d=%x\n", lpd3d); return lpd3d; } @@ -446,12 +540,13 @@ HRESULT WINAPI extDirect3DCreate9Ex(UINT sdkversion, IDirect3D9Ex **ppD3D) void *lpd3d; HRESULT res; - dwD3DVersion = 9; + OutTraceD3D("Direct3DCreate9Ex: sdkversion=%x\n", sdkversion); res = (*pDirect3DCreate9Ex)(sdkversion, ppD3D); if(res) { - OutTraceD("Direct3DCreate9Ex: ERROR res=%x SDKVERSION=%x\n", res, sdkversion); + OutTraceD3D("Direct3DCreate9Ex: ERROR res=%x(%s)\n", res, ExplainDDError(res)); return res; } + dwD3DVersion = 9; lpd3d = *ppD3D; SetHook((void *)(*(DWORD *)lpd3d + 0), extQueryInterfaceD3D9, (void **)&pQueryInterfaceD3D9, "QueryInterface(D9)"); SetHook((void *)(*(DWORD *)lpd3d + 16), extGetAdapterCount9, (void **)&pGetAdapterCount9, "GetAdapterCount(D9)"); @@ -460,10 +555,7 @@ HRESULT WINAPI extDirect3DCreate9Ex(UINT sdkversion, IDirect3D9Ex **ppD3D) SetHook((void *)(*(DWORD *)lpd3d + 32), extGetAdapterDisplayMode9, (void **)&pGetAdapterDisplayMode9, "GetAdapterDisplayMode(D9)"); SetHook((void *)(*(DWORD *)lpd3d + 64), extCreateDevice, (void **)&pCreateDevice9, "CreateDevice(D9)"); SetHook((void *)(*(DWORD *)lpd3d + 80), extCreateDeviceEx, (void **)&pCreateDeviceEx, "CreateDeviceEx(D9)"); - - OutTraceD("Direct3DCreate9Ex: SDKVERSION=%x pCreateDeviceEx=%x\n", - sdkversion, pDirect3DCreate9Ex); - + OutTraceD3D("Direct3DCreate9Ex: d3d=%x\n", lpd3d); return res; } @@ -471,9 +563,9 @@ UINT WINAPI extGetAdapterCount8(void *lpd3d) { UINT res; res=(*pGetAdapterCount8)(lpd3d); - OutTraceD("GetAdapterCount(8): count=%d\n", res); + OutTraceDW("GetAdapterCount(8): count=%d\n", res); if(dxw.dwFlags2 & HIDEMULTIMONITOR) { - OutTraceD("GetAdapterCount: HIDEMULTIMONITOR count=1\n"); + OutTraceDW("GetAdapterCount: HIDEMULTIMONITOR count=1\n"); res=1; } return res; @@ -483,9 +575,9 @@ UINT WINAPI extGetAdapterCount9(void *lpd3d) { UINT res; res=(*pGetAdapterCount9)(lpd3d); - OutTraceD("GetAdapterCount(9): count=%d\n", res); + OutTraceDW("GetAdapterCount(9): count=%d\n", res); if(dxw.dwFlags2 & HIDEMULTIMONITOR) { - OutTraceD("GetAdapterCount: HIDEMULTIMONITOR count=1\n"); + OutTraceDW("GetAdapterCount: HIDEMULTIMONITOR count=1\n"); res=1; } return res; @@ -494,24 +586,24 @@ UINT WINAPI extGetAdapterCount9(void *lpd3d) HRESULT WINAPI extGetAdapterIdentifier8(void *pd3dd, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier) { HRESULT res; - OutTraceD("GetAdapterIdentifier(8): Adapter=%d flags=%x\n", Adapter, Flags); + OutTraceD3D("GetAdapterIdentifier(8): Adapter=%d flags=%x\n", Adapter, Flags); res=pGetAdapterIdentifier8(pd3dd, Adapter, Flags, pIdentifier); - OutTraceD("GetAdapterIdentifier(8): ret=%x\n", res); + OutTraceD3D("GetAdapterIdentifier(8): ret=%x\n", res); return res; } HRESULT WINAPI extGetAdapterIdentifier9(void *pd3dd, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier) { HRESULT res; - OutTraceD("GetAdapterIdentifier(9): Adapter=%d flags=%x\n", Adapter, Flags); + OutTraceD3D("GetAdapterIdentifier(9): Adapter=%d flags=%x\n", Adapter, Flags); res=pGetAdapterIdentifier9(pd3dd, Adapter, Flags, pIdentifier); - OutTraceD("GetAdapterIdentifier(9): ret=%x\n", res); + OutTraceD3D("GetAdapterIdentifier(9): ret=%x\n", res); return res; } HRESULT WINAPI extReset(void *pd3dd, D3DPRESENT_PARAMETERS* pPresentationParameters) { - OutTraceD("Reset: SUPPRESSED\n"); + OutTraceDW("Reset: SUPPRESSED\n"); return D3D_OK; } @@ -531,12 +623,12 @@ HRESULT WINAPI extGetDisplayMode8(void *lpd3d, D3DDISPLAYMODE *pMode) { HRESULT res; res=(*pGetDisplayMode8)(lpd3d, pMode); - OutTraceD("DEBUG: GetDisplayMode(8): size=(%dx%d) RefreshRate=%d Format=%d\n", + OutTraceD3D("DEBUG: GetDisplayMode(8): size=(%dx%d) RefreshRate=%d Format=%d\n", pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format); if(dxw.dwFlags2 & KEEPASPECTRATIO){ pMode->Width=dxw.iSizX; pMode->Height=dxw.iSizY; - OutTraceD("DEBUG: GetDisplayMode(8): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); + OutTraceD3D("DEBUG: GetDisplayMode(8): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); } return res; } @@ -545,12 +637,12 @@ HRESULT WINAPI extGetDisplayMode9(void *lpd3d, UINT iSwapChain, D3DDISPLAYMODE * { HRESULT res; res=(*pGetDisplayMode9)(lpd3d, iSwapChain, pMode); - OutTraceD("DEBUG: GetDisplayMode(9): SwapChain=%d size=(%dx%d) RefreshRate=%d Format=%d\n", + OutTraceD3D("DEBUG: GetDisplayMode(9): SwapChain=%d size=(%dx%d) RefreshRate=%d Format=%d\n", iSwapChain, pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format); if(dxw.dwFlags2 & KEEPASPECTRATIO){ pMode->Width=dxw.iSizX; pMode->Height=dxw.iSizY; - OutTraceD("DEBUG: GetDisplayMode(9): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); + OutTraceD3D("DEBUG: GetDisplayMode(9): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); } return res; } @@ -558,7 +650,7 @@ HRESULT WINAPI extGetDisplayMode9(void *lpd3d, UINT iSwapChain, D3DDISPLAYMODE * HRESULT WINAPI extEnumAdapterModes8(void *lpd3d, UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode) { HRESULT res; - OutTraceD("EnumAdapterModes(8): adapter=%d mode=%d pMode=%x\n", Adapter, Mode, pMode); + OutTraceD3D("EnumAdapterModes(8): adapter=%d mode=%d pMode=%x\n", Adapter, Mode, pMode); res=(*pEnumAdapterModes8)(lpd3d, Adapter, Mode, pMode); if(res) OutTraceE("EnumAdapterModes ERROR: err=%x(%s)\n", res, ExplainDDError(res)); return res; @@ -567,7 +659,7 @@ HRESULT WINAPI extEnumAdapterModes8(void *lpd3d, UINT Adapter, UINT Mode, D3DDIS HRESULT WINAPI extEnumAdapterModes9(void *lpd3d, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) { HRESULT res; - OutTraceD("EnumAdapterModes(9): adapter=%d format=%x mode=%d pMode=%x\n", Adapter, Format, Mode, pMode); + OutTraceD3D("EnumAdapterModes(9): adapter=%d format=%x mode=%d pMode=%x\n", Adapter, Format, Mode, pMode); res=(*pEnumAdapterModes9)(lpd3d, Adapter, Format, Mode, pMode); if(res) OutTraceE("EnumAdapterModes ERROR: err=%x(%s)\n", res, ExplainDDError(res)); return res; @@ -577,12 +669,12 @@ HRESULT WINAPI extGetAdapterDisplayMode8(void *lpd3d, UINT Adapter, D3DDISPLAYMO { HRESULT res; res=(*pGetAdapterDisplayMode8)(lpd3d, Adapter, pMode); - OutTraceD("DEBUG: GetAdapterDisplayMode(8): size=(%dx%d) RefreshRate=%d Format=%d\n", + OutTraceD3D("DEBUG: GetAdapterDisplayMode(8): size=(%dx%d) RefreshRate=%d Format=%d\n", pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format); if(dxw.dwFlags2 & KEEPASPECTRATIO){ pMode->Width=dxw.iSizX; pMode->Height=dxw.iSizY; - OutTraceD("DEBUG: GetAdapterDisplayMode(8): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); + OutTraceDW("DEBUG: GetAdapterDisplayMode(8): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); } return res; } @@ -591,12 +683,12 @@ HRESULT WINAPI extGetAdapterDisplayMode9(void *lpd3d, UINT Adapter, D3DDISPLAYMO { HRESULT res; res=(*pGetAdapterDisplayMode9)(lpd3d, Adapter, pMode); - OutTraceD("DEBUG: GetAdapterDisplayMode(9): size=(%dx%d) RefreshRate=%d Format=%d\n", + OutTraceD3D("DEBUG: GetAdapterDisplayMode(9): size=(%dx%d) RefreshRate=%d Format=%d\n", pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format); if(dxw.dwFlags2 & KEEPASPECTRATIO){ pMode->Width=dxw.iSizX; pMode->Height=dxw.iSizY; - OutTraceD("DEBUG: GetAdapterDisplayMode(9): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); + OutTraceDW("DEBUG: GetAdapterDisplayMode(9): fixed size=(%dx%d)\n", pMode->Width, pMode->Height); } return res; } @@ -631,7 +723,7 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, D3DDISPLAYMODE mode; int Windowed; - OutTraceD("CreateDevice: D3DVersion=%d lpd3d=%x adapter=%x hFocusWnd=%x behavior=%x, size=(%d,%d)\n", + OutTraceD3D("CreateDevice: D3DVersion=%d lpd3d=%x adapter=%x hFocusWnd=%x behavior=%x, size=(%d,%d)\n", dwD3DVersion, lpd3d, adapter, hfocuswindow, behaviorflags, ppresentparam->BackBufferWidth, ppresentparam->BackBufferHeight); memcpy(param, ppresentparam, (dwD3DVersion == 9)?56:52); @@ -652,33 +744,35 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, workarea.left, workarea.top, workarea.right-workarea.left, workarea.bottom-workarea.top, dxw.GethWnd(), NULL, NULL, NULL); if (hfocuswindow) - OutTraceD("CreateDevice: updated hfocuswindow=%x pos=(%d,%d) size=(%d,%d)\n", + OutTraceDW("CreateDevice: updated hfocuswindow=%x pos=(%d,%d) size=(%d,%d)\n", hfocuswindow, workarea.left, workarea.top, workarea.right-workarea.left, workarea.bottom-workarea.top); else - OutTraceD("CreateDevice: CreateWindowEx ERROR err=%d\n", GetLastError()); + OutTraceDW("CreateDevice: CreateWindowEx ERROR err=%d\n", GetLastError()); dxw.SethWnd(hfocuswindow, dxw.GethWnd()); } - tmp = param; - OutTraceD("D3D%d::CreateDevice\n", dwD3DVersion); - OutTraceD(" Adapter = %i\n", adapter); - OutTraceD(" DeviceType = %i\n", devicetype); - OutTraceD(" hFocusWindow = 0x%x\n", hfocuswindow); - OutTraceD(" BehaviorFlags = 0x%x\n", behaviorflags); - OutTraceD(" BackBufferWidth = %i\n", *(tmp ++)); - OutTraceD(" BackBufferHeight = %i\n", *(tmp ++)); - OutTraceD(" BackBufferFormat = %i\n", *(tmp ++)); - OutTraceD(" BackBufferCount = %i\n", *(tmp ++)); - OutTraceD(" MultiSampleType = %i\n", *(tmp ++)); - if(dwD3DVersion == 9) OutTraceD(" MultiSampleQuality = %i\n", *(tmp ++)); - OutTraceD(" SwapEffect = 0x%x\n", *(tmp ++)); - OutTraceD(" hDeviceWindow = 0x%x\n", *(tmp ++)); - OutTraceD(" Windowed = %i\n", (Windowed=*(tmp ++))); - OutTraceD(" EnableAutoDepthStencil = %i\n", *(tmp ++)); - OutTraceD(" AutoDepthStencilFormat = %i\n", *(tmp ++)); - OutTraceD(" Flags = 0x%x\n", *(tmp ++)); - OutTraceD(" FullScreen_RefreshRateInHz = %i\n", *(tmp ++)); - OutTraceD(" PresentationInterval = 0x%x\n", *(tmp ++)); + if(IsTraceDW){ + tmp = param; + OutTrace("D3D%d::CreateDevice\n", dwD3DVersion); + OutTrace(" Adapter = %i\n", adapter); + OutTrace(" DeviceType = %i\n", devicetype); + OutTrace(" hFocusWindow = 0x%x\n", hfocuswindow); + OutTrace(" BehaviorFlags = 0x%x\n", behaviorflags); + OutTrace(" BackBufferWidth = %i\n", *(tmp ++)); + OutTrace(" BackBufferHeight = %i\n", *(tmp ++)); + OutTrace(" BackBufferFormat = %i\n", *(tmp ++)); + OutTrace(" BackBufferCount = %i\n", *(tmp ++)); + OutTrace(" MultiSampleType = %i\n", *(tmp ++)); + if(dwD3DVersion == 9) OutTrace(" MultiSampleQuality = %i\n", *(tmp ++)); + OutTrace(" SwapEffect = 0x%x\n", *(tmp ++)); + OutTrace(" hDeviceWindow = 0x%x\n", *(tmp ++)); + OutTrace(" Windowed = %i\n", (Windowed=*(tmp ++))); + OutTrace(" EnableAutoDepthStencil = %i\n", *(tmp ++)); + OutTrace(" AutoDepthStencilFormat = %i\n", *(tmp ++)); + OutTrace(" Flags = 0x%x\n", *(tmp ++)); + OutTrace(" FullScreen_RefreshRateInHz = %i\n", *(tmp ++)); + OutTrace(" PresentationInterval = 0x%x\n", *(tmp ++)); + } //((LPDIRECT3D9)lpd3d)->GetAdapterDisplayMode(0, &mode); if(dwD3DVersion == 9) @@ -686,7 +780,7 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, else (*pGetAdapterDisplayMode8)(lpd3d, 0, &mode); param[2] = mode.Format; - OutTraceD(" Current Format = 0x%x\n", mode.Format); + OutTraceDW(" Current Format = 0x%x\n", mode.Format); //param[0]=param[1]=0; @@ -710,56 +804,16 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, } if(res){ - OutTraceD("FAILED! %x\n", res); + OutTraceDW("FAILED! %x\n", res); return res; } - OutTraceD("SUCCESS! device=%x\n", *ppd3dd); + OutTraceDW("SUCCESS! device=%x\n", *ppd3dd); if(dwD3DVersion == 8){ - void *pReset; - pReset=NULL; // to avoid assert condition - SetHook((void *)(**(DWORD **)ppd3dd + 0), extQueryInterfaceDev8, (void **)&pQueryInterfaceDev8, "QueryInterface(D8)"); - SetHook((void *)(**(DWORD **)ppd3dd + 24), extGetDirect3D, (void **)&pGetDirect3D, "GetDirect3D(D8)"); - SetHook((void *)(**(DWORD **)ppd3dd + 32), extGetDisplayMode8, (void **)&pGetDisplayMode8, "GetDisplayMode(D8)"); - SetHook((void *)(**(DWORD **)ppd3dd + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D8)"); - SetHook((void *)(**(DWORD **)ppd3dd + 56), extReset, (void **)&pReset, "Reset(D8)"); - SetHook((void *)(**(DWORD **)ppd3dd + 60), extPresent, (void **)&pPresent, "Present(D8)"); - if(dxw.dwFlags2 & DISABLEGAMMARAMP){ - SetHook((void *)(**(DWORD **)ppd3dd + 72), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D8)"); - SetHook((void *)(**(DWORD **)ppd3dd + 76), extGetGammaRamp, (void **)&pGetGammaRamp, "GetGammaRamp(D8)"); - } - if(dxw.dwFlags2 & WIREFRAME){ - SetHook((void *)(**(DWORD **)ppd3dd + 200), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D8)"); - SetHook((void *)(**(DWORD **)ppd3dd + 204), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D8)"); - (*pSetRenderState)((void *)*ppd3dd, D3DRS_FILLMODE, D3DFILL_WIREFRAME); - } + HookD3DDevice8(ppd3dd); } else { - void *pReset; - pReset=NULL; // to avoid assert condition - SetHook((void *)(**(DWORD **)ppd3dd + 0), extQueryInterfaceDev9, (void **)&pQueryInterfaceDev9, "QueryInterface(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 24), extGetDirect3D, (void **)&pGetDirect3D, "GetDirect3D(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 32), extGetDisplayMode9, (void **)&pGetDisplayMode9, "GetDisplayMode(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 64), extReset, (void **)&pReset, "Reset(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 68), extPresent, (void **)&pPresent, "Present(D9)"); - if(dxw.dwFlags2 & DISABLEGAMMARAMP){ - SetHook((void *)(**(DWORD **)ppd3dd + 84), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 88), extGetGammaRamp, (void **)&pGetGammaRamp, "GetGammaRamp(D9)"); - } - //SetHook((void *)(**(DWORD **)ppd3dd +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)"); - //SetHook((void *)(**(DWORD **)ppd3dd +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)"); - if(dxw.dwFlags2 & WIREFRAME){ - SetHook((void *)(**(DWORD **)ppd3dd + 228), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 232), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D9)"); - (*pSetRenderState)((void *)*ppd3dd, D3DRS_FILLMODE, D3DFILL_WIREFRAME); - } - // experiments .... - //SetHook((void *)(**(DWORD **)ppd3dd +280), extValidateDevice, (void **)&pValidateDevice, "ValidateDevice(D9)"); - //SetHook((void *)(**(DWORD **)ppd3dd + 28), extGetDeviceCapsD3D, (void **)&pGetDeviceCapsD3D, "GetDeviceCaps(D9)"); - //void *pNull=0; - //SetHook((void *)(**(DWORD **)ppd3dd + 344), extProbe, &pNull, "Probe-CreateVertexDeclaration(D9)"); - //SetHook((void *)(**(DWORD **)ppd3dd + 28), extProbe, &pNull, "Probe-GetDeviceCaps(D9)"); + HookD3DDevice9(ppd3dd); } GetHookInfo()->IsFullScreen = dxw.IsFullScreen(); @@ -785,30 +839,32 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight()); tmp = param; - OutTraceD("D3D%d::CreateDeviceEx\n", dwD3DVersion); - OutTraceD(" Adapter = %i\n", adapter); - OutTraceD(" DeviceType = %i\n", devicetype); - OutTraceD(" hFocusWindow = 0x%x\n", hfocuswindow); - OutTraceD(" BehaviorFlags = 0x%x\n", behaviorflags); - OutTraceD(" BackBufferWidth = %i\n", *(tmp ++)); - OutTraceD(" BackBufferHeight = %i\n", *(tmp ++)); - OutTraceD(" BackBufferFormat = %i\n", *(tmp ++)); - OutTraceD(" BackBufferCount = %i\n", *(tmp ++)); - OutTraceD(" MultiSampleType = %i\n", *(tmp ++)); - OutTraceD(" MultiSampleQuality = %i\n", *(tmp ++)); - OutTraceD(" SwapEffect = 0x%x\n", *(tmp ++)); - OutTraceD(" hDeviceWindow = 0x%x\n", *(tmp ++)); - OutTraceD(" Windowed = %i\n", (Windowed=*(tmp ++))); - OutTraceD(" EnableAutoDepthStencil = %i\n", *(tmp ++)); - OutTraceD(" AutoDepthStencilFormat = %i\n", *(tmp ++)); - OutTraceD(" Flags = 0x%x\n", *(tmp ++)); - OutTraceD(" FullScreen_RefreshRateInHz = %i\n", *(tmp ++)); - OutTraceD(" PresentationInterval = 0x%x\n", *(tmp ++)); + if(IsTraceDW){ + OutTrace("D3D%d::CreateDeviceEx\n", dwD3DVersion); + OutTrace(" Adapter = %i\n", adapter); + OutTrace(" DeviceType = %i\n", devicetype); + OutTrace(" hFocusWindow = 0x%x\n", hfocuswindow); + OutTrace(" BehaviorFlags = 0x%x\n", behaviorflags); + OutTrace(" BackBufferWidth = %i\n", *(tmp ++)); + OutTrace(" BackBufferHeight = %i\n", *(tmp ++)); + OutTrace(" BackBufferFormat = %i\n", *(tmp ++)); + OutTrace(" BackBufferCount = %i\n", *(tmp ++)); + OutTrace(" MultiSampleType = %i\n", *(tmp ++)); + OutTrace(" MultiSampleQuality = %i\n", *(tmp ++)); + OutTrace(" SwapEffect = 0x%x\n", *(tmp ++)); + OutTrace(" hDeviceWindow = 0x%x\n", *(tmp ++)); + OutTrace(" Windowed = %i\n", (Windowed=*(tmp ++))); + OutTrace(" EnableAutoDepthStencil = %i\n", *(tmp ++)); + OutTrace(" AutoDepthStencilFormat = %i\n", *(tmp ++)); + OutTrace(" Flags = 0x%x\n", *(tmp ++)); + OutTrace(" FullScreen_RefreshRateInHz = %i\n", *(tmp ++)); + OutTrace(" PresentationInterval = 0x%x\n", *(tmp ++)); + } //((LPDIRECT3D9)lpd3d)->GetAdapterDisplayMode(0, &mode); (*pGetAdapterDisplayMode9)(lpd3d, 0, &mode); param[2] = mode.Format; - OutTraceD(" Current Format = 0x%x\n", mode.Format); + OutTraceDW(" Current Format = 0x%x\n", mode.Format); //param[7] = 0; //hDeviceWindow param[7] = (DWORD)dxw.GethWnd(); //hDeviceWindow @@ -819,29 +875,12 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp res = (*pCreateDeviceEx)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, pFullscreenDisplayMode, ppd3dd); if(res){ - OutTraceD("FAILED! %x\n", res); + OutTraceDW("FAILED! %x\n", res); return res; } - OutTraceD("SUCCESS!\n"); + OutTraceDW("SUCCESS!\n"); - void *pReset; - pReset=NULL; // to avoid assert condition - SetHook((void *)(**(DWORD **)ppd3dd + 0), extQueryInterfaceDev9, (void **)&pQueryInterfaceDev9, "QueryInterface(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 32), extGetDisplayMode9, (void **)&pGetDisplayMode9, "GetDisplayMode(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 64), extReset, (void **)&pReset, "Reset(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 68), extPresent, (void **)&pPresent, "Present(D9)"); - if(dxw.dwFlags2 & DISABLEGAMMARAMP){ - SetHook((void *)(**(DWORD **)ppd3dd + 84), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 88), extGetGammaRamp, (void **)&pGetGammaRamp, "GetGammaRamp(D9)"); - } - //SetHook((void *)(**(DWORD **)ppd3dd +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)"); - //SetHook((void *)(**(DWORD **)ppd3dd +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)"); - if(dxw.dwFlags2 & WIREFRAME){ - SetHook((void *)(**(DWORD **)ppd3dd + 228), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D9)"); - SetHook((void *)(**(DWORD **)ppd3dd + 232), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D9)"); - (*pSetRenderState)((void *)*ppd3dd, D3DRS_FILLMODE, D3DFILL_WIREFRAME); - } + HookD3DDevice9(ppd3dd); GetHookInfo()->IsFullScreen = dxw.IsFullScreen(); GetHookInfo()->DXVersion=(short)dwD3DVersion; @@ -873,7 +912,7 @@ HRESULT WINAPI extSetViewport(void *pd3dd, D3DVIEWPORT9 *pViewport) RECT client; POINT p={0,0}; (*pGetClientRect)(dxw.GethWnd(), &client); - OutTraceD("SetViewport: declared pos=(%d,%d) size=(%d,%d) depth=(%f;%f)\n", + OutTraceD3D("SetViewport: declared pos=(%d,%d) size=(%d,%d) depth=(%f;%f)\n", pViewport->X, pViewport->Y, pViewport->Width, pViewport->Height, pViewport->MinZ, pViewport->MaxZ); if(IsDebug) OutTrace("SetViewport: DEBUG win=(%d,%d) screen=(%d,%d)\n", client.right, client.bottom, dxw.GetScreenWidth(), dxw.GetScreenHeight()); @@ -881,7 +920,7 @@ HRESULT WINAPI extSetViewport(void *pd3dd, D3DVIEWPORT9 *pViewport) pViewport->Y = (pViewport->Y * (int)client.bottom) / (int)dxw.GetScreenHeight(); pViewport->Width = (pViewport->Width * (int)client.right) / (int)dxw.GetScreenWidth(); pViewport->Height = (pViewport->Height * (int)client.bottom) / (int)dxw.GetScreenHeight(); - OutTraceD("SetViewport: remapped pos=(%d,%d) size=(%d,%d)\n", + OutTraceDW("SetViewport: remapped pos=(%d,%d) size=(%d,%d)\n", pViewport->X, pViewport->Y, pViewport->Width, pViewport->Height); return (*pSetViewport)(pd3dd, pViewport); } @@ -898,21 +937,23 @@ HRESULT WINAPI extCreateAdditionalSwapChain(void *lpd3d, D3DPRESENT_PARAMETERS * AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight()); tmp = param; - OutTraceD("D3D%d::CreateAdditionalSwapChain\n", dwD3DVersion); - OutTraceD(" BackBufferWidth = %i\n", *(tmp ++)); - OutTraceD(" BackBufferHeight = %i\n", *(tmp ++)); - OutTraceD(" BackBufferFormat = %i\n", *(tmp ++)); - OutTraceD(" BackBufferCount = %i\n", *(tmp ++)); - OutTraceD(" MultiSampleType = %i\n", *(tmp ++)); - if(dwD3DVersion == 9) OutTraceD(" MultiSampleQuality = %i\n", *(tmp ++)); - OutTraceD(" SwapEffect = 0x%x\n", *(tmp ++)); - OutTraceD(" hDeviceWindow = 0x%x\n", *(tmp ++)); - OutTraceD(" Windowed = %i\n", (Windowed=*(tmp ++))); - OutTraceD(" EnableAutoDepthStencil = %i\n", *(tmp ++)); - OutTraceD(" AutoDepthStencilFormat = %i\n", *(tmp ++)); - OutTraceD(" Flags = 0x%x\n", *(tmp ++)); - OutTraceD(" FullScreen_RefreshRateInHz = %i\n", *(tmp ++)); - OutTraceD(" PresentationInterval = 0x%x\n", *(tmp ++)); + if(IsTraceDW){ + OutTrace("D3D%d::CreateAdditionalSwapChain\n", dwD3DVersion); + OutTrace(" BackBufferWidth = %i\n", *(tmp ++)); + OutTrace(" BackBufferHeight = %i\n", *(tmp ++)); + OutTrace(" BackBufferFormat = %i\n", *(tmp ++)); + OutTrace(" BackBufferCount = %i\n", *(tmp ++)); + OutTrace(" MultiSampleType = %i\n", *(tmp ++)); + if(dwD3DVersion == 9) OutTrace(" MultiSampleQuality = %i\n", *(tmp ++)); + OutTrace(" SwapEffect = 0x%x\n", *(tmp ++)); + OutTrace(" hDeviceWindow = 0x%x\n", *(tmp ++)); + OutTrace(" Windowed = %i\n", (Windowed=*(tmp ++))); + OutTrace(" EnableAutoDepthStencil = %i\n", *(tmp ++)); + OutTrace(" AutoDepthStencilFormat = %i\n", *(tmp ++)); + OutTrace(" Flags = 0x%x\n", *(tmp ++)); + OutTrace(" FullScreen_RefreshRateInHz = %i\n", *(tmp ++)); + OutTrace(" PresentationInterval = 0x%x\n", *(tmp ++)); + } //((LPDIRECT3D9)lpd3d)->GetAdapterDisplayMode(0, &mode); if (dwD3DVersion == 9) @@ -920,7 +961,7 @@ HRESULT WINAPI extCreateAdditionalSwapChain(void *lpd3d, D3DPRESENT_PARAMETERS * else (*pGetAdapterDisplayMode8)(lpd3d, 0, &mode); param[2] = mode.Format; - OutTraceD(" Current Format = 0x%x\n", mode.Format); + OutTraceDW(" Current Format = 0x%x\n", mode.Format); if(dwD3DVersion == 9){ param[7] = 0; //hDeviceWindow @@ -954,11 +995,11 @@ HRESULT WINAPI extD3D10CreateDevice( { HRESULT res; D3D10_VIEWPORT ViewPort; - OutTraceD("D3D10CreateDevice: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion); + OutTraceD3D("D3D10CreateDevice: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion); //return 0x887a0004; res=(*pD3D10CreateDevice)(pAdapter, DriverType, Software, Flags, SDKVersion, ppDevice); if(res){ - OutTraceD("D3D10CreateDevice: ret=%x\n", res); + OutTraceE("D3D10CreateDevice: ret=%x(%s)\n", res, ExplainDDError(res)); return res; } SetHook((void *)(*(DWORD *)*ppDevice + 100), extRSSetViewports, (void **)&pRSSetViewports, "RSSetViewports(D10)"); @@ -969,10 +1010,12 @@ HRESULT WINAPI extD3D10CreateDevice( ViewPort.MinDepth=1.0; ViewPort.MaxDepth=1.0; (*pRSSetViewports)((void *)*ppDevice, 1, (D3D11_VIEWPORT *)&ViewPort); - OutTraceD("D3D10CreateDevice: ret=%x\n", res); + OutTraceD3D("D3D10CreateDevice: ret=%x\n", res); return res; } +// -- log revised to here ... + HRESULT WINAPI extD3D10CreateDevice1( IDXGIAdapter *pAdapter, D3D10_DRIVER_TYPE DriverType, @@ -983,10 +1026,10 @@ HRESULT WINAPI extD3D10CreateDevice1( ID3D10Device **ppDevice) { HRESULT res; - OutTraceD("D3D10CreateDevice1: DriverType=%x Flags=%x HardwareLevel=%x SDKVersion=%x\n", DriverType, Flags, HardwareLevel, SDKVersion); + OutTraceDW("D3D10CreateDevice1: DriverType=%x Flags=%x HardwareLevel=%x SDKVersion=%x\n", DriverType, Flags, HardwareLevel, SDKVersion); res=(*pD3D10CreateDevice1)(pAdapter, DriverType, Software, Flags, HardwareLevel, SDKVersion, ppDevice); SetHook((void *)(*(DWORD *)*ppDevice + 100), extRSSetViewports, (void **)&pRSSetViewports, "RSSetViewports(D10)"); - OutTraceD("D3D10CreateDevice1: ret=%x\n", res); + OutTraceDW("D3D10CreateDevice1: ret=%x\n", res); return res; } @@ -1001,12 +1044,12 @@ HRESULT WINAPI extD3D10CreateDeviceAndSwapChain( ID3D10Device **ppDevice) { HRESULT res; - OutTraceD("D3D10CreateDeviceAndSwapChain: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion); + OutTraceDW("D3D10CreateDeviceAndSwapChain: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion); //return 0x887a0004; pSwapChainDesc->OutputWindow = dxw.GethWnd(); pSwapChainDesc->Windowed = true; res=(*pD3D10CreateDeviceAndSwapChain)(pAdapter, DriverType, Software, Flags, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice); - OutTraceD("D3D10CreateDeviceAndSwapChain ret=%x\n", res); + OutTraceDW("D3D10CreateDeviceAndSwapChain ret=%x\n", res); return res; } @@ -1021,12 +1064,12 @@ HRESULT WINAPI extD3D10CreateDeviceAndSwapChain1( ID3D10Device **ppDevice) { HRESULT res; - OutTraceD("D3D10CreateDeviceAndSwapChain1: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion); + OutTraceDW("D3D10CreateDeviceAndSwapChain1: DriverType=%x Flags=%x SDKVersion=%x\n", DriverType, Flags, SDKVersion); //return 0x887a0004; pSwapChainDesc->OutputWindow = dxw.GethWnd(); pSwapChainDesc->Windowed = true; res=(*pD3D10CreateDeviceAndSwapChain1)(pAdapter, DriverType, Software, Flags, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice); - OutTraceD("D3D10CreateDeviceAndSwapChain1 ret=%x\n", res); + OutTraceDW("D3D10CreateDeviceAndSwapChain1 ret=%x\n", res); return res; } @@ -1043,16 +1086,16 @@ HRESULT WINAPI extD3D11CreateDevice( ID3D11DeviceContext **ppImmediateContext) { HRESULT res; - OutTraceD("D3D11CreateDevice: DriverType=%x Flags=%x FeatureLevels=%x SDKVersion=%x\n", DriverType, Flags, FeatureLevels, SDKVersion); + OutTraceDW("D3D11CreateDevice: DriverType=%x Flags=%x FeatureLevels=%x SDKVersion=%x\n", DriverType, Flags, FeatureLevels, SDKVersion); //return 0x887a0004; res=(*pD3D11CreateDevice)(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext); if(res){ - OutTraceD("D3D11CreateDevice: ret=%x\n", res); + OutTraceDW("D3D11CreateDevice: ret=%x\n", res); return res; } SetHook((void *)(*(DWORD *)ppImmediateContext + 148), extRSSetViewports, (void **)&pRSSetViewports, "RSSetViewports(D11)"); //SetHook((void *)(*(DWORD *)ppImmediateContext + 152), extRSSetScissorRects, (void **)&pRSSetScissorRects, "RSSetScissorRects(D11)"); - OutTraceD("D3D11CreateDevice ret=%x\n", res); + OutTraceDW("D3D11CreateDevice ret=%x\n", res); return res; } @@ -1071,16 +1114,16 @@ HRESULT WINAPI extD3D11CreateDeviceAndSwapChain( ID3D11DeviceContext **ppImmediateContext) { HRESULT res; - OutTraceD("D3D11CreateDeviceAndSwapChain\n"); + OutTraceDW("D3D11CreateDeviceAndSwapChain\n"); return 0x887a0004; res=(*pD3D11CreateDeviceAndSwapChain)(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, pSwapChainDesc, ppSwapChain, ppDevice, pFeatureLevel, ppImmediateContext); - OutTraceD("D3D11CreateDeviceAndSwapChain ret=%x\n", res); + OutTraceDW("D3D11CreateDeviceAndSwapChain ret=%x\n", res); return res; } void WINAPI extRSSetViewports(ID3D11DeviceContext *This, UINT NumViewports, D3D11_VIEWPORT *pViewports) { - OutTraceD("RSSetViewports: NumViewports=%d\n", NumViewports); + OutTraceDW("RSSetViewports: NumViewports=%d\n", NumViewports); if(NumViewports==1){ pViewports->TopLeftX=dxw.iPosX; @@ -1095,7 +1138,7 @@ void WINAPI extRSSetViewports(ID3D11DeviceContext *This, UINT NumViewports, D3D1 HRESULT WINAPI extQueryInterfaceD3D8(void *obj, REFIID riid, void** ppvObj) { HRESULT res; - OutTraceD("D3D::QueryInterface(8)\n"); + OutTraceDW("D3D::QueryInterface(8)\n"); res=pQueryInterfaceD3D8(obj, riid, ppvObj); return res; } @@ -1103,7 +1146,7 @@ HRESULT WINAPI extQueryInterfaceD3D8(void *obj, REFIID riid, void** ppvObj) HRESULT WINAPI extQueryInterfaceDev8(void *obj, REFIID riid, void** ppvObj) { HRESULT res; - OutTraceD("Device::QueryInterface(8)\n"); + OutTraceDW("Device::QueryInterface(8)\n"); res=pQueryInterfaceDev8(obj, riid, ppvObj); return res; } @@ -1111,7 +1154,7 @@ HRESULT WINAPI extQueryInterfaceDev8(void *obj, REFIID riid, void** ppvObj) HRESULT WINAPI extQueryInterfaceD3D9(void *obj, REFIID riid, void** ppvObj) { HRESULT res; - OutTraceD("D3D::QueryInterface(9)\n"); + OutTraceDW("D3D::QueryInterface(9)\n"); res=pQueryInterfaceD3D9(obj, riid, ppvObj); return res; } @@ -1119,32 +1162,21 @@ HRESULT WINAPI extQueryInterfaceD3D9(void *obj, REFIID riid, void** ppvObj) HRESULT WINAPI extQueryInterfaceDev9(void *obj, REFIID riid, void** ppvObj) { HRESULT res; - void *pReset; - OutTraceD("Device::QueryInterface(9): lpd3dd=%x refiid=%x\n", obj, riid); + OutTraceDW("Device::QueryInterface(9): lpd3dd=%x refiid=%x\n", obj, riid); res=pQueryInterfaceDev9(obj, riid, ppvObj); if(res){ - OutTraceD("Device::QueryInterface(9): ERROR ret=%x\n", res); + OutTraceDW("Device::QueryInterface(9): ERROR ret=%x\n", res); return res; } - OutTraceD("Device::QueryInterface(9): ppvObj=%x\n", *ppvObj); + OutTraceDW("Device::QueryInterface(9): ppvObj=%x\n", *ppvObj); switch(*(DWORD *)&riid){ + case 0x7385E5DF: // IID_IDirect3DDevice8 + HookD3DDevice8(ppvObj); + break; case 0xD0223B96: // IID_IDirect3DDevice9 - OutTraceD("Device hook for IID_IDirect3DDevice9 interface\n"); - pReset=NULL; // to avoid assert condition - SetHook((void *)(**(DWORD **)ppvObj + 0), extQueryInterfaceDev9, (void **)&pQueryInterfaceDev9, "QueryInterface(D9)"); - SetHook((void *)(**(DWORD **)ppvObj + 32), extGetDisplayMode9, (void **)&pGetDisplayMode9, "GetDisplayMode(D9)"); - SetHook((void *)(**(DWORD **)ppvObj + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)"); - SetHook((void *)(**(DWORD **)ppvObj + 64), extReset, (void **)&pReset, "Reset(D9)"); - SetHook((void *)(**(DWORD **)ppvObj + 68), extPresent, (void **)&pPresent, "Present(D9)"); - //SetHook((void *)(**(DWORD **)ppvObj +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)"); - //SetHook((void *)(**(DWORD **)ppvObj +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)"); - if(dxw.dwFlags2 & WIREFRAME){ - SetHook((void *)(**(DWORD **)ppvObj + 228), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D9)"); - SetHook((void *)(**(DWORD **)ppvObj + 232), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D9)"); - (*pSetRenderState)((void *)*ppvObj, D3DRS_FILLMODE, D3DFILL_WIREFRAME); - } + HookD3DDevice9(ppvObj); break; } @@ -1159,19 +1191,51 @@ HRESULT WINAPI extGetDirect3D(void *lpdd3dd, IDirect3D9 **ppD3D9) HRESULT WINAPI extCheckFullScreen(void) { - OutTraceD("CheckFullScreen\n"); + OutTraceDW("CheckFullScreen\n"); return 0; } void WINAPI extSetGammaRamp(void *lpdd3dd, UINT iSwapChain, DWORD Flags, D3DGAMMARAMP *pRamp) { - OutTraceD("SetGammaRamp: dd3dd=%x SwapChain=%d flags=%x\n", lpdd3dd, iSwapChain, Flags); + OutTraceDW("SetGammaRamp: dd3dd=%x SwapChain=%d flags=%x\n", lpdd3dd, iSwapChain, Flags); if (dxw.dwFlags2 & DISABLEGAMMARAMP) return; (*pSetGammaRamp)(lpdd3dd, iSwapChain, Flags, pRamp); } void WINAPI extGetGammaRamp(void *lpdd3dd, UINT iSwapChain, D3DGAMMARAMP *pRamp) { - OutTraceD("GetGammaRamp: dd3dd=%x SwapChain=%d\n", lpdd3dd, iSwapChain); + OutTraceDW("GetGammaRamp: dd3dd=%x SwapChain=%d\n", lpdd3dd, iSwapChain); (*pGetGammaRamp)(lpdd3dd, iSwapChain, pRamp); } + +void WINAPI extSetCursorPosition9(void *lpdd3dd, int X, int Y, DWORD Flags) +{ + OutTraceDW("SetCursorPosition: dd3dd=%x pos=(%d,%d) flags=%x\n", lpdd3dd, X, Y, Flags); + if(dxw.dwFlags2 & KEEPCURSORFIXED) return; + // to do: proper scaling..... + //(*pSetCursorPosition9)(lpdd3dd, X, Y, Flags); +} + +void WINAPI extSetCursorPosition8(void *lpdd3dd, int X, int Y, DWORD Flags) +{ + OutTraceDW("SetCursorPosition: dd3dd=%x pos=(%d,%d) flags=%x\n", lpdd3dd, X, Y, Flags); + if(dxw.dwFlags2 & KEEPCURSORFIXED) return; + // to do: proper scaling..... + //(*pSetCursorPosition8)(lpdd3dd, X, Y, Flags); +} + +ULONG WINAPI extAddRef9(void *lpdd3dd) +{ + ULONG res; + res=(*pAddRef9)(lpdd3dd); + OutTraceD3D("AddRef(9): dd3dd=%x res=%x\n", lpdd3dd, res); + return res; +} + +ULONG WINAPI extRelease9(void *lpdd3dd) +{ + ULONG res; + res=(*pRelease9)(lpdd3dd); + OutTraceD3D("Release(9): dd3dd=%x res=%x\n", lpdd3dd, res); + return res; +} \ No newline at end of file diff --git a/dll/hd3d7.cpp b/dll/hd3d7.cpp index 4b69d10..9de086d 100644 --- a/dll/hd3d7.cpp +++ b/dll/hd3d7.cpp @@ -9,8 +9,8 @@ // exported API DWORD gD3DVersion; // quick & dirty .... -//#undef OutTraceD -//#define OutTraceD OutTrace +//#undef OutTraceDW +//#define OutTraceDW OutTrace typedef HRESULT (WINAPI *Direct3DCreateDevice_Type)(GUID FAR *, LPDIRECT3D, LPDIRECTDRAWSURFACE, LPDIRECT3D *, LPUNKNOWN); typedef HRESULT (WINAPI *Direct3DCreate_Type)(UINT, LPDIRECT3D *, LPUNKNOWN); @@ -106,6 +106,7 @@ int HookDirect3D7(HMODULE module, int version){ void *tmp; HINSTANCE hinst; LPDIRECT3D lpd3d=NULL; + HRESULT res; gD3DVersion = version; @@ -122,22 +123,22 @@ int HookDirect3D7(HMODULE module, int version){ if(tmp) pDirect3DCreateDevice = (Direct3DCreateDevice_Type)tmp; break; case 7: - hinst = LoadLibrary("d3dim.dll"); + hinst = (*pLoadLibraryA)("d3dim.dll"); if (hinst){ pDirect3DCreate = - (Direct3DCreate_Type)GetProcAddress(hinst, "Direct3DCreate"); + (Direct3DCreate_Type)(*pGetProcAddress)(hinst, "Direct3DCreate"); if(pDirect3DCreate){ - lpd3d = (LPDIRECT3D)extDirect3DCreate(0x0700, &lpd3d, NULL); - if(lpd3d) lpd3d->Release(); + res = extDirect3DCreate(0x0700, &lpd3d, NULL); + if(res == DD_OK) lpd3d->Release(); } } else { - hinst = LoadLibrary("d3dim700.dll"); + hinst = (*pLoadLibraryA)("d3dim700.dll"); pDirect3DCreate = - (Direct3DCreate_Type)GetProcAddress(hinst, "Direct3DCreate"); + (Direct3DCreate_Type)(*pGetProcAddress)(hinst, "Direct3DCreate"); if(pDirect3DCreate){ - lpd3d = (LPDIRECT3D)extDirect3DCreate(0x0700, &lpd3d, NULL); - if(lpd3d) lpd3d->Release(); + res = extDirect3DCreate(0x0700, &lpd3d, NULL); + if(res == DD_OK) lpd3d->Release(); } } break; @@ -149,12 +150,12 @@ FARPROC Remap_d3d7_ProcAddress(LPCSTR proc, HMODULE hModule) { if (!strcmp(proc,"Direct3DCreate") && !pDirect3DCreate){ pDirect3DCreate=(Direct3DCreate_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreate); return (FARPROC)extDirect3DCreate; } if (!strcmp(proc,"Direct3DCreateDevice") && !pDirect3DCreateDevice){ pDirect3DCreateDevice=(Direct3DCreateDevice_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreateDevice); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pDirect3DCreateDevice); return (FARPROC)extDirect3DCreateDevice; } // NULL -> keep the original call address @@ -165,17 +166,17 @@ HRESULT WINAPI extDirect3DCreateDevice(GUID FAR *lpGUID, LPDIRECT3D lpd3ddevice, { HRESULT res; - OutTraceD("Direct3DCreateDevice: guid=%x d3ddevice=%x dds=%x UnkOuter=%x\n", + OutTraceD3D("Direct3DCreateDevice: guid=%x d3ddevice=%x dds=%x UnkOuter=%x\n", lpGUID, lpd3ddevice, surf, pUnkOuter); res=(*pDirect3DCreateDevice)(lpGUID, lpd3ddevice, surf, lplpd3ddevice, pUnkOuter); if(res) OutTraceE("Direct3DCreateDevice ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - else OutTraceD("Direct3DCreateDevice: d3ddevice=%x\n", *lplpd3ddevice); + else OutTraceD3D("Direct3DCreateDevice: d3ddevice=%x\n", *lplpd3ddevice); return res; } void HookDirect3DSession(LPDIRECTDRAW *lplpdd, int dxversion) { - OutTraceD("HookDirect3DSession: d3d=%x d3dversion=%d\n", *lplpdd, dxversion); + OutTraceDW("HookDirect3DSession: d3d=%x d3dversion=%d\n", *lplpdd, dxversion); gD3DVersion = dxversion; @@ -213,7 +214,7 @@ void HookDirect3DSession(LPDIRECTDRAW *lplpdd, int dxversion) void HookDirect3DDevice(void **lpd3ddev, int dxversion) { - OutTraceD("HookDirect3DDevice: d3ddev=%x d3dversion=%d\n", lpd3ddev, dxversion); + OutTraceDW("HookDirect3DDevice: d3ddev=%x d3dversion=%d\n", lpd3ddev, dxversion); gD3DVersion = dxversion; @@ -250,7 +251,7 @@ HRESULT WINAPI extDirect3DCreate(UINT SDKVersion, LPDIRECT3D *lplpd3d, LPUNKNOWN { HRESULT res; - OutTraceD("Direct3DCreate: SDKVersion=%x UnkOuter=%x\n", SDKVersion, pUnkOuter); + OutTraceD3D("Direct3DCreate: SDKVersion=%x UnkOuter=%x\n", SDKVersion, pUnkOuter); res=(*pDirect3DCreate)(SDKVersion, lplpd3d, pUnkOuter); if(res) { @@ -259,13 +260,13 @@ HRESULT WINAPI extDirect3DCreate(UINT SDKVersion, LPDIRECT3D *lplpd3d, LPUNKNOWN } HookDirect3DSession((LPDIRECTDRAW *)lplpd3d, SDKVersion); - OutTraceD("Direct3DCreate: d3d=%x\n", *lplpd3d); + OutTraceD3D("Direct3DCreate: d3d=%x\n", *lplpd3d); return res; } void HookViewport(LPDIRECT3DVIEWPORT *lpViewport, int dxversion) { - OutTraceD("HookViewport: Viewport=%x d3dversion=%d\n", *lpViewport, dxversion); + OutTraceDW("HookViewport: Viewport=%x d3dversion=%d\n", *lpViewport, dxversion); switch(dxversion){ case 1: @@ -284,7 +285,7 @@ HRESULT WINAPI extQueryInterfaceD3(void *lpd3d, REFIID riid, LPVOID *ppvObj) HRESULT res; int d3dversion; - OutTraceD("QueryInterface(D3): d3d=%x REFIID=%x obj=%x\n", lpd3d, riid.Data1, ppvObj); + OutTraceD3D("QueryInterface(D3): d3d=%x REFIID=%x obj=%x\n", lpd3d, riid.Data1, ppvObj); d3dversion=0; res=(*pQueryInterfaceD3)(lpd3d, riid, ppvObj); switch(riid.Data1){ @@ -293,7 +294,7 @@ HRESULT WINAPI extQueryInterfaceD3(void *lpd3d, REFIID riid, LPVOID *ppvObj) case 0xbb223240: d3dversion=6; break; case 0xf5049e77: d3dversion=7; break; } - if(d3dversion) OutTraceD("QueryInterface(D3): hooking version=%d\n", d3dversion); + if(d3dversion) OutTraceDW("QueryInterface(D3): hooking version=%d\n", d3dversion); switch(d3dversion){ case 1: SetHook((void *)(**(DWORD **)ppvObj + 12), extInitialize, (void **)&pInitialize, "Initialize"); @@ -319,10 +320,10 @@ HRESULT WINAPI extInitialize(void *lpd3d) { HRESULT res; - OutTraceD("Initialize: d3d=%x\n", lpd3d); + OutTraceD3D("Initialize: d3d=%x\n", lpd3d); res=(*pInitialize)(lpd3d); if(res) OutTraceE("Initialize ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - else OutTraceD("Initialize: OK\n"); + else OutTraceD3D("Initialize: OK\n"); return res; } @@ -333,7 +334,7 @@ typedef struct { static void DumpD3DDevideDesc(LPD3DDEVICEDESC d3, char *label) { - if(IsTraceD){ + if(IsTraceD3D){ OutTrace("EnumDevices: CALLBACK dev=%s Size=%d Flags=%x ", label, d3->dwSize, d3->dwFlags); if(d3->dwFlags & D3DDD_COLORMODEL) OutTrace("ColorModel=%x ", d3->dcmColorModel); if(d3->dwFlags & D3DDD_DEVCAPS) OutTrace("DevCaps=%x ", d3->dwDevCaps); @@ -353,7 +354,7 @@ static void DumpD3DDevideDesc(LPD3DDEVICEDESC d3, char *label) HRESULT WINAPI extDeviceProxy(GUID FAR *lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC lpd3ddd1, LPD3DDEVICEDESC lpd3ddd2, LPVOID arg) { HRESULT res; - OutTraceD("EnumDevices: CALLBACK GUID=%x(%s) DeviceDescription=\"%s\", DeviceName=\"%s\", arg=%x\n", lpGuid->Data1, ExplainGUID(lpGuid), lpDeviceDescription, lpDeviceName, ((CallbackArg *)arg)->arg); + OutTraceDW("EnumDevices: CALLBACK GUID=%x(%s) DeviceDescription=\"%s\", DeviceName=\"%s\", arg=%x\n", lpGuid->Data1, ExplainGUID(lpGuid), lpDeviceDescription, lpDeviceName, ((CallbackArg *)arg)->arg); DumpD3DDevideDesc(lpd3ddd1, "HWDEV"); DumpD3DDevideDesc(lpd3ddd2, "SWDEV"); if(dxw.dwFlags4 & NOPOWER2FIX){ @@ -369,7 +370,7 @@ HRESULT WINAPI extDeviceProxy(GUID FAR *lpGuid, LPSTR lpDeviceDescription, LPSTR else { res = (*(((CallbackArg *)arg)->cb))(lpGuid, lpDeviceDescription, lpDeviceName, lpd3ddd1, lpd3ddd2, ((CallbackArg *)arg)->arg); } - OutTraceD("EnumDevices: CALLBACK ret=%x\n", res); + OutTraceDW("EnumDevices: CALLBACK ret=%x\n", res); return res; } @@ -378,12 +379,12 @@ HRESULT WINAPI extEnumDevices(void *lpd3d, LPD3DENUMDEVICESCALLBACK cb, LPVOID a HRESULT res; CallbackArg Arg; - OutTraceD("EnumDevices: d3d=%x arg=%x\n", lpd3d, arg); + OutTraceD3D("EnumDevices: d3d=%x arg=%x\n", lpd3d, arg); Arg.cb= &cb; Arg.arg=arg; res=(*pEnumDevices)(lpd3d, (LPD3DENUMDEVICESCALLBACK)extDeviceProxy, (LPVOID)&Arg); if(res) OutTraceE("EnumDevices ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - else OutTraceD("EnumDevices: OK\n"); + else OutTraceD3D("EnumDevices: OK\n"); return res; } @@ -391,10 +392,10 @@ HRESULT WINAPI extCreateLight(void *lpd3d, LPDIRECT3DLIGHT *lpLight, IUnknown *p { HRESULT res; - OutTraceD("CreateLight: d3d=%x\n", lpd3d); + OutTraceD3D("CreateLight: d3d=%x\n", lpd3d); res=(*pCreateLight)(lpd3d, lpLight, p0); if(res) OutTraceE("CreateLight ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - else OutTraceD("CreateLight: OK\n"); + else OutTraceD3D("CreateLight: OK\n"); return res; } @@ -402,10 +403,10 @@ HRESULT WINAPI extCreateMaterial(void *lpd3d, LPDIRECT3DMATERIAL *lpMaterial, IU { HRESULT res; - OutTraceD("CreateMaterial: d3d=%x\n", lpd3d); + OutTraceD3D("CreateMaterial: d3d=%x\n", lpd3d); res=(*pCreateMaterial)(lpd3d, lpMaterial, p0); if(res) OutTraceE("CreateMaterial ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - else OutTraceD("CreateMaterial: OK\n"); + else OutTraceD3D("CreateMaterial: OK\n"); return res; } @@ -413,10 +414,10 @@ HRESULT WINAPI extCreateViewport(void *lpd3d, LPDIRECT3DVIEWPORT *lpViewport, IU { HRESULT res; - OutTraceD("CreateViewport: d3d=%x\n", lpd3d); + OutTraceD3D("CreateViewport: d3d=%x\n", lpd3d); res=(*pCreateViewport)(lpd3d, lpViewport, p0); if(res) OutTraceE("CreateViewport ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - else OutTraceD("CreateViewport: Viewport=%x\n", *lpViewport); + else OutTraceD3D("CreateViewport: Viewport=%x\n", *lpViewport); HookViewport(lpViewport, gD3DVersion); return res; } @@ -425,12 +426,12 @@ HRESULT WINAPI extFindDevice(void *lpd3d, LPD3DFINDDEVICESEARCH p1, LPD3DFINDDEV { HRESULT res; - OutTraceD("FindDevice: d3d=%x devsearch=%x (size=%d flags=%x caps=%x primcaps=%x colormodel=%x hw=%x guid=%x) p2=%x\n", + OutTraceD3D("FindDevice: d3d=%x devsearch=%x (size=%d flags=%x caps=%x primcaps=%x colormodel=%x hw=%x guid=%x) p2=%x\n", lpd3d, p1, p1->dwSize, p1->dwFlags, p1->dwCaps, p1->dpcPrimCaps, p1->dcmColorModel, p1->bHardware, p1->guid, p2); res=(*pFindDevice)(lpd3d, p1, p2); if(res) OutTraceE("FindDevice ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); else { - OutTraceD("FindDevice: GUID=%x.%x.%x.%x\n", p2->guid.Data1, p2->guid.Data2, p2->guid.Data3, p2->guid.Data4); + OutTraceD3D("FindDevice: GUID=%x.%x.%x.%x\n", p2->guid.Data1, p2->guid.Data2, p2->guid.Data3, p2->guid.Data4); DumpD3DDevideDesc(&(p2->ddHwDesc), "HWDEV"); DumpD3DDevideDesc(&(p2->ddSwDesc), "SWDEV"); } @@ -441,12 +442,12 @@ HRESULT WINAPI extSetViewport(void *lpvp, LPD3DVIEWPORT vpd) { HRESULT res; - OutTraceD("SetViewport: viewport=%x viewportd=%x size=%d pos=(%d,%d) dim=(%dx%d) scale=(%fx%f) maxXYZ=(%f,%f,%f) minZ=%f\n", + OutTraceD3D("SetViewport: viewport=%x viewportd=%x size=%d pos=(%d,%d) dim=(%dx%d) scale=(%fx%f) maxXYZ=(%f,%f,%f) minZ=%f\n", lpvp, vpd, vpd->dwSize, vpd->dwX, vpd->dwY, vpd->dwHeight, vpd->dwWidth, vpd->dvScaleX, vpd->dvScaleY, vpd->dvMaxX, vpd->dvMaxY, vpd->dvMaxZ, vpd->dvMinZ); res=(*pSetViewport)(lpvp, vpd); if(res) OutTraceE("SetViewport ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - else OutTraceD("SetViewport: OK\n"); + else OutTraceD3D("SetViewport: OK\n"); return res; } @@ -454,10 +455,10 @@ HRESULT WINAPI extGetViewport(void *lpvp, LPD3DVIEWPORT vpd) { HRESULT res; - OutTraceD("GetViewport: viewport=%x viewportd=%x\n", lpvp, vpd); + OutTraceD3D("GetViewport: viewport=%x viewportd=%x\n", lpvp, vpd); res=(*pGetViewport)(lpvp, vpd); if(res) OutTraceE("GetViewport ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - else OutTraceD("GetViewport: OK size=%d pos=(%d,%d) dim=(%dx%d) scale=(%fx%f) maxXYZ=(%f,%f,%f) minZ=%f\n", + else OutTraceD3D("GetViewport: OK size=%d pos=(%d,%d) dim=(%dx%d) scale=(%fx%f) maxXYZ=(%f,%f,%f) minZ=%f\n", vpd->dwSize, vpd->dwX, vpd->dwY, vpd->dwHeight, vpd->dwWidth, vpd->dvScaleX, vpd->dvScaleY, vpd->dvMaxX, vpd->dvMaxY, vpd->dvMaxZ, vpd->dvMinZ); return res; @@ -467,10 +468,10 @@ HRESULT WINAPI extInitializeVP(void *lpvp, LPDIRECT3D lpd3d) { HRESULT res; - OutTraceD("Initialize(VP): viewport=%x d3d=%x\n", lpvp, lpd3d); + OutTraceD3D("Initialize(VP): viewport=%x d3d=%x\n", lpvp, lpd3d); res=(*pInitializeVP)(lpvp, lpd3d); if(res) OutTraceE("Initialize(VP) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - else OutTraceD("Initialize(VP): OK \n"); + else OutTraceD3D("Initialize(VP): OK \n"); return res; } @@ -478,14 +479,14 @@ HRESULT WINAPI extCreateDevice2(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE { HRESULT res; - OutTraceD("CreateDevice(D3D2): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); + OutTraceD3D("CreateDevice(D3D2): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd); if(res) { OutTraceE("CreateDevice(D3D2) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); return res; } else - OutTraceD("CreateDevice(D3D2): lpd3dd=%x\n", lpd3d, *lplpd3dd); + OutTraceD3D("CreateDevice(D3D2): lpd3dd=%x\n", lpd3d, *lplpd3dd); HookDirect3DDevice((void **)lplpd3dd, 2); return res; @@ -501,7 +502,7 @@ HRESULT WINAPI extCreateDevice3(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE4 GUID IID_IDirect3DRampDevice = {0xF2086B20,0x259F,0x11CF,0xA3,0x1A,0x00,0xAA,0x00,0xB9,0x33,0x56}; GUID IID_IDirect3DMMXDevice = {0x881949a1,0xd6f3,0x11d0,0x89,0xab,0x00,0xa0,0xc9,0x05,0x41,0x29}; - OutTraceD("CreateDevice(D3D3): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); + OutTraceD3D("CreateDevice(D3D3): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk); //res=(*pCreateDevice3)(lpd3d, IID_IDirect3DMMXDevice, lpdds, lplpd3dd, unk); if(res) { @@ -528,7 +529,7 @@ HRESULT WINAPI extCreateDevice3(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE4 HRESULT WINAPI extD3DInitialize(void *d3dd, LPDIRECT3D lpd3d, LPGUID lpGuid, LPD3DDEVICEDESC lpd3dd) { HRESULT res; - OutTrace("Initialize: d3dd=%x lpd3d=%x GUID=%x lpd3ddd=%x\n", d3dd, lpd3d, lpGuid->Data1, lpd3dd); + OutTraceD3D("Initialize: d3dd=%x lpd3d=%x GUID=%x lpd3ddd=%x\n", d3dd, lpd3d, lpGuid->Data1, lpd3dd); res=(*pD3DInitialize)(d3dd, lpd3d, lpGuid, lpd3dd); if(res) OutTraceE("Initialize ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); DumpD3DDevideDesc(lpd3dd, "INIT"); @@ -538,7 +539,7 @@ HRESULT WINAPI extD3DInitialize(void *d3dd, LPDIRECT3D lpd3d, LPGUID lpGuid, LPD HRESULT WINAPI extD3DGetCaps(void *d3dd, LPD3DDEVICEDESC lpd3dd ,LPD3DDEVICEDESC lpd3dd2) { HRESULT res; - OutTrace("GetCaps(D3D): d3dd=%x lpd3dd=%x lpd3dd2=%x \n", d3dd, lpd3dd, lpd3dd2); + OutTraceD3D("GetCaps(D3D): d3dd=%x lpd3dd=%x lpd3dd2=%x \n", d3dd, lpd3dd, lpd3dd2); res=(*pD3DGetCaps)(d3dd, lpd3dd, lpd3dd2); if(res) OutTraceE("GetCaps(D3D) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); DumpD3DDevideDesc(lpd3dd, "HWDEV"); @@ -586,16 +587,16 @@ char *ExplainRenderstateValue(DWORD Value) HRESULT WINAPI extSetRenderState2(void *d3dd, D3DRENDERSTATETYPE State, DWORD Value) { HRESULT res; - OutTraceD("SetRenderState(2): d3dd=%x State=%x(%s) Value=%x\n", d3dd, State, ExplainD3DRenderState(State), Value); + OutTraceD3D("SetRenderState(2): d3dd=%x State=%x(%s) Value=%x\n", d3dd, State, ExplainD3DRenderState(State), Value); if((dxw.dwFlags4 & ZBUFFERALWAYS) && (State == D3DRENDERSTATE_ZFUNC)) { DWORD OldValue; OldValue = Value; Value = D3DCMP_ALWAYS; - OutTraceD("SetRenderState: FIXED State=ZFUNC Value=%s->D3DCMP_ALWAYS\n", ExplainRenderstateValue(OldValue)); + OutTraceDW("SetRenderState: FIXED State=ZFUNC Value=%s->D3DCMP_ALWAYS\n", ExplainRenderstateValue(OldValue)); } if((dxw.dwFlags2 & WIREFRAME) && (State == D3DRENDERSTATE_FILLMODE)){ Value = D3DFILL_WIREFRAME; - OutTraceD("SetRenderState: FIXED State=FILLMODE Value=D3DFILL_WIREFRAME\n"); + OutTraceDW("SetRenderState: FIXED State=FILLMODE Value=D3DFILL_WIREFRAME\n"); } res=(*pSetRenderState2)(d3dd, State, Value); if(res) OutTraceE("SetRenderState(2): res=%x(%s)\n", res, ExplainDDError(res)); @@ -605,19 +606,19 @@ HRESULT WINAPI extSetRenderState2(void *d3dd, D3DRENDERSTATETYPE State, DWORD Va HRESULT WINAPI extSetRenderState3(void *d3dd, D3DRENDERSTATETYPE State, DWORD Value) { HRESULT res; - OutTraceD("SetRenderState(3): d3dd=%x State=%x(%s) Value=%x\n", d3dd, State, ExplainD3DRenderState(State), Value); + OutTraceD3D("SetRenderState(3): d3dd=%x State=%x(%s) Value=%x\n", d3dd, State, ExplainD3DRenderState(State), Value); if((dxw.dwFlags4 & ZBUFFERALWAYS) && (State == D3DRENDERSTATE_ZFUNC)) { DWORD OldValue; OldValue = Value; Value = D3DCMP_ALWAYS; - OutTraceD("SetRenderState: FIXED State=ZFUNC Value=%s->D3DCMP_ALWAYS\n", ExplainRenderstateValue(OldValue)); + OutTraceDW("SetRenderState: FIXED State=ZFUNC Value=%s->D3DCMP_ALWAYS\n", ExplainRenderstateValue(OldValue)); } if((dxw.dwFlags2 & WIREFRAME) && (State == D3DRENDERSTATE_FILLMODE)){ Value = D3DFILL_WIREFRAME; - OutTraceD("SetRenderState: FIXED State=FILLMODE Value=D3DFILL_WIREFRAME\n"); + OutTraceDW("SetRenderState: FIXED State=FILLMODE Value=D3DFILL_WIREFRAME\n"); } if((dxw.dwFlags4 & DISABLEFOGGING) && (State == D3DRENDERSTATE_FOGENABLE)){ - OutTraceD("SetRenderState: FIXED State=FOGENABLE Value=FALSE\n"); + OutTraceDW("SetRenderState: FIXED State=FOGENABLE Value=FALSE\n"); Value = FALSE; } res=(*pSetRenderState3)(d3dd, State, Value); @@ -628,7 +629,7 @@ HRESULT WINAPI extSetRenderState3(void *d3dd, D3DRENDERSTATETYPE State, DWORD Va HRESULT WINAPI extBeginScene1(void *d3dd) { HRESULT res; - OutTraceD("BeginScene(1): d3dd=%x\n", d3dd); + OutTraceD3D("BeginScene(1): d3dd=%x\n", d3dd); res=(*pBeginScene1)(d3dd); if(res) OutTraceE("BeginScene(1): res=%x(%s)\n", res, ExplainDDError(res)); return res; @@ -637,7 +638,7 @@ HRESULT WINAPI extBeginScene1(void *d3dd) HRESULT WINAPI extBeginScene2(void *d3dd) { HRESULT res; - OutTraceD("BeginScene(2): d3dd=%x\n", d3dd); + OutTraceD3D("BeginScene(2): d3dd=%x\n", d3dd); if(dxw.dwFlags4 & ZBUFFERCLEAN){ HRESULT res2; LPDIRECT3DVIEWPORT2 vp; @@ -651,7 +652,7 @@ HRESULT WINAPI extBeginScene2(void *d3dd) d3dRect.y1 = vpd.dwY; d3dRect.x2 = vpd.dwX + vpd.dwWidth; d3dRect.y2 = vpd.dwY + vpd.dwHeight; - OutTraceD("d3dRect=(%d,%d)-(%d,%d)\n", d3dRect.x1, d3dRect.y1, d3dRect.x2, d3dRect.y2); + OutTraceDW("d3dRect=(%d,%d)-(%d,%d)\n", d3dRect.x1, d3dRect.y1, d3dRect.x2, d3dRect.y2); vp->Clear(1, &d3dRect, D3DCLEAR_ZBUFFER); } } @@ -663,7 +664,7 @@ HRESULT WINAPI extBeginScene2(void *d3dd) HRESULT WINAPI extBeginScene3(void *d3dd) { HRESULT res; - OutTraceD("BeginScene(3): d3dd=%x\n", d3dd); + OutTraceD3D("BeginScene(3): d3dd=%x\n", d3dd); if(dxw.dwFlags4 & (ZBUFFERCLEAN|ZBUFFER0CLEAN)){ HRESULT res2; LPDIRECT3DVIEWPORT3 vp; @@ -677,7 +678,7 @@ HRESULT WINAPI extBeginScene3(void *d3dd) d3dRect.y1 = vpd.dwY; d3dRect.x2 = vpd.dwX + vpd.dwWidth; d3dRect.y2 = vpd.dwY + vpd.dwHeight; - OutTraceD("d3dRect=(%d,%d)-(%d,%d)\n", d3dRect.x1, d3dRect.y1, d3dRect.x2, d3dRect.y2); + OutTraceDW("d3dRect=(%d,%d)-(%d,%d)\n", d3dRect.x1, d3dRect.y1, d3dRect.x2, d3dRect.y2); if(dxw.dwFlags4 & ZBUFFERCLEAN )vp->Clear2(1, &d3dRect, D3DCLEAR_ZBUFFER, 0, 1.0, 0); if(dxw.dwFlags4 & ZBUFFER0CLEAN)vp->Clear2(1, &d3dRect, D3DCLEAR_ZBUFFER, 0, 0.0, 0); } @@ -690,7 +691,7 @@ HRESULT WINAPI extBeginScene3(void *d3dd) HRESULT WINAPI extEndScene1(void *d3dd) { HRESULT res; - OutTraceD("EndScene(1): d3dd=%x\n", d3dd); + OutTraceD3D("EndScene(1): d3dd=%x\n", d3dd); res=(*pEndScene1)(d3dd); //dxw.ShowOverlay(); if(res) OutTraceE("EndScene(1): res=%x(%s)\n", res, ExplainDDError(res)); @@ -700,7 +701,7 @@ HRESULT WINAPI extEndScene1(void *d3dd) HRESULT WINAPI extEndScene2(void *d3dd) { HRESULT res; - OutTraceD("EndScene(2): d3dd=%x\n", d3dd); + OutTraceD3D("EndScene(2): d3dd=%x\n", d3dd); res=(*pEndScene2)(d3dd); //dxw.ShowOverlay(); if(res) OutTraceE("EndScene(2): res=%x(%s)\n", res, ExplainDDError(res)); @@ -710,7 +711,7 @@ HRESULT WINAPI extEndScene2(void *d3dd) HRESULT WINAPI extEndScene3(void *d3dd) { HRESULT res; - OutTraceD("EndScene(3): d3dd=%x\n", d3dd); + OutTraceD3D("EndScene(3): d3dd=%x\n", d3dd); res=(*pEndScene3)(d3dd); //dxw.ShowOverlay(); if(res) OutTraceE("EndScene(3): res=%x(%s)\n", res, ExplainDDError(res)); @@ -720,7 +721,7 @@ HRESULT WINAPI extEndScene3(void *d3dd) HRESULT WINAPI extGetCaps3(void *d3dd, LPD3DDEVICEDESC hd, LPD3DDEVICEDESC sd) { HRESULT res; - OutTraceD("GetCaps(3): d3dd=%x hd=%x sd=%x\n", d3dd, hd, sd); + OutTraceD3D("GetCaps(3): d3dd=%x hd=%x sd=%x\n", d3dd, hd, sd); res=(*pGetCaps3)(d3dd, hd, sd); if(res) { OutTraceE("GetCaps(3): res=%x(%s)\n", res, ExplainDDError(res)); diff --git a/dll/imelib.cpp b/dll/imelib.cpp index 4c5327b..ee89cdc 100644 --- a/dll/imelib.cpp +++ b/dll/imelib.cpp @@ -35,49 +35,49 @@ FARPROC Remap_ImeLib_ProcAddress(LPCSTR proc, HMODULE hModule) BOOL WINAPI extImmNotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue) { - OutTraceD("ImmNotifyIME: hIMC=%x dwAction=%x dwIndex=%x dwValue=%x\n", hIMC, dwAction, dwIndex, dwValue); + OutTraceDW("ImmNotifyIME: hIMC=%x dwAction=%x dwIndex=%x dwValue=%x\n", hIMC, dwAction, dwIndex, dwValue); return(*pImmNotifyIME)(hIMC, dwAction, dwIndex, dwValue); } HIMC WINAPI extImmCreateContext(void) { - OutTraceD("ImmCreateContext\n"); + OutTraceDW("ImmCreateContext\n"); return(*pImmCreateContext)(); } BOOL WINAPI extImmDestroyContext(HIMC hIMC) { - OutTraceD("ImmDestroyContext: hIMC=%x\n", hIMC); + OutTraceDW("ImmDestroyContext: hIMC=%x\n", hIMC); return(*pImmDestroyContext)(hIMC); } BOOL WINAPI extImmSetOpenStatus(HIMC hIMC, BOOL fOpen) { - OutTraceD("ImmSetOpenStatus: hIMC=%x fOpen=%x\n", hIMC, fOpen); + OutTraceDW("ImmSetOpenStatus: hIMC=%x fOpen=%x\n", hIMC, fOpen); return(*pImmSetOpenStatus)(hIMC, fOpen); } HIMC WINAPI extImmAssociateContext(HWND hwnd, HIMC hIMC) { - OutTraceD("ImmAssociateContext: hwnd=%x hIMC=%x\n", hwnd, hIMC); + OutTraceDW("ImmAssociateContext: hwnd=%x hIMC=%x\n", hwnd, hIMC); //return NULL; return(*pImmAssociateContext)(hwnd, hIMC); } BOOL WINAPI extImmSetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm) { - OutTraceD("ImmSetCompositionWindow: hIMC=%x lpCompForm=%x\n", hIMC, lpCompForm); + OutTraceDW("ImmSetCompositionWindow: hIMC=%x lpCompForm=%x\n", hIMC, lpCompForm); return(*pImmSetCompositionWindow)(hIMC, lpCompForm); } BOOL WINAPI extImmSetCompositionString(HIMC hIMC, DWORD dwIndex, LPVOID lpComp, DWORD dwCompLen, LPVOID lpRead, DWORD dwReadLen) { - OutTraceD("ImmSetCompositionString: hIMC=%x dwIndex=%x lpComp=%x dwCompLen=%x dwRead=%x dwReadLen=%x\n", hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen); + OutTraceDW("ImmSetCompositionString: hIMC=%x dwIndex=%x lpComp=%x dwCompLen=%x dwRead=%x dwReadLen=%x\n", hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen); return (*pImmSetCompositionString)(hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen); } BOOL WINAPI extImmGetOpenStatus(HIMC hIMC) { - OutTraceD("ImmGetOpenStatus: hIMC=%x\n", hIMC); + OutTraceDW("ImmGetOpenStatus: hIMC=%x\n", hIMC); return(*pImmGetOpenStatus)(hIMC); } diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index 9d90216..46edc39 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -40,6 +40,7 @@ static HookEntry_Type TimeHooks[]={ {"SleepEx", (FARPROC)SleepEx, (FARPROC *)&pSleepEx, (FARPROC)extSleepEx}, {"SetTimer", (FARPROC)SetTimer, (FARPROC *)&pSetTimer, (FARPROC)extSetTimer}, {"QueryPerformanceCounter", (FARPROC)NULL, (FARPROC *)&pQueryPerformanceCounter, (FARPROC)extQueryPerformanceCounter}, + {"QueryPerformanceFrequency", (FARPROC)NULL, (FARPROC *)&pQueryPerformanceFrequency, (FARPROC)extQueryPerformanceFrequency}, {0, NULL, 0, 0} // terminator }; @@ -64,6 +65,26 @@ void HookKernel32(HMODULE module) if(dxw.dwFlags2 & TIMESTRETCH) HookLibrary(module, TimeHooks, libname); if(dxw.dwFlags2 & FAKEVERSION) HookLibrary(module, VersionHooks, libname); if(dxw.dwFlags4 & SUPPRESSCHILD) HookLibrary(module, SuppressChildHooks, libname); + +#if 0 + if(dxw.dwFlags2 & TIMESTRETCH){ + HINSTANCE hinst; + LARGE_INTEGER myPerfCount; + hinst = LoadLibrary("kernel32.dll"); + pQueryPerformanceFrequency=(QueryPerformanceFrequency_Type)GetProcAddress(hinst, "QueryPerformanceFrequency"); + pQueryPerformanceCounter=(QueryPerformanceCounter_Type)GetProcAddress(hinst, "QueryPerformanceCounter"); + pGetTickCount=(GetTickCount_Type)GetProcAddress(hinst, "GetTickCount"); + if(pQueryPerformanceFrequency){ + HookAPI(hinst, "kernel32.dll", pQueryPerformanceFrequency, "QueryPerformanceFrequency", extQueryPerformanceFrequency); + HookAPI(hinst, "kernel32.dll", pQueryPerformanceCounter, "QueryPerformanceCounter", extQueryPerformanceCounter); + extQueryPerformanceFrequency(&myPerfCount); + } + if(pGetTickCount){ + HookAPI(hinst, "kernel32.dll", pGetTickCount, "GetTickCount", extGetTickCount); + extGetTickCount(); + } + } +#endif } void HookKernel32Init() @@ -78,6 +99,14 @@ FARPROC Remap_kernel32_ProcAddress(LPCSTR proc, HMODULE hModule) { FARPROC addr; + if (dxw.dwFlags4 & NOPERFCOUNTER){ + if( !strcmp(proc, "QueryPerformanceCounter") || + !strcmp(proc, "QueryPerformanceFrequency")){ + OutTraceDW("GetProcAddress: HIDING proc=%s\n", proc); + return NULL; + } + } + if (addr=RemapLibrary(proc, hModule, Hooks)) return addr; if(dxw.dwFlags3 & BUFFEREDIOFIX) @@ -106,14 +135,14 @@ extern void HookModule(HMODULE, int); int WINAPI extIsDebuggerPresent(void) { - OutTraceD("extIsDebuggerPresent: return FALSE\n"); + OutTraceDW("extIsDebuggerPresent: return FALSE\n"); return FALSE; } BOOL WINAPI extGetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters) { BOOL ret; - OutTraceD("GetDiskFreeSpace: RootPathName=\"%s\"\n", lpRootPathName); + OutTraceDW("GetDiskFreeSpace: RootPathName=\"%s\"\n", lpRootPathName); ret=(*pGetDiskFreeSpaceA)(lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters); if(!ret) OutTraceE("GetDiskFreeSpace: ERROR err=%d at %d\n", GetLastError(), __LINE__); *lpNumberOfFreeClusters = 16000; @@ -142,7 +171,7 @@ BIGENOUGH 0x20000000 // surely positive !!! void WINAPI extGlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) { (*pGlobalMemoryStatus)(lpBuffer); - OutTraceD("GlobalMemoryStatus: Length=%x MemoryLoad=%x " + OutTraceDW("GlobalMemoryStatus: Length=%x MemoryLoad=%x " "TotalPhys=%x AvailPhys=%x TotalPageFile=%x AvailPageFile=%x TotalVirtual=%x AvailVirtual=%x\n", lpBuffer->dwMemoryLoad, lpBuffer->dwTotalPhys, lpBuffer->dwAvailPhys, lpBuffer->dwTotalPageFile, lpBuffer->dwAvailPageFile, lpBuffer->dwTotalVirtual, lpBuffer->dwAvailVirtual); @@ -200,7 +229,7 @@ BOOL WINAPI extGetVersionEx(LPOSVERSIONINFO lpVersionInfo) return ret; } - OutTraceD("GetVersionEx: version=%d.%d build=(%d)\n", + OutTraceDW("GetVersionEx: version=%d.%d build=(%d)\n", lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber); if(dxw.dwFlags2 & FAKEVERSION) { @@ -208,7 +237,7 @@ BOOL WINAPI extGetVersionEx(LPOSVERSIONINFO lpVersionInfo) lpVersionInfo->dwMajorVersion = WinVersions[dxw.FakeVersionId].bMajor; lpVersionInfo->dwMinorVersion = WinVersions[dxw.FakeVersionId].bMinor; lpVersionInfo->dwBuildNumber = 0; - OutTraceD("GetVersionEx: FIXED version=%d.%d build=(%d) os=\"%s\"\n", + OutTraceDW("GetVersionEx: FIXED version=%d.%d build=(%d) os=\"%s\"\n", lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber, WinVersions[dxw.FakeVersionId].sName); } @@ -234,14 +263,14 @@ DWORD WINAPI extGetVersion(void) if (dwVersion < 0x80000000) dwBuild = (DWORD)(HIWORD(dwVersion)); - OutTraceD("GetVersion: version=%d.%d build=(%d)\n", dwMajorVersion, dwMinorVersion, dwBuild); + OutTraceDW("GetVersion: version=%d.%d build=(%d)\n", dwMajorVersion, dwMinorVersion, dwBuild); if(dxw.dwFlags2 & FAKEVERSION) { dwVersion = WinVersions[dxw.FakeVersionId].bMajor | (WinVersions[dxw.FakeVersionId].bMinor << 8); dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); dwBuild = (DWORD)(HIWORD(dwVersion)); - OutTraceD("GetVersion: FIXED version=%d.%d build=(%d) os=\"%s\"\n", + OutTraceDW("GetVersion: FIXED version=%d.%d build=(%d) os=\"%s\"\n", dwMajorVersion, dwMinorVersion, dwBuild, WinVersions[dxw.FakeVersionId].sName); } @@ -330,7 +359,7 @@ HMODULE WINAPI LoadLibraryExWrapper(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFl int idx; libhandle=(*pLoadLibraryExA)(lpFileName, hFile, dwFlags); - OutTraceD("%s: FileName=%s hFile=%x Flags=%x(%s) hmodule=%x\n", api, lpFileName, hFile, dwFlags, ExplainLoadLibFlags(dwFlags), libhandle); + OutTraceDW("%s: FileName=%s hFile=%x Flags=%x(%s) hmodule=%x\n", api, lpFileName, hFile, dwFlags, ExplainLoadLibFlags(dwFlags), libhandle); if(!libhandle){ OutTraceE("%s: ERROR FileName=%s err=%d\n", api, lpFileName, GetLastError()); return libhandle; @@ -348,6 +377,13 @@ HMODULE WINAPI LoadLibraryExWrapper(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFl SysLibs[idx]=libhandle; } if (idx == -1) HookModule(libhandle, 0); +#if 0 + switch(idx){ + case SYSLIBIDX_DIRECTDRAW: HookDirectDraw(libhandle, 0); break; + case SYSLIBIDX_DIRECT3D8: HookDirect3D(libhandle, 8); break; + case SYSLIBIDX_DIRECT3D9: HookDirect3D(libhandle, 9); break; + } +#endif return libhandle; } @@ -393,7 +429,7 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc) // If this parameter is an ordinal value, it must be in the low-order word; // the high-order word must be zero. - OutTraceD("GetProcAddress: hModule=%x proc=%s\n", hModule, ProcToString(proc)); + OutTraceDW("GetProcAddress: hModule=%x proc=%s\n", hModule, ProcToString(proc)); for(idx=0; idxHighPart, lpPerformanceCount->LowPart); return ret; } + +BOOL WINAPI extQueryPerformanceFrequency(LARGE_INTEGER *lpPerformanceFrequency) +{ + BOOL ret; + if(dxw.dwFlags4 & NOPERFCOUNTER){ + LARGE_INTEGER myPerfFrequency; + myPerfFrequency.LowPart = 0L; + myPerfFrequency.HighPart = 0L; + *lpPerformanceFrequency=myPerfFrequency; + ret = 0; + } + else + ret=(*pQueryPerformanceFrequency)(lpPerformanceFrequency); + OutTraceDW("QueryPerformanceFrequency: ret=%x Frequency=%x-%x\n", ret, lpPerformanceFrequency->HighPart, lpPerformanceFrequency->LowPart); + return ret; +} \ No newline at end of file diff --git a/dll/msvfw.cpp b/dll/msvfw.cpp index 41be6d0..bc33d64 100644 --- a/dll/msvfw.cpp +++ b/dll/msvfw.cpp @@ -30,7 +30,7 @@ void HookMSV4WLibs(HMODULE module) LRESULT WINAPI extICSendMessage(HIC hic, UINT wMsg, DWORD_PTR dw1, DWORD_PTR dw2) { LRESULT res; - OutTraceD("ICSendMessage: hic=%x wMsg=%x dw1=%x dw2=%x\n", hic, wMsg, dw1, dw2); + OutTraceDW("ICSendMessage: hic=%x wMsg=%x dw1=%x dw2=%x\n", hic, wMsg, dw1, dw2); return 0; res=(*pICSendMessage)(hic, wMsg, dw1, dw2); return res; @@ -38,7 +38,7 @@ LRESULT WINAPI extICSendMessage(HIC hic, UINT wMsg, DWORD_PTR dw1, DWORD_PTR dw2 HIC WINAPI extICOpen(DWORD fccType, DWORD fccHandler, UINT wMode) { - OutTraceD("ICOpen: fccType=%x fccHandler=%x wMode=%x\n", fccType, fccHandler, wMode); + OutTraceDW("ICOpen: fccType=%x fccHandler=%x wMode=%x\n", fccType, fccHandler, wMode); return (HIC)0; } diff --git a/dll/ole32.cpp b/dll/ole32.cpp index dd0c95c..5dadd01 100644 --- a/dll/ole32.cpp +++ b/dll/ole32.cpp @@ -52,7 +52,7 @@ static void HookAdditionalModules() if(hModule){ // --- and now it exists ... HookModule(hModule, 0); // ... then hook it and .. AddedModules[i].Hooked=TRUE; // .. mark it as already hooked - OutTraceD("CoCreateInstance: hooked module=%s hmodule=%x\n", AddedModules[i].ModuleName, hModule); + OutTraceDW("CoCreateInstance: hooked module=%s hmodule=%x\n", AddedModules[i].ModuleName, hModule); //CloseHandle(hModule); // do NOT close this handle } } @@ -73,36 +73,36 @@ static HRESULT STDAPICALLTYPE myCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnk if(res) OutTraceE("CoCreateInstance: ERROR res=%x\n", res); else - OutTraceD("CoCreateInstance: ppv=%x->%x\n", *ppv, *(DWORD *)*ppv); + OutTraceDW("CoCreateInstance: ppv=%x->%x\n", *ppv, *(DWORD *)*ppv); if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DirectDraw){ LPDIRECTDRAW lpOldDDraw; - OutTraceD("CoCreateInstance: CLSID_DirectDraw object\n"); + OutTraceDW("CoCreateInstance: CLSID_DirectDraw object\n"); switch (*(DWORD *)&riid){ case 0x6C14DB80: - OutTraceD("DirectDrawCreate: IID_DirectDraw RIID\n"); + OutTraceDW("DirectDrawCreate: IID_DirectDraw RIID\n"); res=extDirectDrawCreate(NULL, (LPDIRECTDRAW *)&ppv, 0); - if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); break; case 0xB3A6F3E0: - OutTraceD("DirectDrawCreate: IID_DirectDraw2 RIID\n"); + OutTraceDW("DirectDrawCreate: IID_DirectDraw2 RIID\n"); res=extDirectDrawCreate(NULL, &lpOldDDraw, 0); - if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); res=lpOldDDraw->QueryInterface(IID_IDirectDraw2, (LPVOID *)&ppv); - if(res)OutTraceD("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res)); lpOldDDraw->Release(); break; case 0x9c59509a: - OutTraceD("DirectDrawCreate: IID_DirectDraw4 RIID\n"); + OutTraceDW("DirectDrawCreate: IID_DirectDraw4 RIID\n"); res=extDirectDrawCreate(NULL, &lpOldDDraw, 0); - if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); res=lpOldDDraw->QueryInterface(IID_IDirectDraw4, (LPVOID *)&ppv); - if(res)OutTraceD("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res)); lpOldDDraw->Release(); case 0x15e65ec0: - OutTraceD("CoCreateInstance: IID_DirectDraw7 RIID\n"); + OutTraceDW("CoCreateInstance: IID_DirectDraw7 RIID\n"); res=extDirectDrawCreateEx(NULL, (LPDIRECTDRAW *)&ppv, IID_IDirectDraw7, 0); - if(res)OutTraceD("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); break; case 0xe436ebb3: break; @@ -118,43 +118,43 @@ static HRESULT STDAPICALLTYPE myCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnk HRESULT STDAPICALLTYPE extCoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID FAR* ppv) { HRESULT res; - OutTraceD("CoCreateInstance: rclsid=%x UnkOuter=%x ClsContext=%x refiid=%x(%s)\n", + OutTraceDW("CoCreateInstance: rclsid=%x UnkOuter=%x ClsContext=%x refiid=%x(%s)\n", rclsid, pUnkOuter, dwClsContext, riid.Data1, ExplainGUID((GUID *)&riid)); res=(*pCoCreateInstance)(rclsid, pUnkOuter, dwClsContext, riid, ppv); if(res) OutTraceE("CoCreateInstance: ERROR res=%x\n", res); else - OutTraceD("CoCreateInstance: ppv=%x->%x\n", *ppv, *(DWORD *)*ppv); + OutTraceDW("CoCreateInstance: ppv=%x->%x\n", *ppv, *(DWORD *)*ppv); if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DirectDraw){ LPDIRECTDRAW lpOldDDraw; - OutTraceD("CoCreateInstance: CLSID_DirectDraw object\n"); + OutTraceDW("CoCreateInstance: CLSID_DirectDraw object\n"); switch (*(DWORD *)&riid){ case 0x6C14DB80: - OutTraceD("DirectDrawCreate: IID_DirectDraw RIID\n"); + OutTraceDW("DirectDrawCreate: IID_DirectDraw RIID\n"); res=extDirectDrawCreate(NULL, (LPDIRECTDRAW *)&ppv, 0); - if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); break; case 0xB3A6F3E0: - OutTraceD("DirectDrawCreate: IID_DirectDraw2 RIID\n"); + OutTraceDW("DirectDrawCreate: IID_DirectDraw2 RIID\n"); res=extDirectDrawCreate(NULL, &lpOldDDraw, 0); - if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); res=lpOldDDraw->QueryInterface(IID_IDirectDraw2, (LPVOID *)&ppv); - if(res)OutTraceD("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res)); lpOldDDraw->Release(); break; case 0x9c59509a: - OutTraceD("DirectDrawCreate: IID_DirectDraw4 RIID\n"); + OutTraceDW("DirectDrawCreate: IID_DirectDraw4 RIID\n"); res=extDirectDrawCreate(NULL, &lpOldDDraw, 0); - if(res)OutTraceD("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreate: res=%x(%s)\n", res, ExplainDDError(res)); res=lpOldDDraw->QueryInterface(IID_IDirectDraw4, (LPVOID *)&ppv); - if(res)OutTraceD("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("QueryInterface: res=%x(%s)\n", res, ExplainDDError(res)); lpOldDDraw->Release(); case 0x15e65ec0: - OutTraceD("CoCreateInstance: IID_DirectDraw7 RIID\n"); + OutTraceDW("CoCreateInstance: IID_DirectDraw7 RIID\n"); res=extDirectDrawCreateEx(NULL, (LPDIRECTDRAW *)&ppv, IID_IDirectDraw7, 0); - if(res)OutTraceD("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); break; case 0xe436ebb3: break; @@ -172,7 +172,7 @@ HRESULT STDAPICALLTYPE extCoCreateInstanceEx(REFCLSID rclsid, IUnknown *punkOute HRESULT res; DWORD i; - OutTraceD("CoCreateInstanceEx: rclsid=%x UnkOuter=%x ClsContext=%x Count=%d\n", + OutTraceDW("CoCreateInstanceEx: rclsid=%x UnkOuter=%x ClsContext=%x Count=%d\n", rclsid, punkOuter, dwClsCtx, dwCount); res=(*pCoCreateInstanceEx)(rclsid, punkOuter, dwClsCtx, pServerInfo, dwCount, pResults); @@ -194,40 +194,40 @@ HRESULT STDAPICALLTYPE extCoCreateInstanceEx(REFCLSID rclsid, IUnknown *punkOute // quartz.dll must be hooked. if (*(DWORD *)&rclsid==0xe436ebb3){ HMODULE qlib; - OutTraceD("CoCreateInstanceEx: CLSID_FilterGraph RIID=%x\n", *(DWORD *)&riid); + OutTraceDW("CoCreateInstanceEx: CLSID_FilterGraph RIID=%x\n", *(DWORD *)&riid); qlib=(*pLoadLibraryA)("quartz.dll"); - OutTraceD("CoCreateInstanceEx: quartz lib handle=%x\n", qlib); + OutTraceDW("CoCreateInstanceEx: quartz lib handle=%x\n", qlib); HookModule(qlib, 0); } if (*(DWORD *)&rclsid==*(DWORD *)&CLSID_DirectDraw){ LPDIRECTDRAW lpOldDDraw; - OutTraceD("CoCreateInstanceEx: CLSID_DirectDraw object\n"); + OutTraceDW("CoCreateInstanceEx: CLSID_DirectDraw object\n"); switch (*(DWORD *)&riid){ case 0x6C14DB80: - OutTraceD("DirectDrawCreateEx: IID_DirectDraw RIID\n"); + OutTraceDW("DirectDrawCreateEx: IID_DirectDraw RIID\n"); res=extDirectDrawCreate(NULL, (LPDIRECTDRAW *)&ppv, 0); - if(res)OutTraceD("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); break; case 0xB3A6F3E0: - OutTraceD("DirectDrawCreateEx: IID_DirectDraw2 RIID\n"); + OutTraceDW("DirectDrawCreateEx: IID_DirectDraw2 RIID\n"); res=extDirectDrawCreate(NULL, &lpOldDDraw, 0); - if(res)OutTraceD("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); res=lpOldDDraw->QueryInterface(IID_IDirectDraw2, (LPVOID *)&ppv); - if(res)OutTraceD("QueryInterfaceEx: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("QueryInterfaceEx: res=%x(%s)\n", res, ExplainDDError(res)); lpOldDDraw->Release(); break; case 0x9c59509a: - OutTraceD("DirectDrawCreateEx: IID_DirectDraw4 RIID\n"); + OutTraceDW("DirectDrawCreateEx: IID_DirectDraw4 RIID\n"); res=extDirectDrawCreate(NULL, &lpOldDDraw, 0); - if(res)OutTraceD("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); res=lpOldDDraw->QueryInterface(IID_IDirectDraw4, (LPVOID *)&ppv); - if(res)OutTraceD("QueryInterfaceEx: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("QueryInterfaceEx: res=%x(%s)\n", res, ExplainDDError(res)); lpOldDDraw->Release(); case 0x15e65ec0: - OutTraceD("CoCreateInstanceEx: IID_DirectDraw7 RIID\n"); + OutTraceDW("CoCreateInstanceEx: IID_DirectDraw7 RIID\n"); res=extDirectDrawCreateEx(NULL, (LPDIRECTDRAW *)&ppv, IID_IDirectDraw7, 0); - if(res)OutTraceD("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); + if(res)OutTraceDW("DirectDrawCreateEx: res=%x(%s)\n", res, ExplainDDError(res)); break; case 0xe436ebb3: break; @@ -244,7 +244,7 @@ HRESULT STDAPICALLTYPE extCoCreateInstanceEx(REFCLSID rclsid, IUnknown *punkOute HRESULT WINAPI extCoInitialize(LPVOID pvReserved) { HRESULT res; - OutTraceD("CoInitialize: Reserved=%x\n", pvReserved); + OutTraceDW("CoInitialize: Reserved=%x\n", pvReserved); res=(*pCoInitialize)(pvReserved); return res; } diff --git a/dll/opengl.cpp b/dll/opengl.cpp index 5c83dfb..5f6606a 100644 --- a/dll/opengl.cpp +++ b/dll/opengl.cpp @@ -49,7 +49,7 @@ static FARPROC wglRemapLibrary(LPCSTR proc, HookEntry_Type *Hooks) Hook=&Hooks[i]; if (!strcmp(proc,Hook->APIName)){ if (Hook->StoreAddress) *(Hook->StoreAddress)=(*pwglGetProcAddress)(proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), (Hook->StoreAddress) ? *(Hook->StoreAddress) : 0); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), (Hook->StoreAddress) ? *(Hook->StoreAddress) : 0); return Hook->HookerAddress; } } @@ -154,7 +154,7 @@ void HookOpenGLLibs(HMODULE module, char *customlib) if (!customlib) customlib=DefOpenGLModule; - OutTraceD("HookOpenGLLibs module=%x lib=\"%s\" forced=%x\n", module, customlib, (dxw.dwFlags3 & FORCEHOOKOPENGL)?1:0); + OutTraceDW("HookOpenGLLibs module=%x lib=\"%s\" forced=%x\n", module, customlib, (dxw.dwFlags3 & FORCEHOOKOPENGL)?1:0); if (dxw.dwFlags3 & FORCEHOOKOPENGL) ForceHookOpenGL(module); else @@ -169,14 +169,14 @@ void WINAPI extglViewport(GLint x, GLint y, GLsizei width, GLsizei height POINT p={0,0}; //if (dxw.dwFlags2 & HANDLEFPS) if(dxw.HandleFPS()) return; (*pGetClientRect)(dxw.GethWnd(), &client); - OutTraceD("glViewport: declared pos=(%d,%d) size=(%d,%d)\n", x, y, width, height); + OutTraceDW("glViewport: declared pos=(%d,%d) size=(%d,%d)\n", x, y, width, height); if(IsDebug) OutTrace("glViewport: DEBUG win=(%d,%d) screen=(%d,%d)\n", client.right, client.bottom, dxw.GetScreenWidth(), dxw.GetScreenHeight()); x = (x * (GLint)client.right) / (GLint)dxw.GetScreenWidth(); y = (y * (GLint)client.bottom) / (GLint)dxw.GetScreenHeight(); width = (width * (GLint)client.right) / (GLint)dxw.GetScreenWidth(); height = (height * (GLint)client.bottom) / (GLint)dxw.GetScreenHeight(); - OutTraceD("glViewport: remapped pos=(%d,%d) size=(%d,%d)\n", x, y, width, height); + OutTraceDW("glViewport: remapped pos=(%d,%d) size=(%d,%d)\n", x, y, width, height); (*pglViewport)(x, y, width, height); } @@ -186,19 +186,19 @@ void WINAPI extglScissor(GLint x, GLint y, GLsizei width, GLsizei height) POINT p={0,0}; //if (dxw.dwFlags2 & HANDLEFPS) if(dxw.HandleFPS()) return; (*pGetClientRect)(dxw.GethWnd(), &client); - OutTraceD("glScissor: declared pos=(%d,%d) size=(%d,%d)\n", x, y, width, height); + OutTraceDW("glScissor: declared pos=(%d,%d) size=(%d,%d)\n", x, y, width, height); x = (x * (GLint)client.right) / (GLint)dxw.GetScreenWidth(); y = (y * (GLint)client.bottom) / (GLint)dxw.GetScreenHeight(); width = (width * (GLint)client.right) / (GLint)dxw.GetScreenWidth(); height = (height * (GLint)client.bottom) / (GLint)dxw.GetScreenHeight(); - OutTraceD("glScissor: remapped pos=(%d,%d) size=(%d,%d)\n", x, y, width, height); + OutTraceDW("glScissor: remapped pos=(%d,%d) size=(%d,%d)\n", x, y, width, height); (*pglScissor)(x, y, width, height); } void WINAPI extglGetIntegerv(GLenum pname, GLint *params) { (*pglGetIntegerv)(pname, params); - OutTraceD("glGetIntegerv: pname=%d\n", pname); + OutTraceDW("glGetIntegerv: pname=%d\n", pname); } void WINAPI extglDrawBuffer(GLenum mode) @@ -224,8 +224,8 @@ void WINAPI extglDrawBuffer(GLenum mode) void WINAPI extglPolygonMode(GLenum face, GLenum mode) { - OutTraceD("glPolygonMode: face=%x mode=%x\n", face, mode); - //OutTraceD("glPolygonMode: extglPolygonMode=%x pglPolygonMode=%x\n", extglPolygonMode, pglPolygonMode); + OutTraceDW("glPolygonMode: face=%x mode=%x\n", face, mode); + //OutTraceDW("glPolygonMode: extglPolygonMode=%x pglPolygonMode=%x\n", extglPolygonMode, pglPolygonMode); if(dxw.dwFlags2 & WIREFRAME) mode = GL_LINE; // trick to set wireframe mode.... (*pglPolygonMode)(face, mode); return; @@ -233,7 +233,7 @@ void WINAPI extglPolygonMode(GLenum face, GLenum mode) void WINAPI extglGetFloatv(GLenum pname, GLboolean *params) { - OutTraceD("glGetFloatv: pname=%x\n", pname); + OutTraceDW("glGetFloatv: pname=%x\n", pname); (*pglGetFloatv)(pname, params); return; } @@ -247,22 +247,22 @@ void WINAPI extglClear(GLbitfield mask) HGLRC WINAPI extwglCreateContext(HDC hdc) { HGLRC ret; - OutTraceD("wglCreateContext: hdc=%x\n", hdc); + OutTraceDW("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); + OutTraceDW("wglCreateContext: remapped desktop hdc=%x->%x\n", oldhdc, hdc); } ret=(*pwglCreateContext)(hdc); if(ret){ HWND hwnd; hwnd=WindowFromDC(hdc); dxw.SethWnd(hwnd); - OutTraceD("wglCreateContext: SET hwnd=%x\n", hwnd); + OutTraceDW("wglCreateContext: SET hwnd=%x\n", hwnd); } else { - OutTraceD("wglCreateContext: ERROR err=%x\n", GetLastError()); + OutTraceDW("wglCreateContext: ERROR err=%x\n", GetLastError()); } return ret; } @@ -271,7 +271,7 @@ PROC WINAPI extwglGetProcAddress(LPCSTR proc) { PROC procaddr; - OutTraceD("wglGetProcAddress: proc=%s\n", proc); + OutTraceDW("wglGetProcAddress: proc=%s\n", proc); procaddr=Remap_wgl_ProcAddress(proc); if (!procaddr) procaddr=(*pwglGetProcAddress)(proc); return procaddr; @@ -287,18 +287,18 @@ BOOL WINAPI extwglMakeCurrent(HDC hdc, HGLRC hglrc) { BOOL ret; - OutTraceD("wglMakeCurrent: hdc=%x hglrc=%x\n", hdc, hglrc); + OutTraceDW("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); + OutTraceDW("wglMakeCurrent: remapped desktop hdc=%x->%x\n", oldhdc, hdc); } ret=(*pwglMakeCurrent)(hdc, hglrc); if(ret){ HWND hWnd; hWnd = WindowFromDC(hdc); - OutTraceD("wglMakeCurrent: setting hwnd=%x\n", hWnd); + OutTraceDW("wglMakeCurrent: setting hwnd=%x\n", hWnd); dxw.SethWnd(hWnd); } return ret; diff --git a/dll/smack.cpp b/dll/smack.cpp index bb71d1a..7215425 100644 --- a/dll/smack.cpp +++ b/dll/smack.cpp @@ -26,7 +26,7 @@ FARPROC Remap_smack_ProcAddress(LPCSTR proc, HMODULE hModule) { if (!strcmp(proc,"_SmackOpen@12") && !pSmackOpen){ pSmackOpen=(SmackOpen_Type)(*pGetProcAddress)(hModule, proc); - OutTraceD("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pSmackOpen); + OutTraceDW("GetProcAddress: hooking proc=%s at addr=%x\n", ProcToString(proc), pSmackOpen); return (FARPROC)extSmackOpen; } // NULL -> keep the original call address @@ -36,12 +36,12 @@ FARPROC Remap_smack_ProcAddress(LPCSTR proc, HMODULE hModule) SmackStruct * WINAPI extSmackOpen(HANDLE SmackFile, UINT32 flags, INT32 unknown) { SmackStruct *ret; - OutTraceD("SmackOpen: SmackFile=%x flags=%x unknown=%x\n", SmackFile, flags, unknown); + OutTraceDW("SmackOpen: SmackFile=%x flags=%x unknown=%x\n", SmackFile, flags, unknown); if(!pSmackOpen) OutTraceE("ASSERT: NULL pSmackOpen\n"); ret=(*pSmackOpen)(SmackFile, flags, unknown); - OutTraceD("SmackOpen: ret=%x\n", ret); + OutTraceDW("SmackOpen: ret=%x\n", ret); if (ret) { - OutTraceD("SmackOpen: version=%x screen=(%dx%d) frame_count=%d frame_number=%d\n", + OutTraceDW("SmackOpen: version=%x screen=(%dx%d) frame_count=%d frame_number=%d\n", ret->version, ret->width, ret->height, ret->frame_count, ret->frame_number); //ret->width=800; //ret->height=600; diff --git a/dll/syslibs.h b/dll/syslibs.h index 965b91a..2d78da2 100644 --- a/dll/syslibs.h +++ b/dll/syslibs.h @@ -120,6 +120,7 @@ typedef DWORD (WINAPI *SetFilePointer_Type)(HANDLE, LONG, PLONG, DWORD); typedef BOOL (WINAPI *CloseHandle_Type)(HANDLE); typedef BOOL (WINAPI *QueryPerformanceFrequency_Type)(LARGE_INTEGER *); typedef BOOL (WINAPI *QueryPerformanceCounter_Type)(LARGE_INTEGER *); +typedef BOOL (WINAPI *QueryPerformanceFrequency_Type)(LARGE_INTEGER *); // ole32.dll: typedef HRESULT (STDAPICALLTYPE *CoCreateInstance_Type)(REFCLSID, LPUNKNOWN, DWORD, REFIID, LPVOID FAR*); @@ -129,8 +130,10 @@ typedef HRESULT (STDAPICALLTYPE *CoInitialize_Type)(LPVOID); // user32.dll: typedef HDC (WINAPI *BeginPaint_Type)(HWND, LPPAINTSTRUCT); typedef LRESULT (WINAPI *CallWindowProc_Type)(WNDPROC, HWND, UINT, WPARAM, LPARAM); -typedef LONG (WINAPI *ChangeDisplaySettings_Type)(DEVMODE *, DWORD); -typedef LONG (WINAPI *ChangeDisplaySettingsEx_Type)(LPCTSTR, DEVMODE *, HWND, DWORD, LPVOID); +typedef LONG (WINAPI *ChangeDisplaySettingsA_Type)(DEVMODEA *, DWORD); +typedef LONG (WINAPI *ChangeDisplaySettingsExA_Type)(LPCTSTR, DEVMODEA *, HWND, DWORD, LPVOID); +typedef LONG (WINAPI *ChangeDisplaySettingsW_Type)(DEVMODEW *, DWORD); +typedef LONG (WINAPI *ChangeDisplaySettingsExW_Type)(LPCTSTR, DEVMODEW *, HWND, DWORD, LPVOID); typedef BOOL (WINAPI *ClientToScreen_Type)(HWND, LPPOINT); typedef BOOL (WINAPI *ClipCursor_Type)(const RECT *); typedef HWND (WINAPI *CreateDialogIndirectParam_Type)(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM); @@ -314,8 +317,10 @@ DXWEXTERN CoInitialize_Type pCoInitialize DXWINITIALIZED; // user32.dll: DXWEXTERN BeginPaint_Type pBeginPaint DXWINITIALIZED; DXWEXTERN CallWindowProc_Type pCallWindowProc DXWINITIALIZED; -DXWEXTERN ChangeDisplaySettings_Type pChangeDisplaySettings DXWINITIALIZED; -DXWEXTERN ChangeDisplaySettingsEx_Type pChangeDisplaySettingsEx DXWINITIALIZED; +DXWEXTERN ChangeDisplaySettingsA_Type pChangeDisplaySettingsA DXWINITIALIZED; +DXWEXTERN ChangeDisplaySettingsExA_Type pChangeDisplaySettingsExA DXWINITIALIZED; +DXWEXTERN ChangeDisplaySettingsW_Type pChangeDisplaySettingsW DXWINITIALIZED; +DXWEXTERN ChangeDisplaySettingsExW_Type pChangeDisplaySettingsExW DXWINITIALIZED; DXWEXTERN ClientToScreen_Type pClientToScreen DXWINITIALIZED; DXWEXTERN ClipCursor_Type pClipCursor DXWINITIALIZED; DXWEXTERN CreateDialogIndirectParam_Type pCreateDialogIndirectParam DXWINITIALIZED; @@ -495,8 +500,10 @@ extern HRESULT STDAPICALLTYPE extCoInitialize(LPVOID); // user32.dll: extern HDC WINAPI extBeginPaint(HWND, LPPAINTSTRUCT); extern LRESULT WINAPI extCallWindowProc(WNDPROC, HWND, UINT, WPARAM, LPARAM); -extern LONG WINAPI extChangeDisplaySettings(DEVMODE *, DWORD); -extern LONG WINAPI extChangeDisplaySettingsEx(LPCTSTR, DEVMODE *, HWND, DWORD, LPVOID); +extern LONG WINAPI extChangeDisplaySettingsA(DEVMODEA *, DWORD); +extern LONG WINAPI extChangeDisplaySettingsExA(LPCTSTR, DEVMODEA *, HWND, DWORD, LPVOID); +extern LONG WINAPI extChangeDisplaySettingsW(DEVMODEW *, DWORD); +extern LONG WINAPI extChangeDisplaySettingsExW(LPCTSTR, DEVMODEW *, HWND, DWORD, LPVOID); extern BOOL WINAPI extClientToScreen(HWND, LPPOINT); extern BOOL WINAPI extClipCursor(LPRECT); extern HWND WINAPI extCreateDialogIndirectParam(HINSTANCE, LPCDLGTEMPLATE, HWND, DLGPROC, LPARAM); diff --git a/dll/user32.cpp b/dll/user32.cpp index 228ffb0..e3b1e52 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -15,8 +15,10 @@ static HookEntry_Type Hooks[]={ {"UpdateWindow", (FARPROC)NULL, (FARPROC *)&pUpdateWindow, (FARPROC)extUpdateWindow}, //{"GetWindowPlacement", (FARPROC)NULL, (FARPROC *)&pGetWindowPlacement, (FARPROC)extGetWindowPlacement}, //{"SetWindowPlacement", (FARPROC)NULL, (FARPROC *)&pSetWindowPlacement, (FARPROC)extSetWindowPlacement}, - {"ChangeDisplaySettingsA", (FARPROC)ChangeDisplaySettingsA, (FARPROC *)&pChangeDisplaySettings, (FARPROC)extChangeDisplaySettings}, - {"ChangeDisplaySettingsExA", (FARPROC)ChangeDisplaySettingsA, (FARPROC *)&pChangeDisplaySettingsEx, (FARPROC)extChangeDisplaySettingsEx}, + {"ChangeDisplaySettingsA", (FARPROC)ChangeDisplaySettingsA, (FARPROC *)&pChangeDisplaySettingsA, (FARPROC)extChangeDisplaySettingsA}, + {"ChangeDisplaySettingsExA", (FARPROC)NULL, (FARPROC *)&pChangeDisplaySettingsExA, (FARPROC)extChangeDisplaySettingsExA}, + {"ChangeDisplaySettingsW", (FARPROC)NULL, (FARPROC *)&pChangeDisplaySettingsW, (FARPROC)extChangeDisplaySettingsW}, // ref. by Knights of Honor + {"ChangeDisplaySettingsExW", (FARPROC)NULL, (FARPROC *)&pChangeDisplaySettingsExW, (FARPROC)extChangeDisplaySettingsExW}, {"BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extBeginPaint}, {"EndPaint", (FARPROC)EndPaint, (FARPROC *)&pEndPaint, (FARPROC)extEndPaint}, {"ShowCursor", (FARPROC)ShowCursor, (FARPROC *)&pShowCursor, (FARPROC)extShowCursor}, @@ -199,7 +201,74 @@ extern HRESULT WINAPI sBlt(char *, LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURF extern INT_PTR CALLBACK extDialogWindowProc(HWND, UINT, WPARAM, LPARAM); -LONG WINAPI MyChangeDisplaySettings(char *fname, DEVMODE *lpDevMode, DWORD dwflags) +LONG WINAPI MyChangeDisplaySettings(char *fname, BOOL WideChar, void *lpDevMode, DWORD dwflags) +{ + HRESULT res; + DWORD dmFields, dmBitsPerPel, dmPelsWidth, dmPelsHeight; + + // v2.02.32: reset the emulated DC used in EMULATEDC mode + dxw.ResetEmulatedDC(); + + if(lpDevMode){ + if(WideChar){ + dmFields=((DEVMODEW *)lpDevMode)->dmFields; + dmPelsWidth=((DEVMODEW *)lpDevMode)->dmPelsWidth; + dmPelsHeight=((DEVMODEW *)lpDevMode)->dmPelsHeight; + dmBitsPerPel=((DEVMODEW *)lpDevMode)->dmBitsPerPel; + } + else{ + dmFields=((DEVMODEA *)lpDevMode)->dmFields; + dmPelsWidth=((DEVMODEA *)lpDevMode)->dmPelsWidth; + dmPelsHeight=((DEVMODEA *)lpDevMode)->dmPelsHeight; + dmBitsPerPel=((DEVMODEA *)lpDevMode)->dmBitsPerPel; + } + } + + // 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 && (dmFields & (DM_PELSWIDTH | DM_PELSHEIGHT))){ + RECT client; + dxw.SetScreenSize(dmPelsWidth, 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); + OutTraceDW("%s: current hWnd=%x size=(%d,%d)\n", fname, dxw.GethWnd(), client.right, client.bottom); + if((client.right>=(LONG)dmPelsWidth) && (client.bottom>=(LONG)dmPelsHeight)) { + OutTraceDW("%s: entering FULLSCREEN mode\n", fname); + dxw.SetFullScreen(TRUE); + } + } + + if ((dwflags==0 || dwflags==CDS_FULLSCREEN) && lpDevMode){ + if (dxw.dwFlags1 & EMULATESURFACE || !(dmFields & DM_BITSPERPEL)){ + OutTraceDW("%s: BYPASS res=DISP_CHANGE_SUCCESSFUL\n", fname); + return DISP_CHANGE_SUCCESSFUL; + } + else{ + DEVMODEA NewMode; + if(dwflags==CDS_FULLSCREEN) dwflags=0; // no FULLSCREEN + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &NewMode); + OutTraceDW("ChangeDisplaySettings: CURRENT wxh=(%dx%d) BitsPerPel=%d -> %d\n", + NewMode.dmPelsWidth, NewMode.dmPelsHeight, NewMode.dmBitsPerPel, dmBitsPerPel); + NewMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; + NewMode.dmBitsPerPel = dmBitsPerPel; + res=(*pChangeDisplaySettingsA)(&NewMode, 0); + if(res) OutTraceE("ChangeDisplaySettings: ERROR err=%d at %d\n", GetLastError(), __LINE__); + return res; + } + } + else{ + if(WideChar) + return (*pChangeDisplaySettingsW)((LPDEVMODEW)lpDevMode, dwflags); + else + return (*pChangeDisplaySettingsA)((LPDEVMODEA)lpDevMode, dwflags); + } +} + +#if 0 +LONG WINAPI MyChangeDisplaySettingsA(char *fname, DEVMODEA *lpDevMode, DWORD dwflags) { HRESULT res; @@ -215,36 +284,83 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, DEVMODE *lpDevMode, DWORD dwfla // 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); + OutTraceDW("%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); + OutTraceDW("%s: entering FULLSCREEN mode\n", fname); dxw.SetFullScreen(TRUE); } } if ((dwflags==0 || dwflags==CDS_FULLSCREEN) && lpDevMode){ if (dxw.dwFlags1 & EMULATESURFACE || !(lpDevMode->dmFields & DM_BITSPERPEL)){ - OutTraceD("%s: BYPASS res=DISP_CHANGE_SUCCESSFUL\n", fname); + OutTraceDW("%s: BYPASS res=DISP_CHANGE_SUCCESSFUL\n", fname); return DISP_CHANGE_SUCCESSFUL; } else{ - DEVMODE NewMode; + DEVMODEA NewMode; if(dwflags==CDS_FULLSCREEN) dwflags=0; // no FULLSCREEN EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &NewMode); - OutTraceD("ChangeDisplaySettings: CURRENT wxh=(%dx%d) BitsPerPel=%d -> %d\n", + OutTraceDW("ChangeDisplaySettings: CURRENT wxh=(%dx%d) BitsPerPel=%d -> %d\n", NewMode.dmPelsWidth, NewMode.dmPelsHeight, NewMode.dmBitsPerPel, lpDevMode->dmBitsPerPel); NewMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; NewMode.dmBitsPerPel = lpDevMode->dmBitsPerPel; - res=(*pChangeDisplaySettings)(&NewMode, 0); + res=(*pChangeDisplaySettingsA)(&NewMode, 0); if(res) OutTraceE("ChangeDisplaySettings: ERROR err=%d at %d\n", GetLastError(), __LINE__); return res; } } else - return (*pChangeDisplaySettings)(lpDevMode, dwflags); + return (*pChangeDisplaySettingsA)(lpDevMode, dwflags); } +LONG WINAPI MyChangeDisplaySettingsW(char *fname, DEVMODEW *lpDevMode, DWORD dwflags) +{ + HRESULT res; + + // v2.02.32: reset the emulated DC used in EMULATEDC mode + dxw.ResetEmulatedDC(); + + // 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))){ + 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); + OutTraceDW("%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)) { + OutTraceDW("%s: entering FULLSCREEN mode\n", fname); + dxw.SetFullScreen(TRUE); + } + } + + if ((dwflags==0 || dwflags==CDS_FULLSCREEN) && lpDevMode){ + if (dxw.dwFlags1 & EMULATESURFACE || !(lpDevMode->dmFields & DM_BITSPERPEL)){ + OutTraceDW("%s: BYPASS res=DISP_CHANGE_SUCCESSFUL\n", fname); + return DISP_CHANGE_SUCCESSFUL; + } + else{ + DEVMODEA NewMode; + if(dwflags==CDS_FULLSCREEN) dwflags=0; // no FULLSCREEN + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &NewMode); + OutTraceDW("ChangeDisplaySettings: CURRENT wxh=(%dx%d) BitsPerPel=%d -> %d\n", + NewMode.dmPelsWidth, NewMode.dmPelsHeight, NewMode.dmBitsPerPel, + lpDevMode->dmBitsPerPel); + NewMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; + NewMode.dmBitsPerPel = lpDevMode->dmBitsPerPel; + res=(*pChangeDisplaySettingsA)(&NewMode, 0); + if(res) OutTraceE("ChangeDisplaySettings: ERROR err=%d at %d\n", GetLastError(), __LINE__); + return res; + } + } + else + return (*pChangeDisplaySettingsW)(lpDevMode, dwflags); +} +#endif + void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) { LPWINDOWPOS wp; @@ -259,7 +375,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) static int BorderY=-1; int cx, cy; - OutTraceD("%s: GOT hwnd=%x pos=(%d,%d) dim=(%d,%d) Flags=%x(%s)\n", + OutTraceDW("%s: GOT hwnd=%x pos=(%d,%d) dim=(%d,%d) Flags=%x(%s)\n", ApiName, hwnd, wp->x, wp->y, wp->cx, wp->cy, wp->flags, ExplainWPFlags(wp->flags)); if (dxw.dwFlags1 & PREVENTMAXIMIZE){ @@ -268,7 +384,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) if(wp->cx>MaxX) { wp->cx=MaxX; UpdFlag=1; } if(wp->cy>MaxY) { wp->cy=MaxY; UpdFlag=1; } if (UpdFlag) - OutTraceD("%s: SET max dim=(%d,%d)\n", ApiName, wp->cx, wp->cy); + OutTraceDW("%s: SET max dim=(%d,%d)\n", ApiName, wp->cx, wp->cy); } if ((wp->flags & (SWP_NOMOVE|SWP_NOSIZE))==(SWP_NOMOVE|SWP_NOSIZE)) return; //v2.02.13 @@ -276,7 +392,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen() && (hwnd==dxw.GethWnd())){ extern void CalculateWindowPos(HWND, DWORD, DWORD, LPWINDOWPOS); CalculateWindowPos(hwnd, MaxX, MaxY, wp); - OutTraceD("%s: LOCK pos=(%d,%d) dim=(%d,%d)\n", ApiName, wp->x, wp->y, wp->cx, wp->cy); + OutTraceDW("%s: LOCK pos=(%d,%d) dim=(%d,%d)\n", ApiName, wp->x, wp->y, wp->cx, wp->cy); } if ((dxw.dwFlags2 & KEEPASPECTRATIO) && dxw.IsFullScreen() && (hwnd==dxw.GethWnd())){ @@ -290,7 +406,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) (*pGetWindowRect)(hwnd, &full); BorderX= full.right - full.left - client.right; BorderY= full.bottom - full.top - client.bottom; - OutTraceD("%s: KEEPASPECTRATIO window borders=(%d,%d)\n", ApiName, BorderX, BorderY); + OutTraceDW("%s: KEEPASPECTRATIO window borders=(%d,%d)\n", ApiName, BorderX, BorderY); } extern LRESULT LastCursorPos; switch (LastCursorPos){ @@ -302,7 +418,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) case HTTOPRIGHT: cx = BorderX + ((wp->cy - BorderY) * dxw.GetScreenWidth()) / dxw.GetScreenHeight(); if(cx!=wp->cx){ - OutTraceD("%s: KEEPASPECTRATIO adjusted cx=%d->%d\n", ApiName, wp->cx, cx); + OutTraceDW("%s: KEEPASPECTRATIO adjusted cx=%d->%d\n", ApiName, wp->cx, cx); wp->cx = cx; } break; @@ -310,7 +426,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) case HTRIGHT: cy = BorderY + ((wp->cx - BorderX) * dxw.GetScreenHeight()) / dxw.GetScreenWidth(); if(cy!=wp->cy){ - OutTraceD("%s: KEEPASPECTRATIO adjusted cy=%d->%d\n", ApiName, wp->cy, cy); + OutTraceDW("%s: KEEPASPECTRATIO adjusted cy=%d->%d\n", ApiName, wp->cy, cy); wp->cy = cy; } break; @@ -326,7 +442,7 @@ void dxwFixMinMaxInfo(char *ApiName, HWND hwnd, LPARAM lParam) if (dxw.dwFlags1 & PREVENTMAXIMIZE){ LPMINMAXINFO lpmmi; lpmmi=(LPMINMAXINFO)lParam; - OutTraceD("%s: GOT MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName, + OutTraceDW("%s: GOT MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName, lpmmi->ptMaxPosition.x, lpmmi->ptMaxPosition.y, lpmmi->ptMaxSize.x, lpmmi->ptMaxSize.y); lpmmi->ptMaxPosition.x=0; lpmmi->ptMaxPosition.y=0; @@ -338,7 +454,7 @@ void dxwFixMinMaxInfo(char *ApiName, HWND hwnd, LPARAM lParam) lpmmi->ptMaxSize.x = dxw.GetScreenWidth(); lpmmi->ptMaxSize.y = dxw.GetScreenHeight(); } - OutTraceD("%s: SET PREVENTMAXIMIZE MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName, + OutTraceDW("%s: SET PREVENTMAXIMIZE MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName, lpmmi->ptMaxPosition.x, lpmmi->ptMaxPosition.y, lpmmi->ptMaxSize.x, lpmmi->ptMaxSize.y); } // v2.1.75: added logic to fix win coordinates to selected ones. @@ -346,13 +462,13 @@ void dxwFixMinMaxInfo(char *ApiName, HWND hwnd, LPARAM lParam) if (dxw.dwFlags1 & LOCKWINPOS){ LPMINMAXINFO lpmmi; lpmmi=(LPMINMAXINFO)lParam; - OutTraceD("%s: GOT MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName, + OutTraceDW("%s: GOT MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName, lpmmi->ptMaxPosition.x, lpmmi->ptMaxPosition.y, lpmmi->ptMaxSize.x, lpmmi->ptMaxSize.y); lpmmi->ptMaxPosition.x=dxw.iPosX; lpmmi->ptMaxPosition.y=dxw.iPosY; lpmmi->ptMaxSize.x = dxw.iSizX ? dxw.iSizX : dxw.GetScreenWidth(); lpmmi->ptMaxSize.y = dxw.iSizY ? dxw.iSizY : dxw.GetScreenHeight(); - OutTraceD("%s: SET LOCKWINPOS MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName, + OutTraceDW("%s: SET LOCKWINPOS MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName, lpmmi->ptMaxPosition.x, lpmmi->ptMaxPosition.y, lpmmi->ptMaxSize.x, lpmmi->ptMaxSize.y); } } @@ -367,7 +483,7 @@ static LRESULT WINAPI FixWindowProc(char *ApiName, HWND hwnd, UINT Msg, WPARAM w switch(Msg){ case WM_ERASEBKGND: - OutTraceD("%s: prevent erase background\n", ApiName); + OutTraceDW("%s: prevent erase background\n", ApiName); return 1; // 1=erased break; // useless case WM_GETMINMAXINFO: @@ -385,11 +501,11 @@ static LRESULT WINAPI FixWindowProc(char *ApiName, HWND hwnd, UINT Msg, WPARAM w if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()) return 0; if (dxw.dwFlags1 & PREVENTMAXIMIZE){ if ((wParam == SIZE_MAXIMIZED)||(wParam == SIZE_MAXSHOW)){ - OutTraceD("%s: prevent screen SIZE to fullscreen wparam=%d(%s) size=(%d,%d)\n", ApiName, + OutTraceDW("%s: prevent screen SIZE to fullscreen wparam=%d(%s) size=(%d,%d)\n", ApiName, wParam, ExplainResizing(wParam), HIWORD(lParam), LOWORD(lParam)); return 0; // checked //lParam = MAKELPARAM(dxw.GetScreenWidth(), dxw.GetScreenHeight()); - //OutTraceD("%s: updated SIZE wparam=%d(%s) size=(%d,%d)\n", ApiName, + //OutTraceDW("%s: updated SIZE wparam=%d(%s) size=(%d,%d)\n", ApiName, // wParam, ExplainResizing(wParam), HIWORD(lParam), LOWORD(lParam)); } } @@ -442,10 +558,10 @@ static POINT FixMessagePt(HWND hwnd, POINT point) BOOL WINAPI extDDInvalidateRect(HWND hwnd, RECT *lpRect, BOOL bErase) { if(lpRect) - OutTraceD("InvalidateRect: hwnd=%x rect=(%d,%d)-(%d,%d) erase=%x\n", + OutTraceDW("InvalidateRect: hwnd=%x rect=(%d,%d)-(%d,%d) erase=%x\n", hwnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, bErase); else - OutTraceD("InvalidateRect: hwnd=%x rect=NULL erase=%x\n", + OutTraceDW("InvalidateRect: hwnd=%x rect=NULL erase=%x\n", hwnd, bErase); return (*pInvalidateRect)(hwnd, NULL, bErase); @@ -454,10 +570,10 @@ BOOL WINAPI extDDInvalidateRect(HWND hwnd, RECT *lpRect, BOOL bErase) BOOL WINAPI extInvalidateRect(HWND hwnd, RECT *lpRect, BOOL bErase) { if(lpRect) - OutTraceD("InvalidateRect: hwnd=%x rect=(%d,%d)-(%d,%d) erase=%x\n", + OutTraceDW("InvalidateRect: hwnd=%x rect=(%d,%d)-(%d,%d) erase=%x\n", hwnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, bErase); else - OutTraceD("InvalidateRect: hwnd=%x rect=NULL erase=%x\n", + OutTraceDW("InvalidateRect: hwnd=%x rect=NULL erase=%x\n", hwnd, bErase); return (*pInvalidateRect)(hwnd, NULL, bErase); @@ -467,10 +583,10 @@ BOOL WINAPI extShowWindow(HWND hwnd, int nCmdShow) { BOOL res; - OutTraceD("ShowWindow: hwnd=%x, CmdShow=%x(%s)\n", hwnd, nCmdShow, ExplainShowCmd(nCmdShow)); + OutTraceDW("ShowWindow: hwnd=%x, CmdShow=%x(%s)\n", hwnd, nCmdShow, ExplainShowCmd(nCmdShow)); if (dxw.dwFlags1 & PREVENTMAXIMIZE){ if(nCmdShow==SW_MAXIMIZE){ - OutTraceD("ShowWindow: suppress maximize\n"); + OutTraceDW("ShowWindow: suppress maximize\n"); nCmdShow=SW_SHOWNORMAL; } } @@ -486,12 +602,12 @@ LONG WINAPI extGetWindowLong(HWND hwnd, int nIndex) res=(*pGetWindowLong)(hwnd, nIndex); - OutTraceD("GetWindowLong: hwnd=%x, Index=%x(%s) res=%x\n", hwnd, nIndex, ExplainSetWindowIndex(nIndex), res); + OutTraceDW("GetWindowLong: hwnd=%x, Index=%x(%s) res=%x\n", hwnd, nIndex, ExplainSetWindowIndex(nIndex), res); if(nIndex==GWL_WNDPROC){ WNDPROC wp; wp=WhndGetWindowProc(hwnd); - OutTraceD("GetWindowLong: remapping WindowProc res=%x -> %x\n", res, (LONG)wp); + OutTraceDW("GetWindowLong: remapping WindowProc res=%x -> %x\n", res, (LONG)wp); if(wp) res=(LONG)wp; // if not found, don't alter the value. } @@ -502,19 +618,19 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong) { LONG res; - OutTraceD("SetWindowLong: hwnd=%x, Index=%x(%s) Val=%x\n", + OutTraceDW("SetWindowLong: hwnd=%x, Index=%x(%s) Val=%x\n", hwnd, nIndex, ExplainSetWindowIndex(nIndex), dwNewLong); //if(!hwnd) hwnd=dxw.GethWnd(); if (dxw.dwFlags1 & LOCKWINSTYLE){ if(nIndex==GWL_STYLE){ - OutTraceD("SetWindowLong: Lock GWL_STYLE=%x\n", dwNewLong); + OutTraceDW("SetWindowLong: Lock GWL_STYLE=%x\n", dwNewLong); //return 1; return (*pGetWindowLong)(hwnd, nIndex); } if(nIndex==GWL_EXSTYLE){ - OutTraceD("SetWindowLong: Lock GWL_EXSTYLE=%x\n", dwNewLong); + OutTraceDW("SetWindowLong: Lock GWL_EXSTYLE=%x\n", dwNewLong); //return 1; return (*pGetWindowLong)(hwnd, nIndex); } @@ -524,21 +640,21 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong) if(nIndex==GWL_STYLE){ dwNewLong &= ~WS_MAXIMIZE; if(dxw.IsDesktop(hwnd)){ - OutTraceD("SetWindowLong: GWL_STYLE %x suppress MAXIMIZE\n", dwNewLong); + OutTraceDW("SetWindowLong: GWL_STYLE %x suppress MAXIMIZE\n", dwNewLong); dwNewLong |= WS_OVERLAPPEDWINDOW; dwNewLong &= ~(WS_DLGFRAME|WS_MAXIMIZE|WS_VSCROLL|WS_HSCROLL|WS_CLIPSIBLINGS); } } // v2.02.32: disable topmost for main window only if(dxw.IsDesktop(hwnd) && (nIndex==GWL_EXSTYLE)){ - OutTraceD("SetWindowLong: GWL_EXSTYLE %x suppress TOPMOST\n", dwNewLong); + OutTraceDW("SetWindowLong: GWL_EXSTYLE %x suppress TOPMOST\n", dwNewLong); dwNewLong = dwNewLong & ~(WS_EX_TOPMOST); } } if (dxw.dwFlags1 & FIXWINFRAME){ if((nIndex==GWL_STYLE) && !(dwNewLong & WS_CHILD)){ - OutTraceD("SetWindowLong: GWL_STYLE %x force OVERLAPPEDWINDOW\n", dwNewLong); + OutTraceDW("SetWindowLong: GWL_STYLE %x force OVERLAPPEDWINDOW\n", dwNewLong); dwNewLong |= WS_OVERLAPPEDWINDOW; dwNewLong &= ~WS_CLIPSIBLINGS; } @@ -550,7 +666,7 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong) // GPL fix if(dxw.IsRealDesktop(hwnd)) { hwnd=dxw.GethWnd(); - OutTraceD("SetWindowLong: DESKTOP hwnd, FIXING hwnd=%x\n",hwnd); + OutTraceDW("SetWindowLong: DESKTOP hwnd, FIXING hwnd=%x\n",hwnd); } // end of GPL fix @@ -566,7 +682,7 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong) res=(*pSetWindowLong)(hwnd, nIndex, dwNewLong); } - OutTraceD("SetWindowLong: hwnd=%x, nIndex=%x, Val=%x, res=%x\n", hwnd, nIndex, dwNewLong, res); + OutTraceDW("SetWindowLong: hwnd=%x, nIndex=%x, Val=%x, res=%x\n", hwnd, nIndex, dwNewLong, res); return res; } @@ -574,7 +690,7 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c { BOOL res; - OutTraceD("SetWindowPos: hwnd=%x%s pos=(%d,%d) dim=(%d,%d) Flags=%x\n", + OutTraceDW("SetWindowPos: 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()){ @@ -589,7 +705,7 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c // Note: any attempt to change the window position, no matter where and how, through the // SetWindowPos API is causing resizing to the default 1:1 pixed size in Commandos. // in such cases, there is incompatibility between LOCKWINPOS and LOCKWINSTYLE. - OutTraceD("SetWindowPos: locked position\n"); + OutTraceDW("SetWindowPos: locked position\n"); return 1; } @@ -603,7 +719,7 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c 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); + OutTraceDW("SetWindowPos: using max dim=(%d,%d)\n", cx, cy); } // useful??? to be demonstrated.... @@ -615,7 +731,7 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c 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); + OutTraceDW("SetWindowPos: main form hwnd=%x fixed size=(%d,%d)\n", hwnd, cx, cy); res=(*pSetWindowPos)(hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags); if(!res)OutTraceE("SetWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__); @@ -627,12 +743,12 @@ HDWP WINAPI extDeferWindowPos(HDWP hWinPosInfo, HWND hwnd, HWND hWndInsertAfter, // v2.02.31: heavily used by "Imperialism II" !!! HDWP res; - OutTraceD("DeferWindowPos: hwnd=%x%s pos=(%d,%d) dim=(%d,%d) Flags=%x\n", + OutTraceDW("DeferWindowPos: hwnd=%x%s pos=(%d,%d) dim=(%d,%d) Flags=%x\n", hwnd, dxw.IsFullScreen()?"(FULLSCREEN)":"", X, Y, cx, cy, uFlags); if(dxw.IsFullScreen()){ dxw.MapClient(&X, &Y, &cx, &cy); - OutTraceD("DeferWindowPos: remapped pos=(%d,%d) dim=(%d,%d)\n", X, Y, cx, cy); + OutTraceDW("DeferWindowPos: remapped pos=(%d,%d) dim=(%d,%d)\n", X, Y, cx, cy); } res=(*pGDIDeferWindowPos)(hWinPosInfo, hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags); @@ -691,7 +807,7 @@ HCURSOR WINAPI extSetCursor(HCURSOR hCursor) HCURSOR ret; ret=(*pSetCursor)(hCursor); - OutTraceD("GDI.SetCursor: Cursor=%x, ret=%x\n", hCursor, ret); + OutTraceDW("GDI.SetCursor: Cursor=%x, ret=%x\n", hCursor, ret); //MessageBox(0, "SelectPalette", "GDI32.dll", MB_OK | MB_ICONEXCLAMATION); return ret; } @@ -902,7 +1018,7 @@ int WINAPI extMapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT int ret; // a rarely used API, but responsible for a painful headache: needs hooking for "Commandos 2", "Alien Nations". - OutTraceD("MapWindowPoints: hWndFrom=%x%s hWndTo=%x%s cPoints=%d FullScreen=%x\n", + OutTraceDW("MapWindowPoints: hWndFrom=%x%s hWndTo=%x%s cPoints=%d FullScreen=%x\n", hWndFrom, dxw.IsDesktop(hWndFrom)?"(DESKTOP)":"", hWndTo, dxw.IsDesktop(hWndTo)?"(DESKTOP)":"", cPoints, dxw.IsFullScreen()); @@ -920,7 +1036,7 @@ int WINAPI extMapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT // should scale the retcode ??? ret=(*pMapWindowPoints)(hWndFrom, hWndTo, lpPoints, cPoints); - OutTraceD("MapWindowPoints: ret=%x (%d,%d)\n", ret, (ret&0xFFFF0000)>>16, ret&0x0000FFFF); + OutTraceDW("MapWindowPoints: ret=%x (%d,%d)\n", ret, (ret&0xFFFF0000)>>16, ret&0x0000FFFF); return ret; } @@ -929,14 +1045,14 @@ HWND WINAPI extGetDesktopWindow(void) // V2.1.73: correct ??? HWND res; - OutTraceD("GetDesktopWindow: FullScreen=%x\n", dxw.IsFullScreen()); + OutTraceDW("GetDesktopWindow: FullScreen=%x\n", dxw.IsFullScreen()); if (dxw.IsFullScreen()){ - OutTraceD("GetDesktopWindow: returning main window hwnd=%x\n", dxw.GethWnd()); + OutTraceDW("GetDesktopWindow: returning main window hwnd=%x\n", dxw.GethWnd()); return dxw.GethWnd(); } else{ res=(*pGetDesktopWindow)(); - OutTraceD("GetDesktopWindow: returning desktop window hwnd=%x\n", res); + OutTraceDW("GetDesktopWindow: returning desktop window hwnd=%x\n", res); return res; } } @@ -946,7 +1062,7 @@ int WINAPI extGetSystemMetrics(int nindex) HRESULT res; res=(*pGetSystemMetrics)(nindex); - OutTraceD("GetSystemMetrics: index=%x(%s), res=%d\n", nindex, ExplainsSystemMetrics(nindex), res); + OutTraceDW("GetSystemMetrics: index=%x(%s), res=%d\n", nindex, ExplainsSystemMetrics(nindex), res); // if you have a bypassed setting, use it first! if(pSetDevMode){ @@ -955,13 +1071,13 @@ int WINAPI extGetSystemMetrics(int nindex) case SM_CXSCREEN: case SM_CXVIRTUALSCREEN: // v2.02.31 res = pSetDevMode->dmPelsWidth; - OutTraceD("GetDeviceCaps: fix HORZRES cap=%d\n", res); + OutTraceDW("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); + OutTraceDW("GetDeviceCaps: fix VERTRES cap=%d\n", res); return res; } } @@ -971,18 +1087,18 @@ int WINAPI extGetSystemMetrics(int nindex) case SM_CXSCREEN: case SM_CXVIRTUALSCREEN: // v2.02.31 res= dxw.GetScreenWidth(); - OutTraceD("GetSystemMetrics: fix SM_CXSCREEN=%d\n", res); + OutTraceDW("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); + OutTraceDW("GetSystemMetrics: fix SM_CYSCREEN=%d\n", res); break; case SM_CMONITORS: if((dxw.dwFlags2 & HIDEMULTIMONITOR) && res>1) { res=1; - OutTraceD("GetSystemMetrics: fix SM_CMONITORS=%d\n", res); + OutTraceDW("GetSystemMetrics: fix SM_CMONITORS=%d\n", res); } break; } @@ -992,7 +1108,7 @@ int WINAPI extGetSystemMetrics(int nindex) ATOM WINAPI extRegisterClassExA(WNDCLASSEX *lpwcx) { - OutTraceD("RegisterClassEx: PROXED ClassName=%s style=%x(%s)\n", + OutTraceDW("RegisterClassEx: PROXED ClassName=%s style=%x(%s)\n", lpwcx->lpszClassName, lpwcx->style, ExplainStyle(lpwcx->style)); return (*pRegisterClassExA)(lpwcx); } @@ -1019,7 +1135,7 @@ static HWND WINAPI extCreateWindowCommon( // no maximized windows in any case if (dxw.dwFlags1 & PREVENTMAXIMIZE){ - OutTraceD("%s: handling PREVENTMAXIMIZE mode\n", ApiName); + OutTraceDW("%s: handling PREVENTMAXIMIZE mode\n", ApiName); dwStyle &= ~WS_MAXIMIZE; //dwStyle &= ~(WS_MAXIMIZE | WS_POPUP); //dwExStyle &= ~WS_EX_TOPMOST; @@ -1071,7 +1187,7 @@ static HWND WINAPI extCreateWindowCommon( } nWidth=screen.right; nHeight=screen.bottom; - OutTraceD("%s: fixed BIG win pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight); + OutTraceDW("%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. @@ -1082,7 +1198,7 @@ static HWND WINAPI extCreateWindowCommon( //} nWidth=dxw.iSizX; nHeight=dxw.iSizY; - OutTraceD("%s: renewed BIG win pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight); + OutTraceDW("%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){ @@ -1093,7 +1209,7 @@ static HWND WINAPI extCreateWindowCommon( nWidth=workarea.right; nHeight=workarea.bottom; dwStyle=0; - OutTraceD("%s: WORKAREA win pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight); + OutTraceDW("%s: WORKAREA win pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight); } else if(dxw.Coordinates==DXW_DESKTOP_FULL){ RECT workarea; @@ -1103,7 +1219,7 @@ static HWND WINAPI extCreateWindowCommon( nWidth=workarea.right; nHeight=workarea.bottom; dwStyle=0; - OutTraceD("%s: FULLDESKTOP win pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight); + OutTraceDW("%s: FULLDESKTOP win pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight); } } @@ -1112,7 +1228,7 @@ static HWND WINAPI extCreateWindowCommon( wndh= (*pCreateWindowExW)(dwExStyle, (LPCWSTR)lpClassName, (LPCWSTR)lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); else wndh= (*pCreateWindowExA)(dwExStyle, (LPCSTR)lpClassName, (LPCSTR)lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); - OutTraceD("%s: windowed mode ret=%x\n", ApiName, wndh); + OutTraceDW("%s: windowed mode ret=%x\n", ApiName, wndh); return wndh; } @@ -1120,14 +1236,14 @@ static HWND WINAPI extCreateWindowCommon( // Age of Empires.... if (dwStyle & WS_CHILD){ dxw.MapClient(&x, &y, &nWidth, &nHeight); - OutTraceD("%s: fixed WS_CHILD pos=(%d,%d) size=(%d,%d)\n", + OutTraceDW("%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("%s: fixed WS_EX_CONTROLPARENT pos=(%d,%d) size=(%d,%d)\n", + OutTraceDW("%s: fixed WS_EX_CONTROLPARENT pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight); } @@ -1149,7 +1265,7 @@ static HWND WINAPI extCreateWindowCommon( extern void AdjustWindowPos(HWND, DWORD, DWORD); (*pSetWindowLong)(wndh, GWL_STYLE, (dxw.dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW); (*pSetWindowLong)(wndh, GWL_EXSTYLE, 0); - OutTraceD("%s: hwnd=%x, set style=WS_OVERLAPPEDWINDOW extstyle=0\n", ApiName, wndh); + OutTraceDW("%s: hwnd=%x, set style=WS_OVERLAPPEDWINDOW extstyle=0\n", ApiName, wndh); AdjustWindowPos(wndh, nWidth, nHeight); (*pShowWindow)(wndh, SW_SHOWNORMAL); } @@ -1161,13 +1277,13 @@ static HWND WINAPI extCreateWindowCommon( if ((dwStyle & WS_CHILD) && (dxw.dwFlags1 & HOOKCHILDWIN)){ long res; pWindowProc = (WNDPROC)(*pGetWindowLong)(wndh, GWL_WNDPROC); - OutTraceD("Hooking CHILD wndh=%x WindowProc %x->%x\n", wndh, pWindowProc, extChildWindowProc); + OutTraceDW("Hooking CHILD wndh=%x WindowProc %x->%x\n", wndh, pWindowProc, extChildWindowProc); res=(*pSetWindowLong)(wndh, GWL_WNDPROC, (LONG)extChildWindowProc); WhndStackPush(wndh, pWindowProc); if(!res) OutTraceE("%s: SetWindowLong ERROR %x\n", ApiName, GetLastError()); } - OutTraceD("%s: ret=%x\n", ApiName, wndh); + OutTraceDW("%s: ret=%x\n", ApiName, wndh); return wndh; } @@ -1197,13 +1313,13 @@ HWND WINAPI extCreateWindowExW( HINSTANCE hInstance, LPVOID lpParam) { - if(IsTraceD){ + if(IsTraceDDRAW){ char xString[20], yString[20]; if (x==CW_USEDEFAULT) strcpy(xString,"CW_USEDEFAULT"); else sprintf(xString,"%d", x); if (y==CW_USEDEFAULT) strcpy(yString,"CW_USEDEFAULT"); else sprintf(yString,"%d", y); - OutTraceD("CreateWindowExW: class=\"%ls\" wname=\"%ls\" pos=(%s,%s) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n", + OutTraceDW("CreateWindowExW: class=\"%ls\" wname=\"%ls\" pos=(%s,%s) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n", lpClassName, lpWindowName, xString, yString, nWidth, nHeight, dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle)); } @@ -1227,13 +1343,13 @@ HWND WINAPI extCreateWindowExA( HINSTANCE hInstance, LPVOID lpParam) { - if(IsTraceD){ + if(IsTraceDDRAW){ char xString[20], yString[20]; if (x==CW_USEDEFAULT) strcpy(xString,"CW_USEDEFAULT"); else sprintf(xString,"%d", x); if (y==CW_USEDEFAULT) strcpy(yString,"CW_USEDEFAULT"); else sprintf(yString,"%d", y); - OutTraceD("CreateWindowExA: class=\"%s\" wname=\"%s\" pos=(%s,%s) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n", + OutTraceDW("CreateWindowExA: class=\"%s\" wname=\"%s\" pos=(%s,%s) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n", ClassToStr(lpClassName), lpWindowName, xString, yString, nWidth, nHeight, dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle)); } @@ -1274,7 +1390,7 @@ int WINAPI extFillRect(HDC hdc, const RECT *lprc, HBRUSH hbr) { 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); + OutTraceDW("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 // better not: some games may use excessive coordinates: see "Premier Manager 98" @@ -1285,9 +1401,11 @@ int WINAPI extFillRect(HDC hdc, const RECT *lprc, HBRUSH hbr) 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(); - if(OBJ_DC == GetObjectType(hdc)) dxw.MapWindow(&rc); - //else dxw.MapClient(&rc); - OutTraceD("FillRect: fixed rect=(%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + if(dxw.IsFullScreen()){ + if(OBJ_DC == GetObjectType(hdc)) dxw.MapWindow(&rc); + //else dxw.MapClient(&rc); + OutTraceDW("FillRect: fixed rect=(%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + } res=(*pFillRect)(hdc, &rc, hbr); return res; @@ -1297,7 +1415,7 @@ 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); + OutTraceDW("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); @@ -1309,7 +1427,7 @@ int WINAPI extFrameRect(HDC hdc, const RECT *lprc, HBRUSH hbr) 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); + OutTraceDW("FrameRect: fixed rect=(%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); } res=(*pFrameRect)(hdc, &rc, hbr); @@ -1356,7 +1474,7 @@ BOOL WINAPI extClipCursor(RECT *lpRectArg) } if (pClipCursor) res=(*pClipCursor)(lpRect); - if (lpRect) OutTraceD("ClipCursor: REMAPPED rect=(%d,%d)-(%d,%d) res=%x\n", lpRect->left,lpRect->top,lpRect->right,lpRect->bottom, res); + if (lpRect) OutTraceDW("ClipCursor: REMAPPED rect=(%d,%d)-(%d,%d) res=%x\n", lpRect->left,lpRect->top,lpRect->right,lpRect->bottom, res); return TRUE; } @@ -1370,7 +1488,7 @@ BOOL WINAPI extGetClipCursor(LPRECT lpRect) // proxy.... if (!(dxw.dwFlags1 & ENABLECLIPPING)) { ret=(*pGetClipCursor)(lpRect); - if(IsTraceD){ + if(IsTraceDDRAW){ if (lpRect) OutTrace("GetClipCursor: PROXED rect=(%d,%d)-(%d,%d) ret=%d\n", lpRect->left,lpRect->top,lpRect->right,lpRect->bottom, ret); @@ -1388,7 +1506,7 @@ BOOL WINAPI extGetClipCursor(LPRECT lpRect) lpRect->right = dxw.GetScreenWidth(); lpRect->bottom = dxw.GetScreenHeight(); } - OutTraceD("GetClipCursor: rect=(%d,%d)-(%d,%d) ret=%d\n", + OutTraceDW("GetClipCursor: rect=(%d,%d)-(%d,%d) ret=%d\n", lpRect->left,lpRect->top,lpRect->right,lpRect->bottom, TRUE); } @@ -1397,7 +1515,7 @@ BOOL WINAPI extGetClipCursor(LPRECT lpRect) LONG WINAPI extEnumDisplaySettings(LPCTSTR lpszDeviceName, DWORD iModeNum, DEVMODE *lpDevMode) { - OutTraceD("EnumDisplaySettings: Devicename=%s ModeNum=%x\n", lpszDeviceName, iModeNum); + OutTraceDW("EnumDisplaySettings: Devicename=%s ModeNum=%x\n", lpszDeviceName, iModeNum); if(pSetDevMode && iModeNum==ENUM_CURRENT_SETTINGS){ lpDevMode=pSetDevMode; return 1; @@ -1406,29 +1524,56 @@ LONG WINAPI extEnumDisplaySettings(LPCTSTR lpszDeviceName, DWORD iModeNum, DEVMO return (*pEnumDisplaySettings)(lpszDeviceName, iModeNum, lpDevMode); } -LONG WINAPI extChangeDisplaySettings(DEVMODE *lpDevMode, DWORD dwflags) +LONG WINAPI extChangeDisplaySettingsA(DEVMODEA *lpDevMode, DWORD dwflags) { - if(IsTraceD){ - OutTrace("ChangeDisplaySettings: lpDevMode=%x flags=%x", lpDevMode, dwflags); - if (lpDevMode) OutTrace(" fields=%x(%s) size=(%d x %d) bpp=%d", - lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields), + if(IsTraceDDRAW){ + OutTrace("ChangeDisplaySettingsA: lpDevMode=%x flags=%x", lpDevMode, dwflags); + if (lpDevMode) OutTrace(" DeviceName=%s fields=%x(%s) size=(%d x %d) bpp=%d", + lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields), lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel); OutTrace("\n"); } - return MyChangeDisplaySettings("ChangeDisplaySettings", lpDevMode, dwflags); + return MyChangeDisplaySettings("ChangeDisplaySettingsA", FALSE, lpDevMode, dwflags); } -LONG WINAPI extChangeDisplaySettingsEx(LPCTSTR lpszDeviceName, DEVMODE *lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam) +LONG WINAPI extChangeDisplaySettingsW(DEVMODEW *lpDevMode, DWORD dwflags) { - if(IsTraceD){ - OutTrace("ChangeDisplaySettingsEx: DeviceName=%s lpDevMode=%x flags=%x", lpszDeviceName, lpDevMode, dwflags); - if (lpDevMode) OutTrace(" size=(%d x %d) bpp=%d", + if(IsTraceDDRAW){ + OutTrace("ChangeDisplaySettingsW: lpDevMode=%x flags=%x", lpDevMode, dwflags); + if (lpDevMode) OutTrace(" DeviceName=%ls fields=%x(%s) size=(%d x %d) bpp=%d", + lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields), lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel); OutTrace("\n"); } - return MyChangeDisplaySettings("ChangeDisplaySettingsEx", lpDevMode, dwflags); + return MyChangeDisplaySettings("ChangeDisplaySettingsW", TRUE, lpDevMode, dwflags); +} + +LONG WINAPI extChangeDisplaySettingsExA(LPCTSTR lpszDeviceName, DEVMODEA *lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam) +{ + if(IsTraceDDRAW){ + OutTrace("ChangeDisplaySettingsEx: DeviceName=%s lpDevMode=%x flags=%x", lpszDeviceName, lpDevMode, dwflags); + if (lpDevMode) OutTrace(" DeviceName=%s fields=%x(%s) size=(%d x %d) bpp=%d", + lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields), + lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel); + OutTrace("\n"); + } + + return MyChangeDisplaySettings("ChangeDisplaySettingsExA", FALSE, lpDevMode, dwflags); +} + +LONG WINAPI extChangeDisplaySettingsExW(LPCTSTR lpszDeviceName, DEVMODEW *lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam) +{ + if(IsTraceDDRAW){ + OutTrace("ChangeDisplaySettingsEx: DeviceName=%ls lpDevMode=%x flags=%x", lpszDeviceName, lpDevMode, dwflags); + if (lpDevMode) OutTrace(" DeviceName=%ls fields=%x(%s) size=(%d x %d) bpp=%d", + lpDevMode->dmDeviceName, lpDevMode->dmFields, ExplainDevModeFields(lpDevMode->dmFields), + lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight, lpDevMode->dmBitsPerPel); + OutTrace("\n"); + } + + return MyChangeDisplaySettings("ChangeDisplaySettingsExW", TRUE, lpDevMode, dwflags); } HDC WINAPI extGDIGetDC(HWND hwnd) @@ -1436,10 +1581,10 @@ HDC WINAPI extGDIGetDC(HWND hwnd) HDC ret; HWND lochwnd; - OutTraceD("GDI.GetDC: hwnd=%x\n", hwnd); + OutTraceDW("GDI.GetDC: hwnd=%x\n", hwnd); lochwnd=hwnd; if (dxw.IsRealDesktop(hwnd)) { - OutTraceD("GDI.GetDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); + OutTraceDW("GDI.GetDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); lochwnd=dxw.GethWnd(); } @@ -1449,7 +1594,7 @@ HDC WINAPI extGDIGetDC(HWND hwnd) ret=(*pGDIGetDC)(lochwnd); if(ret){ - OutTraceD("GDI.GetDC: hwnd=%x ret=%x\n", lochwnd, ret); + OutTraceDW("GDI.GetDC: hwnd=%x ret=%x\n", lochwnd, ret); } else{ int err; @@ -1458,7 +1603,7 @@ HDC WINAPI extGDIGetDC(HWND hwnd) if((err==ERROR_INVALID_WINDOW_HANDLE) && (lochwnd!=hwnd)){ ret=(*pGDIGetDC)(hwnd); if(ret) - OutTraceD("GDI.GetDC: hwnd=%x ret=%x\n", hwnd, ret); + OutTraceDW("GDI.GetDC: hwnd=%x ret=%x\n", hwnd, ret); else OutTraceE("GDI.GetDC ERROR: hwnd=%x err=%d at %d\n", hwnd, GetLastError(), __LINE__); } @@ -1473,10 +1618,10 @@ HDC WINAPI extGDIGetDCEx(HWND hwnd, HRGN hrgnClip, DWORD flags) HDC ret; HWND lochwnd; - OutTraceD("GDI.GetDCEx: hwnd=%x hrgnClip=%x flags=%x(%s)\n", hwnd, hrgnClip, flags, ExplainGetDCExFlags(flags)); + OutTraceDW("GDI.GetDCEx: hwnd=%x hrgnClip=%x flags=%x(%s)\n", hwnd, hrgnClip, flags, ExplainGetDCExFlags(flags)); lochwnd=hwnd; if (dxw.IsRealDesktop(hwnd)) { - OutTraceD("GDI.GetDCEx: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); + OutTraceDW("GDI.GetDCEx: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); lochwnd=dxw.GethWnd(); } @@ -1486,7 +1631,7 @@ HDC WINAPI extGDIGetDCEx(HWND hwnd, HRGN hrgnClip, DWORD flags) ret=(*pGDIGetDC)(lochwnd); if(ret){ - OutTraceD("GDI.GetDCEx: hwnd=%x ret=%x\n", lochwnd, ret); + OutTraceDW("GDI.GetDCEx: hwnd=%x ret=%x\n", lochwnd, ret); } else{ int err; @@ -1495,7 +1640,7 @@ HDC WINAPI extGDIGetDCEx(HWND hwnd, HRGN hrgnClip, DWORD flags) if((err==ERROR_INVALID_WINDOW_HANDLE) && (lochwnd!=hwnd)){ ret=(*pGDIGetDCEx)(hwnd, hrgnClip, flags); if(ret) - OutTraceD("GDI.GetDCEx: hwnd=%x ret=%x\n", hwnd, ret); + OutTraceDW("GDI.GetDCEx: hwnd=%x ret=%x\n", hwnd, ret); else OutTraceE("GDI.GetDCEx ERROR: hwnd=%x err=%d at %d\n", hwnd, GetLastError(), __LINE__); } @@ -1508,17 +1653,17 @@ HDC WINAPI extGDIGetWindowDC(HWND hwnd) { HDC ret; HWND lochwnd; - OutTraceD("GDI.GetWindowDC: hwnd=%x\n", hwnd); + OutTraceDW("GDI.GetWindowDC: hwnd=%x\n", hwnd); lochwnd=hwnd; if (dxw.IsRealDesktop(hwnd)) { - OutTraceD("GDI.GetWindowDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); + OutTraceDW("GDI.GetWindowDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); lochwnd=dxw.GethWnd(); } ret=(*pGDIGetWindowDC)(lochwnd); if(ret){ - OutTraceD("GDI.GetWindowDC: hwnd=%x ret=%x\n", lochwnd, ret); + OutTraceDW("GDI.GetWindowDC: hwnd=%x ret=%x\n", lochwnd, ret); } else{ int err; @@ -1527,7 +1672,7 @@ HDC WINAPI extGDIGetWindowDC(HWND hwnd) if((err==ERROR_INVALID_WINDOW_HANDLE) && (lochwnd!=hwnd)){ ret=(*pGDIGetWindowDC)(hwnd); if(ret) - OutTraceD("GDI.GetWindowDC: hwnd=%x ret=%x\n", hwnd, ret); + OutTraceDW("GDI.GetWindowDC: hwnd=%x ret=%x\n", hwnd, ret); else OutTraceE("GDI.GetWindowDC ERROR: hwnd=%x err=%d at %d\n", hwnd, GetLastError(), __LINE__); } @@ -1539,7 +1684,7 @@ int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC) { int res; - OutTraceD("GDI.ReleaseDC: hwnd=%x hdc=%x\n", hwnd, hDC); + OutTraceDW("GDI.ReleaseDC: hwnd=%x hdc=%x\n", hwnd, hDC); if (dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd(); if(dxw.dwFlags3 & EMULATEDC) @@ -1557,7 +1702,7 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint) extern HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE, HDC FAR *); // proxy part ... - OutTraceD("GDI.BeginPaint: hwnd=%x lpPaint=%x FullScreen=%x\n", hwnd, lpPaint, dxw.IsFullScreen()); + OutTraceDW("GDI.BeginPaint: hwnd=%x lpPaint=%x FullScreen=%x\n", hwnd, lpPaint, dxw.IsFullScreen()); hdc=(*pBeginPaint)(hwnd, lpPaint); // if not in fullscreen mode, that's all! @@ -1569,11 +1714,11 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint) if(dxw.dwFlags1 & MAPGDITOPRIMARY) { if(pGetDC && dxw.lpDDSPrimHDC){ extGetDC(dxw.lpDDSPrimHDC,&PrimHDC); - OutTraceD("GDI.BeginPaint: redirect hdc=%x -> PrimHDC=%x\n", hdc, PrimHDC); + OutTraceDW("GDI.BeginPaint: redirect hdc=%x -> PrimHDC=%x\n", hdc, PrimHDC); hdc=PrimHDC; } else { - OutTraceD("GDI.BeginPaint: hdc=%x\n", hdc); + OutTraceDW("GDI.BeginPaint: hdc=%x\n", hdc); } } @@ -1593,19 +1738,19 @@ BOOL WINAPI extEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint) BOOL ret; HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR hdc); - OutTraceD("GDI.EndPaint: hwnd=%x lpPaint=%x\n", hwnd, lpPaint); + OutTraceDW("GDI.EndPaint: hwnd=%x lpPaint=%x\n", hwnd, lpPaint); if((dxw.dwFlags3 & EMULATEDC) && dxw.IsFullScreen()){ ret=dxw.ReleaseEmulatedDC(hwnd); ret=(*pEndPaint)(hwnd, lpPaint); - OutTraceD("GDI.EndPaint: hwnd=%x ret=%x\n", hwnd, ret); + OutTraceDW("GDI.EndPaint: hwnd=%x ret=%x\n", hwnd, ret); if(!ret) OutTraceE("GDI.EndPaint ERROR: err=%d at %d\n", GetLastError(), __LINE__); return ret; } // proxy part ... ret=(*pEndPaint)(hwnd, lpPaint); - OutTraceD("GDI.EndPaint: hwnd=%x ret=%x\n", hwnd, ret); + OutTraceDW("GDI.EndPaint: hwnd=%x ret=%x\n", hwnd, ret); if(!ret) OutTraceE("GDI.EndPaint ERROR: err=%d at %d\n", GetLastError(), __LINE__); //return ret; @@ -1617,7 +1762,7 @@ BOOL WINAPI extEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint) if(dxw.dwFlags1 & MAPGDITOPRIMARY) { if(pReleaseDC && dxw.lpDDSPrimHDC){ extReleaseDC(dxw.lpDDSPrimHDC, PrimHDC); - OutTraceD("GDI.EndPaint: released hdc=%x\n", PrimHDC); + OutTraceDW("GDI.EndPaint: released hdc=%x\n", PrimHDC); } } @@ -1628,7 +1773,7 @@ HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpT { HWND RetHWND; isWithinDialog=TRUE; - OutTraceD("CreateDialogIndirectParam: hInstance=%x lpTemplate=%s hWndParent=%x lpDialogFunc=%x lParamInit=%x\n", + OutTraceDW("CreateDialogIndirectParam: hInstance=%x lpTemplate=%s hWndParent=%x lpDialogFunc=%x lParamInit=%x\n", hInstance, "tbd", hWndParent, lpDialogFunc, lParamInit); if(dxw.IsFullScreen() && hWndParent==NULL) hWndParent=dxw.GethWnd(); RetHWND=(*pCreateDialogIndirectParam)(hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit); @@ -1637,7 +1782,7 @@ HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpT if(!(*pSetWindowLong)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc)) OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__); - OutTraceD("CreateDialogIndirectParam: hwnd=%x\n", RetHWND); + OutTraceDW("CreateDialogIndirectParam: hwnd=%x\n", RetHWND); isWithinDialog=FALSE; //if (IsDebug) EnumChildWindows(RetHWND, (WNDENUMPROC)TraceChildWin, (LPARAM)RetHWND); return RetHWND; @@ -1647,7 +1792,7 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW { HWND RetHWND; isWithinDialog=TRUE; - OutTraceD("CreateDialogParam: hInstance=%x lpTemplateName=%s hWndParent=%x lpDialogFunc=%x lParamInit=%x\n", + OutTraceDW("CreateDialogParam: hInstance=%x lpTemplateName=%s hWndParent=%x lpDialogFunc=%x lParamInit=%x\n", hInstance, "tbd", hWndParent, lpDialogFunc, lParamInit); if(hWndParent==NULL) hWndParent=dxw.GethWnd(); RetHWND=(*pCreateDialogParam)(hInstance, lpTemplateName, hWndParent, lpDialogFunc, lParamInit); @@ -1656,7 +1801,7 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW if(!(*pSetWindowLong)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc)) OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__); - OutTraceD("CreateDialogParam: hwnd=%x\n", RetHWND); + OutTraceDW("CreateDialogParam: hwnd=%x\n", RetHWND); isWithinDialog=FALSE; //if (IsDebug) EnumChildWindows(RetHWND, (WNDENUMPROC)TraceChildWin, (LPARAM)RetHWND); return RetHWND; @@ -1665,18 +1810,18 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint) { BOOL ret; - OutTraceD("MoveWindow: hwnd=%x xy=(%d,%d) size=(%d,%d) repaint=%x indialog=%x fullscreen=%x\n", + OutTraceDW("MoveWindow: hwnd=%x xy=(%d,%d) size=(%d,%d) repaint=%x indialog=%x fullscreen=%x\n", hwnd, X, Y, nWidth, nHeight, bRepaint, isWithinDialog, dxw.IsFullScreen()); if(dxw.IsDesktop(hwnd)){ // v2.1.93: happens in "Emergency Fighters for Life" ... // what is the meaning of this? is it related to video stretching? - OutTraceD("MoveWindow: prevent moving desktop win\n"); + OutTraceDW("MoveWindow: prevent moving desktop win\n"); return TRUE; } if((hwnd==dxw.GethWnd()) || (hwnd==dxw.hParentWnd)){ - OutTraceD("MoveWindow: prevent moving main win\n"); + OutTraceDW("MoveWindow: prevent moving main win\n"); return TRUE; } @@ -1702,9 +1847,9 @@ BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL nWidth = (nWidth * client.right) / dxw.GetScreenWidth(); nHeight = (nHeight * client.bottom) / dxw.GetScreenHeight(); } - OutTraceD("MoveWindow: DEBUG client=(%d,%d) screen=(%d,%d)\n", + OutTraceDW("MoveWindow: DEBUG client=(%d,%d) screen=(%d,%d)\n", client.right, client.bottom, dxw.GetScreenWidth(), dxw.GetScreenHeight()); - OutTraceD("MoveWindow: hwnd=%x child=%x relocated to xy=(%d,%d) size=(%d,%d)\n", + OutTraceDW("MoveWindow: hwnd=%x child=%x relocated to xy=(%d,%d) size=(%d,%d)\n", hwnd, isChild, X, Y, nWidth, nHeight); } else{ @@ -1718,7 +1863,7 @@ BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL Y=upleft.y; nWidth=screen.right; nHeight=screen.bottom; - OutTraceD("MoveWindow: fixed BIG win pos=(%d,%d) size=(%d,%d)\n", X, Y, nWidth, nHeight); + OutTraceDW("MoveWindow: fixed BIG win pos=(%d,%d) size=(%d,%d)\n", X, Y, nWidth, nHeight); } } @@ -1775,22 +1920,22 @@ BOOL WINAPI extScrollDC(HDC hDC, int dx, int dy, const RECT *lprcScroll, const R HWND WINAPI extGetTopWindow(HWND hwnd) { HWND ret; - OutTraceD("GetTopWindow: hwnd=%x fullscreen=%x\n", hwnd, dxw.IsFullScreen()); + OutTraceDW("GetTopWindow: hwnd=%x fullscreen=%x\n", hwnd, dxw.IsFullScreen()); // a fullscreen program is supposed to be always top Z-order on the desktop! ret = (dxw.IsFullScreen() && dxw.IsDesktop(hwnd)) ? dxw.GethWnd() : (*pGetTopWindow)(hwnd); - OutTraceD("GetTopWindow: ret=%x\n", ret); + OutTraceDW("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", + OutTraceDW("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); + OutTraceDW("TextOut: fixed dest=(%d,%d)\n", X, Y); } res=(*pTabbedTextOutA)(hdc, X, Y, lpString, nCount, nTabPositions, lpnTabStopPositions, nTabOrigin); @@ -1803,7 +1948,7 @@ 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); + OutTraceDW("DestroyWindow: destroy main hwnd=%x\n", hWnd); dxw.SethWnd(NULL); } res=(*pDestroyWindow)(hWnd); @@ -1816,7 +1961,7 @@ 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); + OutTraceDW("CloseWindow: close main hwnd=%x\n", hWnd); dxw.SethWnd(NULL); } res=(*pCloseWindow)(hWnd); @@ -1828,7 +1973,7 @@ BOOL WINAPI extSetSysColors(int cElements, const INT *lpaElements, const COLORRE { // v2.02.32: added to avoid SysColors changes by "Western Front" BOOL ret; - OutTraceD("SetSysColors: Elements=%d\n", cElements); + OutTraceDW("SetSysColors: Elements=%d\n", cElements); if(dxw.dwFlags3 & LOCKSYSCOLORS) return TRUE; @@ -1840,10 +1985,10 @@ BOOL WINAPI extSetSysColors(int cElements, const INT *lpaElements, const COLORRE BOOL WINAPI extUpdateWindow(HWND hwnd) { BOOL ret; - OutTraceD("UpdateWindow: hwnd=%x\n", hwnd); + OutTraceDW("UpdateWindow: hwnd=%x\n", hwnd); if(dxw.IsRealDesktop(hwnd)){ - OutTraceD("UpdateWindow: remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); + OutTraceDW("UpdateWindow: remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); hwnd=dxw.GethWnd(); } @@ -1855,15 +2000,15 @@ BOOL WINAPI extUpdateWindow(HWND hwnd) BOOL WINAPI extGetWindowPlacement(HWND hwnd, WINDOWPLACEMENT *lpwndpl) { BOOL ret; - OutTraceD("GetWindowPlacement: hwnd=%x\n", hwnd); + OutTraceDW("GetWindowPlacement: hwnd=%x\n", hwnd); if(dxw.IsRealDesktop(hwnd)){ - OutTraceD("GetWindowPlacement: remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); + OutTraceDW("GetWindowPlacement: remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); hwnd=dxw.GethWnd(); } ret=(*pGetWindowPlacement)(hwnd, lpwndpl); - OutTraceD("GetWindowPlacement: flags=%x showCmd=%x MinPosition=(%d,%d) MaxPosition=(%d,%d) NormalPosition=(%d,%d)-(%d,%d)\n", + OutTraceDW("GetWindowPlacement: flags=%x showCmd=%x MinPosition=(%d,%d) MaxPosition=(%d,%d) NormalPosition=(%d,%d)-(%d,%d)\n", lpwndpl->flags, lpwndpl->showCmd, lpwndpl->ptMinPosition.x, lpwndpl->ptMinPosition.y, lpwndpl->ptMaxPosition.x, lpwndpl->ptMaxPosition.y, @@ -1873,7 +2018,7 @@ BOOL WINAPI extGetWindowPlacement(HWND hwnd, WINDOWPLACEMENT *lpwndpl) case SW_SHOW: if (dxw.IsFullScreen()){ lpwndpl->showCmd = SW_MAXIMIZE; - OutTraceD("GetWindowPlacement: forcing SW_MAXIMIZE state\n"); + OutTraceDW("GetWindowPlacement: forcing SW_MAXIMIZE state\n"); } break; } @@ -1884,14 +2029,14 @@ BOOL WINAPI extGetWindowPlacement(HWND hwnd, WINDOWPLACEMENT *lpwndpl) BOOL WINAPI extSetWindowPlacement(HWND hwnd, WINDOWPLACEMENT *lpwndpl) { BOOL ret; - OutTraceD("SetWindowPlacement: hwnd=%x\n", hwnd); + OutTraceDW("SetWindowPlacement: hwnd=%x\n", hwnd); if(dxw.IsRealDesktop(hwnd)){ - OutTraceD("SetWindowPlacement: remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); + OutTraceDW("SetWindowPlacement: remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); hwnd=dxw.GethWnd(); } - OutTraceD("SetWindowPlacement: flags=%x showCmd=%x MinPosition=(%d,%d) MaxPosition=(%d,%d) NormalPosition=(%d,%d)-(%d,%d)\n", + OutTraceDW("SetWindowPlacement: flags=%x showCmd=%x MinPosition=(%d,%d) MaxPosition=(%d,%d) NormalPosition=(%d,%d)-(%d,%d)\n", lpwndpl->flags, lpwndpl->showCmd, lpwndpl->ptMinPosition.x, lpwndpl->ptMinPosition.y, lpwndpl->ptMaxPosition.x, lpwndpl->ptMaxPosition.y, @@ -1901,7 +2046,7 @@ BOOL WINAPI extSetWindowPlacement(HWND hwnd, WINDOWPLACEMENT *lpwndpl) case SW_SHOW: if (dxw.IsFullScreen()){ lpwndpl->showCmd = SW_MAXIMIZE; - OutTraceD("SetWindowPlacement: forcing SW_MAXIMIZE state\n"); + OutTraceDW("SetWindowPlacement: forcing SW_MAXIMIZE state\n"); } break; } @@ -1913,9 +2058,9 @@ BOOL WINAPI extSetWindowPlacement(HWND hwnd, WINDOWPLACEMENT *lpwndpl) HWND WINAPI extSetCapture(HWND hwnd) { HWND ret; - OutTraceD("SetCapture: hwnd=%x\n", hwnd); + OutTraceDW("SetCapture: hwnd=%x\n", hwnd); ret=(*pSetCapture)(hwnd); - OutTraceD("SetCapture: ret=%x\n", ret); + OutTraceDW("SetCapture: ret=%x\n", ret); return ret; } @@ -1923,7 +2068,7 @@ HWND WINAPI extGetActiveWindow(void) { HWND ret; ret=(*pGetActiveWindow)(); - OutTraceD("GetActiveWindow: ret=%x\n", ret); + OutTraceDW("GetActiveWindow: ret=%x\n", ret); STOPPER("GetActiveWindow"); return ret; } @@ -1932,7 +2077,7 @@ HWND WINAPI extGetForegroundWindow(void) { HWND ret; ret=(*pGetForegroundWindow)(); - OutTraceD("GetForegroundWindow: ret=%x\n", ret); + OutTraceDW("GetForegroundWindow: ret=%x\n", ret); STOPPER("GetForegroundWindow"); return ret; } \ No newline at end of file diff --git a/dll/winmm.cpp b/dll/winmm.cpp index 989dfe8..e11d78e 100644 --- a/dll/winmm.cpp +++ b/dll/winmm.cpp @@ -6,8 +6,8 @@ #include "MMSystem.h" -//#undef OutTraceD -//#define OutTraceD OutTrace +//#undef OutTraceDW +//#define OutTraceDW OutTrace static HookEntry_Type Hooks[]={ {"mciSendCommandA", NULL, (FARPROC *)&pmciSendCommand, (FARPROC)extmciSendCommand}, @@ -50,18 +50,18 @@ MMRESULT WINAPI exttimeSetEvent(UINT uDelay, UINT uResolution, LPTIMECALLBACK lp { MMRESULT res; //uDelay = uDelay * 8; - OutTraceD("timeSetEvent: Delay=%d Resolution=%d Event=%x\n", uDelay, uResolution, fuEvent); + OutTraceDW("timeSetEvent: Delay=%d Resolution=%d Event=%x\n", uDelay, uResolution, fuEvent); res=(*ptimeSetEvent)(uDelay, uResolution, lpTimeProc, dwUser, fuEvent); - OutTraceD("timeSetEvent: ret=%x\n", res); + OutTraceDW("timeSetEvent: ret=%x\n", res); return res; } MMRESULT WINAPI exttimeKillEvent(UINT uTimerID) { MMRESULT res; - OutTraceD("timeKillEvent: TimerID=%x\n", uTimerID); + OutTraceDW("timeKillEvent: TimerID=%x\n", uTimerID); res=(*ptimeKillEvent)(uTimerID); - OutTraceD("timeKillEvent: ret=%x\n", res); + OutTraceDW("timeKillEvent: ret=%x\n", res); return res; } @@ -84,7 +84,7 @@ MCIERROR WINAPI extmciSendCommand(MCIDEVICEID IDDevice, UINT uMsg, DWORD_PTR fdw MCI_ANIM_RECT_PARMS *pr; MCI_OVLY_WINDOW_PARMSW *pw; - OutTraceD("mciSendCommand: IDDevice=%x msg=%x(%s) Command=%x(%s)\n", + OutTraceDW("mciSendCommand: IDDevice=%x msg=%x(%s) Command=%x(%s)\n", IDDevice, uMsg, ExplainMCICommands(uMsg), fdwCommand, ExplainMCIFlags(uMsg, fdwCommand)); if(dxw.IsFullScreen()){ diff --git a/dll/wintrust.cpp b/dll/wintrust.cpp index e641d0c..d2c1406 100644 --- a/dll/wintrust.cpp +++ b/dll/wintrust.cpp @@ -28,8 +28,8 @@ FARPROC Remap_trust_ProcAddress(LPCSTR proc, HMODULE hModule) LONG WINAPI extWinVerifyTrust(HWND hWnd, GUID *pgActionID, LPVOID pWVTData) { LONG ret; - OutTraceD("WinVerifyTrust: hwnd=%x pgActionID=%x pWVTData=%x\n", hWnd, pgActionID, pWVTData); + OutTraceDW("WinVerifyTrust: hwnd=%x pgActionID=%x pWVTData=%x\n", hWnd, pgActionID, pWVTData); ret = (*pWinVerifyTrust)(hWnd, pgActionID, pWVTData); - OutTraceD("WinVerifyTrust: ret=%x\n", ret); + OutTraceDW("WinVerifyTrust: ret=%x\n", ret); return ret; } diff --git a/dll/wndproc.cpp b/dll/wndproc.cpp index 9a68ce8..102b820 100644 --- a/dll/wndproc.cpp +++ b/dll/wndproc.cpp @@ -32,7 +32,7 @@ void WhndStackPush(HWND hwnd, WNDPROC wndproc) // wndproc values of 0xFFFFxxxx type seems to be error codes rather than valid callback addresses .... // v2.02.36 using CallWindowProc you can pass WinProc handles, so you don't need to eliminate them! //if (((DWORD)wndproc & 0xFFFF0000) == 0xFFFF0000) return; - //OutTraceD("DEBUG: WNDPROC STACK push hwnd=%x, wndproc=%x\n", hwnd, wndproc); + //OutTraceDW("DEBUG: WNDPROC STACK push hwnd=%x, wndproc=%x\n", hwnd, wndproc); // try update first... for(StackIdx=0; StackIdxm_ZBufferClean); DDX_Check(pDX, IDC_ZBUFFER0CLEAN, cTarget->m_ZBuffer0Clean); DDX_Check(pDX, IDC_NOPOWER2FIX, cTarget->m_NoPower2Fix); + DDX_Check(pDX, IDC_NOPERFCOUNTER, cTarget->m_NoPerfCounter); } BEGIN_MESSAGE_MAP(CTabCompat, CDialog) diff --git a/host/TabDirectX.cpp b/host/TabDirectX.cpp index a2daaa8..0efd812 100644 --- a/host/TabDirectX.cpp +++ b/host/TabDirectX.cpp @@ -43,6 +43,7 @@ void CTabDirectX::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_NOPIXELFORMAT, cTarget->m_NoPixelFormat); DDX_Check(pDX, IDC_NOALPHACHANNEL, cTarget->m_NoAlphaChannel); DDX_Check(pDX, IDC_FIXREFCOUNTER, cTarget->m_FixRefCounter); + DDX_Check(pDX, IDC_ADDPROXYLIBS, cTarget->m_AddProxyLibs); //DDX_Check(pDX, IDC_SAVECAPS, cTarget->m_SaveCaps); } diff --git a/host/TabLogs.cpp b/host/TabLogs.cpp index 1a8802f..fa8be17 100644 --- a/host/TabLogs.cpp +++ b/host/TabLogs.cpp @@ -36,12 +36,14 @@ void CTabLogs::DoDataExchange(CDataExchange* pDX) CDialog::DoDataExchange(pDX); CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent())); //extern BOOL gbDebug; - DDX_Check(pDX, IDC_OUTTRACE, cTarget->m_OutTrace); + DDX_Check(pDX, IDC_OUTPROXYTRACE, cTarget->m_OutProxyTrace); + DDX_Check(pDX, IDC_OUTD3DTRACE, cTarget->m_OutD3DTrace); + DDX_Check(pDX, IDC_OUTDDRAWTRACE, cTarget->m_OutDDRAWTrace); DDX_Check(pDX, IDC_OUTDEBUG, cTarget->m_OutDebug); DDX_Check(pDX, IDC_CURSORTRACE, cTarget->m_CursorTrace); DDX_Check(pDX, IDC_LOGENABLED, cTarget->m_LogEnabled); DDX_Check(pDX, IDC_OUTWINMESSAGES, cTarget->m_OutWinMessages); - DDX_Check(pDX, IDC_OUTDXTRACE, cTarget->m_OutDXTrace); + DDX_Check(pDX, IDC_OUTDWTRACE, cTarget->m_OutDWTrace); DDX_Check(pDX, IDC_IMPORTTABLE, cTarget->m_ImportTable); DDX_Check(pDX, IDC_OUTREGISTRY, cTarget->m_RegistryOp); DDX_Check(pDX, IDC_TRACEHOOKS, cTarget->m_TraceHooks); diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index 3ea2c6c..3b21729 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -26,11 +26,13 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_DCEmulationMode = 0; // default: no emulation m_HookDI = FALSE; m_ModifyMouse = TRUE; // default true !! - m_OutTrace = FALSE; + m_OutProxyTrace = FALSE; m_OutDebug = FALSE; m_CursorTrace = FALSE; m_OutWinMessages = FALSE; - m_OutDXTrace = FALSE; + m_OutDWTrace = FALSE; + m_OutD3DTrace = FALSE; + m_OutDDRAWTrace = FALSE; m_DXProxed = FALSE; m_HandleDC = FALSE; m_HandleExceptions = FALSE; @@ -58,6 +60,8 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_ZBufferAlways = FALSE; m_DisableFogging = FALSE; m_NoPower2Fix = FALSE; + m_NoPerfCounter = FALSE; + m_AddProxyLibs = FALSE; m_UnNotify = FALSE; m_Windowize = TRUE; // default true !! m_HookDLLs = TRUE; // default true !! diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 7b6605f..481d228 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -29,12 +29,14 @@ public: int m_DCEmulationMode; BOOL m_HookDI; BOOL m_ModifyMouse; - BOOL m_OutTrace; + BOOL m_OutProxyTrace; BOOL m_OutDebug; BOOL m_CursorTrace; BOOL m_LogEnabled; BOOL m_OutWinMessages; - BOOL m_OutDXTrace; + BOOL m_OutDWTrace; + BOOL m_OutD3DTrace; + BOOL m_OutDDRAWTrace; BOOL m_DXProxed; BOOL m_AssertDialog; BOOL m_ImportTable; @@ -120,6 +122,8 @@ public: BOOL m_ZBuffer0Clean; BOOL m_ZBufferAlways; BOOL m_NoPower2Fix; + BOOL m_NoPerfCounter; + BOOL m_AddProxyLibs; BOOL m_DisableFogging; BOOL m_SuppressIME; BOOL m_SetCompatibility; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index c083292..b9b4f78 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.cpp b/host/dxwndhost.cpp index 3bf2421..ae5e66d 100644 --- a/host/dxwndhost.cpp +++ b/host/dxwndhost.cpp @@ -213,4 +213,4 @@ char *GetTSCaption(int shift) ":6",":8",":12",":16"}; if (shift<-8 || shift>8) return "???"; return sTSCaption[shift+8]; -} \ No newline at end of file +} diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index e819ac9..7bae9e6 100644 --- a/host/dxwndhost.rc +++ b/host/dxwndhost.rc @@ -95,6 +95,13 @@ BEGIN MENUITEM "&Resume", ID_TASK_RESUME MENUITEM "&Kill", ID_TASK_KILL END + POPUP "Desktop color depth" + BEGIN + MENUITEM " 8 BPP", ID_DESKTOPCOLORDEPTH_8BPP + MENUITEM "16 BPP", ID_DESKTOPCOLORDEPTH_16BPP + MENUITEM "24 BPP", ID_DESKTOPCOLORDEPTH_24BPP + MENUITEM "32 BPP", ID_DESKTOPCOLORDEPTH_32BPP + END MENUITEM "Move to Tray", ID_FILE_GOTOTRAYICON MENUITEM "e&Xit", ID_DXAPP_EXIT END @@ -285,16 +292,18 @@ IDD_TAB_LOG DIALOGEX 0, 0, 300, 240 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - GROUPBOX "dxwnd.log logs",IDC_STATIC,7,3,129,145 + GROUPBOX "dxwnd.log logs",IDC_STATIC,7,3,129,173 CONTROL "Enable Trace",IDC_LOGENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,25,73,12 - CONTROL "DxWnd",IDC_OUTTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,73,12 - CONTROL "DirectX trace",IDC_OUTDXTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,58,73,12 - CONTROL "Win Events",IDC_OUTWINMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,70,73,12 - CONTROL "Cursor/Mouse",IDC_CURSORTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,82,73,12 - CONTROL "Import Table",IDC_IMPORTTABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,94,73,12 - CONTROL "Debug",IDC_OUTDEBUG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,106,73,12 - CONTROL "Registry op.",IDC_OUTREGISTRY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,118,73,12 - CONTROL "Hook op.",IDC_TRACEHOOKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,130,73,12 + CONTROL "DirectX full trace",IDC_OUTPROXYTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,82,73,12 + CONTROL "DxWnd hacks",IDC_OUTDWTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,46,73,12 + CONTROL "Win Events",IDC_OUTWINMESSAGES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,94,73,12 + CONTROL "Cursor/Mouse",IDC_CURSORTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,106,73,12 + CONTROL "Import Table",IDC_IMPORTTABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,118,73,12 + CONTROL "Debug",IDC_OUTDEBUG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,130,73,12 + CONTROL "Registry op.",IDC_OUTREGISTRY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,142,73,12 + CONTROL "Hook op.",IDC_TRACEHOOKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,154,73,12 + CONTROL "Direct3D trace",IDC_OUTD3DTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,70,73,12 + CONTROL "DirectDraw Trace",IDC_OUTDDRAWTRACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,58,73,12 END IDD_TAB_DIRECTX DIALOGEX 0, 0, 300, 240 @@ -316,7 +325,7 @@ BEGIN GROUPBOX "DirectX Version Hook",IDC_STATIC,6,3,98,103,WS_GROUP GROUPBOX "Emulation",IDC_STATIC,7,109,98,80,WS_GROUP CONTROL "Auto Primary Surface Refresh",IDC_AUTOREFRESH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,16,126,9 - GROUPBOX "DirectDraw Surface handling",IDC_STATIC,112,3,181,186 + GROUPBOX "DirectDraw Surface handling",IDC_STATIC,112,3,181,230 CONTROL "switch VIDEO to SYSTEM on fail",IDC_VIDEOTOSYSTEMMEM, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,118,28,126,9 CONTROL "Suppress DX common errors",IDC_SUPPRESSDXERRORS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,40,127,10 @@ -332,6 +341,7 @@ BEGIN CONTROL "by default set no ALPHACHANNEL",IDC_NOALPHACHANNEL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,160,123,12 CONTROL "Fix ddraw ref counter",IDC_FIXREFCOUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,172,123,12 + CONTROL "Add proxy libs",IDC_ADDPROXYLIBS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,184,123,12 END IDD_TAB_INPUT DIALOGEX 0, 0, 300, 240 @@ -445,6 +455,7 @@ BEGIN CONTROL "Clean ZBUFFER @1.0 fix",IDC_ZBUFFERCLEAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,116,109,12 CONTROL "Clean ZBUFFER @0.0 fix",IDC_ZBUFFER0CLEAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,104,109,12 CONTROL "Textures not power of 2 fix",IDC_NOPOWER2FIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,92,109,12 + CONTROL "Disable performance counter",IDC_NOPERFCOUNTER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,80,109,12 END IDD_TAB_SYSLIBS DIALOGEX 0, 0, 300, 240 diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo index 9e72604..4eb07bf 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp index e141ccb..9078696 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -65,6 +65,10 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView) ON_COMMAND(ID_VIEW_STATUS, OnViewStatus) ON_COMMAND(ID_VIEW_PALETTE, OnViewPalette) ON_COMMAND(ID_VIEW_TIMESLIDER, OnViewTimeSlider) + ON_COMMAND(ID_DESKTOPCOLORDEPTH_8BPP, OnDesktopcolordepth8bpp) + ON_COMMAND(ID_DESKTOPCOLORDEPTH_16BPP, OnDesktopcolordepth16bpp) + ON_COMMAND(ID_DESKTOPCOLORDEPTH_24BPP, OnDesktopcolordepth24bpp) + ON_COMMAND(ID_DESKTOPCOLORDEPTH_32BPP, OnDesktopcolordepth32bpp) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -137,12 +141,14 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) } if(dlg->m_HookDI) t->flags |= HOOKDI; if(dlg->m_ModifyMouse) t->flags |= MODIFYMOUSE; - if(dlg->m_OutTrace) t->tflags |= OUTDDRAWTRACE; + if(dlg->m_OutProxyTrace) t->tflags |= OUTPROXYTRACE; if(dlg->m_OutDebug) t->tflags |= OUTDEBUG; if(dlg->m_CursorTrace) t->tflags |= OUTCURSORTRACE; if(dlg->m_LogEnabled) t->tflags |= OUTTRACE; if(dlg->m_OutWinMessages) t->tflags |= OUTWINMESSAGES; - if(dlg->m_OutDXTrace) t->tflags |= OUTPROXYTRACE; + if(dlg->m_OutDWTrace) t->tflags |= OUTDXWINTRACE; + if(dlg->m_OutDDRAWTrace) t->tflags |= OUTDDRAWTRACE; + if(dlg->m_OutD3DTrace) t->tflags |= OUTD3DTRACE; if(dlg->m_DXProxed) t->tflags |= DXPROXED; if(dlg->m_AssertDialog) t->tflags |= ASSERTDIALOG; if(dlg->m_ImportTable) t->tflags |= OUTIMPORTTABLE; @@ -158,6 +164,8 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_ZBuffer0Clean) t->flags4 |= ZBUFFER0CLEAN; if(dlg->m_ZBufferAlways) t->flags4 |= ZBUFFERALWAYS; if(dlg->m_NoPower2Fix) t->flags4 |= NOPOWER2FIX; + if(dlg->m_NoPerfCounter) t->flags4 |= NOPERFCOUNTER; + if(dlg->m_AddProxyLibs) t->flags4 |= ADDPROXYLIBS; if(dlg->m_DisableFogging) t->flags4 |= DISABLEFOGGING; if(dlg->m_SuppressIME) t->flags2 |= SUPPRESSIME; if(dlg->m_SuppressD3DExt) t->flags3 |= SUPPRESSD3DEXT; @@ -281,12 +289,14 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_HookDI = t->flags & HOOKDI ? 1 : 0; dlg->m_ModifyMouse = t->flags & MODIFYMOUSE ? 1 : 0; - dlg->m_OutTrace = t->tflags & OUTDDRAWTRACE ? 1 : 0; + dlg->m_OutProxyTrace = t->tflags & OUTPROXYTRACE ? 1 : 0; dlg->m_OutDebug = t->tflags & OUTDEBUG ? 1 : 0; dlg->m_CursorTrace = t->tflags & OUTCURSORTRACE ? 1 : 0; dlg->m_LogEnabled = t->tflags & OUTTRACE ? 1 : 0; dlg->m_OutWinMessages = t->tflags & OUTWINMESSAGES ? 1 : 0; - dlg->m_OutDXTrace = t->tflags & OUTPROXYTRACE ? 1 : 0; + dlg->m_OutDWTrace = t->tflags & OUTDXWINTRACE ? 1 : 0; + dlg->m_OutD3DTrace = t->tflags & OUTD3DTRACE ? 1 : 0; + dlg->m_OutDDRAWTrace = t->tflags & OUTDDRAWTRACE ? 1 : 0; dlg->m_DXProxed = t->tflags & DXPROXED ? 1 : 0; dlg->m_AssertDialog = t->tflags & ASSERTDIALOG ? 1 : 0; dlg->m_ImportTable = t->tflags & OUTIMPORTTABLE ? 1 : 0; @@ -317,6 +327,8 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_ZBuffer0Clean = t->flags4 & ZBUFFER0CLEAN ? 1 : 0; dlg->m_ZBufferAlways = t->flags4 & ZBUFFERALWAYS ? 1 : 0; dlg->m_NoPower2Fix = t->flags4 & NOPOWER2FIX ? 1 : 0; + dlg->m_NoPerfCounter = t->flags4 & NOPERFCOUNTER ? 1 : 0; + dlg->m_AddProxyLibs = t->flags4 & ADDPROXYLIBS ? 1 : 0; dlg->m_DisableFogging = t->flags4 & DISABLEFOGGING ? 1 : 0; dlg->m_SaveLoad = t->flags & SAVELOAD ? 1 : 0; dlg->m_SlowDown = t->flags & SLOWDOWN ? 1 : 0; @@ -1423,6 +1435,18 @@ void CDxwndhostView::OnRButtonDown(UINT nFlags, CPoint point) case ID_FILE_IMPORT: OnImport(); break; + case ID_DESKTOPCOLORDEPTH_8BPP: + OnDesktopcolordepth8bpp(); + break; + case ID_DESKTOPCOLORDEPTH_16BPP: + OnDesktopcolordepth16bpp(); + break; + case ID_DESKTOPCOLORDEPTH_24BPP: + OnDesktopcolordepth24bpp(); + break; + case ID_DESKTOPCOLORDEPTH_32BPP: + OnDesktopcolordepth32bpp(); + break; } CListView::OnRButtonDown(nFlags, point); } @@ -1555,3 +1579,57 @@ void CDxwndhostView::OnRun() CreateProcess(NULL, TargetMaps[i].path, 0, 0, false, CREATE_DEFAULT_ERROR_MODE, NULL, path, &sinfo, &pinfo); } } + +void SwitchToColorDepth(int bpp) +{ + DEVMODE CurrentDevMode; + BOOL res; + char MsgBuf[256+1]; + EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &CurrentDevMode); + sprintf(MsgBuf, "ChangeDisplaySettings: color depth %d -> %d BPP\n", CurrentDevMode.dmBitsPerPel, bpp); + if(MessageBoxEx(0, MsgBuf, "Warning", MB_OKCANCEL | MB_ICONQUESTION, NULL)!=IDOK) return; + //OutTraceDW("ChangeDisplaySettings: CURRENT wxh=(%dx%d) BitsPerPel=%d -> 16\n", + // CurrentDevMode.dmPelsWidth, CurrentDevMode.dmPelsHeight, CurrentDevMode.dmBitsPerPel); + CurrentDevMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; + CurrentDevMode.dmBitsPerPel = bpp; + res=ChangeDisplaySettings(&CurrentDevMode, CDS_UPDATEREGISTRY); + if(res!=DISP_CHANGE_SUCCESSFUL) { + char *err; + switch(res){ + case DISP_CHANGE_BADDUALVIEW: err="BADDUALVIEW"; break; + case DISP_CHANGE_BADFLAGS: err="BADFLAGS"; break; + case DISP_CHANGE_BADMODE: err="BADMODE"; break; + case DISP_CHANGE_BADPARAM: err="BADPARAM"; break; + case DISP_CHANGE_FAILED: err="FAILED"; break; + case DISP_CHANGE_NOTUPDATED: err="NOTUPDATED"; break; + case DISP_CHANGE_RESTART: err="RESTART"; break; + default: err="???"; break; + } + sprintf(MsgBuf, "ChangeDisplaySettings ERROR res=%s err=%d\n", err, GetLastError()); + MessageBoxEx(0, MsgBuf, "Error", MB_OKCANCEL | MB_ICONQUESTION, NULL); + } +} + +void CDxwndhostView::OnDesktopcolordepth8bpp() +{ + // TODO: Add your command handler code here + SwitchToColorDepth(8); +} + +void CDxwndhostView::OnDesktopcolordepth16bpp() +{ + // TODO: Add your command handler code here + SwitchToColorDepth(16); +} + +void CDxwndhostView::OnDesktopcolordepth24bpp() +{ + // TODO: Add your command handler code here + SwitchToColorDepth(24); +} + +void CDxwndhostView::OnDesktopcolordepth32bpp() +{ + // TODO: Add your command handler code here + SwitchToColorDepth(32); +} diff --git a/host/dxwndhostView.h b/host/dxwndhostView.h index d3597de..c7ee42c 100644 --- a/host/dxwndhostView.h +++ b/host/dxwndhostView.h @@ -86,6 +86,10 @@ protected: afx_msg void OnViewPalette(); afx_msg void OnViewTimeSlider(); afx_msg void OnExit(); + afx_msg void OnDesktopcolordepth8bpp(); + afx_msg void OnDesktopcolordepth16bpp(); + afx_msg void OnDesktopcolordepth24bpp(); + afx_msg void OnDesktopcolordepth32bpp(); //}}AFX_MSG DECLARE_MESSAGE_MAP() };