dinput: Initialize event sequence counter. And simplify code.
This commit is contained in:
parent
76fe25241d
commit
7f838ca661
|
@ -84,55 +84,50 @@ HRESULT WINAPI DirectInputCreateEx(
|
||||||
HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI,
|
HINSTANCE hinst, DWORD dwVersion, REFIID riid, LPVOID *ppDI,
|
||||||
LPUNKNOWN punkOuter)
|
LPUNKNOWN punkOuter)
|
||||||
{
|
{
|
||||||
IDirectInputImpl* This;
|
IDirectInputImpl* This;
|
||||||
|
HRESULT res = DIERR_OLDDIRECTINPUTVERSION;
|
||||||
|
LPCVOID vtable = NULL;
|
||||||
|
|
||||||
TRACE("(%p,%04lx,%s,%p,%p)\n", hinst,dwVersion,debugstr_guid(riid),ppDI,punkOuter);
|
TRACE("(%p,%04lx,%s,%p,%p)\n", hinst,dwVersion,debugstr_guid(riid),ppDI,punkOuter);
|
||||||
|
|
||||||
if (IsEqualGUID(&IID_IDirectInputA,riid) ||
|
if (IsEqualGUID(&IID_IDirectInputA,riid) ||
|
||||||
IsEqualGUID(&IID_IDirectInput2A,riid) ||
|
IsEqualGUID(&IID_IDirectInput2A,riid) ||
|
||||||
IsEqualGUID(&IID_IDirectInput7A,riid)) {
|
IsEqualGUID(&IID_IDirectInput7A,riid))
|
||||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
{
|
||||||
This->lpVtbl = &ddi7avt;
|
vtable = &ddi7avt;
|
||||||
This->ref = 1;
|
res = DI_OK;
|
||||||
This->dwVersion = dwVersion;
|
}
|
||||||
*ppDI = This;
|
|
||||||
|
|
||||||
return DI_OK;
|
if (IsEqualGUID(&IID_IDirectInputW,riid) ||
|
||||||
}
|
IsEqualGUID(&IID_IDirectInput2W,riid) ||
|
||||||
|
IsEqualGUID(&IID_IDirectInput7W,riid))
|
||||||
|
{
|
||||||
|
vtable = &ddi7wvt;
|
||||||
|
res = DI_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsEqualGUID(&IID_IDirectInputW,riid) ||
|
if (IsEqualGUID(&IID_IDirectInput8A,riid))
|
||||||
IsEqualGUID(&IID_IDirectInput2W,riid) ||
|
{
|
||||||
IsEqualGUID(&IID_IDirectInput7W,riid)) {
|
vtable = &ddi8avt;
|
||||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
res = DI_OK;
|
||||||
This->lpVtbl = &ddi7wvt;
|
}
|
||||||
This->ref = 1;
|
|
||||||
This->dwVersion = dwVersion;
|
|
||||||
*ppDI = This;
|
|
||||||
|
|
||||||
return DI_OK;
|
if (IsEqualGUID(&IID_IDirectInput8W,riid))
|
||||||
}
|
{
|
||||||
|
vtable = &ddi8wvt;
|
||||||
|
res = DI_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsEqualGUID(&IID_IDirectInput8A,riid)) {
|
if (res == DI_OK)
|
||||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
{
|
||||||
This->lpVtbl = &ddi8avt;
|
This = HeapAlloc(GetProcessHeap(), 0, sizeof(IDirectInputImpl));
|
||||||
This->ref = 1;
|
This->lpVtbl = vtable;
|
||||||
This->dwVersion = dwVersion;
|
This->ref = 1;
|
||||||
*ppDI = This;
|
This->dwVersion = dwVersion;
|
||||||
|
This->evsequence = 1;
|
||||||
return DI_OK;
|
*ppDI = This;
|
||||||
}
|
}
|
||||||
|
return res;
|
||||||
if (IsEqualGUID(&IID_IDirectInput8W,riid)) {
|
|
||||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
|
||||||
This->lpVtbl = &ddi8wvt;
|
|
||||||
This->ref = 1;
|
|
||||||
This->dwVersion = dwVersion;
|
|
||||||
*ppDI = This;
|
|
||||||
|
|
||||||
return DI_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DIERR_OLDDIRECTINPUTVERSION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -140,15 +135,7 @@ HRESULT WINAPI DirectInputCreateEx(
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter)
|
HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter)
|
||||||
{
|
{
|
||||||
IDirectInputImpl* This;
|
return DirectInputCreateEx(hinst, dwVersion, &IID_IDirectInput7A, (LPVOID *)ppDI, punkOuter);
|
||||||
TRACE("(%p,%04lx,%p,%p)\n", hinst,dwVersion,ppDI,punkOuter);
|
|
||||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
|
||||||
This->lpVtbl = &ddi7avt;
|
|
||||||
This->ref = 1;
|
|
||||||
This->dwVersion = dwVersion;
|
|
||||||
*ppDI = (IDirectInputA*)This;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -156,14 +143,7 @@ HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPU
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter)
|
HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter)
|
||||||
{
|
{
|
||||||
IDirectInputImpl* This;
|
return DirectInputCreateEx(hinst, dwVersion, &IID_IDirectInput7W, (LPVOID *)ppDI, punkOuter);
|
||||||
TRACE("(%p,%04lx,%p,%p)\n", hinst,dwVersion,ppDI,punkOuter);
|
|
||||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
|
||||||
This->lpVtbl = &ddi7wvt;
|
|
||||||
This->ref = 1;
|
|
||||||
This->dwVersion = dwVersion;
|
|
||||||
*ppDI = (IDirectInputW*)This;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *_dump_DIDEVTYPE_value(DWORD dwDevType) {
|
static const char *_dump_DIDEVTYPE_value(DWORD dwDevType) {
|
||||||
|
|
Loading…
Reference in New Issue