//
// SongInfoLayer::addLinkRows from 0x1406363d0 to 0x1406366de (782 bytes)
//
// 3 xrefs:
// > SongInfoLayer::init @ 0x140635368
// > SongInfoLayer::init @ 0x14063547d
// > ??> @ 0x140930c38
//
// 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:35:30 +0000
//
// Hidden C++ exception states: #wind=3
__int64 __fastcall SongInfoLayer::addLinkRows(__int64 a1, __int64 *a2, float a3)
{
__int64 v5; // rax
__int64 v6; // rcx
unsigned __int64 v7; // r14
__int64 result; // rax
cocos2d::CCArray *v9; // r13
unsigned __int64 v10; // rbp
__int64 v11; // rsi
__int64 v12; // rdx
_QWORD *v13; // rbx
cocos2d::CCObject *v14; // rdi
cocos2d::CCObject *v15; // rbx
__int64 v16; // rbx
__int64 v17; // rax
__int64 v18; // rax
__int64 v19; // rcx
float v20; // [rsp+50h] [rbp-D8h] BYREF
void *v21; // [rsp+58h] [rbp-D0h]
void *v22; // [rsp+60h] [rbp-C8h]
_BYTE v23[8]; // [rsp+68h] [rbp-C0h] BYREF
_BYTE v24[8]; // [rsp+70h] [rbp-B8h] BYREF
_QWORD v25[4]; // [rsp+78h] [rbp-B0h] BYREF
v5 = cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v5, &v20);
v7 = 6;
if ( (unsigned __int64)((a2[1] - *a2) / 72) < 6 )
v7 = (a2[1] - *a2) / 72;
result = cocos2d::CCArray::create(v6);
v9 = (cocos2d::CCArray *)result;
v10 = 0;
if ( v7 )
{
v11 = 0;
do
{
v12 = *a2;
if ( *(_QWORD *)(v11 + *a2 + 24) )
sub_14003F4F0((__int64)v25, v11 + v12 + 8);
else
MusicDownloadManager::linkTitleForType((__int64)v25, *(_DWORD *)(v11 + v12 + 4));
v13 = v25;
if ( v25[3] > 0xFu )
v13 = (_QWORD *)v25[0];
v21 = operator new(0x2C8u);
v14 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v21);
if ( v14 )
{
if ( ButtonSprite::init_1(
(__int64)v14,
(__int64)v13,
87,
0,
1058642330,
1,
&qword_140704F78,
(__int64)"GJ_button_05.png",
1104674816) )
{
cocos2d::CCObject::autorelease(v14);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v14 + 8LL))(v14, 1);
v14 = nullptr;
}
}
sub_14003D310((__int64)v25);
v22 = operator new(0x208u);
v15 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::CCMenuItemSpriteExtra((__int64)v22);
if ( v15 )
{
if ( CCMenuItemSpriteExtra::init((__int64 *)v15, (__int64 *)v14, 0, a1, (__int64)SongInfoLayer::onLink) )
{
cocos2d::CCObject::autorelease(v15);
goto LABEL_19;
}
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v15 + 8LL))(v15, 1);
}
v15 = nullptr;
LABEL_19:
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v15 + 64LL))(
v15,
(__int64)(*(_QWORD *)(a1 + 744) - *(_QWORD *)(a1 + 736)) >> 5);
sub_140075F50((__int64 *)(a1 + 736), v11 + *a2 + 40);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v15);
cocos2d::CCArray::addObject(v9, v15);
if ( cocos2d::CCArray::count(v9) == 3 || (result = v10 + 1, v10 + 1 == v7) )
{
v16 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, v20 * 0.5, a3 - (float)(int)(34 * (v10 / 3)));
cocos2d::CCNode::convertToNodeSpace(v16, v24, v17);
GameToolbox::alignItemsHorisontally((__int64)v9, 14.0, v18, 0);
result = cocos2d::CCArray::create(v19);
v9 = (cocos2d::CCArray *)result;
}
++v10;
v11 += 72;
}
while ( v10 < v7 );
}
return result;
}