//
// GameManager::isIconLoaded from 0x5f1a64 to 0x5f1b68 (260 bytes)
//
// 3 xrefs:
// > SimplePlayer::asyncLoadIcon @ 0x792edc
// > GJItemIcon::init @ 0x794680
// > ??> @ 0x82d58
//
// 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; // w19
std::_rb_tree_base *m_parent; // x0
std::_rb_tree_base *p_m_header; // x22
std::_rb_tree_base *v7; // x20
std::map *p_m_iconLoadCounts; // x21
__int64 insert_hint_unique_pos; // x0
__int64 v10; // x1
std::_rb_tree_base *v11; // x3
_BOOL8 v12; // x0
std::_rb_tree_base *v14; // x0
__int64 v15; // [xsp+38h] [xbp+38h]
v4 = GameManager::keyForIcon(a1, a2, a3);
m_parent = a1->m_iconLoadCounts.m_header.m_parent;
p_m_header = &a1->m_iconLoadCounts.m_header;
v7 = &a1->m_iconLoadCounts.m_header;
if ( !m_parent )
goto LABEL_6;
do
{
while ( v4 <= *(_DWORD *)&m_parent[1].m_isblack )
{
v7 = m_parent;
m_parent = m_parent->m_left;
if ( !m_parent )
goto LABEL_4;
}
m_parent = m_parent->m_right;
}
while ( m_parent );
LABEL_4:
if ( p_m_header == v7 || v4 < *(_DWORD *)&v7[1].m_isblack )
{
LABEL_6:
v15 = (__int64)v7;
p_m_iconLoadCounts = &a1->m_iconLoadCounts;
v7 = (std::_rb_tree_base *)operator new(0x28u);
*(_DWORD *)&v7[1].m_isblack = v4;
*((_DWORD *)&v7[1].m_isblack + 1) = 0;
insert_hint_unique_pos = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
p_m_iconLoadCounts,
v15,
(int *)&v7[1].m_isblack);
v11 = (std::_rb_tree_base *)insert_hint_unique_pos;
if ( v10 )
{
v12 = insert_hint_unique_pos
|| p_m_header == (std::_rb_tree_base *)v10
|| *(_DWORD *)&v7[1].m_isblack < *(_DWORD *)(v10 + 32);
sub_CFAD74(v12, v7, v10, p_m_header);
++p_m_iconLoadCounts->m_nodecount;
}
else
{
v14 = v7;
v7 = v11;
operator delete(v14);
}
}
return *((_DWORD *)&v7[1].m_isblack + 1) > 0;
}