//
// GameManager::isIconLoaded from 0x324db0 to 0x324e48 (152 bytes)
//
// 2 xrefs:
// > SimplePlayer::asyncLoadIcon @ 0x403b28
// > GJItemIcon::init @ 0x4047ca
//
// 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
//
bool GameManager::isIconLoaded(GameManager *a1, int a2, int a3)
{
int v4; // r0
std::_rb_tree_base *p_m_header; // r8
std::_rb_tree_base *m_parent; // r3
std::_rb_tree_base *v7; // r4
int v8; // r7
std::_rb_tree_base *m_left; // r2
int *v10; // r0
std::_rb_tree_base *v11; // r5
_BOOL4 v12; // r0
GameManager *v14; // [sp+0h] [bp-8h] BYREF
int v15; // [sp+4h] [bp-4h]
v14 = a1;
v15 = a2;
v4 = GameManager::keyForIcon(a1, a2, a3);
p_m_header = &a1->m_iconLoadCounts.m_header;
m_parent = a1->m_iconLoadCounts.m_header.m_parent;
v7 = &a1->m_iconLoadCounts.m_header;
v8 = v4;
while ( m_parent )
{
if ( *(_DWORD *)&m_parent[1].m_isblack >= v4 )
{
m_left = m_parent->m_left;
}
else
{
m_left = m_parent->m_right;
m_parent = v7;
}
v7 = m_parent;
m_parent = m_left;
}
if ( v7 == p_m_header || v4 < *(_DWORD *)&v7[1].m_isblack )
{
v10 = (int *)operator new(0x18u);
v10[5] = 0;
v11 = (std::_rb_tree_base *)v10;
v10[4] = v8;
std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
(int *)&v14,
&a1->m_iconLoadCounts.compare.pad,
v7,
v10 + 4);
v7 = (std::_rb_tree_base *)v14;
if ( v15 )
{
v12 = v14 || (std::_rb_tree_base *)v15 == p_m_header || v8 < *(_DWORD *)(v15 + 16);
sub_7620E8(v12, v11, v15, &a1->m_iconLoadCounts.m_header);
v7 = v11;
++a1->m_iconLoadCounts.m_nodecount;
}
else
{
operator delete(v11);
}
}
return (int)v7[1].m_parent > 0;
}