//
// LevelInfoLayer::levelDownloadFinished from 0x1002c3850 to 0x1002c3ad5 (645 bytes)
//
// 2 xrefs:
// > sub_1002C3B20 @ 0x1002c3b2c
// > ??> @ 0x100906ca8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall LevelInfoLayer::levelDownloadFinished(LevelInfoLayer *a1, GJGameLevel *a2)
{
__int128 v2; // xmm0
GJGameLevel *m_level; // rax
GJGameLevel *v5; // rdi
CCMenuItemSpriteExtra *m_cloneBtn; // rdi
__int64 v7; // r14
cocos2d::CCSpriteFrameCache *v8; // rax
const char *data; // rsi
cocos2d::CCSpriteFrame *v10; // rax
CCMenuItemSpriteExtra *v11; // r14
unsigned __int8 v12; // al
GJGameLevel *v13; // rax
CustomSongWidget *m_songWidget; // r14
__int128 v15; // [rsp+0h] [rbp-60h] BYREF
void *longStorage; // [rsp+10h] [rbp-50h]
__int128 v17; // [rsp+20h] [rbp-40h] BYREF
void *__p; // [rsp+30h] [rbp-30h]
std::string v19; // [rsp+38h] [rbp-28h] BYREF
m_level = a1->m_level;
if ( m_level && m_level->m_levelID.random - m_level->m_levelID.seed != a2->m_levelID.random - a2->m_levelID.seed )
return;
((void (__fastcall *)(LoadingCircle *, _QWORD))a1->m_circle->setVisible)(a1->m_circle, 0);
v5 = a1->m_level;
if ( v5 )
{
cocos2d::CCObject::release(v5);
a1->m_level = nullptr;
}
a1->m_level = a2;
cocos2d::CCObject::retain(a2);
((void (__fastcall *)(cocos2d::CCMenu *, __int64))a1->m_playBtnMenu->setVisible)(a1->m_playBtnMenu, 1);
LevelInfoLayer::updateLabelValues(a1);
m_cloneBtn = a1->m_cloneBtn;
if ( m_cloneBtn )
{
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))m_cloneBtn->setVisible)(
m_cloneBtn,
a1->m_level->m_password.random != a1->m_level->m_password.seed);
if ( ((unsigned __int8 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_cloneBtn->isVisible)(a1->m_cloneBtn) )
{
v19.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x1Au);
v19.__r_.__value_.__r.__words[0] = 27;
v19.__r_.__value_.__l.__size_ = 23;
*(_QWORD *)&v2 = *(_QWORD *)"GJ_duplicateBtn_001.png";
strcpy(v19.__r_.__value_.__l.__data_, "GJ_duplicateBtn_001.png");
if ( a1->m_level->m_password.random - a1->m_level->m_password.seed != 1 )
std::string::assign(&v19, "GJ_duplicateLockedBtn_001.png");
v7 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_cloneBtn->getNormalImage)(a1->m_cloneBtn);
v8 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) != 0 )
data = v19.__r_.__value_.__l.__data_;
else
data = v19.__r_.__value_.__s.__data_;
v10 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v8, data);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v7 + 1144LL))(v7, v10);
if ( (*(_BYTE *)&v19.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v19.__r_.__value_.__l.__data_);
}
v11 = a1->m_cloneBtn;
v12 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))v11->isVisible)(v11);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))v11->setEnabled)(v11, v12);
}
v13 = a1->m_level;
m_songWidget = a1->m_songWidget;
if ( (v13->m_songIDs.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&v15, v13->m_songIDs.m_data.m_long.longStorage, v13->m_songIDs.m_data.m_long.size, *(double *)&v2);
v13 = a1->m_level;
if ( (v13->m_sfxIDs.m_data.m_short.sizex2 & 1) != 0 )
goto LABEL_17;
LABEL_19:
__p = v13->m_sfxIDs.m_data.m_long.longStorage;
v17 = *(_OWORD *)&v13->m_sfxIDs.m_data.m_short.sizex2;
goto LABEL_20;
}
longStorage = v13->m_songIDs.m_data.m_long.longStorage;
v2 = *(_OWORD *)&v13->m_songIDs.m_data.m_short.sizex2;
v15 = v2;
if ( (v13->m_sfxIDs.m_data.m_short.sizex2 & 1) == 0 )
goto LABEL_19;
LABEL_17:
sub_100006B70(&v17, v13->m_sfxIDs.m_data.m_long.longStorage, v13->m_sfxIDs.m_data.m_long.size, *(double *)&v2);
v13 = a1->m_level;
LABEL_20:
CustomSongWidget::updateWithMultiAssets(m_songWidget, &v15, &v17, (unsigned int)v13->m_songSize);
if ( (v17 & 1) != 0 )
operator delete(__p);
if ( (v15 & 1) != 0 )
operator delete(longStorage);
}