mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_03_21_src
Former-commit-id: bcb04b99f4d3963eef2bc6747920fcb5100767d1
This commit is contained in:
parent
1beb97e5aa
commit
d3dab9deb9
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:8b63cb25a2b2f543143293943a740859894c0a8b2ff156428c40376380a47a13
|
oid sha256:95762cfc50b158119d3bcb3d7a613dd13ae5abc3555c4c8153d9560bdafad4e6
|
||||||
size 577536
|
size 577536
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
[window]
|
|
||||||
posx=50
|
|
||||||
posy=50
|
|
||||||
sizx=320
|
|
||||||
sizy=200
|
|
@ -5,10 +5,10 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=134218272
|
flag0=134217762
|
||||||
flagg0=134217728
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4
|
flagi0=4194308
|
||||||
tflag0=0
|
tflag0=0
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -5,11 +5,11 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=150994976
|
flag0=136331298
|
||||||
flagg0=1207959552
|
flagg0=1207959552
|
||||||
flagh0=25165844
|
flagh0=20
|
||||||
flagi0=0
|
flagi0=4194304
|
||||||
tflag0=259
|
tflag0=0
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
minx0=0
|
minx0=0
|
||||||
@ -22,3 +22,10 @@ sizx0=800
|
|||||||
sizy0=600
|
sizy0=600
|
||||||
maxfps0=0
|
maxfps0=0
|
||||||
initts0=0
|
initts0=0
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
winver0=0
|
||||||
|
maxres0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -5,10 +5,10 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=671088676
|
flag0=671088678
|
||||||
flagg0=1207959552
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=0
|
flagi0=4194304
|
||||||
tflag0=0
|
tflag0=0
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -22,3 +22,10 @@ sizx0=800
|
|||||||
sizy0=600
|
sizy0=600
|
||||||
maxfps0=0
|
maxfps0=0
|
||||||
initts0=0
|
initts0=0
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
winver0=0
|
||||||
|
maxres0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -8,7 +8,7 @@ coord0=0
|
|||||||
flag0=134217762
|
flag0=134217762
|
||||||
flagg0=1207959552
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4
|
flagi0=4194308
|
||||||
tflag0=0
|
tflag0=0
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -22,3 +22,10 @@ sizx0=800
|
|||||||
sizy0=600
|
sizy0=600
|
||||||
maxfps0=0
|
maxfps0=0
|
||||||
initts0=0
|
initts0=0
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
winver0=0
|
||||||
|
maxres0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -5,8 +5,8 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=134234660
|
flag0=134234150
|
||||||
flagg0=134217728
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4325380
|
flagi0=4325380
|
||||||
tflag0=64
|
tflag0=64
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -6,7 +6,7 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=134217760
|
flag0=134217762
|
||||||
flagg0=1207959552
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=138412036
|
flagi0=138412036
|
||||||
@ -25,3 +25,7 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
notes0=
|
||||||
|
flagj0=4224
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -5,11 +5,11 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=134217760
|
flag0=134217762
|
||||||
flagg0=1212153856
|
flagg0=1212153856
|
||||||
flagh0=65556
|
flagh0=65556
|
||||||
flagi0=4
|
flagi0=4194308
|
||||||
tflag0=6211
|
tflag0=6147
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
minx0=0
|
minx0=0
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=1
|
winver0=1
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -8,7 +8,7 @@ coord0=0
|
|||||||
flag0=134217762
|
flag0=134217762
|
||||||
flagg0=1208025088
|
flagg0=1208025088
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4
|
flagi0=4194308
|
||||||
tflag0=0
|
tflag0=0
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=2
|
initts0=2
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -5,10 +5,10 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=671088673
|
flag0=671088675
|
||||||
flagg0=1207959552
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=131076
|
flagi0=4325380
|
||||||
tflag0=6147
|
tflag0=6147
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -5,10 +5,10 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=402669604
|
flag0=402669606
|
||||||
flagg0=134217728
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4
|
flagi0=4194308
|
||||||
tflag0=64
|
tflag0=64
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -5,10 +5,10 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=1
|
ver0=1
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=134218272
|
flag0=134217762
|
||||||
flagg0=134217728
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4
|
flagi0=4194308
|
||||||
tflag0=0
|
tflag0=0
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -6,8 +6,8 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=7
|
ver0=7
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=671105312
|
flag0=671105058
|
||||||
flagg0=-937410560
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=138412036
|
flagi0=138412036
|
||||||
flagj0=128
|
flagj0=128
|
||||||
@ -26,3 +26,6 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
notes0=
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -5,10 +5,10 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=134267425
|
flag0=134266915
|
||||||
flagg0=134217728
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4
|
flagi0=4194308
|
||||||
tflag0=6146
|
tflag0=6146
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -26,4 +26,6 @@ winver0=0
|
|||||||
maxres0=-1
|
maxres0=-1
|
||||||
launchpath0=
|
launchpath0=
|
||||||
notes0=
|
notes0=
|
||||||
flagj0=8388736
|
flagj0=262272
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -8,7 +8,7 @@ notes0=
|
|||||||
ver0=7
|
ver0=7
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=746602528
|
flag0=746602528
|
||||||
flagg0=1207959552
|
flagg0=1209008128
|
||||||
flagh0=16
|
flagh0=16
|
||||||
flagi0=138412036
|
flagi0=138412036
|
||||||
flagj0=142610600
|
flagj0=142610600
|
||||||
@ -27,3 +27,5 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -8,7 +8,7 @@ coord0=0
|
|||||||
flag0=134218272
|
flag0=134218272
|
||||||
flagg0=1207959552
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4
|
flagi0=4194308
|
||||||
tflag0=0
|
tflag0=0
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -5,10 +5,10 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=134218272
|
flag0=134217762
|
||||||
flagg0=1207959552
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4
|
flagi0=4194308
|
||||||
tflag0=6402
|
tflag0=6402
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -6,7 +6,7 @@ opengllib0=
|
|||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=134283430
|
flag0=134283430
|
||||||
flagg0=134217856
|
flagg0=1207959680
|
||||||
flagh0=29
|
flagh0=29
|
||||||
flagi0=4194308
|
flagi0=4194308
|
||||||
tflag0=0
|
tflag0=0
|
||||||
@ -25,3 +25,7 @@ initts0=0
|
|||||||
launchpath0=
|
launchpath0=
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=0
|
maxres0=0
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -8,8 +8,8 @@ coord0=0
|
|||||||
flag0=134217762
|
flag0=134217762
|
||||||
flagg0=1207959552
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=0
|
flagi0=4194304
|
||||||
tflag0=323
|
tflag0=64
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
minx0=0
|
minx0=0
|
||||||
@ -22,3 +22,10 @@ sizx0=800
|
|||||||
sizy0=600
|
sizy0=600
|
||||||
maxfps0=0
|
maxfps0=0
|
||||||
initts0=0
|
initts0=0
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=0
|
||||||
|
flagk0=0
|
||||||
|
winver0=0
|
||||||
|
maxres0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -5,10 +5,10 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=738197536
|
flag0=738197538
|
||||||
flagg0=1207959552
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4
|
flagi0=4194308
|
||||||
tflag0=0
|
tflag0=0
|
||||||
initx0=0
|
initx0=0
|
||||||
inity0=0
|
inity0=0
|
||||||
@ -24,3 +24,8 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
launchpath0=
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -6,7 +6,7 @@ opengllib0=
|
|||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=138428450
|
flag0=138428450
|
||||||
flagg0=201326592
|
flagg0=1275068416
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=4194304
|
flagi0=4194304
|
||||||
tflag0=259
|
tflag0=259
|
||||||
@ -25,3 +25,7 @@ initts0=0
|
|||||||
launchpath0=
|
launchpath0=
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=0
|
maxres0=0
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -6,7 +6,7 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=134218272
|
flag0=134217762
|
||||||
flagg0=1476395008
|
flagg0=1476395008
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=138412036
|
flagi0=138412036
|
||||||
@ -25,3 +25,7 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -6,7 +6,7 @@ module0=
|
|||||||
opengllib0=
|
opengllib0=
|
||||||
ver0=0
|
ver0=0
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=671105568
|
flag0=671105058
|
||||||
flagg0=1207959552
|
flagg0=1207959552
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=138412036
|
flagi0=138412036
|
||||||
@ -25,3 +25,7 @@ maxfps0=0
|
|||||||
initts0=0
|
initts0=0
|
||||||
winver0=0
|
winver0=0
|
||||||
maxres0=-1
|
maxres0=-1
|
||||||
|
notes0=
|
||||||
|
flagj0=128
|
||||||
|
flagk0=0
|
||||||
|
swapeffect0=0
|
||||||
|
@ -801,4 +801,8 @@ fix: texture handling for texture dump/hack/highlight
|
|||||||
add: "Reserve legacy memory segments" compatibility flag, needed for "Crusaders of Might & Magic"
|
add: "Reserve legacy memory segments" compatibility flag, needed for "Crusaders of Might & Magic"
|
||||||
add: preliminary support for ddraw7 DirectDrawCreateClipper api
|
add: preliminary support for ddraw7 DirectDrawCreateClipper api
|
||||||
add: "Suppress main window destruction" flag, to make "Prince of Persia 3D" playable
|
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
|
fix: fully revised ddraw surface handling in d3d1-7 versions. Now "Might & Magic IX" is supported
|
||||||
|
|
||||||
|
v2.03.21:
|
||||||
|
fix: full re-design of ddraw "special" surface management (primary & backbuffer): greater compatibility for emulation mode
|
||||||
|
fix: GDI edit window positioning for "Imperialism" city name selection
|
@ -8,7 +8,7 @@
|
|||||||
#include "hddraw.h"
|
#include "hddraw.h"
|
||||||
#include "dxhelper.h"
|
#include "dxhelper.h"
|
||||||
|
|
||||||
extern LPDIRECTDRAWSURFACE lpDDSBack;
|
//extern LPDIRECTDRAWSURFACE lpDDSBack;
|
||||||
extern LPDIRECTDRAWSURFACE lpDDSEmu_Prim;
|
extern LPDIRECTDRAWSURFACE lpDDSEmu_Prim;
|
||||||
extern LPDIRECTDRAW lpPrimaryDD;
|
extern LPDIRECTDRAW lpPrimaryDD;
|
||||||
extern Blt_Type pBlt;
|
extern Blt_Type pBlt;
|
||||||
@ -47,6 +47,8 @@ static HRESULT sBltNoPrimary(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdest
|
|||||||
// is fixed no matter how the window/primary surface is scaled.
|
// is fixed no matter how the window/primary surface is scaled.
|
||||||
// In "The Sims" there is no quality loss, but some scrolling artifact.
|
// In "The Sims" there is no quality loss, but some scrolling artifact.
|
||||||
if(lpsrcrect && FromScreen){
|
if(lpsrcrect && FromScreen){
|
||||||
|
LPDIRECTDRAWSURFACE lpDDSBack;
|
||||||
|
lpDDSBack = dxw.GetBackBufferSurface();
|
||||||
if(lpDDSBack && (dxw.dwFlags1 & BLITFROMBACKBUFFER)){
|
if(lpDDSBack && (dxw.dwFlags1 & BLITFROMBACKBUFFER)){
|
||||||
lpddssrc=lpDDSBack;
|
lpddssrc=lpDDSBack;
|
||||||
srcrect=dxw.GetScreenRect();
|
srcrect=dxw.GetScreenRect();
|
||||||
@ -151,7 +153,8 @@ static HRESULT sBltToPrimary(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdest
|
|||||||
if(!lpddssrc) {
|
if(!lpddssrc) {
|
||||||
if (isFlipping){
|
if (isFlipping){
|
||||||
// handle the flipping chain ...
|
// handle the flipping chain ...
|
||||||
lpddssrc=lpDDSBack;
|
//lpddssrc=lpDDSBack;
|
||||||
|
lpddssrc = dxw.GetBackBufferSurface();
|
||||||
OutTraceDW("Flip: setting flip chain to lpdds=%x\n", lpddssrc);
|
OutTraceDW("Flip: setting flip chain to lpdds=%x\n", lpddssrc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,11 +261,12 @@ static HRESULT sBltToPrimary(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdest
|
|||||||
V2.03.15: The same thing happens with "Silent Hunter III", but with DDERR_INVALIDRECT error code.
|
V2.03.15: The same thing happens with "Silent Hunter III", but with DDERR_INVALIDRECT error code.
|
||||||
*/
|
*/
|
||||||
if((res==DDERR_UNSUPPORTED) || (res==DDERR_EXCEPTION) || (res==DDERR_INVALIDRECT)){
|
if((res==DDERR_UNSUPPORTED) || (res==DDERR_EXCEPTION) || (res==DDERR_INVALIDRECT)){
|
||||||
RECT targetrect;
|
//RECT targetrect;
|
||||||
dxw.ShowOverlay(lpddssrc);
|
dxw.ShowOverlay(lpddssrc);
|
||||||
if (IsDebug) BlitTrace("UNSUPP", &emurect, &destrect, __LINE__);
|
if (IsDebug) BlitTrace("UNSUPP", &emurect, &destrect, __LINE__);
|
||||||
targetrect=dxw.MapWindowRect(&destrect); // v2.03.18
|
//targetrect=dxw.MapWindowRect(&destrect); // v2.03.18
|
||||||
res=(*pBlt)(lpDDSEmu_Prim, &targetrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx);
|
//res=(*pBlt)(lpDDSEmu_Prim, &targetrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx);
|
||||||
|
res=(*pBlt)(lpDDSEmu_Prim, &destrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx);
|
||||||
if (res) BlitError(res, lpsrcrect, &destrect, __LINE__);
|
if (res) BlitError(res, lpsrcrect, &destrect, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "syslibs.h"
|
#include "syslibs.h"
|
||||||
|
|
||||||
extern BOOL IsChangeDisplaySettingsHotPatched;
|
extern BOOL IsChangeDisplaySettingsHotPatched;
|
||||||
BOOL bIsWithinD3DCreateDevice = FALSE;
|
|
||||||
DWORD dwBackBufferCaps;
|
DWORD dwBackBufferCaps;
|
||||||
extern void TextureHandling(LPDIRECTDRAWSURFACE);
|
extern void TextureHandling(LPDIRECTDRAWSURFACE);
|
||||||
ColorConversion_Type pColorConversion = NULL;
|
ColorConversion_Type pColorConversion = NULL;
|
||||||
@ -252,13 +251,10 @@ GammaRamp_Type pDDSetGammaRamp;
|
|||||||
|
|
||||||
LPDIRECTDRAWSURFACE lpDDSEmu_Prim=NULL;
|
LPDIRECTDRAWSURFACE lpDDSEmu_Prim=NULL;
|
||||||
LPDIRECTDRAWSURFACE lpDDSEmu_Back=NULL;
|
LPDIRECTDRAWSURFACE lpDDSEmu_Back=NULL;
|
||||||
LPDIRECTDRAWSURFACE lpDDSBack=NULL;
|
|
||||||
LPDIRECTDRAWSURFACE lpDDZBuffer=NULL;
|
LPDIRECTDRAWSURFACE lpDDZBuffer=NULL;
|
||||||
LPDIRECTDRAWSURFACE lpDDTexture=NULL;
|
|
||||||
// v2.1.87: lpPrimaryDD is the DIRECTDRAW object to which the primary surface and all
|
// v2.1.87: lpPrimaryDD is the DIRECTDRAW object to which the primary surface and all
|
||||||
// the service objects (emulated backbuffer, emulater primary, ....) are attached.
|
// the service objects (emulated backbuffer, emulater primary, ....) are attached.
|
||||||
LPDIRECTDRAW lpPrimaryDD=NULL;
|
LPDIRECTDRAW lpPrimaryDD=NULL;
|
||||||
LPDIRECTDRAW lpBackBufferDD=NULL;
|
|
||||||
int iBakBufferVersion;
|
int iBakBufferVersion;
|
||||||
LPDIRECTDRAWPALETTE lpDDP=NULL;
|
LPDIRECTDRAWPALETTE lpDDP=NULL;
|
||||||
|
|
||||||
@ -1883,25 +1879,17 @@ HRESULT WINAPI extQueryInterfaceS(void *lpdds, REFIID riid, LPVOID *obp)
|
|||||||
dxw.dwDDVersion=dwLocalDDVersion;
|
dxw.dwDDVersion=dwLocalDDVersion;
|
||||||
if(IsPrim){
|
if(IsPrim){
|
||||||
OutTraceDW("QueryInterface(S): primary=%x new=%x\n", lpdds, *obp);
|
OutTraceDW("QueryInterface(S): primary=%x new=%x\n", lpdds, *obp);
|
||||||
dxw.MarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp);
|
dxw.MarkPrimarySurface((LPDIRECTDRAWSURFACE)*obp, dwLocalDDVersion);
|
||||||
HookDDSurfacePrim((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion);
|
HookDDSurfacePrim((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(IsBack) dxw.MarkBackBufferSurface((LPDIRECTDRAWSURFACE)*obp);
|
if(IsBack) dxw.MarkBackBufferSurface((LPDIRECTDRAWSURFACE)*obp, dwLocalDDVersion);
|
||||||
else dxw.MarkRegularSurface((LPDIRECTDRAWSURFACE)*obp);
|
else dxw.MarkRegularSurface((LPDIRECTDRAWSURFACE)*obp);
|
||||||
// v2.02.13: seems that hooking inconditionally gives troubles. What is the proper safe hook condition?
|
// v2.02.13: seems that hooking inconditionally gives troubles. What is the proper safe hook condition?
|
||||||
HookDDSurfaceGeneric((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion);
|
HookDDSurfaceGeneric((LPDIRECTDRAWSURFACE *)obp, dxw.dwDDVersion);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(lpdds == lpDDSBack) {
|
|
||||||
// assume that you always use the newer interface version, if available.
|
|
||||||
if(dwLocalDDVersion > (UINT)iBakBufferVersion){
|
|
||||||
OutTraceDW("QueryInterface(S): switching backbuffer %x -> %x\n", lpDDSBack, *obp);
|
|
||||||
lpDDSBack = (LPDIRECTDRAWSURFACE)*obp;
|
|
||||||
iBakBufferVersion = dwLocalDDVersion;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dwLocalTexVersion) {
|
if(dwLocalTexVersion) {
|
||||||
@ -2400,7 +2388,6 @@ static HRESULT BuildBackBufferEmu(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
|
|||||||
OutTraceDW("CreateSurface: created BACK DDSBack=%x\n", *lplpdds);
|
OutTraceDW("CreateSurface: created BACK DDSBack=%x\n", *lplpdds);
|
||||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__);
|
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__);
|
||||||
HookDDSurfaceGeneric(lplpdds, dxversion); // added !!!
|
HookDDSurfaceGeneric(lplpdds, dxversion); // added !!!
|
||||||
lpBackBufferDD = lpdd; // v2.02.31
|
|
||||||
iBakBufferVersion=dxversion; // v2.02.31
|
iBakBufferVersion=dxversion; // v2.02.31
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
@ -2455,7 +2442,6 @@ static HRESULT BuildBackBufferDir(LPDIRECTDRAW lpdd, CreateSurface_Type pCreateS
|
|||||||
OutTraceDW("CreateSurface: created BACK DDSBack=%x\n", *lplpdds);
|
OutTraceDW("CreateSurface: created BACK DDSBack=%x\n", *lplpdds);
|
||||||
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__);
|
if(IsDebug) DescribeSurface(*lplpdds, dxversion, "DDSBack", __LINE__);
|
||||||
HookDDSurfaceGeneric(lplpdds, dxversion); // added !!!
|
HookDDSurfaceGeneric(lplpdds, dxversion); // added !!!
|
||||||
lpBackBufferDD = lpdd; // v2.02.31
|
|
||||||
iBakBufferVersion=dxversion; // v2.02.31
|
iBakBufferVersion=dxversion; // v2.02.31
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
@ -2547,6 +2533,7 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate
|
|||||||
HRESULT res;
|
HRESULT res;
|
||||||
DDSURFACEDESC2 ddsd;
|
DDSURFACEDESC2 ddsd;
|
||||||
LPDIRECTDRAWSURFACE lpDDSPrim;
|
LPDIRECTDRAWSURFACE lpDDSPrim;
|
||||||
|
LPDIRECTDRAWSURFACE lpDDSBack = NULL;
|
||||||
DWORD CurFlags;
|
DWORD CurFlags;
|
||||||
int TargetSize;
|
int TargetSize;
|
||||||
typedef HRESULT (*BuildSurface_Type)(LPDIRECTDRAW, CreateSurface_Type, LPDDSURFACEDESC2, int, LPDIRECTDRAWSURFACE *, void *);
|
typedef HRESULT (*BuildSurface_Type)(LPDIRECTDRAW, CreateSurface_Type, LPDDSURFACEDESC2, int, LPDIRECTDRAWSURFACE *, void *);
|
||||||
@ -2611,8 +2598,12 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate
|
|||||||
if (lpDDSEmu_Back) while(lpDDSEmu_Back->Release());
|
if (lpDDSEmu_Back) while(lpDDSEmu_Back->Release());
|
||||||
if (lpDDSEmu_Prim) while(lpDDSEmu_Prim->Release());
|
if (lpDDSEmu_Prim) while(lpDDSEmu_Prim->Release());
|
||||||
if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) { // Praetorians !!!!
|
if (ddsd.dwFlags & DDSD_BACKBUFFERCOUNT) { // Praetorians !!!!
|
||||||
if (lpDDSBack) while(lpDDSBack->Release());
|
lpDDSBack = dxw.GetBackBufferSurface();
|
||||||
lpBackBufferDD = NULL;
|
if (lpDDSBack) {
|
||||||
|
while(lpDDSBack->Release());
|
||||||
|
dxw.MarkRegularSurface(lpDDSBack);
|
||||||
|
lpDDSBack = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lpDDSEmu_Back=NULL;
|
lpDDSEmu_Back=NULL;
|
||||||
@ -2639,14 +2630,14 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate
|
|||||||
res=BuildPrimary(lpdd, pCreateSurface, lpddsd, dxversion, lplpdds, NULL);
|
res=BuildPrimary(lpdd, pCreateSurface, lpddsd, dxversion, lplpdds, NULL);
|
||||||
if(res) return res;
|
if(res) return res;
|
||||||
lpDDSPrim = *lplpdds;
|
lpDDSPrim = *lplpdds;
|
||||||
dxw.MarkPrimarySurface(lpDDSPrim);
|
dxw.MarkPrimarySurface(lpDDSPrim, dxversion);
|
||||||
RegisterPixelFormat(lpDDSPrim);
|
RegisterPixelFormat(lpDDSPrim);
|
||||||
|
|
||||||
if (BBCount){
|
if (BBCount){
|
||||||
// build emulated backbuffer surface
|
// build emulated backbuffer surface
|
||||||
res=BuildBackBuffer(lpdd, pCreateSurface, lpddsd, dxversion, &lpDDSBack, NULL);
|
res=BuildBackBuffer(lpdd, pCreateSurface, lpddsd, dxversion, &lpDDSBack, NULL);
|
||||||
if(res) return res;
|
if(res) return res;
|
||||||
dxw.MarkBackBufferSurface(lpDDSBack);
|
dxw.MarkBackBufferSurface(lpDDSBack, dxversion);
|
||||||
|
|
||||||
// V2.1.85/V2.2.34: tricky !!!!
|
// V2.1.85/V2.2.34: tricky !!!!
|
||||||
// When a real backbuffer is created, it has a reference to its frontbuffer.
|
// When a real backbuffer is created, it has a reference to its frontbuffer.
|
||||||
@ -2687,8 +2678,7 @@ static HRESULT WINAPI extCreateSurface(int dxversion, CreateSurface_Type pCreate
|
|||||||
}
|
}
|
||||||
|
|
||||||
res=BuildBackBuffer(lpdd, pCreateSurface, lpddsd, dxversion, lplpdds, NULL);
|
res=BuildBackBuffer(lpdd, pCreateSurface, lpddsd, dxversion, lplpdds, NULL);
|
||||||
lpDDSBack = *lplpdds;
|
if(res == DD_OK) dxw.MarkBackBufferSurface(*lplpdds, dxversion);
|
||||||
dxw.MarkBackBufferSurface(lpDDSBack);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2742,15 +2732,6 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
|
|||||||
OutTraceDDRAW("GetAttachedSurface(%d): lpdds=%x%s caps=%x(%s)\n",
|
OutTraceDDRAW("GetAttachedSurface(%d): lpdds=%x%s caps=%x(%s)\n",
|
||||||
dxversion, lpdds, (IsPrim?"(PRIM)":(IsBack ? "(BACK)":"")), lpddsc->dwCaps, ExplainDDSCaps(lpddsc->dwCaps));
|
dxversion, lpdds, (IsPrim?"(PRIM)":(IsBack ? "(BACK)":"")), lpddsc->dwCaps, ExplainDDSCaps(lpddsc->dwCaps));
|
||||||
|
|
||||||
// this is yet to be proven utility.....
|
|
||||||
// v2.02.45: No - it prevents "Praetorians" to work!!! -> commented out.
|
|
||||||
//
|
|
||||||
//if (IsBack && (lpddsc->dwCaps & DDSCAPS_ZBUFFER) && lpDDZBuffer){
|
|
||||||
// *lplpddas = lpDDZBuffer;
|
|
||||||
// OutTraceDW("GetAttachedSurface(%d): emulating ZBUFFER attach on BACKBUFFER lpddsadd=%x\n", dxversion, *lplpddas);
|
|
||||||
// return 0;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// v2.1.81: fix to make "Silver" working: if the primary surface was created with
|
// v2.1.81: fix to make "Silver" working: if the primary surface was created with
|
||||||
// backbuffercount == 2, the game expects some more surface to be attached to
|
// backbuffercount == 2, the game expects some more surface to be attached to
|
||||||
// the attached backbuffer. Since there would be no use for it, just return
|
// the attached backbuffer. Since there would be no use for it, just return
|
||||||
@ -2759,16 +2740,15 @@ HRESULT WINAPI extGetAttachedSurface(int dxversion, GetAttachedSurface_Type pGet
|
|||||||
// the primary surface was created with back buffer count == 1.
|
// the primary surface was created with back buffer count == 1.
|
||||||
// v2.2.62 fix: a check to implement doublebuffer emulation only in case of DDSCAPS_BACKBUFFER
|
// v2.2.62 fix: a check to implement doublebuffer emulation only in case of DDSCAPS_BACKBUFFER
|
||||||
// requests. A call to GetAttachedSurface can be made to retrieve DDSCAPS_ZBUFFER surfaces, and in
|
// requests. A call to GetAttachedSurface can be made to retrieve DDSCAPS_ZBUFFER surfaces, and in
|
||||||
// this case the lpDDSBack surface can't be returned.
|
// this case the BackBuffer surface can't be returned.
|
||||||
|
|
||||||
if (IsBack && (DDSD_Prim.dwBackBufferCount > 1) && (lpddsc->dwCaps & DDSCAPS_BACKBUFFER)){
|
if (IsBack && (DDSD_Prim.dwBackBufferCount > 1) && (lpddsc->dwCaps & DDSCAPS_BACKBUFFER)){
|
||||||
//if (IsBack && (DDSD_Prim.dwBackBufferCount > 1)){
|
*lplpddas = lpdds;
|
||||||
*lplpddas = lpDDSBack;
|
OutTraceDW("GetAttachedSurface(%d): DOUBLEBUFFER attached to BACK=%x\n", dxversion, lpdds);
|
||||||
OutTraceDW("GetAttachedSurface(%d): DOUBLEBUFFER attached to BACK=%x\n", dxversion, *lplpddas);
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// on primary surface return the lpDDSBack surface coming from either an explicit
|
// on primary surface return the backbuffer surface coming from either an explicit
|
||||||
// AddAttachedSurface, or a primary complex surface creation otherwise....
|
// AddAttachedSurface, or a primary complex surface creation otherwise....
|
||||||
|
|
||||||
if(IsPrim && (lpddsc->dwCaps & (DDSCAPS_BACKBUFFER|DDSCAPS_FLIP))) { // v2.02.42 added DDSCAPS_FLIP for Empire Earth
|
if(IsPrim && (lpddsc->dwCaps & (DDSCAPS_BACKBUFFER|DDSCAPS_FLIP))) { // v2.02.42 added DDSCAPS_FLIP for Empire Earth
|
||||||
@ -3155,6 +3135,7 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc,
|
|||||||
HRESULT res;
|
HRESULT res;
|
||||||
DDSURFACEDESC2 ddsd;
|
DDSURFACEDESC2 ddsd;
|
||||||
LPDIRECTDRAWSURFACE lpddsTmp;
|
LPDIRECTDRAWSURFACE lpddsTmp;
|
||||||
|
LPDIRECTDRAWSURFACE lpDDSBack;
|
||||||
|
|
||||||
IsPrim=dxw.IsAPrimarySurface(lpdds);
|
IsPrim=dxw.IsAPrimarySurface(lpdds);
|
||||||
OutTraceDDRAW("Flip: lpdds=%x%s, src=%x, flags=%x(%s)\n",
|
OutTraceDDRAW("Flip: lpdds=%x%s, src=%x, flags=%x(%s)\n",
|
||||||
@ -3197,6 +3178,8 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc,
|
|||||||
|
|
||||||
if((dwflags & DDFLIP_WAIT) || (dxw.dwFlags1 & SAVELOAD)) lpPrimaryDD->WaitForVerticalBlank(DDWAITVB_BLOCKEND , 0);
|
if((dwflags & DDFLIP_WAIT) || (dxw.dwFlags1 & SAVELOAD)) lpPrimaryDD->WaitForVerticalBlank(DDWAITVB_BLOCKEND , 0);
|
||||||
|
|
||||||
|
lpDDSBack = dxw.GetBackBufferSurface();
|
||||||
|
|
||||||
if(dxw.dwFlags4 & NOFLIPEMULATION){
|
if(dxw.dwFlags4 & NOFLIPEMULATION){
|
||||||
HRESULT res2;
|
HRESULT res2;
|
||||||
// create a temporary working surface
|
// create a temporary working surface
|
||||||
@ -3245,8 +3228,6 @@ HRESULT WINAPI extFlip(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURFACE lpddssrc,
|
|||||||
res=sBlt("Flip", lpdds, NULL, lpddssrc, NULL, DDBLT_WAIT, 0, TRUE);
|
res=sBlt("Flip", lpdds, NULL, lpddssrc, NULL, DDBLT_WAIT, 0, TRUE);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//v2.02.38: look for a valid BackBuffer surface
|
|
||||||
if(!lpDDSBack) lpDDSBack=dxw.GetBackBufferSurface();
|
|
||||||
if(!lpDDSBack){
|
if(!lpDDSBack){
|
||||||
OutTraceE("Flip: no backbuffer\n");
|
OutTraceE("Flip: no backbuffer\n");
|
||||||
return DDERR_INVALIDPARAMS;
|
return DDERR_INVALIDPARAMS;
|
||||||
@ -3437,6 +3418,7 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
|
|||||||
if((dxw.dwFlags1 & EMULATESURFACE) && isPrim){
|
if((dxw.dwFlags1 & EMULATESURFACE) && isPrim){
|
||||||
OutTraceDW("SetPalette: register PRIMARY palette lpDDP=%x\n", lpddp);
|
OutTraceDW("SetPalette: register PRIMARY palette lpDDP=%x\n", lpddp);
|
||||||
lpDDP = lpddp;
|
lpDDP = lpddp;
|
||||||
|
LPDIRECTDRAWSURFACE lpDDSBack;
|
||||||
if(lpddp){
|
if(lpddp){
|
||||||
HRESULT res2;
|
HRESULT res2;
|
||||||
lpentries = (LPPALETTEENTRY)PaletteEntries;
|
lpentries = (LPPALETTEENTRY)PaletteEntries;
|
||||||
@ -3445,6 +3427,7 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
|
|||||||
mySetPalette(0, 256, lpentries); // v2.02.76: necessary for "Requiem Avenging Angel" in SURFACEEMULATION mode
|
mySetPalette(0, 256, lpentries); // v2.02.76: necessary for "Requiem Avenging Angel" in SURFACEEMULATION mode
|
||||||
}
|
}
|
||||||
// Apply palette to backbuffer surface. This is necessary on some games: "Duckman private dick", "Total Soccer 2000", ...
|
// Apply palette to backbuffer surface. This is necessary on some games: "Duckman private dick", "Total Soccer 2000", ...
|
||||||
|
lpDDSBack = dxw.GetBackBufferSurface();
|
||||||
if (lpDDSBack){
|
if (lpDDSBack){
|
||||||
OutTraceDW("SetPalette: apply PRIMARY palette lpDDP=%x to DDSBack=%x\n", lpddp, lpDDSBack);
|
OutTraceDW("SetPalette: apply PRIMARY palette lpDDP=%x to DDSBack=%x\n", lpddp, lpDDSBack);
|
||||||
res=(*pSetPalette)(lpDDSBack, lpddp);
|
res=(*pSetPalette)(lpDDSBack, lpddp);
|
||||||
@ -3504,7 +3487,7 @@ HRESULT WINAPI extSetClipper(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWCLIPPER lpdd
|
|||||||
|
|
||||||
if(dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)){
|
if(dxw.dwFlags1 & (EMULATESURFACE|EMULATEBUFFER)){
|
||||||
if ((isPrim && lpDDSEmu_Prim) ||
|
if ((isPrim && lpDDSEmu_Prim) ||
|
||||||
((lpdds == lpDDSBack) && lpDDSEmu_Back)){
|
(dxw.IsABackBufferSurface(lpdds) && lpDDSEmu_Back)){
|
||||||
OutTraceDW("SetClipper: skip primary/backbuffer lpdds=%x\n", lpdds);
|
OutTraceDW("SetClipper: skip primary/backbuffer lpdds=%x\n", lpdds);
|
||||||
res=0;
|
res=0;
|
||||||
}
|
}
|
||||||
@ -4139,7 +4122,7 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds)
|
|||||||
// erase surface from primary or backbuffer list
|
// erase surface from primary or backbuffer list
|
||||||
// v2-03-20: d3d 1-7 play a dirty trick: it Release the surface passed as argument until refcount == 0,
|
// 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.
|
// but then rebuilds it with the original attributes! So, better not forget them.
|
||||||
if(!bIsWithinD3DCreateDevice && (IsPrim || IsBack)) dxw.MarkRegularSurface(lpdds);
|
if(IsPrim || IsBack) dxw.UnrefSurface(lpdds);
|
||||||
|
|
||||||
// when releasing primary surface, erase clipping region
|
// when releasing primary surface, erase clipping region
|
||||||
if(IsPrim && (dxw.dwFlags1 & CLIPCURSOR)) dxw.EraseClipCursor();
|
if(IsPrim && (dxw.dwFlags1 & CLIPCURSOR)) dxw.EraseClipCursor();
|
||||||
@ -4154,15 +4137,11 @@ HRESULT WINAPI extReleaseS(LPDIRECTDRAWSURFACE lpdds)
|
|||||||
OutTraceDW("Release(S): Clearing lpDDSEmu_Back pointer\n");
|
OutTraceDW("Release(S): Clearing lpDDSEmu_Back pointer\n");
|
||||||
lpDDSEmu_Back=NULL;
|
lpDDSEmu_Back=NULL;
|
||||||
}
|
}
|
||||||
if(lpdds==dxw.lpDDSPrimHDC) {
|
if(lpdds==dxw.lpDDSPrimary) {
|
||||||
OutTraceDW("Release(S): Clearing lpDDSPrimHDC pointer\n");
|
OutTraceDW("Release(S): Clearing lpDDSPrimary pointer\n");
|
||||||
dxw.ResetPrimarySurface();
|
dxw.ResetPrimarySurface();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(lpdds==lpDDSBack) { // v2.02.38
|
|
||||||
OutTraceDW("Release(S): Clearing lpDDSBack pointer\n");
|
|
||||||
lpDDSBack = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dxw.dwFlags4 & RETURNNULLREF) return 0;
|
if(dxw.dwFlags4 & RETURNNULLREF) return 0;
|
||||||
@ -4215,6 +4194,7 @@ HRESULT WINAPI extEnumAttachedSurfaces(LPDIRECTDRAWSURFACE lpdds, LPVOID lpConte
|
|||||||
lpdds, (IsPrim ? "(PRIM)":""), lpContext, lpEnumSurfacesCallback);
|
lpdds, (IsPrim ? "(PRIM)":""), lpContext, lpEnumSurfacesCallback);
|
||||||
|
|
||||||
if (IsPrim){
|
if (IsPrim){
|
||||||
|
LPDIRECTDRAWSURFACE lpDDSBack;
|
||||||
// A Primary surface has not backbuffer attached surfaces actually,
|
// A Primary surface has not backbuffer attached surfaces actually,
|
||||||
// so don't rely on ddraw and call the callback function directly.
|
// so don't rely on ddraw and call the callback function directly.
|
||||||
// Needed to make Nox working.
|
// Needed to make Nox working.
|
||||||
@ -4223,7 +4203,7 @@ HRESULT WINAPI extEnumAttachedSurfaces(LPDIRECTDRAWSURFACE lpdds, LPVOID lpConte
|
|||||||
res=(*pEnumAttachedSurfaces)(lpdds, lpContext, lpEnumSurfacesCallback);
|
res=(*pEnumAttachedSurfaces)(lpdds, lpContext, lpEnumSurfacesCallback);
|
||||||
if (res)
|
if (res)
|
||||||
OutTraceE("EnumAttachedSurfaces: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
OutTraceE("EnumAttachedSurfaces: ERROR %x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||||
if(lpDDSBack){
|
if(lpDDSBack = dxw.GetBackBufferSurface()){
|
||||||
ddsd.dwSize=Set_dwSize_From_Surface(lpDDSBack);
|
ddsd.dwSize=Set_dwSize_From_Surface(lpDDSBack);
|
||||||
res=lpDDSBack->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd);
|
res=lpDDSBack->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd);
|
||||||
if(res){
|
if(res){
|
||||||
@ -4276,7 +4256,7 @@ HRESULT WINAPI extAddAttachedSurface(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWSURF
|
|||||||
if ((dxw.dwFlags1 & EMULATESURFACE) && (res==DDERR_CANNOTATTACHSURFACE) ||
|
if ((dxw.dwFlags1 & EMULATESURFACE) && (res==DDERR_CANNOTATTACHSURFACE) ||
|
||||||
(res==DDERR_NOEXCLUSIVEMODE))
|
(res==DDERR_NOEXCLUSIVEMODE))
|
||||||
OutTraceDW("AddAttachedSurface: emulating BACKBUFFER attach on PRIMARY\n");
|
OutTraceDW("AddAttachedSurface: emulating BACKBUFFER attach on PRIMARY\n");
|
||||||
lpDDSBack=lpddsadd;
|
dxw.MarkBackBufferSurface(lpddsadd, 1);
|
||||||
if (pAddRefS) (*pAddRefS)(lpdds);
|
if (pAddRefS) (*pAddRefS)(lpdds);
|
||||||
res=DD_OK;
|
res=DD_OK;
|
||||||
}
|
}
|
||||||
@ -4302,11 +4282,9 @@ HRESULT WINAPI extDeleteAttachedSurface(LPDIRECTDRAWSURFACE lpdds, DWORD dwflag
|
|||||||
OutTraceDDRAW("DeleteAttachedSurface: lpdds=%x flags=%x lpddsdel=%x\n", lpdds, dwflags, lpddsdel);
|
OutTraceDDRAW("DeleteAttachedSurface: lpdds=%x flags=%x lpddsdel=%x\n", lpdds, dwflags, lpddsdel);
|
||||||
res=(*pDeleteAttachedSurface)(lpdds, dwflags, lpddsdel);
|
res=(*pDeleteAttachedSurface)(lpdds, dwflags, lpddsdel);
|
||||||
if(res) OutTraceE("DeleteAttachedSurface: ERROR %x(%s)\n", res, ExplainDDError(res));
|
if(res) OutTraceE("DeleteAttachedSurface: ERROR %x(%s)\n", res, ExplainDDError(res));
|
||||||
if (res && (lpddsdel==lpDDSBack)){
|
if (res && dxw.IsABackBufferSurface(lpddsdel)){
|
||||||
OutTraceDW("DeleteAttachedSurface: emulating surface detach lpdds=%x\n", lpddsdel);
|
OutTraceDW("DeleteAttachedSurface: emulating surface detach lpdds=%x\n", lpddsdel);
|
||||||
lpDDSBack->Release(); // GHO TRY
|
res = DD_OK;
|
||||||
lpDDSBack=NULL;
|
|
||||||
res=0;
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -4406,7 +4384,7 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd)
|
|||||||
if(dxw.dwFlags4 & FIXREFCOUNTER){
|
if(dxw.dwFlags4 & FIXREFCOUNTER){
|
||||||
// v2.02.41: fix the ref counter to sumulate the unwindowed original situation
|
// v2.02.41: fix the ref counter to sumulate the unwindowed original situation
|
||||||
--VirtualRef; // why ????
|
--VirtualRef; // why ????
|
||||||
if(lpDDSBack) --VirtualRef;
|
if(dxw.GetBackBufferSurface()) --VirtualRef;
|
||||||
if(dxw.dwFlags1 & EMULATESURFACE){
|
if(dxw.dwFlags1 & EMULATESURFACE){
|
||||||
if(lpDDSEmu_Prim) --VirtualRef;
|
if(lpDDSEmu_Prim) --VirtualRef;
|
||||||
if(lpDDSEmu_Back) --VirtualRef;
|
if(lpDDSEmu_Back) --VirtualRef;
|
||||||
@ -4421,10 +4399,6 @@ ULONG WINAPI extReleaseD(LPDIRECTDRAW lpdd)
|
|||||||
lpDDSEmu_Back=NULL;
|
lpDDSEmu_Back=NULL;
|
||||||
lpDDP=NULL;
|
lpDDP=NULL;
|
||||||
lpPrimaryDD=NULL; // v2.02.31
|
lpPrimaryDD=NULL; // v2.02.31
|
||||||
if(lpBackBufferDD==lpdd){
|
|
||||||
lpBackBufferDD=NULL;
|
|
||||||
lpDDSBack=NULL; // beware: Silent Hunter II seems to require the backbuffer ....
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,7 @@ void DDrawScreenShot()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(dxw.dwFlags5 & GDIMODE){
|
if(dxw.dwFlags5 & GDIMODE){
|
||||||
extern LPDIRECTDRAWSURFACE lpDDSBack;
|
s = dxw.GetBackBufferSurface();
|
||||||
s = lpDDSBack;
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
s = dxw.GetPrimarySurface();
|
s = dxw.GetPrimarySurface();
|
||||||
|
@ -114,8 +114,7 @@ void TextureHighlight(LPDIRECTDRAWSURFACE s)
|
|||||||
OutTraceE("TextureHigh: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
OutTraceE("TextureHigh: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
extern LPDIRECTDRAWSURFACE lpDDSBack;
|
if((ddsd.ddsCaps.dwCaps & DDSCAPS_TEXTURE) && !dxw.IsABackBufferSurface(s)) {
|
||||||
if((ddsd.ddsCaps.dwCaps & DDSCAPS_TEXTURE) && (s != lpDDSBack)) {
|
|
||||||
OutTrace("TextureHigh: lpdds=%x BitCount=%d size=(%dx%d)\n",
|
OutTrace("TextureHigh: lpdds=%x BitCount=%d size=(%dx%d)\n",
|
||||||
s, ddsd.ddpfPixelFormat.dwRGBBitCount, ddsd.dwWidth, ddsd.dwHeight);
|
s, ddsd.ddpfPixelFormat.dwRGBBitCount, ddsd.dwWidth, ddsd.dwHeight);
|
||||||
w = ddsd.dwWidth;
|
w = ddsd.dwWidth;
|
||||||
@ -205,8 +204,7 @@ static void TextureDump(LPDIRECTDRAWSURFACE s)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern LPDIRECTDRAWSURFACE lpDDSBack;
|
if((ddsd.ddsCaps.dwCaps & DDSCAPS_TEXTURE) && !dxw.IsABackBufferSurface(s)) while (TRUE) {
|
||||||
if((ddsd.ddsCaps.dwCaps & DDSCAPS_TEXTURE) && (s != lpDDSBack)) while (TRUE) {
|
|
||||||
OutTrace("TextureDump: lpdds=%x BitCount=%d size=(%dx%d)\n",
|
OutTrace("TextureDump: lpdds=%x BitCount=%d size=(%dx%d)\n",
|
||||||
s, ddsd.ddpfPixelFormat.dwRGBBitCount, ddsd.dwWidth, ddsd.dwHeight);
|
s, ddsd.ddpfPixelFormat.dwRGBBitCount, ddsd.dwWidth, ddsd.dwHeight);
|
||||||
w = ddsd.dwWidth;
|
w = ddsd.dwWidth;
|
||||||
@ -320,8 +318,7 @@ static void TextureHack(LPDIRECTDRAWSURFACE s)
|
|||||||
OutTraceE("TextureHack: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
OutTraceE("TextureHack: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
extern LPDIRECTDRAWSURFACE lpDDSBack;
|
if((ddsd.ddsCaps.dwCaps & DDSCAPS_TEXTURE) && !dxw.IsABackBufferSurface(s)) while (TRUE) { // fake loop to ensure final Unlock
|
||||||
if((ddsd.ddsCaps.dwCaps & DDSCAPS_TEXTURE) && (s != lpDDSBack)) while (TRUE) { // fake loop to ensure final Unlock
|
|
||||||
OutTrace("TextureHack: lpdds=%x BitCount=%d size=(%dx%d)\n",
|
OutTrace("TextureHack: lpdds=%x BitCount=%d size=(%dx%d)\n",
|
||||||
s, ddsd.ddpfPixelFormat.dwRGBBitCount, ddsd.dwWidth, ddsd.dwHeight);
|
s, ddsd.ddpfPixelFormat.dwRGBBitCount, ddsd.dwWidth, ddsd.dwHeight);
|
||||||
w = ddsd.dwWidth;
|
w = ddsd.dwWidth;
|
||||||
|
@ -1983,7 +1983,7 @@ void HookLibrary(HMODULE hModule, HookEntry_Type *Hooks, char *DLLName)
|
|||||||
}
|
}
|
||||||
Hooks->OriginalAddress=(*pGetProcAddress)(hDLL, Hooks->APIName);
|
Hooks->OriginalAddress=(*pGetProcAddress)(hDLL, Hooks->APIName);
|
||||||
if(!Hooks->OriginalAddress) {
|
if(!Hooks->OriginalAddress) {
|
||||||
OutTrace("HookLibrary: GetProcAddress failed on API=%s err=%x\n", Hooks->APIName, GetLastError());
|
OutTraceB("HookLibrary: GetProcAddress failed on API=%s err=%x\n", Hooks->APIName, GetLastError());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
237
dll/dxwcore.cpp
237
dll/dxwcore.cpp
@ -8,6 +8,12 @@
|
|||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "d3d9.h"
|
#include "d3d9.h"
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
#define OutTraceSDB OutTrace
|
||||||
|
#else
|
||||||
|
#define OutTraceSDB if(0) OutTrace
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
// Internal function pointers
|
// Internal function pointers
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
@ -40,8 +46,8 @@ dxwCore::dxwCore()
|
|||||||
bActive = TRUE;
|
bActive = TRUE;
|
||||||
bDInputAbs = 0;
|
bDInputAbs = 0;
|
||||||
TimeShift = 0;
|
TimeShift = 0;
|
||||||
lpDDSPrimHDC = NULL;
|
lpDDSPrimary = NULL;
|
||||||
memset(PrimSurfaces, 0, sizeof(PrimSurfaces));
|
memset(SurfaceDB, 0, sizeof(SurfaceDB));
|
||||||
ResetEmulatedDC();
|
ResetEmulatedDC();
|
||||||
MustShowOverlay=FALSE;
|
MustShowOverlay=FALSE;
|
||||||
TimerEvent.dwTimerType = TIMER_TYPE_NONE;
|
TimerEvent.dwTimerType = TIMER_TYPE_NONE;
|
||||||
@ -228,16 +234,57 @@ void dxwCore::DumpDesktopStatus()
|
|||||||
// Primary surfaces auxiliary functions
|
// Primary surfaces auxiliary functions
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
//#define DXW_SURFACE_STACK_TRACING
|
||||||
|
|
||||||
|
static char *sRole(USHORT role)
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
switch (role){
|
||||||
|
case 0: s="(NULL)"; break; // should never happen ...
|
||||||
|
case SURFACE_ROLE_PRIMARY: s="(PRIM)"; break;
|
||||||
|
case SURFACE_ROLE_BACKBUFFER: s="(BACK)"; break;
|
||||||
|
default: s="??"; break; // should never happen ...
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DXW_SURFACE_STACK_TRACING
|
||||||
|
static void CheckSurfaceList(SurfaceDB_Type *SurfaceDB)
|
||||||
|
{
|
||||||
|
char sMsg[81];
|
||||||
|
int iPCount = 0;
|
||||||
|
int iBCount = 0;
|
||||||
|
for (int i=0;i<DDSQLEN;i++) {
|
||||||
|
if (SurfaceDB[i].lpdds == NULL) break;
|
||||||
|
if ((SurfaceDB[i].uRole == SURFACE_ROLE_PRIMARY) && SurfaceDB[i].uRef) iPCount++;
|
||||||
|
if ((SurfaceDB[i].uRole == SURFACE_ROLE_BACKBUFFER) && SurfaceDB[i].uRef) iBCount++;
|
||||||
|
}
|
||||||
|
if(iPCount > 1) {
|
||||||
|
sprintf(sMsg, "Primary count = %d", iPCount);
|
||||||
|
MessageBox(0, sMsg, "DxWnd SurfaceList", MB_OK | MB_ICONEXCLAMATION);
|
||||||
|
}
|
||||||
|
if(iBCount > 1) {
|
||||||
|
sprintf(sMsg, "Backbuffer count = %d", iPCount);
|
||||||
|
MessageBox(0, sMsg, "DxWnd SurfaceList", MB_OK | MB_ICONEXCLAMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DumpSurfaceList(SurfaceDB_Type *SurfaceDB)
|
||||||
|
{
|
||||||
|
for (int i=0;i<DDSQLEN;i++) {
|
||||||
|
if (SurfaceDB[i].lpdds == NULL) break;
|
||||||
|
OutTrace("--- SURFACELIST DUMP: i=%d lpssd=%x%s ref=%d vers=%d\n", i,
|
||||||
|
SurfaceDB[i].lpdds, sRole(SurfaceDB[i].uRole), SurfaceDB[i].uRef, SurfaceDB[i].uVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
char *dxwCore::ExplainSurfaceRole(LPDIRECTDRAWSURFACE ps)
|
char *dxwCore::ExplainSurfaceRole(LPDIRECTDRAWSURFACE ps)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<DDSQLEN;i++) {
|
for (i=0;i<DDSQLEN;i++) {
|
||||||
if (PrimSurfaces[i]==(DWORD)ps) return "(PRIM)";
|
if (SurfaceDB[i].lpdds==ps) return sRole(SurfaceDB[i].uRole);
|
||||||
if (PrimSurfaces[i]==0) break;
|
if (SurfaceDB[i].lpdds==0) break;
|
||||||
}
|
|
||||||
for (i=0;i<DDSQLEN;i++) {
|
|
||||||
if (BackSurfaces[i]==(DWORD)ps) return "(BACK)";
|
|
||||||
if (BackSurfaces[i]==0) break;
|
|
||||||
}
|
}
|
||||||
// this should NEVER happen, but ...
|
// this should NEVER happen, but ...
|
||||||
extern LPDIRECTDRAWSURFACE lpDDSEmu_Back, lpDDSEmu_Prim;
|
extern LPDIRECTDRAWSURFACE lpDDSEmu_Back, lpDDSEmu_Prim;
|
||||||
@ -247,68 +294,97 @@ char *dxwCore::ExplainSurfaceRole(LPDIRECTDRAWSURFACE ps)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void dxwCore::UnmarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
|
void dxwCore::ClearSurfaceList()
|
||||||
{
|
{
|
||||||
int i;
|
#ifdef DXW_SURFACE_STACK_TRACING
|
||||||
// OutTraceDW("PRIMARYSURFACE del %x\n",ps);
|
OutTrace(">>> SURFACELIST CLEAR ALL\n");
|
||||||
for (i=0;i<DDSQLEN;i++) {
|
#endif
|
||||||
if (PrimSurfaces[i]==(DWORD)ps) break;
|
for (int i=0;i<DDSQLEN;i++) {
|
||||||
if (PrimSurfaces[i]==0) break;
|
SurfaceDB[i].lpdds = NULL;
|
||||||
}
|
SurfaceDB[i].uRef = FALSE;
|
||||||
if (PrimSurfaces[i]==(DWORD)ps){
|
SurfaceDB[i].uRole = 0;
|
||||||
for (; i<DDSQLEN; i++){
|
SurfaceDB[i].uVersion = 0;
|
||||||
PrimSurfaces[i]=PrimSurfaces[i+1];
|
|
||||||
if (PrimSurfaces[i]==0) break;
|
|
||||||
}
|
|
||||||
PrimSurfaces[DDSQLEN]=0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dxwCore::UnmarkBackBufferSurface(LPDIRECTDRAWSURFACE ps)
|
void dxwCore::UnrefSurface(LPDIRECTDRAWSURFACE ps)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
// OutTraceDW("PRIMARYSURFACE del %x\n",ps);
|
// look for entry
|
||||||
for (i=0;i<DDSQLEN;i++) {
|
for (i=0;i<DDSQLEN;i++)
|
||||||
if (BackSurfaces[i]==(DWORD)ps) break;
|
if ((SurfaceDB[i].lpdds==ps) || SurfaceDB[i].lpdds==0) break;
|
||||||
if (BackSurfaces[i]==0) break;
|
// if found, delete it by left-copying each entry until end of array
|
||||||
}
|
if (SurfaceDB[i].lpdds == ps) {
|
||||||
if (BackSurfaces[i]==(DWORD)ps){
|
#ifdef DXW_SURFACE_STACK_TRACING
|
||||||
for (; i<DDSQLEN; i++){
|
OutTraceSDB(">>> SURFACELIST UNREF: lpdds=%x%s ref=%x vers=%d\n", ps, sRole(SurfaceDB[i].uRole), SurfaceDB[i].uRef, SurfaceDB[i].uVersion);
|
||||||
BackSurfaces[i]=BackSurfaces[i+1];
|
#endif
|
||||||
if (BackSurfaces[i]==0) break;
|
SurfaceDB[i].uRef = FALSE;
|
||||||
}
|
|
||||||
BackSurfaces[DDSQLEN]=0;
|
|
||||||
}
|
}
|
||||||
|
#ifdef DXW_SURFACE_STACK_TRACING
|
||||||
|
DumpSurfaceList(SurfaceDB);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void dxwCore::MarkPrimarySurface(LPDIRECTDRAWSURFACE ps)
|
void dxwCore::MarkSurfaceByRole(LPDIRECTDRAWSURFACE ps, USHORT role, USHORT version)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
// OutTraceDW("PRIMARYSURFACE add %x\n",ps);
|
SurfaceDB_Type *e;
|
||||||
|
#ifdef DXW_SURFACE_STACK_TRACING
|
||||||
|
OutTraceSDB(">>> SURFACELIST MARK: lpdds=%x%s vers=%d\n", ps, sRole(role), version);
|
||||||
|
#endif
|
||||||
for (i=0;i<DDSQLEN;i++) {
|
for (i=0;i<DDSQLEN;i++) {
|
||||||
if (PrimSurfaces[i]==(DWORD)ps) return; // if already there ....
|
e=&SurfaceDB[i];
|
||||||
if (PrimSurfaces[i]==(DWORD)0) break; // got end of list
|
if ((e->lpdds==ps) || (e->lpdds==(DWORD)0)) break; // got matching entry or end of the list
|
||||||
}
|
}
|
||||||
PrimSurfaces[i]=(DWORD)ps;
|
if(i == DDSQLEN) {
|
||||||
UnmarkBackBufferSurface(ps);
|
MessageBox(0, "Surface stack is full", "DxWnd SurfaceList", MB_OK | MB_ICONEXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e->lpdds=ps;
|
||||||
|
e->uRole = role;
|
||||||
|
e->uRef = TRUE;
|
||||||
|
e->uVersion = version;
|
||||||
|
#ifdef DXW_SURFACE_STACK_TRACING
|
||||||
|
DumpSurfaceList(SurfaceDB);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void dxwCore::MarkPrimarySurface(LPDIRECTDRAWSURFACE ps, int version)
|
||||||
|
{
|
||||||
|
MarkSurfaceByRole(ps, SURFACE_ROLE_PRIMARY, (USHORT)version);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dxwCore::MarkBackBufferSurface(LPDIRECTDRAWSURFACE ps)
|
void dxwCore::MarkBackBufferSurface(LPDIRECTDRAWSURFACE ps, int version)
|
||||||
{
|
{
|
||||||
int i;
|
MarkSurfaceByRole(ps, SURFACE_ROLE_BACKBUFFER, (USHORT)version);
|
||||||
// OutTraceDW("PRIMARYSURFACE add %x\n",ps);
|
|
||||||
for (i=0;i<DDSQLEN;i++) {
|
|
||||||
if (BackSurfaces[i]==(DWORD)ps) return; // if already there ....
|
|
||||||
if (BackSurfaces[i]==(DWORD)0) break; // got end of list
|
|
||||||
}
|
|
||||||
BackSurfaces[i]=(DWORD)ps;
|
|
||||||
UnmarkPrimarySurface(ps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dxwCore::MarkRegularSurface(LPDIRECTDRAWSURFACE ps)
|
void dxwCore::MarkRegularSurface(LPDIRECTDRAWSURFACE ps)
|
||||||
{
|
{
|
||||||
UnmarkBackBufferSurface(ps);
|
int i;
|
||||||
UnmarkPrimarySurface(ps);
|
// look for entry
|
||||||
|
for (i=0;i<DDSQLEN;i++) {
|
||||||
|
if (SurfaceDB[i].lpdds==0) return;
|
||||||
|
if (SurfaceDB[i].lpdds==ps) break;
|
||||||
|
}
|
||||||
|
// if found, delete it by left-copying each entry until end of array
|
||||||
|
if (SurfaceDB[i].lpdds==ps){
|
||||||
|
#ifdef DXW_SURFACE_STACK_TRACING
|
||||||
|
OutTraceSDB(">>> SURFACELIST CLEAR: i=%d lpdds=%x%s ref=%x vers=%d\n",
|
||||||
|
i, ps, sRole(SurfaceDB[i].uRole), SurfaceDB[i].uRef, SurfaceDB[i].uVersion);
|
||||||
|
#endif
|
||||||
|
for (; i<DDSQLEN; i++){
|
||||||
|
SurfaceDB[i]=SurfaceDB[i+1];
|
||||||
|
if (SurfaceDB[i].lpdds==0) break;
|
||||||
|
}
|
||||||
|
SurfaceDB[DDSQLEN].lpdds=0;
|
||||||
|
SurfaceDB[DDSQLEN].uRole=0;
|
||||||
|
SurfaceDB[DDSQLEN].uRef=0;
|
||||||
|
SurfaceDB[DDSQLEN].uVersion=0;
|
||||||
|
}
|
||||||
|
#ifdef DXW_SURFACE_STACK_TRACING
|
||||||
|
DumpSurfaceList(&SurfaceDB[0]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: since MS itself declares that the object refcount is not reliable and should
|
// Note: since MS itself declares that the object refcount is not reliable and should
|
||||||
@ -324,8 +400,8 @@ BOOL dxwCore::IsAPrimarySurface(LPDIRECTDRAWSURFACE ps)
|
|||||||
// treat NULL surface ptr as a non primary
|
// treat NULL surface ptr as a non primary
|
||||||
if(!ps) return FALSE;
|
if(!ps) return FALSE;
|
||||||
for (i=0;i<DDSQLEN;i++) {
|
for (i=0;i<DDSQLEN;i++) {
|
||||||
if (PrimSurfaces[i]==0) return FALSE;
|
if (SurfaceDB[i].lpdds==0) return FALSE;
|
||||||
if (PrimSurfaces[i]==(DWORD)ps) return TRUE;
|
if (SurfaceDB[i].lpdds==ps) return (SurfaceDB[i].uRole == SURFACE_ROLE_PRIMARY);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -336,42 +412,48 @@ BOOL dxwCore::IsABackBufferSurface(LPDIRECTDRAWSURFACE ps)
|
|||||||
// treat NULL surface ptr as a non primary
|
// treat NULL surface ptr as a non primary
|
||||||
if(!ps) return FALSE;
|
if(!ps) return FALSE;
|
||||||
for (i=0;i<DDSQLEN;i++) {
|
for (i=0;i<DDSQLEN;i++) {
|
||||||
if (BackSurfaces[i]==0) return FALSE;
|
if (SurfaceDB[i].lpdds==0) return FALSE;
|
||||||
if (BackSurfaces[i]==(DWORD)ps) return TRUE;
|
if (SurfaceDB[i].lpdds==ps) return (SurfaceDB[i].uRole == SURFACE_ROLE_BACKBUFFER);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LPDIRECTDRAWSURFACE dxwCore::GetSurfaceByRole(USHORT role)
|
||||||
|
{
|
||||||
|
// Get a surface marked for the desired role (either PRIMARY or BACKBUFFER) and
|
||||||
|
// whith a not null reference counter. In case of multiple choices, it has to
|
||||||
|
// return the most recent reference!!!
|
||||||
|
// tested with "101 the Airborne Invasion of Normandy" and "Armored Fist 3"
|
||||||
|
int i;
|
||||||
|
LPDIRECTDRAWSURFACE ret = NULL;
|
||||||
|
#ifdef DXW_SURFACE_STACK_TRACING
|
||||||
|
if (IsAssertEnabled) CheckSurfaceList(SurfaceDB);
|
||||||
|
#endif
|
||||||
|
for (i=0;i<DDSQLEN;i++) {
|
||||||
|
if ((SurfaceDB[i].uRole == role) && (SurfaceDB[i].uRef)) ret = SurfaceDB[i].lpdds;
|
||||||
|
if (SurfaceDB[i].lpdds==NULL) break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
LPDIRECTDRAWSURFACE dxwCore::GetPrimarySurface(void)
|
LPDIRECTDRAWSURFACE dxwCore::GetPrimarySurface(void)
|
||||||
{
|
{
|
||||||
// return last opened one....
|
return GetSurfaceByRole(SURFACE_ROLE_PRIMARY);
|
||||||
int i;
|
|
||||||
for (i=0;i<DDSQLEN;i++) {
|
|
||||||
if (PrimSurfaces[i]==0) break;
|
|
||||||
}
|
|
||||||
if (i) return((LPDIRECTDRAWSURFACE)PrimSurfaces[i-1]);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LPDIRECTDRAWSURFACE dxwCore::GetBackBufferSurface(void)
|
LPDIRECTDRAWSURFACE dxwCore::GetBackBufferSurface(void)
|
||||||
{
|
{
|
||||||
// return last opened one....
|
return GetSurfaceByRole(SURFACE_ROLE_BACKBUFFER);
|
||||||
int i;
|
|
||||||
for (i=0;i<DDSQLEN;i++) {
|
|
||||||
if (BackSurfaces[i]==0) break;
|
|
||||||
}
|
|
||||||
if (i) return((LPDIRECTDRAWSURFACE)BackSurfaces[i-1]);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dxwCore::SetPrimarySurface(void)
|
void dxwCore::SetPrimarySurface(void)
|
||||||
{
|
{
|
||||||
if (!lpDDSPrimHDC) lpDDSPrimHDC=GetPrimarySurface();
|
if (!lpDDSPrimary) lpDDSPrimary=GetPrimarySurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dxwCore::ResetPrimarySurface(void)
|
void dxwCore::ResetPrimarySurface(void)
|
||||||
{
|
{
|
||||||
lpDDSPrimHDC=NULL;
|
lpDDSPrimary=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dxwCore::InitWindowPos(int x, int y, int w, int h)
|
void dxwCore::InitWindowPos(int x, int y, int w, int h)
|
||||||
@ -766,6 +848,21 @@ RECT dxwCore::MapClientRect(LPRECT lpRect)
|
|||||||
return RetRect;
|
return RetRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//RECT dxwCore::MapClientRect(LPPOINT lpPoint, int *SizX, int *SizY)
|
||||||
|
//{
|
||||||
|
// RECT r;
|
||||||
|
// r.left = lpPoint->x;
|
||||||
|
// r.right = lpPoint->x + *SizX;
|
||||||
|
// r.top = lpPoint->y;
|
||||||
|
// r.bottom = lpPoint->y + *SizY;
|
||||||
|
// r = MapClientRect(&r);
|
||||||
|
// lpPoint->x = r.left;
|
||||||
|
// lpPoint->y = r.top;
|
||||||
|
// *SizX = r.right - r.left;
|
||||||
|
// *SizY = r.bottom - r.top;
|
||||||
|
// return NULL;
|
||||||
|
//}
|
||||||
|
|
||||||
void dxwCore::MapClient(LPRECT rect)
|
void dxwCore::MapClient(LPRECT rect)
|
||||||
{
|
{
|
||||||
RECT client;
|
RECT client;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "syslibs.h"
|
#include "syslibs.h"
|
||||||
|
|
||||||
#define DDSQLEN 0x10
|
#define DDSQLEN 0x20
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DWORD dwTimerType;
|
DWORD dwTimerType;
|
||||||
@ -23,6 +23,18 @@ typedef struct {
|
|||||||
} t;
|
} t;
|
||||||
} TimerEvent_Type;
|
} TimerEvent_Type;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
LPDIRECTDRAWSURFACE lpdds;
|
||||||
|
USHORT uRef;
|
||||||
|
USHORT uRole;
|
||||||
|
USHORT uVersion;
|
||||||
|
} SurfaceDB_Type;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SURFACE_ROLE_PRIMARY = 1,
|
||||||
|
SURFACE_ROLE_BACKBUFFER
|
||||||
|
} Enum_Surface_Role_Type;
|
||||||
|
|
||||||
class dxwCore
|
class dxwCore
|
||||||
{
|
{
|
||||||
// Construction/destruction
|
// Construction/destruction
|
||||||
@ -80,10 +92,12 @@ public: // methods
|
|||||||
BOOL ishWndFPS(HWND);
|
BOOL ishWndFPS(HWND);
|
||||||
DWORD GetTickCount(void);
|
DWORD GetTickCount(void);
|
||||||
char *ExplainSurfaceRole(LPDIRECTDRAWSURFACE);
|
char *ExplainSurfaceRole(LPDIRECTDRAWSURFACE);
|
||||||
void MarkPrimarySurface(LPDIRECTDRAWSURFACE);
|
void ClearSurfaceList();
|
||||||
|
void MarkPrimarySurface(LPDIRECTDRAWSURFACE, int);
|
||||||
BOOL IsAPrimarySurface(LPDIRECTDRAWSURFACE);
|
BOOL IsAPrimarySurface(LPDIRECTDRAWSURFACE);
|
||||||
|
void UnrefSurface(LPDIRECTDRAWSURFACE);
|
||||||
LPDIRECTDRAWSURFACE GetPrimarySurface(void);
|
LPDIRECTDRAWSURFACE GetPrimarySurface(void);
|
||||||
void MarkBackBufferSurface(LPDIRECTDRAWSURFACE);
|
void MarkBackBufferSurface(LPDIRECTDRAWSURFACE, int);
|
||||||
BOOL IsABackBufferSurface(LPDIRECTDRAWSURFACE);
|
BOOL IsABackBufferSurface(LPDIRECTDRAWSURFACE);
|
||||||
LPDIRECTDRAWSURFACE GetBackBufferSurface(void);
|
LPDIRECTDRAWSURFACE GetBackBufferSurface(void);
|
||||||
void MarkRegularSurface(LPDIRECTDRAWSURFACE);
|
void MarkRegularSurface(LPDIRECTDRAWSURFACE);
|
||||||
@ -150,7 +164,7 @@ public: // simple data variables
|
|||||||
DWORD SwapEffect;
|
DWORD SwapEffect;
|
||||||
char *gsModules;
|
char *gsModules;
|
||||||
int TimeShift;
|
int TimeShift;
|
||||||
LPDIRECTDRAWSURFACE lpDDSPrimHDC;
|
LPDIRECTDRAWSURFACE lpDDSPrimary;
|
||||||
short iPosX;
|
short iPosX;
|
||||||
short iPosY;
|
short iPosY;
|
||||||
short iSizX;
|
short iSizX;
|
||||||
@ -173,14 +187,16 @@ protected:
|
|||||||
DWORD dwScreenHeight;
|
DWORD dwScreenHeight;
|
||||||
BOOL FullScreen;
|
BOOL FullScreen;
|
||||||
HWND hWnd, hWndFPS;
|
HWND hWnd, hWndFPS;
|
||||||
DWORD PrimSurfaces[DDSQLEN+1];
|
SurfaceDB_Type SurfaceDB[DDSQLEN+1];
|
||||||
DWORD BackSurfaces[DDSQLEN+1];
|
//DWORD PrimSurfaces[DDSQLEN+1];
|
||||||
|
//DWORD BackSurfaces[DDSQLEN+1];
|
||||||
HBITMAP VirtualPic;
|
HBITMAP VirtualPic;
|
||||||
RECT VirtualPicRect;
|
RECT VirtualPicRect;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UnmarkPrimarySurface(LPDIRECTDRAWSURFACE);
|
void MarkSurfaceByRole(LPDIRECTDRAWSURFACE, USHORT, USHORT);
|
||||||
void UnmarkBackBufferSurface(LPDIRECTDRAWSURFACE);
|
LPDIRECTDRAWSURFACE GetSurfaceByRole(USHORT);
|
||||||
|
void SetSurfaceEntry(LPDIRECTDRAWSURFACE, USHORT, USHORT);
|
||||||
BOOL MustShowOverlay;
|
BOOL MustShowOverlay;
|
||||||
void ShowFPS(HDC, int, int);
|
void ShowFPS(HDC, int, int);
|
||||||
void ShowTimeStretching(HDC, int, int);
|
void ShowTimeStretching(HDC, int, int);
|
||||||
|
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include "TlHelp32.h"
|
#include "TlHelp32.h"
|
||||||
|
|
||||||
#define VERSION "2.03.20"
|
#define VERSION "2.03.21"
|
||||||
|
|
||||||
#define DDTHREADLOCK 1
|
#define DDTHREADLOCK 1
|
||||||
//#define LOCKTHREADS
|
//#define LOCKTHREADS
|
||||||
|
Binary file not shown.
@ -655,13 +655,13 @@ HDC WINAPI extDDCreateCompatibleDC(HDC hdc)
|
|||||||
|
|
||||||
if(dxw.IsDesktop(WindowFromDC(hdc)) && dxw.IsFullScreen()) {
|
if(dxw.IsDesktop(WindowFromDC(hdc)) && dxw.IsFullScreen()) {
|
||||||
dxw.SetPrimarySurface();
|
dxw.SetPrimarySurface();
|
||||||
if(!PrimHDC && dxw.lpDDSPrimHDC){
|
if(!PrimHDC && dxw.lpDDSPrimary){
|
||||||
HRESULT res;
|
HRESULT res;
|
||||||
STOPPER("null PrimHDC");
|
STOPPER("null PrimHDC");
|
||||||
res=(*pGetDC)(dxw.lpDDSPrimHDC, &PrimHDC);
|
res=(*pGetDC)(dxw.lpDDSPrimary, &PrimHDC);
|
||||||
if(res) OutTraceE("GDI.CreateCompatibleDC ERROR: GetDC lpdds=%x err=%d(%s) at %d\n", dxw.lpDDSPrimHDC, res, ExplainDDError(res), __LINE__);
|
if(res) OutTraceE("GDI.CreateCompatibleDC ERROR: GetDC lpdds=%x err=%d(%s) at %d\n", dxw.lpDDSPrimary, res, ExplainDDError(res), __LINE__);
|
||||||
}
|
}
|
||||||
OutTraceDW("GDI.CreateCompatibleDC: duplicating primary surface HDC lpDDSPrimHDC=%x SrcHdc=%x\n", dxw.lpDDSPrimHDC, PrimHDC);
|
OutTraceDW("GDI.CreateCompatibleDC: duplicating primary surface HDC lpDDSPrimary=%x SrcHdc=%x\n", dxw.lpDDSPrimary, PrimHDC);
|
||||||
RetHdc=(*pGDICreateCompatibleDC)(PrimHDC);
|
RetHdc=(*pGDICreateCompatibleDC)(PrimHDC);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -698,21 +698,21 @@ static HDC WINAPI winDDGetDC(HWND hwnd, char *api)
|
|||||||
dxw.SetPrimarySurface();
|
dxw.SetPrimarySurface();
|
||||||
if(dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
|
if(dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
|
||||||
|
|
||||||
if(dxw.lpDDSPrimHDC){
|
if(dxw.lpDDSPrimary){
|
||||||
if (PrimHDC){
|
if (PrimHDC){
|
||||||
OutTraceDW("%s: reusing primary hdc\n", api);
|
OutTraceDW("%s: reusing primary hdc\n", api);
|
||||||
(*pUnlockMethod(dxw.lpDDSPrimHDC))(dxw.lpDDSPrimHDC, NULL);
|
(*pUnlockMethod(dxw.lpDDSPrimary))(dxw.lpDDSPrimary, NULL);
|
||||||
hdc=PrimHDC;
|
hdc=PrimHDC;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
OutTraceDW("%s: get hdc from PRIMARY surface lpdds=%x\n", api, dxw.lpDDSPrimHDC);
|
OutTraceDW("%s: get hdc from PRIMARY surface lpdds=%x\n", api, dxw.lpDDSPrimary);
|
||||||
res=extGetDC(dxw.lpDDSPrimHDC,&hdc);
|
res=extGetDC(dxw.lpDDSPrimary,&hdc);
|
||||||
if(res) {
|
if(res) {
|
||||||
OutTraceE("%s: GetDC(%x) ERROR %x(%s) at %d\n", api, dxw.lpDDSPrimHDC, res, ExplainDDError(res), __LINE__);
|
OutTraceE("%s: GetDC(%x) ERROR %x(%s) at %d\n", api, dxw.lpDDSPrimary, res, ExplainDDError(res), __LINE__);
|
||||||
if(res==DDERR_DCALREADYCREATED){
|
if(res==DDERR_DCALREADYCREATED){
|
||||||
// try recovery....
|
// try recovery....
|
||||||
(*pReleaseDC)(dxw.lpDDSPrimHDC,NULL);
|
(*pReleaseDC)(dxw.lpDDSPrimary,NULL);
|
||||||
res=extGetDC(dxw.lpDDSPrimHDC,&hdc);
|
res=extGetDC(dxw.lpDDSPrimary,&hdc);
|
||||||
}
|
}
|
||||||
if(res)return 0;
|
if(res)return 0;
|
||||||
}
|
}
|
||||||
@ -787,9 +787,9 @@ int WINAPI extDDReleaseDC(HWND hwnd, HDC hDC)
|
|||||||
res=0;
|
res=0;
|
||||||
if ((hDC == PrimHDC) || (hwnd==0)){
|
if ((hDC == PrimHDC) || (hwnd==0)){
|
||||||
dxw.SetPrimarySurface();
|
dxw.SetPrimarySurface();
|
||||||
OutTraceDW("GDI.ReleaseDC(DD): refreshing primary surface lpdds=%x\n",dxw.lpDDSPrimHDC);
|
OutTraceDW("GDI.ReleaseDC(DD): refreshing primary surface lpdds=%x\n",dxw.lpDDSPrimary);
|
||||||
if(!dxw.lpDDSPrimHDC) return 0;
|
if(!dxw.lpDDSPrimary) return 0;
|
||||||
extReleaseDC(dxw.lpDDSPrimHDC, hDC);
|
extReleaseDC(dxw.lpDDSPrimary, hDC);
|
||||||
PrimHDC=NULL;
|
PrimHDC=NULL;
|
||||||
res=1; // 1 = OK
|
res=1; // 1 = OK
|
||||||
}
|
}
|
||||||
@ -817,7 +817,7 @@ BOOL WINAPI extDDBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHe
|
|||||||
if(hdcDest==0) {
|
if(hdcDest==0) {
|
||||||
dxw.ResetPrimarySurface();
|
dxw.ResetPrimarySurface();
|
||||||
dxw.SetPrimarySurface();
|
dxw.SetPrimarySurface();
|
||||||
extGetDC(dxw.lpDDSPrimHDC, &PrimHDC);
|
extGetDC(dxw.lpDDSPrimary, &PrimHDC);
|
||||||
hdcDest=PrimHDC;
|
hdcDest=PrimHDC;
|
||||||
}
|
}
|
||||||
res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
|
res=(*pGDIBitBlt)(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, dwRop);
|
||||||
@ -847,7 +847,7 @@ BOOL WINAPI extDDStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int
|
|||||||
// if(hdcDest==0) {
|
// if(hdcDest==0) {
|
||||||
// dxw.ResetPrimarySurface();
|
// dxw.ResetPrimarySurface();
|
||||||
// dxw.SetPrimarySurface();
|
// dxw.SetPrimarySurface();
|
||||||
// extGetDC(dxw.lpDDSPrimHDC, &PrimHDC);
|
// extGetDC(dxw.lpDDSPrimary, &PrimHDC);
|
||||||
// hdcDest=PrimHDC;
|
// hdcDest=PrimHDC;
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
@ -861,9 +861,9 @@ BOOL WINAPI extDDStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//dxw.SetPrimarySurface();
|
//dxw.SetPrimarySurface();
|
||||||
//OutTraceDW("GDI.StretchBlt: refreshing primary surface lpdds=%x\n",dxw.lpDDSPrimHDC);
|
//OutTraceDW("GDI.StretchBlt: refreshing primary surface lpdds=%x\n",dxw.lpDDSPrimary);
|
||||||
//sBlt("GDI.StretchBlt", dxw.lpDDSPrimHDC, NULL, dxw.lpDDSPrimHDC, NULL, 0, NULL, 0);
|
//sBlt("GDI.StretchBlt", dxw.lpDDSPrimary, NULL, dxw.lpDDSPrimary, NULL, 0, NULL, 0);
|
||||||
//res=(*pUnlockMethod(dxw.lpDDSPrimHDC))(dxw.lpDDSPrimHDC, NULL);
|
//res=(*pUnlockMethod(dxw.lpDDSPrimary))(dxw.lpDDSPrimary, NULL);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -927,26 +927,18 @@ HRESULT WINAPI extCreateDevice7(void *lpd3d, REFCLSID Guid, LPDIRECTDRAWSURFACE7
|
|||||||
{
|
{
|
||||||
// v2.02.83: D3D CreateDevice (version 7? all versions?) internally calls the Release method upon the backbuffer
|
// 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.
|
// surface, and this has to be avoided since it causes a crash.
|
||||||
// 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;
|
HRESULT res;
|
||||||
extern BOOL bIsWithinD3DCreateDevice;
|
|
||||||
|
|
||||||
OutTraceD3D("CreateDevice(D3D7): d3d=%x GUID=%x(%s) lpdds=%x%s\n",
|
OutTraceD3D("CreateDevice(D3D7): d3d=%x GUID=%x(%s) lpdds=%x%s\n",
|
||||||
lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxw.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds));
|
lpd3d, Guid.Data1, ExplainGUID((GUID *)&Guid), lpdds, dxw.ExplainSurfaceRole((LPDIRECTDRAWSURFACE)lpdds));
|
||||||
bIsWithinD3DCreateDevice = TRUE;
|
|
||||||
res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd);
|
res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd);
|
||||||
bIsWithinD3DCreateDevice = FALSE;
|
|
||||||
if(res) {
|
if(res) {
|
||||||
OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||||
if((dxw.dwFlags1 & AUTOMATIC) && (dxw.dwFlags1 & EMULATESURFACE)) {
|
if((dxw.dwFlags1 & AUTOMATIC) && (dxw.dwFlags1 & EMULATESURFACE)) {
|
||||||
dxw.dwFlags1 &= ~EMULATESURFACE;
|
dxw.dwFlags1 &= ~EMULATESURFACE;
|
||||||
dxw.dwFlags1 |= LOCKEDSURFACE;
|
dxw.dwFlags1 |= LOCKEDSURFACE;
|
||||||
bIsWithinD3DCreateDevice = TRUE;
|
|
||||||
res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd);
|
res=(*pCreateDevice7)(lpd3d, Guid, lpdds, lplpd3dd);
|
||||||
bIsWithinD3DCreateDevice = FALSE;
|
|
||||||
if (res) OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
if (res) OutTraceE("CreateDevice(D3D7) ERROR: err=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
|
||||||
else OutTraceD3D("CreateDevice(D3D7): Emulation OFF\n");
|
else OutTraceD3D("CreateDevice(D3D7): Emulation OFF\n");
|
||||||
}
|
}
|
||||||
|
@ -741,15 +741,45 @@ BOOL WINAPI extSetWindowPos(HWND hwnd, HWND hWndInsertAfter, int X, int Y, int c
|
|||||||
OutTraceDW("SetWindowPos: hwnd=%x%s pos=(%d,%d) dim=(%d,%d) Flags=%x\n",
|
OutTraceDW("SetWindowPos: hwnd=%x%s pos=(%d,%d) dim=(%d,%d) Flags=%x\n",
|
||||||
hwnd, dxw.IsFullScreen()?"(FULLSCREEN)":"", X, Y, cx, cy, uFlags);
|
hwnd, dxw.IsFullScreen()?"(FULLSCREEN)":"", X, Y, cx, cy, uFlags);
|
||||||
|
|
||||||
//if ((hwnd != dxw.GethWnd()) || !dxw.IsFullScreen()){
|
// when not in fullscreen mode, just proxy the call
|
||||||
if (!dxw.IsDesktop(hwnd) || !dxw.IsFullScreen()){
|
if (!dxw.IsFullScreen()){
|
||||||
// just proxy
|
|
||||||
res=(*pSetWindowPos)(hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
|
res=(*pSetWindowPos)(hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
|
||||||
if(!res)OutTraceE("SetWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
if(!res)OutTraceE("SetWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen()){
|
// in fullscreen, but a child window inside .....
|
||||||
|
if (!dxw.IsDesktop(hwnd)){
|
||||||
|
RECT r;
|
||||||
|
r.left = X;
|
||||||
|
r.right = X + cx;
|
||||||
|
r.top = Y;
|
||||||
|
r.bottom = Y + cy;
|
||||||
|
if ((*pGetWindowLongA)(hwnd, GWL_STYLE) & WS_CHILD){
|
||||||
|
r = dxw.MapClientRect(&r);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//r = dxw.MapWindowRect(&r);
|
||||||
|
}
|
||||||
|
X = r.left;
|
||||||
|
Y = r.top;
|
||||||
|
cx = r.right - r.left;
|
||||||
|
cy = r.bottom - r.top;
|
||||||
|
|
||||||
|
res=(*pSetWindowPos)(hwnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
|
||||||
|
if(!res)OutTraceE("SetWindowPos: ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
||||||
|
|
||||||
|
//HFONT hFont;
|
||||||
|
//hFont=CreateFont (
|
||||||
|
// 30, 0, 0, 0, FW_DONTCARE, FALSE, FALSE,
|
||||||
|
// FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||||
|
// DEFAULT_PITCH | FF_SWISS, NULL); // "Arial");
|
||||||
|
//SendMessage (hwnd, WM_SETFONT, WPARAM (hFont), TRUE);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dxw.dwFlags1 & LOCKWINPOS){
|
||||||
// Note: any attempt to change the window position, no matter where and how, through the
|
// Note: any attempt to change the window position, no matter where and how, through the
|
||||||
// SetWindowPos API is causing resizing to the default 1:1 pixed size in Commandos.
|
// SetWindowPos API is causing resizing to the default 1:1 pixed size in Commandos.
|
||||||
// in such cases, there is incompatibility between LOCKWINPOS and LOCKWINSTYLE.
|
// in such cases, there is incompatibility between LOCKWINPOS and LOCKWINSTYLE.
|
||||||
@ -2019,7 +2049,7 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
|
|||||||
break;
|
break;
|
||||||
case GDIMODE_DIRECTDRAW:
|
case GDIMODE_DIRECTDRAW:
|
||||||
(*pGDIReleaseDC)(hwnd, lpPaint->hdc);
|
(*pGDIReleaseDC)(hwnd, lpPaint->hdc);
|
||||||
(*pGetDC)(dxw.lpDDSPrimHDC,&PrimHDC);
|
(*pGetDC)(dxw.lpDDSPrimary,&PrimHDC);
|
||||||
lpPaint->hdc=PrimHDC;
|
lpPaint->hdc=PrimHDC;
|
||||||
// resize the paint area to virtual screen size (see CivIII clipped panels...)
|
// resize the paint area to virtual screen size (see CivIII clipped panels...)
|
||||||
lpPaint->rcPaint=dxw.GetScreenRect();
|
lpPaint->rcPaint=dxw.GetScreenRect();
|
||||||
@ -2050,7 +2080,7 @@ HDC WINAPI extDDBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
|
|||||||
|
|
||||||
// on MAPGDITOPRIMARY, return the PrimHDC handle instead of the window DC
|
// on MAPGDITOPRIMARY, return the PrimHDC handle instead of the window DC
|
||||||
// if a primary surface has not been created yet, do it
|
// if a primary surface has not been created yet, do it
|
||||||
if(!pGetDC || !dxw.lpDDSPrimHDC){
|
if(!pGetDC || !dxw.lpDDSPrimary){
|
||||||
extern HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *);
|
extern HRESULT WINAPI extDirectDrawCreate(GUID FAR *, LPDIRECTDRAW FAR *, IUnknown FAR *);
|
||||||
HRESULT res;
|
HRESULT res;
|
||||||
LPDIRECTDRAW lpDD;
|
LPDIRECTDRAW lpDD;
|
||||||
@ -2067,11 +2097,11 @@ HDC WINAPI extDDBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
|
|||||||
ddsd.dwHeight = dxw.GetScreenHeight();
|
ddsd.dwHeight = dxw.GetScreenHeight();
|
||||||
ddsd.dwWidth = dxw.GetScreenWidth();
|
ddsd.dwWidth = dxw.GetScreenWidth();
|
||||||
res=lpDD->CreateSurface(&ddsd, &lpDDS, NULL);
|
res=lpDD->CreateSurface(&ddsd, &lpDDS, NULL);
|
||||||
dxw.lpDDSPrimHDC = lpDDS;
|
dxw.lpDDSPrimary = lpDDS;
|
||||||
OutTraceDW("GDI.BeginPaint(MAPGDITOPRIMARY): dd=%x ddsPrim=%x\n", lpDD, lpDDS);
|
OutTraceDW("GDI.BeginPaint(MAPGDITOPRIMARY): dd=%x ddsPrim=%x\n", lpDD, lpDDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
extGetDC(dxw.lpDDSPrimHDC,&PrimHDC);
|
extGetDC(dxw.lpDDSPrimary,&PrimHDC);
|
||||||
lpPaint->hdc=PrimHDC;
|
lpPaint->hdc=PrimHDC;
|
||||||
// resize the paint area to virtual screen size (see CivIII clipped panels...)
|
// resize the paint area to virtual screen size (see CivIII clipped panels...)
|
||||||
lpPaint->rcPaint=dxw.GetScreenRect();
|
lpPaint->rcPaint=dxw.GetScreenRect();
|
||||||
@ -2131,7 +2161,7 @@ BOOL WINAPI extDDEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
|
|||||||
RECT Rect;
|
RECT Rect;
|
||||||
LPRECT lpRect;
|
LPRECT lpRect;
|
||||||
ret=(*pEndPaint)(hwnd, lpPaint);
|
ret=(*pEndPaint)(hwnd, lpPaint);
|
||||||
dxw.lpDDSPrimHDC->Unlock(NULL);
|
dxw.lpDDSPrimary->Unlock(NULL);
|
||||||
//dxw.ScreenRefresh();
|
//dxw.ScreenRefresh();
|
||||||
if(dxw.IsDesktop(hwnd))
|
if(dxw.IsDesktop(hwnd))
|
||||||
lpRect=NULL;
|
lpRect=NULL;
|
||||||
@ -2152,7 +2182,7 @@ BOOL WINAPI extDDEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
|
|||||||
Rect = dxw.MapClientRect(lpRect);
|
Rect = dxw.MapClientRect(lpRect);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
extBlt(dxw.lpDDSPrimHDC, lpRect, dxw.lpDDSPrimHDC, NULL, 0, NULL);
|
extBlt(dxw.lpDDSPrimary, lpRect, dxw.lpDDSPrimary, NULL, 0, NULL);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user