idzhook/zinput.c: Clean up some clutter

This commit is contained in:
Tau 2019-11-03 16:14:26 -05:00
parent 59ad491d08
commit a5a42c3326

View File

@ -19,56 +19,58 @@ HRESULT WINAPI hook_DirectInput8Create(
LPVOID *ppvOut, LPVOID *ppvOut,
LPUNKNOWN punkOuter); LPUNKNOWN punkOuter);
static unsigned long WINAPI my_AddRef(IUnknown *self); static unsigned long WINAPI hook_AddRef(IUnknown *self);
static unsigned long WINAPI my_Release(IUnknown *self); static unsigned long WINAPI hook_Release(IUnknown *self);
static HRESULT WINAPI my_CreateDevice( static HRESULT WINAPI hook_CreateDevice(
IDirectInput8W *self, IDirectInput8W *self,
REFGUID rguid, REFGUID rguid,
LPDIRECTINPUTDEVICE8W * lplpDirectInputDevice, LPDIRECTINPUTDEVICE8W * lplpDirectInputDevice,
LPUNKNOWN pUnkOuter); LPUNKNOWN pUnkOuter);
static HRESULT WINAPI my_EnumDevices( static HRESULT WINAPI hook_EnumDevices(
IDirectInput8W *self, IDirectInput8W *self,
DWORD dwDevType, DWORD dwDevType,
LPDIENUMDEVICESCALLBACKW lpCallback, LPDIENUMDEVICESCALLBACKW lpCallback,
LPVOID pvRef, LPVOID pvRef,
DWORD dwFlags); DWORD dwFlags);
static HRESULT WINAPI my_SetDataFormat( static HRESULT WINAPI hook_SetDataFormat(
IDirectInputDevice8W *self, IDirectInputDevice8W *self,
LPCDIDATAFORMAT lpdf); LPCDIDATAFORMAT lpdf);
static HRESULT WINAPI my_SetCooperativeLevel( static HRESULT WINAPI hook_SetCooperativeLevel(
IDirectInputDevice8W *self, IDirectInputDevice8W *self,
HWND hwnd, HWND hwnd,
DWORD flags); DWORD flags);
static HRESULT WINAPI my_Acquire(IDirectInputDevice8W *self); static HRESULT WINAPI hook_Acquire(IDirectInputDevice8W *self);
static HRESULT WINAPI my_GetDeviceState( static HRESULT WINAPI hook_Unacquire(IDirectInputDevice8W *self);
static HRESULT WINAPI hook_GetDeviceState(
IDirectInputDevice8W *self, IDirectInputDevice8W *self,
DWORD cbData, DWORD cbData,
LPVOID lpvData); LPVOID lpvData);
static const IDirectInput8WVtbl api_vtbl = { static const IDirectInput8WVtbl api_vtbl = {
.AddRef = (void *) my_AddRef, .AddRef = (void *) hook_AddRef,
.Release = (void *) my_Release, .Release = (void *) hook_Release,
.CreateDevice = my_CreateDevice, .CreateDevice = hook_CreateDevice,
.EnumDevices = my_EnumDevices, .EnumDevices = hook_EnumDevices,
}; };
static const IDirectInput8W api = { (void *) &api_vtbl }; static const IDirectInput8W api = { (void *) &api_vtbl };
static const IDirectInputDevice8WVtbl dev_vtbl = { static const IDirectInputDevice8WVtbl dev_vtbl = {
.AddRef = (void *) my_AddRef, .AddRef = (void *) hook_AddRef,
.Release = (void *) my_Release, .Release = (void *) hook_Release,
.SetDataFormat = my_SetDataFormat, .SetDataFormat = hook_SetDataFormat,
.SetCooperativeLevel= my_SetCooperativeLevel, .SetCooperativeLevel= hook_SetCooperativeLevel,
.Acquire = my_Acquire, .Acquire = hook_Acquire,
.Unacquire = my_Acquire, // not a c&p error .Unacquire = hook_Unacquire,
.GetDeviceState = my_GetDeviceState, .GetDeviceState = hook_GetDeviceState,
}; };
static const IDirectInputDevice8W dev = { (void *) &dev_vtbl }; static const IDirectInputDevice8W dev = { (void *) &dev_vtbl };
@ -110,65 +112,70 @@ HRESULT WINAPI hook_DirectInput8Create(
return S_OK; return S_OK;
} }
static unsigned long WINAPI my_AddRef(IUnknown *self) static unsigned long WINAPI hook_AddRef(IUnknown *self)
{ {
return 1; return 1;
} }
static unsigned long WINAPI my_Release(IUnknown *self) static unsigned long WINAPI hook_Release(IUnknown *self)
{ {
return 1; return 1;
} }
static HRESULT WINAPI my_CreateDevice( static HRESULT WINAPI hook_CreateDevice(
IDirectInput8W *self, IDirectInput8W *self,
REFGUID rguid, REFGUID rguid,
LPDIRECTINPUTDEVICE8W *lplpDirectInputDevice, LPDIRECTINPUTDEVICE8W *lplpDirectInputDevice,
LPUNKNOWN pUnkOuter) LPUNKNOWN pUnkOuter)
{ {
dprintf("%s\n", __func__); dprintf("ZInput: %s\n", __func__);
*lplpDirectInputDevice = (void *) &dev; *lplpDirectInputDevice = (void *) &dev;
return S_OK; return S_OK;
} }
static HRESULT WINAPI my_EnumDevices( static HRESULT WINAPI hook_EnumDevices(
IDirectInput8W *self, IDirectInput8W *self,
DWORD dwDevType, DWORD dwDevType,
LPDIENUMDEVICESCALLBACKW lpCallback, LPDIENUMDEVICESCALLBACKW lpCallback,
LPVOID pvRef, LPVOID pvRef,
DWORD dwFlags) DWORD dwFlags)
{ {
dprintf("%s\n", __func__); dprintf("ZInput: %s\n", __func__);
return S_OK; return S_OK;
} }
static HRESULT WINAPI my_SetDataFormat( static HRESULT WINAPI hook_SetDataFormat(
IDirectInputDevice8W *self, IDirectInputDevice8W *self,
LPCDIDATAFORMAT lpdf) LPCDIDATAFORMAT lpdf)
{ {
dprintf("%s\n", __func__); dprintf("ZInput: %s\n", __func__);
return S_OK; return S_OK;
} }
static HRESULT WINAPI my_SetCooperativeLevel( static HRESULT WINAPI hook_SetCooperativeLevel(
IDirectInputDevice8W *self, IDirectInputDevice8W *self,
HWND hwnd, HWND hwnd,
DWORD flags) DWORD flags)
{ {
dprintf("%s\n", __func__); dprintf("ZInput: %s\n", __func__);
return S_OK; return S_OK;
} }
static HRESULT WINAPI my_Acquire(IDirectInputDevice8W *self) static HRESULT WINAPI hook_Acquire(IDirectInputDevice8W *self)
{ {
return S_OK; return S_OK;
} }
static HRESULT WINAPI my_GetDeviceState( static HRESULT WINAPI hook_Unacquire(IDirectInputDevice8W *self)
{
return S_OK;
}
static HRESULT WINAPI hook_GetDeviceState(
IDirectInputDevice8W *self, IDirectInputDevice8W *self,
DWORD cbData, DWORD cbData,
LPVOID lpvData) LPVOID lpvData)