//
// GJEffectManager::countForItem from 0x8a57b0 to 0x8a5840 (144 bytes)
//
// 10 xrefs:
// > GJBaseGameLayer::testInstantCountTrigger @ 0x8653b4
// > GJBaseGameLayer::getItemValue @ 0x86549c
// > GJBaseGameLayer::refreshCounterLabels @ 0x890294
// > GJBaseGameLayer::collectedObject @ 0x890eb0
// > GJBaseGameLayer::addPickupTrigger @ 0x890f30
// > GJBaseGameLayer::addPickupTrigger @ 0x890f58
// > GJBaseGameLayer::addPickupTrigger @ 0x890f8c
// > GJEffectManager::runCountTrigger @ 0x8aff14
// > GJEffectManager::updateCountForItem @ 0x8bcd38
// > ??> @ 0x9f570
//
// 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
//
int GJEffectManager::countForItem(GJEffectManager *a1, int a2)
{
unsigned __int64 v2; // x7
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
unsigned __int64 v4; // x7
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 v5; // x6
std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_base *M_nxt; // x3
int v7; // w5
std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_base v8; // x0
std::__detail::_Hash_node_base *v9; // x0
if ( a2 > 9998 )
{
v2 = 9999;
a2 = 9999;
}
else
{
if ( a2 < 0 )
a2 = 0;
v2 = a2;
}
M_bucket_count = a1->m_itemCountMap._M_h._M_bucket_count;
v4 = v2 % M_bucket_count;
v5 = a1->m_itemCountMap._M_h._M_buckets[v4];
if ( v5 )
{
M_nxt = v5->_M_nxt;
v7 = (int)v5->_M_nxt[1]._M_nxt;
while ( a2 != v7 )
{
v8._M_nxt = M_nxt->_M_nxt;
v5 = M_nxt;
M_nxt = v8._M_nxt;
if ( v8._M_nxt )
{
v7 = (int)v8._M_nxt[1]._M_nxt;
if ( v4 == v7 % M_bucket_count )
continue;
}
goto LABEL_10;
}
v9 = v5->_M_nxt;
if ( v5->_M_nxt )
LODWORD(v9) = HIDWORD(v9[1]._M_nxt);
}
else
{
LABEL_10:
LODWORD(v9) = 0;
}
return (int)v9;
}