Ejemplo n.º 1
0
CIVPad::CIVPad()
	: m_bCreatedByUs(true),
	m_pPad(new IVPad)
{
	// Call the CPad constructor
	IVPad * pPad = m_pPad;
	_asm
	{
		mov ecx, pPad
		call COffsets::FUNC_CPad__Constructor
	}

	// Call CPad::Initialize
	_asm
	{
		push 0
		mov ecx, pPad
		call COffsets::FUNC_CPad__Initialize
	}

	// HACK: To fix values not being initialized properly by the game
	for(int i = 0; i < INPUT_COUNT; i++)
	{
		// Not sure what this is for, but if we don't do it up and left movement keys don't work
		if(i == INPUT_MOVE_LEFT || i == INPUT_MOVE_UP || i == INPUT_VEH_MOVE_LEFT || i == INPUT_VEH_MOVE_RIGHT)
			m_pPad->m_padData[i].m_byteUnknown4 = MAX_INPUT_VALUE;

		// This defaults all analog input values to 128 (middle) instead of 0
		if(IsAnalogInput((eInput)i))
		{
			m_pPad->m_padData[i].m_byteCurrentValue = DEFAULT_ANALOG_INPUT_VALUE;
			m_pPad->m_padData[i].m_byteLastValue = DEFAULT_ANALOG_INPUT_VALUE;
		}
	}
}
Ejemplo n.º 2
0
CIVPad::CIVPad()
{
	// Mark as created by us
	m_bCreatedByUs = true;

	// Allocate the new pad
	m_pPad = new IVPad;

	// Construct the pad
	IVPad * pPad = m_pPad;
	
	_asm	mov ecx, pPad;
	_asm	call COffsets::FUNC_CPad__Constructor;

	// Initialise the pad
	_asm	push 0;
	_asm	mov ecx, pPad;
	_asm	call COffsets::FUNC_CPad__Initialize;

	// Initialise values
	for(int i = 0; i < INPUT_COUNT; i++)
	{
		m_pPad->m_padData[i].m_byteUnknown4 = MAX_INPUT_VALUE;

		if(IsAnalogInput((eInput)i))
		{
			m_pPad->m_padData[i].m_byteCurrentValue = DEFAULT_ANALOG_INPUT_VALUE;
			m_pPad->m_padData[i].m_byteLastValue = DEFAULT_ANALOG_INPUT_VALUE;
		}
	}

	CLogFile::Printf("Remote pad created! (0x%p)", pPad);
}
Ejemplo n.º 3
0
void CClientPadState::Reset()
{
	// Loop through all keys
	for(int i = 0; i < INPUT_COUNT; i++)
	{
		// Is the current key an analog key?
		if(IsAnalogInput((eInput)i))
			byteKeys[i] = DEFAULT_ANALOG_INPUT_VALUE;
		else
			byteKeys[i] = DEFAULT_BINARY_INPUT_VALUE;
	}
}