// // BrowseSmartKeyLayer::init from 0x9e06d4 to 0x9e1180 (2732 bytes) // // 2 xrefs: // > BrowseSmartKeyLayer::create @ 0x9e12b8 // > @ 0x316f8 // // 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 // __int64 __fastcall BrowseSmartKeyLayer::init(BrowseSmartTemplateLayer *a1, cocos2d::CCObject *a2, __int64 a3) { cocos2d::CCDirector *v6; // x0 __int64 v7; // x20 void *v8; // x0 void *v9; // x0 cocos2d::CCNode *m_buttonMenu; // x24 void (__fastcall *v11)(__int64, cocos2d::CCPoint *, float, float); // x21 cocos2d::CCNode *v12; // x20 __int64 m_template; // x20 void *v14; // x0 __int64 v15; // x20 int TotalChanceForPrefab; // w28 void *v17; // x0 int v18; // w20 GJSmartBlockPreview *v19; // x21 void *v20; // x0 __int64 v21; // x24 float v22; // s0 void *v23; // x0 GameManager *v24; // x0 void *v25; // x0 void *v26; // x0 int v27; // w27 CCMenuItemSpriteExtra *v28; // x24 void (__fastcall *v29)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21 int v30; // w3 const char *v31; // x6 cocos2d::CCNode *v32; // x0 CCMenuItemSpriteExtra *v33; // x27 const char *v34; // x6 cocos2d::CCNode *v35; // x0 CCMenuItemSpriteExtra *v36; // x26 const char *v37; // x6 cocos2d::CCNode *v38; // x0 CCMenuItemSpriteExtra *v39; // x23 const char *v40; // x6 cocos2d::CCNode *v41; // x0 CCMenuItemSpriteExtra *v42; // x21 cocos2d::CCNode *v43; // x24 void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24 void (__fastcall *v45)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24 void (__fastcall *v46)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24 void (__fastcall *v47)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23 unsigned int *v48; // x1 int v49; // w2 unsigned int *v50; // x1 int v51; // w2 unsigned int *v52; // x1 int v53; // w2 unsigned int *v54; // x1 int v55; // w2 unsigned int *v56; // x1 int v57; // w2 unsigned int *v58; // x1 int v59; // w2 unsigned int *v60; // x1 int v61; // w2 unsigned int *v62; // x1 int v63; // w2 float v64; // s0 unsigned __int8 v65; // [xsp+A3h] [xbp+A3h] int v66; // [xsp+A4h] [xbp+A4h] cocos2d::CCArray *Prefabs; // [xsp+A8h] [xbp+A8h] int v69; // [xsp+B8h] [xbp+B8h] float v70; // [xsp+D0h] [xbp+D0h] float v71; // [xsp+D4h] [xbp+D4h] _BYTE v72[8]; // [xsp+D8h] [xbp+D8h] BYREF _BYTE v73[8]; // [xsp+E0h] [xbp+E0h] BYREF cocos2d::CCPoint v74; // [xsp+E8h] [xbp+E8h] BYREF cocos2d::CCPoint v75; // [xsp+F0h] [xbp+F0h] BYREF cocos2d::CCPoint v76; // 0:kr08_8.8 cocos2d::SEL_MenuHandler v77; // 0:x2.16 cocos2d::SEL_MenuHandler v78; // 0:x2.16 cocos2d::SEL_MenuHandler v79; // 0:x2.16 cocos2d::SEL_MenuHandler v80; // 0:x2.16 cocos2d::SEL_MenuHandler v81; // 0:x2.16 v65 = FLAlertLayer::init(a1, 0x96u); if ( v65 ) { sub_D18EA8(&a1[1], a3); BrowseSmartTemplateLayer::baseSetup(a1); v6 = cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::getWinSize(v6); if ( a2 ) { a1->m_template = (GJSmartTemplate *)a2; cocos2d::CCObject::retain(a2); } sub_D153B8((int)&v74, "Help"); sub_D153B8( (int)&v75, "Use Add to give chance to the selected variation(s).\n" "Click Zero to reset the chance.\n" "Use Create to create a specific variation."); v7 = InfoAlertButton::create(1.0); v8 = (void *)(*(_QWORD *)&v75 - 24LL); if ( (__int64 *)(*(_QWORD *)&v75 - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v58 = (unsigned int *)(*(_QWORD *)&v75 - 8LL); do v59 = __ldaxr(v58); while ( __stlxr(v59 - 1, v58) ); } else { v59 = *(_DWORD *)(*(_QWORD *)&v75 - 8LL); *(_DWORD *)(*(_QWORD *)&v75 - 8LL) = v59 - 1; } if ( v59 <= 0 ) operator delete(v8); } v9 = (void *)(*(_QWORD *)&v74 - 24LL); if ( (__int64 *)(*(_QWORD *)&v74 - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v56 = (unsigned int *)(*(_QWORD *)&v74 - 8LL); do v57 = __ldaxr(v56); while ( __stlxr(v57 - 1, v56) ); } else { v57 = *(_DWORD *)(*(_QWORD *)&v74 - 8LL); *(_DWORD *)(*(_QWORD *)&v74 - 8LL) = v57 - 1; } if ( v57 <= 0 ) operator delete(v9); } a1->m_buttonMenu->addChild(a1->m_buttonMenu, (cocos2d::CCNode *)v7); m_buttonMenu = a1->m_buttonMenu; v11 = *(void (__fastcall **)(__int64, cocos2d::CCPoint *, float, float))(*(_QWORD *)v7 + 184LL); cocos2d::CCPoint::CCPoint( &v74, (float)((float)(v70 * 0.5) + 225.0) - 18.0, (float)((float)(v71 * 0.5) + 140.0) - 18.0); v76 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v74); v11(v7, &v75, v76.x, v76.y); if ( a1->m_template ) { v12 = a1->m_buttonMenu; cocos2d::CCPoint::CCPoint(&v75, v70 * 0.5, (float)((float)(v71 * 0.5) + 140.0) - 50.0); cocos2d::CCNode::convertToNodeSpace(v12, &v75); m_template = (__int64)a1->m_template; sub_D18D28(&v75); Prefabs = (cocos2d::CCArray *)GJSmartTemplate::getPrefabs(m_template, (const std::string *)&v75); v14 = (void *)(*(_QWORD *)&v75 - 24LL); if ( (__int64 *)(*(_QWORD *)&v75 - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v60 = (unsigned int *)(*(_QWORD *)&v75 - 8LL); do v61 = __ldaxr(v60); while ( __stlxr(v61 - 1, v60) ); } else { v61 = *(_DWORD *)(*(_QWORD *)&v75 - 8LL); *(_DWORD *)(*(_QWORD *)&v75 - 8LL) = v61 - 1; } if ( v61 <= 0 ) operator delete(v14); } v15 = (__int64)a1->m_template; sub_D18D28(&v75); TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab(v15); v17 = (void *)(*(_QWORD *)&v75 - 24LL); if ( (__int64 *)(*(_QWORD *)&v75 - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v62 = (unsigned int *)(*(_QWORD *)&v75 - 8LL); do v63 = __ldaxr(v62); while ( __stlxr(v63 - 1, v62) ); } else { v63 = *(_DWORD *)(*(_QWORD *)&v75 - 8LL); *(_DWORD *)(*(_QWORD *)&v75 - 8LL) = v63 - 1; } if ( v63 <= 0 ) operator delete(v17); } if ( Prefabs ) { v66 = cocos2d::CCArray::count(Prefabs); if ( v66 < 0 ) { LABEL_21: BrowseSmartTemplateLayer::goToPage(a1, 0); v32 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Create", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_01.png", v31, 30.0); v78.adj = (size_t)BrowseSmartKeyLayer::onButton; v78.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v33 = CCMenuItemSpriteExtra::create(v32, nullptr, v78); v33->setTag(v33, 1); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v33); v35 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Delete", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_05.png", v34, 30.0); v79.adj = (size_t)BrowseSmartKeyLayer::onButton; v79.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v36 = CCMenuItemSpriteExtra::create(v35, nullptr, v79); v36->setTag(v36, 2); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v36); v38 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Zero", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_02.png", v37, 30.0); v80.adj = (size_t)BrowseSmartKeyLayer::onButton; v80.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v39 = CCMenuItemSpriteExtra::create(v38, nullptr, v80); v39->setTag(v39, 3); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v39); v41 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Add", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_02.png", v40, 30.0); v81.adj = (size_t)BrowseSmartKeyLayer::onButton; v81.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v42 = CCMenuItemSpriteExtra::create(v41, nullptr, v81); v42->setTag(v42, 4); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v42); v43 = a1->m_buttonMenu; cocos2d::CCPoint::CCPoint(&v75, v70 * 0.5, (float)((float)(v71 * 0.5) + -140.0) + 24.0); cocos2d::CCNode::convertToNodeSpace(v43, &v75); setPosition = v33->setPosition; cocos2d::CCPoint::CCPoint(&v74, -100.0, 0.0); cocos2d::CCPoint::operator+(&v75, v73, &v74); setPosition(v33, &v75); v45 = v36->setPosition; cocos2d::CCPoint::CCPoint(&v74, -50.0, 0.0); cocos2d::CCPoint::operator+(&v75, v73, &v74); v45(v36, &v75); v46 = v39->setPosition; cocos2d::CCPoint::CCPoint(&v74, 50.0, 0.0); cocos2d::CCPoint::operator+(&v75, v73, &v74); v46(v39, &v75); v47 = v42->setPosition; cocos2d::CCPoint::CCPoint(&v74, 100.0, 0.0); cocos2d::CCPoint::operator+(&v75, v73, &v74); v47(v42, &v75); return v65; } } else { v66 = 0; } v18 = 0; do { sub_D18D28(&v75); v19 = (GJSmartBlockPreview *)GJSmartBlockPreview::create(); v20 = (void *)(*(_QWORD *)&v75 - 24LL); if ( (__int64 *)(*(_QWORD *)&v75 - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v48 = (unsigned int *)(*(_QWORD *)&v75 - 8LL); do v49 = __ldaxr(v48); while ( __stlxr(v49 - 1, v48) ); } else { v49 = *(_DWORD *)(*(_QWORD *)&v75 - 8LL); *(_DWORD *)(*(_QWORD *)&v75 - 8LL) = v49 - 1; } if ( v49 <= 0 ) operator delete(v20); } if ( v18 ) { v21 = cocos2d::CCArray::objectAtIndex(Prefabs, v18 - 1); LODWORD(v22) = sub_D18D28(&v75).n128_u32[0]; GJSmartBlockPreview::addTemplateGuide(v19, (SmartPrefabResult *)&v75, v22); v23 = (void *)(*(_QWORD *)&v75 - 24LL); if ( (__int64 *)(*(_QWORD *)&v75 - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v50 = (unsigned int *)(*(_QWORD *)&v75 - 8LL); do v51 = __ldaxr(v50); while ( __stlxr(v51 - 1, v50) ); } else { v51 = *(_DWORD *)(*(_QWORD *)&v75 - 8LL); *(_DWORD *)(*(_QWORD *)&v75 - 8LL) = v51 - 1; } if ( v51 <= 0 ) operator delete(v23); } sub_D18D28(&v74); sub_D18D28(&v75); v24 = GameManager::sharedState(); GJSmartBlockPreview::addPreview((__int64)v19, (unsigned __int8 **)&v74, &v75, v24->m_levelEditorLayer); v25 = (void *)(*(_QWORD *)&v75 - 24LL); if ( (__int64 *)(*(_QWORD *)&v75 - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v54 = (unsigned int *)(*(_QWORD *)&v75 - 8LL); do v55 = __ldaxr(v54); while ( __stlxr(v55 - 1, v54) ); } else { v55 = *(_DWORD *)(*(_QWORD *)&v75 - 8LL); *(_DWORD *)(*(_QWORD *)&v75 - 8LL) = v55 - 1; } if ( v55 <= 0 ) operator delete(v25); } v26 = (void *)(*(_QWORD *)&v74 - 24LL); if ( (__int64 *)(*(_QWORD *)&v74 - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v52 = (unsigned int *)(*(_QWORD *)&v74 - 8LL); do v53 = __ldaxr(v52); while ( __stlxr(v53 - 1, v52) ); } else { v53 = *(_DWORD *)(*(_QWORD *)&v74 - 8LL); *(_DWORD *)(*(_QWORD *)&v74 - 8LL) = v53 - 1; } if ( v53 <= 0 ) operator delete(v26); } v27 = *(_DWORD *)(v21 + 72); if ( TotalChanceForPrefab > 0 ) GJSmartBlockPreview::addChance(v19, *(_DWORD *)(v21 + 76), TotalChanceForPrefab); } else { LODWORD(v64) = sub_D18D28(&v75).n128_u32[0]; GJSmartBlockPreview::addTemplateGuide(v19, (SmartPrefabResult *)&v75, v64); v27 = 0; if ( (__int64 *)(*(_QWORD *)&v75 - 24LL) != &qword_124B6B0 ) sub_4DD5A0((void *)(*(_QWORD *)&v75 - 24LL)); } v19->setScale(v19, 0.5); v77.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v77.adj = (size_t)BrowseSmartKeyLayer::onPrefabObject; v28 = CCMenuItemSpriteExtra::create(v19, nullptr, v77); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v28); v19->setTag(v19, v27); v28->setTag(v28, v27); v29 = v28->setPosition; v69 = vcvtms_s32_f32((float)(v18 / 28)); v30 = v18 - 28 * v69; ++v18; cocos2d::CCPoint::CCPoint( &v74, (float)((float)((float)(v30 % 7) * 60.0) + -210.0) + 30.0, floorf((float)(v30 / 7)) * -60.0); cocos2d::CCPoint::operator+(&v75, v72, &v74); v29(v28, &v75); BrowseSmartTemplateLayer::addObjectToPage(a1, v28, v69); } while ( v66 >= v18 ); goto LABEL_21; } } return v65; }
GD Web Decomp Icon

GD Web Decomp

Raw Source