//
// PlayLayer::addObject from 0x6f4170 to 0x6f4cc4 (2900 bytes)
//
// 6 xrefs:
// > PlayLayer::addObject @ 0x6f4ab4
// > PlayLayer::addLiveStartPosObject @ 0x700518
// > PlayLayer::setupHasCompleted @ 0x7081f0
// > PlayLayer::processCreateObjectsFromSetup @ 0x708a14
// > PlayLayer::processCreateObjectsFromSetup @ 0x708be0
// > ??> @ 0xdacc8
//
// 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 12:51:50 +0000
//
__int64 __fastcall PlayLayer::addObject(PlayLayer *this, GameObject *a2)
{
int v4; // w0
int v5; // w1
int v6; // w0
int v8; // w24
const char *v9; // x1
char *v10; // x0
__int64 v11; // x0
__int64 v12; // x2
__int64 v13; // x22
void (__fastcall *v14)(__int64, __int64 *); // x26
const cocos2d::CCPoint *v15; // x0
void (__fastcall *v16)(__int64, _QWORD); // x23
unsigned int v17; // w0
void (__fastcall *v18)(__int64, _QWORD); // x23
unsigned int v19; // w0
void (__fastcall *v20)(__int64); // x23
void (__fastcall *v21)(__int64); // x23
_BYTE *v22; // x0
char v23; // w2
char v24; // w1
GameObject *BallFrame; // x0
const char *v26; // x1
__int64 v27; // x0
__int64 v28; // x1
GameObject *v29; // x22
int v30; // w1
void (__fastcall *v31)(GameObject *, __int64 *); // x24
const cocos2d::CCPoint *v32; // x0
__int64 v33; // x0
cocos2d::CCNode *v34; // x1
float v35; // s0
bool v36; // w2
_DWORD *v37; // x0
_DWORD *v38; // x22
void (__fastcall *v39)(_DWORD *, __int64 *); // x24
__int64 v40; // x2
void (__fastcall *v41)(_DWORD *, _QWORD); // x24
unsigned __int8 v42; // w0
float v43; // s8
_BYTE *v44; // x0
char v45; // w2
char v46; // w1
__int64 v47; // [xsp+68h] [xbp+68h] BYREF
__int64 v48; // [xsp+70h] [xbp+70h] BYREF
if ( !a2 )
return _stack_chk_guard;
if ( (*(unsigned int (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1800LL))(a2) == 25 )
GameObject::determineSlopeDirection(a2);
else
GameObject::updateIsOriented(a2);
(*(void (__fastcall **)(GameObject *, _QWORD))(*(_QWORD *)a2 + 344LL))(a2, 0);
(*(void (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1816LL))(a2);
if ( *(float *)&v48 > *((float *)this + 3580) )
{
(*(void (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1816LL))(a2);
*((_DWORD *)this + 3580) = v48;
}
if ( (unsigned __int8)GameObject::isSettingsObject(a2) )
{
v4 = *((_DWORD *)a2 + 257);
}
else if ( (*(unsigned int (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1800LL))(a2) != 20
|| *((_DWORD *)a2 + 312) == 1 && *((_BYTE *)a2 + 1472)
|| (v4 = *((_DWORD *)a2 + 257), v4 == 2063) )
{
(*(void (__fastcall **)(PlayLayer *, GameObject *))(*(_QWORD *)this + 1344LL))(this, a2);
if ( *((_DWORD *)a2 + 257) != 3663 )
goto LABEL_9;
goto LABEL_45;
}
*((_DWORD *)a2 + 157) = -1;
if ( v4 != 3663 )
goto LABEL_9;
LABEL_45:
*((_BYTE *)this + 14576) = 1;
LABEL_9:
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 410), a2);
GJBaseGameLayer::addToGroups(this, a2, 1);
if ( *((_DWORD *)a2 + 257) == 1615 )
{
GJBaseGameLayer::addObjectCounter(this, a2);
}
else if ( (*(unsigned int (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1800LL))(a2) == 30
|| (*(unsigned int (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1800LL))(a2) == 31 )
{
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 1788), a2);
GameObject::getActiveColorForMode(a2, *((_DWORD *)a2 + 164), 1);
if ( !(unsigned __int8)GameObject::hasSecondaryColor(a2) )
goto LABEL_13;
goto LABEL_32;
}
GameObject::getActiveColorForMode(a2, *((_DWORD *)a2 + 164), 1);
if ( !(unsigned __int8)GameObject::hasSecondaryColor(a2) )
goto LABEL_13;
LABEL_32:
GameObject::getActiveColorForMode(a2, *((_DWORD *)a2 + 165), 0);
LABEL_13:
if ( *((_BYTE *)a2 + 1252)
&& *((_DWORD *)a2 + 312) == 1
&& (!*((_BYTE *)a2 + 1472) && !*((_BYTE *)a2 + 1473)
|| (*(unsigned __int8 (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1688LL))(a2)) )
{
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 413), a2);
}
if ( *((_BYTE *)this + 12238) )
*((_BYTE *)a2 + 708) = 0;
v6 = *((_DWORD *)a2 + 257);
if ( v6 == 747 )
{
v32 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 192LL))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v47, v32);
v33 = (*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 192LL))(a2);
v34 = *((cocos2d::CCNode **)this + 317);
*((float *)&v47 + 1) = *(float *)(v33 + 4) + *((float *)a2 + 465);
TeleportPortalObject::getTeleportXOff(a2, v34);
*(float *)&v47 = v35 + *(float *)&v47;
v37 = (_DWORD *)TeleportPortalObject::create((TeleportPortalObject *)"portal_16_front_001.png", nullptr, v36);
*((_QWORD *)a2 + 231) = v37;
v37[257] = 749;
v38 = v37;
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v37 + 1264LL))(v37);
v39 = *(void (__fastcall **)(_DWORD *, __int64 *))(*(_QWORD *)v38 + 1368LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v48, (const cocos2d::CCPoint *)&v47);
v39(v38, &v48);
*((_BYTE *)v38 + 1052) = 1;
v40 = *(_QWORD *)v38;
v38[282] = *((_DWORD *)a2 + 282);
v38[262] = *((_DWORD *)a2 + 262);
v41 = *(void (__fastcall **)(_DWORD *, _QWORD))(v40 + 1240);
v42 = (*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1424LL))(a2);
v41(v38, v42 ^ 1u);
*((_BYTE *)v38 + 996) = (*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1424LL))(a2) ^ 1;
*((_BYTE *)v38 + 1042) = *((_BYTE *)a2 + 1042);
*((_BYTE *)v38 + 1043) = *((_BYTE *)a2 + 1043);
*((_BYTE *)v38 + 1044) = *((_BYTE *)a2 + 1044);
v43 = (*(float (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 368LL))(a2);
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v38 + 360LL))(v38);
*((float *)v38 + 243) = v43;
*((float *)v38 + 244) = v43;
GameObject::copyGroups((GameObject *)v38, a2);
GameObject::updateCustomScaleX((GameObject *)v38, *((float *)a2 + 288));
GameObject::updateCustomScaleY((GameObject *)v38, *((float *)a2 + 289));
v38[330] = *((_DWORD *)a2 + 330);
v38[331] = *((_DWORD *)a2 + 331);
if ( *((_BYTE *)a2 + 1294) )
*((_BYTE *)v38 + 1294) = 1;
(*(void (__fastcall **)(_DWORD *))(*(_QWORD *)v38 + 1616LL))(v38);
PlayLayer::addObject(this, (GameObject *)v38);
v6 = *((_DWORD *)a2 + 257);
}
if ( v6 > 287 )
{
if ( v6 == 1022 )
goto LABEL_64;
if ( v6 <= 1022 )
{
if ( v6 == 747 )
goto LABEL_50;
if ( v6 <= 747 )
{
if ( v6 != 744 )
{
if ( v6 != 745 && v6 != 660 )
goto LABEL_27;
goto LABEL_50;
}
}
else if ( v6 > 900 )
{
if ( v6 != 915 )
goto LABEL_27;
}
else if ( v6 < 899 )
{
if ( v6 != 749 )
goto LABEL_27;
goto LABEL_50;
}
LABEL_86:
if ( *((_BYTE *)a2 + 1485) )
{
v22 = *((_BYTE **)this + 407);
v23 = v22[2602];
v24 = v22[2603];
*((_BYTE *)a2 + 1450) = v22[2604];
*((_BYTE *)a2 + 1448) = v23;
*((_BYTE *)a2 + 1449) = v24;
}
else if ( *((_BYTE *)a2 + 1486) )
{
v44 = *((_BYTE **)this + 407);
v45 = v44[2605];
v46 = v44[2606];
*((_BYTE *)a2 + 1450) = v44[2607];
*((_BYTE *)a2 + 1448) = v45;
*((_BYTE *)a2 + 1449) = v46;
}
goto LABEL_27;
}
if ( v6 == 1816 )
{
if ( *((_BYTE *)a2 + 1677) )
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 411), a2);
goto LABEL_27;
}
if ( v6 <= 1816 )
{
if ( v6 == 1331 )
goto LABEL_50;
if ( v6 != 1333 && v6 != 1330 )
goto LABEL_27;
goto LABEL_64;
}
if ( v6 != 2064 )
{
if ( v6 <= 2064 )
{
if ( v6 != 1933 )
goto LABEL_27;
}
else if ( v6 != 2902 && v6 != 2926 )
{
goto LABEL_27;
}
}
LABEL_50:
if ( *((_BYTE *)a2 + 1294) )
goto LABEL_27;
v8 = (unsigned __int8)GJBaseGameLayer::addGuideArt(this, a2);
v9 = (const char *)*((unsigned int *)a2 + 257);
if ( (_DWORD)v9 == 286 )
{
v10 = "portal_11_back_001.png";
goto LABEL_59;
}
if ( (int)v9 <= 286 )
{
if ( (_DWORD)v9 == 46 )
{
v10 = "portal_06_back_001.png";
goto LABEL_59;
}
if ( (int)v9 <= 46 )
{
if ( (_DWORD)v9 == 12 )
{
v10 = "portal_03_back_001.png";
goto LABEL_59;
}
if ( (int)v9 <= 12 )
{
v10 = "portal_02_back_001.png";
if ( (_DWORD)v9 == 11 )
goto LABEL_59;
}
else
{
if ( (_DWORD)v9 == 13 )
{
v10 = "portal_04_back_001.png";
goto LABEL_59;
}
v10 = "portal_05_back_001.png";
if ( (_DWORD)v9 == 45 )
goto LABEL_59;
}
goto LABEL_119;
}
if ( (_DWORD)v9 == 99 )
{
v10 = "portal_08_back_001.png";
goto LABEL_59;
}
if ( (int)v9 <= 99 )
{
v10 = "portal_07_back_001.png";
if ( (_DWORD)v9 == 47 )
goto LABEL_59;
goto LABEL_119;
}
if ( (_DWORD)v9 == 101 )
{
v10 = "portal_09_back_001.png";
goto LABEL_59;
}
v10 = "portal_10_back_001.png";
if ( (_DWORD)v9 != 111 )
LABEL_119:
v10 = "portal_01_back_001.png";
LABEL_59:
v11 = GameObject::createWithFrame((GameObject *)v10, v9);
v12 = *(_QWORD *)v11;
*(_DWORD *)(v11 + 1028) = 38;
v13 = v11;
(*(void (__fastcall **)(__int64, __int64))(v12 + 1808))(v11, 7);
*(_BYTE *)(v13 + 1290) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v13 + 1264LL))(v13);
v14 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v13 + 1368LL);
v15 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 192LL))(a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v48, v15);
v14(v13, &v48);
*(_BYTE *)(v13 + 1052) = 1;
*(_DWORD *)(v13 + 1116) = 4;
*(_DWORD *)(v13 + 1048) = GameObject::getObjectZOrder(a2) - 100 + v8;
v16 = *(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v13 + 1240LL);
v17 = (*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1424LL))(a2);
v16(v13, v17);
v18 = *(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v13 + 1248LL);
v19 = (*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1432LL))(a2);
v18(v13, v19);
v20 = *(void (__fastcall **)(__int64))(*(_QWORD *)v13 + 376LL);
(*(void (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 384LL))(a2);
v20(v13);
v21 = *(void (__fastcall **)(__int64))(*(_QWORD *)v13 + 392LL);
(*(void (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 400LL))(a2);
v21(v13);
*(_DWORD *)(v13 + 972) = *((_DWORD *)a2 + 243);
*(_DWORD *)(v13 + 976) = *((_DWORD *)a2 + 244);
*(_BYTE *)(v13 + 996) = *((_BYTE *)a2 + 996);
*(_BYTE *)(v13 + 997) = *((_BYTE *)a2 + 997);
GameObject::updateCustomScaleX((GameObject *)v13, *((float *)a2 + 288));
GameObject::updateCustomScaleY((GameObject *)v13, *((float *)a2 + 289));
*(_DWORD *)(v13 + 980) = *((_DWORD *)a2 + 245);
*(_DWORD *)(v13 + 984) = *((_DWORD *)a2 + 246);
*(_BYTE *)(v13 + 1042) = *((_BYTE *)a2 + 1042);
*(_BYTE *)(v13 + 1043) = *((_BYTE *)a2 + 1043);
*(_BYTE *)(v13 + 1044) = *((_BYTE *)a2 + 1044);
(*(void (__fastcall **)(PlayLayer *, __int64))(*(_QWORD *)this + 1344LL))(this, v13);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 410), (cocos2d::CCObject *)v13);
GameObject::copyGroups((GameObject *)v13, a2);
GJBaseGameLayer::addToGroups(this, (GameObject *)v13, 1);
*((_BYTE *)a2 + 1052) = 1;
*((_DWORD *)a2 + 262) = v8 + 12;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v13 + 1616LL))(v13);
*(_DWORD *)(v13 + 1320) = *((_DWORD *)a2 + 330);
*(_DWORD *)(v13 + 1324) = *((_DWORD *)a2 + 331);
goto LABEL_27;
}
if ( (_DWORD)v9 != 749 )
{
if ( (int)v9 <= 749 )
{
if ( (_DWORD)v9 == 660 )
{
v10 = "portal_13_back_001.png";
goto LABEL_59;
}
if ( (int)v9 <= 660 )
{
v10 = "portal_12_back_001.png";
if ( (_DWORD)v9 == 287 )
goto LABEL_59;
goto LABEL_119;
}
if ( (_DWORD)v9 == 745 )
{
v10 = "portal_14_back_001.png";
goto LABEL_59;
}
if ( (_DWORD)v9 != 747 )
goto LABEL_119;
goto LABEL_143;
}
if ( (_DWORD)v9 != 2064 )
{
if ( (int)v9 <= 2064 )
{
if ( (_DWORD)v9 == 1331 )
{
v10 = "portal_17_back_001.png";
goto LABEL_59;
}
v10 = "portal_18_back_001.png";
if ( (_DWORD)v9 != 1933 )
goto LABEL_119;
goto LABEL_59;
}
if ( (_DWORD)v9 != 2902 )
{
v10 = "portal_19_back_001.png";
if ( (_DWORD)v9 == 2926 )
goto LABEL_59;
goto LABEL_119;
}
LABEL_143:
v10 = "portal_15_back_001.png";
goto LABEL_59;
}
}
v10 = "portal_16_back_001.png";
goto LABEL_59;
}
if ( v6 >= 286 )
goto LABEL_50;
if ( v6 == 36 )
goto LABEL_64;
if ( v6 <= 36 )
{
if ( v6 > 17 )
{
if ( v6 < 29 )
goto LABEL_27;
if ( v6 > 30 )
{
if ( v6 == 31 )
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 1555), a2);
goto LABEL_27;
}
goto LABEL_86;
}
if ( v6 < 15 )
{
if ( (unsigned int)(v6 - 10) > 3 )
goto LABEL_27;
goto LABEL_50;
}
BallFrame = (GameObject *)GameObject::getBallFrame((GameObject *)*((unsigned int *)this + 3579), v5);
v27 = GameObject::createWithFrame(BallFrame, v26);
v28 = *(_QWORD *)v27;
*(_DWORD *)(v27 + 1028) = 37;
v29 = (GameObject *)v27;
(*(void (**)(void))(v28 + 1264))();
v30 = *((_DWORD *)a2 + 164);
if ( v30 != 1004 )
GameObject::setMainColorMode(v29, v30);
GameObject::setDefaultMainColorMode(a2, 0);
(*(void (__fastcall **)(GameObject *))(*(_QWORD *)a2 + 1616LL))(a2);
(*(void (__fastcall **)(GameObject *))(*(_QWORD *)v29 + 1616LL))(v29);
*((_DWORD *)a2 + 330) = 0;
*((_DWORD *)a2 + 331) = 0;
*((_DWORD *)v29 + 330) = 0;
*((_DWORD *)v29 + 331) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v48, *((float *)a2 + 108) * 0.5, *((float *)a2 + 109) + 10.0);
cocos2d::CCNode::convertToWorldSpace(&v47, a2, (const cocos2d::CCPoint *)&v48);
v31 = *(void (__fastcall **)(GameObject *, __int64 *))(*(_QWORD *)v29 + 1368LL);
cocos2d::CCNode::convertToNodeSpace(&v48, *((cocos2d::CCNode **)this + 318), (const cocos2d::CCPoint *)&v47);
v31(v29, &v48);
(*(void (__fastcall **)(GameObject *, float))(*(_QWORD *)v29 + 160LL))(v29, 0.1);
(*(void (__fastcall **)(PlayLayer *, GameObject *))(*(_QWORD *)this + 1344LL))(this, v29);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 410), v29);
(*(void (__fastcall **)(GameObject *, _QWORD))(*(_QWORD *)v29 + 344LL))(v29, 0);
GameObject::copyGroups(v29, a2);
GJBaseGameLayer::addToGroups(this, v29, 1);
LABEL_27:
if ( (unsigned __int8)GameObject::isSpeedObject(a2) )
goto LABEL_28;
goto LABEL_65;
}
if ( v6 == 99 )
goto LABEL_50;
if ( v6 <= 99 )
{
if ( v6 < 45 )
goto LABEL_27;
if ( v6 > 47 )
{
if ( v6 != 84 )
goto LABEL_27;
goto LABEL_64;
}
goto LABEL_50;
}
if ( v6 == 105 )
goto LABEL_86;
if ( v6 <= 105 )
{
if ( v6 != 101 )
goto LABEL_27;
goto LABEL_50;
}
if ( v6 == 111 )
goto LABEL_50;
if ( v6 != 141 )
goto LABEL_27;
LABEL_64:
GJBaseGameLayer::addGuideArt(this, a2);
if ( (unsigned __int8)GameObject::isSpeedObject(a2) )
{
LABEL_28:
if ( *((_BYTE *)a2 + 1768) )
{
LABEL_29:
EffectGameObject::updateSpeedModType(a2);
cocos2d::CCArray::addObject(*((cocos2d::CCArray **)this + 1782), a2);
return _stack_chk_guard;
}
}
LABEL_65:
if ( *((_DWORD *)a2 + 312) == 1 && *((_BYTE *)a2 + 1780) && *((_BYTE *)a2 + 1768) )
goto LABEL_29;
return _stack_chk_guard;
}