//
// KeybindingsLayer::buildContentForTab from 0x589b08 to 0x58a504 (2556 bytes)
//
// 1 xrefs:
// > KeybindingsLayer::showTab @ 0x58a704
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:53:01 +0000
//
char **__fastcall KeybindingsLayer::buildContentForTab(char **this, char *a2)
{
int v2; // r4
int v3; // r0
float v4; // s21
float v5; // s19
float v6; // s20
float v7; // s22
int v8; // r5
void (__fastcall *v9)(int, char **); // r9
int v10; // r1
void (__fastcall *v11)(int, char **); // r2
void (__fastcall *v12)(int, char **); // r8
cocos2d::CCNode *v13; // r0
void (__fastcall *v14)(int, char **); // r5
int v15; // r2
int v16; // r3
int v17; // r7
int v18; // r1
unsigned __int8 *v19; // r6
int v20; // r5
size_t v21; // r5
const void *v22; // r6
cocos2d::CCLabelBMFont *v23; // r9
cocos2d::CCLabelBMFont *v24; // r0
int v25; // r5
void (__fastcall *v26)(int, char **); // r8
void (__fastcall *v27)(int, char **); // r6
char v28; // r3
char v29; // r2
char v30; // r1
float v31; // s18
cocos2d::CCLabelBMFont *v32; // r0
int v33; // r5
void (__fastcall *v34)(int, char **); // r7
void (__fastcall *v35)(int, char **); // r7
float v36; // s18
int v37; // r5
ButtonSprite *v38; // r6
void (__fastcall *v39)(int, char **); // r8
int v40; // r9
int v41; // r5
void (__fastcall *v42)(int, char **); // r6
float v43; // s24
GJKeybindManager *isControllerChord; // r0
GJKeybindManager *v45; // r0
float v46; // s25
char *v47; // r5
char *v48; // r6
GJKeybindManager *v49; // r0
unsigned int j; // r8
GJKeybindManager *v51; // r0
GJKeybindManager *v52; // r0
int v53; // r2
float v54; // s15
float v55; // s17
float v56; // s16
int i; // r7
int v58; // r8
void (__fastcall *v59)(int, char **); // r10
float v60; // s17
float v61; // s24
float v62; // s15
float v63; // s24
float v64; // r1
GJKeybindManager *v65; // r0
int v66; // r8
int v67; // r9
unsigned int k; // r8
int v69; // r0
int v70; // r10
void (__fastcall *v71)(int, _DWORD); // r11
int v72; // r0
int v73; // r0
int v74; // r1
int v75; // r11
float v76; // s16
int v77; // r1
int v78; // r2
int v79; // r3
float v80; // s16
cocos2d::CCLabelBMFont *v81; // r0
ButtonSprite *v82; // r0
int v83; // r11
int v84; // r0
void (__fastcall *v85)(int, char **); // r2
int v86; // r10
unsigned int v87; // r8
unsigned int v88; // r9
int v89; // r0
bool v90; // zf
int v91; // r3
char *v92; // r8
char *v93; // r0
_DWORD *v94; // r2
int v95; // r1
int v96; // r0
int v97; // r1
GJKeybindManager *v98; // r0
GJKeybindManager *v99; // r0
int v100; // r2
float v101; // [sp+10h] [bp-ECh]
int v102; // [sp+14h] [bp-E8h]
int v103; // [sp+18h] [bp-E4h]
int v104; // [sp+1Ch] [bp-E0h]
unsigned int v105; // [sp+20h] [bp-DCh]
int v106; // [sp+24h] [bp-D8h]
int v107; // [sp+30h] [bp-CCh]
int v109; // [sp+3Ch] [bp-C0h]
char *v110; // [sp+40h] [bp-BCh]
char v111; // [sp+67h] [bp-95h] BYREF
int v112; // [sp+68h] [bp-94h]
int v113; // [sp+6Ch] [bp-90h]
float v114; // [sp+70h] [bp-8Ch] BYREF
float v115; // [sp+74h] [bp-88h]
int (__fastcall *v116)(KeybindingsLayer *, cocos2d::CCObject *); // [sp+78h] [bp-84h]
int v117; // [sp+7Ch] [bp-80h]
char **(__fastcall *v118)(KeybindingsLayer *, cocos2d::CCObject *, int, int); // [sp+80h] [bp-7Ch]
int v119; // [sp+84h] [bp-78h]
char **(__fastcall *v120)(KeybindingsLayer *, cocos2d::CCObject *, int, int); // [sp+88h] [bp-74h]
int v121; // [sp+8Ch] [bp-70h]
char *v122[3]; // [sp+90h] [bp-6Ch] BYREF
char v123; // [sp+9Ch] [bp-60h] BYREF
char v124; // [sp+9Dh] [bp-5Fh] BYREF
cocos2d::CCLabelBMFont *v125; // [sp+A4h] [bp-58h]
int v126[3]; // [sp+A8h] [bp-54h] BYREF
char *v127; // [sp+B4h] [bp-48h] BYREF
char *v128; // [sp+B8h] [bp-44h]
char *v129; // [sp+BCh] [bp-40h]
char *v130; // [sp+C0h] [bp-3Ch] BYREF
char **v131; // [sp+C4h] [bp-38h]
char **v132; // [sp+C8h] [bp-34h]
char *v133[3]; // [sp+CCh] [bp-30h] BYREF
unsigned int v134; // [sp+D8h] [bp-24h] BYREF
size_t v135; // [sp+DCh] [bp-20h]
cocos2d::CCLabelBMFont *v136; // [sp+E0h] [bp-1Ch]
char *v137[4]; // [sp+E4h] [bp-18h] BYREF
v2 = (int)this;
if ( !*(this + 194) || !*(this + 195) )
return this;
v3 = (*((int (__fastcall **)(char **))*this + 193))(this);
v110 = *(char **)(v2 + 800);
v109 = v3;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v114, (const cocos2d::CCSize *)(*(_DWORD *)(v2 + 776) + 324));
v4 = v114;
v5 = v114 * 0.5;
(*(void (__fastcall **)(char **, int, char *))(*(_DWORD *)v2 + 760))(v122, v2, a2);
v104 = 0;
v6 = v4 - 23.0;
LABEL_4:
if ( v104 < (unsigned int)((v122[1] - v122[0]) >> 2) )
{
v103 = *(_DWORD *)&v122[0][4 * v104];
(*(void (__fastcall **)(char *, int, int))(*(_DWORD *)v2 + 764))(&v123, v2, v103);
v7 = -20.0 - (float)((float)v104 * 32.0);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v137, 0.0, 0.0, 40.0, 40.0);
v8 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v137);
v9 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v8 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v137, v4, 30.0);
v9(v8, v137);
if ( (v104 & 1) != 0 )
v10 = 40;
else
v10 = 70;
(*(void (__fastcall **)(int, int))(*(_DWORD *)v8 + 456))(v8, v10);
v11 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v8 + 480);
LOWORD(v137[0]) = 0;
BYTE2(v137[0]) = 0;
v11(v8, v137);
v12 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v8 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v137, v5, v7);
v12(v8, v137);
v13 = (cocos2d::CCNode *)(*(int (__fastcall **)(_DWORD, int, _DWORD))(**(_DWORD **)(*(_DWORD *)(v2 + 776) + 320)
+ 232))(
*(_DWORD *)(*(_DWORD *)(v2 + 776) + 320),
v8,
0);
v102 = cocos2d::CCNode::create(v13);
v14 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v102 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v137, 10.0, v7);
v14(v102, v137);
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(*(_DWORD *)(v2 + 776) + 320) + 232))(
*(_DWORD *)(*(_DWORD *)(v2 + 776) + 320),
v102,
1);
v15 = (int)v110;
if ( a2 != v110 )
goto LABEL_34;
v16 = 0;
while ( 1 )
{
v15 = 8 * v16;
if ( *((_DWORD *)&unk_BED94C + 2 * v16) == v103 )
break;
if ( ++v16 == 214 )
goto LABEL_34;
}
v15 += (int)&unk_BED94C;
v17 = *(_DWORD *)(v15 + 4);
if ( v17 >= 0 )
{
v18 = *(_DWORD *)(v2 + 712);
v134 = 0;
v135 = 0;
v136 = nullptr;
v19 = (unsigned __int8 *)(v18 + 44 * v17);
v20 = *v19;
if ( (v20 & 1) != 0 )
{
v21 = *((_DWORD *)v19 + 1);
v22 = *((const void **)v19 + 2);
}
else
{
v21 = v20 >> 1;
v22 = v19 + 1;
}
if ( v21 + 1 > 0xFFFFFFEF )
sub_388A28();
if ( v21 + 1 > 0xA )
{
v23 = (cocos2d::CCLabelBMFont *)operator new((v21 + 17) & 0xFFFFFFF0);
v136 = v23;
v134 = (v21 + 17) & 0xFFFFFFF0 | 1;
v135 = v21;
}
else
{
v23 = (cocos2d::CCLabelBMFont *)((char *)&v134 + 1);
LOBYTE(v134) = 2 * v21;
}
std::char_traits::copy(v23, v22, v21);
*((_BYTE *)v23 + v21) = 0;
std::string::append(&v134, ":", 1u);
if ( (v134 & 1) != 0 )
v24 = v136;
else
v24 = (cocos2d::CCLabelBMFont *)((char *)&v134 + 1);
v25 = cocos2d::CCLabelBMFont::create(v24, "bigFont.fnt", (const char *)((unsigned __int8)v134 << 31));
std::string::~string((int)&v134);
v26 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v25 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v137, 0.0, 0.5);
v26(v25, v137);
v27 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v25 + 536);
switch ( v17 )
{
case 0:
v28 = 120;
v29 = -1;
v30 = 120;
break;
case 1:
v28 = 100;
v29 = -26;
goto LABEL_29;
case 2:
v28 = 80;
v29 = -86;
LABEL_29:
v30 = -1;
break;
case 3:
v28 = -1;
v29 = -106;
v30 = -56;
break;
default:
v28 = -1;
v29 = -56;
v30 = 100;
break;
}
LOBYTE(v137[0]) = v30;
BYTE1(v137[0]) = v29;
BYTE2(v137[0]) = v28;
v27(v25, v137);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v102 + 228))(v102, v25);
v31 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v25 + 164))(v25) + 15.0;
}
else
{
LABEL_34:
v31 = 0.0;
}
if ( (v123 & 1) != 0 )
v32 = v125;
else
v32 = (cocos2d::CCLabelBMFont *)&v124;
v33 = cocos2d::CCLabelBMFont::create(v32, "bigFont.fnt", (const char *)v15);
v34 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v33 + 148);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v137, 0.0, 0.5);
v34(v33, v137);
v35 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v33 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v137, v31, 0.0);
v35(v33, v137);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v102 + 228))(v102, v33);
v36 = v31 + *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v33 + 164))(v33);
v38 = ButtonSprite::create(
(ButtonSprite *)"+",
&byte_9[1],
0,
0.6,
1,
"bigFont.fnt",
"GJ_button_01.png",
COERCE_CONST_CHAR_(22.0),
v101);
v37 = *((_DWORD *)v38 + 134);
v39 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v37 + 92);
v40 = (*(int (__fastcall **)(int))(*(_DWORD *)v37 + 96))(v37);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v133, 0.25, 0.0);
cocos2d::CCPoint::operator+(v137, v40, v133);
v39(v37, v137);
v116 = KeybindingsLayer::onAddBinding;
v117 = 0;
v41 = CCMenuItemSpriteExtra::create((int)v38, 0, v2, (int)KeybindingsLayer::onAddBinding, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v41 + 36))(v41, v103);
v42 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v41 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v137, v6, v7);
v42(v41, v137);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(v2 + 780) + 228))(*(_DWORD *)(v2 + 780), v41);
v43 = (float)(v6 - 13.0) - 4.0;
isControllerChord = (GJKeybindManager *)(*(int (__fastcall **)(int *))(**(_DWORD **)(v2 + 756) + 8))(v126);
v127 = nullptr;
v128 = nullptr;
v129 = nullptr;
v130 = nullptr;
v131 = nullptr;
v132 = nullptr;
for ( v137[0] = nullptr; (int)v137[0] < (v126[1] - v126[0]) >> 2; ++v137[0] )
{
isControllerChord = (GJKeybindManager *)GJKeybindManager::isControllerChord(
*(GJKeybindManager **)(v126[0] + 4 * (int)v137[0]),
v126[0]);
if ( !isControllerChord || v109 )
{
isControllerChord = (GJKeybindManager *)v137[0];
if ( v128 == v129 )
{
std::vector::__push_back_slow_path((int)&v127, (_DWORD *)(v126[0] + 4 * (int)v137[0]));
}
else
{
if ( v128 )
*(_DWORD *)v128 = *(_DWORD *)(v126[0] + 4 * (int)v137[0]);
v128 += 4;
}
if ( v131 == v132 )
{
std::vector::__push_back_slow_path((int)&v130, v137);
}
else
{
if ( v131 )
*v131 = v137[0];
++v131;
}
}
}
if ( v127 == v128 )
goto LABEL_71;
v45 = (GJKeybindManager *)GJKeybindManager::sharedState(isControllerChord);
v46 = 0.0;
v105 = 0;
v47 = nullptr;
v48 = nullptr;
v106 = 0;
v107 = GJKeybindManager::groupForAction(v45, v103);
while ( 1 )
{
if ( v106 >= (v128 - v127) >> 2 )
{
v54 = (float)(unsigned int)((v47 - v48) >> 3) * 4.0;
v55 = (float)(v5 - 26.0) - 4.0;
if ( (float)(v46 + v54) <= v55 )
{
v56 = 1.0;
}
else
{
v56 = (float)(v55 - v54) / v46;
if ( v56 < 0.4 )
v56 = 0.4;
}
for ( i = ((v47 - v48) >> 3) - 1; i >= 0; --i )
{
v58 = *((_DWORD *)v47 - 2);
if ( v56 < 1.0 )
(*(void (__fastcall **)(_DWORD, float))(*(_DWORD *)v58 + 80))(
*((_DWORD *)v47 - 2),
COERCE_FLOAT(LODWORD(v56)));
v59 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v58 + 92);
v60 = (float)(v56 * *((float *)v47 - 1)) * 0.5;
v61 = v43 - v60;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v137, v61, v7);
v59(v58, v137);
v47 -= 8;
v43 = v61 - (float)(v60 + 4.0);
}
if ( v48 )
operator delete(v48);
LABEL_71:
v62 = 0.35;
v63 = v43 - 10.0;
if ( (float)(v36 * 0.35) > v63 )
{
v62 = v63 / v36;
if ( (float)(v63 / v36) <= 0.2 )
v62 = 0.2;
}
(*(void (__fastcall **)(int, float))(*(_DWORD *)v102 + 80))(v102, COERCE_FLOAT(LODWORD(v62)));
++v104;
std::__vector_base::~__vector_base(&v130);
std::__vector_base::~__vector_base(&v127);
std::__vector_base::~__vector_base((char **)v126);
std::string::~string((int)&v123);
goto LABEL_4;
}
v49 = (GJKeybindManager *)(*(int (__fastcall **)(char **))(**(_DWORD **)(v2 + 756) + 12))(v133);
for ( j = 0; j < (v133[1] - v133[0]) >> 2; ++j )
{
if ( *(_DWORD *)&v133[0][4 * j] != v103 )
{
v51 = (GJKeybindManager *)GJKeybindManager::sharedState(v49);
v52 = (GJKeybindManager *)GJKeybindManager::groupForAction(v51, *(_DWORD *)&v133[0][4 * j]);
v49 = (GJKeybindManager *)GJKeybindManager::groupsConflict(v52, v107, v53);
if ( v49 )
{
v66 = 1;
goto LABEL_88;
}
}
}
v65 = (GJKeybindManager *)(*(int (__fastcall **)(int))(*(_DWORD *)v2 + 780))(v2);
if ( v65 )
{
v96 = GJKeybindManager::sharedState(v65);
GJKeybindManager::actionsForChord((GJKeybindManager *)v137, v96);
for ( k = 0; ; ++k )
{
if ( k >= (v137[1] - v137[0]) >> 2 )
{
v66 = 0;
goto LABEL_87;
}
v67 = *(_DWORD *)&v137[0][4 * k];
if ( v67 != v103 && !GJKeybindManager::isMovementAction(*(GJKeybindManager **)&v137[0][4 * k], v97) )
{
v98 = (GJKeybindManager *)GJKeybindManager::sharedState(nullptr);
v99 = (GJKeybindManager *)GJKeybindManager::groupForAction(v98, v67);
if ( GJKeybindManager::groupsConflict(v99, v107, v100) )
break;
}
}
v66 = 1;
LABEL_87:
std::__vector_base::~__vector_base(v137);
}
else
{
v66 = 0;
}
LABEL_88:
v111 = 0;
v69 = KeybindingsLayer::buildControllerGlyph(
(KeybindingsLayer *)*(unsigned __int16 *)&v127[4 * v106],
&v111,
(bool *)(4 * v106));
v70 = v69;
if ( v69 )
break;
GJKeybindManager::chordToString((GJKeybindManager *)&v134, *(_DWORD *)&v127[4 * v106]);
v77 = v134 & 1;
if ( v77 )
v78 = v135;
else
v78 = (int)(unsigned __int8)v134 >> 1;
if ( (float)((float)(unsigned int)v78 * 8.0) <= 22.0 )
{
v80 = 22.0;
}
else
{
if ( v77 )
v79 = v135;
else
v79 = (int)(unsigned __int8)v134 >> 1;
v80 = (float)(unsigned int)v79 * 8.0;
}
if ( v77 )
v81 = v136;
else
v81 = (cocos2d::CCLabelBMFont *)((char *)&v134 + 1);
v82 = ButtonSprite::create(
v81,
(const char *)(int)v80,
0,
0.4,
1,
"bigFont.fnt",
"GJ_button_04.png",
COERCE_CONST_CHAR_(22.0),
v101);
v83 = (int)v82;
if ( v66 )
{
v84 = *((_DWORD *)v82 + 134);
v85 = *(void (__fastcall **)(int, char **))(*(_DWORD *)v84 + 536);
LOWORD(v137[0]) = 20735;
BYTE2(v137[0]) = 80;
v85(v84, v137);
}
v120 = KeybindingsLayer::onEditBinding;
v121 = 0;
v75 = CCMenuItemSpriteExtra::create(v83, 0, v2, (int)KeybindingsLayer::onEditBinding, 0);
v76 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v75 + 164))(v75);
std::string::~string((int)&v134);
LABEL_110:
(*(void (__fastcall **)(int, int))(*(_DWORD *)v75 + 36))(
v75,
v103 & 0xFFFFFF | (*(_DWORD *)&v130[4 * v106] << 24));
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(v2 + 780) + 228))(*(_DWORD *)(v2 + 780), v75);
if ( (unsigned int)v47 < v105 )
{
if ( v47 )
{
*((float *)v47 + 1) = v76;
*(_DWORD *)v47 = v75;
}
v47 += 8;
goto LABEL_136;
}
v86 = v47 - v48;
v87 = ((v47 - v48) >> 3) + 1;
if ( v87 >= 0x20000000 )
sub_388A70();
v88 = (int)(v105 - (_DWORD)v48) >> 3;
if ( v88 > 0xFFFFFFE )
{
v87 = 0x1FFFFFFF;
}
else
{
if ( v87 < 2 * v88 )
v87 = 2 * v88;
if ( !v87 )
{
v89 = 0;
goto LABEL_124;
}
}
v89 = operator new(8 * v87);
LABEL_124:
v105 = v89 + 8 * v87;
v91 = v89 + v86;
v90 = v89 + v86 == 0;
if ( v89 + v86 )
*(_DWORD *)(v89 + v86) = v75;
v92 = (char *)(v91 + 8);
v93 = v47;
if ( !v90 )
*(float *)(v91 + 4) = v76;
v94 = (_DWORD *)v91;
while ( v93 != v48 )
{
v94 -= 2;
if ( v94 )
{
v95 = *((_DWORD *)v93 - 1);
*v94 = *((_DWORD *)v93 - 2);
v94[1] = v95;
}
v93 -= 8;
}
v48 = (char *)(v91 - 8 * ((unsigned int)(v47 - v93) >> 3));
if ( v93 )
operator delete(v93);
v47 = v92;
LABEL_136:
v46 = v46 + v76;
std::__vector_base::~__vector_base(v133);
++v106;
}
v71 = *(void (__fastcall **)(int, _DWORD))(*(_DWORD *)v69 + 80);
v72 = (*(int (__fastcall **)(int))(*(_DWORD *)v69 + 164))(v69);
v71(v70, 26.0 / *(float *)(v72 + 4));
if ( v66 )
{
LOWORD(v112) = 20735;
BYTE2(v112) = 80;
v73 = v70;
v74 = v112;
}
else
{
if ( !v111 )
goto LABEL_92;
LOWORD(v113) = -16776;
BYTE2(v113) = -1;
v73 = v70;
v74 = v113;
}
KeybindingsLayer::tintGlyph(v73, v74);
LABEL_92:
v118 = KeybindingsLayer::onEditBinding;
v119 = 0;
v75 = CCMenuItemSpriteExtra::create(v70, 0, v2, (int)KeybindingsLayer::onEditBinding, 0);
v76 = *(float *)(*(int (__fastcall **)(int))(*(_DWORD *)v75 + 164))(v75);
goto LABEL_110;
}
if ( (float)((float)((float)v104 * 32.0) + 8.0) >= v115 )
v64 = (float)((float)v104 * 32.0) + 8.0;
else
v64 = v115;
ScrollableContentLayer::setContentHeight(*(ScrollableContentLayer **)(v2 + 776), v64);
return std::__vector_base::~__vector_base(v122);
}