//
// EditorSoundBrowserLayer::updatePageLabel from 0x14018fbe0 to 0x14018fe44 (612 bytes)
//
// 5 xrefs:
// > EditorSoundBrowserLayer::loadCurrentPage @ 0x14018f43c
// > EditorSoundBrowserLayer::loadCurrentPage @ 0x14018f8ef
// > EditorSoundBrowserLayer::loadEditorSoundsFinished @ 0x14019049a
// > EditorSoundBrowserLayer::loadEditorSoundsFailed @ 0x140190549
// > ??> @ 0x140919250
//
// 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:27:42 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall EditorSoundBrowserLayer::updatePageLabel(__int64 a1)
{
int v2; // edi
cocos2d::CCArray *v3; // rcx
cocos2d::CCArray *v4; // rcx
unsigned int v5; // ecx
int v6; // edx
unsigned int v7; // r8d
cocos2d::CCString *v8; // rax
char *CString; // rax
size_t v10; // r8
cocos2d::CCString *v11; // rax
void **v12; // rdx
__int64 v13; // rdx
cocos2d::CCArray *v14; // rcx
bool v15; // di
__int64 v16; // rcx
__int64 v17; // rcx
void *v18; // rcx
void *Block[2]; // [rsp+30h] [rbp-38h] BYREF
__int64 v20; // [rsp+40h] [rbp-28h]
unsigned __int64 v21; // [rsp+48h] [rbp-20h]
if ( *(_QWORD *)(a1 + 1048) )
{
v2 = 10 * *(_DWORD *)(a1 + 1036) + 1;
v3 = *(cocos2d::CCArray **)(a1 + 1088);
if ( v3 && !cocos2d::CCArray::count(v3) )
v2 = 0;
v4 = *(cocos2d::CCArray **)(a1 + 1088);
if ( v4 )
v5 = cocos2d::CCArray::count(v4);
else
v5 = 0;
v6 = *(_DWORD *)(a1 + 1036);
v7 = v5 + 10 * v6;
*(_OWORD *)Block = 0;
v20 = 0;
v21 = 15;
LOBYTE(Block[0]) = 0;
if ( v7 )
{
if ( *(_DWORD *)(a1 + 1032) < 2u )
{
v11 = cocos2d::CCString::createWithFormat("%d-%d of %d", v2, v7, *(_DWORD *)(a1 + 1096));
CString = (char *)cocos2d::CCString::getCString(v11);
v10 = -1;
do
++v10;
while ( CString[v10] );
}
else
{
v8 = cocos2d::CCString::createWithFormat("Page %d", v6 + 1);
CString = (char *)cocos2d::CCString::getCString(v8);
v10 = -1;
do
++v10;
while ( CString[v10] );
}
sub_1400405A0(Block, CString, v10);
}
else
{
v20 = 10;
strcpy((char *)Block, "No results");
}
v12 = Block;
if ( v21 > 0xF )
v12 = (void **)Block[0];
(**(void (__fastcall ***)(__int64, void **))(*(_QWORD *)(a1 + 1048) + 360LL))(*(_QWORD *)(a1 + 1048) + 360LL, v12);
if ( *(_DWORD *)(a1 + 1032) < 2u )
{
v15 = *(_DWORD *)(a1 + 1096) > 10 * (*(_DWORD *)(a1 + 1036) + 1);
}
else
{
v14 = *(cocos2d::CCArray **)(a1 + 1088);
v15 = v14 && (int)cocos2d::CCArray::count(v14) >= 10;
}
v16 = *(_QWORD *)(a1 + 1056);
if ( v16 )
{
LOBYTE(v13) = *(_DWORD *)(a1 + 1036) > 0;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v16 + 336LL))(v16, v13);
}
v17 = *(_QWORD *)(a1 + 1064);
if ( v17 )
(*(void (__fastcall **)(__int64, bool))(*(_QWORD *)v17 + 336LL))(v17, v15);
if ( v21 > 0xF )
{
v18 = Block[0];
if ( v21 + 1 >= 0x1000 )
{
v18 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v18 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v18);
}
}
}