//
// EditorUI::findObject from 0xbdd598 to 0xbdda04 (1132 bytes)
//
// 3 xrefs:
// > EditorUI::handleEditorAction @ 0xbd7424
// > FindObjectPopup::runFind @ 0xcbcff8
// > ??> @ 0x64048
//
// 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:03:44 +0000
//
__int64 __fastcall EditorUI::findObject(LevelEditorLayer **this, int a2, unsigned __int8 a3, int a4)
{
int v7; // w27
GameManager *v8; // x0
GameManager *v9; // x0
GameManager *v10; // x0
int GameVariable; // w23
cocos2d::CCObject *Group; // x0
unsigned int *v13; // x1
GameObject **v14; // x19
__int64 v15; // x0
char *v16; // x21
GameObject *v17; // x1
__int64 *v18; // x0
__int64 GameObject; // x0
__int64 *v20; // x4
__int64 *v21; // x1
__int64 v22; // x1
int v23; // w2
__int64 *v24; // x27
int v25; // w25
__int64 v26; // t1
__int64 v27; // x27
GameObject *v28; // x19
cocos2d::CCArray *v30; // x20
cocos2d::CCObject **v31; // x1
unsigned __int64 i; // x19
int v33; // w0
__int64 MainObject; // x0
__int64 *v35; // x1
__int64 v36; // t1
char v37[8]; // [xsp+60h] [xbp+60h] BYREF
__int64 v38; // [xsp+68h] [xbp+68h] BYREF
__int64 v39; // [xsp+70h] [xbp+70h] BYREF
void *v40; // [xsp+78h] [xbp+78h] BYREF
__int64 *v41; // [xsp+80h] [xbp+80h]
__int64 *v42; // [xsp+88h] [xbp+88h]
char v43; // [xsp+90h] [xbp+90h] BYREF
char v44[9]; // [xsp+91h] [xbp+91h] BYREF
__int16 v45; // [xsp+9Ah] [xbp+9Ah]
int v46; // [xsp+9Ch] [xbp+9Ch]
void *v47; // [xsp+A0h] [xbp+A0h]
v7 = a3;
v8 = (GameManager *)GameManager::sharedState(_stack_chk_guard);
v9 = (GameManager *)GameManager::setIntGameVariable(v8, "0230", a2);
v10 = (GameManager *)GameManager::sharedState(v9);
v40 = nullptr;
v41 = nullptr;
GameVariable = (unsigned __int8)GameManager::getGameVariable(v10, "0231");
v42 = nullptr;
if ( v7 )
{
GameObject = LevelEditorLayer::findGameObject(*(this + 180), a2);
v39 = GameObject;
if ( GameObject
&& (!GameVariable
|| (GameObject = EditorUI::findPassesFilters((EditorUI *)this, (GameObject *)GameObject), (_BYTE)GameObject)) )
{
std::vector::__push_back_slow_path((__int64)&v40, &v39);
v21 = v41;
}
else
{
v21 = v41;
}
v20 = (__int64 *)v40;
}
else
{
if ( a2 <= 0 )
goto LABEL_40;
Group = GJBaseGameLayer::getGroup(*(this + 180), a2);
if ( Group )
{
v13 = *((unsigned int **)Group + 7);
if ( *v13 )
{
v14 = *((GameObject ***)v13 + 2);
v15 = 8LL * *v13 - 8;
v16 = (char *)v14 + v15;
if ( v14 <= (GameObject **)((char *)v14 + v15) )
{
v17 = *v14;
if ( *v14 )
{
while ( 1 )
{
v39 = (__int64)v17;
if ( GameVariable )
{
if ( !EditorUI::findPassesFilters((EditorUI *)this, v17) )
goto LABEL_12;
v18 = v41;
if ( v41 != v42 )
{
LABEL_9:
if ( v18 )
{
*v18 = v39;
v18 = v41;
}
v41 = v18 + 1;
goto LABEL_12;
}
}
else
{
v18 = v41;
if ( v41 != v42 )
goto LABEL_9;
}
std::vector::__push_back_slow_path((__int64)&v40, &v39);
LABEL_12:
if ( v16 >= (char *)++v14 )
{
v17 = *v14;
if ( *v14 )
continue;
}
break;
}
}
}
}
}
v37[0] = 0;
GameObject = sub_BDBB00((__int64)v40, v41, (__int64)v37);
v20 = (__int64 *)v40;
v21 = v41;
}
if ( v20 != v21 )
{
if ( a4 )
{
v22 = v21 - v20;
if ( (int)v22 > 0 )
{
v23 = *((_DWORD *)this + 358);
if ( *(_DWORD *)(*v20 + 916) == v23 )
{
v25 = 0;
LABEL_25:
v27 = (a4 + v25 + (int)v22) % (int)v22;
goto LABEL_26;
}
v24 = v20 + 1;
v25 = 0;
while ( ++v25 != (_DWORD)v22 )
{
v26 = *v24++;
if ( v23 == *(_DWORD *)(v26 + 916) )
{
if ( v25 < 0 )
break;
goto LABEL_25;
}
}
}
v27 = 0;
if ( a4 <= 0 )
v27 = (int)v22 - 1;
LABEL_26:
v28 = (GameObject *)v20[v27];
*((_DWORD *)this + 358) = *((_DWORD *)v28 + 229);
EditorUI::processSelectObject((__int64)this, v28);
EditorUI::centerCameraOnObject((EditorUI *)this, v28);
goto LABEL_27;
}
v30 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)GameObject);
v31 = (cocos2d::CCObject **)v40;
for ( i = 0; i < ((char *)v41 - (_BYTE *)v40) >> 3; ++i )
{
cocos2d::CCArray::addObject(v30, v31[i]);
v31 = (cocos2d::CCObject **)v40;
}
if ( !v7 )
{
MainObject = GJBaseGameLayer::tryGetMainObject((cocos2d::CCDictionary **)*(this + 180), a2);
if ( MainObject )
{
if ( v40 != v41 )
{
if ( MainObject == *(_QWORD *)v40 )
{
LABEL_55:
v33 = *(_DWORD *)(MainObject + 916);
goto LABEL_39;
}
v35 = (__int64 *)((char *)v40 + 8);
while ( v41 != v35 )
{
v36 = *v35++;
if ( MainObject == v36 )
goto LABEL_55;
}
}
}
}
v33 = 0;
LABEL_39:
*((_DWORD *)this + 358) = v33;
EditorUI::getGroupCenter(&v38, (EditorUI *)this, v30, 0);
EditorUI::processSelectObjects((EditorUI *)this, v30);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v39, (const cocos2d::CCPoint *)&v38);
EditorUI::centerCameraOnPoint((EditorUI *)this, (float *)&v39);
goto LABEL_27;
}
LABEL_40:
v44[8] = 0;
v45 = 0;
v46 = 0;
v47 = nullptr;
v43 = 18;
strcpy(v44, "No Matc");
EditorUI::showTextAlert((__int64)this, (__int64)&v43, 0, 1, 0);
if ( (v43 & 1) != 0 )
operator delete(v47);
LABEL_27:
if ( v40 )
{
if ( v40 != v41 )
v41 += ~((unsigned __int64)((char *)(v41 - 1) - (_BYTE *)v40) >> 3);
operator delete(v40);
}
return _stack_chk_guard;
}