diff --git a/Include/dxwnd.h b/Include/dxwnd.h
index 863e955..c1f4752 100644
--- a/Include/dxwnd.h
+++ b/Include/dxwnd.h
@@ -212,6 +212,10 @@
#define UNACQUIRE 0x10000000 // Unacquire DirectInput devices when losing focus and acquire back when gaining focus
#define HOOKGOGLIBS 0x20000000 // Hook additional libraries provided by GOG with different names but same functionalities as system ones
#define BYPASSGOGLIBS 0x40000000 // Bypass GOG proxy system libraries loading directly the system libraries from the system folder
+#define EMULATERELMOUSE 0x80000000 // Emulates the dinput detection of relative mouse position by keeping the mouse at the center of window and looking for movements
+
+// seventh flags DWORD dxw.dwFlags7:
+// eighth flags DWORD dxw.dwFlags8:
// logging Tflags DWORD:
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general
@@ -251,13 +255,9 @@ typedef struct TARGETMAP
int flags4;
int flags5;
int flags6;
+ int flags7;
+ int flags8;
int tflags;
- short initx;
- short inity;
- short minx;
- short miny;
- short maxx;
- short maxy;
short posx;
short posy;
short sizx;
diff --git a/build/dxwnd.dll b/build/dxwnd.dll
index 4f92797..d16fb6e 100644
--- a/build/dxwnd.dll
+++ b/build/dxwnd.dll
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:58984ac106a91ee758fe27b885e80e4c0c07d1d5de6105c9a397032410db5b4c
+oid sha256:fced667458c73b82bde02efd8d316628a878f1b006dc783b0e806309c0ff8d32
size 626176
diff --git a/build/dxwnd.exe b/build/dxwnd.exe
index a3b7d5e..9ced148 100644
--- a/build/dxwnd.exe
+++ b/build/dxwnd.exe
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:7e22776dc66acf9e798458cd8bf1e95195ee0577c99153c150b1a8e69e704b8f
-size 546816
+oid sha256:45425fed1d12c6c8a93df12b38a6ec3a17b875c00b2851c1031963973e4a8c67
+size 545792
diff --git a/build/dxwnd.ini b/build/dxwnd.ini
deleted file mode 100644
index b8fb4a7..0000000
--- a/build/dxwnd.ini
+++ /dev/null
@@ -1,908 +0,0 @@
-[window]
-exportpath=D:\DxWnd\v2_03_50_src\build\exports\
-posx=1045
-posy=439
-sizx=492
-sizy=367
-exepath=D:\Games\SWAT 3 (GOG)\game\
-debug=1
-[target]
-title0=Command & Conquer - Red Alert The Aftermath
-path0=D:\Games\C&C - Red Alert The Aftermath\RA95.EXE
-launchpath0=
-module0=
-opengllib0=
-notes0=
-registry0=
-ver0=0
-coord0=0
-flag0=136368226
-flagg0=1224740864
-flagh0=532
-flagi0=138412036
-flagj0=4224
-flagk0=262144
-tflag0=-1476388605
-initx0=0
-inity0=0
-minx0=0
-miny0=0
-maxx0=0
-maxy0=0
-posx0=50
-posy0=50
-sizx0=800
-sizy0=600
-maxfps0=4
-initts0=0
-winver0=0
-maxres0=-1
-swapeffect0=0
-title1=hlp.exe
-path1=D:\Games\DylanDog\hlp.exe
-launchpath1=
-module1=
-opengllib1=
-notes1=
-registry1=
-ver1=0
-coord1=0
-flag1=2097184
-flagg1=1207959552
-flagh1=1048596
-flagi1=138412038
-flagj1=4224
-flagk1=2
-tflag1=-2147477245
-initx1=0
-inity1=0
-minx1=0
-miny1=0
-maxx1=0
-maxy1=0
-posx1=50
-posy1=50
-sizx1=800
-sizy1=600
-maxfps1=0
-initts1=0
-winver1=0
-maxres1=-1
-swapeffect1=0
-title2=Riven DVD
-path2=D:\Games\Riven\Riven.patched.exe
-launchpath2=
-module2=
-opengllib2=
-notes2=
-registry2=
-ver2=0
-coord2=0
-flag2=673185824
-flagg2=1207959552
-flagh2=20
-flagi2=138412036
-flagj2=67108992
-flagk2=33554432
-tflag2=-2147477245
-initx2=0
-inity2=0
-minx2=0
-miny2=0
-maxx2=0
-maxy2=0
-posx2=50
-posy2=50
-sizx2=800
-sizy2=600
-maxfps2=0
-initts2=0
-winver2=0
-maxres2=-1
-swapeffect2=0
-title3=Rogue Squadron.EXE
-path3=D:\Games\Rogue Squadron 3D\Rogue Squadron.EXE
-launchpath3=
-module3=
-opengllib3=
-notes3=
-registry3=
-ver3=0
-coord3=0
-flag3=136314914
-flagg3=1207959552
-flagh3=20
-flagi3=138412036
-flagj3=4224
-flagk3=65536
-tflag3=0
-initx3=0
-inity3=0
-minx3=0
-miny3=0
-maxx3=0
-maxy3=0
-posx3=50
-posy3=50
-sizx3=800
-sizy3=600
-maxfps3=0
-initts3=0
-winver3=0
-maxres3=-1
-swapeffect3=0
-title4=Geneforge
-path4=d:\games\Geneforge\Geneforge.exe
-launchpath4=
-module4=
-opengllib4=
-notes4=
-registry4=
-ver4=0
-coord4=0
-flag4=134234628
-flagg4=1207959808
-flagh4=65620
-flagi4=4194308
-flagj4=0
-flagk4=0
-tflag4=64
-initx4=0
-inity4=0
-minx4=0
-miny4=0
-maxx4=0
-maxy4=0
-posx4=50
-posy4=50
-sizx4=1200
-sizy4=900
-maxfps4=0
-initts4=0
-winver4=0
-maxres4=4
-swapeffect4=0
-title5=One Must Fall - Battlegrounds - Demo
-path5=D:\Games\One Must Fall - Battlegrounds - Demo\Engine\OMFBG.exe
-launchpath5=
-module5=
-opengllib5=
-notes5=
-registry5=
-ver5=0
-coord5=0
-flag5=136314914
-flagg5=1207959552
-flagh5=20
-flagi5=138412036
-flagj5=4224
-flagk5=65536
-tflag5=0
-initx5=0
-inity5=0
-minx5=0
-miny5=0
-maxx5=0
-maxy5=0
-posx5=50
-posy5=50
-sizx5=800
-sizy5=600
-maxfps5=0
-initts5=0
-winver5=0
-maxres5=-1
-swapeffect5=0
-title6=One Must Fall - Battlegrounds
-path6=D:\Games\One Must Fall - Battlegrounds\Engine\OMFBG.exe
-launchpath6=
-module6=core_module.dll
-opengllib6=
-notes6=
-registry6=
-ver6=0
-coord6=0
-flag6=136314915
-flagg6=1275068416
-flagh6=33554460
-flagi6=675283252
-flagj6=21120
-flagk6=458752
-tflag6=-2147477245
-initx6=0
-inity6=0
-minx6=0
-miny6=0
-maxx6=0
-maxy6=0
-posx6=50
-posy6=50
-sizx6=800
-sizy6=600
-maxfps6=0
-initts6=0
-winver6=0
-maxres6=-1
-swapeffect6=0
-title7=Geneforge 1 GOG
-path7=D:\Games\Geneforge GOG\Geneforge\Geneforge.exe
-launchpath7=
-module7=
-opengllib7=
-notes7=
-registry7=
-ver7=0
-coord7=0
-flag7=-2011160538
-flagg7=1241513984
-flagh7=20
-flagi7=138412036
-flagj7=4224
-flagk7=268500992
-tflag7=-2147477241
-initx7=0
-inity7=0
-minx7=0
-miny7=0
-maxx7=800
-maxy7=600
-posx7=50
-posy7=50
-sizx7=800
-sizy7=600
-maxfps7=0
-initts7=0
-winver7=0
-maxres7=-1
-swapeffect7=0
-title8=Geneforge 2 GOG
-path8=D:\Games\Geneforge GOG\Geneforge 2\Geneforge 2.exe
-launchpath8=
-module8=
-opengllib8=
-notes8=
-registry8=
-ver8=0
-coord8=0
-flag8=136315446
-flagg8=1207959552
-flagh8=20
-flagi8=138412036
-flagj8=4224
-flagk8=65536
-tflag8=-2147477245
-initx8=0
-inity8=0
-minx8=0
-miny8=0
-maxx8=800
-maxy8=600
-posx8=50
-posy8=50
-sizx8=800
-sizy8=600
-maxfps8=0
-initts8=0
-winver8=0
-maxres8=-1
-swapeffect8=0
-title9=Geneforge 3 GOG
-path9=D:\Games\Geneforge GOG\Geneforge 3\Geneforge 3.exe
-launchpath9=
-module9=
-opengllib9=
-notes9=
-registry9=
-ver9=0
-coord9=0
-flag9=136314886
-flagg9=1207959808
-flagh9=20
-flagi9=138412036
-flagj9=67113088
-flagk9=65536
-tflag9=0
-initx9=0
-inity9=0
-minx9=0
-miny9=0
-maxx9=0
-maxy9=0
-posx9=50
-posy9=50
-sizx9=800
-sizy9=600
-maxfps9=0
-initts9=0
-winver9=0
-maxres9=-1
-swapeffect9=0
-title10=Wizardry 8 (3DfX)
-path10=D:\Games\Wizardry 8\Wiz8.exe
-launchpath10=
-module10=
-opengllib10=
-notes10=
-registry10=
-ver10=9
-coord10=0
-flag10=134225922
-flagg10=1207959552
-flagh10=20
-flagi10=205520900
-flagj10=4224
-flagk10=0
-tflag10=0
-initx10=0
-inity10=0
-minx10=0
-miny10=0
-maxx10=0
-maxy10=0
-posx10=50
-posy10=50
-sizx10=800
-sizy10=600
-maxfps10=0
-initts10=0
-winver10=0
-maxres10=-1
-swapeffect10=0
-title11=Warcraft 2 Battlenet Ed
-path11=D:\Games\Warcraft 2 Battlenet Ed\Warcraft II BNE.exe
-launchpath11=
-module11=
-opengllib11=
-notes11=
-registry11=
-ver11=0
-coord11=0
-flag11=134221986
-flagg11=1207959552
-flagh11=20
-flagi11=138412036
-flagj11=128
-flagk11=0
-tflag11=0
-initx11=0
-inity11=0
-minx11=0
-miny11=0
-maxx11=0
-maxy11=0
-posx11=50
-posy11=50
-sizx11=800
-sizy11=600
-maxfps11=0
-initts11=0
-winver11=0
-maxres11=0
-swapeffect11=0
-title12=Star Wars Rogue Squadron 3D
-path12=D:\Games\rogue\Rogue Squadron.EXE
-launchpath12=
-module12=
-opengllib12=
-notes12=
-registry12=
-ver12=0
-coord12=0
-flag12=136314934
-flagg12=1207959552
-flagh12=20
-flagi12=138412038
-flagj12=4224
-flagk12=402718720
-tflag12=0
-initx12=0
-inity12=0
-minx12=0
-miny12=0
-maxx12=0
-maxy12=0
-posx12=50
-posy12=50
-sizx12=800
-sizy12=600
-maxfps12=0
-initts12=0
-winver12=0
-maxres12=-1
-swapeffect12=0
-title13=Dark Colony
-path13=D:\Games\DarkColony\DCOLONY\DC.EXE
-launchpath13=
-module13=
-opengllib13=
-notes13=
-registry13=
-ver13=0
-coord13=0
-flag13=134255138
-flagg13=1207963648
-flagh13=20
-flagi13=4194308
-flagj13=67108992
-flagk13=0
-tflag13=0
-initx13=0
-inity13=0
-minx13=0
-miny13=0
-maxx13=0
-maxy13=0
-posx13=50
-posy13=50
-sizx13=800
-sizy13=600
-maxfps13=20
-initts13=0
-winver13=0
-maxres13=-1
-swapeffect13=0
-title14=Empire of the Ants
-path14=D:\Games\Empire of the Ants\Game.exe
-launchpath14=
-module14=
-opengllib14=
-notes14=
-registry14=
-ver14=0
-coord14=0
-flag14=402669606
-flagg14=1207959552
-flagh14=20
-flagi14=4194308
-flagj14=128
-flagk14=65536
-tflag14=0
-initx14=0
-inity14=0
-minx14=0
-miny14=0
-maxx14=0
-maxy14=0
-posx14=50
-posy14=50
-sizx14=800
-sizy14=600
-maxfps14=0
-initts14=0
-winver14=0
-maxres14=-1
-swapeffect14=0
-title15=Paladin 3 RIP
-path15=D:\Games\QGPAL3\rungame.exe
-launchpath15=
-module15=
-opengllib15=
-notes15=
-registry15=
-ver15=0
-coord15=0
-flag15=136314914
-flagg15=1207959552
-flagh15=20
-flagi15=205520900
-flagj15=4224
-flagk15=65536
-tflag15=-2147477245
-initx15=0
-inity15=0
-minx15=0
-miny15=0
-maxx15=0
-maxy15=0
-posx15=50
-posy15=50
-sizx15=800
-sizy15=600
-maxfps15=0
-initts15=0
-winver15=0
-maxres15=-1
-swapeffect15=0
-title16=Revenant (GOG)
-path16=D:\Games\Revenant GOG\Revenant.exe
-launchpath16=D:\Games\Revenant GOG\Launcher.exe
-module16=
-opengllib16=
-notes16=
-registry16=
-ver16=0
-coord16=3
-flag16=1019216498
-flagg16=1207959552
-flagh16=20
-flagi16=138412036
-flagj16=134218368
-flagk16=2162696
-tflag16=-2147477245
-initx16=0
-inity16=0
-minx16=0
-miny16=0
-maxx16=0
-maxy16=0
-posx16=50
-posy16=50
-sizx16=800
-sizy16=600
-maxfps16=0
-initts16=0
-winver16=0
-maxres16=-1
-swapeffect16=0
-title17=Revenant.exe
-path17=D:\Games\Revenant GOG\Disk2\Revenant.exe
-launchpath17=
-module17=
-opengllib17=
-notes17=
-registry17=
-ver17=0
-coord17=0
-flag17=136314914
-flagg17=1207959552
-flagh17=20
-flagi17=134217732
-flagj17=4224
-flagk17=65536
-tflag17=0
-initx17=0
-inity17=0
-minx17=0
-miny17=0
-maxx17=0
-maxy17=0
-posx17=50
-posy17=50
-sizx17=800
-sizy17=600
-maxfps17=0
-initts17=0
-winver17=0
-maxres17=-1
-swapeffect17=0
-title18=Revenant - No Cd.exe
-path18=D:\Games\Revenant\Revenant - No Cd.exe
-launchpath18=
-module18=
-opengllib18=
-notes18=
-registry18=
-ver18=0
-coord18=0
-flag18=136314914
-flagg18=1207959552
-flagh18=20
-flagi18=138412036
-flagj18=4224
-flagk18=65536
-tflag18=-2147477245
-initx18=0
-inity18=0
-minx18=0
-miny18=0
-maxx18=0
-maxy18=0
-posx18=50
-posy18=50
-sizx18=800
-sizy18=600
-maxfps18=0
-initts18=0
-winver18=0
-maxres18=-1
-swapeffect18=0
-title19=Enemy Zero
-path19=F:\EZERO\EZERO.EXE
-launchpath19=
-module19=
-opengllib19=
-notes19=
-registry19=
-ver19=0
-coord19=0
-flag19=681574434
-flagg19=1207959552
-flagh19=20
-flagi19=138412036
-flagj19=4224
-flagk19=65536
-tflag19=-2147477245
-initx19=0
-inity19=0
-minx19=0
-miny19=0
-maxx19=0
-maxy19=0
-posx19=50
-posy19=50
-sizx19=800
-sizy19=600
-maxfps19=0
-initts19=0
-winver19=0
-maxres19=-1
-swapeffect19=0
-title20=Revenant ICD GOG
-path20=D:\Games\Revenant GOG\Revenant.icd
-launchpath20=
-module20=
-opengllib20=
-notes20=
-registry20=
-ver20=0
-coord20=0
-flag20=681574434
-flagg20=1207959552
-flagh20=20
-flagi20=138412036
-flagj20=4224
-flagk20=65536
-tflag20=0
-initx20=0
-inity20=0
-minx20=0
-miny20=0
-maxx20=0
-maxy20=0
-posx20=50
-posy20=50
-sizx20=800
-sizy20=600
-maxfps20=0
-initts20=0
-winver20=0
-maxres20=-1
-swapeffect20=0
-title21=Geneforge 4 (Steam)
-path21=D:\Program Files (x86)\Steam\SteamApps\common\Geneforge 4\Geneforge 4.exe
-launchpath21=
-module21=
-opengllib21=
-notes21=
-registry21=
-ver21=0
-coord21=0
-flag21=136314934
-flagg21=1207959552
-flagh21=20
-flagi21=138412036
-flagj21=5248
-flagk21=65536
-tflag21=0
-initx21=0
-inity21=0
-minx21=0
-miny21=0
-maxx21=1024
-maxy21=768
-posx21=50
-posy21=50
-sizx21=800
-sizy21=600
-maxfps21=0
-initts21=0
-winver21=0
-maxres21=-1
-swapeffect21=0
-title22=Geneforge (Steam)
-path22=D:\Program Files (x86)\Steam\SteamApps\common\Geneforge\Geneforge.exe
-launchpath22=
-module22=
-opengllib22=
-notes22=
-registry22=
-ver22=0
-coord22=0
-flag22=136314902
-flagg22=1207959552
-flagh22=20
-flagi22=138412036
-flagj22=4224
-flagk22=65536
-tflag22=-2147477237
-initx22=400
-inity22=300
-minx22=0
-miny22=0
-maxx22=800
-maxy22=600
-posx22=50
-posy22=50
-sizx22=800
-sizy22=600
-maxfps22=0
-initts22=0
-winver22=0
-maxres22=-1
-swapeffect22=0
-title23=Geneforge 2 (Steam)
-path23=D:\Program Files (x86)\Steam\SteamApps\common\Geneforge 2\Geneforge 2.exe
-launchpath23=
-module23=
-opengllib23=
-notes23=
-registry23=
-ver23=0
-coord23=0
-flag23=136314886
-flagg23=1207959552
-flagh23=20
-flagi23=138412036
-flagj23=4224
-flagk23=268503040
-tflag23=-2147477245
-initx23=0
-inity23=0
-minx23=0
-miny23=0
-maxx23=0
-maxy23=0
-posx23=50
-posy23=50
-sizx23=800
-sizy23=600
-maxfps23=0
-initts23=0
-winver23=0
-maxres23=-1
-swapeffect23=0
-title24=Geneforge 3 (Steam)
-path24=D:\Program Files (x86)\Steam\SteamApps\common\Geneforge 3\Geneforge 3.exe
-launchpath24=
-module24=
-opengllib24=
-notes24=
-registry24=
-ver24=0
-coord24=0
-flag24=136314886
-flagg24=1207959552
-flagh24=20
-flagi24=138412036
-flagj24=4224
-flagk24=268500992
-tflag24=0
-initx24=0
-inity24=0
-minx24=0
-miny24=0
-maxx24=0
-maxy24=0
-posx24=50
-posy24=50
-sizx24=800
-sizy24=600
-maxfps24=0
-initts24=0
-winver24=0
-maxres24=-1
-swapeffect24=0
-title25=LEGO Pirates
-path25=d:\Games\Disney Interactive Studios\LEGOŽ Pirates\LEGOPirates.exe
-launchpath25=
-module25=
-opengllib25=
-notes25=
-registry25=
-ver25=9
-coord25=0
-flag25=136314914
-flagg25=1207959552
-flagh25=20
-flagi25=138412036
-flagj25=4224
-flagk25=65536
-tflag25=0
-initx25=0
-inity25=0
-minx25=0
-miny25=0
-maxx25=0
-maxy25=0
-posx25=50
-posy25=50
-sizx25=800
-sizy25=600
-maxfps25=0
-initts25=0
-winver25=0
-maxres25=-1
-swapeffect25=0
-title26=Deadlock II
-path26=D:\Games\deadlock II\DEADLOCK.EXE
-launchpath26=
-module26=
-opengllib26=
-notes26=
-registry26=
-ver26=7
-coord26=0
-flag26=-1996488672
-flagg26=1209008128
-flagh26=20
-flagi26=138420228
-flagj26=67108992
-flagk26=0
-tflag26=0
-initx26=0
-inity26=0
-minx26=0
-miny26=0
-maxx26=0
-maxy26=0
-posx26=50
-posy26=50
-sizx26=800
-sizy26=600
-maxfps26=0
-initts26=0
-winver26=0
-maxres26=-1
-swapeffect26=0
-title27=Swat 3
-path27=D:\Games\SWAT3\SWAT.EXE
-launchpath27=
-module27=
-opengllib27=
-notes27=
-registry27=
-ver27=0
-coord27=0
-flag27=136314914
-flagg27=1209008128
-flagh27=20
-flagi27=138412036
-flagj27=4224
-flagk27=65536
-tflag27=-2147477245
-initx27=0
-inity27=0
-minx27=0
-miny27=0
-maxx27=0
-maxy27=0
-posx27=50
-posy27=50
-sizx27=800
-sizy27=600
-maxfps27=0
-initts27=0
-winver27=0
-maxres27=-1
-swapeffect27=0
-title28=Swat 3 (GOG)
-path28=D:\Games\SWAT 3 (GOG)\game\swat.exe
-launchpath28=
-module28=
-opengllib28=
-notes28=
-registry28=
-ver28=1
-coord28=0
-flag28=136314914
-flagg28=1207959552
-flagh28=20
-flagi28=138412036
-flagj28=4224
-flagk28=65536
-tflag28=-2147477245
-initx28=0
-inity28=0
-minx28=0
-miny28=0
-maxx28=0
-maxy28=0
-posx28=50
-posy28=50
-sizx28=800
-sizy28=600
-maxfps28=0
-initts28=0
-winver28=0
-maxres28=-1
-swapeffect28=0
diff --git a/build/exports/Alien Swarm (Steam).dxw b/build/exports/Alien Swarm (Steam).dxw
new file mode 100644
index 0000000..a58f74a
--- /dev/null
+++ b/build/exports/Alien Swarm (Steam).dxw
@@ -0,0 +1,32 @@
+[target]
+title0=Alien Swarm (Steam)
+path0=D:\Program Files (x86)\Steam\SteamApps\common\Alien Swarm\swarm.exe
+launchpath0=
+module0=
+opengllib0=
+notes0=
+registry0=
+ver0=0
+coord0=0
+flag0=136314914
+flagg0=1744830464
+flagh0=20
+flagi0=138412038
+flagj0=4224
+flagk0=65536
+tflag0=0
+initx0=0
+inity0=0
+minx0=0
+miny0=0
+maxx0=0
+maxy0=0
+posx0=50
+posy0=50
+sizx0=800
+sizy0=600
+maxfps0=0
+initts0=5
+winver0=0
+maxres0=-1
+swapeffect0=0
diff --git a/build/exports/Avadon 2 The Corruption (Steam).dxw b/build/exports/Avadon 2 The Corruption (Steam).dxw
new file mode 100644
index 0000000..b8f23df
--- /dev/null
+++ b/build/exports/Avadon 2 The Corruption (Steam).dxw
@@ -0,0 +1,32 @@
+[target]
+title0=Avadon 2: The Corruption (Steam)
+path0=D:\Program Files (x86)\Steam\SteamApps\common\Avadon 2\Avadon 2.exe
+launchpath0=
+module0=
+opengllib0=
+notes0=
+registry0=
+ver0=12
+coord0=0
+flag0=136314918
+flagg0=1208090624
+flagh0=20
+flagi0=138412038
+flagj0=4224
+flagk0=65536
+tflag0=0
+initx0=0
+inity0=0
+minx0=0
+miny0=0
+maxx0=0
+maxy0=0
+posx0=50
+posy0=50
+sizx0=800
+sizy0=600
+maxfps0=0
+initts0=0
+winver0=0
+maxres0=-1
+swapeffect0=0
diff --git a/build/exports/Avadon the Black Fortress (Steam).dxw b/build/exports/Avadon the Black Fortress (Steam).dxw
new file mode 100644
index 0000000..151602d
--- /dev/null
+++ b/build/exports/Avadon the Black Fortress (Steam).dxw
@@ -0,0 +1,32 @@
+[target]
+title0=Avadon the Black Fortress (Steam)
+path0=D:\Program Files (x86)\Steam\SteamApps\common\Avadon The Black Fortress\Avadon.exe
+launchpath0=
+module0=
+opengllib0=
+notes0=
+registry0=
+ver0=12
+coord0=0
+flag0=136314918
+flagg0=1208090624
+flagh0=20
+flagi0=138412038
+flagj0=4224
+flagk0=65536
+tflag0=0
+initx0=0
+inity0=0
+minx0=0
+miny0=0
+maxx0=0
+maxy0=0
+posx0=50
+posy0=50
+sizx0=800
+sizy0=600
+maxfps0=0
+initts0=0
+winver0=0
+maxres0=-1
+swapeffect0=0
diff --git a/build/exports/Avernum 2 Crystal Souls (Steam).dxw b/build/exports/Avernum 2 Crystal Souls (Steam).dxw
new file mode 100644
index 0000000..375af34
--- /dev/null
+++ b/build/exports/Avernum 2 Crystal Souls (Steam).dxw
@@ -0,0 +1,32 @@
+[target]
+title0=Avernum 2: Crystal Souls (Steam)
+path0=D:\Program Files (x86)\Steam\SteamApps\common\Avernum 2 Crystal Souls\Avernum 2.exe
+launchpath0=
+module0=
+opengllib0=
+notes0=
+registry0=
+ver0=12
+coord0=0
+flag0=136314918
+flagg0=1208090624
+flagh0=20
+flagi0=138412038
+flagj0=4224
+flagk0=65536
+tflag0=0
+initx0=0
+inity0=0
+minx0=0
+miny0=0
+maxx0=0
+maxy0=0
+posx0=50
+posy0=50
+sizx0=800
+sizy0=600
+maxfps0=0
+initts0=0
+winver0=0
+maxres0=-1
+swapeffect0=0
diff --git a/build/exports/Avernum 4 (Steam).dxw b/build/exports/Avernum 4 (Steam).dxw
new file mode 100644
index 0000000..1f7fcf5
--- /dev/null
+++ b/build/exports/Avernum 4 (Steam).dxw
@@ -0,0 +1,32 @@
+[target]
+title0=Avernum 4 (Steam)
+path0=D:\Program Files (x86)\Steam\SteamApps\common\Avernum 4\Avernum 4.exe
+launchpath0=
+module0=
+opengllib0=
+notes0=
+registry0=
+ver0=0
+coord0=0
+flag0=136314934
+flagg0=1208090624
+flagh0=20
+flagi0=138412038
+flagj0=4224
+flagk0=-2147418112
+tflag0=0
+initx0=0
+inity0=0
+minx0=0
+miny0=0
+maxx0=0
+maxy0=0
+posx0=50
+posy0=50
+sizx0=800
+sizy0=600
+maxfps0=0
+initts0=0
+winver0=0
+maxres0=-1
+swapeffect0=0
diff --git a/build/exports/Avernum 5 (Steam).dxw b/build/exports/Avernum 5 (Steam).dxw
new file mode 100644
index 0000000..167ea48
--- /dev/null
+++ b/build/exports/Avernum 5 (Steam).dxw
@@ -0,0 +1,32 @@
+[target]
+title0=Avernum 5 (Steam)
+path0=D:\Program Files (x86)\Steam\SteamApps\common\Avernum 5\Avernum 5.exe
+launchpath0=
+module0=
+opengllib0=
+notes0=
+registry0=
+ver0=0
+coord0=0
+flag0=136314934
+flagg0=1208090624
+flagh0=20
+flagi0=138412038
+flagj0=4224
+flagk0=-2147418112
+tflag0=0
+initx0=0
+inity0=0
+minx0=0
+miny0=0
+maxx0=0
+maxy0=0
+posx0=50
+posy0=50
+sizx0=800
+sizy0=600
+maxfps0=0
+initts0=0
+winver0=0
+maxres0=-1
+swapeffect0=0
diff --git a/build/exports/Avernum 6 (Steam).dxw b/build/exports/Avernum 6 (Steam).dxw
new file mode 100644
index 0000000..d36a9fe
--- /dev/null
+++ b/build/exports/Avernum 6 (Steam).dxw
@@ -0,0 +1,32 @@
+[target]
+title0=Avernum 6 (Steam)
+path0=D:\Program Files (x86)\Steam\SteamApps\common\Avernum 6\Avernum 6.exe
+launchpath0=
+module0=
+opengllib0=
+notes0=
+registry0=
+ver0=0
+coord0=0
+flag0=136314934
+flagg0=1208090624
+flagh0=20
+flagi0=138412038
+flagj0=4224
+flagk0=-2147418112
+tflag0=0
+initx0=0
+inity0=0
+minx0=0
+miny0=0
+maxx0=0
+maxy0=0
+posx0=50
+posy0=50
+sizx0=800
+sizy0=600
+maxfps0=0
+initts0=0
+winver0=0
+maxres0=-1
+swapeffect0=0
diff --git a/build/exports/Avernum Escape From the Pit (Steam).dxw b/build/exports/Avernum Escape From the Pit (Steam).dxw
new file mode 100644
index 0000000..9010d42
--- /dev/null
+++ b/build/exports/Avernum Escape From the Pit (Steam).dxw
@@ -0,0 +1,32 @@
+[target]
+title0=Avernum: Escape From the Pit (Steam)
+path0=D:\Program Files (x86)\Steam\SteamApps\common\Avernum Escape From the Pit\Avernum.exe
+launchpath0=
+module0=
+opengllib0=
+notes0=
+registry0=
+ver0=12
+coord0=0
+flag0=136314918
+flagg0=1208090624
+flagh0=20
+flagi0=138412038
+flagj0=4224
+flagk0=65536
+tflag0=0
+initx0=0
+inity0=0
+minx0=0
+miny0=0
+maxx0=0
+maxy0=0
+posx0=50
+posy0=50
+sizx0=800
+sizy0=600
+maxfps0=0
+initts0=0
+winver0=0
+maxres0=-1
+swapeffect0=0
diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt
index 338695e..f794ba1 100644
--- a/build/readme-relnotes.txt
+++ b/build/readme-relnotes.txt
@@ -1000,4 +1000,13 @@ fix: more accurate hooking of ddraw pointers - fixes several DD_GENERIC_ERROR in
fix: improvements (not finished) in dinput handling
add: the OS version info is traced in the log file
fix: added cursor clipping when requested on new main window creation
-fix: handling of cursor clipping when the window gain/lose focus threough DefWindowProc message handling
\ No newline at end of file
+fix: handling of cursor clipping when the window gain/lose focus threough DefWindowProc message handling
+
+v2.03.51
+fix: WinXP select file dialog bug, not appearing if pointing to nonexistent directory
+fix: export file bug - now forces the file to have a .dxw extension
+fix: eliminated 6 useless fields in dinput handling, now their value is calculated automatically and at runtime
+add: DirectInput / "Emulate mouse relative movement". Eliminates the fake clipped regions inside the window (fix Geneforge series)
+fix: directinput mouse mode (absolute vs. relative) now correctly checked using the mouse device
+fix: attempt to fix FIXMOVIESCOLOR flag for 32BPP target color depth, but it doesn't still work on Win10
+fix: directinput RELEASEMOUSE flag applied to mouse device only
diff --git a/dll/advapi.cpp b/dll/advapi.cpp
index 93f484f..ecea63b 100644
--- a/dll/advapi.cpp
+++ b/dll/advapi.cpp
@@ -26,7 +26,7 @@ static HookEntry_Type Hooks[]={
{HOOK_IAT_CANDIDATE, "RegEnumValueA", NULL, (FARPROC *)&pRegEnumValueA, (FARPROC)extRegEnumValueA},
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
};
-
+
void HookAdvApi32(HMODULE module)
{
HookLibrary(module, Hooks, "ADVAPI32.dll");
diff --git a/dll/avifile.cpp b/dll/avifile.cpp
index 7b1c729..a4a98b3 100644
--- a/dll/avifile.cpp
+++ b/dll/avifile.cpp
@@ -76,7 +76,10 @@ PGETFRAME WINAPI extAVIStreamGetFrameOpen(PAVISTREAM pavi, LPBITMAPINFOHEADER lp
biWanted.biSize = sizeof(BITMAPINFOHEADER);
biWanted.biBitCount = (WORD)dxw.VirtualPixelFormat.dwRGBBitCount;
biWanted.biPlanes = 1;
+ if(biWanted.biBitCount < 32)
biWanted.biClrUsed = (0x1 << biWanted.biBitCount); // 8 -> 256;
+ else
+ biWanted.biClrUsed = 0;
biWanted.biClrImportant = biWanted.biClrUsed;
return (*pAVIStreamGetFrameOpen)(pavi, &biWanted);
}
diff --git a/dll/ddproxy.cpp b/dll/ddproxy.cpp
index 50af319..5903134 100644
--- a/dll/ddproxy.cpp
+++ b/dll/ddproxy.cpp
@@ -356,6 +356,7 @@ int HookDDProxy(HMODULE module, int dxVersion)
case 1:
case 2:
case 3:
+ case 4:
case 5:
case 6:
hinst = LoadLibrary("ddraw.dll");
diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp
index 311df0b..cd8b934 100644
--- a/dll/ddraw.cpp
+++ b/dll/ddraw.cpp
@@ -405,7 +405,7 @@ static CHAR *LogSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line)
static void DumpPixFmt(LPDDSURFACEDESC2 lpdds)
{
- OutTrace("PixelFormat: lpddsd=%x %s\n", DumpPixelFormat(lpdds));
+ OutTrace("PixelFormat: lpdds=%x %s\n", DumpPixelFormat(lpdds));
}
void DescribeSurface(LPDIRECTDRAWSURFACE lpdds, int dxversion, char *label, int line)
diff --git a/dll/dinput.cpp b/dll/dinput.cpp
index c404502..8b3a898 100644
--- a/dll/dinput.cpp
+++ b/dll/dinput.cpp
@@ -18,6 +18,8 @@
#define DIDEVTYPE_JOYSTICK 4
#endif
+extern BOOL WINAPI extGetCursorPos(LPPOINT);
+
typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID, LPVOID *);
typedef HRESULT (WINAPI *DirectInputCreate_Type)(HINSTANCE, DWORD, LPDIRECTINPUT *, LPUNKNOWN);
typedef HRESULT (WINAPI *DirectInputCreateEx_Type)(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN);
@@ -87,10 +89,25 @@ int iCurMinY;
int iCurMaxX;
int iCurMaxY;
+LPDIRECTINPUTDEVICE lpDIDDevice = NULL;
LPDIRECTINPUTDEVICE lpDIDKeyboard = NULL;
LPDIRECTINPUTDEVICE lpDIDSysMouse = NULL;
LPDIRECTINPUTDEVICE lpDIDJoystick = NULL;
+static char *sDevice(LPDIRECTINPUTDEVICE lpdid)
+{
+ char *ret;
+ ret = NULL;
+ if(lpdid==lpDIDDevice) ret = "Device";
+ if(lpdid==lpDIDKeyboard) ret = "Keyboard";
+ if(lpdid==lpDIDSysMouse) ret = "Mouse";
+ if(lpdid==lpDIDJoystick) ret = "Joystick";
+ if (ret)
+ return ret;
+ else
+ return (lpdid ? "unknown" : "NULL");
+}
+
void HookDirectInput(HMODULE module)
{
const GUID di7 = {0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE};
@@ -286,7 +303,8 @@ HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPU
SetHook((void *)(**(DWORD **)lplpdid + 52), extDISetCooperativeLevel, (void **)&pDISetCooperativeLevel, "SetCooperativeLevel(I)");
switch(iDeviceType(rguid)){
- case DIDEVTYPE_MOUSE: lpDIDSysMouse = *lplpdid; break;
+ case DIDEVTYPE_DEVICE: lpDIDDevice = *lplpdid; break;
+ case DIDEVTYPE_MOUSE: lpDIDSysMouse = *lplpdid; break;
case DIDEVTYPE_KEYBOARD: lpDIDKeyboard = *lplpdid; break;
case DIDEVTYPE_JOYSTICK: lpDIDJoystick = *lplpdid; break;
}
@@ -314,7 +332,8 @@ HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid,
SetHook((void *)(**(DWORD **)pvout + 52), extDISetCooperativeLevel, (void **)&pDISetCooperativeLevel, "SetCooperativeLevel(I)");
switch(iDeviceType(rguid)){
- case DIDEVTYPE_MOUSE: lpDIDSysMouse = *(LPDIRECTINPUTDEVICE *)pvout; break;
+ case DIDEVTYPE_DEVICE: lpDIDDevice = *(LPDIRECTINPUTDEVICE *)pvout; break;
+ case DIDEVTYPE_MOUSE: lpDIDSysMouse = *(LPDIRECTINPUTDEVICE *)pvout; break;
case DIDEVTYPE_KEYBOARD: lpDIDKeyboard = *(LPDIRECTINPUTDEVICE *)pvout; break;
case DIDEVTYPE_JOYSTICK: lpDIDJoystick = *(LPDIRECTINPUTDEVICE *)pvout; break;
}
@@ -347,8 +366,8 @@ HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPVOID
unsigned int i;
POINT p;
- OutTraceDW("GetDeviceData(I): did=%x cbdata=%i rgdod=%x, inout=%d flags=%x\n",
- lpdid, cbdata, rgdod, *pdwinout, dwflags);
+ OutTraceDW("GetDeviceData(I): did=%x(%s) cbdata=%i rgdod=%x, inout=%d flags=%x\n",
+ lpdid, sDevice(lpdid), cbdata, rgdod, *pdwinout, dwflags);
res = (*pGetDeviceData)(lpdid, cbdata, rgdod, pdwinout, dwflags);
switch(res){
@@ -370,22 +389,22 @@ HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPVOID
return DI_OK;
}
- if(dxw.dwFlags4 & RELEASEMOUSE){
- POINT curr;
- RECT client;
- extern GetCursorPos_Type pGetCursorPos;
- extern GetClientRect_Type pGetClientRect;
- extern ScreenToClient_Type pScreenToClient;
- (*pGetCursorPos)(&curr);
- (*pScreenToClient)(dxw.GethWnd(), &curr);
- (*pGetClientRect)(dxw.GethWnd(), &client);
- if ((curr.x < client.left) || (curr.y < client.top) || (curr.x > client.right) || (curr.y > client.bottom)){
- *pdwinout = 0;
- return DI_OK;
+ if(lpdid == lpDIDSysMouse){
+ if(dxw.dwFlags4 & RELEASEMOUSE) {
+ POINT curr;
+ RECT client;
+ extern GetCursorPos_Type pGetCursorPos;
+ extern GetClientRect_Type pGetClientRect;
+ extern ScreenToClient_Type pScreenToClient;
+ (*pGetCursorPos)(&curr);
+ (*pScreenToClient)(dxw.GethWnd(), &curr);
+ (*pGetClientRect)(dxw.GethWnd(), &client);
+ if ((curr.x < client.left) || (curr.y < client.top) || (curr.x > client.right) || (curr.y > client.bottom)){
+ *pdwinout = 0;
+ return DI_OK;
+ }
}
- }
- if(cbdata == 20 || cbdata == 24 || cbdata == 16){
tmp = (BYTE *)rgdod;
if(dxw.bDInputAbs){
GetMousePosition((int *)&p.x, (int *)&p.y);
@@ -404,7 +423,6 @@ HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPVOID
}
}
}
-
return DI_OK;
}
@@ -413,7 +431,7 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO
HRESULT res;
POINT p = {0, 0};
- OutTraceDW("GetDeviceState(I): did=%x cbData=%i,%i\n", lpdid, cbdata, dxw.bActive);
+ OutTraceDW("GetDeviceState(I): did=%x(%s) cbData=%i,%i\n", lpdid, sDevice(lpdid), cbdata, dxw.bActive);
res = (*pGetDeviceState)(lpdid, cbdata, lpvdata);
@@ -440,44 +458,41 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO
break;
}
- if( cbdata == sizeof(DIMOUSESTATE) || cbdata == sizeof(DIMOUSESTATE2)
- // || cbdata == sizeof(DIJOYSTATE) || cbdata == sizeof(DIJOYSTATE2)
- ){
- int iMaxX, iMaxY, iMinX, iMinY;
- if(dxw.dwFlags1 & MODIFYMOUSE){
- iMinX = iCurMinX ? iCurMinX : 0;
- iMaxX = iCurMaxX ? iCurMaxX : dxw.GetScreenWidth();
- iMinY = iCurMinY ? iCurMinY : 0;
- iMaxY = iCurMaxY ? iCurMaxY : dxw.GetScreenHeight();
- }
- else {
- RECT WinRect = dxw.GetMainWindow();
- iMinX = iCurMinX ? iCurMinX : WinRect.left;
- iMaxX = iCurMaxX ? iCurMaxX : WinRect.right;
- iMinY = iCurMinY ? iCurMinY : WinRect.top;
- iMaxY = iCurMaxY ? iCurMaxY : WinRect.bottom;
- }
- OutTraceB("GetDeviceState(I): CLIP (%d,%d)-(%d,%d)\n", iMinX, iMinY, iMaxX, iMaxY);
- GetMousePosition((int *)&p.x, (int *)&p.y);
- lpvdata->lX = p.x;
- lpvdata->lY = p.y;
- if(!dxw.bDInputAbs){
- if(p.x < iMinX) p.x = iMinX;
- if(p.x > iMaxX) p.x = iMaxX;
- if(p.y < iMinY) p.y = iMinY;
- if(p.y > iMaxY) p.y = iMaxY;
- lpvdata->lX = p.x - iCursorX;
- lpvdata->lY = p.y - iCursorY;
- iCursorX = p.x;
- iCursorY = p.y;
- }
+ if( cbdata == sizeof(DIMOUSESTATE) || cbdata == sizeof(DIMOUSESTATE2)){
+
if(!dxw.bActive){
lpvdata->lZ = 0;
*(DWORD *)lpvdata->rgbButtons = 0;
+ OutTraceB("GetDeviceState(I): DEBUG cleared mousestate=(%d,%d)\n", p.x, p.y);
+ return DI_OK;
+ }
+
+ if(dxw.bDInputAbs){ // absolute position
+ POINT p;
+ extGetCursorPos(&p);
+ lpvdata->lX = p.x;
+ lpvdata->lY = p.y;
+ OutTraceDW("GetMousePosition(I): x,y=(%d,%d)\n", p.x, p.y);
+ }
+ else { // relative position
+ if(dxw.dwFlags6 & EMULATERELMOUSE){
+ int iMaxX, iMaxY, iMinX, iMinY;
+ RECT WinRect = dxw.GetMainWindow();
+ iMinX = WinRect.left;
+ iMaxX = WinRect.right;
+ iMinY = WinRect.top;
+ iMaxY = WinRect.bottom;
+ iCursorX = (iMaxX+iMinX)/2;
+ iCursorY = (iMaxY+iMinY)/2;
+ OutTraceB("GetDeviceState(I): RELATIVE clip=(%d,%d)-(%d,%d) pos=(%d,%d)\n", iMinX, iMinY, iMaxX, iMaxY, iCursorX, iCursorY);
+ (*pGetCursorPos)(&p);
+ lpvdata->lX = p.x - iCursorX;
+ lpvdata->lY = p.y - iCursorY;
+ (*pSetCursorPos)(iCursorX, iCursorY);
+ }
}
- OutTraceB("GetDeviceState(I): DEBUG cleared mousestate=(%d,%d)\n", p.x, p.y);
}
-
+
// SysKeybd device
if(cbdata == 256 && !dxw.bActive) {
ZeroMemory(lpvdata, 256);
@@ -528,8 +543,8 @@ static char *ExplainDataFormatFlags(DWORD f)
HRESULT WINAPI extSetDataFormat(LPDIRECTINPUTDEVICE lpdid, LPCDIDATAFORMAT lpdf)
{
- OutTraceDW("SetDataFormat(I): did=%x lpdf=%x size=%d objsize=%d flags=0x%x(%s) datasize=%d numobjects=%d\n",
- lpdid, lpdf, lpdf->dwSize, lpdf->dwObjSize, lpdf->dwFlags, ExplainDataFormatFlags(lpdf->dwFlags), lpdf->dwDataSize, lpdf->dwNumObjs);
+ OutTraceDW("SetDataFormat(I): did=%x(%s) lpdf=%x size=%d objsize=%d flags=0x%x(%s) datasize=%d numobjects=%d\n",
+ lpdid, sDevice(lpdid), lpdf, lpdf->dwSize, lpdf->dwObjSize, lpdf->dwFlags, ExplainDataFormatFlags(lpdf->dwFlags), lpdf->dwDataSize, lpdf->dwNumObjs);
if(IsDebug){
DIOBJECTDATAFORMAT *df;
df = lpdf->rgodf;
@@ -539,8 +554,10 @@ HRESULT WINAPI extSetDataFormat(LPDIRECTINPUTDEVICE lpdid, LPCDIDATAFORMAT lpdf)
}
}
- if(lpdf->dwFlags & DIDF_ABSAXIS) dxw.bDInputAbs = 1;
- if(lpdf->dwFlags & DIDF_RELAXIS) dxw.bDInputAbs = 0;
+ if(lpdid == lpDIDSysMouse){
+ if(lpdf->dwFlags & DIDF_ABSAXIS) dxw.bDInputAbs = 1;
+ if(lpdf->dwFlags & DIDF_RELAXIS) dxw.bDInputAbs = 0;
+ }
return (*pSetDataFormat)(lpdid, lpdf);
}
@@ -548,8 +565,8 @@ HRESULT WINAPI extDISetCooperativeLevel(LPDIRECTINPUTDEVICE lpdid, HWND hwnd, DW
{
HRESULT res;
- OutTraceDW("SetCooperativeLevel(I): did=%x hwnd=%x flags=%x(%s)\n",
- lpdid, hwnd, dwflags, ExplainDICooperativeFlags(dwflags));
+ OutTraceDW("SetCooperativeLevel(I): did=%x(%s) hwnd=%x flags=%x(%s)\n",
+ lpdid, sDevice(lpdid), hwnd, dwflags, ExplainDICooperativeFlags(dwflags));
if(dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
//dwflags = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
@@ -576,18 +593,6 @@ void GetMousePosition(int *x, int *y)
OutTraceDW("GetMousePosition(I): x,y=(%d,%d)\n", *x, *y);
}
-void InitPosition(int x, int y, int minx, int miny, int maxx, int maxy)
-{
- iCursorX = x;
- iCursorY = y;
- iCursorXBuf = x;
- iCursorYBuf = y;
- iCurMinX = minx;
- iCurMinY = miny;
- iCurMaxX = maxx;
- iCurMaxY = maxy;
-}
-
typedef struct {
LPDIENUMDEVICESCALLBACK cb;
LPVOID arg;
@@ -628,7 +633,7 @@ HRESULT WINAPI extAcquire(LPDIRECTINPUTDEVICE lpdid)
{
HRESULT res;
res = (*pAcquire)(lpdid);
- OutTrace("Acquire(I): lpdid=%x res=%x(%s)\n", lpdid, res, ExplainDDError(res));
+ OutTrace("Acquire(I): lpdid=%x(%s) res=%x(%s)\n", lpdid, sDevice(lpdid), res, ExplainDDError(res));
return res;
}
@@ -636,7 +641,7 @@ HRESULT WINAPI extUnacquire(LPDIRECTINPUTDEVICE lpdid)
{
HRESULT res;
res = (*pUnacquire)(lpdid);
- OutTrace("Unacquire(I): lpdid=%x res=%x(%s)\n", lpdid, res, ExplainDDError(res));
+ OutTrace("Unacquire(I): lpdid=%x(%s) res=%x(%s)\n", lpdid, sDevice(lpdid), res, ExplainDDError(res));
return res;
}
diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp
index babb6a7..af65552 100644
--- a/dll/dxhook.cpp
+++ b/dll/dxhook.cpp
@@ -453,7 +453,7 @@ void SetHook(void *target, void *hookproc, void **hookedproc, char *hookname)
tmp=(void *)dwTmp;
if (*hookedproc && *hookedproc!=tmp) {
- sprintf(msg,"SetHook: proc=%s oldhook=%x newhook=%x\n", hookname, hookedproc, tmp);
+ sprintf(msg,"SetHook: proc=%s oldhook=%x->%x newhook=%x\n", hookname, hookedproc, *(DWORD *)hookedproc, tmp);
OutTraceDW(msg);
if (IsAssertEnabled) MessageBox(0, msg, "SetHook", MB_OK | MB_ICONEXCLAMATION);
}
@@ -1310,11 +1310,8 @@ void HookInit(TARGETMAP *target, HWND hwnd)
}
// make InitPosition used for both DInput and DDraw
- if(dxw.Windowize){
- InitPosition(target->initx, target->inity,
- target->minx, target->miny, target->maxx, target->maxy);
- dxw.InitWindowPos(target->posx, target->posy, target->sizx, target->sizy);
- }
+ if(dxw.Windowize) dxw.InitWindowPos(target->posx, target->posy, target->sizx, target->sizy);
+
OutTraceB("HookInit: base hmodule=%x\n", base);
HookModule(base, dxw.dwTargetDDVersion);
@@ -1346,7 +1343,7 @@ void HookInit(TARGETMAP *target, HWND hwnd)
hMouseHook=(*pSetWindowsHookEx)(WH_GETMESSAGE, MessageHook, hInst, GetCurrentThreadId());
if(hMouseHook==NULL) OutTraceE("SetWindowsHookEx WH_GETMESSAGE failed: error=%d\n", GetLastError());
}
-
+
InitScreenParameters();
if(hwnd) HookWindowProc(hwnd);
// in fullscreen mode, messages seem to reach and get processed by the parent window
@@ -1357,7 +1354,7 @@ void HookInit(TARGETMAP *target, HWND hwnd)
// 2) in Windowed mode and
// 3) supposedly in fullscreen mode (dxw.IsFullScreen()) and
// 4) configuration ask for a overlapped bordered window (dxw.dwFlags1 & FIXWINFRAME) then
- // update window styles: just this window or, when FIXPARENTWIN is set, the father one as well.
+ // update window styles: just this window or, when FIXPARENTWIN is set, the father one as well.
if (hwnd && dxw.Windowize && dxw.IsFullScreen() && (dxw.dwFlags1 & FIXWINFRAME)) {
dxw.FixWindowFrame(dxw.hChildWnd);
diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp
index 987aaa4..57178f7 100644
--- a/dll/dxwnd.cpp
+++ b/dll/dxwnd.cpp
@@ -1,7 +1,7 @@
/*
DXWnd/dxwnd.cpp
DirectX Hook Module
-Copyright(C) 2004-2011 SFB7/GHO
+Copyright(C) 2004-2016 SFB7/GHO
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ along with this program. If not, see .
#include "TlHelp32.h"
-#define VERSION "2.03.50"
+#define VERSION "2.03.51"
#define DDTHREADLOCK 1
//#define LOCKTHREADS
diff --git a/dll/dxwnd.suo b/dll/dxwnd.suo
deleted file mode 100644
index a6ba136..0000000
Binary files a/dll/dxwnd.suo and /dev/null differ
diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo
index 0f47bf7..54f9aab 100644
Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ
diff --git a/host/TabInput.cpp b/host/TabInput.cpp
index 721361c..9461dd6 100644
--- a/host/TabInput.cpp
+++ b/host/TabInput.cpp
@@ -46,12 +46,7 @@ void CTabInput::DoDataExchange(CDataExchange* pDX)
DDX_Check(pDX, IDC_HOOKDI, cTarget->m_HookDI);
DDX_Check(pDX, IDC_HOOKDI8, cTarget->m_HookDI8);
DDX_Check(pDX, IDC_UNACQUIRE, cTarget->m_Unacquire);
- DDX_Text(pDX, IDC_INITX, cTarget->m_InitX);
- DDX_Text(pDX, IDC_INITY, cTarget->m_InitY);
- DDX_Text(pDX, IDC_MAXX, cTarget->m_MaxX);
- DDX_Text(pDX, IDC_MAXY, cTarget->m_MaxY);
- DDX_Text(pDX, IDC_MINX, cTarget->m_MinX);
- DDX_Text(pDX, IDC_MINY, cTarget->m_MinY);
+ DDX_Check(pDX, IDC_EMULATERELMOUSE, cTarget->m_EmulateRelMouse);
// Message processing
DDX_Check(pDX, IDC_FILTERMESSAGES, cTarget->m_FilterMessages);
DDX_Check(pDX, IDC_PEEKALLMESSAGES, cTarget->m_PeekAllMessages);
diff --git a/host/TabProgram.cpp b/host/TabProgram.cpp
index fe54aa2..6e3a483 100644
--- a/host/TabProgram.cpp
+++ b/host/TabProgram.cpp
@@ -12,6 +12,14 @@
static char THIS_FILE[] = __FILE__;
#endif
+static BOOL dirExists(char *path)
+{
+ DWORD ftyp = GetFileAttributesA(path);
+ if (ftyp == INVALID_FILE_ATTRIBUTES) return FALSE; //something is wrong with your path!
+ if (ftyp & FILE_ATTRIBUTE_DIRECTORY) return TRUE; // this is a directory!
+ return false; // this is not a directory!
+}
+
/////////////////////////////////////////////////////////////////////////////
// CTabProgram dialog
@@ -73,6 +81,7 @@ void CTabProgram::OnOpen()
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
cTarget->m_File.GetWindowText(path, MAX_PATH);
GetPrivateProfileString("window", "exepath", NULL, path, MAX_PATH, gInitPath);
+ if(!dirExists(path)) strcpy(path, "");
CFileDialog dlg( TRUE, "*.*", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Program (*.exe)|*.exe|All Files (*.*)|*.*||", this);
if( dlg.DoModal() == IDOK) {
@@ -92,6 +101,7 @@ void CTabProgram::OnOpenLaunch()
CTargetDlg *cTarget = ((CTargetDlg *)(this->GetParent()->GetParent()));
cTarget->m_File.GetWindowText(path, MAX_PATH);
GetPrivateProfileString("window", "exepath", NULL, path, MAX_PATH, gInitPath);
+ if(!dirExists(path)) strcpy(path, "");
CFileDialog dlg( TRUE, "*.*", path, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"Program (*.exe)|*.exe|All Files (*.*)|*.*||", this);
if( dlg.DoModal() == IDOK) {
diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp
index 47c73ae..700ade6 100644
--- a/host/TargetDlg.cpp
+++ b/host/TargetDlg.cpp
@@ -29,6 +29,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_TextureHandling = 0;
m_HookDI = FALSE;
m_HookDI8 = FALSE;
+ m_EmulateRelMouse = FALSE; // ??
m_ModifyMouse = TRUE; // default true !!
m_VirtualJoystick = FALSE;
m_Unacquire = FALSE;
@@ -213,12 +214,6 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_NoTextures = FALSE;
m_BlackWhite = FALSE;
m_AssertDialog = FALSE;
- m_InitX = 0;
- m_InitY = 0;
- m_MaxX = 0;
- m_MaxY = 0;
- m_MinX = 0;
- m_MinY = 0;
m_PosX = 50;
m_PosY = 50;
m_SizX = 800;
diff --git a/host/TargetDlg.h b/host/TargetDlg.h
index b3dd9b4..f1b071b 100644
--- a/host/TargetDlg.h
+++ b/host/TargetDlg.h
@@ -34,6 +34,7 @@ public:
int m_SonProcessMode;
BOOL m_HookDI;
BOOL m_HookDI8;
+ BOOL m_EmulateRelMouse;
BOOL m_ModifyMouse;
BOOL m_VirtualJoystick;
BOOL m_Unacquire;
@@ -223,12 +224,6 @@ public:
BOOL m_ForceYUVtoRGB;
BOOL m_ForceRGBtoYUV;
BOOL m_LimitScreenRes;
- int m_InitX;
- int m_InitY;
- int m_MaxX;
- int m_MaxY;
- int m_MinX;
- int m_MinY;
int m_PosX;
int m_PosY;
int m_SizX;
diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps
index 3534894..78e3d2c 100644
Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ
diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc
index dda6bbc..4c19159 100644
Binary files a/host/dxwndhost.rc and b/host/dxwndhost.rc differ
diff --git a/host/dxwndhost.vs2008.suo b/host/dxwndhost.vs2008.suo
index ab24fcc..fb921d0 100644
Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ
diff --git a/host/dxwndhost.vs2008.vcproj b/host/dxwndhost.vs2008.vcproj
index 954da59..aea6d56 100644
--- a/host/dxwndhost.vs2008.vcproj
+++ b/host/dxwndhost.vs2008.vcproj
@@ -494,10 +494,6 @@
RelativePath=".\dxTabCtrl.h"
>
-
-
diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp
index 43b3779..1b13042 100644
--- a/host/dxwndhostView.cpp
+++ b/host/dxwndhostView.cpp
@@ -24,6 +24,7 @@ static char THIS_FILE[] = __FILE__;
#endif
#define WM_ICON_NOTIFY WM_APP+10
+#define strcasecmp lstrcmpi
extern UINT m_StartToTray;
extern UINT m_InitialState;
@@ -176,6 +177,8 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
t->flags4 = 0;
t->flags5 = 0;
t->flags6 = 0;
+ t->flags7 = 0;
+ t->flags8 = 0;
t->tflags = 0;
if(dlg->m_UnNotify) t->flags |= UNNOTIFY;
if(dlg->m_Windowize) t->flags2 |= WINDOWIZE;
@@ -248,6 +251,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_HookDI) t->flags |= HOOKDI;
if(dlg->m_HookDI8) t->flags |= HOOKDI8;
+ if(dlg->m_EmulateRelMouse) t->flags6 |= EMULATERELMOUSE;
if(dlg->m_ModifyMouse) t->flags |= MODIFYMOUSE;
if(dlg->m_VirtualJoystick) t->flags6 |= VIRTUALJOYSTICK;
if(dlg->m_Unacquire) t->flags6 |= UNACQUIRE;
@@ -411,12 +415,6 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
if(dlg->m_SyncPalette) t->flags6 |= SYNCPALETTE;
if(dlg->m_AnalyticMode) t->flags3 |= ANALYTICMODE;
if(dlg->m_ReplacePrivOps) t->flags5 |= REPLACEPRIVOPS;
- t->initx = dlg->m_InitX;
- t->inity = dlg->m_InitY;
- t->minx = dlg->m_MinX;
- t->miny = dlg->m_MinY;
- t->maxx = dlg->m_MaxX;
- t->maxy = dlg->m_MaxY;
t->posx = dlg->m_PosX;
t->posy = dlg->m_PosY;
t->sizx = dlg->m_SizX;
@@ -495,6 +493,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_HookDI = t->flags & HOOKDI ? 1 : 0;
dlg->m_HookDI8 = t->flags & HOOKDI8 ? 1 : 0;
+ dlg->m_EmulateRelMouse = t->flags6 & EMULATERELMOUSE ? 1 : 0;
dlg->m_ModifyMouse = t->flags & MODIFYMOUSE ? 1 : 0;
dlg->m_VirtualJoystick = t->flags6 & VIRTUALJOYSTICK ? 1 : 0;
dlg->m_Unacquire = t->flags6 & UNACQUIRE ? 1 : 0;
@@ -659,12 +658,6 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
dlg->m_SyncPalette = t->flags6 & SYNCPALETTE ? 1 : 0;
dlg->m_AnalyticMode = t->flags3 & ANALYTICMODE ? 1 : 0;
dlg->m_ReplacePrivOps = t->flags5 & REPLACEPRIVOPS ? 1 : 0;
- dlg->m_InitX = t->initx;
- dlg->m_InitY = t->inity;
- dlg->m_MinX = t->minx;
- dlg->m_MinY = t->miny;
- dlg->m_MaxX = t->maxx;
- dlg->m_MaxY = t->maxy;
dlg->m_PosX = t->posx;
dlg->m_PosY = t->posy;
dlg->m_SizX = t->sizx;
@@ -718,27 +711,21 @@ static void SaveConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i,
sprintf_s(key, sizeof(key), "flagk%i", i);
sprintf_s(val, sizeof(val), "%i", TargetMap->flags6);
WritePrivateProfileString("target", key, val, InitPath);
+ sprintf_s(key, sizeof(key), "flagl%i", i);
+ sprintf_s(val, sizeof(val), "%i", TargetMap->flags7);
+ WritePrivateProfileString("target", key, val, InitPath);
+ sprintf_s(key, sizeof(key), "flagm%i", i);
+ sprintf_s(val, sizeof(val), "%i", TargetMap->flags8);
+ WritePrivateProfileString("target", key, val, InitPath);
+ sprintf_s(key, sizeof(key), "flagl%i", i);
+ sprintf_s(val, sizeof(val), "%i", TargetMap->flags7);
+ WritePrivateProfileString("target", key, val, InitPath);
+ sprintf_s(key, sizeof(key), "flagm%i", i);
+ sprintf_s(val, sizeof(val), "%i", TargetMap->flags8);
+ WritePrivateProfileString("target", key, val, InitPath);
sprintf_s(key, sizeof(key), "tflag%i", i);
sprintf_s(val, sizeof(val), "%i", TargetMap->tflags);
WritePrivateProfileString("target", key, val, InitPath);
- sprintf_s(key, sizeof(key), "initx%i", i);
- sprintf_s(val, sizeof(val), "%i", TargetMap->initx);
- WritePrivateProfileString("target", key, val, InitPath);
- sprintf_s(key, sizeof(key), "inity%i", i);
- sprintf_s(val, sizeof(val), "%i", TargetMap->inity);
- WritePrivateProfileString("target", key, val, InitPath);
- sprintf_s(key, sizeof(key), "minx%i", i);
- sprintf_s(val, sizeof(val), "%i", TargetMap->minx);
- WritePrivateProfileString("target", key, val, InitPath);
- sprintf_s(key, sizeof(key), "miny%i", i);
- sprintf_s(val, sizeof(val), "%i", TargetMap->miny);
- WritePrivateProfileString("target", key, val, InitPath);
- sprintf_s(key, sizeof(key), "maxx%i", i);
- sprintf_s(val, sizeof(val), "%i", TargetMap->maxx);
- WritePrivateProfileString("target", key, val, InitPath);
- sprintf_s(key, sizeof(key), "maxy%i", i);
- sprintf_s(val, sizeof(val), "%i", TargetMap->maxy);
- WritePrivateProfileString("target", key, val, InitPath);
sprintf_s(key, sizeof(key), "posx%i", i);
sprintf_s(val, sizeof(val), "%i", TargetMap->posx);
WritePrivateProfileString("target", key, val, InitPath);
@@ -795,6 +782,10 @@ static void ClearTarget(int i, char *InitPath)
WritePrivateProfileString("target", key, 0, InitPath);
sprintf_s(key, sizeof(key), "flagk%i", i);
WritePrivateProfileString("target", key, 0, InitPath);
+ sprintf_s(key, sizeof(key), "flagl%i", i);
+ WritePrivateProfileString("target", key, 0, InitPath);
+ sprintf_s(key, sizeof(key), "flagm%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);
@@ -894,27 +885,15 @@ static int LoadConfigItem(TARGETMAP *TargetMap, PRIVATEMAP *PrivateMap, int i, c
sprintf_s(key, sizeof(key), "flagk%i", i);
TargetMap->flags6 = GetPrivateProfileInt("target", key, 0, InitPath);
// -------
+ sprintf_s(key, sizeof(key), "flagl%i", i);
+ TargetMap->flags7 = GetPrivateProfileInt("target", key, 0, InitPath);
+ // -------
+ sprintf_s(key, sizeof(key), "flagm%i", i);
+ TargetMap->flags8 = GetPrivateProfileInt("target", key, 0, InitPath);
+ // -------
sprintf_s(key, sizeof(key), "tflag%i", i);
TargetMap->tflags = GetPrivateProfileInt("target", key, 0, InitPath);
// -------
- sprintf_s(key, sizeof(key), "initx%i", i);
- TargetMap->initx = GetPrivateProfileInt("target", key, 0, InitPath);
- // -------
- sprintf_s(key, sizeof(key), "inity%i", i);
- TargetMap->inity = GetPrivateProfileInt("target", key, 0, InitPath);
- // -------
- sprintf_s(key, sizeof(key), "minx%i", i);
- TargetMap->minx = GetPrivateProfileInt("target", key, 0, InitPath);
- // -------
- sprintf_s(key, sizeof(key), "miny%i", i);
- TargetMap->miny = GetPrivateProfileInt("target", key, 0, InitPath);
- // -------
- sprintf_s(key, sizeof(key), "maxx%i", i);
- TargetMap->maxx = GetPrivateProfileInt("target", key, 0, InitPath);
- // -------
- sprintf_s(key, sizeof(key), "maxy%i", i);
- TargetMap->maxy = GetPrivateProfileInt("target", key, 0, InitPath);
- // -------
sprintf_s(key, sizeof(key), "posx%i", i);
TargetMap->posx = GetPrivateProfileInt("target", key, 0, InitPath);
// -------
@@ -1137,6 +1116,14 @@ void CDxwndhostView::OnExport()
DWORD TFlags;
TARGETMAP *TargetMap;
strcpy(path, dlg.GetPathName().GetBuffer());
+ // XP fix:
+ if(strlen(path)>4){
+ char *p;
+ p = &path[strlen(path-4)];
+ if(strcasecmp(p, ".dxw")) strcat(path, ".dxw");
+ }
+ else
+ strcat(path, ".dxw");
//MessageBox(path, "PathName", MB_OK);
// export with no trace flags active
TargetMap = &TargetMaps[i];
@@ -1385,8 +1372,6 @@ void CDxwndhostView::OnSetRegistry()
fclose(regfp);
}
-#define strcasecmp lstrcmpi
-
void CDxwndhostView::OnSort()
{
int i, itemcount;
diff --git a/host/resource b/host/resource
index bc9a140..205c43b 100644
Binary files a/host/resource and b/host/resource differ