dinput: [joystick_linux] Reuse the same properties array.
This commit is contained in:
parent
3989e0feb8
commit
60948ab1f0
|
@ -654,7 +654,6 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat(
|
||||||
{
|
{
|
||||||
JoystickImpl *This = (JoystickImpl *)iface;
|
JoystickImpl *This = (JoystickImpl *)iface;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
ObjProps * new_props = 0;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p,%p)\n",This,df);
|
TRACE("(%p,%p)\n",This,df);
|
||||||
|
@ -662,13 +661,8 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat(
|
||||||
hr = IDirectInputDevice2AImpl_SetDataFormat(iface, df);
|
hr = IDirectInputDevice2AImpl_SetDataFormat(iface, df);
|
||||||
if (FAILED(hr)) return hr;
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
new_props = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*sizeof(ObjProps));
|
for (i = 0; i < This->base.data_format.wine_df->dwNumObjs; i++)
|
||||||
if (!new_props) return DIERR_OUTOFMEMORY;
|
{
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(),0,This->props);
|
|
||||||
|
|
||||||
This->props = new_props;
|
|
||||||
for (i = 0; i < df->dwNumObjs; i++) {
|
|
||||||
This->props[i].lMin = 0;
|
This->props[i].lMin = 0;
|
||||||
This->props[i].lMax = 0xffff;
|
This->props[i].lMax = 0xffff;
|
||||||
This->props[i].lDeadZone = 1000;
|
This->props[i].lDeadZone = 1000;
|
||||||
|
@ -928,7 +922,7 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(
|
||||||
LPCDIPROPRANGE pr = (LPCDIPROPRANGE)ph;
|
LPCDIPROPRANGE pr = (LPCDIPROPRANGE)ph;
|
||||||
if (ph->dwHow == DIPH_DEVICE) {
|
if (ph->dwHow == DIPH_DEVICE) {
|
||||||
TRACE("proprange(%d,%d) all\n", pr->lMin, pr->lMax);
|
TRACE("proprange(%d,%d) all\n", pr->lMin, pr->lMax);
|
||||||
for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++) {
|
for (i = 0; i < This->base.data_format.wine_df->dwNumObjs; i++) {
|
||||||
This->props[i].lMin = pr->lMin;
|
This->props[i].lMin = pr->lMin;
|
||||||
This->props[i].lMax = pr->lMax;
|
This->props[i].lMax = pr->lMax;
|
||||||
}
|
}
|
||||||
|
@ -948,7 +942,7 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(
|
||||||
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
|
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
|
||||||
if (ph->dwHow == DIPH_DEVICE) {
|
if (ph->dwHow == DIPH_DEVICE) {
|
||||||
TRACE("deadzone(%d) all\n", pd->dwData);
|
TRACE("deadzone(%d) all\n", pd->dwData);
|
||||||
for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++)
|
for (i = 0; i < This->base.data_format.wine_df->dwNumObjs; i++)
|
||||||
This->props[i].lDeadZone = pd->dwData;
|
This->props[i].lDeadZone = pd->dwData;
|
||||||
} else {
|
} else {
|
||||||
int obj = find_property(&This->base.data_format, ph);
|
int obj = find_property(&This->base.data_format, ph);
|
||||||
|
@ -965,7 +959,7 @@ static HRESULT WINAPI JoystickAImpl_SetProperty(
|
||||||
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
|
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
|
||||||
if (ph->dwHow == DIPH_DEVICE) {
|
if (ph->dwHow == DIPH_DEVICE) {
|
||||||
TRACE("saturation(%d) all\n", pd->dwData);
|
TRACE("saturation(%d) all\n", pd->dwData);
|
||||||
for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++)
|
for (i = 0; i < This->base.data_format.wine_df->dwNumObjs; i++)
|
||||||
This->props[i].lSaturation = pd->dwData;
|
This->props[i].lSaturation = pd->dwData;
|
||||||
} else {
|
} else {
|
||||||
int obj = find_property(&This->base.data_format, ph);
|
int obj = find_property(&This->base.data_format, ph);
|
||||||
|
|
Loading…
Reference in New Issue