//
// FindBPMLayer::create from 0x14009b8b0 to 0x14009baca (538 bytes)
//
// 2 xrefs:
// > SongInfoLayer::onBPM @ 0x140494589
// > ??> @ 0x1406c750c
//
// 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
//
// Hidden C++ exception states: #wind=1
FindBPMLayer *FindBPMLayer::create(int a1)
{
FindBPMLayer *v2; // rdi
__int64 v3; // rcx
cocos2d::CCDirector *v4; // rax
struct cocos2d::CCLabelBMFont *v5; // rax
cocos2d::CCLabelBMFont_vtbl *v6; // rbx
const cocos2d::CCPoint *v7; // rax
MusicDownloadManager *v8; // rax
SongInfoObject *SongInfoObject; // rax
int m_BPM; // edx
void (__fastcall **v11)(__int64, const char *); // rbx
cocos2d::CCString *v12; // rax
const char *CString; // rax
cocos2d::CCPoint v15; // [rsp+40h] [rbp+18h] BYREF
v2 = (FindBPMLayer *)operator new(0x300u);
CreateGuidelinesLayer::CreateGuidelinesLayer(v2);
v2->CreateGuidelinesLayer::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable = (FindBPMLayer_vtbl *)&FindBPMLayer::`vftable';
v2->CreateGuidelinesLayer::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCTouchDelegate::__vftable = (cocos2d::CCTouchDelegate_vtbl *)&FindBPMLayer::`vftable';
v2->CreateGuidelinesLayer::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCAccelerometerDelegate::__vftable = (cocos2d::CCAccelerometerDelegate_vtbl *)&FindBPMLayer::`vftable';
v2->CreateGuidelinesLayer::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeypadDelegate::__vftable = (cocos2d::CCKeypadDelegate_vtbl *)&FindBPMLayer::`vftable';
v2->CreateGuidelinesLayer::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCKeyboardDelegate::__vftable = (cocos2d::CCKeyboardDelegate_vtbl *)&FindBPMLayer::`vftable';
v2->CreateGuidelinesLayer::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCMouseDelegate::__vftable = (cocos2d::CCMouseDelegate_vtbl *)&FindBPMLayer::`vftable';
v2->CreateGuidelinesLayer::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCLayerRGBA::cocos2d::CCRGBAProtocol::__vftable = (cocos2d::CCRGBAProtocol_vtbl *)&FindBPMLayer::`vftable';
v2->CreateGuidelinesLayer::FLAlertLayer::cocos2d::CCLayerColor::cocos2d::CCBlendProtocol::__vftable = (cocos2d::CCBlendProtocol_vtbl *)&FindBPMLayer::`vftable';
v2->CreateGuidelinesLayer::FLAlertLayerProtocol::__vftable = (FLAlertLayerProtocol_vtbl *)&FindBPMLayer::`vftable';
v2->m_songID = 0;
v2->m_bpmLabel = nullptr;
*(_QWORD *)&v2->m_startOffset = 0;
v2->m_beatsPerMinute = 0;
if ( CreateGuidelinesLayer::init(v2, nullptr, BPMFinder) )
{
v2->m_songID = a1;
v4 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v3);
cocos2d::CCDirector::getWinSize(v4);
v5 = cocos2d::CCLabelBMFont::create("BPM", (const char *)&qword_14052A4D8);
v2->m_bpmLabel = v5;
v2->m_mainLayer->addChild_0(v2->m_mainLayer, v5, 1);
v6 = v2->m_bpmLabel->__vftable;
cocos2d::CCPoint::CCPoint(&v15, *(float *)&v2 * 0.5, *((float *)&v2 + 1) * 0.5);
v6->setPosition_0(v2->m_bpmLabel, v7);
cocos2d::CCArray::addObject(v2->m_recordingObjects, v2->m_bpmLabel);
v8 = MusicDownloadManager::sharedState();
SongInfoObject = MusicDownloadManager::getSongInfoObject(v8, v2->m_songID);
if ( SongInfoObject )
{
m_BPM = SongInfoObject->m_BPM;
if ( m_BPM > 0 )
{
v11 = (void (__fastcall **)(__int64, const char *))v2->m_infoLabel->__vftable;
v12 = cocos2d::CCString::createWithFormat("BPM: %i", m_BPM);
CString = cocos2d::CCString::getCString(v12);
(*v11)((__int64)&v2->m_infoLabel->cocos2d::CCLabelProtocol, CString);
}
}
CreateGuidelinesLayer::toggleItems(v2, 0);
cocos2d::CCObject::autorelease(v2);
return v2;
}
else
{
((void (__fastcall *)(FindBPMLayer *, __int64))v2->~FindBPMLayer)(v2, 1);
return nullptr;
}
}