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

v2_03_47_src

Former-commit-id: e4b6b7411e1b0780c84eb8e6d028ac3ac965eeb5
This commit is contained in:
gho tik 2015-11-22 11:42:31 -05:00 committed by Refael ACkermann
parent 06026c6ab2
commit 11aace665a
31 changed files with 431 additions and 98 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:58d53ae35a2c6ed0abd1628c80eebf170d591eb9b2a840f79b3a0507813048c9 oid sha256:4ba9b297fe64848f5b2fc2ec464edf523c15537cec300708587e072b69b6d175
size 619520 size 622080

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:bfcf831bd510bb48aaef99c2469d1627a11d73ea4c4c50c765e257ab30b38f7e oid sha256:bd5ee4d4d589d7580de254177665f34b2c8ead891982d3700123f29cecc90cc3
size 546304 size 546304

64
build/dxwnd.ini Normal file
View File

@ -0,0 +1,64 @@
[window]
posx=1313
posy=581
sizx=320
sizy=200
lang=default
exepath=D:\Games\Kasbrik\
;lang=automatic
;updatepaths=1
;debug=1
;multiprocesshook=0
;checkadmin=0
[texture]
MinTexX=16
MaxTexX=0
MinTexY=16
MaxTexY=0
[keymapping]
timetoggle=0x72
altf4=0x73
timeslow=0x74
timefast=0x75
cliptoggle=
refresh=
logtoggle=
plocktoggle=
fpstoggle=
printscreen=0x7B
corner=0x7A
freezetime=0x79
[target]
title0=Kasbrik 3D
path0=D:\Games\Kasbrik\Kasbrik.exe
launchpath0=
module0=
opengllib0=
notes0=
registry0=
ver0=8
coord0=0
flag0=136314914
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
flagk0=327680
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -13,7 +13,7 @@ flagg0=1209008128
flagh0=20 flagh0=20
flagi0=138412036 flagi0=138412036
flagj0=4224 flagj0=4224
flagk0=327680 flagk0=344064
tflag0=0 tflag0=0
initx0=0 initx0=0
inity0=0 inity0=0

View File

@ -0,0 +1,32 @@
[target]
title0=Kasbrik 3D
path0=D:\Games\Kasbrik\Kasbrik.exe
launchpath0=
module0=
opengllib0=
notes0=
registry0=
ver0=8
coord0=0
flag0=136315426
flagg0=1275068416
flagh0=20
flagi0=138412036
flagj0=4224
flagk0=268763136
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=800
maxy0=600
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,32 @@
[target]
title0=Les adventures de Robby le Robot - Mission Code de la route
path0=D:\Games\Robby Robot\VISION.EXE
launchpath0=
module0=
opengllib0=
notes0=
registry0=
ver0=0
coord0=0
flag0=136314914
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
flagk0=327680
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,32 @@
[target]
title0=Snowmobile Racing
path0=D:\Games\Snowmobile Racing\snow.exe
launchpath0=
module0=
opengllib0=
notes0=
registry0=
ver0=0
coord0=0
flag0=681574434
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
flagk0=327680
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,32 @@
[target]
title0=Space Hulk
path0=D:\Games\Space Hulk\HULKDATA\BIN\HULKW95.EXE
launchpath0=
module0=
opengllib0=
notes0=Beware: this game requirestheat the executable HULKW95.EXE, \nlocated in the HULKDATA\BIN subfolder, is run from the root directory.\nTo do so, it is necessary to create a task shortcut and ru the game from there,\nrunning the game from DxWnd is not working.
registry0=
ver0=0
coord0=0
flag0=140509218
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=5248
flagk0=327680
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,32 @@
[target]
title0=Star Wars X-Wing Alliance (GOG)
path0=D:\Games\Star Wars - X-Wing Alliance (GOG)\XWINGALLIANCE.EXE
launchpath0=
module0=
opengllib0=
notes0=
registry0=
ver0=0
coord0=0
flag0=136314930
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4224
flagk0=1476722688
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=800
maxy0=600
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -12,7 +12,7 @@ flag0=136314930
flagg0=1207959552 flagg0=1207959552
flagh0=20 flagh0=20
flagi0=138412036 flagi0=138412036
flagj0=1073746048 flagj0=1074794624
flagk0=402980864 flagk0=402980864
tflag0=0 tflag0=0
initx0=0 initx0=0

View File

@ -0,0 +1,32 @@
[target]
title0=Star Wars X-Wing vs. Tie-Fighter (GOG)
path0=D:\Games\Star Wars - XvT\Z_XVT__.EXE
launchpath0=
module0=
opengllib0=
notes0=
registry0=
ver0=0
coord0=0
flag0=136314930
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=67113088
flagk0=939589632
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=800
maxy0=600
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -0,0 +1,32 @@
[target]
title0=Ultim@te Race Pro
path0=D:\Games\Ultim@te Race Pro\ULTIM@TE RACE PRO.EXE
launchpath0=
module0=
opengllib0=
notes0=
registry0=
ver0=0
coord0=0
flag0=681574434
flagg0=1207959552
flagh0=20
flagi0=138412036
flagj0=4736
flagk0=327680
tflag0=0
initx0=0
inity0=0
minx0=0
miny0=0
maxx0=0
maxy0=0
posx0=50
posy0=50
sizx0=800
sizy0=600
maxfps0=0
initts0=0
winver0=0
maxres0=-1
swapeffect0=0

View File

@ -974,3 +974,10 @@ add: added compatibility options "Hook GOG libs" and "Byass GOG libs" to manage
add: added "Enable Time Freeze" timing option and the virtual key "freezetime" add: added "Enable Time Freeze" timing option and the virtual key "freezetime"
add: command line option /E to terminate exixting DxWnd session add: command line option /E to terminate exixting DxWnd session
fix: relocation of WS_POPUP windows. Fixes "Riven" menu window. fix: relocation of WS_POPUP windows. Fixes "Riven" menu window.
v2.03.47
add: added handling of DirectInput8 dinput8.dll
fix: completely revised directinput hooking to manage multiple devices acquire/unacquire
fix: added some dinput error codes to log messages
fix: increased time freeze toggle key hysteresis time to 1 sec to avoid multiple activations

View File

@ -9,6 +9,13 @@
#include "syslibs.h" #include "syslibs.h"
#include "dxhelper.h" #include "dxhelper.h"
#ifndef DIDEVTYPE_MOUSE
#define DIDEVTYPE_DEVICE 1
#define DIDEVTYPE_MOUSE 2
#define DIDEVTYPE_KEYBOARD 3
#define DIDEVTYPE_JOYSTICK 4
#endif
typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID, LPVOID *); typedef HRESULT (WINAPI *QueryInterface_Type)(void *, REFIID, LPVOID *);
typedef HRESULT (WINAPI *DirectInputCreate_Type)(HINSTANCE, DWORD, LPDIRECTINPUT *, LPUNKNOWN); typedef HRESULT (WINAPI *DirectInputCreate_Type)(HINSTANCE, DWORD, LPDIRECTINPUT *, LPUNKNOWN);
typedef HRESULT (WINAPI *DirectInputCreateEx_Type)(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN); typedef HRESULT (WINAPI *DirectInputCreateEx_Type)(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN);
@ -78,7 +85,11 @@ int iCurMinY;
int iCurMaxX; int iCurMaxX;
int iCurMaxY; int iCurMaxY;
void HookDirectInput(HMODULE module, int version) LPDIRECTINPUTDEVICE lpDIDKeyboard = NULL;
LPDIRECTINPUTDEVICE lpDIDSysMouse = NULL;
LPDIRECTINPUTDEVICE lpDIDJoystick = NULL;
void HookDirectInput(HMODULE module)
{ {
const GUID di7 = {0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE}; const GUID di7 = {0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE};
HINSTANCE hinst; HINSTANCE hinst;
@ -98,7 +109,7 @@ void HookDirectInput(HMODULE module, int version)
} }
} }
void HookDirectInput8(HMODULE module, int version) void HookDirectInput8(HMODULE module)
{ {
const GUID di8 = {0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00}; const GUID di8 = {0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00};
HINSTANCE hinst; HINSTANCE hinst;
@ -114,51 +125,6 @@ void HookDirectInput8(HMODULE module, int version)
} }
} }
#if 0
int HookDirectInput(HMODULE module, int version)
{
HINSTANCE hinst;
void *tmp;
LPDIRECTINPUT lpdi;
const GUID di7 = {0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE};
const GUID di8 = {0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00};
tmp = HookAPI(module, "dinput.dll", NULL, "DirectInputCreateA", extDirectInputCreateA);
if(tmp) pDirectInputCreateA = (DirectInputCreate_Type)tmp;
tmp = HookAPI(module, "dinput.dll", NULL, "DirectInputCreateW", extDirectInputCreateW);
if(tmp) pDirectInputCreateW = (DirectInputCreate_Type)tmp;
tmp = HookAPI(module, "dinput.dll", NULL, "DirectInputCreateEx", extDirectInputCreateEx);
if(tmp) pDirectInputCreateEx = (DirectInputCreateEx_Type)tmp;
tmp = HookAPI(module, "dinput8.dll", NULL, "DirectInput8Create", extDirectInput8Create);
if(tmp) pDirectInputCreateEx = (DirectInputCreateEx_Type)tmp;
if(!pDirectInputCreateA && !pDirectInputCreateW && !pDirectInputCreateEx){
if(version < 8){
hinst = LoadLibrary("dinput.dll");
pDirectInputCreateA =
(DirectInputCreate_Type)GetProcAddress(hinst, "DirectInputCreateA");
if(pDirectInputCreateA)
if(!extDirectInputCreateA(GetModuleHandle(0), DIRECTINPUT_VERSION,
&lpdi, 0)) lpdi->Release();
pDirectInputCreateEx =
(DirectInputCreateEx_Type)GetProcAddress(hinst, "DirectInputCreateEx");
if(pDirectInputCreateEx)
if(!extDirectInputCreateEx(GetModuleHandle(0), DIRECTINPUT_VERSION,
di7, (void **)&lpdi, 0)) lpdi->Release();
}
else{
hinst = LoadLibrary("dinput8.dll");
pDirectInputCreateEx =
(DirectInputCreateEx_Type)GetProcAddress(hinst, "DirectInput8Create");
if(pDirectInputCreateEx)
if(!extDirectInputCreateEx(GetModuleHandle(0), DIRECTINPUT_VERSION,
di8, (void **)&lpdi, 0)) lpdi->Release();
}
}
if(pDirectInputCreateA || pDirectInputCreateW || pDirectInputCreateEx) return 1;
return 0;
}
#endif
FARPROC Remap_DInput_ProcAddress(LPCSTR proc, HMODULE hModule) FARPROC Remap_DInput_ProcAddress(LPCSTR proc, HMODULE hModule)
{ {
FARPROC addr; FARPROC addr;
@ -173,7 +139,6 @@ FARPROC Remap_DInput8_ProcAddress(LPCSTR proc, HMODULE hModule)
return NULL; return NULL;
} }
static char *libname = "dsound.dll";
HRESULT WINAPI extDirectInputCreate(HINSTANCE hinst, HRESULT WINAPI extDirectInputCreate(HINSTANCE hinst,
DWORD dwversion, LPDIRECTINPUT *lplpdi, LPUNKNOWN pu, DirectInputCreate_Type pDirectInputCreate, char *apiname) DWORD dwversion, LPDIRECTINPUT *lplpdi, LPUNKNOWN pu, DirectInputCreate_Type pDirectInputCreate, char *apiname)
{ {
@ -256,14 +221,13 @@ HRESULT WINAPI extDirectInput8Create(HINSTANCE hinst, DWORD dwversion, REFIID ri
} }
OutTraceDW("DirectInput8Create: di=%x\n", *ppvout); OutTraceDW("DirectInput8Create: di=%x\n", *ppvout);
SetHook((void *)(**(DWORD **)ppvout + 12), extDICreateDevice, (void **)&pDICreateDevice, "CreateDevice(I8)"); SetHook((void *)(**(DWORD **)ppvout + 12), extDICreateDevice, (void **)&pDICreateDevice, "CreateDevice(I8)");
SetHook((void *)(**(DWORD **)ppvout + 16), extDIEnumDevices, (void **)&pDIEnumDevices, "EnumDevices(I8)");
return 0; return 0;
} }
HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPUTDEVICE *lplpdid, LPUNKNOWN pu) static char *sDeviceType(REFGUID rguid)
{ {
HRESULT res;
char *devtype; char *devtype;
switch(rguid.Data1){ switch(rguid.Data1){
case 0x6F1D2B60: devtype = "SysMouse"; break; case 0x6F1D2B60: devtype = "SysMouse"; break;
case 0x6F1D2B61: devtype = "SysKeyboard"; break; case 0x6F1D2B61: devtype = "SysKeyboard"; break;
@ -274,7 +238,26 @@ HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPU
case 0x6F1D2B83: devtype = "SysKeyboardEm2"; break; case 0x6F1D2B83: devtype = "SysKeyboardEm2"; break;
default: devtype = "Unknown"; break; default: devtype = "Unknown"; break;
} }
OutTraceDW("CreateDevice(I): REFGUID=%x(%s)\n", rguid.Data1, devtype); return devtype;
}
static int iDeviceType(REFGUID rguid)
{
int devtype;
switch(rguid.Data1){
case 0x6F1D2B60: devtype = DIDEVTYPE_MOUSE; break;
case 0x6F1D2B61: devtype = DIDEVTYPE_KEYBOARD; break;
case 0x6F1D2B70: devtype = DIDEVTYPE_JOYSTICK; break;
default: devtype = 0; break;
}
return devtype;
}
HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPUTDEVICE *lplpdid, LPUNKNOWN pu)
{
HRESULT res;
OutTraceDW("CreateDevice(I): REFGUID=%x(%s)\n", rguid.Data1, sDeviceType(rguid));
res = (*pDICreateDevice)(lpdi, rguid, lplpdid, pu); res = (*pDICreateDevice)(lpdi, rguid, lplpdid, pu);
if(res) { if(res) {
@ -288,7 +271,13 @@ HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPU
SetHook((void *)(**(DWORD **)lplpdid + 40), extGetDeviceData, (void **)&pGetDeviceData, "GetDeviceData(I)"); SetHook((void *)(**(DWORD **)lplpdid + 40), extGetDeviceData, (void **)&pGetDeviceData, "GetDeviceData(I)");
SetHook((void *)(**(DWORD **)lplpdid + 44), extSetDataFormat, (void **)&pSetDataFormat, "SetDataFormat(I)"); SetHook((void *)(**(DWORD **)lplpdid + 44), extSetDataFormat, (void **)&pSetDataFormat, "SetDataFormat(I)");
SetHook((void *)(**(DWORD **)lplpdid + 52), extDISetCooperativeLevel, (void **)&pDISetCooperativeLevel, "SetCooperativeLevel(I)"); SetHook((void *)(**(DWORD **)lplpdid + 52), extDISetCooperativeLevel, (void **)&pDISetCooperativeLevel, "SetCooperativeLevel(I)");
return 0;
switch(iDeviceType(rguid)){
case DIDEVTYPE_MOUSE: lpDIDSysMouse = *lplpdid; break;
case DIDEVTYPE_KEYBOARD: lpDIDKeyboard = *lplpdid; break;
case DIDEVTYPE_JOYSTICK: lpDIDJoystick = *lplpdid; break;
}
return DI_OK;
} }
HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid, HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid,
@ -296,7 +285,7 @@ HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid,
{ {
HRESULT res; HRESULT res;
OutTraceDW("CreateDeviceEx(I): GUID=%x REFIID=%x\n", rguid.Data1, riid.Data1); OutTraceDW("CreateDeviceEx(I): GUID=%x(%s) REFIID=%x\n", rguid.Data1, sDeviceType(rguid), riid.Data1);
res = (*pDICreateDeviceEx)(lpdi, rguid, riid, pvout, pu); res = (*pDICreateDeviceEx)(lpdi, rguid, riid, pvout, pu);
if(res) { if(res) {
@ -310,7 +299,13 @@ HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid,
SetHook((void *)(**(DWORD **)pvout + 40), extGetDeviceData, (void **)&pGetDeviceData, "GetDeviceData(I)"); SetHook((void *)(**(DWORD **)pvout + 40), extGetDeviceData, (void **)&pGetDeviceData, "GetDeviceData(I)");
SetHook((void *)(**(DWORD **)pvout + 44), extSetDataFormat, (void **)&pSetDataFormat, "SetDataFormat(I)"); SetHook((void *)(**(DWORD **)pvout + 44), extSetDataFormat, (void **)&pSetDataFormat, "SetDataFormat(I)");
SetHook((void *)(**(DWORD **)pvout + 52), extDISetCooperativeLevel, (void **)&pDISetCooperativeLevel, "SetCooperativeLevel(I)"); SetHook((void *)(**(DWORD **)pvout + 52), extDISetCooperativeLevel, (void **)&pDISetCooperativeLevel, "SetCooperativeLevel(I)");
return 0;
switch(iDeviceType(rguid)){
case DIDEVTYPE_MOUSE: lpDIDSysMouse = *(LPDIRECTINPUTDEVICE *)pvout; break;
case DIDEVTYPE_KEYBOARD: lpDIDKeyboard = *(LPDIRECTINPUTDEVICE *)pvout; break;
case DIDEVTYPE_JOYSTICK: lpDIDJoystick = *(LPDIRECTINPUTDEVICE *)pvout; break;
}
return DI_OK;
} }
/* from MSDN: /* from MSDN:
@ -343,9 +338,18 @@ HRESULT WINAPI extGetDeviceData(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPVOID
lpdid, cbdata, rgdod, *pdwinout, dwflags); lpdid, cbdata, rgdod, *pdwinout, dwflags);
res = (*pGetDeviceData)(lpdid, cbdata, rgdod, pdwinout, dwflags); res = (*pGetDeviceData)(lpdid, cbdata, rgdod, pdwinout, dwflags);
if(res) { switch(res){
OutTraceE("GetDeviceData(I) ERROR: err=%x(%s)\n", res, ExplainDDError(res)); case DI_OK:
return res; break;
case DIERR_NOTACQUIRED:
case DIERR_INPUTLOST:
OutTraceB("GetDeviceData(I): handling err=%s\n", ExplainDDError(res));
*pdwinout = 0; // to avoid crashes
break;
default:
OutTraceE("GetDeviceData(I) ERROR: err=%x(%s)\n", res, ExplainDDError(res));
return res;
break;
} }
if(!dxw.bActive) { if(!dxw.bActive) {
@ -399,9 +403,17 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO
OutTraceDW("GetDeviceState(I): did=%x cbData=%i,%i\n", lpdid, cbdata, dxw.bActive); OutTraceDW("GetDeviceState(I): did=%x cbData=%i,%i\n", lpdid, cbdata, dxw.bActive);
res = (*pGetDeviceState)(lpdid, cbdata, lpvdata); res = (*pGetDeviceState)(lpdid, cbdata, lpvdata);
if(res) { switch(res){
OutTraceE("GetDeviceState(I) ERROR: err=%x(%s)\n", res, ExplainDDError(res)); case DI_OK:
return res; break;
case DIERR_NOTACQUIRED:
case DIERR_INPUTLOST:
OutTraceB("GetDeviceState(I): handling err=%s\n", ExplainDDError(res));
break;
default:
OutTraceE("GetDeviceState(I) ERROR: err=%x(%s)\n", res, ExplainDDError(res));
return res;
break;
} }
if( cbdata == sizeof(DIMOUSESTATE) || cbdata == sizeof(DIMOUSESTATE2) if( cbdata == sizeof(DIMOUSESTATE) || cbdata == sizeof(DIMOUSESTATE2)
@ -424,23 +436,17 @@ HRESULT WINAPI extGetDeviceState(LPDIRECTINPUTDEVICE lpdid, DWORD cbdata, LPDIMO
lpvdata->lZ = 0; lpvdata->lZ = 0;
*(DWORD *)lpvdata->rgbButtons = 0; *(DWORD *)lpvdata->rgbButtons = 0;
} }
OutTraceB("GetDeviceState(I): DEBUG mousestate=(%d,%d)\n", p.x, p.y); OutTraceB("GetDeviceState(I): DEBUG cleared mousestate=(%d,%d)\n", p.x, p.y);
} }
if(cbdata == 256 && !dxw.bActive) ZeroMemory(lpvdata, 256); // SysKeybd device
if(cbdata == 256 && !dxw.bActive) {
ZeroMemory(lpvdata, 256);
OutTraceB("GetDeviceState(I): DEBUG cleared syskeybdstate\n");
}
return DI_OK; return DI_OK;
} }
//static char *dftype(LPCDIDATAFORMAT lpdf)
//{
// if(lpdf == &c_dfDIMouse) return "mouse";
// if(lpdf == &c_dfDIKeyboard) return "keyboard";
// if(lpdf == &c_dfDIMouse2) return "mouse2";
// if(lpdf == &c_dfDIJoystick) return "joy";
// if(lpdf == &c_dfDIJoystick2) return "joy2";
// return "custom";
//}
static char *didftype(DWORD c) static char *didftype(DWORD c)
{ {
static char eb[256]; static char eb[256];
@ -508,6 +514,7 @@ HRESULT WINAPI extDISetCooperativeLevel(LPDIRECTINPUTDEVICE lpdid, HWND hwnd, DW
if(dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd(); if(dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
//dwflags = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND; //dwflags = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
dwflags = DISCL_NONEXCLUSIVE | DISCL_FOREGROUND; dwflags = DISCL_NONEXCLUSIVE | DISCL_FOREGROUND;
hwnd=dxw.GethWnd(); hwnd=dxw.GethWnd();
res = (*pDISetCooperativeLevel)(lpdid, hwnd, dwflags); res = (*pDISetCooperativeLevel)(lpdid, hwnd, dwflags);
@ -578,29 +585,32 @@ HRESULT WINAPI extDIEnumDevices(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALL
return res; return res;
} }
LPDIRECTINPUTDEVICE lpDID = NULL;
HRESULT WINAPI extAcquire(LPDIRECTINPUTDEVICE lpdid) HRESULT WINAPI extAcquire(LPDIRECTINPUTDEVICE lpdid)
{ {
HRESULT res; HRESULT res;
lpDID = lpdid;
res = (*pAcquire)(lpdid); res = (*pAcquire)(lpdid);
OutTrace("Acquire(I): lpdid=%x res=%x\n", lpdid, res); OutTrace("Acquire(I): lpdid=%x res=%x(%s)\n", lpdid, res, ExplainDDError(res));
return res; return res;
} }
HRESULT WINAPI extUnacquire(LPDIRECTINPUTDEVICE lpdid) HRESULT WINAPI extUnacquire(LPDIRECTINPUTDEVICE lpdid)
{ {
HRESULT res; HRESULT res;
lpDID = lpdid;
res = (*pUnacquire)(lpdid); res = (*pUnacquire)(lpdid);
OutTrace("Unacquire(I): lpdid=%x res=%x\n", lpdid, res); OutTrace("Unacquire(I): lpdid=%x res=%x(%s)\n", lpdid, res, ExplainDDError(res));
return res; return res;
} }
void ToggleAcquiredDevices(BOOL flag) void ToggleAcquiredDevices(BOOL flag)
{ {
if (!lpDID) return; if(flag && pAcquire){
if(flag && pAcquire)(*pAcquire)(lpDID); if(lpDIDSysMouse) (*pAcquire)(lpDIDSysMouse);
if(!flag && pUnacquire)(*pUnacquire)(lpDID); if(lpDIDKeyboard) (*pAcquire)(lpDIDKeyboard);
if(lpDIDJoystick) (*pAcquire)(lpDIDJoystick);
}
if(!flag && pUnacquire){
if(lpDIDSysMouse) (*pUnacquire)(lpDIDSysMouse);
if(lpDIDKeyboard) (*pUnacquire)(lpDIDKeyboard);
if(lpDIDJoystick) (*pUnacquire)(lpDIDJoystick);
}
} }

View File

@ -1814,6 +1814,12 @@ char *ExplainDDError(DWORD c)
case D3DERR_CANNOTPROTECTCONTENT: eb="D3DERR_CANNOTPROTECTCONTENT"; break; case D3DERR_CANNOTPROTECTCONTENT: eb="D3DERR_CANNOTPROTECTCONTENT"; break;
case D3DERR_UNSUPPORTEDCRYPTO: eb="D3DERR_UNSUPPORTEDCRYPTO"; break; case D3DERR_UNSUPPORTEDCRYPTO: eb="D3DERR_UNSUPPORTEDCRYPTO"; break;
case D3DERR_PRESENT_STATISTICS_DISJOINT:eb="D3DERR_PRESENT_STATISTICS_DISJOINT"; break; case D3DERR_PRESENT_STATISTICS_DISJOINT:eb="D3DERR_PRESENT_STATISTICS_DISJOINT"; break;
// DINPUT errors
case DIERR_INPUTLOST: eb="DIERR_INPUTLOST"; break;
//case DIERR_INVALIDPARAM: eb="DIERR_INVALIDPARAM"; break;
case DIERR_NOTACQUIRED: eb="DIERR_NOTACQUIRED"; break;
case DIERR_NOTINITIALIZED: eb="DIERR_NOTINITIALIZED"; break;
case E_PENDING: eb="E_PENDING"; break;
default: eb="unknown"; break; default: eb="unknown"; break;
} }

View File

@ -852,7 +852,8 @@ void HookModule(HMODULE base, int dxversion)
if(dxw.dwFlags6 & HOOKGOGLIBS) HookWinMM(base, "win32.dll"); if(dxw.dwFlags6 & HOOKGOGLIBS) HookWinMM(base, "win32.dll");
//if(dxw.dwFlags2 & SUPPRESSIME) HookImeLib(module); //if(dxw.dwFlags2 & SUPPRESSIME) HookImeLib(module);
HookGDI32(base); HookGDI32(base);
if(dxw.dwFlags1 & HOOKDI) HookDirectInput(base, dxversion); if(dxw.dwFlags1 & HOOKDI) HookDirectInput(base);
if(dxw.dwFlags1 & HOOKDI8) HookDirectInput8(base);
if(dxw.dwTargetDDVersion != HOOKDDRAWNONE) HookDirectDraw(base, dxversion); if(dxw.dwTargetDDVersion != HOOKDDRAWNONE) HookDirectDraw(base, dxversion);
HookDirect3D(base, dxversion); HookDirect3D(base, dxversion);
HookDirect3D7(base, dxversion); HookDirect3D7(base, dxversion);

View File

@ -4,8 +4,8 @@ extern int HookDirect3D(HMODULE, int);
extern int HookDirect3D7(HMODULE, int); extern int HookDirect3D7(HMODULE, int);
extern void HookOle32(HMODULE); extern void HookOle32(HMODULE);
extern void HookGDI32(HMODULE); extern void HookGDI32(HMODULE);
extern void HookDirectInput(HMODULE, int); extern void HookDirectInput(HMODULE);
extern void HookDirectInput8(HMODULE, int); extern void HookDirectInput8(HMODULE);
extern void HookDirectSound(HMODULE); extern void HookDirectSound(HMODULE);
extern void HookImeLib(HMODULE); extern void HookImeLib(HMODULE);
extern void HookKernel32(HMODULE); extern void HookKernel32(HMODULE);

View File

@ -1214,7 +1214,7 @@ void dxwCore::GetSystemTime(LPSYSTEMTIME lpSystemTime)
dwTick=(dwCurrentTick-dwStartTick); dwTick=(dwCurrentTick-dwStartTick);
TimeShift=GetHookInfo()->TimeShift; TimeShift=GetHookInfo()->TimeShift;
dwTick = (*pTimeShifter)(dwTick, TimeShift); dwTick = (*pTimeShifter)(dwTick, TimeShift);
if(dxw.TimeFreeze) dwTick=0; if(TimeFreeze) dwTick=0;
// From MSDN: Contains a 64-bit value representing the number of // From MSDN: Contains a 64-bit value representing the number of
// 100-nanosecond intervals since January 1, 1601 (UTC). // 100-nanosecond intervals since January 1, 1601 (UTC).
// So, since 1mSec = 10.000 * 100nSec, you still have to multiply by 10.000. // So, since 1mSec = 10.000 * 100nSec, you still have to multiply by 10.000.
@ -1871,7 +1871,7 @@ UINT dxwCore::MapKeysConfig(UINT message, LPARAM lparam, WPARAM wparam)
void dxwCore::ToggleFreezedTime() void dxwCore::ToggleFreezedTime()
{ {
static DWORD dwLastTime = 0; static DWORD dwLastTime = 0;
if(((*pGetTickCount)() - dwLastTime) < 100) return; if(((*pGetTickCount)() - dwLastTime) < 1000) return;
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");

View File

@ -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.46" #define VERSION "2.03.47"
#define DDTHREADLOCK 1 #define DDTHREADLOCK 1
//#define LOCKTHREADS //#define LOCKTHREADS

Binary file not shown.

View File

@ -107,8 +107,9 @@ static HookEntry_Type ScaledHooks[]={
{HOOK_IAT_CANDIDATE, "Polygon", (FARPROC)NULL, (FARPROC *)&pPolygon, (FARPROC)extPolygon}, {HOOK_IAT_CANDIDATE, "Polygon", (FARPROC)NULL, (FARPROC *)&pPolygon, (FARPROC)extPolygon},
{HOOK_IAT_CANDIDATE, "Arc", (FARPROC)NULL, (FARPROC *)&pArc, (FARPROC)extArc}, {HOOK_IAT_CANDIDATE, "Arc", (FARPROC)NULL, (FARPROC *)&pArc, (FARPROC)extArc},
// commented out since they alter text on screen...... (see Imperialism II difficulty level menu) // commented out since they alter text on screen...... (see Imperialism II difficulty level menu)
//{HOOK_IAT_CANDIDATE, "CreateEllipticRgn", (FARPROC)NULL, (FARPROC *)&pCreateEllipticRgn, (FARPROC)extCreateEllipticRgn}, // v2.03.47 - restored: needed for "688(I) Hunter Killer" periscope ....
//{HOOK_IAT_CANDIDATE, "CreateEllipticRgnIndirect", (FARPROC)NULL, (FARPROC *)&pCreateEllipticRgnIndirect, (FARPROC)extCreateEllipticRgnIndirect}, {HOOK_IAT_CANDIDATE, "CreateEllipticRgn", (FARPROC)NULL, (FARPROC *)&pCreateEllipticRgn, (FARPROC)extCreateEllipticRgn},
{HOOK_IAT_CANDIDATE, "CreateEllipticRgnIndirect", (FARPROC)NULL, (FARPROC *)&pCreateEllipticRgnIndirect, (FARPROC)extCreateEllipticRgnIndirect},
// CreateRectRgn must be hooked in scaled mode to let Avernum work correctly! // CreateRectRgn must be hooked in scaled mode to let Avernum work correctly!
{HOOK_IAT_CANDIDATE, "CreateRectRgn", (FARPROC)NULL, (FARPROC *)&pCreateRectRgn, (FARPROC)extCreateRectRgn}, {HOOK_IAT_CANDIDATE, "CreateRectRgn", (FARPROC)NULL, (FARPROC *)&pCreateRectRgn, (FARPROC)extCreateRectRgn},
{HOOK_IAT_CANDIDATE, "CreateRectRgnIndirect", (FARPROC)NULL, (FARPROC *)&pCreateRectRgnIndirect, (FARPROC)extCreateRectRgnIndirect}, {HOOK_IAT_CANDIDATE, "CreateRectRgnIndirect", (FARPROC)NULL, (FARPROC *)&pCreateRectRgnIndirect, (FARPROC)extCreateRectRgnIndirect},

View File

@ -13,13 +13,16 @@
BOOL WINAPI extCheckRemoteDebuggerPresent(HANDLE, PBOOL); BOOL WINAPI extCheckRemoteDebuggerPresent(HANDLE, PBOOL);
LPVOID WINAPI extVirtualAlloc(LPVOID, SIZE_T, DWORD, DWORD); LPVOID WINAPI extVirtualAlloc(LPVOID, SIZE_T, DWORD, DWORD);
UINT WINAPI extWinExec(LPCSTR, UINT);
typedef LPVOID (WINAPI *VirtualAlloc_Type)(LPVOID, SIZE_T, DWORD, DWORD); typedef LPVOID (WINAPI *VirtualAlloc_Type)(LPVOID, SIZE_T, DWORD, DWORD);
typedef BOOL (WINAPI *CreateProcessA_Type)(LPCTSTR, LPTSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, typedef BOOL (WINAPI *CreateProcessA_Type)(LPCTSTR, LPTSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES,
BOOL, DWORD, LPVOID, LPCTSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION); BOOL, DWORD, LPVOID, LPCTSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION);
typedef UINT (WINAPI *WinExec_Type)(LPCSTR, UINT);
CreateProcessA_Type pCreateProcessA = NULL; CreateProcessA_Type pCreateProcessA = NULL;
VirtualAlloc_Type pVirtualAlloc = NULL; VirtualAlloc_Type pVirtualAlloc = NULL;
WinExec_Type pWinExec = NULL;
#ifdef NOFREELIBRARY #ifdef NOFREELIBRARY
typedef BOOL (WINAPI *FreeLibrary_Type)(HMODULE); typedef BOOL (WINAPI *FreeLibrary_Type)(HMODULE);
@ -47,6 +50,7 @@ static HookEntry_Type Hooks[]={
{HOOK_IAT_CANDIDATE, "GetLogicalDrives", (FARPROC)NULL, (FARPROC *)&pGetLogicalDrives, (FARPROC)extGetLogicalDrives}, {HOOK_IAT_CANDIDATE, "GetLogicalDrives", (FARPROC)NULL, (FARPROC *)&pGetLogicalDrives, (FARPROC)extGetLogicalDrives},
{HOOK_IAT_CANDIDATE, "GetTempFileNameA", (FARPROC)GetTempFileNameA, (FARPROC *)&pGetTempFileName, (FARPROC)extGetTempFileName}, {HOOK_IAT_CANDIDATE, "GetTempFileNameA", (FARPROC)GetTempFileNameA, (FARPROC *)&pGetTempFileName, (FARPROC)extGetTempFileName},
{HOOK_IAT_CANDIDATE, "CreateProcessA", (FARPROC)NULL, (FARPROC *)&pCreateProcessA, (FARPROC)extCreateProcessA}, {HOOK_IAT_CANDIDATE, "CreateProcessA", (FARPROC)NULL, (FARPROC *)&pCreateProcessA, (FARPROC)extCreateProcessA},
//{HOOK_IAT_CANDIDATE, "WinExec", (FARPROC)NULL, (FARPROC *)&pWinExec, (FARPROC)extWinExec},
#ifdef NOFREELIBRARY #ifdef NOFREELIBRARY
{HOOK_HOT_CANDIDATE, "FreeLibrary", (FARPROC)FreeLibrary, (FARPROC *)&pFreeLibrary, (FARPROC)extFreeLibrary}, {HOOK_HOT_CANDIDATE, "FreeLibrary", (FARPROC)FreeLibrary, (FARPROC *)&pFreeLibrary, (FARPROC)extFreeLibrary},
#endif #endif
@ -1094,3 +1098,14 @@ LPVOID WINAPI extVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocatio
OutTrace("VirtualAlloc: ret=%x\n", ret); OutTrace("VirtualAlloc: ret=%x\n", ret);
return ret; return ret;
} }
// WinExec: used by "Star Wars X-Wings Alliance" frontend, but fortunately it's not essential to hook it....
UINT WINAPI extWinExec(LPCSTR lpCmdLine, UINT uCmdShow)
{
UINT ret;
OutTraceDW("WinExec: lpCmdLine=%s CmdShow=%x\n", lpCmdLine, uCmdShow);
ret=(*pWinExec)(lpCmdLine, uCmdShow);
if(ret<31)
OutTraceE("WinExec: ERROR ret=%x\n", ret);
return ret;
}

View File

@ -88,7 +88,7 @@ DWORD WINAPI exttimeGetTime(void)
{ {
DWORD ret; DWORD ret;
ret = dxw.GetTickCount(); ret = dxw.GetTickCount();
if (IsDebug) OutTrace("timeGetTime: time=%x\n", ret); //OutTraceB("timeGetTime: time=%x\n", ret);
return ret; return ret;
} }

View File

@ -44,6 +44,7 @@ void CTabInput::DoDataExchange(CDataExchange* pDX)
//DDX_Check(pDX, IDC_FRAMECOMPENSATION, cTarget->m_FrameCompensation); //DDX_Check(pDX, IDC_FRAMECOMPENSATION, cTarget->m_FrameCompensation);
// DirectInput // DirectInput
DDX_Check(pDX, IDC_HOOKDI, cTarget->m_HookDI); DDX_Check(pDX, IDC_HOOKDI, cTarget->m_HookDI);
DDX_Check(pDX, IDC_HOOKDI8, cTarget->m_HookDI8);
DDX_Check(pDX, IDC_UNACQUIRE, cTarget->m_Unacquire); DDX_Check(pDX, IDC_UNACQUIRE, cTarget->m_Unacquire);
DDX_Text(pDX, IDC_INITX, cTarget->m_InitX); DDX_Text(pDX, IDC_INITX, cTarget->m_InitX);
DDX_Text(pDX, IDC_INITY, cTarget->m_InitY); DDX_Text(pDX, IDC_INITY, cTarget->m_InitY);

View File

@ -28,6 +28,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
m_MouseVisibility = 0; m_MouseVisibility = 0;
m_TextureHandling = 0; m_TextureHandling = 0;
m_HookDI = FALSE; m_HookDI = FALSE;
m_HookDI8 = FALSE;
m_ModifyMouse = TRUE; // default true !! m_ModifyMouse = TRUE; // default true !!
m_VirtualJoystick = FALSE; m_VirtualJoystick = FALSE;
m_Unacquire = FALSE; m_Unacquire = FALSE;

View File

@ -33,6 +33,7 @@ public:
int m_TextureHandling; int m_TextureHandling;
int m_SonProcessMode; int m_SonProcessMode;
BOOL m_HookDI; BOOL m_HookDI;
BOOL m_HookDI8;
BOOL m_ModifyMouse; BOOL m_ModifyMouse;
BOOL m_VirtualJoystick; BOOL m_VirtualJoystick;
BOOL m_Unacquire; BOOL m_Unacquire;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -247,6 +247,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
} }
if(dlg->m_HookDI) t->flags |= HOOKDI; if(dlg->m_HookDI) t->flags |= HOOKDI;
if(dlg->m_HookDI8) t->flags |= HOOKDI8;
if(dlg->m_ModifyMouse) t->flags |= MODIFYMOUSE; if(dlg->m_ModifyMouse) t->flags |= MODIFYMOUSE;
if(dlg->m_VirtualJoystick) t->flags6 |= VIRTUALJOYSTICK; if(dlg->m_VirtualJoystick) t->flags6 |= VIRTUALJOYSTICK;
if(dlg->m_Unacquire) t->flags6 |= UNACQUIRE; if(dlg->m_Unacquire) t->flags6 |= UNACQUIRE;
@ -491,6 +492,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
if(t->flags5 & INJECTSON) dlg->m_SonProcessMode = 3; if(t->flags5 & INJECTSON) dlg->m_SonProcessMode = 3;
dlg->m_HookDI = t->flags & HOOKDI ? 1 : 0; dlg->m_HookDI = t->flags & HOOKDI ? 1 : 0;
dlg->m_HookDI8 = t->flags & HOOKDI8 ? 1 : 0;
dlg->m_ModifyMouse = t->flags & MODIFYMOUSE ? 1 : 0; dlg->m_ModifyMouse = t->flags & MODIFYMOUSE ? 1 : 0;
dlg->m_VirtualJoystick = t->flags6 & VIRTUALJOYSTICK ? 1 : 0; dlg->m_VirtualJoystick = t->flags6 & VIRTUALJOYSTICK ? 1 : 0;
dlg->m_Unacquire = t->flags6 & UNACQUIRE ? 1 : 0; dlg->m_Unacquire = t->flags6 & UNACQUIRE ? 1 : 0;

Binary file not shown.