//
// CustomSongWidget::loadSongInfoFinished from 0x14016dee0 to 0x14016e089 (425 bytes)
//
// 2 xrefs:
// > ??> @ 0x1407448a8
// > ??> @ 0x1409181a0
//
// 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:30 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall CustomSongWidget::loadSongInfoFinished(__int64 a1, cocos2d::CCObject *a2)
{
int v4; // r8d
_QWORD *v5; // rcx
__int64 *v6; // r9
__int64 *v7; // rax
__int64 v8; // rcx
__int64 result; // rax
__int64 v10; // rdi
__int64 v11; // rcx
cocos2d::CCObject *v12; // rax
cocos2d::CCObject *v13; // rcx
int v14; // ecx
__int64 v15; // rbx
struct cocos2d::CCFiniteTimeAction *v16; // rax
struct cocos2d::CCAction *v17; // rax
void *v18; // [rsp+30h] [rbp+8h] BYREF
v4 = *((_DWORD *)a2 + 80);
v5 = (_QWORD *)(a1 + 296);
v6 = (__int64 *)*v5;
v7 = *(__int64 **)(*v5 + 8LL);
while ( !*((_BYTE *)v7 + 25) )
{
if ( *((_DWORD *)v7 + 7) >= v4 )
{
v6 = v7;
v7 = (__int64 *)*v7;
}
else
{
v7 = (__int64 *)v7[2];
}
}
if ( *((_BYTE *)v6 + 25) || v4 < *((_DWORD *)v6 + 7) )
{
v10 = a1 - 320;
result = *(unsigned int *)(a1 - 320 + 504);
if ( (_DWORD)result == v4 && (_DWORD)result )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v10 + 376) + 336LL))(*(_QWORD *)(v10 + 376), 0);
v11 = *(_QWORD *)(v10 + 480);
if ( v11 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v11 + 336LL))(v11, 0);
v12 = *(cocos2d::CCObject **)(v10 + 336);
if ( v12 != a2 )
{
cocos2d::CCObject::retain(a2);
v13 = *(cocos2d::CCObject **)(v10 + 336);
if ( v13 )
cocos2d::CCObject::release(v13);
*(_QWORD *)(v10 + 336) = a2;
v12 = a2;
}
if ( v12 )
v14 = *((_DWORD *)v12 + 80);
else
v14 = 0;
*(_DWORD *)(v10 + 504) = v14;
CustomSongWidget::updateSongInfo(a1 - 320);
if ( *(_BYTE *)(a1 + 179) )
CustomSongWidget::startDownload(a1 - 320);
v15 = cocos2d::CCCallFunc::create(a1 - 320, CustomSongWidget::updateSongInfo);
v16 = cocos2d::CCDelayTime::create(0.0);
v17 = cocos2d::CCSequence::create(v16, v15, 0);
return (__int64)cocos2d::CCNode::runAction((cocos2d::CCNode *)(a1 - 320), v17);
}
}
else
{
LODWORD(v18) = *((_DWORD *)a2 + 80);
sub_1400BD2C0(v5, (int *)&v18);
v8 = qword_14090C070;
if ( !qword_14090C070 )
{
v18 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager(v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v8 = qword_14090C070;
}
return MusicDownloadManager::downloadSong(v8, *((unsigned int *)a2 + 80));
}
return result;
}