//
// SFXSearchResult::updateObjects from 0x10059a880 to 0x10059b23c (2492 bytes)
//
// 1 xrefs:
// > ??> @ 0x100970a70
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall SFXSearchResult::updateObjects(SFXSearchResult *p_shortStorage, AudioSortType a2)
{
__m128 v2; // xmm0
SFXSearchResult *v3; // r13
std::uint8_t sizex2; // al
std::array *longStorage; // rdx
std::size_t size; // rcx
__int64 v7; // r9
__int64 v8; // r8
__int64 v9; // rcx
SFXSearchResult *v10; // rbx
char *v11; // r14
__int64 v12; // rsi
int v13; // eax
cocos2d::CCObject *v14; // rax
__int64 v15; // rsi
cocos2d::CCObject *v16; // rax
cocos2d::CCObject *v17; // rdi
cocos2d::CCArray *v18; // rbx
SFXFolderObject *m_folderObject; // rax
unsigned int v20; // ecx
__int64 v21; // rbx
char *v22; // r14
__int64 m_sfxObjects; // r14
__int64 v24; // rax
__int64 v25; // rbx
__int64 v26; // rsi
__int64 v27; // rbx
char *v28; // r14
__int64 v29; // rax
__int64 v30; // rbx
__int64 v31; // rsi
__int64 v32; // r12
__int64 v33; // r14
__int64 i; // rdi
__int64 v35; // rbx
__int64 v36; // rax
unsigned int *v37; // rax
__int64 *v38; // rbx
unsigned __int64 v39; // r15
__int64 v40; // rsi
__int64 v41; // rdi
cocos2d::CCObject *FilesMatchingSearch; // r15
unsigned int v43; // eax
unsigned int *v44; // rax
_QWORD *v45; // rbx
unsigned __int64 v46; // r14
unsigned int v47; // eax
cocos2d::CCObject_vtbl *v48; // rax
__int64 copyWithZone_low; // rcx
unsigned __int64 v50; // rax
unsigned __int64 v51; // rcx
GameManager *v52; // rax
bool GameVariable; // al
std::string *v54; // rcx
unsigned int v55; // eax
__int64 v56; // rbx
__int64 v57; // r15
char *v58; // rax
char v59; // al
char *v60; // rcx
__int64 v61; // r12
__int64 v62; // r14
bool v63; // r15
char *v64; // rax
char *v65; // rdx
unsigned int v66; // ebx
signed __int64 v67; // rbx
__int64 v68; // rax
char *v69; // r13
char *v70; // r15
unsigned int *v71; // rax
__int64 *v72; // rbx
unsigned __int64 v73; // r14
__int64 v74; // rsi
void *v75; // r15
size_t v76; // rdx
char *v77; // rax
int (__cdecl *v78)(const void *, const void *); // rcx
cocos2d::CCObject *m_filterObjects; // rdi
SFXSearchResult *v80; // [rsp+0h] [rbp-A0h]
char *v81; // [rsp+8h] [rbp-98h]
__m128 v82; // [rsp+10h] [rbp-90h] BYREF
void *v83; // [rsp+20h] [rbp-80h]
void *v84[2]; // [rsp+28h] [rbp-78h] BYREF
void *__p; // [rsp+38h] [rbp-68h]
cocos2d::CCObject *v86; // [rsp+40h] [rbp-60h]
int __c; // [rsp+48h] [rbp-58h]
AudioSortType v88; // [rsp+4Ch] [rbp-54h]
void *__s2; // [rsp+50h] [rbp-50h]
std::string *p_m_searchQuery; // [rsp+58h] [rbp-48h]
__int128 v91; // [rsp+60h] [rbp-40h] BYREF
void *v92; // [rsp+70h] [rbp-30h]
v3 = p_shortStorage;
p_m_searchQuery = &p_shortStorage->m_searchQuery;
sizex2 = p_shortStorage->m_searchQuery.m_data.m_short.sizex2;
if ( (sizex2 & 1) != 0 )
{
size = p_shortStorage->m_searchQuery.m_data.m_long.size;
if ( !size )
goto LABEL_23;
longStorage = (std::array *)p_shortStorage->m_searchQuery.m_data.m_long.longStorage;
}
else
{
if ( !sizex2 )
goto LABEL_23;
longStorage = &p_shortStorage->m_searchQuery.m_data.m_short.shortStorage;
size = sizex2 >> 1;
}
v7 = 0;
p_shortStorage = (SFXSearchResult *)&_DefaultRuneLocale;
do
{
v8 = longStorage->__elems_[v7];
if ( v8 < 0 || (_DefaultRuneLocale.__runetype[v8] & 0x400) == 0 )
goto LABEL_23;
++v7;
}
while ( size != v7 );
v9 = qword_1009A2C38;
if ( qword_1009A2C38 )
{
if ( (sizex2 & 1) == 0 )
goto LABEL_12;
LABEL_15:
p_shortStorage = (SFXSearchResult *)v3->m_searchQuery.m_data.m_long.longStorage;
v10 = *(SFXSearchResult **)(v9 + 392);
if ( !v10 )
goto LABEL_23;
goto LABEL_16;
}
v11 = (char *)operator new(0x230u);
cocos2d::CCNode::CCNode((__int64)v11);
*(_QWORD *)v11 = off_100970158;
*((_QWORD *)v11 + 40) = off_1009704D8;
v2 = 0;
*((_OWORD *)v11 + 28) = 0;
*(_OWORD *)(v11 + 328) = 0;
*(_OWORD *)(v11 + 344) = 0;
*((_DWORD *)v11 + 90) = 0;
*((_OWORD *)v11 + 23) = 0;
*((_OWORD *)v11 + 24) = 0;
*((_OWORD *)v11 + 25) = 0;
v11[416] = 0;
*(_OWORD *)(v11 + 424) = 0;
*((_QWORD *)v11 + 55) = v11 + 448;
*((_OWORD *)v11 + 30) = 0;
*((_OWORD *)v11 + 31) = 0;
*((_QWORD *)v11 + 58) = 0;
*(_QWORD *)(v11 + 471) = 0;
*((_DWORD *)v11 + 128) = 1065353216;
*(_OWORD *)(v11 + 520) = 0;
*(_OWORD *)(v11 + 536) = 0;
*((_DWORD *)v11 + 138) = 1065353216;
qword_1009A2C38 = (__int64)v11;
MusicDownloadManager::init((MusicDownloadManager *)v11);
v9 = qword_1009A2C38;
v12 = (unsigned int)a2;
if ( (p_m_searchQuery->m_data.m_short.sizex2 & 1) != 0 )
goto LABEL_15;
LABEL_12:
p_shortStorage = (SFXSearchResult *)&v3->m_searchQuery.m_data.m_short.shortStorage;
v10 = *(SFXSearchResult **)(v9 + 392);
if ( !v10 )
{
LABEL_23:
v3->m_sortType = a2;
m_folderObject = v3->m_folderObject;
v88 = a2;
if ( !m_folderObject )
{
v27 = qword_1009A2C38;
if ( !qword_1009A2C38 )
{
v28 = (char *)operator new(0x230u);
cocos2d::CCNode::CCNode((__int64)v28);
*(_QWORD *)v28 = off_100970158;
*((_QWORD *)v28 + 40) = off_1009704D8;
v2 = 0;
*((_OWORD *)v28 + 28) = 0;
*(_OWORD *)(v28 + 328) = 0;
*(_OWORD *)(v28 + 344) = 0;
*((_DWORD *)v28 + 90) = 0;
*((_OWORD *)v28 + 23) = 0;
*((_OWORD *)v28 + 24) = 0;
*((_OWORD *)v28 + 25) = 0;
v28[416] = 0;
*(_OWORD *)(v28 + 424) = 0;
*((_QWORD *)v28 + 55) = v28 + 448;
*((_OWORD *)v28 + 30) = 0;
*((_OWORD *)v28 + 31) = 0;
*((_QWORD *)v28 + 58) = 0;
*(_QWORD *)(v28 + 471) = 0;
*((_DWORD *)v28 + 128) = 1065353216;
*(_OWORD *)(v28 + 520) = 0;
*(_OWORD *)(v28 + 536) = 0;
*((_DWORD *)v28 + 138) = 1065353216;
qword_1009A2C38 = (__int64)v28;
p_shortStorage = (SFXSearchResult *)v28;
MusicDownloadManager::init((MusicDownloadManager *)v28);
v27 = qword_1009A2C38;
}
m_sfxObjects = sub_10071F9E0(p_shortStorage, *(_QWORD *)&a2);
v29 = *(_QWORD *)(v27 + 392);
if ( v29 )
{
v30 = *(_QWORD *)(v29 + 56);
while ( v30 )
{
v31 = *(_QWORD *)(v30 + 264);
v30 = *(_QWORD *)(v30 + 288);
if ( !*(_BYTE *)(v31 + 72) )
sub_10071FCD0(m_sfxObjects, v31);
}
}
goto LABEL_55;
}
v20 = p_m_searchQuery->m_data.m_short.sizex2;
if ( (v20 & 1) != 0 )
{
if ( v3->m_searchQuery.m_data.m_long.size )
{
LABEL_26:
if ( m_folderObject->m_sfxID == 1 )
{
v21 = qword_1009A2C38;
if ( !qword_1009A2C38 )
{
v22 = (char *)operator new(0x230u);
cocos2d::CCNode::CCNode((__int64)v22);
*(_QWORD *)v22 = off_100970158;
*((_QWORD *)v22 + 40) = off_1009704D8;
v2 = 0;
*((_OWORD *)v22 + 28) = 0;
*(_OWORD *)(v22 + 328) = 0;
*(_OWORD *)(v22 + 344) = 0;
*((_DWORD *)v22 + 90) = 0;
*((_OWORD *)v22 + 23) = 0;
*((_OWORD *)v22 + 24) = 0;
*((_OWORD *)v22 + 25) = 0;
v22[416] = 0;
*(_OWORD *)(v22 + 424) = 0;
*((_QWORD *)v22 + 55) = v22 + 448;
*((_OWORD *)v22 + 30) = 0;
*((_OWORD *)v22 + 31) = 0;
*((_QWORD *)v22 + 58) = 0;
*(_QWORD *)(v22 + 471) = 0;
*((_DWORD *)v22 + 128) = 1065353216;
*(_OWORD *)(v22 + 520) = 0;
*(_OWORD *)(v22 + 536) = 0;
*((_DWORD *)v22 + 138) = 1065353216;
qword_1009A2C38 = (__int64)v22;
p_shortStorage = (SFXSearchResult *)v22;
MusicDownloadManager::init((MusicDownloadManager *)v22);
v21 = qword_1009A2C38;
}
m_sfxObjects = sub_10071F9E0(p_shortStorage, *(_QWORD *)&a2);
v24 = *(_QWORD *)(v21 + 392);
if ( v24 )
{
v25 = *(_QWORD *)(v24 + 56);
while ( v25 )
{
v26 = *(_QWORD *)(v25 + 264);
v25 = *(_QWORD *)(v25 + 288);
if ( !*(_BYTE *)(v26 + 72) )
sub_10071FCD0(m_sfxObjects, v26);
}
}
}
else
{
v32 = sub_10071F9E0(p_shortStorage, *(_QWORD *)&a2);
v33 = sub_10071FA80(v3->m_folderObject);
for ( i = v33; (unsigned int)sub_100720070(i); i = v33 )
{
v35 = sub_1007200E0(v33);
sub_100720200(v33, 1);
v36 = *(_QWORD *)(v35 + 104);
if ( v36 )
{
v37 = *(unsigned int **)(v36 + 56);
if ( *v37 )
{
v38 = *((__int64 **)v37 + 2);
v39 = (unsigned __int64)&v38[*v37 - 1];
do
{
v40 = *v38;
if ( !*v38 )
break;
v41 = v33;
if ( !*(_BYTE *)(v40 + 72) )
v41 = v32;
sub_10071FCD0(v41, v40);
++v38;
}
while ( (unsigned __int64)v38 <= v39 );
}
}
}
FilesMatchingSearch = (cocos2d::CCObject *)v32;
if ( v32 )
{
LABEL_60:
v47 = p_m_searchQuery->m_data.m_short.sizex2;
if ( (v47 & 1) != 0 )
{
if ( !v3->m_searchQuery.m_data.m_long.size )
{
LABEL_118:
if ( (unsigned int)sub_100720070(FilesMatchingSearch) >= 2 )
{
if ( (unsigned int)(v88 - 1) > 4 )
v78 = (int (__cdecl *)(const void *, const void *))sub_100589880;
else
v78 = (int (__cdecl *)(const void *, const void *))off_100970BB8[v88 - 1];
qsort(FilesMatchingSearch[1].~CCObject_0, (size_t)FilesMatchingSearch[1].copyWithZone, 8u, v78);
}
m_filterObjects = v3->m_filterObjects;
if ( m_filterObjects != FilesMatchingSearch )
{
if ( FilesMatchingSearch )
{
cocos2d::CCObject::retain(FilesMatchingSearch);
m_filterObjects = v3->m_filterObjects;
}
if ( m_filterObjects )
cocos2d::CCObject::release(m_filterObjects);
v3->m_filterObjects = (cocos2d::CCArray *)FilesMatchingSearch;
}
return;
}
}
else if ( !(v47 >> 1) )
{
goto LABEL_118;
}
if ( FilesMatchingSearch )
{
v48 = FilesMatchingSearch[1].__vftable;
copyWithZone_low = LODWORD(v48->copyWithZone);
if ( LODWORD(v48->copyWithZone) )
{
v50 = (unsigned __int64)v48->~CCObject_0;
v51 = v50 + 8 * copyWithZone_low - 8;
do
{
if ( !*(_QWORD *)v50 )
break;
*(_BYTE *)(*(_QWORD *)v50 + 73LL) = 0;
v50 += 8LL;
}
while ( v50 <= v51 );
}
}
v52 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v52, "0147");
v54 = p_m_searchQuery;
if ( !GameVariable || !v3->m_folderObject )
{
LABEL_113:
if ( (v54->m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&v82,
v3->m_searchQuery.m_data.m_long.longStorage,
v3->m_searchQuery.m_data.m_long.size,
*(double *)v2.i64);
}
else
{
v83 = v54->m_data.m_long.longStorage;
v2 = *(__m128 *)&v54->m_data.m_short.sizex2;
v82 = *(__m128 *)&v54->m_data.m_short.sizex2;
}
FilesMatchingSearch = (cocos2d::CCObject *)MusicSearchResult::getFilesMatchingSearch(
(__int64)v3,
(__int64)FilesMatchingSearch,
(__int64)&v82,
v2);
if ( (v82.i8[0] & 1) != 0 )
operator delete(v83);
goto LABEL_118;
}
if ( (p_m_searchQuery->m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(
&v91,
v3->m_searchQuery.m_data.m_long.longStorage,
v3->m_searchQuery.m_data.m_long.size,
*(double *)v2.i64);
v55 = (unsigned __int8)v91;
v86 = FilesMatchingSearch;
if ( (v91 & 1) == 0 )
{
LABEL_73:
v56 = v55 >> 1;
if ( !(v55 >> 1) )
goto LABEL_83;
goto LABEL_77;
}
}
else
{
v92 = p_m_searchQuery->m_data.m_long.longStorage;
v2 = *(__m128 *)&p_m_searchQuery->m_data.m_short.sizex2;
v91 = *(_OWORD *)&p_m_searchQuery->m_data.m_short.sizex2;
v55 = (unsigned __int8)v91;
v86 = FilesMatchingSearch;
if ( (v91 & 1) == 0 )
goto LABEL_73;
}
v56 = DWORD2(v91);
if ( !DWORD2(v91) )
{
LABEL_83:
v61 = sub_10071FA80(v3->m_folderObject);
v80 = v3;
while ( 1 )
{
FilesMatchingSearch = v86;
if ( !(unsigned int)sub_100720070(v61) )
{
if ( (v91 & 1) != 0 )
operator delete(v92);
v54 = p_m_searchQuery;
goto LABEL_113;
}
v62 = sub_1007200E0(v61);
sub_100720200(v61, 1);
SFXInfoObject::getLowerCaseName(v84, v62, *(double *)v2.i64);
v63 = 1;
if ( *(_BYTE *)(v62 + 73) )
{
LABEL_89:
v68 = *(_QWORD *)(v62 + 104);
v3 = v80;
if ( !v68 )
goto LABEL_102;
LABEL_96:
v71 = *(unsigned int **)(v68 + 56);
if ( *v71 )
{
v72 = *((__int64 **)v71 + 2);
v73 = (unsigned __int64)&v72[*v71 - 1];
do
{
v74 = *v72;
if ( !*v72 )
break;
*(_BYTE *)(v74 + 73) = v63;
if ( *(_BYTE *)(v74 + 72) == 1 )
sub_10071FCD0(v61, v74);
++v72;
}
while ( (unsigned __int64)v72 <= v73 );
}
goto LABEL_102;
}
if ( ((__int64)v84[0] & 1) != 0 )
{
v64 = (char *)__p;
v65 = (char *)v84[1];
v66 = (unsigned __int8)v91;
if ( (v91 & 1) == 0 )
goto LABEL_88;
}
else
{
v65 = (char *)(LOBYTE(v84[0]) >> 1);
v64 = (char *)v84 + 1;
v66 = (unsigned __int8)v91;
if ( (v91 & 1) == 0 )
{
LABEL_88:
v67 = v66 >> 1;
__s2 = (char *)&v91 + 1;
if ( !v67 )
goto LABEL_89;
goto LABEL_93;
}
}
__s2 = v92;
v67 = *((_QWORD *)&v91 + 1);
if ( !*((_QWORD *)&v91 + 1) )
goto LABEL_89;
LABEL_93:
v69 = &v65[(_QWORD)v64];
v81 = v64;
if ( (__int64)v65 >= v67 )
{
__c = *(char *)__s2;
v75 = v64;
do
{
v76 = (size_t)&v65[-v67 + 1];
if ( !v76 )
break;
v77 = (char *)memchr(v75, __c, v76);
if ( !v77 )
break;
v70 = v77;
if ( !memcmp(v77, __s2, v67) )
goto LABEL_95;
v75 = v70 + 1;
v65 = (char *)(v69 - (_BYTE *)v75);
}
while ( v69 - (_BYTE *)v75 >= v67 );
}
v70 = v69;
LABEL_95:
v63 = v70 != v69 && v70 - v81 != -1;
v68 = *(_QWORD *)(v62 + 104);
v3 = v80;
if ( v68 )
goto LABEL_96;
LABEL_102:
if ( ((__int64)v84[0] & 1) != 0 )
operator delete(__p);
}
}
LABEL_77:
v57 = 0;
do
{
v58 = (char *)&v91 + 1;
if ( (v91 & 1) != 0 )
v58 = (char *)v92;
v59 = __tolower(v58[v57]);
v60 = (char *)&v91 + 1;
if ( (v91 & 1) != 0 )
v60 = (char *)v92;
v60[v57++] = v59;
}
while ( v56 != v57 );
goto LABEL_83;
}
m_sfxObjects = 0;
}
LABEL_55:
v43 = sub_100720070(m_sfxObjects);
FilesMatchingSearch = (cocos2d::CCObject *)sub_10071FD00(v43);
if ( m_sfxObjects )
{
v44 = *(unsigned int **)(m_sfxObjects + 56);
if ( *v44 )
{
v45 = *((_QWORD **)v44 + 2);
v46 = (unsigned __int64)&v45[*v44 - 1];
do
{
if ( !*v45 )
break;
sub_10071FCD0(FilesMatchingSearch, *v45++);
}
while ( (unsigned __int64)v45 <= v46 );
}
}
goto LABEL_60;
}
}
else if ( v20 >> 1 )
{
goto LABEL_26;
}
m_sfxObjects = (__int64)m_folderObject->m_sfxObjects;
goto LABEL_55;
}
LABEL_16:
v13 = atoi((const char *)p_shortStorage);
p_shortStorage = v10;
v14 = cocos2d::CCDictionary::objectForKey((cocos2d::CCDictionary *)v10, v13);
v15 = (unsigned int)a2;
if ( !v14 )
goto LABEL_23;
v16 = (cocos2d::CCObject *)sub_10071FA80(v14);
v17 = v3->m_filterObjects;
if ( v17 != v16 )
{
v18 = (cocos2d::CCArray *)v16;
if ( v16 )
{
cocos2d::CCObject::retain(v16);
v17 = v3->m_filterObjects;
}
if ( v17 )
cocos2d::CCObject::release(v17);
v3->m_filterObjects = v18;
}
}