diff --git a/Include/dxwnd.h b/Include/dxwnd.h
index 54565fd..44f23fe 100644
--- a/Include/dxwnd.h
+++ b/Include/dxwnd.h
@@ -258,8 +258,11 @@ LRESULT CALLBACK extDialogWindowProc(HWND, UINT, WPARAM, LPARAM);
#define IsAssertEnabled (dxw.dwTFlags & ASSERTDIALOG)
#define STEP OutTrace("STEP at %s:%d\n", __FILE__, __LINE__)
-extern void WhndStackPush(HWND, WNDPROC);
-extern WNDPROC WhndGetWindowProc(HWND );
+extern void WinDBPut(HWND, WNDPROC, int, int);
+extern BOOL WinDBGetSize(HWND, int *, int *);
+extern WNDPROC WinDBGetProc(HWND);
+extern void WinDBPutProc(HWND, WNDPROC);
+extern void WinDBPutSize(HWND, int, int);
typedef enum {
DXW_SET_COORDINATES = 0,
diff --git a/build/dxwnd.dll b/build/dxwnd.dll
index 430192f..9f9b368 100644
--- a/build/dxwnd.dll
+++ b/build/dxwnd.dll
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:9acf0133674a5d1ffcc309d75c08587768cf3442b0df972f25fae2e030364053
-size 492544
+oid sha256:44bc7151507fb71f758117713d02a61e84ee848a109920a5e8c6820e4cfe79a2
+size 493568
diff --git a/build/dxwnd.ini b/build/dxwnd.ini
index ae1493c..4df1801 100644
--- a/build/dxwnd.ini
+++ b/build/dxwnd.ini
@@ -1,6 +1,59 @@
[window]
-posx=929
-posy=550
+posx=1074
+posy=334
sizx=320
sizy=200
lang=automatic
+[target]
+title0=MetroLL.exe
+path0=D:\Games\Metro Last Light\MetroLL.exe
+launchpath0=
+module0=
+opengllib0=
+ver0=10
+coord0=0
+flag0=679477792
+flagg0=1207959552
+flagh0=20
+flagi0=205520900
+tflag0=6147
+initx0=0
+inity0=0
+minx0=0
+miny0=0
+maxx0=0
+maxy0=0
+posx0=50
+posy0=50
+sizx0=800
+sizy0=600
+maxfps0=0
+initts0=0
+winver0=0
+maxres0=-1
+title1=MC.EXE
+path1=D:\Games\Moonchld\MC.EXE
+launchpath1=
+module1=
+opengllib1=
+ver1=0
+coord1=0
+flag1=134218336
+flagg1=1207959552
+flagh1=2068
+flagi1=-2009071612
+tflag1=6147
+initx1=0
+inity1=0
+minx1=0
+miny1=0
+maxx1=0
+maxy1=0
+posx1=50
+posy1=50
+sizx1=800
+sizy1=600
+maxfps1=0
+initts1=0
+winver1=0
+maxres1=-1
diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt
index 02de050..91a90c1 100644
--- a/build/readme-relnotes.txt
+++ b/build/readme-relnotes.txt
@@ -548,4 +548,8 @@ fix: supppressed BackBuffer release within D3D7:CreateDevice: this makes "Tetris
add: build-in check for compatibility modes set!
v2.02.84
-fix: removed extra reference to ddraw session causing window movements on fullscreen game exit: fixes another "Wind Fantasy SP" reported bug
\ No newline at end of file
+fix: removed extra reference to ddraw session causing window movements on fullscreen game exit: fixes another "Wind Fantasy SP" reported bug
+
+v2.02.85
+fix: revised handling of d3d D3DFORMAT field: fixes "Call of Cthulhu DCotE" color problems
+fix: added recovery for rounded child win coordinates: fixes blitting problems in Diablo when win size is not an exact multiple of native resolution.
\ No newline at end of file
diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp
index 91d3ae9..38b7f79 100644
--- a/dll/dxhook.cpp
+++ b/dll/dxhook.cpp
@@ -528,7 +528,7 @@ void HookWindowProc(HWND hwnd)
}
else {// don't hook twice ....
long lres;
- WhndStackPush(hwnd, pWindowProc);
+ WinDBPutProc(hwnd, pWindowProc);
lres=(*pSetWindowLongA)(hwnd, GWL_WNDPROC, (LONG)extWindowProc);
OutTraceDW("SetWindowLong: hwnd=%x HOOK WindowProc=%x->%x\n", hwnd, lres, (LONG)extWindowProc);
}
@@ -597,7 +597,7 @@ LRESULT CALLBACK extDialogWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPA
t=tn;
}
- pWindowProc=WhndGetWindowProc(hwnd);
+ pWindowProc=WinDBGetProc(hwnd);
if(pWindowProc) return(*pCallWindowProc)(pWindowProc, hwnd, message, wparam, lparam);
char *sMsg="ASSERT: DialogWinMsg pWindowProc=NULL !!!\n";
OutTraceDW(sMsg);
@@ -653,7 +653,7 @@ LRESULT CALLBACK extChildWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPAR
}
}
- pWindowProc=WhndGetWindowProc(hwnd);
+ pWindowProc=WinDBGetProc(hwnd);
// v2.02.82: use CallWindowProc that handles WinProc handles
if(pWindowProc) return(*pCallWindowProc)(pWindowProc, hwnd, message, wparam, lparam);
@@ -1016,7 +1016,7 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
}
if (dxw.dwFlags1 & AUTOREFRESH) dxw.ScreenRefresh();
- pWindowProc=WhndGetWindowProc(hwnd);
+ pWindowProc=WinDBGetProc(hwnd);
//OutTraceB("WindowProc: pWindowProc=%x extWindowProc=%x message=%x(%s) wparam=%x lparam=%x\n",
// (*pWindowProc), extWindowProc, message, ExplainWinMessage(message), wparam, lparam);
if(pWindowProc) {
diff --git a/dll/dxwcore.cpp b/dll/dxwcore.cpp
index 4e61dc8..157f238 100644
--- a/dll/dxwcore.cpp
+++ b/dll/dxwcore.cpp
@@ -29,7 +29,7 @@ static LARGE_INTEGER TimeShifter64Coarse(LARGE_INTEGER, int);
dxwCore::dxwCore()
{
// initialization stuff ....
- extern void WhndStackInit();
+ extern void WinDBInit();
FullScreen=FALSE;
SethWnd(NULL);
SetScreenSize();
@@ -44,7 +44,7 @@ dxwCore::dxwCore()
ResetEmulatedDC();
MustShowOverlay=FALSE;
TimerEvent.dwTimerType = TIMER_TYPE_NONE;
- WhndStackInit();
+ WinDBInit();
}
dxwCore::~dxwCore()
diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp
index 27bb17d..d0635d9 100644
--- a/dll/dxwnd.cpp
+++ b/dll/dxwnd.cpp
@@ -24,7 +24,7 @@ along with this program. If not, see .
#include "dxwnd.h"
#include "dxwcore.hpp"
-#define VERSION "2.02.84"
+#define VERSION "2.02.85"
#define DDTHREADLOCK 1
diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo
index 6fb3b42..61209d3 100644
Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ
diff --git a/dll/dxwnd.vs2008.vcproj b/dll/dxwnd.vs2008.vcproj
index 5a775f6..f68a5a8 100644
--- a/dll/dxwnd.vs2008.vcproj
+++ b/dll/dxwnd.vs2008.vcproj
@@ -445,6 +445,10 @@
RelativePath=".\glidehook.h"
>
+
+
diff --git a/dll/hd3d.cpp b/dll/hd3d.cpp
index 6995efb..d28f4fe 100644
--- a/dll/hd3d.cpp
+++ b/dll/hd3d.cpp
@@ -9,6 +9,7 @@
#include "dxhook.h"
#include "dxhelper.h"
#include "syslibs.h"
+#include "hd3d.doc.hpp" // fake include to hold documentation
#define HOOKD3D10ANDLATER 1
#define TRACEALLMETHODS 1
@@ -668,7 +669,6 @@ HRESULT WINAPI extReset(void *pd3dd, D3DPRESENT_PARAMETERS* pPresParam)
OutTraceD3D("GetAdapterDisplayMode FAILED! %x\n", res);
return(DD_OK);
}
- param[2] = mode.Format;
param[7] = 0; //hDeviceWindow
dxw.SetFullScreen(~param[8]?TRUE:FALSE);
param[8] = 1; //Windowed
@@ -688,7 +688,6 @@ HRESULT WINAPI extReset(void *pd3dd, D3DPRESENT_PARAMETERS* pPresParam)
OutTraceD3D("GetAdapterDisplayMode FAILED! %x\n", res);
return(DD_OK);
}
- param[2] = mode.Format;
param[6] = 0; //hDeviceWindow
dxw.SetFullScreen(~param[7]?TRUE:FALSE);
param[7] = 1; //Windowed
@@ -700,6 +699,16 @@ HRESULT WINAPI extReset(void *pd3dd, D3DPRESENT_PARAMETERS* pPresParam)
if(!(dxw.dwFlags4 & NOD3DRESET)){
res = (*pReset)(pd3dd, (D3DPRESENT_PARAMETERS *)param);
+ if(res){
+ OutTraceD3D("switching to mode=%x\n", mode.Format);
+ param[2] = mode.Format; // first attempt: current screen mode
+ res = (*pReset)(pd3dd, (D3DPRESENT_PARAMETERS *)param);
+ }
+ if(res){
+ OutTraceD3D("switching to mode=D3DFMT_UNKNOWN\n");
+ param[2] = D3DFMT_UNKNOWN; // second attempt: unknown, good for windowed mode
+ res = (*pReset)(pd3dd, (D3DPRESENT_PARAMETERS *)param);
+ }
if(res == D3DERR_INVALIDCALL){
OutTraceD3D("FAILED! D3DERR_INVALIDCALL\n", res);
return D3DERR_INVALIDCALL;
@@ -898,7 +907,6 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
(*pGetAdapterDisplayMode9)(lpd3d, 0, &mode);
else
(*pGetAdapterDisplayMode8)(lpd3d, 0, &mode);
- param[2] = mode.Format;
OutTraceD3D(" Current Format = 0x%x\n", mode.Format);
OutTraceD3D(" Current ScreenSize = (%dx%d)\n", mode.Width, mode.Height);
OutTraceD3D(" Current Refresh Rate = %d\n", mode.RefreshRate);
@@ -913,6 +921,16 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
param[13] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval
}
res = (*pCreateDevice9)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, ppd3dd);
+ if(res){
+ OutTraceD3D("switching to mode=%x\n", mode.Format);
+ param[2] = mode.Format; // first attempt: current screen mode
+ res = (*pCreateDevice9)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, ppd3dd);
+ }
+ if(res){
+ OutTraceD3D("switching to mode=D3DFMT_UNKNOWN\n");
+ param[2] = D3DFMT_UNKNOWN; // second attempt: unknown, good for windowed mode
+ res = (*pCreateDevice9)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, ppd3dd);
+ }
}
else{
if(dxw.Windowize){
@@ -924,6 +942,16 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
param[12] = D3DPRESENT_INTERVAL_DEFAULT; //PresentationInterval
}
res = (*pCreateDevice8)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, ppd3dd);
+ if(res){
+ OutTraceD3D("switching to mode=%x\n", mode.Format);
+ param[2] = mode.Format; // first attempt: current screen mode
+ res = (*pCreateDevice8)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, ppd3dd);
+ }
+ if(res){
+ OutTraceD3D("switching to mode=D3DFMT_UNKNOWN\n");
+ param[2] = D3DFMT_UNKNOWN; // second attempt: unknown, good for windowed mode
+ res = (*pCreateDevice8)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, ppd3dd);
+ }
}
if(res){
@@ -989,7 +1017,6 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp
//((LPDIRECT3D9)lpd3d)->GetAdapterDisplayMode(0, &mode);
(*pGetAdapterDisplayMode9)(lpd3d, 0, &mode);
- param[2] = mode.Format;
OutTraceD3D(" Current Format = 0x%x\n", mode.Format);
OutTraceD3D(" Current ScreenSize = (%dx%d)\n", mode.Width, mode.Height);
OutTraceD3D(" Current Refresh Rate = %d\n", mode.RefreshRate);
@@ -1004,6 +1031,16 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp
}
res = (*pCreateDeviceEx)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, pFullscreenDisplayMode, ppd3dd);
+ if(res){
+ OutTraceD3D("switching to mode=%x\n", mode.Format);
+ param[2] = mode.Format; // first attempt: current screen mode
+ res = (*pCreateDeviceEx)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, pFullscreenDisplayMode, ppd3dd);
+ }
+ if(res){
+ OutTraceD3D("switching to mode=D3DFMT_UNKNOWN\n");
+ param[2] = D3DFMT_UNKNOWN; // second attempt: unknown, good for windowed mode
+ res = (*pCreateDeviceEx)(lpd3d, 0, devicetype, hfocuswindow, behaviorflags, param, pFullscreenDisplayMode, ppd3dd);
+ }
if(res){
OutTraceD3D("FAILED! %x\n", res);
return res;
@@ -1109,7 +1146,6 @@ HRESULT WINAPI extCreateAdditionalSwapChain(void *lpd3dd, D3DPRESENT_PARAMETERS
(*pGetAdapterDisplayMode9)(lpd3dd, 0, &mode);
else
(*pGetAdapterDisplayMode8)(lpd3dd, 0, &mode);
- param[2] = mode.Format;
OutTraceD3D(" Current Format = 0x%x\n", mode.Format);
OutTraceD3D(" Current ScreenSize = (%dx%d)\n", mode.Width, mode.Height);
OutTraceD3D(" Current Refresh Rate = %d\n", mode.RefreshRate);
@@ -1131,7 +1167,20 @@ HRESULT WINAPI extCreateAdditionalSwapChain(void *lpd3dd, D3DPRESENT_PARAMETERS
}
}
res=(*pCreateAdditionalSwapChain)(lpd3dd, (D3DPRESENT_PARAMETERS *)param, ppSwapChain);
- if(res) OutTraceE("CreateAdditionalSwapChain ERROR: res=%x\n", res);
+ if(res){
+ OutTraceD3D("switching to mode=%x\n", mode.Format);
+ param[2] = mode.Format; // first attempt: current screen mode
+ res=(*pCreateAdditionalSwapChain)(lpd3dd, (D3DPRESENT_PARAMETERS *)param, ppSwapChain);
+ }
+ if(res){
+ OutTraceD3D("switching to mode=D3DFMT_UNKNOWN\n");
+ param[2] = D3DFMT_UNKNOWN; // second attempt: unknown, good for windowed mode
+ res=(*pCreateAdditionalSwapChain)(lpd3dd, (D3DPRESENT_PARAMETERS *)param, ppSwapChain);
+ }
+ if(res) {
+ OutTraceE("CreateAdditionalSwapChain ERROR: res=%x\n", res);
+ }
+
(dwD3DVersion == 9) ? HookD3DDevice9(&lpd3dd) : HookD3DDevice8(&lpd3dd);
return res;
}
diff --git a/dll/hd3d.doc.hpp b/dll/hd3d.doc.hpp
new file mode 100644
index 0000000..38ccad0
--- /dev/null
+++ b/dll/hd3d.doc.hpp
@@ -0,0 +1,41 @@
+#if 0
+from http://msdn.microsoft.com/en-us/library/windows/desktop/bb172588%28v=vs.85%29.aspx
+
+D3DPRESENT_PARAMETERS structure
+
+Describes the presentation parameters.
+Syntax
+C++
+
+typedef struct D3DPRESENT_PARAMETERS {
+ UINT BackBufferWidth;
+ UINT BackBufferHeight;
+ D3DFORMAT BackBufferFormat;
+ UINT BackBufferCount;
+ D3DMULTISAMPLE_TYPE MultiSampleType;
+ DWORD MultiSampleQuality;
+ D3DSWAPEFFECT SwapEffect;
+ HWND hDeviceWindow;
+ BOOL Windowed;
+ BOOL EnableAutoDepthStencil;
+ D3DFORMAT AutoDepthStencilFormat;
+ DWORD Flags;
+ UINT FullScreen_RefreshRateInHz;
+ UINT PresentationInterval;
+} D3DPRESENT_PARAMETERS, *LPD3DPRESENT_PARAMETERS;
+
+BackBufferFormat
+ Type: D3DFORMAT
+ The back buffer format. For more information about formats, see D3DFORMAT.
+ This value must be one of the render-target formats as validated by CheckDeviceType.
+ You can use GetDisplayMode to obtain the current format.
+ In fact, D3DFMT_UNKNOWN can be specified for the BackBufferFormat while in windowed mode.
+ This tells the runtime to use the current display-mode format and eliminates the need to call GetDisplayMode.
+ For windowed applications, the back buffer format no longer needs to match the display-mode format because
+ color conversion can now be done by the hardware (if the hardware supports color conversion).
+ The set of possible back buffer formats is constrained, but the runtime will allow any valid back buffer format
+ to be presented to any desktop format. (There is the additional requirement that the device be operable in the
+ desktop; devices typically do not operate in 8 bits per pixel modes.)
+
+ Full-screen applications cannot do color conversion.
+#endif
\ No newline at end of file
diff --git a/dll/user32.cpp b/dll/user32.cpp
index 0a23fc6..b97a21d 100644
--- a/dll/user32.cpp
+++ b/dll/user32.cpp
@@ -12,6 +12,8 @@
#include "hddraw.h"
#include "dxhelper.h"
+#define FIXCHILDSIZE TRUE
+
BOOL IsChangeDisplaySettingsHotPatched = FALSE;
static HookEntry_Type Hooks[]={
@@ -543,7 +545,7 @@ LONG WINAPI extGetWindowLong(HWND hwnd, int nIndex, GetWindowLong_Type pGetWindo
if((nIndex==GWL_WNDPROC)||(nIndex==DWL_DLGPROC)){
WNDPROC wp;
- wp=WhndGetWindowProc(hwnd);
+ wp=WinDBGetProc(hwnd);
OutTraceDW("GetWindowLong: remapping WindowProc res=%x -> %x\n", res, (LONG)wp);
if(wp) res=(LONG)wp; // if not found, don't alter the value.
}
@@ -623,8 +625,8 @@ LONG WINAPI extSetWindowLong(HWND hwnd, int nIndex, LONG dwNewLong, SetWindowLon
if((OldProc==extWindowProc) ||
(OldProc==extChildWindowProc)||
(OldProc==extDialogWindowProc))
- OldProc=WhndGetWindowProc(hwnd);
- WhndStackPush(hwnd, (WNDPROC)dwNewLong);
+ OldProc=WinDBGetProc(hwnd);
+ WinDBPutProc(hwnd, (WNDPROC)dwNewLong);
res=(LONG)OldProc;
SetLastError(0);
lres=(WNDPROC)(*pSetWindowLongA)(hwnd, nIndex, (LONG)extWindowProc);
@@ -973,6 +975,16 @@ BOOL WINAPI extGetClientRect(HWND hwnd, LPRECT lpRect)
}
else
if (dxw.IsFullScreen()){
+ int w, h;
+ if(FIXCHILDSIZE){
+ if(WinDBGetSize(hwnd, &w, &h)){
+ lpRect->top=lpRect->left=0;
+ lpRect->right=w;
+ lpRect->bottom=h;
+ OutTraceB("GetClientRect: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
+ return TRUE;
+ }
+ }
*lpRect=dxw.GetClientRect(*lpRect);
OutTraceB("GetClientRect: fixed rect=(%d,%d)-(%d,%d)\n", lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
}
@@ -1127,7 +1139,7 @@ static void HookChildWndProc(HWND hwnd, DWORD dwStyle, LPCTSTR ApiName)
{
// child window inherit the father's windproc, so if it's redirected to
// a hooker (either extWindowProc or extChildWindowProc) you have to retrieve
- // the correct value (WhndGetWindowProc) before saving it (WhndStackPush).
+ // the correct value (WinDBGetProc) before saving it (WinDBPutProc).
long res;
WNDPROC pWindowProc;
@@ -1138,13 +1150,13 @@ static void HookChildWndProc(HWND hwnd, DWORD dwStyle, LPCTSTR ApiName)
HWND Father;
WNDPROC pFatherProc;
Father=GetParent(hwnd);
- pFatherProc=WhndGetWindowProc(Father);
+ pFatherProc=WinDBGetProc(Father);
OutTraceDW("%s: WndProc=%s father=%x WndProc=%x\n", ApiName,
(pWindowProc == extWindowProc) ? "extWindowProc" : ((pWindowProc == extChildWindowProc) ? "extChildWindowProc" : "extDialogWindowProc"),
Father, pFatherProc);
pWindowProc = pFatherProc;
}
- WhndStackPush(hwnd, pWindowProc);
+ WinDBPutProc(hwnd, pWindowProc);
if(dwStyle & WS_CHILD){
OutTraceDW("%s: Hooking CHILD hwnd=%x father WindowProc %x->%x\n", ApiName, hwnd, pWindowProc, extChildWindowProc);
res=(*pSetWindowLongA)(hwnd, GWL_WNDPROC, (LONG)extChildWindowProc);
@@ -1174,7 +1186,10 @@ static HWND WINAPI extCreateWindowCommon(
{
HWND hwnd;
BOOL isValidHandle=TRUE;
+ int iOrigW, iOrigH;
+ iOrigW=nWidth;
+ iOrigH=nHeight;
if(!dxw.Windowize){
if(WideChar)
hwnd= (*pCreateWindowExW)(dwExStyle, (LPCWSTR)lpClassName, (LPCWSTR)lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam);
@@ -1336,6 +1351,9 @@ static HWND WINAPI extCreateWindowCommon(
if ((dxw.dwFlags1 & HOOKCHILDWIN) && (dwStyle & (WS_CHILD|WS_DLGFRAME)))
HookChildWndProc(hwnd, dwStyle, ApiName);
+ if ((FIXCHILDSIZE) && (dwStyle & (WS_CHILD|WS_DLGFRAME)))
+ WinDBPutSize(hwnd, iOrigW, iOrigH);
+
OutTraceDW("%s: ret=%x\n", ApiName, hwnd);
return hwnd;
}
@@ -2123,7 +2141,7 @@ HWND WINAPI extCreateDialogIndirectParam(HINSTANCE hInstance, LPCDLGTEMPLATE lpT
// v2.02.73: redirect lpDialogFunc only when it is nor NULL
if(lpDialogFunc) {
- WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc);
+ WinDBPutProc(RetHWND, (WNDPROC)lpDialogFunc);
if(!(*pSetWindowLongA)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc))
OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__);
}
@@ -2145,7 +2163,7 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW
// v2.02.73: redirect lpDialogFunc only when it is nor NULL: fix for "LEGO Stunt Rally"
if(lpDialogFunc) {
- WhndStackPush(RetHWND, (WNDPROC)lpDialogFunc);
+ WinDBPutProc(RetHWND, (WNDPROC)lpDialogFunc);
if(!(*pSetWindowLongA)(RetHWND, DWL_DLGPROC, (LONG)extDialogWindowProc))
OutTraceE("SetWindowLong: ERROR err=%d at %d\n", GetLastError(), __LINE__);
}
diff --git a/dll/wndproc.cpp b/dll/wndproc.cpp
index 1da6c7d..6cb0271 100644
--- a/dll/wndproc.cpp
+++ b/dll/wndproc.cpp
@@ -15,6 +15,8 @@
typedef struct {
HWND hwnd;
WNDPROC wndproc;
+ int w;
+ int h;
} wndstack_entry;
#define MAXWNDHSTACK 256
@@ -23,16 +25,17 @@ wndstack_entry *WhndStack;
static int WhndTOS = 0;
static int WhndSize = 0;
-void WhndStackInit()
+void WinDBInit()
{
WhndSize = MAXWNDHSTACK;
WhndStack = (wndstack_entry *)malloc(WhndSize * sizeof(wndstack_entry));
}
-void WhndStackPush(HWND hwnd, WNDPROC wndproc)
+void WinDBPut(HWND hwnd, WNDPROC wndproc, int w, int h)
{
int StackIdx;
+ // add extra space when necessary, in chunks of MAXWNDHSTACK entries
if(WhndTOS == WhndSize){
WhndSize += MAXWNDHSTACK;
WhndStack = (wndstack_entry *)realloc(WhndStack, WhndSize * sizeof(wndstack_entry));
@@ -44,21 +47,98 @@ void WhndStackPush(HWND hwnd, WNDPROC wndproc)
// try update first...
for(StackIdx=0; StackIdx