//
// LevelBrowserLayer::setupPageInfo from 0x1403e61b0 to 0x1403e6442 (658 bytes)
//
// 3 xrefs:
// > ??> @ 0x140789ff0
// > ??> @ 0x14078f998
// > ??> @ 0x140924f14
//
// 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:43 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall LevelBrowserLayer::setupPageInfo(__int64 a1, _QWORD *a2, _BYTE *a3)
{
__int64 v5; // rsi
_BYTE *v6; // rdx
size_t v7; // r8
cocos2d::CCArray *v8; // rbp
void *v9; // r8
cocos2d::CCString *v10; // rax
cocos2d::CCString *v11; // rax
cocos2d::CCString *v12; // rax
__int64 v13; // rdx
__int64 v14; // rdx
int v15; // r9d
int v16; // edx
int v17; // r8d
cocos2d::CCString *v18; // rax
const char *CString; // rax
__int64 v20; // rcx
__int64 v21; // rdx
void *Block[2]; // [rsp+38h] [rbp-40h] BYREF
__m128i si128; // [rsp+48h] [rbp-30h]
v5 = a1 - 544;
if ( !*(_BYTE *)(a1 - 544 + 764) && (unsigned __int8)LevelBrowserLayer::isCorrect(a1 - 544, a3) )
{
v6 = a2;
if ( a2[3] > 0xFu )
v6 = (_BYTE *)*a2;
*(_OWORD *)Block = 0;
si128 = 0;
v7 = -1;
do
++v7;
while ( v6[v7] );
sub_14003D230(Block, v6, v7);
v8 = sub_14020EFC0((__int64 *)Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v9 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
if ( cocos2d::CCArray::count(v8) >= 3 )
{
v10 = cocos2d::CCArray::objectAtIndex(v8, 0);
*(_DWORD *)(a1 + 176) = cocos2d::CCString::intValue(v10);
v11 = cocos2d::CCArray::objectAtIndex(v8, 1u);
*(_DWORD *)(a1 + 180) = cocos2d::CCString::intValue(v11);
v12 = cocos2d::CCArray::objectAtIndex(v8, 2u);
*(_DWORD *)(a1 + 184) = cocos2d::CCString::intValue(v12);
if ( *(_DWORD *)(a1 + 180) )
LOBYTE(v13) = 1;
else
v13 = 0;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 80) + 336LL))(*(_QWORD *)(a1 + 80), v13);
if ( *(_DWORD *)(a1 + 184) + *(_DWORD *)(a1 + 180) < *(_DWORD *)(a1 + 176) )
LOBYTE(v14) = 1;
else
v14 = 0;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 72) + 336LL))(*(_QWORD *)(a1 + 72), v14);
v15 = *(_DWORD *)(v5 + 720);
v16 = *(_DWORD *)(v5 + 724);
v17 = v16 + *(_DWORD *)(v5 + 728);
if ( v17 >= v15 )
v17 = *(_DWORD *)(v5 + 720);
v18 = cocos2d::CCString::createWithFormat("%i to %i of %i", v16 + 1, v17, v15);
CString = cocos2d::CCString::getCString(v18);
(**(void (__fastcall ***)(__int64, const char *))(*(_QWORD *)(v5 + 672) + 360LL))(
*(_QWORD *)(v5 + 672) + 360LL,
CString);
cocos2d::CCLabelBMFont::limitLabelWidth(*(cocos2d::CCLabelBMFont **)(v5 + 672), 100.0, 0.60000002, 0.0);
LevelBrowserLayer::updatePageLabel(v5);
v20 = *(_QWORD *)(a1 + 120);
if ( v20 )
*(_DWORD *)(v20 + 432) = *(_DWORD *)(a1 + 176);
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 72) + 344LL))(*(_QWORD *)(a1 + 72))
|| (*(unsigned __int8 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 80) + 344LL))(*(_QWORD *)(a1 + 80)) )
{
LOBYTE(v21) = 1;
}
else
{
v21 = 0;
}
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 144) + 336LL))(*(_QWORD *)(a1 + 144), v21);
}
}
sub_14003D310((__int64)a2);
}