//
// BrowseSmartKeyLayer::init from 0x674bd4 to 0x675180 (1452 bytes)
//
// 1 xrefs:
// > BrowseSmartKeyLayer::create @ 0x67525a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:55:55 +0000
//
GameManager *__fastcall BrowseSmartKeyLayer::init(int a1, cocos2d::CCObject *a2, unsigned __int8 *a3)
{
cocos2d::CCDirector *v6; // r0
int v7; // r7
const cocos2d::CCPoint *v8; // r10
void (__fastcall *v9)(int, _DWORD *); // r9
const cocos2d::CCPoint *v10; // r7
int v11; // r6
cocos2d::CCArray *Prefabs; // r9
int v13; // r6
int v14; // r2
int v15; // r3
int v16; // r7
unsigned __int8 *v17; // r6
int v18; // r10
int *v19; // r0
int v20; // r0
int v21; // r5
cocos2d::CCObject *v22; // r10
unsigned int v23; // s18
signed int v24; // r5
void (__fastcall *v25)(cocos2d::CCObject *, _DWORD *); // r6
float v26; // s22
ButtonSprite *v27; // r0
int v28; // r10
ButtonSprite *v29; // r0
int v30; // r9
ButtonSprite *v31; // r0
int v32; // r8
ButtonSprite *v33; // r0
int v34; // r7
const cocos2d::CCPoint *v35; // r5
void (__fastcall *v36)(int, _BYTE *); // r11
void (__fastcall *v37)(int, _BYTE *); // r10
void (__fastcall *v38)(int, _BYTE *); // r9
void (__fastcall *v39)(int, _BYTE *); // r8
char *v41; // [sp+10h] [bp-84h]
float v42; // [sp+10h] [bp-84h]
char *v43; // [sp+10h] [bp-84h]
GameManager *v44; // [sp+14h] [bp-80h]
const char *TotalChanceForPrefab; // [sp+18h] [bp-7Ch]
float v46; // [sp+24h] [bp-70h] BYREF
float v47; // [sp+28h] [bp-6Ch]
_BYTE v48[8]; // [sp+2Ch] [bp-68h] BYREF
_BYTE v49[8]; // [sp+34h] [bp-60h] BYREF
_BYTE v50[8]; // [sp+3Ch] [bp-58h] BYREF
_BYTE v51[8]; // [sp+44h] [bp-50h] BYREF
int (__fastcall *v52)(BrowseSmartKeyLayer *, cocos2d::CCObject *); // [sp+4Ch] [bp-48h]
int v53; // [sp+50h] [bp-44h]
int (__fastcall *v54)(cocos2d::CCArray **, cocos2d::CCObject *); // [sp+54h] [bp-40h]
int v55; // [sp+58h] [bp-3Ch]
int (__fastcall *v56)(cocos2d::CCArray **, cocos2d::CCObject *); // [sp+5Ch] [bp-38h]
int v57; // [sp+60h] [bp-34h]
_DWORD v58[2]; // [sp+64h] [bp-30h] BYREF
_DWORD v59[2]; // [sp+6Ch] [bp-28h] BYREF
int v60[3]; // [sp+74h] [bp-20h] BYREF
int v61[3]; // [sp+80h] [bp-14h] BYREF
v44 = FLAlertLayer::init((FLAlertLayer *)a1, 150);
if ( v44 )
{
std::string::operator=((unsigned __int8 *)(a1 + 544), a3);
v6 = (cocos2d::CCDirector *)BrowseSmartTemplateLayer::baseSetup((const cocos2d::CCPoint **)a1);
cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v46);
if ( a2 )
{
*(_DWORD *)(a1 + 520) = a2;
cocos2d::CCObject::retain(a2);
}
memset(v60, 0, sizeof(v60));
std::string::__init(v60, "Help", 4u);
memset(v61, 0, sizeof(v61));
std::string::__init(
v61,
"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);
v7 = InfoAlertButton::create((char *)v60, (int)v61, 1065353216);
std::string::~string((int)v61);
std::string::~string((int)v60);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v7);
v8 = *(const cocos2d::CCPoint **)(a1 + 444);
v9 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v7 + 92);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v58,
(float)((float)(v46 * 0.5) + 225.0) - 18.0,
(float)((float)(v47 * 0.5) + 140.0) - 18.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v59, v8);
v9(v7, v59);
if ( *(_DWORD *)(a1 + 520) )
{
v10 = *(const cocos2d::CCPoint **)(a1 + 444);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, v46 * 0.5, (float)((float)(v47 * 0.5) + 140.0) - 50.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v48, v10);
v11 = *(_DWORD *)(a1 + 520);
std::string::basic_string(v61, a1 + 544);
Prefabs = (cocos2d::CCArray *)GJSmartTemplate::getPrefabs(v11, (int)v61);
std::string::~string((int)v61);
v13 = *(_DWORD *)(a1 + 520);
std::string::basic_string(v61, a1 + 544);
TotalChanceForPrefab = (const char *)GJSmartTemplate::getTotalChanceForPrefab(v13, (int)v61, v14, v15);
std::string::~string((int)v61);
if ( Prefabs )
v41 = (char *)cocos2d::CCArray::count(Prefabs);
else
v41 = nullptr;
v16 = 0;
while ( (int)v41 >= v16 )
{
std::string::basic_string(v61, a1 + 544);
v17 = (unsigned __int8 *)GJSmartBlockPreview::create((int)v61);
std::string::~string((int)v61);
if ( v16 <= 0 )
{
std::string::basic_string(v61, a1 + 544);
GJSmartBlockPreview::addTemplateGuide(v17, (unsigned __int8 *)v61, 2);
v21 = 0;
std::string::~string((int)v61);
}
else
{
v18 = cocos2d::CCArray::objectAtIndex(Prefabs, v16 - 1);
std::string::basic_string(v61, a1 + 544);
GJSmartBlockPreview::addTemplateGuide(v17, (unsigned __int8 *)v61, 1);
std::string::~string((int)v61);
std::string::basic_string(v60, a1 + 544);
v19 = std::string::basic_string(v61, v18 + 64);
v20 = GameManager::sharedState((GameManager *)v19);
GJSmartBlockPreview::addPreview(
(cocos2d::CCArray *)v17,
(unsigned __int8 *)v60,
(unsigned __int8 *)v61,
*(LevelEditorLayer **)(v20 + 408));
std::string::~string((int)v61);
std::string::~string((int)v60);
v21 = *(_DWORD *)(v18 + 76);
if ( (int)TotalChanceForPrefab > 0 )
GJSmartBlockPreview::addChance((GJSmartBlockPreview *)v17, *(const char **)(v18 + 80), TotalChanceForPrefab);
}
(*(void (__fastcall **)(unsigned __int8 *, int))(*(_DWORD *)v17 + 80))(v17, 1056964608);
v52 = BrowseSmartKeyLayer::onPrefabObject;
v53 = 0;
v22 = (cocos2d::CCObject *)CCMenuItemSpriteExtra::create(
(int)v17,
0,
a1,
(int)BrowseSmartKeyLayer::onPrefabObject,
0);
(*(void (__fastcall **)(_DWORD, cocos2d::CCObject *))(**(_DWORD **)(a1 + 444) + 228))(
*(_DWORD *)(a1 + 444),
v22);
(*(void (__fastcall **)(unsigned __int8 *, int))(*(_DWORD *)v17 + 36))(v17, v21);
(*(void (__fastcall **)(cocos2d::CCObject *, int))(*(_DWORD *)v22 + 36))(v22, v21);
v23 = (int)floorf((float)(v16 / 28));
v24 = v16 - 28 * v23;
++v16;
v25 = *(void (__fastcall **)(cocos2d::CCObject *, _DWORD *))(*(_DWORD *)v22 + 92);
v26 = floorf((float)(v24 / 7));
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v58,
(float)((float)((float)(v24 % 7) * 60.0) - 210.0) + 30.0,
v26 * -60.0);
cocos2d::CCPoint::operator+(v59, v48, v58);
v25(v22, v59);
BrowseSmartTemplateLayer::addObjectToPage((cocos2d::CCArray **)a1, v22, v23);
}
BrowseSmartTemplateLayer::goToPage((BrowseSmartTemplateLayer *)a1, 0);
v27 = 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 *)&v41);
v54 = BrowseSmartKeyLayer::onButton;
v55 = 0;
v28 = CCMenuItemSpriteExtra::create((int)v27, 0, a1, (int)BrowseSmartKeyLayer::onButton, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v28 + 36))(v28, 1);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v28);
v29 = ButtonSprite::create(
(ButtonSprite *)"Delete",
(const char *)&dword_18 + 1,
0,
0.5,
1,
"goldFont.fnt",
"GJ_button_05.png",
COERCE_CONST_CHAR_(30.0),
v42);
v56 = BrowseSmartKeyLayer::onButton;
v57 = 0;
v30 = CCMenuItemSpriteExtra::create((int)v29, 0, a1, (int)BrowseSmartKeyLayer::onButton, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v30 + 36))(v30, 2);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v30);
v31 = 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"));
v58[0] = BrowseSmartKeyLayer::onButton;
v58[1] = 0;
v32 = CCMenuItemSpriteExtra::create((int)v31, 0, a1, (int)BrowseSmartKeyLayer::onButton, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v32 + 36))(v32, 3);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v32);
v33 = ButtonSprite::create(
(ButtonSprite *)"Add",
(const char *)&dword_18 + 1,
0,
0.5,
1,
"goldFont.fnt",
v43,
COERCE_CONST_CHAR_(30.0),
*(float *)&v43);
v59[0] = BrowseSmartKeyLayer::onButton;
v59[1] = 0;
v34 = CCMenuItemSpriteExtra::create((int)v33, 0, a1, (int)BrowseSmartKeyLayer::onButton, 0);
(*(void (__fastcall **)(int, int))(*(_DWORD *)v34 + 36))(v34, 4);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v34);
v35 = *(const cocos2d::CCPoint **)(a1 + 444);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, v46 * 0.5, (float)((float)(v47 * 0.5) - 140.0) + 24.0);
cocos2d::CCNode::convertToNodeSpace((cocos2d::CCNode *)v49, v35);
v36 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v28 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, -100.0, 0.0);
cocos2d::CCPoint::operator+(v51, v49, v50);
v36(v28, v51);
v37 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v30 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, -50.0, 0.0);
cocos2d::CCPoint::operator+(v51, v49, v50);
v37(v30, v51);
v38 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v32 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, 50.0, 0.0);
cocos2d::CCPoint::operator+(v51, v49, v50);
v38(v32, v51);
v39 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v34 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, 100.0, 0.0);
cocos2d::CCPoint::operator+(v51, v49, v50);
v39(v34, v51);
}
}
return v44;
}