//
// GJPathsLayer::init from 0x140284c00 to 0x14028515f (1375 bytes)
//
// 5 xrefs:
// > GJPathsLayer::create @ 0x140284bc2
// > GJPathsLayer::create @ 0x140284bc9
// > GJPathsLayer::create @ 0x140284bb3
// > ??> @ 0x14056dfa8
// > ??> @ 0x1406d1538
//
// 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=2
bool GJPathsLayer::init(GJPathsLayer *a1)
{
cocos2d::CCTextureCache *v2; // rax
__int64 v3; // rcx
cocos2d::CCSpriteFrameCache *v4; // rax
GameStatsManager *v5; // rcx
__int64 v6; // rcx
__int64 v7; // rax
cocos2d::CCTouchDispatcher *v8; // rax
bool result; // al
_BOOL8 v10; // rdx
_BOOL8 v11; // rdx
__int64 v12; // rcx
cocos2d::CCDirector *v13; // rax
cocos2d::CCLayer *v14; // rax
struct cocos2d::CCSprite *v15; // rdi
float v16; // xmm0_4
cocos2d::CCSprite_vtbl *v17; // rbx
double v18; // xmm0_8
const cocos2d::CCPoint *v19; // rax
cocos2d::CCSprite *v20; // rax
CCMenuItemSpriteExtra *v21; // rax
cocos2d::CCMenu *v22; // rax
cocos2d::CCMenu_vtbl *v23; // rbx
const cocos2d::CCPoint *v24; // rax
struct cocos2d::CCSprite *v25; // rdi
float v26; // xmm0_4
cocos2d::CCSprite_vtbl *v27; // rbx
const cocos2d::CCPoint *v28; // rax
struct cocos2d::CCSprite *v29; // rdi
float v30; // xmm0_4
cocos2d::CCSprite_vtbl *v31; // rbx
const cocos2d::CCPoint *v32; // rax
struct cocos2d::CCSprite *v33; // rdi
float v34; // xmm0_4
cocos2d::CCSprite_vtbl *v35; // rbx
const cocos2d::CCPoint *v36; // rax
float v37; // xmm0_4
int v38; // ebx
int v39; // r14d
GJPathSprite *v40; // r15
CCMenuItemSpriteExtra *v41; // rax
cocos2d::CCNode *v42; // rdi
float v43; // xmm6_4
float v44; // xmm0_4
cocos2d::CCNode_vtbl *v45; // rbx
struct cocos2d::CCPoint v46; // rax
__int128 v47; // [rsp+40h] [rbp-41h] BYREF
void *v48; // [rsp+E8h] [rbp+67h] BYREF
float v49; // [rsp+F0h] [rbp+6Fh]
char v50; // [rsp+F8h] [rbp+77h] BYREF
CCMenuItemSpriteExtra *v51; // [rsp+100h] [rbp+7Fh]
v2 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
cocos2d::CCTextureCache::addImage(v2, "GJ_PathSheet.png", 0);
v4 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v3);
cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile(v4, "GJ_PathSheet.plist");
a1->m_exiting = 1;
v5 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v48 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v48);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v5 = (GameStatsManager *)qword_1406C2EE8;
}
GameStatsManager::trySelectActivePath(v5);
if ( !a1->m_forcePrioRegistered )
{
a1->m_forcePrioRegistered = 1;
v7 = cocos2d::CCDirector::sharedDirector(v6);
v8 = (cocos2d::CCTouchDispatcher *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 144LL))(v7);
cocos2d::CCTouchDispatcher::registerForcePrio(v8, a1, 2);
}
LODWORD(v48) = -1358954496;
result = cocos2d::CCLayerColor::initWithColor(a1, (const struct cocos2d::_ccColor4B *)&v48);
if ( result )
{
LOBYTE(v10) = 1;
a1->setTouchEnabled(a1, v10);
LOBYTE(v11) = 1;
a1->setKeypadEnabled(a1, v11);
v13 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v12);
cocos2d::CCDirector::getWinSize(v13);
v14 = (cocos2d::CCLayer *)cocos2d::CCLayer::create();
a1->m_mainLayer = v14;
a1->addChild_1(a1, v14);
v15 = cocos2d::CCSprite::createWithSpriteFrameName("pathSelectBG_001.png");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v15, -1);
v16 = ((float (__fastcall *)(struct cocos2d::CCSprite *))v15->setScale_0)(v15);
v17 = v15->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v18 = cocos2d::CCPoint::CCPoint(v16, v49 * 0.5);
v17->setPosition_0(v15, v19);
a1->m_joystickConnected = -1;
v20 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_closeBtn_001.png");
a1->m_closeSprite = v20;
v21 = CCMenuItemSpriteExtra::create(v20, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJPathRewardPopup::closePopup);
HIDWORD(v21->m_pfnSelector.adj) = 1070386381;
v22 = cocos2d::CCMenu::create(v21, 0);
a1->m_buttonMenu = v22;
v23 = v22->cocos2d::CCLayerRGBA::cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v18, (float)((float)(v49 * 0.5) - 130.0) + 10.0);
v23->setPosition_0(a1->m_buttonMenu, v24);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, a1->m_buttonMenu, 10);
v25 = cocos2d::CCSprite::createWithSpriteFrameName("label_paths_001.png");
v26 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v25,
20);
v27 = v25->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v26, v49 * 0.5);
v27->setPosition_0(v25, v28);
((void (__fastcall *)(struct cocos2d::CCSprite *))v25->setScale_0)(v25);
v29 = cocos2d::CCSprite::createWithSpriteFrameName("label_of_001.png");
v30 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v29,
20);
v31 = v29->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v30, v49 * 0.5);
v31->setPosition_0(v29, v32);
((void (__fastcall *)(struct cocos2d::CCSprite *))v29->setScale_0)(v29);
v33 = cocos2d::CCSprite::createWithSpriteFrameName("label_power_001.png");
v34 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v33,
20);
v35 = v33->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v34, v49 * 0.5);
v35->setPosition_0(v33, v36);
v37 = ((float (__fastcall *)(struct cocos2d::CCSprite *))v33->setScale_0)(v33);
cocos2d::CCPoint::CCPoint(v37, v49 * 0.5);
v38 = 0;
while ( 1 )
{
v39 = v38 + 1;
v40 = GJPathSprite::create(v38 + 1);
GJPathSprite::updateState(v40);
v51 = (CCMenuItemSpriteExtra *)operator new(0x208u);
v41 = CCMenuItemSpriteExtra::CCMenuItemSpriteExtra(v51);
v42 = v41;
if ( !v41 )
goto LABEL_11;
if ( !CCMenuItemSpriteExtra::init(v41, v40, nullptr, a1, (cocos2d::SEL_MenuHandler *)GJPathsLayer::onPath) )
break;
cocos2d::CCObject::autorelease(v42);
LABEL_12:
v42->setTag(v42, v39);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v42);
v43 = (float)(90.0 - (float)((float)v38 * 36.0)) * 0.0174532925199433;
sinf(v43);
v44 = cosf(v43) * 100.0;
cocos2d::CCPoint::CCPoint(v44, v44);
cocos2d::CCPoint::operator+(&v50, &v48);
v45 = v42->__vftable;
v46 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, (const struct cocos2d::CCPoint *)&v47);
((void (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCPoint))v45->setPosition_0)(v42, v46);
v38 = v39;
if ( v39 >= 10 )
return 1;
}
((void (__fastcall *)(cocos2d::CCNode *, __int64))v42->~CCNode)(v42, 1);
LABEL_11:
v42 = nullptr;
goto LABEL_12;
}
return result;
}