diff --git a/Include/dxwnd.h b/Include/dxwnd.h index c39728d..325445f 100644 --- a/Include/dxwnd.h +++ b/Include/dxwnd.h @@ -183,6 +183,8 @@ // sixth flags DWORD dxw.dwFlags6: #define FORCESWAPEFFECT 0x00000001 // in D3D8/9, forces the SwapEffect value in CreateDevice/Reset operations +#define LEGACYALLOC 0x00000002 // reserve legacy memory segments +#define NODESTROYWINDOW 0x00000004 // suppress the main window destruction // logging Tflags DWORD: #define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general diff --git a/build/dxwnd.dll b/build/dxwnd.dll index 4761121..455008c 100644 --- a/build/dxwnd.dll +++ b/build/dxwnd.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:30f6a78ea3b87ee01aff8159e37ade8c64528ce94e51299d3f5e5b3f7c7e8276 -size 575488 +oid sha256:8b63cb25a2b2f543143293943a740859894c0a8b2ff156428c40376380a47a13 +size 577536 diff --git a/build/dxwnd.exe b/build/dxwnd.exe index 3002862..85bc625 100644 --- a/build/dxwnd.exe +++ b/build/dxwnd.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:292da547aea629cb8b159cd7ac8c768bdc915cdd4ecd294dbc0ec14097ec869c +oid sha256:c1bb172dc721bb8db528e064c3bc6acb78a0107c298e11368d28b36bb636dae6 size 539648 diff --git a/build/exports/dxwnd.ini b/build/dxwnd.ini similarity index 58% rename from build/exports/dxwnd.ini rename to build/dxwnd.ini index 823f159..7f729a0 100644 --- a/build/exports/dxwnd.ini +++ b/build/dxwnd.ini @@ -1,5 +1,5 @@ [window] -posx=1496 -posy=246 +posx=50 +posy=50 sizx=320 sizy=200 diff --git a/build/exports/Alone in the Dark the New Nightmare.dxw b/build/exports/Alone in the Dark the New Nightmare.dxw new file mode 100644 index 0000000..0a7a09a --- /dev/null +++ b/build/exports/Alone in the Dark the New Nightmare.dxw @@ -0,0 +1,31 @@ +[target] +title0=Alone in the Dark the New Nightmare +path0=D:\Games\Alone in the Dark\alone4.exe +launchpath0=D:\Games\Alone in the Dark\launch.exe +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=679477282 +flagg0=1207959568 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=0 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=1200 +sizy0=900 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 diff --git a/build/exports/Armor Command.dxw b/build/exports/Armor Command.dxw new file mode 100644 index 0000000..6a3648c --- /dev/null +++ b/build/exports/Armor Command.dxw @@ -0,0 +1,29 @@ +[target] +title0=Armor Command +path0=D:\Games\ArmCom\armrcmd.exe +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=671088674 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Battle Isle - the Andosia War.dxw b/build/exports/Battle Isle - the Andosia War.dxw new file mode 100644 index 0000000..69681e0 --- /dev/null +++ b/build/exports/Battle Isle - the Andosia War.dxw @@ -0,0 +1,31 @@ +[target] +title0=Battle Isle - the Andosia War +path0=D:\Games\Battle Isle - the Andosia War\BITAW.exe +launchpath0= +module0= +opengllib0= +notes0= +ver0=7 +coord0=0 +flag0=679477280 +flagg0=1207959552 +flagh0=20 +flagi0=136314884 +flagj0=134221952 +flagk0=0 +tflag0=6402 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 diff --git a/build/exports/Black Moon Chronicles.dxw b/build/exports/Black Moon Chronicles.dxw index ddb82ae..25618c3 100644 --- a/build/exports/Black Moon Chronicles.dxw +++ b/build/exports/Black Moon Chronicles.dxw @@ -8,8 +8,8 @@ coord0=0 flag0=134234146 flagg0=1207959568 flagh0=32788 -flagi0=4 -tflag0=6211 +flagi0=4194308 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -24,3 +24,8 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 +launchpath0= +notes0= +flagj0=128 +flagk0=0 +swapeffect0=0 diff --git a/build/exports/Corsairs Gold (GOG).dxw b/build/exports/Corsairs Gold (GOG).dxw new file mode 100644 index 0000000..f59eaa8 --- /dev/null +++ b/build/exports/Corsairs Gold (GOG).dxw @@ -0,0 +1,31 @@ +[target] +title0=Corsairs Gold +path0=D:\Games\Corsairs Gold\corsairs.patched.exe +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=134221858 +flagg0=1207959552 +flagh0=20 +flagi0=205520900 +flagj0=67108992 +flagk0=0 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 diff --git a/build/exports/Crusaders of Might and Magic (GOG).dxw b/build/exports/Crusaders of Might and Magic (GOG).dxw index 6038dc4..db7d088 100644 --- a/build/exports/Crusaders of Might and Magic (GOG).dxw +++ b/build/exports/Crusaders of Might and Magic (GOG).dxw @@ -4,15 +4,15 @@ path0=D:\Games\Crusaders of Might and Magic (GOG)\crusaders.exe launchpath0= module0=gfx_d3d gfx_sw opengllib0= -notes0=the ddraw.dll hooker in the game folder must be deleted or renamed \nto allow DxWnd to play the game. +notes0= ver0=0 coord0=0 flag0=-1467989966 -flagg0=1744830472 -flagh0=20 -flagi0=138412036 +flagg0=1209008640 +flagh0=65556 +flagi0=136314884 flagj0=4224 -tflag0=-2147477229 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -27,3 +27,5 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 +flagk0=2 +swapeffect0=0 diff --git a/build/exports/Crusaders of Might and Magic Demo.dxw b/build/exports/Crusaders of Might and Magic Demo.dxw index 4016a48..51cc1b4 100644 --- a/build/exports/Crusaders of Might and Magic Demo.dxw +++ b/build/exports/Crusaders of Might and Magic Demo.dxw @@ -8,11 +8,11 @@ notes0= ver0=0 coord0=0 flag0=-1467989966 -flagg0=1207959560 -flagh0=20 -flagi0=138412036 +flagg0=1207959552 +flagh0=1044 +flagi0=1212153860 flagj0=4224 -tflag0=6418 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -27,3 +27,5 @@ maxfps0=0 initts0=0 winver0=0 maxres0=-1 +flagk0=2 +swapeffect0=0 diff --git a/build/exports/Earth 2150.dxw b/build/exports/Earth 2150.dxw new file mode 100644 index 0000000..6951272 --- /dev/null +++ b/build/exports/Earth 2150.dxw @@ -0,0 +1,28 @@ +[target] +title0=Earth 2150 +path0=D:\Games\Earth 2150\Earth2150.exe +launchpath0= +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=136331298 +flagg0=1207959552 +flagh0=20 +flagi0=138412452 +flagj0=8322 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Hearts of Iron III.dxw b/build/exports/Hearts of Iron III.dxw new file mode 100644 index 0000000..172b8ee --- /dev/null +++ b/build/exports/Hearts of Iron III.dxw @@ -0,0 +1,28 @@ +[target] +title0=Hearts of Iron III +path0=D:\Games\Hearts of Iron III\hoi3game.exe +launchpath0= +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=704774688 +flagg0=1207959568 +flagh0=20 +flagi0=138412036 +flagj0=128 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Hexen95.dxw b/build/exports/Hexen95.dxw new file mode 100644 index 0000000..2ccc0f5 --- /dev/null +++ b/build/exports/Hexen95.dxw @@ -0,0 +1,29 @@ +[target] +title0=Hexen95 +path0=D:\Games\HEXEN95\HEXEN95.EXE +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=671088674 +flagg0=1207959552 +flagh0=65556 +flagi0=138412036 +flagj0=4224 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Hollywood Monsters.dxw b/build/exports/Hollywood Monsters.dxw index 0b4df23..4a4264d 100644 --- a/build/exports/Hollywood Monsters.dxw +++ b/build/exports/Hollywood Monsters.dxw @@ -9,7 +9,7 @@ flag0=134217762 flagg0=1209008384 flagh0=20 flagi0=4194308 -tflag0=64 +tflag0=0 initx0=0 inity0=0 minx0=0 @@ -25,3 +25,5 @@ initts0=0 winver0=0 maxres0=-1 launchpath0= +notes0= +flagj0=128 diff --git a/build/exports/Legend of the Prophet & Assassin, the.dxw b/build/exports/Legend of the Prophet & Assassin, the.dxw new file mode 100644 index 0000000..d53ab89 --- /dev/null +++ b/build/exports/Legend of the Prophet & Assassin, the.dxw @@ -0,0 +1,29 @@ +[target] +title0=Legend of the Prophet & Assassin, the +path0=D:\Games\La leggenda\Legend.exe +launchpath0= +module0= +opengllib0= +notes0= +ver0=1 +coord0=0 +flag0=134217762 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=67113088 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Moto Racer demo.dxw b/build/exports/Moto Racer demo.dxw new file mode 100644 index 0000000..ce248fb --- /dev/null +++ b/build/exports/Moto Racer demo.dxw @@ -0,0 +1,31 @@ +[target] +title0=Moto Racer demo +path0=D:\Games\Moto.Racer.demo\PlayDemo.exe +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=1207959680 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=0 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 diff --git a/build/exports/Myth the Fallen Lords.dxw b/build/exports/Myth the Fallen Lords.dxw new file mode 100644 index 0000000..6794e35 --- /dev/null +++ b/build/exports/Myth the Fallen Lords.dxw @@ -0,0 +1,29 @@ +[target] +title0=Myth the Fallen Lords +path0=D:\Games\myth\MYTH_TFL.EXE +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=2013265920 +flagh0=20 +flagi0=138412036 +flagj0=4224 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Prince of Persia 3D.dxw b/build/exports/Prince of Persia 3D.dxw new file mode 100644 index 0000000..98406a6 --- /dev/null +++ b/build/exports/Prince of Persia 3D.dxw @@ -0,0 +1,31 @@ +[target] +title0=Prince of Persia 3D +path0=D:\Games\Prince_of_Persia_3D\POP3D.exe +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=671105058 +flagg0=1209008128 +flagh0=20 +flagi0=136314885 +flagj0=128 +flagk0=4 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 diff --git a/build/exports/Puma World Football.dxw b/build/exports/Puma World Football.dxw new file mode 100644 index 0000000..c561e94 --- /dev/null +++ b/build/exports/Puma World Football.dxw @@ -0,0 +1,29 @@ +[target] +title0=Puma World Football +path0=D:\Games\pumawf98\WF.EXE +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=1207963648 +flagh0=20 +flagi0=138412036 +flagj0=4224 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=16 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Real War Air Land Sea.dxw b/build/exports/Real War Air Land Sea.dxw new file mode 100644 index 0000000..9bf9350 --- /dev/null +++ b/build/exports/Real War Air Land Sea.dxw @@ -0,0 +1,31 @@ +[target] +title0=Real War Air Land Sea +path0=D:\Games\Real War\REALWAR.EXE +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=134234146 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=0 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 diff --git a/build/exports/Scrapland.dxw b/build/exports/Scrapland.dxw new file mode 100644 index 0000000..63f1f7e --- /dev/null +++ b/build/exports/Scrapland.dxw @@ -0,0 +1,28 @@ +[target] +title0=Scrapland +path0=D:\Games\Scrapland\Bin\Scrap.exe +launchpath0= +module0= +opengllib0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Sherlock Holmes The Mystery of The Mummy demo.dxw b/build/exports/Sherlock Holmes The Mystery of The Mummy demo.dxw new file mode 100644 index 0000000..4f6269d --- /dev/null +++ b/build/exports/Sherlock Holmes The Mystery of The Mummy demo.dxw @@ -0,0 +1,31 @@ +[target] +title0=Sherlock Holmes The Mystery of The Mummy demo +path0=D:\Games\Sherlock Holmes demo\Sherlock Holmes- Level-1- Hall\game.exe +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=136314914 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=0 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 diff --git a/build/exports/SimCity 3000.dxw b/build/exports/SimCity 3000.dxw new file mode 100644 index 0000000..9fba206 --- /dev/null +++ b/build/exports/SimCity 3000.dxw @@ -0,0 +1,28 @@ +[target] +title0=SimCity 3000 +path0=D:\Games\SimCity 3000\Game\Sc3.exe +launchpath0= +module0=SIMCITY.DLL +opengllib0= +ver0=1 +coord0=0 +flag0=1746935842 +flagg0=1811939328 +flagh0=131092 +flagi0=136314884 +flagj0=8320 +tflag0=6403 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Spirit Warrior.dxw b/build/exports/Spirit Warrior.dxw new file mode 100644 index 0000000..7ce0ef9 --- /dev/null +++ b/build/exports/Spirit Warrior.dxw @@ -0,0 +1,29 @@ +[target] +title0=Spirit Warrior +path0=D:\Games\spirit\SPIRIT.EXE +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=134217762 +flagg0=1744830464 +flagh0=1044 +flagi0=1212153862 +flagj0=4224 +tflag0=513 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/The Hobbit(TM).dxw b/build/exports/The Hobbit(TM).dxw new file mode 100644 index 0000000..b4fbc8a --- /dev/null +++ b/build/exports/The Hobbit(TM).dxw @@ -0,0 +1,29 @@ +[target] +title0=The Hobbit(TM) +path0=d:\Games\The Hobbit(TM)\Meridian.exe +launchpath0= +module0= +opengllib0= +notes0=1 - If you want to set screen mode other than the default included (800x600) \nyou should run the game without the hook, set the preferred screenmode in-game, \nthen change it in DxDwnd before else you'll reset back to the initial mode set.\n\n2 - To get the game working it took some checking/unchecking for a bit. \nAll that's needed is to activated "Fix Parent Window" which this game seems \nto use the invisible window for it's execution (per DxWnd manual even though \nexperimental... it works) and set the direct x version to 8. +ver0=8 +coord0=0 +flag0=167772194 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Viper Racing.dxw b/build/exports/Viper Racing.dxw new file mode 100644 index 0000000..d2e0bbf --- /dev/null +++ b/build/exports/Viper Racing.dxw @@ -0,0 +1,29 @@ +[target] +title0=Viper Racing +path0=D:\Games\Viper Racing\SIERRA\Viper Racing\Data\race.bin +launchpath0=D:\Games\Viper Racing\SIERRA\Viper Racing\Viper Racing.exe +module0= +opengllib0= +notes0= +ver0=1 +coord0=0 +flag0=134217762 +flagg0=1207959552 +flagh0=20 +flagi0=-2009071612 +flagj0=4224 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/exports/Wars & Warriors Joan of Arc.dxw b/build/exports/Wars & Warriors Joan of Arc.dxw new file mode 100644 index 0000000..b256c5d --- /dev/null +++ b/build/exports/Wars & Warriors Joan of Arc.dxw @@ -0,0 +1,31 @@ +[target] +title0=Wars & Warriors: Joan of Arc +path0=D:\Games\Wars & Warriors Johan of Arc\joan.exe +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=134217746 +flagg0=1207959552 +flagh0=20 +flagi0=205520900 +flagj0=4224 +flagk0=0 +tflag0=-2147477501 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=800 +maxy0=600 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 diff --git a/build/exports/Weird War.dxw b/build/exports/Weird War.dxw new file mode 100644 index 0000000..3588708 --- /dev/null +++ b/build/exports/Weird War.dxw @@ -0,0 +1,31 @@ +[target] +title0=Weird War +path0=D:\Games\Weird War\WeirdWar.exe +launchpath0= +module0= +opengllib0= +notes0= +ver0=0 +coord0=0 +flag0=136331298 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=4224 +flagk0=0 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 +swapeffect0=0 diff --git a/build/exports/mdk 95.dxw b/build/exports/mdk 95.dxw new file mode 100644 index 0000000..3614ab9 --- /dev/null +++ b/build/exports/mdk 95.dxw @@ -0,0 +1,29 @@ +[target] +title0=mdk 95 +path0=D:\Games\MDK\MDK95.EXE +launchpath0= +module0= +opengllib0= +notes0=Must manually set MDK.CFG hddata field with install game directory +ver0=0 +coord0=0 +flag0=134217762 +flagg0=1207959552 +flagh0=20 +flagi0=138412036 +flagj0=12416 +tflag0=0 +initx0=0 +inity0=0 +minx0=0 +miny0=0 +maxx0=0 +maxy0=0 +posx0=50 +posy0=50 +sizx0=800 +sizy0=600 +maxfps0=0 +initts0=0 +winver0=0 +maxres0=-1 diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt index 6443c63..1184fe0 100644 --- a/build/readme-relnotes.txt +++ b/build/readme-relnotes.txt @@ -793,4 +793,12 @@ fix: crash when setting "showFPS overlay" with DirectX "hybrid mode" fix: "keep aspect ratio" with DirectX "GDI mode" fix: when ddraw hook is set to "none", no hook operations are performed on ddraw add: possibility to control the D3D8/9 SwapEffect field with the "force swap effect" flag -fix: revised handling of GDI device context shared with DirectDraw primary surface, improved behaviour of "Star trek Armada" \ No newline at end of file +fix: revised handling of GDI device context shared with DirectDraw primary surface, improved behaviour of "Star trek Armada" + +v2.03.20: +fix: revised hookers for kernel32 GetVersionExA/W api, adding support for dwPlatformId field +fix: texture handling for texture dump/hack/highlight +add: "Reserve legacy memory segments" compatibility flag, needed for "Crusaders of Might & Magic" +add: preliminary support for ddraw7 DirectDrawCreateClipper api +add: "Suppress main window destruction" flag, to make "Prince of Persia 3D" playable +fix: fully revised ddraw surface handling in d3d1-7 versions. Now "Might & Magic IX" is supported \ No newline at end of file diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp index b0b511f..72e540a 100644 --- a/dll/ddraw.cpp +++ b/dll/ddraw.cpp @@ -18,7 +18,7 @@ #include "syslibs.h" extern BOOL IsChangeDisplaySettingsHotPatched; -BOOL bDontReleaseBackBuffer = FALSE; +BOOL bIsWithinD3DCreateDevice = FALSE; DWORD dwBackBufferCaps; extern void TextureHandling(LPDIRECTDRAWSURFACE); ColorConversion_Type pColorConversion = NULL; @@ -33,6 +33,7 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *, LPDIRECTDRAW FAR *, REFIID, IUnknown FAR *); HRESULT WINAPI extDirectDrawEnumerate(LPDDENUMCALLBACK, LPVOID); HRESULT WINAPI extDirectDrawEnumerateEx(LPDDENUMCALLBACKEX, LPVOID, DWORD); +HRESULT WINAPI extDirectDrawCreateClipper(DWORD, LPDIRECTDRAWCLIPPER *, IUnknown *); // DirectDraw HRESULT WINAPI extQueryInterfaceD(void *, REFIID, LPVOID *); @@ -64,7 +65,6 @@ HRESULT WINAPI extTestCooperativeLevel(LPDIRECTDRAW); // STDMETHOD(EvaluateMode)(THIS_ DWORD, DWORD * ) PURE; HRESULT WINAPI extGetCapsD(LPDIRECTDRAW, LPDDCAPS, LPDDCAPS); - // DirectDrawSurface HRESULT WINAPI extQueryInterfaceS(void *, REFIID, LPVOID *); HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE); @@ -130,6 +130,7 @@ DirectDrawCreate_Type pDirectDrawCreate = NULL; DirectDrawCreateEx_Type pDirectDrawCreateEx = NULL; DirectDrawEnumerate_Type pDirectDrawEnumerate = NULL; DirectDrawEnumerateEx_Type pDirectDrawEnumerateEx = NULL; +DirectDrawCreateClipper_Type pDirectDrawCreateClipper = NULL; /* DirectDraw hook pointers */ QueryInterface_Type pQueryInterfaceD; @@ -280,6 +281,7 @@ static HookEntry_Type ddHooks[]={ {HOOK_HOT_CANDIDATE, "DirectDrawCreateEx", (FARPROC)NULL, (FARPROC *)&pDirectDrawCreateEx, (FARPROC)extDirectDrawCreateEx}, {HOOK_HOT_CANDIDATE, "DirectDrawEnumerateA", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerate, (FARPROC)extDirectDrawEnumerate}, {HOOK_HOT_CANDIDATE, "DirectDrawEnumerateExA", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateEx, (FARPROC)extDirectDrawEnumerateEx}, + {HOOK_HOT_CANDIDATE, "DirectDrawCreateClipper", (FARPROC)NULL, (FARPROC *)&pDirectDrawCreateClipper, (FARPROC)extDirectDrawCreateClipper}, //{HOOK_IAT_CANDIDATE, "DirectDrawEnumerateW", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateW, (FARPROC)extDirectDrawCreate}, //{HOOK_IAT_CANDIDATE, "DirectDrawEnumerateExW", (FARPROC)NULL, (FARPROC *)&pDirectDrawEnumerateExW, (FARPROC)extDirectDrawCreate}, {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator @@ -334,87 +336,9 @@ static void Stopper(char *s, int line) #define STOPPER(s) #endif -static char *sFourCC(DWORD fcc) -{ - static char sRet[5]; - char c; - int i; - char *t=&sRet[0]; - for(i=0; i<4; i++){ - c = fcc & (0xFF); - *t++ = isprint(c) ? c : '.'; - c = c >> 8; - } - *t = 0; - return sRet; -} - static char *DumpPixelFormat(LPDDSURFACEDESC2 lpddsd) { - static char sBuf[512]; - char sItem[256]; - DWORD flags=lpddsd->ddpfPixelFormat.dwFlags; - sprintf(sBuf, " PixelFormat flags=%x(%s) BPP=%d", - flags, ExplainPixelFormatFlags(flags), lpddsd->ddpfPixelFormat.dwRGBBitCount); - if (flags & DDPF_RGB) { - if (flags & DDPF_ALPHAPIXELS) { - sprintf(sItem, " RGBA=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwRBitMask, - lpddsd->ddpfPixelFormat.dwGBitMask, - lpddsd->ddpfPixelFormat.dwBBitMask, - lpddsd->ddpfPixelFormat.dwRGBAlphaBitMask); - } - else { - sprintf(sItem, " RGB=(%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwRBitMask, - lpddsd->ddpfPixelFormat.dwGBitMask, - lpddsd->ddpfPixelFormat.dwBBitMask); - } - strcat(sBuf, sItem); - } - if (flags & DDPF_YUV) { - sprintf(sItem, " YUVA=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwYBitMask, - lpddsd->ddpfPixelFormat.dwUBitMask, - lpddsd->ddpfPixelFormat.dwVBitMask, - lpddsd->ddpfPixelFormat.dwYUVAlphaBitMask); - strcat(sBuf, sItem); - } - if (flags & DDPF_ZBUFFER) { - sprintf(sItem, " SdZSbL=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwStencilBitDepth, - lpddsd->ddpfPixelFormat.dwZBitMask, - lpddsd->ddpfPixelFormat.dwStencilBitMask, - lpddsd->ddpfPixelFormat.dwLuminanceAlphaBitMask); - strcat(sBuf, sItem); - } - if (flags & DDPF_ALPHA) { - sprintf(sItem, " LBdBlZ=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwLuminanceBitMask, - lpddsd->ddpfPixelFormat.dwBumpDvBitMask, - lpddsd->ddpfPixelFormat.dwBumpLuminanceBitMask, - lpddsd->ddpfPixelFormat.dwRGBZBitMask); - strcat(sBuf, sItem); - } - if (flags & DDPF_LUMINANCE) { - sprintf(sItem, " BMbMF=(%x,%x,%x,%x)", - lpddsd->ddpfPixelFormat.dwBumpDuBitMask, - lpddsd->ddpfPixelFormat.MultiSampleCaps.wBltMSTypes, - lpddsd->ddpfPixelFormat.MultiSampleCaps.wFlipMSTypes, - lpddsd->ddpfPixelFormat.dwYUVZBitMask); - strcat(sBuf, sItem); - } - if (flags & DDPF_BUMPDUDV) { - sprintf(sItem, " O=(%x)", - lpddsd->ddpfPixelFormat.dwOperations); - strcat(sBuf, sItem); - } - if (flags & DDPF_FOURCC) { - sprintf(sItem, " FourCC=%x(%s)", - lpddsd->ddpfPixelFormat.dwFourCC, sFourCC(lpddsd->ddpfPixelFormat.dwFourCC)); - strcat(sBuf, sItem); - } - return sBuf; + return ExplainPixelFormat(&(lpddsd->ddpfPixelFormat)); } static CHAR *LogSurfaceAttributes(LPDDSURFACEDESC lpddsd, char *label, int line) @@ -1410,9 +1334,6 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion) SetHook((void *)(**(DWORD **)lplpdds + 128), extUnlockDir4, (void **)&pUnlock4, "Unlock(S4)"); } - if (dxversion == 7) - SetHook((void *)(**(DWORD **)lplpdds + 156), extSetSurfaceDesc, (void **)&pSetSurfaceDesc, "SetSurfaceDesc(S3)"); - if (!(dxw.dwTFlags & OUTPROXYTRACE)) return; // just proxed .... @@ -1454,6 +1375,9 @@ static void HookDDSurfaceGeneric(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 (dxversion == 7) + SetHook((void *)(**(DWORD **)lplpdds + 156), extSetSurfaceDesc, (void **)&pSetSurfaceDesc, "SetSurfaceDesc(S3)"); + } static void HookGammaControl(LPVOID *obp) @@ -1866,11 +1790,11 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp) unsigned int dwLocalDDVersion; unsigned int dwLocalTexVersion; - OutTraceDDRAW("QueryInterface(S): lpdds=%x REFIID=%x(%s) obp=%x\n", - lpdds, riid.Data1, ExplainGUID((GUID *)&riid), *obp); - IsPrim=dxw.IsAPrimarySurface((LPDIRECTDRAWSURFACE)lpdds); IsBack=dxw.IsABackBufferSurface((LPDIRECTDRAWSURFACE)lpdds); + OutTraceDDRAW("QueryInterface(S): lpdds=%x%s REFIID=%x(%s)\n", + lpdds, dxw.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds), riid.Data1, ExplainGUID((GUID *)&riid)); + IsGammaRamp=FALSE; dwLocalDDVersion=0; @@ -2120,6 +2044,7 @@ HRESULT WINAPI extGetDisplayMode(LPDIRECTDRAW lpdd, LPDDSURFACEDESC lpddsd) HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags) { HRESULT res; + BOOL bFixFrame = FALSE; OutTraceDDRAW("SetCooperativeLevel: lpdd=%x hwnd=%x dwFlags=%x(%s)\n", lpdd, hwnd, dwflags,ExplainCoopFlags(dwflags)); @@ -2143,9 +2068,7 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags) dxw.SetFullScreen(TRUE); dwflags &= ~(DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX); dwflags |= DDSCL_NORMAL; - res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); - AdjustWindowFrame(hwnd, dxw.GetScreenWidth(), dxw.GetScreenHeight()); - if (dxw.dwFlags1 & FIXWINFRAME) dxw.FixWindowFrame(hwnd); + bFixFrame = TRUE; } else{ RECT client; @@ -2153,17 +2076,25 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags) // v2.02.11: // Non fullscreen cooperative mode means windowed, unless the window occupies the whole desktop area dxw.SetFullScreen(client.right==dxw.iSizX && client.bottom==dxw.iSizY); - //dxw.SetFullScreen(FALSE); - res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); } } - else { - res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); - } - if(res) + res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); + if(res){ + if(res == DDERR_INVALIDPARAMS){ + //hwnd = GetForegroundWindow(); + PostMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); + Sleep(1000); + res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags); + } OutTraceE("SetCooperativeLevel: ERROR lpdd=%x hwnd=%x Flags=%x err=%x(%s) at %d\n", lpdd, hwnd, dwflags, res, ExplainDDError(res), __LINE__); + } + + if(bFixFrame){ + AdjustWindowFrame(hwnd, dxw.GetScreenWidth(), dxw.GetScreenHeight()); + if (dxw.dwFlags1 & FIXWINFRAME) dxw.FixWindowFrame(hwnd); + } GetHookInfo()->IsFullScreen=dxw.IsFullScreen(); @@ -3706,12 +3637,11 @@ HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFAC HRESULT res; BOOL IsPrim; BOOL IsBack; + RECT rect; IsPrim=dxw.IsAPrimarySurface(lpdds); IsBack=dxw.IsABackBufferSurface(lpdds); - if ((dxversion == 4) && lprect) CleanRect(&lprect,__LINE__); - if(IsTraceDDRAW){ char sRect[81]; if (dxversion == 4){ @@ -3723,6 +3653,18 @@ HRESULT WINAPI extUnlock(int dxversion, Unlock4_Type pUnlock, LPDIRECTDRAWSURFAC OutTrace("Unlock(%d): lpdds=%x%s %s\n", dxversion, lpdds, (IsPrim ? "(PRIM)": (IsBack ? "(BACK)" : "")), sRect); } + if(dxversion == 4){ + // make lprect point elsewhere, so that the original values are not altered + if(lprect){ + CleanRect(&lprect,__LINE__); + rect = *lprect; + lprect = ▭ + // v2.03.20: apparently, it seems that in ddraw 7 you can set an empty rectangle to mean the whole area .... + // this fixes the black screen otherwise present in "Arcanum". + if(IsPrim && ((lprect->right - lprect->left) == 0) && ((lprect->bottom - lprect->top) == 0)) lprect = NULL; + } + } + res=(*pUnlock)(lpdds, lprect); if (IsPrim && res==DD_OK) { if(dxversion == 1) lprect=NULL; @@ -4190,17 +4132,14 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds) IsPrim=dxw.IsAPrimarySurface(lpdds); IsBack=dxw.IsABackBufferSurface(lpdds); - if(IsBack && bDontReleaseBackBuffer){ - OutTraceDDRAW("Release(S): SKIP RELEASE on lpdds=%x\n", lpdds); - res = 0; - } - else - res = (*pReleaseS)(lpdds); + res = (*pReleaseS)(lpdds); - OutTraceDDRAW("Release(S): lpdds=%x%s refcount=%d\n", lpdds, IsPrim?"(PRIM)":(IsBack?"(BACK)":""), res); + OutTraceDDRAW("Release(S): lpdds=%x%s refcount=%d\n", lpdds, dxw.ExplainSurfaceRole(lpdds), res); if (res==0) { // common precondition // erase surface from primary or backbuffer list - if(IsPrim || IsBack) dxw.MarkRegularSurface(lpdds); + // v2-03-20: d3d 1-7 play a dirty trick: it Release the surface passed as argument until refcount == 0, + // but then rebuilds it with the original attributes! So, better not forget them. + if(!bIsWithinD3DCreateDevice && (IsPrim || IsBack)) dxw.MarkRegularSurface(lpdds); // when releasing primary surface, erase clipping region if(IsPrim && (dxw.dwFlags1 & CLIPCURSOR)) dxw.EraseClipCursor(); @@ -4894,6 +4833,19 @@ HRESULT WINAPI extSetSurfaceDesc(LPDIRECTDRAWSURFACE lpdds, LPDDSURFACEDESC lpDD HRESULT res; OutTrace("SetSurfaceDesc: REACHED\n"); res = (*pSetSurfaceDesc)(lpdds, lpDDsd2, dwFlags); - OutTraceE("SetSurfaceDesc: ERROR res=%x(%s)\n", res, ExplainDDError(res)); + if(res) OutTraceE("SetSurfaceDesc: ERROR res=%x(%s)\n", res, ExplainDDError(res)); return res; } + +HRESULT WINAPI extDirectDrawCreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, IUnknown *pUnkOuter) +{ + HRESULT res; + OutTraceDW("DirectDrawCreateClipper: flags=%x\n", dwFlags); + res = (*pDirectDrawCreateClipper)(dwFlags, lplpDDClipper, pUnkOuter); + if(res) { + OutTraceE("DirectDrawCreateClipper: ERROR res=%x(%s)\n", res, ExplainDDError(res)); + return res; + } + HookDDClipper(lplpDDClipper); + return res; +} \ No newline at end of file diff --git a/dll/ddtexture.cpp b/dll/ddtexture.cpp index 375b4a5..287b416 100644 --- a/dll/ddtexture.cpp +++ b/dll/ddtexture.cpp @@ -37,17 +37,22 @@ static unsigned int Hash(BYTE *buf, int len) unsigned int HashSurface(BYTE *buf, int pitch, int width, int height) { - unsigned int b = 378551; - unsigned int a = 63689; - DWORD hash = 0; - for(int y = 0; y < height; y++){ - BYTE *p = buf + (y * pitch); - for(int x = 0; x < width; x++){ - hash = hash * a + p[x]; - a = a * b; - } - } - return hash; + unsigned int b = 378551; + unsigned int a = 63689; + int pixelsize; + DWORD hash = 0; + // integer divide, intentionally throwing reminder away + pixelsize = pitch / width; + for(int y = 0; y < height; y++){ + BYTE *p = buf + (y * pitch); + for(int x = 0; x < width; x++){ + for(int pixelbyte = 0; pixelbyte < pixelsize; pixelbyte++){ + hash = (hash * a) + (*p++); + a = a * b; + } + } + } + return hash; } static char *SurfaceType(DDPIXELFORMAT ddpfPixelFormat) diff --git a/dll/dxhelper.cpp b/dll/dxhelper.cpp index 2dfb051..96942d3 100644 --- a/dll/dxhelper.cpp +++ b/dll/dxhelper.cpp @@ -1803,3 +1803,86 @@ char *ExplainDDError(DWORD c) } return eb; } + +static char *sFourCC(DWORD fcc) +{ + static char sRet[5]; + char c; + int i; + char *t=&sRet[0]; + for(i=0; i<4; i++){ + c = fcc & (0xFF); + *t++ = isprint(c) ? c : '.'; + c = c >> 8; + } + *t = 0; + return sRet; +} + +char *ExplainPixelFormat(LPDDPIXELFORMAT ddpfPixelFormat) +{ + static char sBuf[512]; + char sItem[256]; + DWORD flags=ddpfPixelFormat->dwFlags; + sprintf(sBuf, " PixelFormat flags=%x(%s) BPP=%d", + flags, ExplainPixelFormatFlags(flags), ddpfPixelFormat->dwRGBBitCount); + if (flags & DDPF_RGB) { + if (flags & DDPF_ALPHAPIXELS) { + sprintf(sItem, " RGBA=(%x,%x,%x,%x)", + ddpfPixelFormat->dwRBitMask, + ddpfPixelFormat->dwGBitMask, + ddpfPixelFormat->dwBBitMask, + ddpfPixelFormat->dwRGBAlphaBitMask); + } + else { + sprintf(sItem, " RGB=(%x,%x,%x)", + ddpfPixelFormat->dwRBitMask, + ddpfPixelFormat->dwGBitMask, + ddpfPixelFormat->dwBBitMask); + } + strcat(sBuf, sItem); + } + if (flags & DDPF_YUV) { + sprintf(sItem, " YUVA=(%x,%x,%x,%x)", + ddpfPixelFormat->dwYBitMask, + ddpfPixelFormat->dwUBitMask, + ddpfPixelFormat->dwVBitMask, + ddpfPixelFormat->dwYUVAlphaBitMask); + strcat(sBuf, sItem); + } + if (flags & DDPF_ZBUFFER) { + sprintf(sItem, " SdZSbL=(%x,%x,%x,%x)", + ddpfPixelFormat->dwStencilBitDepth, + ddpfPixelFormat->dwZBitMask, + ddpfPixelFormat->dwStencilBitMask, + ddpfPixelFormat->dwLuminanceAlphaBitMask); + strcat(sBuf, sItem); + } + if (flags & DDPF_ALPHA) { + sprintf(sItem, " LBdBlZ=(%x,%x,%x,%x)", + ddpfPixelFormat->dwLuminanceBitMask, + ddpfPixelFormat->dwBumpDvBitMask, + ddpfPixelFormat->dwBumpLuminanceBitMask, + ddpfPixelFormat->dwRGBZBitMask); + strcat(sBuf, sItem); + } + if (flags & DDPF_LUMINANCE) { + sprintf(sItem, " BMbMF=(%x,%x,%x,%x)", + ddpfPixelFormat->dwBumpDuBitMask, + ddpfPixelFormat->MultiSampleCaps.wBltMSTypes, + ddpfPixelFormat->MultiSampleCaps.wFlipMSTypes, + ddpfPixelFormat->dwYUVZBitMask); + strcat(sBuf, sItem); + } + if (flags & DDPF_BUMPDUDV) { + sprintf(sItem, " O=(%x)", + ddpfPixelFormat->dwOperations); + strcat(sBuf, sItem); + } + if (flags & DDPF_FOURCC) { + sprintf(sItem, " FourCC=%x(%s)", + ddpfPixelFormat->dwFourCC, sFourCC(ddpfPixelFormat->dwFourCC)); + strcat(sBuf, sItem); + } + return sBuf; +} \ No newline at end of file diff --git a/dll/dxhelper.h b/dll/dxhelper.h index d362a9d..c1912fb 100644 --- a/dll/dxhelper.h +++ b/dll/dxhelper.h @@ -51,4 +51,5 @@ extern char *ExplainRenderstateValue(DWORD); extern char *ExplainWfPFlags(DWORD); extern char *ExplainChangeDisplaySettingsFlags(DWORD); extern char *ExplainDICooperativeFlags(DWORD); -extern char *ExplainRegionType(DWORD); \ No newline at end of file +extern char *ExplainRegionType(DWORD); +extern char *ExplainPixelFormat(LPDDPIXELFORMAT); diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp index 9d41a14..6bccee1 100644 --- a/dll/dxhook.cpp +++ b/dll/dxhook.cpp @@ -103,7 +103,7 @@ static char *Flag5Names[32]={ }; static char *Flag6Names[32]={ - "FORCESWAPEFFECT", "", "", "", + "FORCESWAPEFFECT", "LEGACYALLOC", "NODESTROYWINDOW", "", "", "", "", "", "", "", "", "", "", "", "", "", @@ -1654,6 +1654,15 @@ DWORD WINAPI MessagePoller(LPVOID lpParameter) return 0; } +static void MemoryReserve() +{ + VirtualAlloc((LPVOID)0x4000000, 0x04000000, MEM_RESERVE, PAGE_READWRITE); + VirtualAlloc((LPVOID)0x5000000, 0x00F00000, MEM_RESERVE, PAGE_READWRITE); + VirtualAlloc((LPVOID)0x6000000, 0x00F00000, MEM_RESERVE, PAGE_READWRITE); + VirtualAlloc((LPVOID)0x7000000, 0x00F00000, MEM_RESERVE, PAGE_READWRITE); + VirtualAlloc((LPVOID)0x8000000, 0x00F00000, MEM_RESERVE, PAGE_READWRITE); +} + void HookInit(TARGETMAP *target, HWND hwnd) { HMODULE base; @@ -1667,9 +1676,12 @@ void HookInit(TARGETMAP *target, HWND hwnd) static char *Resolutions[]={ "unlimited", "320x200", "400x300", "640x480", "800x600", "1024x768", "1280x960", "" // terminator }; - + dxw.InitTarget(target); + // reserve legacy memory segments + if(dxw.dwFlags6 & LEGACYALLOC) MemoryReserve(); + // add the DxWnd install dir to the search path, to make all included dll linkable DWORD dwAttrib; dwAttrib = GetFileAttributes("dxwnd.dll"); diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp index 0869d6e..a04b9bc 100644 --- a/dll/dxwcore.cpp +++ b/dll/dxwcore.cpp @@ -228,6 +228,25 @@ void dxwCore::DumpDesktopStatus() // Primary surfaces auxiliary functions /* ------------------------------------------------------------------ */ +char *dxwCore::ExplainSurfaceRole(LPDIRECTDRAWSURFACE ps) +{ + int i; + for (i=0;i. #include "TlHelp32.h" -#define VERSION "2.03.19" +#define VERSION "2.03.20" #define DDTHREADLOCK 1 //#define LOCKTHREADS diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo index 6f7ec42..38ac928 100644 Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ diff --git a/dll/hd3d.cpp b/dll/hd3d.cpp index 7beab3c..bdc788c 100644 --- a/dll/hd3d.cpp +++ b/dll/hd3d.cpp @@ -17,6 +17,9 @@ #define HOOKD3D10ANDLATER 1 #define TRACEALLMETHODS 1 +extern void D3D9TextureHandling(void *, int); +extern void D3D8TextureHandling(void *, int); + typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID riid, void** ppvObj); // D3D8/9 API @@ -112,7 +115,11 @@ typedef HRESULT (WINAPI *EndStateBlock8_Type)(void *, DWORD *); typedef HRESULT (WINAPI *EndStateBlock9_Type)(void *, IDirect3DStateBlock9**); typedef HRESULT (WINAPI *CreateTexture8_Type)(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **); typedef HRESULT (WINAPI *CreateTexture9_Type)(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **, HANDLE *); +#ifdef DXWNDDISABLEDHOOKS typedef HRESULT (WINAPI *CopyRects_Type)(void *, void *, CONST RECT *, UINT, void *, CONST POINT *); +typedef HRESULT (WINAPI *UpdateSurface_Type)(void *, IDirect3DSurface9 *, CONST RECT *, IDirect3DSurface9 *, CONST POINT *); +typedef HRESULT (WINAPI *UpdateTexture_Type)(void *, IDirect3DBaseTexture9 *, IDirect3DBaseTexture9 *); +#endif UINT WINAPI extGetAvailableTextureMem(void *); HRESULT WINAPI extTestCooperativeLevel(void *); @@ -133,7 +140,11 @@ HRESULT WINAPI extEndStateBlock8(void *, DWORD *); HRESULT WINAPI extEndStateBlock9(void *, IDirect3DStateBlock9**); HRESULT WINAPI extCreateTexture8(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **); HRESULT WINAPI extCreateTexture9(void *, UINT, UINT, UINT, DWORD, D3DFORMAT, D3DPOOL, void **, HANDLE *); +#ifdef DXWNDDISABLEDHOOKS HRESULT WINAPI extCopyRects(void *, void *, CONST RECT *, UINT, void *, CONST POINT *); +HRESULT WINAPI extUpdateSurface(void *, IDirect3DSurface9 *, CONST RECT *, IDirect3DSurface9 *, CONST POINT *); +HRESULT WINAPI extUpdateTexture(void *, IDirect3DBaseTexture9 *, IDirect3DBaseTexture9 *); +#endif GetAvailableTextureMem_Type pGetAvailableTextureMem = 0; TestCooperativeLevel_Type pTestCooperativeLevel = 0; @@ -154,19 +165,38 @@ EndStateBlock8_Type pEndStateBlock8 = 0; EndStateBlock9_Type pEndStateBlock9 = 0; CreateTexture8_Type pCreateTexture8 = 0; CreateTexture9_Type pCreateTexture9 = 0; +#ifdef DXWNDDISABLEDHOOKS CopyRects_Type pCopyRects = 0; +UpdateSurface_Type pUpdateSurface = NULL; +UpdateTexture_Type pUpdateTexture = NULL; +#endif // IDirect3DTexture8/9 methods typedef HRESULT (WINAPI *LockRect_Type)(void *, UINT, D3DLOCKED_RECT *, CONST RECT *, DWORD); typedef HRESULT (WINAPI *UnlockRect_Type)(void *, UINT); +#ifdef DXWNDDISABLEDHOOKS +typedef HRESULT (WINAPI *GetSurfaceLevel_Type)(void *, UINT, IDirect3DSurface9**); +typedef HRESULT (WINAPI *SetPrivateData_Type)(void *, REFGUID, CONST void *, DWORD, DWORD); +typedef HRESULT (WINAPI *QueryInterfaceTex_Type)(void *, REFIID, void**); +#endif HRESULT WINAPI extLockRect(void *, UINT, D3DLOCKED_RECT *, CONST RECT *, DWORD); HRESULT WINAPI extUnlockRect8(void *, UINT); HRESULT WINAPI extUnlockRect9(void *, UINT); +#ifdef DXWNDDISABLEDHOOKS +HRESULT WINAPI extGetSurfaceLevel9(void *, UINT, IDirect3DSurface9**); +HRESULT WINAPI extSetPrivateData(void *, REFGUID, CONST void *, DWORD, DWORD); +HRESULT WINAPI extQueryInterfaceTex(void *, REFIID, void**); +#endif LockRect_Type pLockRect = NULL; UnlockRect_Type pUnlockRect = NULL; +#ifdef DXWNDDISABLEDHOOKS +GetSurfaceLevel_Type pGetSurfaceLevel9 = NULL; +SetPrivateData_Type pSetPrivateData = NULL; +QueryInterfaceTex_Type pQueryInterfaceTex = NULL; +#endif // to sort ... @@ -460,8 +490,8 @@ void HookD3DDevice8(void** ppD3Ddev8) } if(dxw.dwFlags5 & TEXTUREMASK){ SetHook((void *)(**(DWORD **)ppD3Ddev8 + 80), extCreateTexture8, (void **)&pCreateTexture8, "CreateTexture(D8)"); - //SetHook((void *)(**(DWORD **)ppD3Ddev8 + 112), extCopyRects, (void **)&pCopyRects, "CopyRects(D8)"); } + //SetHook((void *)(**(DWORD **)ppD3Ddev8 + 112), extCopyRects, (void **)&pCopyRects, "CopyRects(D8)"); SetHook((void *)(**(DWORD **)ppD3Ddev8 + 100), extCreateRenderTarget8, (void **)&pCreateRenderTarget8, "CreateRenderTarget(D8)"); SetHook((void *)(**(DWORD **)ppD3Ddev8 + 136), extBeginScene8, (void **)&pBeginScene8, "BeginScene(D8)"); SetHook((void *)(**(DWORD **)ppD3Ddev8 + 140), extEndScene8, (void **)&pEndScene8, "EndScene(D8)"); @@ -475,7 +505,9 @@ void HookD3DDevice8(void** ppD3Ddev8) } SetHook((void *)(**(DWORD **)ppD3Ddev8 + 208), extBeginStateBlock8, (void **)&pBeginStateBlock8, "BeginStateBlock(D8)"); SetHook((void *)(**(DWORD **)ppD3Ddev8 + 212), extEndStateBlock8, (void **)&pEndStateBlock8, "EndStateBlock(D8)"); - if (dxw.dwFlags4 & NOTEXTURES) SetHook((void *)(**(DWORD **)ppD3Ddev8 + 244), extSetTexture8, (void **)&pSetTexture8, "SetTexture(D8)"); + if((dxw.dwFlags5 & TEXTUREMASK) || (dxw.dwFlags4 & NOTEXTURES)){ + SetHook((void *)(**(DWORD **)ppD3Ddev8 + 244), extSetTexture8, (void **)&pSetTexture8, "SetTexture(D8)"); + } //if (!(dxw.dwTFlags & OUTPROXYTRACE)) return; //SetHook((void *)(**(DWORD **)ppD3Ddev8 + 4), extAddRef8, (void **)&pAddRef8, "AddRef(D8)"); //SetHook((void *)(**(DWORD **)ppD3Ddev8 + 8), extRelease8, (void **)&pRelease8, "Release(D8)"); @@ -503,6 +535,11 @@ void HookD3DDevice9(void** ppD3Ddev9) if(dxw.dwFlags5 & TEXTUREMASK){ SetHook((void *)(**(DWORD **)ppD3Ddev9 + 92), extCreateTexture9, (void **)&pCreateTexture9, "CreateTexture(D9)"); } +#ifdef DXWNDDISABLEDHOOKS + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 120), extUpdateSurface, (void **)&pUpdateSurface, "UpdateSurface(D9)"); + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 124), extUpdateTexture, (void **)&pUpdateTexture, "UpdateTexture(D9)"); +#endif + SetHook((void *)(**(DWORD **)ppD3Ddev9 + 164), extBeginScene9, (void **)&pBeginScene9, "BeginScene(D9)"); SetHook((void *)(**(DWORD **)ppD3Ddev9 + 168), extEndScene9, (void **)&pEndScene9, "EndScene(D9)"); //SetHook((void *)(**(DWORD **)ppD3Ddev9 +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)"); @@ -517,7 +554,7 @@ void HookD3DDevice9(void** ppD3Ddev9) } SetHook((void *)(**(DWORD **)ppD3Ddev9 + 240), extBeginStateBlock9, (void **)&pBeginStateBlock9, "BeginStateBlock(D9)"); SetHook((void *)(**(DWORD **)ppD3Ddev9 + 244), extEndStateBlock9, (void **)&pEndStateBlock9, "EndStateBlock(D9)"); - if (dxw.dwFlags4 & NOTEXTURES) { + if((dxw.dwFlags5 & TEXTUREMASK) || (dxw.dwFlags4 & NOTEXTURES)){ SetHook((void *)(**(DWORD **)ppD3Ddev9 + 260), extSetTexture9, (void **)&pSetTexture9, "SetTexture(D9)"); } if (!(dxw.dwTFlags & OUTPROXYTRACE)) return; @@ -536,8 +573,13 @@ void HookD3DTexture8(void** ppD3Dtex8) void HookD3DTexture9(void** ppD3Dtex9) { OutTraceD3D("Device hook for IDirect3DTexture9 interface\n"); - SetHook((void *)(**(DWORD **)ppD3Dtex9 + 76), extLockRect, (void **)&pLockRect, "LockRect(D9)"); - SetHook((void *)(**(DWORD **)ppD3Dtex9 + 80), extUnlockRect9, (void **)&pUnlockRect, "UnlockRect(D9)"); + SetHook((void *)(**(DWORD **)ppD3Dtex9 + 76), extLockRect, (void **)&pLockRect, "LockRect(T9)"); + SetHook((void *)(**(DWORD **)ppD3Dtex9 + 80), extUnlockRect9, (void **)&pUnlockRect, "UnlockRect(T9)"); +#ifdef DXWNDDISABLEDHOOKS + SetHook((void *)(**(DWORD **)ppD3Dtex9 + 0), extQueryInterfaceTex, (void **)&pQueryInterfaceTex, "QueryInterface(T9)"); + SetHook((void *)(**(DWORD **)ppD3Dtex9 + 16), extSetPrivateData, (void **)&pSetPrivateData, "SetPrivateData(T9)"); + SetHook((void *)(**(DWORD **)ppD3Dtex9 + 72), extGetSurfaceLevel9, (void **)&pGetSurfaceLevel9, "GetSurfaceLevel(T9)"); +#endif } void HookDirect3D8(void *lpd3d) @@ -850,10 +892,10 @@ HRESULT WINAPI extPresent(void *pd3dd, CONST RECT *pSourceRect, CONST RECT *pDes if(dxw.Windowize){ // v2.03.15 - fix target RECT region if ((dwD3DSwapEffect == D3DSWAPEFFECT_COPY) && (dxw.dwFlags2 & KEEPASPECTRATIO)) { - RemappedDstRect=dxw.MapClientRect((LPRECT)pDestRect); - pDestRect = &RemappedDstRect; + RemappedDstRect=dxw.MapClientRect((LPRECT)pDestRect); + pDestRect = &RemappedDstRect; + OutTraceB("Present: FIXED DestRect=(%d,%d)-(%d,%d)\n", RemappedDstRect.left, RemappedDstRect.top, RemappedDstRect.right, RemappedDstRect.bottom); } - OutTraceB("Present: FIXED DestRect=(%d,%d)-(%d,%d)\n", RemappedDstRect.left, RemappedDstRect.top, RemappedDstRect.right, RemappedDstRect.bottom); // in case of NOD3DRESET, remap source rect. Unfortunately, this doesn't work in fullscreen mode .... if((dxw.dwFlags4 & NOD3DRESET) && (pSourceRect == NULL)){ RemappedSrcRect = dxw.GetScreenRect(); @@ -1762,16 +1804,30 @@ ULONG WINAPI extEndScene9(void *lpdd3dd) ULONG WINAPI extSetTexture8(void *lpd3dd, DWORD Stage, void* pTexture) { - (*pSetTexture8)(lpd3dd, Stage, NULL); - OutTraceD3D("Device::SetTexture(8): d3dd=%x stage=%x\n", lpd3dd, Stage); - return DD_OK; + ULONG ret; + if (dxw.dwFlags4 & NOTEXTURES) { + (*pSetTexture8)(lpd3dd, Stage, NULL); + OutTraceD3D("Device::SetTexture(8): d3dd=%x stage=%x\n", lpd3dd, Stage); + return DD_OK; + } + ret = (*pSetTexture8)(lpd3dd, Stage, pTexture); + OutTraceD3D("Device::SetTexture(8): d3dd=%x stage=%x texture=%x ret=%x\n", lpd3dd, Stage, pTexture, ret); + if(pTexture) D3D8TextureHandling((void *)pTexture, Stage); + return ret; } ULONG WINAPI extSetTexture9(void *lpd3dd, DWORD Stage, void* pTexture) { - (*pSetTexture9)(lpd3dd, Stage, NULL); - OutTraceD3D("Device::SetTexture(9): d3dd=%x stage=%x\n", lpd3dd, Stage); - return DD_OK; + ULONG ret; + if (dxw.dwFlags4 & NOTEXTURES) { + (*pSetTexture9)(lpd3dd, Stage, NULL); + OutTraceD3D("Device::SetTexture(9): d3dd=%x stage=%x\n", lpd3dd, Stage); + return DD_OK; + } + ret = (*pSetTexture9)(lpd3dd, Stage, pTexture); + OutTraceD3D("Device::SetTexture(9): d3dd=%x stage=%x texture=%x ret=%x\n", lpd3dd, Stage, pTexture, ret); + if(pTexture) D3D9TextureHandling((void *)pTexture, Stage); + return ret; } BOOL WINAPI extShowCursor8(void *lpd3dd, BOOL bShow) @@ -2185,21 +2241,71 @@ HRESULT WINAPI extUnlockRect(void *lpd3dtex, UINT Level, TextureHandling_Type Te HRESULT WINAPI extUnlockRect8(void *lpd3dtex, UINT Level) { - extern void D3D8TextureHandling(void *, int); return extUnlockRect(lpd3dtex, Level, D3D8TextureHandling); } HRESULT WINAPI extUnlockRect9(void *lpd3dtex, UINT Level) { - extern void D3D9TextureHandling(void *, int); return extUnlockRect(lpd3dtex, Level, D3D9TextureHandling); } +#ifdef DXWNDDISABLEDHOOKS +HRESULT WINAPI extGetSurfaceLevel9(void *lpd3dtex, UINT Level, IDirect3DSurface9** ppSurfaceLevel) +{ + HRESULT res; + OutTraceD3D("GetSurfaceLevel(9): lpd3dtex=%x level=%d\n", lpd3dtex, Level); + res = (*pGetSurfaceLevel9)(lpd3dtex, Level, ppSurfaceLevel); + if(res == DD_OK){ + OutTraceD3D("GetSurfaceLevel(9): SurfaceLevel=%x\n", lpd3dtex, Level, *ppSurfaceLevel); + //HookD3DTexture9((void **)ppSurfaceLevel); + } + return res; +} + HRESULT WINAPI extCopyRects(void *lpd3dd, void *pSourceSurface, CONST RECT *pSourceRectsArray, UINT cRects, void *pDestinationSurface, CONST POINT* pDestPointsArray) { HRESULT res; OutTraceD3D("CopyRects: rects=%d\n", cRects); res = (pCopyRects)(lpd3dd, pSourceSurface, pSourceRectsArray, cRects, pDestinationSurface, pDestPointsArray); - extern void D3D8TextureHandling(void *, int); + //extern void D3D8TextureHandling(void *, int); //D3D8TextureHandling(pDestinationSurface, 0); - return res;} + return res; +} + +HRESULT WINAPI extUpdateSurface(void *lpd3dd, IDirect3DSurface9 *pSourceSurface, CONST RECT *pSourceRect, IDirect3DSurface9 *pDestinationSurface, CONST POINT *pDestPoint) +{ + HRESULT res; + OutTraceD3D("UpdateSurface: lpd3dd=%x sourcesurface=%x destsurface=%x\n", lpd3dd, pSourceSurface, pDestinationSurface); + res = (*pUpdateSurface)(lpd3dd, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint); + return res; +} + +HRESULT WINAPI extUpdateTexture(void *lpd3dd, IDirect3DBaseTexture9 *pSourceTexture, IDirect3DBaseTexture9 *pDestinationTexture) +{ + HRESULT res; + OutTraceD3D("UpdateTexture: lpd3dd=%x sourcetexture=%x desttexture=%x\n", lpd3dd, pSourceTexture, pDestinationTexture); + res = (*pUpdateTexture)(lpd3dd, pSourceTexture, pDestinationTexture); + return res; +} + +HRESULT WINAPI extSetPrivateData(void *lpd3dd, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) +{ + HRESULT res; + OutTraceD3D("SetPrivateData: lpd3dd=%x refguid=%x pData=%x size=%x flags=%x\n", lpd3dd, refguid, pData, SizeOfData, Flags); + res = (*pSetPrivateData)(lpd3dd, refguid, pData, SizeOfData, Flags); + return res; +} + +HRESULT WINAPI extQueryInterfaceTex(void *obj, REFIID riid, void** ppvObj) +{ + HRESULT res; + OutTraceD3D("D3D::QueryInterface(T9): d3d=%x riid=%x\n", obj, riid.Data1); + res=pQueryInterfaceTex(obj, riid, ppvObj); + if(res) + OutTraceE("D3D::QueryInterface(T9): ERROR ret=%x(%s)\n", res, ExplainDDError(res)); + else + OutTraceD3D("D3D::QueryInterface(T9): obp=%x\n", *ppvObj); + return res; +} +#endif + diff --git a/dll/hd3d7.cpp b/dll/hd3d7.cpp index a4513eb..04869a2 100644 --- a/dll/hd3d7.cpp +++ b/dll/hd3d7.cpp @@ -9,6 +9,9 @@ #include "syslibs.h" #include "dxhelper.h" +//#undef OutTraceD3D +//#define OutTraceD3D OutTrace + // exported API typedef HRESULT (WINAPI *Direct3DCreateDevice_Type)(GUID FAR *, LPDIRECT3D, LPDIRECTDRAWSURFACE, LPDIRECT3D *, LPUNKNOWN); @@ -139,7 +142,6 @@ NextViewport1_Type pNextViewport1 = NULL; DeleteViewport2_Type pDeleteViewport2 = NULL; NextViewport2_Type pNextViewport2 = NULL; - HRESULT WINAPI extInitialize(void *); HRESULT WINAPI extEnumDevices(void *, LPD3DENUMDEVICESCALLBACK, LPVOID); HRESULT WINAPI extEnumDevices7(void *, LPD3DENUMDEVICESCALLBACK7, LPVOID); @@ -501,8 +503,8 @@ HRESULT WINAPI extDirect3DCreateDevice(GUID FAR *lpGUID, LPDIRECT3D lpd3ddevice, { HRESULT res; - OutTraceD3D("Direct3DCreateDevice: guid=%x d3ddevice=%x dds=%x UnkOuter=%x\n", - lpGUID, lpd3ddevice, surf, pUnkOuter); + OutTraceD3D("Direct3DCreateDevice: guid=%x d3ddevice=%x dds=%x%s UnkOuter=%x\n", + lpGUID, lpd3ddevice, surf, dxw.ExplainSurfaceRole(surf), pUnkOuter); res=(*pDirect3DCreateDevice)(lpGUID, lpd3ddevice, surf, lplpd3ddevice, pUnkOuter); if(res) OutTraceE("Direct3DCreateDevice ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); else OutTraceD3D("Direct3DCreateDevice: d3ddevice=%x\n", *lplpd3ddevice); @@ -876,7 +878,8 @@ HRESULT WINAPI extCreateDevice2(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE { HRESULT res; - OutTraceD3D("CreateDevice(D3D2): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); + OutTraceD3D("CreateDevice(D3D2): d3d=%x GUID=%x(%s) lpdds=%x%s\n", + lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxw.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds)); res=(*pCreateDevice2)(lpd3d, Guid, lpdds, lplpd3dd); if(res) { OutTraceE("CreateDevice(D3D2) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); @@ -899,7 +902,8 @@ HRESULT WINAPI extCreateDevice3(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE4 { HRESULT res; - OutTraceD3D("CreateDevice(D3D3): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); + OutTraceD3D("CreateDevice(D3D3): d3d=%x GUID=%x(%s) lpdds=%x%s\n", + lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxw.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds)); res=(*pCreateDevice3)(lpd3d, Guid, lpdds, lplpd3dd, unk); if(res) { OutTraceE("CreateDevice(D3D3) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); @@ -921,25 +925,28 @@ HRESULT WINAPI extCreateDevice3(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE4 HRESULT WINAPI extCreateDevice7(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE7 lpdds, LPDIRECT3DDEVICE7 *lplpd3dd) { - // v2.02.83: D3D CreateDevice (version 7? all versions?) internally calls the Release method upon th ebackbuffer + // v2.02.83: D3D CreateDevice (version 7? all versions?) internally calls the Release method upon the backbuffer // surface, and this has to be avoided since it causes a crash. - // The bDontReleaseBackBuffer boolean tells extReleaseS NOT to perform an actual release operation. + // The bIsWithinD3DCreateDevice boolean tells extReleaseS NOT to perform an actual release operation. + // v2.03.20: also, D3D CreateDevice internally Release the primary surface lpdds and builds a new primary + // using the same lpdds value, but issuing a QueryInterface call upon a zero-referenced object! HRESULT res; - extern BOOL bDontReleaseBackBuffer; + extern BOOL bIsWithinD3DCreateDevice; - OutTraceD3D("CreateDevice(D3D7): d3d=%x GUID=%x(%s) lpdds=%x\n", lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds); - bDontReleaseBackBuffer = TRUE; + OutTraceD3D("CreateDevice(D3D7): d3d=%x GUID=%x(%s) lpdds=%x%s\n", + lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxw.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds)); + bIsWithinD3DCreateDevice = TRUE; res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd); - bDontReleaseBackBuffer = FALSE; + bIsWithinD3DCreateDevice = FALSE; if(res) { OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); if((dxw.dwFlags1 & AUTOMATIC) && (dxw.dwFlags1 & EMULATESURFACE)) { dxw.dwFlags1 &= ~EMULATESURFACE; dxw.dwFlags1 |= LOCKEDSURFACE; - bDontReleaseBackBuffer = TRUE; + bIsWithinD3DCreateDevice = TRUE; res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd); - bDontReleaseBackBuffer = FALSE; + bIsWithinD3DCreateDevice = FALSE; if (res) OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__); else OutTraceD3D("CreateDevice(D3D7): Emulation OFF\n"); } @@ -1520,9 +1527,9 @@ typedef struct { HRESULT WINAPI extZBufferProxy(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext) { HRESULT res; - OutTraceD3D("EnumZBufferFormats: CALLBACK PixelFormat=%x(%s) context=%x\n", lpDDPixFmt->dwFlags, lpContext); + OutTraceD3D("EnumZBufferFormats: CALLBACK context=%x %s \n", ((CallbackZBufArg *)lpContext)->arg, ExplainPixelFormat(lpDDPixFmt)); res = (*(((CallbackZBufArg *)lpContext)->cb))(lpDDPixFmt, ((CallbackZBufArg *)lpContext)->arg); - OutTraceD3D("EnumDevices: CALLBACK ret=%x\n", res); + OutTraceD3D("EnumZBufferFormats: CALLBACK ret=%x\n", res); return res; } diff --git a/dll/hddraw.h b/dll/hddraw.h index 3cce6e6..3ac8b6d 100644 --- a/dll/hddraw.h +++ b/dll/hddraw.h @@ -4,6 +4,7 @@ typedef HRESULT (WINAPI *DirectDrawCreate_Type)(GUID *, LPDIRECTDRAW *, IUnknown typedef HRESULT (WINAPI *DirectDrawCreateEx_Type)(GUID *, LPDIRECTDRAW *, REFIID, IUnknown *); typedef HRESULT (WINAPI *DirectDrawEnumerate_Type)(LPDDENUMCALLBACK, LPVOID); typedef HRESULT (WINAPI *DirectDrawEnumerateEx_Type)(LPDDENUMCALLBACKEX, LPVOID, DWORD); +typedef HRESULT (WINAPI *DirectDrawCreateClipper_Type)(DWORD, LPDIRECTDRAWCLIPPER *, IUnknown *); typedef HDC (WINAPI *GDIGetDC_Type)(HWND); typedef int (WINAPI *GDIReleaseDC_Type)(HWND, HDC); diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index 940f747..ab89169 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -12,10 +12,14 @@ #define LOCKINJECTIONTHREADS BOOL WINAPI extCheckRemoteDebuggerPresent(HANDLE, PBOOL); +LPVOID WINAPI extVirtualAlloc(LPVOID, SIZE_T, DWORD, DWORD); +typedef LPVOID (WINAPI *VirtualAlloc_Type)(LPVOID, SIZE_T, DWORD, DWORD); typedef BOOL (WINAPI *CreateProcessA_Type)(LPCTSTR, LPTSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPCTSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION); + CreateProcessA_Type pCreateProcessA = NULL; +VirtualAlloc_Type pVirtualAlloc = NULL; #ifdef NOFREELIBRARY typedef BOOL (WINAPI *FreeLibrary_Type)(HMODULE); @@ -49,6 +53,11 @@ static HookEntry_Type Hooks[]={ {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator }; +static HookEntry_Type FixAllocHooks[]={ + {HOOK_IAT_CANDIDATE, "VirtualAlloc", (FARPROC)VirtualAlloc, (FARPROC *)&pVirtualAlloc, (FARPROC)extVirtualAlloc}, + {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator +}; + static HookEntry_Type FixIOHooks[]={ {HOOK_IAT_CANDIDATE, "ReadFile", (FARPROC)NULL, (FARPROC *)&pReadFile, (FARPROC)extReadFile}, {HOOK_IAT_CANDIDATE, "CreateFileA", (FARPROC)NULL, (FARPROC *)&pCreateFile, (FARPROC)extCreateFile}, @@ -91,14 +100,17 @@ void HookKernel32(HMODULE module) if(dxw.dwFlags2 & LIMITRESOURCES) HookLibrary(module, LimitHooks, libname); if(dxw.dwFlags2 & TIMESTRETCH) HookLibrary(module, TimeHooks, libname); if(dxw.dwFlags2 & FAKEVERSION) HookLibrary(module, VersionHooks, libname); + if(dxw.dwFlags6 & LEGACYALLOC) HookLibrary(module, FixAllocHooks, libname); } void HookKernel32Init() { HookLibInit(Hooks); + HookLibInit(FixIOHooks); HookLibInit(LimitHooks); HookLibInit(TimeHooks); HookLibInit(VersionHooks); + HookLibInit(FixAllocHooks); } FARPROC Remap_kernel32_ProcAddress(LPCSTR proc, HMODULE hModule) @@ -127,6 +139,8 @@ FARPROC Remap_kernel32_ProcAddress(LPCSTR proc, HMODULE hModule) if(dxw.dwFlags2 & FAKEVERSION) if (addr=RemapLibrary(proc, hModule, VersionHooks)) return addr; + if(dxw.dwFlags6 & LEGACYALLOC) + if (addr=RemapLibrary(proc, hModule, FixAllocHooks)) return addr; return NULL; } @@ -254,17 +268,25 @@ For Windows NT and Win32s, the remaining bits in the high order word specify the For Windows 95 and Windows 98, the remaining bits of the high order word are reserved. */ -static struct {char bMajor; char bMinor; char *sName;} WinVersions[9]= +// v2.03.20: "Talonsoft's Operational Art of War II" checks the dwPlatformId field +// v2.03.20: list revised according to Microsoft compatibility settings + +static struct {DWORD bMajor; DWORD bMinor; DWORD dwPlatformId; DWORD build; char *sName;} WinVersions[9]= { - {4, 0, "Windows 95"}, - {4,10, "Windows 98/SE"}, - {4,90, "Windows ME"}, - {5, 0, "Windows 2000"}, - {5, 1, "Windows XP"}, - {5, 2, "Windows Server 2003"}, - {6, 0, "Windows Vista"}, - {6, 1, "Windows 7"}, - {6, 2, "Windows 8"} + {4, 0, VER_PLATFORM_WIN32_WINDOWS, 950, "Windows 95"}, + {4,10, VER_PLATFORM_WIN32_WINDOWS, 67766446, "Windows 98/SE"}, + {4,90, VER_PLATFORM_WIN32_WINDOWS, 0, "Windows ME"}, +// {4, 0, VER_PLATFORM_WIN32_NT, 1381, "Windows NT4.0(sp5)"}, + {5, 0, VER_PLATFORM_WIN32_NT, 2195, "Windows 2000"}, +// {5, 1, VER_PLATFORM_WIN32_NT, 2600, "Windows XP(sp2)"}, + {5, 1, VER_PLATFORM_WIN32_NT, 2600, "Windows XP(sp3)"}, + {5, 2, VER_PLATFORM_WIN32_NT, 3790, "Windows Server 2003(sp1)"}, +// {6, 0, VER_PLATFORM_WIN32_NT, 6001, "Windows Server 2008(sp1)"}, +// {6, 0, VER_PLATFORM_WIN32_NT, 6000, "Windows Vista"}, +// {6, 0, VER_PLATFORM_WIN32_NT, 6001, "Windows Vista(sp1)"}, + {6, 0, VER_PLATFORM_WIN32_NT, 6002, "Windows Vista(sp2)"}, + {6, 1, VER_PLATFORM_WIN32_NT, 7600, "Windows 7"}, + {6, 2, VER_PLATFORM_WIN32_NT, 0, "Windows 8"} }; BOOL WINAPI extGetVersionExA(LPOSVERSIONINFOA lpVersionInfo) @@ -277,16 +299,17 @@ BOOL WINAPI extGetVersionExA(LPOSVERSIONINFOA lpVersionInfo) return ret; } - OutTraceDW("GetVersionExA: version=%d.%d build=(%d)\n", - lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber); + OutTraceDW("GetVersionExA: version=%d.%d platform=%x build=(%d)\n", + lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwPlatformId, lpVersionInfo->dwBuildNumber); if(dxw.dwFlags2 & FAKEVERSION) { // fake Win XP build 0 lpVersionInfo->dwMajorVersion = WinVersions[dxw.FakeVersionId].bMajor; lpVersionInfo->dwMinorVersion = WinVersions[dxw.FakeVersionId].bMinor; + lpVersionInfo->dwPlatformId = WinVersions[dxw.FakeVersionId].dwPlatformId; lpVersionInfo->dwBuildNumber = 0; - OutTraceDW("GetVersionExA: FIXED version=%d.%d build=(%d) os=\"%s\"\n", - lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber, + OutTraceDW("GetVersionExA: FIXED version=%d.%d platform=%x build=(%d) os=\"%s\"\n", + lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwPlatformId, lpVersionInfo->dwBuildNumber, WinVersions[dxw.FakeVersionId].sName); } return TRUE; @@ -302,16 +325,17 @@ BOOL WINAPI extGetVersionExW(LPOSVERSIONINFOW lpVersionInfo) return ret; } - OutTraceDW("GetVersionExW: version=%d.%d build=(%d)\n", - lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber); + OutTraceDW("GetVersionExW: version=%d.%d platform=%x build=(%d)\n", + lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwPlatformId, lpVersionInfo->dwBuildNumber); if(dxw.dwFlags2 & FAKEVERSION) { // fake Win XP build 0 lpVersionInfo->dwMajorVersion = WinVersions[dxw.FakeVersionId].bMajor; lpVersionInfo->dwMinorVersion = WinVersions[dxw.FakeVersionId].bMinor; + lpVersionInfo->dwPlatformId = WinVersions[dxw.FakeVersionId].dwPlatformId; lpVersionInfo->dwBuildNumber = 0; - OutTraceDW("GetVersionExW: FIXED version=%d.%d build=(%d) os=\"%ls\"\n", - lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwBuildNumber, + OutTraceDW("GetVersionExW: FIXED version=%d.%d platform=%x build=(%d) os=\"%s\"\n", + lpVersionInfo->dwMajorVersion, lpVersionInfo->dwMinorVersion, lpVersionInfo->dwPlatformId, lpVersionInfo->dwBuildNumber, WinVersions[dxw.FakeVersionId].sName); } return TRUE; @@ -1027,3 +1051,33 @@ UINT WINAPI extGetTempFileName(LPCTSTR lpPathName, LPCTSTR lpPrefixString, UINT } return ret; } + +LPVOID WINAPI extVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) +{ + // v2.03.20: handling of legacy memory segments. + // Some games (Crusaders of Might and Magic, the demo and the GOG release) rely on the fact that the + // program can VirtualAlloc-ate memory on certain tipically free segments (0x4000000, 0x5000000, + // 0x6000000, 0x7000000 and 0x8000000) but when the program is hooked by DxWnd these segments could + // be allocated to extra dlls or allocated memory. + // The trick is ti pre-allocate this memory and free it upon error to make it certainly available to + // the calling program. + + LPVOID ret; + OutTraceB("VirtualAlloc: lpAddress=%x size=%x flag=%x protect=%x\n", lpAddress, dwSize, flAllocationType, flProtect); + ret = (*pVirtualAlloc)(lpAddress, dwSize, flAllocationType, flProtect); + if((ret == NULL) && lpAddress){ + OutTraceE("VirtualAlloc: RECOVERY lpAddress=%x size=%x flag=%x protect=%x\n", + lpAddress, dwSize, flAllocationType, flProtect); + if (((DWORD)lpAddress & 0xF0FFFFFF) == 0){ + BOOL bret; + bret = VirtualFree(lpAddress, 0x00000000, MEM_RELEASE); + if(!bret) OutTraceE("VirtualFree: MEM_RELEASE err=%d\n", GetLastError()); + ret = (*pVirtualAlloc)(lpAddress, dwSize, flAllocationType, flProtect); + if (ret == NULL) OutTraceE("VirtualAlloc: addr=%x err=%d\n", lpAddress, GetLastError()); + } + if (!ret) ret = (*pVirtualAlloc)((LPVOID)0x00000000, dwSize, flAllocationType, flProtect); + if(ret == NULL) OutTraceE("VirtualAlloc: addr=NULL err=%d\n", GetLastError()); + } + OutTrace("VirtualAlloc: ret=%x\n", ret); + return ret; +} \ No newline at end of file diff --git a/dll/user32.cpp b/dll/user32.cpp index e9c5e42..7e1262c 100644 --- a/dll/user32.cpp +++ b/dll/user32.cpp @@ -137,18 +137,6 @@ static HookEntry_Type EmulateHooks[]={ {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator }; -static HookEntry_Type DDHooks[]={ - {HOOK_IAT_CANDIDATE, "BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extDDBeginPaint}, - //{HOOK_IAT_CANDIDATE, "BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extBeginPaint}, - {HOOK_IAT_CANDIDATE, "EndPaint", (FARPROC)EndPaint, (FARPROC *)&pEndPaint, (FARPROC)extDDEndPaint}, - {HOOK_IAT_CANDIDATE, "GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extDDGetDC}, - {HOOK_IAT_CANDIDATE, "GetDCEx", (FARPROC)GetDCEx, (FARPROC *)&pGDIGetDCEx, (FARPROC)extDDGetDCEx}, - {HOOK_IAT_CANDIDATE, "GetWindowDC", (FARPROC)GetWindowDC, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extDDGetDC}, - {HOOK_IAT_CANDIDATE, "ReleaseDC", (FARPROC)ReleaseDC, (FARPROC *)&pGDIReleaseDC, (FARPROC)extDDReleaseDC}, - {HOOK_IAT_CANDIDATE, "InvalidateRect", (FARPROC)InvalidateRect, (FARPROC *)&pInvalidateRect, (FARPROC)extInvalidateRect}, - {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator -}; - static HookEntry_Type ScaledHooks[]={ {HOOK_IAT_CANDIDATE, "FrameRect", (FARPROC)NULL, (FARPROC *)&pFrameRect, (FARPROC)extFrameRect}, {HOOK_IAT_CANDIDATE, "TabbedTextOutA", (FARPROC)TabbedTextOutA, (FARPROC *)&pTabbedTextOutA, (FARPROC)extTabbedTextOutA}, @@ -166,6 +154,18 @@ static HookEntry_Type ScaledHooks[]={ {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator }; +static HookEntry_Type DDHooks[]={ + {HOOK_IAT_CANDIDATE, "BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extDDBeginPaint}, + //{HOOK_IAT_CANDIDATE, "BeginPaint", (FARPROC)BeginPaint, (FARPROC *)&pBeginPaint, (FARPROC)extBeginPaint}, + {HOOK_IAT_CANDIDATE, "EndPaint", (FARPROC)EndPaint, (FARPROC *)&pEndPaint, (FARPROC)extDDEndPaint}, + {HOOK_IAT_CANDIDATE, "GetDC", (FARPROC)GetDC, (FARPROC *)&pGDIGetDC, (FARPROC)extDDGetDC}, + {HOOK_IAT_CANDIDATE, "GetDCEx", (FARPROC)GetDCEx, (FARPROC *)&pGDIGetDCEx, (FARPROC)extDDGetDCEx}, + {HOOK_IAT_CANDIDATE, "GetWindowDC", (FARPROC)GetWindowDC, (FARPROC *)&pGDIGetWindowDC, (FARPROC)extDDGetDC}, + {HOOK_IAT_CANDIDATE, "ReleaseDC", (FARPROC)ReleaseDC, (FARPROC *)&pGDIReleaseDC, (FARPROC)extDDReleaseDC}, + {HOOK_IAT_CANDIDATE, "InvalidateRect", (FARPROC)InvalidateRect, (FARPROC *)&pInvalidateRect, (FARPROC)extInvalidateRect}, + {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator +}; + static HookEntry_Type RemapHooks[]={ {HOOK_IAT_CANDIDATE, "ScreenToClient", (FARPROC)ScreenToClient, (FARPROC *)&pScreenToClient, (FARPROC)extScreenToClient}, {HOOK_IAT_CANDIDATE, "ClientToScreen", (FARPROC)ClientToScreen, (FARPROC *)&pClientToScreen, (FARPROC)extClientToScreen}, @@ -1877,16 +1877,20 @@ static HDC WINAPI sGetDC(HWND hwnd, char *ApiName) #ifdef HANDLEFLIPTOGDI extern BOOL bFlippedDC; - //if(bFlippedDC && (OBJ_DC == GetObjectType(ret))) { if(bFlippedDC) { extern HDC hFlippedDC; LPDIRECTDRAWSURFACE lpDDSPrim; - //extern Unlock4_Type pUnlockMethod(LPDIRECTDRAWSURFACE); lpDDSPrim = dxw.GetPrimarySurface(); - //(*pUnlockMethod(lpDDSPrim))(lpDDSPrim, NULL); - (*pGetDC)(lpDDSPrim, &hFlippedDC); +#if 0 + // v2.03.20: beware, from this release the output from dxw.GetPrimarySurface() could be a + // zero reference counter released surface that could be used to feed a QueryInterface method, + // but would crash if used otherwise. + __try {(*pGetDC)(lpDDSPrim, &hFlippedDC);} __except(EXCEPTION_EXECUTE_HANDLER){hFlippedDC=NULL;}; +#else + if (lpDDSPrim) (*pGetDC)(lpDDSPrim, &hFlippedDC); +#endif OutTraceDW("%s: remapping flipped GDI hdc=%x\n", ApiName, hFlippedDC); - return hFlippedDC; + if(hFlippedDC) return hFlippedDC; } #endif @@ -1964,7 +1968,7 @@ int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC) OutTraceDW("GDI.ReleaseDC: releasing flipped GDI hdc=%x\n", hDC); ret=(*pReleaseDC)(dxw.GetPrimarySurface(), hDC); if (ret) OutTraceE("GDI.ReleaseDC ERROR: err=%x(%s) at %d\n", ret, ExplainDDError(ret), __LINE__); - dxw.ScreenRefresh(); + else dxw.ScreenRefresh(); return (ret == DD_OK); } #endif @@ -2332,10 +2336,15 @@ LONG WINAPI extTabbedTextOutA(HDC hdc, int X, int Y, LPCTSTR lpString, int nCoun BOOL WINAPI extDestroyWindow(HWND hWnd) { - // v2.02.43: Empire Earth builds test surfaces that must be destroyed! + // v2.02.43: "Empire Earth" builds test surfaces that must be destroyed! + // v2.03.20: "Prince of Persia 3D" destroys the main window that must be preserved! BOOL res; OutTraceB("DestroyWindow: hwnd=%x\n", hWnd); if (hWnd == dxw.GethWnd()) { + if(dxw.dwFlags6 & NODESTROYWINDOW) { + OutTraceDW("DestroyWindow: do NOT destroy main hwnd=%x\n", hWnd); + return TRUE; + } OutTraceDW("DestroyWindow: destroy main hwnd=%x\n", hWnd); dxw.SethWnd(NULL); } diff --git a/host/TabCompat.cpp b/host/TabCompat.cpp index ce3d98c..abce254 100644 --- a/host/TabCompat.cpp +++ b/host/TabCompat.cpp @@ -40,6 +40,7 @@ void CTabCompat::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_HIDECDROMEMPTY, cTarget->m_HideCDROMEmpty); DDX_Check(pDX, IDC_DIABLOTWEAK, cTarget->m_DiabloTweak); DDX_Check(pDX, IDC_EASPORTSHACK, cTarget->m_EASportsHack); + DDX_Check(pDX, IDC_LEGACYALLOC, cTarget->m_LegacyAlloc); DDX_Check(pDX, IDC_NOIMAGEHLP, cTarget->m_NoImagehlp); DDX_Check(pDX, IDC_REPLACEPRIVOPS, cTarget->m_ReplacePrivOps); diff --git a/host/TabWindow.cpp b/host/TabWindow.cpp index bf552f4..233f0ea 100644 --- a/host/TabWindow.cpp +++ b/host/TabWindow.cpp @@ -43,9 +43,9 @@ void CTabWindow::DoDataExchange(CDataExchange* pDX) DDX_Check(pDX, IDC_REFRESHONRESIZE, cTarget->m_RefreshOnResize); DDX_Check(pDX, IDC_FIXD3DFRAME, cTarget->m_FixD3DFrame); DDX_Check(pDX, IDC_NOWINDOWMOVE, cTarget->m_NoWindowMove); - //DDX_Check(pDX, IDC_SUPPRESSCHILD, cTarget->m_SuppressChild); DDX_Check(pDX, IDC_HIDEDESKTOP, cTarget->m_HideDesktop); DDX_Check(pDX, IDC_UNLOCKZORDER, cTarget->m_UnlockZOrder); + DDX_Check(pDX, IDC_NODESTROYWINDOW, cTarget->m_NoDestroyWindow); // color management DDX_Check(pDX, IDC_INIT8BPP, cTarget->m_Init8BPP); diff --git a/host/TargetDlg.cpp b/host/TargetDlg.cpp index c136853..0ddd676 100644 --- a/host/TargetDlg.cpp +++ b/host/TargetDlg.cpp @@ -46,6 +46,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_AEROBoost = TRUE; // default true !! m_DiabloTweak = FALSE; m_EASportsHack = FALSE; + m_LegacyAlloc = FALSE; m_NoImagehlp = FALSE; m_ReplacePrivOps = FALSE; m_ForcesHEL = FALSE; @@ -56,9 +57,9 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/) m_FixRefCounter = TRUE; // default true !! m_ReturnNullRef = FALSE; m_NoD3DReset = FALSE; - //m_SuppressChild = FALSE; m_HideDesktop = FALSE; m_UnlockZOrder = FALSE; + m_NoDestroyWindow = FALSE; m_LockSysColors = FALSE; m_LockReservedPalette = FALSE; m_ForceYUVtoRGB = FALSE; diff --git a/host/TargetDlg.h b/host/TargetDlg.h index 6b17882..9611b4c 100644 --- a/host/TargetDlg.h +++ b/host/TargetDlg.h @@ -168,6 +168,7 @@ public: BOOL m_AEROBoost; BOOL m_DiabloTweak; BOOL m_EASportsHack; + BOOL m_LegacyAlloc; BOOL m_NoImagehlp; BOOL m_ForcesHEL; BOOL m_ForcesSwapEffect; @@ -177,9 +178,9 @@ public: BOOL m_FixRefCounter; BOOL m_ReturnNullRef; BOOL m_NoD3DReset; - //BOOL m_SuppressChild; BOOL m_HideDesktop; BOOL m_UnlockZOrder; + BOOL m_NoDestroyWindow; BOOL m_LockSysColors; BOOL m_LockReservedPalette; BOOL m_SingleProcAffinity; diff --git a/host/dxwndhost.aps b/host/dxwndhost.aps index 34f53ba..c6fff39 100644 Binary files a/host/dxwndhost.aps and b/host/dxwndhost.aps differ diff --git a/host/dxwndhost.rc b/host/dxwndhost.rc index d3e3113..75d8e63 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 d2f4513..8d76bf3 100644 Binary files a/host/dxwndhost.vs2008.suo and b/host/dxwndhost.vs2008.suo differ diff --git a/host/dxwndhostView.cpp b/host/dxwndhostView.cpp index a02dd19..a4a7c9c 100644 --- a/host/dxwndhostView.cpp +++ b/host/dxwndhostView.cpp @@ -273,6 +273,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_AEROBoost) t->flags5 |= AEROBOOST; if(dlg->m_DiabloTweak) t->flags5 |= DIABLOTWEAK; if(dlg->m_EASportsHack) t->flags5 |= EASPORTSHACK; + if(dlg->m_LegacyAlloc) t->flags6 |= LEGACYALLOC; if(dlg->m_NoImagehlp) t->flags5 |= NOIMAGEHLP; if(dlg->m_ForcesHEL) t->flags3 |= FORCESHEL; if(dlg->m_ForcesSwapEffect) t->flags6 |= FORCESWAPEFFECT; @@ -282,9 +283,9 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg) if(dlg->m_FixRefCounter) t->flags4 |= FIXREFCOUNTER; if(dlg->m_ReturnNullRef) t->flags4 |= RETURNNULLREF; if(dlg->m_NoD3DReset) t->flags4 |= NOD3DRESET; - //if(dlg->m_SuppressChild) t->flags4 |= SUPPRESSCHILD; if(dlg->m_HideDesktop) t->flags4 |= HIDEDESKTOP; if(dlg->m_UnlockZOrder) t->flags5 |= UNLOCKZORDER; + if(dlg->m_NoDestroyWindow) t->flags6 |= NODESTROYWINDOW; if(dlg->m_LockSysColors) t->flags3 |= LOCKSYSCOLORS; if(dlg->m_LockReservedPalette) t->flags5 |= LOCKRESERVEDPALETTE; if(dlg->m_ForceYUVtoRGB) t->flags3 |= YUV2RGB; @@ -474,6 +475,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_AEROBoost = t->flags5 & AEROBOOST ? 1 : 0; dlg->m_DiabloTweak = t->flags5 & DIABLOTWEAK ? 1 : 0; dlg->m_EASportsHack = t->flags5 & EASPORTSHACK ? 1 : 0; + dlg->m_LegacyAlloc = t->flags6 & LEGACYALLOC ? 1 : 0; dlg->m_NoImagehlp = t->flags5 & NOIMAGEHLP ? 1 : 0; dlg->m_ForcesHEL = t->flags3 & FORCESHEL ? 1 : 0; dlg->m_ForcesSwapEffect = t->flags6 & FORCESWAPEFFECT ? 1 : 0; @@ -483,9 +485,9 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg) dlg->m_FixRefCounter = t->flags4 & FIXREFCOUNTER ? 1 : 0; dlg->m_ReturnNullRef = t->flags4 & RETURNNULLREF ? 1 : 0; dlg->m_NoD3DReset = t->flags4 & NOD3DRESET ? 1 : 0; - //dlg->m_SuppressChild = t->flags4 & SUPPRESSCHILD ? 1 : 0; dlg->m_HideDesktop = t->flags4 & HIDEDESKTOP ? 1 : 0; dlg->m_UnlockZOrder = t->flags5 & UNLOCKZORDER ? 1 : 0; + dlg->m_NoDestroyWindow = t->flags6 & NODESTROYWINDOW ? 1 : 0; dlg->m_LockSysColors = t->flags3 & LOCKSYSCOLORS ? 1 : 0; dlg->m_LockReservedPalette = t->flags5 & LOCKRESERVEDPALETTE ? 1 : 0; dlg->m_ForceRGBtoYUV = t->flags3 & RGB2YUV ? 1 : 0; diff --git a/host/resource b/host/resource index 80e061a..81ac5e8 100644 Binary files a/host/resource and b/host/resource differ