Пример #1
0
void CCBuffer::moveLeft(unsigned int u_len)
{
	BEGIN_IF(LE(_u_content_size, 0))
	DO_RETURN;
	END_IF
	DO_ASSERT(LNE(u_len, 0), "LNE(u_len, 0)");
	BEGIN_IF(LDE(u_len, _u_content_size)) clear();
	BEGIN_ELSE
	BEGIN_FOR(DO_ASSIGN(unsigned int i, u_len), LX(i, _u_content_size), AAI(i))
	DO_ASSIGN(QV(CA(_p_buffer, CS(i, u_len))), QV(CA(_p_buffer, i)));
	DO_ASSIGN(QV(CA(_p_buffer, i)), 0);
	END_FOR
	DO_ASSIGN(_u_write_pos, TO_UINT(MAX(0, CS(TO_INT(_u_write_pos), TO_INT(u_len)))));
	DO_ASSIGN(_u_read_pos, TO_UINT(MAX(0, CS(TO_INT(_u_read_pos), TO_INT(u_len)))));
	DO_ASSIGN(_u_mark_pos, TO_UINT(MAX(0, CS(TO_INT(_u_mark_pos), TO_INT(u_len)))));
	DO_ASSIGN(_u_content_size, CS(_u_content_size, u_len));
	END_IF
}
Пример #2
0
bool Input::Init()
{
	XML xml(CSTR(Files::appdata+L"Settings.xml"));
	TCHAR xinputDLLPath[MAX_PATH];

	if(xml.Find("KeyBind"))
	{
		m_key = TO_UINT(xml.GetInt("Value",VK_A));
	}

	Interface::instance->SetKeyString(Keyboard::KeyToString(m_key));

	m_fake.ki.wVk = m_key;
	m_fake.ki.wScan = MapVirtualKey(m_key,MAPVK_VK_TO_VSC);

	if(GetSystemDirectory(xinputDLLPath,sizeof(xinputDLLPath))==0)
	{
		Utils::ShowError(L"Failed to get system directory");
		return false;
	}

	wcscat(xinputDLLPath,L"\\xinput1_3.dll");

	m_xinput = LoadLibrary(xinputDLLPath);

	if(m_xinput==null)
	{
		Utils::ShowError(L"Failed to load XInput module");
		return false;
	}

	*(FARPROC*)&GetXInputSecret = GetProcAddress(m_xinput,(LPCSTR)100);

	if(GetXInputSecret==null)
	{
		Utils::ShowError(L"Failed to get XInput function");
		return false;
	}

	return true;
}
Пример #3
0
unsigned int CCBuffer::readUInt()
{
	DO_RETURN_R(TO_UINT(readInt()));
}