//
// SFXSearchResult::updateObjects from 0x14049ae70 to 0x14049b92e (2750 bytes)
//
// 3 xrefs:
// > ??> @ 0x1407b9398
// > ??> @ 0x140929114
// > ??> @ 0x140929120
//
// This function is hookable on this platform (idp: pc, 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 11:32:54 +0000
//
// Hidden C++ exception states: #wind=19
void __fastcall SFXSearchResult::updateObjects(__int64 a1, int a2)
{
int v2; // esi
__int64 v3; // r13
unsigned __int64 v4; // r14
char *v5; // rcx
char *v6; // rdi
char *v7; // rbx
const char *v8; // rbx
__int64 v9; // rdi
int v10; // eax
struct cocos2d::CCObject *v11; // rax
cocos2d::CCObject *v12; // rax
cocos2d::CCObject *v13; // rbx
cocos2d::CCObject *v14; // rcx
int v15; // edx
cocos2d::CCArray *v16; // r12
__int64 v17; // rax
__int64 v18; // rcx
cocos2d::CCArray *FilesMatchingSearch; // r15
cocos2d::CCArray *v20; // rdi
struct cocos2d::CCObject *v21; // rbx
__int64 v22; // rbx
unsigned int *v23; // rbx
__int64 v24; // rax
struct cocos2d::CCObject **v25; // rbx
struct cocos2d::CCObject **m; // rsi
struct cocos2d::CCObject *v27; // rdx
cocos2d::CCArray *v28; // rcx
__int64 v29; // rax
void (__fastcall *v30)(__int64); // rdx
unsigned int v31; // eax
unsigned int *v32; // rbx
__int64 v33; // rax
struct cocos2d::CCObject **v34; // rbx
struct cocos2d::CCObject **i; // rdi
unsigned int *v36; // rcx
__int64 v37; // rax
unsigned __int64 v38; // rcx
unsigned __int64 j; // rdx
__int64 v40; // rcx
__int64 v41; // rdi
__int128 *v42; // rbx
__int128 *v43; // rax
cocos2d::CCArray *v44; // rdi
struct cocos2d::CCObject *Object; // rbx
__int128 *v46; // r9
_QWORD *v47; // rcx
char v48; // si
__int64 v49; // rax
unsigned int *v50; // rbx
__int64 v51; // rax
struct cocos2d::CCObject **v52; // rbx
struct cocos2d::CCObject **k; // r14
struct cocos2d::CCObject *v54; // rdx
__int128 *v55; // rax
cocos2d::CCObject *v56; // rcx
cocos2d::CCArray *v57; // rdi
int v58; // eax
__int64 v59; // rcx
__int64 *v60; // rbx
struct cocos2d::CCObject *v61; // rax
int *v62; // rbx
struct cocos2d::CCObject *v63; // rax
__int64 v64; // rax
unsigned int *v65; // rbx
__int64 v66; // rax
struct cocos2d::CCObject **v67; // rbx
struct cocos2d::CCObject **n; // rsi
unsigned int *v69; // rcx
__int64 v70; // rax
unsigned __int64 v71; // rcx
unsigned __int64 ii; // rdx
__int128 *v73; // rax
cocos2d::CCObject *v74; // rcx
__int64 v75; // rsi
__int64 v76; // rcx
unsigned __int64 v77; // r12
__int64 v78; // r15
__int64 v79; // rbx
struct cocos2d::CCObject *v80; // rbx
void *v81; // rcx
int *v82; // rbx
unsigned __int64 v83; // rbx
cocos2d::CCDictionary *v84; // rcx
struct cocos2d::CCObject *v85; // rax
void *v87; // [rsp+38h] [rbp-41h]
void *v88; // [rsp+38h] [rbp-41h]
void *v89; // [rsp+38h] [rbp-41h]
void *v90; // [rsp+38h] [rbp-41h]
void *v91; // [rsp+38h] [rbp-41h]
void *v92; // [rsp+38h] [rbp-41h]
void *v93; // [rsp+38h] [rbp-41h]
void *v94; // [rsp+38h] [rbp-41h]
void *v95; // [rsp+40h] [rbp-39h]
void *v96; // [rsp+40h] [rbp-39h]
void *v97; // [rsp+48h] [rbp-31h]
void *v98; // [rsp+50h] [rbp-29h]
void *v99; // [rsp+58h] [rbp-21h]
__int128 v100; // [rsp+60h] [rbp-19h] BYREF
unsigned __int64 v101; // [rsp+70h] [rbp-9h]
unsigned __int64 v102; // [rsp+78h] [rbp-1h]
_QWORD v103[4]; // [rsp+80h] [rbp+7h] BYREF
v2 = a2;
v3 = a1;
v4 = 0;
if ( !*(_DWORD *)(a1 + 148) && *(_QWORD *)(a1 + 120) )
{
if ( *(_QWORD *)(a1 + 128) <= 0xFu )
{
v6 = (char *)(a1 + 104);
v5 = (char *)(a1 + 104);
}
else
{
v5 = *(char **)(a1 + 104);
v6 = v5;
}
v7 = &v5[*(_QWORD *)(v3 + 120)];
if ( v6 == v7 )
{
LABEL_9:
v8 = (const char *)(v3 + 104);
if ( *(_QWORD *)(v3 + 128) > 0xFu )
v8 = *(const char **)v8;
v9 = qword_14090C070;
if ( !qword_14090C070 )
{
v87 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v87);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v9 = qword_14090C070;
}
v10 = atoi(v8);
a1 = *(_QWORD *)(v9 + 408);
if ( a1 )
{
v11 = cocos2d::CCDictionary::objectForKey((cocos2d::CCDictionary *)a1, v10);
if ( v11 )
{
v12 = cocos2d::CCArray::createWithObject(v11);
v13 = v12;
if ( *(cocos2d::CCObject **)(v3 + 64) != v12 )
{
if ( v12 )
cocos2d::CCObject::retain(v12);
v14 = *(cocos2d::CCObject **)(v3 + 64);
if ( v14 )
cocos2d::CCObject::release(v14);
*(_QWORD *)(v3 + 64) = v13;
}
return;
}
}
}
else
{
while ( isdigit(*v6) )
{
if ( ++v6 == v7 )
goto LABEL_9;
}
}
}
*(_DWORD *)(v3 + 136) = v2;
v15 = *(_DWORD *)(v3 + 148);
if ( v15 != 1 && (unsigned int)(v15 - 2) > 1 )
{
v16 = nullptr;
v17 = *(_QWORD *)(v3 + 184);
if ( v17 )
{
if ( !*(_QWORD *)(v3 + 120) )
{
v16 = *(cocos2d::CCArray **)(v17 + 176);
LABEL_44:
v31 = cocos2d::CCArray::count(v16);
FilesMatchingSearch = cocos2d::CCArray::createWithCapacity(v31);
if ( v16 )
{
v32 = *((unsigned int **)v16 + 7);
v33 = *v32;
if ( (_DWORD)v33 )
{
v34 = *((struct cocos2d::CCObject ***)v32 + 2);
for ( i = &v34[v33 - 1]; v34 <= i; ++v34 )
{
if ( !*v34 )
break;
cocos2d::CCArray::addObject(FilesMatchingSearch, *v34);
}
}
}
LABEL_49:
if ( *(_QWORD *)(v3 + 120) )
{
if ( FilesMatchingSearch )
{
v36 = *((unsigned int **)FilesMatchingSearch + 7);
v37 = *v36;
if ( (_DWORD)v37 )
{
v38 = *((_QWORD *)v36 + 2);
for ( j = v38 + 8 * (v37 - 1); v38 <= j; v38 += 8LL )
{
if ( !*(_QWORD *)v38 )
break;
*(_BYTE *)(*(_QWORD *)v38 + 73LL) = 0;
}
}
}
v40 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v89 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v89);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v40 = qword_14090BFD0;
}
if ( GameManager::getGameVariable(v40, "0147") && *(_QWORD *)(v3 + 184) )
{
sub_14003F4F0((__int64)&v100, v3 + 104);
if ( (_DWORD)v101 )
{
v41 = (unsigned int)v101;
do
{
v42 = &v100;
if ( v102 > 0xF )
v42 = (__int128 *)v100;
v43 = &v100;
if ( v102 > 0xF )
v43 = (__int128 *)v100;
*((_BYTE *)v42 + v4) = tolower(*((char *)v43 + v4));
++v4;
--v41;
}
while ( v41 );
}
v44 = cocos2d::CCArray::createWithObject(*(struct cocos2d::CCObject **)(v3 + 184));
while ( cocos2d::CCArray::count(v44) )
{
Object = cocos2d::CCArray::lastObject(v44);
cocos2d::CCArray::removeLastObject(v44, 1);
sub_14003F4F0((__int64)v103, (__int64)Object + 112);
if ( *((_BYTE *)Object + 73) )
goto LABEL_74;
v46 = &v100;
if ( v102 > 0xF )
v46 = (__int128 *)v100;
v47 = v103;
if ( v103[3] > 0xFu )
v47 = (_QWORD *)v103[0];
if ( sub_14003EFB0((__int64)v47, v103[2], 0, (__int64)v46, v101) != -1 )
LABEL_74:
v48 = 1;
else
v48 = 0;
v49 = *((_QWORD *)Object + 22);
if ( v49 )
{
v50 = *(unsigned int **)(v49 + 56);
v51 = *v50;
if ( (_DWORD)v51 )
{
v52 = *((struct cocos2d::CCObject ***)v50 + 2);
for ( k = &v52[v51 - 1]; v52 <= k; ++v52 )
{
v54 = *v52;
if ( !*v52 )
break;
*((_BYTE *)v54 + 73) = v48;
if ( *((_BYTE *)v54 + 72) )
cocos2d::CCArray::addObject(v44, v54);
}
}
}
sub_14003D310((__int64)v103);
}
sub_14003D310((__int64)&v100);
}
v55 = (__int128 *)sub_14003F4F0((__int64)v103, v3 + 104);
FilesMatchingSearch = MusicSearchResult::getFilesMatchingSearch(v3, (__int64)FilesMatchingSearch, v55);
}
sub_14049ADD0(FilesMatchingSearch, a2);
if ( *(cocos2d::CCArray **)(v3 + 64) != FilesMatchingSearch )
{
if ( FilesMatchingSearch )
cocos2d::CCObject::retain(FilesMatchingSearch);
v56 = *(cocos2d::CCObject **)(v3 + 64);
if ( v56 )
cocos2d::CCObject::release(v56);
*(_QWORD *)(v3 + 64) = FilesMatchingSearch;
}
return;
}
if ( v15 || *(_DWORD *)(v17 + 56) != 1 )
{
FilesMatchingSearch = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
v20 = cocos2d::CCArray::createWithObject(*(struct cocos2d::CCObject **)(v3 + 184));
while ( cocos2d::CCArray::count(v20) )
{
v21 = cocos2d::CCArray::lastObject(v20);
cocos2d::CCArray::removeLastObject(v20, 1);
v22 = *((_QWORD *)v21 + 22);
if ( v22 )
{
v23 = *(unsigned int **)(v22 + 56);
v24 = *v23;
if ( (_DWORD)v24 )
{
v25 = *((struct cocos2d::CCObject ***)v23 + 2);
for ( m = &v25[v24 - 1]; v25 <= m; ++v25 )
{
v27 = *v25;
if ( !*v25 )
break;
v28 = v20;
if ( !*((_BYTE *)v27 + 72) )
v28 = FilesMatchingSearch;
cocos2d::CCArray::addObject(v28, v27);
}
}
}
}
if ( FilesMatchingSearch )
goto LABEL_49;
goto LABEL_44;
}
v18 = qword_14090C070;
if ( !qword_14090C070 )
goto LABEL_42;
}
else
{
v18 = qword_14090C070;
if ( !qword_14090C070 )
{
LABEL_42:
v88 = operator new(0x3D0u);
v29 = MusicDownloadManager::MusicDownloadManager((__int64)v88);
v30 = *(void (__fastcall **)(__int64))(*(_QWORD *)v29 + 72LL);
qword_14090C070 = v29;
v30(v29);
v18 = qword_14090C070;
}
}
v16 = (cocos2d::CCArray *)sub_140490BB0(v18);
goto LABEL_44;
}
v57 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
v58 = *(_DWORD *)(v3 + 148);
if ( v58 == 1 )
{
v59 = qword_14090C070;
if ( !qword_14090C070 )
{
v90 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v90);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v59 = qword_14090C070;
}
v60 = *(__int64 **)(v59 + 656);
while ( 1 )
{
v60 = (__int64 *)*v60;
if ( !v59 )
{
v91 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v91);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v59 = qword_14090C070;
}
if ( v60 == *(__int64 **)(v59 + 656) )
break;
if ( *(_QWORD *)(v59 + 408) )
{
v61 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v59 + 408), *((int *)v60 + 4));
if ( v61 && !*((_BYTE *)v61 + 72) )
cocos2d::CCArray::addObject(v57, v61);
v59 = qword_14090C070;
}
}
v62 = *(int **)(v59 + 720);
while ( 1 )
{
v62 = *(int **)v62;
if ( !v59 )
{
v92 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v92);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v59 = qword_14090C070;
}
if ( v62 == *(int **)(v59 + 720) )
break;
if ( *(_QWORD *)(v59 + 920) && v62[4] > 0 )
{
v63 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v59 + 920), v62[4]);
if ( v63 && !*((_BYTE *)v63 + 72) )
cocos2d::CCArray::addObject(v57, v63);
v59 = qword_14090C070;
}
}
goto LABEL_120;
}
if ( v58 != 3 )
{
if ( v58 != 2 )
{
LABEL_163:
v83 = (__int64)(*(_QWORD *)(v3 + 160) - *(_QWORD *)(v3 + 152)) >> 2;
if ( v83 )
{
do
{
if ( !qword_14090C070 )
{
v96 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v96);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
}
v84 = *(cocos2d::CCDictionary **)(qword_14090C070 + 408);
if ( v84 )
{
v85 = cocos2d::CCDictionary::objectForKey(v84, *(int *)(*(_QWORD *)(v3 + 152) + 4 * v4));
if ( v85 )
{
if ( !*((_BYTE *)v85 + 72) )
cocos2d::CCArray::addObject(v57, v85);
}
}
++v4;
}
while ( v4 < v83 );
}
goto LABEL_120;
}
v75 = 0;
v76 = qword_14090C070;
if ( !qword_14090C070 )
{
v93 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v93);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v76 = qword_14090C070;
}
v77 = (__int64)(*(_QWORD *)(v76 + 848) - *(_QWORD *)(v76 + 840)) >> 3;
if ( !v77 )
goto LABEL_119;
while ( 1 )
{
v100 = 0;
v101 = 0;
v102 = 15;
LOBYTE(v100) = 0;
if ( !v76 )
{
v94 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v94);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v76 = qword_14090C070;
}
v78 = *(_QWORD *)(v76 + 840) + 8 * v75;
if ( !v76 )
{
v97 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v97);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v76 = qword_14090C070;
}
v79 = v76;
if ( !v76 )
{
v98 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v98);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v76 = qword_14090C070;
}
v80 = MusicDownloadManager::resolveSFXPlacement(
v76,
*(_DWORD *)(*(_QWORD *)(v79 + 840) + 8 * v75),
*(_DWORD *)(v78 + 4),
(__int64 *)&v100);
if ( v102 > 0xF )
{
v81 = (void *)v100;
if ( v102 + 1 >= 0x1000 )
{
v81 = *(void **)(v100 - 8);
if ( (unsigned __int64)(v100 - (_QWORD)v81 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v81);
}
v101 = 0;
v102 = 15;
LOBYTE(v100) = 0;
if ( v80 )
goto LABEL_174;
v76 = qword_14090C070;
if ( !qword_14090C070 )
{
v99 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v99);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v76 = qword_14090C070;
}
v82 = (int *)(*(_QWORD *)(v76 + 840) + 8 * v75);
if ( !v76 )
{
v95 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v95);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v76 = qword_14090C070;
}
if ( !*(_QWORD *)(v76 + 408) )
goto LABEL_160;
v80 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v76 + 408), *v82);
if ( v80 )
{
LABEL_174:
if ( !*((_BYTE *)v80 + 72) )
cocos2d::CCArray::addObject(v57, v80);
}
v76 = qword_14090C070;
LABEL_160:
if ( ++v75 >= v77 )
goto LABEL_119;
}
}
v64 = *(_QWORD *)(v3 + 88);
if ( !v64 )
goto LABEL_163;
v65 = *(unsigned int **)(v64 + 56);
v66 = *v65;
if ( (_DWORD)v66 )
{
v67 = *((struct cocos2d::CCObject ***)v65 + 2);
for ( n = &v67[v66 - 1]; v67 <= n; ++v67 )
{
if ( !*v67 )
break;
cocos2d::CCArray::addObject(v57, *v67);
}
LABEL_119:
v2 = a2;
}
LABEL_120:
if ( *(_QWORD *)(v3 + 120) )
{
if ( v57 )
{
v69 = *((unsigned int **)v57 + 7);
v70 = *v69;
if ( (_DWORD)v70 )
{
v71 = *((_QWORD *)v69 + 2);
for ( ii = v71 + 8 * (v70 - 1); v71 <= ii; v71 += 8LL )
{
if ( !*(_QWORD *)v71 )
break;
*(_BYTE *)(*(_QWORD *)v71 + 73LL) = 0;
}
}
}
v73 = (__int128 *)sub_14003F4F0((__int64)v103, v3 + 104);
v57 = MusicSearchResult::getFilesMatchingSearch(v3, (__int64)v57, v73);
}
if ( *(_DWORD *)(v3 + 148) != 2 )
sub_14049ADD0(v57, v2);
if ( *(cocos2d::CCArray **)(v3 + 64) != v57 )
{
if ( v57 )
cocos2d::CCObject::retain(v57);
v74 = *(cocos2d::CCObject **)(v3 + 64);
if ( v74 )
cocos2d::CCObject::release(v74);
*(_QWORD *)(v3 + 64) = v57;
}
}