mirror of
https://github.com/reactos/reactos.git
synced 2024-10-02 07:26:47 +00:00
[DINPUT] Sync with Wine Staging 1.9.11. CORE-11368
svn path=/trunk/; revision=71759
This commit is contained in:
parent
b30f3bad0f
commit
b0105c5dc3
|
@ -764,7 +764,6 @@ HRESULT _build_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf,
|
||||||
|
|
||||||
HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df)
|
HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, LPCWSTR lpszUserName, DWORD dwFlags, LPCDIDATAFORMAT df)
|
||||||
{
|
{
|
||||||
static const WCHAR emptyW[] = { 0 };
|
|
||||||
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
IDirectInputDeviceImpl *This = impl_from_IDirectInputDevice8W(iface);
|
||||||
DIDATAFORMAT data_format;
|
DIDATAFORMAT data_format;
|
||||||
DIOBJECTDATAFORMAT *obj_df = NULL;
|
DIOBJECTDATAFORMAT *obj_df = NULL;
|
||||||
|
@ -855,7 +854,10 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
|
||||||
dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
dps.diph.dwHeaderSize = sizeof(DIPROPHEADER);
|
||||||
dps.diph.dwObj = 0;
|
dps.diph.dwObj = 0;
|
||||||
dps.diph.dwHow = DIPH_DEVICE;
|
dps.diph.dwHow = DIPH_DEVICE;
|
||||||
lstrcpynW(dps.wsz, (dwFlags & DIDSAM_NOUSER) ? emptyW : username, sizeof(dps.wsz)/sizeof(WCHAR));
|
if (dwFlags & DIDSAM_NOUSER)
|
||||||
|
dps.wsz[0] = '\0';
|
||||||
|
else
|
||||||
|
lstrcpynW(dps.wsz, username, sizeof(dps.wsz)/sizeof(WCHAR));
|
||||||
IDirectInputDevice8_SetProperty(iface, DIPROP_USERNAME, &dps.diph);
|
IDirectInputDevice8_SetProperty(iface, DIPROP_USERNAME, &dps.diph);
|
||||||
|
|
||||||
/* Save the settings to disk */
|
/* Save the settings to disk */
|
||||||
|
@ -1095,9 +1097,6 @@ ULONG WINAPI IDirectInputDevice2WImpl_Release(LPDIRECTINPUTDEVICE8W iface)
|
||||||
/* Free action mapping */
|
/* Free action mapping */
|
||||||
HeapFree(GetProcessHeap(), 0, This->action_map);
|
HeapFree(GetProcessHeap(), 0, This->action_map);
|
||||||
|
|
||||||
/* Free username */
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->username);
|
|
||||||
|
|
||||||
EnterCriticalSection( &This->dinput->crit );
|
EnterCriticalSection( &This->dinput->crit );
|
||||||
list_remove( &This->entry );
|
list_remove( &This->entry );
|
||||||
LeaveCriticalSection( &This->dinput->crit );
|
LeaveCriticalSection( &This->dinput->crit );
|
||||||
|
@ -1255,8 +1254,6 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface,
|
||||||
|
|
||||||
if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
|
if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
|
||||||
|
|
||||||
ps->wsz[0] = 0;
|
|
||||||
if (This->username)
|
|
||||||
lstrcpynW(ps->wsz, This->username, sizeof(ps->wsz)/sizeof(WCHAR));
|
lstrcpynW(ps->wsz, This->username, sizeof(ps->wsz)/sizeof(WCHAR));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1339,14 +1336,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(
|
||||||
|
|
||||||
if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
|
if (pdiph->dwSize != sizeof(DIPROPSTRING)) return DIERR_INVALIDPARAM;
|
||||||
|
|
||||||
if (!This->username)
|
lstrcpynW(This->username, ps->wsz, sizeof(This->username)/sizeof(WCHAR));
|
||||||
This->username = HeapAlloc(GetProcessHeap(), 0, sizeof(ps->wsz));
|
|
||||||
if (!This->username)
|
|
||||||
return DIERR_OUTOFMEMORY;
|
|
||||||
|
|
||||||
This->username[0] = 0;
|
|
||||||
if (ps->wsz)
|
|
||||||
lstrcpynW(This->username, ps->wsz, sizeof(ps->wsz)/sizeof(WCHAR));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct IDirectInputDeviceImpl
|
||||||
/* Action mapping */
|
/* Action mapping */
|
||||||
int num_actions; /* number of actions mapped */
|
int num_actions; /* number of actions mapped */
|
||||||
ActionMap *action_map; /* array of mappings */
|
ActionMap *action_map; /* array of mappings */
|
||||||
WCHAR *username; /* set by 'SetActionMap' */
|
WCHAR username[MAX_PATH];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
|
extern BOOL get_app_key(HKEY*, HKEY*) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -67,6 +67,11 @@ static inline LinuxInputEffectImpl *impl_from_IDirectInputEffect(IDirectInputEff
|
||||||
return CONTAINING_RECORD(iface, LinuxInputEffectImpl, IDirectInputEffect_iface);
|
return CONTAINING_RECORD(iface, LinuxInputEffectImpl, IDirectInputEffect_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static double ff_effect_direction_to_rad(unsigned int dir)
|
||||||
|
{
|
||||||
|
return (dir & 0xffff) * M_PI / 0x8000;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* LinuxInputEffectImpl
|
* LinuxInputEffectImpl
|
||||||
*/
|
*/
|
||||||
|
@ -172,8 +177,10 @@ static HRESULT WINAPI LinuxInputEffectImpl_GetParameters(
|
||||||
return diErr;
|
return diErr;
|
||||||
else {
|
else {
|
||||||
if (peff->dwFlags & DIEFF_CARTESIAN) {
|
if (peff->dwFlags & DIEFF_CARTESIAN) {
|
||||||
peff->rglDirection[0] = sin(M_PI * 3 * This->effect.direction / 0x7FFF) * 1000;
|
/* rotate so 0 points right */
|
||||||
peff->rglDirection[1] = cos(M_PI * 3 * This->effect.direction / 0x7FFF) * 1000;
|
double angle = ff_effect_direction_to_rad(This->effect.direction + 0xc000);
|
||||||
|
peff->rglDirection[0] = sin(angle) * 1000;
|
||||||
|
peff->rglDirection[1] = -cos(angle) * 1000;
|
||||||
} else {
|
} else {
|
||||||
/* Polar and spherical coordinates are the same for two or less
|
/* Polar and spherical coordinates are the same for two or less
|
||||||
* axes.
|
* axes.
|
||||||
|
@ -505,9 +512,11 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
|
||||||
/* One condition block. This needs to be rotated to direction,
|
/* One condition block. This needs to be rotated to direction,
|
||||||
* and expanded to separate x and y conditions. */
|
* and expanded to separate x and y conditions. */
|
||||||
int i;
|
int i;
|
||||||
double factor[2];
|
double factor[2], angle;
|
||||||
factor[0] = asin((This->effect.direction * 3.0 * M_PI) / 0x7FFF);
|
/* rotate so 0 points right */
|
||||||
factor[1] = acos((This->effect.direction * 3.0 * M_PI) / 0x7FFF);
|
angle = ff_effect_direction_to_rad(This->effect.direction + 0xc000);
|
||||||
|
factor[0] = sin(angle);
|
||||||
|
factor[1] = -cos(angle);
|
||||||
for (i = 0; i < 2; ++i) {
|
for (i = 0; i < 2; ++i) {
|
||||||
This->effect.u.condition[i].center = (int)(factor[i] * (tsp->lOffset / 10) * 32);
|
This->effect.u.condition[i].center = (int)(factor[i] * (tsp->lOffset / 10) * 32);
|
||||||
This->effect.u.condition[i].right_coeff = (int)(factor[i] * (tsp->lPositiveCoefficient / 10) * 32);
|
This->effect.u.condition[i].right_coeff = (int)(factor[i] * (tsp->lPositiveCoefficient / 10) * 32);
|
||||||
|
|
|
@ -143,7 +143,7 @@ static INT find_joystick_devices(void)
|
||||||
#ifdef JSIOCGAXES
|
#ifdef JSIOCGAXES
|
||||||
if (ioctl(fd, JSIOCGAXES, &joydev.axis_count) < 0)
|
if (ioctl(fd, JSIOCGAXES, &joydev.axis_count) < 0)
|
||||||
{
|
{
|
||||||
WARN("ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2\n", joydev.device, strerror(errno));
|
WARN("ioctl(%s,JSIOCGAXES) failed: %s, defaulting to 2\n", joydev.device, strerror(errno));
|
||||||
joydev.axis_count = 2;
|
joydev.axis_count = 2;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -153,7 +153,7 @@ static INT find_joystick_devices(void)
|
||||||
#ifdef JSIOCGBUTTONS
|
#ifdef JSIOCGBUTTONS
|
||||||
if (ioctl(fd, JSIOCGBUTTONS, &joydev.button_count) < 0)
|
if (ioctl(fd, JSIOCGBUTTONS, &joydev.button_count) < 0)
|
||||||
{
|
{
|
||||||
WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n", joydev.device, strerror(errno));
|
WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defaulting to 2\n", joydev.device, strerror(errno));
|
||||||
joydev.button_count = 2;
|
joydev.button_count = 2;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1474,7 +1474,7 @@ static HRESULT WINAPI effect_QueryInterface(IDirectInputEffect *iface,
|
||||||
|
|
||||||
TRACE("%p %s %p\n", This, debugstr_guid(guid), out);
|
TRACE("%p %s %p\n", This, debugstr_guid(guid), out);
|
||||||
|
|
||||||
if(IsEqualIID(guid, &IID_IDirectInputEffect)){
|
if(IsEqualIID(guid, &IID_IUnknown) || IsEqualIID(guid, &IID_IDirectInputEffect)){
|
||||||
*out = iface;
|
*out = iface;
|
||||||
IDirectInputEffect_AddRef(iface);
|
IDirectInputEffect_AddRef(iface);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -30,7 +30,7 @@ reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-1.9.4
|
||||||
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.9.4
|
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.9.4
|
||||||
reactos/dll/directx/wine/ddraw # Synced to WineStaging-1.9.4
|
reactos/dll/directx/wine/ddraw # Synced to WineStaging-1.9.4
|
||||||
reactos/dll/directx/wine/devenum # Synced to WineStaging-1.9.11
|
reactos/dll/directx/wine/devenum # Synced to WineStaging-1.9.11
|
||||||
reactos/dll/directx/wine/dinput # Synced to WineStaging-1.9.4
|
reactos/dll/directx/wine/dinput # Synced to WineStaging-1.9.11
|
||||||
reactos/dll/directx/wine/dinput8 # Synced to WineStaging-1.9.4
|
reactos/dll/directx/wine/dinput8 # Synced to WineStaging-1.9.4
|
||||||
reactos/dll/directx/wine/dmusic # Synced to WineStaging-1.9.4
|
reactos/dll/directx/wine/dmusic # Synced to WineStaging-1.9.4
|
||||||
reactos/dll/directx/wine/dplay # Synced to WineStaging-1.9.4
|
reactos/dll/directx/wine/dplay # Synced to WineStaging-1.9.4
|
||||||
|
|
Loading…
Reference in a new issue