1
0
mirror of https://github.com/DxWnd/DxWnd.reloaded synced 2024-12-30 09:25:35 +01:00

v2_02_09_src

Former-commit-id: 7fb3b3bed743f47a59d8c7ace59a2c463bf2f784
This commit is contained in:
gho tik 2013-01-29 11:17:05 -05:00 committed by Refael ACkermann
parent 6c0296c0e4
commit 7fce4dde63
16 changed files with 4041 additions and 138 deletions

View File

@ -145,6 +145,7 @@ LRESULT CALLBACK extWindowProc(HWND, UINT, WPARAM, LPARAM);
#define OutTraceX if(dxw.dwTFlags & OUTPROXYTRACE) OutTrace
#define OutTraceD if(dxw.dwTFlags & OUTDDRAWTRACE) OutTrace
#define OutTraceC if(dxw.dwTFlags & OUTCURSORTRACE) OutTrace
#define OutTraceB if(dxw.dwTFlags & OUTDEBUG) OutTrace
#define OutTraceP OutTrace
#define OutTraceE OutTrace

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:42bf1dd1c3802f28d8bf51d0612a2a5df8e070e0218e2c15912e038ece52c5aa
size 272384
oid sha256:5d86d12841bdee7ce3d7140b40baf24b55ea5067689bd374bd8ca59dad6a6d7b
size 272896

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cb6552a857a81cef451a0851137395257ef958b967bc307ded9978abeb09b517
oid sha256:a5cb263e1da61a6fa71899a4885cf2b6bb608dc3af7af603244d471d524c1cf4
size 488960

View File

@ -30,3 +30,11 @@ many fixes on the FPS and time control features.
v2.02.08:
fixed some errors in the main directdraw palette descriptor. That gives better compatibility and less complicated source code.
added Fake Version feature: now Dungeon Keeper II (original version, not GOG hack) can detect a fake Win2000 / WinXP environment on Win7 and newer. Tested and working on Win7. Many thanks to Maxim for pushing me hard to win my lazyness and implement this new feature.
v2.02.09:
Fixed some x,y window coordinates bugs
Fixed some proxy log messages (missing \n line terminator)
Fixed Trace "DirectX" flag.
improved GetDC handling in 8BPP palette mode: AddPalette called on demand, and on any surface (including backbuffers): makes Emergency work with no "Handle DC" flag set. Beware: this may affect the "Map GDI HDC on Primary DC" flag causing surface locks.
Fixed limit FPS timing issues: now the max possible FPS is 1000/delay.
Fixed EndPaint bug causing HDC lock in "Map GDI HDC to Primary DC" mode.

View File

@ -21,7 +21,7 @@ path1=D:\Games\7th_Legion\LEGION.EXE
module1=
ver1=0
flag1=402669607
flagg1=67600
flagg1=2185232
tflag1=12
initx1=0
inity1=0
@ -90,7 +90,7 @@ module5=
ver5=1
flag5=134217762
flagg5=32
tflag5=3
tflag5=2
initx5=0
inity5=0
minx5=0
@ -106,8 +106,8 @@ path6=D:\Games\Age of Empires\EMPIRES.EXE
module6=
ver6=0
flag6=402653347
flagg6=2179088
tflag6=3
flagg6=2166800
tflag6=259
initx6=0
inity6=0
minx6=0
@ -123,7 +123,7 @@ path7=D:\Games\Age of Empires 2\empires2.exe
module7=
ver7=0
flag7=134217762
flagg7=0
flagg7=20480
tflag7=0
initx7=0
inity7=0
@ -158,7 +158,7 @@ module9=VideoP.dpl vcl30.dpl
ver9=0
flag9=545390594
flagg9=17
tflag9=131
tflag9=130
initx9=0
inity9=0
minx9=0
@ -277,7 +277,7 @@ module16=
ver16=0
flag16=142606370
flagg16=1048576
tflag16=259
tflag16=258
initx16=0
inity16=0
minx16=0
@ -719,7 +719,7 @@ module42=OpenGL32.dll
ver42=9
flag42=514
flagg42=513
tflag42=387
tflag42=386
initx42=0
inity42=0
minx42=0
@ -923,7 +923,7 @@ module54=
ver54=1
flag54=134234150
flagg54=16
tflag54=3
tflag54=2
initx54=0
inity54=0
minx54=0
@ -957,7 +957,7 @@ module56=
ver56=8
flag56=0
flagg56=20480
tflag56=259
tflag56=258
initx56=0
inity56=0
minx56=0
@ -991,7 +991,7 @@ module58=
ver58=9
flag58=679477249
flagg58=303104
tflag58=257
tflag58=256
initx58=0
inity58=0
minx58=0
@ -1037,19 +1037,19 @@ posy60=50
sizx60=800
sizy60=600
title61=Dungeon Keeper II
path61=C:\Games\Dungeon Keeper II\DKII.exe
path61=D:\Games\Dungeon Keeper 2\DKII.exe
module61=
ver61=0
flag61=34
flagg61=0
tflag61=82
tflag61=2
initx61=0
inity61=0
minx61=0
miny61=0
maxx61=0
maxy61=0
posx61=50
posx61=150
posy61=50
sizx61=800
sizy61=600
@ -1057,9 +1057,9 @@ title62=Emergency Fighters for life
path62=D:\Games\Emergency\EMERGY.EXE
module62=
ver62=0
flag62=134283811
flag62=134545443
flagg62=18
tflag62=3
tflag62=2
initx62=0
inity62=0
minx62=0
@ -1365,7 +1365,7 @@ module80=
ver80=10
flag80=1073741826
flagg80=513
tflag80=259
tflag80=258
initx80=0
inity80=0
minx80=0
@ -1382,7 +1382,7 @@ module81=
ver81=1
flag81=1073741826
flagg81=16384
tflag81=3
tflag81=2
initx81=0
inity81=0
minx81=0
@ -1399,7 +1399,7 @@ module82=
ver82=9
flag82=570425377
flagg82=0
tflag82=479
tflag82=478
initx82=0
inity82=0
minx82=0
@ -1483,8 +1483,8 @@ path87=D:\Games\Hexen II\glh2.exe
module87=
ver87=10
flag87=3
flagg87=2310145
tflag87=387
flagg87=155649
tflag87=386
initx87=0
inity87=0
minx87=0
@ -1533,7 +1533,7 @@ title90=Hyperblade
path90=D:\Games\Hyperblade\HYPERX.EXE
module90=
ver90=0
flag90=163
flag90=134217891
flagg90=3231762
tflag90=3
initx90=0
@ -1620,7 +1620,7 @@ module95=
ver95=8
flag95=134217760
flagg95=0
tflag95=3
tflag95=2
initx95=0
inity95=0
minx95=0
@ -1654,7 +1654,7 @@ module97=winmm
ver97=9
flag97=537010208
flagg97=196608
tflag97=259
tflag97=258
initx97=0
inity97=0
minx97=0
@ -1671,7 +1671,7 @@ module98=
ver98=0
flag98=0
flagg98=512
tflag98=267
tflag98=266
initx98=0
inity98=0
minx98=0
@ -1773,7 +1773,7 @@ module104=
ver104=7
flag104=0
flagg104=512
tflag104=259
tflag104=258
initx104=0
inity104=0
minx104=0
@ -2147,7 +2147,7 @@ module126=
ver126=10
flag126=167772672
flagg126=1
tflag126=387
tflag126=386
initx126=0
inity126=0
minx126=0
@ -2283,7 +2283,7 @@ module134=
ver134=0
flag134=134234114
flagg134=212992
tflag134=257
tflag134=256
initx134=0
inity134=0
minx134=0
@ -2317,7 +2317,7 @@ module136=
ver136=0
flag136=134217730
flagg136=0
tflag136=387
tflag136=386
initx136=0
inity136=0
minx136=0
@ -2334,7 +2334,7 @@ module137=
ver137=0
flag137=134218242
flagg137=0
tflag137=259
tflag137=258
initx137=0
inity137=0
minx137=0
@ -2436,7 +2436,7 @@ module143=ref_gl.dll ref_soft.dll
ver143=10
flag143=402670082
flagg143=769
tflag143=387
tflag143=386
initx143=0
inity143=0
minx143=0
@ -2640,7 +2640,7 @@ module155=
ver155=10
flag155=0
flagg155=65536
tflag155=3
tflag155=2
initx155=0
inity155=0
minx155=0
@ -2827,7 +2827,7 @@ module166=
ver166=0
flag166=-2013265886
flagg166=16
tflag166=3
tflag166=2
initx166=0
inity166=0
minx166=0
@ -2944,9 +2944,9 @@ title173=Tomb Raider 2 the Golden Mask
path173=D:\Games\TR2 Golden Mask\T2GOLD.EXE
module173=
ver173=0
flag173=570688034
flagg173=2179072
tflag173=387
flag173=570687522
flagg173=3227648
tflag173=259
initx173=0
inity173=0
minx173=0
@ -3014,7 +3014,7 @@ module177=
ver177=1
flag177=33554434
flagg177=1069056
tflag177=1
tflag177=0
initx177=0
inity177=0
minx177=0
@ -3065,7 +3065,7 @@ module180=
ver180=0
flag180=671236130
flagg180=256
tflag180=259
tflag180=258
initx180=0
inity180=0
minx180=0
@ -3081,8 +3081,8 @@ path181=D:\Games\Warcraft 2\Warcraft II BNE.exe
module181=
ver181=0
flag181=24739
flagg181=2166800
tflag181=0
flagg181=2183184
tflag181=3
initx181=0
inity181=0
minx181=0
@ -3115,8 +3115,8 @@ path183=D:\Games\WARLORDS3\Darklord.exe
module183=
ver183=0
flag183=-2013265374
flagg183=1048608
tflag183=2
flagg183=32
tflag183=3
initx183=0
inity183=0
minx183=0
@ -3125,8 +3125,8 @@ maxx183=0
maxy183=0
posx183=50
posy183=50
sizx183=800
sizy183=600
sizx183=0
sizy183=0
title184=WarTorn
path184=C:\Games\WarTorn\W.exe
module184=
@ -3196,13 +3196,13 @@ posy187=50
sizx187=800
sizy187=600
maxfps0=0
maxfps1=0
maxfps1=40
maxfps2=0
maxfps3=0
maxfps4=0
maxfps5=0
maxfps6=0
maxfps7=0
maxfps6=40
maxfps7=40
maxfps8=0
maxfps9=0
maxfps10=0
@ -3282,10 +3282,10 @@ maxfps83=0
maxfps84=0
maxfps85=0
maxfps86=0
maxfps87=100
maxfps87=50
maxfps88=0
maxfps89=0
maxfps90=40
maxfps90=25
maxfps91=0
maxfps92=0
maxfps93=0
@ -3581,7 +3581,7 @@ initts88=0
opengllib89=
initts89=0
opengllib90=
initts90=2
initts90=1
opengllib91=
initts91=0
opengllib92=
@ -3966,8 +3966,8 @@ module198=
opengllib198=
ver198=0
flag198=134217762
flagg198=65536
tflag198=3
flagg198=2113536
tflag198=259
initx198=0
inity198=0
minx198=0
@ -3978,5 +3978,25 @@ posx198=50
posy198=50
sizx198=800
sizy198=600
maxfps198=0
maxfps198=20
initts198=-9
title199=Urban Assault CD
path199=D:\Games\Urban Assault CD\UA.EXE
module199=
opengllib199=
ver199=0
flag199=671498274
flagg199=256
tflag199=274
initx199=0
inity199=0
minx199=0
miny199=0
maxx199=0
maxy199=0
posx199=50
posy199=100
sizx199=800
sizy199=600
maxfps199=0
initts199=0

View File

@ -62,7 +62,7 @@ static HRESULT WINAPI EmuBlt_8_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdest
}
}
else {
if ((*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
if(res=(*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt8_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return 0;
@ -131,7 +131,7 @@ static HRESULT WINAPI EmuBlt_16_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes
}
}
else {
if (res=(*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
if(res=(*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY|DDLOCK_WAIT, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt16_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
@ -227,7 +227,7 @@ static HRESULT WINAPI EmuBlt_24_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes
}
}
else {
if (res=(*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
if(res=(*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt24_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
@ -302,7 +302,7 @@ static HRESULT WINAPI EmuBlt_32_to_32(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes
}
}
else {
if ((*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
if(res=(*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt32_32: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
@ -371,7 +371,7 @@ static HRESULT WINAPI EmuBlt_8_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdest
}
}
else {
if ((*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
if(res=(*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt8_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return 0;
@ -454,7 +454,7 @@ static HRESULT WINAPI EmuBlt_24_to_16(LPDIRECTDRAWSURFACE lpddsdst, LPRECT lpdes
}
}
else {
if ((*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
if(res=(*pLock)(lpddssrc, 0, (LPDIRECTDRAWSURFACE)&ddsd_src, DDLOCK_SURFACEMEMORYPTR|DDLOCK_READONLY, 0)) {
(*pUnlockMethod(lpddsdst))(lpddsdst,0);
OutTraceE("EmuBlt24_16: Lock ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return 0;

View File

@ -320,13 +320,13 @@ void CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWPOS wp)
HMENU hMenu;
rect.left = dxw.iPosX;
rect.top = dxw.iPosX;
rect.top = dxw.iPosY; //v2.02.09
MaxX = dxw.iSizX;
MaxY = dxw.iSizY;
if (!MaxX) MaxX = width;
if (!MaxY) MaxY = height;
rect.right = dxw.iPosX+MaxX;
rect.bottom = dxw.iPosX+MaxY;
rect.bottom = dxw.iPosY+MaxY; //v2.02.09
dwStyle=(*pGetWindowLong)(hwnd, GWL_STYLE);
hMenu = GetMenu(hwnd);
@ -417,8 +417,8 @@ INT_PTR CALLBACK extDialogWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPA
static int t = -1;
if (t == -1)
t = GetTickCount();
int tn = GetTickCount();
t = (*pGetTickCount)();
int tn = (*pGetTickCount)();
OutTraceW("DEBUG: DialogWinMsg [0x%x]%s(%x,%x)\n", message, ExplainWinMessage(message), wparam, lparam);
@ -1192,7 +1192,7 @@ int HookInit(TARGETMAP *target, HWND hwnd)
InitScreenParameters();
if (IsDebug) OutTraceD("MoveWindow: target pos=(%d,%d) size=(%d,%d)\n", dxw.iPosX, dxw.iPosX, dxw.iSizX, dxw.iSizY);
if (IsDebug) OutTraceD("MoveWindow: target pos=(%d,%d) size=(%d,%d)\n", dxw.iPosX, dxw.iPosY, dxw.iSizX, dxw.iSizY); //v2.02.09
if(dxw.dwFlags1 & FIXPARENTWIN){
CalculateWindowPos(hwnd, dxw.iSizX, dxw.iSizY, &wp);
if (IsDebug) OutTraceD("MoveWindow: dxw.hParentWnd=%x pos=(%d,%d) size=(%d,%d)\n", dxw.hParentWnd, wp.x, wp.y, wp.cx, wp.cy);

View File

@ -132,7 +132,7 @@ void dxwCore::ResetPrimarySurface(void)
void dxwCore::InitWindowPos(int x, int y, int w, int h)
{
iPosX = x;
iPosX = y;
iPosY = y; //v2.02.09
iSizX = w;
iSizY = h;
}
@ -310,8 +310,8 @@ void dxwCore::ScreenRefresh(void)
static int t = -1;
if (t == -1)
t = GetTickCount()-(DXWREFRESHINTERVAL+1); // V.2.1.69: trick - subtract
int tn = GetTickCount();
t = (*pGetTickCount)()-(DXWREFRESHINTERVAL+1); // V.2.1.69: trick - subtract
int tn = (*pGetTickCount)();
if (tn-t < DXWREFRESHINTERVAL) return;
@ -332,12 +332,12 @@ static void CountFPS(HWND hwnd)
extern void SetFPS(int);
//DXWNDSTATUS Status;
DWORD tmp;
tmp = GetTickCount();
tmp = (*pGetTickCount)();
if((tmp - time) > 1000) {
char sBuf[80+12+1]; // title + fps string + terminator
char *fpss;
// log fps count
OutTrace("FPSCount=%d\n", FPSCount);
OutTrace("FPS: Delta=%x FPSCount=%d\n", (tmp-time), FPSCount);
// show fps count on status win
GetHookInfo()->FPSCount = FPSCount; // for overlay display
// show fps on win title bar
@ -354,18 +354,27 @@ static void CountFPS(HWND hwnd)
}
else {
FPSCount++;
OutTrace("FPS: Delta=%x FPSCount++=%d\n", (tmp-time), FPSCount);
}
}
static void LimitFrameCount(DWORD delay)
{
static DWORD oldtime=(*pGetTickCount)();
DWORD newtime;
newtime = (*pGetTickCount)();
// use '<' and not '<=' to avoid the risk of sleeping forever....
if(newtime < oldtime+delay) (*pSleep)(oldtime+delay-newtime);
oldtime = newtime;
if(newtime < oldtime+delay) {
//extern void do_slow(int);
if(IsDebug) OutTrace("FPS limit: old=%x new=%x delay=%d sleep=%d\n",
oldtime, newtime, delay, (oldtime+delay-newtime));
(*pSleep)(oldtime+delay-newtime);
// no good processing messages in the meanwhile: AoE series won't work at all!
//do_slow(oldtime+delay-newtime);
oldtime += delay; // same as doing "oldtime=(*pGetTickCount)();" now
}
else
oldtime = newtime;
}
static BOOL SkipFrameCount(DWORD delay)
@ -373,10 +382,9 @@ static BOOL SkipFrameCount(DWORD delay)
static DWORD oldtime=(*pGetTickCount)();
DWORD newtime;
newtime = (*pGetTickCount)();
// use '<' and not '<=' to avoid the risk of sleeping forever....
if(newtime < oldtime+delay) return TRUE;
if(newtime < oldtime+delay) return TRUE; // TRUE => skip the screen refresh
oldtime = newtime;
return FALSE;
return FALSE; // don't skip, do the update
}

View File

@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdio.h>
#include "dxwnd.h"
#define VERSION "2.02.08"
#define VERSION "2.02.09"
LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam);

Binary file not shown.

View File

@ -1597,9 +1597,9 @@ HRESULT WINAPI extAddOverlayDirtyRectProxy(LPDIRECTDRAWSURFACE lpdds, LPRECT dre
HRESULT res;
OutTraceP("AddOverlayDirtyRect(S): PROXED lpdds=%x ", lpdds);
if (drect)
OutTraceP(" drect=(%d,%d)-(%d,%d)",drect->left, drect->top, drect->right, drect->bottom);
OutTraceP(" drect=(%d,%d)-(%d,%d)\n",drect->left, drect->top, drect->right, drect->bottom);
else
OutTraceP(" drect=(NULL)");
OutTraceP(" drect=(NULL)\n");
res=(*pAddOverlayDirtyRect)(lpdds, drect);
if(res) OutTraceP("AddOverlayDirtyRect(S): ERROR res=%x(%s)\n", res, ExplainDDError(res));
@ -1615,9 +1615,9 @@ HRESULT WINAPI extUpdateOverlayProxy(LPDIRECTDRAWSURFACE lpdds, LPRECT lpSrcRect
else
OutTraceP(" src=(NULL)");
if (lpDestRect)
OutTraceP(" dest=(%d,%d)-(%d,%d)",lpDestRect->left, lpDestRect->top, lpDestRect->right, lpDestRect->bottom);
OutTraceP(" dest=(%d,%d)-(%d,%d)\n",lpDestRect->left, lpDestRect->top, lpDestRect->right, lpDestRect->bottom);
else
OutTraceP(" dest=(NULL)");
OutTraceP(" dest=(NULL)\n");
res=(*pUpdateOverlay)(lpdds, lpSrcRect, lpddsdest, lpDestRect, dwflags, f);
if(res) OutTraceP("UpdateOverlay(S): ERROR res=%x(%s)\n", res, ExplainDDError(res));
return res;

View File

@ -669,10 +669,10 @@ void do_slow(int delay)
{
MSG uMsg;
int t, tn;
t = GetTickCount();
t = (*pGetTickCount)();
uMsg.message=0; // initialize somehow...
while((tn = GetTickCount())-t < delay){
while((tn = (*pGetTickCount)())-t < delay){
while (PeekMessage (&uMsg, NULL, 0, 0, PM_REMOVE) > 0){
if(WM_QUIT == uMsg.message) break;
TranslateMessage (&uMsg);
@ -832,7 +832,7 @@ static void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion)
if (dxversion >= 4)
SetHook((void *)(**(DWORD **)lplpdd + 104), extTestCooperativeLevel, (void **)&pTestCooperativeLevel, "TestCooperativeLevel(D)");
if (!(dxw.dwFlags1 & OUTPROXYTRACE)) return;
if (!(dxw.dwTFlags & OUTPROXYTRACE)) return;
// Just proxed ...
// IDIrectDraw::AddRef
@ -845,7 +845,7 @@ static void HookDDSession(LPDIRECTDRAW *lplpdd, int dxversion)
else
SetHook((void *)(**(DWORD **)lplpdd + 36), extEnumSurfacesProxy4, (void **)&pEnumSurfaces4, "EnumSurfaces(D4)");
// IDIrectDraw::GetCaps
SetHook((void *)(**(DWORD **)lplpdd + 44), extGetCapsD, (void **)&pGetCapsD, "GetCapsD(D)");
SetHook((void *)(**(DWORD **)lplpdd + 44), extGetCapsD, (void **)&pGetCapsD, "GetCaps(D)");
// IDIrectDraw::GetFourCCCodes
SetHook((void *)(**(DWORD **)lplpdd + 52), extGetFourCCCodesProxy, (void **)&pGetFourCCCodes, "GetFourCCCodes(D)");
// IDIrectDraw::GetMonitorFrequency
@ -878,7 +878,7 @@ static void HookDDClipper(LPDIRECTDRAWCLIPPER FAR* lplpDDClipper)
// IDirectDrawClipper::Release
SetHook((void *)(**(DWORD **)lplpDDClipper + 8), extReleaseC, (void **)&pReleaseC, "Release(C)");
if (!(dxw.dwFlags1 & OUTPROXYTRACE)) return;
if (!(dxw.dwTFlags & OUTPROXYTRACE)) return;
// Just proxed ...
// IDirectDrawClipper::QueryInterface
@ -911,7 +911,7 @@ static void HookDDPalette(LPDIRECTDRAWPALETTE FAR* lplpDDPalette)
// IDirectDrawPalette::SetEntries
SetHook((void *)(**(DWORD **)lplpDDPalette + 24), extSetEntries, (void **)&pSetEntries, "SetEntries(P)");
if (!(dxw.dwFlags1 & OUTPROXYTRACE)) return;
if (!(dxw.dwTFlags & OUTPROXYTRACE)) return;
// IDirectDrawPalette::QueryInterface
SetHook((void *)(**(DWORD **)lplpDDPalette), extQueryInterfacePProxy, (void **)&pQueryInterfaceP, "QueryInterface(P)");
@ -1013,7 +1013,7 @@ static void HookDDSurfacePrim(LPDIRECTDRAWSURFACE *lplpdds, int dxversion)
SetHook((void *)(**(DWORD **)lplpdds + 128), extUnlock4, (void **)&pUnlock4, "Unlock(S4)");
}
if (!(dxw.dwFlags1 & OUTPROXYTRACE)) return;
if (!(dxw.dwTFlags & OUTPROXYTRACE)) return;
// Just proxed ...
@ -1099,7 +1099,7 @@ static void HookDDSurfaceGeneric(LPDIRECTDRAWSURFACE *lplpdds, int dxversion)
// IDirectDrawSurface::ReleaseDC
SetHook((void *)(**(DWORD **)lplpdds + 104), extReleaseDC, (void **)&pReleaseDC, "ReleaseDC(S)");
if (!(dxw.dwFlags1 & OUTPROXYTRACE)) return;
if (!(dxw.dwTFlags & OUTPROXYTRACE)) return;
// just proxed ....
@ -1616,9 +1616,12 @@ HRESULT WINAPI extSetCooperativeLevel(void *lpdd, HWND hwnd, DWORD dwflags)
if(dxw.dwFlags1 & FIXPARENTWIN) hwnd=dxw.hParentWnd;
}
if (dwflags & DDSCL_FULLSCREEN){
if (dwflags & DDSCL_FULLSCREEN){
dxw.SetFullScreen(TRUE);
res=(*pSetCooperativeLevel)(lpdd, hwnd, DDSCL_NORMAL);
dwflags &= ~(DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX);
dwflags |= DDSCL_NORMAL;
//res=(*pSetCooperativeLevel)(lpdd, hwnd, DDSCL_NORMAL);
res=(*pSetCooperativeLevel)(lpdd, hwnd, dwflags);
AdjustWindowFrame(hwnd, dxw.GetScreenWidth(), dxw.GetScreenHeight());
//FixWindowFrame(hwnd); //-- incompatible with Microsoft Madness
if (dxw.dwFlags1 & FIXWINFRAME) FixWindowFrame(hwnd);
@ -1788,7 +1791,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
dxw.UnmarkPrimarySurface(lpDDSEmu_Prim);
// can't hook lpDDSEmu_Prim as generic, since the Flip method is unimplemented for a PRIMARY surface!
// better avoid it or hook just useful methods.
//if (dxw.dwFlags1 & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Prim, dxw.dwDDVersion);
//if (dxw.dwTFlags & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Prim, dxw.dwDDVersion);
// rebuild emulated primary backbuffer surface
@ -1812,7 +1815,7 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
}
dxw.UnmarkPrimarySurface(lpDDSEmu_Back);
if (dxw.dwFlags1 & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Back, dxversion);
if (dxw.dwTFlags & OUTPROXYTRACE) HookDDSurfaceGeneric(&lpDDSEmu_Back, dxversion);
OutTraceD("CreateSurface: created DDSEmu_Prim=%x DDSEmu_Back=%x DDSPrim=%x DDSBack=%x\n",
lpDDSEmu_Prim, lpDDSEmu_Back, lpDDSPrim, lpDDSBack);
@ -1864,24 +1867,6 @@ HRESULT WINAPI extCreateSurfaceEmu(int dxversion, CreateSurface_Type pCreateSurf
return res;
}
// for 8BPP palettized surfaces, connect them to either the ddraw emulated palette or the GDI emulated palette
if(ddsd.ddpfPixelFormat.dwRGBBitCount==8){ // use a better condition here....
if(lpDDP==NULL){
// should link here to the GDI palette? See Hyperblade....
dxw.palNumEntries=256;
res=(*pCreatePalette)(lpdd, DDPCAPS_ALLOW256|DDPCAPS_8BIT|DDPCAPS_INITIALIZE, dxw.palPalEntry, &lpDDP, NULL);
if (res) {
OutTraceE("CreateSurface: CreatePalette ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
}
res=(*pSetPalette)(*lplpdds, lpDDP);
if (res) {
OutTraceE("CreateSurface: SetPalette ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
}
// diagnostic hooks ....
HookDDSurfaceGeneric(lplpdds, dxversion);
// unmark this as possible primary
@ -2443,7 +2428,8 @@ HRESULT WINAPI sBlt(char *api, LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect,
// Try to handle HDC lock concurrency....
if(res==DDERR_SURFACEBUSY){
(*pUnlockMethod(lpddssrc))(lpddssrc, NULL);
res=(*pUnlockMethod(lpddssrc))(lpddssrc, NULL);
if(res) OutTraceE("Unlock ERROR: err=%x(%s)\n", res, ExplainDDError(res));
res=(*pBlt)(lpdds, &emurect, lpddssrc, lpsrcrect, dwflags, lpddbltfx);
if (res) BlitError(res, lpsrcrect, &destrect, __LINE__);
}
@ -2665,7 +2651,7 @@ HRESULT WINAPI extWaitForVerticalBlank(LPDIRECTDRAW lpdd, DWORD dwflags, HANDLE
static BOOL step = 0;
DWORD tmp;
if(!(dxw.dwFlags1 & SAVELOAD)) return (*pWaitForVerticalBlank)(lpdd, dwflags, hevent);
tmp = GetTickCount();
tmp = (*pGetTickCount)();
if((time - tmp) > 32) time = tmp;
(*pSleep)(time - tmp);
if(step) time += 16;
@ -2712,6 +2698,7 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
isPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("SetPalette: lpdds=%x%s lpddp=%x\n", lpdds, isPrim?"(PRIM)":"", lpddp);
#if 0
if(!(dxw.dwFlags1 & EMULATESURFACE) || !isPrim) {
res=(*pSetPalette)(lpdds, lpddp);
if(res)OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
@ -2735,6 +2722,25 @@ HRESULT WINAPI extSetPalette(LPDIRECTDRAWSURFACE lpdds, LPDIRECTDRAWPALETTE lpdd
}
return 0;
#else
res=(*pSetPalette)(lpdds, lpddp);
if(res)OutTraceE("SetPalette: ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
if((dxw.dwFlags1 & EMULATESURFACE) && (res==DD_OK)){
OutTraceD("SetPalette: DEBUG emulating palette\n");
lpDDP = lpddp;
if(lpddp){
HRESULT res2;
lpentries = (LPPALETTEENTRY)PaletteEntries;
res2=lpddp->GetEntries(0, 0, 256, lpentries);
if(res2) OutTraceE("SetPalette: GetEntries ERROR res=%x(%s)\n", res2, ExplainDDError(res2));
mySetPalette(0, 256, lpentries);
}
}
return res;
#endif
}
HRESULT WINAPI extSetEntries(LPDIRECTDRAWPALETTE lpddp, DWORD dwflags, DWORD dwstart, DWORD dwcount, LPPALETTEENTRY lpentries)
@ -2926,6 +2932,30 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC)
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("GetDC: lpdss=%x%s\n",lpdds, IsPrim?"(PRIM)":"");
res=(*pGetDC)(lpdds,pHDC);
if (res==DDERR_CANTCREATEDC &&
(dxw.dwFlags1 & EMULATESURFACE) &&
dxw.VirtualPixelFormat.dwRGBBitCount==8) {
// for 8BPP palettized surfaces, connect them to either the ddraw emulated palette or the GDI emulated palette
OutTraceD("GetDC: adding 8BPP palette to surface lpdds=%x\n", lpdds);
if(lpDDP==NULL){
// should link here to the GDI palette? See Hyperblade....
dxw.palNumEntries=256;
res=(*pCreatePalette)(lpDD, DDPCAPS_ALLOW256|DDPCAPS_8BIT|DDPCAPS_INITIALIZE, dxw.palPalEntry, &lpDDP, NULL);
if (res) {
OutTraceE("CreateSurface: CreatePalette ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
}
res=(*pSetPalette)(lpdds, lpDDP);
if (res) {
OutTraceE("CreateSurface: SetPalette ERROR res=%x(%s) at %d\n", res, ExplainDDError(res), __LINE__);
return res;
}
// retry ....
res=(*pGetDC)(lpdds,pHDC);
}
if(res){
// take care: actually, many games (AoE, Beasts & Bumpkins) get an error code here,
// but pretending nothing happened seems the best way to get tha game working somehow.

3838
dll/hddraw.cpp.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1308,20 +1308,26 @@ ATOM WINAPI extRegisterClassExA(WNDCLASSEX *lpwcx)
return (*pRegisterClassExA)(lpwcx);
}
BOOL WINAPI extClientToScreen(HWND whnd, LPPOINT lppoint)
BOOL WINAPI extClientToScreen(HWND hwnd, LPPOINT lppoint)
{
if (lppoint && dxw.IsFullScreen() && (whnd == dxw.GethWnd()))
OutTraceB("ClientToScreen: hwnd=%x hWnd=%x FullScreen=%x point=(%d,%d)\n",
hwnd, dxw.GethWnd(), dxw.IsFullScreen(), lppoint->x, lppoint->y);
if (lppoint && dxw.IsFullScreen() && (hwnd == dxw.GethWnd()))
return 1;
else
return (*pClientToScreen)(whnd, lppoint);
return (*pClientToScreen)(hwnd, lppoint);
}
BOOL WINAPI extScreenToClient(HWND whnd, LPPOINT lppoint)
BOOL WINAPI extScreenToClient(HWND hwnd, LPPOINT lppoint)
{
if (lppoint && dxw.IsFullScreen() && (whnd == dxw.GethWnd()))
OutTraceB("ScreenToClient: hwnd=%x hWnd=%x FullScreen=%x point=(%d,%d)\n",
hwnd, dxw.GethWnd(), dxw.IsFullScreen(), lppoint->x, lppoint->y);
if (lppoint && dxw.IsFullScreen() && (hwnd == dxw.GethWnd()))
return 1;
else
return (*pScreenToClient)(whnd, lppoint);
return (*pScreenToClient)(hwnd, lppoint);
}
BOOL WINAPI extGetClientRect(HWND hwnd, LPRECT lpRect)
@ -2160,6 +2166,7 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
BOOL WINAPI extEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
{
BOOL ret;
HRESULT WINAPI extReleaseDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR hdc);
// proxy part ...
OutTraceD("GDI.EndPaint: hwnd=%x lpPaint=%x\n", hwnd, lpPaint);
@ -2170,6 +2177,14 @@ BOOL WINAPI extEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
// if not in fullscreen mode, that's all!
if(!dxw.IsFullScreen()) return ret;
// v2.02.09: on MAPGDITOPRIMARY, release the PrimHDC handle
if(dxw.dwFlags1 & MAPGDITOPRIMARY) {
if(pReleaseDC && dxw.lpDDSPrimHDC){
extReleaseDC(dxw.lpDDSPrimHDC, PrimHDC);
OutTraceD("GDI.EndPaint: released hdc=%x\n", PrimHDC);
}
}
return ret;
}

Binary file not shown.

View File

@ -1,17 +0,0 @@
del dll\dxwnd.*.user
del dll\dxwnd.*.ncb
del host\dxwndhost.*.user
del host\dxwndhost.*.ncb
copy Release\dxwnd.exe build
copy Release\dxwnd.dll build
del dll\Debug\*.*
del dll\Release\*.*
del host\Debug\*.*
del host\Release\*.*
echo build done
pause