[DINPUT] get Unreal Tournament 2003 (and maybe Unreal2) starting
Lionel Ulmer
lionel.ulmer at free.fr
Thu May 15 13:25:45 CDT 2003
> lionel, why the IID_IDirectInput8W is considered as an old version of DINPUT
> ? ;))
Don't ask me, the DInput8 code was done by Transgaming.
Anyway, this was on my TODO list to get America's Amry to start with
built-in DInput but it seems you beat me to it (a pitty there is no public
transportation strike where I live or that I take the bike :-) ).
Anyway, I have just one comment :
> +/******************************************************************************
> + * IDirectInputW_EnumDevices
> + */
> +static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
> + LPDIRECTINPUT7W iface, DWORD dwDevType, LPDIENUMDEVICESCALLBACKW lpCallback,
> + LPVOID pvRef, DWORD dwFlags
> +)
> +{
> + ICOM_THIS(IDirectInputAImpl,iface);
> + DIDEVICEINSTANCEA devInstance;
> + DIDEVICEINSTANCEW newDevInstance;
> + int i;
> +
> + TRACE("(this=%p,0x%04lx,%p,%p,%04lx)\n", This, dwDevType, lpCallback, pvRef, dwFlags);
> +
> + for (i = 0; i < nrof_dinput_devices; i++) {
> + devInstance.dwSize = sizeof(devInstance);
> + if (dinput_devices[i]->enum_device(dwDevType, dwFlags, &devInstance)) {
> + newDevInstance.dwSize = sizeof(DIDEVICEINSTANCEW);
> + newDevInstance.guidInstance = devInstance.guidInstance;
> + newDevInstance.guidProduct = devInstance.guidProduct;
> + newDevInstance.dwDevType = devInstance.dwDevType;
> + MultiByteToWideChar( CP_ACP, 0, devInstance.tszInstanceName, -1, newDevInstance.tszInstanceName, MAX_PATH);
> + MultiByteToWideChar( CP_ACP, 0, devInstance.tszProductName, -1, newDevInstance.tszProductName, MAX_PATH);
> + if (lpCallback(&newDevInstance,pvRef) == DIENUM_STOP)
> + return 0;
> + }
> + }
> +
> + return 0;
> +}
>
Just to be on the pedantic side, it would be better to share this code...
For example by calling the DInput8A function with a special callback written
in the Wine code that converts the strings from A to W before calling the
'real' callback.
Even better would be to have our code work like the rest of Wine : ie having
A using the W code and not the reverse :-)
Another question, did you investigate this code : SysKeyboardAImpl_EnumObjects ?
This returns an 'A' pointer as part of the 'DIDEVICEOBJECTINSTANCEA'
structure... If a 'DIDEVICEOBJECTINSTANCEW' is used in the case of the W
interface, this needs to be changed too.
Lionel
--
Lionel Ulmer - http://www.bbrox.org/
More information about the wine-devel
mailing list