//
// cocos2d::extension::CCArrayForObjectSorting::setObjectID_ofSortedObject from 0x10042a290 to 0x10042a4e6 (598 bytes)
//
// 0 xrefs:
//
// 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
//
void __fastcall cocos2d::extension::CCArrayForObjectSorting::setObjectID_ofSortedObject(
cocos2d::extension::CCArrayForObjectSorting *a1,
unsigned int a2,
cocos2d::extension::CCSortableObject *a3)
{
unsigned int v3; // eax
unsigned int v4; // r12d
unsigned int v5; // r14d
cocos2d::ccArray *data; // rax
const void **arr; // r13
const void **v8; // rbx
unsigned int v9; // r15d
void *v10; // rax
unsigned int v11; // eax
const void *v12; // rax
void *v13; // rax
const void *v14; // r14
cocos2d::CCObject *v15; // r15
int v16; // ebx
unsigned int v17; // eax
unsigned int v18; // r15d
unsigned int v19; // r14d
cocos2d::ccArray *v20; // rax
const void **v21; // r12
unsigned __int64 v22; // rbx
unsigned int v23; // r13d
void *v24; // rax
unsigned int v25; // eax
cocos2d::CCObject *v27; // [rsp+8h] [rbp-38h]
void *v28; // [rsp+10h] [rbp-30h]
if ( a3 )
{
v3 = ((__int64 (__fastcall *)(cocos2d::extension::CCSortableObject *))a3->getObjectID)(a3);
v4 = 0;
if ( a1 )
{
v5 = v3;
data = a1->data;
if ( data->num )
{
arr = (const void **)data->arr;
v8 = &arr[data->num - 1];
v4 = 0;
v9 = 0;
do
{
if ( !*arr )
break;
v10 = __dynamic_cast(
*arr,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
-2);
v11 = (*(__int64 (__fastcall **)(void *))(*(_QWORD *)v10 + 24LL))(v10);
if ( v5 == v11 )
break;
if ( v5 < v11 && v5 >= v9 )
break;
++v4;
++arr;
v9 = v11;
}
while ( arr <= v8 );
}
}
if ( v4 < (unsigned int)sub_100720070(a1) )
{
v12 = (const void *)sub_1007200C0(a1, v4);
if ( v12
&& (v13 = __dynamic_cast(
v12,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
-2)) != nullptr )
{
v14 = v13;
v15 = (cocos2d::CCObject *)__dynamic_cast(
v13,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
-2);
}
else
{
v14 = nullptr;
v15 = nullptr;
}
cocos2d::CCObject::retain(v15);
v16 = (*(__int64 (__fastcall **)(const void *))(*(_QWORD *)v14 + 24LL))(v14);
if ( v16 == ((unsigned int (__fastcall *)(cocos2d::extension::CCSortableObject *))a3->getObjectID)(a3) )
{
v27 = v15;
sub_100720230(a1, v4, 1);
(*(void (__fastcall **)(const void *, _QWORD))(*(_QWORD *)v14 + 16LL))(v14, a2);
v28 = __dynamic_cast(
v14,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
-2);
v17 = (*(__int64 (__fastcall **)(const void *))(*(_QWORD *)v14 + 24LL))(v14);
v18 = 0;
if ( a1 )
{
v19 = v17;
v20 = a1->data;
if ( v20->num )
{
v21 = (const void **)v20->arr;
v22 = (unsigned __int64)&v21[v20->num - 1];
v18 = 0;
v23 = 0;
do
{
if ( !*v21 )
break;
v24 = __dynamic_cast(
*v21,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
-2);
v25 = (*(__int64 (__fastcall **)(void *))(*(_QWORD *)v24 + 24LL))(v24);
if ( v19 == v25 || v19 >= v23 && v19 < v25 )
break;
++v18;
++v21;
v23 = v25;
}
while ( (unsigned __int64)v21 <= v22 );
}
}
sub_1007201F0(a1, v28, v18);
cocos2d::CCObject::release(v27);
}
else
{
cocos2d::CCObject::release(v15);
}
}
}
else
{
sub_100720070(a1);
}
}