//
// KeybindingsManager::commandToKeyForGroup from 0x1004e54f0 to 0x1004e5693 (419 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
cocos2d::CCDictionary *__fastcall KeybindingsManager::commandToKeyForGroup(KeybindingsManager *a1, GJKeyGroup a2)
{
double v2; // xmm0_8
KeybindingsManager *v3; // r14
cocos2d::CCString *v4; // rax
const char *CString; // rbx
cocos2d::CCDictionary *m_commandToKeyDict; // r15
size_t v7; // rax
size_t v8; // r12
char *v9; // r13
size_t v10; // r14
cocos2d::CCDictionary *v11; // r15
__int64 v12; // r14
size_t v13; // rax
size_t v14; // r12
char *v15; // r13
size_t v16; // r14
char v18; // [rsp+0h] [rbp-50h]
cocos2d::CCDictionary *v19; // [rsp+8h] [rbp-48h]
__int64 v20; // [rsp+8h] [rbp-48h]
size_t __dst; // [rsp+10h] [rbp-40h] BYREF
size_t v22; // [rsp+18h] [rbp-38h]
void *__p; // [rsp+20h] [rbp-30h]
v3 = a1;
v4 = (cocos2d::CCString *)sub_1007AB580("%i", v18);
CString = cocos2d::CCString::getCString(v4);
m_commandToKeyDict = a1->m_commandToKeyDict;
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_23;
v8 = v7;
if ( v7 >= 0x17 )
{
v19 = a1->m_commandToKeyDict;
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
v9 = (char *)operator new(v10);
__p = v9;
__dst = v10 + 1;
v3 = a1;
m_commandToKeyDict = v19;
v22 = v8;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v7;
v9 = (char *)&__dst + 1;
if ( v7 )
LABEL_8:
memmove(v9, CString, v8);
v9[v8] = 0;
v11 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey_1((__int64)m_commandToKeyDict, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( !v11 )
{
v11 = cocos2d::CCDictionary::create();
v12 = (__int64)v3->m_commandToKeyDict;
v13 = strlen(CString);
if ( v13 < 0xFFFFFFFFFFFFFFF8LL )
{
v14 = v13;
if ( v13 >= 0x17 )
{
v20 = v12;
v16 = 26;
if ( (v13 | 7) != 0x17 )
v16 = (v13 | 7) + 1;
v15 = (char *)operator new(v16);
__p = v15;
__dst = v16 + 1;
v12 = v20;
v22 = v14;
}
else
{
LOBYTE(__dst) = 2 * v13;
v15 = (char *)&__dst + 1;
if ( !v13 )
{
LABEL_20:
v15[v14] = 0;
cocos2d::CCDictionary::setObject_1(v12, v11, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
return v11;
}
}
memmove(v15, CString, v14);
goto LABEL_20;
}
LABEL_23:
sub_100006BF0(v2);
}
return v11;
}