mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_03_89_src
Former-commit-id: ba83a72b7c6694e0f34c45ca2c7dca48787612aa
This commit is contained in:
parent
c7934bf142
commit
c22cda8a40
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2cb685fd9bcac89865a83e26fbdc14663d7d2f9bba0014f1e4c44606f6bb7702
|
||||
size 680960
|
||||
oid sha256:9070435639bcf64aebc632f848af969aa24800cb40864ae90d5ce56a1d43b373
|
||||
size 681472
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:b7b7d8268a048d4d8600bca6824ef8226e2dab5bb347d07b9bb2afff7d2a73d1
|
||||
oid sha256:14ddc8f6eaa1eac7dc356e8824fb118e014fe5b5e8828432e2ffa0ac58f1f3c4
|
||||
size 660992
|
||||
|
@ -1,6 +1,6 @@
|
||||
[target]
|
||||
title0=Crazy Hospital 3
|
||||
path0=D:\Games\Crazy Hospital 3\Dtrmain.exe
|
||||
title0=Microsoft Motocross Madness
|
||||
path0=F:\Games\Motocross Madness\mcm.exe
|
||||
startfolder0=
|
||||
launchpath0=
|
||||
module0=
|
||||
@ -11,10 +11,10 @@ ver0=0
|
||||
monitorid0=-1
|
||||
coord0=0
|
||||
flag0=136314914
|
||||
flagg0=1207959552
|
||||
flagg0=134219776
|
||||
flagh0=20
|
||||
flagi0=138412036
|
||||
flagj0=4224
|
||||
flagi0=4194308
|
||||
flagj0=0
|
||||
flagk0=65536
|
||||
flagl0=0
|
||||
flagm0=0
|
||||
@ -30,4 +30,4 @@ winver0=0
|
||||
maxres0=-1
|
||||
swapeffect0=0
|
||||
maxddinterface0=7
|
||||
slowratio0=2
|
||||
slowratio0=1
|
@ -1,33 +0,0 @@
|
||||
[target]
|
||||
title0=Street Fighter Zero II
|
||||
path0=D:\Games\sfzero2\ZERO2.exe
|
||||
startfolder0=
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
monitorid0=-1
|
||||
coord0=0
|
||||
flag0=136314914
|
||||
flagg0=1207959552
|
||||
flagh0=20
|
||||
flagi0=138412036
|
||||
flagj0=4224
|
||||
flagk0=65536
|
||||
flagl0=0
|
||||
flagm0=0
|
||||
tflag0=0
|
||||
dflag0=0
|
||||
posx0=50
|
||||
posy0=50
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
||||
swapeffect0=0
|
||||
maxddinterface0=7
|
||||
slowratio0=2
|
@ -1,33 +0,0 @@
|
||||
[target]
|
||||
title0=Super Puzzle Fighter 2 Turbo
|
||||
path0=D:\Games\Super Puzzle Fighter 2 Turbo (1997)\W_Spf2x.exe
|
||||
startfolder0=
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=[HKEY_LOCAL_MACHINE\SOFTWARE\Capcom]\n\n[HKEY_LOCAL_MACHINE\SOFTWARE\Capcom\w_spf2x]\n"SAVEDIR"=".\\"\n"SC_MODE"="SCREEN_MODE_640*480_8BIT_DIRECTX"\n"CD_ROM"=".\\"\n"SETUPCEHCK"="SETUP_ALL_OK"\n"NET_USER"=""\n\n
|
||||
ver0=0
|
||||
monitorid0=-1
|
||||
coord0=0
|
||||
flag0=136314914
|
||||
flagg0=1207959552
|
||||
flagh0=1044
|
||||
flagi0=1212153860
|
||||
flagj0=5248
|
||||
flagk0=67584
|
||||
flagl0=32768
|
||||
flagm0=0
|
||||
tflag0=0
|
||||
dflag0=0
|
||||
posx0=50
|
||||
posy0=50
|
||||
sizx0=800
|
||||
sizy0=600
|
||||
maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
||||
swapeffect0=0
|
||||
maxddinterface0=7
|
||||
slowratio0=2
|
@ -1266,6 +1266,10 @@ fix: added ddraw hooking in ddrawex/CreateDirectDraw() call: now "Theocracy" wor
|
||||
fix: added hook for EnumDisplayDevicesW used by "Battleground Europe"
|
||||
fix: added "Hide multi monitors" logic to EnumDisplayDevicesA/W
|
||||
|
||||
|
||||
|
||||
v2.03.89
|
||||
fix: replaced hooked LoadLibrary with original call (*pLoadLibraryA), this seems to avoid the hook address replacements and the need for the "No hook update" flag. To be tested.
|
||||
fix: added some missing IID_DirectDraw3 case in DirectDraw hooking
|
||||
fix: fixed the logic for centering the main window for desktop with non-zero offset
|
||||
fix: improved logic for window placement in CreateWindowEx call
|
||||
fix: added wrapper for winmm/GetJoyPos() virtual joystick referenced in "Jane's FA18"
|
||||
|
||||
|
@ -369,17 +369,7 @@ HRESULT WINAPI sBlt(int dxversion, Blt_Type pBlt, char *api, LPDIRECTDRAWSURFACE
|
||||
HRESULT res;
|
||||
BOOL ToPrim, FromPrim, ToScreen, FromScreen;
|
||||
|
||||
if(dxw.dwFlags5 & MESSAGEPUMP){
|
||||
MSG msg;
|
||||
while(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)){
|
||||
OutTraceW("MESSAGEPUMP: msg=%x l-wParam=(%x,%x)\n", msg.message, msg.lParam, msg.wParam);
|
||||
if((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST)) break; // do not consume keyboard inputs
|
||||
if((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST)) break; // do not consume mouse inputs
|
||||
PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
if(dxw.dwFlags5 & MESSAGEPUMP) dxw.MessagePump();
|
||||
|
||||
ToPrim=dxwss.IsAPrimarySurface(lpdds);
|
||||
FromPrim=dxwss.IsAPrimarySurface(lpddssrc);
|
||||
|
@ -748,7 +748,7 @@ static void ddSetCompatibility()
|
||||
HRESULT res;
|
||||
HINSTANCE hinst;
|
||||
|
||||
hinst=LoadLibrary("ddraw.dll");
|
||||
hinst=(*pLoadLibraryA)("ddraw.dll");
|
||||
pSetAppCompatData=(SetAppCompatData_Type)(*pGetProcAddress)(hinst, "SetAppCompatData");
|
||||
if(pSetAppCompatData) {
|
||||
if (dxw.dwFlags2 & SETCOMPATIBILITY){
|
||||
@ -776,7 +776,7 @@ static void BypassGOGDDrawRedirector()
|
||||
|
||||
GetSystemDirectory(sSysLibraryPath, MAX_PATH);
|
||||
strcat(sSysLibraryPath, "\\ddraw.dll");
|
||||
hinst = LoadLibrary(sSysLibraryPath);
|
||||
hinst = (*pLoadLibraryA)(sSysLibraryPath);
|
||||
pDirectDrawEnumerateA = (DirectDrawEnumerateA_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
|
||||
pDirectDrawEnumerateExA = (DirectDrawEnumerateExA_Type)GetProcAddress(hinst, "DirectDrawEnumerateExA");
|
||||
pDirectDrawEnumerateW = (DirectDrawEnumerateW_Type)GetProcAddress(hinst, "DirectDrawEnumerateW");
|
||||
@ -825,7 +825,7 @@ int HookDirectDraw(HMODULE module, int version)
|
||||
case 6:
|
||||
HookLibraryEx(module, ddHooks, "ddraw.dll");
|
||||
if(!pDirectDrawCreate){ // required for IAT patching
|
||||
hinst = LoadLibrary("ddraw.dll");
|
||||
hinst = (*pLoadLibraryA)("ddraw.dll");
|
||||
pDirectDrawCreate = (DirectDrawCreate_Type)GetProcAddress(hinst, "DirectDrawCreate");
|
||||
pDirectDrawEnumerateA = (DirectDrawEnumerateA_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
|
||||
}
|
||||
@ -844,7 +844,7 @@ int HookDirectDraw(HMODULE module, int version)
|
||||
//hinst = LoadLibrary("ddraw.dll");
|
||||
HookLibraryEx(module, ddHooks, "ddraw.dll");
|
||||
if(!pDirectDrawCreate){ // required for IAT patching in "Crimson skies"
|
||||
hinst = LoadLibrary("ddraw.dll");
|
||||
hinst = (*pLoadLibraryA)("ddraw.dll");
|
||||
pDirectDrawEnumerateA = (DirectDrawEnumerateA_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
|
||||
pDirectDrawEnumerateExA = (DirectDrawEnumerateExA_Type)GetProcAddress(hinst, "DirectDrawEnumerateExA");
|
||||
pDirectDrawCreate = (DirectDrawCreate_Type)GetProcAddress(hinst, "DirectDrawCreate");
|
||||
@ -1637,7 +1637,7 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I
|
||||
|
||||
if(!pDirectDrawCreate){ // not hooked yet....
|
||||
HINSTANCE hinst;
|
||||
hinst = LoadLibrary("ddraw.dll");
|
||||
hinst = (*pLoadLibraryA)("ddraw.dll");
|
||||
if(!hinst){
|
||||
OutTraceE("LoadLibrary ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
||||
}
|
||||
@ -1674,6 +1674,7 @@ HRESULT WINAPI extDirectDrawCreate(GUID FAR *lpguid, LPDIRECTDRAW FAR *lplpdd, I
|
||||
switch (*(DWORD *)lpguid){
|
||||
case 0x6C14DB80: dxw.dwDDVersion=1; mode="IID_IDirectDraw"; break;
|
||||
case 0xB3A6F3E0: dxw.dwDDVersion=2; mode="IID_IDirectDraw2"; break;
|
||||
case 0x618f8ad4: dxw.dwDDVersion=3; mode="IID_IDirectDraw3"; break;
|
||||
case 0x9c59509a: dxw.dwDDVersion=4; mode="IID_IDirectDraw4"; break;
|
||||
case 0x15e65ec0: dxw.dwDDVersion=7; mode="IID_IDirectDraw7"; break;
|
||||
default: mode="unknown"; break;
|
||||
@ -1730,7 +1731,7 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
|
||||
// v2.1.70: auto-hooking (just in case...)
|
||||
if(!pDirectDrawCreateEx){ // not hooked yet....
|
||||
HINSTANCE hinst;
|
||||
hinst = LoadLibrary("ddraw.dll");
|
||||
hinst = (*pLoadLibraryA)("ddraw.dll");
|
||||
if(!hinst){
|
||||
OutTraceE("LoadLibrary ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
||||
}
|
||||
@ -1767,6 +1768,7 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
|
||||
switch (*(DWORD *)lpguid){
|
||||
case 0x6C14DB80: dxw.dwDDVersion=1; mode="IID_IDirectDraw"; break;
|
||||
case 0xB3A6F3E0: dxw.dwDDVersion=2; mode="IID_IDirectDraw2"; break;
|
||||
case 0x618f8ad4: dxw.dwDDVersion=3; mode="IID_IDirectDraw3"; break;
|
||||
case 0x9c59509a: dxw.dwDDVersion=4; mode="IID_IDirectDraw4"; break;
|
||||
case 0x15e65ec0: dxw.dwDDVersion=7; mode="IID_IDirectDraw7"; break;
|
||||
default: mode="unknown"; break;
|
||||
@ -4006,7 +4008,7 @@ HRESULT WINAPI extBlt4(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRA
|
||||
HRESULT WINAPI extBlt7(LPDIRECTDRAWSURFACE lpdds, LPRECT lpdestrect, LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwflags, LPDDBLTFX lpddbltfx)
|
||||
{ return extBlt(7, pBlt7, lpdds, lpdestrect, lpddssrc, lpsrcrect, dwflags, lpddbltfx); }
|
||||
|
||||
HRESULT WINAPI extBltFast(int dxversion, Blt_Type pBlt, BltFast_Type pBltFast,
|
||||
static HRESULT WINAPI extBltFast(int dxversion, Blt_Type pBlt, BltFast_Type pBltFast,
|
||||
LPDIRECTDRAWSURFACE lpdds, DWORD dwx, DWORD dwy,
|
||||
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwtrans)
|
||||
{
|
||||
@ -4036,6 +4038,7 @@ HRESULT WINAPI extBltFast(int dxversion, Blt_Type pBlt, BltFast_Type pBltFast,
|
||||
// try the actual method first, it may work in some corcumstances....
|
||||
// when ret is DDERR_UNSUPPORTED try the emulated path.
|
||||
if(!(ToPrim || FromPrim)) {
|
||||
if(dxw.dwFlags5 & MESSAGEPUMP) dxw.MessagePump();
|
||||
ret = pBltFast(lpdds, dwx, dwy, lpddssrc, lpsrcrect, dwtrans);
|
||||
if(ret != DDERR_UNSUPPORTED) {
|
||||
if(ret) OutTraceE("BltFast ERROR: res=%x(%s)\n", ret, ExplainDDError(ret));
|
||||
@ -4056,7 +4059,14 @@ HRESULT WINAPI extBltFast(int dxversion, Blt_Type pBlt, BltFast_Type pBltFast,
|
||||
if(dwtrans & DDBLTFAST_SRCCOLORKEY) flags |= DDBLT_KEYSRC;
|
||||
|
||||
if ((dxw.dwFlags2 & FULLRECTBLT) && ToPrim){
|
||||
return sBlt(dxversion, pBlt, "BltFast", lpdds, NULL, lpddssrc, lpsrcrect, flags, NULL, FALSE);
|
||||
ret = sBlt(dxversion, pBlt, "BltFast", lpdds, NULL, lpddssrc, lpsrcrect, flags, NULL, FALSE);
|
||||
if(ret) {
|
||||
OutTraceE("BltFast FULLRECBLT res=%x\n", ret);
|
||||
}
|
||||
else {
|
||||
OutTraceDDRAW("BltFast FULLRECBLT res=DD_OK\n");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
destrect.left = dwx;
|
||||
@ -4078,7 +4088,7 @@ HRESULT WINAPI extBltFast(int dxversion, Blt_Type pBlt, BltFast_Type pBltFast,
|
||||
ret=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd);
|
||||
if (ret){
|
||||
OutTraceE("BltFast: GetSurfaceDesc ERROR %x at %d\n", ret, __LINE__);
|
||||
return 0;
|
||||
return DD_OK;
|
||||
}
|
||||
destrect.right = destrect.left + ddsd.dwWidth;
|
||||
destrect.bottom = destrect.top + ddsd.dwHeight;
|
||||
@ -4086,10 +4096,17 @@ HRESULT WINAPI extBltFast(int dxversion, Blt_Type pBlt, BltFast_Type pBltFast,
|
||||
}
|
||||
else{
|
||||
//ret=sBlt("BltFast", lpdds, NULL, lpddssrc, NULL, flags, NULL, FALSE);
|
||||
OutTraceDW("BltFast FAKE res=DD_OK at %d\n", __LINE__);
|
||||
ret=DD_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if(ret) {
|
||||
OutTraceE("BltFast ERROR: res=%x(%s)\n", ret, ExplainDDError(ret));
|
||||
}
|
||||
else {
|
||||
OutTraceDDRAW("BltFast: res=DD_OK\n");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -6,18 +6,20 @@
|
||||
#include "syslibs.h"
|
||||
#include "dxhelper.h"
|
||||
|
||||
#if 0
|
||||
// IsValidMainWindow: returns TRUE if the main window can be queried for coordinates,
|
||||
// FALSE otherwise (e.g. when minimized)
|
||||
|
||||
BOOL dxwCore::IsValidMainWindow()
|
||||
{
|
||||
RECT Client;
|
||||
POINT UpLeft = {0, 0};
|
||||
|
||||
if(!(*pGetClientRect)(hWnd, &Client)) return FALSE;
|
||||
if((Client.right == 0) || (Client.bottom == 0)) return FALSE;
|
||||
if(!(*pClientToScreen)(hWnd, &UpLeft)) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// if the main window coordinates are still valid updates the window placement values
|
||||
|
||||
void dxwCore::UpdateDesktopCoordinates()
|
||||
{
|
||||
@ -36,7 +38,6 @@ void dxwCore::UpdateDesktopCoordinates()
|
||||
OutTraceB("dxwCore::UpdateDesktopCoordinates: NEW pos=(%d,%d) size=(%dx%d)\n", iPosX, iPosY, iSizX, iSizY);
|
||||
}
|
||||
|
||||
|
||||
// GetScreenRect: returns a RECT sized as the virtual desktop
|
||||
|
||||
RECT dxwCore::GetScreenRect()
|
||||
@ -346,7 +347,8 @@ void dxwCore::GetMonitorWorkarea(LPRECT lpRect, BOOL WorkArea)
|
||||
MonitorId = -1;
|
||||
GetMonitorWorkarea(lpRect, WorkArea);
|
||||
}
|
||||
|
||||
OutTraceB("dxwCore::GetMonitorWorkarea: id=%d workarea=%x rect=(%d,%d)-(%d,%d)\n",
|
||||
MonitorId, WorkArea, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
|
||||
}
|
||||
|
||||
// v.2.1.80: unified positioning logic into CalculateWindowPos routine
|
||||
@ -360,7 +362,7 @@ void dxwCore::CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWP
|
||||
int MaxX, MaxY;
|
||||
HMENU hMenu;
|
||||
|
||||
switch(dxw.Coordinates){
|
||||
switch(Coordinates){
|
||||
case DXW_DESKTOP_CENTER:
|
||||
if(bAutoScale){
|
||||
MaxX = GetScreenWidth();
|
||||
@ -381,8 +383,8 @@ void dxwCore::CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWP
|
||||
if(dxw.dwFlags4 & BILINEAR2XFILTER) MaxY <<= 1; // double
|
||||
}
|
||||
dxw.GetMonitorWorkarea(&desktop, TRUE);
|
||||
rect.left = (desktop.right - desktop.left - MaxX) / 2;
|
||||
rect.top = (desktop.bottom - desktop.top - MaxY) / 2;
|
||||
rect.left = (desktop.right + desktop.left - MaxX) / 2; // v2.03.89 - fixed
|
||||
rect.top = (desktop.bottom + desktop.top - MaxY) / 2; // v2.03.89 - fixed
|
||||
rect.right = rect.left + MaxX;
|
||||
rect.bottom = rect.top + MaxY; //v2.02.09
|
||||
// fixed ....
|
||||
@ -425,6 +427,8 @@ void dxwCore::CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWP
|
||||
rect.bottom = iPosY + MaxY; //v2.02.09
|
||||
break;
|
||||
}
|
||||
OutTraceB("dxwCore::CalculateWindowPos: coord=%d client rect=(%d,%d)-(%d,%d)\n",
|
||||
Coordinates, rect.left, rect.top, rect.right, rect.bottom);
|
||||
|
||||
if(hwnd){
|
||||
RECT UnmappedRect;
|
||||
@ -468,6 +472,9 @@ void dxwCore::CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWP
|
||||
}
|
||||
}
|
||||
|
||||
OutTraceB("dxwCore::CalculateWindowPos: coord=%d window rect=(%d,%d)-(%d,%d)\n",
|
||||
Coordinates, rect.left, rect.top, rect.right, rect.bottom);
|
||||
|
||||
// update the arguments for the window creation
|
||||
wp->x=rect.left;
|
||||
wp->y=rect.top;
|
||||
|
@ -1557,4 +1557,17 @@ void dxwCore::ToggleFreezedTime()
|
||||
TimeFreeze = !TimeFreeze;
|
||||
dwLastTime = (*pGetTickCount)();
|
||||
OutTraceDW("DxWnd: time is %s\n", dxw.TimeFreeze ? "freezed" : "unfreezed");
|
||||
}
|
||||
}
|
||||
|
||||
void dxwCore::MessagePump()
|
||||
{
|
||||
MSG msg;
|
||||
while(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)){
|
||||
OutTraceW("MESSAGEPUMP: msg=%x l-wParam=(%x,%x)\n", msg.message, msg.lParam, msg.wParam);
|
||||
if((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST)) break; // do not consume keyboard inputs
|
||||
if((msg.message >= WM_MOUSEFIRST) && (msg.message <= WM_MOUSELAST)) break; // do not consume mouse inputs
|
||||
PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ public: // methods
|
||||
void FixNCHITCursorPos(LPPOINT);
|
||||
void SetClipCursor(void);
|
||||
void EraseClipCursor(void);
|
||||
BOOL IsValidMainWindow();
|
||||
RECT MapWindowRect(LPRECT);
|
||||
RECT MapWindowRect(void);
|
||||
RECT MapClientRect(LPRECT);
|
||||
@ -105,7 +106,7 @@ public: // methods
|
||||
void GetSystemTimeAsFileTime(LPFILETIME);
|
||||
DWORD StretchTime(DWORD);
|
||||
DWORD StretchCounter(DWORD);
|
||||
LARGE_INTEGER dxwCore::StretchCounter(LARGE_INTEGER);
|
||||
LARGE_INTEGER StretchCounter(LARGE_INTEGER);
|
||||
void ShowOverlay();
|
||||
void ShowOverlay(HDC);
|
||||
void ShowOverlay(HDC, int, int);
|
||||
@ -144,6 +145,7 @@ public: // methods
|
||||
void ToggleFreezedTime();
|
||||
void GetMonitorWorkarea(LPRECT, BOOL);
|
||||
void CalculateWindowPos(HWND, DWORD, DWORD, LPWINDOWPOS);
|
||||
void MessagePump(void);
|
||||
|
||||
public: // simple data variables
|
||||
int MonitorId;
|
||||
|
BIN
dll/dxwnd.aps
BIN
dll/dxwnd.aps
Binary file not shown.
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "TlHelp32.h"
|
||||
|
||||
#define VERSION "2.03.88.fix1"
|
||||
#define VERSION "2.03.89"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
//#define LOCKTHREADS
|
||||
|
Binary file not shown.
@ -562,6 +562,10 @@
|
||||
RelativePath=".\hddraw.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\logall.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\msvfwhook.h"
|
||||
>
|
||||
|
16
dll/logall.h
Normal file
16
dll/logall.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifdef OutTraceB
|
||||
#undef OutTraceB
|
||||
#define OutTraceB OutTrace
|
||||
#endif
|
||||
#ifdef OutTraceDW
|
||||
#undef OutTraceDW
|
||||
#define OutTraceDW OutTrace
|
||||
#endif
|
||||
#ifdef OutTraceC
|
||||
#undef OutTraceC
|
||||
#define OutTraceC OutTrace
|
||||
#endif
|
||||
#ifdef OutTraceE
|
||||
#undef OutTraceE
|
||||
#define OutTraceE OutTrace
|
||||
#endif
|
@ -493,6 +493,9 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam)
|
||||
OutTraceDW("%s: GOT hwnd=%x pos=(%d,%d) dim=(%d,%d) Flags=%x(%s)\n",
|
||||
ApiName, hwnd, wp->x, wp->y, wp->cx, wp->cy, wp->flags, ExplainWPFlags(wp->flags));
|
||||
|
||||
// if nothing to be moved, do nothing
|
||||
if ((wp->flags & (SWP_NOMOVE|SWP_NOSIZE))==(SWP_NOMOVE|SWP_NOSIZE)) return; //v2.02.13
|
||||
|
||||
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
|
||||
int UpdFlag = 0;
|
||||
WINDOWPOS MaxPos;
|
||||
@ -504,8 +507,6 @@ void dxwFixWindowPos(char *ApiName, HWND hwnd, LPARAM lParam)
|
||||
OutTraceDW("%s: SET max dim=(%d,%d)\n", ApiName, wp->cx, wp->cy);
|
||||
}
|
||||
|
||||
if ((wp->flags & (SWP_NOMOVE|SWP_NOSIZE))==(SWP_NOMOVE|SWP_NOSIZE)) return; //v2.02.13
|
||||
|
||||
if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen() && (hwnd==dxw.GethWnd())){
|
||||
dxw.CalculateWindowPos(hwnd, MaxX, MaxY, wp);
|
||||
OutTraceDW("%s: LOCK pos=(%d,%d) dim=(%d,%d)\n", ApiName, wp->x, wp->y, wp->cx, wp->cy);
|
||||
@ -1543,9 +1544,6 @@ static HWND WINAPI CreateWindowCommon(
|
||||
// v2.03.53: revised code, logic moved to IsFullscreenWindow
|
||||
|
||||
if(isNewDesktop=IsFullscreenWindow(lpClassName, dwStyle, dwExStyle, hWndParent, x, y, nWidth, nHeight)){
|
||||
RECT screen;
|
||||
POINT upleft = {0,0};
|
||||
|
||||
// if already in fullscreen mode, save previous settings
|
||||
if(dxw.IsFullScreen() && dxw.GethWnd()){
|
||||
hLastFullScrWin = dxw.GethWnd();
|
||||
@ -1559,25 +1557,14 @@ static HWND WINAPI CreateWindowCommon(
|
||||
// inserted some checks here, since the main window could be destroyed
|
||||
// or minimized (see "Jedi Outcast") so that you may get a dangerous
|
||||
// zero size. In this case, better renew the hWnd assignement and its coordinates.
|
||||
do { // fake loop
|
||||
isValidHandle = FALSE;
|
||||
if (!(*pGetClientRect)(dxw.GethWnd(),&screen)) break;
|
||||
if (!(*pClientToScreen)(dxw.GethWnd(),&upleft)) break;
|
||||
if (screen.right==0 || screen.bottom==0) break;
|
||||
isValidHandle = TRUE;
|
||||
} while(FALSE);
|
||||
if (isValidHandle){ // use parent's coordinates
|
||||
// child windows of the current virtual desktop have relative coordinates
|
||||
// but non child windows or child of the real desktop must be shifted....
|
||||
//if (!(dwStyle & WS_CHILD) || (dxw.IsDesktop(hWndParent))){
|
||||
if (!(dwStyle & WS_CHILD)){
|
||||
x=upleft.x;
|
||||
y=upleft.y;
|
||||
}
|
||||
nWidth=screen.right;
|
||||
nHeight=screen.bottom;
|
||||
OutTraceDW("%s: fixed BIG win pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight);
|
||||
isValidHandle = dxw.IsValidMainWindow();
|
||||
if (!(dwStyle & WS_CHILD) || (dxw.IsRealDesktop(hWndParent))){
|
||||
x=dxw.iPosX;
|
||||
y=dxw.iPosY;
|
||||
}
|
||||
nWidth=dxw.GetScreenWidth();
|
||||
nHeight=dxw.GetScreenHeight();
|
||||
OutTraceDW("%s: fixed client pos=(%d,%d) size=(%d,%d)\n", ApiName, x, y, nWidth, nHeight);
|
||||
dxw.SetFullScreen(TRUE);
|
||||
}
|
||||
|
||||
@ -1593,7 +1580,7 @@ static HWND WINAPI CreateWindowCommon(
|
||||
// from here on, fullscreen is garanteed
|
||||
|
||||
if(!isNewDesktop){
|
||||
if (dwStyle & WS_CHILD){
|
||||
if ((dwStyle & WS_CHILD) && !dxw.IsRealDesktop(hWndParent)){
|
||||
// tested on Gangsters: coordinates must be window-relative!!!
|
||||
// Age of Empires....
|
||||
dxw.MapClient(&x, &y, &nWidth, &nHeight);
|
||||
@ -1601,15 +1588,13 @@ static HWND WINAPI CreateWindowCommon(
|
||||
ApiName, x, y, nWidth, nHeight);
|
||||
}
|
||||
else {
|
||||
if ((dwExStyle & WS_EX_CONTROLPARENT) || (dwStyle & WS_POPUP)){
|
||||
// needed for "Diablo", that creates a new WS_EX_CONTROLPARENT window that must be
|
||||
// overlapped to the directdraw surface.
|
||||
// needed for "Riven", that creates a new WS_POPUP window with the menu bar that must be
|
||||
// overlapped to the directdraw surface.
|
||||
dxw.MapWindow(&x, &y, &nWidth, &nHeight);
|
||||
OutTraceDW("%s: fixed pos=(%d,%d) size=(%d,%d)\n",
|
||||
ApiName, x, y, nWidth, nHeight);
|
||||
}
|
||||
// needed for "Diablo", that creates a new WS_EX_CONTROLPARENT window that must be
|
||||
// overlapped to the directdraw surface.
|
||||
// needed for "Riven", that creates a new WS_POPUP window with the menu bar that must be
|
||||
// overlapped to the directdraw surface.
|
||||
dxw.MapWindow(&x, &y, &nWidth, &nHeight);
|
||||
OutTraceDW("%s: fixed ABSOLUTE pos=(%d,%d) size=(%d,%d)\n",
|
||||
ApiName, x, y, nWidth, nHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1628,6 +1613,7 @@ static HWND WINAPI CreateWindowCommon(
|
||||
|
||||
if (dwExStyle & WS_EX_CONTROLPARENT) hControlParentWnd=hwnd;
|
||||
|
||||
// replace the invalid main win with the new one
|
||||
if ((!isValidHandle) && dxw.IsFullScreen()){
|
||||
dxw.SethWnd(hwnd);
|
||||
extern void AdjustWindowPos(HWND, DWORD, DWORD);
|
||||
|
@ -15,6 +15,8 @@
|
||||
#define EMULATEJOY TRUE
|
||||
#define INVERTJOYAXIS TRUE
|
||||
|
||||
// #include "logall.h" // comment when not debugging
|
||||
|
||||
BOOL IsWithinMCICall = FALSE;
|
||||
|
||||
typedef MCIDEVICEID (WINAPI *mciGetDeviceIDA_Type)(LPCTSTR);
|
||||
@ -32,6 +34,9 @@ MMRESULT WINAPI extjoyGetDevCapsA(DWORD, LPJOYCAPS, UINT);
|
||||
typedef MMRESULT (WINAPI *joyGetPosEx_Type)(DWORD, LPJOYINFOEX);
|
||||
joyGetPosEx_Type pjoyGetPosEx = NULL;
|
||||
MMRESULT WINAPI extjoyGetPosEx(DWORD, LPJOYINFOEX);
|
||||
typedef MMRESULT (WINAPI *joyGetPos_Type)(DWORD, LPJOYINFO);
|
||||
joyGetPos_Type pjoyGetPos = NULL;
|
||||
MMRESULT WINAPI extjoyGetPos(DWORD, LPJOYINFO);
|
||||
typedef MMRESULT (WINAPI *auxGetNumDevs_Type)(void);
|
||||
auxGetNumDevs_Type pauxGetNumDevs = NULL;
|
||||
MMRESULT WINAPI extauxGetNumDevs(void);
|
||||
@ -62,6 +67,7 @@ static HookEntryEx_Type JoyHooks[]={
|
||||
{HOOK_IAT_CANDIDATE, 0, "joyGetNumDevs", NULL, (FARPROC *)&pjoyGetNumDevs, (FARPROC)extjoyGetNumDevs},
|
||||
{HOOK_IAT_CANDIDATE, 0, "joyGetDevCapsA", NULL, (FARPROC *)&pjoyGetDevCapsA, (FARPROC)extjoyGetDevCapsA},
|
||||
{HOOK_IAT_CANDIDATE, 0, "joyGetPosEx", NULL, (FARPROC *)&pjoyGetPosEx, (FARPROC)extjoyGetPosEx},
|
||||
{HOOK_IAT_CANDIDATE, 0, "joyGetPos", NULL, (FARPROC *)&pjoyGetPos, (FARPROC)extjoyGetPos},
|
||||
{HOOK_IAT_CANDIDATE, 0, 0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
@ -211,7 +217,7 @@ MCIERROR WINAPI extmciSendCommand(mciSendCommand_Type pmciSendCommand, MCIDEVICE
|
||||
switch(uMsg){
|
||||
case MCI_STATUS:
|
||||
MCI_STATUS_PARMS *p = (MCI_STATUS_PARMS *)dwParam;
|
||||
OutTrace("mciSendCommand: Item=%d Track=%d return=%x\n", p->dwItem, p->dwTrack, p->dwReturn);
|
||||
OutTraceDW("mciSendCommand: Item=%d Track=%d return=%x\n", p->dwItem, p->dwTrack, p->dwReturn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -326,9 +332,9 @@ MMRESULT WINAPI extjoyGetDevCapsA(DWORD uJoyID, LPJOYCAPS pjc, UINT cbjc)
|
||||
// set Joystick capability structure
|
||||
memset(pjc, 0, sizeof(JOYCAPS));
|
||||
strncpy(pjc->szPname, "DxWnd Joystick Emulator", MAXPNAMELEN);
|
||||
pjc->wXmin = 0;
|
||||
pjc->wXmin = -XSPAN;
|
||||
pjc->wXmax = XSPAN;
|
||||
pjc->wYmin = 0;
|
||||
pjc->wYmin = -YSPAN;
|
||||
pjc->wYmax = YSPAN;
|
||||
pjc->wNumButtons = 2;
|
||||
pjc->wMaxButtons = 2;
|
||||
@ -341,11 +347,11 @@ MMRESULT WINAPI extjoyGetDevCapsA(DWORD uJoyID, LPJOYCAPS pjc, UINT cbjc)
|
||||
return JOYERR_NOERROR;
|
||||
}
|
||||
|
||||
MMRESULT WINAPI extjoyGetPosEx(DWORD uJoyID, LPJOYINFOEX pji)
|
||||
static MMRESULT GetJoy(char *apiname, DWORD uJoyID, LPJOYINFO lpj)
|
||||
{
|
||||
OutTraceC("joyGetPosEx: joyid=%d\n", uJoyID);
|
||||
OutTraceC("%s: joyid=%d\n", apiname, uJoyID);
|
||||
if(uJoyID != 0) return JOYERR_PARMS;
|
||||
LONG x, y;
|
||||
LONG x, y, CenterX, CenterY;
|
||||
HWND hwnd;
|
||||
DWORD dwButtons;
|
||||
static BOOL bJoyLock = FALSE;
|
||||
@ -355,7 +361,7 @@ MMRESULT WINAPI extjoyGetPosEx(DWORD uJoyID, LPJOYINFOEX pji)
|
||||
if (GetKeyState(VK_LBUTTON) < 0) dwButtons |= JOY_BUTTON1;
|
||||
if (GetKeyState(VK_RBUTTON) < 0) dwButtons |= JOY_BUTTON2;
|
||||
if (GetKeyState(VK_MBUTTON) < 0) dwButtons |= JOY_BUTTON3;
|
||||
OutTraceB("joyGetPosEx: Virtual Joystick buttons=%x\n", dwButtons);
|
||||
OutTraceB("%s: Virtual Joystick buttons=%x\n", apiname, dwButtons);
|
||||
|
||||
if(dwButtons == JOY_BUTTON3){
|
||||
if(((*pGetTickCount)() - dwLastClick) > 200){
|
||||
@ -365,8 +371,10 @@ MMRESULT WINAPI extjoyGetPosEx(DWORD uJoyID, LPJOYINFOEX pji)
|
||||
}
|
||||
}
|
||||
|
||||
x=(XSPAN>>1);
|
||||
y=(YSPAN>>1);
|
||||
// default: centered position
|
||||
x=0;
|
||||
y=0;
|
||||
// get cursor position and map it to virtual joystick x,y axis
|
||||
if(hwnd=dxw.GethWnd()){
|
||||
POINT pt;
|
||||
RECT client;
|
||||
@ -379,43 +387,60 @@ MMRESULT WINAPI extjoyGetPosEx(DWORD uJoyID, LPJOYINFOEX pji)
|
||||
if(bJoyLock || !dxw.bActive){
|
||||
// when the joystick is "locked" (bJoyLock) or when the window lost focus
|
||||
// (dxw.bActive == FALSE) place the joystick in the central position
|
||||
OutTraceB("joyGetPosEx: CENTERED lock=%x active=%x\n", bJoyLock, dxw.bActive);
|
||||
x=(XSPAN>>1);
|
||||
y=(YSPAN>>1);
|
||||
OutTraceB("%s: CENTERED lock=%x active=%x\n", apiname, bJoyLock, dxw.bActive);
|
||||
x=0;
|
||||
y=0;
|
||||
pt.x = client.right >> 1;
|
||||
pt.y = client.bottom >> 1;
|
||||
dwButtons = JOY_BUTTON3;
|
||||
}
|
||||
else{
|
||||
OutTraceB("joyGetPosEx: ACTIVE mouse=(%d,%d)\n", pt.x, pt.y);
|
||||
OutTraceB("%s: ACTIVE mouse=(%d,%d)\n", apiname, pt.x, pt.y);
|
||||
if(pt.x < client.left) pt.x = client.left;
|
||||
if(pt.x > client.right) pt.x = client.right;
|
||||
if(pt.y < client.top) pt.y = client.top;
|
||||
if(pt.y > client.bottom) pt.y = client.bottom;
|
||||
x = (pt.x * XSPAN) / client.right;
|
||||
CenterX = (client.right - client.left) >> 1;
|
||||
CenterY = (client.bottom - client.top) >> 1;
|
||||
x = ((pt.x - CenterX) * XSPAN) / client.right;
|
||||
if(INVERTJOYAXIS)
|
||||
y = ((client.bottom - pt.y) * YSPAN) / client.bottom; // inverted y axis
|
||||
y = ((CenterY - pt.y) * YSPAN) / client.bottom; // inverted y axis
|
||||
else
|
||||
y = (pt.y * YSPAN) / client.bottom;
|
||||
y = ((pt.y - CenterY) * YSPAN) / client.bottom;
|
||||
}
|
||||
ShowJoystick(pt.x, pt.y, dwButtons);
|
||||
}
|
||||
else {
|
||||
x=(XSPAN>>1);
|
||||
y=(YSPAN>>1);
|
||||
}
|
||||
lpj->wXpos = x;
|
||||
lpj->wYpos = y;
|
||||
lpj->wZpos = 0;
|
||||
lpj->wButtons = dwButtons;
|
||||
OutTraceC("%s: joyid=%d pos=(%d,%d)\n", apiname, uJoyID, lpj->wXpos, lpj->wYpos);
|
||||
return JOYERR_NOERROR;
|
||||
}
|
||||
|
||||
// set Joystick info structure
|
||||
MMRESULT WINAPI extjoyGetPosEx(DWORD uJoyID, LPJOYINFOEX pji)
|
||||
{
|
||||
MMRESULT res;
|
||||
JOYINFO jinfo;
|
||||
res=GetJoy("joyGetPosEx", uJoyID, &jinfo);
|
||||
|
||||
// set Joystick JOYINFOEX info structure
|
||||
memset(pji, 0, sizeof(JOYINFOEX));
|
||||
pji->dwSize = sizeof(JOYINFOEX);
|
||||
pji->dwFlags = 0;
|
||||
pji->dwXpos = x;
|
||||
pji->dwYpos = y;
|
||||
pji->dwButtons = dwButtons;
|
||||
pji->dwXpos = jinfo.wXpos;
|
||||
pji->dwYpos = jinfo.wYpos;
|
||||
pji->dwButtons = jinfo.wButtons;
|
||||
pji->dwFlags = JOY_RETURNX|JOY_RETURNY|JOY_RETURNBUTTONS;
|
||||
|
||||
OutTraceC("joyGetPosEx: joyid=%d pos=(%d,%d)\n", uJoyID, pji->dwXpos, pji->dwYpos);
|
||||
return JOYERR_NOERROR;
|
||||
return res;
|
||||
}
|
||||
|
||||
MMRESULT WINAPI extjoyGetPos(DWORD uJoyID, LPJOYINFO pji)
|
||||
{
|
||||
MMRESULT res;
|
||||
res=GetJoy("joyGetPosEx", uJoyID, pji);
|
||||
return res;
|
||||
}
|
||||
|
||||
static void ShowJoystick(LONG x, LONG y, DWORD dwButtons)
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user