//
// PlayerObject::pushButton from 0x100227eac to 0x100228110 (612 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::handleButton @ 0x1001fac7c
// > GJBaseGameLayer::handleButton @ 0x1001fad0c
// > PlayerObject::enablePlayerControls @ 0x10022ca18
// > MenuGameLayer::tryJump @ 0x10039ab98
//
// 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 __fastcall PlayerObject::pushButton(PlayerObject *a1, PlayerButton a2)
{
bool result; // w0
__int64 v5; // x0
__int64 v6; // x20
__int64 v7; // x21
__int64 v8; // x20
cocos2d::CCArray *m_touchingRings; // x8
cocos2d::ccArray *data; // x9
__int64 num; // x8
RingObject **arr; // x23
unsigned __int64 v13; // x24
RingObject *v14; // x22
__int64 v15; // x0
unsigned int *v16; // x9
__int64 v17; // x8
RingObject **v18; // x21
unsigned __int64 v19; // x22
unsigned int *v20; // x9
__int64 v21; // x8
RingObject **v22; // x20
unsigned __int64 v23; // x21
PlayerButton v24; // [xsp+0h] [xbp-40h] BYREF
PlayerButton *v25; // [xsp+8h] [xbp-38h] BYREF
if ( !a1->m_inputsLocked )
{
v24 = a2;
v25 = &v24;
*((_BYTE *)sub_1000FE7D8((__int64)&a1->m_holdingButtons, (int *)&v24, (__int64)&unk_10063A946, (_DWORD **)&v25) + 32) = 1;
}
if ( a1->m_isLocked || a1->m_controlsDisabled )
return 0;
if ( a2 == Jump )
{
if ( !a1->m_jumpBuffered )
PlayerObject::placeStreakPoint(a1);
*(_WORD *)&a1->m_jumpBuffered = 257;
a1->m_padRingRelated = 0;
sub_100018054(&a1->m_ringRelatedSet.__table_.__bucket_list_.__ptr_.__value_);
*(_WORD *)&a1->m_stateJumpBuffered = *(_WORD *)&a1->m_jumpBuffered;
*(_DWORD *)&a1->m_touchedRing = 0;
if ( (unsigned int)sub_10024A36C(a1->m_touchingRings) )
{
v5 = sub_10024A36C(a1->m_touchingRings);
if ( (int)v5 >= 1 )
{
v6 = v5;
v7 = sub_10024A300(v5);
v8 = sub_10024A300(v6);
m_touchingRings = a1->m_touchingRings;
if ( m_touchingRings )
{
data = m_touchingRings->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (RingObject **)data->arr;
v13 = (unsigned __int64)&arr[num - 1];
do
{
v14 = *arr;
if ( !*arr )
break;
if ( v14->m_claimTouch )
{
PlayerObject::ringJump(a1, *arr, 0);
a1->m_jumpBuffered = 0;
return 1;
}
if ( ((unsigned int (__fastcall *)(RingObject *))v14->getType)(*arr) == 36 )
v15 = v7;
else
v15 = v8;
sub_10024A2D0(v15, v14);
++arr;
}
while ( (unsigned __int64)arr <= v13 );
}
}
if ( v7 )
{
v16 = *(unsigned int **)(v7 + 56);
v17 = *v16;
if ( (_DWORD)v17 )
{
v18 = *((RingObject ***)v16 + 2);
v19 = (unsigned __int64)&v18[v17 - 1];
do
{
if ( !*v18 )
break;
PlayerObject::ringJump(a1, *v18++, 0);
}
while ( (unsigned __int64)v18 <= v19 );
}
}
if ( v8 )
{
v20 = *(unsigned int **)(v8 + 56);
v21 = *v20;
if ( (_DWORD)v21 )
{
v22 = *((RingObject ***)v20 + 2);
v23 = (unsigned __int64)&v22[v21 - 1];
while ( *v22 )
{
PlayerObject::ringJump(a1, *v22++, 0);
result = 1;
if ( (unsigned __int64)v22 > v23 )
return result;
}
}
}
}
}
else if ( (a1->m_isBall || !a1->m_isShip && !a1->m_isBird && !a1->m_isDart && !a1->m_isSwing && a1->m_jumpBuffered)
&& a1->m_isOnGround )
{
PlayerObject::updateJump(a1, 0.0);
}
}
else if ( (a2 & 0xFFFFFFFE) == 2 )
{
PlayerObject::switchedDirTo(a1, a2);
}
return 1;
}