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
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:2cb685fd9bcac89865a83e26fbdc14663d7d2f9bba0014f1e4c44606f6bb7702
|
oid sha256:9070435639bcf64aebc632f848af969aa24800cb40864ae90d5ce56a1d43b373
|
||||||
size 680960
|
size 681472
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:b7b7d8268a048d4d8600bca6824ef8226e2dab5bb347d07b9bb2afff7d2a73d1
|
oid sha256:14ddc8f6eaa1eac7dc356e8824fb118e014fe5b5e8828432e2ffa0ac58f1f3c4
|
||||||
size 660992
|
size 660992
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[target]
|
[target]
|
||||||
title0=Crazy Hospital 3
|
title0=Microsoft Motocross Madness
|
||||||
path0=D:\Games\Crazy Hospital 3\Dtrmain.exe
|
path0=F:\Games\Motocross Madness\mcm.exe
|
||||||
startfolder0=
|
startfolder0=
|
||||||
launchpath0=
|
launchpath0=
|
||||||
module0=
|
module0=
|
||||||
@ -11,10 +11,10 @@ ver0=0
|
|||||||
monitorid0=-1
|
monitorid0=-1
|
||||||
coord0=0
|
coord0=0
|
||||||
flag0=136314914
|
flag0=136314914
|
||||||
flagg0=1207959552
|
flagg0=134219776
|
||||||
flagh0=20
|
flagh0=20
|
||||||
flagi0=138412036
|
flagi0=4194308
|
||||||
flagj0=4224
|
flagj0=0
|
||||||
flagk0=65536
|
flagk0=65536
|
||||||
flagl0=0
|
flagl0=0
|
||||||
flagm0=0
|
flagm0=0
|
||||||
@ -30,4 +30,4 @@ winver0=0
|
|||||||
maxres0=-1
|
maxres0=-1
|
||||||
swapeffect0=0
|
swapeffect0=0
|
||||||
maxddinterface0=7
|
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 hook for EnumDisplayDevicesW used by "Battleground Europe"
|
||||||
fix: added "Hide multi monitors" logic to EnumDisplayDevicesA/W
|
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;
|
HRESULT res;
|
||||||
BOOL ToPrim, FromPrim, ToScreen, FromScreen;
|
BOOL ToPrim, FromPrim, ToScreen, FromScreen;
|
||||||
|
|
||||||
if(dxw.dwFlags5 & MESSAGEPUMP){
|
if(dxw.dwFlags5 & MESSAGEPUMP) dxw.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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ToPrim=dxwss.IsAPrimarySurface(lpdds);
|
ToPrim=dxwss.IsAPrimarySurface(lpdds);
|
||||||
FromPrim=dxwss.IsAPrimarySurface(lpddssrc);
|
FromPrim=dxwss.IsAPrimarySurface(lpddssrc);
|
||||||
|
@ -748,7 +748,7 @@ static void ddSetCompatibility()
|
|||||||
HRESULT res;
|
HRESULT res;
|
||||||
HINSTANCE hinst;
|
HINSTANCE hinst;
|
||||||
|
|
||||||
hinst=LoadLibrary("ddraw.dll");
|
hinst=(*pLoadLibraryA)("ddraw.dll");
|
||||||
pSetAppCompatData=(SetAppCompatData_Type)(*pGetProcAddress)(hinst, "SetAppCompatData");
|
pSetAppCompatData=(SetAppCompatData_Type)(*pGetProcAddress)(hinst, "SetAppCompatData");
|
||||||
if(pSetAppCompatData) {
|
if(pSetAppCompatData) {
|
||||||
if (dxw.dwFlags2 & SETCOMPATIBILITY){
|
if (dxw.dwFlags2 & SETCOMPATIBILITY){
|
||||||
@ -776,7 +776,7 @@ static void BypassGOGDDrawRedirector()
|
|||||||
|
|
||||||
GetSystemDirectory(sSysLibraryPath, MAX_PATH);
|
GetSystemDirectory(sSysLibraryPath, MAX_PATH);
|
||||||
strcat(sSysLibraryPath, "\\ddraw.dll");
|
strcat(sSysLibraryPath, "\\ddraw.dll");
|
||||||
hinst = LoadLibrary(sSysLibraryPath);
|
hinst = (*pLoadLibraryA)(sSysLibraryPath);
|
||||||
pDirectDrawEnumerateA = (DirectDrawEnumerateA_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
|
pDirectDrawEnumerateA = (DirectDrawEnumerateA_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
|
||||||
pDirectDrawEnumerateExA = (DirectDrawEnumerateExA_Type)GetProcAddress(hinst, "DirectDrawEnumerateExA");
|
pDirectDrawEnumerateExA = (DirectDrawEnumerateExA_Type)GetProcAddress(hinst, "DirectDrawEnumerateExA");
|
||||||
pDirectDrawEnumerateW = (DirectDrawEnumerateW_Type)GetProcAddress(hinst, "DirectDrawEnumerateW");
|
pDirectDrawEnumerateW = (DirectDrawEnumerateW_Type)GetProcAddress(hinst, "DirectDrawEnumerateW");
|
||||||
@ -825,7 +825,7 @@ int HookDirectDraw(HMODULE module, int version)
|
|||||||
case 6:
|
case 6:
|
||||||
HookLibraryEx(module, ddHooks, "ddraw.dll");
|
HookLibraryEx(module, ddHooks, "ddraw.dll");
|
||||||
if(!pDirectDrawCreate){ // required for IAT patching
|
if(!pDirectDrawCreate){ // required for IAT patching
|
||||||
hinst = LoadLibrary("ddraw.dll");
|
hinst = (*pLoadLibraryA)("ddraw.dll");
|
||||||
pDirectDrawCreate = (DirectDrawCreate_Type)GetProcAddress(hinst, "DirectDrawCreate");
|
pDirectDrawCreate = (DirectDrawCreate_Type)GetProcAddress(hinst, "DirectDrawCreate");
|
||||||
pDirectDrawEnumerateA = (DirectDrawEnumerateA_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
|
pDirectDrawEnumerateA = (DirectDrawEnumerateA_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
|
||||||
}
|
}
|
||||||
@ -844,7 +844,7 @@ int HookDirectDraw(HMODULE module, int version)
|
|||||||
//hinst = LoadLibrary("ddraw.dll");
|
//hinst = LoadLibrary("ddraw.dll");
|
||||||
HookLibraryEx(module, ddHooks, "ddraw.dll");
|
HookLibraryEx(module, ddHooks, "ddraw.dll");
|
||||||
if(!pDirectDrawCreate){ // required for IAT patching in "Crimson skies"
|
if(!pDirectDrawCreate){ // required for IAT patching in "Crimson skies"
|
||||||
hinst = LoadLibrary("ddraw.dll");
|
hinst = (*pLoadLibraryA)("ddraw.dll");
|
||||||
pDirectDrawEnumerateA = (DirectDrawEnumerateA_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
|
pDirectDrawEnumerateA = (DirectDrawEnumerateA_Type)GetProcAddress(hinst, "DirectDrawEnumerateA");
|
||||||
pDirectDrawEnumerateExA = (DirectDrawEnumerateExA_Type)GetProcAddress(hinst, "DirectDrawEnumerateExA");
|
pDirectDrawEnumerateExA = (DirectDrawEnumerateExA_Type)GetProcAddress(hinst, "DirectDrawEnumerateExA");
|
||||||
pDirectDrawCreate = (DirectDrawCreate_Type)GetProcAddress(hinst, "DirectDrawCreate");
|
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....
|
if(!pDirectDrawCreate){ // not hooked yet....
|
||||||
HINSTANCE hinst;
|
HINSTANCE hinst;
|
||||||
hinst = LoadLibrary("ddraw.dll");
|
hinst = (*pLoadLibraryA)("ddraw.dll");
|
||||||
if(!hinst){
|
if(!hinst){
|
||||||
OutTraceE("LoadLibrary ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
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){
|
switch (*(DWORD *)lpguid){
|
||||||
case 0x6C14DB80: dxw.dwDDVersion=1; mode="IID_IDirectDraw"; break;
|
case 0x6C14DB80: dxw.dwDDVersion=1; mode="IID_IDirectDraw"; break;
|
||||||
case 0xB3A6F3E0: dxw.dwDDVersion=2; mode="IID_IDirectDraw2"; 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 0x9c59509a: dxw.dwDDVersion=4; mode="IID_IDirectDraw4"; break;
|
||||||
case 0x15e65ec0: dxw.dwDDVersion=7; mode="IID_IDirectDraw7"; break;
|
case 0x15e65ec0: dxw.dwDDVersion=7; mode="IID_IDirectDraw7"; break;
|
||||||
default: mode="unknown"; break;
|
default: mode="unknown"; break;
|
||||||
@ -1730,7 +1731,7 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
|
|||||||
// v2.1.70: auto-hooking (just in case...)
|
// v2.1.70: auto-hooking (just in case...)
|
||||||
if(!pDirectDrawCreateEx){ // not hooked yet....
|
if(!pDirectDrawCreateEx){ // not hooked yet....
|
||||||
HINSTANCE hinst;
|
HINSTANCE hinst;
|
||||||
hinst = LoadLibrary("ddraw.dll");
|
hinst = (*pLoadLibraryA)("ddraw.dll");
|
||||||
if(!hinst){
|
if(!hinst){
|
||||||
OutTraceE("LoadLibrary ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
OutTraceE("LoadLibrary ERROR err=%d at %d\n", GetLastError(), __LINE__);
|
||||||
}
|
}
|
||||||
@ -1767,6 +1768,7 @@ HRESULT WINAPI extDirectDrawCreateEx(GUID FAR *lpguid,
|
|||||||
switch (*(DWORD *)lpguid){
|
switch (*(DWORD *)lpguid){
|
||||||
case 0x6C14DB80: dxw.dwDDVersion=1; mode="IID_IDirectDraw"; break;
|
case 0x6C14DB80: dxw.dwDDVersion=1; mode="IID_IDirectDraw"; break;
|
||||||
case 0xB3A6F3E0: dxw.dwDDVersion=2; mode="IID_IDirectDraw2"; 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 0x9c59509a: dxw.dwDDVersion=4; mode="IID_IDirectDraw4"; break;
|
||||||
case 0x15e65ec0: dxw.dwDDVersion=7; mode="IID_IDirectDraw7"; break;
|
case 0x15e65ec0: dxw.dwDDVersion=7; mode="IID_IDirectDraw7"; break;
|
||||||
default: mode="unknown"; 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)
|
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); }
|
{ 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 lpdds, DWORD dwx, DWORD dwy,
|
||||||
LPDIRECTDRAWSURFACE lpddssrc, LPRECT lpsrcrect, DWORD dwtrans)
|
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....
|
// try the actual method first, it may work in some corcumstances....
|
||||||
// when ret is DDERR_UNSUPPORTED try the emulated path.
|
// when ret is DDERR_UNSUPPORTED try the emulated path.
|
||||||
if(!(ToPrim || FromPrim)) {
|
if(!(ToPrim || FromPrim)) {
|
||||||
|
if(dxw.dwFlags5 & MESSAGEPUMP) dxw.MessagePump();
|
||||||
ret = pBltFast(lpdds, dwx, dwy, lpddssrc, lpsrcrect, dwtrans);
|
ret = pBltFast(lpdds, dwx, dwy, lpddssrc, lpsrcrect, dwtrans);
|
||||||
if(ret != DDERR_UNSUPPORTED) {
|
if(ret != DDERR_UNSUPPORTED) {
|
||||||
if(ret) OutTraceE("BltFast ERROR: res=%x(%s)\n", ret, ExplainDDError(ret));
|
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(dwtrans & DDBLTFAST_SRCCOLORKEY) flags |= DDBLT_KEYSRC;
|
||||||
|
|
||||||
if ((dxw.dwFlags2 & FULLRECTBLT) && ToPrim){
|
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;
|
destrect.left = dwx;
|
||||||
@ -4078,7 +4088,7 @@ HRESULT WINAPI extBltFast(int dxversion, Blt_Type pBlt, BltFast_Type pBltFast,
|
|||||||
ret=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd);
|
ret=lpddssrc->GetSurfaceDesc((LPDDSURFACEDESC)&ddsd);
|
||||||
if (ret){
|
if (ret){
|
||||||
OutTraceE("BltFast: GetSurfaceDesc ERROR %x at %d\n", ret, __LINE__);
|
OutTraceE("BltFast: GetSurfaceDesc ERROR %x at %d\n", ret, __LINE__);
|
||||||
return 0;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
destrect.right = destrect.left + ddsd.dwWidth;
|
destrect.right = destrect.left + ddsd.dwWidth;
|
||||||
destrect.bottom = destrect.top + ddsd.dwHeight;
|
destrect.bottom = destrect.top + ddsd.dwHeight;
|
||||||
@ -4086,10 +4096,17 @@ HRESULT WINAPI extBltFast(int dxversion, Blt_Type pBlt, BltFast_Type pBltFast,
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//ret=sBlt("BltFast", lpdds, NULL, lpddssrc, NULL, flags, NULL, FALSE);
|
//ret=sBlt("BltFast", lpdds, NULL, lpddssrc, NULL, flags, NULL, FALSE);
|
||||||
|
OutTraceDW("BltFast FAKE res=DD_OK at %d\n", __LINE__);
|
||||||
ret=DD_OK;
|
ret=DD_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ret) {
|
||||||
|
OutTraceE("BltFast ERROR: res=%x(%s)\n", ret, ExplainDDError(ret));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
OutTraceDDRAW("BltFast: res=DD_OK\n");
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,18 +6,20 @@
|
|||||||
#include "syslibs.h"
|
#include "syslibs.h"
|
||||||
#include "dxhelper.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()
|
BOOL dxwCore::IsValidMainWindow()
|
||||||
{
|
{
|
||||||
RECT Client;
|
RECT Client;
|
||||||
POINT UpLeft = {0, 0};
|
POINT UpLeft = {0, 0};
|
||||||
|
|
||||||
if(!(*pGetClientRect)(hWnd, &Client)) return FALSE;
|
if(!(*pGetClientRect)(hWnd, &Client)) return FALSE;
|
||||||
if((Client.right == 0) || (Client.bottom == 0)) return FALSE;
|
if((Client.right == 0) || (Client.bottom == 0)) return FALSE;
|
||||||
if(!(*pClientToScreen)(hWnd, &UpLeft)) return FALSE;
|
if(!(*pClientToScreen)(hWnd, &UpLeft)) return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
// if the main window coordinates are still valid updates the window placement values
|
||||||
|
|
||||||
void dxwCore::UpdateDesktopCoordinates()
|
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);
|
OutTraceB("dxwCore::UpdateDesktopCoordinates: NEW pos=(%d,%d) size=(%dx%d)\n", iPosX, iPosY, iSizX, iSizY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GetScreenRect: returns a RECT sized as the virtual desktop
|
// GetScreenRect: returns a RECT sized as the virtual desktop
|
||||||
|
|
||||||
RECT dxwCore::GetScreenRect()
|
RECT dxwCore::GetScreenRect()
|
||||||
@ -346,7 +347,8 @@ void dxwCore::GetMonitorWorkarea(LPRECT lpRect, BOOL WorkArea)
|
|||||||
MonitorId = -1;
|
MonitorId = -1;
|
||||||
GetMonitorWorkarea(lpRect, WorkArea);
|
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
|
// 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;
|
int MaxX, MaxY;
|
||||||
HMENU hMenu;
|
HMENU hMenu;
|
||||||
|
|
||||||
switch(dxw.Coordinates){
|
switch(Coordinates){
|
||||||
case DXW_DESKTOP_CENTER:
|
case DXW_DESKTOP_CENTER:
|
||||||
if(bAutoScale){
|
if(bAutoScale){
|
||||||
MaxX = GetScreenWidth();
|
MaxX = GetScreenWidth();
|
||||||
@ -381,8 +383,8 @@ void dxwCore::CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWP
|
|||||||
if(dxw.dwFlags4 & BILINEAR2XFILTER) MaxY <<= 1; // double
|
if(dxw.dwFlags4 & BILINEAR2XFILTER) MaxY <<= 1; // double
|
||||||
}
|
}
|
||||||
dxw.GetMonitorWorkarea(&desktop, TRUE);
|
dxw.GetMonitorWorkarea(&desktop, TRUE);
|
||||||
rect.left = (desktop.right - desktop.left - MaxX) / 2;
|
rect.left = (desktop.right + desktop.left - MaxX) / 2; // v2.03.89 - fixed
|
||||||
rect.top = (desktop.bottom - desktop.top - MaxY) / 2;
|
rect.top = (desktop.bottom + desktop.top - MaxY) / 2; // v2.03.89 - fixed
|
||||||
rect.right = rect.left + MaxX;
|
rect.right = rect.left + MaxX;
|
||||||
rect.bottom = rect.top + MaxY; //v2.02.09
|
rect.bottom = rect.top + MaxY; //v2.02.09
|
||||||
// fixed ....
|
// fixed ....
|
||||||
@ -425,6 +427,8 @@ void dxwCore::CalculateWindowPos(HWND hwnd, DWORD width, DWORD height, LPWINDOWP
|
|||||||
rect.bottom = iPosY + MaxY; //v2.02.09
|
rect.bottom = iPosY + MaxY; //v2.02.09
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
OutTraceB("dxwCore::CalculateWindowPos: coord=%d client rect=(%d,%d)-(%d,%d)\n",
|
||||||
|
Coordinates, rect.left, rect.top, rect.right, rect.bottom);
|
||||||
|
|
||||||
if(hwnd){
|
if(hwnd){
|
||||||
RECT UnmappedRect;
|
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
|
// update the arguments for the window creation
|
||||||
wp->x=rect.left;
|
wp->x=rect.left;
|
||||||
wp->y=rect.top;
|
wp->y=rect.top;
|
||||||
|
@ -1557,4 +1557,17 @@ void dxwCore::ToggleFreezedTime()
|
|||||||
TimeFreeze = !TimeFreeze;
|
TimeFreeze = !TimeFreeze;
|
||||||
dwLastTime = (*pGetTickCount)();
|
dwLastTime = (*pGetTickCount)();
|
||||||
OutTraceDW("DxWnd: time is %s\n", dxw.TimeFreeze ? "freezed" : "unfreezed");
|
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 FixNCHITCursorPos(LPPOINT);
|
||||||
void SetClipCursor(void);
|
void SetClipCursor(void);
|
||||||
void EraseClipCursor(void);
|
void EraseClipCursor(void);
|
||||||
|
BOOL IsValidMainWindow();
|
||||||
RECT MapWindowRect(LPRECT);
|
RECT MapWindowRect(LPRECT);
|
||||||
RECT MapWindowRect(void);
|
RECT MapWindowRect(void);
|
||||||
RECT MapClientRect(LPRECT);
|
RECT MapClientRect(LPRECT);
|
||||||
@ -105,7 +106,7 @@ public: // methods
|
|||||||
void GetSystemTimeAsFileTime(LPFILETIME);
|
void GetSystemTimeAsFileTime(LPFILETIME);
|
||||||
DWORD StretchTime(DWORD);
|
DWORD StretchTime(DWORD);
|
||||||
DWORD StretchCounter(DWORD);
|
DWORD StretchCounter(DWORD);
|
||||||
LARGE_INTEGER dxwCore::StretchCounter(LARGE_INTEGER);
|
LARGE_INTEGER StretchCounter(LARGE_INTEGER);
|
||||||
void ShowOverlay();
|
void ShowOverlay();
|
||||||
void ShowOverlay(HDC);
|
void ShowOverlay(HDC);
|
||||||
void ShowOverlay(HDC, int, int);
|
void ShowOverlay(HDC, int, int);
|
||||||
@ -144,6 +145,7 @@ public: // methods
|
|||||||
void ToggleFreezedTime();
|
void ToggleFreezedTime();
|
||||||
void GetMonitorWorkarea(LPRECT, BOOL);
|
void GetMonitorWorkarea(LPRECT, BOOL);
|
||||||
void CalculateWindowPos(HWND, DWORD, DWORD, LPWINDOWPOS);
|
void CalculateWindowPos(HWND, DWORD, DWORD, LPWINDOWPOS);
|
||||||
|
void MessagePump(void);
|
||||||
|
|
||||||
public: // simple data variables
|
public: // simple data variables
|
||||||
int MonitorId;
|
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"
|
#include "TlHelp32.h"
|
||||||
|
|
||||||
#define VERSION "2.03.88.fix1"
|
#define VERSION "2.03.89"
|
||||||
|
|
||||||
#define DDTHREADLOCK 1
|
#define DDTHREADLOCK 1
|
||||||
//#define LOCKTHREADS
|
//#define LOCKTHREADS
|
||||||
|
Binary file not shown.
@ -562,6 +562,10 @@
|
|||||||
RelativePath=".\hddraw.h"
|
RelativePath=".\hddraw.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\logall.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\msvfwhook.h"
|
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",
|
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));
|
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){
|
if (dxw.dwFlags1 & PREVENTMAXIMIZE){
|
||||||
int UpdFlag = 0;
|
int UpdFlag = 0;
|
||||||
WINDOWPOS MaxPos;
|
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);
|
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())){
|
if ((dxw.dwFlags1 & LOCKWINPOS) && dxw.IsFullScreen() && (hwnd==dxw.GethWnd())){
|
||||||
dxw.CalculateWindowPos(hwnd, MaxX, MaxY, wp);
|
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);
|
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
|
// v2.03.53: revised code, logic moved to IsFullscreenWindow
|
||||||
|
|
||||||
if(isNewDesktop=IsFullscreenWindow(lpClassName, dwStyle, dwExStyle, hWndParent, x, y, nWidth, nHeight)){
|
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 already in fullscreen mode, save previous settings
|
||||||
if(dxw.IsFullScreen() && dxw.GethWnd()){
|
if(dxw.IsFullScreen() && dxw.GethWnd()){
|
||||||
hLastFullScrWin = dxw.GethWnd();
|
hLastFullScrWin = dxw.GethWnd();
|
||||||
@ -1559,25 +1557,14 @@ static HWND WINAPI CreateWindowCommon(
|
|||||||
// inserted some checks here, since the main window could be destroyed
|
// inserted some checks here, since the main window could be destroyed
|
||||||
// or minimized (see "Jedi Outcast") so that you may get a dangerous
|
// 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.
|
// zero size. In this case, better renew the hWnd assignement and its coordinates.
|
||||||
do { // fake loop
|
isValidHandle = dxw.IsValidMainWindow();
|
||||||
isValidHandle = FALSE;
|
if (!(dwStyle & WS_CHILD) || (dxw.IsRealDesktop(hWndParent))){
|
||||||
if (!(*pGetClientRect)(dxw.GethWnd(),&screen)) break;
|
x=dxw.iPosX;
|
||||||
if (!(*pClientToScreen)(dxw.GethWnd(),&upleft)) break;
|
y=dxw.iPosY;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
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);
|
dxw.SetFullScreen(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1593,7 +1580,7 @@ static HWND WINAPI CreateWindowCommon(
|
|||||||
// from here on, fullscreen is garanteed
|
// from here on, fullscreen is garanteed
|
||||||
|
|
||||||
if(!isNewDesktop){
|
if(!isNewDesktop){
|
||||||
if (dwStyle & WS_CHILD){
|
if ((dwStyle & WS_CHILD) && !dxw.IsRealDesktop(hWndParent)){
|
||||||
// tested on Gangsters: coordinates must be window-relative!!!
|
// tested on Gangsters: coordinates must be window-relative!!!
|
||||||
// Age of Empires....
|
// Age of Empires....
|
||||||
dxw.MapClient(&x, &y, &nWidth, &nHeight);
|
dxw.MapClient(&x, &y, &nWidth, &nHeight);
|
||||||
@ -1601,15 +1588,13 @@ static HWND WINAPI CreateWindowCommon(
|
|||||||
ApiName, x, y, nWidth, nHeight);
|
ApiName, x, y, nWidth, nHeight);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((dwExStyle & WS_EX_CONTROLPARENT) || (dwStyle & WS_POPUP)){
|
// needed for "Diablo", that creates a new WS_EX_CONTROLPARENT window that must be
|
||||||
// needed for "Diablo", that creates a new WS_EX_CONTROLPARENT window that must be
|
// overlapped to the directdraw surface.
|
||||||
// overlapped to the directdraw surface.
|
// needed for "Riven", that creates a new WS_POPUP window with the menu bar that must be
|
||||||
// needed for "Riven", that creates a new WS_POPUP window with the menu bar that must be
|
// overlapped to the directdraw surface.
|
||||||
// overlapped to the directdraw surface.
|
dxw.MapWindow(&x, &y, &nWidth, &nHeight);
|
||||||
dxw.MapWindow(&x, &y, &nWidth, &nHeight);
|
OutTraceDW("%s: fixed ABSOLUTE pos=(%d,%d) size=(%d,%d)\n",
|
||||||
OutTraceDW("%s: fixed pos=(%d,%d) size=(%d,%d)\n",
|
ApiName, x, y, nWidth, nHeight);
|
||||||
ApiName, x, y, nWidth, nHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1628,6 +1613,7 @@ static HWND WINAPI CreateWindowCommon(
|
|||||||
|
|
||||||
if (dwExStyle & WS_EX_CONTROLPARENT) hControlParentWnd=hwnd;
|
if (dwExStyle & WS_EX_CONTROLPARENT) hControlParentWnd=hwnd;
|
||||||
|
|
||||||
|
// replace the invalid main win with the new one
|
||||||
if ((!isValidHandle) && dxw.IsFullScreen()){
|
if ((!isValidHandle) && dxw.IsFullScreen()){
|
||||||
dxw.SethWnd(hwnd);
|
dxw.SethWnd(hwnd);
|
||||||
extern void AdjustWindowPos(HWND, DWORD, DWORD);
|
extern void AdjustWindowPos(HWND, DWORD, DWORD);
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
#define EMULATEJOY TRUE
|
#define EMULATEJOY TRUE
|
||||||
#define INVERTJOYAXIS TRUE
|
#define INVERTJOYAXIS TRUE
|
||||||
|
|
||||||
|
// #include "logall.h" // comment when not debugging
|
||||||
|
|
||||||
BOOL IsWithinMCICall = FALSE;
|
BOOL IsWithinMCICall = FALSE;
|
||||||
|
|
||||||
typedef MCIDEVICEID (WINAPI *mciGetDeviceIDA_Type)(LPCTSTR);
|
typedef MCIDEVICEID (WINAPI *mciGetDeviceIDA_Type)(LPCTSTR);
|
||||||
@ -32,6 +34,9 @@ MMRESULT WINAPI extjoyGetDevCapsA(DWORD, LPJOYCAPS, UINT);
|
|||||||
typedef MMRESULT (WINAPI *joyGetPosEx_Type)(DWORD, LPJOYINFOEX);
|
typedef MMRESULT (WINAPI *joyGetPosEx_Type)(DWORD, LPJOYINFOEX);
|
||||||
joyGetPosEx_Type pjoyGetPosEx = NULL;
|
joyGetPosEx_Type pjoyGetPosEx = NULL;
|
||||||
MMRESULT WINAPI extjoyGetPosEx(DWORD, LPJOYINFOEX);
|
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);
|
typedef MMRESULT (WINAPI *auxGetNumDevs_Type)(void);
|
||||||
auxGetNumDevs_Type pauxGetNumDevs = NULL;
|
auxGetNumDevs_Type pauxGetNumDevs = NULL;
|
||||||
MMRESULT WINAPI extauxGetNumDevs(void);
|
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, "joyGetNumDevs", NULL, (FARPROC *)&pjoyGetNumDevs, (FARPROC)extjoyGetNumDevs},
|
||||||
{HOOK_IAT_CANDIDATE, 0, "joyGetDevCapsA", NULL, (FARPROC *)&pjoyGetDevCapsA, (FARPROC)extjoyGetDevCapsA},
|
{HOOK_IAT_CANDIDATE, 0, "joyGetDevCapsA", NULL, (FARPROC *)&pjoyGetDevCapsA, (FARPROC)extjoyGetDevCapsA},
|
||||||
{HOOK_IAT_CANDIDATE, 0, "joyGetPosEx", NULL, (FARPROC *)&pjoyGetPosEx, (FARPROC)extjoyGetPosEx},
|
{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
|
{HOOK_IAT_CANDIDATE, 0, 0, NULL, 0, 0} // terminator
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -211,7 +217,7 @@ MCIERROR WINAPI extmciSendCommand(mciSendCommand_Type pmciSendCommand, MCIDEVICE
|
|||||||
switch(uMsg){
|
switch(uMsg){
|
||||||
case MCI_STATUS:
|
case MCI_STATUS:
|
||||||
MCI_STATUS_PARMS *p = (MCI_STATUS_PARMS *)dwParam;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,9 +332,9 @@ MMRESULT WINAPI extjoyGetDevCapsA(DWORD uJoyID, LPJOYCAPS pjc, UINT cbjc)
|
|||||||
// set Joystick capability structure
|
// set Joystick capability structure
|
||||||
memset(pjc, 0, sizeof(JOYCAPS));
|
memset(pjc, 0, sizeof(JOYCAPS));
|
||||||
strncpy(pjc->szPname, "DxWnd Joystick Emulator", MAXPNAMELEN);
|
strncpy(pjc->szPname, "DxWnd Joystick Emulator", MAXPNAMELEN);
|
||||||
pjc->wXmin = 0;
|
pjc->wXmin = -XSPAN;
|
||||||
pjc->wXmax = XSPAN;
|
pjc->wXmax = XSPAN;
|
||||||
pjc->wYmin = 0;
|
pjc->wYmin = -YSPAN;
|
||||||
pjc->wYmax = YSPAN;
|
pjc->wYmax = YSPAN;
|
||||||
pjc->wNumButtons = 2;
|
pjc->wNumButtons = 2;
|
||||||
pjc->wMaxButtons = 2;
|
pjc->wMaxButtons = 2;
|
||||||
@ -341,11 +347,11 @@ MMRESULT WINAPI extjoyGetDevCapsA(DWORD uJoyID, LPJOYCAPS pjc, UINT cbjc)
|
|||||||
return JOYERR_NOERROR;
|
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;
|
if(uJoyID != 0) return JOYERR_PARMS;
|
||||||
LONG x, y;
|
LONG x, y, CenterX, CenterY;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
DWORD dwButtons;
|
DWORD dwButtons;
|
||||||
static BOOL bJoyLock = FALSE;
|
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_LBUTTON) < 0) dwButtons |= JOY_BUTTON1;
|
||||||
if (GetKeyState(VK_RBUTTON) < 0) dwButtons |= JOY_BUTTON2;
|
if (GetKeyState(VK_RBUTTON) < 0) dwButtons |= JOY_BUTTON2;
|
||||||
if (GetKeyState(VK_MBUTTON) < 0) dwButtons |= JOY_BUTTON3;
|
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(dwButtons == JOY_BUTTON3){
|
||||||
if(((*pGetTickCount)() - dwLastClick) > 200){
|
if(((*pGetTickCount)() - dwLastClick) > 200){
|
||||||
@ -365,8 +371,10 @@ MMRESULT WINAPI extjoyGetPosEx(DWORD uJoyID, LPJOYINFOEX pji)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x=(XSPAN>>1);
|
// default: centered position
|
||||||
y=(YSPAN>>1);
|
x=0;
|
||||||
|
y=0;
|
||||||
|
// get cursor position and map it to virtual joystick x,y axis
|
||||||
if(hwnd=dxw.GethWnd()){
|
if(hwnd=dxw.GethWnd()){
|
||||||
POINT pt;
|
POINT pt;
|
||||||
RECT client;
|
RECT client;
|
||||||
@ -379,43 +387,60 @@ MMRESULT WINAPI extjoyGetPosEx(DWORD uJoyID, LPJOYINFOEX pji)
|
|||||||
if(bJoyLock || !dxw.bActive){
|
if(bJoyLock || !dxw.bActive){
|
||||||
// when the joystick is "locked" (bJoyLock) or when the window lost focus
|
// when the joystick is "locked" (bJoyLock) or when the window lost focus
|
||||||
// (dxw.bActive == FALSE) place the joystick in the central position
|
// (dxw.bActive == FALSE) place the joystick in the central position
|
||||||
OutTraceB("joyGetPosEx: CENTERED lock=%x active=%x\n", bJoyLock, dxw.bActive);
|
OutTraceB("%s: CENTERED lock=%x active=%x\n", apiname, bJoyLock, dxw.bActive);
|
||||||
x=(XSPAN>>1);
|
x=0;
|
||||||
y=(YSPAN>>1);
|
y=0;
|
||||||
pt.x = client.right >> 1;
|
pt.x = client.right >> 1;
|
||||||
pt.y = client.bottom >> 1;
|
pt.y = client.bottom >> 1;
|
||||||
dwButtons = JOY_BUTTON3;
|
dwButtons = JOY_BUTTON3;
|
||||||
}
|
}
|
||||||
else{
|
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.left) pt.x = client.left;
|
||||||
if(pt.x > client.right) pt.x = client.right;
|
if(pt.x > client.right) pt.x = client.right;
|
||||||
if(pt.y < client.top) pt.y = client.top;
|
if(pt.y < client.top) pt.y = client.top;
|
||||||
if(pt.y > client.bottom) pt.y = client.bottom;
|
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)
|
if(INVERTJOYAXIS)
|
||||||
y = ((client.bottom - pt.y) * YSPAN) / client.bottom; // inverted y axis
|
y = ((CenterY - pt.y) * YSPAN) / client.bottom; // inverted y axis
|
||||||
else
|
else
|
||||||
y = (pt.y * YSPAN) / client.bottom;
|
y = ((pt.y - CenterY) * YSPAN) / client.bottom;
|
||||||
}
|
}
|
||||||
ShowJoystick(pt.x, pt.y, dwButtons);
|
ShowJoystick(pt.x, pt.y, dwButtons);
|
||||||
}
|
}
|
||||||
else {
|
lpj->wXpos = x;
|
||||||
x=(XSPAN>>1);
|
lpj->wYpos = y;
|
||||||
y=(YSPAN>>1);
|
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));
|
memset(pji, 0, sizeof(JOYINFOEX));
|
||||||
pji->dwSize = sizeof(JOYINFOEX);
|
pji->dwSize = sizeof(JOYINFOEX);
|
||||||
pji->dwFlags = 0;
|
pji->dwFlags = 0;
|
||||||
pji->dwXpos = x;
|
pji->dwXpos = jinfo.wXpos;
|
||||||
pji->dwYpos = y;
|
pji->dwYpos = jinfo.wYpos;
|
||||||
pji->dwButtons = dwButtons;
|
pji->dwButtons = jinfo.wButtons;
|
||||||
pji->dwFlags = JOY_RETURNX|JOY_RETURNY|JOY_RETURNBUTTONS;
|
pji->dwFlags = JOY_RETURNX|JOY_RETURNY|JOY_RETURNBUTTONS;
|
||||||
|
|
||||||
OutTraceC("joyGetPosEx: joyid=%d pos=(%d,%d)\n", uJoyID, pji->dwXpos, pji->dwYpos);
|
return res;
|
||||||
return JOYERR_NOERROR;
|
}
|
||||||
|
|
||||||
|
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)
|
static void ShowJoystick(LONG x, LONG y, DWORD dwButtons)
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user