mirror of
https://github.com/DxWnd/DxWnd.reloaded
synced 2024-12-30 09:25:35 +01:00
v2_03_45_src
Former-commit-id: 306e2b4ae4951095b7efa9ce7e24075ff432076d
This commit is contained in:
parent
bf26e50bd9
commit
2c9572fa77
@ -209,6 +209,7 @@
|
||||
#define NOWINDOWHOOKS 0x02000000 // do not intercept window callback routines
|
||||
#define SYNCPALETTE 0x04000000 // Syncronize GDI to DDRAW palette
|
||||
#define VIRTUALJOYSTICK 0x08000000 // Enables the DxWnd virtual joystick
|
||||
#define UNACQUIRE 0x10000000 // Unacquire DirectInput devices when losing focus and acquire back when gaining focus
|
||||
|
||||
// logging Tflags DWORD:
|
||||
#define OUTTRACE 0x00000001 // enables tracing to dxwnd.log in general
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4fa45747fcb74b2f182ae1d40d3d2219eef7a9410a72a7db49157aba403d9fe4
|
||||
size 613888
|
||||
oid sha256:35b41771cbc6227fe2b767905fbd42e75f893b1bedc8f5ccbcf26d42dffc802f
|
||||
size 619008
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:48137e513053f009fb46ef066a902428491fa3fbc00119db3d5a16cd287ce4fa
|
||||
size 545792
|
||||
oid sha256:a1616682f67e2e527cec0060d101ab43de06f3cbe2ff7cd4e03394c7de2c0027
|
||||
size 546304
|
||||
|
@ -5,10 +5,10 @@ module0=
|
||||
opengllib0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=939524640
|
||||
flag0=939524130
|
||||
flagg0=1209008128
|
||||
flagh0=20
|
||||
flagi0=4
|
||||
flagi0=4194308
|
||||
tflag0=0
|
||||
initx0=0
|
||||
inity0=0
|
||||
@ -24,3 +24,9 @@ maxfps0=0
|
||||
initts0=0
|
||||
winver0=0
|
||||
maxres0=-1
|
||||
launchpath0=
|
||||
notes0=
|
||||
registry0=
|
||||
flagj0=128
|
||||
flagk0=0
|
||||
swapeffect0=0
|
||||
|
32
build/exports/Reap, the.dxw
Normal file
32
build/exports/Reap, the.dxw
Normal file
@ -0,0 +1,32 @@
|
||||
[target]
|
||||
title0=Reap, the
|
||||
path0=D:\Games\theReap\thereap.exe
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=681574434
|
||||
flagg0=1744830464
|
||||
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
|
32
build/exports/Star Trek Klingon Academy.dxw
Normal file
32
build/exports/Star Trek Klingon Academy.dxw
Normal file
@ -0,0 +1,32 @@
|
||||
[target]
|
||||
title0=Star Trek Klingon Academy
|
||||
path0=D:\Games\Klingon Academy\ka.exe
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=-2011168718
|
||||
flagg0=1207959552
|
||||
flagh0=20
|
||||
flagi0=138412036
|
||||
flagj0=4224
|
||||
flagk0=327680
|
||||
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
|
32
build/exports/Star Trek Starfleet Command.dxw
Normal file
32
build/exports/Star Trek Starfleet Command.dxw
Normal file
@ -0,0 +1,32 @@
|
||||
[target]
|
||||
title0=Star Trek Starfleet Command
|
||||
path0=D:\Games\Star Trek Starfleet Command\StarFleet.exe
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=136314914
|
||||
flagg0=1209008128
|
||||
flagh0=20
|
||||
flagi0=138412036
|
||||
flagj0=67113088
|
||||
flagk0=65536
|
||||
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
|
32
build/exports/Star Wars X-Wing Alliance.dxw
Normal file
32
build/exports/Star Wars X-Wing Alliance.dxw
Normal file
@ -0,0 +1,32 @@
|
||||
[target]
|
||||
title0=Star Wars X-Wing Alliance
|
||||
path0=D:\Games\Star Wars X-Wing Alliance\XWINGALLIANCE.EXE
|
||||
launchpath0=
|
||||
module0=
|
||||
opengllib0=
|
||||
notes0=
|
||||
registry0=
|
||||
ver0=0
|
||||
coord0=0
|
||||
flag0=136314930
|
||||
flagg0=1207959552
|
||||
flagh0=20
|
||||
flagi0=138412036
|
||||
flagj0=1073746048
|
||||
flagk0=402980864
|
||||
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
|
@ -961,3 +961,10 @@ fix: complete recoding of GDI BitBlt, StretchBlt and PatBlt hookers: it fixes "R
|
||||
fix: changes in USER32 BeginPaint hooker to support DC sharing with ddraw
|
||||
fix: increased configuration panels heigth do avoid clipping when desktop font size is set to 125%
|
||||
|
||||
v2.03.45
|
||||
add: virtual joystick center-lock feature, helps using the mouse as mouse leaving the joystick locked.
|
||||
fix: revised dinput hooking. dinput8 still to be completed.
|
||||
add: option "Unacquire input devices on focus lost". Needed for Star wars "Tie Fighter 95".
|
||||
fix: set dinput SetCooperativeLevel flags to DISCL_NONEXCLUSIVE | DISCL_FOREGROUND
|
||||
fix: fixed CreateIC hooker call method (WINAPI)
|
||||
fix: emulated Unacquire on virtual joystick. Needed for Star wars "Tie Fighter 95".
|
||||
|
BIN
dll/center.bmp
Normal file
BIN
dll/center.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
162
dll/dinput.cpp
162
dll/dinput.cpp
@ -19,6 +19,9 @@ typedef HRESULT (WINAPI *GetDeviceState_Type)(LPDIRECTINPUTDEVICE, DWORD, LPDIMO
|
||||
typedef HRESULT (WINAPI *DISetCooperativeLevel_Type)(LPDIRECTINPUTDEVICE, HWND, DWORD);
|
||||
typedef HRESULT (WINAPI *SetDataFormat_Type)(LPDIRECTINPUTDEVICE, LPCDIDATAFORMAT);
|
||||
typedef HRESULT (WINAPI *DIEnumDevices_Type)(void *, DWORD, LPDIENUMDEVICESCALLBACK, LPVOID, DWORD);
|
||||
typedef HRESULT (WINAPI *Acquire_Type)(LPDIRECTINPUTDEVICE);
|
||||
typedef HRESULT (WINAPI *Unacquire_Type)(LPDIRECTINPUTDEVICE);
|
||||
typedef HRESULT (WINAPI *DirectInput8Create_Type)(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN);
|
||||
|
||||
HRESULT WINAPI extDirectInputCreateA(HINSTANCE, DWORD, LPDIRECTINPUT *, LPUNKNOWN);
|
||||
HRESULT WINAPI extDirectInputCreateW(HINSTANCE, DWORD, LPDIRECTINPUT *, LPUNKNOWN);
|
||||
@ -32,30 +35,39 @@ HRESULT WINAPI extDISetCooperativeLevel(LPDIRECTINPUTDEVICE, HWND, DWORD);
|
||||
HRESULT WINAPI extSetDataFormat(LPDIRECTINPUTDEVICE, LPCDIDATAFORMAT);
|
||||
HRESULT WINAPI extDIQueryInterface(void *, REFIID, LPVOID *);
|
||||
HRESULT WINAPI extDIEnumDevices(void *, DWORD, LPDIENUMDEVICESCALLBACK, LPVOID, DWORD);
|
||||
HRESULT WINAPI extAcquire(LPDIRECTINPUTDEVICE);
|
||||
HRESULT WINAPI extUnacquire(LPDIRECTINPUTDEVICE);
|
||||
HRESULT WINAPI extDirectInput8Create(HINSTANCE, DWORD, REFIID, LPVOID *, LPUNKNOWN);
|
||||
|
||||
DirectInputCreate_Type pDirectInputCreateA = 0;
|
||||
DirectInputCreate_Type pDirectInputCreateW = 0;
|
||||
DirectInputCreateEx_Type pDirectInputCreateEx = 0;
|
||||
DICreateDevice_Type pDICreateDevice = 0;
|
||||
DICreateDeviceEx_Type pDICreateDeviceEx = 0;
|
||||
GetDeviceData_Type pGetDeviceData = 0;
|
||||
GetDeviceState_Type pGetDeviceState = 0;
|
||||
DISetCooperativeLevel_Type pDISetCooperativeLevel = 0;
|
||||
SetDataFormat_Type pSetDataFormat = 0;
|
||||
QueryInterface_Type pDIQueryInterface = 0;
|
||||
DIEnumDevices_Type pDIEnumDevices = 0;
|
||||
DirectInputCreate_Type pDirectInputCreateA = NULL;
|
||||
DirectInputCreate_Type pDirectInputCreateW = NULL;
|
||||
DirectInputCreateEx_Type pDirectInputCreateEx = NULL;
|
||||
DICreateDevice_Type pDICreateDevice = NULL;
|
||||
DICreateDeviceEx_Type pDICreateDeviceEx = NULL;
|
||||
GetDeviceData_Type pGetDeviceData = NULL;
|
||||
GetDeviceState_Type pGetDeviceState = NULL;
|
||||
DISetCooperativeLevel_Type pDISetCooperativeLevel = NULL;
|
||||
SetDataFormat_Type pSetDataFormat = NULL;
|
||||
QueryInterface_Type pDIQueryInterface = NULL;
|
||||
DIEnumDevices_Type pDIEnumDevices = NULL;
|
||||
Acquire_Type pAcquire = NULL;
|
||||
Unacquire_Type pUnacquire = NULL;
|
||||
DirectInput8Create_Type pDirectInput8Create = NULL;
|
||||
|
||||
//static HookEntry_Type diHooks[]={
|
||||
// {HOOK_HOT_CANDIDATE, "DirectInputCreateA", (FARPROC)NULL, (FARPROC *)&pDirectInputCreateA, (FARPROC)extDirectInputCreateA},
|
||||
// {HOOK_HOT_CANDIDATE, "DirectInputCreateW", (FARPROC)NULL, (FARPROC *)&pDirectInputCreateW, (FARPROC)extDirectInputCreateW},
|
||||
// {HOOK_HOT_CANDIDATE, "DirectInputCreateEx", (FARPROC)NULL, (FARPROC *)&pDirectInputCreateEx, (FARPROC)extDirectInputCreateEx},
|
||||
// {HOOK_HOT_CANDIDATE, "DirectInput8Create", (FARPROC)NULL, (FARPROC *)&pDirectInput8Create, (FARPROC)extDirectInput8Create},
|
||||
// {HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
|
||||
//};
|
||||
static HookEntry_Type diHooks[]={
|
||||
{HOOK_HOT_CANDIDATE, "DirectInputCreateA", (FARPROC)NULL, (FARPROC *)&pDirectInputCreateA, (FARPROC)extDirectInputCreateA},
|
||||
{HOOK_HOT_CANDIDATE, "DirectInputCreateW", (FARPROC)NULL, (FARPROC *)&pDirectInputCreateW, (FARPROC)extDirectInputCreateW},
|
||||
{HOOK_HOT_CANDIDATE, "DirectInputCreateEx", (FARPROC)NULL, (FARPROC *)&pDirectInputCreateEx, (FARPROC)extDirectInputCreateEx},
|
||||
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type di8Hooks[]={
|
||||
{HOOK_HOT_CANDIDATE, "DirectInput8Create", (FARPROC)NULL, (FARPROC *)&pDirectInput8Create, (FARPROC)extDirectInput8Create},
|
||||
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
void GetMousePosition(int *, int *);
|
||||
void InitPosition(int, int, int, int, int, int);
|
||||
|
||||
|
||||
int iCursorX;
|
||||
int iCursorY;
|
||||
@ -66,6 +78,43 @@ int iCurMinY;
|
||||
int iCurMaxX;
|
||||
int iCurMaxY;
|
||||
|
||||
void HookDirectInput(HMODULE module, int version)
|
||||
{
|
||||
const GUID di7 = {0x9A4CB684,0x236D,0x11D3,0x8E,0x9D,0x00,0xC0,0x4F,0x68,0x44,0xAE};
|
||||
HINSTANCE hinst;
|
||||
LPDIRECTINPUT lpdi;
|
||||
|
||||
HookLibrary(module, diHooks, "dinput.dll");
|
||||
if(!pDirectInputCreateA && !pDirectInputCreateW && !pDirectInputCreateEx){
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
void HookDirectInput8(HMODULE module, int version)
|
||||
{
|
||||
const GUID di8 = {0xBF798030,0x483A,0x4DA2,0xAA,0x99,0x5D,0x64,0xED,0x36,0x97,0x00};
|
||||
HINSTANCE hinst;
|
||||
LPDIRECTINPUT lpdi;
|
||||
|
||||
HookLibrary(module, di8Hooks, "dinput8.dll");
|
||||
if(!pDirectInput8Create){
|
||||
hinst = LoadLibrary("dinput8.dll");
|
||||
pDirectInput8Create = (DirectInput8Create_Type)GetProcAddress(hinst, "DirectInput8Create");
|
||||
if(pDirectInput8Create)
|
||||
if(!extDirectInput8Create(GetModuleHandle(0), DIRECTINPUT_VERSION,
|
||||
di8, (LPVOID *)&lpdi, 0)) lpdi->Release();
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
int HookDirectInput(HMODULE module, int version)
|
||||
{
|
||||
HINSTANCE hinst;
|
||||
@ -108,7 +157,23 @@ int HookDirectInput(HMODULE module, int version)
|
||||
if(pDirectInputCreateA || pDirectInputCreateW || pDirectInputCreateEx) return 1;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
FARPROC Remap_DInput_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
{
|
||||
FARPROC addr;
|
||||
if (addr=RemapLibrary(proc, hModule, diHooks)) return addr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FARPROC Remap_DInput8_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
{
|
||||
FARPROC addr;
|
||||
if (addr=RemapLibrary(proc, hModule, di8Hooks)) return addr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *libname = "dsound.dll";
|
||||
HRESULT WINAPI extDirectInputCreate(HINSTANCE hinst,
|
||||
DWORD dwversion, LPDIRECTINPUT *lplpdi, LPUNKNOWN pu, DirectInputCreate_Type pDirectInputCreate, char *apiname)
|
||||
{
|
||||
@ -137,8 +202,7 @@ HRESULT WINAPI extDirectInputCreateW(HINSTANCE hinst, DWORD dwversion, LPDIRECTI
|
||||
return extDirectInputCreate(hinst, dwversion, lplpdi, pu, pDirectInputCreateW, "DirectInputCreateW");
|
||||
}
|
||||
|
||||
HRESULT WINAPI extDirectInputCreateEx(HINSTANCE hinst,
|
||||
DWORD dwversion, REFIID riidltf, LPVOID *ppvout, LPUNKNOWN pu)
|
||||
HRESULT WINAPI extDirectInputCreateEx(HINSTANCE hinst, DWORD dwversion, REFIID riidltf, LPVOID *ppvout, LPUNKNOWN pu)
|
||||
{
|
||||
HRESULT res;
|
||||
|
||||
@ -177,15 +241,15 @@ HRESULT WINAPI extDIQueryInterface(void * lpdi, REFIID riid, LPVOID *obp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT WINAPI extDirectInput8Create(HINSTANCE hinst,
|
||||
DWORD dwversion, REFIID riidltf, LPVOID *ppvout, LPUNKNOWN pu)
|
||||
HRESULT WINAPI extDirectInput8Create(HINSTANCE hinst, DWORD dwversion, REFIID riidltf, LPVOID *ppvout, LPUNKNOWN pu)
|
||||
{
|
||||
HRESULT res;
|
||||
|
||||
OutTraceDW("DirectInput8Create: dwVersion=%x REFIID=%x\n",
|
||||
dwversion, riidltf.Data1);
|
||||
|
||||
res = (*pDirectInputCreateEx)(hinst, dwversion, riidltf, ppvout, pu);
|
||||
//res = (*pDirectInputCreateEx)(hinst, dwversion, riidltf, ppvout, pu);
|
||||
res = (*pDirectInput8Create)(hinst, dwversion, riidltf, ppvout, pu);
|
||||
if(res) {
|
||||
OutTraceE("DirectInput8Create: ERROR res=%x\n", res);
|
||||
return res;
|
||||
@ -195,12 +259,22 @@ HRESULT WINAPI extDirectInput8Create(HINSTANCE hinst,
|
||||
return 0;
|
||||
}
|
||||
|
||||
HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid,
|
||||
LPDIRECTINPUTDEVICE *lplpdid, LPUNKNOWN pu)
|
||||
HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid, LPDIRECTINPUTDEVICE *lplpdid, LPUNKNOWN pu)
|
||||
{
|
||||
HRESULT res;
|
||||
char *devtype;
|
||||
|
||||
OutTraceDW("CreateDevice(I): REFGUID=%x\n", rguid.Data1);
|
||||
switch(rguid.Data1){
|
||||
case 0x6F1D2B60: devtype = "SysMouse"; break;
|
||||
case 0x6F1D2B61: devtype = "SysKeyboard"; break;
|
||||
case 0x6F1D2B70: devtype = "Joystick"; break;
|
||||
case 0x6F1D2B80: devtype = "SysMouseEm"; break;
|
||||
case 0x6F1D2B81: devtype = "SysMouseEm2"; break;
|
||||
case 0x6F1D2B82: devtype = "SysKeyboardEm"; break;
|
||||
case 0x6F1D2B83: devtype = "SysKeyboardEm2"; break;
|
||||
default: devtype = "Unknown"; break;
|
||||
}
|
||||
OutTraceDW("CreateDevice(I): REFGUID=%x(%s)\n", rguid.Data1, devtype);
|
||||
|
||||
res = (*pDICreateDevice)(lpdi, rguid, lplpdid, pu);
|
||||
if(res) {
|
||||
@ -208,6 +282,8 @@ HRESULT WINAPI extDICreateDevice(LPDIRECTINPUT lpdi, REFGUID rguid,
|
||||
return res;
|
||||
}
|
||||
OutTraceDW("CreateDevice(I): did=%x\n", *lplpdid);
|
||||
SetHook((void *)(**(DWORD **)lplpdid + 28), extAcquire, (void **)&pAcquire, "Acquire(I)");
|
||||
SetHook((void *)(**(DWORD **)lplpdid + 32), extUnacquire, (void **)&pUnacquire, "Unacquire(I)");
|
||||
SetHook((void *)(**(DWORD **)lplpdid + 36), extGetDeviceState, (void **)&pGetDeviceState, "GetDeviceState(I)");
|
||||
SetHook((void *)(**(DWORD **)lplpdid + 40), extGetDeviceData, (void **)&pGetDeviceData, "GetDeviceData(I)");
|
||||
SetHook((void *)(**(DWORD **)lplpdid + 44), extSetDataFormat, (void **)&pSetDataFormat, "SetDataFormat(I)");
|
||||
@ -228,6 +304,8 @@ HRESULT WINAPI extDICreateDeviceEx(LPDIRECTINPUT lpdi, REFGUID rguid,
|
||||
return res;
|
||||
}
|
||||
OutTraceDW("CreateDeviceEx(I): did=%x\n", *pvout);
|
||||
SetHook((void *)(**(DWORD **)pvout + 28), extAcquire, (void **)&pAcquire, "Acquire(I)");
|
||||
SetHook((void *)(**(DWORD **)pvout + 32), extUnacquire, (void **)&pUnacquire, "Unacquire(I)");
|
||||
SetHook((void *)(**(DWORD **)pvout + 36), extGetDeviceState, (void **)&pGetDeviceState, "GetDeviceState(I)");
|
||||
SetHook((void *)(**(DWORD **)pvout + 40), extGetDeviceData, (void **)&pGetDeviceData, "GetDeviceData(I)");
|
||||
SetHook((void *)(**(DWORD **)pvout + 44), extSetDataFormat, (void **)&pSetDataFormat, "SetDataFormat(I)");
|
||||
@ -429,7 +507,9 @@ HRESULT WINAPI extDISetCooperativeLevel(LPDIRECTINPUTDEVICE lpdid, HWND hwnd, DW
|
||||
lpdid, hwnd, dwflags, ExplainDICooperativeFlags(dwflags));
|
||||
|
||||
if(dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
|
||||
dwflags = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
|
||||
//dwflags = DISCL_NONEXCLUSIVE | DISCL_BACKGROUND;
|
||||
dwflags = DISCL_NONEXCLUSIVE | DISCL_FOREGROUND;
|
||||
hwnd=dxw.GethWnd();
|
||||
res = (*pDISetCooperativeLevel)(lpdid, hwnd, dwflags);
|
||||
if(res != DD_OK){
|
||||
OutTraceE("SetCooperativeLevel(I) ERROR: err=%x(%s)\n", res, ExplainDDError(res));
|
||||
@ -498,3 +578,29 @@ HRESULT WINAPI extDIEnumDevices(void *lpdi, DWORD dwDevType, LPDIENUMDEVICESCALL
|
||||
return res;
|
||||
}
|
||||
|
||||
LPDIRECTINPUTDEVICE lpDID = NULL;
|
||||
|
||||
HRESULT WINAPI extAcquire(LPDIRECTINPUTDEVICE lpdid)
|
||||
{
|
||||
HRESULT res;
|
||||
lpDID = lpdid;
|
||||
res = (*pAcquire)(lpdid);
|
||||
OutTrace("Acquire(I): lpdid=%x res=%x\n", lpdid, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
HRESULT WINAPI extUnacquire(LPDIRECTINPUTDEVICE lpdid)
|
||||
{
|
||||
HRESULT res;
|
||||
lpDID = lpdid;
|
||||
res = (*pUnacquire)(lpdid);
|
||||
OutTrace("Unacquire(I): lpdid=%x res=%x\n", lpdid, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
void ToggleAcquiredDevices(BOOL flag)
|
||||
{
|
||||
if (!lpDID) return;
|
||||
if(flag && pAcquire)(*pAcquire)(lpDID);
|
||||
if(!flag && pUnacquire)(*pUnacquire)(lpDID);
|
||||
}
|
@ -4,7 +4,8 @@ extern int HookDirect3D(HMODULE, int);
|
||||
extern int HookDirect3D7(HMODULE, int);
|
||||
extern void HookOle32(HMODULE);
|
||||
extern void HookGDI32(HMODULE);
|
||||
extern int HookDirectInput(HMODULE, int);
|
||||
extern void HookDirectInput(HMODULE, int);
|
||||
extern void HookDirectInput8(HMODULE, int);
|
||||
extern void HookDirectSound(HMODULE);
|
||||
extern void HookImeLib(HMODULE);
|
||||
extern void HookKernel32(HMODULE);
|
||||
@ -41,6 +42,8 @@ extern FARPROC Remap_vfw_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_AdvApi32_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_Glide_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_Imagehlp_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_DInput_ProcAddress(LPCSTR, HMODULE);
|
||||
extern FARPROC Remap_DInput8_ProcAddress(LPCSTR, HMODULE);
|
||||
|
||||
typedef enum {
|
||||
HOOK_IAT_CANDIDATE = 0,
|
||||
|
@ -123,6 +123,10 @@ void dxwCore::InitTarget(TARGETMAP *target)
|
||||
// Aspect Ratio from window size, or traditional 4:3 by default
|
||||
iRatioX = iSizX ? iSizX : 800;
|
||||
iRatioY = iSizY ? iSizY : 600;
|
||||
|
||||
GDIEmulationMode = GDIMODE_STRETCHED; // default
|
||||
if (dwFlags2 & GDISTRETCHED) GDIEmulationMode = GDIMODE_STRETCHED;
|
||||
if (dwFlags3 & GDIEMULATEDC) GDIEmulationMode = GDIMODE_EMULATED;
|
||||
}
|
||||
|
||||
void dxwCore::SetScreenSize(void)
|
||||
@ -478,9 +482,14 @@ void dxwCore::SethWnd(HWND hwnd)
|
||||
hWndFPS=hwnd;
|
||||
RealHDC=(*pGDIGetDC)(hwnd);
|
||||
|
||||
(*pGetWindowRect)(hwnd, &WinRect);
|
||||
OutTraceDW("SethWnd: setting main win=%x hdc=%x pos=(%d,%d)-(%d,%d)\n",
|
||||
hwnd, RealHDC, WinRect.left, WinRect.top, WinRect.right, WinRect.bottom);
|
||||
if(hwnd){
|
||||
(*pGetWindowRect)(hwnd, &WinRect);
|
||||
OutTraceDW("SethWnd: setting main win=%x hdc=%x pos=(%d,%d)-(%d,%d)\n",
|
||||
hwnd, RealHDC, WinRect.left, WinRect.top, WinRect.right, WinRect.bottom);
|
||||
}
|
||||
else{
|
||||
OutTraceDW("SethWnd: clearing main win\n");
|
||||
}
|
||||
}
|
||||
|
||||
BOOL dxwCore::ishWndFPS(HWND hwnd)
|
||||
|
@ -167,6 +167,7 @@ public: // simple data variables
|
||||
short MaxScreenRes;
|
||||
HDC RealHDC;
|
||||
HDC VirtualHDC;
|
||||
int GDIEmulationMode;
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
@ -348,5 +349,9 @@ typedef enum {
|
||||
DXVK_SIZE
|
||||
};
|
||||
|
||||
#define GDIMODE_STRETCHED 0
|
||||
#define GDIMODE_EMULATED 1
|
||||
|
||||
typedef HRESULT (WINAPI *ColorConversion_Type)(LPDIRECTDRAWSURFACE, RECT, LPDIRECTDRAWSURFACE *);
|
||||
extern ColorConversion_Type pColorConversion;
|
||||
extern void ToggleAcquiredDevices(BOOL);
|
||||
|
@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "TlHelp32.h"
|
||||
|
||||
#define VERSION "2.03.44"
|
||||
#define VERSION "2.03.45"
|
||||
|
||||
#define DDTHREADLOCK 1
|
||||
//#define LOCKTHREADS
|
||||
|
@ -57,6 +57,8 @@ IDB_CROSS BITMAP "cross.bmp"
|
||||
IDB_FIRE1 BITMAP "fire1.bmp"
|
||||
IDB_FIRE2 BITMAP "fire2.bmp"
|
||||
IDB_FIRE3 BITMAP "fire3.bmp"
|
||||
IDB_JOYCENTER BITMAP "center.bmp"
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
Binary file not shown.
@ -9,10 +9,6 @@
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
#define GDIMODE_STRETCHED 0
|
||||
#define GDIMODE_EMULATED 1
|
||||
extern int GDIEmulationMode;
|
||||
|
||||
static void Stopper(char *s, int line)
|
||||
{
|
||||
char sMsg[81];
|
||||
@ -333,6 +329,7 @@ int WINAPI extGetDeviceCaps(HDC hdc, int nindex)
|
||||
case BITSPIXEL:
|
||||
case COLORRES:
|
||||
case VERTRES:
|
||||
case HORZRES:
|
||||
case SIZEPALETTE:
|
||||
case NUMRESERVED:
|
||||
sprintf(sInfo, "%s res=%d\n", sInfo, res); break;
|
||||
@ -705,7 +702,7 @@ HDC WINAPI extGDICreateDC(LPSTR lpszDriver, LPSTR lpszDevice, LPSTR lpszOutput,
|
||||
return RetHDC;
|
||||
}
|
||||
|
||||
HDC extCreateICA(LPCTSTR lpszDriver, LPCTSTR lpszDevice, LPCTSTR lpszOutput, const DEVMODE *lpdvmInit)
|
||||
HDC WINAPI extCreateICA(LPCTSTR lpszDriver, LPCTSTR lpszDevice, LPCTSTR lpszOutput, const DEVMODE *lpdvmInit)
|
||||
{
|
||||
HDC WinHDC, RetHDC;
|
||||
OutTraceDW("GDI.CreateIC: Driver=%s Device=%s Output=%s InitData=%x\n",
|
||||
@ -728,6 +725,7 @@ HDC extCreateICA(LPCTSTR lpszDriver, LPCTSTR lpszDevice, LPCTSTR lpszOutput, con
|
||||
RetHDC = (*pCreateICA)(lpszDriver, lpszDevice, lpszOutput, lpdvmInit);
|
||||
}
|
||||
|
||||
OutTraceDW("CreateIC: ret=%x\n", RetHDC);
|
||||
return RetHDC;
|
||||
}
|
||||
|
||||
@ -788,7 +786,7 @@ BOOL WINAPI extGDIBitBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
|
||||
IsToScreen=(OBJ_DC == GetObjectType(hdcDest));
|
||||
if (IsToScreen && (dxw.dwFlags3 & NOGDIBLT)) return TRUE;
|
||||
if(dxw.IsFullScreen()) {
|
||||
switch(GDIEmulationMode){
|
||||
switch(dxw.GDIEmulationMode){
|
||||
case GDIMODE_STRETCHED: {
|
||||
int nWDest, nHDest;
|
||||
nWDest= nWidth;
|
||||
@ -838,7 +836,7 @@ BOOL WINAPI extGDIPatBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nH
|
||||
IsToScreen=(OBJ_DC == GetObjectType(hdcDest));
|
||||
if (IsToScreen && (dxw.dwFlags3 & NOGDIBLT)) return TRUE;
|
||||
if(dxw.IsFullScreen()) {
|
||||
switch(GDIEmulationMode){
|
||||
switch(dxw.GDIEmulationMode){
|
||||
case GDIMODE_STRETCHED: {
|
||||
int nWDest, nHDest;
|
||||
nWDest= nWidth;
|
||||
@ -889,7 +887,7 @@ BOOL WINAPI extGDIStretchBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, in
|
||||
IsToScreen=(OBJ_DC == GetObjectType(hdcDest));
|
||||
if (IsToScreen && (dxw.dwFlags3 & NOGDIBLT)) return TRUE;
|
||||
if(dxw.IsFullScreen()) {
|
||||
switch(GDIEmulationMode){
|
||||
switch(dxw.GDIEmulationMode){
|
||||
case GDIMODE_STRETCHED: {
|
||||
int nWDest, nHDest;
|
||||
nWDest= nWidth;
|
||||
|
@ -638,6 +638,12 @@ FARPROC WINAPI extGetProcAddress(HMODULE hModule, LPCSTR proc)
|
||||
case SYSLIBIDX_IMAGEHLP:
|
||||
if (remap=Remap_Imagehlp_ProcAddress(proc, hModule)) return remap;
|
||||
break;
|
||||
case SYSLIBIDX_DINPUT:
|
||||
if (remap=Remap_DInput_ProcAddress(proc, hModule)) return remap;
|
||||
break;
|
||||
case SYSLIBIDX_DINPUT8:
|
||||
if (remap=Remap_DInput8_ProcAddress(proc, hModule)) return remap;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
#define IDB_CROSS 102
|
||||
#define IDB_FIRE1 103
|
||||
#define IDB_FIRE2 104
|
||||
#define IDB_BITMAP2 105
|
||||
#define IDB_FIRE3 105
|
||||
#define IDB_JOYCENTER 106
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
@ -488,7 +488,7 @@ extern HDC WINAPI extEMUCreateCompatibleDC(HDC);
|
||||
extern HDC WINAPI extGDICreateDC(LPSTR, LPSTR, LPSTR, CONST DEVMODE *);
|
||||
extern HFONT WINAPI extCreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR);
|
||||
extern HFONT WINAPI extCreateFontIndirect(const LOGFONT*);
|
||||
extern HDC extCreateICA(LPCTSTR, LPCTSTR, LPCTSTR, const DEVMODE *);
|
||||
extern HDC WINAPI extCreateICA(LPCTSTR, LPCTSTR, LPCTSTR, const DEVMODE *);
|
||||
extern HPALETTE WINAPI extGDICreatePalette(CONST LOGPALETTE *);
|
||||
extern HDWP WINAPI extDeferWindowPos(HDWP, HWND, HWND, int, int, int, int, UINT);
|
||||
extern BOOL WINAPI extExtTextOutW(HDC, int, int, UINT, const RECT *, LPCWSTR, UINT, const INT *);
|
||||
|
@ -15,9 +15,6 @@
|
||||
#define FIXCHILDSIZE FALSE
|
||||
|
||||
BOOL IsChangeDisplaySettingsHotPatched = FALSE;
|
||||
#define GDIMODE_STRETCHED 0
|
||||
#define GDIMODE_EMULATED 1
|
||||
int GDIEmulationMode = 0;
|
||||
extern BOOL bFlippedDC;
|
||||
extern HDC hFlippedDC;
|
||||
|
||||
@ -201,6 +198,7 @@ static HookEntry_Type PeekAllHooks[]={
|
||||
|
||||
static HookEntry_Type MouseHooks[]={
|
||||
{HOOK_HOT_CANDIDATE, "GetCursorPos", (FARPROC)GetCursorPos, (FARPROC *)&pGetCursorPos, (FARPROC)extGetCursorPos},
|
||||
{HOOK_HOT_CANDIDATE, "SetCursorPos", (FARPROC)SetCursorPos, (FARPROC *)&pSetCursorPos, (FARPROC)extSetCursorPos},
|
||||
{HOOK_IAT_CANDIDATE, "GetCursorInfo", (FARPROC)GetCursorInfo, (FARPROC *)&pGetCursorInfo, (FARPROC)extGetCursorInfo},
|
||||
{HOOK_IAT_CANDIDATE, "SetCursor", (FARPROC)SetCursor, (FARPROC *)&pSetCursor, (FARPROC)extSetCursor},
|
||||
{HOOK_IAT_CANDIDATE, "SendMessageA", (FARPROC)SendMessageA, (FARPROC *)&pSendMessageA, (FARPROC)extSendMessageA},
|
||||
@ -218,11 +216,6 @@ static HookEntry_Type WinHooks[]={
|
||||
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type MouseHooks2[]={
|
||||
{HOOK_HOT_CANDIDATE, "SetCursorPos", (FARPROC)SetCursorPos, (FARPROC *)&pSetCursorPos, (FARPROC)extSetCursorPos},
|
||||
{HOOK_IAT_CANDIDATE, 0, NULL, 0, 0} // terminator
|
||||
};
|
||||
|
||||
static HookEntry_Type TimeHooks[]={
|
||||
{HOOK_IAT_CANDIDATE, "SetTimer", (FARPROC)SetTimer, (FARPROC *)&pSetTimer, (FARPROC)extSetTimer},
|
||||
{HOOK_IAT_CANDIDATE, "KillTimer", (FARPROC)KillTimer, (FARPROC *)&pKillTimer, (FARPROC)extKillTimer},
|
||||
@ -243,16 +236,16 @@ FARPROC Remap_user32_ProcAddress(LPCSTR proc, HMODULE hModule)
|
||||
if (addr=RemapLibrary(proc, hModule, Hooks)) return addr;
|
||||
if (dxw.dwFlags1 & CLIENTREMAPPING) if (addr=RemapLibrary(proc, hModule, RemapHooks)) return addr;
|
||||
|
||||
if (dxw.dwFlags2 & GDISTRETCHED) if (addr=RemapLibrary(proc, hModule, ScaledHooks)) return addr;
|
||||
if (dxw.dwFlags3 & GDIEMULATEDC) if (addr=RemapLibrary(proc, hModule, EmulateHooks)) return addr;
|
||||
if (dxw.dwFlags2 & GDISTRETCHED)
|
||||
if (addr=RemapLibrary(proc, hModule, ScaledHooks)) return addr;
|
||||
if (dxw.dwFlags3 & GDIEMULATEDC)
|
||||
if (addr=RemapLibrary(proc, hModule, EmulateHooks)) return addr;
|
||||
if (!(dxw.dwFlags2 & GDISTRETCHED) && !(dxw.dwFlags3 & GDIEMULATEDC))
|
||||
if (addr=RemapLibrary(proc, hModule, NoGDIHooks)) return addr;
|
||||
|
||||
if (dxw.dwFlags1 & MODIFYMOUSE) if (addr=RemapLibrary(proc, hModule, MouseHooks)) return addr;
|
||||
if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE))
|
||||
if (addr=RemapLibrary(proc, hModule, WinHooks)) return addr;
|
||||
if ((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED))
|
||||
if (addr=RemapLibrary(proc, hModule, MouseHooks2)) return addr;
|
||||
if (addr=RemapLibrary(proc, hModule, MouseHooks)) return addr;
|
||||
if (dxw.dwFlags3 & PEEKALLMESSAGES)
|
||||
if (addr=RemapLibrary(proc, hModule, PeekAllHooks)) return addr;
|
||||
if((dxw.dwFlags2 & TIMESTRETCH) && (dxw.dwFlags4 & STRETCHTIMERS))
|
||||
@ -265,9 +258,6 @@ static char *libname = "user32.dll";
|
||||
|
||||
void HookUser32(HMODULE hModule)
|
||||
{
|
||||
GDIEmulationMode = GDIMODE_STRETCHED; // default
|
||||
if (dxw.dwFlags2 & GDISTRETCHED) GDIEmulationMode = GDIMODE_STRETCHED;
|
||||
if (dxw.dwFlags3 & GDIEMULATEDC) GDIEmulationMode = GDIMODE_EMULATED;
|
||||
|
||||
HookLibrary(hModule, Hooks, libname);
|
||||
if (!(dxw.dwFlags2 & GDISTRETCHED) && !(dxw.dwFlags3 & GDIEMULATEDC))
|
||||
@ -276,9 +266,8 @@ void HookUser32(HMODULE hModule)
|
||||
if (dxw.dwFlags2 & GDISTRETCHED) HookLibrary(hModule, ScaledHooks, libname);
|
||||
|
||||
if (dxw.dwFlags1 & CLIENTREMAPPING) HookLibrary(hModule, RemapHooks, libname);
|
||||
if (dxw.dwFlags1 & MODIFYMOUSE) HookLibrary(hModule, MouseHooks, libname);
|
||||
if (dxw.dwFlags1 & (PREVENTMAXIMIZE|FIXWINFRAME|LOCKWINPOS|LOCKWINSTYLE)) HookLibrary(hModule, WinHooks, libname);
|
||||
if ((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)) HookLibrary(hModule, MouseHooks2, libname);
|
||||
if ((dxw.dwFlags1 & (MODIFYMOUSE|SLOWDOWN|KEEPCURSORWITHIN)) || (dxw.dwFlags2 & KEEPCURSORFIXED)) HookLibrary(hModule, MouseHooks, libname);
|
||||
if (dxw.dwFlags3 & PEEKALLMESSAGES) HookLibrary(hModule, PeekAllHooks, libname);
|
||||
if (dxw.dwFlags2 & TIMESTRETCH) HookLibrary(hModule, TimeHooks, libname);
|
||||
|
||||
@ -294,7 +283,6 @@ void HookUser32Init()
|
||||
HookLibInit(RemapHooks);
|
||||
HookLibInit(MouseHooks);
|
||||
HookLibInit(WinHooks);
|
||||
HookLibInit(MouseHooks2);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------ */
|
||||
@ -621,7 +609,7 @@ BOOL WINAPI extInvalidateRect(HWND hwnd, RECT *lpRect, BOOL bErase)
|
||||
hwnd, bErase);
|
||||
|
||||
if(dxw.IsFullScreen()) {
|
||||
switch(GDIEmulationMode){
|
||||
switch(dxw.GDIEmulationMode){
|
||||
case GDIMODE_STRETCHED:
|
||||
if(lpRect) dxw.MapClient(lpRect);
|
||||
break;
|
||||
@ -995,36 +983,6 @@ BOOL WINAPI extSetCursorPos(int x, int y)
|
||||
}
|
||||
|
||||
if(dxw.dwFlags1 & MODIFYMOUSE){
|
||||
#if 0
|
||||
POINT cur;
|
||||
RECT rect;
|
||||
|
||||
// find window metrics
|
||||
if (!(*pGetClientRect)(dxw.GethWnd(), &rect)) {
|
||||
// report error and ignore ...
|
||||
OutTraceE("GetClientRect(%x) ERROR %d at %d\n", dxw.GethWnd(), GetLastError(), __LINE__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
x= x * rect.right / dxw.GetScreenWidth();
|
||||
y= y * rect.bottom / dxw.GetScreenHeight();
|
||||
|
||||
// check for boundaries (???)
|
||||
if (x >= rect.right) x=rect.right-1;
|
||||
if (x<0) x=0;
|
||||
if (y >= rect.bottom) y=rect.bottom-1;
|
||||
if (y<0) y=0;
|
||||
|
||||
// make it screen absolute
|
||||
cur.x = x;
|
||||
cur.y = y;
|
||||
if (!(*pClientToScreen)(dxw.GethWnd(), &cur)) {
|
||||
OutTraceE("ClientToScreen(%x) ERROR %d at %d\n", dxw.GethWnd(), GetLastError(), __LINE__);
|
||||
return 0;
|
||||
}
|
||||
x = cur.x;
|
||||
y = cur.y;
|
||||
#else
|
||||
// v2.03.41
|
||||
POINT cur;
|
||||
cur.x = x;
|
||||
@ -1032,7 +990,6 @@ BOOL WINAPI extSetCursorPos(int x, int y)
|
||||
dxw.MapWindow(&cur);
|
||||
x = cur.x;
|
||||
y = cur.y;
|
||||
#endif
|
||||
}
|
||||
|
||||
res=0;
|
||||
@ -1991,7 +1948,7 @@ static HDC WINAPI sGetDC(HWND hwnd, char *ApiName)
|
||||
if(ret) return ret;
|
||||
}
|
||||
|
||||
switch(GDIEmulationMode){
|
||||
switch(dxw.GDIEmulationMode){
|
||||
case GDIMODE_STRETCHED:
|
||||
ret=(*pGDIGetDC)(lochwnd);
|
||||
break;
|
||||
@ -2058,7 +2015,7 @@ int WINAPI extGDIReleaseDC(HWND hwnd, HDC hDC)
|
||||
|
||||
if(bFlippedDC && (hDC == hFlippedDC)) return dxw.ReleaseSharedDC(hwnd, hDC);
|
||||
|
||||
switch(GDIEmulationMode){
|
||||
switch(dxw.GDIEmulationMode){
|
||||
case GDIMODE_STRETCHED:
|
||||
res=(*pGDIReleaseDC)(hwnd, hDC);
|
||||
break;
|
||||
@ -2090,7 +2047,7 @@ HDC WINAPI extBeginPaint(HWND hwnd, LPPAINTSTRUCT lpPaint)
|
||||
hdc = dxw.AcquireSharedDC(hwnd);
|
||||
}
|
||||
else {
|
||||
switch(GDIEmulationMode){
|
||||
switch(dxw.GDIEmulationMode){
|
||||
case GDIMODE_STRETCHED:
|
||||
// on CLIENTREMAPPING, resize the paint area to virtual screen size
|
||||
//if(dxw.dwFlags1 & CLIENTREMAPPING) lpPaint->rcPaint=dxw.GetScreenRect();
|
||||
@ -2127,7 +2084,7 @@ BOOL WINAPI extEndPaint(HWND hwnd, const PAINTSTRUCT *lpPaint)
|
||||
// avoid access to real desktop
|
||||
if(dxw.IsRealDesktop(hwnd)) hwnd=dxw.GethWnd();
|
||||
|
||||
switch(GDIEmulationMode){
|
||||
switch(dxw.GDIEmulationMode){
|
||||
case GDIMODE_STRETCHED:
|
||||
ret=(*pEndPaint)(hwnd, lpPaint);
|
||||
break;
|
||||
|
@ -335,34 +335,54 @@ MMRESULT WINAPI extjoyGetPosEx(DWORD uJoyID, LPJOYINFOEX pji)
|
||||
LONG x, y;
|
||||
HWND hwnd;
|
||||
DWORD dwButtons;
|
||||
static BOOL bJoyLock = FALSE;
|
||||
static DWORD dwLastClick = 0;
|
||||
|
||||
dwButtons = 0;
|
||||
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);
|
||||
|
||||
if(dwButtons == JOY_BUTTON3){
|
||||
if(((*pGetTickCount)() - dwLastClick) > 200){
|
||||
bJoyLock = !bJoyLock;
|
||||
dwButtons &= ~JOY_BUTTON3;
|
||||
dwLastClick = (*pGetTickCount)();
|
||||
}
|
||||
}
|
||||
|
||||
POINT pt;
|
||||
if(hwnd=dxw.GethWnd()){
|
||||
RECT client;
|
||||
POINT upleft = {0,0};
|
||||
(*pGetClientRect)(hwnd, &client);
|
||||
(*pClientToScreen)(hwnd, &upleft);
|
||||
if(dwButtons & JOY_BUTTON3){
|
||||
// center joystick ...
|
||||
dwButtons &= ~JOY_BUTTON3;
|
||||
(*pSetCursorPos)(upleft.x + (client.right >> 1), upleft.y + (client.bottom >> 1));
|
||||
}
|
||||
(*pGetCursorPos)(&pt);
|
||||
pt.x -= upleft.x;
|
||||
pt.y -= upleft.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;
|
||||
if(INVERTJOYAXIS)
|
||||
y = ((client.bottom - pt.y) * YSPAN) / client.bottom; // inverted y axis
|
||||
else
|
||||
pt.y = (pt.y * YSPAN) / dxw.GetScreenHeight();
|
||||
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);
|
||||
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);
|
||||
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;
|
||||
if(INVERTJOYAXIS)
|
||||
y = ((client.bottom - pt.y) * YSPAN) / client.bottom; // inverted y axis
|
||||
else
|
||||
pt.y = (pt.y * YSPAN) / dxw.GetScreenHeight();
|
||||
}
|
||||
ShowJoystick(pt.x, pt.y, dwButtons);
|
||||
}
|
||||
else {
|
||||
@ -393,6 +413,7 @@ static void ShowJoystick(LONG x, LONG y, DWORD dwButtons)
|
||||
static HBITMAP g_hbmJoyFire1;
|
||||
static HBITMAP g_hbmJoyFire2;
|
||||
static HBITMAP g_hbmJoyFire3;
|
||||
static HBITMAP g_hbmJoyCenter;
|
||||
HBITMAP g_hbmJoy;
|
||||
RECT client;
|
||||
RECT win;
|
||||
@ -412,6 +433,7 @@ static void ShowJoystick(LONG x, LONG y, DWORD dwButtons)
|
||||
g_hbmJoyFire1 = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_FIRE1));
|
||||
g_hbmJoyFire2 = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_FIRE2));
|
||||
g_hbmJoyFire3 = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_FIRE3));
|
||||
g_hbmJoyCenter = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_JOYCENTER));
|
||||
JustOnce=TRUE;
|
||||
}
|
||||
|
||||
@ -420,8 +442,13 @@ static void ShowJoystick(LONG x, LONG y, DWORD dwButtons)
|
||||
case 0: g_hbmJoy = g_hbmJoyCross; break;
|
||||
case JOY_BUTTON1: g_hbmJoy = g_hbmJoyFire1; break;
|
||||
case JOY_BUTTON2: g_hbmJoy = g_hbmJoyFire2; break;
|
||||
default: g_hbmJoy = g_hbmJoyFire3; break;
|
||||
case JOY_BUTTON1|JOY_BUTTON2: g_hbmJoy = g_hbmJoyFire3; break;
|
||||
case JOY_BUTTON3: g_hbmJoy = g_hbmJoyCenter; break;
|
||||
default: g_hbmJoy = NULL; break;
|
||||
}
|
||||
|
||||
if(g_hbmJoy == NULL) return; // show nothing ...
|
||||
|
||||
HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_hbmJoy);
|
||||
GetObject(g_hbmJoy, sizeof(bm), &bm);
|
||||
|
||||
|
@ -391,6 +391,9 @@ LRESULT CALLBACK extWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
|
||||
// turn DirectInput bActive flag on & off .....
|
||||
if(message == WM_NCACTIVATE) dxw.bActive = wparam;
|
||||
if(dxw.bActive) (*pSetWindowPos)(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
if(dxw.dwFlags6 & UNACQUIRE){
|
||||
ToggleAcquiredDevices(dxw.bActive);
|
||||
}
|
||||
if(dxw.dwFlags1 & UNNOTIFY){
|
||||
DefWindowProc(hwnd, message, wparam, lparam);
|
||||
return false;
|
||||
|
@ -44,6 +44,7 @@ void CTabInput::DoDataExchange(CDataExchange* pDX)
|
||||
//DDX_Check(pDX, IDC_FRAMECOMPENSATION, cTarget->m_FrameCompensation);
|
||||
// DirectInput
|
||||
DDX_Check(pDX, IDC_HOOKDI, cTarget->m_HookDI);
|
||||
DDX_Check(pDX, IDC_UNACQUIRE, cTarget->m_Unacquire);
|
||||
DDX_Text(pDX, IDC_INITX, cTarget->m_InitX);
|
||||
DDX_Text(pDX, IDC_INITY, cTarget->m_InitY);
|
||||
DDX_Text(pDX, IDC_MAXX, cTarget->m_MaxX);
|
||||
|
@ -30,6 +30,7 @@ CTargetDlg::CTargetDlg(CWnd* pParent /*=NULL*/)
|
||||
m_HookDI = FALSE;
|
||||
m_ModifyMouse = TRUE; // default true !!
|
||||
m_VirtualJoystick = FALSE;
|
||||
m_Unacquire = FALSE;
|
||||
m_LogEnabled = FALSE;
|
||||
m_OutProxyTrace = FALSE;
|
||||
m_OutDebug = FALSE;
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
BOOL m_HookDI;
|
||||
BOOL m_ModifyMouse;
|
||||
BOOL m_VirtualJoystick;
|
||||
BOOL m_Unacquire;
|
||||
BOOL m_OutProxyTrace;
|
||||
BOOL m_OutDebug;
|
||||
BOOL m_CursorTrace;
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -249,6 +249,7 @@ static void SetTargetFromDlg(TARGETMAP *t, CTargetDlg *dlg)
|
||||
if(dlg->m_HookDI) t->flags |= HOOKDI;
|
||||
if(dlg->m_ModifyMouse) t->flags |= MODIFYMOUSE;
|
||||
if(dlg->m_VirtualJoystick) t->flags6 |= VIRTUALJOYSTICK;
|
||||
if(dlg->m_Unacquire) t->flags6 |= UNACQUIRE;
|
||||
if(dlg->m_OutProxyTrace) t->tflags |= OUTPROXYTRACE;
|
||||
if(dlg->m_OutDebug) t->tflags |= OUTDEBUG;
|
||||
if(dlg->m_CursorTrace) t->tflags |= OUTCURSORTRACE;
|
||||
@ -490,6 +491,7 @@ static void SetDlgFromTarget(TARGETMAP *t, CTargetDlg *dlg)
|
||||
dlg->m_HookDI = t->flags & HOOKDI ? 1 : 0;
|
||||
dlg->m_ModifyMouse = t->flags & MODIFYMOUSE ? 1 : 0;
|
||||
dlg->m_VirtualJoystick = t->flags6 & VIRTUALJOYSTICK ? 1 : 0;
|
||||
dlg->m_Unacquire = t->flags6 & UNACQUIRE ? 1 : 0;
|
||||
dlg->m_OutProxyTrace = t->tflags & OUTPROXYTRACE ? 1 : 0;
|
||||
dlg->m_OutDebug = t->tflags & OUTDEBUG ? 1 : 0;
|
||||
dlg->m_CursorTrace = t->tflags & OUTCURSORTRACE ? 1 : 0;
|
||||
|
BIN
host/resource
BIN
host/resource
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user