// // BrowseSmartKeyLayer::init from 0xb17df8 to 0xb187b8 (2496 bytes) // // 2 xrefs: // > BrowseSmartKeyLayer::create @ 0xb1897c // > @ 0xbc008 // // This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 13:01:33 +0000 // __int64 __fastcall BrowseSmartKeyLayer::init(__int64 a1, cocos2d::CCObject *a2, __int64 a3) { __int64 *v5; // x20 const void *v6; // x1 size_t v7; // x2 cocos2d::CCDirector *v8; // x0 cocos2d::CCDirector *v9; // x0 __int64 v10; // x21 cocos2d::CCNode *v11; // x24 void (__fastcall *v12)(__int64, __int64 *); // x22 cocos2d::CCNode *v13; // x21 char v14; // w0 __int64 v15; // x21 __int64 v16; // x1 char v17; // w0 __int64 v18; // x21 __int64 v19; // x1 int v20; // w21 char v21; // w0 __int64 v22; // x0 __int64 v23; // x1 GJSmartBlockPreview *v24; // x22 __int64 v25; // x24 char v26; // w0 __int64 v27; // x0 __int64 v28; // x1 char v29; // w0 __int64 v30; // x0 __int64 v31; // x1 __int64 v32; // x1 void *v33; // x0 __int64 v34; // x0 unsigned int v35; // w26 cocos2d::CCObject *v36; // x24 void (__fastcall *v37)(cocos2d::CCObject *, __int64 *); // x22 int v38; // w3 const char *v39; // x6 __int64 v40; // x0 __int64 v41; // x24 const char *v42; // x6 __int64 v43; // x0 __int64 v44; // x23 const char *v45; // x6 __int64 v46; // x0 __int64 v47; // x21 const char *v48; // x6 __int64 v49; // x0 __int64 v50; // x20 cocos2d::CCNode *v51; // x22 void (__fastcall *v52)(__int64, __int64 *); // x22 void (__fastcall *v53)(__int64, __int64 *); // x22 void (__fastcall *v54)(__int64, __int64 *); // x22 void (__fastcall *v55)(__int64, __int64 *); // x21 char v57; // w0 char v58; // w0 __int64 v59; // x0 __int64 v60; // x1 unsigned __int8 v61; // [xsp+9Fh] [xbp+9Fh] int TotalChanceForPrefab; // [xsp+A8h] [xbp+A8h] int v63; // [xsp+ACh] [xbp+ACh] cocos2d::CCArray *Prefabs; // [xsp+B0h] [xbp+B0h] unsigned int v66; // [xsp+B8h] [xbp+B8h] __int64 v67; // [xsp+C0h] [xbp+C0h] BYREF __int64 v68; // [xsp+C8h] [xbp+C8h] BYREF __int64 v69; // [xsp+D0h] [xbp+D0h] BYREF _BYTE v70[8]; // [xsp+D8h] [xbp+D8h] BYREF __int64 v71; // [xsp+E0h] [xbp+E0h] BYREF __int64 v72; // [xsp+E8h] [xbp+E8h] BYREF __int64 v73; // [xsp+F0h] [xbp+F0h] void *v74; // [xsp+F8h] [xbp+F8h] __int64 v75; // [xsp+100h] [xbp+100h] BYREF __int64 v76; // [xsp+108h] [xbp+108h] void *v77; // [xsp+110h] [xbp+110h] v61 = FLAlertLayer::init((FLAlertLayer *)a1, 150); if ( !v61 ) return v61; v5 = (__int64 *)(a1 + 712); if ( a1 + 712 != a3 ) { if ( (*(_BYTE *)a3 & 1) != 0 ) { v6 = *(const void **)(a3 + 16); v7 = *(_QWORD *)(a3 + 8); } else { v6 = (const void *)(a3 + 1); v7 = *(_BYTE *)a3 >> 1; } std::string::assign((__int64 *)(a1 + 712), v6, v7); } v8 = (cocos2d::CCDirector *)BrowseSmartTemplateLayer::baseSetup((BrowseSmartTemplateLayer *)a1); v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v8); cocos2d::CCDirector::getWinSize(&v67, v9); if ( a2 ) { *(_QWORD *)(a1 + 664) = a2; cocos2d::CCObject::retain(a2); } v72 = 0; v73 = 0; v74 = nullptr; std::string::__init(&v72, "Help", 4u); v75 = 0; v76 = 0; v77 = nullptr; std::string::__init( &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.", 0x97u); v10 = InfoAlertButton::create((char *)&v72, (char *)&v75, 1.0); if ( (v75 & 1) == 0 ) { if ( (v72 & 1) == 0 ) goto LABEL_10; goto LABEL_48; } operator delete(v77); if ( (v72 & 1) != 0 ) LABEL_48: operator delete(v74); LABEL_10: (*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v10); v11 = *(cocos2d::CCNode **)(a1 + 552); v12 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v10 + 184LL); cocos2d::CCPoint::CCPoint( (cocos2d::CCPoint *)v70, (float)((float)(*(float *)&v67 * 0.5) + 225.0) - 18.0, (float)((float)(*((float *)&v67 + 1) * 0.5) + 140.0) - 18.0); cocos2d::CCNode::convertToNodeSpace(&v71, v11, (const cocos2d::CCPoint *)v70); v12(v10, &v71); if ( *(_QWORD *)(a1 + 664) ) { v13 = *(cocos2d::CCNode **)(a1 + 552); cocos2d::CCPoint::CCPoint( (cocos2d::CCPoint *)&v71, *(float *)&v67 * 0.5, (float)((float)(*((float *)&v67 + 1) * 0.5) + 140.0) - 50.0); cocos2d::CCNode::convertToNodeSpace(&v68, v13, (const cocos2d::CCPoint *)&v71); v75 = 0; v14 = *(_BYTE *)(a1 + 712); v76 = 0; v77 = nullptr; v15 = *(_QWORD *)(a1 + 664); if ( (v14 & 1) != 0 ) { std::string::__init(&v75, *(void **)(a1 + 728), *(_QWORD *)(a1 + 720)); } else { v77 = *(void **)(a1 + 728); v16 = *(_QWORD *)(a1 + 720); v75 = *v5; v76 = v16; } Prefabs = (cocos2d::CCArray *)GJSmartTemplate::getPrefabs(v15, (__int64)&v75); if ( (v75 & 1) != 0 ) { operator delete(v77); v75 = 0; v57 = *(_BYTE *)(a1 + 712); v76 = 0; v77 = nullptr; v18 = *(_QWORD *)(a1 + 664); if ( (v57 & 1) == 0 ) goto LABEL_15; } else { v17 = *(_BYTE *)(a1 + 712); v75 = 0; v76 = 0; v77 = nullptr; v18 = *(_QWORD *)(a1 + 664); if ( (v17 & 1) == 0 ) { LABEL_15: v77 = *(void **)(a1 + 728); v19 = *(_QWORD *)(a1 + 720); v75 = *v5; v76 = v19; goto LABEL_16; } } std::string::__init(&v75, *(void **)(a1 + 728), *(_QWORD *)(a1 + 720)); LABEL_16: TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab(v18, (char *)&v75); if ( (v75 & 1) != 0 ) operator delete(v77); if ( Prefabs ) { v63 = cocos2d::CCArray::count(Prefabs); if ( v63 < 0 ) { LABEL_41: BrowseSmartTemplateLayer::goToPage((BrowseSmartTemplateLayer *)a1, 0); v40 = ButtonSprite::create( (ButtonSprite *)"Create", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_01.png", v39, 30.0); v41 = CCMenuItemSpriteExtra::create(v40, 0, a1, (__int64)BrowseSmartKeyLayer::onButton, 0); (*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v41 + 72LL))(v41, 1); (*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v41); v43 = ButtonSprite::create( (ButtonSprite *)"Delete", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_05.png", v42, 30.0); v44 = CCMenuItemSpriteExtra::create(v43, 0, a1, (__int64)BrowseSmartKeyLayer::onButton, 0); (*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v44 + 72LL))(v44, 2); (*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v44); v46 = ButtonSprite::create( (ButtonSprite *)"Zero", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_02.png", v45, 30.0); v47 = CCMenuItemSpriteExtra::create(v46, 0, a1, (__int64)BrowseSmartKeyLayer::onButton, 0); (*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v47 + 72LL))(v47, 3); (*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v47); v49 = ButtonSprite::create( (ButtonSprite *)"Add", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_02.png", v48, 30.0); v50 = CCMenuItemSpriteExtra::create(v49, 0, a1, (__int64)BrowseSmartKeyLayer::onButton, 0); (*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v50 + 72LL))(v50, 4); (*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 552) + 456LL))(*(_QWORD *)(a1 + 552), v50); v51 = *(cocos2d::CCNode **)(a1 + 552); cocos2d::CCPoint::CCPoint( (cocos2d::CCPoint *)&v71, *(float *)&v67 * 0.5, (float)((float)(*((float *)&v67 + 1) * 0.5) + -140.0) + 24.0); cocos2d::CCNode::convertToNodeSpace(&v69, v51, (const cocos2d::CCPoint *)&v71); v52 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v41 + 184LL); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, -100.0, 0.0); cocos2d::CCPoint::operator+(&v71, &v69); v52(v41, &v71); v53 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v44 + 184LL); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, -50.0, 0.0); cocos2d::CCPoint::operator+(&v71, &v69); v53(v44, &v71); v54 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v47 + 184LL); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, 50.0, 0.0); cocos2d::CCPoint::operator+(&v71, &v69); v54(v47, &v71); v55 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v50 + 184LL); cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, 100.0, 0.0); cocos2d::CCPoint::operator+(&v71, &v69); v55(v50, &v71); return v61; } } else { v63 = 0; } v20 = 0; do { v21 = *(_BYTE *)v5; v75 = 0; v76 = 0; v77 = nullptr; if ( (v21 & 1) != 0 ) { std::string::__init(&v75, *(void **)(a1 + 728), *(_QWORD *)(a1 + 720)); } else { v22 = *v5; v23 = *(_QWORD *)(a1 + 720); v77 = *(void **)(a1 + 728); v75 = v22; v76 = v23; } v24 = (GJSmartBlockPreview *)GJSmartBlockPreview::create((char *)&v75); if ( (v75 & 1) != 0 ) operator delete(v77); if ( v20 ) { v25 = cocos2d::CCArray::objectAtIndex(Prefabs, v20 - 1); v26 = *(_BYTE *)v5; v75 = 0; v76 = 0; v77 = nullptr; if ( (v26 & 1) != 0 ) { std::string::__init(&v75, *(void **)(a1 + 728), *(_QWORD *)(a1 + 720)); } else { v27 = *v5; v28 = *(_QWORD *)(a1 + 720); v77 = *(void **)(a1 + 728); v75 = v27; v76 = v28; } GJSmartBlockPreview::addTemplateGuide((__int64)v24, (char *)&v75, 1); if ( (v75 & 1) != 0 ) operator delete(v77); v29 = *(_BYTE *)v5; v72 = 0; v73 = 0; v74 = nullptr; if ( (v29 & 1) != 0 ) { std::string::__init(&v72, *(void **)(a1 + 728), *(_QWORD *)(a1 + 720)); } else { v30 = *v5; v31 = *(_QWORD *)(a1 + 720); v74 = *(void **)(a1 + 728); v72 = v30; v73 = v31; } v75 = 0; v76 = 0; v77 = nullptr; if ( (*(_BYTE *)(v25 + 80) & 1) != 0 ) { v33 = (void *)std::string::__init(&v75, *(void **)(v25 + 96), *(_QWORD *)(v25 + 88)); } else { v32 = *(_QWORD *)(v25 + 88); v75 = *(_QWORD *)(v25 + 80); v76 = v32; v33 = *(void **)(v25 + 96); v77 = v33; } v34 = GameManager::sharedState((GameManager *)v33); GJSmartBlockPreview::addPreview( (__int64)v24, (unsigned __int8 *)&v72, (unsigned __int8 *)&v75, *(LevelEditorLayer **)(v34 + 552)); if ( (v75 & 1) != 0 ) operator delete(v77); if ( (v72 & 1) != 0 ) operator delete(v74); v35 = *(_DWORD *)(v25 + 104); if ( TotalChanceForPrefab > 0 ) GJSmartBlockPreview::addChance(v24, *(_DWORD *)(v25 + 108), (const char *)(unsigned int)TotalChanceForPrefab); } else { v58 = *(_BYTE *)v5; v75 = 0; v76 = 0; v77 = nullptr; if ( (v58 & 1) != 0 ) { std::string::__init(&v75, *(void **)(a1 + 728), *(_QWORD *)(a1 + 720)); } else { v59 = *v5; v60 = *(_QWORD *)(a1 + 720); v77 = *(void **)(a1 + 728); v75 = v59; v76 = v60; } GJSmartBlockPreview::addTemplateGuide((__int64)v24, (char *)&v75, 2); v35 = 0; if ( (v75 & 1) != 0 ) operator delete(v77); } (*(void (__fastcall **)(GJSmartBlockPreview *, float))(*(_QWORD *)v24 + 160LL))(v24, 0.5); v36 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create( (__int64)v24, 0, a1, (__int64)BrowseSmartKeyLayer::onPrefabObject, 0); (*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 456LL))( *(_QWORD *)(a1 + 552), v36); (*(void (__fastcall **)(GJSmartBlockPreview *, _QWORD))(*(_QWORD *)v24 + 72LL))(v24, v35); (*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)v36 + 72LL))(v36, v35); v37 = *(void (__fastcall **)(cocos2d::CCObject *, __int64 *))(*(_QWORD *)v36 + 184LL); v66 = vcvtms_s32_f32((float)(v20 / 28)); v38 = v20 - 28 * v66; ++v20; cocos2d::CCPoint::CCPoint( (cocos2d::CCPoint *)v70, (float)((float)((float)(v38 % 7) * 60.0) + -210.0) + 30.0, floorf((float)(v38 / 7)) * -60.0); cocos2d::CCPoint::operator+(&v71, &v68); v37(v36, &v71); BrowseSmartTemplateLayer::addObjectToPage((cocos2d::CCArray **)a1, v36, v66); } while ( v63 >= v20 ); goto LABEL_41; } return v61; }