//
// DrawGridLayer::removeAudioLineObject from 0x665344 to 0x66547c (312 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::removeSpecial @ 0x665628
// > ??> @ 0x63b70
//
// 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 DrawGridLayer::removeAudioLineObject(DrawGridLayer *a1, AudioLineGuideGameObject *a2)
{
int m_uniqueID; // w8
std::_Hashtable, std::allocator>, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits>::size_type M_bucket_count; // x4
std::_Hashtable, std::allocator>, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits>::__bucket_type *M_buckets; // x10
unsigned __int64 v5; // x6
std::_Hashtable, std::allocator>, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits>::__bucket_type v6; // x9
DrawGridLayer **v7; // x12
std::__detail::_Hash_node_base *M_nxt; // x3
std::__detail::_Hash_node_base *v9; // x7
int v10; // w5
std::__detail::_Hash_node_base *v11; // x1
std::__detail::_Hash_node_base *v12; // x2
std::__detail::_Hash_node_base *v13; // x1
unsigned __int64 v14; // x4
std::unordered_map *p_m_audioLineObjects; // x19
unsigned __int64 v16; // x4
DrawGridLayer *v17; // x4
m_uniqueID = a2->m_uniqueID;
M_bucket_count = a1->m_audioLineObjects._M_h._M_bucket_count;
M_buckets = a1->m_audioLineObjects._M_h._M_buckets;
v5 = m_uniqueID % M_bucket_count;
v6 = M_buckets[v5];
v7 = (DrawGridLayer **)&M_buckets[v5];
if ( v6 )
{
M_nxt = v6->_M_nxt;
v9 = M_buckets[v5];
v10 = (int)v6->_M_nxt[1]._M_nxt;
while ( m_uniqueID != v10 )
{
v11 = M_nxt->_M_nxt;
v9 = M_nxt;
M_nxt = v11;
if ( v11 )
{
v10 = (int)v11[1]._M_nxt;
if ( v5 == v10 % M_bucket_count )
continue;
}
return;
}
v12 = v9->_M_nxt;
if ( v6 != v9 )
{
v13 = v12->_M_nxt;
if ( v12->_M_nxt )
{
v14 = SLODWORD(v13[1]._M_nxt) % M_bucket_count;
if ( v5 != v14 )
{
M_buckets[v14] = v9;
p_m_audioLineObjects = &a1->m_audioLineObjects;
v13 = v12->_M_nxt;
LABEL_11:
v9->_M_nxt = v13;
operator delete(v12);
--p_m_audioLineObjects->_M_h._M_element_count;
return;
}
}
LABEL_14:
p_m_audioLineObjects = &a1->m_audioLineObjects;
goto LABEL_11;
}
v13 = v12->_M_nxt;
if ( v12->_M_nxt )
{
v16 = SLODWORD(v13[1]._M_nxt) % M_bucket_count;
if ( v5 == v16 )
goto LABEL_14;
M_buckets[v16] = v9;
v7 = (DrawGridLayer **)&a1->m_audioLineObjects._M_h._M_buckets[v5];
v17 = *v7;
}
else
{
v17 = (DrawGridLayer *)v9;
}
p_m_audioLineObjects = &a1->m_audioLineObjects;
if ( v17 == (DrawGridLayer *)&a1->m_audioLineObjects._M_h._M_before_begin )
a1->m_audioLineObjects._M_h._M_before_begin._M_nxt = v13;
*v7 = nullptr;
v13 = v12->_M_nxt;
goto LABEL_11;
}
}