feat: x360 input lib
This commit is contained in:
1 parent
f8ec357c45
commit
f9c9b27e33
22 files changed
+2147
-8
No files matched your search
@@ -0,0 +1,70 @@
|
||||
#include "4J_Profile.h"
|
||||
#include "INP_Keyboard.h"
|
||||
|
||||
CKeyboard::CKeyboard()
|
||||
{
|
||||
bActive = false;
|
||||
}
|
||||
|
||||
void CKeyboard::Tick(void)
|
||||
{
|
||||
if (bActive == true && KeyboardOverlap.InternalLow != ERROR_IO_PENDING)
|
||||
{
|
||||
if(Func != NULL) Func(lpParam, KeyboardOverlap.dwExtendedError == 0);
|
||||
bActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
C_4JInput::EKeyboardResult CKeyboard::RequestKeyboard(LPCWSTR uiTitle, LPCWSTR uiText, LPCWSTR uiDesc, DWORD dwPad, WCHAR *pwchResult, UINT uiMaxChars, int (*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode)
|
||||
{
|
||||
if (bActive == true)
|
||||
return C_4JInput::EKeyboard_Cancelled;
|
||||
|
||||
this->iPad = (int)dwPad;
|
||||
this->pwchResult = pwchResult;
|
||||
this->uiMaxChars = uiMaxChars;
|
||||
this->Func = Func;
|
||||
this->lpParam = lpParam;
|
||||
|
||||
int LockedProfile = this->iPad;
|
||||
if (LockedProfile == -1)
|
||||
{
|
||||
LockedProfile = ProfileManager.GetLockedProfile();
|
||||
if (LockedProfile == -1)
|
||||
{
|
||||
LockedProfile = ProfileManager.GetLockedProfile();
|
||||
if (LockedProfile == -1)
|
||||
return C_4JInput::EKeyboard_Cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
ZeroMemory(&KeyboardOverlap, sizeof(XOVERLAPPED));
|
||||
|
||||
for (;;)
|
||||
{
|
||||
DWORD result = XShowKeyboardUI(LockedProfile, 0, uiText, uiTitle, uiDesc, this->pwchResult, this->uiMaxChars, &KeyboardOverlap);
|
||||
if (result == ERROR_IO_PENDING)
|
||||
break;
|
||||
if (result != ERROR_ACCESS_DENIED)
|
||||
return C_4JInput::EKeyboard_Cancelled;
|
||||
Sleep(250);
|
||||
}
|
||||
|
||||
bActive = true;
|
||||
return eState;
|
||||
}
|
||||
|
||||
//str1k3r - These 2 only exist cause of iggy
|
||||
C_4JInput::EKeyboardResult CKeyboard::RequestKeyboard(LPCWSTR uiTitle, LPCWSTR uiText, LPCWSTR uiDesc, DWORD dwPad, UINT uiMaxChars, int(*Func)(LPVOID, const bool), LPVOID lpParam, C_4JInput::EKeyboardMode eMode)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void CKeyboard::GetText(uint16_t *UTF16String)
|
||||
{
|
||||
//uint16_t *keyString;
|
||||
//for (unsigned int index = 0; keyString[index] && index < 0x200; index++)
|
||||
//{
|
||||
// UTF16String[index] = keyString[index];
|
||||
//}
|
||||
}
|
||||
Reference in new issue
Block a user