//
// PlayerObject::pushButton from 0x63c800 to 0x63cb68 (872 bytes)
//
// 5 xrefs:
// > PlayerObject::enablePlayerControls @ 0x63cd98
// > MenuGameLayer::tryJump @ 0x6c8c5c
// > GJBaseGameLayer::handleButton @ 0x88c96c
// > GJBaseGameLayer::handleButton @ 0x88c980
// > ??> @ 0x4a130
//
// 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 PlayerObject::pushButton(PlayerObject *a1, PlayerButton a2)
{
bool result; // w0
std::_rb_tree_base *m_parent; // x0
std::_rb_tree_base *p_m_header; // x22
std::_rb_tree_base *v7; // x21
__int64 insert_hint_unique_pos; // x0
__int64 v9; // x1
std::_rb_tree_base *v10; // x3
_BOOL8 v11; // x0
std::__detail::_Hash_node_base *M_nxt; // x0
std::__detail::_Hash_node_base *v13; // x20
cocos2d::CCArray *v14; // x0
unsigned int v15; // w1
unsigned int v16; // w20
cocos2d::CCArray *v17; // x24
unsigned int v18; // w1
cocos2d::CCArray *v19; // x22
cocos2d::CCArray *m_touchingRings; // x0
cocos2d::ccArray *data; // x1
RingObject **arr; // x21
RingObject **i; // x23
RingObject *v24; // x20
cocos2d::ccArray *v25; // x1
RingObject **v26; // x20
__int64 v27; // x0
char *v28; // x21
RingObject *v29; // x1
cocos2d::ccArray *v30; // x1
RingObject **v31; // x20
__int64 v32; // x0
char *v33; // x21
RingObject *v34; // x1
std::_rb_tree_base *v35; // x0
__int64 v36; // [xsp+48h] [xbp+48h]
if ( !a1->m_inputsLocked )
{
m_parent = a1->m_holdingButtons.m_header.m_parent;
p_m_header = &a1->m_holdingButtons.m_header;
v7 = &a1->m_holdingButtons.m_header;
if ( !m_parent )
goto LABEL_14;
do
{
while ( a2 <= *(_DWORD *)&m_parent[1].m_isblack )
{
v7 = m_parent;
m_parent = m_parent->m_left;
if ( !m_parent )
goto LABEL_12;
}
m_parent = m_parent->m_right;
}
while ( m_parent );
LABEL_12:
if ( p_m_header == v7 || a2 < *(_DWORD *)&v7[1].m_isblack )
{
LABEL_14:
v36 = (__int64)v7;
v7 = (std::_rb_tree_base *)operator new(0x28u);
*(_DWORD *)&v7[1].m_isblack = a2;
*(&v7[1].m_isblack + 4) = 0;
insert_hint_unique_pos = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
&a1->m_holdingButtons.compare.pad,
v36,
(int *)&v7[1].m_isblack);
v10 = (std::_rb_tree_base *)insert_hint_unique_pos;
if ( v9 )
{
v11 = insert_hint_unique_pos
|| p_m_header == (std::_rb_tree_base *)v9
|| *(_DWORD *)&v7[1].m_isblack < *(_DWORD *)(v9 + 32);
sub_CFAD74(v11, v7, v9, &a1->m_holdingButtons.m_header);
++a1->m_holdingButtons.m_nodecount;
}
else
{
v35 = v7;
v7 = v10;
operator delete(v35);
}
}
*(&v7[1].m_isblack + 4) = 1;
}
result = a1->m_isLocked;
if ( result )
return 0;
if ( !a1->m_controlsDisabled )
{
if ( a2 != Jump )
{
if ( (unsigned int)(a2 - 2) <= 1 )
{
PlayerObject::switchedDirTo(a1, a2);
return 1;
}
return 1;
}
if ( !a1->m_jumpBuffered )
PlayerObject::placeStreakPoint(a1);
M_nxt = a1->m_ringRelatedSet._M_h._M_before_begin._M_nxt;
a1->m_padRingRelated = 0;
a1->m_jumpBuffered = 1;
a1->m_stateRingJump = 1;
if ( M_nxt )
{
do
{
v13 = M_nxt->_M_nxt;
operator delete(M_nxt);
M_nxt = v13;
}
while ( v13 );
}
memset(a1->m_ringRelatedSet._M_h._M_buckets, 0, 8 * a1->m_ringRelatedSet._M_h._M_bucket_count);
a1->m_ringRelatedSet._M_h._M_element_count = 0;
a1->m_ringRelatedSet._M_h._M_before_begin._M_nxt = nullptr;
PlayerObject::updateJumpVariables(a1);
if ( (unsigned int)cocos2d::CCArray::count(a1->m_touchingRings) )
{
v14 = (cocos2d::CCArray *)cocos2d::CCArray::count(a1->m_touchingRings);
v16 = (unsigned int)v14;
if ( (int)v14 > 0 )
{
v17 = (cocos2d::CCArray *)cocos2d::CCArray::createWithCapacity(v14, v15);
v19 = (cocos2d::CCArray *)cocos2d::CCArray::createWithCapacity((cocos2d::CCArray *)v16, v18);
m_touchingRings = a1->m_touchingRings;
if ( m_touchingRings )
{
data = m_touchingRings->data;
if ( data->num )
{
arr = (RingObject **)data->arr;
for ( i = &arr[data->num - 1]; i >= arr; ++arr )
{
v24 = *arr;
if ( !*arr )
break;
if ( v24->m_claimTouch )
{
PlayerObject::ringJump(a1, *arr, 0);
a1->m_jumpBuffered = 0;
return 1;
}
if ( v24->getType(*arr) == CustomRing )
cocos2d::CCArray::addObject(v17, v24);
else
cocos2d::CCArray::addObject(v19, v24);
}
}
}
if ( v17 )
{
v25 = v17->data;
if ( v25->num )
{
v26 = (RingObject **)v25->arr;
v27 = 8LL * v25->num - 8;
v28 = (char *)v26 + v27;
if ( v26 <= (RingObject **)((char *)v26 + v27) )
{
do
{
v29 = *v26;
if ( !*v26 )
break;
++v26;
PlayerObject::ringJump(a1, v29, 0);
}
while ( v28 >= (char *)v26 );
}
}
}
if ( v19 )
{
v30 = v19->data;
if ( v30->num )
{
v31 = (RingObject **)v30->arr;
v32 = 8LL * v30->num - 8;
v33 = (char *)v31 + v32;
if ( v31 <= (RingObject **)((char *)v31 + v32) )
{
while ( 1 )
{
v34 = *v31;
if ( !*v31 )
break;
++v31;
PlayerObject::ringJump(a1, v34, 0);
if ( v33 < (char *)v31 )
return 1;
}
}
}
}
}
}
else
{
if ( a1->m_isBall )
{
LABEL_29:
if ( a1->m_isOnGround )
{
PlayerObject::updateJump(a1, 0.0);
return 1;
}
return 1;
}
if ( !PlayerObject::isFlying(a1) )
{
if ( !a1->m_jumpBuffered )
return 1;
goto LABEL_29;
}
}
return 1;
}
return result;
}