//
// MusicSearchResult::updateObjects_1 from 0x100599e80 to 0x10059a171 (753 bytes)
//
// 1 xrefs:
// > ??> @ 0x100970988
//
// 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 MusicSearchResult::updateObjects_1(MusicSearchResult *a1, AudioSortType a2)
{
double v2; // xmm0_8
__int64 v4; // r14
char *v5; // r15
GJSongType m_songType; // r12d
unsigned int v7; // eax
cocos2d::CCArray *v8; // r15
__int64 v9; // rax
__int64 v10; // r14
__int64 v11; // r13
__int64 v12; // rsi
__int64 v13; // r14
__int64 v14; // rsi
std::uint8_t sizex2; // al
cocos2d::CCArray *FilesMatchingSearch; // rsi
std::size_t size; // rdx
cocos2d::CCArray *v18; // rax
cocos2d::CCArray *v19; // r12
int (__cdecl *v20)(const void *, const void *); // rdx
int (__cdecl *v21)(const void *, const void *); // rcx
cocos2d::CCArray *m_filterObjects; // rdi
__int128 v23; // [rsp+0h] [rbp-50h] BYREF
void *__p; // [rsp+10h] [rbp-40h]
AudioSortType v25; // [rsp+24h] [rbp-2Ch]
a1->m_sortType = a2;
v4 = qword_1009A2C38;
if ( !qword_1009A2C38 )
{
v5 = (char *)operator new(0x230u);
cocos2d::CCNode::CCNode((__int64)v5);
*(_QWORD *)v5 = off_100970158;
*((_QWORD *)v5 + 40) = off_1009704D8;
v2 = 0.0;
*((_OWORD *)v5 + 28) = 0;
*(_OWORD *)(v5 + 328) = 0;
*(_OWORD *)(v5 + 344) = 0;
*((_DWORD *)v5 + 90) = 0;
*((_OWORD *)v5 + 23) = 0;
*((_OWORD *)v5 + 24) = 0;
*((_OWORD *)v5 + 25) = 0;
v5[416] = 0;
*(_OWORD *)(v5 + 424) = 0;
*((_QWORD *)v5 + 55) = v5 + 448;
*((_OWORD *)v5 + 30) = 0;
*((_OWORD *)v5 + 31) = 0;
*((_QWORD *)v5 + 58) = 0;
*(_QWORD *)(v5 + 471) = 0;
*((_DWORD *)v5 + 128) = 1065353216;
*(_OWORD *)(v5 + 520) = 0;
*(_OWORD *)(v5 + 536) = 0;
*((_DWORD *)v5 + 138) = 1065353216;
qword_1009A2C38 = (__int64)v5;
MusicDownloadManager::init((MusicDownloadManager *)v5);
v4 = qword_1009A2C38;
}
v25 = a2;
m_songType = a1->m_songType;
v7 = cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(v4 + 424));
v8 = (cocos2d::CCArray *)sub_10071FD00(v7);
v9 = *(_QWORD *)(v4 + 424);
if ( v9 )
{
v10 = *(_QWORD *)(v9 + 56);
if ( v10 )
{
v11 = *(_QWORD *)(v10 + 288);
if ( m_songType == Music )
{
sub_10071FCD0(v8, *(_QWORD *)(v10 + 264));
while ( v11 )
{
v14 = *(_QWORD *)(v11 + 264);
v11 = *(_QWORD *)(v11 + 288);
sub_10071FCD0(v8, v14);
}
}
else
{
v12 = *(_QWORD *)(v10 + 264);
v13 = *(_QWORD *)(v10 + 288);
if ( *(_DWORD *)(v12 + 472) != m_songType )
goto LABEL_8;
LABEL_7:
sub_10071FCD0(v8, v12);
LABEL_8:
while ( v13 )
{
v12 = *(_QWORD *)(v13 + 264);
v13 = *(_QWORD *)(v13 + 288);
if ( *(_DWORD *)(v12 + 472) == m_songType )
goto LABEL_7;
}
}
}
}
MusicSearchResult::createTagFilterObjects(a1);
MusicSearchResult::createArtistFilterObjects(a1);
sizex2 = a1->m_searchQuery.m_data.m_short.sizex2;
if ( (sizex2 & 1) != 0 )
{
size = a1->m_searchQuery.m_data.m_long.size;
FilesMatchingSearch = v8;
if ( !size )
goto LABEL_20;
sub_100006B70(&v23, a1->m_searchQuery.m_data.m_long.longStorage, size, v2);
}
else
{
FilesMatchingSearch = v8;
if ( !sizex2 )
goto LABEL_20;
__p = a1->m_searchQuery.m_data.m_long.longStorage;
v23 = *(_OWORD *)&a1->m_searchQuery.m_data.m_short.sizex2;
}
FilesMatchingSearch = (cocos2d::CCArray *)MusicSearchResult::getFilesMatchingSearch(a1, v8, &v23);
if ( (v23 & 1) != 0 )
operator delete(__p);
LABEL_20:
v18 = MusicSearchResult::applyArtistFilters(a1, FilesMatchingSearch);
v19 = MusicSearchResult::applyTagFilters(a1, v18);
MusicSearchResult::updateFutureCount(a1, v19, v8);
if ( (unsigned int)sub_100720070(v19) >= 2 )
{
v20 = (int (__cdecl *)(const void *, const void *))sub_1005895E0;
if ( v25 == SongOrder )
v20 = (int (__cdecl *)(const void *, const void *))sub_100589610;
v21 = (int (__cdecl *)(const void *, const void *))sub_100589640;
if ( v25 )
v21 = v20;
qsort(v19->data->arr, v19->data->num, 8u, v21);
}
m_filterObjects = a1->m_filterObjects;
if ( m_filterObjects != v19 )
{
if ( v19 )
{
cocos2d::CCObject::retain(v19);
m_filterObjects = a1->m_filterObjects;
}
if ( m_filterObjects )
cocos2d::CCObject::release(m_filterObjects);
a1->m_filterObjects = v19;
}
}