//
// MusicSearchResult::getFilesMatchingSearch from 0x459168 to 0x459286 (286 bytes)
//
// 2 xrefs:
// > MusicSearchResult::updateObjects @ 0x45b4a2
// > SFXSearchResult::updateObjects @ 0x45d9a6
//
// 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
//
cocos2d::CCArray *__fastcall MusicSearchResult::getFilesMatchingSearch(cocos2d::CCArray *a1, int a2)
{
int v4; // r5
cocos2d::CCArray *v5; // r9
int v6; // r10
int v7; // r6
int *v9; // r3
int v10; // r6
int *v11; // r3
unsigned int v12; // r11
int *v13; // r10
int v14; // r6
int v15; // t1
int v16; // r8
int v17; // r7
unsigned int m_uReference; // [sp+0h] [bp-24h]
int v19; // [sp+4h] [bp-20h]
int v20; // [sp+8h] [bp-1Ch]
int v21; // [sp+14h] [bp-10h] BYREF
int v22; // [sp+18h] [bp-Ch] BYREF
v4 = 0;
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(a1);
sub_775C20(&v21);
v6 = *(_DWORD *)(v21 - 12);
while ( v4 != v6 )
{
sub_775170(&v21);
v7 = v21;
sub_775170(&v21);
*(_BYTE *)(v7 + v4) = tolower(*(unsigned __int8 *)(v21 + v4));
++v4;
}
m_uReference = a1[1].m_uReference;
if ( a2 )
{
v9 = *(int **)(a2 + 52);
v10 = *v9;
if ( *v9 )
{
v11 = (int *)v9[3];
v12 = (unsigned int)&v11[v10 - 1];
v13 = v11;
while ( (unsigned int)v13 <= v12 )
{
v15 = *v13++;
v14 = v15;
if ( !v15 )
break;
if ( m_uReference == 1 )
v16 = *(unsigned __int8 *)(v14 + 69);
else
v16 = 0;
sub_775C20(&v22);
v17 = 0;
v19 = *(_DWORD *)(v22 - 12);
while ( v17 != v19 )
{
sub_775170(&v22);
v20 = v22;
sub_775170(&v22);
*(_BYTE *)(v20 + v17) = tolower(*(unsigned __int8 *)(v22 + v17));
++v17;
}
if ( v16 || sub_774834(&v22, &v21, 0) != -1 )
cocos2d::CCArray::addObject(v5, (cocos2d::CCObject *)v14);
sub_774008(&v22);
}
}
}
sub_774008(&v21);
return v5;
}