Made Input.cpp more ASM-accurate
There was one ASM-inaccuracy I missed last time, but now I've also made the file's memory layout accurate (it appears that global variable initialisation actually affects the order they reside in memory).
This commit is contained in:
parent
38484613d5
commit
f36fc61de3
1 changed files with 11 additions and 9 deletions
|
@ -19,11 +19,11 @@ typedef struct DirectInputPair
|
||||||
LPDIRECTINPUTDEVICE2A device;
|
LPDIRECTINPUTDEVICE2A device;
|
||||||
} DirectInputPair;
|
} DirectInputPair;
|
||||||
|
|
||||||
static LPDIRECTINPUTDEVICE2A joystick;
|
// The original names for these variables are unknown
|
||||||
static LPDIRECTINPUTA lpDI;
|
static LPDIRECTINPUTA lpDI = NULL;
|
||||||
|
static LPDIRECTINPUTDEVICE2A joystick = NULL;
|
||||||
static int joystick_neutral_x;
|
static int joystick_neutral_x = 0;
|
||||||
static int joystick_neutral_y;
|
static int joystick_neutral_y = 0;
|
||||||
|
|
||||||
void ReleaseDirectInput(void)
|
void ReleaseDirectInput(void)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ void ReleaseDirectInput(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The original name for this function is unknown
|
// The original name for this function and its variables are unknown
|
||||||
BOOL SetDeviceAquire(BOOL aquire)
|
BOOL SetDeviceAquire(BOOL aquire)
|
||||||
{
|
{
|
||||||
if (aquire == TRUE)
|
if (aquire == TRUE)
|
||||||
|
@ -57,6 +57,7 @@ BOOL SetDeviceAquire(BOOL aquire)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// It looks like Pixel declared his functions early, so he could forward-reference
|
||||||
BOOL HookAllDirectInputDevices(HWND hWnd);
|
BOOL HookAllDirectInputDevices(HWND hWnd);
|
||||||
BOOL __stdcall EnumDevices_Callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef);
|
BOOL __stdcall EnumDevices_Callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef);
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ BOOL InitDirectInput(HINSTANCE hinst, HWND hWnd)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The original name for this function is unknown
|
// The original name for this function and its variables are unknown
|
||||||
BOOL HookAllDirectInputDevices(HWND hWnd)
|
BOOL HookAllDirectInputDevices(HWND hWnd)
|
||||||
{
|
{
|
||||||
DirectInputPair directinput_objects;
|
DirectInputPair directinput_objects;
|
||||||
|
@ -83,7 +84,8 @@ BOOL HookAllDirectInputDevices(HWND hWnd)
|
||||||
directinput_objects.device = NULL;
|
directinput_objects.device = NULL;
|
||||||
directinput_objects.lpDI = lpDI;
|
directinput_objects.lpDI = lpDI;
|
||||||
|
|
||||||
lpDI->AddRef();
|
directinput_objects.lpDI->AddRef();
|
||||||
|
|
||||||
lpDI->EnumDevices(DIDEVTYPE_JOYSTICK, EnumDevices_Callback, &directinput_objects, DIEDFL_ATTACHEDONLY);
|
lpDI->EnumDevices(DIDEVTYPE_JOYSTICK, EnumDevices_Callback, &directinput_objects, DIEDFL_ATTACHEDONLY);
|
||||||
|
|
||||||
if (directinput_objects.lpDI != NULL)
|
if (directinput_objects.lpDI != NULL)
|
||||||
|
@ -108,7 +110,7 @@ BOOL HookAllDirectInputDevices(HWND hWnd)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The original name for this function is unknown
|
// The original name for this function and its variables are unknown
|
||||||
BOOL __stdcall EnumDevices_Callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
|
BOOL __stdcall EnumDevices_Callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
|
||||||
{
|
{
|
||||||
static int already_ran;
|
static int already_ran;
|
||||||
|
|
Loading…
Add table
Reference in a new issue