//
// SelectEventLayer::onCustomToggleTriggerValue from 0x100409028 to 0x10040914c (292 bytes)
//
// 1 xrefs:
// > ??> @ 0x1008188e0
//
// 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 __fastcall SelectEventLayer::onCustomToggleTriggerValue(SelectEventLayer *a1, cocos2d::CCObject *a2)
{
int v4; // w0
std::__tree_end_node *>::pointer left; // x8
int v6; // w9
cocos2d::CCDictionary *m_customValueToggles; // x8
cocos2d::CCDictElement *m_pElements; // x21
CCMenuItemToggler *m_pObject; // x20
int v10; // w0
std::__tree_end_node *>::pointer v11; // x8
int v12; // w9
bool v13; // w1
int v14; // [xsp+8h] [xbp-28h] BYREF
int v15; // [xsp+Ch] [xbp-24h] BYREF
if ( !a2 )
goto LABEL_9;
a1->m_eventsChanged = 1;
v4 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
left = a1->m_eventIDs.__tree_.__pair1_.__value_.__left_;
if ( !left )
{
LABEL_7:
v14 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
sub_1000B4D20((__int64)&a1->m_eventIDs, &v14, &v14);
goto LABEL_9;
}
while ( 1 )
{
v6 = *((_DWORD *)left + 7);
if ( v4 >= v6 )
break;
LABEL_6:
left = *(std::__tree_end_node *>::pointer *)left;
if ( !left )
goto LABEL_7;
}
if ( v6 < v4 )
{
left = (std::__tree_end_node *>::pointer)((char *)left + 8);
goto LABEL_6;
}
v15 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
sub_10004C07C(&a1->m_eventIDs.__tree_.__begin_node_, &v15);
LABEL_9:
m_customValueToggles = a1->m_customValueToggles;
if ( !m_customValueToggles )
return;
m_pElements = m_customValueToggles->m_pElements;
if ( !m_pElements )
return;
while ( 2 )
{
m_pObject = (CCMenuItemToggler *)m_pElements->m_pObject;
m_pElements = (cocos2d::CCDictElement *)m_pElements->hh.next;
v10 = ((__int64 (__fastcall *)(CCMenuItemToggler *))m_pObject->getTag)(m_pObject);
v11 = a1->m_eventIDs.__tree_.__pair1_.__value_.__left_;
if ( !v11 )
{
LABEL_16:
v13 = 0;
goto LABEL_18;
}
while ( 2 )
{
v12 = *((_DWORD *)v11 + 7);
if ( v10 < v12 )
{
LABEL_15:
v11 = *(std::__tree_end_node *>::pointer *)v11;
if ( !v11 )
goto LABEL_16;
continue;
}
break;
}
if ( v12 < v10 )
{
v11 = (std::__tree_end_node *>::pointer)((char *)v11 + 8);
goto LABEL_15;
}
v13 = 1;
LABEL_18:
CCMenuItemToggler::toggle(m_pObject, v13);
if ( m_pElements )
continue;
break;
}
}