// // SetupSmartBlockLayer::init from 0x9dcd3c to 0x9ddb38 (3580 bytes) // // 2 xrefs: // > SetupSmartBlockLayer::create @ 0x9ddc70 // > @ 0x6e3d0 // // 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 SetupSmartBlockLayer::init(SetupSmartBlockLayer *a1, SmartGameObject *a2, cocos2d::CCArray *a3) { cocos2d::CCObject *v5; // x2 cocos2d::CCDirector *v6; // x0 cocos2d::CCNode *v7; // x23 void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x26 void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x26 cocos2d::CCLabelBMFont *v10; // x26 void (__fastcall *v11)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28 const char *v12; // x6 cocos2d::CCNode *v13; // x0 const char *v14; // x6 cocos2d::CCNode *v15; // x0 const char *v16; // x6 cocos2d::CCNode *v17; // x0 const char *v18; // x6 cocos2d::CCNode *v19; // x0 CCMenuItemSpriteExtra *v20; // x27 const char *v21; // x6 cocos2d::CCNode *v22; // x0 CCMenuItemSpriteExtra *v23; // x28 const char *v24; // x6 cocos2d::CCNode *v25; // x0 const char *v26; // x6 cocos2d::CCNode *v27; // x0 CCMenuItemSpriteExtra *v28; // x0 cocos2d::CCMenu *v29; // x0 cocos2d::CCLayer *m_mainLayer; // x3 cocos2d::CCMenu *m_buttonMenu; // x23 void (__fastcall *v32)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x24 cocos2d::CCNode *v33; // x23 void *v34; // x0 void *v35; // x0 cocos2d::CCMenu *v36; // x27 void (__fastcall *v37)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28 cocos2d::CCMenu *v38; // x2 void *v39; // x0 cocos2d::CCMenu *v40; // x2 void *v41; // x0 CCMenuItemToggler *v42; // x28 void *v43; // x0 cocos2d::CCMenu *v44; // x2 CCMenuItemToggler *v45; // x28 void *v46; // x0 cocos2d::CCMenu *v47; // x2 void *v48; // x0 cocos2d::CCMenu *v49; // x2 void *v50; // x0 cocos2d::CCMenu *v51; // x28 cocos2d::CCLayer *v52; // x22 void *v53; // x22 unsigned int *v55; // x20 int v56; // w0 unsigned int *v57; // x1 int v58; // w2 unsigned int *v59; // x1 int v60; // w2 unsigned int *v61; // x1 int v62; // w2 unsigned int *v63; // x1 int v64; // w2 unsigned int *v65; // x1 int v66; // w2 unsigned int *v67; // x1 int v68; // w2 unsigned int *v69; // x1 int v70; // w2 unsigned int *v71; // x1 int v72; // w2 cocos2d::CCMenu *v73[2]; // [xsp+30h] [xbp+0h] BYREF cocos2d::CCMenu *v74; // [xsp+A8h] [xbp+78h] cocos2d::CCMenuItem *v75; // [xsp+B0h] [xbp+80h] cocos2d::CCNode *v76; // [xsp+B8h] [xbp+88h] cocos2d::CCObject *v77; // [xsp+C0h] [xbp+90h] char v78; // [xsp+CFh] [xbp+9Fh] float v79; // [xsp+E0h] [xbp+B0h] float v80; // [xsp+E4h] [xbp+B4h] cocos2d::CCPoint v81; // [xsp+E8h] [xbp+B8h] BYREF cocos2d::CCPoint v82; // [xsp+F0h] [xbp+C0h] BYREF cocos2d::CCPoint v83; // [xsp+F8h] [xbp+C8h] BYREF cocos2d::CCPoint v84; // [xsp+100h] [xbp+D0h] BYREF cocos2d::CCRect v85; // [xsp+108h] [xbp+D8h] BYREF cocos2d::CCPoint v86; // 0:kr08_8.8 cocos2d::SEL_MenuHandler v87; // 0:x2.16 cocos2d::SEL_MenuHandler v88; // 0:x2.16 cocos2d::SEL_MenuHandler v89; // 0:x2.16 cocos2d::SEL_MenuHandler v90; // 0:x2.16 cocos2d::SEL_MenuHandler v91; // 0:x2.16 cocos2d::SEL_MenuHandler v92; // 0:x2.16 cocos2d::SEL_MenuHandler v93; // 0:x2.16 cocos2d::CCRect v94; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4 v77 = a3; v78 = FLAlertLayer::init(a1, 0x96u); if ( v78 ) { v5 = v77; if ( a2 ) { a1->m_gameObject = a2; cocos2d::CCObject::retain(a2); } else if ( v77 ) { a1->m_gameObjects = (cocos2d::CCArray *)v77; cocos2d::CCObject::retain(v5); } SetupSmartBlockLayer::determineStartValues(a1); a1->m_noElasticity = 1; v6 = cocos2d::CCDirector::sharedDirector(); cocos2d::CCDirector::getWinSize(v6); cocos2d::CCRect::CCRect(&v85, 0.0, 0.0, 80.0, 80.0); v7 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create( (cocos2d::extension::CCScale9Sprite *)"GJ_square01.png", (const char *)&v85, v94); setContentSize = v7->setContentSize; cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v85, 300.0, 240.0); setContentSize(v7, (const cocos2d::CCSize *)&v85); a1->m_mainLayer->addChild_0(a1->m_mainLayer, v7, -2); setPosition = v7->setPosition; cocos2d::CCPoint::CCPoint(&v85.origin, v79 * 0.5, v80 * 0.5); setPosition(v7, &v85.origin); v10 = cocos2d::CCLabelBMFont::create(); a1->addChild(a1, v10); v10->setScale(v10, 0.7); v11 = v10->setPosition; cocos2d::CCPoint::CCPoint(&v85.origin, v79 * 0.5, (float)((float)(v80 * 0.5) + 120.0) - 18.0); v11(v10, &v85.origin); v13 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Back", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_05.png", v12, 30.0); v87.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v87.adj = (size_t)SetupSmartBlockLayer::onClose; v74 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(v13, nullptr, v87); v15 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Create", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_01.png", v14, 30.0); v88.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v88.adj = (size_t)SetupSmartBlockLayer::onCreate; v75 = CCMenuItemSpriteExtra::create(v15, nullptr, v88); v17 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Template", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_02.png", v16, 30.0); v89.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v89.adj = (size_t)SetupSmartBlockLayer::onCreateTemplate; v76 = CCMenuItemSpriteExtra::create(v17, nullptr, v89); v19 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Special", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_02.png", v18, 30.0); v90.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v90.adj = (size_t)SetupSmartBlockLayer::onSelectPremade; v20 = CCMenuItemSpriteExtra::create(v19, nullptr, v90); v22 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Browser", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_01.png", v21, 30.0); v91.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v91.adj = (size_t)SetupSmartBlockLayer::onSelectTemplate; v23 = CCMenuItemSpriteExtra::create(v22, nullptr, v91); v25 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Paste\nTemplate", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_01.png", v24, 30.0); v92.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v92.adj = (size_t)SetupSmartBlockLayer::onPasteTemplate; v77 = CCMenuItemSpriteExtra::create(v25, nullptr, v92); v27 = (cocos2d::CCNode *)ButtonSprite::create( (ButtonSprite *)"Create\nAll", (const char *)&off_18 + 1, 0, 1, 0.5, "goldFont.fnt", "GJ_button_01.png", v26, 30.0); v93.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1; v93.adj = (size_t)SetupSmartBlockLayer::onCreateAll; v28 = CCMenuItemSpriteExtra::create(v27, nullptr, v93); v29 = (cocos2d::CCMenu *)cocos2d::CCMenu::create(v74, v75, v76, v20, v23, v28, v77, 0); m_mainLayer = a1->m_mainLayer; a1->m_buttonMenu = v29; m_mainLayer->addChild_0(m_mainLayer, v29, 10); cocos2d::CCMenu::alignItemsHorizontally(a1->m_buttonMenu); m_buttonMenu = a1->m_buttonMenu; v32 = m_buttonMenu->setPosition; cocos2d::CCPoint::CCPoint(&v85.origin, v79 * 0.5, (float)((float)(v80 * 0.5) + -120.0) + 24.0); v32(m_buttonMenu, &v85.origin); sub_D153B8((unsigned int)v73 + 208, "Help"); sub_D153B8( (unsigned int)v73 + 216, "Auto-builds structures with given templates.\n" "Use Browser to start and select templates.\n" "Click Template with a template made to save it.\n" "Create structures with these blocks and click Create to paste the selected template.\n" "Reference Only blocks are used as reference positions.\n" "Allow Rotation, Flip X, and Flip Y allow rotating the design.\n" "Dont Delete keeps these blocks when template is pasted.\n" "The tool is in beta and will be enhanced in future updates."); v33 = (cocos2d::CCNode *)InfoAlertButton::create(1.0); v34 = (void *)(*(_QWORD *)&v85.origin - 24LL); if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v71 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL); do v72 = __ldaxr(v71); while ( __stlxr(v72 - 1, v71) ); } else { v72 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL); *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v72 - 1; } if ( v72 <= 0 ) operator delete(v34); } v35 = (void *)(*(_QWORD *)&v84 - 24LL); if ( (__int64 *)(*(_QWORD *)&v84 - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v69 = (unsigned int *)(*(_QWORD *)&v84 - 8LL); do v70 = __ldaxr(v69); while ( __stlxr(v70 - 1, v69) ); } else { v70 = *(_DWORD *)(*(_QWORD *)&v84 - 8LL); *(_DWORD *)(*(_QWORD *)&v84 - 8LL) = v70 - 1; } if ( v70 <= 0 ) operator delete(v35); } a1->m_buttonMenu->addChild(a1->m_buttonMenu, v33); v36 = a1->m_buttonMenu; v37 = v33->setPosition; cocos2d::CCPoint::CCPoint( &v84, (float)((float)(v79 * 0.5) + -150.0) + 18.0, (float)((float)(v80 * 0.5) + 120.0) - 18.0); v86 = cocos2d::CCNode::convertToNodeSpace(v36, &v84); ((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *, float, float))v37)(v33, &v85, v86.x, v86.y); cocos2d::CCPoint::CCPoint(&v81, (float)(v79 * 0.5) + -60.0, (float)(v80 * 0.5) + 70.0); sub_D153B8((unsigned int)v73 + 216, "Reference Only"); v38 = a1->m_buttonMenu; LODWORD(v77) = a1->m_referenceOnly; v76 = v38; cocos2d::CCPoint::CCPoint(&v82, 0.0, -0.0); cocos2d::CCPoint::operator+(&v83, &v81, &v82); v75 = (cocos2d::CCMenuItem *)a1->m_mainLayer; cocos2d::CCPoint::CCPoint(&v84, 8.0, 0.0); GameToolbox::createToggleButton( 0.6, 0.35, 0.0, (__int64)&v85, (void (__cdecl *)(cocos2d::CCObject *))SetupSmartBlockLayer::onReferenceOnly, 0, (bool)v77, v76, &v83, a1, v75, (float *)&v84, (__int64)"bigFont.fnt", 0, 0, nullptr); v39 = (void *)(*(_QWORD *)&v85.origin - 24LL); if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v67 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL); do v68 = __ldaxr(v67); while ( __stlxr(v68 - 1, v67) ); } else { v68 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL); *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v68 - 1; } if ( v68 <= 0 ) operator delete(v39); } sub_D153B8((unsigned int)v73 + 216, "Allow Rotation"); v40 = a1->m_buttonMenu; LODWORD(v77) = a1->m_allowRotation; v76 = v40; cocos2d::CCPoint::CCPoint(&v82, 0.0, -22.0); cocos2d::CCPoint::operator+(&v83, &v81, &v82); v75 = (cocos2d::CCMenuItem *)a1->m_mainLayer; cocos2d::CCPoint::CCPoint(&v84, 8.0, 0.0); GameToolbox::createToggleButton( 0.6, 0.35, 0.0, (__int64)&v85, (void (__cdecl *)(cocos2d::CCObject *))SetupSmartBlockLayer::onAllowRotation, 0, (bool)v77, v76, &v83, a1, v75, (float *)&v84, (__int64)"bigFont.fnt", 0, 0, nullptr); v41 = (void *)(*(_QWORD *)&v85.origin - 24LL); if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v65 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL); do v66 = __ldaxr(v65); while ( __stlxr(v66 - 1, v65) ); } else { v66 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL); *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v66 - 1; } if ( v66 <= 0 ) operator delete(v41); } sub_D153B8((unsigned int)v73 + 216, "Allow Flip X"); LODWORD(v77) = a1->m_allowFlipX; v76 = a1->m_buttonMenu; cocos2d::CCPoint::CCPoint(&v82, 0.0, -44.0); cocos2d::CCPoint::operator+(&v83, &v81, &v82); v75 = (cocos2d::CCMenuItem *)a1->m_mainLayer; cocos2d::CCPoint::CCPoint(&v84, 8.0, 0.0); v42 = GameToolbox::createToggleButton( 0.6, 0.35, 0.0, (__int64)&v85, (void (__cdecl *)(cocos2d::CCObject *))SetupSmartBlockLayer::onAllowFlipping, 0, (bool)v77, v76, &v83, a1, v75, (float *)&v84, (__int64)"bigFont.fnt", 0, 0, nullptr); v43 = (void *)(*(_QWORD *)&v85.origin - 24LL); if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v63 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL); do v64 = __ldaxr(v63); while ( __stlxr(v64 - 1, v63) ); } else { v64 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL); *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v64 - 1; } if ( v64 <= 0 ) operator delete(v43); } v42->setTag(v42, 3); sub_D153B8((unsigned int)v73 + 216, "Allow Flip Y"); v44 = a1->m_buttonMenu; LODWORD(v77) = a1->m_allowFlipY; v76 = v44; cocos2d::CCPoint::CCPoint(&v82, 0.0, -66.0); cocos2d::CCPoint::operator+(&v83, &v81, &v82); v75 = (cocos2d::CCMenuItem *)a1->m_mainLayer; cocos2d::CCPoint::CCPoint(&v84, 8.0, 0.0); v45 = GameToolbox::createToggleButton( 0.6, 0.35, 0.0, (__int64)&v85, (void (__cdecl *)(cocos2d::CCObject *))SetupSmartBlockLayer::onAllowFlipping, 0, (bool)v77, v76, &v83, a1, v75, (float *)&v84, (__int64)"bigFont.fnt", 0, 0, nullptr); v46 = (void *)(*(_QWORD *)&v85.origin - 24LL); if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v61 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL); do v62 = __ldaxr(v61); while ( __stlxr(v62 - 1, v61) ); } else { v62 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL); *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v62 - 1; } if ( v62 <= 0 ) operator delete(v46); } v45->setTag(v45, 4); sub_D153B8((unsigned int)v73 + 216, "Ignore Corners"); v47 = a1->m_buttonMenu; LODWORD(v77) = a1->m_ignoreCorners; v76 = v47; cocos2d::CCPoint::CCPoint(&v82, 0.0, -88.0); cocos2d::CCPoint::operator+(&v83, &v81, &v82); v75 = (cocos2d::CCMenuItem *)a1->m_mainLayer; cocos2d::CCPoint::CCPoint(&v84, 8.0, 0.0); GameToolbox::createToggleButton( 0.6, 0.35, 0.0, (__int64)&v85, (void (__cdecl *)(cocos2d::CCObject *))SetupSmartBlockLayer::onIgnoreCorners, 0, (bool)v77, v76, &v83, a1, v75, (float *)&v84, (__int64)"bigFont.fnt", 0, 0, nullptr); v48 = (void *)(*(_QWORD *)&v85.origin - 24LL); if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v59 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL); do v60 = __ldaxr(v59); while ( __stlxr(v60 - 1, v59) ); } else { v60 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL); *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v60 - 1; } if ( v60 <= 0 ) operator delete(v48); } sub_D153B8((unsigned int)v73 + 216, "Use nearby as reference"); v49 = a1->m_buttonMenu; LODWORD(v77) = a1->m_useNearby; v76 = v49; cocos2d::CCPoint::CCPoint(&v82, 0.0, -110.0); cocos2d::CCPoint::operator+(&v83, &v81, &v82); v75 = (cocos2d::CCMenuItem *)a1->m_mainLayer; cocos2d::CCPoint::CCPoint(&v84, 8.0, 0.0); GameToolbox::createToggleButton( 0.6, 0.35, 0.0, (__int64)&v85, (void (__cdecl *)(cocos2d::CCObject *))SetupSmartBlockLayer::onNearbyReference, 0, (bool)v77, v76, &v83, a1, v75, (float *)&v84, (__int64)"bigFont.fnt", 0, 0, nullptr); v50 = (void *)(*(_QWORD *)&v85.origin - 24LL); if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v57 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL); do v58 = __ldaxr(v57); while ( __stlxr(v58 - 1, v57) ); } else { v58 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL); *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v58 - 1; } if ( v58 <= 0 ) operator delete(v50); } sub_D153B8((unsigned int)v73 + 216, "Dont delete"); v51 = a1->m_buttonMenu; LODWORD(v77) = a1->m_dontDelete; cocos2d::CCPoint::CCPoint(&v82, 0.0, -132.0); cocos2d::CCPoint::operator+(&v83, &v81, &v82); v52 = a1->m_mainLayer; cocos2d::CCPoint::CCPoint(&v84, 8.0, 0.0); GameToolbox::createToggleButton( 0.6, 0.35, 0.0, (__int64)&v85, (void (__cdecl *)(cocos2d::CCObject *))SetupSmartBlockLayer::onDontDelete, 0, (bool)v77, v51, &v83, a1, v52, (float *)&v84, (__int64)"bigFont.fnt", 0, 0, nullptr); v53 = (void *)(*(_QWORD *)&v85.origin - 24LL); if ( (__int64 *)(*(_QWORD *)&v85.origin - 24LL) != &qword_124B6B0 ) { if ( &pthread_create ) { v55 = (unsigned int *)(*(_QWORD *)&v85.origin - 8LL); do v56 = __ldaxr(v55); while ( __stlxr(v56 - 1, v55) ); } else { v56 = *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL); *(_DWORD *)(*(_QWORD *)&v85.origin - 8LL) = v56 - 1; } if ( v56 <= 0 ) operator delete(v53); } a1->m_joystickConnected = -1; } return v78; }
GD Web Decomp Icon

GD Web Decomp

Raw Source