//
// EmotePickerPopup::layoutEmoteGrid from 0x140124050 to 0x140124377 (807 bytes)
//
// 5 xrefs:
// > EmotePickerPopup::onBuildWindowContent @ 0x140123f32
// > EmotePickerPopup::onWindowResized @ 0x140124380
// > ??> @ 0x140897fcc
// > ??> @ 0x140898048
// > ??> @ 0x140916850
//
// 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:26:57 +0000
//
void __fastcall EmotePickerPopup::layoutEmoteGrid(__int64 a1, signed __int64 a2, __int64 a3, double a4)
{
_QWORD *v5; // r8
float v6; // xmm6_4
float v7; // xmm9_4
int v8; // ebp
__int64 v9; // rcx
char v10; // r12
unsigned __int64 v11; // r14
float v12; // xmm9_4
__int64 *v13; // rdi
int v14; // esi
__int64 v15; // rbx
__int64 v16; // rax
int v17; // ebx
int v18; // esi
__int64 v19; // r14
char *v20; // rax
int v21; // eax
_QWORD *v22; // rax
_QWORD *v23; // r15
int v24; // edi
__int64 v25; // rbx
__int64 v26; // rax
__int64 v27; // rbx
__int64 v28; // rcx
char v29; // [rsp+C0h] [rbp+8h] BYREF
if ( *(_QWORD *)(a1 + 1032) && *(_QWORD *)(a1 + 1024) )
{
v5 = *(_QWORD **)(a1 + 1200);
v6 = -4.0;
v7 = *(float *)(a1 + 1040);
v8 = (int)(float)((float)(v7 - 8.0) / 26.0);
if ( v8 < 3 )
v8 = 3;
v9 = 0;
v10 = 0;
v11 = 0;
v12 = (float)(v7 - (float)((float)v8 * 26.0)) * 0.5;
if ( (__int64)(*(_QWORD *)(a1 + 1208) - (_QWORD)v5) >> 3 )
{
do
{
if ( (int)v9 >= v8 )
v6 = v6 + -26.0;
v13 = (__int64 *)v5[v11];
v14 = 0;
if ( (int)v9 < v8 )
v14 = v9;
v15 = *v13;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v29, (float)((float)((float)v14 + 0.5) * 26.0) + v12, v6 - 13.0);
(*(void (__fastcall **)(__int64 *, __int64))(v15 + 184))(v13, v16);
v5 = *(_QWORD **)(a1 + 1200);
v9 = (unsigned int)(v14 + 1);
++v11;
}
while ( v11 < (__int64)(*(_QWORD *)(a1 + 1208) - (_QWORD)v5) >> 3 );
if ( (int)v9 > 0 )
v6 = v6 - 38.0;
}
v17 = 0;
v18 = 0;
if ( (int)v9 <= 0 )
v17 = v9;
v19 = 0;
do
{
ensureEmotesAreLoaded(v9, a2, (__int64)v5, a4);
v5 = Block;
v9 = (_BYTE *)*(&Block + 1) - (_BYTE *)Block;
a2 = ((_BYTE *)*(&Block + 1) - (_BYTE *)Block) / 48;
if ( v18 >= (int)a2 )
v20 = nullptr;
else
v20 = (char *)Block + v19;
if ( *(_QWORD *)v20 )
{
if ( !v20[27] )
{
v22 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 1032) + 472LL))(
*(_QWORD *)(a1 + 1032),
(unsigned int)v18);
v23 = v22;
if ( v22 )
{
if ( v17 >= v8 )
v6 = v6 + -26.0;
v24 = 0;
if ( v17 < v8 )
v24 = v17;
v25 = *v22;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v29,
(float)((float)((float)v24 + 0.5) * 26.0) + v12,
v6 - 13.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v25 + 184))(v23, v26);
v17 = v24 + 1;
v10 = 1;
}
}
}
else if ( v10 )
{
if ( v17 > 0 )
v6 = v6 + -26.0;
v21 = 0;
v6 = v6 + -12.0;
if ( v17 <= 0 )
v21 = v17;
v17 = v21;
}
++v18;
v19 += 48;
}
while ( v18 < 262 );
if ( v17 > 0 )
v6 = v6 + -26.0;
v27 = *(_QWORD *)(a1 + 1024);
*(float *)(v27 + 432) = 5.0 - v6;
ScrollableContentLayer::clampOffset(v27);
ScrollableContentLayer::ensureScrollThumb(v28);
ScrollableContentLayer::applyContentPosition(v27);
}
}