//
// GJKeybindManager::chordToString from 0x140389bc0 to 0x14038a0d4 (1300 bytes)
//
// 4 xrefs:
// > KeybindingsLayer::buildContentForTab @ 0x1403d7290
// > KeybindingsLayer::actionsToShow @ 0x1403d7f8f
// > KeybindCapturePopup::updateChordDisplay @ 0x14044e40c
// > ??> @ 0x140922d18
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:31:09 +0000
//
// Hidden C++ exception states: #wind=1
void **__fastcall GJKeybindManager::chordToString(void **Src, signed int a2)
{
signed int v2; // edi
char *v4; // rdx
size_t v5; // r8
__int64 v6; // rcx
UINT v7; // esi
HKL KeyboardLayout; // rax
UINT v9; // eax
HKL dwhkl; // rsi
UINT v11; // ebp
int v12; // eax
char v13; // al
__int64 v14; // rax
__int64 v15; // rax
__int64 v16; // rax
WCHAR pwszBuff[4]; // [rsp+50h] [rbp-138h] BYREF
WCHAR v19[4]; // [rsp+58h] [rbp-130h] BYREF
BYTE KeyState[256]; // [rsp+60h] [rbp-128h] BYREF
v2 = a2;
*(_OWORD *)Src = 0;
Src[2] = nullptr;
Src[3] = (void *)15;
*(_BYTE *)Src = 0;
if ( (a2 & 0x10000) != 0 )
sub_140044D80(Src, "Ctrl+", 5u);
if ( (v2 & 0x20000) != 0 )
sub_140044D80(Src, "Alt+", 4u);
if ( (v2 & 0x40000) != 0 )
sub_140044D80(Src, "Shift+", 6u);
v2 = (unsigned __int16)v2;
switch ( (__int16)v2 )
{
case 1001:
v4 = "CA";
goto LABEL_52;
case 1002:
v4 = "C2A";
goto LABEL_52;
case 1003:
v4 = "CB";
goto LABEL_52;
case 1004:
v4 = "C2B";
goto LABEL_52;
case 1005:
v4 = "CY";
goto LABEL_52;
case 1006:
v4 = "C2Y";
goto LABEL_52;
case 1007:
v4 = "CX";
goto LABEL_52;
case 1008:
v4 = "C2X";
goto LABEL_52;
case 1009:
v4 = "CStart";
goto LABEL_52;
case 1010:
v4 = "C2Start";
goto LABEL_52;
case 1011:
v4 = "CBack";
goto LABEL_52;
case 1012:
v4 = "C2Back";
goto LABEL_52;
case 1013:
v4 = "CRB";
goto LABEL_52;
case 1014:
v4 = "C2RB";
goto LABEL_52;
case 1015:
v4 = "CLB";
goto LABEL_52;
case 1016:
v4 = "C2LB";
goto LABEL_52;
case 1017:
v4 = "CRT";
goto LABEL_52;
case 1018:
v4 = "C2RT";
goto LABEL_52;
case 1019:
v4 = "CLT";
goto LABEL_52;
case 1020:
v4 = "C2LT";
goto LABEL_52;
case 1021:
v4 = "CUp";
goto LABEL_52;
case 1022:
v4 = "C2Up";
goto LABEL_52;
case 1023:
v4 = "CDown";
goto LABEL_52;
case 1024:
v4 = "C2Down";
goto LABEL_52;
case 1025:
v4 = "CLeft";
goto LABEL_52;
case 1026:
v4 = "C2Left";
goto LABEL_52;
case 1027:
v4 = "CRight";
goto LABEL_52;
case 1028:
v4 = "C2Right";
goto LABEL_52;
case 1029:
v4 = "CLUp";
goto LABEL_52;
case 1030:
v4 = "C2LUp";
goto LABEL_52;
case 1031:
v4 = "CLDown";
goto LABEL_52;
case 1032:
v4 = "C2LDown";
goto LABEL_52;
case 1033:
v4 = "CLLeft";
goto LABEL_52;
case 1034:
v4 = "C2LLeft";
goto LABEL_52;
case 1035:
v4 = "CLRight";
goto LABEL_52;
case 1036:
v4 = "C2LRight";
goto LABEL_52;
case 1037:
v4 = "CRUp";
goto LABEL_52;
case 1038:
v4 = "C2RUp";
goto LABEL_52;
case 1039:
v4 = "CRDown";
goto LABEL_52;
case 1040:
v4 = "C2RDown";
goto LABEL_52;
case 1041:
v4 = "CRLeft";
goto LABEL_52;
case 1042:
v4 = "C2RLeft";
goto LABEL_52;
case 1043:
v4 = "CRRight";
goto LABEL_52;
case 1044:
v4 = "C2RRight";
LABEL_52:
v5 = -1;
do
++v5;
while ( v4[v5] );
goto LABEL_75;
default:
v6 = (unsigned int)(unsigned __int16)v2 - 186;
if ( (unsigned int)(unsigned __int16)v2 - 65 <= 0x19 || (unsigned int)v6 <= 0x28 )
{
v7 = cocos2d::CCEGLView::scanCodeForPositionalKey((unsigned __int16)v2);
if ( v7 )
{
KeyboardLayout = GetKeyboardLayout(0);
v9 = MapVirtualKeyExA(v7, 1u, KeyboardLayout);
if ( !v9 )
v9 = (unsigned __int16)v2;
v2 = v9;
}
}
if ( v2 < 186 )
goto LABEL_70;
if ( v2 > 226 )
goto LABEL_70;
dwhkl = GetKeyboardLayout(0);
v11 = MapVirtualKeyExA(v2, 0, dwhkl);
if ( !v11 )
goto LABEL_70;
memset(KeyState, 0, sizeof(KeyState));
*(_QWORD *)pwszBuff = 0;
v12 = ToUnicodeEx(v2, v11, KeyState, pwszBuff, 4, 0, dwhkl);
if ( v12 >= 0 )
{
if ( v12 != 1 )
goto LABEL_70;
}
else
{
*(_QWORD *)v19 = 0;
ToUnicodeEx(v2, v11, KeyState, v19, 4, 0, dwhkl);
}
v6 = (unsigned int)pwszBuff[0] - 33;
if ( (unsigned __int16)(pwszBuff[0] - 33) <= 0x5Du )
{
v13 = toupper(pwszBuff[0]);
if ( v13 )
{
sub_14003DBD0(Src, v13);
return Src;
}
}
LABEL_70:
v14 = cocos2d::CCDirector::sharedDirector(v6);
v15 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v14 + 176LL))(v14);
v16 = cocos2d::CCKeyboardDispatcher::keyToString(v15, (unsigned int)v2);
if ( v16 )
{
v5 = -1;
do
++v5;
while ( *(_BYTE *)(v16 + v5) );
v4 = (char *)v16;
}
else
{
v5 = 1;
v4 = "?";
}
LABEL_75:
sub_140044D80(Src, v4, v5);
return Src;
}
}