diff --git a/build/dxwnd.dll b/build/dxwnd.dll
index c0e379f..af1eba7 100644
--- a/build/dxwnd.dll
+++ b/build/dxwnd.dll
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:cebe66cab28374f902eeeecc7aa8db65b794c728a3857488cdb26860ef3976c8
-size 342528
+oid sha256:783c26a318be9da75391d757104a7b69b5d7f22ef0dfe84a8b79174e16c824e5
+size 350720
diff --git a/build/readme-relnotes.txt b/build/readme-relnotes.txt
index e200df1..6655c7f 100644
--- a/build/readme-relnotes.txt
+++ b/build/readme-relnotes.txt
@@ -167,4 +167,14 @@ CORE:
fixed GetDC/ReleaseDC ddraw implementation to refresh GDI operation on primary surface. Warlords 3 text is now visible.
preliminary implementation of MapWindowPoints - to be tested
GUI:
-Fixed log flags wrong initialization
\ No newline at end of file
+Fixed log flags wrong initialization
+
+v2.02.28
+CORE:
+eliminated experimental ICSendMessage and ICOpen hooks, preventing some games (Alien Nations) to work
+added mciSendCommand hook to fix video playback
+fixed MoveWindow bug - still, it's unknown the reason why some programs (Emergency) tries to MoveWindow upon the hWnd=0 desktop!
+fixed MapWindowPoints hook (Alien Nations)
+fixed desktop detections in some places, now correctly using dxw.IsDesktop() method
+Now "Alien Nations" and "Emergency" working (almost) perfectly.
+fixed d3d8/9 hook to Get/SetGammaRamp. This should make a great number of recent games playable again.
diff --git a/dll/ddraw.cpp b/dll/ddraw.cpp
index f856c1a..84b7690 100644
--- a/dll/ddraw.cpp
+++ b/dll/ddraw.cpp
@@ -2994,7 +2994,6 @@ HRESULT WINAPI extGetDC(LPDIRECTDRAWSURFACE lpdds, HDC FAR *pHDC)
{
HRESULT res;
BOOL IsPrim;
- RECT client;
IsPrim=dxw.IsAPrimarySurface(lpdds);
OutTraceD("GetDC: lpdss=%x%s\n",lpdds, IsPrim?"(PRIM)":"");
diff --git a/dll/dxhelper.cpp b/dll/dxhelper.cpp
index 282b86d..3a4a267 100644
--- a/dll/dxhelper.cpp
+++ b/dll/dxhelper.cpp
@@ -1023,3 +1023,181 @@ char *ExplainDevModeFields(DWORD c)
else strcpy(eb,"NULL");
return(eb);
}
+
+char *ExplainMCICommands(DWORD c)
+{
+ switch(c){
+ case MCI_OPEN: return "MCI_OPEN";
+ case MCI_CLOSE: return "MCI_CLOSE";
+ case MCI_ESCAPE: return "MCI_ESCAPE";
+ case MCI_PLAY: return "MCI_PLAY";
+ case MCI_SEEK: return "MCI_SEEK";
+ case MCI_STOP: return "MCI_STOP";
+ case MCI_PAUSE: return "MCI_PAUSE";
+ case MCI_INFO: return "MCI_INFO";
+ case MCI_GETDEVCAPS: return "MCI_GETDEVCAPS";
+ case MCI_SPIN: return "MCI_SPIN";
+ case MCI_SET: return "MCI_SET";
+ case MCI_STEP: return "MCI_STEP";
+ case MCI_RECORD: return "MCI_RECORD";
+ case MCI_SYSINFO: return "MCI_SYSINFO";
+ case MCI_BREAK: return "MCI_BREAK";
+ case MCI_SAVE: return "MCI_SAVE";
+ case MCI_STATUS: return "MCI_STATUS";
+ case MCI_CUE: return "MCI_CUE";
+ case MCI_REALIZE: return "MCI_REALIZE";
+ case MCI_WINDOW: return "MCI_WINDOW";
+ case MCI_PUT: return "MCI_PUT";
+ case MCI_WHERE: return "MCI_WHERE";
+ case MCI_FREEZE: return "MCI_FREEZE";
+ case MCI_UNFREEZE: return "MCI_UNFREEZE";
+ case MCI_LOAD: return "MCI_LOAD";
+ case MCI_CUT: return "MCI_CUT";
+ case MCI_COPY: return "MCI_COPY";
+ case MCI_PASTE: return "MCI_PASTE";
+ case MCI_UPDATE: return "MCI_UPDATE";
+ case MCI_RESUME: return "MCI_RESUME";
+ case MCI_DELETE: return "MCI_DELETE";
+ }
+ return "???";
+}
+
+char *ExplainMCIFlags(DWORD cmd, DWORD c)
+{
+ static char eb[512];
+ unsigned int l;
+ strcpy(eb,"MCI_");
+ // common flags
+ if (c & MCI_NOTIFY) strcat(eb, "NOTIFY+");
+ if (c & MCI_WAIT) strcat(eb, "WAIT+");
+ if (c & MCI_FROM) strcat(eb, "FROM+");
+ if (c & MCI_TO) strcat(eb, "TO+");
+ if (c & MCI_TRACK) strcat(eb, "TRACK+");
+ switch(cmd){
+ case MCI_OPEN:
+ if (c & MCI_OPEN_SHAREABLE) strcat(eb, "OPEN_SHAREABLE+");
+ if (c & MCI_OPEN_ELEMENT) strcat(eb, "OPEN_ELEMENT+");
+ if (c & MCI_OPEN_ALIAS) strcat(eb, "OPEN_ALIAS+");
+ if (c & MCI_OPEN_ELEMENT_ID) strcat(eb, "OPEN_ELEMENT_ID+");
+ if (c & MCI_OPEN_TYPE_ID) strcat(eb, "OPEN_TYPE_ID+");
+ if (c & MCI_OPEN_TYPE) strcat(eb, "OPEN_TYPE+");
+ if (c & MCI_WAVE_OPEN_BUFFER) strcat(eb, "WAVE_OPEN_BUFFER+");
+ break;
+ case MCI_SEEK:
+ if (c & MCI_SEEK_TO_START) strcat(eb, "SEEK_TO_START+");
+ if (c & MCI_STATUS_START) strcat(eb, "STATUS_START+");
+ if (c & MCI_VD_SEEK_REVERSE) strcat(eb, "VD_SEEK_REVERSE+");
+ break;
+ case MCI_STATUS:
+ if (c & MCI_STATUS_ITEM) strcat(eb, "STATUS_ITEM+");
+ if (c & MCI_STATUS_START) strcat(eb, "STATUS_START+");
+ break;
+ case MCI_INFO:
+ if (c & MCI_INFO_PRODUCT) strcat(eb, "INFO_PRODUCT+");
+ if (c & MCI_INFO_FILE) strcat(eb, "INFO_FILE+");
+ if (c & MCI_INFO_MEDIA_UPC) strcat(eb, "INFO_MEDIA_UPC+");
+ if (c & MCI_INFO_MEDIA_IDENTITY) strcat(eb, "INFO_MEDIA_IDENTITY+");
+ if (c & MCI_INFO_NAME) strcat(eb, "INFO_NAME+");
+ if (c & MCI_INFO_COPYRIGHT) strcat(eb, "INFO_COPYRIGHT+");
+ break;
+ case MCI_GETDEVCAPS:
+ if (c & MCI_VD_GETDEVCAPS_CLV) strcat(eb, "VD_GETDEVCAPS_CLV+");
+ if (c & MCI_VD_GETDEVCAPS_CAV) strcat(eb, "VD_GETDEVCAPS_CAV+");
+ if (c & MCI_GETDEVCAPS_ITEM) strcat(eb, "GETDEVCAPS_ITEM+");
+ break;
+ case MCI_SYSINFO:
+ if (c & MCI_SYSINFO_QUANTITY) strcat(eb, "SYSINFO_QUANTITY+");
+ if (c & MCI_SYSINFO_OPEN) strcat(eb, "SYSINFO_OPEN+");
+ if (c & MCI_SYSINFO_NAME) strcat(eb, "SYSINFO_NAME+");
+ if (c & MCI_SYSINFO_INSTALLNAME) strcat(eb, "SYSINFO_INSTALLNAME+");
+ break;
+ case MCI_SET:
+ if (c & MCI_SET_DOOR_OPEN) strcat(eb, "SET_DOOR_OPEN+");
+ if (c & MCI_SET_DOOR_CLOSED) strcat(eb, "SET_DOOR_CLOSED+");
+ if (c & MCI_SET_TIME_FORMAT) strcat(eb, "SET_TIME_FORMAT+");
+ if (c & MCI_SET_AUDIO) strcat(eb, "SET_AUDIO+");
+ if (c & MCI_SET_VIDEO) strcat(eb, "SET_VIDEO+");
+ if (c & MCI_SET_ON) strcat(eb, "SET_ON+");
+ if (c & MCI_SET_OFF) strcat(eb, "SET_OFF+");
+ if (c & MCI_SEQ_SET_TEMPO) strcat(eb, "SEQ_SET_TEMPO+");
+ if (c & MCI_SEQ_SET_PORT) strcat(eb, "SEQ_SET_PORT+");
+ if (c & MCI_SEQ_SET_SLAVE) strcat(eb, "SEQ_SET_SLAVE+");
+ if (c & MCI_SEQ_SET_MASTER) strcat(eb, "SEQ_SET_MASTER+");
+ if (c & MCI_SEQ_SET_OFFSET) strcat(eb, "SEQ_SET_OFFSET+");
+ break;
+ case MCI_BREAK:
+ if (c & MCI_BREAK_KEY) strcat(eb, "BREAK_KEY+");
+ if (c & MCI_BREAK_HWND) strcat(eb, "BREAK_HWND+");
+ if (c & MCI_BREAK_OFF) strcat(eb, "BREAK_OFF+");
+ break;
+ case MCI_RECORD:
+ if (c & MCI_RECORD_INSERT) strcat(eb, "RECORD_INSERT+");
+ if (c & MCI_RECORD_OVERWRITE) strcat(eb, "RECORD_OVERWRITE+");
+ break;
+ case MCI_SAVE:
+ if (c & MCI_SAVE_FILE) strcat(eb, "SAVE_FILE+");
+ break;
+ case MCI_LOAD:
+ if (c & MCI_LOAD_FILE) strcat(eb, "SAVE_FILE+");
+ break;
+ case MCI_PLAY:
+ if (c & MCI_VD_PLAY_REVERSE) strcat(eb, "VD_PLAY_REVERSE+");
+ if (c & MCI_VD_PLAY_FAST) strcat(eb, "VD_PLAY_FAST+");
+ if (c & MCI_VD_PLAY_SPEED) strcat(eb, "VD_PLAY_SPEED+");
+ if (c & MCI_VD_PLAY_SCAN) strcat(eb, "VD_PLAY_SCAN+");
+ if (c & MCI_VD_PLAY_SLOW) strcat(eb, "VD_PLAY_SLOW+");
+ break;
+ case MCI_STEP:
+ if (c & MCI_VD_STEP_FRAMES) strcat(eb, "VD_STEP_FRAMES+");
+ if (c & MCI_VD_STEP_REVERSE) strcat(eb, "VD_STEP_REVERSE+");
+ break;
+ case MCI_WINDOW:
+ if (c & MCI_ANIM_WINDOW_HWND) strcat(eb, "ANIM_WINDOW_HWND+");
+ if (c & MCI_ANIM_WINDOW_STATE) strcat(eb, "ANIM_WINDOW_STATE+");
+ if (c & MCI_ANIM_WINDOW_TEXT) strcat(eb, "ANIM_WINDOW_TEXT+");
+ if (c & MCI_ANIM_WINDOW_ENABLE_STRETCH) strcat(eb, "ANIM_WINDOW_ENABLE_STRETCH+");
+ if (c & MCI_ANIM_WINDOW_DISABLE_STRETCH) strcat(eb, "ANIM_WINDOW_DISABLE_STRETCH+");
+ break;
+ case MCI_PUT:
+ if (c & MCI_ANIM_RECT) strcat(eb, "ANIM_RECT+");
+ if (c & MCI_ANIM_PUT_SOURCE) strcat(eb, "ANIM_PUT_SOURCE+");
+ if (c & MCI_ANIM_PUT_DESTINATION) strcat(eb, "ANIM_PUT_DESTINATION+");
+ break;
+ case MCI_WHERE:
+ if (c & MCI_ANIM_WHERE_SOURCE) strcat(eb, "ANIM_WHERE_SOURCE+");
+ if (c & MCI_ANIM_WHERE_DESTINATION) strcat(eb, "ANIM_WHERE_DESTINATION+");
+ break;
+ case MCI_UPDATE:
+ if (c & MCI_ANIM_UPDATE_HDC) strcat(eb, "ANIM_UPDATE_HDC+");
+ break;
+ }
+ /*
+ if (c & MCI_OVLY_OPEN_WS) strcat(eb, "OVLY_OPEN_WS+");
+ if (c & MCI_OVLY_OPEN_PARENT) strcat(eb, "OVLY_OPEN_PARENT+");
+ if (c & MCI_OVLY_STATUS_HWND) strcat(eb, "OVLY_STATUS_HWND+");
+ if (c & MCI_OVLY_STATUS_STRETCH) strcat(eb, "OVLY_STATUS_STRETCH+");
+ if (c & MCI_OVLY_INFO_TEXT) strcat(eb, "OVLY_INFO_TEXT+");
+ if (c & MCI_OVLY_WINDOW_HWND) strcat(eb, "OVLY_WINDOW_HWND+");
+ if (c & MCI_OVLY_WINDOW_STATE) strcat(eb, "OVLY_WINDOW_STATE+");
+ if (c & MCI_OVLY_WINDOW_TEXT) strcat(eb, "OVLY_WINDOW_TEXT+");
+ if (c & MCI_OVLY_WINDOW_ENABLE_STRETCH) strcat(eb, "OVLY_WINDOW_ENABLE_STRETCH+");
+ if (c & MCI_OVLY_WINDOW_DISABLE_STRETCH) strcat(eb, "OVLY_WINDOW_DISABLE_STRETCH+");
+ if (c & MCI_OVLY_WINDOW_DEFAULT) strcat(eb, "OVLY_WINDOW_DEFAULT+");
+ if (c & MCI_OVLY_RECT) strcat(eb, "OVLY_RECT+");
+ if (c & MCI_OVLY_PUT_SOURCE) strcat(eb, "OVLY_PUT_SOURCE+");
+ if (c & MCI_OVLY_PUT_DESTINATION) strcat(eb, "OVLY_PUT_DESTINATION+");
+ if (c & MCI_OVLY_PUT_FRAME) strcat(eb, "OVLY_PUT_FRAME+");
+ if (c & MCI_OVLY_PUT_VIDEO) strcat(eb, "OVLY_PUT_VIDEO+");
+ if (c & MCI_OVLY_WHERE_SOURCE) strcat(eb, "OVLY_WHERE_SOURCE+");
+ if (c & MCI_OVLY_WHERE_DESTINATION) strcat(eb, "OVLY_WHERE_DESTINATION+");
+ if (c & MCI_OVLY_WHERE_FRAME) strcat(eb, "OVLY_WHERE_FRAME+");
+ if (c & MCI_OVLY_WHERE_VIDEO) strcat(eb, "OVLY_WHERE_VIDEO+");
+ */
+ l=strlen(eb);
+ if (l>strlen("MCI_")) eb[l-1]=0; // delete last '+' if any
+ else strcpy(eb,"NULL");
+ return(eb);
+}
+
+
+
diff --git a/dll/dxhelper.h b/dll/dxhelper.h
index e1d710a..e79cd69 100644
--- a/dll/dxhelper.h
+++ b/dll/dxhelper.h
@@ -30,3 +30,5 @@ extern char *ExplainsSystemMetrics(DWORD);
extern char *ExplainWPFlags(DWORD);
extern char *ExplainLoadLibFlags(DWORD);
extern char *ExplainDevModeFields(DWORD);
+extern char *ExplainMCICommands(DWORD);
+extern char *ExplainMCIFlags(DWORD, DWORD);
diff --git a/dll/dxhook.cpp b/dll/dxhook.cpp
index eb5bf88..2730dfd 100644
--- a/dll/dxhook.cpp
+++ b/dll/dxhook.cpp
@@ -16,6 +16,7 @@
#include "dxhelper.h"
#include "Ime.h"
#include "Winnls32.h"
+#include "Mmsystem.h"
dxwCore dxw;
@@ -1242,7 +1243,7 @@ void HookModule(HMODULE base, int dxversion)
HookDirectDraw(base, dxversion);
HookDirect3D(base, dxversion);
if(dxw.dwFlags2 & HOOKOPENGL) HookOpenGLLibs(base, dxw.CustomOpenGLLib);
- HookMSV4WLibs(base);
+ HookMSV4WLibs(base); // -- used by Aliens & Amazons demo: what for?
}
void DisableIME()
diff --git a/dll/dxwnd.cpp b/dll/dxwnd.cpp
index 205aa8b..de2f3ff 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.27"
+#define VERSION "2.02.28"
LRESULT CALLBACK HookProc(int ncode, WPARAM wparam, LPARAM lparam);
diff --git a/dll/dxwnd.vs2008.suo b/dll/dxwnd.vs2008.suo
index 05d3b3b..789ae4d 100644
Binary files a/dll/dxwnd.vs2008.suo and b/dll/dxwnd.vs2008.suo differ
diff --git a/dll/hd3d.cpp b/dll/hd3d.cpp
index 3e80c05..3466417 100644
--- a/dll/hd3d.cpp
+++ b/dll/hd3d.cpp
@@ -33,7 +33,8 @@ typedef HRESULT (WINAPI *CreateAdditionalSwapChain_Type)(void *, D3DPRESENT_PARA
typedef HRESULT (WINAPI *GetDirect3D_Type)(void *, IDirect3D9 **);
typedef HRESULT (WINAPI *GetViewport_Type)(void *, D3DVIEWPORT9 *);
typedef HRESULT (WINAPI *SetViewport_Type)(void *, D3DVIEWPORT9 *);
-typedef void (WINAPI *SetGammaRamp_Type)(UINT, DWORD, D3DGAMMARAMP *);
+typedef void (WINAPI *SetGammaRamp_Type)(void *, UINT, DWORD, D3DGAMMARAMP *);
+typedef void (WINAPI *GetGammaRamp_Type)(void *, UINT, D3DGAMMARAMP *);
typedef HRESULT (WINAPI *D3D10CreateDevice_Type)(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, ID3D10Device **);
typedef HRESULT (WINAPI *D3D10CreateDeviceAndSwapChain_Type)(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device **);
@@ -68,7 +69,8 @@ HRESULT WINAPI extGetRenderState(void *, D3DRENDERSTATETYPE, DWORD);
HRESULT WINAPI extCreateAdditionalSwapChain(void *, D3DPRESENT_PARAMETERS *, IDirect3DSwapChain9 **);
HRESULT WINAPI extGetViewport(void *, D3DVIEWPORT9 *);
HRESULT WINAPI extSetViewport(void *, D3DVIEWPORT9 *);
-void WINAPI extSetGammaRamp(UINT, DWORD, D3DGAMMARAMP *);
+void WINAPI extSetGammaRamp(void *, UINT, DWORD, D3DGAMMARAMP *);
+void WINAPI extGetGammaRamp(void *, UINT, D3DGAMMARAMP *);
HRESULT WINAPI extD3D10CreateDevice(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, ID3D10Device **);
HRESULT WINAPI extD3D10CreateDeviceAndSwapChain(IDXGIAdapter *, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC *, IDXGISwapChain **, ID3D10Device **);
@@ -106,6 +108,7 @@ CreateAdditionalSwapChain_Type pCreateAdditionalSwapChain = 0;
GetViewport_Type pGetViewport = 0;
SetViewport_Type pSetViewport = 0;
SetGammaRamp_Type pSetGammaRamp = 0;
+GetGammaRamp_Type pGetGammaRamp = 0;
D3D10CreateDevice_Type pD3D10CreateDevice = 0;
D3D10CreateDeviceAndSwapChain_Type pD3D10CreateDeviceAndSwapChain = 0;
@@ -669,7 +672,10 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
SetHook((void *)(**(DWORD **)ppd3dd + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D8)");
SetHook((void *)(**(DWORD **)ppd3dd + 56), extReset, (void **)&pReset, "Reset(D8)");
SetHook((void *)(**(DWORD **)ppd3dd + 60), extPresent, (void **)&pPresent, "Present(D8)");
- SetHook((void *)(**(DWORD **)ppd3dd + 72), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D8)");
+ if(dxw.dwFlags2 & DISABLEGAMMARAMP){
+ SetHook((void *)(**(DWORD **)ppd3dd + 72), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D8)");
+ SetHook((void *)(**(DWORD **)ppd3dd + 76), extGetGammaRamp, (void **)&pGetGammaRamp, "GetGammaRamp(D8)");
+ }
if(dxw.dwFlags2 & WIREFRAME){
SetHook((void *)(**(DWORD **)ppd3dd + 200), extSetRenderState, (void **)&pSetRenderState, "SetRenderState(D8)");
SetHook((void *)(**(DWORD **)ppd3dd + 204), extGetRenderState, (void **)&pGetRenderState, "GetRenderState(D8)");
@@ -685,7 +691,10 @@ HRESULT WINAPI extCreateDevice(void *lpd3d, UINT adapter, D3DDEVTYPE devicetype,
SetHook((void *)(**(DWORD **)ppd3dd + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 64), extReset, (void **)&pReset, "Reset(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 68), extPresent, (void **)&pPresent, "Present(D9)");
- SetHook((void *)(**(DWORD **)ppd3dd + 84), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D9)");
+ if(dxw.dwFlags2 & DISABLEGAMMARAMP){
+ SetHook((void *)(**(DWORD **)ppd3dd + 84), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D9)");
+ SetHook((void *)(**(DWORD **)ppd3dd + 88), extGetGammaRamp, (void **)&pGetGammaRamp, "GetGammaRamp(D9)");
+ }
//SetHook((void *)(**(DWORD **)ppd3dd +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)");
//SetHook((void *)(**(DWORD **)ppd3dd +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)");
if(dxw.dwFlags2 & WIREFRAME){
@@ -761,7 +770,7 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp
OutTraceD("FAILED! %x\n", res);
return res;
}
- OutTraceD("SUCCESS!\n");
+ OutTraceD("SUCCESS!\n");
void *pReset;
pReset=NULL; // to avoid assert condition
@@ -770,7 +779,10 @@ HRESULT WINAPI extCreateDeviceEx(void *lpd3d, UINT adapter, D3DDEVTYPE devicetyp
SetHook((void *)(**(DWORD **)ppd3dd + 52), extCreateAdditionalSwapChain, (void **)&pCreateAdditionalSwapChain, "CreateAdditionalSwapChain(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 64), extReset, (void **)&pReset, "Reset(D9)");
SetHook((void *)(**(DWORD **)ppd3dd + 68), extPresent, (void **)&pPresent, "Present(D9)");
- SetHook((void *)(**(DWORD **)ppd3dd + 84), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D9)");
+ if(dxw.dwFlags2 & DISABLEGAMMARAMP){
+ SetHook((void *)(**(DWORD **)ppd3dd + 84), extSetGammaRamp, (void **)&pSetGammaRamp, "SetGammaRamp(D9)");
+ SetHook((void *)(**(DWORD **)ppd3dd + 88), extGetGammaRamp, (void **)&pGetGammaRamp, "GetGammaRamp(D9)");
+ }
//SetHook((void *)(**(DWORD **)ppd3dd +188), extSetViewport, (void **)&pSetViewport, "SetViewport(D9)");
//SetHook((void *)(**(DWORD **)ppd3dd +192), extGetViewport, (void **)&pGetViewport, "GetViewport(D9)");
if(dxw.dwFlags2 & WIREFRAME){
@@ -1096,9 +1108,15 @@ HRESULT WINAPI extCheckFullScreen(void)
return 0;
}
-void WINAPI extSetGammaRamp(UINT iSwapChain, DWORD Flags, D3DGAMMARAMP *pRamp)
+void WINAPI extSetGammaRamp(void *lpdd3dd, UINT iSwapChain, DWORD Flags, D3DGAMMARAMP *pRamp)
{
- OutTraceD("SetGammaRamp: SwapChain=%d flags=%x\n", iSwapChain, Flags);
+ OutTraceD("SetGammaRamp: dd3dd=%x SwapChain=%d flags=%x\n", lpdd3dd, iSwapChain, Flags);
if (dxw.dwFlags2 & DISABLEGAMMARAMP) return;
- (*pSetGammaRamp)(iSwapChain, Flags, pRamp);
+ (*pSetGammaRamp)(lpdd3dd, iSwapChain, Flags, pRamp);
+}
+
+void WINAPI extGetGammaRamp(void *lpdd3dd, UINT iSwapChain, D3DGAMMARAMP *pRamp)
+{
+ OutTraceD("GetGammaRamp: dd3dd=%x SwapChain=%d\n", lpdd3dd, iSwapChain);
+ (*pGetGammaRamp)(lpdd3dd, iSwapChain, pRamp);
}
diff --git a/dll/msvfw.cpp b/dll/msvfw.cpp
index c553c10..41be6d0 100644
--- a/dll/msvfw.cpp
+++ b/dll/msvfw.cpp
@@ -9,8 +9,8 @@
#undef DXWDECLARATIONS
static HookEntry_Type Hooks[]={
- {"ICSendMessage", (FARPROC)NULL, (FARPROC *)&pICSendMessage, (FARPROC)extICSendMessage},
- {"ICOpen", (FARPROC)NULL, (FARPROC *)&pICOpen, (FARPROC)extICOpen},
+ //{"ICSendMessage", (FARPROC)NULL, (FARPROC *)&pICSendMessage, (FARPROC)extICSendMessage},
+ //{"ICOpen", (FARPROC)NULL, (FARPROC *)&pICOpen, (FARPROC)extICOpen},
{0, NULL, 0, 0} // terminator
};
@@ -41,3 +41,86 @@ HIC WINAPI extICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
OutTraceD("ICOpen: fccType=%x fccHandler=%x wMode=%x\n", fccType, fccHandler, wMode);
return (HIC)0;
}
+
+/*
+ICDrawBegin function
+
+The ICDrawBegin function initializes the renderer and prepares the drawing destination for drawing.
+Syntax
+DWORD ICDrawBegin(
+ HIC hic,
+ DWORD dwFlags,
+ HPALETTE hpal,
+ HWND hwnd,
+ HDC hdc,
+ int xDst,
+ int yDst,
+ int dxDst,
+ int dyDst,
+ LPBITMAPINFOHEADER lpbi,
+ int xSrc,
+ int ySrc,
+ int dxSrc,
+ int dySrc,
+ DWORD dwRate,
+ DWORD dwScale
+);
+
+
+Parameters
+
+hic Handle to the decompressor to use.
+
+dwFlags
+ Decompression flags. The following values are defined.
+ Value Meaning
+ ICDRAW_ANIMATE Application can animate the palette.
+ ICDRAW_CONTINUE Drawing is a continuation of the previous frame.
+ ICDRAW_FULLSCREEN Draws the decompressed data on the full screen.
+ ICDRAW_HDC Draws the decompressed data to a window or a DC.
+ ICDRAW_MEMORYDC DC is off-screen.
+ ICDRAW_QUERY Determines if the decompressor can decompress the data. The driver does not decompress the data.
+ ICDRAW_UPDATING Current frame is being updated rather than played.
+
+hpal Handle to the palette used for drawing.
+
+hwnd Handle to the window used for drawing.
+
+hdc DC used for drawing.
+
+xDst The x-coordinate of the upper right corner of the destination rectangle.
+yDst The y-coordinate of the upper right corner of the destination rectangle.
+dxDst Width of the destination rectangle.
+dyDst Height of the destination rectangle.
+
+lpbi Pointer to a BITMAPINFOHEADER structure containing the format of the input data to be decompressed.
+
+xSrc The x-coordinate of the upper right corner of the source rectangle.
+ySrc The y-coordinate of the upper right corner of the source rectangle.
+dxSrc Width of the source rectangle.
+dySrc Height of the source rectangle.
+
+dwRate Frame rate numerator. The frame rate, in frames per second, is obtained by dividing dwRate by dwScale.
+dwScale Frame rate denominator. The frame rate, in frames per second, is obtained by dividing dwRate by dwScale.
+
+Return value
+
+Returns ICERR_OK if the renderer can decompress the data or ICERR_UNSUPPORTED otherwise.
+Remarks
+
+The ICDRAW_HDC and ICDRAW_FULLSCREEN flags are mutually exclusive. If an application sets the ICDRAW_HDC flag in dwFlags, the decompressor uses hwnd, hdc, and the parameters defining the destination rectangle (xDst, yDst, dxDst, and dyDst). Your application should set these parameters to the size of the destination rectangle. Specify destination rectangle values relative to the current window or DC.
+If an application sets the ICDRAW_FULLSCREEN flag in dwFlags, the hwnd and hdc parameters are not used and should be set to NULL. Also, the destination rectangle is not used and its parameters can be set to zero.
+The source rectangle is relative to the full video frame. The portion of the video frame specified by the source rectangle is stretched or shrunk to fit the destination rectangle.
+The dwRate and dwScale parameters specify the decompression rate. The integer value specified for dwRate divided by the integer value specified for dwScale defines the frame rate in frames per second. This value is used by the renderer when it is responsible for timing frames during playback.
+
+Requirements
+Minimum supported client
+ Windows 2000 Professional [desktop apps only]
+Minimum supported server
+ Windows 2000 Server [desktop apps only]
+
+Header Vfw.h
+Library Vfw32.lib
+DLL Msvfw32.dll
+
+*/
\ No newline at end of file
diff --git a/dll/syslibs.h b/dll/syslibs.h
index c8c0163..615650e 100644
--- a/dll/syslibs.h
+++ b/dll/syslibs.h
@@ -9,6 +9,8 @@ user32.dll.dll
====================================================================*/
+#include "Mmsystem.h"
+
/* ===================================================================
type definitions
====================================================================*/
@@ -110,6 +112,7 @@ typedef int (WINAPI *ShowCursor_Type)(BOOL);
typedef BOOL (WINAPI *ShowWindow_Type)(HWND, int);
// Winmm.dll:
+typedef MCIERROR(WINAPI *mciSendCommand_Type)(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR);
typedef DWORD (WINAPI *timeGetTime_Type)(void);
/* ===================================================================
@@ -225,6 +228,7 @@ DXWEXTERN ShowCursor_Type pShowCursor DXWINITIALIZED;
DXWEXTERN ShowWindow_Type pShowWindow DXWINITIALIZED;
// Winmm.dll:
+DXWEXTERN mciSendCommand_Type pmciSendCommand DXWINITIALIZED;
DXWEXTERN timeGetTime_Type ptimeGetTime DXWINITIALIZED;
/* ===================================================================
@@ -338,6 +342,7 @@ extern int WINAPI extShowCursor(BOOL);
extern BOOL WINAPI extShowWindow(HWND, int);
// Winmm.dll:
+extern MCIERROR WINAPI extmciSendCommand(MCIDEVICEID, UINT, DWORD_PTR, DWORD_PTR);
extern DWORD WINAPI exttimeGetTime(void);
// extern function declaration
diff --git a/dll/user32.cpp b/dll/user32.cpp
index 1beefd7..8c56ee1 100644
--- a/dll/user32.cpp
+++ b/dll/user32.cpp
@@ -912,10 +912,12 @@ int WINAPI extMapWindowPoints(HWND hWndFrom, HWND hWndTo, LPPOINT lpPoints, UINT
{
UINT pi;
int ret;
- // a rarely used API, but responsible for a painful headache: needs hooking for "Commandos 2".
+ // a rarely used API, but responsible for a painful headache: needs hooking for "Commandos 2", "Alien Nations".
- OutTraceD("MapWindowPoints: hWndFrom=%x hWndTo=%x cPoints=%d FullScreen=%x\n",
- hWndFrom, hWndTo, cPoints, dxw.IsFullScreen());
+ OutTraceD("MapWindowPoints: hWndFrom=%x%s hWndTo=%x%s cPoints=%d FullScreen=%x\n",
+ hWndFrom, dxw.IsDesktop(hWndFrom)?"(DESKTOP)":"",
+ hWndTo, dxw.IsDesktop(hWndTo)?"(DESKTOP)":"",
+ cPoints, dxw.IsFullScreen());
if(IsDebug){
OutTrace("Points: ");
for(pi=0; pi>16, ret&0x0000FFFF);
+ return ret;
}
HWND WINAPI extGetDesktopWindow(void)
@@ -1385,7 +1380,7 @@ HDC WINAPI extGDIGetWindowDC(HWND hwnd)
HWND lochwnd;
OutTraceD("GDI.GetWindowDC: hwnd=%x\n", hwnd);
lochwnd=hwnd;
- if ((hwnd==0) || (hwnd==(*pGetDesktopWindow)())) {
+ if (dxw.IsDesktop(hwnd)) {
OutTraceD("GDI.GetWindowDC: desktop remapping hwnd=%x->%x\n", hwnd, dxw.GethWnd());
lochwnd=dxw.GethWnd();
}
@@ -1541,26 +1536,18 @@ HWND WINAPI extCreateDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplateName, HW
BOOL WINAPI extMoveWindow(HWND hwnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint)
{
BOOL ret;
- OutTraceD("MoveWindow: hwnd=%x xy=(%d,%d) size=(%d,%d) repaint=%x indialog=%x\n",
- hwnd, X, Y, nWidth, nHeight, bRepaint, isWithinDialog);
+ OutTraceD("MoveWindow: hwnd=%x xy=(%d,%d) size=(%d,%d) repaint=%x indialog=%x fullscreen=%x\n",
+ hwnd, X, Y, nWidth, nHeight, bRepaint, isWithinDialog, dxw.IsFullScreen());
- if((hwnd==dxw.GethWnd()) || (hwnd==dxw.hParentWnd)){
- OutTraceD("MoveWindow: prevent moving main win\n");
- if (nHeight && nWidth){
- OutTraceD("MoveWindow: setting screen size=(%d,%d)\n", nHeight, nWidth);
- dxw.SetScreenSize(nWidth, nHeight);
- }
+ if(dxw.IsDesktop(hwnd)){
+ // v2.1.93: happens in "Emergency Fighters for Life" ...
+ // what is the meaning of this? is it related to video stretching?
+ OutTraceD("MoveWindow: prevent moving desktop win\n");
return TRUE;
}
- if((hwnd==0) || (hwnd==(*pGetDesktopWindow)())){
- // v2.1.93: happens in "Emergency Fighters for Life" ...
- OutTraceD("MoveWindow: prevent moving desktop win\n");
- // v2.1.93: moving the desktop seems a way to change its resolution?
- if (nHeight && nWidth){
- OutTraceD("MoveWindow: setting screen size=(%d,%d)\n", nHeight, nWidth);
- dxw.SetScreenSize(nWidth, nHeight);
- }
+ if((hwnd==dxw.GethWnd()) || (hwnd==dxw.hParentWnd)){
+ OutTraceD("MoveWindow: prevent moving main win\n");
return TRUE;
}
diff --git a/dll/winmm.cpp b/dll/winmm.cpp
index b34797c..7294d4c 100644
--- a/dll/winmm.cpp
+++ b/dll/winmm.cpp
@@ -2,6 +2,14 @@
#include "dxwcore.hpp"
#include "syslibs.h"
#include "dxhook.h"
+#include "dxhelper.h"
+
+#include "MMSystem.h"
+
+static HookEntry_Type Hooks[]={
+ {"mciSendCommandA", NULL, (FARPROC *)&pmciSendCommand, (FARPROC)extmciSendCommand},
+ {0, NULL, 0, 0} // terminator
+};
static HookEntry_Type TimeHooks[]={
{"timeGetTime", NULL, (FARPROC *)&ptimeGetTime, (FARPROC)exttimeGetTime},
@@ -10,6 +18,7 @@ static HookEntry_Type TimeHooks[]={
void HookWinMM(HMODULE module)
{
+ HookLibrary(module, Hooks, "winmm.dll");
if(dxw.dwFlags2 & TIMESTRETCH) HookLibrary(module, TimeHooks, "winmm.dll");
}
@@ -17,6 +26,7 @@ FARPROC Remap_WinMM_ProcAddress(LPCSTR proc, HMODULE hModule)
{
FARPROC addr;
+ if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
if(dxw.dwFlags2 & TIMESTRETCH)
if (addr=RemapLibrary(proc, hModule, TimeHooks)) return addr;
@@ -30,3 +40,60 @@ DWORD WINAPI exttimeGetTime(void)
if (IsDebug) OutTrace("timeGetTime: time=%x\n", ret);
return ret;
}
+
+/* MCI_DGV_PUT_FRAME
+
+ The rectangle defined for MCI_DGV_RECT applies to the frame rectangle.
+ The frame rectangle specifies the portion of the frame buffer used as the destination of the video images obtained from the video rectangle.
+ The video should be scaled to fit within the frame buffer rectangle.
+ The rectangle is specified in frame buffer coordinates.
+ The default rectangle is the full frame buffer.
+ Specifying this rectangle lets the device scale the image as it digitizes the data.
+ Devices that cannot scale the image reject this command with MCIERR_UNSUPPORTED_FUNCTION.
+ You can use the MCI_GETDEVCAPS_CAN_STRETCH flag with the MCI_GETDEVCAPS command to determine if a device scales the image. A device returns FALSE if it cannot scale the image.
+*/
+
+MCIERROR WINAPI extmciSendCommand(MCIDEVICEID IDDevice, UINT uMsg, DWORD_PTR fdwCommand, DWORD_PTR dwParam)
+{
+ RECT saverect;
+ MCIERROR ret;
+ MCI_ANIM_RECT_PARMS *pr;
+ MCI_OVLY_WINDOW_PARMSW *pw;
+
+ OutTraceD("mciSendCommand: IDDevice=%x msg=%x(%s) Command=%x(%s)\n",
+ IDDevice, uMsg, ExplainMCICommands(uMsg), fdwCommand, ExplainMCIFlags(uMsg, fdwCommand));
+
+ if(dxw.IsFullScreen()){
+ switch(uMsg){
+ case MCI_WINDOW:
+ pw = (MCI_OVLY_WINDOW_PARMSW *)dwParam;
+ OutTraceB("mciSendCommand: hwnd=%x CmdShow=%x\n",
+ pw->hWnd, pw->nCmdShow);
+ //fdwCommand |= MCI_ANIM_WINDOW_ENABLE_STRETCH;
+ //fdwCommand &= ~MCI_ANIM_WINDOW_DISABLE_STRETCH;
+ if(dxw.IsDesktop(pw->hWnd)) pw->hWnd = dxw.GethWnd();
+ break;
+ case MCI_PUT:
+ RECT client;
+ pr = (MCI_ANIM_RECT_PARMS *)dwParam;
+ OutTraceB("mciSendCommand: rect=(%d,%d),(%d,%d)\n",
+ pr->rc.left, pr->rc.top, pr->rc.right, pr->rc.bottom);
+ (*pGetClientRect)(dxw.GethWnd(), &client);
+ //fdwCommand |= MCI_ANIM_PUT_DESTINATION;
+ fdwCommand |= MCI_ANIM_RECT;
+ saverect=pr->rc;
+ pr->rc.top = (pr->rc.top * client.bottom) / dxw.GetScreenHeight();
+ pr->rc.bottom = (pr->rc.bottom * client.bottom) / dxw.GetScreenHeight();
+ pr->rc.left = (pr->rc.left * client.right) / dxw.GetScreenWidth();
+ pr->rc.right = (pr->rc.right * client.right) / dxw.GetScreenWidth();
+ OutTraceB("mciSendCommand: fixed rect=(%d,%d),(%d,%d)\n",
+ pr->rc.left, pr->rc.top, pr->rc.right, pr->rc.bottom);
+ break;
+ }
+ }
+
+ ret=(*pmciSendCommand)(IDDevice, uMsg, fdwCommand, dwParam);
+ if(dxw.IsFullScreen() && uMsg==MCI_PUT) pr->rc=saverect;
+ if (ret) OutTraceE("mciSendCommand: ERROR res=%x\n", ret);
+ return ret;
+}