// // BrowseSmartKeyLayer::init from 0x53f204 to 0x53f79c (1432 bytes) // // 1 xrefs: // > BrowseSmartKeyLayer::create @ 0x53f86e // // 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 // int __fastcall BrowseSmartKeyLayer::init(BrowseSmartTemplateLayer *a1, cocos2d::CCObject *a2, int a3) { cocos2d::CCDirector *v6; // r0 CCMenuItemSpriteExtra *v7; // r7 cocos2d::CCNode *m_buttonMenu; // r10 void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9 cocos2d::CCNode *v10; // r6 int m_template; // r6 cocos2d::CCArray *Prefabs; // r9 stl::StringData::Internal *v13; // r6 int v14; // r7 int v15; // r1 int v16; // r2 GJSmartBlockPreview *v17; // r6 int v18; // r10 SmartPrefabResult v19; // kr00_28 GameManager *v20; // r0 int v21; // r5 SmartPrefabResult v22; // kr24_28 CCMenuItemSpriteExtra *v23; // r10 int v24; // s18 int v25; // r5 void (__fastcall *v26)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r6 float v27; // s22 ButtonSprite *v28; // r0 CCMenuItemSpriteExtra *v29; // r10 ButtonSprite *v30; // r0 CCMenuItemSpriteExtra *v31; // r9 ButtonSprite *v32; // r0 CCMenuItemSpriteExtra *v33; // r8 ButtonSprite *v34; // r0 CCMenuItemSpriteExtra *v35; // r7 cocos2d::CCNode *v36; // r5 void (__fastcall *v37)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r11 void (__fastcall *v38)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r10 void (__fastcall *v39)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9 void (__fastcall *v40)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r8 stl::StringData::Internal *v42; // r3 stl::StringData::Internal *v43; // r3 int v44; // [sp+0h] [bp-7Ch] bool v45; // [sp+4h] [bp-78h] char *v46; // [sp+8h] [bp-74h] _BYTE v47[3]; // [sp+Ch] [bp-70h] char *v48; // [sp+10h] [bp-6Ch] float v49; // [sp+10h] [bp-6Ch] char *v50; // [sp+10h] [bp-6Ch] int v51; // [sp+14h] [bp-68h] signed int TotalChanceForPrefab; // [sp+18h] [bp-64h] cocos2d::CCSize v53; // [sp+24h] [bp-58h] BYREF cocos2d::CCPoint v54; // [sp+2Ch] [bp-50h] BYREF cocos2d::CCPoint v55; // [sp+34h] [bp-48h] BYREF cocos2d::CCPoint v56; // [sp+3Ch] [bp-40h] BYREF cocos2d::CCPoint v57; // [sp+44h] [bp-38h] BYREF void (*v58)(BrowseSmartKeyLayer *, cocos2d::CCObject *); // [sp+4Ch] [bp-30h] int v59; // [sp+50h] [bp-2Ch] void (*v60)(BrowseSmartKeyLayer *, cocos2d::CCObject *); // [sp+54h] [bp-28h] int v61; // [sp+58h] [bp-24h] void (*v62)(BrowseSmartKeyLayer *, cocos2d::CCObject *); // [sp+5Ch] [bp-20h] int v63; // [sp+60h] [bp-1Ch] cocos2d::CCPoint v64; // [sp+64h] [bp-18h] BYREF cocos2d::CCPoint v65; // [sp+6Ch] [bp-10h] BYREF v51 = FLAlertLayer::init(a1, (cocos2d::_ccColor4B)150); if ( v51 ) { sub_775D40(&a1[1], a3); BrowseSmartTemplateLayer::baseSetup(a1); v6 = cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::getWinSize(&v53, v6); if ( a2 ) { a1->m_template = (GJSmartTemplate *)a2; cocos2d::CCObject::retain(a2); } sub_776584((int)&v64, "Help"); sub_776584( (int)&v65, "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((int)&v64, (int)&v65, 1065353216); sub_774008(&v65); sub_774008(&v64); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v7); m_buttonMenu = a1->m_buttonMenu; setPosition = v7->setPosition; cocos2d::CCPoint::CCPoint( &v64, (float)((float)(v53.width * 0.5) + 225.0) - 18.0, (float)((float)(v53.height * 0.5) + 140.0) - 18.0); cocos2d::CCNode::convertToNodeSpace(&v65, m_buttonMenu, &v64); setPosition(v7, &v65); if ( a1->m_template ) { v10 = a1->m_buttonMenu; cocos2d::CCPoint::CCPoint(&v65, v53.width * 0.5, (float)((float)(v53.height * 0.5) + 140.0) - 50.0); cocos2d::CCNode::convertToNodeSpace(&v54, v10, &v65); m_template = (int)a1->m_template; sub_775C20(&v65); Prefabs = (cocos2d::CCArray *)GJSmartTemplate::getPrefabs(m_template, (const std::string *)&v65); sub_774008(&v65); v13 = (stl::StringData::Internal *)a1->m_template; sub_775C20(&v65); TotalChanceForPrefab = GJSmartTemplate::getTotalChanceForPrefab(v13, (stl::StringData::Internal *)&v65); sub_774008(&v65); if ( Prefabs ) v48 = (char *)cocos2d::CCArray::count(Prefabs); else v48 = nullptr; v14 = 0; while ( (int)v48 >= v14 ) { sub_775C20(&v65); v17 = (GJSmartBlockPreview *)GJSmartBlockPreview::create((int)&v65, v15, v16); sub_774008(&v65); if ( v14 <= 0 ) { sub_775C20(&v65); v22.m_smartPrefab = (GJSmartPrefab *)&v65; v22.m_binaryKey.m_data.m_data = (stl::StringData::Internal *)(&dword_0 + 2); v22.m_prefabKey.m_data.m_data = v43; v22.m_prefabCount = v44; v22.m_unrequired = v45; v22.m_rotation = (int)v46; v22.m_flipX = v47[0]; v22.m_flipY = v47[1]; v22.m_ignoreCorners = v47[2]; GJSmartBlockPreview::addTemplateGuide(v17, v22, *(float *)&v48); v21 = 0; sub_774008(&v65); } else { v18 = cocos2d::CCArray::objectAtIndex(Prefabs, v14 - 1); sub_775C20(&v65); v19.m_smartPrefab = (GJSmartPrefab *)&v65; v19.m_binaryKey.m_data.m_data = (stl::StringData::Internal *)(&dword_0 + 1); v19.m_prefabKey.m_data.m_data = v42; v19.m_prefabCount = v44; v19.m_unrequired = v45; v19.m_rotation = (int)v46; v19.m_flipX = v47[0]; v19.m_flipY = v47[1]; v19.m_ignoreCorners = v47[2]; GJSmartBlockPreview::addTemplateGuide(v17, v19, *(float *)&v48); sub_774008(&v65); sub_775C20(&v64); sub_775C20(&v65); v20 = GameManager::sharedState(); GJSmartBlockPreview::addPreview((cocos2d::CCArray *)v17, (int)&v64, &v65, v20->m_levelEditorLayer); sub_774008(&v65); sub_774008(&v64); v21 = *(_DWORD *)(v18 + 60); if ( TotalChanceForPrefab > 0 ) GJSmartBlockPreview::addChance(v17, *(_DWORD *)(v18 + 64), TotalChanceForPrefab); } ((void (__fastcall *)(GJSmartBlockPreview *, int))v17->setScale)(v17, 1056964608); v44 = 0; v58 = BrowseSmartKeyLayer::onPrefabObject; v59 = 0; v23 = CCMenuItemSpriteExtra::create( v17, nullptr, (cocos2d::SEL_MenuHandler)__PAIR64__(BrowseSmartKeyLayer::onPrefabObject, (unsigned int)a1)); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v23); v17->setTag(v17, v21); v23->setTag(v23, v21); v24 = (int)floorf((float)(v14 / 28)); v25 = v14 - 28 * v24; ++v14; v26 = v23->setPosition; v27 = floorf((float)(v25 / 7)); cocos2d::CCPoint::CCPoint(&v64, (float)((float)((float)(v25 % 7) * 60.0) - 210.0) + 30.0, v27 * -60.0); cocos2d::CCPoint::operator+(&v65, &v54, &v64); v26(v23, &v65); BrowseSmartTemplateLayer::addObjectToPage(a1, v23, v24); } BrowseSmartTemplateLayer::goToPage(a1, 0); v28 = ButtonSprite::create( (ButtonSprite *)"Create", (const char *)&dword_18 + 1, 0, 0.5, 1, "goldFont.fnt", "GJ_button_01.png", COERCE_CONST_CHAR_(30.0), *(float *)&v48); v60 = BrowseSmartKeyLayer::onButton; v61 = 0; v29 = CCMenuItemSpriteExtra::create( v28, nullptr, (cocos2d::SEL_MenuHandler)__PAIR64__(BrowseSmartKeyLayer::onButton, (unsigned int)a1)); v29->setTag(v29, 1); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v29); v30 = ButtonSprite::create( (ButtonSprite *)"Delete", (const char *)&dword_18 + 1, 0, 0.5, 1, "goldFont.fnt", "GJ_button_05.png", COERCE_CONST_CHAR_(30.0), v49); v62 = BrowseSmartKeyLayer::onButton; v63 = 0; v31 = CCMenuItemSpriteExtra::create( v30, nullptr, (cocos2d::SEL_MenuHandler)__PAIR64__(BrowseSmartKeyLayer::onButton, (unsigned int)a1)); v31->setTag(v31, 2); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v31); v32 = ButtonSprite::create( (ButtonSprite *)"Zero", (const char *)&dword_18 + 1, 0, 0.5, 1, "goldFont.fnt", "GJ_button_02.png", COERCE_CONST_CHAR_(30.0), COERCE_FLOAT("GJ_button_02.png")); LODWORD(v64.x) = BrowseSmartKeyLayer::onButton; v64.y = 0.0; v33 = CCMenuItemSpriteExtra::create( v32, nullptr, (cocos2d::SEL_MenuHandler)__PAIR64__(BrowseSmartKeyLayer::onButton, (unsigned int)a1)); v33->setTag(v33, 3); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v33); v34 = ButtonSprite::create( (ButtonSprite *)"Add", (const char *)&dword_18 + 1, 0, 0.5, 1, "goldFont.fnt", v50, COERCE_CONST_CHAR_(30.0), *(float *)&v50); LODWORD(v65.x) = BrowseSmartKeyLayer::onButton; v65.y = 0.0; v35 = CCMenuItemSpriteExtra::create( v34, nullptr, (cocos2d::SEL_MenuHandler)__PAIR64__(BrowseSmartKeyLayer::onButton, (unsigned int)a1)); v35->setTag(v35, 4); a1->m_buttonMenu->addChild(a1->m_buttonMenu, v35); v36 = a1->m_buttonMenu; cocos2d::CCPoint::CCPoint(&v57, v53.width * 0.5, (float)((float)(v53.height * 0.5) - 140.0) + 24.0); cocos2d::CCNode::convertToNodeSpace(&v55, v36, &v57); v37 = v29->setPosition; cocos2d::CCPoint::CCPoint(&v56, -100.0, 0.0); cocos2d::CCPoint::operator+(&v57, &v55, &v56); v37(v29, &v57); v38 = v31->setPosition; cocos2d::CCPoint::CCPoint(&v56, -50.0, 0.0); cocos2d::CCPoint::operator+(&v57, &v55, &v56); v38(v31, &v57); v39 = v33->setPosition; cocos2d::CCPoint::CCPoint(&v56, 50.0, 0.0); cocos2d::CCPoint::operator+(&v57, &v55, &v56); v39(v33, &v57); v40 = v35->setPosition; cocos2d::CCPoint::CCPoint(&v56, 100.0, 0.0); cocos2d::CCPoint::operator+(&v57, &v55, &v56); v40(v35, &v57); } } return v51; }