diff --git a/Include/dxwnd.h b/Include/dxwnd.h index 850d9f4..a8b1e98 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -1,4 +1,5 @@ #include +//#include "dxwcore.hpp" #define DXW_IDLE 0 #define DXW_ACTIVE 1 @@ -8,7 +9,7 @@ #define DXWACTIVATESINGLETASK 1 // comment to allow multiple task activations -// first flags DWORD dwFlags: +// first flags DWORD dwFlags1: #define UNNOTIFY 0x00000001 #define EMULATESURFACE 0x00000002 #define CLIPCURSOR 0x00000004 // Force cursor clipping within window @@ -42,7 +43,7 @@ #define HOOKCHILDWIN 0x40000000 // hook CHILD windows to alter placement coordinates (UNUSED) #define MESSAGEPROC 0x80000000 // process peek/get messages -// second flags DWORD dwFlags2: +// second flags DWORD dxw.dwFlags2: #define RECOVERSCREENMODE 0x00000001 // actively set screen mode to initial state after hooking #define REFRESHONRESIZE 0x00000002 // forces a refresh (blitting from backbuffer to primary) upon win resize #define BACKBUFATTACH 0x00000004 // sets backbuf wxh dim. equal to primary surface so that ZBUFFER is attachable..... @@ -103,16 +104,6 @@ typedef struct BOOL isLogging; } DXWNDSTATUS; -typedef struct -{ - // (full)screen width & height - DWORD dwWidth, dwHeight; - DDPIXELFORMAT PixelFormat; - DWORD dwPrimarySurfaceCaps; - DWORD dwBackBufferCount; -} ScreenDef_Type; - -extern ScreenDef_Type ActualScr, VirtualScr; extern DXWNDSTATUS DxWndStatus; int SetTarget(TARGETMAP *); @@ -132,25 +123,24 @@ LRESULT CALLBACK extWindowProc(HWND, UINT, WPARAM, LPARAM); // defines below to condition debug message handling -#define OutTraceW if(dwTFlags & OUTWINMESSAGES) OutTrace -#define OutTraceX if(dwTFlags & OUTPROXYTRACE) OutTrace -#define OutTraceD if(dwTFlags & OUTDDRAWTRACE) OutTrace -#define OutTraceC if(dwTFlags & OUTCURSORTRACE) OutTrace +#define OutTraceW if(dxw.dwTFlags & OUTWINMESSAGES) OutTrace +#define OutTraceX if(dxw.dwTFlags & OUTPROXYTRACE) OutTrace +#define OutTraceD if(dxw.dwTFlags & OUTDDRAWTRACE) OutTrace +#define OutTraceC if(dxw.dwTFlags & OUTCURSORTRACE) OutTrace #define OutTraceP OutTrace #define OutTraceE OutTrace -#define IsTraceW (dwTFlags & OUTWINMESSAGES) -#define IsTraceX (dwTFlags & OUTPROXYTRACE) -#define IsTraceD (dwTFlags & OUTDDRAWTRACE) -#define IsTraceC (dwTFlags & OUTCURSORTRACE) +#define IsTraceW (dxw.dwTFlags & OUTWINMESSAGES) +#define IsTraceX (dxw.dwTFlags & OUTPROXYTRACE) +#define IsTraceD (dxw.dwTFlags & OUTDDRAWTRACE) +#define IsTraceC (dxw.dwTFlags & OUTCURSORTRACE) #define IsTraceP (TRUE) #define IsTraceE (TRUE) -#define IsDebug (dwTFlags & OUTDEBUG) -#define IsAssertEnabled (dwTFlags & ASSERTDIALOG) +#define IsDebug (dxw.dwTFlags & OUTDEBUG) +#define IsAssertEnabled (dxw.dwTFlags & ASSERTDIALOG) +#define STEP OutTrace("STEP at %s:%d\n", __MODULE__, __LINE__) extern void WhndStackPush(HWND, WNDPROC); extern WNDPROC WhndGetWindowProc(HWND ); -extern DWORD dwFlags, dwFlags2, dwTFlags; -#define debugstep OutTrace("STEP at %d\n", __LINE__) diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 2a10ca4..ee52589 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:45ea0ab9cba93c39da05d08c0c2a8798c647186d5882dfdc679e1ab2bf3b4e25 -size 266240 +oid sha256:2556cf08b2c38ff21834f13e3202ea976936eefd2b5b2da3ce11fc1d878f633a +size 259072 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index f33e4ce..f07818d 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d61f3984a2545612ddb0ea7cb3dca19bbf5cfe4b12acdd6c61de8b85816692a -size 483328 +oid sha256:d0ef26bafd26df050cec17c30948cf719a91fd7eb300bdca5a069410c76f5928 +size 482816 diff --git a/build/dxwnd.ini b/build/dxwnd.ini deleted file mode 100644 index 9e73708..0000000 --- a/build/dxwnd.ini +++ /dev/null @@ -1,35 +0,0 @@ -[target] -title0=The Grinch -path0=D:\Games\The_Grinch\The Grinch\bin\TheGrinch.exe -module0= -ver0=10 -flag0=536870914 -flagg0=16 -tflag0=0 -initx0=0 -inity0=0 -minx0=0 -miny0=0 -maxx0=0 -maxy0=0 -posx0=50 -posy0=50 -sizx0=800 -sizy0=600 -title1=7th Legion -path1=D:\Games\7th Legion\legion.exe -module1= -ver1=0 -flag1=16418 -flagg1=2128 -tflag1=0 -initx1=0 -inity1=0 -minx1=0 -miny1=0 -maxx1=0 -maxy1=0 -posx1=50 -posy1=50 -sizx1=800 -sizy1=600 diff --git a/debug/dxwnd.ini b/debug/dxwnd.ini new file mode 100644 index 0000000..61ec2b7 --- /dev/null +++ b/debug/dxwnd.ini @@ -0,0 +1,3197 @@ +[target] +title0=1602 A.D. +path0=C:\Games\1602 A.D\1602.exe +module0= +ver0=0 +flag0=679608354 +flagg0=0 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +title1=7th Legion +path1=D:\Games\7th_Legion\LEGION.EXE +module1= +ver1=0 +flag1=402669607 +flagg1=2064 +tflag1=13 +initx1=0 +inity1=0 +minx1=0 +miny1=0 +maxx1=0 +maxy1=0 +posx1=50 +posy1=50 +sizx1=800 +sizy1=600 +title2=A10 Cuba +path2=D:\Games\A10\A10Cuba.exe +module2= +ver2=0 +flag2=34 +flagg2=0 +tflag2=0 +initx2=0 +inity2=0 +minx2=0 +miny2=0 +maxx2=0 +maxy2=0 +posx2=50 +posy2=50 +sizx2=800 +sizy2=600 +title3=Achtung Spitfire +path3=C:\Games\Achtung Spitfire\ASP95.EXE +module3= +ver3=0 +flag3=536870946 +flagg3=0 +tflag3=70 +initx3=0 +inity3=0 +minx3=0 +miny3=0 +maxx3=0 +maxy3=0 +posx3=50 +posy3=50 +sizx3=800 +sizy3=600 +title4=Actua Soccer 3 +path4=C:\Games\ActuaSoccer3\ActuaSoccer3\Soccer3.exe +module4= +ver4=0 +flag4=671088928 +flagg4=256 +tflag4=0 +initx4=0 +inity4=0 +minx4=0 +miny4=0 +maxx4=0 +maxy4=0 +posx4=50 +posy4=50 +sizx4=800 +sizy4=600 +title5=AfterLife +path5=d:\Games\ALIFE\ALIFE.EXE +module5= +ver5=1 +flag5=134217762 +flagg5=32 +tflag5=3 +initx5=0 +inity5=0 +minx5=0 +miny5=0 +maxx5=0 +maxy5=0 +posx5=50 +posy5=50 +sizx5=800 +sizy5=600 +title6=Age of Empires +path6=D:\Games\Age of Empires\EMPIRES.EXE +module6= +ver6=0 +flag6=268436006 +flagg6=16 +tflag6=3 +initx6=0 +inity6=0 +minx6=0 +miny6=0 +maxx6=0 +maxy6=0 +posx6=50 +posy6=50 +sizx6=800 +sizy6=600 +title7=Airline Tycoon Evolution +path7=C:\Games\Airline.Tycoon.Evolution.UV.Carlows\AT.EXE +module7= +ver7=0 +flag7=32 +flagg7=0 +tflag7=2 +initx7=0 +inity7=0 +minx7=0 +miny7=0 +maxx7=0 +maxy7=0 +posx7=50 +posy7=50 +sizx7=800 +sizy7=600 +title8=Alien Cabal 95 +path8=C:\Games\Alien_cabal\ACabal95.exe +module8= +ver8=0 +flag8=67108896 +flagg8=0 +tflag8=2 +initx8=0 +inity8=0 +minx8=0 +miny8=0 +maxx8=0 +maxy8=0 +posx8=50 +posy8=50 +sizx8=800 +sizy8=600 +title9=Alien vs. Predator +path9=C:\Games\Alien vs Predator\AvP.exe +module9= +ver9=0 +flag9=8224 +flagg9=0 +tflag9=130 +initx9=0 +inity9=0 +minx9=0 +miny9=0 +maxx9=0 +maxy9=0 +posx9=50 +posy9=50 +sizx9=800 +sizy9=600 +title10=Aliens Nations Demo +path10=C:\Games\aademo\Bin\AA.exe +module10= +ver10=0 +flag10=134217762 +flagg10=0 +tflag10=0 +initx10=0 +inity10=0 +minx10=0 +miny10=0 +maxx10=0 +maxy10=0 +posx10=0 +posy10=0 +sizx10=800 +sizy10=600 +title11=America +path11=D:\Games\America\america.exe +module11= +ver11=0 +flag11=134234150 +flagg11=16 +tflag11=0 +initx11=0 +inity11=0 +minx11=0 +miny11=0 +maxx11=0 +maxy11=0 +posx11=50 +posy11=50 +sizx11=800 +sizy11=600 +title12=Ancient Evil +path12=C:\Games\Ancient Evil\RPG.EXE +module12=DDW16.DLL +ver12=1 +flag12=-2013249497 +flagg12=0 +tflag12=2 +initx12=0 +inity12=0 +minx12=0 +miny12=0 +maxx12=0 +maxy12=0 +posx12=50 +posy12=50 +sizx12=800 +sizy12=600 +title13=Ancient Evil Demo +path13=C:\Games\Ancient Evil Curse of the Snake Cult\aecsc-demo.exe +module13= +ver13=1 +flag13=134242336 +flagg13=0 +tflag13=0 +initx13=0 +inity13=0 +minx13=0 +miny13=0 +maxx13=0 +maxy13=0 +posx13=50 +posy13=50 +sizx13=800 +sizy13=600 +title14=Armymen +path14=C:\Games\armymen\Armymen.exe +module14= +ver14=0 +flag14=134218274 +flagg14=1 +tflag14=0 +initx14=0 +inity14=0 +minx14=0 +miny14=0 +maxx14=0 +maxy14=0 +posx14=50 +posy14=50 +sizx14=800 +sizy14=600 +title15=ArmyMen 2 +path15=C:\Games\army2\ArmyMen2.exe +module15= +ver15=0 +flag15=402653730 +flagg15=0 +tflag15=0 +initx15=0 +inity15=0 +minx15=0 +miny15=0 +maxx15=0 +maxy15=0 +posx15=50 +posy15=50 +sizx15=800 +sizy15=600 +title16=Atomic Bomberman +path16=C:\Games\Atomic Bomberman\BM95.EXE +module16= +ver16=0 +flag16=2 +flagg16=0 +tflag16=0 +initx16=0 +inity16=0 +minx16=0 +miny16=0 +maxx16=0 +maxy16=0 +posx16=50 +posy16=50 +sizx16=800 +sizy16=600 +title17=Axis & Allies Iron Blitz Edition +path17=C:\Games\Axis & Allies Iron Blitz Edition\Axis & Allies\AxisAllies.exe +module17= +ver17=0 +flag17=-2147483614 +flagg17=0 +tflag17=0 +initx17=0 +inity17=0 +minx17=0 +miny17=0 +maxx17=0 +maxy17=0 +posx17=50 +posy17=50 +sizx17=800 +sizy17=600 +title18=Baldies +path18=C:\Games\Baldies for Win95\baldies.exe +module18= +ver18=0 +flag18=537010210 +flagg18=0 +tflag18=0 +initx18=0 +inity18=0 +minx18=0 +miny18=0 +maxx18=0 +maxy18=0 +posx18=50 +posy18=50 +sizx18=800 +sizy18=600 +title19=Battle Arena Toshinden 2 (BAD!!) +path19=C:\Games\Battle Arena Toshinden 2\tsd2\T2.EXE +module19= +ver19=1 +flag19=8388640 +flagg19=0 +tflag19=258 +initx19=0 +inity19=0 +minx19=0 +miny19=0 +maxx19=0 +maxy19=0 +posx19=50 +posy19=50 +sizx19=800 +sizy19=600 +title20=Beasts & Bumpkins +path20=C:\Games\Beasts and Bumpkins\BEASTS.EXE +module20= +ver20=0 +flag20=2105890 +flagg20=0 +tflag20=2 +initx20=0 +inity20=0 +minx20=0 +miny20=0 +maxx20=0 +maxy20=0 +posx20=50 +posy20=50 +sizx20=800 +sizy20=600 +title21=Beats of Rage +path21=C:\Games\BOR\BeatsOfRage.exe +module21= +ver21=0 +flag21=537002018 +flagg21=0 +tflag21=0 +initx21=0 +inity21=0 +minx21=0 +miny21=0 +maxx21=0 +maxy21=0 +posx21=50 +posy21=50 +sizx21=800 +sizy21=600 +title22=Beyond Good & Evil Demo +path22=C:\Games\Beyond Good & Evil\BGE.exe +module22= +ver22=0 +flag22=0 +flagg22=0 +tflag22=0 +initx22=0 +inity22=0 +minx22=0 +miny22=0 +maxx22=0 +maxy22=0 +posx22=50 +posy22=50 +sizx22=800 +sizy22=600 +title23=Black Moon Lune Noire +path23=C:\Games\Black Moon\Lune noire\Engine.exe +module23= +ver23=0 +flag23=262179 +flagg23=0 +tflag23=0 +initx23=0 +inity23=0 +minx23=0 +miny23=0 +maxx23=0 +maxy23=0 +posx23=50 +posy23=50 +sizx23=800 +sizy23=600 +title24=Blood Omen Legacy of Kain +path24=C:\Games\Blood Omen\KAIN.EXE +module24= +ver24=0 +flag24=49190 +flagg24=0 +tflag24=0 +initx24=0 +inity24=0 +minx24=0 +miny24=0 +maxx24=0 +maxy24=0 +posx24=50 +posy24=50 +sizx24=800 +sizy24=600 +title25=Bonkheads +path25=C:\Games\Bonkheads\Bonkheads.exe +module25= +ver25=0 +flag25=262690 +flagg25=16 +tflag25=78 +initx25=0 +inity25=0 +minx25=0 +miny25=0 +maxx25=0 +maxy25=0 +posx25=50 +posy25=50 +sizx25=800 +sizy25=600 +title26=Bubble Bobble 2 +path26=C:\Games\bubble2\BOBO2.EXE +module26= +ver26=0 +flag26=34 +flagg26=0 +tflag26=0 +initx26=0 +inity26=0 +minx26=0 +miny26=0 +maxx26=0 +maxy26=0 +posx26=50 +posy26=50 +sizx26=800 +sizy26=600 +title27=Bug! +path27=C:\Games\Bug\BUG!.EXE +module27= +ver27=0 +flag27=134225954 +flagg27=32 +tflag27=2 +initx27=0 +inity27=0 +minx27=0 +miny27=0 +maxx27=0 +maxy27=0 +posx27=0 +posy27=0 +sizx27=800 +sizy27=600 +title28=Caesar III +path28=C:\Games\Caesar III\c3.exe +module28= +ver28=0 +flag28=-2147475422 +flagg28=0 +tflag28=0 +initx28=0 +inity28=0 +minx28=0 +miny28=0 +maxx28=0 +maxy28=0 +posx28=50 +posy28=50 +sizx28=800 +sizy28=600 +title29=Championship Manager 99-00 +path29=C:\Games\CM9900\cm9900.exe +module29= +ver29=0 +flag29=10306 +flagg29=0 +tflag29=0 +initx29=0 +inity29=0 +minx29=0 +miny29=0 +maxx29=0 +maxy29=0 +posx29=50 +posy29=50 +sizx29=800 +sizy29=600 +title30=Civilization Call to Power +path30=C:\Games\civctp\Civilization_Call_To_Power\ctp_program\ctp\civctp.exe +module30= +ver30=0 +flag30=545267746 +flagg30=0 +tflag30=0 +initx30=0 +inity30=0 +minx30=0 +miny30=0 +maxx30=0 +maxy30=0 +posx30=50 +posy30=50 +sizx30=800 +sizy30=600 +title31=Claw +path31=C:\Games\claw\clawexe.exe +module31= +ver31=0 +flag31=24610 +flagg31=0 +tflag31=0 +initx31=0 +inity31=0 +minx31=0 +miny31=0 +maxx31=0 +maxy31=0 +posx31=50 +posy31=50 +sizx31=800 +sizy31=600 +title32=Commando's Behind Enemy Lines Demo +path32=C:\Games\Commando's Behind Enemy Lines Demo\COMANDOS\Comandos.exe +module32= +ver32=0 +flag32=1744838944 +flagg32=0 +tflag32=64 +initx32=0 +inity32=0 +minx32=0 +miny32=0 +maxx32=0 +maxy32=0 +posx32=50 +posy32=50 +sizx32=800 +sizy32=600 +title33=Commandos II: Men of Courage +path33=C:\Games\Commandos II\comm2.exe +module33= +ver33=0 +flag33=-1207951008 +flagg33=0 +tflag33=0 +initx33=0 +inity33=0 +minx33=0 +miny33=0 +maxx33=0 +maxy33=0 +posx33=50 +posy33=50 +sizx33=800 +sizy33=600 +title34=Crazy Taxy +path34=C:\Games\Crazy_Taxi\Crazy Taxi PC Version\crazy_taxi_pc.exe +module34= +ver34=8 +flag34=536870945 +flagg34=0 +tflag34=0 +initx34=0 +inity34=0 +minx34=0 +miny34=0 +maxx34=0 +maxy34=0 +posx34=50 +posy34=50 +sizx34=800 +sizy34=600 +title35=Crush! Deluxe +path35=C:\Games\Crush! Deluxe\CRUSHD.EXE +module35= +ver35=0 +flag35=134492706 +flagg35=0 +tflag35=0 +initx35=0 +inity35=0 +minx35=0 +miny35=0 +maxx35=0 +maxy35=0 +posx35=50 +posy35=50 +sizx35=800 +sizy35=600 +title36=Cybermercs +path36=C:\Games\cybermercs\cybermercs.exe +module36= +ver36=0 +flag36=134234146 +flagg36=16 +tflag36=0 +initx36=0 +inity36=0 +minx36=0 +miny36=0 +maxx36=0 +maxy36=0 +posx36=50 +posy36=50 +sizx36=800 +sizy36=600 +title37=Darius Gaiden +path37=C:\Games\Darius_gaiden\DARIUS.EXE +module37= +ver37=0 +flag37=536870946 +flagg37=0 +tflag37=0 +initx37=0 +inity37=0 +minx37=0 +miny37=0 +maxx37=0 +maxy37=0 +posx37=50 +posy37=50 +sizx37=800 +sizy37=600 +title38=Dark Colony the Council Wars +path38=C:\Games\darkcolony_council\dc\DC16.EXE +module38= +ver38=0 +flag38=268435462 +flagg38=0 +tflag38=0 +initx38=0 +inity38=0 +minx38=0 +miny38=0 +maxx38=0 +maxy38=0 +posx38=50 +posy38=50 +sizx38=800 +sizy38=600 +title39=Darkstone +path39=C:\Games\darkstone\Darkstone.exe +module39= +ver39=0 +flag39=134234148 +flagg39=0 +tflag39=0 +initx39=0 +inity39=0 +minx39=0 +miny39=0 +maxx39=0 +maxy39=0 +posx39=50 +posy39=50 +sizx39=800 +sizy39=600 +title40=Dave Mirra Freestyle BMX Demo +path40=C:\Games\Dave Mirra Freestyle BMX\NgBMXDemo.exe +module40= +ver40=0 +flag40=8224 +flagg40=0 +tflag40=0 +initx40=0 +inity40=0 +minx40=0 +miny40=0 +maxx40=0 +maxy40=0 +posx40=50 +posy40=50 +sizx40=800 +sizy40=600 +title41=Daytona USA Deluxe +path41=C:\Games\Daytona USA Deluxe\DAYTONA USA Deluxe.exe +module41= +ver41=0 +flag41=402661410 +flagg41=0 +tflag41=0 +initx41=0 +inity41=0 +minx41=0 +miny41=0 +maxx41=0 +maxy41=0 +posx41=50 +posy41=50 +sizx41=800 +sizy41=600 +title42=Deadlock 2 +path42=C:\Games\deadlock2\DEADLOCK.EXE +module42= +ver42=0 +flag42=-2012995550 +flagg42=0 +tflag42=0 +initx42=0 +inity42=0 +minx42=0 +miny42=0 +maxx42=0 +maxy42=0 +posx42=50 +posy42=50 +sizx42=800 +sizy42=600 +title43=Deeper Dungeons 95 +path43=C:\Games\Keeper95\Deeper95.exe +module43= +ver43=0 +flag43=268460070 +flagg43=0 +tflag43=0 +initx43=0 +inity43=0 +minx43=0 +miny43=0 +maxx43=0 +maxy43=0 +posx43=50 +posy43=50 +sizx43=800 +sizy43=600 +title44=Delta Force +path44=C:\Games\Delta Force\Df.exe +module44= +ver44=0 +flag44=34 +flagg44=0 +tflag44=0 +initx44=0 +inity44=0 +minx44=0 +miny44=0 +maxx44=0 +maxy44=0 +posx44=50 +posy44=50 +sizx44=800 +sizy44=600 +title45=Dementia +path45=C:\Games\dementia\program\CRUX.EXE -h +module45= +ver45=0 +flag45=536887330 +flagg45=0 +tflag45=2 +initx45=0 +inity45=0 +minx45=0 +miny45=0 +maxx45=0 +maxy45=0 +posx45=50 +posy45=50 +sizx45=800 +sizy45=600 +title46=Dethkarz +path46=D:\Games\DethKarz\Dethkarz.exe +module46= +ver46=0 +flag46=0 +flagg46=0 +tflag46=0 +initx46=0 +inity46=0 +minx46=0 +miny46=0 +maxx46=0 +maxy46=0 +posx46=50 +posy46=50 +sizx46=800 +sizy46=600 +title47=Devil Inside +path47=C:\Games\Devil Inside\Devil.exe +module47= +ver47=0 +flag47=32 +flagg47=0 +tflag47=0 +initx47=0 +inity47=0 +minx47=0 +miny47=0 +maxx47=0 +maxy47=0 +posx47=50 +posy47=50 +sizx47=800 +sizy47=600 +title48=Diablo +path48=D:\Games\Diablo\Diablo.exe +module48= +ver48=1 +flag48=134234150 +flagg48=16 +tflag48=3 +initx48=0 +inity48=0 +minx48=0 +miny48=0 +maxx48=0 +maxy48=0 +posx48=50 +posy48=50 +sizx48=800 +sizy48=600 +title49=Dink Smallwood (BAD) +path49=C:\Games\Dink SmallWood\Dink.exe +module49= +ver49=0 +flag49=546 +flagg49=0 +tflag49=258 +initx49=0 +inity49=0 +minx49=0 +miny49=0 +maxx49=0 +maxy49=0 +posx49=50 +posy49=50 +sizx49=800 +sizy49=600 +title50=Drakan +path50=C:\Games\Drakan\drakan.exe +module50= +ver50=0 +flag50=536887328 +flagg50=0 +tflag50=0 +initx50=0 +inity50=0 +minx50=0 +miny50=0 +maxx50=0 +maxy50=0 +posx50=50 +posy50=50 +sizx50=800 +sizy50=600 +title51=Dungeon Keeper 95 +path51=D:\Games\Keeper95\KEEPER95.EXE +module51= +ver51=0 +flag51=24614 +flagg51=0 +tflag51=64 +initx51=0 +inity51=0 +minx51=0 +miny51=0 +maxx51=0 +maxy51=0 +posx51=50 +posy51=50 +sizx51=800 +sizy51=600 +title52=Dungeon Keeper II +path52=C:\Games\Dungeon Keeper II\DKII.exe +module52= +ver52=0 +flag52=34 +flagg52=0 +tflag52=82 +initx52=0 +inity52=0 +minx52=0 +miny52=0 +maxx52=0 +maxy52=0 +posx52=50 +posy52=50 +sizx52=800 +sizy52=600 +title53=Emergency Fighters for life +path53=D:\Games\Emergency\EMERGY.EXE +module53= +ver53=0 +flag53=134283811 +flagg53=18 +tflag53=3 +initx53=0 +inity53=0 +minx53=0 +miny53=0 +maxx53=0 +maxy53=0 +posx53=50 +posy53=50 +sizx53=800 +sizy53=600 +title54=Enemy Infestation +path54=C:\Games\Enemy Infestation (1998)\Ei.exe +module54= +ver54=0 +flag54=38 +flagg54=0 +tflag54=0 +initx54=0 +inity54=0 +minx54=0 +miny54=0 +maxx54=0 +maxy54=0 +posx54=50 +posy54=50 +sizx54=800 +sizy54=600 +title55=Evil Genius +path55=D:\Games\Evil Genius\ReleaseExe\EvilGenius_Cracked.exe +module55= +ver55=9 +flag55=2053 +flagg55=80 +tflag55=0 +initx55=0 +inity55=0 +minx55=0 +miny55=0 +maxx55=0 +maxy55=0 +posx55=50 +posy55=50 +sizx55=800 +sizy55=600 +title56=Expendable +path56=C:\Games\eXpendable\go.exe -nocputest +module56= +ver56=0 +flag56=402653280 +flagg56=1 +tflag56=2 +initx56=0 +inity56=0 +minx56=0 +miny56=0 +maxx56=0 +maxy56=0 +posx56=50 +posy56=50 +sizx56=800 +sizy56=600 +title57=Fallen Heaven (BAD) +path57=C:\Games\falhaven\Exe\FALLEN.EXE +module57= +ver57=0 +flag57=679485962 +flagg57=32 +tflag57=0 +initx57=0 +inity57=0 +minx57=0 +miny57=0 +maxx57=0 +maxy57=0 +posx57=0 +posy57=0 +sizx57=800 +sizy57=600 +title58=Fallout +path58=D:\Games\Fallout\FALLOUTW.EXE +module58= +ver58=1 +flag58=134217734 +flagg58=16 +tflag58=0 +initx58=0 +inity58=0 +minx58=0 +miny58=0 +maxx58=0 +maxy58=0 +posx58=50 +posy58=50 +sizx58=800 +sizy58=600 +title59=FreakOut +path59=C:\Games\Freak Out - Extreme Freeride\FreakOut.exe +module59= +ver59=9 +flag59=0 +flagg59=0 +tflag59=2 +initx59=0 +inity59=0 +minx59=0 +miny59=0 +maxx59=0 +maxy59=0 +posx59=50 +posy59=50 +sizx59=800 +sizy59=600 +title60=Funtracks +path60=C:\Games\Funtracks\Fun_win.exe +module60= +ver60=1 +flag60=2 +flagg60=0 +tflag60=258 +initx60=0 +inity60=0 +minx60=0 +miny60=0 +maxx60=0 +maxy60=0 +posx60=50 +posy60=50 +sizx60=800 +sizy60=600 +title61=Galapagos +path61=C:\Games\Galapagos\GALA.EXE +module61= +ver61=0 +flag61=134217760 +flagg61=0 +tflag61=0 +initx61=0 +inity61=0 +minx61=0 +miny61=0 +maxx61=0 +maxy61=0 +posx61=50 +posy61=50 +sizx61=800 +sizy61=600 +title62=Gangsters +path62=C:\Games\Gangsters\gangsters.exe +module62= +ver62=0 +flag62=134217762 +flagg62=0 +tflag62=2 +initx62=0 +inity62=0 +minx62=0 +miny62=0 +maxx62=0 +maxy62=0 +posx62=100 +posy62=100 +sizx62=800 +sizy62=600 +title63=GeneRally +path63=C:\Games\generally105\GeneRally.exe +module63= +ver63=0 +flag63=34 +flagg63=0 +tflag63=0 +initx63=0 +inity63=0 +minx63=0 +miny63=0 +maxx63=0 +maxy63=0 +posx63=50 +posy63=50 +sizx63=800 +sizy63=600 +title64=Get Medieval +path64=C:\Games\Get Medieval\MEDIEVAL.EXE +module64= +ver64=0 +flag64=34 +flagg64=2 +tflag64=0 +initx64=0 +inity64=0 +minx64=0 +miny64=0 +maxx64=0 +maxy64=0 +posx64=0 +posy64=0 +sizx64=800 +sizy64=600 +title65=Gift +path65=C:\Games\Gift\Gift.exe +module65= +ver65=0 +flag65=4196384 +flagg65=0 +tflag65=34 +initx65=0 +inity65=0 +minx65=0 +miny65=0 +maxx65=0 +maxy65=0 +posx65=0 +posy65=0 +sizx65=0 +sizy65=0 +title66=Golden Age of Racing +path66=C:\Games\Golden Age of Racing\GAOR.exe +module66= +ver66=0 +flag66=34 +flagg66=0 +tflag66=0 +initx66=0 +inity66=0 +minx66=0 +miny66=0 +maxx66=0 +maxy66=0 +posx66=50 +posy66=50 +sizx66=800 +sizy66=600 +title67=Gp500 for Win2K +path67=C:\Games\gp500\gp500_win2k.exe +module67= +ver67=1 +flag67=545677860 +flagg67=0 +tflag67=2 +initx67=0 +inity67=0 +minx67=0 +miny67=0 +maxx67=0 +maxy67=0 +posx67=50 +posy67=50 +sizx67=800 +sizy67=600 +title68=G-Police +path68=C:\Games\gpolice\GPOLICE.EXE +module68= +ver68=0 +flag68=67125286 +flagg68=0 +tflag68=2 +initx68=0 +inity68=0 +minx68=0 +miny68=0 +maxx68=0 +maxy68=0 +posx68=50 +posy68=50 +sizx68=800 +sizy68=600 +title69=Grand Prix Legends +path69=C:\Games\grand prix legends\gpl\gpl.exe +module69= +ver69=7 +flag69=134217760 +flagg69=4 +tflag69=0 +initx69=0 +inity69=0 +minx69=0 +miny69=0 +maxx69=0 +maxy69=0 +posx69=50 +posy69=50 +sizx69=0 +sizy69=0 +title70=Grim Fandango Demo +path70=C:\Games\GrimWebDemo\grimdemo.exe +module70= +ver70=0 +flag70=34 +flagg70=0 +tflag70=258 +initx70=0 +inity70=0 +minx70=0 +miny70=0 +maxx70=0 +maxy70=0 +posx70=50 +posy70=50 +sizx70=800 +sizy70=600 +title71=Heart of Darkness +path71=C:\Games\Heart_of_Darkness\HODWin32.exe +module71= +ver71=0 +flag71=8226 +flagg71=0 +tflag71=0 +initx71=0 +inity71=0 +minx71=0 +miny71=0 +maxx71=0 +maxy71=0 +posx71=50 +posy71=50 +sizx71=800 +sizy71=600 +title72=Heavy Metal FAKK 2 +path72=C:\Games\Heavy Metal - FAKK2\fakk2.exe +module72= +ver72=0 +flag72=33554464 +flagg72=64 +tflag72=2 +initx72=0 +inity72=0 +minx72=0 +miny72=0 +maxx72=0 +maxy72=0 +posx72=50 +posy72=50 +sizx72=800 +sizy72=600 +title73=HellCopter +path73=C:\Games\hellcop\HCopter.exe +module73= +ver73=0 +flag73=-2013249500 +flagg73=256 +tflag73=0 +initx73=0 +inity73=0 +minx73=0 +miny73=0 +maxx73=0 +maxy73=0 +posx73=50 +posy73=50 +sizx73=800 +sizy73=600 +title74=Heroes of Might & Magic III Demo +path74=C:\Games\Heroes III Demo\h3demo.exe +module74= +ver74=1 +flag74=134234146 +flagg74=0 +tflag74=2 +initx74=0 +inity74=0 +minx74=0 +miny74=0 +maxx74=0 +maxy74=0 +posx74=50 +posy74=50 +sizx74=800 +sizy74=600 +title75=hover +path75=C:\Games\hover\hoverX.exe +module75= +ver75=0 +flag75=8224 +flagg75=0 +tflag75=0 +initx75=0 +inity75=0 +minx75=0 +miny75=0 +maxx75=0 +maxy75=0 +posx75=50 +posy75=50 +sizx75=800 +sizy75=600 +title76=Hyperblade +path76=D:\Games\Hyperblade\HYPERX.EXE +module76= +ver76=0 +flag76=675 +flagg76=18 +tflag76=2 +initx76=0 +inity76=0 +minx76=0 +miny76=0 +maxx76=0 +maxy76=0 +posx76=50 +posy76=50 +sizx76=800 +sizy76=600 +title77=Idinaloq +path77=C:\Games\idina101\idinaloq.exe +module77= +ver77=0 +flag77=32 +flagg77=0 +tflag77=0 +initx77=0 +inity77=0 +minx77=0 +miny77=0 +maxx77=0 +maxy77=0 +posx77=50 +posy77=50 +sizx77=800 +sizy77=600 +title78=Immanis +path78=C:\Games\Immanis CD release\immanis.exe +module78= +ver78=0 +flag78=24611 +flagg78=0 +tflag78=0 +initx78=0 +inity78=0 +minx78=0 +miny78=0 +maxx78=0 +maxy78=0 +posx78=50 +posy78=50 +sizx78=800 +sizy78=600 +title79=Immanis (v2) +path79=C:\Games\Immanis CD release\immanis_v2.exe +module79= +ver79=0 +flag79=268460067 +flagg79=0 +tflag79=0 +initx79=0 +inity79=0 +minx79=0 +miny79=0 +maxx79=0 +maxy79=0 +posx79=50 +posy79=50 +sizx79=800 +sizy79=600 +title80=In the Hunt +path80=C:\Games\In The Hunt\e8.exe +module80= +ver80=0 +flag80=2 +flagg80=0 +tflag80=0 +initx80=0 +inity80=0 +minx80=0 +miny80=0 +maxx80=0 +maxy80=0 +posx80=50 +posy80=50 +sizx80=800 +sizy80=600 +title81=International Superstar Soccer 3 +path81=C:\Games\ISS_3\iss3.exe +module81= +ver81=8 +flag81=545267715 +flagg81=0 +tflag81=0 +initx81=0 +inity81=0 +minx81=0 +miny81=0 +maxx81=0 +maxy81=0 +posx81=50 +posy81=50 +sizx81=800 +sizy81=600 +title82=Jet Moto +path82=M:\JETMOTO.EXE +module82= +ver82=0 +flag82=139298 +flagg82=0 +tflag82=0 +initx82=0 +inity82=0 +minx82=0 +miny82=0 +maxx82=0 +maxy82=0 +posx82=50 +posy82=50 +sizx82=800 +sizy82=600 +title83=Kiss Psyco Cyrcus +path83=C:\Games\Psycho\client.exe +module83=d3d.ren +ver83=7 +flag83=537018404 +flagg83=0 +tflag83=0 +initx83=0 +inity83=0 +minx83=0 +miny83=0 +maxx83=0 +maxy83=0 +posx83=50 +posy83=50 +sizx83=800 +sizy83=600 +title84=Krazy Ivan +path84=C:\Games\Krazy Ivan\KRAZY.EXE +module84= +ver84=0 +flag84=536870914 +flagg84=0 +tflag84=0 +initx84=0 +inity84=0 +minx84=0 +miny84=0 +maxx84=0 +maxy84=0 +posx84=50 +posy84=50 +sizx84=800 +sizy84=600 +title85=Last Bronx +path85=C:\Games\Last_Bronx\LB.EXE +module85= +ver85=0 +flag85=40994 +flagg85=0 +tflag85=64 +initx85=0 +inity85=0 +minx85=0 +miny85=0 +maxx85=0 +maxy85=0 +posx85=50 +posy85=50 +sizx85=800 +sizy85=600 +title86=Lionheart +path86=C:\Games\Lionheart Demo\Lionheart.exe +module86= +ver86=0 +flag86=-2147483612 +flagg86=0 +tflag86=0 +initx86=0 +inity86=0 +minx86=0 +miny86=0 +maxx86=0 +maxy86=0 +posx86=50 +posy86=50 +sizx86=800 +sizy86=600 +title87=M.A.X. 2 +path87=C:\Games\MAX 2\MAX_2\MAX2\MAX2.EXE +module87= +ver87=0 +flag87=34 +flagg87=0 +tflag87=0 +initx87=0 +inity87=0 +minx87=0 +miny87=0 +maxx87=0 +maxy87=0 +posx87=50 +posy87=50 +sizx87=800 +sizy87=600 +title88=M1 Tank Platoon 2 +path88=C:\Games\M1 Tank Platoon 2\M1TP2.exe +module88= +ver88=8 +flag88=34 +flagg88=0 +tflag88=0 +initx88=0 +inity88=0 +minx88=0 +miny88=0 +maxx88=0 +maxy88=0 +posx88=50 +posy88=50 +sizx88=800 +sizy88=600 +title89=Mario Worlds (stripped PE) +path89=C:\Games\Mario Worlds\Mario Worlds.exe +module89= +ver89=1 +flag89=2 +flagg89=1 +tflag89=386 +initx89=0 +inity89=0 +minx89=0 +miny89=0 +maxx89=0 +maxy89=0 +posx89=50 +posy89=50 +sizx89=800 +sizy89=600 +title90=Masters of Orion 2 +path90=C:\Games\Orion2\Orion95.exe +module90= +ver90=0 +flag90=34 +flagg90=0 +tflag90=0 +initx90=0 +inity90=0 +minx90=0 +miny90=0 +maxx90=0 +maxy90=0 +posx90=50 +posy90=50 +sizx90=800 +sizy90=600 +title91=Microsoft Flight Simulator 98 +path91=C:\Games\Flight Simulator 98\FLTSIM98.EXE +module91= +ver91=0 +flag91=288 +flagg91=0 +tflag91=0 +initx91=0 +inity91=0 +minx91=0 +miny91=0 +maxx91=0 +maxy91=0 +posx91=50 +posy91=50 +sizx91=800 +sizy91=600 +title92=Microsoft Midtown Madness +path92=C:\Games\Midtown Madness\midtown.exe +module92= +ver92=0 +flag92=8192 +flagg92=0 +tflag92=2 +initx92=0 +inity92=0 +minx92=0 +miny92=0 +maxx92=0 +maxy92=0 +posx92=50 +posy92=50 +sizx92=800 +sizy92=600 +title93=Microsoft Midtown Madness Trial (BAD) +path93=C:\Games\Midtown Madness Trial\midtrial.exe +module93= +ver93=0 +flag93=2 +flagg93=0 +tflag93=0 +initx93=0 +inity93=0 +minx93=0 +miny93=0 +maxx93=0 +maxy93=0 +posx93=0 +posy93=0 +sizx93=800 +sizy93=600 +title94=Microsoft Motocross Madness 2 (BAD!!) +path94=C:\Games\Motocross Madness 2\MCM2.cracked.EXE +module94= +ver94=7 +flag94=201326664 +flagg94=1 +tflag94=82 +initx94=0 +inity94=0 +minx94=0 +miny94=0 +maxx94=0 +maxy94=0 +posx94=50 +posy94=50 +sizx94=800 +sizy94=600 +title95=Microsoft Motocross Madness Trial (BAD) +path95=C:\Games\Motocross Madness Trial\mcm.exe +module95= +ver95=1 +flag95=134225952 +flagg95=0 +tflag95=130 +initx95=0 +inity95=0 +minx95=0 +miny95=0 +maxx95=0 +maxy95=0 +posx95=50 +posy95=50 +sizx95=0 +sizy95=0 +title96=Mission Force Cyberstorm (BAD ?) +path96=C:\Games\SIERRA\CSTORM\CSTORM.EXE +module96= +ver96=0 +flag96=33562658 +flagg96=0 +tflag96=0 +initx96=0 +inity96=0 +minx96=0 +miny96=0 +maxx96=0 +maxy96=0 +posx96=50 +posy96=50 +sizx96=0 +sizy96=0 +title97=Monopoly 3D +path97=C:\Games\Monopoly (Edition 3D)\Monopoly.exe +module97= +ver97=0 +flag97=134244388 +flagg97=0 +tflag97=2 +initx97=0 +inity97=0 +minx97=0 +miny97=0 +maxx97=0 +maxy97=0 +posx97=50 +posy97=50 +sizx97=800 +sizy97=600 +title98=Monster Truck Madness 2 +path98=C:\Games\Monster Truck Madness 2\Monster.EXE +module98= +ver98=1 +flag98=34 +flagg98=1 +tflag98=0 +initx98=0 +inity98=0 +minx98=0 +miny98=0 +maxx98=0 +maxy98=0 +posx98=50 +posy98=50 +sizx98=800 +sizy98=600 +title99=Necrodrome +path99=C:\Games\Necrodome\NECRO95.EXE +module99= +ver99=0 +flag99=268435495 +flagg99=256 +tflag99=0 +initx99=0 +inity99=0 +minx99=0 +miny99=0 +maxx99=0 +maxy99=0 +posx99=50 +posy99=50 +sizx99=800 +sizy99=600 +title100=Need For Speed - Porsche 2000 +path100=C:\Games\Need For Speed - Porsche 2000\Porsche.exe +module100= +ver100=7 +flag100=0 +flagg100=0 +tflag100=258 +initx100=0 +inity100=0 +minx100=0 +miny100=0 +maxx100=0 +maxy100=0 +posx100=50 +posy100=50 +sizx100=800 +sizy100=600 +title101=Netstorm Islands at War +path101=C:\Games\Netstorm\Netstorm.exe +module101= +ver101=0 +flag101=2 +flagg101=0 +tflag101=0 +initx101=0 +inity101=0 +minx101=0 +miny101=0 +maxx101=0 +maxy101=0 +posx101=50 +posy101=50 +sizx101=800 +sizy101=600 +title102=Nox +path102=C:\Games\Nox2\Game.exe +module102= +ver102=0 +flag102=939540515 +flagg102=0 +tflag102=386 +initx102=0 +inity102=0 +minx102=0 +miny102=0 +maxx102=0 +maxy102=0 +posx102=50 +posy102=50 +sizx102=800 +sizy102=600 +title103=Pacific General +path103=C:\Games\Pacific General\PACGEN.EXE +module103= +ver103=0 +flag103=8226 +flagg103=0 +tflag103=2 +initx103=0 +inity103=0 +minx103=0 +miny103=0 +maxx103=0 +maxy103=0 +posx103=50 +posy103=50 +sizx103=800 +sizy103=600 +title104=Project Nomads Demo (BAD) +path104=C:\Games\Project Nomads Demo\bin\win32\nomads.exe +module104= +ver104=8 +flag104=-1476394912 +flagg104=256 +tflag104=258 +initx104=0 +inity104=0 +minx104=0 +miny104=0 +maxx104=0 +maxy104=0 +posx104=50 +posy104=50 +sizx104=800 +sizy104=600 +title105=Puzzle Bubble +path105=C:\Games\Puzzle Bubble\PB.EXE +module105= +ver105=0 +flag105=34 +flagg105=0 +tflag105=0 +initx105=0 +inity105=0 +minx105=0 +miny105=0 +maxx105=0 +maxy105=0 +posx105=50 +posy105=50 +sizx105=800 +sizy105=600 +title106=Raiden II +path106=C:\Games\Raiden II\Raiden II\RAIDENII.EXE +module106= +ver106=0 +flag106=34 +flagg106=0 +tflag106=0 +initx106=0 +inity106=0 +minx106=0 +miny106=0 +maxx106=0 +maxy106=0 +posx106=50 +posy106=50 +sizx106=800 +sizy106=600 +title107=Railroad Tycoon II +path107=C:\Games\Railroad.Tycoon.II\RT2.EXE +module107= +ver107=1 +flag107=134225954 +flagg107=0 +tflag107=0 +initx107=0 +inity107=0 +minx107=0 +miny107=0 +maxx107=0 +maxy107=0 +posx107=50 +posy107=50 +sizx107=800 +sizy107=600 +title108=Rally Championship 2000 +path108=C:\Games\Rally Championship 2000\RAL.EXE +module108= +ver108=0 +flag108=67108864 +flagg108=0 +tflag108=2 +initx108=0 +inity108=0 +minx108=0 +miny108=0 +maxx108=0 +maxy108=0 +posx108=50 +posy108=50 +sizx108=800 +sizy108=600 +title109=Rebel Moon Rising +path109=C:\Games\Rebel Moon Rising\Rmr.exe +module109= +ver109=0 +flag109=0 +flagg109=0 +tflag109=0 +initx109=0 +inity109=0 +minx109=0 +miny109=0 +maxx109=0 +maxy109=0 +posx109=50 +posy109=50 +sizx109=800 +sizy109=600 +title110=Redline - Gang Warfare 2066 +path110=C:\Games\Redline - Gang Warfare 2066\redline.exe +module110= +ver110=0 +flag110=32 +flagg110=0 +tflag110=386 +initx110=0 +inity110=0 +minx110=0 +miny110=0 +maxx110=0 +maxy110=0 +posx110=50 +posy110=50 +sizx110=800 +sizy110=600 +title111=Resident Evil +path111=C:\Games\Resident Evil\residentevil.patched.exe +module111= +ver111=1 +flag111=134217827 +flagg111=0 +tflag111=2 +initx111=0 +inity111=0 +minx111=0 +miny111=0 +maxx111=0 +maxy111=0 +posx111=50 +posy111=50 +sizx111=800 +sizy111=600 +title112=Re-Volt +path112=C:\Games\Re-Volt\REVOLT.EXE +module112= +ver112=0 +flag112=134217792 +flagg112=0 +tflag112=0 +initx112=0 +inity112=0 +minx112=0 +miny112=0 +maxx112=0 +maxy112=0 +posx112=50 +posy112=50 +sizx112=800 +sizy112=600 +title113=Road Rash +path113=D:\Games\Road Rash\ROADRASH\ROADRASH.EXE +module113= +ver113=0 +flag113=134217730 +flagg113=0 +tflag113=387 +initx113=0 +inity113=0 +minx113=0 +miny113=0 +maxx113=0 +maxy113=0 +posx113=50 +posy113=50 +sizx113=800 +sizy113=600 +title114=Road Rash Demo +path114=D:\Games\RoadRash DEMO\DEMORASH.EXE +module114= +ver114=0 +flag114=134218242 +flagg114=0 +tflag114=259 +initx114=0 +inity114=0 +minx114=0 +miny114=0 +maxx114=0 +maxy114=0 +posx114=50 +posy114=50 +sizx114=800 +sizy114=600 +title115=RollerCoaster Tycoon 2 Mini Game +path115=C:\Games\RollerCoaster Tycoon 2 Mini Game\rct2.exe +module115= +ver115=1 +flag115=536870946 +flagg115=0 +tflag115=0 +initx115=0 +inity115=0 +minx115=0 +miny115=0 +maxx115=0 +maxy115=0 +posx115=0 +posy115=0 +sizx115=800 +sizy115=600 +title116=Sega Rally 2 Championship +path116=C:\Games\Sega Rally 2 Championship\SEGA RALLY 2.exe +module116= +ver116=1 +flag116=268435488 +flagg116=2 +tflag116=0 +initx116=0 +inity116=0 +minx116=0 +miny116=0 +maxx116=0 +maxy116=0 +posx116=0 +posy116=0 +sizx116=800 +sizy116=600 +title117=Shadow Master (TBD) +path117=C:\Games\Shadow Master\rmg.exe +module117= +ver117=1 +flag117=32 +flagg117=256 +tflag117=450 +initx117=0 +inity117=0 +minx117=0 +miny117=0 +maxx117=0 +maxy117=0 +posx117=50 +posy117=50 +sizx117=800 +sizy117=600 +title118=Sid Meier's SimGolf Demo +path118=C:\Games\Sid Meier's SimGolf Demo\golf.exe +module118=jgl.dll +ver118=0 +flag118=33554434 +flagg118=0 +tflag118=2 +initx118=0 +inity118=0 +minx118=0 +miny118=0 +maxx118=0 +maxy118=0 +posx118=50 +posy118=50 +sizx118=800 +sizy118=600 +title119=SleepWalker +path119=C:\Games\SleepWalker\Sleepy.exe +module119= +ver119=0 +flag119=301989954 +flagg119=0 +tflag119=198 +initx119=0 +inity119=0 +minx119=0 +miny119=0 +maxx119=0 +maxy119=0 +posx119=50 +posy119=50 +sizx119=800 +sizy119=600 +title120=SnowBoard Racer +path120=C:\Games\Snowboard Racer\SnowBoard.exe +module120= +ver120=0 +flag120=268443681 +flagg120=0 +tflag120=0 +initx120=0 +inity120=0 +minx120=0 +miny120=0 +maxx120=0 +maxy120=0 +posx120=50 +posy120=50 +sizx120=800 +sizy120=600 +title121=Solaris (~BAD) +path121=c:\Games\Solaris\solaris.exe +module121= +ver121=7 +flag121=973078627 +flagg121=1 +tflag121=2 +initx121=0 +inity121=0 +minx121=0 +miny121=0 +maxx121=0 +maxy121=0 +posx121=50 +posy121=50 +sizx121=800 +sizy121=600 +title122=Sonic 3 +path122=C:\Games\Sonic 3 + Sonic et Knuckles\Sonic 3\SONIC3K.EXE +module122= +ver122=1 +flag122=546 +flagg122=0 +tflag122=0 +initx122=0 +inity122=0 +minx122=0 +miny122=0 +maxx122=0 +maxy122=0 +posx122=50 +posy122=50 +sizx122=800 +sizy122=600 +title123=Sonic 3D Blast +path123=C:\Games\Sonic3D\pcsonic.exe +module123= +ver123=0 +flag123=134217762 +flagg123=0 +tflag123=0 +initx123=0 +inity123=0 +minx123=0 +miny123=0 +maxx123=0 +maxy123=0 +posx123=50 +posy123=50 +sizx123=800 +sizy123=600 +title124=Sonic R +path124=C:\Games\SonicR\sonicr.exe +module124= +ver124=0 +flag124=8288 +flagg124=0 +tflag124=0 +initx124=0 +inity124=0 +minx124=0 +miny124=0 +maxx124=0 +maxy124=0 +posx124=50 +posy124=50 +sizx124=800 +sizy124=600 +title125=Soulbringer +path125=C:\Games\SoulBringer\SoulbringeVCnoeax.exe +module125= +ver125=0 +flag125=143024174 +flagg125=0 +tflag125=0 +initx125=0 +inity125=0 +minx125=0 +miny125=0 +maxx125=0 +maxy125=0 +posx125=50 +posy125=50 +sizx125=800 +sizy125=600 +title126=Speedboat Attack (BAD) +path126=C:\Games\Speedboat Attack\SBOAT.EXE +module126= +ver126=0 +flag126=541073954 +flagg126=0 +tflag126=2 +initx126=0 +inity126=0 +minx126=0 +miny126=0 +maxx126=0 +maxy126=0 +posx126=50 +posy126=50 +sizx126=800 +sizy126=600 +title127=Star Wars Episode 1 Racer +path127=C:\Games\sw racer\SWEP1RCR.EXE +module127= +ver127=0 +flag127=142606368 +flagg127=0 +tflag127=0 +initx127=0 +inity127=0 +minx127=0 +miny127=0 +maxx127=0 +maxy127=0 +posx127=50 +posy127=50 +sizx127=800 +sizy127=600 +title128=Star Wars: Jedi Knight +path128=C:\Games\Jedi Knight\Jedi Knight\JK.EXE +module128= +ver128=0 +flag128=8226 +flagg128=0 +tflag128=0 +initx128=0 +inity128=0 +minx128=0 +miny128=0 +maxx128=0 +maxy128=0 +posx128=50 +posy128=50 +sizx128=800 +sizy128=600 +title129=Star Wars: the Gungan Frontier +path129=C:\Games\sw the gungan frontier\Gungan Frontier.exe +module129= +ver129=1 +flag129=402915362 +flagg129=512 +tflag129=0 +initx129=0 +inity129=0 +minx129=0 +miny129=0 +maxx129=0 +maxy129=0 +posx129=0 +posy129=0 +sizx129=800 +sizy129=600 +title130=Starship Troopers +path130=C:\Games\Starship Troopers - Terran Ascendancy\stta\StarshipTroopers.exe +module130= +ver130=1 +flag130=32 +flagg130=0 +tflag130=0 +initx130=0 +inity130=0 +minx130=0 +miny130=0 +maxx130=0 +maxy130=0 +posx130=50 +posy130=50 +sizx130=800 +sizy130=600 +title131=Starshot Space Circus +path131=D:\SpaceCircus.exe +module131= +ver131=0 +flag131=66 +flagg131=0 +tflag131=0 +initx131=0 +inity131=0 +minx131=0 +miny131=0 +maxx131=0 +maxy131=0 +posx131=50 +posy131=50 +sizx131=800 +sizy131=600 +title132=Stronghold Demo +path132=C:\Games\Firefly Studios' Stronghold - Demo\Stronghold Demo.exe +module132= +ver132=0 +flag132=98 +flagg132=0 +tflag132=0 +initx132=0 +inity132=0 +minx132=0 +miny132=0 +maxx132=0 +maxy132=0 +posx132=50 +posy132=50 +sizx132=800 +sizy132=600 +title133=Sub Culture +path133=C:\Games\Sub Culture\sc.exe +module133= +ver133=0 +flag133=66 +flagg133=256 +tflag133=10 +initx133=50 +inity133=50 +minx133=50 +miny133=50 +maxx133=800 +maxy133=600 +posx133=50 +posy133=50 +sizx133=800 +sizy133=600 +title134=Superbike 2001 +path134=C:\Games\Superbike 2001\Sbk2001.exe +module134= +ver134=1 +flag134=536887332 +flagg134=0 +tflag134=0 +initx134=0 +inity134=0 +minx134=0 +miny134=0 +maxx134=0 +maxy134=0 +posx134=50 +posy134=50 +sizx134=800 +sizy134=600 +title135=Syberia 2 Demo +path135=C:\Games\Syberia 2 Demo\Syberia2Demo.exe +module135= +ver135=8 +flag135=536887332 +flagg135=0 +tflag135=0 +initx135=0 +inity135=0 +minx135=0 +miny135=0 +maxx135=0 +maxy135=0 +posx135=50 +posy135=50 +sizx135=800 +sizy135=600 +title136=Syberia Demo +path136=C:\Games\SyberiaDemo\SyberiaDemo.exe +module136= +ver136=1 +flag136=536887332 +flagg136=0 +tflag136=0 +initx136=0 +inity136=0 +minx136=0 +miny136=0 +maxx136=0 +maxy136=0 +posx136=50 +posy136=50 +sizx136=800 +sizy136=600 +title137=System Shock 2 (BAD!!!) +path137=C:\Games\Sys Shock II\Shock2.exe +module137= +ver137=1 +flag137=0 +flagg137=64 +tflag137=0 +initx137=0 +inity137=0 +minx137=0 +miny137=0 +maxx137=0 +maxy137=0 +posx137=50 +posy137=50 +sizx137=800 +sizy137=600 +title138=Test Drive 4 +path138=D:\Games\Test Drive 4\td4.EXE +module138= +ver138=0 +flag138=-2013265886 +flagg138=16 +tflag138=3 +initx138=0 +inity138=0 +minx138=0 +miny138=0 +maxx138=0 +maxy138=0 +posx138=50 +posy138=50 +sizx138=800 +sizy138=600 +title139=The Nations Demo +path139=C:\Games\The Nations Demo\bin\Game.exe +module139= +ver139=1 +flag139=402661920 +flagg139=256 +tflag139=0 +initx139=0 +inity139=0 +minx139=0 +miny139=0 +maxx139=0 +maxy139=0 +posx139=50 +posy139=50 +sizx139=800 +sizy139=600 +title140=The Sims +path140=C:\Games\The Sims\Sims.exe +module140= +ver140=0 +flag140=134226976 +flagg140=0 +tflag140=2 +initx140=0 +inity140=0 +minx140=0 +miny140=0 +maxx140=0 +maxy140=0 +posx140=50 +posy140=50 +sizx140=800 +sizy140=600 +title141=Thief the Dark Project (FRE) +path141=C:\Games\thief\game\thieffixed.exe +module141= +ver141=1 +flag141=16390 +flagg141=0 +tflag141=0 +initx141=0 +inity141=0 +minx141=0 +miny141=0 +maxx141=0 +maxy141=0 +posx141=50 +posy141=50 +sizx141=800 +sizy141=600 +title142=TinTin: Prisoners of the Sun +path142=C:\Games\tintin\TINTINW.EXE +module142= +ver142=0 +flag142=34 +flagg142=0 +tflag142=2 +initx142=0 +inity142=0 +minx142=0 +miny142=0 +maxx142=0 +maxy142=0 +posx142=50 +posy142=50 +sizx142=800 +sizy142=600 +title143=Tintoy (BAD gfx) +path143=C:\Games\Tintoy\Tintoy.exe +module143= +ver143=0 +flag143=546 +flagg143=256 +tflag143=258 +initx143=0 +inity143=0 +minx143=0 +miny143=0 +maxx143=0 +maxy143=0 +posx143=50 +posy143=50 +sizx143=800 +sizy143=600 +title144=Tomb Raider - Anniversary +path144=C:\Games\Tomb Raider - Anniversary\tra.exe +module144= +ver144=9 +flag144=0 +flagg144=256 +tflag144=2 +initx144=0 +inity144=0 +minx144=0 +miny144=0 +maxx144=0 +maxy144=0 +posx144=50 +posy144=50 +sizx144=800 +sizy144=600 +title145=Tomb Raider 2 the Golden Mask +path145=D:\Games\TR2 Golden Mask\T2GOLD.EXE +module145= +ver145=0 +flag145=570688034 +flagg145=0 +tflag145=258 +initx145=0 +inity145=0 +minx145=0 +miny145=0 +maxx145=0 +maxy145=0 +posx145=50 +posy145=50 +sizx145=800 +sizy145=600 +title146=Tomb Raider 3 Demo +path146=C:\Games\Tomb Raider 3 - The Lost Artifact Demo\tr3gold.exe +module146= +ver146=1 +flag146=369098848 +flagg146=0 +tflag146=258 +initx146=0 +inity146=0 +minx146=0 +miny146=0 +maxx146=0 +maxy146=0 +posx146=50 +posy146=50 +sizx146=800 +sizy146=600 +title147=Tomb Raider 4 Demo +path147=C:\Games\Tomb Raider 4 - The Last Revelation (Demo)\tomb4.patched.exe +module147= +ver147=0 +flag147=234881056 +flagg147=16 +tflag147=258 +initx147=0 +inity147=0 +minx147=0 +miny147=0 +maxx147=0 +maxy147=0 +posx147=50 +posy147=50 +sizx147=800 +sizy147=600 +title148=Total Annihilation Kingdoms +path148=D:\Games\Total Annihilation Kingdoms\Kingdoms.exe +module148= +ver148=0 +flag148=134234146 +flagg148=0 +tflag148=0 +initx148=0 +inity148=0 +minx148=0 +miny148=0 +maxx148=0 +maxy148=0 +posx148=50 +posy148=50 +sizx148=800 +sizy148=600 +title149=Ultim@te Race Pro +path149=C:\Games\Ultim@te race pro\Ultim@te Race Pro.exe +module149= +ver149=0 +flag149=570425440 +flagg149=256 +tflag149=0 +initx149=0 +inity149=0 +minx149=0 +miny149=0 +maxx149=0 +maxy149=0 +posx149=50 +posy149=50 +sizx149=800 +sizy149=600 +title150=Uprising - Join or Die +path150=D:\Games\Uprising\uprising.exe +module150= +ver150=0 +flag150=-2013265882 +flagg150=18 +tflag150=0 +initx150=0 +inity150=0 +minx150=0 +miny150=0 +maxx150=0 +maxy150=0 +posx150=50 +posy150=50 +sizx150=800 +sizy150=600 +title151=Warcraft 2 Battlenet Edition +path151=D:\Games\Warcraft 2\Warcraft II BNE.exe +module151= +ver151=0 +flag151=24610 +flagg151=16 +tflag151=14 +initx151=0 +inity151=0 +minx151=0 +miny151=0 +maxx151=0 +maxy151=0 +posx151=50 +posy151=50 +sizx151=800 +sizy151=600 +title152=WarHammer Rites of War +path152=C:\Games\Rites of War\RoW.exe +module152= +ver152=0 +flag152=134217760 +flagg152=128 +tflag152=0 +initx152=0 +inity152=0 +minx152=0 +miny152=0 +maxx152=0 +maxy152=0 +posx152=50 +posy152=50 +sizx152=800 +sizy152=600 +title153=Warlords 3 +path153=D:\Games\WARLORDS3\Darklord.exe +module153= +ver153=0 +flag153=134218274 +flagg153=32 +tflag153=2 +initx153=0 +inity153=0 +minx153=0 +miny153=0 +maxx153=0 +maxy153=0 +posx153=50 +posy153=50 +sizx153=640 +sizy153=480 +title154=WarTorn +path154=C:\Games\WarTorn\W.exe +module154= +ver154=0 +flag154=32 +flagg154=0 +tflag154=0 +initx154=0 +inity154=0 +minx154=0 +miny154=0 +maxx154=0 +maxy154=0 +posx154=50 +posy154=50 +sizx154=800 +sizy154=600 +title155=WarWind +path155=C:\Games\WarWind\WW.EXE +module155= +ver155=0 +flag155=16418 +flagg155=16 +tflag155=0 +initx155=0 +inity155=0 +minx155=0 +miny155=0 +maxx155=0 +maxy155=0 +posx155=50 +posy155=50 +sizx155=800 +sizy155=600 +title156=Worms Armageddon Demo (BAD!!!) +path156=C:\Games\Worms Armageddon Demo\WaDemo.exe +module156= +ver156=1 +flag156=939524099 +flagg156=8 +tflag156=2 +initx156=0 +inity156=0 +minx156=0 +miny156=0 +maxx156=0 +maxy156=0 +posx156=0 +posy156=0 +sizx156=0 +sizy156=0 +title157=Worms World Party +path157=D:\Games\Worms World Party\wwp.exe +module157= +ver157=1 +flag157=8388610 +flagg157=0 +tflag157=0 +initx157=0 +inity157=0 +minx157=0 +miny157=0 +maxx157=0 +maxy157=0 +posx157=50 +posy157=50 +sizx157=800 +sizy157=600 +title158=Worms World Party Demo (BAD) +path158=C:\Games\WWP Demo\wwp.exe +module158=MFC42.DLL ltkrn10N.dll +ver158=1 +flag158=406847491 +flagg158=8 +tflag158=2 +initx158=0 +inity158=0 +minx158=0 +miny158=0 +maxx158=0 +maxy158=0 +posx158=0 +posy158=0 +sizx158=0 +sizy158=0 +title159=X-Com Enforcer +path159=C:\Games\X-Com Enforcer\System\xcom.exe +module159= +ver159=1 +flag159=32 +flagg159=0 +tflag159=0 +initx159=0 +inity159=0 +minx159=0 +miny159=0 +maxx159=0 +maxy159=0 +posx159=0 +posy159=0 +sizx159=800 +sizy159=600 +title160=X-Com Interceptor +path160=C:\Games\X-Com_Interceptor\X-COM Interceptor\Interceptor.exe +module160= +ver160=0 +flag160=16418 +flagg160=0 +tflag160=0 +initx160=0 +inity160=0 +minx160=0 +miny160=0 +maxx160=0 +maxy160=0 +posx160=50 +posy160=50 +sizx160=800 +sizy160=600 +title161=Z Steel Soldiers +path161=C:\Games\ZSteelSoldiers\Bin\z2.exe +module161= +ver161=8 +flag161=805462020 +flagg161=0 +tflag161=0 +initx161=0 +inity161=0 +minx161=0 +miny161=0 +maxx161=0 +maxy161=0 +posx161=50 +posy161=50 +sizx161=800 +sizy161=600 +title162=Zax Alien Hunter +path162=C:\Games\ZaxDemo\Zax.exe +module162= +ver162=0 +flag162=-1476386784 +flagg162=0 +tflag162=0 +initx162=0 +inity162=0 +minx162=0 +miny162=0 +maxx162=0 +maxy162=0 +posx162=50 +posy162=50 +sizx162=800 +sizy162=600 +title163=Zero Critical (BAD) +path163=C:\Games\zero_critical_-_satin_rift\ZEROCR.EXE +module163= +ver163=0 +flag163=679477858 +flagg163=8 +tflag163=0 +initx163=0 +inity163=0 +minx163=0 +miny163=0 +maxx163=0 +maxy163=0 +posx163=0 +posy163=0 +sizx163=800 +sizy163=600 +title164=Zero Population Count +path164=C:\Games\ZPC\ZPC.EXE +module164= +ver164=0 +flag164=1073741859 +flagg164=0 +tflag164=0 +initx164=0 +inity164=0 +minx164=0 +miny164=0 +maxx164=0 +maxy164=0 +posx164=0 +posy164=0 +sizx164=800 +sizy164=600 +title165=Zero Zone +path165=D:\ZZone\ZeroZone.exe +module165= +ver165=0 +flag165=34 +flagg165=0 +tflag165=0 +initx165=0 +inity165=0 +minx165=0 +miny165=0 +maxx165=0 +maxy165=0 +posx165=50 +posy165=50 +sizx165=800 +sizy165=600 +title166=Zeus Poseidon +path166=C:\Games\Zeus-Poseidon\Zeus.exe +module166= +ver166=0 +flag166=34 +flagg166=0 +tflag166=0 +initx166=0 +inity166=0 +minx166=0 +miny166=0 +maxx166=0 +maxy166=0 +posx166=50 +posy166=50 +sizx166=800 +sizy166=600 +title167=Zoo Tycoon +path167=C:\Games\Zoo Tycoon\zoo.exe +module167= +ver167=0 +flag167=-2013265886 +flagg167=0 +tflag167=0 +initx167=0 +inity167=0 +minx167=0 +miny167=0 +maxx167=0 +maxy167=0 +posx167=50 +posy167=50 +sizx167=800 +sizy167=600 +title168=Soldiers at War +path168=D:\Games\Soldiers at War\SAW_Game.exe +module168= +ver168=0 +flag168=671359010 +flagg168=64 +tflag168=0 +initx168=0 +inity168=0 +minx168=0 +miny168=0 +maxx168=0 +maxy168=0 +posx168=50 +posy168=50 +sizx168=640 +sizy168=480 +title169=Halo Combat Evolved +path169=D:\Games\Halo Combat Evolved\halo.exe +module169= +ver169=9 +flag169=570425377 +flagg169=0 +tflag169=479 +initx169=0 +inity169=0 +minx169=0 +miny169=0 +maxx169=0 +maxy169=0 +posx169=50 +posy169=50 +sizx169=800 +sizy169=600 +title170=Jedi Knight II Jedi Outcast +path170=D:\Games\Jedi Knight II Jedi Outcast\GameData\jk2sp.exe +module170= +ver170=0 +flag170=0 +flagg170=512 +tflag170=267 +initx170=0 +inity170=0 +minx170=0 +miny170=0 +maxx170=0 +maxy170=0 +posx170=50 +posy170=50 +sizx170=800 +sizy170=600 +title171=Incoming Forces +path171=D:\Games\Incoming Forces\forces.exe +module171= +ver171=8 +flag171=134217760 +flagg171=0 +tflag171=3 +initx171=0 +inity171=0 +minx171=0 +miny171=0 +maxx171=0 +maxy171=0 +posx171=50 +posy171=50 +sizx171=800 +sizy171=600 +title172=Doom 64 Absolution +path172=D:\Games\Doom 64\Bin\Absolution.exe +module172= +ver172=8 +flag172=0 +flagg172=0 +tflag172=259 +initx172=0 +inity172=0 +minx172=0 +miny172=0 +maxx172=0 +maxy172=0 +posx172=50 +posy172=50 +sizx172=800 +sizy172=600 +title173=lithtech.exe +path173=D:\Games\NOLF Technology Demo\lithtech.exe +module173= +ver173=7 +flag173=0 +flagg173=512 +tflag173=259 +initx173=0 +inity173=0 +minx173=0 +miny173=0 +maxx173=0 +maxy173=0 +posx173=50 +posy173=50 +sizx173=800 +sizy173=600 +title174=Half-Life Uplink Demo +path174=D:\Games\Half-Life Uplink\hldemo.exe +module174= +ver174=1 +flag174=1073741826 +flagg174=512 +tflag174=3 +initx174=0 +inity174=0 +minx174=0 +miny174=0 +maxx174=0 +maxy174=0 +posx174=50 +posy174=50 +sizx174=640 +sizy174=480 +title175=Daikatana +path175=D:\Games\Daikatana\daikatana.exe +module175=OpenGL32.dll +ver175=9 +flag175=514 +flagg175=513 +tflag175=387 +initx175=0 +inity175=0 +minx175=0 +miny175=0 +maxx175=0 +maxy175=0 +posx175=50 +posy175=50 +sizx175=800 +sizy175=600 +title176=Half-Life Blue-Shift (d3d) +path176=D:\Games\Half-Life Blue-Shift\bshift.exe +module176= +ver176=10 +flag176=1073741826 +flagg176=513 +tflag176=259 +initx176=0 +inity176=0 +minx176=0 +miny176=0 +maxx176=0 +maxy176=0 +posx176=50 +posy176=50 +sizx176=640 +sizy176=480 +title177=Moto Racer Demo +path177=D:\Games\Moto Racer Demo\PlayDemo.exe +module177= +ver177=0 +flag177=167903267 +flagg177=192 +tflag177=14 +initx177=0 +inity177=0 +minx177=0 +miny177=0 +maxx177=0 +maxy177=0 +posx177=50 +posy177=50 +sizx177=800 +sizy177=600 +title178=Quake 2 +path178=D:\Games\QUAKE2\quake2.exe +module178= +ver178=10 +flag178=167772672 +flagg178=1 +tflag178=387 +initx178=0 +inity178=0 +minx178=0 +miny178=0 +maxx178=0 +maxy178=0 +posx178=50 +posy178=50 +sizx178=800 +sizy178=600 +title179=Quake 3 Arena +path179=D:\Games\Q3A\quake3.exe +module179= +ver179=10 +flag179=0 +flagg179=513 +tflag179=0 +initx179=0 +inity179=0 +minx179=0 +miny179=0 +maxx179=0 +maxy179=0 +posx179=50 +posy179=50 +sizx179=800 +sizy179=600 +title180=Sentinel Returns +path180=D:\Games\Sentinel Returns\Sentinel.exe +module180= +ver180=1 +flag180=3 +flagg180=0 +tflag180=0 +initx180=0 +inity180=0 +minx180=0 +miny180=0 +maxx180=0 +maxy180=0 +posx180=50 +posy180=50 +sizx180=800 +sizy180=600 +title181=Sin, Wages of (sw renderer) +path181=D:\Games\sin\sin.exe +module181=ref_gl.dll ref_soft.dll +ver181=10 +flag181=402670082 +flagg181=769 +tflag181=387 +initx181=0 +inity181=0 +minx181=0 +miny181=0 +maxx181=0 +maxy181=0 +posx181=50 +posy181=50 +sizx181=800 +sizy181=600 +title182=Star trek Klingon Honor Guard +path182=D:\Games\Star trek Klingon Honor Guard\System\Khg.exe +module182=OGIDrv.dll +ver182=10 +flag182=0 +flagg182=513 +tflag182=386 +initx182=0 +inity182=0 +minx182=0 +miny182=0 +maxx182=0 +maxy182=0 +posx182=50 +posy182=50 +sizx182=800 +sizy182=600 +title183=American McGee's Alice Demo +path183=D:\Games\American McGee's Alice Demo\alice.exe +module183= +ver183=10 +flag183=268435458 +flagg183=0 +tflag183=0 +initx183=0 +inity183=0 +minx183=0 +miny183=0 +maxx183=0 +maxy183=0 +posx183=50 +posy183=50 +sizx183=800 +sizy183=600 +title184=Hexen II (opengl) +path184=D:\Games\Hexen II\glh2.exe +module184= +ver184=10 +flag184=2 +flagg184=1 +tflag184=387 +initx184=0 +inity184=0 +minx184=0 +miny184=0 +maxx184=0 +maxy184=0 +posx184=50 +posy184=50 +sizx184=800 +sizy184=600 +title185=Hexen II (software) +path185=D:\Games\Hexen II\h2.exe +module185= +ver185=10 +flag185=671088642 +flagg185=0 +tflag185=0 +initx185=0 +inity185=0 +minx185=0 +miny185=0 +maxx185=0 +maxy185=0 +posx185=50 +posy185=50 +sizx185=800 +sizy185=600 +title186=Star Wars Jedi Knight Jedi Academy +path186=D:\Games\Star_Wars_Jedi_Knight_Jedi_Academy\GameData\jasp.exe +module186= +ver186=10 +flag186=0 +flagg186=0 +tflag186=3 +initx186=0 +inity186=0 +minx186=0 +miny186=0 +maxx186=0 +maxy186=0 +posx186=50 +posy186=50 +sizx186=800 +sizy186=600 +title187=Dungeon Keeper 2 GOG release +path187=D:\Games\Dungeon Keeper 2 GOG release\DKII.EXE +module187= +ver187=0 +flag187=134217762 +flagg187=0 +tflag187=0 +initx187=0 +inity187=0 +minx187=0 +miny187=0 +maxx187=0 +maxy187=0 +posx187=50 +posy187=50 +sizx187=800 +sizy187=600 diff --git a/dll/dxemublt.cpp b/dll/dxemublt.cpp index df325b5..1b6c085 100644 --- a/dll/dxemublt.cpp +++ b/dll/dxemublt.cpp @@ -2,6 +2,7 @@ #include #include #include "dxwnd.h" +#include "dxwcore.hpp" #include "hddraw.h" typedef HRESULT (WINAPI *Lock_Type)(LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, DWORD, HANDLE); @@ -13,8 +14,6 @@ extern Unlock4_Type pUnlockMethod(LPDIRECTDRAWSURFACE); extern DWORD PaletteEntries[256]; extern DWORD *Palette16BPP; -extern DWORD dwDDVersion; -extern DWORD dwFlags; extern char *ExplainDDError(DWORD); extern int Set_dwSize_From_Surface(LPDIRECTDRAWSURFACE); @@ -156,7 +155,7 @@ static HRESULT WINAPI EmuBlt_16_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes if (!Palette16BPP) { // first time through ..... unsigned int pi; Palette16BPP = (DWORD *)malloc(0x10000 * sizeof(DWORD)); - if (dwFlags & USERGB565){ + if (dxw.dwFlags1 & USERGB565){ for (pi=0; pi<0x10000; pi++) { Palette16BPP[pi]=(pi & 0x1F)<<3 | (pi & 0x7E0)<<5 | (pi & 0xF800)<<8; // RGB565 } @@ -285,7 +284,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes memset(&ddsd_dst,0,sizeof(DDSURFACEDESC2)); ddsd_dst.dwSize = Set_dwSize_From_Surface(lpddsdst); - ddsd_dst.dwFlags = DDSD_LPSURFACE | DDSD_PITCH; + ddsd_dst.dxw.dwFlags1 = DDSD_LPSURFACE | DDSD_PITCH; if(res=(*pLock)(lpddsdst, 0, (LPDIRECTDRAWSURFACE)&ddsd_dst, DDLOCK_SURFACEMEMORYPTR|DDLOCK_WRITEONLY|DDLOCK_WAIT, 0)){ OutTraceE("EmuBlt32_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); return res; @@ -293,7 +292,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes memset(&ddsd_src,0,sizeof(DDSURFACEDESC2)); ddsd_src.dwSize = Set_dwSize_From_Surface(lpddssrc); - ddsd_src.dwFlags = DDSD_LPSURFACE | DDSD_PITCH; + ddsd_src.dxw.dwFlags1 = DDSD_LPSURFACE | DDSD_PITCH; if (lpsurface) { // already locked, just get info .... if(res=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd_src)) { OutTraceE("EmuBlt32_32: GetSurfaceDesc ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); @@ -846,15 +845,15 @@ static HRESULT WINAPI RevBlt_Null(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdestrec void SetBltTransformations() { OutTraceD("SetBltTransformations: color transformation %d->%d\n", - VirtualScr.PixelFormat.dwRGBBitCount, ActualScr.PixelFormat.dwRGBBitCount); + dxw.VirtualPixelFormat.dwRGBBitCount, dxw.ActualPixelFormat.dwRGBBitCount); /* default (bad) setting */ pRevBlt=RevBlt_Null; pEmuBlt=EmuBlt_Null; - switch (ActualScr.PixelFormat.dwRGBBitCount){ + switch (dxw.ActualPixelFormat.dwRGBBitCount){ case 32: - switch(VirtualScr.PixelFormat.dwRGBBitCount){ + switch(dxw.VirtualPixelFormat.dwRGBBitCount){ case 8: pRevBlt=RevBlt_32_to_8; pEmuBlt=EmuBlt_8_to_32; @@ -875,12 +874,12 @@ void SetBltTransformations() OutTraceD("set color transformation 32->32\n"); break; default: - OutTraceD("unsupported color transformation %d->32\n", VirtualScr.PixelFormat.dwRGBBitCount); + OutTraceD("unsupported color transformation %d->32\n", dxw.VirtualPixelFormat.dwRGBBitCount); break; } break; case 16: - switch(VirtualScr.PixelFormat.dwRGBBitCount){ + switch(dxw.VirtualPixelFormat.dwRGBBitCount){ case 8: pRevBlt=RevBlt_16_to_8; pEmuBlt=EmuBlt_8_to_16; @@ -900,14 +899,14 @@ void SetBltTransformations() pEmuBlt=EmuBlt_32_to_16; break; default: - OutTraceD("unsupported color transformation %d->16\n", VirtualScr.PixelFormat.dwRGBBitCount); + OutTraceD("unsupported color transformation %d->16\n", dxw.VirtualPixelFormat.dwRGBBitCount); break; } break; default: OutTraceD("unsupported color transformation %d->%d\n", - VirtualScr.PixelFormat.dwRGBBitCount, - ActualScr.PixelFormat.dwRGBBitCount); + dxw.VirtualPixelFormat.dwRGBBitCount, + dxw.ActualPixelFormat.dwRGBBitCount); break; } return; diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 47fa4bb..c2edba3 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -6,16 +6,17 @@ #include #include #include "dxwnd.h" +#include "dxwcore.hpp" #include "dxhook.h" #include "glhook.h" #include "syslibs.h" #include "dxhelper.h" +dxwCore dxw; + extern BOOL MakeWindowTransparent(HWND, unsigned char); -extern void dx_ScreenRefresh(); extern void InitScreenParameters(); -//extern char *ExplainStyle(DWORD); int WINAPI extGetDeviceCaps(HDC, int); BOOL WINAPI extGetCursorPos(LPPOINT); @@ -108,16 +109,6 @@ extern BOOL WINAPI extSetDeviceGammaRamp(HDC, LPVOID); extern BOOL WINAPI extGetDeviceGammaRamp(HDC, LPVOID); extern LRESULT WINAPI extSendMessage(HWND, UINT, WPARAM, LPARAM); - -DWORD dwFlags; -DWORD dwFlags2; -DWORD dwTFlags; -DWORD dwVersion=0; -BOOL bActive = 1; -BOOL Filler = 99; -HWND hWnd = 0; -HWND hParentWnd = 0; -HWND hChildWnd = 0; extern HANDLE hTraceMutex; char *gsModules; @@ -234,9 +225,9 @@ static void OutTraceHeader(FILE *fp) fprintf(fp, "*** DxWnd %s log BEGIN: %02d-%02d-%04d %02d:%02d:%02d ***\n", Version, Time.wDay, Time.wMonth, Time.wYear, Time.wHour, Time.wMinute, Time.wSecond); fprintf(fp, "*** Flags= "); - for(i=0, dword=dwFlags; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", FlagNames[i]); - for(i=0, dword=dwFlags2; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", Flag2Names[i]); - for(i=0, dword=dwTFlags; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", TFlagNames[i]); + for(i=0, dword=dxw.dwFlags1; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", FlagNames[i]); + for(i=0, dword=dxw.dwFlags2; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", Flag2Names[i]); + for(i=0, dword=dxw.dwTFlags; i<32; i++, dword>>=1) if(dword & 0x1) fprintf(fp, "%s ", TFlagNames[i]); fprintf(fp, "***\n"); } @@ -247,7 +238,7 @@ void OutTrace(const char *format, ...) static FILE *fp=NULL; // GHO: thread safe??? // check global log flag - if(!(dwTFlags & OUTTRACE)) return; + if(!(dxw.dwTFlags & OUTTRACE)) return; WaitForSingleObject(hTraceMutex, INFINITE); if (fp == NULL){ @@ -260,7 +251,7 @@ void OutTrace(const char *format, ...) fp = fopen(path, "a+"); } if (fp==NULL){ // last chance: do not log... - dwTFlags &= ~OUTTRACE; // turn flag OFF + dxw.dwTFlags &= ~OUTTRACE; // turn flag OFF return; } else @@ -277,15 +268,15 @@ void OutTrace(const char *format, ...) static void dx_ToggleLogging() { // toggle LOGGING - if(dwTFlags & OUTTRACE){ + if(dxw.dwTFlags & OUTTRACE){ OutTraceD("Toggle logging OFF\n"); - dwTFlags &= ~OUTTRACE; + dxw.dwTFlags &= ~OUTTRACE; } else { - dwTFlags |= OUTTRACE; + dxw.dwTFlags |= OUTTRACE; OutTraceD("Toggle logging ON\n"); } - DxWndStatus.isLogging=(dwTFlags & OUTTRACE); + DxWndStatus.isLogging=(dxw.dwTFlags & OUTTRACE); SetHookStatus(&DxWndStatus); } @@ -555,109 +546,6 @@ void SetHook(void *target, void *hookproc, void **hookedproc, char *hookname) *hookedproc = tmp; } -// v2.1.93: FixCursorPos completely revised to introduce a clipping tolerance in -// clipping regions as well as in normal operations - -#define CLIP_TOLERANCE 4 - -static POINT FixCursorPos(HWND hwnd, POINT prev) -{ - POINT curr; - RECT rect; - extern LPRECT lpClipRegion; - - curr=prev; - - // scale mouse coordinates - // remember: rect from GetClientRect always start at 0,0! - if(dwFlags & MODIFYMOUSE){ - if (!(*pGetClientRect)(hwnd, &rect)) { - OutTraceD("GetClientRect ERROR %d at %d\n", GetLastError(),__LINE__); - curr.x = curr.y = 0; - } - - if (rect.right) curr.x = (curr.x * VirtualScr.dwWidth) / rect.right; - if (rect.bottom) curr.y = (curr.y * VirtualScr.dwHeight) / rect.bottom; - } - - if((dwFlags & ENABLECLIPPING) && lpClipRegion){ - // v2.1.93: - // in clipping mode, avoid the cursor position to lay outside the valid rect - // note 1: the rect follow the convention and valid coord lay between left to righ-1, - // top to bottom-1 - // note 2: CLIP_TOLERANCE is meant to handle possible integer divide tolerance errors - // that may prevent reaching the clip rect borders. The smaller you shrink the window, - // the bigger tolerance is required - if (curr.x < lpClipRegion->left+CLIP_TOLERANCE) curr.x=lpClipRegion->left; - if (curr.y < lpClipRegion->top+CLIP_TOLERANCE) curr.y=lpClipRegion->top; - if (curr.x >= lpClipRegion->right-CLIP_TOLERANCE) curr.x=lpClipRegion->right-1; - if (curr.y >= lpClipRegion->bottom-CLIP_TOLERANCE) curr.y=lpClipRegion->bottom-1; - } - else{ - if (curr.x < CLIP_TOLERANCE) curr.x=0; - if (curr.y < CLIP_TOLERANCE) curr.y=0; - if (curr.x >= (LONG)VirtualScr.dwWidth-CLIP_TOLERANCE) curr.x=VirtualScr.dwWidth-1; - if (curr.y >= (LONG)VirtualScr.dwHeight-CLIP_TOLERANCE) curr.y=VirtualScr.dwHeight-1; - } - - return curr; -} - -static void FixNCHITCursorPos(LPPOINT lppoint) -{ - RECT rect; - POINT point; - - point=*lppoint; - (*pGetClientRect)(hWnd, &rect); - (*pScreenToClient)(hWnd, &point); - - if (point.x < 0) return; - if (point.y < 0) return; - if (point.x > rect.right) return; - if (point.y > rect.bottom) return; - - *lppoint=point; - lppoint->x = (lppoint->x * VirtualScr.dwWidth) / rect.right; - lppoint->y = (lppoint->y * VirtualScr.dwHeight) / rect.bottom; - if(lppoint->x < CLIP_TOLERANCE) lppoint->x=0; - if(lppoint->y < CLIP_TOLERANCE) lppoint->y=0; - if(lppoint->x > (LONG)VirtualScr.dwWidth-CLIP_TOLERANCE) lppoint->x=VirtualScr.dwWidth-1; - if(lppoint->y > (LONG)VirtualScr.dwHeight-CLIP_TOLERANCE) lppoint->y=VirtualScr.dwHeight-1; -} - - -void DxWndSetClipCursor() -{ - RECT Rect; - POINT UpLeftCorner; - - OutTraceD("DxWndSetClipCursor:\n"); - if (hWnd==NULL) { - OutTraceD("DxWndSetClipCursor: ASSERT hWnd==NULL\n"); - return; - } - (*pGetClientRect)(hWnd, &Rect); - UpLeftCorner.x=UpLeftCorner.y=0; - (*pClientToScreen)(hWnd, &UpLeftCorner); - Rect.left+=UpLeftCorner.x; - Rect.right+=UpLeftCorner.x; - Rect.top+=UpLeftCorner.y; - Rect.bottom+=UpLeftCorner.y; - (*pClipCursor)(NULL); - if(!(*pClipCursor)(&Rect)){ - OutTraceE("ClipCursor: ERROR err=%d at %d\n", GetLastError(), __LINE__); - } - OutTraceD("DxWndSetClipCursor: rect=(%d,%d)-(%d,%d)\n", - Rect.left, Rect.top, Rect.right, Rect.bottom); -} - -void DxWndEraseClipCursor() -{ - OutTraceD("DxWndEraseClipCursor:\n"); - (*pClipCursor)(NULL); -} - // v.2.1.80: unified positioning logic into CalculateWindowPos routine // now taking in account for window menus (see "Alien Cabal") @@ -718,11 +606,10 @@ void AdjustWindowFrame(HWND hwnd, DWORD width, DWORD height) OutTraceD("AdjustWindowFrame hwnd=%x, wxh=%dx%d\n", hwnd, width, height); - if (width) VirtualScr.dwWidth = width; - if (height) VirtualScr.dwHeight = height; + dxw.SetScreenSize(width, height); if (hwnd==NULL) return; - (*pSetWindowLong)(hwnd, GWL_STYLE, (dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW); + (*pSetWindowLong)(hwnd, GWL_STYLE, (dxw.dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW); (*pSetWindowLong)(hwnd, GWL_EXSTYLE, 0); (*pShowWindow)(hwnd, SW_SHOWNORMAL); OutTraceD("AdjustWindowFrame hwnd=%x, set style=WS_OVERLAPPEDWINDOW extstyle=0\n", hwnd); @@ -749,10 +636,10 @@ void AdjustWindowFrame(HWND hwnd, DWORD width, DWORD height) // fixing cursor view and clipping region - if (dwFlags & HIDEHWCURSOR) while (ShowCursor(0) >= 0); - if (dwFlags & CLIPCURSOR) { + if (dxw.dwFlags1 & HIDEHWCURSOR) while (ShowCursor(0) >= 0); + if (dxw.dwFlags1 & CLIPCURSOR) { OutTraceD("AdjustWindowFrame: setting clip region\n"); - DxWndSetClipCursor(); + dxw.SetClipCursor(); } (*pInvalidateRect)(hwnd, NULL, TRUE); @@ -792,36 +679,9 @@ LRESULT CALLBACK extChildWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPAR static int i=0; static WINDOWPOS *wp; WNDPROC pWindowProc; - extern BOOL isFullScreen; OutTraceW("DEBUG: ChildWinMsg [0x%x]%s(%x,%x)\n", message, ExplainWinMessage(message), wparam, lparam); switch(message){ -#if 0 - // deleted after interception of MoveWindow API with WS_CHILD special case. - // don't make the same compensation twice!!! - case WM_WINDOWPOSCHANGING: - { - // WINDOWPOS coordinates update for Age of Empires I & II edit controls. - WINDOWPOS *wp; - RECT rect; - wp = (LPWINDOWPOS)lparam; - OutTraceD("ChildWindowProc: WM_WINDOWPOSCHANGING pos=(%d,%d) size=(%d,%d)\n", - wp->x, wp->y, wp->cx, wp->cy); - if(isFullScreen){ - // scale coordinates - if (!(*pGetClientRect)(hWnd, &rect)) { // note! hWnd, the main form. Fixed again v70 - OutTraceE("GetClientRect ERROR %d at %d\n", GetLastError(),__LINE__); - break; - } - wp->x = (wp->x * rect.right) / VirtualScr.dwWidth; - wp->cx = (wp->cx * rect.right) / VirtualScr.dwWidth; - wp->y = (wp->y * rect.bottom) / VirtualScr.dwHeight; - wp->cy = (wp->cy * rect.bottom) / VirtualScr.dwHeight; - OutTraceD("ChildWindowProc: fixed pos=(%d,%d) size=(%d,%d)\n", wp->x, wp->y, wp->cx, wp->cy); - } - } - break; -#endif // Cybermercs: it seems that all game menus are conveniently handled by the WindowProc routine, // while the action screen get messages processed by the ChildWindowProc, that needs some different @@ -839,13 +699,13 @@ LRESULT CALLBACK extChildWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPAR case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_MBUTTONDBLCLK: - if(dwFlags & MODIFYMOUSE){ // mouse processing + if(dxw.dwFlags1 & MODIFYMOUSE){ // mouse processing POINT prev, curr; // scale mouse coordinates prev.x = LOWORD(lparam); prev.y = HIWORD(lparam); //OutTraceC("ChildWindowProc: hwnd=%x pos XY prev=(%d,%d)\n", hwnd, prev.x, prev.y); - curr=FixCursorPos(hWnd, prev); // Warn! the correction must refer to the main window hWnd, not the current hwnd one !!! + curr=dxw.FixCursorPos(prev); // Warn! the correction must refer to the main window hWnd, not the current hwnd one !!! lparam = MAKELPARAM(curr.x, curr.y); OutTraceC("ChildWindowProc: hwnd=%x pos XY=(%d,%d)->(%d,%d)\n", hwnd, prev.x, prev.y, curr.x, curr.y); } @@ -862,10 +722,10 @@ LRESULT CALLBACK extChildWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPAR static void dx_TogglePositionLock(HWND hwnd) { // toggle position locking - if(dwFlags & LOCKWINPOS){ + if(dxw.dwFlags1 & LOCKWINPOS){ // unlock OutTraceD("Toggle position lock OFF\n"); - dwFlags &= ~LOCKWINPOS; + dxw.dwFlags1 &= ~LOCKWINPOS; } else { // lock and update window position!!! @@ -874,7 +734,7 @@ static void dx_TogglePositionLock(HWND hwnd) POINT p={0,0}; (*pGetClientRect)(hwnd,&rect); (*pClientToScreen)(hwnd,&p); - dwFlags |= LOCKWINPOS; + dxw.dwFlags1 |= LOCKWINPOS; OutTraceD("Toggle position lock ON\n"); iPosX=(short)p.x; iPosY=(short)p.y; @@ -885,12 +745,12 @@ static void dx_TogglePositionLock(HWND hwnd) void dx_ToggleDC() { - if(dwFlags & HANDLEDC){ - dwFlags &= ~HANDLEDC; + if(dxw.dwFlags1 & HANDLEDC){ + dxw.dwFlags1 &= ~HANDLEDC; OutTrace("ToggleDC: HANDLEDC mode OFF\n"); } else { - dwFlags |= HANDLEDC; + dxw.dwFlags1 |= HANDLEDC; OutTrace("ToggleDC: HANDLEDC mode ON\n"); } } @@ -913,7 +773,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp OutTraceW("WindowProc: WinMsg=[0x%x]%s(%x,%x)\n", message, ExplainWinMessage(message), wparam, lparam); switch(message){ case WM_NCHITTEST: - if((dwFlags2 & FIXNCHITTEST) && (dwFlags & MODIFYMOUSE)){ // mouse processing + if((dxw.dwFlags2 & FIXNCHITTEST) && (dxw.dwFlags1 & MODIFYMOUSE)){ // mouse processing POINT cursor; LRESULT ret; ret=(*pDefWindowProc)(hwnd, message, wparam, lparam); @@ -921,7 +781,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp if (ret==HTCLIENT) { cursor.x=LOWORD(lparam); cursor.y=HIWORD(lparam); - FixNCHITCursorPos(&cursor); + dxw.FixNCHITCursorPos(&cursor); lparam = MAKELPARAM(cursor.x, cursor.y); } else @@ -933,8 +793,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp return 1; // 1 == OK, erased break; case WM_DISPLAYCHANGE: - extern int isFullScreen; - if ((dwFlags & LOCKWINPOS) && isFullScreen){ + if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()){ OutTraceD("WindowProc: prevent WM_DISPLAYCHANGE depth=%d size=(%d,%d)\n", wparam, HIWORD(lparam), LOWORD(lparam)); return 0; @@ -948,20 +807,20 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp break; case WM_ENTERSIZEMOVE: while(ShowCursor(1) < 0); - if(dwFlags & CLIPCURSOR) DxWndEraseClipCursor(); - if(dwFlags & ENABLECLIPPING) (*pClipCursor)(NULL); + if(dxw.dwFlags1 & CLIPCURSOR) dxw.EraseClipCursor(); + if(dxw.dwFlags1 & ENABLECLIPPING) (*pClipCursor)(NULL); break; case WM_EXITSIZEMOVE: - if (dwFlags & HIDEHWCURSOR) while(ShowCursor(0) >= 0); - if(dwFlags & ENABLECLIPPING) extClipCursor(lpClipRegion); - if(dwFlags2 & REFRESHONRESIZE) dx_ScreenRefresh(); + if (dxw.dwFlags1 & HIDEHWCURSOR) while(ShowCursor(0) >= 0); + if(dxw.dwFlags1 & ENABLECLIPPING) extClipCursor(lpClipRegion); + if(dxw.dwFlags2 & REFRESHONRESIZE) dxw.ScreenRefresh(); break; case WM_ACTIVATE: - bActive = (LOWORD(wparam) == WA_ACTIVE || LOWORD(wparam) == WA_CLICKACTIVE) ? 1 : 0; + dxw.bActive = (LOWORD(wparam) == WA_ACTIVE || LOWORD(wparam) == WA_CLICKACTIVE) ? 1 : 0; case WM_NCACTIVATE: - if(message == WM_NCACTIVATE) bActive = wparam; + if(message == WM_NCACTIVATE) dxw.bActive = wparam; (*pSetWindowPos)(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); - if(dwFlags & UNNOTIFY){ + if(dxw.dwFlags1 & UNNOTIFY){ DefWindowProc(hwnd, message, wparam, lparam); return false; } @@ -976,7 +835,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp case WM_MOUSEMOVE: prev.x = LOWORD(lparam); prev.y = HIWORD(lparam); - if (dwFlags & HIDEHWCURSOR) { + if (dxw.dwFlags1 & HIDEHWCURSOR) { (*pGetClientRect)(hwnd, &rect); if(prev.x >= 0 && prev.x < rect.right && prev.y >= 0 && prev.y < rect.bottom) while(ShowCursor(0) >= 0); @@ -986,9 +845,9 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp else { while(ShowCursor(1) < 0); } - if(dwFlags & MODIFYMOUSE){ // mouse processing + if(dxw.dwFlags1 & MODIFYMOUSE){ // mouse processing // scale mouse coordinates - curr=FixCursorPos(hwnd, prev); + curr=dxw.FixCursorPos(hwnd, prev); lparam = MAKELPARAM(curr.x, curr.y); OutTraceC("WindowProc: hwnd=%x pos XY=(%d,%d)->(%d,%d)\n", hwnd, prev.x, prev.y, curr.x, curr.y); } @@ -1004,26 +863,26 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp case WM_MBUTTONDOWN: case WM_MBUTTONUP: case WM_MBUTTONDBLCLK: - if((dwFlags & CLIPCURSOR) && ClipCursorToggleState) DxWndSetClipCursor(); - if(dwFlags & MODIFYMOUSE){ // mouse processing + if((dxw.dwFlags1 & CLIPCURSOR) && ClipCursorToggleState) dxw.SetClipCursor(); + if(dxw.dwFlags1 & MODIFYMOUSE){ // mouse processing // scale mouse coordinates prev.x = LOWORD(lparam); prev.y = HIWORD(lparam); - curr=FixCursorPos(hwnd, prev); + curr=dxw.FixCursorPos(hwnd, prev); lparam = MAKELPARAM(curr.x, curr.y); OutTraceC("WindowProc: hwnd=%x pos XY=(%d,%d)->(%d,%d)\n", hwnd, prev.x, prev.y, curr.x, curr.y); } break; case WM_SETFOCUS: - //if (dwFlags & CLIPCURSOR) if (ClipCursorToggleState) DxWndSetClipCursor(); - if (dwFlags & ENABLECLIPPING) extClipCursor(lpClipRegion); + //if (dxw.dwFlags1 & CLIPCURSOR) if (ClipCursorToggleState) dxw.SetClipCursor(); + if (dxw.dwFlags1 & ENABLECLIPPING) extClipCursor(lpClipRegion); break; case WM_KILLFOCUS: - if (dwFlags & CLIPCURSOR) DxWndEraseClipCursor(); - if (dwFlags & ENABLECLIPPING) (*pClipCursor)(NULL); + if (dxw.dwFlags1 & CLIPCURSOR) dxw.EraseClipCursor(); + if (dxw.dwFlags1 & ENABLECLIPPING) (*pClipCursor)(NULL); break; case WM_CLOSE: - //if (dwFlags & HANDLECOSEICON) { + //if (dxw.dwFlags1 & HANDLECOSEICON) { { OutTraceD("WindowProc: WM_CLOSE - terminating process\n"); TerminateProcess(GetCurrentProcess(),0); @@ -1033,13 +892,13 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp OutTraceW("event WM_SYSKEYDOWN wparam=%x lparam=%x\n", wparam, lparam); switch (wparam){ case VK_F12: - if(dwFlags & CLIPCURSOR){ + if(dxw.dwFlags1 & CLIPCURSOR){ OutTraceD("WindowProc: WM_SYSKEYDOWN key=%x ToggleState=%x\n",wparam,ClipCursorToggleState); ClipCursorToggleState = !ClipCursorToggleState; - ClipCursorToggleState ? DxWndSetClipCursor() : DxWndEraseClipCursor(); + ClipCursorToggleState ? dxw.SetClipCursor() : dxw.EraseClipCursor(); } case VK_F11: - dx_ScreenRefresh(); + dxw.ScreenRefresh(); break; case VK_F10: dx_ToggleLogging(); @@ -1051,7 +910,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp dx_ToggleDC(); break; case VK_F4: - if (dwFlags & HANDLEALTF4) { + if (dxw.dwFlags1 & HANDLEALTF4) { OutTraceD("WindowProc: WM_SYSKEYDOWN(ALT-F4) - terminating process\n"); TerminateProcess(GetCurrentProcess(),0); } @@ -1062,9 +921,9 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp default: break; } - if (dwFlags & AUTOREFRESH) + if (dxw.dwFlags1 & AUTOREFRESH) { - dx_ScreenRefresh(); + dxw.ScreenRefresh(); } pWindowProc=WhndGetWindowProc(hwnd); @@ -1074,7 +933,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp // save last NCHITTEST cursor position for use with KEEPASPECTRATIO scaling if(message==WM_NCHITTEST) LastCursorPos=ret; // v2.1.89: if FORCEWINRESIZE add standard processing for the missing WM_NC* messages - if(dwFlags2 & FORCEWINRESIZE){ + if(dxw.dwFlags2 & FORCEWINRESIZE){ switch(message){ //case WM_NCHITTEST: //case WM_NCPAINT: @@ -1189,7 +1048,7 @@ void HookSysLibs(char *module) if(tmp) pBeginPaint = (BeginPaint_Type)tmp; tmp = HookAPI("user32.dll", EndPaint, "EndPaint", extEndPaint); if(tmp) pEndPaint = (EndPaint_Type)tmp; - if(dwFlags & MAPGDITOPRIMARY){ + if(dxw.dwFlags1 & MAPGDITOPRIMARY){ tmp = HookAPI("GDI32.dll", CreateCompatibleDC, "CreateCompatibleDC", extDDCreateCompatibleDC); if(tmp) pCreateCompatibleDC = (CreateCompatibleDC_Type)tmp; tmp = HookAPI("GDI32.dll", DeleteDC, "DeleteDC", extDDDeleteDC); @@ -1234,7 +1093,7 @@ void HookSysLibs(char *module) //if(tmp) pInvalidateRgn = (InvalidateRgn_Type)tmp; } - if (dwFlags & CLIENTREMAPPING){ + if (dxw.dwFlags1 & CLIENTREMAPPING){ tmp = HookAPI("user32.dll", ScreenToClient, "ScreenToClient", extScreenToClient); if(tmp) pScreenToClient = (ScreenToClient_Type)tmp; tmp = HookAPI("user32.dll", ClientToScreen, "ClientToScreen", extClientToScreen); @@ -1263,7 +1122,7 @@ void HookSysLibs(char *module) if(tmp) pClipCursor = (ClipCursor_Type)tmp; tmp = HookAPI("user32.dll", FillRect, "FillRect", extFillRect); if(tmp) pFillRect = (FillRect_Type)tmp; - if (dwFlags & MESSAGEPROC) { + if (dxw.dwFlags1 & MESSAGEPROC) { tmp = HookAPI("user32.dll", PeekMessageA, "PeekMessageA", extPeekMessage); // added for GPL if(tmp) pPeekMessage = (PeekMessage_Type)tmp; tmp = HookAPI("user32.dll", GetMessageA, "GetMessageA", extGetMessage); // added for GPL @@ -1285,7 +1144,7 @@ void HookSysLibs(char *module) if(tmp) pRegisterClassExA = (RegisterClassExA_Type)tmp; tmp = HookAPI("GDI32.dll", Rectangle, "Rectangle", extRectangle); if(tmp) pRectangle = (Rectangle_Type)tmp; - if (dwFlags & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE)){ + if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE)){ tmp = HookAPI("user32.dll", ShowWindow, "ShowWindow", extShowWindow); if(tmp) pShowWindow = (ShowWindow_Type)tmp; tmp = HookAPI("user32.dll", SetWindowLongA, "SetWindowLongA", extSetWindowLong); @@ -1302,7 +1161,7 @@ void HookSysLibs(char *module) //tmp = HookAPI("user32.dll", SetWindowPlacement, "SetWindowPlacement", extSetWindowPlacement); //if(tmp) pSetWindowPlacement = (SetWindowPlacement_Type)tmp; } - if ((dwFlags & EMULATESURFACE) && (dwFlags & HANDLEDC)){ + if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC)){ tmp = HookAPI("GDI32.dll", SetTextColor, "SetTextColor", extSetTextColor); if(tmp) pSetTextColor = (SetTextColor_Type)tmp; tmp = HookAPI("GDI32.dll", SetBkColor, "SetBkColor", extSetBkColor); @@ -1321,7 +1180,7 @@ void HookSysLibs(char *module) tmp = HookAPI("user32.dll", GetDesktopWindow, "GetDesktopWindow", extGetDesktopWindow); if(tmp) pGetDesktopWindow = (GetDesktopWindow_Type)tmp; - if(dwFlags & MODIFYMOUSE){ + if(dxw.dwFlags1 & MODIFYMOUSE){ tmp = HookAPI("user32.dll", GetCursorPos, "GetCursorPos", extGetCursorPos); if(tmp) pGetCursorPos = (GetCursorPos_Type)tmp; //tmp = HookAPI("user32.dll", GetPhysicalCursorPos, "", extGetCursorPos); @@ -1331,7 +1190,7 @@ void HookSysLibs(char *module) tmp = HookAPI("user32.dll", SendMessageA, "SendMessageA", extSendMessage); if(tmp) pSendMessage = (SendMessage_Type)tmp; } - if((dwFlags & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dwFlags2 & KEEPCURSORFIXED)){ + if((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)){ tmp = HookAPI("user32.dll", SetCursorPos, "SetCursorPos", extSetCursorPos); if(tmp) pSetCursorPos = (SetCursorPos_Type)tmp; } @@ -1370,7 +1229,7 @@ void HookSysLibs(char *module) if(tmp) pMoveWindow = (MoveWindow_Type)tmp; } - if(dwFlags2 & DISABLEGAMMARAMP){ + if(dxw.dwFlags2 & DISABLEGAMMARAMP){ tmp = HookAPI("GDI32.dll", SetDeviceGammaRamp, "SetDeviceGammaRamp", extSetDeviceGammaRamp); if(tmp) pSetDeviceGammaRamp = (SetDeviceGammaRamp_Type)tmp; tmp = HookAPI("GDI32.dll", GetDeviceGammaRamp, "GetDeviceGammaRamp", extGetDeviceGammaRamp); @@ -1466,7 +1325,7 @@ void HookExceptionHandler(void) void HookModule(char *module, int dxversion) { HookSysLibs(module); - if(dwFlags & HOOKDI) HookDirectInput(dxversion); + if(dxw.dwFlags1 & HOOKDI) HookDirectInput(dxversion); HookDirectDraw(dxversion); HookDirect3D(dxversion); HookOle32(dxversion); // unfinished business @@ -1483,36 +1342,36 @@ int HookInit(TARGETMAP *target, HWND hwnd) "DirectX7", "DirectX8", "DirectX9", "None\\OpenGL", "", "", "" }; - dwFlags = target->flags; - dwFlags2 = target->flags2; - dwTFlags = target->tflags; + dxw.dwFlags1 = target->flags; + dxw.dwFlags2 = target->flags2; + dxw.dwTFlags = target->tflags; gsModules = target->module; // v2.1.75: is it correct to set hWnd here? - hWnd=hwnd; - hParentWnd=GetParent(hwnd); - hChildWnd=hwnd; + dxw.SethWnd(hwnd); + dxw.hParentWnd=GetParent(hwnd); + dxw.hChildWnd=hwnd; // bounds control if(target->dxversion<0) target->dxversion=0; if(target->dxversion>10) target->dxversion=10; - OutTraceD("HookInit: path=\"%s\" module=\"%s\" dxversion=%s hWnd=%x hParentWnd=%x\n", - target->path, target->module, dxversions[target->dxversion], hwnd, hParentWnd); + OutTraceD("HookInit: path=\"%s\" module=\"%s\" dxversion=%s hWnd=%x dxw.hParentWnd=%x\n", + target->path, target->module, dxversions[target->dxversion], hwnd, dxw.hParentWnd); if (IsDebug){ DWORD dwStyle, dwExStyle; - dwStyle=GetWindowLong(hWnd, GWL_STYLE); - dwExStyle=GetWindowLong(hWnd, GWL_EXSTYLE); + dwStyle=GetWindowLong(dxw.GethWnd(), GWL_STYLE); + dwExStyle=GetWindowLong(dxw.GethWnd(), GWL_EXSTYLE); OutTrace("HookInit: hWnd style=%x(%s) exstyle=%x(%s)\n", dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle)); - dwStyle=GetWindowLong(hParentWnd, GWL_STYLE); - dwExStyle=GetWindowLong(hParentWnd, GWL_EXSTYLE); - OutTrace("HookInit: hParentWnd style=%x(%s) exstyle=%x(%s)\n", dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle)); + dwStyle=GetWindowLong(dxw.hParentWnd, GWL_STYLE); + dwExStyle=GetWindowLong(dxw.hParentWnd, GWL_EXSTYLE); + OutTrace("HookInit: dxw.hParentWnd style=%x(%s) exstyle=%x(%s)\n", dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle)); } - if(dwFlags & HANDLEEXCEPTIONS) HookExceptionHandler(); + if(dxw.dwFlags1 & HANDLEEXCEPTIONS) HookExceptionHandler(); - if (dwTFlags & OUTIMPORTTABLE) DumpImportTable(NULL); + if (dxw.dwTFlags & OUTIMPORTTABLE) DumpImportTable(NULL); - if (dwTFlags & DXPROXED){ + if (dxw.dwTFlags & DXPROXED){ HookDDProxy(target->dxversion); return 0; } @@ -1532,16 +1391,16 @@ int HookInit(TARGETMAP *target, HWND hwnd) sModule=strtok(NULL," "); } - if(dwFlags2 & RECOVERSCREENMODE) RecoverScreenMode(); + if(dxw.dwFlags2 & RECOVERSCREENMODE) RecoverScreenMode(); InitScreenParameters(); if (IsDebug) OutTraceD("MoveWindow: target pos=(%d,%d) size=(%d,%d)\n", iPosX, iPosY, iSizX, iSizY); - if(dwFlags & FIXPARENTWIN){ + if(dxw.dwFlags1 & FIXPARENTWIN){ CalculateWindowPos(hwnd, iSizX, iSizY, &wp); - if (IsDebug) OutTraceD("MoveWindow: hParentWnd=%x pos=(%d,%d) size=(%d,%d)\n", hParentWnd, wp.x, wp.y, wp.cx, wp.cy); - res=(*pMoveWindow)(hParentWnd, wp.x, wp.y, wp.cx, wp.cy, FALSE); - if(!res) OutTraceE("MoveWindow ERROR: hParentWnd=%x err=%d at %d\n", hParentWnd, GetLastError(), __LINE__); + if (IsDebug) OutTraceD("MoveWindow: dxw.hParentWnd=%x pos=(%d,%d) size=(%d,%d)\n", dxw.hParentWnd, wp.x, wp.y, wp.cx, wp.cy); + res=(*pMoveWindow)(dxw.hParentWnd, wp.x, wp.y, wp.cx, wp.cy, FALSE); + if(!res) OutTraceE("MoveWindow ERROR: dxw.hParentWnd=%x err=%d at %d\n", dxw.hParentWnd, GetLastError(), __LINE__); } return 0; @@ -1558,13 +1417,13 @@ HRESULT WINAPI extGDIGetDisplayMode(HDC dev, int mode) OutTraceD("GDIGetDisplayMode, mode=%x\n", mode); res=(*pGDIGetDisplayMode)(dev, mode); - if((dwFlags & EMULATESURFACE) && (VirtualScr.PixelFormat.dwRGBBitCount == 8)){ + if((dxw.dwFlags1 & EMULATESURFACE) && (dxw.VirtualPixelFormat.dwRGBBitCount == 8)){ //lpddsd->ddpfPixelFormat.dwFlags |= DDPF_PALETTEINDEXED8; //lpddsd->ddpfPixelFormat.dwRGBBitCount = 8; //lpddsd->ddsCaps.dwCaps |= DDSCAPS_PALETTE; } else - if((dwFlags & EMULATESURFACE) && (VirtualScr.PixelFormat.dwRGBBitCount == 16)){ + if((dxw.dwFlags1 & EMULATESURFACE) && (dxw.VirtualPixelFormat.dwRGBBitCount == 16)){ //lpddsd->ddpfPixelFormat.dwRGBBitCount = 16; } //OutTraceD("GetDisplayMode: returning WxH=(%dx%d), PixelFormat Flags=%x, RGBBitCount=%d, Caps=%x\n", @@ -1578,13 +1437,12 @@ HRESULT WINAPI extGDIGetDisplayMode(HDC dev, int mode) HWND WINAPI extGetDesktopWindow(void) { // V2.1.73: correct ??? - extern BOOL isFullScreen; HWND res; - OutTraceD("GetDesktopWindow: FullScreen=%x\n", isFullScreen); - if (isFullScreen){ - OutTraceD("GetDesktopWindow: returning main window hwnd=%x\n", hWnd); - return hWnd; + OutTraceD("GetDesktopWindow: FullScreen=%x\n", dxw.IsFullScreen()); + if (dxw.IsFullScreen()){ + OutTraceD("GetDesktopWindow: returning main window hwnd=%x\n", dxw.GethWnd()); + return dxw.GethWnd(); } else{ res=(*pGetDesktopWindow)(); diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp index 33a9a23..aa761fc 100644 --- a/dll/dxwcore.cpp +++ b/dll/dxwcore.cpp @@ -1,5 +1,5 @@ #include "dxwnd.h" -//#include "dxwcore.hpp" +#include "dxwcore.hpp" #include "syslibs.h" extern GetCursorPos_Type pGetCursorPos; @@ -7,18 +7,42 @@ extern ClientToScreen_Type pClientToScreen; dxwCore::dxwCore() { + // initialization stuff .... + FullScreen=FALSE; + SethWnd(NULL); + SetScreenSize(); + dwMaxDDVersion=7; + hParentWnd = 0; + hChildWnd = 0; + bActive = TRUE; + bDInputAbs = 0; } dxwCore::~dxwCore() { } -void dxwCore::SethWnd(HWND hwnd) +RECT dxwCore::GetScreenRect() { - hWnd=hwnd; + static RECT Screen; + Screen.left=0; + Screen.top=0; + Screen.right=dwScreenWidth; + Screen.bottom=dwScreenHeight; + return Screen; } -POINT FixCursorPos(POINT prev) +// v2.1.93: FixCursorPos completely revised to introduce a clipping tolerance in +// clipping regions as well as in normal operations + +#define CLIP_TOLERANCE 4 + +POINT dxwCore::FixCursorPos(POINT prev) +{ + return FixCursorPos(hWnd, prev); +} + +POINT dxwCore::FixCursorPos(HWND hwnd, POINT prev) { POINT curr; RECT rect; @@ -28,17 +52,17 @@ POINT FixCursorPos(POINT prev) // scale mouse coordinates // remember: rect from GetClientRect always start at 0,0! - if(dwFlags & MODIFYMOUSE){ - if (!(*pGetClientRect)(hWnd, &rect)) { + if(dxw.dwFlags1 & MODIFYMOUSE){ + if (!(*pGetClientRect)(hwnd, &rect)) { OutTraceD("GetClientRect ERROR %d at %d\n", GetLastError(),__LINE__); curr.x = curr.y = 0; } - if (rect.right) curr.x = (curr.x * VirtualScr.dwWidth) / rect.right; - if (rect.bottom) curr.y = (curr.y * VirtualScr.dwHeight) / rect.bottom; + if (rect.right) curr.x = (curr.x * dxw.GetScreenWidth()) / rect.right; + if (rect.bottom) curr.y = (curr.y * dxw.GetScreenHeight()) / rect.bottom; } - if((dwFlags & ENABLECLIPPING) && lpClipRegion){ + if((dxw.dwFlags1 & ENABLECLIPPING) && lpClipRegion){ // v2.1.93: // in clipping mode, avoid the cursor position to lay outside the valid rect // note 1: the rect follow the convention and valid coord lay between left to righ-1, @@ -54,9 +78,123 @@ POINT FixCursorPos(POINT prev) else{ if (curr.x < CLIP_TOLERANCE) curr.x=0; if (curr.y < CLIP_TOLERANCE) curr.y=0; - if (curr.x >= (LONG)VirtualScr.dwWidth-CLIP_TOLERANCE) curr.x=VirtualScr.dwWidth-1; - if (curr.y >= (LONG)VirtualScr.dwHeight-CLIP_TOLERANCE) curr.y=VirtualScr.dwHeight-1; + if (curr.x >= (LONG)dxw.GetScreenWidth()-CLIP_TOLERANCE) curr.x=dxw.GetScreenWidth()-1; + if (curr.y >= (LONG)dxw.GetScreenHeight()-CLIP_TOLERANCE) curr.y=dxw.GetScreenHeight()-1; } return curr; +} + +void dxwCore::FixNCHITCursorPos(LPPOINT lppoint) +{ + RECT rect; + POINT point; + + point=*lppoint; + (*pGetClientRect)(dxw.GethWnd(), &rect); + (*pScreenToClient)(dxw.GethWnd(), &point); + + if (point.x < 0) return; + if (point.y < 0) return; + if (point.x > rect.right) return; + if (point.y > rect.bottom) return; + + *lppoint=point; + lppoint->x = (lppoint->x * dxw.GetScreenWidth()) / rect.right; + lppoint->y = (lppoint->y * dxw.GetScreenHeight()) / rect.bottom; + if(lppoint->x < CLIP_TOLERANCE) lppoint->x=0; + if(lppoint->y < CLIP_TOLERANCE) lppoint->y=0; + if(lppoint->x > (LONG)dxw.GetScreenWidth()-CLIP_TOLERANCE) lppoint->x=dxw.GetScreenWidth()-1; + if(lppoint->y > (LONG)dxw.GetScreenHeight()-CLIP_TOLERANCE) lppoint->y=dxw.GetScreenHeight()-1; +} + +void dxwCore::SetClipCursor() +{ + RECT Rect; + POINT UpLeftCorner; + + OutTraceD("Core::SetClipCursor:\n"); + if (hWnd==NULL) { + OutTraceD("Core::SetClipCursor: ASSERT hWnd==NULL\n"); + return; + } + (*pGetClientRect)(hWnd, &Rect); + UpLeftCorner.x=UpLeftCorner.y=0; + (*pClientToScreen)(hWnd, &UpLeftCorner); + Rect.left+=UpLeftCorner.x; + Rect.right+=UpLeftCorner.x; + Rect.top+=UpLeftCorner.y; + Rect.bottom+=UpLeftCorner.y; + (*pClipCursor)(NULL); + if(!(*pClipCursor)(&Rect)){ + OutTraceE("ClipCursor: ERROR err=%d at %d\n", GetLastError(), __LINE__); + } + OutTraceD("Core::SetClipCursor: rect=(%d,%d)-(%d,%d)\n", + Rect.left, Rect.top, Rect.right, Rect.bottom); +} + +void dxwCore::EraseClipCursor() +{ + OutTraceD("Core::EraseClipCursor:\n"); + (*pClipCursor)(NULL); +} + +// MapWindow Rect: returns a rectangle in the real coordinate system from the virtual coordinates +// of an emulated fullscreen window. NULL or void returns the rectangle of the whole client area. + +RECT dxwCore::MapWindowRect(void) +{ + return MapWindowRect(NULL); +} + +RECT dxwCore::MapWindowRect(LPRECT lpRect) +{ + POINT UpLeft={0,0}; + RECT RetRect; + RECT ClientRect; + if (!(*pGetClientRect)(hWnd, &ClientRect)){ + OutTraceE("GetClientRect ERROR: err=%d hwnd=%x at %d\n", GetLastError(), hWnd, __LINE__); + } + if(lpRect){ + RetRect.left = lpRect->left * ClientRect.right / dwScreenWidth; + RetRect.right = lpRect->right * ClientRect.right / dwScreenWidth; + RetRect.top = lpRect->top * ClientRect.bottom / dwScreenHeight; + RetRect.bottom = lpRect->bottom * ClientRect.bottom / dwScreenHeight; + } + else { + RetRect=ClientRect; + } + if(!(*pClientToScreen)(hWnd, &UpLeft)){ + OutTraceE("ClientToScreen ERROR: err=%d hwnd=%x at %d\n", GetLastError(), hWnd, __LINE__); + } + if(!OffsetRect(&RetRect ,UpLeft.x, UpLeft.y)){ + OutTraceE("OffsetRect ERROR: err=%d hwnd=%x at %d\n", GetLastError(), hWnd, __LINE__); + } + return RetRect; +} + +void dxwCore::ScreenRefresh(void) +{ + // optimization: don't blit too often! + // 20mSec seems a good compromise. + #define DXWREFRESHINTERVAL 20 + + LPDIRECTDRAWSURFACE lpDDSPrim; + extern LPDIRECTDRAWSURFACE GetPrimarySurface(); + extern HRESULT WINAPI extBlt(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPDDBLTFX lpddbltfx); + + static int t = -1; + if (t == -1) + t = GetTickCount()-(DXWREFRESHINTERVAL+1); // V.2.1.69: trick - subtract + int tn = GetTickCount(); + + if (tn-t < DXWREFRESHINTERVAL) return; + + lpDDSPrim=GetPrimarySurface(); + // if too early .... + if (lpDDSPrim) + extBlt(lpDDSPrim, NULL, lpDDSPrim, NULL, 0, NULL); + + (*pInvalidateRect)(hWnd, NULL, FALSE); + t = tn; } \ No newline at end of file diff --git a/dll/dxwcore.hpp b/dll/dxwcore.hpp index 5ee1cf4..d7fbb27 100644 --- a/dll/dxwcore.hpp +++ b/dll/dxwcore.hpp @@ -1,7 +1,5 @@ #include -#define CLIP_TOLERANCE 4 - class dxwCore { // Construction/destruction @@ -10,15 +8,46 @@ public: virtual ~dxwCore(); // Operations -public: - void SethWnd(HWND); -public: +public: // methods + void SethWnd(HWND hwnd) {hWnd=hwnd;} + HWND GethWnd(void) {return hWnd;} + void SetScreenSize(void) {dwScreenWidth=800; dwScreenHeight=600;} + void SetScreenSize(int x, int y) {if(x)dwScreenWidth=x; if(y)dwScreenHeight=y;} + DWORD GetScreenWidth(void) {return dwScreenWidth;} + DWORD GetScreenHeight(void) {return dwScreenHeight;} + RECT GetScreenRect(void); + void SetFullScreen(BOOL fs) {FullScreen=fs;} + BOOL IsFullScreen() {return FullScreen;} POINT FixCursorPos(POINT); + POINT FixCursorPos(HWND, POINT); + void FixNCHITCursorPos(LPPOINT); + void SetClipCursor(void); + void EraseClipCursor(void); + RECT MapWindowRect(LPRECT lpRect); + RECT MapWindowRect(void); + void ScreenRefresh(void); + +public: // simple data variables + DDPIXELFORMAT ActualPixelFormat; + DDPIXELFORMAT VirtualPixelFormat; + DWORD dwPrimarySurfaceCaps; + DWORD dwBackBufferCount; + DWORD dwDDVersion; + DWORD dwMaxDDVersion; + DWORD dwFlags1; + DWORD dwFlags2; + DWORD dwTFlags; + HWND hParentWnd; + HWND hChildWnd; + BOOL bActive; + BOOL bDInputAbs; // Implementation protected: + DWORD dwScreenWidth; + DWORD dwScreenHeight; + BOOL FullScreen; HWND hWnd; - int dwScreenWidth; - int dwScreenHeight; - BOOL IsFullScreen; }; + +extern dxwCore dxw; diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp index f3c6714..23a87da 100644 --- a/dll/dxwnd.cpp +++ b/dll/dxwnd.cpp @@ -23,7 +23,7 @@ along with this program. If not, see . #include #include "dxwnd.h" -#define VERSION "2.01.100" +#define VERSION "2.02.00" LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam); diff --git a/dll/dxwnd.ws2008.sln b/dll/dxwnd.ws2008.sln new file mode 100644 index 0000000..d2888f1 --- /dev/null +++ b/dll/dxwnd.ws2008.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwnd", "dxwnd.ws2008.vcproj", "{579E7FE7-2745-4100-A802-23511711FCDE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.ActiveCfg = Debug|Win32 + {579E7FE7-2745-4100-A802-23511711FCDE}.Debug|Win32.Build.0 = Debug|Win32 + {579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.ActiveCfg = Release|Win32 + {579E7FE7-2745-4100-A802-23511711FCDE}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/dll/dxwnd.ws2008.suo b/dll/dxwnd.ws2008.suo new file mode 100644 index 0000000..9261157 Binary files /dev/null and b/dll/dxwnd.ws2008.suo differ diff --git a/dll/dxwnd.ws2008.vcproj b/dll/dxwnd.ws2008.vcproj index be0ccb4..2a1b7ce 100644 --- a/dll/dxwnd.ws2008.vcproj +++ b/dll/dxwnd.ws2008.vcproj @@ -244,6 +244,10 @@ /> + + @@ -357,6 +361,10 @@ RelativePath="dxhook.h" > + + diff --git a/dll/glhook.cpp b/dll/glhook.cpp index 79923c2..03e7268 100644 --- a/dll/glhook.cpp +++ b/dll/glhook.cpp @@ -1,4 +1,5 @@ #include "dxwnd.h" +#include "dxwcore.hpp" #include "syslibs.h" #include "dxhook.h" #include "glhook.h" @@ -14,14 +15,14 @@ extern short iPosX, iPosY, iSizX, iSizY; void WINAPI extglViewport(GLint x, GLint y, GLsizei width, GLsizei height) { RECT client; - (*pGetClientRect)(hWnd, &client); + (*pGetClientRect)(dxw.GethWnd(), &client); OutTraceD("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, VirtualScr.dwWidth, VirtualScr.dwHeight); - x = (x * (GLint)client.right) / (GLint)VirtualScr.dwWidth; - y = (y * (GLint)client.bottom) / (GLint)VirtualScr.dwHeight; - width = (width * (GLint)client.right) / (GLint)VirtualScr.dwWidth; - height = (height * (GLint)client.bottom) / (GLint)VirtualScr.dwHeight; + 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); (*pglViewport)(x, y, width, height); } @@ -29,12 +30,12 @@ void WINAPI extglViewport(GLint x, GLint y, GLsizei width, GLsizei height void WINAPI extglScissor(GLint x, GLint y, GLsizei width, GLsizei height) { RECT client; - (*pGetClientRect)(hWnd, &client); + (*pGetClientRect)(dxw.GethWnd(), &client); OutTraceD("glScissor: declared pos=(%d,%d) size=(%d,%d)\n", x, y, width, height); - x = (x * (GLint)client.right) / (GLint)VirtualScr.dwWidth; - y = (y * (GLint)client.bottom) / (GLint)VirtualScr.dwHeight; - width = (width * (GLint)client.right) / (GLint)VirtualScr.dwWidth; - height = (height * (GLint)client.bottom) / (GLint)VirtualScr.dwHeight; + 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); (*pglScissor)(x, y, width, height); } diff --git a/dll/hd3d.cpp b/dll/hd3d.cpp index 165ae4a..df684df 100644 --- a/dll/hd3d.cpp +++ b/dll/hd3d.cpp @@ -1,6 +1,7 @@ #include #include #include "dxwnd.h" +#include "dxwcore.hpp" typedef void* (WINAPI *Direct3DCreate8_Type)(UINT); typedef void* (WINAPI *Direct3DCreate9_Type)(UINT); @@ -18,9 +19,6 @@ HRESULT WINAPI extEnumAdapterModes9(void *, UINT, D3DFORMAT, UINT , D3DDISPLAYMO HRESULT WINAPI extGetAdapterDisplayMode(void *, UINT, D3DDISPLAYMODE *); HRESULT WINAPI extGetDisplayMode(void *, D3DDISPLAYMODE *); -extern HWND hWnd; -extern DWORD dwFlags; -extern BOOL bActive; extern char *ExplainDDError(DWORD); Direct3DCreate8_Type pDirect3DCreate8 = 0; @@ -115,7 +113,7 @@ HRESULT WINAPI extGetDisplayMode(void *lpd3d, D3DDISPLAYMODE *pMode) res=(*pGetDisplayMode)(lpd3d, pMode); OutTraceD("DEBUG: GetDisplayMode: size=(%dx%d) RefreshRate=%d Format=%d\n", pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format); - if(dwFlags2 & KEEPASPECTRATIO){ + if(dxw.dwFlags2 & KEEPASPECTRATIO){ pMode->Width=iSizX; pMode->Height=iSizY; OutTraceD("DEBUG: GetDisplayMode: fixed size=(%dx%d)\n", pMode->Width, pMode->Height); @@ -148,7 +146,7 @@ HRESULT WINAPI extGetAdapterDisplayMode(void *lpd3d, UINT Adapter, D3DDISPLAYMOD res=(*pGetAdapterDisplayMode)(lpd3d, Adapter, pMode); OutTraceD("DEBUG: GetAdapterDisplayMode: size=(%dx%d) RefreshRate=%d Format=%d\n", pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format); - if(dwFlags2 & KEEPASPECTRATIO){ + if(dxw.dwFlags2 & KEEPASPECTRATIO){ pMode->Width=iSizX; pMode->Height=iSizY; OutTraceD("DEBUG: GetDisplayMode: fixed size=(%dx%d)\n", pMode->Width, pMode->Height); @@ -163,7 +161,6 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, DWORD param[64], *tmp; D3DDISPLAYMODE mode; int Windowed; - extern BOOL isFullScreen; if(dwD3DVersion == 9){ memcpy(param, ppresentparam, 56); @@ -174,16 +171,9 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, OutTraceD("D3D8::CreateDevice\n"); } - hWnd = hfocuswindow; - VirtualScr.dwWidth = param[0]; - VirtualScr.dwHeight = param[1]; - // The Fellowship of the Ring: starts with 0,0 size, but this doesn't fully help - //if ((VirtualScr.dwWidth==0) && (VirtualScr.dwHeight==0)){ - // OutTraceD("CreateDevice: setting default size 800x600\n"); - // VirtualScr.dwWidth=800; - // VirtualScr.dwHeight=600; - //} - AdjustWindowFrame(hWnd, VirtualScr.dwWidth, VirtualScr.dwHeight); + dxw.SethWnd(hfocuswindow); + dxw.SetScreenSize(param[0], param[1]); + AdjustWindowFrame(dxw.GethWnd(), dxw.GetScreenWidth(), dxw.GetScreenHeight()); tmp = param; OutTraceD(" Adapter = %i\n", adapter); @@ -213,14 +203,14 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, if(dwD3DVersion == 9){ param[7] = 0; //hDeviceWindow - isFullScreen = ~param[8]?TRUE:FALSE; + dxw.SetFullScreen(~param[8]?TRUE:FALSE); param[8] = 1; //Windowed param[12] = 0; //FullScreen_RefreshRateInHz; param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval } else{ param[6] = 0; //hDeviceWindow - isFullScreen = ~param[7]?TRUE:FALSE; + dxw.SetFullScreen(~param[7]?TRUE:FALSE); param[7] = 1; //Windowed param[11] = 0; //FullScreen_RefreshRateInHz; param[12] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval @@ -246,11 +236,11 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype, SetHook((void *)(**(DWORD **)ppd3dd + 64), extReset, (void **)&pReset, "Reset(D9)"); } - DxWndStatus.IsFullScreen = isFullScreen; + DxWndStatus.IsFullScreen = dxw.IsFullScreen(); DxWndStatus.DXVersion=(short)dwD3DVersion; - DxWndStatus.Height=(short)VirtualScr.dwHeight; - DxWndStatus.Width=(short)VirtualScr.dwWidth; - DxWndStatus.ColorDepth=(short)VirtualScr.PixelFormat.dwRGBBitCount; + DxWndStatus.Height=(short)dxw.GetScreenHeight(); + DxWndStatus.Width=(short)dxw.GetScreenWidth(); + DxWndStatus.ColorDepth=(short)dxw.VirtualPixelFormat.dwRGBBitCount; SetHookStatus(&DxWndStatus); return 0; diff --git a/dll/hddproxy.cpp b/dll/hddproxy.cpp index 8dd2ac1..0875768 100644 --- a/dll/hddproxy.cpp +++ b/dll/hddproxy.cpp @@ -13,6 +13,7 @@ #include #include #include "dxwnd.h" +#include "dxwcore.hpp" #include "dxhook.h" #include "syslibs.h" #include "dxhelper.h" @@ -280,7 +281,7 @@ int HookDDProxy(int dxVersion) // LPDIRECTDRAW lpdd; // BOOL res; - dwFlags |= OUTDDRAWTRACE; + dxw.dwFlags1 |= OUTDDRAWTRACE; pCreateCompatibleDC=CreateCompatibleDC; pGDIGetDC=GetDC; @@ -1747,7 +1748,7 @@ static void HookDDSessionProxy(LPDIRECTDRAW *lplpdd, int dxVersion) HRESULT WINAPI extDirectDrawCreateProxy(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, IUnknown FAR *pu) { HRESULT res; - int dwDDVersion; + int DDVersion; OutTraceP("DirectDrawCreate: PROXED guid=%x(%s)\n", lpguid, ExplainGUID(lpguid)); @@ -1758,19 +1759,19 @@ HRESULT WINAPI extDirectDrawCreateProxy(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplp return res; } - dwDDVersion=1; + DDVersion=1; if (lpguid) switch (*(DWORD *)lpguid){ - case 0x6C14DB80: dwDDVersion=1; break; - case 0xB3A6F3E0: dwDDVersion=2; break; - case 0x9c59509a: dwDDVersion=4; break; - case 0x15e65ec0: dwDDVersion=7; break; + case 0x6C14DB80: DDVersion=1; break; + case 0xB3A6F3E0: DDVersion=2; break; + case 0x9c59509a: DDVersion=4; break; + case 0x15e65ec0: DDVersion=7; break; } OutTraceP("DirectDrawCreate: lpdd=%x guid=%x DDVersion=%d\n", - *lplpdd, (lpguid ? *(DWORD *)lpguid:0), dwDDVersion); + *lplpdd, (lpguid ? *(DWORD *)lpguid:0), DDVersion); #ifdef HOOKDDRAW - HookDDSessionProxy(lplpdd, dwDDVersion); + HookDDSessionProxy(lplpdd, DDVersion); #endif return 0; } @@ -1778,7 +1779,7 @@ HRESULT WINAPI extDirectDrawCreateProxy(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplp HRESULT WINAPI extDirectDrawCreateExProxy(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, REFIID RefIid, IUnknown FAR *pu) { HRESULT res; - int dwDDVersion; + int DDVersion; OutTraceP("DirectDrawCreateEx: PROXED guid=%x(%s) refiid=%x\n", lpguid, ExplainGUID(lpguid), RefIid); @@ -1789,19 +1790,19 @@ HRESULT WINAPI extDirectDrawCreateExProxy(GUID FAR *lpguid, LPDIRECTDRAW FAR *lp return res; } - dwDDVersion=1; + DDVersion=1; if (lpguid) switch (*(DWORD *)lpguid){ - case 0x6C14DB80: dwDDVersion=1; break; - case 0xB3A6F3E0: dwDDVersion=2; break; - case 0x9c59509a: dwDDVersion=4; break; - case 0x15e65ec0: dwDDVersion=7; break; + case 0x6C14DB80: DDVersion=1; break; + case 0xB3A6F3E0: DDVersion=2; break; + case 0x9c59509a: DDVersion=4; break; + case 0x15e65ec0: DDVersion=7; break; } OutTraceP("DirectDrawCreateEx: lpdd=%x guid=%x DDVersion=%d\n", - *lplpdd, (lpguid ? *(DWORD *)lpguid:0), dwDDVersion); + *lplpdd, (lpguid ? *(DWORD *)lpguid:0), DDVersion); #ifdef HOOKDDRAW - HookDDSessionProxy(lplpdd, dwDDVersion); + HookDDSessionProxy(lplpdd, DDVersion); #endif return 0; } @@ -1854,7 +1855,7 @@ HRESULT WINAPI extDirectDrawEnumerateExProxy(LPDDENUMCALLBACKEX lpCallback, LPVO { HRESULT ret; OutTraceP("DirectDrawEnumerateEx: PROXED lpCallback=%x lpContext=%x Flags=%x(%s)\n", - lpCallback, lpContext, dwFlags, ExplainDDEnumerateFlags(dwFlags)); + lpCallback, lpContext, dxw.dwFlags1, ExplainDDEnumerateFlags(dwFlags)); (*pDirectDrawEnumerateEx)(DDEnumerateCallbackEx, lpContext, dwFlags); ret=(*pDirectDrawEnumerateEx)(lpCallback, lpContext, dwFlags); if(ret) OutTraceP("DirectDrawEnumerateEx: ERROR res=%x(%s)\n", ret, ExplainDDError(ret)); diff --git a/dll/hddraw.cpp b/dll/hddraw.cpp index 3c42f0b..db9c7f8 100644 --- a/dll/hddraw.cpp +++ b/dll/hddraw.cpp @@ -6,15 +6,13 @@ #include #include #include "dxwnd.h" +#include "dxwcore.hpp" #include "stdio.h" #include "hddraw.h" #include "hddproxy.h" #include "dxhelper.h" #include "syslibs.h" -extern void DxWndSetClipCursor(); -extern void DxWndEraseClipCursor(); - // DirectDraw API HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *); HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFIID, IUnknown FAR *); @@ -96,16 +94,6 @@ HDC WINAPI extGDIGetDC(HWND); HDC WINAPI extGDIGetWindowDC(HWND); int WINAPI extGDIReleaseDC(HWND, HDC); -// to do: put some order in global variables..... -ScreenDef_Type ActualScr, VirtualScr; - -extern HWND hWnd; -DWORD dwDDVersion; -DWORD dwMaxDDVersion=7; -extern DWORD dwFlags; -extern DWORD dwFlags2; -extern BOOL bActive; - extern short iPosX, iPosY, iSizX, iSizY; /* ------ */ @@ -242,7 +230,6 @@ void *EmuScreenBuffer = NULL; // to implement pitch bug fix DWORD rPitch = 0; LPVOID rSurface = NULL; static char *SetPixFmt(LPDDSURFACEDESC2); -BOOL isFullScreen = 0; int FlipChainLength=0; /* ------------------------------------------------------------------------------ */ @@ -324,7 +311,7 @@ void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries) { int i; OutTraceD("mySetPalette DEBUG: BPP=%d GBitMask=%x count=%d\n", - ActualScr.PixelFormat.dwRGBBitCount, ActualScr.PixelFormat.dwGBitMask, dwcount); + dxw.ActualPixelFormat.dwRGBBitCount, dxw.ActualPixelFormat.dwGBitMask, dwcount); if(IsDebug){ int idx; @@ -336,7 +323,7 @@ void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries) OutTraceD("\n"); } - switch (ActualScr.PixelFormat.dwRGBBitCount){ + switch (dxw.ActualPixelFormat.dwRGBBitCount){ case 32: for(i = 0; i < dwcount; i ++){ PaletteEntries[i + dwstart] = @@ -345,14 +332,14 @@ void mySetPalette(int dwstart, int dwcount, LPPALETTEENTRY lpentries) break; case 16: for(i = 0; i < dwcount; i ++){ - PaletteEntries[i + dwstart] = (ActualScr.PixelFormat.dwGBitMask == 0x03E0) ? + PaletteEntries[i + dwstart] = (dxw.ActualPixelFormat.dwGBitMask == 0x03E0) ? (((DWORD)lpentries[i].peRed & 0xF8) << 8) + (((DWORD)lpentries[i].peGreen & 0xFC) << 3) + (((DWORD)lpentries[i].peBlue &0xF8) >> 3) : (((DWORD)lpentries[i].peRed & 0xF8) << 8) + (((DWORD)lpentries[i].peGreen & 0xF8) << 3) + (((DWORD)lpentries[i].peBlue &0xF8) >> 3); } break; default: - OutTraceD("ASSERT: unsupported Color BPP=%d\n", ActualScr.PixelFormat.dwRGBBitCount); + OutTraceD("ASSERT: unsupported Color BPP=%d\n", dxw.ActualPixelFormat.dwRGBBitCount); break; } @@ -378,7 +365,7 @@ void InitDDScreenParameters(LPDIRECTDRAW lpdd) ddsd.ddpfPixelFormat.dwBBitMask, ddsd.ddpfPixelFormat.dwRGBAlphaBitMask); - ActualScr.PixelFormat=ddsd.ddpfPixelFormat; + dxw.ActualPixelFormat=ddsd.ddpfPixelFormat; SetBltTransformations(); return; @@ -403,7 +390,7 @@ void InitDSScreenParameters(LPDIRECTDRAWSURFACE lpdds) p.dwBBitMask, p.dwRGBAlphaBitMask); - ActualScr.PixelFormat=p; + dxw.ActualPixelFormat=p; SetBltTransformations(); return; @@ -419,24 +406,23 @@ void InitScreenParameters() // set default VGA mode 800x600 // should I make it configurable ? (640x480, 800x600, 1024x768) - VirtualScr.dwWidth = 800; - VirtualScr.dwHeight = 600; - DxWndStatus.Height=(short)VirtualScr.dwHeight; - DxWndStatus.Width=(short)VirtualScr.dwWidth; + dxw.SetScreenSize(); // 800 x 600 by default + DxWndStatus.Height=(short)dxw.GetScreenHeight(); + DxWndStatus.Width=(short)dxw.GetScreenWidth(); DxWndStatus.ColorDepth=0; // unknown DxWndStatus.DXVersion=0; // unknown - DxWndStatus.isLogging=(dwTFlags & OUTTRACE); + DxWndStatus.isLogging=(dxw.dwTFlags & OUTTRACE); SetHookStatus(&DxWndStatus); if(!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &CurrDevMode)){ OutTraceE("EnumDisplaySettings: ERROR err=%d at %d\n", GetLastError(), __LINE__); return; } - memset(&ActualScr.PixelFormat, 0, sizeof(DDPIXELFORMAT)); + memset(&dxw.ActualPixelFormat, 0, sizeof(DDPIXELFORMAT)); // initialize to default null values, but dwRGBBitCount - ActualScr.PixelFormat.dwRGBBitCount=CurrDevMode.dmBitsPerPel; - VirtualScr.PixelFormat.dwRGBBitCount=CurrDevMode.dmBitsPerPel; // until set differently - //if(dwFlags2 & INIT8BPP) VirtualScr.PixelFormat.dwRGBBitCount = 8; + dxw.ActualPixelFormat.dwRGBBitCount=CurrDevMode.dmBitsPerPel; + dxw.VirtualPixelFormat.dwRGBBitCount=CurrDevMode.dmBitsPerPel; // until set differently + //if(dxw.dwFlags2 & INIT8BPP) dxw.VirtualPixelFormat.dwRGBBitCount = 8; OutTraceD("InitScreenParameters: RGBBitCount=%d\n", CurrDevMode.dmBitsPerPel); SetBltTransformations(); InitDCStack(); @@ -458,7 +444,7 @@ void FixPixelFormat(int ColorDepth, DDPIXELFORMAT *pf) break; case 16: pf->dwRGBBitCount = 16; - if (dwFlags & USERGB565){ + if (dxw.dwFlags1 & USERGB565){ pf->dwRBitMask = 0xf800; pf->dwGBitMask = 0x07e0; pf->dwBBitMask = 0x001f; @@ -753,29 +739,6 @@ int lpddHookedVersion(LPDIRECTDRAW lpdd) /* ------------------------------------------------------------------ */ -// optimization: don't blit too often! -// 20mSec seems a good compromise. -#define DXWREFRESHINTERVAL 20 - -void dx_ScreenRefresh() -{ - LPDIRECTDRAWSURFACE lpDDSPrim; - static int t = -1; - if (t == -1) - t = GetTickCount()-(DXWREFRESHINTERVAL+1); // V.2.1.69: trick - subtract - int tn = GetTickCount(); - - if (tn-t < DXWREFRESHINTERVAL) return; - - lpDDSPrim=GetPrimarySurface(); - // if too early .... - if (lpDDSPrim) - extBlt(lpDDSPrim, NULL, lpDDSPrim, NULL, 0, NULL); - - (*pInvalidateRect)(hWnd, NULL, FALSE); - t = tn; -} - void do_slow(int delay) { MSG uMsg; @@ -809,25 +772,25 @@ static void DumpPixFmt(LPDDSURFACEDESC2 lpdd) static char *SetPixFmt(LPDDSURFACEDESC2 lpdd) { char *pfstr; - OutTraceD("SetPixFmt: BPP=%d Use565=%d\n", VirtualScr.PixelFormat.dwRGBBitCount, dwFlags & USERGB565 ? 1:0); + OutTraceD("SetPixFmt: BPP=%d Use565=%d\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.dwFlags1 & USERGB565 ? 1:0); memset(&lpdd->ddpfPixelFormat,0,sizeof(DDPIXELFORMAT)); lpdd->ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - lpdd->ddpfPixelFormat.dwRGBBitCount = ActualScr.PixelFormat.dwRGBBitCount; - if(ActualScr.PixelFormat.dwRGBBitCount==VirtualScr.PixelFormat.dwRGBBitCount && ActualScr.PixelFormat.dwRBitMask){ + lpdd->ddpfPixelFormat.dwRGBBitCount = dxw.ActualPixelFormat.dwRGBBitCount; + if(dxw.ActualPixelFormat.dwRGBBitCount==dxw.VirtualPixelFormat.dwRGBBitCount && dxw.ActualPixelFormat.dwRBitMask){ // if same color depth, choose current color masks pfstr="CURRENT"; - lpdd->ddpfPixelFormat=ActualScr.PixelFormat; + lpdd->ddpfPixelFormat=dxw.ActualPixelFormat; } else { - switch (VirtualScr.PixelFormat.dwRGBBitCount) + switch (dxw.VirtualPixelFormat.dwRGBBitCount) { case 8: pfstr="RGB8"; FixPixelFormat(8, &lpdd->ddpfPixelFormat); break; case 16: - pfstr=(dwFlags & USERGB565)?"RGB16-565":"RGB16-555"; + pfstr=(dxw.dwFlags1 & USERGB565)?"RGB16-565":"RGB16-555"; FixPixelFormat(16, &lpdd->ddpfPixelFormat); break; case 24: @@ -840,13 +803,13 @@ static char *SetPixFmt(LPDDSURFACEDESC2 lpdd) break; default: pfstr="unsupported"; - OutTraceE("CreateSurface ERROR: Unsupported resolution ColorBPP=%d\n", VirtualScr.PixelFormat.dwRGBBitCount); + OutTraceE("CreateSurface ERROR: Unsupported resolution ColorBPP=%d\n", dxw.VirtualPixelFormat.dwRGBBitCount); break; } } // remember current virtual settings - VirtualScr.PixelFormat=lpdd->ddpfPixelFormat; + dxw.VirtualPixelFormat=lpdd->ddpfPixelFormat; OutTraceD("SetPixFmt: RGBBitCount=%d Flags=%x FourCC=%x RGBA BitMask=(%x,%x,%x,%x)\n", lpdd->ddpfPixelFormat.dwRGBBitCount, @@ -943,7 +906,7 @@ static void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion) if (dxversion >= 4) SetHook((void *)(**(DWORD **)lplpdd + 104), extTestCooperativeLevel, (void **)&pTestCooperativeLevel, "TestCooperativeLevel(D)"); - if (!(dwFlags & OUTPROXYTRACE)) return; + if (!(dxw.dwFlags1 & OUTPROXYTRACE)) return; // Just proxed ... // IDIrectDraw::AddRef @@ -989,7 +952,7 @@ static void HookDDClipper(LPDIRECTDRAWCLIPPER FAR* lplpDDClipper) // IDirectDrawClipper::Release SetHook((void *)(**(DWORD **)lplpDDClipper + 8), extReleaseC, (void **)&pReleaseC, "Release(C)"); - if (!(dwFlags & OUTPROXYTRACE)) return; + if (!(dxw.dwFlags1 & OUTPROXYTRACE)) return; // Just proxed ... // IDirectDrawClipper::QueryInterface @@ -1022,7 +985,7 @@ static void HookDDPalette(LPDIRECTDRAWPALETTE FAR* lplpDDPalette) // IDirectDrawPalette::SetEntries SetHook((void *)(**(DWORD **)lplpDDPalette + 24), extSetEntries, (void **)&pSetEntries, "SetEntries(P)"); - if (!(dwFlags & OUTPROXYTRACE)) return; + if (!(dxw.dwFlags1 & OUTPROXYTRACE)) return; // IDirectDrawPalette::QueryInterface SetHook((void *)(**(DWORD **)lplpDDPalette), extQueryInterfacePProxy, (void **)&pQueryInterfaceP, "QueryInterface(P)"); @@ -1114,7 +1077,7 @@ static void HookDDSurfacePrim(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) SetHook((void *)(**(DWORD **)lplpdds + 68), extGetDC, (void **)&pGetDC, "GetDC(S)"); // IDirectDrawSurface::ReleaseDC SetHook((void *)(**(DWORD **)lplpdds + 104), extReleaseDC, (void **)&pReleaseDC, "ReleaseDC(S)"); - if (dwFlags & (EMULATESURFACE|EMULATEBUFFER)){ + if (dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)){ // IDirectDrawSurface::Lock SetHook((void *)(**(DWORD **)lplpdds + 100), extLock, (void **)&pLock, "Lock(S)"); // IDirectDrawSurface::Unlock @@ -1124,7 +1087,7 @@ static void HookDDSurfacePrim(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) SetHook((void *)(**(DWORD **)lplpdds + 128), extUnlock4, (void **)&pUnlock4, "Unlock(S4)"); } - if (!(dwFlags & OUTPROXYTRACE)) return; + if (!(dxw.dwFlags1 & OUTPROXYTRACE)) return; // Just proxed ... @@ -1156,7 +1119,7 @@ static void HookDDSurfacePrim(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) SetHook((void *)(**(DWORD **)lplpdds + 136), extUpdateOverlayDisplayProxy, (void **)&pUpdateOverlayDisplay, "UpdateOverlayDisplay(S)"); // IDirectDrawSurface::UpdateOverlayZOrder SetHook((void *)(**(DWORD **)lplpdds + 140), extUpdateOverlayZOrderProxy, (void **)&pUpdateOverlayZOrder, "UpdateOverlayZOrder(S)"); - if (!(dwFlags & (EMULATESURFACE|EMULATEBUFFER))){ + if (!(dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER))){ // IDirectDrawSurface::Lock SetHook((void *)(**(DWORD **)lplpdds + 100), extLock, (void **)&pLock, "Lock(S)"); // IDirectDrawSurface::Unlock @@ -1210,7 +1173,7 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) // IDirectDrawSurface::ReleaseDC SetHook((void *)(**(DWORD **)lplpdds + 104), extReleaseDC, (void **)&pReleaseDC, "ReleaseDC(S)"); - if (!(dwFlags & OUTPROXYTRACE)) return; + if (!(dxw.dwFlags1 & OUTPROXYTRACE)) return; // just proxed .... @@ -1283,8 +1246,8 @@ static void RenewClipper(LPDIRECTDRAW lpdd, LPDIRECTDRAWSURFACE lpdds) res=lpdd->CreateClipper(0, &lpDDC, NULL); if(res) OutTraceE("CreateSurface: CreateClipper ERROR: lpdd=%x res=%x(%s) at %d\n", lpdd, res, ExplainDDError(res), __LINE__); //HookDDClipper(&lpDDC); - res=lpDDC->SetHWnd(0, hWnd); - if(res) OutTraceE("CreateSurface: SetHWnd ERROR: hWnd=%x res=%x(%s) at %d\n", hWnd, res, ExplainDDError(res), __LINE__); + res=lpDDC->SetHWnd(0, dxw.GethWnd()); + if(res) OutTraceE("CreateSurface: SetHWnd ERROR: hWnd=%x res=%x(%s) at %d\n", dxw.GethWnd(), res, ExplainDDError(res), __LINE__); res=lpdds->SetClipper(lpDDC); //res=(*pSetClipper)(lpdds, lpDDC); if(res) OutTraceE("CreateSurface: SetClipper ERROR: lpdds=%x res=%x(%s) at %d\n", lpdds, res, ExplainDDError(res), __LINE__); @@ -1344,7 +1307,7 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I return res; } - dwDDVersion=1; + dxw.dwDDVersion=1; char *mode; switch ((DWORD)lpguid){ case 0: mode="NULL"; break; @@ -1352,17 +1315,17 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I case DDCREATE_EMULATIONONLY: mode="DDCREATE_EMULATIONONLY"; break; default: switch (*(DWORD *)lpguid){ - case 0x6C14DB80: dwDDVersion=1; mode="IID_IDirectDraw"; break; - case 0xB3A6F3E0: dwDDVersion=2; mode="IID_IDirectDraw2"; break; - case 0x9c59509a: dwDDVersion=4; mode="IID_IDirectDraw4"; break; - case 0x15e65ec0: dwDDVersion=7; mode="IID_IDirectDraw7"; break; + case 0x6C14DB80: dxw.dwDDVersion=1; mode="IID_IDirectDraw"; break; + case 0xB3A6F3E0: dxw.dwDDVersion=2; mode="IID_IDirectDraw2"; break; + case 0x9c59509a: dxw.dwDDVersion=4; mode="IID_IDirectDraw4"; break; + case 0x15e65ec0: dxw.dwDDVersion=7; mode="IID_IDirectDraw7"; break; default: mode="unknown"; break; } break; } - OutTraceD("DirectDrawCreate: lpdd=%x guid=%s DDVersion=%d\n", *lplpdd, mode, dwDDVersion); + OutTraceD("DirectDrawCreate: lpdd=%x guid=%s DDVersion=%d\n", *lplpdd, mode, dxw.dwDDVersion); - HookDDSession(lplpdd, dwDDVersion); + HookDDSession(lplpdd, dxw.dwDDVersion); // added v2.1.44 lpDD = *lplpdd; @@ -1427,7 +1390,7 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid, return res; } - dwDDVersion=7; + dxw.dwDDVersion=7; char *mode; switch ((DWORD)lpguid){ case 0: mode="NULL"; break; @@ -1435,17 +1398,17 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid, case DDCREATE_EMULATIONONLY: mode="DDCREATE_EMULATIONONLY"; break; default: switch (*(DWORD *)lpguid){ - case 0x6C14DB80: dwDDVersion=1; mode="IID_IDirectDraw"; break; - case 0xB3A6F3E0: dwDDVersion=2; mode="IID_IDirectDraw2"; break; - case 0x9c59509a: dwDDVersion=4; mode="IID_IDirectDraw4"; break; - case 0x15e65ec0: dwDDVersion=7; mode="IID_IDirectDraw7"; break; + case 0x6C14DB80: dxw.dwDDVersion=1; mode="IID_IDirectDraw"; break; + case 0xB3A6F3E0: dxw.dwDDVersion=2; mode="IID_IDirectDraw2"; break; + case 0x9c59509a: dxw.dwDDVersion=4; mode="IID_IDirectDraw4"; break; + case 0x15e65ec0: dxw.dwDDVersion=7; mode="IID_IDirectDraw7"; break; default: mode="unknown"; break; } break; } - OutTraceD("DirectDrawCreateEx: lpdd=%x guid=%s DDVersion=%d\n", *lplpdd, mode, dwDDVersion); + OutTraceD("DirectDrawCreateEx: lpdd=%x guid=%s DDVersion=%d\n", *lplpdd, mode, dxw.dwDDVersion); - HookDDSession(lplpdd,dwDDVersion); + HookDDSession(lplpdd,dxw.dwDDVersion); // added v2.1.44 lpDD = *lplpdd; @@ -1484,7 +1447,7 @@ HRESULT WINAPI extQueryInterfaceD(void *lpdd, REFIID riid, LPVOID *obp) return(0); } - if (dwLocalDDVersion > dwMaxDDVersion) { + if (dwLocalDDVersion > dxw.dwMaxDDVersion) { *obp = NULL; OutTraceD("QueryInterface(D): lpdd=%x REFIID=%x obp=(NULL) ret=%x at %d\n", lpdd, riid.Data1, res, __LINE__); @@ -1497,14 +1460,14 @@ HRESULT WINAPI extQueryInterfaceD(void *lpdd, REFIID riid, LPVOID *obp) case 4: // it's not supposed to be written for DDVersion==7, but it works .... case 7: - dwDDVersion=dwLocalDDVersion; - HookDDSession((LPDIRECTDRAW *)obp, dwDDVersion); + dxw.dwDDVersion=dwLocalDDVersion; + HookDDSession((LPDIRECTDRAW *)obp, dxw.dwDDVersion); break; } OutTraceD("QueryInterface(D): lpdd=%x REFIID=%x obp=%x DDVersion=%d ret=0\n", - lpdd, riid.Data1, *obp, dwDDVersion); + lpdd, riid.Data1, *obp, dxw.dwDDVersion); return 0; } @@ -1536,7 +1499,7 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) break; } - if (dwLocalDDVersion > dwMaxDDVersion) { + if (dwLocalDDVersion > dxw.dwMaxDDVersion) { *obp = NULL; OutTraceD("QueryInterface(S): DDVersion=%d SUPPRESSED lpdds=%x(%s) REFIID=%x obp=(NULL) ret=0 at %d\n", dwLocalDDVersion, lpdds, IsPrim?"":"(PRIM)", riid.Data1, __LINE__); @@ -1568,16 +1531,16 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) case 4: case 7: - dwDDVersion=dwLocalDDVersion; + dxw.dwDDVersion=dwLocalDDVersion; if(IsPrim){ OutTraceD("QueryInterface(S): primary=%x new=%x\n", lpdds, *obp); MarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp); - HookDDSurfacePrim((LPDIRECTDRAWSURFACE *)obp, dwDDVersion); + HookDDSurfacePrim((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion); } else{ UnmarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp); - HookDDSurfaceGeneric((LPDIRECTDRAWSURFACE *)obp, dwDDVersion); + HookDDSurfaceGeneric((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion); } break; @@ -1601,22 +1564,21 @@ HRESULT WINAPI extSetDisplayMode(int version, LPDIRECTDRAW lpdd, OutTrace("\n"); } - if (dwwidth) VirtualScr.dwWidth = dwwidth; - if (dwheight) VirtualScr.dwHeight = dwheight; - DxWndStatus.Height=(short)VirtualScr.dwHeight; - DxWndStatus.Width=(short)VirtualScr.dwWidth; + dxw.SetScreenSize(dwwidth, dwheight); + DxWndStatus.Height=(short)dxw.GetScreenHeight(); + DxWndStatus.Width=(short)dxw.GetScreenWidth(); SetHookStatus(&DxWndStatus); - AdjustWindowFrame(hWnd, dwwidth, dwheight); + AdjustWindowFrame(dxw.GethWnd(), dwwidth, dwheight); - if(dwFlags & EMULATESURFACE){ - VirtualScr.PixelFormat.dwRGBBitCount = dwbpp; - dwbpp = ActualScr.PixelFormat.dwRGBBitCount; + if(dxw.dwFlags1 & EMULATESURFACE){ + dxw.VirtualPixelFormat.dwRGBBitCount = dwbpp; + dwbpp = dxw.ActualPixelFormat.dwRGBBitCount; SetBltTransformations(); - OutTraceD("SetDisplayMode: mode=EMULATESURFACE EmuBPP=%d ActBPP=%d\n", VirtualScr.PixelFormat.dwRGBBitCount, ActualScr.PixelFormat.dwRGBBitCount); + OutTraceD("SetDisplayMode: mode=EMULATESURFACE EmuBPP=%d ActBPP=%d\n", dxw.VirtualPixelFormat.dwRGBBitCount, dxw.ActualPixelFormat.dwRGBBitCount); } else { OutTraceD("SetDisplayMode: mode=STANDARD BPP=%d\n", dwbpp); - ActualScr.PixelFormat.dwRGBBitCount = dwbpp; + dxw.ActualPixelFormat.dwRGBBitCount = dwbpp; } ZeroMemory(&ddsd, sizeof(ddsd)); @@ -1655,14 +1617,14 @@ HRESULT WINAPI extGetDisplayMode(LPDIRECTDRAW lpdd, LPDDSURFACEDESC lpddsd) OutTraceD("GetDisplayMode\n"); (*pGetDisplayMode)(lpdd, lpddsd); - if(dwFlags & EMULATESURFACE) SetPixFmt((LPDDSURFACEDESC2)lpddsd); - lpddsd->dwWidth = VirtualScr.dwWidth; - lpddsd->dwHeight = VirtualScr.dwHeight; + if(dxw.dwFlags1 & EMULATESURFACE) SetPixFmt((LPDDSURFACEDESC2)lpddsd); + lpddsd->dwWidth = dxw.GetScreenWidth(); + lpddsd->dwHeight = dxw.GetScreenHeight(); // v2.1.96: fake screen color depth - if(dwFlags2 & INIT8BPP|INIT16BPP){ - if(dwFlags2 & INIT8BPP) FixPixelFormat(8, &lpddsd->ddpfPixelFormat); - if(dwFlags2 & INIT16BPP) FixPixelFormat(16, &lpddsd->ddpfPixelFormat); + if(dxw.dwFlags2 & INIT8BPP|INIT16BPP){ + 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); } @@ -1723,28 +1685,27 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags) // v2.1.82 fix: hDesktop=(*pGetDesktopWindow)(); if ((hwnd==0) || (hwnd==hDesktop)) { - extern HWND hParentWnd; - OutTraceD("SetCooperativeLevel: detected desktop hwnd=%x redirected to %x\n", hwnd, hWnd); - hwnd=hWnd; + OutTraceD("SetCooperativeLevel: detected desktop hwnd=%x redirected to %x\n", hwnd, dxw.GethWnd()); + hwnd=dxw.GethWnd(); // this fixes the blocks on "Tomb Raider IV" !!!! - if(dwFlags & FIXPARENTWIN) hwnd=hParentWnd; + if(dxw.dwFlags1 & FIXPARENTWIN) hwnd=dxw.hParentWnd; } if (dwflags & DDSCL_FULLSCREEN){ - isFullScreen=1; + dxw.SetFullScreen(TRUE); res=(*pSetCooperativeLevel)(lpdd, hwnd, DDSCL_NORMAL); - AdjustWindowFrame(hwnd, VirtualScr.dwWidth, VirtualScr.dwHeight); + AdjustWindowFrame(hwnd, dxw.GetScreenWidth(), dxw.GetScreenHeight()); //FixWindowFrame(hwnd); //-- incompatible with Microsoft Madness - if (dwFlags & FIXWINFRAME) FixWindowFrame(hwnd); + if (dxw.dwFlags1 & FIXWINFRAME) FixWindowFrame(hwnd); } else{ - isFullScreen=0; + dxw.SetFullScreen(FALSE); res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); } if(res) OutTraceE("SetCooperativeLevel: ERROR err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); - DxWndStatus.IsFullScreen=isFullScreen; + DxWndStatus.IsFullScreen=dxw.IsFullScreen(); SetHookStatus(&DxWndStatus); // WARN: GP500 was setting cooperative level against the desktop! This can be partially @@ -1756,10 +1717,10 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags) OutTraceE("SetCooperativeLevel: attempt to work on desktop window\n"); } else - hWnd=hwnd; // save the good one + dxw.SethWnd(hwnd); // save the good one } - DxWndStatus.IsFullScreen=isFullScreen; + DxWndStatus.IsFullScreen=dxw.IsFullScreen(); SetHookStatus(&DxWndStatus); return res; @@ -1788,15 +1749,15 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf ddsd.dwSize = CurSize; if(ddsd.dwFlags & DDSD_CAPS && ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE){ - DxWndStatus.Height=(short)VirtualScr.dwHeight; - DxWndStatus.Width=(short)VirtualScr.dwWidth; - DxWndStatus.ColorDepth=(short)VirtualScr.PixelFormat.dwRGBBitCount; + DxWndStatus.Height=(short)dxw.GetScreenHeight(); + DxWndStatus.Width=(short)dxw.GetScreenWidth(); + DxWndStatus.ColorDepth=(short)dxw.VirtualPixelFormat.dwRGBBitCount; DxWndStatus.DXVersion=dxversion; SetHookStatus(&DxWndStatus); lpServiceDD = lpdd; // v2.1.87 - VirtualScr.dwPrimarySurfaceCaps = ddsd.ddsCaps.dwCaps; - VirtualScr.dwBackBufferCount = (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) ? ddsd.dwBackBufferCount : 0; + dxw.dwPrimarySurfaceCaps = ddsd.ddsCaps.dwCaps; + dxw.dwBackBufferCount = (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) ? ddsd.dwBackBufferCount : 0; // beware of the different behaviour between older and newer directdraw releases... if(dxversion >= 4){ @@ -1822,7 +1783,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf OutTraceD(sMsg); if (IsAssertEnabled) MessageBox(0, sMsg, "CreateSurface", MB_OK | MB_ICONEXCLAMATION); // recover ... - VirtualScr.dwBackBufferCount =MAXBACKBUFFERS; + dxw.dwBackBufferCount =MAXBACKBUFFERS; BBCount = MAXBACKBUFFERS; } @@ -1833,8 +1794,8 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf if (lpddsd->dwFlags & DDSD_CKDESTOVERLAY) ddsd.dwFlags|=DDSD_CKDESTOVERLAY; if (lpddsd->dwFlags & DDSD_CKSRCBLT) ddsd.dwFlags|=DDSD_CKSRCBLT; if (lpddsd->dwFlags & DDSD_CKSRCOVERLAY) ddsd.dwFlags|=DDSD_CKSRCOVERLAY; - ddsd.dwWidth = VirtualScr.dwWidth; - ddsd.dwHeight = VirtualScr.dwHeight; + ddsd.dwWidth = dxw.GetScreenWidth(); + ddsd.dwHeight = dxw.GetScreenHeight(); pfmt=SetPixFmt(&ddsd); CurFlags=ddsd.dwFlags; @@ -1846,8 +1807,6 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf if(res==DDERR_INVALIDPIXELFORMAT) DumpPixFmt(&ddsd); return res; } - //ActualScr.dwPrimarySurfaceCaps=lplpdds->ddsCaps.dwCaps; - //ActualScr.dwBackBufferCount =lplpdds->ddsCaps.dwBackBufferCount; lpDDSPrim = *lplpdds; OutTraceD("CreateSurface: created PRIMARY DDSPrim=%x\n", lpDDSPrim); MarkPrimarySurface(*lplpdds); @@ -1859,8 +1818,8 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf ddsd.dwSize = CurSize; ddsd.dwFlags = CurFlags; ddsd.ddsCaps.dwCaps=DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; - ddsd.dwWidth = VirtualScr.dwWidth; - ddsd.dwHeight = VirtualScr.dwHeight; + ddsd.dwWidth = dxw.GetScreenWidth(); + ddsd.dwHeight = dxw.GetScreenHeight(); pfmt=SetPixFmt(&ddsd); //ddsd.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER; DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Backbuf]" , __LINE__); @@ -1911,7 +1870,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf UnmarkPrimarySurface(lpDDSEmu_Prim); // can't hook lpDDSEmu_Prim as generic, since the Flip method is unimplemented for a PRIMARY surface! // better avoid it or hook just useful methods. - //if (dwFlags & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Prim, dwDDVersion); + //if (dxw.dwFlags1 & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Prim, dxw.dwDDVersion); // rebuild emulated primary backbuffer surface @@ -1920,8 +1879,8 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf ddsd.dwSize = CurSize; ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd.dwWidth = VirtualScr.dwWidth; - ddsd.dwHeight = VirtualScr.dwHeight; + ddsd.dwWidth = dxw.GetScreenWidth(); + ddsd.dwHeight = dxw.GetScreenHeight(); //pfmt=SetPixFmt(&ddsd); DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[EmuBack]" , __LINE__); @@ -1935,14 +1894,14 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf } UnmarkPrimarySurface(lpDDSEmu_Back); - if (dwFlags & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Back, dxversion); + if (dxw.dwFlags1 & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Back, dxversion); OutTraceD("CreateSurface: created DDSEmu_Prim=%x DDSEmu_Back=%x DDSPrim=%x DDSBack=%x\n", lpDDSEmu_Prim, lpDDSEmu_Back, lpDDSPrim, lpDDSBack); // creation of lpDDSHDC service surfae moved to GetDC method - if(dwFlags & CLIPCURSOR) DxWndSetClipCursor(); + if(dxw.dwFlags1 & CLIPCURSOR) dxw.SetClipCursor(); return 0; } @@ -1970,7 +1929,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf if(res){ // v2.1.81: retry on system memory may fix not only the DDERR_OUTOFVIDEOMEMORY // error, but the DDERR_INVALIDPIXELFORMAT (see "The Sims ???") - if ((dwFlags & SWITCHVIDEOMEMORY) && + if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && ((res==DDERR_OUTOFVIDEOMEMORY) || (res==DDERR_INVALIDPIXELFORMAT))){ OutTraceD("CreateSurface: CreateSurface ERROR err=%x(%s) at %d, retry in SYSTEMMEMORY\n", res, ExplainDDError(res), __LINE__); @@ -2010,13 +1969,13 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf ddsd.dwSize = dwSize; if(ddsd.dwFlags & DDSD_CAPS && ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE){ - DxWndStatus.Height=(short)VirtualScr.dwHeight; - DxWndStatus.Width=(short)VirtualScr.dwWidth; - DxWndStatus.ColorDepth=(short)VirtualScr.PixelFormat.dwRGBBitCount; + DxWndStatus.Height=(short)dxw.GetScreenHeight(); + DxWndStatus.Width=(short)dxw.GetScreenWidth(); + DxWndStatus.ColorDepth=(short)dxw.VirtualPixelFormat.dwRGBBitCount; DxWndStatus.DXVersion=dxversion; SetHookStatus(&DxWndStatus); - VirtualScr.dwPrimarySurfaceCaps = ddsd.ddsCaps.dwCaps; - VirtualScr.dwBackBufferCount = (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) ? ddsd.dwBackBufferCount : 0; + dxw.dwPrimarySurfaceCaps = ddsd.ddsCaps.dwCaps; + dxw.dwBackBufferCount = (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) ? ddsd.dwBackBufferCount : 0; lpServiceDD = lpdd; // v2.1.87 // clean up service objects @@ -2046,7 +2005,7 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf OutTraceD("CreateSurface: BackBufferCount=%d\n", BBCount); } - if((dwFlags & EMULATEBUFFER) && lpDDSEmu_Prim){ + if((dxw.dwFlags1 & EMULATEBUFFER) && lpDDSEmu_Prim){ __try { while(lpDDSEmu_Prim && lpDDSEmu_Prim->Release()); } __except(EXCEPTION_EXECUTE_HANDLER){ OutTraceD("Release(lpDDSEmu_Prim): exception caught at %d\n", __LINE__); @@ -2060,7 +2019,7 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir Primary]" , __LINE__); res = (*pCreateSurface)(lpdd, &ddsd, &lpDDSPrim, pu); if(res){ - if ((dwFlags & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){ + if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){ OutTraceD("CreateSurface: CreateSurface DDERR_OUTOFVIDEOMEMORY ERROR at %d, retry in SYSTEMMEMORY\n", __LINE__); ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; // try ... ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; // try ... @@ -2073,7 +2032,7 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf } } - if(dwFlags & EMULATEBUFFER){ + if(dxw.dwFlags1 & EMULATEBUFFER){ lpDDSEmu_Prim = lpDDSPrim; UnmarkPrimarySurface(lpDDSEmu_Prim); OutTraceD("CreateSurface: created PRIMARY DDSPrim=%x flags=%x(%s) caps=%x(%s)\n", @@ -2082,8 +2041,8 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; // warning: can't create zero sized backbuffer surface !!!! - ddsd.dwWidth = VirtualScr.dwWidth; - ddsd.dwHeight = VirtualScr.dwHeight; + ddsd.dwWidth = dxw.GetScreenWidth(); + ddsd.dwHeight = dxw.GetScreenHeight(); ddsd.ddsCaps.dwCaps = 0; if (dxversion >= 4) ddsd.ddsCaps.dwCaps |= DDSCAPS_OFFSCREENPLAIN; DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir FixBuf]" , __LINE__); @@ -2114,9 +2073,9 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf ddsd.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; // warning: can't create zero sized backbuffer surface !!!! - ddsd.dwWidth = VirtualScr.dwWidth; - ddsd.dwHeight = VirtualScr.dwHeight; - if (dwFlags2 & BACKBUFATTACH) { + ddsd.dwWidth = dxw.GetScreenWidth(); + ddsd.dwHeight = dxw.GetScreenHeight(); + if (dxw.dwFlags2 & BACKBUFATTACH) { DDSURFACEDESC2 prim; prim.dwSize = dwSize; res=lpDDSPrim->GetSurfaceDesc((DDSURFACEDESC *)&prim); @@ -2131,7 +2090,7 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf DumpSurfaceAttributes((LPDDSURFACEDESC)&ddsd, "[Dir Backbuf]" , __LINE__); res=(*pCreateSurface)(lpdd, &ddsd, &lpDDSBack, pu); if(res) { - if ((dwFlags & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){ + if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){ OutTraceD("CreateSurface: CreateSurface DDERR_OUTOFVIDEOMEMORY ERROR at %d, retry in SYSTEMMEMORY\n", __LINE__); ddsd.ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; // try ... ddsd.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; // try ... @@ -2155,13 +2114,12 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf // Should this hold for EMULATED mode as well? Maybe, but Diablo crashes.... lpDDSBack->AddRef(); - if(dwFlags & CLIPCURSOR) DxWndSetClipCursor(); + if(dxw.dwFlags1 & CLIPCURSOR) dxw.SetClipCursor(); return 0; } //BACKBUFATTACH: needed for Syberia - extern DWORD dwFlags2; - if ((dwFlags2 & BACKBUFATTACH) && (lpddsd->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)){ + if ((dxw.dwFlags2 & BACKBUFATTACH) && (lpddsd->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)){ DDSURFACEDESC2 backbuf; backbuf.dwSize = dwSize; res=lpDDSBack->GetSurfaceDesc((DDSURFACEDESC *)&backbuf); @@ -2172,7 +2130,7 @@ HRESULT WINAPI extCreateSurfaceDir(int dxversion, CreateSurface_Type pCreateSurf DumpSurfaceAttributes((LPDDSURFACEDESC)lpddsd, "[Dir Generic]" , __LINE__); res = (*pCreateSurface)(lpdd, lpddsd, lplpdds, 0); if(res){ - if ((dwFlags & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){ + if ((dxw.dwFlags1 & SWITCHVIDEOMEMORY) && (res==DDERR_OUTOFVIDEOMEMORY)){ OutTraceD("CreateSurface ERROR: res=%x(%s) at %d, retry\n", res, ExplainDDError(res), __LINE__); lpddsd->ddsCaps.dwCaps &= ~DDSCAPS_VIDEOMEMORY; lpddsd->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY; @@ -2222,7 +2180,7 @@ HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreateSurface //GHO: beware: incomplete trace line - must be line terminated below! if(IsTraceD){ OutTrace("CreateSurface: Version=%d lpdd=%x Flags=%x(%s)", dxversion, lpdd, lpddsd->dwFlags, ExplainFlags(lpddsd->dwFlags)); - if (lpddsd->dwFlags & DDSD_CAPS && lpddsd->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) OutTrace(" VirtualScreen=(%d,%d)", VirtualScr.dwWidth, VirtualScr.dwHeight); + if (lpddsd->dwFlags & DDSD_CAPS && lpddsd->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) OutTrace(" VirtualScreen=(%d,%d)", dxw.GetScreenWidth(), dxw.GetScreenHeight()); if (lpddsd->dwFlags & DDSD_BACKBUFFERCOUNT) OutTrace(" BackBufferCount=%d", lpddsd->dwBackBufferCount); if (lpddsd->dwFlags & DDSD_WIDTH) OutTrace(" Width=%d", lpddsd->dwWidth); if (lpddsd->dwFlags & DDSD_HEIGHT) OutTrace(" Height=%d", lpddsd->dwHeight); @@ -2243,7 +2201,7 @@ HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreateSurface lpDD = lpdd; - if (dwFlags & EMULATESURFACE) + if (dxw.dwFlags1 & EMULATESURFACE) res= extCreateSurfaceEmu(dxversion, pCreateSurface, lpdd, lpddsd, lplpdds, pu); else res= extCreateSurfaceDir(dxversion, pCreateSurface, lpdd, lpddsd, lplpdds, pu); @@ -2270,7 +2228,7 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet // beware: "Snowboard Racer" fails if you return an attached surface anyhow! There, // the primary surface was created with back buffer count == 1. - if ((lpdds == lpDDSBack) && (VirtualScr.dwBackBufferCount > 1)){ + if ((lpdds == lpDDSBack) && (dxw.dwBackBufferCount > 1)){ *lplpddas = lpDDSBack; OutTraceD("GetAttachedSurface(%d): DOUBLEBUFFER attached=%x\n", dxversion, *lplpddas); return 0; @@ -2347,31 +2305,6 @@ static void BlitError(HRESULT res, LPRECT lps, LPRECT lpd, int line) return; } -#if 0 -// to be implemented and replaced into Blt coordinate transformation logic - -static LPRECT RectScreenToClient(LPRECT lprect) -{ - // to be implemented .... -} - -static LPRECT RectClientToScreen(LPRECT lprect) -{ - // to be implemented .... - - POINT p; - p.x = p.y = 0; - if(!(*pClientToScreen)(hWnd, &p)){ - OutTraceE("ClientToScreen ERROR %d hwnd=%x\n", GetLastError(), hWnd); - return 0; - } - if(!OffsetRect(lprect ,p.x, p.y)){ - OutTraceE("OffsetRect ERROR %d hwnd=%x\n", GetLastError(), hWnd); - return 0; - } -} -#endif - HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPDDBLTFX lpddbltfx, BOOL isFlipping) { @@ -2383,8 +2316,8 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, ToPrim=IsAPrimarySurface(lpdds); FromPrim=IsAPrimarySurface(lpddssrc); - ToScreen=ToPrim && !(dwFlags & EMULATESURFACE); - FromScreen=FromPrim && !(dwFlags & EMULATESURFACE); + ToScreen=ToPrim && !(dxw.dwFlags1 & EMULATESURFACE); + FromScreen=FromPrim && !(dxw.dwFlags1 & EMULATESURFACE); CleanRect(&lpdestrect,__LINE__); CleanRect(&lpsrcrect,__LINE__); @@ -2415,21 +2348,21 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, if (ONEPIXELFIXFlag){ if (lpdestrect){ - if (lpdestrect->bottom == VirtualScr.dwHeight -1) lpdestrect->bottom = VirtualScr.dwHeight; - if (lpdestrect->right == VirtualScr.dwWidth -1) lpdestrect->right = VirtualScr.dwWidth; + if (lpdestrect->bottom == dxw.GetScreenHeight() -1) lpdestrect->bottom = dxw.GetScreenHeight(); + if (lpdestrect->right == dxw.GetScreenWidth() -1) lpdestrect->right = dxw.GetScreenWidth(); } } if(FIXBIGGERRECT){ if(ToPrim && lpdestrect){ - if((DWORD)lpdestrect->bottom > VirtualScr.dwHeight) lpdestrect->bottom = VirtualScr.dwHeight; - if((DWORD)lpdestrect->right > VirtualScr.dwWidth) lpdestrect->right = VirtualScr.dwWidth; + if((DWORD)lpdestrect->bottom > dxw.GetScreenHeight()) lpdestrect->bottom = dxw.GetScreenHeight(); + if((DWORD)lpdestrect->right > dxw.GetScreenWidth()) lpdestrect->right = dxw.GetScreenWidth(); } } - if((dwFlags & EMULATESURFACE) && (dwflags==DDBLT_COLORFILL)){ + if((dxw.dwFlags1 & EMULATESURFACE) && (dwflags==DDBLT_COLORFILL)){ OutTraceD("Debug: dwFillDepth=%d, EmuBPP=%d, dwFillColor=%x\n", - lpddbltfx->dwFillDepth, VirtualScr.PixelFormat.dwRGBBitCount, lpddbltfx->dwFillColor); + lpddbltfx->dwFillDepth, dxw.VirtualPixelFormat.dwRGBBitCount, lpddbltfx->dwFillColor); //lpddbltfx->dwFillDepth=VirtualScr.dwRGBBitCount; } @@ -2460,7 +2393,8 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, // blit to non primary surface if(!ToPrim){ - RECT srcrect, winrect; + //RECT srcrect, winrect; + RECT srcrect; // make a working copy of srcrect if not NULL if (lpsrcrect){ srcrect=*lpsrcrect; @@ -2472,29 +2406,12 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, // is fixed no matter how the window/primary surface is scaled. // In "The Sims" there is no quality loss, but some scrolling artifact. if(lpsrcrect && FromScreen){ - if(lpDDSBack && (dwFlags & BLITFROMBACKBUFFER)){ + if(lpDDSBack && (dxw.dwFlags1 & BLITFROMBACKBUFFER)){ lpddssrc=lpDDSBack; - srcrect.left = 0; - srcrect.right = VirtualScr.dwWidth; - srcrect.top = 0; - srcrect.bottom = VirtualScr.dwHeight; + srcrect=dxw.GetScreenRect(); } else{ - POINT p; - p.x = p.y = 0; - (*pGetClientRect)(hWnd, &winrect); - srcrect.left = (srcrect.left * winrect.right) / VirtualScr.dwWidth; - srcrect.right = (srcrect.right * winrect.right) / VirtualScr.dwWidth; - srcrect.top = (srcrect.top * winrect.bottom) / VirtualScr.dwHeight; - srcrect.bottom = (srcrect.bottom * winrect.bottom) / VirtualScr.dwHeight; - if(!(*pClientToScreen)(hWnd, &p)){ - OutTraceE("%s: ClientToScreen ERROR %d hwnd=%x\n", api, GetLastError(), hWnd); - return 0; - } - if(!OffsetRect(&srcrect ,p.x, p.y)){ - OutTraceE("%s: OffsetRect ERROR %d hwnd=%x\n", api, GetLastError(), hWnd); - return 0; - } + srcrect=dxw.MapWindowRect(lpsrcrect); } } res= (*pBlt)(lpdds, lpdestrect, lpddssrc, lpsrcrect ? &srcrect : NULL, dwflags, lpddbltfx); @@ -2502,7 +2419,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, // trying blitting directly to lpDDSEmu_Prim: it makes DK2 intro movies working. switch(res){ case DDERR_UNSUPPORTED: - if (dwFlags & EMULATESURFACE){ + if (dxw.dwFlags1 & EMULATESURFACE){ res=(*pBlt)(lpDDSEmu_Prim, lpdestrect, lpddssrc, lpsrcrect ? &srcrect : NULL, dwflags, lpddbltfx); } break; @@ -2515,40 +2432,17 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, break; } if (res) BlitError(res, &srcrect, lpdestrect, __LINE__); - if(dwFlags & SUPPRESSDXERRORS) res=0; + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0; return res; } // Blit to primary surface - if(lpdestrect) { - // surface relative coordinates - need scaling & relocation - (*pGetClientRect)(hWnd, &destrect); - destrect.left = lpdestrect->left * destrect.right / VirtualScr.dwWidth; - destrect.right = lpdestrect->right * destrect.right / VirtualScr.dwWidth; - destrect.top = lpdestrect->top * destrect.bottom / VirtualScr.dwHeight; - destrect.bottom = lpdestrect->bottom * destrect.bottom / VirtualScr.dwHeight; - (*pClientToScreen)(hWnd, &p); - OffsetRect(&destrect ,p.x, p.y); - } - else { - if (!(*pGetClientRect)(hWnd, &destrect)){ - OutTraceE("%s: GetClientRect ERROR %d hwnd=%x\n", api, GetLastError(), hWnd); - return 0; - } - if(!(*pClientToScreen)(hWnd, &p)){ - OutTraceE("%s: ClientToScreen ERROR %d hwnd=%x\n", api, GetLastError(), hWnd); - return 0; - } - if(!OffsetRect(&destrect ,p.x, p.y)){ - OutTraceE("%s: OffsetRect ERROR %d hwnd=%x\n", api, GetLastError(), hWnd); - return 0; - } - } + destrect=dxw.MapWindowRect(lpdestrect); - if(!(dwFlags & (EMULATESURFACE|EMULATEBUFFER))){ + if(!(dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER))){ res=0; - // blit only when source and dest surface are different. Should make dx_ScreenRefresh faster. + // blit only when source and dest surface are different. Should make ScreenRefresh faster. if (lpdds != lpddssrc) { //OutTrace("DEBUG: lpdds=%x lpddssrc=%x destrect=(%d,%d)-(%d,%d) lpsrcrect=%x flags=%x lpddbltfx=%x\n", // lpdds, lpddssrc, destrect.left, destrect.top, destrect.right, destrect.bottom, lpsrcrect, dwflags, lpddbltfx); @@ -2563,7 +2457,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, if (res) BlitError(res, lpsrcrect, &destrect, __LINE__); } - if(dwFlags & SUPPRESSDXERRORS) res=0; + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0; } return res; @@ -2587,12 +2481,12 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, // emurect: emulated rect is full surface (dwWidth x dwHeight) emurect.left = 0; emurect.top = 0; - emurect.right = VirtualScr.dwWidth; - emurect.bottom = VirtualScr.dwHeight; + emurect.right = dxw.GetScreenWidth(); + emurect.bottom = dxw.GetScreenHeight(); } res=0; - // blit only when source and dest surface are different. Should make dx_ScreenRefresh faster. + // blit only when source and dest surface are different. Should make ScreenRefresh faster. if (lpdds != lpddssrc) res=(*pBlt)(lpdds, &emurect, lpddssrc, lpsrcrect, dwflags, lpddbltfx); @@ -2616,13 +2510,13 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, if (res) BlitError(res, lpsrcrect, &destrect, __LINE__); } - if(dwFlags & SUPPRESSDXERRORS) res=0; + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0; return res; } LPDIRECTDRAWSURFACE lpDDSSource; - if(dwFlags & EMULATESURFACE){ + if(dxw.dwFlags1 & EMULATESURFACE){ res=(*pEmuBlt)(lpDDSEmu_Back, &emurect, lpdds, &emurect, DDBLT_WAIT, 0); if(res==DDERR_SURFACEBUSY){ (*pUnlockMethod(lpdds))(lpdds, NULL); @@ -2630,7 +2524,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, res=(*pEmuBlt)(lpDDSEmu_Back, &emurect, lpdds, &emurect, DDBLT_WAIT, 0); } if(res) { - if(dwFlags & SUPPRESSDXERRORS) res=0; + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0; return res; } lpDDSSource = lpDDSEmu_Back; @@ -2646,7 +2540,7 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, } if (res) BlitError(res, &emurect, &destrect, __LINE__); - if(dwFlags & SUPPRESSDXERRORS) res=0; + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0; return res; } @@ -2698,18 +2592,18 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc, // so you have to replace it with Blt operations. //lpdds->GetDDInterface(lpDD); from IDirectDrawSurface2 only - if((dwflags & DDFLIP_WAIT) || (dwFlags & SAVELOAD)) lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKEND , 0); + if((dwflags & DDFLIP_WAIT) || (dxw.dwFlags1 & SAVELOAD)) lpDD->WaitForVerticalBlank(DDWAITVB_BLOCKEND , 0); if(lpddssrc){ //res=lpdds->Blt(0, lpddssrc, 0, DDBLT_WAIT, 0); res=sBlt("Flip", lpdds, NULL, lpddssrc, NULL, DDBLT_WAIT, 0, TRUE); } else{ - if (dwFlags2 & BACKBUFATTACH){ + if (dxw.dwFlags2 & BACKBUFATTACH){ RECT NullArea; NullArea.left=NullArea.top=0; - NullArea.bottom=VirtualScr.dwHeight; - NullArea.right=VirtualScr.dwWidth; + NullArea.bottom=dxw.GetScreenHeight(); + NullArea.right=dxw.GetScreenWidth(); res=sBlt("Flip", lpdds, NULL, lpDDSBack, &NullArea, DDBLT_WAIT, 0, TRUE); } else @@ -2799,7 +2693,7 @@ HRESULT WINAPI extCreatePalette(LPDIRECTDRAW lpdd, DWORD dwflags, LPPALETTEENTRY OutTraceD("CreatePalette: dwFlags=%x(%s)\n", dwflags, ExplainCreatePaletteFlags(dwflags)); - if(!(dwFlags & EMULATESURFACE)){ + if(!(dxw.dwFlags1 & EMULATESURFACE)){ res = (*pCreatePalette)(lpdd, dwflags, lpddpa, lplpddp, pu); if (res) { OutTraceD("CreatePalette: res=%x(%s)\n", res, ExplainDDError(res)); @@ -2831,7 +2725,7 @@ HRESULT WINAPI extWaitForVerticalBlank(LPDIRECTDRAW lpdd, DWORD dwflags, HANDLE static DWORD time = 0; static BOOL step = 0; DWORD tmp; - if(!(dwFlags & SAVELOAD)) return (*pWaitForVerticalBlank)(lpdd, dwflags, hevent); + if(!(dxw.dwFlags1 & SAVELOAD)) return (*pWaitForVerticalBlank)(lpdd, dwflags, hevent); tmp = GetTickCount(); if((time - tmp) > 32) time = tmp; Sleep(time - tmp); @@ -2850,7 +2744,7 @@ HRESULT WINAPI extGetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE *lpl OutTraceD("GetPalette: lpdds=%x\n", lpdds); // if NO-EMU mode, just proxy the call - if(!(dwFlags & EMULATESURFACE)){ + if(!(dxw.dwFlags1 & EMULATESURFACE)){ res=(*pGetPalette)(lpdds, lplpddp); if (res) OutTraceE("GetPalette: ERROR res=%x(%s)\n", res, ExplainDDError(res)); return 0; @@ -2878,7 +2772,7 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd isPrim=IsAPrimarySurface(lpdds); OutTraceD("SetPalette: lpdds=%x%s lpddp=%x\n", lpdds, isPrim?"(PRIM)":"", lpddp); - if(!(dwFlags & EMULATESURFACE) || !isPrim) { + if(!(dxw.dwFlags1 & EMULATESURFACE) || !isPrim) { res=(*pSetPalette)(lpdds, lpddp); if(res)OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); return res; @@ -2913,7 +2807,7 @@ HRESULT WINAPI extSetEntries(LPDIRECTDRAWPALETTE lpddp, DWORD dwflags, DWORD dws res = (*pSetEntries)(lpddp, dwflags, dwstart, dwcount, lpentries); if(res) OutTraceE("SetEntries: ERROR res=%x(%s)\n", res, ExplainDDError(res)); - if(!(dwFlags & EMULATESURFACE) || lpDDP != lpddp) + if(!(dxw.dwFlags1 & EMULATESURFACE) || lpDDP != lpddp) return res; if ((dwstart + dwcount > 256) || (dwstart<0)){ @@ -2926,7 +2820,7 @@ HRESULT WINAPI extSetEntries(LPDIRECTDRAWPALETTE lpddp, DWORD dwflags, DWORD dws // GHO: needed for fixed rect and variable palette animations, // e.g. dungeon keeper loading screen - if (dwFlags & EMULATESURFACE) dx_ScreenRefresh(); + if (dxw.dwFlags1 & EMULATESURFACE) dxw.ScreenRefresh(); return 0; } @@ -2940,15 +2834,15 @@ HRESULT WINAPI extSetClipper(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWCLIPPER lpdd // v2.1.84: SUPPRESSCLIPPING flag - improves "Monopoly Edition 3D" where continuous // clipping ON & OFF affects blitting on primary surface. - if(dwFlags & SUPPRESSCLIPPING) return 0; + if(dxw.dwFlags1 & SUPPRESSCLIPPING) return 0; - if(isPrim && (dwFlags & (EMULATESURFACE|EMULATEBUFFER)) && lpDDSEmu_Prim){ + if(isPrim && (dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)) && lpDDSEmu_Prim){ res=(*pSetClipper)(lpDDSEmu_Prim, lpddc); if(res) OutTraceE("CreateSurface: SetClipper ERROR: res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); lpDDC = lpddc; // n.b. SetHWnd was not wrapped, so pSetHWnd is not usable (NULL) !!! - if(lpDDC) res=lpDDC->SetHWnd( 0, hWnd); - //res=(*pSetHWnd)(lpDDC, 0, hWnd); + if(lpDDC) res=lpDDC->SetHWnd( 0, dxw.GethWnd()); + //res=(*pSetHWnd)(lpDDC, 0, dxw.GethWnd()); if(res) OutTraceE("CreateSurface: SetHWnd ERROR: res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); //res = 0; } @@ -2984,7 +2878,7 @@ HRESULT WINAPI extLock(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAWSUR } if(res) OutTraceE("Lock ERROR: ret=%x(%s)\n", res, ExplainDDError(res)); DumpSurfaceAttributes((LPDDSURFACEDESC)lpdds2, "[Locked]" , __LINE__); - if(dwFlags & SUPPRESSDXERRORS) res=DD_OK; + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=DD_OK; // shouldn't happen.... if hooked to non primary surface, just call regular method. // it happens in "Deadlock 2" backbuffer surface!!! @@ -2994,7 +2888,6 @@ HRESULT WINAPI extLock(LPDIRECTDRAWSURFACE lpdds, LPRECT lprect, LPDIRECTDRAWSUR HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFACE lpdds, LPRECT lprect) { HRESULT res; - POINT p = {0, 0}; RECT screen, rect; BOOL IsPrim; @@ -3015,19 +2908,19 @@ HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFAC OutTrace("lpvoid=%x\n", lprect); } - if(dwFlags & SLOWDOWN) do_slow(2); + if(dxw.dwFlags1 & SLOWDOWN) do_slow(2); if (!IsPrim){ res=(*pUnlock)(lpdds, lprect); if (res) OutTraceE("Unlock ERROR res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__); - if(dwFlags & SUPPRESSDXERRORS) res=0; + if(dxw.dwFlags1 & SUPPRESSDXERRORS) res=0; return res; } res=(*pUnlock)(lpdds, lprect); if (res) OutTraceE("Unlock ERROR res=%x(%s) at %d\n",res, ExplainDDError(res), __LINE__); - if (dwFlags & (EMULATESURFACE|EMULATEBUFFER)){ + if (dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)){ DDSURFACEDESC2 ddsd; LPDIRECTDRAWSURFACE lpDDSSource; @@ -3042,12 +2935,9 @@ HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFAC rect.bottom=ddsd.dwHeight; rect.right=ddsd.dwWidth; - p.x = 0; p.y = 0; - (*pGetClientRect)(hWnd, &screen); - (*pClientToScreen)(hWnd, &p); - OffsetRect(&screen, p.x, p.y); + screen=dxw.MapWindowRect(); - if(dwFlags & EMULATESURFACE){ + if(dxw.dwFlags1 & EMULATESURFACE){ (*pEmuBlt)(lpDDSEmu_Back, &rect, lpdds, &rect, DDBLT_WAIT, ddsd.lpSurface); lpDDSSource=lpDDSEmu_Back; } @@ -3099,7 +2989,7 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC) // Should the surface have a RGB color setting to allow for DC creation? // log an error just when not intercepted by EMULATESURFACE|HANDLEDC handling below - if ((dwFlags & (EMULATESURFACE|HANDLEDC))!=(EMULATESURFACE|HANDLEDC)) + if ((dxw.dwFlags1 & (EMULATESURFACE|HANDLEDC))!=(EMULATESURFACE|HANDLEDC)) OutTraceE("GetDC ERROR: lpdss=%x%s, hdc=%x, res=%x(%s) at %d\n", lpdds, IsPrim?"(PRIM)":"", *pHDC, res, ExplainDDError(res), __LINE__); @@ -3118,8 +3008,8 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC) // tricky part to allog GDI to operate on top of a directdraw surface's HDI. // needed for Age of Empires I & II and some other oldies. // To Do: check that lpdds hdc doesn't stay locked! - if (res && (dwFlags & EMULATESURFACE)){ - if (dwFlags & HANDLEDC) { + if (res && (dxw.dwFlags1 & EMULATESURFACE)){ + if (dxw.dwFlags1 & HANDLEDC) { DDSURFACEDESC2 sd, hdcsd; LPDIRECTDRAWSURFACE lpddshdc; @@ -3134,7 +3024,7 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC) client.bottom=sd.dwHeight; // v2.1.90 fix: Warlords III can't handle very big service surfaces. Better skip. - if(sd.dwWidth>VirtualScr.dwWidth || sd.dwHeight>VirtualScr.dwHeight) return DDERR_CANTCREATEDC; + if(sd.dwWidth>dxw.GetScreenWidth() || sd.dwHeight>dxw.GetScreenHeight()) return DDERR_CANTCREATEDC; // create a service lpDDSHDC surface of the needed size.... @@ -3167,7 +3057,7 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC) PushDC(lpddshdc,*pHDC); } else { - *pHDC=(*pGDIGetDC)(hWnd); + *pHDC=(*pGDIGetDC)(dxw.GethWnd()); if(!*pHDC) { OutTraceE("GDI.GetDC ERROR: err=%d at %d\n", GetLastError(), __LINE__); res=DDERR_CANTCREATEDC; @@ -3196,8 +3086,8 @@ HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR hdc) if (res==DD_OK) return res; do { // fake loop to break out ... - if (dwFlags & EMULATESURFACE){ - if (dwFlags & HANDLEDC){ + if (dxw.dwFlags1 & EMULATESURFACE){ + if (dxw.dwFlags1 & HANDLEDC){ DDSURFACEDESC2 sd; LPDIRECTDRAWSURFACE lpddshdc; @@ -3239,7 +3129,7 @@ HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR hdc) (*pReleaseS)(lpddshdc); } else { - if((*pGDIReleaseDC)(hWnd,hdc)) res=DD_OK; + if((*pGDIReleaseDC)(dxw.GethWnd(),hdc)) res=DD_OK; else { OutTraceE("ReleaseDC: ReleaseDC ERROR err=%x at %d\n", GetLastError(), __LINE__); res=DDERR_INVALIDPARAMS; // maybe there's a better value.... @@ -3309,10 +3199,10 @@ HRESULT WINAPI myEnumModesFilter(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpConte { if (IsDebug) EnumModesCallbackDumper(lpDDSurfaceDesc, NULL); - if (dwFlags & PREVENTMAXIMIZE){ + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ // if PREVENTMAXIMIZE is set, don't let the caller know about forbidden screen settings. - if((lpDDSurfaceDesc->dwHeight > VirtualScr.dwHeight) || - (lpDDSurfaceDesc->dwWidth > VirtualScr.dwWidth)){ + if((lpDDSurfaceDesc->dwHeight > dxw.GetScreenHeight()) || + (lpDDSurfaceDesc->dwWidth > dxw.GetScreenWidth())){ OutTraceD("EnumDisplayModes: skipping screen size=(%d,%d)\n", lpDDSurfaceDesc->dwHeight, lpDDSurfaceDesc->dwWidth); return DDENUMRET_OK; } @@ -3343,7 +3233,7 @@ HRESULT WINAPI extEnumDisplayModes(EnumDisplayModes1_Type pEnumDisplayModes, LPD // they differ for the lpddsd argument that should point to either DDSURFACEDESC or DDSURFACEDESC2 // structures, but unification is possible if the lpddsd->dwSize is properly set and is left untouched. - if(dwFlags & EMULATESURFACE){ + if(dxw.dwFlags1 & EMULATESURFACE){ #if 0 struct {int w; int h;}SupportedRes[5]= {(320,240),(640,480),(800,600),(1024,1200),(0,0)}; int SupportedDepths[5]={8,16,24,32,0}; @@ -3371,7 +3261,7 @@ HRESULT WINAPI extEnumDisplayModes(EnumDisplayModes1_Type pEnumDisplayModes, LPD EmuDesc.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8; break; case 16: - if (dwFlags & USERGB565){ + if (dxw.dwFlags1 & USERGB565){ EmuDesc.ddpfPixelFormat.dwRBitMask = 0xf800; // Grim Fandango EmuDesc.ddpfPixelFormat.dwGBitMask = 0x07e0; EmuDesc.ddpfPixelFormat.dwBBitMask = 0x001f; @@ -3458,13 +3348,13 @@ HRESULT WINAPI extGetPixelFormat(LPDIRECTDRAWSURFACE lpdds, LPDDPIXELFORMAT p) p->dwRBitMask, p->dwGBitMask, p->dwBBitMask, p->dwRGBAlphaBitMask ); } - if ((dwFlags & EMULATESURFACE) && IsPrim){ - p->dwFlags = VirtualScr.PixelFormat.dwFlags; - p->dwRGBBitCount= VirtualScr.PixelFormat.dwRGBBitCount; - p->dwRBitMask = VirtualScr.PixelFormat.dwRBitMask; - p->dwGBitMask = VirtualScr.PixelFormat.dwGBitMask; - p->dwBBitMask = VirtualScr.PixelFormat.dwBBitMask; - p->dwRGBAlphaBitMask = VirtualScr.PixelFormat.dwRGBAlphaBitMask; + if ((dxw.dwFlags1 & EMULATESURFACE) && IsPrim){ + p->dwFlags = dxw.VirtualPixelFormat.dwFlags; + p->dwRGBBitCount= dxw.VirtualPixelFormat.dwRGBBitCount; + p->dwRBitMask = dxw.VirtualPixelFormat.dwRBitMask; + 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", p->dwRGBBitCount, p->dwRBitMask, p->dwGBitMask, p->dwBBitMask, p->dwRGBAlphaBitMask ); } @@ -3504,7 +3394,7 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds) OutTraceD("Release(S): lpdds=%x%s refcount=%d\n", lpdds, IsPrim?"(PRIM)":"", res); if (res==0) { // common precondition // when releasing primary surface, erase clipping region - if(IsPrim && (dwFlags & CLIPCURSOR)) DxWndEraseClipCursor(); + if(IsPrim && (dxw.dwFlags1 & CLIPCURSOR)) dxw.EraseClipCursor(); // if primary, clean primay surface list if(IsPrim) UnmarkPrimarySurface(lpdds); // service surfaces cleanup @@ -3512,7 +3402,7 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds) OutTraceD("Release(S): Clearing lpDDSBack pointer\n"); lpDDSBack=NULL; } - if (dwFlags & EMULATESURFACE) { + if (dxw.dwFlags1 & EMULATESURFACE) { if(lpdds==lpDDSEmu_Prim) { OutTraceD("Release(S): Clearing lpDDSEmu_Prim pointer\n"); lpDDSEmu_Prim=NULL; @@ -3637,14 +3527,14 @@ HRESULT WINAPI extAddAttachedSurface(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURF OutTraceD("AddAttachedSurface: GetSurfaceDesc dwCaps=%x(%s)\n", sd.ddsCaps.dwCaps, ExplainDDSCaps(sd.ddsCaps.dwCaps)); if (sd.ddsCaps.dwCaps & DDSCAPS_BACKBUFFER) - if ((dwFlags & EMULATESURFACE) && (res==DDERR_CANNOTATTACHSURFACE) || + if ((dxw.dwFlags1 & EMULATESURFACE) && (res==DDERR_CANNOTATTACHSURFACE) || (res==DDERR_NOEXCLUSIVEMODE)) OutTraceD("AddAttachedSurface: emulating surface attach on PRIMARY\n"); lpDDSBack=lpddsadd; res=0; } //// v2.1.73: Alien Cabal 95 in EMU mode - //if((lpdds==lpDDSBack) && (dwFlags & EMULATESURFACE)){ + //if((lpdds==lpDDSBack) && (dxw.dwFlags1 & EMULATESURFACE)){ // OutTraceD("AddAttachedSurface: ignoring err=%x(%s) on BACKBUFFER surface attach\n", res, ExplainDDError(res)); // res=DD_OK; //} @@ -3688,14 +3578,14 @@ HRESULT WINAPI extGetCapsS(int dxInterface, GetCapsS_Type pGetCapsS, LPDIRECTDRA else OutTraceD("GetCaps(S%d): lpdds=%x caps=%x(%s)\n", dxInterface, lpdds, caps->dwCaps, ExplainDDSCaps(caps->dwCaps)); - if (!(dwFlags & EMULATESURFACE)) return res; + if (!(dxw.dwFlags1 & EMULATESURFACE)) return res; // note: C&C95 Gold Edition includes a check for the primary surface NOT having // DDSCAPS_SYSTEMMEMORY bit set - if(IsPrim) caps->dwCaps = VirtualScr.dwPrimarySurfaceCaps; + if(IsPrim) caps->dwCaps = dxw.dwPrimarySurfaceCaps; // v2.1.83: add FLIP capability (Funtraks a.k.a. Ignition) - if((dwFlags & EMULATESURFACE) && (lpdds == lpDDSBack)) caps->dwCaps |= DDSCAPS_FLIP; + if((dxw.dwFlags1 & EMULATESURFACE) && (lpdds == lpDDSBack)) caps->dwCaps |= DDSCAPS_FLIP; OutTraceD("GetCaps(S%d): lpdds=%x FIXED caps=%x(%s)\n", dxInterface, lpdds, caps->dwCaps, ExplainDDSCaps(caps->dwCaps)); return res; @@ -3858,20 +3748,20 @@ HRESULT WINAPI extGetSurfaceDesc(GetSurfaceDesc_Type pGetSurfaceDesc, LPDIRECTDR if (IsPrim) { // expose original caps - if (dwFlags & EMULATESURFACE) { - lpddsd->ddpfPixelFormat = VirtualScr.PixelFormat; + if (dxw.dwFlags1 & EMULATESURFACE) { + lpddsd->ddpfPixelFormat = dxw.VirtualPixelFormat; } - //lpddsd->ddsCaps.dwCaps=VirtualScr.dwPrimarySurfaceCaps; + //lpddsd->ddsCaps.dwCaps=dxw.dwPrimarySurfaceCaps; // V2.1.84: better .OR. the capabilities (you don't ask but get for DDSCAPS_VISIBLE...) - lpddsd->ddsCaps.dwCaps |= VirtualScr.dwPrimarySurfaceCaps; + lpddsd->ddsCaps.dwCaps |= dxw.dwPrimarySurfaceCaps; lpddsd->ddsCaps.dwCaps |= DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_FRONTBUFFER; // you never know.... - lpddsd->dwBackBufferCount=VirtualScr.dwBackBufferCount; - lpddsd->dwHeight=VirtualScr.dwHeight; - lpddsd->dwWidth=VirtualScr.dwWidth; + lpddsd->dwBackBufferCount=dxw.dwBackBufferCount; + lpddsd->dwHeight=dxw.GetScreenHeight(); + lpddsd->dwWidth=dxw.GetScreenWidth(); //OutTraceD("GetSurfaceDesc: DEBUG restoring original caps=%x(%s) size=(%dx%d) BackBufferCount=%d\n", // lpddsd->ddsCaps.dwCaps, ExplainDDSCaps(lpddsd->ddsCaps.dwCaps), - // lpddsd->dwWidth=VirtualScr.dwWidth, lpddsd->dwHeight=VirtualScr.dwHeight, + // lpddsd->dwWidth=dxw.GetScreenWidth(), lpddsd->dwHeight=dxw.GetScreenHeight(), // lpddsd->dwBackBufferCount); DumpSurfaceAttributes(lpddsd, "GetSurfaceDesc FIXED", __LINE__); diff --git a/dll/hdinput.cpp b/dll/hdinput.cpp index 498c4c6..0df0472 100644 --- a/dll/hdinput.cpp +++ b/dll/hdinput.cpp @@ -1,6 +1,7 @@ #include #include #include "dxwnd.h" +#include "dxwcore.hpp" #include "syslibs.h" typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID, LPVOID *); @@ -26,12 +27,6 @@ HRESULT WINAPI extQueryInterfaceI(void *, REFIID, LPVOID *); void GetMousePosition(int *, int *); void InitPosition(int, int, int, int, int, int); -extern DWORD dwFlags; -extern BOOL bActive; -extern HWND hWnd; -extern DWORD dwWidth; -extern DWORD dwHeight; - DirectInputCreate_Type pDirectInputCreate = 0; DirectInputCreateEx_Type pDirectInputCreateEx = 0; DICreateDevice_Type pDICreateDevice = 0; @@ -42,8 +37,6 @@ DISetCooperativeLevel_Type pDISetCooperativeLevel; SetDataFormat_Type pSetDataFormat; QueryInterface_Type pQueryInterfaceI; -BOOL bDInputAbs = 0; - int iCursorX; int iCursorY; int iCursorXBuf; @@ -205,14 +198,14 @@ HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPVOID res = (*pGetDeviceData)(lpdid, cbdata, rgdod, pdwinout, dwflags); if(res) return res; - if(!bActive) *pdwinout = 0; + if(!dxw.bActive) *pdwinout = 0; GetMousePosition((int *)&p.x, (int *)&p.y); if(cbdata == 20 || cbdata == 24){ tmp = (BYTE *)rgdod; for(i = 0; i < *pdwinout; i ++){ if(((LPDIDEVICEOBJECTDATA)tmp)->dwOfs == DIMOFS_X){ ((LPDIDEVICEOBJECTDATA)tmp)->dwData = p.x; - if(!bDInputAbs){ + if(!dxw.bDInputAbs){ if(p.x < iCurMinX) p.x = iCurMinX; if(p.x > iCurMaxX) p.x = iCurMaxX; ((LPDIDEVICEOBJECTDATA)tmp)->dwData = p.x - iCursorXBuf; @@ -221,7 +214,7 @@ HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPVOID } if(((LPDIDEVICEOBJECTDATA)tmp)->dwOfs == DIMOFS_Y){ ((LPDIDEVICEOBJECTDATA)tmp)->dwData = p.y; - if(!bDInputAbs){ + if(!dxw.bDInputAbs){ if(p.y < iCurMinY) p.y = iCurMinY; if(p.y > iCurMaxY) p.y = iCurMaxY; ((LPDIDEVICEOBJECTDATA)tmp)->dwData = p.y - iCursorYBuf; @@ -240,7 +233,7 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO HRESULT res; POINT p = {0, 0}; - OutTraceD("GetDeviceState cbData:%i %i\n", cbdata, bActive); + OutTraceD("GetDeviceState cbData:%i %i\n", cbdata, dxw.bActive); res = (*pGetDeviceState)(lpdid, cbdata, lpvdata); if(res) return res; @@ -248,7 +241,7 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO GetMousePosition((int *)&p.x, (int *)&p.y); lpvdata->lX = p.x; lpvdata->lY = p.y; - if(!bDInputAbs){ + if(!dxw.bDInputAbs){ if(p.x < iCurMinX) p.x = iCurMinX; if(p.x > iCurMaxX) p.x = iCurMaxX; if(p.y < iCurMinY) p.y = iCurMinY; @@ -258,14 +251,14 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO iCursorX = p.x; iCursorY = p.y; } - if(!bActive){ + if(!dxw.bActive){ lpvdata->lZ = 0; *(DWORD *)lpvdata->rgbButtons = 0; } OutTraceD("DEBUG: directinput mousestate=(%d,%d)\n", p.x, p.y); } - if(cbdata == 256 && !bActive) ZeroMemory(lpvdata, 256); + if(cbdata == 256 && !dxw.bActive) ZeroMemory(lpvdata, 256); return 0; } @@ -273,8 +266,8 @@ HRESULT WINAPI extSetDataFormat(LPDIRECTINPUTDEVICE lpdid, LPCDIDATAFORMAT lpdf) { OutTraceD("SetDataFormat: flags = 0x%x\n", lpdf->dwFlags); - if(lpdf->dwFlags & DIDF_ABSAXIS) bDInputAbs = 1; - if(lpdf->dwFlags & DIDF_RELAXIS) bDInputAbs = 0; + if(lpdf->dwFlags & DIDF_ABSAXIS) dxw.bDInputAbs = 1; + if(lpdf->dwFlags & DIDF_RELAXIS) dxw.bDInputAbs = 0; return (*pSetDataFormat)(lpdid, lpdf); } diff --git a/dll/syslibs.cpp b/dll/syslibs.cpp index b65cdc0..5d3841b 100644 --- a/dll/syslibs.cpp +++ b/dll/syslibs.cpp @@ -5,6 +5,7 @@ #include #include #include "dxwnd.h" +#include "dxwcore.hpp" #include "dxhook.h" #include "glhook.h" #include "syslibs.h" @@ -21,7 +22,6 @@ extern DWORD PaletteEntries[256]; extern HDC PrimSurfaceHDC; extern LPDIRECTDRAWSURFACE lpDDSPrimHDC; extern LPDIRECTDRAW lpDD; -extern POINT FixCursorPos(HWND, POINT); extern Unlock4_Type pUnlockMethod(LPDIRECTDRAWSURFACE); extern GetDC_Type pGetDC; @@ -36,7 +36,6 @@ extern void do_slow(int); extern LPDIRECTDRAWSURFACE GetPrimarySurface(void); extern HRESULT WINAPI extBlt(LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT, DWORD, LPDDBLTFX); extern HRESULT WINAPI sBlt(char *, LPDIRECTDRAWSURFACE, LPRECT, LPDIRECTDRAWSURFACE, LPRECT, DWORD, LPDDBLTFX, BOOL); -extern BOOL isFullScreen; static SetLayeredWindowAttributes_Type pSetLayeredWindowAttributes = NULL; #ifndef WS_EX_LAYERED @@ -101,8 +100,8 @@ static POINT FixMessagePt(HWND hwnd, POINT point) if (curr.y < 0) curr.y=0; if (curr.x > rect.right) curr.x=rect.right; if (curr.y > rect.bottom) curr.y=rect.bottom; - if (rect.right) curr.x = (curr.x * VirtualScr.dwWidth) / rect.right; - if (rect.bottom) curr.y = (curr.y * VirtualScr.dwHeight) / rect.bottom; + if (rect.right) curr.x = (curr.x * dxw.GetScreenWidth()) / rect.right; + if (rect.bottom) curr.y = (curr.y * dxw.GetScreenHeight()) / rect.bottom; return curr; } @@ -123,12 +122,12 @@ static COLORREF GetMatchingColor(COLORREF crColor) iDistance=0; PalColor=PaletteEntries[iColorIndex]; - switch(ActualScr.PixelFormat.dwRGBBitCount){ + switch(dxw.ActualPixelFormat.dwRGBBitCount){ case 32: PalColor = ((PalColor & 0x00FF0000) >> 16) | (PalColor & 0x0000FF00) | ((PalColor & 0x000000FF) << 16); break; case 16: - if(ActualScr.PixelFormat.dwGBitMask==0x03E0){ + if(dxw.ActualPixelFormat.dwGBitMask==0x03E0){ // RGB555 screen settings PalColor = ((PalColor & 0x7C00) >> 7) | ((PalColor & 0x03E0) << 6) | ((PalColor & 0x001F) << 19); } @@ -167,12 +166,12 @@ static COLORREF GetMatchingColor(COLORREF crColor) OutTraceD("GetMatchingColor: color=%x matched with palette[%d]=%x dist=%d\n", crColor, iMinColorIndex, PaletteEntries[iMinColorIndex], iDistance); PalColor=PaletteEntries[iMinColorIndex]; - switch(ActualScr.PixelFormat.dwRGBBitCount){ + switch(dxw.ActualPixelFormat.dwRGBBitCount){ case 32: crColor = ((PalColor & 0x00FF0000) >> 16) | (PalColor & 0x0000FF00) | ((PalColor & 0x000000FF) << 16); break; case 16: - if(ActualScr.PixelFormat.dwGBitMask==0x03E0){ + if(dxw.ActualPixelFormat.dwGBitMask==0x03E0){ // RGB555 screen settings crColor = ((PalColor & 0x7C00) >> 7) | ((PalColor & 0x03E0) << 6) | ((PalColor & 0x001F) << 19); } @@ -205,15 +204,14 @@ HWND WINAPI extCreateWindowExA( HWND wndh; WNDPROC pWindowProc; BOOL isValidHandle=TRUE; - extern BOOL isFullScreen; OutTraceD("CreateWindowEx: class=\"%s\" wname=\"%s\" pos=(%d,%d) size=(%d,%d) Style=%x(%s) ExStyle=%x(%s)\n", lpClassName, lpWindowName, x, y, nWidth, nHeight, dwStyle, ExplainStyle(dwStyle), dwExStyle, ExplainExStyle(dwExStyle)); - if(IsDebug) OutTrace("CreateWindowEx: DEBUG screen=(%d,%d)\n", VirtualScr.dwWidth, VirtualScr.dwHeight); + if(IsDebug) OutTrace("CreateWindowEx: DEBUG screen=(%d,%d)\n", dxw.GetScreenWidth(), dxw.GetScreenHeight()); // no maximized windows in any case - if (dwFlags & PREVENTMAXIMIZE){ + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ OutTraceD("CreateWindowEx: handling PREVENTMAXIMIZE mode\n"); dwStyle &= ~(WS_MAXIMIZE | WS_POPUP); dwExStyle &= ~WS_EX_TOPMOST; @@ -230,20 +228,19 @@ HWND WINAPI extCreateWindowExA( ((x==0)&&(y==0)) || ((x==CW_USEDEFAULT)&&(y==CW_USEDEFAULT)) ) && - (((DWORD)nWidth>=VirtualScr.dwWidth)&&((DWORD)nHeight>=VirtualScr.dwHeight)) + (((DWORD)nWidth>=dxw.GetScreenWidth())&&((DWORD)nHeight>=dxw.GetScreenHeight())) ){ RECT screen; POINT upleft = {0,0}; // update virtual screen size if it has grown - VirtualScr.dwWidth=nWidth; - VirtualScr.dwHeight=nHeight; + dxw.SetScreenSize(nWidth, nHeight); // inserted some checks here, since the main window could be destroyed // or minimized (see "Jedi Outcast") so that you may get a dangerous // zero size. In this case, better renew the hWnd assignement and its coordinates. do { // fake loop isValidHandle = FALSE; - if (!(*pGetClientRect)(hWnd,&screen)) break; - if (!(*pClientToScreen)(hWnd,&upleft)) break; + if (!(*pGetClientRect)(dxw.GethWnd(),&screen)) break; + if (!(*pClientToScreen)(dxw.GethWnd(),&upleft)) break; if (screen.right==0 || screen.bottom==0) break; isValidHandle = TRUE; } while(FALSE); @@ -263,10 +260,10 @@ HWND WINAPI extCreateWindowExA( nHeight=iSizY; OutTraceD("CreateWindowEx: renewed BIG win pos=(%d,%d) size=(%d,%d)\n", x, y, nWidth, nHeight); } - isFullScreen = TRUE; + dxw.SetFullScreen(TRUE); } - if(!isFullScreen){ // v2.1.63: needed for "Monster Truck Madness" + if(!dxw.IsFullScreen()){ // v2.1.63: needed for "Monster Truck Madness" wndh= (*pCreateWindowExA)(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); OutTraceD("CreateWindowEx: windowed mode ret=%x\n", wndh); @@ -277,11 +274,11 @@ HWND WINAPI extCreateWindowExA( // Age of Empires.... if (dwStyle & WS_CHILD){ RECT screen; - (*pGetClientRect)(hWnd,&screen); - x=x*screen.right/VirtualScr.dwWidth; - y=y*screen.bottom/VirtualScr.dwHeight; - nWidth=nWidth*screen.right/VirtualScr.dwWidth; - nHeight=nHeight*screen.bottom/VirtualScr.dwHeight; + (*pGetClientRect)(dxw.GethWnd(),&screen); + x=x*screen.right/dxw.GetScreenWidth(); + y=y*screen.bottom/dxw.GetScreenHeight(); + nWidth=nWidth*screen.right/dxw.GetScreenWidth(); + nHeight=nHeight*screen.bottom/dxw.GetScreenHeight(); OutTraceD("CreateWindowEx: fixed WS_CHILD pos=(%d,%d) size=(%d,%d)\n", x, y, nWidth, nHeight); } @@ -290,8 +287,8 @@ HWND WINAPI extCreateWindowExA( else if (dwExStyle & WS_EX_CONTROLPARENT){ RECT screen; POINT upleft = {0,0}; - (*pGetClientRect)(hWnd,&screen); - (*pClientToScreen)(hWnd,&upleft); + (*pGetClientRect)(dxw.GethWnd(),&screen); + (*pClientToScreen)(dxw.GethWnd(),&upleft); x=upleft.x; y=upleft.y; nWidth=screen.right; @@ -312,18 +309,18 @@ HWND WINAPI extCreateWindowExA( return wndh; } - if ((!isValidHandle) && isFullScreen) { - hWnd = wndh; + if ((!isValidHandle) && dxw.IsFullScreen()) { + dxw.SethWnd(wndh); extern void AdjustWindowPos(HWND, DWORD, DWORD); - (*pSetWindowLong)(wndh, GWL_STYLE, (dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW); + (*pSetWindowLong)(wndh, GWL_STYLE, (dxw.dwFlags2 & MODALSTYLE) ? 0 : WS_OVERLAPPEDWINDOW); (*pSetWindowLong)(wndh, GWL_EXSTYLE, 0); //(*pShowWindow)(wndh, SW_SHOWNORMAL); - OutTraceD("CreateWindow: hWnd=%x, set style=WS_OVERLAPPEDWINDOW extstyle=0\n", wndh); + OutTraceD("CreateWindow: hwnd=%x, set style=WS_OVERLAPPEDWINDOW extstyle=0\n", wndh); AdjustWindowPos(wndh, nWidth, nHeight); (*pShowWindow)(wndh, SW_SHOWNORMAL); } - if ((dwFlags & FIXWINFRAME) && !(dwStyle & WS_CHILD)) + if ((dxw.dwFlags1 & FIXWINFRAME) && !(dwStyle & WS_CHILD)) FixWindowFrame(wndh); // to do: handle inner child, and leave dialogue & modal child alone!!! @@ -344,7 +341,7 @@ COLORREF WINAPI extSetTextColor(HDC hdc, COLORREF crColor) { COLORREF res; - if ((dwFlags & EMULATESURFACE) && (dwFlags & HANDLEDC) && (VirtualScr.PixelFormat.dwRGBBitCount==8)) + if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC) && (dxw.VirtualPixelFormat.dwRGBBitCount==8)) crColor=GetMatchingColor(crColor); res=(*pSetTextColor)(hdc, crColor); @@ -356,7 +353,7 @@ COLORREF WINAPI extSetBkColor(HDC hdc, COLORREF crColor) { COLORREF res; - if ((dwFlags & EMULATESURFACE) && (dwFlags & HANDLEDC) && (VirtualScr.PixelFormat.dwRGBBitCount==8)) + if ((dxw.dwFlags1 & EMULATESURFACE) && (dxw.dwFlags1 & HANDLEDC) && (dxw.VirtualPixelFormat.dwRGBBitCount==8)) crColor=GetMatchingColor(crColor); res=(*pSetBkColor)(hdc, crColor); @@ -385,7 +382,7 @@ BOOL WINAPI extClipCursor(RECT *lpRectArg) OutTrace("ClipCursor: rect=(NULL)\n"); } - if (!(dwFlags & ENABLECLIPPING)) return 1; + if (!(dxw.dwFlags1 & ENABLECLIPPING)) return 1; if(lpRectArg){ Rect=*lpRectArg; @@ -394,45 +391,16 @@ BOOL WINAPI extClipCursor(RECT *lpRectArg) else lpRect=NULL; - if(dwFlags & MODIFYMOUSE){ - RECT rect; - POINT corner; - RECT ClientArea; - - // beware: computations for RECT coordinates: the range is 1 pixel wider - // than accettable coordinates for cursor positions ??? - - // find window metrics - if (!(*pGetClientRect)(hWnd, &rect)){ - OutTraceE("GetClientRect ERROR %d at %d\n", GetLastError(), __LINE__); - return 0; - } - corner.x=corner.y=0; - if (!(*pClientToScreen)(hWnd, &corner)){ - OutTraceE("ClientToScreen ERROR %d at %d\n", GetLastError(), __LINE__); - return 0; - } + if(dxw.dwFlags1 & MODIFYMOUSE){ + // save desired clip region if (lpRect) { - // save desired clip region ClipRegion=*lpRectArg; lpClipRegion=&ClipRegion; - // need no scaling for upper left, since they're set to 0. - lpRect->left = corner.x + (lpRect->left * rect.right) / VirtualScr.dwWidth; - lpRect->right = corner.x + (lpRect->right * rect.right) / VirtualScr.dwWidth; - lpRect->top = corner.y + (lpRect->top * rect.bottom) / VirtualScr.dwHeight; - lpRect->bottom = corner.y + (lpRect->bottom * rect.bottom) / VirtualScr.dwHeight; } - else { - // NULL -> whole screen -> whole client area!!! - // save desired clip region + else lpClipRegion=NULL; - // map space for null ptr - lpRect=&ClientArea; - lpRect->left = corner.x; - lpRect->right = corner.x + rect.right; - lpRect->top = corner.y; - lpRect->bottom = corner.y + rect.bottom; - } + + *lpRect=dxw.MapWindowRect(lpRect); } if (pClipCursor) res=(*pClipCursor)(lpRect); @@ -449,7 +417,7 @@ BOOL WINAPI extGetClipCursor(LPRECT lpRect) BOOL ret; // proxy.... - if (!(dwFlags & ENABLECLIPPING)) { + if (!(dxw.dwFlags1 & ENABLECLIPPING)) { ret=(*pGetClipCursor)(lpRect); if(IsTraceD){ if (lpRect) @@ -466,8 +434,8 @@ BOOL WINAPI extGetClipCursor(LPRECT lpRect) *lpRect=ClipRegion; else{ lpRect->top = lpRect->left = 0; - lpRect->right = VirtualScr.dwWidth; - lpRect->bottom = VirtualScr.dwHeight; + lpRect->right = dxw.GetScreenWidth(); + lpRect->bottom = dxw.GetScreenHeight(); } OutTraceD("ClipCursor: rect=(%d,%d)-(%d,%d) ret=%d\n", lpRect->left,lpRect->top,lpRect->right,lpRect->bottom, TRUE); @@ -483,13 +451,7 @@ BOOL WINAPI extGetCursorPos(LPPOINT lppoint) HRESULT res; static int PrevX, PrevY; - if(dwFlags & SLOWDOWN) do_slow(2); - - //if(dwFlags2 & KEEPCURSORFIXED) { - // lppoint->x=LastCurPosX; - // lppoint->y=LastCurPosY; - // return 1; - //} + if(dxw.dwFlags1 & SLOWDOWN) do_slow(2); if (pGetCursorPos) { res=(*pGetCursorPos)(lppoint); @@ -499,14 +461,14 @@ BOOL WINAPI extGetCursorPos(LPPOINT lppoint) res=1; } - if(dwFlags2 & DIFFERENTIALMOUSE){ + if(dxw.dwFlags2 & DIFFERENTIALMOUSE){ int NewX, NewY; RECT client; POINT corner={0,0}; // get win placement - (*pGetClientRect)(hWnd, &client); - (*pClientToScreen)(hWnd, &corner); + (*pGetClientRect)(dxw.GethWnd(), &client); + (*pClientToScreen)(dxw.GethWnd(), &corner); NewX = lppoint->x - PrevX + LastCurPosX; NewY = lppoint->y - PrevY + LastCurPosY; // handle virtual clipping @@ -525,23 +487,22 @@ BOOL WINAPI extGetCursorPos(LPPOINT lppoint) return TRUE; } - PrevX=lppoint->x; PrevY=lppoint->y; - if(dwFlags & MODIFYMOUSE){ + if(dxw.dwFlags1 & MODIFYMOUSE){ RECT rect; // find window metrics - if (!(*pGetClientRect)(hWnd, &rect)){ - OutTraceE("GetClientRect(%x) ERROR %d at %d\n", hWnd, GetLastError(), __LINE__); + if (!(*pGetClientRect)(dxw.GethWnd(), &rect)){ + OutTraceE("GetClientRect(%x) ERROR %d at %d\n", dxw.GethWnd(), GetLastError(), __LINE__); lppoint->x =0; lppoint->y=0; return TRUE; } // convert absolute screen coordinates to frame relative - if (!(*pScreenToClient)(hWnd, lppoint)) { - OutTraceE("ScreenToClient(%x) ERROR %d at %d\n", hWnd, GetLastError(), __LINE__); + if (!(*pScreenToClient)(dxw.GethWnd(), lppoint)) { + OutTraceE("ScreenToClient(%x) ERROR %d at %d\n", dxw.GethWnd(), GetLastError(), __LINE__); lppoint->x =0; lppoint->y=0; return TRUE; } @@ -560,11 +521,11 @@ BOOL WINAPI extGetCursorPos(LPPOINT lppoint) if (lppoint->x > rect.right) lppoint->x=rect.right; if (lppoint->y > rect.bottom) lppoint->y=rect.bottom; - lppoint->x = (lppoint->x * VirtualScr.dwWidth) / rect.right; - lppoint->y = (lppoint->y * VirtualScr.dwHeight) / rect.bottom; + lppoint->x = (lppoint->x * dxw.GetScreenWidth()) / rect.right; + lppoint->y = (lppoint->y * dxw.GetScreenHeight()) / rect.bottom; OutTraceC("GetCursorPos: hwnd=%x res=%x XY=(%d,%d)->(%d,%d)\n", - hWnd, res, PrevX, PrevY, lppoint->x, lppoint->y); + dxw.GethWnd(), res, PrevX, PrevY, lppoint->x, lppoint->y); } return res; @@ -578,33 +539,33 @@ BOOL WINAPI extSetCursorPos(int x, int y) PrevX=x; PrevY=y; - if(dwFlags2 & KEEPCURSORFIXED) { + if(dxw.dwFlags2 & KEEPCURSORFIXED) { OutTraceC("SetCursorPos: FIXED pos=(%d,%d)\n", x, y); LastCurPosX=x; LastCurPosY=y; return 1; } - if(dwFlags & SLOWDOWN) do_slow(2); + if(dxw.dwFlags1 & SLOWDOWN) do_slow(2); - if(dwFlags & KEEPCURSORWITHIN){ + if(dxw.dwFlags1 & KEEPCURSORWITHIN){ // Intercept SetCursorPos outside screen boundaries (used as Cursor OFF in some games) - if ((y<0)||(y>=(int)VirtualScr.dwHeight)||(x<0)||(x>=(int)VirtualScr.dwWidth)) return 1; + if ((y<0)||(y>=(int)dxw.GetScreenHeight())||(x<0)||(x>=(int)dxw.GetScreenWidth())) return 1; } - if(dwFlags & MODIFYMOUSE){ + if(dxw.dwFlags1 & MODIFYMOUSE){ POINT cur; RECT rect; // find window metrics - if (!(*pGetClientRect)(hWnd, &rect)) { + if (!(*pGetClientRect)(dxw.GethWnd(), &rect)) { // report error and ignore ... - OutTraceE("GetClientRect(%x) ERROR %d at %d\n", hWnd, GetLastError(), __LINE__); + OutTraceE("GetClientRect(%x) ERROR %d at %d\n", dxw.GethWnd(), GetLastError(), __LINE__); return 0; } - x= x * rect.right / VirtualScr.dwWidth; - y= y * rect.bottom / VirtualScr.dwHeight; + x= x * rect.right / dxw.GetScreenWidth(); + y= y * rect.bottom / dxw.GetScreenHeight(); // check for boundaries (???) if (x >= rect.right) x=rect.right-1; @@ -615,8 +576,8 @@ BOOL WINAPI extSetCursorPos(int x, int y) // make it screen absolute cur.x = x; cur.y = y; - if (!(*pClientToScreen)(hWnd, &cur)) { - OutTraceE("ClientToScreen(%x) ERROR %d at %d\n", hWnd, GetLastError(), __LINE__); + if (!(*pClientToScreen)(dxw.GethWnd(), &cur)) { + OutTraceE("ClientToScreen(%x) ERROR %d at %d\n", dxw.GethWnd(), GetLastError(), __LINE__); return 0; } x = cur.x; @@ -633,11 +594,11 @@ BOOL WINAPI extSetCursorPos(int x, int y) BOOL WINAPI extTextOutA(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cchString) { OutTraceD("TextOut: hdc=%x xy=(%d,%d) str=(%d)\"%s\"\n", hdc, nXStart, nYStart, cchString, lpString); - if (dwFlags & FIXTEXTOUT) { + if (dxw.dwFlags1 & FIXTEXTOUT) { POINT anchor; anchor.x=nXStart; anchor.y=nYStart; - (*pClientToScreen)(hWnd, &anchor); + (*pClientToScreen)(dxw.GethWnd(), &anchor); nXStart=anchor.x; nYStart=anchor.y; } @@ -647,16 +608,16 @@ BOOL WINAPI extTextOutA(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int BOOL WINAPI extRectangle(HDC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) { OutTraceD("Rectangle: hdc=%x xy=(%d,%d)-(%d,%d)\n", hdc, nLeftRect, nTopRect, nRightRect, nBottomRect); - if (dwFlags & FIXTEXTOUT) { + if (dxw.dwFlags1 & FIXTEXTOUT) { POINT anchor; anchor.x=nLeftRect; anchor.y=nTopRect; - (*pClientToScreen)(hWnd, &anchor); + (*pClientToScreen)(dxw.GethWnd(), &anchor); nLeftRect=anchor.x; nTopRect=anchor.y; anchor.x=nRightRect; anchor.y=nBottomRect; - (*pClientToScreen)(hWnd, &anchor); + (*pClientToScreen)(dxw.GethWnd(), &anchor); nRightRect=anchor.x; nBottomRect=anchor.y; } @@ -668,16 +629,16 @@ int WINAPI extFillRect(HDC hdc, const RECT *lprc, HBRUSH hbr) RECT rc; OutTraceD("FillRect: hdc=%x xy=(%d,%d)-(%d,%d)\n", hdc, lprc->left, lprc->top, lprc->right, lprc->bottom); memcpy(&rc, lprc, sizeof(rc)); - if (dwFlags & FIXTEXTOUT) { + if (dxw.dwFlags1 & FIXTEXTOUT) { POINT anchor; anchor.x=rc.left; anchor.y=rc.top; - (*pClientToScreen)(hWnd, &anchor); + (*pClientToScreen)(dxw.GethWnd(), &anchor); rc.left=anchor.x; rc.top=anchor.y; anchor.x=rc.right; anchor.y=rc.bottom; - (*pClientToScreen)(hWnd, &anchor); + (*pClientToScreen)(dxw.GethWnd(), &anchor); rc.right=anchor.x; rc.bottom=anchor.y; } @@ -689,16 +650,16 @@ int WINAPI extDrawFocusRect(HDC hdc, const RECT *lprc) RECT rc; OutTraceD("DrawFocusRect: hdc=%x xy=(%d,%d)-(%d,%d)\n", hdc, lprc->left, lprc->top, lprc->right, lprc->bottom); memcpy(&rc, lprc, sizeof(rc)); - if (dwFlags & FIXTEXTOUT) { + if (dxw.dwFlags1 & FIXTEXTOUT) { POINT anchor; anchor.x=rc.left; anchor.y=rc.top; - (*pClientToScreen)(hWnd, &anchor); + (*pClientToScreen)(dxw.GethWnd(), &anchor); rc.left=anchor.x; rc.top=anchor.y; anchor.x=rc.right; anchor.y=rc.bottom; - (*pClientToScreen)(hWnd, &anchor); + (*pClientToScreen)(dxw.GethWnd(), &anchor); rc.right=anchor.x; rc.bottom=anchor.y; } @@ -739,7 +700,7 @@ BOOL WINAPI extShowWindow(HWND hwnd, int nCmdShow) BOOL res; OutTraceD("ShowWindow: hwnd=%x, CmdShow=%x(%s)\n", hwnd, nCmdShow, ExplainShowCmd(nCmdShow)); - if (dwFlags & PREVENTMAXIMIZE){ + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ if(nCmdShow==SW_MAXIMIZE){ OutTraceD("ShowWindow: suppress maximize\n"); nCmdShow=SW_SHOWNORMAL; @@ -776,9 +737,9 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong) OutTraceD("SetWindowLong: hwnd=%x, Index=%x(%s) Val=%x\n", hwnd, nIndex, ExplainSetWindowIndex(nIndex), dwNewLong); - //if(!hwnd) hwnd=hWnd; + //if(!hwnd) hwnd=dxw.GethWnd(); - if (dwFlags & LOCKWINSTYLE){ + if (dxw.dwFlags1 & LOCKWINSTYLE){ if(nIndex==GWL_STYLE){ OutTraceD("SetWindowLong: Lock GWL_STYLE=%x\n", dwNewLong); //return 1; @@ -791,7 +752,7 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong) } } - if (dwFlags & PREVENTMAXIMIZE){ + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ if(nIndex==GWL_STYLE){ OutTraceD("SetWindowLong: GWL_STYLE %x suppress MAXIMIZE\n", dwNewLong); dwNewLong |= WS_OVERLAPPEDWINDOW; @@ -803,7 +764,7 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong) } } - if (dwFlags & FIXWINFRAME){ + if (dxw.dwFlags1 & FIXWINFRAME){ if((nIndex==GWL_STYLE) && !(dwNewLong & WS_CHILD)){ OutTraceD("SetWindowLong: GWL_STYLE %x force OVERLAPPEDWINDOW\n", dwNewLong); dwNewLong |= WS_OVERLAPPEDWINDOW; @@ -829,40 +790,38 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong) BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags) { - extern BOOL isFullScreen; BOOL res; OutTraceD("SetWindowPos: hwnd=%x%s pos=(%d,%d) dim=(%d,%d) Flags=%x\n", - hwnd, isFullScreen?"(FULLSCREEN)":"", X, Y, cx, cy, uFlags); + hwnd, dxw.IsFullScreen()?"(FULLSCREEN)":"", X, Y, cx, cy, uFlags); - if ((hwnd != hWnd) || !isFullScreen){ + if ((hwnd != dxw.GethWnd()) || !dxw.IsFullScreen()){ // just proxy res=(*pSetWindowPos)(hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags); if(!res)OutTraceE("SetWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__); return res; } - if ((dwFlags & LOCKWINPOS) && isFullScreen){ + if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()){ // 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. return 1; } - if (dwFlags & PREVENTMAXIMIZE){ + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ int UpdFlag =0; int MaxX, MaxY; MaxX = iSizX; MaxY = iSizY; - if (!MaxX) MaxX = VirtualScr.dwWidth; - if (!MaxY) MaxY = VirtualScr.dwHeight; + if (!MaxX) MaxX = dxw.GetScreenWidth(); + if (!MaxY) MaxY = dxw.GetScreenHeight(); if(cx>MaxX) { cx=MaxX; UpdFlag=1; } if(cy>MaxY) { cy=MaxY; UpdFlag=1; } if (UpdFlag) OutTraceD("SetWindowPos: using max dim=(%d,%d)\n", cx, cy); } - //OutTraceD("SetWindowPos: DEBUG hWnd=%x hwnd=%x isFullScreen=%x\n", hwnd, hWnd, isFullScreen); // useful??? to be demonstrated.... // when altering main window in fullscreen mode, fix the coordinates for borders DWORD dwCurStyle; @@ -881,30 +840,29 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c HDWP WINAPI extDeferWindowPos(HDWP hWinPosInfo, HWND hwnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags) { - extern BOOL isFullScreen; HDWP res; OutTraceD("DeferWindowPos: hwnd=%x%s pos=(%d,%d) dim=(%d,%d) Flags=%x\n", - hwnd, isFullScreen?"(FULLSCREEN)":"", X, Y, cx, cy, uFlags); + hwnd, dxw.IsFullScreen()?"(FULLSCREEN)":"", X, Y, cx, cy, uFlags); - if ((hwnd != hWnd) || !isFullScreen){ + if ((hwnd != dxw.GethWnd()) || !dxw.IsFullScreen()){ // just proxy res=(*pDeferWindowPos)(hWinPosInfo, hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags); if(!res)OutTraceE("SetWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__); return res; } - if (dwFlags & LOCKWINPOS){ + if (dxw.dwFlags1 & LOCKWINPOS){ return hWinPosInfo; } - if (dwFlags & PREVENTMAXIMIZE){ + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ int UpdFlag =0; int MaxX, MaxY; MaxX = iSizX; MaxY = iSizY; - if (!MaxX) MaxX = VirtualScr.dwWidth; - if (!MaxY) MaxY = VirtualScr.dwHeight; + if (!MaxX) MaxX = dxw.GetScreenWidth(); + if (!MaxY) MaxY = dxw.GetScreenHeight(); if(cx>MaxX) { cx=MaxX; UpdFlag=1; } if(cy>MaxY) { cy=MaxY; UpdFlag=1; } if (UpdFlag) @@ -934,8 +892,8 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) wp = (LPWINDOWPOS)lParam; MaxX = iSizX; MaxY = iSizY; - if (!MaxX) MaxX = VirtualScr.dwWidth; - if (!MaxY) MaxY = VirtualScr.dwHeight; + if (!MaxX) MaxX = dxw.GetScreenWidth(); + if (!MaxY) MaxY = dxw.GetScreenHeight(); static int iLastCX, iLastCY; static int BorderX=-1; static int BorderY=-1; @@ -944,13 +902,13 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) OutTraceD("%s: GOT hwnd=%x pos=(%d,%d) dim=(%d,%d) Flags=%x\n", ApiName, hwnd, wp->x, wp->y, wp->cx, wp->cy, wp->flags); - if ((dwFlags & LOCKWINPOS) && isFullScreen && (hwnd==hWnd)){ + 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); } - if ((dwFlags2 & KEEPASPECTRATIO) && isFullScreen && (hwnd==hWnd)){ + if ((dxw.dwFlags2 & KEEPASPECTRATIO) && dxw.IsFullScreen() && (hwnd==dxw.GethWnd())){ // note: while keeping aspect ration, resizing from one corner doesn't tell // which coordinate is prevalent to the other. We made an arbitrary choice. // note: v2.1.93: compensation must refer to the client area, not the wp @@ -971,7 +929,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) case HTBOTTOMRIGHT: case HTTOPLEFT: case HTTOPRIGHT: - cx = BorderX + ((wp->cy - BorderY) * VirtualScr.dwWidth) / VirtualScr.dwHeight; + 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); wp->cx = cx; @@ -979,7 +937,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) break; case HTLEFT: case HTRIGHT: - cy = BorderY + ((wp->cx - BorderX) * VirtualScr.dwHeight) / VirtualScr.dwWidth; + 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); wp->cy = cy; @@ -988,7 +946,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) } } - if (dwFlags & PREVENTMAXIMIZE){ + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ int UpdFlag = 0; if(wp->cx>MaxX) { wp->cx=MaxX; UpdFlag=1; } @@ -1003,7 +961,7 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam) void dxwFixMinMaxInfo(char *ApiName, HWND hwnd, LPARAM lParam) { - if (dwFlags & PREVENTMAXIMIZE){ + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ LPMINMAXINFO lpmmi; lpmmi=(LPMINMAXINFO)lParam; OutTraceD("%s: GOT MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName, @@ -1015,23 +973,23 @@ void dxwFixMinMaxInfo(char *ApiName, HWND hwnd, LPARAM lParam) lpmmi->ptMaxSize.y = pSetDevMode->dmPelsHeight; } else{ - lpmmi->ptMaxSize.x = VirtualScr.dwWidth; - lpmmi->ptMaxSize.y = VirtualScr.dwHeight; + lpmmi->ptMaxSize.x = dxw.GetScreenWidth(); + lpmmi->ptMaxSize.y = dxw.GetScreenHeight(); } OutTraceD("%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. // fixes the problem with "Achtung Spitfire", that can't be managed through PREVENTMAXIMIZE flag. - if (dwFlags & LOCKWINPOS){ + if (dxw.dwFlags1 & LOCKWINPOS){ LPMINMAXINFO lpmmi; lpmmi=(LPMINMAXINFO)lParam; OutTraceD("%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=iPosX; lpmmi->ptMaxPosition.y=iPosY; - lpmmi->ptMaxSize.x = iSizX ? iSizX : VirtualScr.dwWidth; - lpmmi->ptMaxSize.y = iSizY ? iSizY : VirtualScr.dwHeight; + lpmmi->ptMaxSize.x = iSizX ? iSizX : dxw.GetScreenWidth(); + lpmmi->ptMaxSize.y = iSizY ? iSizY : dxw.GetScreenHeight(); OutTraceD("%s: SET LOCKWINPOS MaxPosition=(%d,%d) MaxSize=(%d,%d)\n", ApiName, lpmmi->ptMaxPosition.x, lpmmi->ptMaxPosition.y, lpmmi->ptMaxSize.x, lpmmi->ptMaxSize.y); } @@ -1045,13 +1003,13 @@ void dxwFixStyle(char *ApiName, HWND hwnd, LPARAM lParam) OutTraceD("%s: new Style=%x(%s)\n", ApiName, lpSS->styleNew, ExplainStyle(lpSS->styleNew)); - if (dwFlags & FIXWINFRAME){ // set canonical style + if (dxw.dwFlags1 & FIXWINFRAME){ // set canonical style lpSS->styleNew= WS_OVERLAPPEDWINDOW; } - if (dwFlags & LOCKWINSTYLE){ // set to current value + if (dxw.dwFlags1 & LOCKWINSTYLE){ // set to current value lpSS->styleNew= (*pGetWindowLong)(hwnd, GWL_STYLE); } - if (dwFlags & PREVENTMAXIMIZE){ // disable maximize settings + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ // disable maximize settings if (lpSS->styleNew & WS_MAXIMIZE){ OutTraceD("%s: prevent maximize style\n", ApiName); lpSS->styleNew &= ~WS_MAXIMIZE; @@ -1067,13 +1025,13 @@ void dxwFixExStyle(char *ApiName, HWND hwnd, LPARAM lParam) OutTraceD("%s: new ExStyle=%x(%s)\n", ApiName, lpSS->styleNew, ExplainExStyle(lpSS->styleNew)); - if (dwFlags & FIXWINFRAME){ // set canonical style + if (dxw.dwFlags1 & FIXWINFRAME){ // set canonical style lpSS->styleNew= 0; } - if (dwFlags & LOCKWINSTYLE){ // set to current value + if (dxw.dwFlags1 & LOCKWINSTYLE){ // set to current value lpSS->styleNew= (*pGetWindowLong)(hwnd, GWL_EXSTYLE); } - if (dwFlags & PREVENTMAXIMIZE){ // disable maximize settings + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ // disable maximize settings if (lpSS->styleNew & WS_EX_TOPMOST){ OutTraceD("%s: prevent EXSTYLE topmost style\n", ApiName); lpSS->styleNew &= ~WS_EX_TOPMOST; @@ -1092,7 +1050,7 @@ static LRESULT WINAPI FixWindowProc(char *ApiName, HWND hwnd, UINT Msg, WPARAM w switch(Msg){ // attempt to fix Sleepwalker //case WM_NCCALCSIZE: - // if (dwFlags & PREVENTMAXIMIZE) + // if (dxw.dwFlags1 & PREVENTMAXIMIZE) // return 0; // break; case WM_ERASEBKGND: @@ -1115,21 +1073,21 @@ static LRESULT WINAPI FixWindowProc(char *ApiName, HWND hwnd, UINT Msg, WPARAM w break; case WM_DISPLAYCHANGE: // too late? to be deleted.... - if ((dwFlags & LOCKWINPOS) && isFullScreen) return 0; - if (dwFlags & PREVENTMAXIMIZE){ + if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()) return 0; + if (dxw.dwFlags1 & PREVENTMAXIMIZE){ OutTraceD("%s: WM_DISPLAYCHANGE depth=%d size=(%d,%d)\n", ApiName, wParam, HIWORD(lParam), LOWORD(lParam)); return 0; } break; case WM_SIZE: - if ((dwFlags & LOCKWINPOS) && isFullScreen) return 0; - if (dwFlags & PREVENTMAXIMIZE){ + 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, wParam, ExplainResizing(wParam), HIWORD(lParam), LOWORD(lParam)); return 0; // checked - //lParam = MAKELPARAM(VirtualScr.dwWidth, VirtualScr.dwHeight); + //lParam = MAKELPARAM(dxw.GetScreenWidth(), dxw.GetScreenHeight()); //OutTraceD("%s: updated SIZE wparam=%d(%s) size=(%d,%d)\n", ApiName, // wParam, ExplainResizing(wParam), HIWORD(lParam), LOWORD(lParam)); } @@ -1196,35 +1154,35 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex) switch(nindex){ case VERTRES: - res= VirtualScr.dwHeight; + res= dxw.GetScreenHeight(); OutTraceD("GetDeviceCaps: fix VERTRES cap=%d\n", res); break; case HORZRES: - res= VirtualScr.dwWidth; + res= dxw.GetScreenWidth(); OutTraceD("GetDeviceCaps: fix 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(dwFlags2 & INIT8BPP) { + if(dxw.dwFlags2 & INIT8BPP) { res = RC_PALETTE; OutTraceD("GetDeviceCaps: fix RASTERCAPS setting RC_PALETTE cap=%x\n",res); } break; case BITSPIXEL: case COLORRES: - if(dwFlags2 & INIT8BPP|INIT16BPP){ - if(dwFlags2 & INIT8BPP) res = 8; - if(dwFlags2 & INIT16BPP) res = 16; + if(dxw.dwFlags2 & INIT8BPP|INIT16BPP){ + if(dxw.dwFlags2 & INIT8BPP) res = 8; + if(dxw.dwFlags2 & INIT16BPP) res = 16; OutTraceD("GetDeviceCaps: fix BITSPIXEL/COLORRES cap=%d\n",res); } break; } - if(dwFlags & EMULATESURFACE){ + if(dxw.dwFlags1 & EMULATESURFACE){ switch(nindex){ case RASTERCAPS: - if((VirtualScr.PixelFormat.dwRGBBitCount==8) || (dwFlags2 & INIT8BPP)){ + if((dxw.VirtualPixelFormat.dwRGBBitCount==8) || (dxw.dwFlags2 & INIT8BPP)){ res = RC_PALETTE; OutTraceD("GetDeviceCaps: fix RASTERCAPS setting RC_PALETTE cap=%x\n",res); } @@ -1233,9 +1191,9 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex) case COLORRES: int PrevRes; PrevRes=res; - if(VirtualScr.PixelFormat.dwRGBBitCount!=0) res = VirtualScr.PixelFormat.dwRGBBitCount; - if(dwFlags2 & INIT8BPP) res = 8; - if(dwFlags2 & INIT16BPP) res = 16; + 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 BITSPIXEL/COLORRES cap=%d\n",res); break; case SIZEPALETTE: @@ -1277,12 +1235,12 @@ int WINAPI extGetSystemMetrics(int nindex) switch(nindex){ case SM_CXFULLSCREEN: case SM_CXSCREEN: - res= VirtualScr.dwWidth; + res= dxw.GetScreenWidth(); OutTraceD("GetSystemMetrics: fix SM_CXSCREEN=%d\n", res); break; case SM_CYFULLSCREEN: case SM_CYSCREEN: - res= VirtualScr.dwHeight; + res= dxw.GetScreenHeight(); OutTraceD("GetSystemMetrics: fix SM_CYSCREEN=%d\n", res); break; } @@ -1295,7 +1253,7 @@ BOOL WINAPI extScaleWindowExtEx(HDC hdc, int Xnum, int Xdenom, int Ynum, int Yde OutTraceD("ScaleWindowExtEx: hdc=%x num=(%d,%d) denom=(%d,%d) lpSize=%d\n", hdc, Xnum, Ynum, Xdenom, Ydenom, lpSize); - if ((dwFlags & LOCKWINPOS) && isFullScreen) return 1; + if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()) return 1; return (*pScaleWindowExtEx)(hdc, Xnum, Xdenom, Ynum, Ydenom, lpSize); } @@ -1333,7 +1291,7 @@ BOOL WINAPI extGDISetPixelFormat(HDC hdc, int iPixelFormat, const PIXELFORMATDES OutTraceD("GDISetPixelFormat: hdc=%x\n", hdc); #if 0 - if(dwFlags & EMULATESURFACE){ + if(dxw.dwFlags1 & EMULATESURFACE){ // set VirtualScr view VirtualScr.dwRGBBitCount=ppfd->cColorBits; VirtualScr.dwFlags=ppfd->dwFlags; @@ -1362,12 +1320,10 @@ LONG WINAPI MyChangeDisplaySettings(char *fname, DEVMODE *lpDevMode, DWORD dwfla // save desired settings first v.2.1.89 // v2.1.95 protect when lpDevMode is null (closing game... Jedi Outcast - if(lpDevMode){ - VirtualScr.dwWidth = lpDevMode->dmPelsWidth; - VirtualScr.dwHeight = lpDevMode->dmPelsHeight; - } + if(lpDevMode) + dxw.SetScreenSize(lpDevMode->dmPelsWidth, lpDevMode->dmPelsHeight); - if (dwFlags & EMULATESURFACE){ + if (dxw.dwFlags1 & EMULATESURFACE){ OutTraceD("%s: BYPASS res=DISP_CHANGE_SUCCESSFUL\n", fname); return DISP_CHANGE_SUCCESSFUL; } @@ -1468,7 +1424,7 @@ ATOM WINAPI extRegisterClassExA(WNDCLASSEX *lpwcx) BOOL WINAPI extClientToScreen(HWND whnd, LPPOINT lppoint) { - if (lppoint && isFullScreen && (whnd == hWnd)) + if (lppoint && dxw.IsFullScreen() && (whnd == dxw.GethWnd())) return 1; else return (*pClientToScreen)(whnd, lppoint); @@ -1477,7 +1433,7 @@ BOOL WINAPI extClientToScreen(HWND whnd, LPPOINT lppoint) BOOL WINAPI extScreenToClient(HWND whnd, LPPOINT lppoint) { - if (lppoint && isFullScreen && (whnd == hWnd)) + if (lppoint && dxw.IsFullScreen() && (whnd == dxw.GethWnd())) return 1; else return (*pScreenToClient)(whnd, lppoint); @@ -1487,12 +1443,12 @@ BOOL WINAPI extScreenToClient(HWND whnd, LPPOINT lppoint) BOOL WINAPI extGetClientRect(HWND hwnd, LPRECT lpRect) { // do (almost) nothing !!! - OutTraceD("GetClientRect: whnd=%x isFullScreen=%x\n", hwnd, isFullScreen); - if (lpRect && isFullScreen && (hwnd == hWnd)){ + OutTraceD("GetClientRect: whnd=%x FullScreen=%x\n", hwnd, dxw.IsFullScreen()); + if (lpRect && dxw.IsFullScreen() && (hwnd == dxw.GethWnd())){ lpRect->left=0; lpRect->top=0; - lpRect->right=VirtualScr.dwWidth; - lpRect->bottom=VirtualScr.dwHeight; + lpRect->right=dxw.GetScreenWidth(); + lpRect->bottom=dxw.GetScreenHeight(); OutTraceD("GetClientRect: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); return 1; } @@ -1503,8 +1459,8 @@ BOOL WINAPI extGetClientRect(HWND hwnd, LPRECT lpRect) if ((hwnd==(*pGetDesktopWindow)()) || (hwnd==0)){ lpRect->left=0; lpRect->top=0; - lpRect->right=VirtualScr.dwWidth; - lpRect->bottom=VirtualScr.dwHeight; + lpRect->right=dxw.GetScreenWidth(); + lpRect->bottom=dxw.GetScreenHeight(); OutTraceD("GetClientRect: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); return 1; } @@ -1518,42 +1474,33 @@ BOOL WINAPI extGetWindowRect(HWND hwnd, LPRECT lpRect) { BOOL ret; - OutTraceD("GetWindowRect: hwnd=%x hWnd=%x isFullScreen=%x\n", hwnd, hWnd, isFullScreen); - if (lpRect && isFullScreen && (hwnd == hWnd)){ + OutTraceD("GetWindowRect: hwnd=%x hWnd=%x FullScreen=%x\n", hwnd, dxw.GethWnd(), dxw.IsFullScreen()); + if (lpRect && dxw.IsFullScreen() && (hwnd == dxw.GethWnd())){ // a fullscreen window should have NO BORDERS! lpRect->left = 0; lpRect->top = 0; - lpRect->right = VirtualScr.dwWidth; - lpRect->bottom = VirtualScr.dwHeight; + lpRect->right = dxw.GetScreenWidth(); + lpRect->bottom = dxw.GetScreenHeight(); OutTraceD("GetWindowRect: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); return 1; } - if (isFullScreen && ((*pGetWindowLong)(hwnd, GWL_STYLE) & WS_CHILD)){ + if (dxw.IsFullScreen() && ((*pGetWindowLong)(hwnd, GWL_STYLE) & WS_CHILD)){ // a child win should return the original supposed size // so you basically revert here the coordinates compensation. // Used by "Road Rash" to blit graphic on top of child windows POINT upleft={0,0}; RECT client; - (*pClientToScreen)(hWnd,&upleft); - (*pGetClientRect)(hWnd,&client); -#if 1 + (*pClientToScreen)(dxw.GethWnd(),&upleft); + (*pGetClientRect)(dxw.GethWnd(),&client); + // using GetWindowRect and compensate for displacement..... ret=(*pGetWindowRect)(hwnd, lpRect); if (client.right && client.bottom){ // avoid divide by 0 - lpRect->left = ((lpRect->left - upleft.x) * VirtualScr.dwWidth) / client.right; - lpRect->top = ((lpRect->top - upleft.y) * VirtualScr.dwHeight) / client.bottom; - lpRect->right = ((lpRect->right - upleft.x) * VirtualScr.dwWidth) / client.right; - lpRect->bottom = ((lpRect->bottom - upleft.y) * VirtualScr.dwHeight) / client.bottom; -#else - // using GetClientRect (simpler....) but not working..... - ret=(*pGetClientRect)(hwnd, lpRect); - if (client.right && client.bottom){ // avoid divide by 0 - lpRect->left = (lpRect->left * VirtualScr.dwWidth) / client.right; - lpRect->top = (lpRect->top * VirtualScr.dwHeight) / client.bottom; - lpRect->right = (lpRect->right * VirtualScr.dwWidth) / client.right; - lpRect->bottom = (lpRect->bottom * VirtualScr.dwHeight) / client.bottom; -#endif + lpRect->left = ((lpRect->left - upleft.x) * dxw.GetScreenWidth()) / client.right; + lpRect->top = ((lpRect->top - upleft.y) * dxw.GetScreenHeight()) / client.bottom; + lpRect->right = ((lpRect->right - upleft.x) * dxw.GetScreenWidth()) / client.right; + lpRect->bottom = ((lpRect->bottom - upleft.y) * dxw.GetScreenHeight()) / client.bottom; OutTraceD("GetWindowRect: fixed CHILD rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); } return ret; @@ -1568,9 +1515,9 @@ int WINAPI extMapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT { // a rarely used API, but responsible for a painful headache: needs hooking for "Commandos 2". - OutTraceD("MapWindowPoints: hWndFrom=%x hWndTo=%x cPoints=%d isFullScreen=%x\n", - hWndFrom, hWndTo, cPoints, isFullScreen); - if((hWndTo==HWND_DESKTOP) && (hWndFrom==hWnd) && isFullScreen){ + OutTraceD("MapWindowPoints: hWndFrom=%x hWndTo=%x cPoints=%d FullScreen=%x\n", + hWndFrom, hWndTo, cPoints, dxw.IsFullScreen()); + if((hWndTo==HWND_DESKTOP) && (hWndFrom==dxw.GethWnd()) && dxw.IsFullScreen()){ OutTraceD("MapWindowPoints: fullscreen condition\n"); SetLastError(0); return 0; // = 0,0 shift @@ -1606,7 +1553,7 @@ BOOL WINAPI extPeekMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsg if(wRemoveMsg){ static MSG MsgCopy; MsgCopy=*lpMsg; - MsgCopy.pt=FixMessagePt(hWnd, MsgCopy.pt); + MsgCopy.pt=FixMessagePt(dxw.GethWnd(), MsgCopy.pt); if((MsgCopy.message <= WM_MOUSELAST) && (MsgCopy.message >= WM_MOUSEFIRST)) MsgCopy.lParam = MAKELPARAM(MsgCopy.pt.x, MsgCopy.pt.y); OutTraceC("PeekMessage: fixed lparam/pt=(%d,%d)\n", MsgCopy.pt.x, MsgCopy.pt.y); lpMsg=&MsgCopy; @@ -1632,7 +1579,7 @@ BOOL WINAPI extGetMessage(LPMSG lpMsg, HWND hwnd, UINT wMsgFilterMin, UINT wMsgF DWORD Message; Message=lpMsg->message & 0xFFFF; if((Message <= WM_MOUSELAST) && (Message >= WM_MOUSEFIRST)){ - FixedHwnd=(hwnd)?hwnd:hWnd; + FixedHwnd=(hwnd)?hwnd:dxw.GethWnd(); lpMsg->pt=FixMessagePt(FixedHwnd, lpMsg->pt); lpMsg->lParam = MAKELPARAM(lpMsg->pt.x, lpMsg->pt.y); OutTraceC("PeekMessage: fixed lparam/pt=(%d,%d)\n", lpMsg->pt.x, lpMsg->pt.y); @@ -1647,7 +1594,7 @@ LRESULT WINAPI extDispatchMessage(LPMSG lpMsg) #if WORKONCOPY static MSG MsgCopy; MsgCopy=*lpMsg; - MsgCopy.pt=FixMessagePt(hWnd, MsgCopy.pt); + MsgCopy.pt=FixMessagePt(dxw.GethWnd(), MsgCopy.pt); Message=MsgCopy.message & 0xFFFF; if((Message <= WM_MOUSELAST) && (Message >= WM_MOUSEFIRST)){ MsgCopy.lParam = MAKELPARAM(MsgCopy.pt.x, MsgCopy.pt.y); @@ -1658,7 +1605,7 @@ LRESULT WINAPI extDispatchMessage(LPMSG lpMsg) lpMsg, MsgCopy.message, ExplainWinMessage(MsgCopy.message & 0xFFFF), MsgCopy.wParam, MsgCopy.lParam, MsgCopy.pt.x, MsgCopy.pt.y, res); #else - lpMsg->pt=FixMessagePt(hWnd, lpMsg->pt); + lpMsg->pt=FixMessagePt(dxw.GethWnd(), lpMsg->pt); Message=lpMsg->message & 0xFFFF; if((Message <= WM_MOUSELAST) && (Message >= WM_MOUSEFIRST)){ lpMsg->lParam = MAKELPARAM(lpMsg->pt.x, lpMsg->pt.y); @@ -1892,9 +1839,9 @@ HDC WINAPI extGDIGetDC(HWND hwnd) HWND lochwnd; OutTraceD("GDI.GetDC: hwnd=%x\n", hwnd); lochwnd=hwnd; - if (isFullScreen && ((hwnd==0) || (hwnd==(*pGetDesktopWindow)()))) { - OutTraceD("GDI.GetDC: desktop remapping hwnd=%x->%x\n", hwnd, hWnd); - lochwnd=hWnd; + if (dxw.IsFullScreen() && ((hwnd==0) || (hwnd==(*pGetDesktopWindow)()))) { + OutTraceD("GDI.GetDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); + lochwnd=dxw.GethWnd(); } ret=(*pGDIGetDC)(lochwnd); if(ret){ @@ -1922,8 +1869,8 @@ HDC WINAPI extGDIGetWindowDC(HWND hwnd) OutTraceD("GDI.GetWindowDC: hwnd=%x\n", hwnd); lochwnd=hwnd; if ((hwnd==0) || (hwnd==(*pGetDesktopWindow)())) { - OutTraceD("GDI.GetWindowDC: desktop remapping hwnd=%x->%x\n", hwnd, hWnd); - lochwnd=hWnd; + OutTraceD("GDI.GetWindowDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd()); + lochwnd=dxw.GethWnd(); } ret=(*pGDIGetWindowDC)(lochwnd); if(ret){ @@ -1948,7 +1895,7 @@ int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC) { int res; OutTraceD("GDI.ReleaseDC: hwnd=%x hdc=%x\n", hwnd, hDC); - if (hwnd==0) hwnd=hWnd; + if (hwnd==0) hwnd=dxw.GethWnd(); res=(*pGDIReleaseDC)(hwnd, hDC); if (!res) OutTraceE("GDI.ReleaseDC ERROR: err=%d at %d\n", GetLastError(), __LINE__); return(res); @@ -1962,9 +1909,9 @@ HDC WINAPI extGDICreateDC(LPSTR Driver, LPSTR Device, LPSTR Output, CONST DEVMOD if (!Driver || !strncmp(Driver,"DISPLAY",7)) { OutTraceD("GDI.CreateDC: returning window surface DC\n"); - WinHDC=(*pGDIGetDC)(hWnd); + WinHDC=(*pGDIGetDC)(dxw.GethWnd()); RetHDC=(*pCreateCompatibleDC)(WinHDC); - (*pGDIReleaseDC)(hWnd, WinHDC); + (*pGDIReleaseDC)(dxw.GethWnd(), WinHDC); } else{ RetHDC=(*pCreateDC)(Driver, Device, Output, InitData); @@ -1985,8 +1932,8 @@ HDC WINAPI extGDICreateCompatibleDC(HDC hdc) OutTraceD("GDI.CreateCompatibleDC: hdc=%x\n", hdc); if(hdc==0){ - SrcHdc=(*pGDIGetDC)(hWnd); - OutTraceD("GDI.CreateCompatibleDC: duplicating win HDC hWnd=%x\n", hWnd); + SrcHdc=(*pGDIGetDC)(dxw.GethWnd()); + OutTraceD("GDI.CreateCompatibleDC: duplicating win HDC hWnd=%x\n", dxw.GethWnd()); } RetHdc=(*pCreateCompatibleDC)(hdc); if(RetHdc) @@ -2008,14 +1955,14 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH res=(*pBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop); if(!res) OutTraceE("GDI.BitBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__); #else - if (isFullScreen){ + if (dxw.IsFullScreen()){ RECT client; int nWDest, nHDest; - (*pGetClientRect)(hWnd, &client); - nXDest= nXDest * client.right / VirtualScr.dwWidth; - nYDest= nYDest * client.bottom / VirtualScr.dwHeight; - nWDest= nWidth * client.right / VirtualScr.dwWidth; - nHDest= nHeight * client.bottom / VirtualScr.dwHeight; + (*pGetClientRect)(dxw.GethWnd(), &client); + nXDest= nXDest * client.right / dxw.GetScreenWidth(); + nYDest= nYDest * client.bottom / dxw.GetScreenHeight(); + nWDest= nWidth * client.right / dxw.GetScreenWidth(); + nHDest= nHeight * client.bottom / dxw.GetScreenHeight(); res=(*pStretchBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); } else { @@ -2038,14 +1985,14 @@ BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH res=(*pPatBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, dwRop); if(!res) OutTraceE("GDI.PatBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__); #else - if (isFullScreen){ + if (dxw.IsFullScreen()){ RECT client; int nWDest, nHDest; - (*pGetClientRect)(hWnd, &client); - nXDest= nXDest * client.right / VirtualScr.dwWidth; - nYDest= nYDest * client.bottom / VirtualScr.dwHeight; - nWDest= nWidth * client.right / VirtualScr.dwWidth; - nHDest= nHeight * client.bottom / VirtualScr.dwHeight; + (*pGetClientRect)(dxw.GethWnd(), &client); + nXDest= nXDest * client.right / dxw.GetScreenWidth(); + nYDest= nYDest * client.bottom / dxw.GetScreenHeight(); + nWDest= nWidth * client.right / dxw.GetScreenWidth(); + nHDest= nHeight * client.bottom / dxw.GetScreenHeight(); res=(*pPatBlt)(hdcDest, nXDest, nYDest, nWDest, nHDest, dwRop); } else { @@ -2083,11 +2030,9 @@ static HANDLE AutoRefreshThread; static DWORD dwThrdId; void AutoRefresh(HDC hdc) { -// HRESULT res; -// extern void dx_ScreenRefresh(); while(1){ Sleep(10); - (*pInvalidateRect)(hWnd, 0, FALSE); + (*pInvalidateRect)(dxw.GethWnd(), 0, FALSE); } } @@ -2128,7 +2073,7 @@ HDC WINAPI extDDCreateCompatibleDC(HDC hdc) OutTraceD("GDI.CreateCompatibleDC: hdc=%x\n", hdc); - if(hdc==0 && pGetDC && isFullScreen){ + if(hdc==0 && pGetDC && dxw.IsFullScreen()){ if(!lpDDSPrimHDC) lpDDSPrimHDC=GetPrimarySurface(); (*pGetDC)(lpDDSPrimHDC,&SrcHdc); OutTraceD("GDI.CreateCompatibleDC: duplicating screen HDC lpDDSPrimHDC=%x\n", lpDDSPrimHDC); @@ -2192,7 +2137,7 @@ static HDC WINAPI winDDGetDC(HWND hwnd, char *api) } } else { - hdc=(*pGDIGetDC)(hwnd ? hwnd : hWnd); + hdc=(*pGDIGetDC)(hwnd ? hwnd : dxw.GethWnd()); OutTraceD("%s: returning window DC handle hwnd=%x hdc=%x\n", api, hwnd, hdc); PrimHDC=NULL; } @@ -2350,7 +2295,7 @@ BOOL WINAPI extDDStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWSrc, nHSrc, dwRop); if(hdcDest != hdcSrc){ - (*pGetClientRect)(hWnd,&ClientRect); + (*pGetClientRect)(dxw.GethWnd(),&ClientRect); ret=(*pStretchBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, nWidth, nHeight, dwRop); if(!ret) { OutTraceE("GDI.StretchBlt: ERROR err=%d at %d\n", GetLastError(), __LINE__); @@ -2375,14 +2320,14 @@ 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, isFullScreen); + OutTraceD("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! - if(!isFullScreen) return hdc; + if(!dxw.IsFullScreen()) return hdc; // on MAPGDITOPRIMARY, return the PrimHDC handle instead of the window DC - if(dwFlags & MAPGDITOPRIMARY) { + if(dxw.dwFlags1 & MAPGDITOPRIMARY) { if(pGetDC && lpDDSPrimHDC){ //(*pGetDC)(lpDDSPrimHDC,&PrimHDC); extGetDC(lpDDSPrimHDC,&PrimHDC); @@ -2395,11 +2340,11 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint) } // on CLIENTREMAPPING, resize the paint area to virtual screen size - if(dwFlags & CLIENTREMAPPING){ + if(dxw.dwFlags1 & CLIENTREMAPPING){ lpPaint->rcPaint.top=0; lpPaint->rcPaint.left=0; - lpPaint->rcPaint.right=VirtualScr.dwWidth; - lpPaint->rcPaint.bottom=VirtualScr.dwHeight; + lpPaint->rcPaint.right=dxw.GetScreenWidth(); + lpPaint->rcPaint.bottom=dxw.GetScreenHeight(); } return hdc; @@ -2416,7 +2361,7 @@ BOOL WINAPI extEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint) if(!ret) OutTraceE("GDI.EndPaint ERROR: err=%d at %d\n", GetLastError(), __LINE__); // if not in fullscreen mode, that's all! - if(!isFullScreen) return ret; + if(!dxw.IsFullScreen()) return ret; return ret; } @@ -2446,7 +2391,7 @@ HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpT isWithinDialog=TRUE; OutTraceD("CreateDialogIndirectParam: hInstance=%x lpTemplate=%s hWndParent=%x lpDialogFunc=%x lParamInit=%x\n", hInstance, "tbd", hWndParent, lpDialogFunc, lParamInit); - if(hWndParent==NULL) hWndParent=hWnd; + if(hWndParent==NULL) hWndParent=dxw.GethWnd(); RetHWND=(*pCreateDialogIndirectParam)(hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit); WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc); @@ -2467,7 +2412,7 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW isWithinDialog=TRUE; OutTraceD("CreateDialogParam: hInstance=%x lpTemplateName=%s hWndParent=%x lpDialogFunc=%x lParamInit=%x\n", hInstance, "tbd", hWndParent, lpDialogFunc, lParamInit); - if(hWndParent==NULL) hWndParent=hWnd; + if(hWndParent==NULL) hWndParent=dxw.GethWnd(); RetHWND=(*pCreateDialogParam)(hInstance, lpTemplateName, hWndParent, lpDialogFunc, lParamInit); WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc); @@ -2583,7 +2528,7 @@ UINT WINAPI extRealizePalette(HDC hdc) // then don't override the current palette set by the DirectDrawPalette class. // should be cleaned up a little.... // maybe not: now both Diable & Dementia colors are working... - if(dwFlags & EMULATESURFACE) + if(dxw.dwFlags1 & EMULATESURFACE) mySetPalette(0, MyPal.palNumEntries, MyPal.palPalEntry); // DEBUGGING if(IsDebug){ @@ -2607,7 +2552,7 @@ UINT WINAPI extGetSystemPaletteEntries(HDC hdc, UINT iStartIndex, UINT nEntries, OutTraceD("GetSystemPaletteEntries: hdc=%x start=%d num=%d\n", hdc, iStartIndex, nEntries); ret=(*pGetSystemPaletteEntries)(hdc, iStartIndex, nEntries, lppe); OutTraceD("GetSystemPaletteEntries: ret=%d\n", ret); - if((ret == 0) && (dwFlags & EMULATESURFACE)) { + if((ret == 0) && (dxw.dwFlags1 & EMULATESURFACE)) { OutTraceD("GetSystemPaletteEntries: fixing ret=%d\n", nEntries); ret = nEntries; } @@ -2627,17 +2572,14 @@ HCURSOR WINAPI extSetCursor(HCURSOR hCursor) BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint) { BOOL ret; - extern HWND hParentWnd; OutTraceD("MoveWindow: hwnd=%x xy=(%d,%d) size=(%d,%d) repaint=%x indialog=%x\n", hwnd, X, Y, nWidth, nHeight, bRepaint, isWithinDialog); - if((hwnd==hWnd) || (hwnd==hParentWnd)){ + if((hwnd==dxw.GethWnd()) || (hwnd==dxw.hParentWnd)){ OutTraceD("MoveWindow: prevent moving main win\n"); if (nHeight && nWidth){ OutTraceD("MoveWindow: setting screen size=(%d,%d)\n", nHeight, nWidth); - VirtualScr.dwHeight=nHeight; - VirtualScr.dwWidth=nWidth; -// isFullScreen=TRUE; + dxw.SetScreenSize(nWidth, nHeight); } return TRUE; } @@ -2648,47 +2590,45 @@ BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL // v2.1.93: moving the desktop seems a way to change its resolution? if (nHeight && nWidth){ OutTraceD("MoveWindow: setting screen size=(%d,%d)\n", nHeight, nWidth); - VirtualScr.dwHeight=nHeight; - VirtualScr.dwWidth=nWidth; -// isFullScreen=TRUE; + dxw.SetScreenSize(nWidth, nHeight); } return TRUE; } - if (isFullScreen){ + if (dxw.IsFullScreen()){ POINT upleft={0,0}; RECT client; BOOL isChild; - (*pClientToScreen)(hWnd,&upleft); - (*pGetClientRect)(hWnd,&client); + (*pClientToScreen)(dxw.GethWnd(),&upleft); + (*pGetClientRect)(dxw.GethWnd(),&client); if ((*pGetWindowLong)(hwnd, GWL_STYLE) & WS_CHILD){ isChild=TRUE; // child coordinate adjustement - X = (X * client.right) / VirtualScr.dwWidth; - Y = (Y * client.bottom) / VirtualScr.dwHeight; - nWidth = (nWidth * client.right) / VirtualScr.dwWidth; - nHeight = (nHeight * client.bottom) / VirtualScr.dwHeight; + X = (X * client.right) / dxw.GetScreenWidth(); + Y = (Y * client.bottom) / dxw.GetScreenHeight(); + nWidth = (nWidth * client.right) / dxw.GetScreenWidth(); + nHeight = (nHeight * client.bottom) / dxw.GetScreenHeight(); } else { isChild=FALSE; // regular win coordinate adjustement - X = upleft.x + (X * client.right) / VirtualScr.dwWidth; - Y = upleft.y + (Y * client.bottom) / VirtualScr.dwHeight; - nWidth = (nWidth * client.right) / VirtualScr.dwWidth; - nHeight = (nHeight * client.bottom) / VirtualScr.dwHeight; + X = upleft.x + (X * client.right) / dxw.GetScreenWidth(); + Y = upleft.y + (Y * client.bottom) / dxw.GetScreenHeight(); + nWidth = (nWidth * client.right) / dxw.GetScreenWidth(); + nHeight = (nHeight * client.bottom) / dxw.GetScreenHeight(); } OutTraceD("MoveWindow: DEBUG client=(%d,%d) screen=(%d,%d)\n", - client.right, client.bottom, VirtualScr.dwWidth, VirtualScr.dwHeight); + client.right, client.bottom, dxw.GetScreenWidth(), dxw.GetScreenHeight()); OutTraceD("MoveWindow: hwnd=%x child=%x relocated to xy=(%d,%d) size=(%d,%d)\n", hwnd, isChild, X, Y, nWidth, nHeight); } else{ - if((X==0)&&(Y==0)&&(nWidth==VirtualScr.dwWidth)&&(nHeight==VirtualScr.dwHeight)){ + if((X==0)&&(Y==0)&&(nWidth==dxw.GetScreenWidth())&&(nHeight==dxw.GetScreenHeight())){ // evidently, this was supposed to be a fullscreen window.... RECT screen; POINT upleft = {0,0}; - (*pGetClientRect)(hWnd,&screen); - (*pClientToScreen)(hWnd,&upleft); + (*pGetClientRect)(dxw.GethWnd(),&screen); + (*pClientToScreen)(dxw.GethWnd(),&upleft); X=upleft.x; Y=upleft.y; nWidth=screen.right; @@ -2724,7 +2664,7 @@ BOOL WINAPI extSetDeviceGammaRamp(HDC hDC, LPVOID lpRamp) { BOOL ret; OutTraceD("SetDeviceGammaRamp: hdc=%x\n", hDC); - if(dwFlags2 & DISABLEGAMMARAMP) { + if(dxw.dwFlags2 & DISABLEGAMMARAMP) { OutTraceD("SetDeviceGammaRamp: SUPPRESSED\n"); return TRUE; } @@ -2747,7 +2687,7 @@ LRESULT WINAPI extSendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) LRESULT ret; OutTraceW("SendMessage: hwnd=%x WinMsg=[0x%x]%s(%x,%x)\n", hwnd, Msg, ExplainWinMessage(Msg), wParam, lParam); - if(dwFlags & MODIFYMOUSE){ + if(dxw.dwFlags1 & MODIFYMOUSE){ switch (Msg){ case WM_MOUSEMOVE: case WM_MOUSEWHEEL: @@ -2765,9 +2705,9 @@ LRESULT WINAPI extSendMessage(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) RECT rect; prev.x = LOWORD(lParam); prev.y = HIWORD(lParam); - (*pGetClientRect)(hWnd, &rect); - if (VirtualScr.dwWidth) curr.x = (prev.x * rect.right) / VirtualScr.dwWidth; - if (VirtualScr.dwHeight) curr.y = (prev.y * rect.bottom) / VirtualScr.dwHeight; + (*pGetClientRect)(dxw.GethWnd(), &rect); + curr.x = (prev.x * rect.right) / dxw.GetScreenWidth(); + curr.y = (prev.y * rect.bottom) / dxw.GetScreenHeight(); lParam = MAKELPARAM(curr.x, curr.y); OutTraceC("SendMessage: hwnd=%x pos XY=(%d,%d)->(%d,%d)\n", hwnd, prev.x, prev.y, curr.x, curr.y); break; diff --git a/dll/syslibs.h b/dll/syslibs.h index ee2f093..8104a09 100644 --- a/dll/syslibs.h +++ b/dll/syslibs.h @@ -89,8 +89,6 @@ typedef BOOL (WINAPI *SetDeviceGammaRamp_Type)(HDC, LPVOID); typedef BOOL (WINAPI *GetDeviceGammaRamp_Type)(HDC, LPVOID); typedef LRESULT (WINAPI *SendMessage_Type)(HWND, UINT, WPARAM, LPARAM); -extern DWORD dwFlags, dwFlags2; -extern HWND hWnd; extern GetCursorPos_Type pGetCursorPos; extern SetCursorPos_Type pSetCursorPos; extern ClipCursor_Type pClipCursor; diff --git a/dll/wndproc.cpp b/dll/wndproc.cpp index d066254..9b959c3 100644 --- a/dll/wndproc.cpp +++ b/dll/wndproc.cpp @@ -5,6 +5,7 @@ #include #include #include "dxwnd.h" +#include "dxwcore.hpp" #include "dxhook.h" #include "syslibs.h" #include "dxhelper.h" diff --git a/host/Resource.h b/host/Resource.h index 05c7e9a..e98f5aa 100644 --- a/host/Resource.h +++ b/host/Resource.h @@ -131,6 +131,7 @@ #define ID_TRAY_RESTORE 32808 #define ID_VIEW_STATUS 32809 #define ID_DXAPP_EXIT 32810 +#define ID_SAVEFILE 32810 // Next default values for new objects // @@ -138,7 +139,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 150 -#define _APS_NEXT_COMMAND_VALUE 32809 +#define _APS_NEXT_COMMAND_VALUE 32811 #define _APS_NEXT_CONTROL_VALUE 1032 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index 5a24783..962d175 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index a2fb8a2..d24010b 100644 --- a/host/dxwndhost.rc +++ b/host/dxwndhost.rc @@ -80,6 +80,7 @@ IDR_MAINFRAME MENU BEGIN POPUP "&File" BEGIN + MENUITEM "Save", ID_FILE_SAVE MENUITEM "&Sort programs list", ID_FILE_SORTPROGRAMSLIST MENUITEM "&Clear all logs", ID_FILE_CLEARALLLOGS POPUP "Hook" @@ -393,7 +394,7 @@ BEGIN ID_FILE_NEW "Create a new file\nNew File" ID_FILE_OPEN "Open an existing file\nOpen" ID_FILE_CLOSE "Close the active file\nClose" - ID_FILE_SAVE "Save overwriting the files in the working directory\nSave" + ID_FILE_SAVE "Save the configuration file\nSave" ID_FILE_SAVE_AS "Save with a new name\nrename and save" END diff --git a/host/dxwndhost.vs2008.sln b/host/dxwndhost.vs2008.sln new file mode 100644 index 0000000..5bf4fb1 --- /dev/null +++ b/host/dxwndhost.vs2008.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dxwndhost", "dxwndhost.vs2008.vcproj", "{FD0B0234-8EC5-43C0-A384-1B881DD3D925}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.ActiveCfg = Debug|Win32 + {FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Debug|Win32.Build.0 = Debug|Win32 + {FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.ActiveCfg = Release|Win32 + {FD0B0234-8EC5-43C0-A384-1B881DD3D925}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo new file mode 100644 index 0000000..4a0791d Binary files /dev/null and b/host/dxwndhost.vs2008.suo differ diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp index 7b6f04c..c7e8389 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -45,6 +45,7 @@ BEGIN_MESSAGE_MAP(CDxwndhostView, CListView) ON_COMMAND(ID_FILE_SORTPROGRAMSLIST, OnSort) ON_COMMAND(ID_FILE_CLEARALLLOGS, OnClearAllLogs) ON_COMMAND(ID_FILE_GOTOTRAYICON, OnGoToTrayIcon) + ON_COMMAND(ID_FILE_SAVE, OnSaveFile) ON_COMMAND(ID_HOOK_START, OnHookStart) ON_COMMAND(ID_HOOK_STOP, OnHookStop) ON_COMMAND(ID_DXAPP_EXIT, OnExit) @@ -92,11 +93,100 @@ CDxwndhostView::CDxwndhostView() EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &this->InitDevMode); } -CDxwndhostView::~CDxwndhostView() +void CDxwndhostView::SaveConfigFile() { int i; char key[32], val[32]; + for(i = 0; i < MAXTARGETS; i ++){ + if(!TargetMaps[i].path[0]) break; + sprintf_s(key, sizeof(key), "title%i", i); + WritePrivateProfileString("target", key, TitleMaps[i].title, InitPath); + sprintf_s(key, sizeof(key), "path%i", i); + WritePrivateProfileString("target", key, TargetMaps[i].path, InitPath); + sprintf_s(key, sizeof(key), "module%i", i); + WritePrivateProfileString("target", key, TargetMaps[i].module, InitPath); + sprintf_s(key, sizeof(key), "ver%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].dxversion); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "flag%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].flags); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "flagg%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].flags2); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "tflag%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].tflags); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "initx%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].initx); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "inity%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].inity); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "minx%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].minx); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "miny%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].miny); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "maxx%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].maxx); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "maxy%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].maxy); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "posx%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].posx); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "posy%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].posy); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "sizx%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].sizx); + WritePrivateProfileString("target", key, val, InitPath); + sprintf_s(key, sizeof(key), "sizy%i", i); + sprintf_s(val, sizeof(val), "%i", TargetMaps[i].sizy); + WritePrivateProfileString("target", key, val, InitPath); + } + for(; i < MAXTARGETS; i ++){ + sprintf_s(key, sizeof(key), "path%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "ver%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "flag%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "flagg%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "tflag%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "initx%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "inity%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "minx%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "miny%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "maxx%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "maxy%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "posx%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "posy%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "sizx%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + sprintf_s(key, sizeof(key), "sizy%i", i); + WritePrivateProfileString("target", key, 0, InitPath); + } + + this->isUpdated=FALSE; +} + +CDxwndhostView::~CDxwndhostView() +{ EndHook(); RevertScreenChanges(&this->InitDevMode); @@ -106,92 +196,7 @@ CDxwndhostView::~CDxwndhostView() "Task list has changed.\n" "Do you want to save it?", "Warning", MB_YESNO | MB_ICONQUESTION, NULL)==IDYES) - { - for(i = 0; i < MAXTARGETS; i ++){ - if(!TargetMaps[i].path[0]) break; - sprintf_s(key, sizeof(key), "title%i", i); - WritePrivateProfileString("target", key, TitleMaps[i].title, InitPath); - sprintf_s(key, sizeof(key), "path%i", i); - WritePrivateProfileString("target", key, TargetMaps[i].path, InitPath); - sprintf_s(key, sizeof(key), "module%i", i); - WritePrivateProfileString("target", key, TargetMaps[i].module, InitPath); - sprintf_s(key, sizeof(key), "ver%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].dxversion); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "flag%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].flags); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "flagg%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].flags2); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "tflag%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].tflags); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "initx%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].initx); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "inity%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].inity); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "minx%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].minx); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "miny%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].miny); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "maxx%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].maxx); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "maxy%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].maxy); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "posx%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].posx); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "posy%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].posy); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "sizx%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].sizx); - WritePrivateProfileString("target", key, val, InitPath); - sprintf_s(key, sizeof(key), "sizy%i", i); - sprintf_s(val, sizeof(val), "%i", TargetMaps[i].sizy); - WritePrivateProfileString("target", key, val, InitPath); - } - for(; i < MAXTARGETS; i ++){ - sprintf_s(key, sizeof(key), "path%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "ver%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "flag%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "flagg%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "tflag%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "initx%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "inity%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "minx%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "miny%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "maxx%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "maxy%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "posx%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "posy%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "sizx%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - sprintf_s(key, sizeof(key), "sizy%i", i); - WritePrivateProfileString("target", key, 0, InitPath); - } - } - this->isUpdated=FALSE; + this->SaveConfigFile(); if(this->SystemTray.Enabled()){ this->SystemTray.StopAnimation(); @@ -966,6 +971,16 @@ void CDxwndhostView::OnGoToTrayIcon() this->SystemTray.MinimiseToTray(pParent, FALSE); } +void CDxwndhostView::OnSaveFile() +{ + if (this->isUpdated) + if (MessageBoxEx(0, + "Task list has changed.\n" + "Do you want to save it?", + "Warning", MB_YESNO | MB_ICONQUESTION, NULL)==IDYES) + this->SaveConfigFile(); +} + void CDxwndhostView::OnTrayRestore() { CWnd *pParent = this->GetParent(); diff --git a/host/dxwndhostView.h b/host/dxwndhostView.h index 13183c7..f1075f2 100644 --- a/host/dxwndhostView.h +++ b/host/dxwndhostView.h @@ -19,6 +19,7 @@ protected: // Create from serialization only features. private: void Resize(void); + void SaveConfigFile(); TARGETMAP TargetMaps[MAXTARGETS]; PRIVATEMAP TitleMaps[MAXTARGETS]; char InitPath[MAX_PATH]; @@ -69,6 +70,7 @@ protected: afx_msg void OnRun(); afx_msg void OnClearAllLogs(); afx_msg void OnGoToTrayIcon(); + afx_msg void OnSaveFile(); afx_msg void OnHookStart(); afx_msg void OnInitMenu(); afx_msg void OnHookStop();