//
// FindBPMLayer::init from 0x5c1a30 to 0x5c1b84 (340 bytes)
//
// 2 xrefs:
// > FindBPMLayer::create @ 0x5c1c74
// > ??> @ 0x44c10
//
// 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
//
bool FindBPMLayer::init(FindBPMLayer *a1, int a2)
{
bool v4; // w21
cocos2d::CCDirector *v6; // x0
cocos2d::CCLabelBMFont *v7; // x0
cocos2d::CCLayer *m_mainLayer; // x3
cocos2d::CCLabelBMFont *m_bpmLabel; // x23
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
MusicDownloadManager *v11; // x0
SongInfoObject *SongInfoObject; // x0
const char *m_BPM; // x1
cocos2d::CCLabelBMFont *m_infoLabel; // x22
void (__fastcall *setString)(cocos2d::CCLabelBMFont *__hidden, const unsigned __int8 *); // x23
cocos2d::CCString *v16; // x0
const char *CString; // x0
float v18; // [xsp+58h] [xbp+58h]
float v19; // [xsp+5Ch] [xbp+5Ch]
cocos2d::CCPoint v20; // [xsp+60h] [xbp+60h] BYREF
v4 = CreateGuidelinesLayer::init(a1, nullptr, BPMFinder);
if ( v4 )
{
a1->m_songID = a2;
v6 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCLabelBMFont::create();
m_mainLayer = a1->m_mainLayer;
a1->m_bpmLabel = v7;
m_mainLayer->addChild_0(m_mainLayer, v7, 1);
m_bpmLabel = a1->m_bpmLabel;
setPosition = m_bpmLabel->setPosition;
cocos2d::CCPoint::CCPoint(&v20, v18 * 0.5, v19 * 0.5);
setPosition(m_bpmLabel, &v20);
cocos2d::CCArray::addObject(a1->m_recordingObjects, a1->m_bpmLabel);
v11 = MusicDownloadManager::sharedState();
SongInfoObject = MusicDownloadManager::getSongInfoObject(v11, a1->m_songID);
if ( SongInfoObject )
{
m_BPM = (const char *)(unsigned int)SongInfoObject->m_BPM;
if ( (int)m_BPM > 0 )
{
m_infoLabel = a1->m_infoLabel;
setString = m_infoLabel->setString;
v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"BPM: %i", m_BPM);
CString = cocos2d::CCString::getCString(v16);
setString(m_infoLabel, (const unsigned __int8 *)CString);
}
}
CreateGuidelinesLayer::toggleItems(a1, 0);
}
return v4;
}