// // ChallengeNode::init from 0x906e80 to 0x907b40 (3264 bytes) // // 2 xrefs: // > ChallengeNode::create @ 0x907bd8 // > @ 0x4af40 // // 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 ChallengeNode::init(ChallengeNode *a1, GJChallengeItem *a2, ChallengesPage *a3, bool a4) { _BOOL4 v7; // w28 bool v8; // w26 GJChallengeItem *m_challengeItem; // x0 char *v10; // x21 cocos2d::CCNode *v11; // x21 void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x23 cocos2d::CCLabelBMFont *v13; // x21 GJChallengeType m_challengeType; // w0 unsigned __int64 v15; // d0 cocos2d::CCString *v16; // x0 cocos2d::CCLabelBMFont *v17; // x23 void (__fastcall *v18)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x25 const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1 __int64 v20; // x27 cocos2d::CCSprite *v21; // x23 const cocos2d::CCPoint *(__fastcall *v22)(cocos2d::CCNode *__hidden); // x1 __int64 v23; // x27 float width; // s8 float v25; // s10 float height; // s8 float v27; // s0 const char *v28; // x1 cocos2d::CCLabelBMFont *v29; // x27 void (__fastcall *v30)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x28 cocos2d::CCSprite *v31; // x0 const cocos2d::CCPoint *(__fastcall *v32)(cocos2d::CCNode *__hidden); // x1 void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23 float v34; // s10 float y; // s12 float v36; // s8 float v37; // s0 cocos2d::CCNode *v38; // x21 void (__fastcall *v39)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27 void (__fastcall *v40)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27 const char *v41; // x1 float *v42; // x23 float v43; // s8 void (__fastcall *v44)(float *, cocos2d::CCRect *); // x28 void (__fastcall *v45)(float *, cocos2d::CCRect *); // x28 __int64 v46; // x0 float v47; // s1 float v48; // s2 void (__fastcall *v49)(float *, cocos2d::CCRect *); // x27 cocos2d::CCString *v50; // x0 cocos2d::CCLabelBMFont *v51; // x23 void (__fastcall *v52)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28 __int64 v53; // x27 float *v54; // x0 cocos2d::CCSprite *v55; // x23 void (__fastcall *v56)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x21 cocos2d::CCString *v57; // x0 cocos2d::CCLabelBMFont *v58; // x21 void (__fastcall *v59)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x20 void (__fastcall *v60)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20 __int64 v61; // x22 char *p_m_fBrVertexMod; // x0 void *v63; // x0 cocos2d::CCSprite *v65; // x21 CCMenuItemSpriteExtra *v66; // x21 cocos2d::CCMenu *v67; // x27 void (__fastcall *v68)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21 cocos2d::CCSprite *v69; // x23 void (__fastcall *v70)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x21 cocos2d::CCString *v71; // x0 cocos2d::CCLabelBMFont *v72; // x21 void (__fastcall *v73)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x22 void (__fastcall *v74)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22 __int64 v75; // x23 float v76; // s0 float v77; // s1 double v78; // d0 unsigned int *v79; // x1 int v80; // w2 unsigned __int64 v81; // d0 double v82; // d0 cocos2d::CCLabelBMFont *v83; // x0 cocos2d::CCLabelBMFont_vtbl *v84; // x1 unsigned int *p_m_fTextureTop; // x1 int m_fTextureTop_low; // w2 _QWORD v87[2]; // [xsp+0h] [xbp+0h] BYREF void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *, cocos2d::CCRect *); // [xsp+98h] [xbp+98h] _BYTE v89[8]; // [xsp+A8h] [xbp+A8h] BYREF __int64 v90; // [xsp+B0h] [xbp+B0h] BYREF cocos2d::CCSprite *v91; // [xsp+B8h] [xbp+B8h] BYREF cocos2d::CCPoint v92; // [xsp+C0h] [xbp+C0h] BYREF cocos2d::CCRect v93; // [xsp+C8h] [xbp+C8h] BYREF cocos2d::SEL_MenuHandler v94; // 0:x2.16 cocos2d::CCRect v95; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4 v7 = a4; v8 = cocos2d::CCNode::init(a1); if ( v8 ) { a1->m_challengeItem = a2; if ( a2 && (cocos2d::CCObject::retain(a2), (m_challengeItem = a1->m_challengeItem) != nullptr) && m_challengeItem->m_canClaim ) { v10 = "GJ_square03.png"; } else { v10 = "GJ_square02.png"; } a1->m_challengesPage = a3; cocos2d::CCRect::CCRect(&v93, 0.0, 0.0, 80.0, 80.0); v11 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create( (cocos2d::extension::CCScale9Sprite *)v10, (const char *)&v93, v95); ((void (__fastcall *)(cocos2d::CCNode *, __int64))v11->__vftable[1].~CCNode_0)(v11, 0xFFFFFFFFLL); setContentSize = v11->setContentSize; cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v93, 300.0, 70.0); setContentSize(v11, (const cocos2d::CCSize *)&v93); a1->addChild_0(a1, v11, -1); if ( a1->m_challengeItem ) { v13 = cocos2d::CCLabelBMFont::create(); a1->addChild(a1, v13); v13->setScale(v13, 0.5); setAnchorPoint = (void (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCRect *))v13->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v93.origin, 0.0, 1.0); setAnchorPoint(v13, &v93); setAnchorPoint = (void (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCRect *))v13->setPosition; cocos2d::CCPoint::CCPoint(&v93.origin, -140.0, 29.0); setAnchorPoint(v13, &v93); sub_D153B8((unsigned int)v87 + 176, &byte_F288A0); sub_D153B8((unsigned int)v87 + 184, "currencyOrbIcon_001.png"); m_challengeType = a2->m_challengeType; switch ( m_challengeType ) { case 1: *(_QWORD *)&v78 = sub_D1798C(&v90, "Mana Orbs", 9).n128_u64[0]; v15 = sub_D1798C(&v91, "currencyOrbIcon_001.png", 23, v78).n128_u64[0]; break; case 3: *(_QWORD *)&v82 = sub_D1798C(&v90, "Stars/Moons", 11).n128_u64[0]; v15 = sub_D1798C(&v91, "GJ_starsIcon_001.png", 20, v82).n128_u64[0]; break; case 2: if ( a2->m_goal.random - a2->m_goal.seed == 1 ) v81 = sub_D1798C(&v90, "Silver Coin", 11).n128_u64[0]; else v81 = sub_D1798C(&v90, "Silver Coins", 12).n128_u64[0]; v15 = sub_D1798C(&v91, "GJ_coinsIcon2_001.png", 21, *(double *)&v81).n128_u64[0]; break; default: v15 = sub_D1798C(&v90, "?", 1).n128_u64[0]; break; } v16 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"Collect %i %s.", (const char *)(unsigned int)(a2->m_goal.random - a2->m_goal.seed), v90, *(double *)&v15); cocos2d::CCString::getCString(v16); v17 = cocos2d::CCLabelBMFont::create(); v18 = v17->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v93.origin, 0.0, 1.0); v18(v17, &v93.origin); getPosition = v13->getPosition; setAnchorPoint = (void (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCRect *))v17->setPosition; v20 = (__int64)getPosition(v13); cocos2d::CCPoint::CCPoint(&v92, 0.0, -20.0); cocos2d::CCPoint::operator+(&v93, v20, &v92); setAnchorPoint(v17, &v93); v17->setScale(v17, 0.5); a1->addChild(a1, v17); v21 = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v91); a1->addChild(a1, v21); v21->setScale(v21, 0.7); v22 = v13->getPosition; setAnchorPoint = (void (__fastcall *)(cocos2d::CCLabelBMFont *, cocos2d::CCRect *))v21->setPosition; v23 = (__int64)v22(v13); width = v13->getContentSize(v13)->width; v25 = (float)(width * v13->getScale(v13)) + 14.0; height = v13->getContentSize(v13)->height; v27 = v13->getScale(v13); cocos2d::CCPoint::CCPoint(&v92, v25, -1.0 - (float)((float)(height * v27) * 0.5)); cocos2d::CCPoint::operator+(&v93, v23, &v92); setAnchorPoint((cocos2d::CCLabelBMFont *)v21, &v93); if ( v7 ) { v29 = cocos2d::CCLabelBMFont::create(); v30 = v29->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v93.origin, 0.0, 0.5); v30(v29, &v93.origin); v31 = v21; v32 = v21->getPosition; setPosition = v29->setPosition; v34 = v32(v31)->x + 15.0; y = v13->getPosition(v13)->y; v36 = v13->getContentSize(v13)->height; v37 = v13->getScale(v13); cocos2d::CCPoint::CCPoint(&v93.origin, v34, y - (float)((float)(v36 * v37) * 0.5)); setPosition(v29, &v93.origin); v29->setScale(v29, 0.6); a1->addChild(a1, v29); } v89[0] = 0; v89[1] = 0; v89[2] = 0; v38 = (cocos2d::CCNode *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v28); ((void (__fastcall *)(cocos2d::CCNode *, _BYTE *))v38->__vftable[1].getTag)(v38, v89); ((void (__fastcall *)(cocos2d::CCNode *, __int64))v38->__vftable[1].~CCNode_0)(v38, 125); v38->setScaleX(v38, 0.5); v38->setScaleY(v38, 0.525); a1->addChild_0(a1, v38, 3); v39 = v38->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v93.origin, 0.0, 1.0); v39(v38, &v93.origin); v40 = v38->setPosition; cocos2d::CCPoint::CCPoint(&v93.origin, -140.0, -13.0); v40(v38, &v93.origin); v42 = (float *)cocos2d::CCSprite::create((cocos2d::CCSprite *)"GJ_progressBar_001.png", v41); (*(void (__fastcall **)(float *, float))(*(_QWORD *)v42 + 128LL))(v42, 0.98); (*(void (__fastcall **)(float *, float))(*(_QWORD *)v42 + 144LL))(v42, 0.78); (*(void (__fastcall **)(float *, void *))(*(_QWORD *)v42 + 944LL))(v42, &unk_EF2DE8); v43 = v42[108] - (float)(v42[108] * 0.98); v38->addChild_0(v38, (cocos2d::CCNode *)v42, 1); v44 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_QWORD *)v42 + 280LL); cocos2d::CCPoint::CCPoint(&v93.origin, 0.0, 0.5); v44(v42, &v93); v45 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_QWORD *)v42 + 184LL); v46 = (__int64)v38->getContentSize(v38); cocos2d::CCPoint::CCPoint(&v93.origin, v43 * 0.5, *(float *)(v46 + 4) * 0.5); v45(v42, &v93); v47 = v42[108]; v48 = (float)((float)(a2->m_count.random - a2->m_count.seed) / (float)(a2->m_goal.random - a2->m_goal.seed)) * v47; if ( v47 <= v48 ) v48 = v42[108]; v49 = *(void (__fastcall **)(float *, cocos2d::CCRect *))(*(_QWORD *)v42 + 1120LL); cocos2d::CCRect::CCRect(&v93, 0.0, 0.0, v48, v42[109]); v49(v42, &v93); v50 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%i / %i", (const char *)(unsigned int)(a2->m_count.random - a2->m_count.seed), (unsigned int)(a2->m_goal.random - a2->m_goal.seed)); cocos2d::CCString::getCString(v50); v51 = cocos2d::CCLabelBMFont::create(); v51->setScale(v51, 0.28); a1->addChild_0(a1, v51, 4); v52 = v51->setPosition; v53 = (__int64)v38->getPosition(v38); v54 = (float *)v38->getContentSize(v38); cocos2d::CCPoint::CCPoint(&v92, (float)(*v54 * 0.5) * 0.5, -5.0); cocos2d::CCPoint::operator+(&v93, v53, &v92); v52(v51, &v93.origin); if ( a2->m_canClaim ) { v65 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_rewardBtn_001.png"); v65->setScale(v65, 0.8); v94.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v94.adj = (size_t)ChallengeNode::onClaimReward; v66 = CCMenuItemSpriteExtra::create(v65, nullptr, v94); CCMenuItemSpriteExtra::setSizeMult(v66, 1.5); v67 = cocos2d::CCMenu::createWithItem(v66); a1->addChild(a1, v67); v68 = v67->setPosition; cocos2d::CCPoint::CCPoint(&v93.origin, 115.0, 0.0); v68(v67, &v93.origin); v69 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png"); a1->addChild(a1, v69); v69->setScale(v69, 0.6); v70 = v69->setPosition; cocos2d::CCPoint::CCPoint(&v93.origin, 70.0, 0.0); v70(v69, &v93.origin); v71 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%ix", (const char *)(unsigned int)(a2->m_reward.random - a2->m_reward.seed)); cocos2d::CCString::getCString(v71); v72 = cocos2d::CCLabelBMFont::create(); a1->addChild(a1, v72); v73 = v72->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v93.origin, 1.0, 0.5); v73(v72, &v93.origin); v72->setScale(v72, 0.4); v74 = v72->setPosition; v75 = (__int64)v69->getPosition(v69); cocos2d::CCPoint::CCPoint(&v92, -14.0, 0.0); cocos2d::CCPoint::operator+(&v93, v75, &v92); v74(v72, &v93.origin); v76 = ((float (__fastcall *)(cocos2d::CCMenu *))v67->getPosition)(v67); cocos2d::CCPoint::operator=(&a1->m_unkPoint, v76, v77); } else { v55 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_bigDiamond_001.png"); a1->addChild(a1, v55); v55->setScale(v55, 0.8); v56 = v55->setPosition; cocos2d::CCPoint::CCPoint(&v93.origin, 118.0, 0.0); v56(v55, &v93.origin); v57 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"%ix", (const char *)(unsigned int)(a2->m_reward.random - a2->m_reward.seed)); cocos2d::CCString::getCString(v57); v58 = cocos2d::CCLabelBMFont::create(); a1->addChild(a1, v58); v59 = v58->setAnchorPoint; cocos2d::CCPoint::CCPoint(&v93.origin, 1.0, 0.5); v59(v58, &v93.origin); v58->setScale(v58, 0.6); v60 = v58->setPosition; v61 = (__int64)v55->getPosition(v55); cocos2d::CCPoint::CCPoint(&v92, -20.0, 0.0); cocos2d::CCPoint::operator+(&v93, v61, &v92); v60(v58, &v93.origin); } p_m_fBrVertexMod = (char *)&v91[-1].m_fBrVertexMod; if ( (__int64 *)&v91[-1].m_fBrVertexMod != &qword_124B6B0 ) { if ( &pthread_create ) { p_m_fTextureTop = (unsigned int *)&v91[-1].m_fTextureTop; do m_fTextureTop_low = __ldaxr(p_m_fTextureTop); while ( __stlxr(m_fTextureTop_low - 1, p_m_fTextureTop) ); } else { m_fTextureTop_low = LODWORD(v91[-1].m_fTextureTop); LODWORD(v91[-1].m_fTextureTop) = m_fTextureTop_low - 1; } if ( m_fTextureTop_low <= 0 ) operator delete(p_m_fBrVertexMod); } v63 = (void *)(v90 - 24); if ( (__int64 *)(v90 - 24) != &qword_124B6B0 ) { if ( &pthread_create ) { v79 = (unsigned int *)(v90 - 8); do v80 = __ldaxr(v79); while ( __stlxr(v80 - 1, v79) ); } else { v80 = *(_DWORD *)(v90 - 8); *(_DWORD *)(v90 - 8) = v80 - 1; } if ( v80 <= 0 ) operator delete(v63); } } else { ((void (__fastcall *)(cocos2d::CCNode *, void *))v11->__vftable[1].getTag)(v11, &unk_EF2DE0); ((void (__fastcall *)(cocos2d::CCNode *, __int64))v11->__vftable[1].~CCNode_0)(v11, 75); v83 = cocos2d::CCLabelBMFont::create(); v84 = v83->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable; a1->m_countdownLabel = v83; ((void (__fastcall *)(float))v84->setScale)(0.5); a1->addChild(a1, a1->m_countdownLabel); a1->m_unloaded = 1; } } return v8; }